diff options
Diffstat (limited to 'src/dns/gnunet-dns-monitor.c')
-rw-r--r-- | src/dns/gnunet-dns-monitor.c | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/src/dns/gnunet-dns-monitor.c b/src/dns/gnunet-dns-monitor.c index 82715aa..747a875 100644 --- a/src/dns/gnunet-dns-monitor.c +++ b/src/dns/gnunet-dns-monitor.c @@ -75,6 +75,7 @@ get_type (uint16_t type) case GNUNET_DNSPARSER_TYPE_MX: return "MX"; case GNUNET_DNSPARSER_TYPE_TXT: return "TXT"; case GNUNET_DNSPARSER_TYPE_AAAA: return "AAAA"; + case GNUNET_DNSPARSER_TYPE_SRV: return "SRV"; } GNUNET_snprintf (buf, sizeof (buf), "%u", (unsigned int) type); return buf; @@ -151,7 +152,7 @@ display_record (const struct GNUNET_DNSPARSER_Record *record) format = record->data.hostname; break; case GNUNET_DNSPARSER_TYPE_SOA: - if (record->data.soa == NULL) + if (NULL == record->data.soa) format = "<invalid>"; else { @@ -179,6 +180,23 @@ display_record (const struct GNUNET_DNSPARSER_Record *record) format = tmp; } break; + case GNUNET_DNSPARSER_TYPE_SRV: + if (NULL == record->data.srv) + format = "<invalid>"; + else + { + GNUNET_asprintf (&tmp, + "service: %s, protocol: %s, domain_name = %s, priority %u, weight = %s, port = %u, target = %s", + record->data.srv->service, + record->data.srv->proto, + record->data.srv->domain_name, + (unsigned int) record->data.srv->priority, + (unsigned int) record->data.srv->weight, + (unsigned int) record->data.srv->port, + record->data.srv->target); + format = tmp; + } + break; case GNUNET_DNSPARSER_TYPE_TXT: GNUNET_asprintf (&tmp, "%.*s", @@ -342,11 +360,16 @@ main (int argc, char *const *argv) GNUNET_GETOPT_OPTION_VERBOSE (&verbosity), GNUNET_GETOPT_OPTION_END }; - return (GNUNET_OK == - GNUNET_PROGRAM_run (argc, argv, "gnunet-dns-monitor", - gettext_noop - ("Monitor DNS queries."), options, - &run, NULL)) ? ret : 1; + + if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) + return 2; + ret = (GNUNET_OK == + GNUNET_PROGRAM_run (argc, argv, "gnunet-dns-monitor", + gettext_noop + ("Monitor DNS queries."), options, + &run, NULL)) ? ret : 1; + GNUNET_free ((void*) argv); + return ret; } |