2 * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1999-2002 Internet Software Consortium.
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.
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: zt.h,v 1.27.2.3 2004/03/09 06:11:25 marka Exp $ */
25 #include <dns/types.h>
27 #define DNS_ZTFIND_NOEXACT 0x01
32 dns_zt_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_zt_t **zt);
34 * Creates a new zone table.
37 * 'mctx' to be initialized.
40 * ISC_R_SUCCESS on success.
45 dns_zt_mount(dns_zt_t *zt, dns_zone_t *zone);
47 * Mounts the zone on the zone table.
61 dns_zt_unmount(dns_zt_t *zt, dns_zone_t *zone);
63 * Unmount the given zone from the table.
76 dns_zt_find(dns_zt_t *zt, dns_name_t *name, unsigned int options,
77 dns_name_t *foundname, dns_zone_t **zone);
79 * Find the best match for 'name' in 'zt'. If foundname is non NULL
80 * then the name of the zone found is returned.
83 * If the DNS_ZTFIND_NOEXACT is set, the best partial match (if any)
84 * to 'name' will be returned.
89 * 'foundname' to be initialized and associated with a fixedname or NULL
90 * 'zone' to be non NULL and '*zone' to be NULL
100 dns_zt_detach(dns_zt_t **ztp);
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.
110 dns_zt_flushanddetach(dns_zt_t **ztp);
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
121 dns_zt_attach(dns_zt_t *zt, dns_zt_t **ztp);
123 * Attach 'zt' to '*ztp'.
131 dns_zt_load(dns_zt_t *zt, isc_boolean_t stop);
134 dns_zt_loadnew(dns_zt_t *zt, isc_boolean_t stop);
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.
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.
149 dns_zt_apply(dns_zt_t *zt, isc_boolean_t stop,
150 isc_result_t (*action)(dns_zone_t *, void *), void *uap);
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.
158 * 'action' to be non NULL.
161 * ISC_R_SUCCESS if action was applied to all nodes.
162 * any error code from 'action'.
167 #endif /* DNS_ZT_H */