lwdclient.c File Reference

#include <config.h>
#include <isc/socket.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/util.h>
#include <dns/adb.h>
#include <dns/view.h>
#include <dns/log.h>
#include <named/types.h>
#include <named/log.h>
#include <named/lwresd.h>
#include <named/lwdclient.h>

Go to the source code of this file.

Defines

#define SHUTTINGDOWN(cm)   ((cm->flags & NS_LWDCLIENTMGR_FLAGSHUTTINGDOWN) != 0)

Functions

static void lwdclientmgr_shutdown_callback (isc_task_t *task, isc_event_t *ev)
void ns_lwdclient_log (int level, const char *format,...)
isc_result_t ns_lwdclientmgr_create (ns_lwreslistener_t *listener, unsigned int nclients, isc_taskmgr_t *taskmgr)
static void lwdclientmgr_destroy (ns_lwdclientmgr_t *cm)
static void process_request (ns_lwdclient_t *client)
void ns_lwdclient_recv (isc_task_t *task, isc_event_t *ev)
isc_result_t ns_lwdclient_startrecv (ns_lwdclientmgr_t *cm)
void ns_lwdclient_stateidle (ns_lwdclient_t *client)
void ns_lwdclient_send (isc_task_t *task, isc_event_t *ev)
isc_result_t ns_lwdclient_sendreply (ns_lwdclient_t *client, isc_region_t *r)
void ns_lwdclient_initialize (ns_lwdclient_t *client, ns_lwdclientmgr_t *cmgr)


Detailed Description

Definition in file lwdclient.c.


Define Documentation

#define SHUTTINGDOWN ( cm   )     ((cm->flags & NS_LWDCLIENTMGR_FLAGSHUTTINGDOWN) != 0)

Definition at line 38 of file lwdclient.c.


Function Documentation

static void lwdclientmgr_shutdown_callback ( isc_task_t task,
isc_event_t ev 
) [static]

Definition at line 324 of file lwdclient.c.

References dns_adb_cancelfind(), ns_lwdclient::find, ns_lwdclientmgr::flags, isc_event_free(), ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_LIST_UNLINK, isc_mem_put, ISC_SOCKCANCEL_ALL, isc_socket_cancel(), ns_lwdclientmgr::mctx, ns_lwdclient_log(), NS_LWDCLIENTMGR_FLAGSHUTTINGDOWN, REQUIRE, SHUTTINGDOWN, ns_lwdclientmgr::sock, ns_lwdclient::v4find, and ns_lwdclient::v6find.

Referenced by ns_lwdclientmgr_create().

void ns_lwdclient_log ( int  level,
const char *  format,
  ... 
)

Definition at line 44 of file lwdclient.c.

References dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_ADB, ISC_LOG_DEBUG, and isc_log_vwrite().

isc_result_t ns_lwdclientmgr_create ( ns_lwreslistener_t listener,
unsigned int  nclients,
isc_taskmgr_t taskmgr 
)

Definition at line 55 of file lwdclient.c.

References ns_lwdclientmgr::flags, ISC_LINK_INIT, ISC_LIST_EMPTY, ISC_LIST_HEAD, ISC_LIST_INIT, ISC_LIST_UNLINK, isc_mem_get, isc_mem_put, ISC_R_FAILURE, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_socket_attach(), isc_task_create(), isc_task_detach(), isc_task_onshutdown(), isc_task_setname(), ns_lwdclientmgr::listener, ns_lwdclientmgr::lwctx, lwdclientmgr_shutdown_callback(), ns_lwreslistener::manager, ns_lwdclientmgr::mctx, ns_lwresd::mctx, ns__lwresd_memalloc(), ns__lwresd_memfree(), ns_lwdclient_initialize(), ns_lwdclient_log(), ns_lwreslistener_attach(), ns_lwreslistener_linkcm(), ns_lwreslistener::sock, ns_lwdclientmgr::sock, ns_lwdclientmgr::task, ns_lwresd::view, and ns_lwdclientmgr::view.

Referenced by listener_startclients().

static void lwdclientmgr_destroy ( ns_lwdclientmgr_t cm  )  [static]

Definition at line 138 of file lwdclient.c.

References ISC_LIST_EMPTY, ISC_LIST_HEAD, ISC_LIST_UNLINK, isc_mem_put, isc_socket_detach(), isc_task_detach(), ns_lwdclientmgr::listener, ns_lwdclientmgr::lwctx, ns_lwdclientmgr::mctx, ns_lwdclient_log(), ns_lwreslistener_detach(), ns_lwreslistener_unlinkcm(), SHUTTINGDOWN, ns_lwdclientmgr::sock, ns_lwdclientmgr::task, and ns_lwdclientmgr::view.

Referenced by ns_lwdclient_startrecv().

static void process_request ( ns_lwdclient_t client  )  [static]

Definition at line 175 of file lwdclient.c.

References ns_lwdclient::buffer, ISC_R_SUCCESS, ns_lwdclient_log(), ns_lwdclient_processgabn(), ns_lwdclient_processgnba(), ns_lwdclient_processgrbn(), ns_lwdclient_processnoop(), ns_lwdclient_stateidle(), ns_lwdclient::pkt, and ns_lwdclient::recvlength.

void ns_lwdclient_recv ( isc_task_t task,
isc_event_t ev 
)

Definition at line 217 of file lwdclient.c.

References isc_socketevent::address, ns_lwdclient::address, isc_socketevent::attributes, isc_region::base, ns_lwdclient::buffer, ns_lwdclient::clientmgr, ns_lwdclientmgr::flags, INSIST, isc_event_free(), ISC_FALSE, ISC_LOG_ERROR, isc_log_write(), ISC_R_SUCCESS, isc_result_totext(), ISC_SOCKEVENTATTR_PKTINFO, ISC_TRUE, isc_socketevent::n, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_LWRESD, NS_LWDCLIENT_ISRECV, ns_lwdclient_log(), NS_LWDCLIENT_SETRECVDONE, ns_lwdclient_startrecv(), ns_lwdclient_stateidle(), NS_LWDCLIENTMGR_FLAGRECVPENDING, isc_socketevent::pktinfo, ns_lwdclient::pktinfo, ns_lwdclient::pktinfo_valid, process_request(), ns_lwdclient::recvlength, isc_socketevent::region, and isc_socketevent::result.

Referenced by ns_lwdclient_startrecv().

isc_result_t ns_lwdclient_startrecv ( ns_lwdclientmgr_t cm  ) 

Definition at line 273 of file lwdclient.c.

References isc_region::base, ns_lwdclient::buffer, ns_lwdclientmgr::flags, INSIST, ISC_LIST_APPEND, ISC_LIST_HEAD, ISC_LIST_UNLINK, ISC_R_SUCCESS, isc_socket_recv(), isc_region::length, lwdclientmgr_destroy(), NS_LWDCLIENT_ISIDLE, ns_lwdclient_recv(), NS_LWDCLIENT_SETRECV, NS_LWDCLIENTMGR_FLAGRECVPENDING, r, SHUTTINGDOWN, ns_lwdclientmgr::sock, and ns_lwdclientmgr::task.

Referenced by listener_startclients(), ns_lwdclient_recv(), and ns_lwdclient_stateidle().

void ns_lwdclient_stateidle ( ns_lwdclient_t client  ) 

Definition at line 378 of file lwdclient.c.

References ns_lwdclient::arg, ns_lwdclient::clientmgr, INSIST, ISC_LIST_PREPEND, ISC_LIST_UNLINK, ISC_LOG_ERROR, isc_log_write(), ISC_R_SUCCESS, isc_result_totext(), NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_LWRESD, NS_LWDCLIENT_SETIDLE, ns_lwdclient_startrecv(), ns_lwdclient::sendbuf, ns_lwdclient::sendlength, ns_lwdclient::v4find, and ns_lwdclient::v6find.

Referenced by ns_lwdclient_errorpktsend(), ns_lwdclient_recv(), ns_lwdclient_send(), and process_request().

void ns_lwdclient_send ( isc_task_t task,
isc_event_t ev 
)

Definition at line 405 of file lwdclient.c.

References isc_region::base, ns_lwdclient::buffer, ns_lwdclient::clientmgr, INSIST, isc_event_free(), ns_lwdclientmgr::lwctx, NS_LWDCLIENT_ISSEND, ns_lwdclient_log(), ns_lwdclient_stateidle(), isc_socketevent::region, ns_lwdclient::sendbuf, ns_lwdclient::sendlength, and UNUSED.

Referenced by ns_lwdclient_sendreply().

isc_result_t ns_lwdclient_sendreply ( ns_lwdclient_t client,
isc_region_t r 
)

Definition at line 431 of file lwdclient.c.

References ns_lwdclient::address, ns_lwdclient::clientmgr, isc_socket_sendto(), ns_lwdclient_send(), ns_lwdclient::pktinfo, ns_lwdclient::pktinfo_valid, ns_lwdclientmgr::sock, and ns_lwdclientmgr::task.

Referenced by byaddr_done(), generate_reply(), lookup_done(), ns_lwdclient_errorpktsend(), and ns_lwdclient_processnoop().

void ns_lwdclient_initialize ( ns_lwdclient_t client,
ns_lwdclientmgr_t cmgr 
)

Definition at line 444 of file lwdclient.c.

References ns_lwdclient::arg, ns_lwdclient::byaddr, ns_lwdclient::clientmgr, ns_lwdclient::find, ns_lwdclient::find_wanted, ISC_FALSE, ISC_LINK_INIT, ISC_LIST_APPEND, ns_lwdclient::lookup, NS_LWDCLIENT_SETIDLE, ns_lwdclient::options, ns_lwdclient::pktinfo_valid, ns_lwdclient::recvlength, ns_lwdclient::sendbuf, ns_lwdclient::sendlength, ns_lwdclient::v4find, and ns_lwdclient::v6find.

Referenced by ns_lwdclientmgr_create().


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