iostat - add read/write details to output
[dragonfly.git] / contrib / bind / lib / dns / include / dns / ssu.h
1 /*
2  * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
3  * Copyright (C) 2000, 2001, 2003  Internet Software Consortium.
4  *
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.
8  *
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.
16  */
17
18 /* $Id: ssu.h,v 1.21 2007/06/19 23:47:17 tbox Exp $ */
19
20 #ifndef DNS_SSU_H
21 #define DNS_SSU_H 1
22
23 /*! \file dns/ssu.h */
24
25 #include <isc/lang.h>
26
27 #include <dns/types.h>
28
29 ISC_LANG_BEGINDECLS
30
31 #define DNS_SSUMATCHTYPE_NAME           0
32 #define DNS_SSUMATCHTYPE_SUBDOMAIN      1
33 #define DNS_SSUMATCHTYPE_WILDCARD       2
34 #define DNS_SSUMATCHTYPE_SELF           3
35 #define DNS_SSUMATCHTYPE_SELFSUB        4
36 #define DNS_SSUMATCHTYPE_SELFWILD       5
37 #define DNS_SSUMATCHTYPE_SELFKRB5       6
38 #define DNS_SSUMATCHTYPE_SELFMS         7
39 #define DNS_SSUMATCHTYPE_SUBDOMAINMS    8
40 #define DNS_SSUMATCHTYPE_SUBDOMAINKRB5  9
41 #define DNS_SSUMATCHTYPE_MAX            9  /* max value */
42
43 isc_result_t
44 dns_ssutable_create(isc_mem_t *mctx, dns_ssutable_t **table);
45 /*%<
46  *      Creates a table that will be used to store simple-secure-update rules.
47  *      Note: all locking must be provided by the client.
48  *
49  *      Requires:
50  *\li           'mctx' is a valid memory context
51  *\li           'table' is not NULL, and '*table' is NULL
52  *
53  *      Returns:
54  *\li           ISC_R_SUCCESS
55  *\li           ISC_R_NOMEMORY
56  */
57
58 void
59 dns_ssutable_attach(dns_ssutable_t *source, dns_ssutable_t **targetp);
60 /*%<
61  *      Attach '*targetp' to 'source'.
62  *
63  *      Requires:
64  *\li           'source' is a valid SSU table
65  *\li           'targetp' points to a NULL dns_ssutable_t *.
66  *
67  *      Ensures:
68  *\li           *targetp is attached to source.
69  */
70
71 void
72 dns_ssutable_detach(dns_ssutable_t **tablep);
73 /*%<
74  *      Detach '*tablep' from its simple-secure-update rule table.
75  *
76  *      Requires:
77  *\li           'tablep' points to a valid dns_ssutable_t
78  *
79  *      Ensures:
80  *\li           *tablep is NULL
81  *\li           If '*tablep' is the last reference to the SSU table, all
82  *                      resources used by the table will be freed.
83  */
84
85 isc_result_t
86 dns_ssutable_addrule(dns_ssutable_t *table, isc_boolean_t grant,
87                      dns_name_t *identity, unsigned int matchtype,
88                      dns_name_t *name, unsigned int ntypes,
89                      dns_rdatatype_t *types);
90 /*%<
91  *      Adds a new rule to a simple-secure-update rule table.  The rule
92  *      either grants or denies update privileges of an identity (or set of
93  *      identities) to modify a name (or set of names) or certain types present
94  *      at that name.
95  *
96  *      Notes:
97  *\li           If 'matchtype' is of SELF type, this rule only matches if the
98  *              name to be updated matches the signing identity.
99  *
100  *\li           If 'ntypes' is 0, this rule applies to all types except
101  *              NS, SOA, RRSIG, and NSEC.
102  *
103  *\li           If 'types' includes ANY, this rule applies to all types
104  *              except NSEC.
105  *
106  *      Requires:
107  *\li           'table' is a valid SSU table
108  *\li           'identity' is a valid absolute name
109  *\li           'matchtype' must be one of the defined constants.
110  *\li           'name' is a valid absolute name
111  *\li           If 'ntypes' > 0, 'types' must not be NULL
112  *
113  *      Returns:
114  *\li           ISC_R_SUCCESS
115  *\li           ISC_R_NOMEMORY
116  */
117
118 isc_boolean_t
119 dns_ssutable_checkrules(dns_ssutable_t *table, dns_name_t *signer,
120                         dns_name_t *name, dns_rdatatype_t type);
121 /*%<
122  *      Checks that the attempted update of (name, type) is allowed according
123  *      to the rules specified in the simple-secure-update rule table.  If
124  *      no rules are matched, access is denied.  If signer is NULL, access
125  *      is denied.
126  *
127  *      Requires:
128  *\li           'table' is a valid SSU table
129  *\li           'signer' is NULL or a valid absolute name
130  *\li           'name' is a valid absolute name
131  */
132
133
134 /*% Accessor functions to extract rule components */
135 isc_boolean_t   dns_ssurule_isgrant(const dns_ssurule_t *rule);
136 /*% Accessor functions to extract rule components */
137 dns_name_t *    dns_ssurule_identity(const dns_ssurule_t *rule);
138 /*% Accessor functions to extract rule components */
139 unsigned int    dns_ssurule_matchtype(const dns_ssurule_t *rule);
140 /*% Accessor functions to extract rule components */
141 dns_name_t *    dns_ssurule_name(const dns_ssurule_t *rule);
142 /*% Accessor functions to extract rule components */
143 unsigned int    dns_ssurule_types(const dns_ssurule_t *rule,
144                                   dns_rdatatype_t **types);
145
146 isc_result_t    dns_ssutable_firstrule(const dns_ssutable_t *table,
147                                        dns_ssurule_t **rule);
148 /*%<
149  * Initiates a rule iterator.  There is no need to maintain any state.
150  *
151  * Returns:
152  *\li   #ISC_R_SUCCESS
153  *\li   #ISC_R_NOMORE
154  */
155
156 isc_result_t    dns_ssutable_nextrule(dns_ssurule_t *rule,
157                                       dns_ssurule_t **nextrule);
158 /*%<
159  * Returns the next rule in the table.
160  *
161  * Returns:
162  *\li   #ISC_R_SUCCESS
163  *\li   #ISC_R_NOMORE
164  */
165
166 ISC_LANG_ENDDECLS
167
168 #endif /* DNS_SSU_H */