2 * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1999-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: dbtable.h,v 1.23 2007/06/19 23:47:16 tbox Exp $ */
21 #define DNS_DBTABLE_H 1
27 /*! \file dns/dbtable.h
34 *\li The module ensures appropriate synchronization of data structures it
35 * creates and manipulates.
38 *\li No anticipated impact.
44 *\li No anticipated impact.
52 #include <dns/types.h>
54 #define DNS_DBTABLEFIND_NOEXACT 0x01
59 dns_dbtable_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
60 dns_dbtable_t **dbtablep);
62 * Make a new dbtable of class 'rdclass'
66 * \li dbtablep != NULL && *dptablep == NULL
67 *\li 'rdclass' is a valid class
72 *\li #ISC_R_UNEXPECTED
76 dns_dbtable_attach(dns_dbtable_t *source, dns_dbtable_t **targetp);
78 * Attach '*targetp' to 'source'.
82 *\li 'source' is a valid dbtable.
84 *\li 'targetp' points to a NULL dns_dbtable_t *.
88 *\li *targetp is attached to source.
92 dns_dbtable_detach(dns_dbtable_t **dbtablep);
94 * Detach *dbtablep from its dbtable.
98 *\li '*dbtablep' points to a valid dbtable.
102 *\li *dbtablep is NULL.
104 *\li If '*dbtablep' is the last reference to the dbtable,
105 * all resources used by the dbtable will be freed
109 dns_dbtable_add(dns_dbtable_t *dbtable, dns_db_t *db);
111 * Add 'db' to 'dbtable'.
114 *\li 'dbtable' is a valid dbtable.
116 *\li 'db' is a valid database with the same class as 'dbtable'
120 dns_dbtable_remove(dns_dbtable_t *dbtable, dns_db_t *db);
122 * Remove 'db' from 'dbtable'.
125 *\li 'db' was previously added to 'dbtable'.
129 dns_dbtable_adddefault(dns_dbtable_t *dbtable, dns_db_t *db);
131 * Use 'db' as the result of a dns_dbtable_find() if no better match is
136 dns_dbtable_getdefault(dns_dbtable_t *dbtable, dns_db_t **db);
138 * Get the 'db' used as the result of a dns_dbtable_find()
139 * if no better match is available.
143 dns_dbtable_removedefault(dns_dbtable_t *dbtable);
145 * Remove the default db from 'dbtable'.
149 dns_dbtable_find(dns_dbtable_t *dbtable, dns_name_t *name,
150 unsigned int options, dns_db_t **dbp);
152 * Find the deepest match to 'name' in the dbtable, and return it
155 *\li If the DNS_DBTABLEFIND_NOEXACT option is set, the best partial
156 * match (if any) to 'name' will be returned.
159 * \li #ISC_R_SUCCESS on success
160 *\li something else: no default and match
165 #endif /* DNS_DBTABLE_H */