diff options
author | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2012-01-04 15:22:49 +0000 |
---|---|---|
committer | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2012-01-04 15:22:49 +0000 |
commit | 612b00dc59b1e46e797ed4ca4cb0457869185211 (patch) | |
tree | ff455e1d477e1348f5c4ae06221d746dc6c4b73d /src/dns/gnunet-dns-monitor.c | |
parent | 68f236cb04dc1b910f8007ab351a37da3afe099a (diff) |
-options
git-svn-id: https://gnunet.org/svn/gnunet@18986 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/dns/gnunet-dns-monitor.c')
-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 96d2a4959b..18d08d4fcf 100644 --- a/src/dns/gnunet-dns-monitor.c +++ b/src/dns/gnunet-dns-monitor.c @@ -35,9 +35,14 @@ static struct GNUNET_DNS_Handle *handle; /** - * Option -s. + * Option -i. */ -static int benchmark_send; +static int inbound_only; + +/** + * Option -o. + */ +static int outbound_only; /** * Global return value (0 success). @@ -306,9 +311,18 @@ static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) { + enum GNUNET_DNS_Flags flags; + + flags = GNUNET_DNS_FLAG_REQUEST_MONITOR | GNUNET_DNS_FLAG_RESPONSE_MONITOR; + if (inbound_only | outbound_only) + flags = 0; + if (inbound_only) + flags |= GNUNET_DNS_FLAG_REQUEST_MONITOR; + if (outbound_only) + flags |= GNUNET_DNS_FLAG_RESPONSE_MONITOR; handle = GNUNET_DNS_connect (cfg, - GNUNET_DNS_FLAG_REQUEST_MONITOR | GNUNET_DNS_FLAG_RESPONSE_MONITOR, + flags, &display_request, NULL); GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, @@ -320,9 +334,12 @@ int main (int argc, char *const *argv) { static const struct GNUNET_GETOPT_CommandLineOption options[] = { - {'s', "testoption", NULL, - gettext_noop ("not useful"), - 0, &GNUNET_GETOPT_set_one, &benchmark_send}, + {'i', "inbound-only", NULL, + gettext_noop ("only monitor DNS queries"), + 0, &GNUNET_GETOPT_set_one, &inbound_only}, + {'o', "outbound-only", NULL, + gettext_noop ("only monitor DNS replies"), + 0, &GNUNET_GETOPT_set_one, &outbound_only}, GNUNET_GETOPT_OPTION_VERBOSE (&verbosity), GNUNET_GETOPT_OPTION_END }; |