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;
44 const struct GNUNET_HELLO_Address *address,
45 struct GNUNET_TIME_Absolute expiration)
47 unsigned int *addr = cls;
56 const struct GNUNET_PeerIdentity *peer,
57 const struct GNUNET_HELLO_Message *hello,
60 static unsigned int calls = 0;
65 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
66 "Error in communication with PEERINFO service: %s\n",
74 GNUNET_HELLO_iterate_addresses (hello,
78 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
79 "Got information about peer %s with %u addresses\n",
86 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
87 "Got no HELLP for peer %s\n",
96 "Failed: got no callbacks!\n");
98 GNUNET_PEERINFO_disconnect (h);
103 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
104 "Got %u HELLOs in total\n",
107 GNUNET_PEERINFO_disconnect (h);
116 const struct GNUNET_CONFIGURATION_Handle *cfg,
117 struct GNUNET_TESTING_Peer *peer)
119 h = GNUNET_PEERINFO_connect (cfg);
120 GNUNET_assert (NULL != h);
121 ic = GNUNET_PEERINFO_iterate (h,
126 GNUNET_assert (NULL != ic);
135 if (0 != GNUNET_TESTING_service_run ("test_peerinfo_shipped_hellos",
137 "test_peerinfo_api_data.conf",
143 /* end of test_peerinfo_shipped_hellos.c */