#include <config.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <dns/acl.h>
#include <dns/compress.h>
#include <dns/dispatch.h>
#include <dns/events.h>
#include <dns/log.h>
#include <dns/message.h>
#include <dns/rdata.h>
#include <dns/rdatastruct.h>
#include <dns/request.h>
#include <dns/result.h>
#include <dns/tsig.h>
Go to the source code of this file.
Data Structures | |
struct | dns_request |
Defines | |
#define | REQUESTMGR_MAGIC ISC_MAGIC('R', 'q', 'u', 'M') |
#define | VALID_REQUESTMGR(mgr) ISC_MAGIC_VALID(mgr, REQUESTMGR_MAGIC) |
#define | REQUEST_MAGIC ISC_MAGIC('R', 'q', 'u', '!') |
#define | VALID_REQUEST(request) ISC_MAGIC_VALID(request, REQUEST_MAGIC) |
#define | DNS_REQUEST_NLOCKS 7 |
#define | DNS_REQUEST_F_CONNECTING 0x0001 |
#define | DNS_REQUEST_F_SENDING 0x0002 |
#define | DNS_REQUEST_F_CANCELED 0x0004 |
ctlevent received, or otherwise synchronously canceled | |
#define | DNS_REQUEST_F_TIMEDOUT 0x0008 |
canceled due to a timeout | |
#define | DNS_REQUEST_F_TCP 0x0010 |
This request used TCP. | |
#define | DNS_REQUEST_CANCELED(r) (((r)->flags & DNS_REQUEST_F_CANCELED) != 0) |
#define | DNS_REQUEST_CONNECTING(r) (((r)->flags & DNS_REQUEST_F_CONNECTING) != 0) |
#define | DNS_REQUEST_SENDING(r) (((r)->flags & DNS_REQUEST_F_SENDING) != 0) |
#define | DNS_REQUEST_TIMEDOUT(r) (((r)->flags & DNS_REQUEST_F_TIMEDOUT) != 0) |
Functions | |
typedef | ISC_LIST (dns_request_t) |
static void | mgr_destroy (dns_requestmgr_t *requestmgr) |
static void | mgr_shutdown (dns_requestmgr_t *requestmgr) |
static unsigned int | mgr_gethash (dns_requestmgr_t *requestmgr) |
static void | send_shutdown_events (dns_requestmgr_t *requestmgr) |
static isc_result_t | req_render (dns_message_t *message, isc_buffer_t **buffer, unsigned int options, isc_mem_t *mctx) |
static void | req_senddone (isc_task_t *task, isc_event_t *event) |
static void | req_response (isc_task_t *task, isc_event_t *event) |
static void | req_timeout (isc_task_t *task, isc_event_t *event) |
static isc_socket_t * | req_getsocket (dns_request_t *request) |
static void | req_connected (isc_task_t *task, isc_event_t *event) |
static void | req_sendevent (dns_request_t *request, isc_result_t result) |
static void | req_cancel (dns_request_t *request) |
static void | req_destroy (dns_request_t *request) |
static void | req_log (int level, const char *fmt,...) ISC_FORMAT_PRINTF(2 |
static void static void | do_cancel (isc_task_t *task, isc_event_t *event) |
isc_result_t | dns_requestmgr_create (isc_mem_t *mctx, isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr, isc_taskmgr_t *taskmgr, dns_dispatchmgr_t *dispatchmgr, dns_dispatch_t *dispatchv4, dns_dispatch_t *dispatchv6, dns_requestmgr_t **requestmgrp) |
Create a request manager. | |
void | dns_requestmgr_whenshutdown (dns_requestmgr_t *requestmgr, isc_task_t *task, isc_event_t **eventp) |
Send '*eventp' to 'task' when 'requestmgr' has completed shutdown. | |
void | dns_requestmgr_shutdown (dns_requestmgr_t *requestmgr) |
Start the shutdown process for 'requestmgr'. | |
static void | requestmgr_attach (dns_requestmgr_t *source, dns_requestmgr_t **targetp) |
static void | requestmgr_detach (dns_requestmgr_t **requestmgrp) |
void | dns_requestmgr_attach (dns_requestmgr_t *source, dns_requestmgr_t **targetp) |
Attach to the request manager. dns_requestmgr_shutdown() must not have been called on 'source' prior to calling dns_requestmgr_attach(). | |
void | dns_requestmgr_detach (dns_requestmgr_t **requestmgrp) |
Detach from the given requestmgr. If this is the final detach requestmgr will be destroyed. dns_requestmgr_shutdown() must be called before the final detach. | |
static isc_result_t | req_send (dns_request_t *request, isc_task_t *task, isc_sockaddr_t *address) |
static isc_result_t | new_request (isc_mem_t *mctx, dns_request_t **requestp) |
static isc_boolean_t | isblackholed (dns_dispatchmgr_t *dispatchmgr, isc_sockaddr_t *destaddr) |
static isc_result_t | create_tcp_dispatch (isc_boolean_t newtcp, isc_boolean_t share, dns_requestmgr_t *requestmgr, isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr, isc_dscp_t dscp, isc_boolean_t *connected, dns_dispatch_t **dispatchp) |
static isc_result_t | find_udp_dispatch (dns_requestmgr_t *requestmgr, isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr, dns_dispatch_t **dispatchp) |
static isc_result_t | get_dispatch (isc_boolean_t tcp, isc_boolean_t newtcp, isc_boolean_t share, dns_requestmgr_t *requestmgr, isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr, isc_dscp_t dscp, isc_boolean_t *connected, dns_dispatch_t **dispatchp) |
static isc_result_t | set_timer (isc_timer_t *timer, unsigned int timeout, unsigned int udpresend) |
isc_result_t | dns_request_createraw (dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf, isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr, unsigned int options, unsigned int timeout, isc_task_t *task, isc_taskaction_t action, void *arg, dns_request_t **requestp) |
See dns_request_createraw4(). | |
isc_result_t | dns_request_createraw2 (dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf, isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr, unsigned int options, unsigned int timeout, unsigned int udptimeout, isc_task_t *task, isc_taskaction_t action, void *arg, dns_request_t **requestp) |
See dns_request_createraw4(). | |
isc_result_t | dns_request_createraw3 (dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf, isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr, unsigned int options, unsigned int timeout, unsigned int udptimeout, unsigned int udpretries, isc_task_t *task, isc_taskaction_t action, void *arg, dns_request_t **requestp) |
See dns_request_createraw4(). | |
isc_result_t | dns_request_createraw4 (dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf, isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr, isc_dscp_t dscp, unsigned int options, unsigned int timeout, unsigned int udptimeout, unsigned int udpretries, isc_task_t *task, isc_taskaction_t action, void *arg, dns_request_t **requestp) |
Create and send a request. | |
isc_result_t | dns_request_create (dns_requestmgr_t *requestmgr, dns_message_t *message, isc_sockaddr_t *address, unsigned int options, dns_tsigkey_t *key, unsigned int timeout, isc_task_t *task, isc_taskaction_t action, void *arg, dns_request_t **requestp) |
Create and send a request. | |
isc_result_t | dns_request_createvia (dns_requestmgr_t *requestmgr, dns_message_t *message, isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr, unsigned int options, dns_tsigkey_t *key, unsigned int timeout, isc_task_t *task, isc_taskaction_t action, void *arg, dns_request_t **requestp) |
See dns_request_createvia4(). | |
isc_result_t | dns_request_createvia2 (dns_requestmgr_t *requestmgr, dns_message_t *message, isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr, unsigned int options, dns_tsigkey_t *key, unsigned int timeout, unsigned int udptimeout, isc_task_t *task, isc_taskaction_t action, void *arg, dns_request_t **requestp) |
See dns_request_createvia4(). | |
isc_result_t | dns_request_createvia3 (dns_requestmgr_t *requestmgr, dns_message_t *message, isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr, unsigned int options, dns_tsigkey_t *key, unsigned int timeout, unsigned int udptimeout, unsigned int udpretries, isc_task_t *task, isc_taskaction_t action, void *arg, dns_request_t **requestp) |
See dns_request_createvia4(). | |
isc_result_t | dns_request_createvia4 (dns_requestmgr_t *requestmgr, dns_message_t *message, isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr, isc_dscp_t dscp, unsigned int options, dns_tsigkey_t *key, unsigned int timeout, unsigned int udptimeout, unsigned int udpretries, isc_task_t *task, isc_taskaction_t action, void *arg, dns_request_t **requestp) |
Create and send a request. | |
static void | send_if_done (dns_request_t *request, isc_result_t result) |
void | dns_request_cancel (dns_request_t *request) |
Cancel 'request'. | |
isc_result_t | dns_request_getresponse (dns_request_t *request, dns_message_t *message, unsigned int options) |
Get the response to 'request' by filling in 'message'. | |
isc_boolean_t | dns_request_usedtcp (dns_request_t *request) |
Return whether this query used TCP or not. Setting DNS_REQUESTOPT_TCP in the call to dns_request_create() will cause the function to return ISC_TRUE, otherwise the result is based on the query message size. | |
void | dns_request_destroy (dns_request_t **requestp) |
Destroy 'request'. |
Definition in file request.c.
#define REQUESTMGR_MAGIC ISC_MAGIC('R', 'q', 'u', 'M') |
#define VALID_REQUESTMGR | ( | mgr | ) | ISC_MAGIC_VALID(mgr, REQUESTMGR_MAGIC) |
Definition at line 43 of file request.c.
Referenced by dns_request_createraw4(), dns_request_createvia4(), dns_requestmgr_attach(), dns_requestmgr_detach(), dns_requestmgr_shutdown(), dns_requestmgr_whenshutdown(), requestmgr_attach(), and requestmgr_detach().
#define REQUEST_MAGIC ISC_MAGIC('R', 'q', 'u', '!') |
#define VALID_REQUEST | ( | request | ) | ISC_MAGIC_VALID(request, REQUEST_MAGIC) |
Definition at line 46 of file request.c.
Referenced by dns_request_cancel(), dns_request_destroy(), dns_request_getresponse(), dns_request_usedtcp(), req_cancel(), req_connected(), req_destroy(), req_response(), req_send(), req_senddone(), req_sendevent(), and req_timeout().
#define DNS_REQUEST_NLOCKS 7 |
Referenced by dns_requestmgr_create(), ISC_LIST(), mgr_destroy(), and mgr_gethash().
#define DNS_REQUEST_F_CONNECTING 0x0001 |
Definition at line 95 of file request.c.
Referenced by dns_request_createraw4(), dns_request_createvia4(), and req_connected().
#define DNS_REQUEST_F_SENDING 0x0002 |
#define DNS_REQUEST_F_CANCELED 0x0004 |
ctlevent received, or otherwise synchronously canceled
Definition at line 97 of file request.c.
Referenced by req_cancel().
#define DNS_REQUEST_F_TIMEDOUT 0x0008 |
#define DNS_REQUEST_F_TCP 0x0010 |
This request used TCP.
Definition at line 100 of file request.c.
Referenced by dns_request_createraw4(), dns_request_createvia4(), and dns_request_usedtcp().
Definition at line 101 of file request.c.
Referenced by dns_request_cancel(), do_cancel(), req_connected(), and req_senddone().
Definition at line 103 of file request.c.
Referenced by dns_request_destroy(), req_cancel(), and req_connected().
Definition at line 105 of file request.c.
Referenced by dns_request_destroy(), req_cancel(), req_senddone(), and req_timeout().
typedef ISC_LIST | ( | dns_request_t | ) |
Definition at line 48 of file request.c.
References dispatchmgr, dispatchv4, dispatchv6, DNS_REQUEST_NLOCKS, hash, mctx, requests, socketmgr, taskmgr, and timermgr.
static void mgr_destroy | ( | dns_requestmgr_t * | requestmgr | ) | [static] |
Definition at line 395 of file request.c.
References DESTROYLOCK, dns_dispatch_detach(), DNS_REQUEST_NLOCKS, ISC_LOG_DEBUG, isc_mem_detach(), isc_mem_put, dns_request::mctx, req_log(), and REQUIRE.
Referenced by dns_requestmgr_detach(), and requestmgr_detach().
static void mgr_shutdown | ( | dns_requestmgr_t * | requestmgr | ) | [static] |
Definition at line 260 of file request.c.
References dns_request_cancel(), INSIST, ISC_LIST_EMPTY, ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_TRUE, and send_shutdown_events().
Referenced by dns_requestmgr_shutdown().
static unsigned int mgr_gethash | ( | dns_requestmgr_t * | requestmgr | ) | [static] |
Definition at line 418 of file request.c.
References DNS_REQUEST_NLOCKS, ISC_LOG_DEBUG, and req_log().
Referenced by dns_request_createraw4(), and dns_request_createvia4().
static void send_shutdown_events | ( | dns_requestmgr_t * | requestmgr | ) | [static] |
Definition at line 374 of file request.c.
References ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_LIST_UNLINK, ISC_LOG_DEBUG, isc_task_sendanddetach(), and req_log().
Referenced by dns_resolver_shutdown(), empty_bucket(), mgr_shutdown(), and requestmgr_detach().
static isc_result_t req_render | ( | dns_message_t * | message, | |
isc_buffer_t ** | buffer, | |||
unsigned int | options, | |||
isc_mem_t * | mctx | |||
) | [static] |
Definition at line 1143 of file request.c.
References cleanup(), dns_compress_init(), dns_compress_invalidate(), dns_compress_setsensitive(), dns_message_renderbegin(), dns_message_renderend(), dns_message_renderreset(), dns_message_rendersection(), DNS_R_USETCP, DNS_REQUESTOPT_CASE, DNS_REQUESTOPT_TCP, DNS_SECTION_ADDITIONAL, DNS_SECTION_ANSWER, DNS_SECTION_AUTHORITY, DNS_SECTION_QUESTION, isc_buffer_allocate(), isc_buffer_copyregion(), isc_buffer_free(), isc_buffer_putuint16, isc_buffer_usedregion, ISC_FALSE, ISC_LOG_DEBUG, ISC_R_SUCCESS, ISC_TRUE, isc_region::length, r, req_log(), and REQUIRE.
Referenced by dns_request_createvia4().
static void req_senddone | ( | isc_task_t * | task, | |
isc_event_t * | event | |||
) | [static] |
Definition at line 1406 of file request.c.
References DNS_REQUEST_CANCELED, DNS_REQUEST_F_SENDING, DNS_REQUEST_SENDING, DNS_REQUEST_TIMEDOUT, dns_request::flags, dns_request::hash, isc_event_free(), ISC_LOG_DEBUG, ISC_R_CANCELED, ISC_R_SUCCESS, ISC_R_TIMEDOUT, ISC_SOCKEVENT_SENDDONE, LOCK, req_cancel(), req_log(), REQUIRE, isc_socketevent::result, send_if_done(), UNLOCK, UNUSED, and VALID_REQUEST.
Referenced by req_send().
static void req_response | ( | isc_task_t * | task, | |
isc_event_t * | event | |||
) | [static] |
Definition at line 1439 of file request.c.
References dns_dispatchevent::buffer, dns_dispatch_removeresponse(), DNS_EVENT_DISPATCH, dns_result_totext(), dns_request::hash, isc_buffer_allocate(), isc_buffer_copyregion(), isc_buffer_free(), isc_buffer_usedregion, ISC_LOG_DEBUG, ISC_R_SUCCESS, isc_region::length, LOCK, dns_request::mctx, r, req_cancel(), req_log(), REQUIRE, dns_dispatchevent::result, send_if_done(), UNLOCK, UNUSED, and VALID_REQUEST.
Referenced by dns_request_createraw4(), and dns_request_createvia4().
static void req_timeout | ( | isc_task_t * | task, | |
isc_event_t * | event | |||
) | [static] |
Definition at line 1483 of file request.c.
References DNS_REQUEST_F_TIMEDOUT, DNS_REQUEST_SENDING, dns_request::flags, dns_request::hash, isc_event_free(), ISC_LOG_DEBUG, ISC_R_SUCCESS, ISC_R_TIMEDOUT, ISC_TIMEREVENT_TICK, LOCK, req_cancel(), req_log(), req_send(), REQUIRE, send_if_done(), UNLOCK, UNUSED, and VALID_REQUEST.
Referenced by dns_request_createraw4(), and dns_request_createvia4().
static isc_socket_t * req_getsocket | ( | dns_request_t * | request | ) | [static] |
Definition at line 1353 of file request.c.
References dns_dispatch_getattributes(), dns_dispatch_getentrysocket(), dns_dispatch_getsocket(), DNS_DISPATCHATTR_EXCLUSIVE, INSIST, and sock.
Referenced by dns_request_createraw4(), dns_request_createvia4(), and req_send().
static void req_connected | ( | isc_task_t * | task, | |
isc_event_t * | event | |||
) | [static] |
Definition at line 1368 of file request.c.
References dns_dispatch_starttcp(), DNS_REQUEST_CANCELED, DNS_REQUEST_CONNECTING, DNS_REQUEST_F_CONNECTING, DNS_REQUEST_TIMEDOUT, dns_request::flags, dns_request::hash, isc_event_free(), ISC_LOG_DEBUG, ISC_R_CANCELED, ISC_R_SUCCESS, ISC_R_TIMEDOUT, ISC_SOCKEVENT_CONNECT, LOCK, req_cancel(), req_log(), req_send(), REQUIRE, isc_socketevent::result, send_if_done(), UNLOCK, and VALID_REQUEST.
Referenced by dns_request_createraw4(), and dns_request_createvia4().
static void req_sendevent | ( | dns_request_t * | request, | |
isc_result_t | result | |||
) | [static] |
Definition at line 1512 of file request.c.
References ISC_LOG_DEBUG, isc_task_sendanddetach(), req_log(), REQUIRE, and VALID_REQUEST.
Referenced by send_if_done().
static void req_cancel | ( | dns_request_t * | request | ) | [static] |
Definition at line 1564 of file request.c.
References dns_dispatch_detach(), dns_dispatch_getattributes(), dns_dispatch_getentrysocket(), dns_dispatch_getsocket(), dns_dispatch_removeresponse(), DNS_DISPATCHATTR_EXCLUSIVE, DNS_REQUEST_CONNECTING, DNS_REQUEST_F_CANCELED, DNS_REQUEST_SENDING, dns_request::flags, ISC_LOG_DEBUG, ISC_SOCKCANCEL_CONNECT, ISC_SOCKCANCEL_SEND, isc_socket_cancel(), isc_timer_detach(), req_log(), REQUIRE, sock, and VALID_REQUEST.
Referenced by do_cancel(), req_connected(), req_response(), req_senddone(), and req_timeout().
static void req_destroy | ( | dns_request_t * | request | ) | [static] |
Definition at line 1529 of file request.c.
References dns_dispatch_detach(), dns_dispatch_removeresponse(), dns_tsigkey_detach(), isc_buffer_free(), isc_event_free(), ISC_LOG_DEBUG, isc_mem_detach(), isc_mem_put, isc_timer_detach(), dns_request::magic, dns_request::mctx, req_log(), requestmgr_detach(), REQUIRE, and VALID_REQUEST.
Referenced by dns_request_createraw4(), dns_request_createvia4(), and dns_request_destroy().
static void req_log | ( | int | level, | |
const char * | fmt, | |||
... | ||||
) | [static] |
Definition at line 1600 of file request.c.
References dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_REQUEST, and isc_log_vwrite().
Referenced by create_tcp_dispatch(), dns_request_cancel(), dns_request_createraw4(), dns_request_createvia4(), dns_request_destroy(), dns_request_getresponse(), dns_requestmgr_attach(), dns_requestmgr_create(), dns_requestmgr_detach(), dns_requestmgr_shutdown(), dns_requestmgr_whenshutdown(), isblackholed(), mgr_destroy(), mgr_gethash(), req_cancel(), req_connected(), req_destroy(), req_render(), req_response(), req_send(), req_senddone(), req_sendevent(), req_timeout(), requestmgr_attach(), requestmgr_detach(), and send_shutdown_events().
static void do_cancel | ( | isc_task_t * | task, | |
isc_event_t * | event | |||
) | [static] |
Definition at line 1254 of file request.c.
References DNS_EVENT_REQUESTCONTROL, DNS_REQUEST_CANCELED, dns_request::hash, INSIST, ISC_FALSE, ISC_R_CANCELED, LOCK, req_cancel(), send_if_done(), UNLOCK, and UNUSED.
isc_result_t dns_requestmgr_create | ( | isc_mem_t * | mctx, | |
isc_timermgr_t * | timermgr, | |||
isc_socketmgr_t * | socketmgr, | |||
isc_taskmgr_t * | taskmgr, | |||
dns_dispatchmgr_t * | dispatchmgr, | |||
dns_dispatch_t * | dispatchv4, | |||
dns_dispatch_t * | dispatchv6, | |||
dns_requestmgr_t ** | requestmgrp | |||
) |
Create a request manager.
Requires:
Definition at line 138 of file request.c.
References DESTROYLOCK, dns_dispatch_attach(), dns_dispatch_getattributes(), DNS_DISPATCHATTR_UDP, DNS_REQUEST_NLOCKS, ISC_FALSE, ISC_LIST_INIT, ISC_LOG_DEBUG, isc_mem_attach(), isc_mem_get, isc_mem_put, isc_mutex_init, ISC_R_NOMEMORY, ISC_R_SUCCESS, req_log(), REQUESTMGR_MAGIC, REQUIRE, sock, and UNUSED.
Referenced by dns_view_createresolver(), and setup_system().
void dns_requestmgr_whenshutdown | ( | dns_requestmgr_t * | requestmgr, | |
isc_task_t * | task, | |||
isc_event_t ** | eventp | |||
) |
Send '*eventp' to 'task' when 'requestmgr' has completed shutdown.
Notes:
Definition at line 216 of file request.c.
References ISC_LIST_APPEND, ISC_LOG_DEBUG, isc_task_attach(), isc_task_send(), LOCK, req_log(), REQUIRE, UNLOCK, and VALID_REQUESTMGR.
Referenced by dns_view_createresolver().
void dns_requestmgr_shutdown | ( | dns_requestmgr_t * | requestmgr | ) |
Start the shutdown process for 'requestmgr'.
Notes:
Definition at line 248 of file request.c.
References ISC_LOG_DEBUG, LOCK, mgr_shutdown(), req_log(), REQUIRE, UNLOCK, and VALID_REQUESTMGR.
Referenced by maybeshutdown(), and view_flushanddetach().
static void requestmgr_attach | ( | dns_requestmgr_t * | source, | |
dns_requestmgr_t ** | targetp | |||
) | [static] |
Definition at line 281 of file request.c.
References ISC_LOG_DEBUG, req_log(), REQUIRE, and VALID_REQUESTMGR.
Referenced by dns_request_createraw4(), and dns_request_createvia4().
static void requestmgr_detach | ( | dns_requestmgr_t ** | requestmgrp | ) | [static] |
Definition at line 300 of file request.c.
References INSIST, ISC_FALSE, ISC_LIST_HEAD, ISC_LOG_DEBUG, ISC_TRUE, LOCK, mgr_destroy(), req_log(), REQUIRE, send_shutdown_events(), UNLOCK, and VALID_REQUESTMGR.
Referenced by req_destroy().
void dns_requestmgr_attach | ( | dns_requestmgr_t * | source, | |
dns_requestmgr_t ** | targetp | |||
) |
Attach to the request manager. dns_requestmgr_shutdown() must not have been called on 'source' prior to calling dns_requestmgr_attach().
Requires:
Definition at line 329 of file request.c.
References ISC_LOG_DEBUG, LOCK, req_log(), REQUIRE, UNLOCK, and VALID_REQUESTMGR.
void dns_requestmgr_detach | ( | dns_requestmgr_t ** | requestmgrp | ) |
Detach from the given requestmgr. If this is the final detach requestmgr will be destroyed. dns_requestmgr_shutdown() must be called before the final detach.
Requires:
Definition at line 345 of file request.c.
References INSIST, ISC_FALSE, ISC_LIST_HEAD, ISC_LOG_DEBUG, ISC_TRUE, LOCK, mgr_destroy(), req_log(), REQUIRE, UNLOCK, and VALID_REQUESTMGR.
Referenced by destroy(), and doshutdown().
static isc_result_t req_send | ( | dns_request_t * | request, | |
isc_task_t * | task, | |||
isc_sockaddr_t * | address | |||
) | [inline, static] |
Definition at line 428 of file request.c.
References isc_socketevent::attributes, DNS_REQUEST_F_SENDING, isc_socketevent::dscp, dns_request::flags, isc_buffer_usedregion, ISC_LOG_DEBUG, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_socket_sendto2(), isc_socket_socketevent(), ISC_SOCKEVENT_SENDDONE, ISC_SOCKEVENTATTR_DSCP, dns_request::mctx, r, req_getsocket(), req_log(), req_senddone(), REQUIRE, sock, and VALID_REQUEST.
Referenced by dns_request_createraw4(), dns_request_createvia4(), req_connected(), and req_timeout().
static isc_result_t new_request | ( | isc_mem_t * | mctx, | |
dns_request_t ** | requestp | |||
) | [static] |
Definition at line 465 of file request.c.
References DNS_EVENT_REQUESTCONTROL, do_cancel(), dns_request::flags, ISC_EVENT_INIT, ISC_FALSE, ISC_LINK_INIT, isc_mem_attach(), isc_mem_get, ISC_R_NOMEMORY, ISC_R_SUCCESS, dns_request::magic, dns_request::mctx, and REQUEST_MAGIC.
Referenced by dns_request_createraw4(), and dns_request_createvia4().
static isc_boolean_t isblackholed | ( | dns_dispatchmgr_t * | dispatchmgr, | |
isc_sockaddr_t * | destaddr | |||
) | [static] |
Definition at line 505 of file request.c.
References dns_acl_match(), dns_dispatchmgr_getblackhole(), ISC_FALSE, ISC_LOG_DEBUG, isc_netaddr_format(), ISC_NETADDR_FORMATSIZE, isc_netaddr_fromsockaddr(), ISC_R_SUCCESS, ISC_TRUE, match(), and req_log().
Referenced by dns_request_createraw4(), and dns_request_createvia4().
static isc_result_t create_tcp_dispatch | ( | isc_boolean_t | newtcp, | |
isc_boolean_t | share, | |||
dns_requestmgr_t * | requestmgr, | |||
isc_sockaddr_t * | srcaddr, | |||
isc_sockaddr_t * | destaddr, | |||
isc_dscp_t | dscp, | |||
isc_boolean_t * | connected, | |||
dns_dispatch_t ** | dispatchp | |||
) | [static] |
Definition at line 528 of file request.c.
References bind_any, cleanup(), dns_dispatch_createtcp2(), dns_dispatch_gettcp(), dns_dispatch_gettcp2(), DNS_DISPATCHATTR_IPV4, DNS_DISPATCHATTR_IPV6, DNS_DISPATCHATTR_MAKEQUERY, DNS_DISPATCHATTR_TCP, ISC_LOG_DEBUG, ISC_R_SUCCESS, isc_sockaddr_anyofpf(), isc_sockaddr_format(), ISC_SOCKADDR_FORMATSIZE, isc_sockaddr_pf(), isc_sockaddr_setport(), isc_socket_bind(), isc_socket_create(), isc_socket_detach(), isc_socket_dscp(), isc_sockettype_tcp, ISC_TRUE, req_log(), and sock.
Referenced by get_dispatch().
static isc_result_t find_udp_dispatch | ( | dns_requestmgr_t * | requestmgr, | |
isc_sockaddr_t * | srcaddr, | |||
isc_sockaddr_t * | destaddr, | |||
dns_dispatch_t ** | dispatchp | |||
) | [static] |
Definition at line 606 of file request.c.
References dns_dispatch_attach(), dns_dispatch_getudp(), DNS_DISPATCHATTR_IPV4, DNS_DISPATCHATTR_IPV6, DNS_DISPATCHATTR_TCP, DNS_DISPATCHATTR_UDP, ISC_R_FAMILYNOSUPPORT, ISC_R_NOTIMPLEMENTED, ISC_R_SUCCESS, isc_sockaddr_pf(), and PF_INET6.
Referenced by get_dispatch().
static isc_result_t get_dispatch | ( | isc_boolean_t | tcp, | |
isc_boolean_t | newtcp, | |||
isc_boolean_t | share, | |||
dns_requestmgr_t * | requestmgr, | |||
isc_sockaddr_t * | srcaddr, | |||
isc_sockaddr_t * | destaddr, | |||
isc_dscp_t | dscp, | |||
isc_boolean_t * | connected, | |||
dns_dispatch_t ** | dispatchp | |||
) | [static] |
Definition at line 659 of file request.c.
References create_tcp_dispatch(), and find_udp_dispatch().
Referenced by dns_request_createraw4(), and dns_request_createvia4().
static isc_result_t set_timer | ( | isc_timer_t * | timer, | |
unsigned int | timeout, | |||
unsigned int | udpresend | |||
) | [static] |
Definition at line 678 of file request.c.
References ISC_FALSE, isc_interval_set(), ISC_R_SUCCESS, isc_time_nowplusinterval(), isc_timer_reset(), isc_timertype_limited, and isc_timertype_once.
Referenced by dns_request_createraw4(), and dns_request_createvia4().
isc_result_t dns_request_createraw | ( | dns_requestmgr_t * | requestmgr, | |
isc_buffer_t * | msgbuf, | |||
isc_sockaddr_t * | srcaddr, | |||
isc_sockaddr_t * | destaddr, | |||
unsigned int | options, | |||
unsigned int | timeout, | |||
isc_task_t * | task, | |||
isc_taskaction_t | action, | |||
void * | arg, | |||
dns_request_t ** | requestp | |||
) |
isc_result_t dns_request_createraw2 | ( | dns_requestmgr_t * | requestmgr, | |
isc_buffer_t * | msgbuf, | |||
isc_sockaddr_t * | srcaddr, | |||
isc_sockaddr_t * | destaddr, | |||
unsigned int | options, | |||
unsigned int | timeout, | |||
unsigned int | udptimeout, | |||
isc_task_t * | task, | |||
isc_taskaction_t | action, | |||
void * | arg, | |||
dns_request_t ** | requestp | |||
) |
isc_result_t dns_request_createraw3 | ( | dns_requestmgr_t * | requestmgr, | |
isc_buffer_t * | msgbuf, | |||
isc_sockaddr_t * | srcaddr, | |||
isc_sockaddr_t * | destaddr, | |||
unsigned int | options, | |||
unsigned int | timeout, | |||
unsigned int | udptimeout, | |||
unsigned int | udpretries, | |||
isc_task_t * | task, | |||
isc_taskaction_t | action, | |||
void * | arg, | |||
dns_request_t ** | requestp | |||
) |
isc_result_t dns_request_createraw4 | ( | dns_requestmgr_t * | requestmgr, | |
isc_buffer_t * | msgbuf, | |||
isc_sockaddr_t * | srcaddr, | |||
isc_sockaddr_t * | destaddr, | |||
isc_dscp_t | dscp, | |||
unsigned int | options, | |||
unsigned int | timeout, | |||
unsigned int | udptimeout, | |||
unsigned int | udpretries, | |||
isc_task_t * | task, | |||
isc_taskaction_t | action, | |||
void * | arg, | |||
dns_request_t ** | requestp | |||
) |
Create and send a request.
Notes:
Definition at line 741 of file request.c.
References isc_region::base, cleanup(), dns_dispatch_addresponse3(), dns_dispatch_detach(), DNS_DISPATCHOPT_FIXEDID, DNS_EVENT_REQUESTDONE, DNS_MESSAGE_HEADERLEN, DNS_R_BLACKHOLED, DNS_R_FORMERR, DNS_REQUEST_F_CONNECTING, DNS_REQUEST_F_TCP, DNS_REQUESTOPT_FIXEDID, DNS_REQUESTOPT_SHARE, DNS_REQUESTOPT_TCP, dns_result_totext(), dns_request::flags, get_dispatch(), dns_request::hash, INSIST, isblackholed(), isc_buffer_allocate(), isc_buffer_copyregion(), isc_buffer_putuint16, isc_buffer_usedregion, isc_event_allocate(), ISC_FALSE, ISC_LIST_APPEND, ISC_LIST_UNLINK, ISC_LOG_DEBUG, ISC_R_FAILURE, ISC_R_NOMEMORY, ISC_R_SHUTTINGDOWN, ISC_R_SUCCESS, isc_region_consume, isc_sockaddr_pf(), isc_socket_connect(), isc_task_attach(), isc_task_detach(), ISC_TF, isc_timer_create(), isc_timertype_inactive, ISC_TRUE, isc_region::length, LOCK, dns_request::mctx, mgr_gethash(), new_request(), r, req_connected(), req_destroy(), req_getsocket(), req_log(), req_response(), req_send(), req_timeout(), requestmgr_attach(), REQUIRE, set_timer(), sock, UNLOCK, and VALID_REQUESTMGR.
Referenced by dns_request_createraw(), dns_request_createraw2(), dns_request_createraw3(), and sendtomaster().
isc_result_t dns_request_create | ( | dns_requestmgr_t * | requestmgr, | |
dns_message_t * | message, | |||
isc_sockaddr_t * | address, | |||
unsigned int | options, | |||
dns_tsigkey_t * | key, | |||
unsigned int | timeout, | |||
isc_task_t * | task, | |||
isc_taskaction_t | action, | |||
void * | arg, | |||
dns_request_t ** | requestp | |||
) |
Create and send a request.
Notes:
Definition at line 917 of file request.c.
References dns_request_createvia4().
isc_result_t dns_request_createvia | ( | dns_requestmgr_t * | requestmgr, | |
dns_message_t * | message, | |||
isc_sockaddr_t * | srcaddr, | |||
isc_sockaddr_t * | destaddr, | |||
unsigned int | options, | |||
dns_tsigkey_t * | key, | |||
unsigned int | timeout, | |||
isc_task_t * | task, | |||
isc_taskaction_t | action, | |||
void * | arg, | |||
dns_request_t ** | requestp | |||
) |
isc_result_t dns_request_createvia2 | ( | dns_requestmgr_t * | requestmgr, | |
dns_message_t * | message, | |||
isc_sockaddr_t * | srcaddr, | |||
isc_sockaddr_t * | destaddr, | |||
unsigned int | options, | |||
dns_tsigkey_t * | key, | |||
unsigned int | timeout, | |||
unsigned int | udptimeout, | |||
isc_task_t * | task, | |||
isc_taskaction_t | action, | |||
void * | arg, | |||
dns_request_t ** | requestp | |||
) |
isc_result_t dns_request_createvia3 | ( | dns_requestmgr_t * | requestmgr, | |
dns_message_t * | message, | |||
isc_sockaddr_t * | srcaddr, | |||
isc_sockaddr_t * | destaddr, | |||
unsigned int | options, | |||
dns_tsigkey_t * | key, | |||
unsigned int | timeout, | |||
unsigned int | udptimeout, | |||
unsigned int | udpretries, | |||
isc_task_t * | task, | |||
isc_taskaction_t | action, | |||
void * | arg, | |||
dns_request_t ** | requestp | |||
) |
Definition at line 961 of file request.c.
References dns_request_createvia4().
Referenced by dns_client_startrequest(), receive_soa(), recvsoa(), request_soa(), send_update(), sendrequest(), and update_done().
isc_result_t dns_request_createvia4 | ( | dns_requestmgr_t * | requestmgr, | |
dns_message_t * | message, | |||
isc_sockaddr_t * | srcaddr, | |||
isc_sockaddr_t * | destaddr, | |||
isc_dscp_t | dscp, | |||
unsigned int | options, | |||
dns_tsigkey_t * | key, | |||
unsigned int | timeout, | |||
unsigned int | udptimeout, | |||
unsigned int | udpretries, | |||
isc_task_t * | task, | |||
isc_taskaction_t | action, | |||
void * | arg, | |||
dns_request_t ** | requestp | |||
) |
Create and send a request.
Notes:
Definition at line 976 of file request.c.
References cleanup(), dns_dispatch_addresponse2(), dns_dispatch_detach(), dns_dispatch_removeresponse(), DNS_EVENT_REQUESTDONE, dns_message_getquerytsig(), dns_message_renderreset(), dns_message_settsigkey(), DNS_R_BLACKHOLED, DNS_R_USETCP, DNS_REQUEST_F_CONNECTING, DNS_REQUEST_F_TCP, DNS_REQUESTOPT_SHARE, DNS_REQUESTOPT_TCP, dns_result_totext(), dns_tsigkey_attach(), dns_request::flags, get_dispatch(), dns_request::hash, dns_message::id, INSIST, isblackholed(), isc_event_allocate(), ISC_FALSE, ISC_LIST_APPEND, ISC_LIST_UNLINK, ISC_LOG_DEBUG, ISC_R_FAILURE, ISC_R_FAMILYMISMATCH, ISC_R_NOMEMORY, ISC_R_SHUTTINGDOWN, ISC_R_SUCCESS, isc_sockaddr_pf(), isc_socket_connect(), isc_task_attach(), isc_task_detach(), ISC_TF, isc_timer_create(), isc_timertype_inactive, ISC_TRUE, LOCK, dns_request::mctx, mgr_gethash(), new_request(), req_connected(), req_destroy(), req_getsocket(), req_log(), req_render(), req_response(), req_send(), req_timeout(), requestmgr_attach(), REQUIRE, set_timer(), sock, UNLOCK, and VALID_REQUESTMGR.
Referenced by dns_request_create(), dns_request_createvia(), dns_request_createvia2(), dns_request_createvia3(), notify_send_toaddr(), ns_query(), and soa_query().
static void send_if_done | ( | dns_request_t * | request, | |
isc_result_t | result | |||
) | [static] |
Definition at line 1245 of file request.c.
References req_sendevent().
Referenced by do_cancel(), req_connected(), req_response(), req_senddone(), and req_timeout().
void dns_request_cancel | ( | dns_request_t * | request | ) |
Cancel 'request'.
Requires:
Definition at line 1267 of file request.c.
References DNS_REQUEST_CANCELED, dns_request::hash, ISC_LOG_DEBUG, isc_task_send(), ISC_TRUE, LOCK, req_log(), REQUIRE, UNLOCK, and VALID_REQUEST.
Referenced by dns_client_cancelrequest(), dns_client_cancelupdate(), dns_zone_setmasterswithkeys(), forward_cancel(), mgr_shutdown(), notify_cancel(), and zone_shutdown().
isc_result_t dns_request_getresponse | ( | dns_request_t * | request, | |
dns_message_t * | message, | |||
unsigned int | options | |||
) |
Get the response to 'request' by filling in 'message'.
'options' is passed to dns_message_parse(). See dns_message_parse() for more details.
Requires:
Definition at line 1284 of file request.c.
References dns_message_parse(), dns_message_setquerytsig(), dns_message_settsigkey(), dns_tsig_verify(), ISC_LOG_DEBUG, ISC_R_SUCCESS, req_log(), REQUIRE, and VALID_REQUEST.
Referenced by forward_callback(), notify_done(), receive_soa(), recvsoa(), refresh_callback(), request_done(), stub_callback(), update_completed(), and update_done().
isc_boolean_t dns_request_usedtcp | ( | dns_request_t * | request | ) |
Return whether this query used TCP or not. Setting DNS_REQUESTOPT_TCP in the call to dns_request_create() will cause the function to return ISC_TRUE, otherwise the result is based on the query message size.
Requires:
Definition at line 1310 of file request.c.
References DNS_REQUEST_F_TCP, dns_request::flags, ISC_TF, REQUIRE, and VALID_REQUEST.
Referenced by refresh_callback(), and stub_callback().
void dns_request_destroy | ( | dns_request_t ** | requestp | ) |
Destroy 'request'.
Requires:
Definition at line 1317 of file request.c.
References DNS_REQUEST_CONNECTING, DNS_REQUEST_SENDING, dns_request::hash, INSIST, ISC_LINK_LINKED, ISC_LIST_UNLINK, ISC_LOG_DEBUG, LOCK, req_destroy(), req_log(), REQUIRE, UNLOCK, and VALID_REQUEST.
Referenced by dns_client_destroyreqtrans(), forward_callback(), forward_destroy(), notify_destroy(), notify_done(), receive_soa(), recvsoa(), refresh_callback(), stub_callback(), update_completed(), update_done(), and zone_free().