2 This file is part of GNUnet.
3 Copyright (C) 2004, 2009 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
17 * @file peerinfo/test_peerinfo_shipped_hellos.c
18 * @brief testcase for shipped HELLOs getting parsed
19 * @author Christian Grothoff
20 * @author Matthias Wachs
24 #include "gnunet_hello_lib.h"
25 #include "gnunet_util_lib.h"
26 #include "gnunet_peerinfo_service.h"
27 #include "gnunet_testing_lib.h"
30 static struct GNUNET_PEERINFO_IteratorContext *ic;
32 static struct GNUNET_PEERINFO_Handle *h;
34 static int global_ret;
39 const struct GNUNET_HELLO_Address *address,
40 struct GNUNET_TIME_Absolute expiration)
42 unsigned int *addr = cls;
51 const struct GNUNET_PeerIdentity *peer,
52 const struct GNUNET_HELLO_Message *hello,
55 static unsigned int calls = 0;
60 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
61 "Error in communication with PEERINFO service: %s\n",
69 GNUNET_HELLO_iterate_addresses (hello,
73 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
74 "Got information about peer %s with %u addresses\n",
81 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
82 "Got no HELLP for peer %s\n",
91 "Failed: got no callbacks!\n");
93 GNUNET_PEERINFO_disconnect (h);
98 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
99 "Got %u HELLOs in total\n",
102 GNUNET_PEERINFO_disconnect (h);
111 const struct GNUNET_CONFIGURATION_Handle *cfg,
112 struct GNUNET_TESTING_Peer *peer)
114 h = GNUNET_PEERINFO_connect (cfg);
115 GNUNET_assert (NULL != h);
116 ic = GNUNET_PEERINFO_iterate (h,
121 GNUNET_assert (NULL != ic);
130 if (0 != GNUNET_TESTING_service_run ("test_peerinfo_shipped_hellos",
132 "test_peerinfo_api_data.conf",
138 /* end of test_peerinfo_shipped_hellos.c */