lwsearch.c File Reference

#include <config.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/mutex.h>
#include <isc/result.h>
#include <isc/types.h>
#include <isc/util.h>
#include <dns/name.h>
#include <dns/types.h>
#include <named/lwsearch.h>
#include <named/types.h>

Go to the source code of this file.

Defines

#define LWSEARCHLIST_MAGIC   ISC_MAGIC('L', 'W', 'S', 'L')
#define VALID_LWSEARCHLIST(l)   ISC_MAGIC_VALID(l, LWSEARCHLIST_MAGIC)

Functions

isc_result_t ns_lwsearchlist_create (isc_mem_t *mctx, ns_lwsearchlist_t **listp)
 Create an empty search list object.
void ns_lwsearchlist_attach (ns_lwsearchlist_t *source, ns_lwsearchlist_t **target)
 Attach to a search list object.
void ns_lwsearchlist_detach (ns_lwsearchlist_t **listp)
 Detach from a search list object.
isc_result_t ns_lwsearchlist_append (ns_lwsearchlist_t *list, dns_name_t *name)
 Append an element to a search list. This creates a copy of the name.
void ns_lwsearchctx_init (ns_lwsearchctx_t *sctx, ns_lwsearchlist_t *list, dns_name_t *name, unsigned int ndots)
 Creates a search list context structure.
void ns_lwsearchctx_first (ns_lwsearchctx_t *sctx)
 Moves the search list context iterator to the first element, which is usually the exact name.
isc_result_t ns_lwsearchctx_next (ns_lwsearchctx_t *sctx)
 Moves the search list context iterator to the next element.
isc_result_t ns_lwsearchctx_current (ns_lwsearchctx_t *sctx, dns_name_t *absname)
 Obtains the current name to be looked up. This involves either concatenating the name with a search path element, making an exact name absolute, or doing nothing.


Detailed Description

Definition in file lwsearch.c.


Define Documentation

#define LWSEARCHLIST_MAGIC   ISC_MAGIC('L', 'W', 'S', 'L')

Definition at line 37 of file lwsearch.c.

Referenced by ns_lwsearchlist_create().

#define VALID_LWSEARCHLIST (  )     ISC_MAGIC_VALID(l, LWSEARCHLIST_MAGIC)

Definition at line 38 of file lwsearch.c.

Referenced by ns_lwsearchlist_append(), ns_lwsearchlist_attach(), and ns_lwsearchlist_detach().


Function Documentation

isc_result_t ns_lwsearchlist_create ( isc_mem_t mctx,
ns_lwsearchlist_t **  listp 
)

Create an empty search list object.

Definition at line 41 of file lwsearch.c.

References ISC_LIST_INIT, isc_mem_attach(), isc_mem_get, isc_mem_put, isc_mutex_init, ISC_R_NOMEMORY, ISC_R_SUCCESS, ns_lwsearchlist::lock, LWSEARCHLIST_MAGIC, ns_lwsearchlist::magic, ns_lwsearchlist::mctx, ns_lwsearchlist::names, ns_lwsearchlist::refs, and REQUIRE.

Referenced by ns_lwdmanager_create().

void ns_lwsearchlist_attach ( ns_lwsearchlist_t source,
ns_lwsearchlist_t **  target 
)

Attach to a search list object.

Definition at line 68 of file lwsearch.c.

References INSIST, ns_lwsearchlist::lock, LOCK, ns_lwsearchlist::refs, REQUIRE, UNLOCK, and VALID_LWSEARCHLIST.

void ns_lwsearchlist_detach ( ns_lwsearchlist_t **  listp  ) 

Detach from a search list object.

Definition at line 82 of file lwsearch.c.

References dns_name_free(), INSIST, ISC_LIST_EMPTY, ISC_LIST_HEAD, ISC_LIST_UNLINK, isc_mem_detach(), isc_mem_put, ns_lwsearchlist::lock, LOCK, ns_lwsearchlist::magic, ns_lwsearchlist::mctx, mctx, name, ns_lwsearchlist::names, ns_lwsearchlist::refs, REQUIRE, UNLOCK, and VALID_LWSEARCHLIST.

Referenced by ns_lwdmanager_create(), and ns_lwdmanager_detach().

isc_result_t ns_lwsearchlist_append ( ns_lwsearchlist_t list,
dns_name_t name 
)

Append an element to a search list. This creates a copy of the name.

Definition at line 112 of file lwsearch.c.

References dns_name_dup(), dns_name_init(), ISC_LINK_INIT, ISC_LIST_APPEND, isc_mem_get, isc_mem_put, ISC_R_NOMEMORY, ISC_R_SUCCESS, ns_lwsearchlist::mctx, ns_lwsearchlist::names, REQUIRE, and VALID_LWSEARCHLIST.

Referenced by ns_lwdmanager_create().

void ns_lwsearchctx_init ( ns_lwsearchctx_t sctx,
ns_lwsearchlist_t list,
dns_name_t name,
unsigned int  ndots 
)

Creates a search list context structure.

Definition at line 134 of file lwsearch.c.

References dns_name_countlabels(), dns_name_isabsolute(), ns_lwsearchctx::doneexact, ns_lwsearchctx::exactfirst, INSIST, ISC_FALSE, ISC_LIST_HEAD, ISC_TRUE, ns_lwsearchctx::list, ns_lwsearchlist::names, ns_lwsearchctx::ndots, ns_lwsearchctx::relname, and ns_lwsearchctx::searchname.

Referenced by ns_lwdclient_processgabn(), and ns_lwdclient_processgrbn().

void ns_lwsearchctx_first ( ns_lwsearchctx_t sctx  ) 

Moves the search list context iterator to the first element, which is usually the exact name.

Definition at line 154 of file lwsearch.c.

References REQUIRE, and UNUSED.

Referenced by ns_lwdclient_processgabn(), and ns_lwdclient_processgrbn().

isc_result_t ns_lwsearchctx_next ( ns_lwsearchctx_t sctx  ) 

Moves the search list context iterator to the next element.

Definition at line 160 of file lwsearch.c.

References ns_lwsearchctx::doneexact, ns_lwsearchctx::exactfirst, INSIST, ISC_LIST_NEXT, ISC_R_NOMORE, ISC_R_SUCCESS, ISC_TRUE, ns_lwsearchctx::list, REQUIRE, and ns_lwsearchctx::searchname.

Referenced by generate_reply(), and lookup_done().

isc_result_t ns_lwsearchctx_current ( ns_lwsearchctx_t sctx,
dns_name_t absname 
)

Obtains the current name to be looked up. This involves either concatenating the name with a search path element, making an exact name absolute, or doing nothing.

Definition at line 186 of file lwsearch.c.

References dns_name_concatenate(), dns_name_isabsolute(), dns_rootname, ns_lwsearchctx::doneexact, ns_lwsearchctx::exactfirst, ISC_FALSE, ISC_TRUE, ns_lwsearchctx::list, ns_lwsearchctx::relname, REQUIRE, and ns_lwsearchctx::searchname.

Referenced by start_lookup(), and store_realname().


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