Go to the source code of this file.
Data Structures | |
struct | GNUNET_DNSSTUB_RequestSocket |
UDP socket we are using for sending DNS requests to the Internet. More... | |
struct | DnsServer |
DNS Server used for resolution. More... | |
struct | GNUNET_DNSSTUB_Context |
Handle to the stub resolver. More... | |
Macros | |
#define | DNS_RETRANSMIT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 250) |
Timeout for retrying DNS queries. More... | |
Functions | |
static void | cleanup_rs (struct GNUNET_DNSSTUB_RequestSocket *rs) |
We're done with a struct GNUNET_DNSSTUB_RequestSocket , close it for now. More... | |
static struct GNUNET_NETWORK_Handle * | open_socket (int af) |
Open source port for sending DNS requests. More... | |
static struct GNUNET_DNSSTUB_RequestSocket * | get_request_socket (struct GNUNET_DNSSTUB_Context *ctx) |
Get a socket of the specified address family to send out a UDP DNS request to the Internet. More... | |
static int | do_dns_read (struct GNUNET_DNSSTUB_RequestSocket *rs, struct GNUNET_NETWORK_Handle *dnsout) |
Actually do the reading of a DNS packet from our UDP socket and see if we have a valid, matching, pending request. More... | |
static void | read_response (void *cls) |
Read a DNS response from the (unhindered) UDP-Socket. More... | |
static void | schedule_read (struct GNUNET_DNSSTUB_RequestSocket *rs) |
Schedule read_response() task for rs. More... | |
static void | transmit_query (void *cls) |
Task to (re)transmit the DNS query, possibly repeatedly until we succeed. More... | |
struct GNUNET_DNSSTUB_RequestSocket * | GNUNET_DNSSTUB_resolve (struct GNUNET_DNSSTUB_Context *ctx, const void *request, size_t request_len, GNUNET_DNSSTUB_ResultCallback rc, void *rc_cls) |
Perform DNS resolution using our default IP from init. More... | |
void | GNUNET_DNSSTUB_resolve_cancel (struct GNUNET_DNSSTUB_RequestSocket *rs) |
Cancel DNS resolution. More... | |
struct GNUNET_DNSSTUB_Context * | GNUNET_DNSSTUB_start (unsigned int num_sockets) |
Start a DNS stub resolver. More... | |
int | GNUNET_DNSSTUB_add_dns_ip (struct GNUNET_DNSSTUB_Context *ctx, const char *dns_ip) |
Add nameserver for use by the DNSSTUB. More... | |
int | GNUNET_DNSSTUB_add_dns_sa (struct GNUNET_DNSSTUB_Context *ctx, const struct sockaddr *sa) |
Add nameserver for use by the DNSSTUB. More... | |
void | GNUNET_DNSSTUB_set_retry (struct GNUNET_DNSSTUB_Context *ctx, struct GNUNET_TIME_Relative retry_freq) |
How long should we try requests before timing out? Only effective for requests issued after this call. More... | |
void | GNUNET_DNSSTUB_stop (struct GNUNET_DNSSTUB_Context *ctx) |
Cleanup DNSSTUB resolver. More... | |
#define DNS_RETRANSMIT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 250) |
|
static |
We're done with a struct GNUNET_DNSSTUB_RequestSocket
, close it for now.
rs | request socket to clean up |
Definition at line 159 of file dnsstub.c.
References GNUNET_DNSSTUB_RequestSocket::dnsout4, GNUNET_DNSSTUB_RequestSocket::dnsout6, GNUNET_free, GNUNET_NETWORK_socket_close(), GNUNET_SCHEDULER_cancel(), GNUNET_DNSSTUB_RequestSocket::read_task, GNUNET_DNSSTUB_RequestSocket::request, and GNUNET_DNSSTUB_RequestSocket::retry_task.
Referenced by GNUNET_DNSSTUB_stop().
|
static |
Open source port for sending DNS requests.
af | AF_INET or AF_INET6 |
Definition at line 196 of file dnsstub.c.
References _, GNUNET_NETWORK_Handle::af, GNUNET_break, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_NETWORK_socket_bind(), GNUNET_NETWORK_socket_close(), GNUNET_NETWORK_socket_create(), GNUNET_OK, and ret.
Referenced by transmit_query().
|
static |
Get a socket of the specified address family to send out a UDP DNS request to the Internet.
ctx | the DNSSTUB context |
Definition at line 245 of file dnsstub.c.
References ctx, GNUNET_DNSSTUB_RequestSocket::ctx, GNUNET_CRYPTO_QUALITY_NONCE, GNUNET_CRYPTO_random_u32(), GNUNET_free, GNUNET_SCHEDULER_cancel(), GNUNET_DNSSTUB_RequestSocket::rc, GNUNET_DNSSTUB_RequestSocket::rc_cls, GNUNET_DNSSTUB_RequestSocket::read_task, GNUNET_DNSSTUB_RequestSocket::request, and GNUNET_DNSSTUB_RequestSocket::retry_task.
Referenced by GNUNET_DNSSTUB_resolve().
|
static |
Actually do the reading of a DNS packet from our UDP socket and see if we have a valid, matching, pending request.
rs | request socket with callback details |
dnsout | socket to read from |
Definition at line 291 of file dnsstub.c.
References _, ctx, GNUNET_DNSSTUB_RequestSocket::ctx, ds, GNUNET_ALIGN, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_log_strerror, GNUNET_NETWORK_get_fd(), GNUNET_NETWORK_socket_close(), GNUNET_NETWORK_socket_recvfrom(), GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, GNUNET_DNSSTUB_RequestSocket::rc, and GNUNET_DNSSTUB_RequestSocket::rc_cls.
Referenced by read_response().
|
static |
Read a DNS response from the (unhindered) UDP-Socket.
cls | struct GNUNET_DNSSTUB_RequestSocket to read from |
Definition at line 426 of file dnsstub.c.
References GNUNET_DNSSTUB_RequestSocket::dnsout4, GNUNET_DNSSTUB_RequestSocket::dnsout6, do_dns_read(), GNUNET_NETWORK_fdset_isset(), GNUNET_SCHEDULER_get_task_context(), GNUNET_SYSERR, GNUNET_SCHEDULER_TaskContext::read_ready, GNUNET_DNSSTUB_RequestSocket::read_task, schedule_read(), and tc.
Referenced by schedule_read().
|
static |
Schedule read_response() task for rs.
rs | request to schedule read operation for |
Definition at line 403 of file dnsstub.c.
References GNUNET_DNSSTUB_RequestSocket::dnsout4, GNUNET_DNSSTUB_RequestSocket::dnsout6, GNUNET_NETWORK_fdset_create(), GNUNET_NETWORK_fdset_destroy(), GNUNET_NETWORK_fdset_set(), GNUNET_SCHEDULER_add_select(), GNUNET_SCHEDULER_cancel(), GNUNET_SCHEDULER_PRIORITY_DEFAULT, GNUNET_TIME_UNIT_FOREVER_REL, read_response(), and GNUNET_DNSSTUB_RequestSocket::read_task.
Referenced by read_response(), and transmit_query().
|
static |
Task to (re)transmit the DNS query, possibly repeatedly until we succeed.
cls | our struct GNUNET_DNSSTUB_RequestSocket * |
Definition at line 454 of file dnsstub.c.
References _, ctx, GNUNET_DNSSTUB_RequestSocket::ctx, GNUNET_DNSSTUB_RequestSocket::dnsout4, GNUNET_DNSSTUB_RequestSocket::dnsout6, ds, GNUNET_DNSSTUB_RequestSocket::ds_pos, GNUNET_a2s(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_NETWORK_socket_sendto(), GNUNET_SCHEDULER_add_delayed(), GNUNET_SYSERR, open_socket(), GNUNET_DNSSTUB_RequestSocket::request, GNUNET_DNSSTUB_RequestSocket::request_len, GNUNET_DNSSTUB_RequestSocket::retry_task, schedule_read(), and transmit_query().
Referenced by GNUNET_DNSSTUB_resolve(), and transmit_query().