Add BIND 9.2.4rc7.
[dragonfly.git] / contrib / bind-9.2.4rc7 / lib / dns / include / dns / keytable.h
blob735786437fe62c3574bf303cb98158ae753d32a6
1 /*
2 * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 2000, 2001 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: keytable.h,v 1.10.2.1 2004/03/09 06:11:16 marka Exp $ */
20 #ifndef DNS_KEYTABLE_H
21 #define DNS_KEYTABLE_H 1
23 /*****
24 ***** Module Info
25 *****/
28 * Key Tables
30 * The keytable module provides services for storing and retrieving DNSSEC
31 * trusted keys, as well as the ability to find the deepest matching key
32 * for a given domain name.
34 * MP:
35 * The module ensures appropriate synchronization of data structures it
36 * creates and manipulates.
38 * Resources:
39 * <TBS>
41 * Security:
42 * No anticipated impact.
45 #include <isc/lang.h>
47 #include <dns/types.h>
49 #include <dst/dst.h>
51 ISC_LANG_BEGINDECLS
53 isc_result_t
54 dns_keytable_create(isc_mem_t *mctx, dns_keytable_t **keytablep);
56 * Create a keytable.
58 * Requires:
60 * 'mctx' is a valid memory context.
62 * keytablep != NULL && *keytablep == NULL
64 * Ensures:
66 * On success, *keytablep is a valid, empty key table.
68 * Returns:
70 * ISC_R_SUCCESS
72 * Any other result indicates failure.
76 void
77 dns_keytable_attach(dns_keytable_t *source, dns_keytable_t **targetp);
79 * Attach *targetp to source.
81 * Requires:
83 * 'source' is a valid keytable.
85 * 'targetp' points to a NULL dns_keytable_t *.
87 * Ensures:
89 * *targetp is attached to source.
92 void
93 dns_keytable_detach(dns_keytable_t **keytablep);
95 * Detach *keytablep from its keytable.
97 * Requires:
99 * 'keytablep' points to a valid keytable.
101 * Ensures:
103 * *keytablep is NULL.
105 * If '*keytablep' is the last reference to the keytable,
107 * All resources used by the keytable will be freed
110 isc_result_t
111 dns_keytable_add(dns_keytable_t *keytable, dst_key_t **keyp);
113 * Add '*keyp' to 'keytable'.
115 * Notes:
117 * Ownership of *keyp is transferred to the keytable.
119 * Requires:
121 * keyp != NULL && *keyp is a valid dst_key_t *.
123 * Ensures:
125 * On success, *keyp == NULL
127 * Returns:
129 * ISC_R_SUCCESS
131 * Any other result indicates failure.
134 isc_result_t
135 dns_keytable_findkeynode(dns_keytable_t *keytable, dns_name_t *name,
136 dns_secalg_t algorithm, dns_keytag_t tag,
137 dns_keynode_t **keynodep);
139 * Search for a key named 'name', matching 'algorithm' and 'tag' in
140 * 'keytable'.
142 * Requires:
144 * 'keytable' is a valid keytable.
146 * 'name' is a valid absolute name.
148 * keynodep != NULL && *keynodep == NULL
150 * Returns:
152 * ISC_R_SUCCESS
153 * ISC_R_NOTFOUND
155 * Any other result indicates an error.
158 isc_result_t
159 dns_keytable_findnextkeynode(dns_keytable_t *keytable, dns_keynode_t *keynode,
160 dns_keynode_t **nextnodep);
162 * Search for the next key with the same properties as 'keynode' in
163 * 'keytable'.
165 * Requires:
167 * 'keytable' is a valid keytable.
169 * 'keynode' is a valid keynode.
171 * nextnodep != NULL && *nextnodep == NULL
173 * Returns:
175 * ISC_R_SUCCESS
176 * ISC_R_NOTFOUND
178 * Any other result indicates an error.
181 isc_result_t
182 dns_keytable_finddeepestmatch(dns_keytable_t *keytable, dns_name_t *name,
183 dns_name_t *foundname);
185 * Search for the deepest match of 'name' in 'keytable'.
187 * Requires:
189 * 'keytable' is a valid keytable.
191 * 'name' is a valid absolute name.
193 * 'foundname' is a name with a dedicated buffer.
195 * Returns:
197 * ISC_R_SUCCESS
198 * ISC_R_NOTFOUND
200 * Any other result indicates an error.
203 void
204 dns_keytable_detachkeynode(dns_keytable_t *keytable,
205 dns_keynode_t **keynodep);
207 * Give back a keynode found via dns_keytable_findkeynode().
209 * Requires:
211 * 'keytable' is a valid keytable.
213 * *keynodep is a valid keynode returned by a call to
214 * dns_keytable_findkeynode().
216 * Ensures:
218 * *keynodep == NULL
221 isc_result_t
222 dns_keytable_issecuredomain(dns_keytable_t *keytable, dns_name_t *name,
223 isc_boolean_t *wantdnssecp);
225 * Is 'name' at or beneath a trusted key?
227 * Requires:
229 * 'keytable' is a valid keytable.
231 * 'name' is a valid absolute name.
233 * '*wantsdnssecp' is a valid isc_boolean_t.
235 * Ensures:
237 * On success, *wantsdnssecp will be ISC_TRUE if and only if 'name'
238 * is at or beneath a trusted key.
240 * Returns:
242 * ISC_R_SUCCESS
244 * Any other result is an error.
247 dst_key_t *
248 dns_keynode_key(dns_keynode_t *keynode);
250 * Get the DST key associated with keynode.
253 ISC_LANG_ENDDECLS
255 #endif /* DNS_KEYTABLE_H */