/*
This file is part of GNUnet.
- (C) 2011 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2011 GNUnet e.V.
- GNUnet is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
/**
* Selected level of verbosity.
*/
-static int verbosity;
+static unsigned int verbosity;
/**
const char *format;
char buf[INET6_ADDRSTRLEN];
char *tmp;
-
+
tmp = NULL;
switch (record->type)
{
(unsigned int) record->data.soa->refresh,
(unsigned int) record->data.soa->retry,
(unsigned int) record->data.soa->expire,
- (unsigned int) record->data.soa->minimum_ttl);
+ (unsigned int) record->data.soa->minimum_ttl);
format = tmp;
}
break;
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,
+ "priority %u, weight = %s, port = %u, target = %s",
(unsigned int) record->data.srv->priority,
(unsigned int) record->data.srv->weight,
(unsigned int) record->data.srv->port,
* @param request_length number of bytes in request
* @param request udp payload of the DNS request
*/
-static void
+static void
display_request (void *cls,
struct GNUNET_DNS_RequestHandle *rh,
size_t request_length,
p->flags.authenticated_data ? "AD " : "",
p->flags.recursion_available ? "RA " : "",
return_codes[p->flags.return_code & 15],
- op_codes[p->flags.opcode & 15]);
+ op_codes[p->flags.opcode & 15]);
if (p->num_queries > 0)
fprintf (stdout,
"\tQueries:\n");
for (i=0;i<p->num_queries;i++)
display_query (&p->queries[i]);
-
+
if (p->num_answers > 0)
fprintf (stdout,
"\tAnswers:\n");
* Shutdown.
*/
static void
-do_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_disconnect (void *cls)
{
if (NULL != handle)
{
if (outbound_only)
flags |= GNUNET_DNS_FLAG_RESPONSE_MONITOR;
handle =
- GNUNET_DNS_connect (cfg,
+ GNUNET_DNS_connect (cfg,
flags,
&display_request,
NULL);
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
- &do_disconnect, NULL);
+ GNUNET_SCHEDULER_add_shutdown (&do_disconnect, NULL);
}
int
main (int argc, char *const *argv)
{
- static const struct GNUNET_GETOPT_CommandLineOption options[] = {
- {'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),
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+
+ GNUNET_GETOPT_option_flag ('i',
+ "inbound-only",
+ gettext_noop ("only monitor DNS queries"),
+ &inbound_only),
+
+ GNUNET_GETOPT_option_flag ('o',
+ "outbound-only",
+ gettext_noop ("only monitor DNS queries"),
+ &outbound_only),
+
+ GNUNET_GETOPT_option_verbose (&verbosity),
GNUNET_GETOPT_OPTION_END
};