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_Handle * | handle |
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... | |
|
static |
Convert numeric DNS record type to a string.
type | type to convert |
Definition at line 64 of file gnunet-dns-monitor.c.
References 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_DNSPARSER_TYPE_URI, GNUNET_snprintf(), and type.
Referenced by display_query(), and display_record().
|
static |
Convert numeric DNS record class to a string.
class | class to convert |
Definition at line 102 of file gnunet-dns-monitor.c.
References 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().
|
static |
Output the given DNS query to stdout.
query | query to display. |
Definition at line 125 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().
|
static |
Output the given DNS record to stdout.
record | record to display. |
Definition at line 141 of file gnunet-dns-monitor.c.
References 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_DNSPARSER_TYPE_URI, GNUNET_free, GNUNET_TIME_absolute_get_remaining(), record(), and GNUNET_TIME_Relative::rel_value_us.
Referenced by display_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.
cls | closure |
rh | request handle to user for reply |
request_length | number of bytes in request |
request | udp payload of the DNS request |
Definition at line 280 of file gnunet-dns-monitor.c.
References display_query(), display_record(), GNUNET_DNS_request_forward(), GNUNET_DNSPARSER_free_packet(), GNUNET_DNSPARSER_parse(), p, and request.
Referenced by run().
|
static |
Shutdown.
Definition at line 341 of file gnunet-dns-monitor.c.
References GNUNET_DNS_disconnect(), and handle.
Referenced by run().
|
static |
Main function that will be run by the scheduler.
cls | closure |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
cfg | configuration |
Definition at line 360 of file gnunet-dns-monitor.c.
References cfg, 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(), handle, inbound_only, and outbound_only.
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
Definition at line 382 of file gnunet-dns-monitor.c.
References gettext_noop, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_verbose(), GNUNET_OK, GNUNET_OS_project_data_gnunet(), GNUNET_PROGRAM_run(), inbound_only, options, outbound_only, ret, run(), and verbosity.
|
static |
Handle to transport service.
Definition at line 34 of file gnunet-dns-monitor.c.
Referenced by do_disconnect(), and run().
|
static |
|
static |
|
static |
Global return value (0 success).
Definition at line 49 of file gnunet-dns-monitor.c.
Referenced by main().
|
static |
Selected level of verbosity.
Definition at line 54 of file gnunet-dns-monitor.c.
Referenced by main().