![]() |
GNUnet
0.11.x
|
Tool to monitor DNS queries. More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_dns_service.h"
#include "gnunet_dnsparser_lib.h"
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... | |
Tool to monitor DNS queries.
Definition in file gnunet-dns-monitor.c.
|
static |
Convert numeric DNS record type to a string.
type | type to convert |
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().
|
static |
Convert numeric DNS record class to a string.
class | class to convert |
Definition at line 101 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().
|
static |
Output the given DNS query to stdout.
query | query to display. |
Definition at line 124 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 140 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, 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().
|
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 264 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().
|
static |
Shutdown.
Definition at line 325 of file gnunet-dns-monitor.c.
References GNUNET_DNS_disconnect().
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 344 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().
int main | ( | int | argc, |
char *const * | argv | ||
) |
Definition at line 366 of file gnunet-dns-monitor.c.
References gettext_noop, GNUNET_free_nz, 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.
|
static |
Handle to transport service.
Definition at line 35 of file gnunet-dns-monitor.c.
Referenced by add_attribute_cont(), add_credential_cont(), add_get_request_to_pending(), add_list_handle(), add_service_handle(), aes_128_cbc_decrypt(), aes_128_cbc_encrypt(), attr_collect(), authorize_endpoint(), build_authz_response(), build_redirect(), cleanup_handle(), client_redirect(), code_redirect(), collect_finished_cb(), consume_cont(), consume_ticket(), consume_ticket_cont(), consume_timeout(), create_finished(), create_handle(), create_room(), cred_collect(), del_finished(), delete_attribute_cont(), delete_credential_cont(), delete_finished_cb(), do_error(), do_finished(), do_finished_create(), do_redirect_error(), do_timeout(), do_userinfo_error(), dump_pc(), ecdsa_symmetric_decrypt(), ecdsa_symmetric_encrypt(), 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_gns_cont(), GNUNET_ABD_collect(), GNUNET_ABD_connect(), GNUNET_ABD_request_cancel(), GNUNET_ABD_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_cancel(), GNUNET_GNS_lookup_limited(), GNUNET_GNS_lookup_with_tld(), GNUNET_MESSENGER_connect(), GNUNET_STATISTICS_get(), GNUNET_TRANSPORT_core_get_mq(), GST_connection_pool_get_handle(), handle_client_result(), handle_get_key(), handle_get_name(), handle_gns_response(), handle_intermediate(), handle_member_id(), handle_monitor_get(), handle_monitor_get_resp(), handle_monitor_put(), handle_recv_message(), handle_result(), handle_room_close(), handle_room_entry(), handle_room_open(), handle_service_message(), handle_ticket_result(), header_iterator(), iterate_send_room_message(), list_attribute_cont(), list_credential_cont(), list_tickets_cont(), login_cont(), login_redirect(), lookup_redirect_uri_result(), message_sent_cont(), mq_error_handler(), namestore_add(), namestore_add_or_update(), namestore_delete(), namestore_get(), namestore_iteration_error(), namestore_list_finished(), namestore_list_iteration(), namestore_update(), neighbour_delete(), ns_get_lookup_cb(), ns_lookup_cb(), ns_lookup_error_cb(), oidc_attr_collect(), oidc_attr_collect_finished_cb(), oidc_config_cors(), oidc_config_endpoint(), oidc_cred_collect(), oidc_cred_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_identity_process_request(), rest_process_request(), return_response(), revoke_ticket_cont(), send_room_message(), send_room_message_ext(), set_cont(), store_ticket_issue_cont(), ticket_collect(), tld_iter(), token_endpoint(), url_iterator(), and userinfo_endpoint().
|
static |
|
static |
|
static |
Global return value (0 success).
Definition at line 50 of file gnunet-dns-monitor.c.
Referenced by main().
|
static |
Selected level of verbosity.
Definition at line 55 of file gnunet-dns-monitor.c.
Referenced by main().