API to access the DNS service. More...
Go to the source code of this file.
Data Structures | |
| struct | GNUNET_DNS_RequestHandle |
| Handle to identify an individual DNS request. More... | |
| struct | GNUNET_DNS_Handle |
| DNS handle. More... | |
Functions | |
| static void | reconnect (void *cls) |
| Reconnect to the DNS service. | |
| static void | force_reconnect (struct GNUNET_DNS_Handle *dh) |
| Drop the existing connection and reconnect to the DNS service. | |
| static void | mq_error_handler (void *cls, enum GNUNET_MQ_Error error) |
| Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue. | |
| static int | check_request (void *cls, const struct GNUNET_DNS_Request *req) |
| This receives packets from the DNS service and calls the application to check that the request is well-formed. | |
| static void | handle_request (void *cls, const struct GNUNET_DNS_Request *req) |
| This receives packets from the DNS service and calls the application to handle it. | |
| 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 global DNS for resolution. | |
| void | GNUNET_DNS_request_drop (struct GNUNET_DNS_RequestHandle *rh) |
| If a GNUNET_DNS_RequestHandler calls this function, the request is to be dropped and no response should be generated. | |
| void | GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh, uint16_t reply_length, const char *reply) |
| If a GNUNET_DNS_RequestHandler calls this function, the request is supposed to be answered with the data provided to this call (with the modifications the function might have made). | |
| 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. | |
| void | GNUNET_DNS_disconnect (struct GNUNET_DNS_Handle *dh) |
| Disconnect from the DNS service. | |
API to access the DNS service.
Definition in file dns_api.c.
|
static |
Reconnect to the DNS service.
| cls | handle with the connection to connect |
Definition at line 196 of file dns_api.c.
References GNUNET_DNS_Handle::cfg, env, GNUNET_DNS_Handle::flags, GNUNET_DNS_Handle::generation, GNUNET_CLIENT_connect(), GNUNET_MESSAGE_TYPE_DNS_CLIENT_INIT, GNUNET_MESSAGE_TYPE_DNS_CLIENT_REQUEST, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg, GNUNET_MQ_send(), handlers, GNUNET_DNS_Handle::mq, mq_error_handler(), msg, GNUNET_DNS_Handle::reconnect_task, and request.
|
static |
Drop the existing connection and reconnect to the DNS service.
| dh | handle with the connection |
Definition at line 116 of file dns_api.c.
References GNUNET_MQ_destroy(), GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_UNIT_SECONDS, GNUNET_DNS_Handle::mq, reconnect(), and GNUNET_DNS_Handle::reconnect_task.
Referenced by mq_error_handler().
|
static |
Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue.
Not every message queue implementation supports an error handler.
| cls | closure with the struct GNUNET_DNS_Handle * |
| error | error code |
Definition at line 139 of file dns_api.c.
References force_reconnect().
Referenced by reconnect().
|
static |
This receives packets from the DNS service and calls the application to check that the request is well-formed.
| cls | the struct GNUNET_DNS_Handle |
| req | message from the service (request) |
Definition at line 156 of file dns_api.c.
References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, and GNUNET_DNS_Request::reserved.
|
static |
This receives packets from the DNS service and calls the application to handle it.
| cls | the struct GNUNET_DNS_Handle * |
| req | message from the service (request) |
Definition at line 176 of file dns_api.c.
References GNUNET_DNS_RequestHandle::dh, GNUNET_DNS_RequestHandle::generation, GNUNET_DNS_Handle::generation, GNUNET_new, GNUNET_DNS_Request::header, GNUNET_DNS_Handle::pending_requests, GNUNET_DNS_Request::request_id, GNUNET_DNS_RequestHandle::request_id, GNUNET_DNS_Handle::rh, GNUNET_DNS_Handle::rh_cls, and GNUNET_MessageHeader::size.