aboutsummaryrefslogtreecommitdiff
path: root/src/util/test_resolver_api.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2010-04-01 09:17:55 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2010-04-01 09:17:55 +0000
commitf513c42604b7539368faab72993459fda9d9e711 (patch)
tree364b026f27ba89df1c907f39835b176f2f1df213 /src/util/test_resolver_api.c
parent6de4e547529a948c11423868e768b0a8d39a6cee (diff)
downloadgnunet-f513c42604b7539368faab72993459fda9d9e711.tar.gz
gnunet-f513c42604b7539368faab72993459fda9d9e711.zip
Diffstat (limited to 'src/util/test_resolver_api.c')
-rw-r--r--src/util/test_resolver_api.c310
1 files changed, 144 insertions, 166 deletions
diff --git a/src/util/test_resolver_api.c b/src/util/test_resolver_api.c
index 30b455aed..5802370e3 100644
--- a/src/util/test_resolver_api.c
+++ b/src/util/test_resolver_api.c
@@ -1,22 +1,22 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2009 Christian Grothoff (and other contributing authors) 3 (C) 2009 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your 7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version. 8 option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 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 16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19 */
20/** 20/**
21 * @file resolver/test_resolver_api.c 21 * @file resolver/test_resolver_api.c
22 * @brief testcase for resolver_api.c 22 * @brief testcase for resolver_api.c
@@ -41,7 +41,7 @@
41#define ROOTSERVER_IP "198.41.0.4" 41#define ROOTSERVER_IP "198.41.0.4"
42 42
43static void 43static void
44check_hostname (void *cls, const struct sockaddr *sa, socklen_t salen) 44check_hostname(void *cls, const struct sockaddr *sa, socklen_t salen)
45{ 45{
46 int *ok = cls; 46 int *ok = cls;
47 47
@@ -50,23 +50,21 @@ check_hostname (void *cls, const struct sockaddr *sa, socklen_t salen)
50 (*ok) &= ~8; 50 (*ok) &= ~8;
51 return; 51 return;
52 } 52 }
53 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 53 GNUNET_log(GNUNET_ERROR_TYPE_INFO, _("Got IP address `%s' for our host.\n"),
54 _("Got IP address `%s' for our host.\n"), 54 GNUNET_a2s(sa, salen));
55 GNUNET_a2s (sa, salen));
56} 55}
57 56
58
59static void 57static void
60check_localhost_num (void *cls, const char *hostname) 58check_localhost_num(void *cls, const char *hostname)
61{ 59{
62 int *ok = cls; 60 int *ok = cls;
63 if (hostname == NULL) 61 if (hostname == NULL)
64 return; 62 return;
65 if (0 == strcmp (hostname, "127.0.0.1")) 63 if (0 == strcmp(hostname, "127.0.0.1"))
66 { 64 {
67#if DEBUG_RESOLVER 65#if DEBUG_RESOLVER
68 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 66 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
69 "Received correct hostname `%s'.\n", hostname); 67 "Received correct hostname `%s'.\n", hostname);
70#endif 68#endif
71 (*ok) &= ~4; 69 (*ok) &= ~4;
72 } 70 }
@@ -74,23 +72,23 @@ check_localhost_num (void *cls, const char *hostname)
74 { 72 {
75#if DEBUG_RESOLVER 73#if DEBUG_RESOLVER
76 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 74 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
77 "Received invalid hostname `%s'.\n", hostname); 75 "Received invalid hostname `%s'.\n", hostname);
78#endif 76#endif
79 GNUNET_break (0); 77 GNUNET_break(0);
80 } 78 }
81} 79}
82 80
83static void 81static void
84check_localhost (void *cls, const char *hostname) 82check_localhost(void *cls, const char *hostname)
85{ 83{
86 int *ok = cls; 84 int *ok = cls;
87 if (hostname == NULL) 85 if (hostname == NULL)
88 return; 86 return;
89 if (0 == strcmp (hostname, "localhost")) 87 if (0 == strcmp(hostname, "localhost"))
90 { 88 {
91#if DEBUG_RESOLVER 89#if DEBUG_RESOLVER
92 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 90 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
93 "Received correct hostname `%s'.\n", hostname); 91 "Received correct hostname `%s'.\n", hostname);
94#endif 92#endif
95 (*ok) &= ~2; 93 (*ok) &= ~2;
96 } 94 }
@@ -98,22 +96,22 @@ check_localhost (void *cls, const char *hostname)
98 { 96 {
99#if DEBUG_RESOLVER 97#if DEBUG_RESOLVER
100 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 98 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
101 "Received invalid hostname `%s'.\n", hostname); 99 "Received invalid hostname `%s'.\n", hostname);
102#endif 100#endif
103 GNUNET_break (0); 101 GNUNET_break(0);
104 } 102 }
105} 103}
106 104
107static void 105static void
108check_127 (void *cls, const struct sockaddr *sa, socklen_t salen) 106check_127(void *cls, const struct sockaddr *sa, socklen_t salen)
109{ 107{
110 int *ok = cls; 108 int *ok = cls;
111 const struct sockaddr_in *sai = (const struct sockaddr_in *) sa; 109 const struct sockaddr_in *sai = (const struct sockaddr_in *) sa;
112 110
113 if (sa == NULL) 111 if (sa == NULL)
114 return; 112 return;
115 GNUNET_assert (sizeof (struct sockaddr_in) == salen); 113 GNUNET_assert(sizeof(struct sockaddr_in) == salen);
116 if (sai->sin_addr.s_addr == htonl (INADDR_LOOPBACK)) 114 if (sai->sin_addr.s_addr == htonl(INADDR_LOOPBACK))
117 { 115 {
118#if DEBUG_RESOLVER 116#if DEBUG_RESOLVER
119 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received correct address.\n"); 117 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received correct address.\n");
@@ -125,21 +123,21 @@ check_127 (void *cls, const struct sockaddr *sa, socklen_t salen)
125#if DEBUG_RESOLVER 123#if DEBUG_RESOLVER
126 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received incorrect address.\n"); 124 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received incorrect address.\n");
127#endif 125#endif
128 GNUNET_break (0); 126 GNUNET_break(0);
129 } 127 }
130} 128}
131 129
132static void 130static void
133check_rootserver_ip (void *cls, const struct sockaddr *sa, socklen_t salen) 131check_rootserver_ip(void *cls, const struct sockaddr *sa, socklen_t salen)
134{ 132{
135 int *ok = cls; 133 int *ok = cls;
136 const struct sockaddr_in *sai = (const struct sockaddr_in *) sa; 134 const struct sockaddr_in *sai = (const struct sockaddr_in *) sa;
137 135
138 if (sa == NULL) 136 if (sa == NULL)
139 return; 137 return;
140 GNUNET_assert (sizeof (struct sockaddr_in) == salen); 138 GNUNET_assert(sizeof(struct sockaddr_in) == salen);
141 139
142 if ( 0 == strcmp(inet_ntoa(sai->sin_addr),ROOTSERVER_IP)) 140 if (0 == strcmp(inet_ntoa(sai->sin_addr), ROOTSERVER_IP))
143 { 141 {
144#if DEBUG_RESOLVER 142#if DEBUG_RESOLVER
145 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received correct rootserver ip address.\n"); 143 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received correct rootserver ip address.\n");
@@ -151,22 +149,22 @@ check_rootserver_ip (void *cls, const struct sockaddr *sa, socklen_t salen)
151#if DEBUG_RESOLVER 149#if DEBUG_RESOLVER
152 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received incorrect rootserver ip address.\n"); 150 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received incorrect rootserver ip address.\n");
153#endif 151#endif
154 GNUNET_break (0); 152 GNUNET_break(0);
155 } 153 }
156} 154}
157 155
158static void 156static void
159check_rootserver_name (void *cls, const char *hostname) 157check_rootserver_name(void *cls, const char *hostname)
160{ 158{
161 int *ok = cls; 159 int *ok = cls;
162 if (hostname == NULL) 160 if (hostname == NULL)
163 return; 161 return;
164 162
165 if (0 == strcmp (hostname, ROOTSERVER_NAME)) 163 if (0 == strcmp(hostname, ROOTSERVER_NAME))
166 { 164 {
167#if DEBUG_RESOLVER 165#if DEBUG_RESOLVER
168 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 166 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
169 "Received correct rootserver hostname `%s'.\n", hostname); 167 "Received correct rootserver hostname `%s'.\n", hostname);
170#endif 168#endif
171 (*ok) &= ~2; 169 (*ok) &= ~2;
172 } 170 }
@@ -174,200 +172,180 @@ check_rootserver_name (void *cls, const char *hostname)
174 { 172 {
175#if DEBUG_RESOLVER 173#if DEBUG_RESOLVER
176 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 174 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
177 "Received invalid rootserver hostname `%s'.\n", hostname); 175 "Received invalid rootserver hostname `%s'.\n", hostname);
178#endif 176#endif
179 GNUNET_break (0); 177 GNUNET_break(0);
180 } 178 }
181} 179}
182 180
183static void 181static void
184run (void *cls, 182run(void *cls, struct GNUNET_SCHEDULER_Handle *sched, char * const *args,
185 struct GNUNET_SCHEDULER_Handle *sched, 183 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
186 char *const *args,
187 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
188{ 184{
189 struct sockaddr_in sa; 185 struct sockaddr_in sa;
190 struct GNUNET_TIME_Relative timeout = 186 struct GNUNET_TIME_Relative timeout = GNUNET_TIME_relative_multiply(
191 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 187 GNUNET_TIME_UNIT_MILLISECONDS, 2500);
192 2500); 188 int count_ips = 0;
193 int count_ips =0 ;
194 189
195 memset (&sa, 0, sizeof (sa)); 190 memset(&sa, 0, sizeof(sa));
196 sa.sin_family = AF_INET; 191 sa.sin_family = AF_INET;
197 sa.sin_addr.s_addr = htonl (INADDR_LOOPBACK); 192 sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
198 GNUNET_RESOLVER_ip_get (sched, 193 GNUNET_RESOLVER_ip_get(sched, cfg, "localhost", AF_INET, timeout, &check_127,
199 cfg, 194 cls);
200 "localhost", AF_INET, timeout, &check_127, cls); 195 GNUNET_RESOLVER_hostname_get(sched, cfg, (const struct sockaddr *) &sa,
201 GNUNET_RESOLVER_hostname_get (sched, 196 sizeof(struct sockaddr), GNUNET_YES, timeout, &check_localhost, cls);
202 cfg, 197 GNUNET_RESOLVER_hostname_get(sched, cfg, (const struct sockaddr *) &sa,
203 (const struct sockaddr *) &sa, 198 sizeof(struct sockaddr), GNUNET_NO, timeout, &check_localhost_num, cls);
204 sizeof (struct sockaddr), 199 GNUNET_RESOLVER_hostname_resolve(sched, cfg, AF_UNSPEC, timeout,
205 GNUNET_YES, timeout, &check_localhost, cls); 200 &check_hostname, cls);
206 GNUNET_RESOLVER_hostname_get (sched,
207 cfg,
208 (const struct sockaddr *) &sa,
209 sizeof (struct sockaddr),
210 GNUNET_NO,
211 timeout, &check_localhost_num, cls);
212 GNUNET_RESOLVER_hostname_resolve (sched,
213 cfg,
214 AF_UNSPEC, timeout, &check_hostname, cls);
215 /* 201 /*
216 * Testing non-local DNS resolution 202 * Testing non-local DNS resolution
217 * DNS rootserver to test: a.root-servers.net - 198.41.0.4 203 * DNS rootserver to test: a.root-servers.net - 198.41.0.4
218 */ 204 */
219 205
220 char const * rootserver_name = ROOTSERVER_NAME; 206 char const * rootserver_name = ROOTSERVER_NAME;
221 struct hostent *rootserver; 207 struct hostent *rootserver;
222 208
223 rootserver = gethostbyname(rootserver_name); 209 rootserver = gethostbyname(rootserver_name);
224 if (rootserver == NULL) 210 if (rootserver == NULL)
225 { 211 {
226 /* Error: resolving ip addresses does not work */ 212 /* Error: resolving ip addresses does not work */
227#if DEBUG_RESOLVER 213#if DEBUG_RESOLVER
228 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 214 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
229 _("gethostbyname() could not lookup IP address: %s\n"), 215 _("gethostbyname() could not lookup IP address: %s\n"),
230 hstrerror (h_errno)); 216 hstrerror (h_errno));
231#endif 217#endif
232 GNUNET_break (0); 218 GNUNET_break(0);
233 return; 219 return;
234 } 220 }
235 221
236 /* Counting returned IP addresses */ 222 /* Counting returned IP addresses */
237 while (rootserver->h_addr_list[count_ips]!=NULL) 223 while (rootserver->h_addr_list[count_ips] != NULL)
238 count_ips++; 224 count_ips++;
239 if ( count_ips > 1) 225 if (count_ips > 1)
240 { 226 {
241#if DEBUG_RESOLVER 227#if DEBUG_RESOLVER
242 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "IP received range for root name server, but a root name server has only 1 IP\n"); 228 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "IP received range for root name server, but a root name server has only 1 IP\n");
243#endif 229#endif
244 GNUNET_break (0); 230 GNUNET_break(0);
245 } 231 }
246 232
247 /* Comparing to resolved address to the address the root name server should have */ 233 /* Comparing to resolved address to the address the root name server should have */
248 if ( strcmp(inet_ntoa( *(struct in_addr *) rootserver->h_addr_list[0]),ROOTSERVER_IP) !=0) 234 if (strcmp(inet_ntoa(*(struct in_addr *) rootserver->h_addr_list[0]),
235 ROOTSERVER_IP) != 0)
249 { 236 {
250#if DEBUG_RESOLVER 237#if DEBUG_RESOLVER
251 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "IP received and IP for root name server differ\n"); 238 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "IP received and IP for root name server differ\n");
252#endif 239#endif
253 GNUNET_break (0); 240 GNUNET_break(0);
254 } 241 }
255#if DEBUG_RESOLVER 242#if DEBUG_RESOLVER
256 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "System's own forward name resolution is working\n"); 243 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "System's own forward name resolution is working\n");
257#endif 244#endif
258 245
259 /* Resolve the same using GNUNET */ 246 /* Resolve the same using GNUNET */
260 GNUNET_RESOLVER_ip_get (sched, cfg, ROOTSERVER_NAME, AF_INET, timeout, &check_rootserver_ip, cls); 247 GNUNET_RESOLVER_ip_get(sched, cfg, ROOTSERVER_NAME, AF_INET, timeout,
261 248 &check_rootserver_ip, cls);
262 /* 249
263 * Success: forward lookups work as expected 250 /*
264 * Next step: reverse lookups 251 * Success: forward lookups work as expected
265 */ 252 * Next step: reverse lookups
266 253 */
267 struct in_addr rootserver_addr; 254
268 rootserver->h_name=""; 255 struct in_addr rootserver_addr;
269 if ( 1 != inet_pton(AF_INET, ROOTSERVER_IP, &rootserver_addr)) 256 rootserver->h_name = "";
257 if (1 != inet_pton(AF_INET, ROOTSERVER_IP, &rootserver_addr))
270 { 258 {
271#if DEBUG_RESOLVER 259#if DEBUG_RESOLVER
272 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Could not transform root name server IP address\n"); 260 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Could not transform root name server IP address\n");
273#endif 261#endif
274 GNUNET_break (0); 262 GNUNET_break(0);
275 } 263 }
276 264
277 rootserver = gethostbyaddr(&rootserver_addr, sizeof(rootserver_addr), AF_INET); 265 rootserver
278 if (rootserver == NULL) 266 = gethostbyaddr(&rootserver_addr, sizeof(rootserver_addr), AF_INET);
267 if (rootserver == NULL)
279 { 268 {
280 /* Error: resolving ip addresses does not work */ 269 /* Error: resolving ip addresses does not work */
281#if DEBUG_RESOLVER 270#if DEBUG_RESOLVER
282 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 271 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
283 _("gethostbyaddr() could not lookup hostname: %s\n"), 272 _("gethostbyaddr() could not lookup hostname: %s\n"),
284 hstrerror (h_errno)); 273 hstrerror (h_errno));
285#endif 274#endif
286 GNUNET_break (0); 275 GNUNET_break(0);
287 } 276 }
288 277
289 if ( 0 != strcmp( rootserver->h_name,ROOTSERVER_NAME)) 278 if (0 != strcmp(rootserver->h_name, ROOTSERVER_NAME))
290 { 279 {
291#if DEBUG_RESOLVER 280#if DEBUG_RESOLVER
292 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received hostname and hostname for root name server differ\n"); 281 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received hostname and hostname for root name server differ\n");
293#endif 282#endif
294 GNUNET_break (0); 283 GNUNET_break(0);
295 } 284 }
296 285
297#if DEBUG_RESOLVER 286#if DEBUG_RESOLVER
298 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "System's own reverse name resolution is working\n"); 287 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "System's own reverse name resolution is working\n");
299#endif 288#endif
300 /* Resolve the same using GNUNET */ 289 /* Resolve the same using GNUNET */
301 290
302 memset (&sa, 0, sizeof (sa)); 291 memset(&sa, 0, sizeof(sa));
303 sa.sin_family = AF_INET; 292 sa.sin_family = AF_INET;
304 inet_aton(ROOTSERVER_IP, &sa.sin_addr); 293 inet_aton(ROOTSERVER_IP, &sa.sin_addr);
305 294
306 GNUNET_RESOLVER_hostname_get (sched, 295 GNUNET_RESOLVER_hostname_get(sched, cfg, (const struct sockaddr *) &sa,
307 cfg, 296 sizeof(struct sockaddr), GNUNET_YES, timeout, &check_rootserver_name, cls);
308 (const struct sockaddr *) &sa,
309 sizeof (struct sockaddr),
310 GNUNET_YES,
311 timeout, &check_rootserver_name, cls);
312} 297}
313 298
314static int 299static int
315check () 300check()
316{ 301{
317 int ok = 1 + 2 + 4 + 8; 302 int ok = 1 + 2 + 4 + 8;
318 char *fn; 303 char *fn;
319 char *pfx; 304 char *pfx;
320 pid_t pid; 305 pid_t pid;
321 char *const argv[] = { "test-resolver-api", 306 char * const argv[] =
322 "-c", 307 { "test-resolver-api", "-c", "test_resolver_api_data.conf",
323 "test_resolver_api_data.conf",
324#if VERBOSE 308#if VERBOSE
325 "-L", "DEBUG", 309 "-L", "DEBUG",
326#endif 310#endif
327 NULL 311 NULL };
328 }; 312 struct GNUNET_GETOPT_CommandLineOption options[] =
329 struct GNUNET_GETOPT_CommandLineOption options[] = { 313 { GNUNET_GETOPT_OPTION_END };
330 GNUNET_GETOPT_OPTION_END
331 };
332 pfx = GNUNET_OS_installation_get_path(GNUNET_OS_IPK_BINDIR); 314 pfx = GNUNET_OS_installation_get_path(GNUNET_OS_IPK_BINDIR);
333 GNUNET_asprintf(&fn, "%s%cgnunet-service-resolver", 315 GNUNET_asprintf(&fn, "%s%cgnunet-service-resolver", pfx, DIR_SEPARATOR);
334 pfx, 316 GNUNET_free(pfx);
335 DIR_SEPARATOR); 317 pid = GNUNET_OS_start_process(NULL, NULL, fn, "gnunet-service-resolver",
336 GNUNET_free (pfx);
337 pid = GNUNET_OS_start_process (NULL, NULL, fn,
338 "gnunet-service-resolver",
339#if VERBOSE 318#if VERBOSE
340 "-L", "DEBUG", 319 "-L", "DEBUG",
341#endif 320#endif
342 "-c", "test_resolver_api_data.conf", NULL); 321 "-c", "test_resolver_api_data.conf", NULL);
343 GNUNET_free (fn); 322 GNUNET_free(fn);
344 GNUNET_assert (GNUNET_OK == GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, 323 GNUNET_assert(GNUNET_OK == GNUNET_PROGRAM_run((sizeof(argv) / sizeof(char *))
345 argv, "test-resolver-api", "nohelp", 324 - 1, argv, "test-resolver-api", "nohelp", options, &run, &ok));
346 options, &run, &ok)); 325 if (0 != PLIBC_KILL(pid, SIGTERM))
347 if (0 != PLIBC_KILL (pid, SIGTERM))
348 { 326 {
349 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); 327 GNUNET_log_strerror(GNUNET_ERROR_TYPE_WARNING, "kill");
350 ok = 1; 328 ok = 1;
351 } 329 }
352 GNUNET_OS_process_wait (pid); 330 GNUNET_OS_process_wait(pid);
353 if (ok != 0) 331 if (ok != 0)
354 fprintf (stderr, "Missed some resolutions: %u\n", ok); 332 fprintf(stderr, "Missed some resolutions: %u\n", ok);
355 return ok; 333 return ok;
356} 334}
357 335
358int 336int
359main (int argc, char *argv[]) 337main(int argc, char *argv[])
360{ 338{
361 int ret; 339 int ret;
362 340
363 GNUNET_log_setup ("test-resolver-api", 341 GNUNET_log_setup("test-resolver-api",
364#if VERBOSE 342#if VERBOSE
365 "DEBUG", 343 "DEBUG",
366#else 344#else
367 "WARNING", 345 "WARNING",
368#endif 346#endif
369 NULL); 347 NULL);
370 ret = check (); 348 ret = check();
371 349
372 return ret; 350 return ret;
373} 351}