request.h File Reference

The request module provides simple request/response services useful for sending SOA queries, DNS Notify messages, and dynamic update requests. More...

#include <isc/lang.h>
#include <isc/event.h>
#include <dns/types.h>

Go to the source code of this file.

Data Structures

struct  dns_requestevent

Defines

#define DNS_REQUEST_H   1
#define DNS_REQUESTOPT_TCP   0x00000001U
#define DNS_REQUESTOPT_CASE   0x00000002U
#define DNS_REQUESTOPT_FIXEDID   0x00000004U
#define DNS_REQUESTOPT_SHARE   0x00000008U

Typedefs

typedef struct dns_requestevent dns_requestevent_t

Functions

ISC_LANG_BEGINDECLS 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'.
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.
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.
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.
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'.


Detailed Description

The request module provides simple request/response services useful for sending SOA queries, DNS Notify messages, and dynamic update requests.

MP:

Resources: Security:

Definition in file request.h.


Define Documentation

#define DNS_REQUEST_H   1

Definition at line 21 of file request.h.

#define DNS_REQUESTOPT_TCP   0x00000001U

Definition at line 49 of file request.h.

Referenced by dns_client_startrequest(), dns_request_createraw4(), dns_request_createvia4(), dns_zone_forwardupdate(), ns_query(), receive_soa(), req_render(), request_soa(), send_update(), soa_query(), and update_done().

#define DNS_REQUESTOPT_CASE   0x00000002U

Definition at line 50 of file request.h.

Referenced by req_render(), and send_update().

#define DNS_REQUESTOPT_FIXEDID   0x00000004U

Definition at line 51 of file request.h.

Referenced by dns_request_createraw4(), and dns_zone_forwardupdate().

#define DNS_REQUESTOPT_SHARE   0x00000008U

Definition at line 52 of file request.h.

Referenced by dns_request_createraw4(), and dns_request_createvia4().


Typedef Documentation

typedef struct dns_requestevent dns_requestevent_t


Function Documentation

ISC_LANG_BEGINDECLS 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:

Ensures:

Returns:

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:

Requires:

Ensures:

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:

Requires:

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().

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:

Ensures:

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().

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:

Requires:

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 
)

See dns_request_createvia4().

Definition at line 930 of file request.c.

References 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().

Definition at line 943 of file request.c.

References 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().

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:

Requires:

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().

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().

Definition at line 696 of file request.c.

References 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().

Definition at line 708 of file request.c.

References 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().

Definition at line 727 of file request.c.

References 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.

Notes:

Requires:

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().

void dns_request_cancel ( dns_request_t request  ) 

Cancel 'request'.

Requires:

Ensures:

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:

Returns:

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:

Returns:

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:

Ensures:

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().


Generated on Tue Apr 28 17:41:10 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha