Go to the source code of this file.
Functions | |
static void | modify_record (const struct GNUNET_DNSPARSER_Record *record) |
Modify the given DNS record. More... | |
static void | modify_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 DNS service. More... | |
static char * | n4 |
New target for A records. More... | |
static char * | n6 |
New target for AAAA records. More... | |
static int | ret |
Global return value (0 success). More... | |
static unsigned int | verbosity |
Selected level of verbosity. More... | |
|
static |
Modify the given DNS record.
record | record to modify |
Definition at line 63 of file gnunet-dns-redirector.c.
References GNUNET_assert, 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_TXT, n4, n6, record(), and verbosity.
Referenced by modify_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 135 of file gnunet-dns-redirector.c.
References GNUNET_break, GNUNET_DNS_request_answer(), GNUNET_DNS_request_forward(), GNUNET_DNSPARSER_free_packet(), GNUNET_DNSPARSER_pack(), GNUNET_DNSPARSER_parse(), GNUNET_free, GNUNET_NO, GNUNET_OK, modify_record(), p, request, and verbosity.
Referenced by run().
|
static |
Shutdown.
Definition at line 182 of file gnunet-dns-redirector.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 201 of file gnunet-dns-redirector.c.
References cfg, do_disconnect(), GNUNET_DNS_connect(), GNUNET_DNS_FLAG_POST_RESOLUTION, GNUNET_SCHEDULER_add_shutdown(), handle, modify_request(), n4, and n6.
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
Definition at line 234 of file gnunet-dns-redirector.c.
References gettext_noop, GNUNET_free_nz, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_string(), GNUNET_GETOPT_option_verbose(), GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_STRINGS_get_utf8_args(), n4, n6, options, ret, run(), and verbosity.
|
static |
Handle to DNS service.
Definition at line 34 of file gnunet-dns-redirector.c.
Referenced by do_disconnect(), and run().
|
static |
New target for A records.
Definition at line 39 of file gnunet-dns-redirector.c.
Referenced by main(), modify_record(), and run().
|
static |
New target for AAAA records.
Definition at line 44 of file gnunet-dns-redirector.c.
Referenced by main(), modify_record(), and run().
|
static |
Global return value (0 success).
Definition at line 49 of file gnunet-dns-redirector.c.
Referenced by main().
|
static |
Selected level of verbosity.
Definition at line 54 of file gnunet-dns-redirector.c.
Referenced by main(), modify_record(), and modify_request().