diff options
-rw-r--r-- | src/dns/gnunet-dns-monitor.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/dns/gnunet-dns-monitor.c b/src/dns/gnunet-dns-monitor.c index 96d2a4959..18d08d4fc 100644 --- a/src/dns/gnunet-dns-monitor.c +++ b/src/dns/gnunet-dns-monitor.c | |||
@@ -35,9 +35,14 @@ | |||
35 | static struct GNUNET_DNS_Handle *handle; | 35 | static struct GNUNET_DNS_Handle *handle; |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * Option -s. | 38 | * Option -i. |
39 | */ | 39 | */ |
40 | static int benchmark_send; | 40 | static int inbound_only; |
41 | |||
42 | /** | ||
43 | * Option -o. | ||
44 | */ | ||
45 | static int outbound_only; | ||
41 | 46 | ||
42 | /** | 47 | /** |
43 | * Global return value (0 success). | 48 | * Global return value (0 success). |
@@ -306,9 +311,18 @@ static void | |||
306 | run (void *cls, char *const *args, const char *cfgfile, | 311 | run (void *cls, char *const *args, const char *cfgfile, |
307 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 312 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
308 | { | 313 | { |
314 | enum GNUNET_DNS_Flags flags; | ||
315 | |||
316 | flags = GNUNET_DNS_FLAG_REQUEST_MONITOR | GNUNET_DNS_FLAG_RESPONSE_MONITOR; | ||
317 | if (inbound_only | outbound_only) | ||
318 | flags = 0; | ||
319 | if (inbound_only) | ||
320 | flags |= GNUNET_DNS_FLAG_REQUEST_MONITOR; | ||
321 | if (outbound_only) | ||
322 | flags |= GNUNET_DNS_FLAG_RESPONSE_MONITOR; | ||
309 | handle = | 323 | handle = |
310 | GNUNET_DNS_connect (cfg, | 324 | GNUNET_DNS_connect (cfg, |
311 | GNUNET_DNS_FLAG_REQUEST_MONITOR | GNUNET_DNS_FLAG_RESPONSE_MONITOR, | 325 | flags, |
312 | &display_request, | 326 | &display_request, |
313 | NULL); | 327 | NULL); |
314 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 328 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
@@ -320,9 +334,12 @@ int | |||
320 | main (int argc, char *const *argv) | 334 | main (int argc, char *const *argv) |
321 | { | 335 | { |
322 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 336 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { |
323 | {'s', "testoption", NULL, | 337 | {'i', "inbound-only", NULL, |
324 | gettext_noop ("not useful"), | 338 | gettext_noop ("only monitor DNS queries"), |
325 | 0, &GNUNET_GETOPT_set_one, &benchmark_send}, | 339 | 0, &GNUNET_GETOPT_set_one, &inbound_only}, |
340 | {'o', "outbound-only", NULL, | ||
341 | gettext_noop ("only monitor DNS replies"), | ||
342 | 0, &GNUNET_GETOPT_set_one, &outbound_only}, | ||
326 | GNUNET_GETOPT_OPTION_VERBOSE (&verbosity), | 343 | GNUNET_GETOPT_OPTION_VERBOSE (&verbosity), |
327 | GNUNET_GETOPT_OPTION_END | 344 | GNUNET_GETOPT_OPTION_END |
328 | }; | 345 | }; |