Add BIND 9.2.4rc7.
[dragonfly.git] / contrib / bind-9.2.4rc7 / lib / dns / include / dns / ssu.h
blob2622596cb7005ae3e205ae07d21df95322262c89
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: ssu.h,v 1.11.2.1 2004/03/09 06:11:22 marka Exp $ */
20 #ifndef DNS_SSU_H
21 #define DNS_SSU_H 1
23 #include <isc/lang.h>
25 #include <dns/types.h>
27 ISC_LANG_BEGINDECLS
29 #define DNS_SSUMATCHTYPE_NAME 0
30 #define DNS_SSUMATCHTYPE_SUBDOMAIN 1
31 #define DNS_SSUMATCHTYPE_WILDCARD 2
32 #define DNS_SSUMATCHTYPE_SELF 3
34 isc_result_t
35 dns_ssutable_create(isc_mem_t *mctx, dns_ssutable_t **table);
37 * Creates a table that will be used to store simple-secure-update rules.
38 * Note: all locking must be provided by the client.
40 * Requires:
41 * 'mctx' is a valid memory context
42 * 'table' is not NULL, and '*table' is NULL
44 * Returns:
45 * ISC_R_SUCCESS
46 * ISC_R_NOMEMORY
49 void
50 dns_ssutable_attach(dns_ssutable_t *source, dns_ssutable_t **targetp);
52 * Attach '*targetp' to 'source'.
54 * Requires:
55 * 'source' is a valid SSU table
56 * 'targetp' points to a NULL dns_ssutable_t *.
58 * Ensures:
59 * *targetp is attached to source.
62 void
63 dns_ssutable_detach(dns_ssutable_t **tablep);
65 * Detach '*tablep' from its simple-secure-update rule table.
67 * Requires:
68 * 'tablep' points to a valid dns_ssutable_t
70 * Ensures:
71 * *tablep is NULL
72 * If '*tablep' is the last reference to the SSU table, all
73 * resources used by the table will be freed.
76 isc_result_t
77 dns_ssutable_addrule(dns_ssutable_t *table, isc_boolean_t grant,
78 dns_name_t *identity, unsigned int matchtype,
79 dns_name_t *name, unsigned int ntypes,
80 dns_rdatatype_t *types);
82 * Adds a new rule to a simple-secure-update rule table. The rule
83 * either grants or denies update privileges of an identity (or set of
84 * identities) to modify a name (or set of names) or certain types present
85 * at that name.
87 * Notes:
88 * If 'matchtype' is SELF, this rule only matches if the name
89 * to be updated matches the signing identity.
91 * If 'ntypes' is 0, this rule applies to all types except
92 * NS, SOA, SIG, and NXT.
94 * If 'types' includes ANY, this rule applies to all types
95 * except NXT.
97 * Requires:
98 * 'table' is a valid SSU table
99 * 'identity' is a valid absolute name
100 * 'matchtype' must be one of the defined constants.
101 * 'name' is a valid absolute name
102 * If 'ntypes' > 0, 'types' must not be NULL
104 * Returns:
105 * ISC_R_SUCCESS
106 * ISC_R_NOMEMORY
109 isc_boolean_t
110 dns_ssutable_checkrules(dns_ssutable_t *table, dns_name_t *signer,
111 dns_name_t *name, dns_rdatatype_t type);
113 * Checks that the attempted update of (name, type) is allowed according
114 * to the rules specified in the simple-secure-update rule table. If
115 * no rules are matched, access is denied. If signer is NULL, access
116 * is denied.
118 * Requires:
119 * 'table' is a valid SSU table
120 * 'signer' is NULL or a valid absolute name
121 * 'name' is a valid absolute name
125 isc_boolean_t dns_ssurule_isgrant(const dns_ssurule_t *rule);
126 dns_name_t * dns_ssurule_identity(const dns_ssurule_t *rule);
127 unsigned int dns_ssurule_matchtype(const dns_ssurule_t *rule);
128 dns_name_t * dns_ssurule_name(const dns_ssurule_t *rule);
129 unsigned int dns_ssurule_types(const dns_ssurule_t *rule,
130 dns_rdatatype_t **types);
132 * Accessor functions to extract rule components
135 isc_result_t dns_ssutable_firstrule(const dns_ssutable_t *table,
136 dns_ssurule_t **rule);
138 * Initiates a rule iterator. There is no need to maintain any state.
140 * Returns:
141 * ISC_R_SUCCESS
142 * ISC_R_NOMORE
145 isc_result_t dns_ssutable_nextrule(dns_ssurule_t *rule,
146 dns_ssurule_t **nextrule);
148 * Returns the next rule in the table.
150 * Returns:
151 * ISC_R_SUCCESS
152 * ISC_R_NOMORE
155 ISC_LANG_ENDDECLS
157 #endif /* DNS_SSU_H */