lwsearch.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004, 2005, 2007  Internet Systems Consortium, Inc. ("ISC")
00003  * Copyright (C) 2000, 2001  Internet Software Consortium.
00004  *
00005  * Permission to use, copy, modify, and/or distribute this software for any
00006  * purpose with or without fee is hereby granted, provided that the above
00007  * copyright notice and this permission notice appear in all copies.
00008  *
00009  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
00010  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00011  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
00012  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00013  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00014  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00015  * PERFORMANCE OF THIS SOFTWARE.
00016  */
00017 
00018 /* $Id: lwsearch.h,v 1.9 2007/06/19 23:46:59 tbox Exp $ */
00019 
00020 #ifndef NAMED_LWSEARCH_H
00021 #define NAMED_LWSEARCH_H 1
00022 
00023 #include <isc/mutex.h>
00024 #include <isc/result.h>
00025 #include <isc/types.h>
00026 
00027 #include <dns/types.h>
00028 
00029 #include <named/types.h>
00030 
00031 /*! \file
00032  * \brief
00033  * Lightweight resolver search list types and routines.
00034  *
00035  * An ns_lwsearchlist_t holds a list of search path elements.
00036  *
00037  * An ns_lwsearchctx stores the state of search list during a lookup
00038  * operation.
00039  */
00040 
00041 /*% An ns_lwsearchlist_t holds a list of search path elements. */
00042 struct ns_lwsearchlist {
00043         unsigned int magic;
00044 
00045         isc_mutex_t lock;
00046         isc_mem_t *mctx;
00047         unsigned int refs;
00048         dns_namelist_t names;
00049 };
00050 /*% An ns_lwsearchctx stores the state of search list during a lookup operation. */
00051 struct ns_lwsearchctx {
00052         dns_name_t *relname;
00053         dns_name_t *searchname;
00054         unsigned int ndots;
00055         ns_lwsearchlist_t *list;
00056         isc_boolean_t doneexact;
00057         isc_boolean_t exactfirst;
00058 };
00059 
00060 isc_result_t
00061 ns_lwsearchlist_create(isc_mem_t *mctx, ns_lwsearchlist_t **listp);
00062 /*%<
00063  * Create an empty search list object.
00064  */
00065 
00066 void
00067 ns_lwsearchlist_attach(ns_lwsearchlist_t *source, ns_lwsearchlist_t **target);
00068 /*%<
00069  * Attach to a search list object.
00070  */
00071 
00072 void
00073 ns_lwsearchlist_detach(ns_lwsearchlist_t **listp);
00074 /*%<
00075  * Detach from a search list object.
00076  */
00077 
00078 isc_result_t
00079 ns_lwsearchlist_append(ns_lwsearchlist_t *list, dns_name_t *name);
00080 /*%<
00081  * Append an element to a search list.  This creates a copy of the name.
00082  */
00083 
00084 void
00085 ns_lwsearchctx_init(ns_lwsearchctx_t *sctx, ns_lwsearchlist_t *list,
00086                     dns_name_t *name, unsigned int ndots);
00087 /*%<
00088  * Creates a search list context structure.
00089  */
00090 
00091 void
00092 ns_lwsearchctx_first(ns_lwsearchctx_t *sctx);
00093 /*%<
00094  * Moves the search list context iterator to the first element, which
00095  * is usually the exact name.
00096  */
00097 
00098 isc_result_t
00099 ns_lwsearchctx_next(ns_lwsearchctx_t *sctx);
00100 /*%<
00101  * Moves the search list context iterator to the next element.
00102  */
00103 
00104 isc_result_t
00105 ns_lwsearchctx_current(ns_lwsearchctx_t *sctx, dns_name_t *absname);
00106 /*%<
00107  * Obtains the current name to be looked up.  This involves either
00108  * concatenating the name with a search path element, making an
00109  * exact name absolute, or doing nothing.
00110  */
00111 
00112 #endif /* NAMED_LWSEARCH_H */

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