lookup.c File Reference

#include <config.h>
#include <isc/mem.h>
#include <isc/netaddr.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/util.h>
#include <dns/db.h>
#include <dns/events.h>
#include <dns/lookup.h>
#include <dns/rdata.h>
#include <dns/rdataset.h>
#include <dns/rdatastruct.h>
#include <dns/resolver.h>
#include <dns/result.h>
#include <dns/view.h>

Go to the source code of this file.

Data Structures

struct  dns_lookup

Defines

#define LOOKUP_MAGIC   ISC_MAGIC('l', 'o', 'o', 'k')
#define VALID_LOOKUP(l)   ISC_MAGIC_VALID((l), LOOKUP_MAGIC)
#define MAX_RESTARTS   16

Functions

static void lookup_find (dns_lookup_t *lookup, dns_fetchevent_t *event)
static void fetch_done (isc_task_t *task, isc_event_t *event)
static isc_result_t start_fetch (dns_lookup_t *lookup)
static isc_result_t build_event (dns_lookup_t *lookup)
static isc_result_t view_find (dns_lookup_t *lookup, dns_name_t *foundname)
static void levent_destroy (isc_event_t *event)
isc_result_t dns_lookup_create (isc_mem_t *mctx, dns_name_t *name, dns_rdatatype_t type, dns_view_t *view, unsigned int options, isc_task_t *task, isc_taskaction_t action, void *arg, dns_lookup_t **lookupp)
 Finds the rrsets matching 'name' and 'type'.
void dns_lookup_cancel (dns_lookup_t *lookup)
 Cancel 'lookup'.
void dns_lookup_destroy (dns_lookup_t **lookupp)
 Destroy 'lookup'.


Detailed Description

Definition in file lookup.c.


Define Documentation

#define LOOKUP_MAGIC   ISC_MAGIC('l', 'o', 'o', 'k')

Definition at line 59 of file lookup.c.

Referenced by dns_lookup_create().

#define VALID_LOOKUP (  )     ISC_MAGIC_VALID((l), LOOKUP_MAGIC)

Definition at line 60 of file lookup.c.

Referenced by dns_lookup_cancel(), dns_lookup_destroy(), fetch_done(), and lookup_find().

#define MAX_RESTARTS   16

Definition at line 62 of file lookup.c.


Function Documentation

static void lookup_find ( dns_lookup_t lookup,
dns_fetchevent_t event 
) [static]

Definition at line 181 of file lookup.c.

References build_event(), dns_lookup::canceled, dns_db_attach(), dns_db_attachnode(), dns_db_detach(), dns_db_detachnode(), dns_fixedname_init, dns_fixedname_name, dns_name_concatenate(), dns_name_copy(), dns_name_fullcompare(), dns_name_split(), dns_namereln_subdomain, DNS_R_CNAME, DNS_R_DNAME, dns_rdata_freestruct(), DNS_RDATA_INIT, dns_rdata_reset(), dns_rdata_tostruct(), dns_rdataset_current(), dns_rdataset_disassociate(), dns_rdataset_first(), dns_rdataset_isassociated(), dns_resolver_destroyfetch(), dns_view_detach(), dns_lookup::event, dns_lookup::fetch, fixed, INSIST, isc_event_free(), ISC_EVENT_PTR, ISC_FALSE, ISC_R_CANCELED, ISC_R_NOTFOUND, ISC_R_QUOTA, ISC_R_SUCCESS, isc_task_sendanddetach(), ISC_TRUE, dns_lookup::lock, LOCK, MAX_RESTARTS, dns_lookup::name, name, dns_lookup::rdataset, REQUIRE, dns_lookup::restarts, dns_lookup::sigrdataset, start_fetch(), dns_lookup::task, UNLOCK, VALID_LOOKUP, dns_lookup::view, and view_find().

Referenced by dns_lookup_create(), and fetch_done().

static void fetch_done ( isc_task_t task,
isc_event_t event 
) [static]

Definition at line 67 of file lookup.c.

References DNS_EVENT_FETCHDONE, dns_lookup::fetch, lookup_find(), REQUIRE, dns_lookup::task, UNUSED, and VALID_LOOKUP.

static isc_result_t start_fetch ( dns_lookup_t lookup  )  [inline, static]

Definition at line 82 of file lookup.c.

References dns_fixedname_name, dns_resolver_createfetch(), dns_lookup::fetch, fetch_done(), dns_lookup::name, dns_lookup::rdataset, REQUIRE, dns_view::resolver, dns_lookup::sigrdataset, dns_lookup::task, dns_lookup::type, and dns_lookup::view.

static isc_result_t build_event ( dns_lookup_t lookup  )  [static]

Definition at line 104 of file lookup.c.

References dns_fixedname_name, dns_name_dup(), dns_name_dynamic(), dns_name_free(), dns_name_init(), dns_rdataset_clone(), dns_rdataset_disassociate(), dns_rdataset_init(), dns_rdataset_isassociated(), dns_lookup::event, isc_mem_get, isc_mem_put, ISC_R_NOMEMORY, ISC_R_SUCCESS, dns_lookup::mctx, dns_lookup::name, name, dns_lookup::rdataset, and dns_lookup::sigrdataset.

Referenced by lookup_find().

static isc_result_t view_find ( dns_lookup_t lookup,
dns_name_t foundname 
) [static]

Definition at line 163 of file lookup.c.

References dns_fixedname_name, dns_view_find(), dns_lookup::event, ISC_FALSE, dns_lookup::name, name, dns_lookup::rdataset, dns_lookup::sigrdataset, dns_lookup::type, and dns_lookup::view.

static void levent_destroy ( isc_event_t event  )  [static]

Definition at line 356 of file lookup.c.

References dns_db_detach(), dns_db_detachnode(), DNS_EVENT_LOOKUPDONE, dns_name_dynamic(), dns_name_free(), dns_rdataset_disassociate(), isc_mem_put, mctx, and REQUIRE.

Referenced by dns_lookup_create().

isc_result_t dns_lookup_create ( isc_mem_t mctx,
dns_name_t name,
dns_rdatatype_t  type,
dns_view_t view,
unsigned int  options,
isc_task_t task,
isc_taskaction_t  action,
void *  arg,
dns_lookup_t **  lookupp 
)

Finds the rrsets matching 'name' and 'type'.

Requires:

Returns:

Definition at line 385 of file lookup.c.

References dns_lookup::canceled, DESTROYLOCK, DNS_EVENT_LOOKUPDONE, dns_fixedname_init, dns_fixedname_name, dns_name_copy(), dns_rdataset_init(), dns_view_attach(), dns_lookup::event, dns_lookup::fetch, isc_event_allocate(), isc_event_free(), ISC_FALSE, isc_mem_attach(), isc_mem_get, isc_mem_putanddetach, isc_mutex_init, ISC_R_FAILURE, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_task_attach(), isc_task_detach(), levent_destroy(), dns_lookup::lock, lookup_find(), LOOKUP_MAGIC, dns_lookup::magic, dns_lookup::mctx, dns_lookup::name, dns_lookup::options, dns_lookup::rdataset, dns_lookup::restarts, dns_lookup::sigrdataset, dns_lookup::task, dns_lookup::type, and dns_lookup::view.

Referenced by dns_byaddr_create(), and start_lookup().

void dns_lookup_cancel ( dns_lookup_t lookup  ) 

Cancel 'lookup'.

Notes:

Requires:

Definition at line 462 of file lookup.c.

References dns_lookup::canceled, dns_resolver_cancelfetch(), dns_lookup::fetch, INSIST, ISC_TRUE, dns_lookup::lock, LOCK, REQUIRE, UNLOCK, VALID_LOOKUP, and dns_lookup::view.

Referenced by dns_byaddr_cancel().

void dns_lookup_destroy ( dns_lookup_t **  lookupp  ) 

Destroy 'lookup'.

Requires:

Ensures:

Definition at line 479 of file lookup.c.

References DESTROYLOCK, dns_rdataset_disassociate(), dns_rdataset_isassociated(), dns_lookup::event, isc_mem_putanddetach, dns_lookup::lock, dns_lookup::magic, dns_lookup::mctx, dns_lookup::rdataset, REQUIRE, dns_lookup::sigrdataset, dns_lookup::task, VALID_LOOKUP, and dns_lookup::view.

Referenced by dns_byaddr_destroy(), and lookup_done().


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