2 * Copyright (C) 2004, 2006 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.206.3 2006/01/06 00:01:42 marka Exp $ */
20 #ifndef DNS_KEYTABLE_H
21 #define DNS_KEYTABLE_H 1
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.
35 * The module ensures appropriate synchronization of data structures it
36 * creates and manipulates.
42 * No anticipated impact.
47 #include <dns/types.h>
54 dns_keytable_create(isc_mem_t *mctx, dns_keytable_t **keytablep);
60 * 'mctx' is a valid memory context.
62 * keytablep != NULL && *keytablep == NULL
66 * On success, *keytablep is a valid, empty key table.
72 * Any other result indicates failure.
77 dns_keytable_attach(dns_keytable_t *source, dns_keytable_t **targetp);
79 * Attach *targetp to source.
83 * 'source' is a valid keytable.
85 * 'targetp' points to a NULL dns_keytable_t *.
89 * *targetp is attached to source.
93 dns_keytable_detach(dns_keytable_t **keytablep);
95 * Detach *keytablep from its keytable.
99 * 'keytablep' points to a valid keytable.
103 * *keytablep is NULL.
105 * If '*keytablep' is the last reference to the keytable,
107 * All resources used by the keytable will be freed
111 dns_keytable_add(dns_keytable_t *keytable, dst_key_t **keyp);
113 * Add '*keyp' to 'keytable'.
117 * Ownership of *keyp is transferred to the keytable.
121 * keyp != NULL && *keyp is a valid dst_key_t *.
125 * On success, *keyp == NULL
131 * Any other result indicates failure.
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'. This finds the first instance which matches. Use
141 * dns_keytable_findnextkeynode() to find other instances.
145 * 'keytable' is a valid keytable.
147 * 'name' is a valid absolute name.
149 * keynodep != NULL && *keynodep == NULL
154 * DNS_R_PARTIALMATCH the name existed in the keytable.
157 * Any other result indicates an error.
161 dns_keytable_findnextkeynode(dns_keytable_t *keytable, dns_keynode_t *keynode,
162 dns_keynode_t **nextnodep);
164 * Search for the next key with the same properties as 'keynode' in
165 * 'keytable' as found by dns_keytable_findkeynode().
169 * 'keytable' is a valid keytable.
171 * 'keynode' is a valid keynode.
173 * nextnodep != NULL && *nextnodep == NULL
180 * Any other result indicates an error.
184 dns_keytable_finddeepestmatch(dns_keytable_t *keytable, dns_name_t *name,
185 dns_name_t *foundname);
187 * Search for the deepest match of 'name' in 'keytable'.
191 * 'keytable' is a valid keytable.
193 * 'name' is a valid absolute name.
195 * 'foundname' is a name with a dedicated buffer.
202 * Any other result indicates an error.
206 dns_keytable_detachkeynode(dns_keytable_t *keytable,
207 dns_keynode_t **keynodep);
209 * Give back a keynode found via dns_keytable_findkeynode().
213 * 'keytable' is a valid keytable.
215 * *keynodep is a valid keynode returned by a call to
216 * dns_keytable_findkeynode().
224 dns_keytable_issecuredomain(dns_keytable_t *keytable, dns_name_t *name,
225 isc_boolean_t *wantdnssecp);
227 * Is 'name' at or beneath a trusted key?
231 * 'keytable' is a valid keytable.
233 * 'name' is a valid absolute name.
235 * '*wantsdnssecp' is a valid isc_boolean_t.
239 * On success, *wantsdnssecp will be ISC_TRUE if and only if 'name'
240 * is at or beneath a trusted key.
246 * Any other result is an error.
250 dns_keynode_key(dns_keynode_t *keynode);
252 * Get the DST key associated with keynode.
257 #endif /* DNS_KEYTABLE_H */