2 * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 2000-2003 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: validator.h,v 1.18.12.9 2005/09/06 02:12:41 marka Exp $ */
20 #ifndef DNS_VALIDATOR_H
21 #define DNS_VALIDATOR_H 1
33 * The module ensures appropriate synchronization of data structures it
34 * creates and manipulates.
37 * No anticipated impact.
43 * No anticipated impact.
46 * RFCs: 1034, 1035, 2181, 2535, <TBS>
51 #include <isc/event.h>
52 #include <isc/mutex.h>
54 #include <dns/fixedname.h>
55 #include <dns/types.h>
56 #include <dns/rdataset.h>
57 #include <dns/rdatastruct.h> /* for dns_rdata_rrsig_t */
62 * A dns_validatorevent_t is sent when a 'validation' completes.
64 * 'name', 'rdataset', 'sigrdataset', and 'message' are the values that were
65 * supplied when dns_validator_create() was called. They are returned to the
66 * caller so that they may be freed.
68 typedef struct dns_validatorevent {
69 ISC_EVENT_COMMON(struct dns_validatorevent);
70 dns_validator_t * validator;
74 dns_rdataset_t * rdataset;
75 dns_rdataset_t * sigrdataset;
76 dns_message_t * message;
77 dns_name_t * proofs[3];
78 } dns_validatorevent_t;
80 #define DNS_VALIDATOR_NOQNAMEPROOF 0
81 #define DNS_VALIDATOR_NODATAPROOF 1
82 #define DNS_VALIDATOR_NOWILDCARDPROOF 2
85 * A validator object represents a validation in procgress.
87 * Clients are strongly discouraged from using this type directly, with
88 * the exception of the 'link' field, which may be used directly for
89 * whatever purpose the client desires.
91 struct dns_validator {
98 unsigned int attributes;
99 dns_validatorevent_t * event;
101 dns_validator_t * subvalidator;
102 dns_validator_t * parent;
103 dns_keytable_t * keytable;
104 dns_keynode_t * keynode;
106 dns_rdata_rrsig_t * siginfo;
108 isc_taskaction_t action;
111 dns_rdataset_t * currentset;
112 isc_boolean_t seensig;
113 dns_rdataset_t * keyset;
114 dns_rdataset_t * dsset;
115 dns_rdataset_t * soaset;
116 dns_rdataset_t * nsecset;
117 dns_name_t * soaname;
118 dns_rdataset_t frdataset;
119 dns_rdataset_t fsigrdataset;
120 dns_fixedname_t fname;
121 dns_fixedname_t wild;
122 ISC_LINK(dns_validator_t) link;
124 dns_fixedname_t dlvsep;
125 isc_boolean_t havedlvsep;
126 isc_boolean_t mustbesecure;
127 unsigned int dlvlabels;
131 #define DNS_VALIDATOR_DLV 1
136 dns_validator_create(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
137 dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset,
138 dns_message_t *message, unsigned int options,
139 isc_task_t *task, isc_taskaction_t action, void *arg,
140 dns_validator_t **validatorp);
142 * Start a DNSSEC validation.
144 * This validates a response to the question given by
147 * To validate a positive response, the response data is
148 * given by 'rdataset' and 'sigrdataset'. If 'sigrdataset'
149 * is NULL, the data is presumed insecure and an attempt
150 * is made to prove its insecurity by finding the appropriate
153 * The complete response message may be given in 'message',
154 * to make available any authority section NSECs that may be
155 * needed for validation of a response resulting from a
156 * wildcard expansion (though no such wildcard validation
157 * is implemented yet). If the complete response message
158 * is not available, 'message' is NULL.
160 * To validate a negative response, the complete negative response
161 * message is given in 'message'. The 'rdataset', and
162 * 'sigrdataset' arguments must be NULL, but the 'name' and 'type'
163 * arguments must be provided.
165 * The validation is performed in the context of 'view'.
166 * 'options' must be zero.
168 * When the validation finishes, a dns_validatorevent_t with
169 * the given 'action' and 'arg' are sent to 'task'.
170 * Its 'result' field will be ISC_R_SUCCESS iff the
171 * response was successfully proven to be either secure or
172 * part of a known insecure domain.
176 dns_validator_cancel(dns_validator_t *validator);
178 * Cancel a DNSSEC validation in progress.
181 * 'validator' points to a valid DNSSEC validator, which
182 * may or may not already have completed.
185 * It the validator has not already sent its completion
186 * event, it will send it with result code ISC_R_CANCELED.
190 dns_validator_destroy(dns_validator_t **validatorp);
192 * Destroy a DNSSEC validator.
195 * '*validatorp' points to a valid DNSSEC validator.
196 * The validator must have completed and sent its completion
200 * All resources used by the validator are freed.
205 #endif /* DNS_VALIDATOR_H */