OpenDNSSEC-signer  1.3.9
domain.h
Go to the documentation of this file.
1 /*
2  * $Id: domain.h 4573 2011-03-16 09:18:42Z matthijs $
3  *
4  * Copyright (c) 2009 NLNet Labs. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
21  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
23  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
25  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28 
34 #ifndef SIGNER_DOMAIN_H
35 #define SIGNER_DOMAIN_H
36 
37 #include "config.h"
38 #include "daemon/worker.h"
39 #include "scheduler/fifoq.h"
40 #include "shared/allocator.h"
41 #include "shared/status.h"
42 #include "signer/denial.h"
43 #include "signer/keys.h"
44 #include "signer/rrset.h"
45 
46 #include <ldns/ldns.h>
47 #include <time.h>
48 
50  DOMAIN_STATUS_NONE = 0, /* initial domain status [UNSIGNED] */
51  DOMAIN_STATUS_APEX, /* apex domain, authoritative [SIGNED] */
52  DOMAIN_STATUS_AUTH, /* authoritative domain, non-apex [SIGNED] */
53  DOMAIN_STATUS_NS, /* unsigned delegation [UNSIGNED] */
54  DOMAIN_STATUS_DS, /* signed delegation [SIGNED] */
55  DOMAIN_STATUS_ENT, /* empty non-terminal [UNSIGNED] */
56  DOMAIN_STATUS_OCCLUDED /* occluded domain [UNSIGNED] */
57 };
59 
60 #define SE_NSEC_RDATA_NXT 0
61 #define SE_NSEC_RDATA_BITMAP 1
62 #define SE_NSEC3_RDATA_NSEC3PARAMS 4
63 #define SE_NSEC3_RDATA_NXT 4
64 #define SE_NSEC3_RDATA_BITMAP 5
65 
70 typedef struct domain_struct domain_type;
71 struct domain_struct {
72  /* General domain info */
73  ldns_rdf* dname;
76 
77  /* Family */
79 
80  /* Denial of Existence */
82 
83  /* RRsets */
84  ldns_rbtree_t* rrsets;
85 };
86 
93 domain_type* domain_create(ldns_rdf* dname);
94 
103 ods_status domain_recover(domain_type* domain, FILE* fd,
104  domain_status dstatus);
105 
113 /*
114 int domain_recover_rr_from_backup(domain_type* domain, ldns_rr* rr);
115 */
116 
127 /*
128 int domain_recover_rrsig_from_backup(domain_type* domain, ldns_rr* rrsig,
129  ldns_rr_type type_covered, const char* locator, uint32_t flags);
130 */
131 
138 size_t domain_count_rrset(domain_type* domain);
139 
147 rrset_type* domain_lookup_rrset(domain_type* domain, ldns_rr_type rrtype);
148 
157 
166 
175 
184 int domain_examine_data_exists(domain_type* domain, ldns_rr_type rrtype,
185  int skip_glue);
186 
194 int domain_examine_ns_rdata(domain_type* domain, ldns_rdf* nsdname);
195 
203 
211 int domain_examine_rrset_is_alone(domain_type* domain, ldns_rr_type rrtype);
212 
220 int domain_examine_rrset_is_singleton(domain_type* domain, ldns_rr_type rrtype);
221 
229 
235 void domain_rollback(domain_type* domain);
236 
242 void domain_dstatus(domain_type* domain);
243 
253  worker_type* worker);
254 
260 void domain_cleanup(domain_type* domain);
261 
268 void domain_print(FILE* fd, domain_type* domain);
269 
276 void domain_backup(FILE* fd, domain_type* domain);
277 
278 #endif /* SIGNER_DOMAIN_H */