GNUnet  0.10.x
Functions | Variables
gnunet-dns-monitor.c File Reference

Tool to monitor DNS queries. More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_dns_service.h"
#include "gnunet_dnsparser_lib.h"
Include dependency graph for gnunet-dns-monitor.c:

Go to the source code of this file.

Functions

static const char * get_type (uint16_t type)
 Convert numeric DNS record type to a string. More...
 
static const char * get_class (uint16_t class)
 Convert numeric DNS record class to a string. More...
 
static void display_query (const struct GNUNET_DNSPARSER_Query *query)
 Output the given DNS query to stdout. More...
 
static void display_record (const struct GNUNET_DNSPARSER_Record *record)
 Output the given DNS record to stdout. More...
 
static void display_request (void *cls, struct GNUNET_DNS_RequestHandle *rh, size_t request_length, const char *request)
 Signature of a function that is called whenever the DNS service encounters a DNS request and needs to do something with it. More...
 
static void do_disconnect (void *cls)
 Shutdown. More...
 
static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
 Main function that will be run by the scheduler. More...
 
int main (int argc, char *const *argv)
 

Variables

static struct GNUNET_DNS_Handlehandle
 Handle to transport service. More...
 
static int inbound_only
 Option -i. More...
 
static int outbound_only
 Option -o. More...
 
static int ret
 Global return value (0 success). More...
 
static unsigned int verbosity
 Selected level of verbosity. More...
 

Detailed Description

Tool to monitor DNS queries.

Author
Christian Grothoff

Definition in file gnunet-dns-monitor.c.

Function Documentation

◆ get_type()

static const char* get_type ( uint16_t  type)
static

Convert numeric DNS record type to a string.

Parameters
typetype to convert
Returns
type as string, only valid until the next call to this function

Definition at line 65 of file gnunet-dns-monitor.c.

References buf, GNUNET_DNSPARSER_TYPE_A, GNUNET_DNSPARSER_TYPE_AAAA, GNUNET_DNSPARSER_TYPE_CNAME, GNUNET_DNSPARSER_TYPE_MX, GNUNET_DNSPARSER_TYPE_NS, GNUNET_DNSPARSER_TYPE_PTR, GNUNET_DNSPARSER_TYPE_SOA, GNUNET_DNSPARSER_TYPE_SRV, GNUNET_DNSPARSER_TYPE_TXT, and GNUNET_snprintf().

Referenced by display_query(), and display_record().

66 {
67  static char buf[6];
68  switch (type)
69  {
70  case GNUNET_DNSPARSER_TYPE_A: return "A";
71  case GNUNET_DNSPARSER_TYPE_NS: return "NS";
72  case GNUNET_DNSPARSER_TYPE_CNAME: return "CNAME";
73  case GNUNET_DNSPARSER_TYPE_SOA: return "SOA";
74  case GNUNET_DNSPARSER_TYPE_PTR: return "PTR";
75  case GNUNET_DNSPARSER_TYPE_MX: return "MX";
76  case GNUNET_DNSPARSER_TYPE_TXT: return "TXT";
77  case GNUNET_DNSPARSER_TYPE_AAAA: return "AAAA";
78  case GNUNET_DNSPARSER_TYPE_SRV: return "SRV";
79  }
80  GNUNET_snprintf (buf, sizeof (buf), "%u", (unsigned int) type);
81  return buf;
82 }
#define GNUNET_DNSPARSER_TYPE_CNAME
int GNUNET_snprintf(char *buf, size_t size, const char *format,...)
Like snprintf, just aborts if the buffer is of insufficient size.
#define GNUNET_DNSPARSER_TYPE_MX
#define GNUNET_DNSPARSER_TYPE_PTR
#define GNUNET_DNSPARSER_TYPE_SOA
static char buf[2048]
#define GNUNET_DNSPARSER_TYPE_TXT
#define GNUNET_DNSPARSER_TYPE_AAAA
#define GNUNET_DNSPARSER_TYPE_NS
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
#define GNUNET_DNSPARSER_TYPE_SRV
#define GNUNET_DNSPARSER_TYPE_A
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_class()

static const char* get_class ( uint16_t  class)
static

Convert numeric DNS record class to a string.

Parameters
classclass to convert
Returns
class as string, only valid until the next call to this function

Definition at line 92 of file gnunet-dns-monitor.c.

References buf, GNUNET_snprintf(), GNUNET_TUN_DNS_CLASS_CHAOS, GNUNET_TUN_DNS_CLASS_HESIOD, and GNUNET_TUN_DNS_CLASS_INTERNET.

Referenced by display_query(), and display_record().

93 {
94  static char buf[6];
95  switch (class)
96  {
97  case GNUNET_TUN_DNS_CLASS_INTERNET: return "IN";
98  case GNUNET_TUN_DNS_CLASS_CHAOS: return "CHAOS";
99  case GNUNET_TUN_DNS_CLASS_HESIOD: return "HESIOD";
100  }
101  GNUNET_snprintf (buf, sizeof (buf), "%u", (unsigned int) class);
102  return buf;
103 }
#define GNUNET_TUN_DNS_CLASS_CHAOS
int GNUNET_snprintf(char *buf, size_t size, const char *format,...)
Like snprintf, just aborts if the buffer is of insufficient size.
#define GNUNET_TUN_DNS_CLASS_HESIOD
static char buf[2048]
#define GNUNET_TUN_DNS_CLASS_INTERNET
A few common DNS classes (ok, only one is common, but I list a couple more to make it clear what we'r...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ display_query()

static void display_query ( const struct GNUNET_DNSPARSER_Query query)
static

Output the given DNS query to stdout.

Parameters
queryquery to display.

Definition at line 112 of file gnunet-dns-monitor.c.

References GNUNET_DNSPARSER_Query::dns_traffic_class, get_class(), get_type(), GNUNET_DNSPARSER_Query::name, and GNUNET_DNSPARSER_Query::type.

Referenced by display_request().

113 {
114  fprintf (stdout,
115  "\t\t%s %s: %s\n",
116  get_class (query->dns_traffic_class),
117  get_type (query->type),
118  query->name);
119 }
static const char * get_class(uint16_t class)
Convert numeric DNS record class to a string.
uint16_t type
See GNUNET_DNSPARSER_TYPE_*.
uint16_t dns_traffic_class
See GNUNET_TUN_DNS_CLASS_*.
char * name
Name of the record that the query is for (0-terminated).
static const char * get_type(uint16_t type)
Convert numeric DNS record type to a string.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ display_record()

static void display_record ( const struct GNUNET_DNSPARSER_Record record)
static

Output the given DNS record to stdout.

Parameters
recordrecord to display.

Definition at line 128 of file gnunet-dns-monitor.c.

References buf, GNUNET_DNSPARSER_RawRecord::data, GNUNET_DNSPARSER_Record::data, GNUNET_DNSPARSER_RawRecord::data_len, GNUNET_DNSPARSER_Record::dns_traffic_class, GNUNET_DNSPARSER_Record::expiration_time, GNUNET_DNSPARSER_SoaRecord::expire, get_class(), get_type(), GNUNET_asprintf(), GNUNET_DNSPARSER_TYPE_A, GNUNET_DNSPARSER_TYPE_AAAA, GNUNET_DNSPARSER_TYPE_CNAME, GNUNET_DNSPARSER_TYPE_MX, GNUNET_DNSPARSER_TYPE_NS, GNUNET_DNSPARSER_TYPE_PTR, GNUNET_DNSPARSER_TYPE_SOA, GNUNET_DNSPARSER_TYPE_SRV, GNUNET_DNSPARSER_TYPE_TXT, GNUNET_free_non_null, GNUNET_TIME_absolute_get_remaining(), GNUNET_DNSPARSER_Record::hostname, GNUNET_DNSPARSER_SoaRecord::minimum_ttl, GNUNET_DNSPARSER_SoaRecord::mname, GNUNET_DNSPARSER_Record::mx, GNUNET_DNSPARSER_MxRecord::mxhost, GNUNET_DNSPARSER_Record::name, GNUNET_DNSPARSER_SrvRecord::port, GNUNET_DNSPARSER_MxRecord::preference, GNUNET_DNSPARSER_SrvRecord::priority, GNUNET_DNSPARSER_Record::raw, GNUNET_DNSPARSER_SoaRecord::refresh, GNUNET_TIME_Relative::rel_value_us, GNUNET_DNSPARSER_SoaRecord::retry, GNUNET_DNSPARSER_SoaRecord::rname, GNUNET_DNSPARSER_SoaRecord::serial, GNUNET_DNSPARSER_Record::soa, GNUNET_DNSPARSER_Record::srv, GNUNET_DNSPARSER_SrvRecord::target, GNUNET_DNSPARSER_Record::type, and GNUNET_DNSPARSER_SrvRecord::weight.

Referenced by display_request().

129 {
130  const char *format;
131  char buf[INET6_ADDRSTRLEN];
132  char *tmp;
133 
134  tmp = NULL;
135  switch (record->type)
136  {
138  if (record->data.raw.data_len != sizeof (struct in_addr))
139  format = "<invalid>";
140  else
141  format = inet_ntop (AF_INET, record->data.raw.data, buf, sizeof (buf));
142  break;
144  if (record->data.raw.data_len != sizeof (struct in6_addr))
145  format = "<invalid>";
146  else
147  format = inet_ntop (AF_INET6, record->data.raw.data, buf, sizeof (buf));
148  break;
152  format = record->data.hostname;
153  break;
155  if (NULL == record->data.soa)
156  format = "<invalid>";
157  else
158  {
159  GNUNET_asprintf (&tmp,
160  "origin: %s, mail: %s, serial = %u, refresh = %u s, retry = %u s, expire = %u s, minimum = %u s",
161  record->data.soa->mname,
162  record->data.soa->rname,
163  (unsigned int) record->data.soa->serial,
164  (unsigned int) record->data.soa->refresh,
165  (unsigned int) record->data.soa->retry,
166  (unsigned int) record->data.soa->expire,
167  (unsigned int) record->data.soa->minimum_ttl);
168  format = tmp;
169  }
170  break;
172  if (record->data.mx == NULL)
173  format = "<invalid>";
174  else
175  {
176  GNUNET_asprintf (&tmp,
177  "%u: %s",
178  record->data.mx->preference,
179  record->data.mx->mxhost);
180  format = tmp;
181  }
182  break;
184  if (NULL == record->data.srv)
185  format = "<invalid>";
186  else
187  {
188  GNUNET_asprintf (&tmp,
189  "priority %u, weight = %s, port = %u, target = %s",
190  (unsigned int) record->data.srv->priority,
191  (unsigned int) record->data.srv->weight,
192  (unsigned int) record->data.srv->port,
193  record->data.srv->target);
194  format = tmp;
195  }
196  break;
198  GNUNET_asprintf (&tmp,
199  "%.*s",
200  (unsigned int) record->data.raw.data_len,
201  record->data.raw.data);
202  format = tmp;
203  break;
204  default:
205  format = "<payload>";
206  break;
207  }
208  fprintf (stdout,
209  "\t\t%s %s: %s = %s (%u s)\n",
210  get_class (record->dns_traffic_class),
211  get_type (record->type),
212  record->name,
213  format,
214  (unsigned int) (GNUNET_TIME_absolute_get_remaining (record->expiration_time).rel_value_us / 1000LL / 1000LL));
215  GNUNET_free_non_null (tmp);
216 }
uint16_t type
See GNUNET_DNSPARSER_TYPE_*.
static const char * get_class(uint16_t class)
Convert numeric DNS record class to a string.
uint32_t retry
Time interval that should elapse before a failed refresh should be retried.
uint64_t rel_value_us
The actual value.
uint32_t refresh
Time interval before the zone should be refreshed.
char * mname
The domainname of the name server that was the original or primary source of data for this zone...
#define GNUNET_DNSPARSER_TYPE_CNAME
char * mxhost
Name of the mail server.
struct GNUNET_DNSPARSER_SrvRecord * srv
SRV data for SRV records.
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
#define GNUNET_DNSPARSER_TYPE_MX
uint32_t serial
The version number of the original copy of the zone.
#define GNUNET_DNSPARSER_TYPE_PTR
int GNUNET_asprintf(char **buf, const char *format,...)
Like asprintf, just portable.
uint32_t minimum_ttl
The bit minimum TTL field that should be exported with any RR from this zone.
#define GNUNET_DNSPARSER_TYPE_SOA
char * name
Name of the record that the query is for (0-terminated).
char * hostname
For NS, CNAME and PTR records, this is the uncompressed 0-terminated hostname.
struct GNUNET_DNSPARSER_SoaRecord * soa
SOA data for SOA records.
uint16_t port
TCP or UDP port of the service.
char * target
Hostname offering the service.
char * rname
A domainname which specifies the mailbox of the person responsible for this zone. ...
static char buf[2048]
uint32_t expire
Time value that specifies the upper limit on the time interval that can elapse before the zone is no ...
size_t data_len
Number of bytes in data.
void * data
Binary record data.
#define GNUNET_DNSPARSER_TYPE_TXT
struct GNUNET_TIME_Absolute expiration_time
When does the record expire?
struct GNUNET_DNSPARSER_MxRecord * mx
MX data for MX records.
#define GNUNET_DNSPARSER_TYPE_AAAA
#define GNUNET_DNSPARSER_TYPE_NS
uint16_t dns_traffic_class
See GNUNET_TUN_DNS_CLASS_*.
uint16_t priority
Preference for this entry (lower value is higher preference).
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_remaining(struct GNUNET_TIME_Absolute future)
Given a timestamp in the future, how much time remains until then?
Definition: time.c:331
uint16_t weight
Relative weight for records with the same priority.
static const char * get_type(uint16_t type)
Convert numeric DNS record type to a string.
union GNUNET_DNSPARSER_Record::@27 data
Payload of the record (which one of these is valid depends on the &#39;type&#39;).
#define GNUNET_DNSPARSER_TYPE_SRV
uint16_t preference
Preference for this entry (lower value is higher preference).
struct GNUNET_DNSPARSER_RawRecord raw
Raw data for all other types.
#define GNUNET_DNSPARSER_TYPE_A
Here is the call graph for this function:
Here is the caller graph for this function:

◆ display_request()

static void display_request ( void *  cls,
struct GNUNET_DNS_RequestHandle rh,
size_t  request_length,
const char *  request 
)
static

Signature of a function that is called whenever the DNS service encounters a DNS request and needs to do something with it.

The function has then the chance to generate or modify the response by calling one of the three "GNUNET_DNS_request_*" continuations.

When a request is intercepted, this function is called first to give the client a chance to do the complete address resolution; "rdata" will be NULL for this first call for a DNS request, unless some other client has already filled in a response.

If multiple clients exist, all of them are called before the global DNS. The global DNS is only called if all of the clients' functions call GNUNET_DNS_request_forward. Functions that call GNUNET_DNS_request_forward will be called again before a final response is returned to the application. If any of the clients' functions call GNUNET_DNS_request_drop, the response is dropped.

Parameters
clsclosure
rhrequest handle to user for reply
request_lengthnumber of bytes in request
requestudp payload of the DNS request

Definition at line 243 of file gnunet-dns-monitor.c.

References GNUNET_DNSPARSER_Packet::answers, GNUNET_TUN_DnsFlags::authenticated_data, GNUNET_TUN_DnsFlags::authoritative_answer, GNUNET_TUN_DnsFlags::checking_disabled, display_query(), display_record(), GNUNET_DNSPARSER_Packet::flags, GNUNET_DNS_request_forward(), GNUNET_DNSPARSER_free_packet(), GNUNET_DNSPARSER_parse(), GNUNET_DNSPARSER_Packet::id, GNUNET_TUN_DnsFlags::message_truncated, GNUNET_DNSPARSER_Packet::num_answers, GNUNET_DNSPARSER_Packet::num_queries, GNUNET_TUN_DnsFlags::opcode, p, GNUNET_DNSPARSER_Packet::queries, GNUNET_TUN_DnsFlags::query_or_response, GNUNET_TUN_DnsFlags::recursion_available, GNUNET_TUN_DnsFlags::recursion_desired, and GNUNET_TUN_DnsFlags::return_code.

Referenced by run().

247 {
248  static const char *return_codes[] =
249  {
250  "No error", "Format error", "Server failure", "Name error",
251  "Not implemented", "Refused", "YXDomain", "YXRRset",
252  "NXRRset", "NOT AUTH", "NOT ZONE", "<invalid>",
253  "<invalid>", "<invalid>", "<invalid>", "<invalid>"
254  };
255  static const char *op_codes[] =
256  {
257  "Query", "Inverse query", "Status", "<invalid>",
258  "<invalid>", "<invalid>", "<invalid>", "<invalid>",
259  "<invalid>", "<invalid>", "<invalid>", "<invalid>",
260  "<invalid>", "<invalid>", "<invalid>", "<invalid>"
261  };
262  struct GNUNET_DNSPARSER_Packet *p;
263  unsigned int i;
264 
265  p = GNUNET_DNSPARSER_parse (request, request_length);
266  if (NULL == p)
267  {
268  fprintf (stderr, "Received malformed DNS packet!\n");
269  // FIXME: drop instead?
271  return;
272  }
273  fprintf (stdout,
274  "%s with ID: %5u Flags: %s%s%s%s%s%s, Return Code: %s, Opcode: %s\n",
275  p->flags.query_or_response ? "Response" : "Query",
276  p->id,
277  p->flags.recursion_desired ? "RD " : "",
278  p->flags.message_truncated ? "MT " : "",
279  p->flags.authoritative_answer ? "AA " : "",
280  p->flags.checking_disabled ? "CD " : "",
281  p->flags.authenticated_data ? "AD " : "",
282  p->flags.recursion_available ? "RA " : "",
283  return_codes[p->flags.return_code & 15],
284  op_codes[p->flags.opcode & 15]);
285  if (p->num_queries > 0)
286  fprintf (stdout,
287  "\tQueries:\n");
288  for (i=0;i<p->num_queries;i++)
289  display_query (&p->queries[i]);
290 
291  if (p->num_answers > 0)
292  fprintf (stdout,
293  "\tAnswers:\n");
294  for (i=0;i<p->num_answers;i++)
295  display_record (&p->answers[i]);
296  fprintf (stdout, "\n");
299 }
struct GNUNET_DNSPARSER_Record * answers
Array of all answers in the packet, must contain "num_answers" entries.
static void display_query(const struct GNUNET_DNSPARSER_Query *query)
Output the given DNS query to stdout.
unsigned int return_code
See GNUNET_TUN_DNS_RETURN_CODE_ defines.
uint16_t id
DNS ID (to match replies to requests).
void GNUNET_DNSPARSER_free_packet(struct GNUNET_DNSPARSER_Packet *p)
Free memory taken by a packet.
Definition: dnsparser.c:854
unsigned int recursion_available
Set to 1 if recursion is available (server -> client)
unsigned int num_answers
Number of answers in the packet, should be 0 for queries.
unsigned int authoritative_answer
Set to 1 if this is an authoritative answer.
unsigned int authenticated_data
Response has been cryptographically verified, RFC 4035.
unsigned int query_or_response
query:0, response:1
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
struct GNUNET_DNSPARSER_Packet * GNUNET_DNSPARSER_parse(const char *udp_payload, size_t udp_payload_length)
Parse a UDP payload of a DNS packet in to a nice struct for further processing and manipulation...
Definition: dnsparser.c:662
unsigned int recursion_desired
Set to 1 if recursion is desired (client -> server)
unsigned int message_truncated
Set to 1 if message is truncated.
unsigned int opcode
See GNUNET_TUN_DNS_OPCODE_ defines.
struct GNUNET_DNSPARSER_Query * queries
Array of all queries in the packet, must contain "num_queries" entries.
static void display_record(const struct GNUNET_DNSPARSER_Record *record)
Output the given DNS record to stdout.
void GNUNET_DNS_request_forward(struct GNUNET_DNS_RequestHandle *rh)
If a GNUNET_DNS_RequestHandler calls this function, the request is given to other clients or the glob...
Definition: dns_api.c:247
Easy-to-process, parsed version of a DNS packet.
unsigned int num_queries
Number of queries in the packet.
struct GNUNET_TUN_DnsFlags flags
Bitfield of DNS flags.
unsigned int checking_disabled
See RFC 4035.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_disconnect()

static void do_disconnect ( void *  cls)
static

Shutdown.

Definition at line 306 of file gnunet-dns-monitor.c.

References GNUNET_DNS_disconnect().

Referenced by run().

307 {
308  if (NULL != handle)
309  {
311  handle = NULL;
312  }
313 }
void GNUNET_DNS_disconnect(struct GNUNET_DNS_Handle *dh)
Disconnect from the DNS service.
Definition: dns_api.c:373
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

static void run ( void *  cls,
char *const *  args,
const char *  cfgfile,
const struct GNUNET_CONFIGURATION_Handle cfg 
)
static

Main function that will be run by the scheduler.

Parameters
clsclosure
argsremaining command-line arguments
cfgfilename of the configuration file used (for saving, can be NULL!)
cfgconfiguration

Definition at line 325 of file gnunet-dns-monitor.c.

References display_request(), do_disconnect(), GNUNET_DNSPARSER_Packet::flags, GNUNET_DNS_connect(), GNUNET_DNS_FLAG_REQUEST_MONITOR, GNUNET_DNS_FLAG_RESPONSE_MONITOR, GNUNET_SCHEDULER_add_shutdown(), inbound_only, and outbound_only.

Referenced by main().

327 {
328  enum GNUNET_DNS_Flags flags;
329 
332  flags = 0;
333  if (inbound_only)
335  if (outbound_only)
337  handle =
338  GNUNET_DNS_connect (cfg,
339  flags,
341  NULL);
343 }
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received, or when GNUNET_SCHEDULER_shutdown() is being invoked.
Definition: scheduler.c:1293
Set this flag to see all requests just before they are returned to the network.
static int inbound_only
Option -i.
static int outbound_only
Option -o.
static void display_request(void *cls, struct GNUNET_DNS_RequestHandle *rh, size_t request_length, const char *request)
Signature of a function that is called whenever the DNS service encounters a DNS request and needs to...
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
Set this flag to see all requests first prior to resolution (for monitoring).
struct GNUNET_DNS_Handle * GNUNET_DNS_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, enum GNUNET_DNS_Flags flags, GNUNET_DNS_RequestHandler rh, void *rh_cls)
Connect to the service-dns.
Definition: dns_api.c:350
static void do_disconnect(void *cls)
Shutdown.
struct GNUNET_TUN_DnsFlags flags
Bitfield of DNS flags.
GNUNET_DNS_Flags
Flags that specify when to call the client&#39;s handler.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char *const *  argv 
)

Definition at line 347 of file gnunet-dns-monitor.c.

References gettext_noop, GNUNET_free, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_verbose(), GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_STRINGS_get_utf8_args(), inbound_only, outbound_only, ret, run(), and verbosity.

348 {
350 
352  "inbound-only",
353  gettext_noop ("only monitor DNS queries"),
354  &inbound_only),
355 
357  "outbound-only",
358  gettext_noop ("only monitor DNS queries"),
359  &outbound_only),
360 
363  };
364 
365  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
366  return 2;
367  ret = (GNUNET_OK ==
368  GNUNET_PROGRAM_run (argc, argv, "gnunet-dns-monitor",
370  ("Monitor DNS queries."), options,
371  &run, NULL)) ? ret : 1;
372  GNUNET_free ((void*) argv);
373  return ret;
374 }
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_verbose(unsigned int *level)
Define the &#39;-V&#39; verbosity option.
int GNUNET_STRINGS_get_utf8_args(int argc, char *const *argv, int *u8argc, char *const **u8argv)
Returns utf-8 encoded arguments.
Definition: strings.c:1521
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
Definition of a command line option.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
Definition: 002.c:13
static int inbound_only
Option -i.
static int outbound_only
Option -o.
static int ret
Global return value (0 success).
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_flag(char shortName, const char *name, const char *description, int *val)
Allow user to specify a flag (which internally means setting an integer to 1/GNUNET_YES/GNUNET_OK.
int GNUNET_PROGRAM_run(int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration, parse options).
Definition: program.c:361
static unsigned int verbosity
Selected level of verbosity.
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
Main function that will be run by the scheduler.
#define GNUNET_free(ptr)
Wrapper around free.
#define gettext_noop(String)
Definition: gettext.h:69
Here is the call graph for this function:

Variable Documentation

◆ handle

struct GNUNET_DNS_Handle* handle
static

Handle to transport service.

Definition at line 35 of file gnunet-dns-monitor.c.

Referenced by add_attribute_cont(), add_get_request_to_pending(), aes_128_cbc_decrypt(), aes_128_cbc_encrypt(), attr_collect(), authorize_endpoint(), build_authz_response(), build_redirect(), cleanup_handle(), client_redirect(), code_redirect(), collect_cred_cont(), collect_error_cb(), collect_finished_cb(), consume_cont(), consume_ticket(), consume_ticket_cont(), create_finished(), del_finished(), delete_attribute_cont(), delete_finished_cb(), do_error(), do_finished(), do_finished_create(), do_redirect_error(), do_timeout(), do_userinfo_error(), dump_pc(), ego_create(), ego_delete_name(), ego_delete_pubkey(), ego_edit_name(), ego_edit_pubkey(), ego_edit_subsystem(), ego_get_all(), ego_get_for_subsystem(), ego_get_name(), ego_get_pubkey(), ego_get_subsystem(), finished_cont(), get_cont(), get_cred_issuer_cb(), get_gns_cont(), GNUNET_CREDENTIAL_collect(), GNUNET_CREDENTIAL_connect(), GNUNET_CREDENTIAL_request_cancel(), GNUNET_CREDENTIAL_verify(), GNUNET_CRYPTO_symmetric_decrypt(), GNUNET_CRYPTO_symmetric_encrypt(), GNUNET_DHT_connect(), GNUNET_DHT_get_start(), GNUNET_DHT_get_stop(), GNUNET_DHT_monitor_start(), GNUNET_DHT_monitor_stop(), GNUNET_DHT_put(), GNUNET_DHT_put_cancel(), GNUNET_GNS_connect(), GNUNET_GNS_lookup(), GNUNET_GNS_lookup_cancel(), GNUNET_GNS_lookup_with_tld(), GNUNET_STATISTICS_get(), GNUNET_TRANSPORT_core_get_mq(), GST_connection_pool_get_handle(), handle_client_result(), handle_collect_response(), handle_gns_response(), handle_monitor_get(), handle_monitor_get_resp(), handle_monitor_put(), handle_result(), handle_ticket_result(), handle_verify_response(), header_iterator(), id_connect_cb(), init_egos(), issue_cred_cont(), list_attribute_cont(), list_ego(), list_tickets_cont(), login_cont(), login_redirect(), lookup_redirect_uri_result(), message_sent_cont(), mq_error_handler(), namestore_add(), namestore_delete(), namestore_get(), namestore_iteration_error(), namestore_list_finished(), namestore_list_iteration(), neighbour_delete(), ns_lookup_cb(), ns_lookup_error_cb(), oidc_attr_collect(), oidc_collect_finished_cb(), oidc_iteration_error(), oidc_ticket_issue_cb(), options_cont(), peerinfo_get(), peerinfo_list_finished(), peerinfo_list_iteration(), plugin_callback(), post_data_iter(), reconnect_task(), rest_config_process_request(), rest_copying_process_request(), rest_credential_process_request(), rest_identity_process_request(), rest_process_request(), return_response(), return_userinfo_response(), revoke_ticket_cont(), store_ticket_issue_cont(), subject_ego_lookup(), ticket_collect(), tld_iter(), token_endpoint(), url_iterator(), userinfo_endpoint(), and verify_cred_cont().

◆ inbound_only

int inbound_only
static

Option -i.

Definition at line 40 of file gnunet-dns-monitor.c.

Referenced by handle_session_add(), main(), and run().

◆ outbound_only

int outbound_only
static

Option -o.

Definition at line 45 of file gnunet-dns-monitor.c.

Referenced by main(), and run().

◆ ret

int ret
static

Global return value (0 success).

Definition at line 50 of file gnunet-dns-monitor.c.

Referenced by main().

◆ verbosity

unsigned int verbosity
static

Selected level of verbosity.

Definition at line 55 of file gnunet-dns-monitor.c.

Referenced by main().