Merge from vendor branch OPENSSL:
[dragonfly.git] / contrib / bind-9.3 / lib / dns / include / dns / zt.h
1 /*
2  * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
3  * Copyright (C) 1999-2002  Internet Software Consortium.
4  *
5  * Permission to use, copy, modify, and 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.
8  *
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.
16  */
17
18 /* $Id: zt.h,v 1.27.2.2.8.1 2004/03/06 08:14:01 marka Exp $ */
19
20 #ifndef DNS_ZT_H
21 #define DNS_ZT_H 1
22
23 #include <isc/lang.h>
24
25 #include <dns/types.h>
26
27 #define DNS_ZTFIND_NOEXACT              0x01
28
29 ISC_LANG_BEGINDECLS
30
31 isc_result_t
32 dns_zt_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_zt_t **zt);
33 /*
34  * Creates a new zone table.
35  *
36  * Requires:
37  *      'mctx' to be initialized.
38  *
39  * Returns:
40  *      ISC_R_SUCCESS on success.
41  *      ISC_R_NOMEMORY
42  */
43
44 isc_result_t
45 dns_zt_mount(dns_zt_t *zt, dns_zone_t *zone);
46 /*
47  * Mounts the zone on the zone table.
48  *
49  * Requires:
50  *      'zt' to be valid
51  *      'zone' to be valid
52  *
53  * Returns:
54  *      ISC_R_SUCCESS
55  *      ISC_R_EXISTS
56  *      ISC_R_NOSPACE
57  *      ISC_R_NOMEMORY
58  */
59
60 isc_result_t
61 dns_zt_unmount(dns_zt_t *zt, dns_zone_t *zone);
62 /*
63  * Unmount the given zone from the table.
64  *
65  * Requires:
66  *      'zt' to be valid
67  *      'zone' to be valid
68  *
69  * Returns:
70  *      ISC_R_SUCCESS
71  *      ISC_R_NOTFOUND
72  *      ISC_R_NOMEMORY
73  */
74
75 isc_result_t
76 dns_zt_find(dns_zt_t *zt, dns_name_t *name, unsigned int options,
77             dns_name_t *foundname, dns_zone_t **zone);
78 /*
79  * Find the best match for 'name' in 'zt'.  If foundname is non NULL
80  * then the name of the zone found is returned.
81  *
82  * Notes:
83  *      If the DNS_ZTFIND_NOEXACT is set, the best partial match (if any)
84  *      to 'name' will be returned.
85  *
86  * Requires:
87  *      'zt' to be valid
88  *      'name' to be valid
89  *      'foundname' to be initialized and associated with a fixedname or NULL
90  *      'zone' to be non NULL and '*zone' to be NULL
91  *
92  * Returns:
93  *      ISC_R_SUCCESS
94  *      DNS_R_PARTIALMATCH
95  *      ISC_R_NOTFOUND
96  *      ISC_R_NOSPACE
97  */
98
99 void
100 dns_zt_detach(dns_zt_t **ztp);
101 /*
102  * Detach the given zonetable, if the reference count goes to zero the
103  * zonetable will be freed.  In either case 'ztp' is set to NULL.
104  *
105  * Requires:
106  *      '*ztp' to be valid
107  */
108
109 void
110 dns_zt_flushanddetach(dns_zt_t **ztp);
111 /*
112  * Detach the given zonetable, if the reference count goes to zero the
113  * zonetable will be flushed and then freed.  In either case 'ztp' is
114  * set to NULL.
115  *
116  * Requires:
117  *      '*ztp' to be valid
118  */
119
120 void
121 dns_zt_attach(dns_zt_t *zt, dns_zt_t **ztp);
122 /*
123  * Attach 'zt' to '*ztp'.
124  *
125  * Requires:
126  *      'zt' to be valid
127  *      '*ztp' to be NULL
128  */
129
130 isc_result_t
131 dns_zt_load(dns_zt_t *zt, isc_boolean_t stop);
132
133 isc_result_t
134 dns_zt_loadnew(dns_zt_t *zt, isc_boolean_t stop);
135 /*
136  * Load all zones in the table.  If 'stop' is ISC_TRUE,
137  * stop on the first error and return it.  If 'stop'
138  * is ISC_FALSE, ignore errors.
139  *
140  * dns_zt_loadnew() only loads zones that are not yet loaded.
141  * dns_zt_load() also loads zones that are already loaded and
142  * and whose master file has changed since the last load.
143  *
144  * Requires:
145  *      'zt' to be valid
146  */
147
148 isc_result_t
149 dns_zt_apply(dns_zt_t *zt, isc_boolean_t stop,
150              isc_result_t (*action)(dns_zone_t *, void *), void *uap);
151 /*
152  * Apply a given 'action' to all zone zones in the table.
153  * If 'stop' is 'ISC_TRUE' then walking the zone tree will stop if
154  * 'action' does not return ISC_R_SUCCESS.
155  *
156  * Requires:
157  *      'zt' to be valid.
158  *      'action' to be non NULL.
159  *
160  * Returns:
161  *      ISC_R_SUCCESS if action was applied to all nodes.
162  *      any error code from 'action'.
163  */
164
165 ISC_LANG_ENDDECLS
166
167 #endif /* DNS_ZT_H */