Import bind 9.5.2 vendor sources.
[dragonfly.git] / contrib / bind-9.5.2 / bin / named / include / named / lwsearch.h
blobc1b4f48f62c3ad367fbda695bcb1495002834fa3
1 /*
2 * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 2000, 2001 Internet Software Consortium.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
18 /* $Id: lwsearch.h,v 1.9 2007/06/19 23:46:59 tbox Exp $ */
20 #ifndef NAMED_LWSEARCH_H
21 #define NAMED_LWSEARCH_H 1
23 #include <isc/mutex.h>
24 #include <isc/result.h>
25 #include <isc/types.h>
27 #include <dns/types.h>
29 #include <named/types.h>
31 /*! \file
32 * \brief
33 * Lightweight resolver search list types and routines.
35 * An ns_lwsearchlist_t holds a list of search path elements.
37 * An ns_lwsearchctx stores the state of search list during a lookup
38 * operation.
41 /*% An ns_lwsearchlist_t holds a list of search path elements. */
42 struct ns_lwsearchlist {
43 unsigned int magic;
45 isc_mutex_t lock;
46 isc_mem_t *mctx;
47 unsigned int refs;
48 dns_namelist_t names;
50 /*% An ns_lwsearchctx stores the state of search list during a lookup operation. */
51 struct ns_lwsearchctx {
52 dns_name_t *relname;
53 dns_name_t *searchname;
54 unsigned int ndots;
55 ns_lwsearchlist_t *list;
56 isc_boolean_t doneexact;
57 isc_boolean_t exactfirst;
60 isc_result_t
61 ns_lwsearchlist_create(isc_mem_t *mctx, ns_lwsearchlist_t **listp);
62 /*%<
63 * Create an empty search list object.
66 void
67 ns_lwsearchlist_attach(ns_lwsearchlist_t *source, ns_lwsearchlist_t **target);
68 /*%<
69 * Attach to a search list object.
72 void
73 ns_lwsearchlist_detach(ns_lwsearchlist_t **listp);
74 /*%<
75 * Detach from a search list object.
78 isc_result_t
79 ns_lwsearchlist_append(ns_lwsearchlist_t *list, dns_name_t *name);
80 /*%<
81 * Append an element to a search list. This creates a copy of the name.
84 void
85 ns_lwsearchctx_init(ns_lwsearchctx_t *sctx, ns_lwsearchlist_t *list,
86 dns_name_t *name, unsigned int ndots);
87 /*%<
88 * Creates a search list context structure.
91 void
92 ns_lwsearchctx_first(ns_lwsearchctx_t *sctx);
93 /*%<
94 * Moves the search list context iterator to the first element, which
95 * is usually the exact name.
98 isc_result_t
99 ns_lwsearchctx_next(ns_lwsearchctx_t *sctx);
100 /*%<
101 * Moves the search list context iterator to the next element.
104 isc_result_t
105 ns_lwsearchctx_current(ns_lwsearchctx_t *sctx, dns_name_t *absname);
106 /*%<
107 * Obtains the current name to be looked up. This involves either
108 * concatenating the name with a search path element, making an
109 * exact name absolute, or doing nothing.
112 #endif /* NAMED_LWSEARCH_H */