lwdgabn.c File Reference

#include <config.h>
#include <stdlib.h>
#include <isc/netaddr.h>
#include <isc/sockaddr.h>
#include <isc/socket.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/adb.h>
#include <dns/events.h>
#include <dns/result.h>
#include <named/types.h>
#include <named/lwaddr.h>
#include <named/lwdclient.h>
#include <named/lwresd.h>
#include <named/lwsearch.h>
#include <named/sortlist.h>

Go to the source code of this file.

Data Structures

struct  rankedaddress

Defines

#define NEED_V4(c)
#define NEED_V6(c)

Functions

static isc_result_t start_find (ns_lwdclient_t *)
static void restart_find (ns_lwdclient_t *)
static void init_gabn (ns_lwdclient_t *)
static void cleanup_gabn (ns_lwdclient_t *client)
 Destroy any finds. This can be used to "start over from scratch" and should only be called when events are _not_ being generated by the finds.
static void setup_addresses (ns_lwdclient_t *client, dns_adbfind_t *find, unsigned int at)
static int addr_compare (const void *av, const void *bv)
static void sort_addresses (ns_lwdclient_t *client)
static void generate_reply (ns_lwdclient_t *client)
static isc_result_t add_alias (ns_lwdclient_t *client)
static isc_result_t store_realname (ns_lwdclient_t *client)
static void process_gabn_finddone (isc_task_t *task, isc_event_t *ev)
void ns_lwdclient_processgabn (ns_lwdclient_t *client, lwres_buffer_t *b)


Detailed Description

Definition in file lwdgabn.c.


Define Documentation

#define NEED_V4 (  ) 

Value:

((((c)->find_wanted & LWRES_ADDRTYPE_V4) != 0) \
                         && ((c)->v4find == NULL))

Definition at line 43 of file lwdgabn.c.

Referenced by process_gabn_finddone(), and restart_find().

#define NEED_V6 (  ) 

Value:

((((c)->find_wanted & LWRES_ADDRTYPE_V6) != 0) \
                         && ((c)->v6find == NULL))

Definition at line 45 of file lwdgabn.c.

Referenced by generate_reply(), process_gabn_finddone(), and restart_find().


Function Documentation

static isc_result_t start_find ( ns_lwdclient_t client  )  [static]

Definition at line 526 of file lwdgabn.c.

References init_gabn(), ISC_R_SUCCESS, restart_find(), and store_realname().

Referenced by generate_reply(), and ns_lwdclient_processgabn().

static void restart_find ( ns_lwdclient_t client  )  [static]

Definition at line 405 of file lwdgabn.c.

References dns_view::adb, add_alias(), cleanup_gabn(), ns_lwdclient::clientmgr, dns_adb_createfind(), dns_adb_destroyfind(), DNS_ADBFIND_INET, DNS_ADBFIND_INET6, DNS_ADBFIND_RETURNLAME, DNS_ADBFIND_WANTEVENT, dns_fixedname_name, DNS_R_ALIAS, dns_rootname, dns_view::dstport, ns_lwdclient::find, generate_reply(), INSIST, ISC_FALSE, ISC_R_SUCCESS, isc_result_totext(), ISC_TRUE, NEED_V4, NEED_V6, ns_lwdclient_errorpktsend(), ns_lwdclient_log(), dns_adbfind::options, process_gabn_finddone(), dns_adbfind::query_pending, ns_lwdclient::target_name, ns_lwdclientmgr::task, ns_lwdclient::v4find, ns_lwdclient::v6find, and ns_lwdclientmgr::view.

Referenced by process_gabn_finddone(), and start_find().

static void init_gabn ( ns_lwdclient_t client  )  [static]

Definition at line 544 of file lwdgabn.c.

References ns_lwdclient::addrs, ns_lwdclient::aliases, ns_lwdclient::aliaslen, ns_lwdclient::buffer, ns_lwdclient::gabn, isc_buffer_init, and ns_lwdclient::recv_buffer.

Referenced by start_find().

static void cleanup_gabn ( ns_lwdclient_t client  )  [static]

Destroy any finds. This can be used to "start over from scratch" and should only be called when events are _not_ being generated by the finds.

Definition at line 57 of file lwdgabn.c.

References dns_adb_destroyfind(), ns_lwdclient_log(), ns_lwdclient::v4find, and ns_lwdclient::v6find.

Referenced by generate_reply(), process_gabn_finddone(), and restart_find().

static void setup_addresses ( ns_lwdclient_t client,
dns_adbfind_t find,
unsigned int  at 
) [static]

Definition at line 71 of file lwdgabn.c.

References ns_lwdclient::addrs, AF_INET6, DNS_ADBFIND_INET, ns_lwdclient::gabn, ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_R_SUCCESS, dns_adbfind::list, lwaddr_lwresaddr_fromsockaddr(), ns_lwdclient_log(), REQUIRE, isc_sockaddr::sa, dns_adbaddrinfo::sockaddr, and isc_sockaddr::type.

Referenced by generate_reply().

static int addr_compare ( const void *  av,
const void *  bv 
) [static]

Definition at line 113 of file lwdgabn.c.

References rankedaddress::rank.

Referenced by sort_addresses().

static void sort_addresses ( ns_lwdclient_t client  )  [static]

Definition at line 120 of file lwdgabn.c.

References addr_compare(), rankedaddress::address, ns_lwdclient::address, ns_lwdclient::addrs, arg, ns_lwdclient::clientmgr, ns_lwdclient::gabn, INSIST, isc_mem_get, isc_mem_put, isc_netaddr_fromsockaddr(), ISC_R_SUCCESS, ns_lwdclientmgr::listener, lwaddr_lwresaddr_fromnetaddr(), lwaddr_netaddr_fromlwresaddr(), ns_lwreslistener::manager, ns_lwresd::mctx, ns_sortlist_byaddrsetup(), rankedaddress::rank, dns_view::sortlist, and ns_lwresd::view.

Referenced by generate_reply().

static void generate_reply ( ns_lwdclient_t client  )  [static]

Definition at line 164 of file lwdgabn.c.

References isc_region::base, cleanup_gabn(), ns_lwdclient::clientmgr, dns_adb_destroyfind(), DNS_ADBFIND_INET, DNS_ADBFIND_INET6, ns_lwdclient::find, ns_lwdclient::gabn, ISC_R_SUCCESS, isc_region::length, ns_lwdclientmgr::lwctx, NEED_V6, ns_lwdclient_errorpktsend(), ns_lwdclient_log(), ns_lwdclient_sendreply(), NS_LWDCLIENT_SETSEND, ns_lwsearchctx_next(), ns_lwdclient::pkt, r, ns_lwdclient::searchctx, ns_lwdclient::sendbuf, ns_lwdclient::sendlength, setup_addresses(), sort_addresses(), start_find(), ns_lwdclient::v4find, and ns_lwdclient::v6find.

Referenced by process_gabn_finddone(), and restart_find().

static isc_result_t add_alias ( ns_lwdclient_t client  )  [static]

Definition at line 277 of file lwdgabn.c.

References isc_buffer::base, dns_fixedname_name, dns_name_totext(), ns_lwdclient::gabn, ISC_R_SUCCESS, ISC_TRUE, ns_lwdclient::recv_buffer, ns_lwdclient::target_name, and isc_buffer::used.

Referenced by restart_find().

static isc_result_t store_realname ( ns_lwdclient_t client  )  [static]

Definition at line 312 of file lwdgabn.c.

References isc_buffer::base, dns_fixedname_name, dns_name_totext(), ns_lwdclient::gabn, ISC_R_SUCCESS, ISC_TRUE, ns_lwsearchctx_current(), ns_lwdclient::recv_buffer, return(), ns_lwdclient::searchctx, ns_lwdclient::target_name, and isc_buffer::used.

Referenced by start_find().

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

Definition at line 341 of file lwdgabn.c.

References cleanup_gabn(), dns_adb_destroyfind(), DNS_EVENT_ADBMOREADDRESSES, DNS_EVENT_ADBNOMOREADDRESSES, ns_lwdclient::find, generate_reply(), isc_event_free(), ISC_FALSE, ISC_TRUE, NEED_V4, NEED_V6, ns_lwdclient_errorpktsend(), ns_lwdclient_log(), restart_find(), ns_lwdclient::v4find, and ns_lwdclient::v6find.

Referenced by restart_find().

void ns_lwdclient_processgabn ( ns_lwdclient_t client,
lwres_buffer_t *  b 
)

Definition at line 598 of file lwdgabn.c.

References ns_lwdclient::clientmgr, dns_fixedname_init, dns_fixedname_name, dns_name_fromtext(), ns_lwdclient::find_wanted, isc_buffer_add, isc_buffer_init, ISC_R_SUCCESS, ns_lwdclientmgr::listener, ns_lwdclientmgr::lwctx, ns_lwreslistener::manager, namebuf, ns_lwresd::ndots, ns_lwdclient_errorpktsend(), NS_LWDCLIENT_ISRECVDONE, ns_lwdclient_log(), ns_lwsearchctx_first(), ns_lwsearchctx_init(), ns_lwdclient::pkt, ns_lwdclient::query_name, REQUIRE, ns_lwresd::search, ns_lwdclient::searchctx, start_find(), and ns_lwdclient::target_name.

Referenced by process_request().


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