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
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 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 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 * @file peerinfo/test_peerinfo_shipped_hellos.c
23 * @brief testcase for shipped HELLOs getting parsed
24 * @author Christian Grothoff
25 * @author Matthias Wachs
29 #include "gnunet_hello_lib.h"
30 #include "gnunet_util_lib.h"
31 #include "gnunet_peerinfo_service.h"
32 #include "gnunet_testing_lib.h"
35 static struct GNUNET_PEERINFO_IteratorContext *ic;
37 static struct GNUNET_PEERINFO_Handle *h;
39 static int global_ret;
43 const struct GNUNET_HELLO_Address *address,
44 struct GNUNET_TIME_Absolute expiration)
55 const struct GNUNET_PeerIdentity *peer,
56 const struct GNUNET_HELLO_Message *hello,
59 static unsigned int calls = 0;
64 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
65 _("Error in communication with PEERINFO service\n"));
72 GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO, &addr_cb, &addr);
73 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
74 "Got information about peer `%s' with %u addresses \n",
75 GNUNET_i2s (peer), addr);
79 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
80 "Fail: Got information about peer `%s' without HELLO \n",
88 "Failed: got no callbacks!\n");
93 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
94 "Got %u callbacks\n", calls);
103 const struct GNUNET_CONFIGURATION_Handle *cfg,
104 struct GNUNET_TESTING_Peer *peer)
106 h = GNUNET_PEERINFO_connect (cfg);
107 GNUNET_assert (NULL != h);
108 ic = GNUNET_PEERINFO_iterate (h, GNUNET_YES, NULL,
109 GNUNET_TIME_relative_multiply
110 (GNUNET_TIME_UNIT_SECONDS, 15), &process, cls);
115 main (int argc, char *argv[])
118 if (0 != GNUNET_TESTING_service_run ("test_peerinfo_shipped_hellos",
120 "test_peerinfo_api_data.conf",
126 /* end of test_peerinfo_shipped_hellos.c */