OpenDNSSEC-signer  2.0.4
rrset.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 NLNet Labs. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
17  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
19  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
21  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
22  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
23  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  */
26 
27 #ifndef SIGNER_RRSET_H
28 #define SIGNER_RRSET_H
29 
30 #include "config.h"
31 #include <ldns/ldns.h>
32 
33 typedef struct rrsig_struct rrsig_type;
34 typedef struct rr_struct rr_type;
35 typedef struct rrset_struct rrset_type;
36 
37 #include "status.h"
38 #include "signer/stats.h"
39 #include "libhsm.h"
40 #include "domain.h"
41 #include "zone.h"
42 #include "datastructure.h"
43 
44 struct rrsig_struct {
45  ldns_rr* rr;
47  const char* key_locator;
48  uint32_t key_flags;
49 };
50 
51 struct rr_struct {
52  ldns_rr* rr;
54  unsigned exists : 1;
55  unsigned is_added : 1;
56  unsigned is_removed : 1;
57 };
58 
59 struct rrset_struct {
63  ldns_rr_type rrtype;
65  size_t rr_count;
66  collection_t rrsigs;
67  unsigned needs_signing : 1;
68 };
69 
77 void log_rr(ldns_rr* rr, const char* pre, int level);
78 
87 void log_rrset(ldns_rdf* dname, ldns_rr_type type, const char* pre, int level);
88 
95 const char* rrset_type2str(ldns_rr_type type);
96 
104 rrset_type* rrset_create(zone_type* zone, ldns_rr_type type);
105 
113 rr_type* rrset_lookup_rr(rrset_type* rrset, ldns_rr* rr);
114 
121 size_t rrset_count_rr_is_added(rrset_type* rrset);
122 
130 rr_type* rrset_add_rr(rrset_type* rrset, ldns_rr* rr);
131 
138 void rrset_del_rr(rrset_type* rrset, uint16_t rrnum);
139 
148 void rrset_add_rrsig(rrset_type* rrset, ldns_rr* rr,
149  const char* locator, uint32_t flags);
150 
157 void rrset_drop_rrsigs(zone_type* zone, rrset_type* rrset);
158 
166 void rrset_diff(rrset_type* rrset, unsigned is_ixfr, unsigned more_coming);
167 
176 ods_status rrset_sign(hsm_ctx_t* ctx, rrset_type* rrset, time_t signtime);
177 
186 ods_status rrset_getliteralrr(ldns_rr** dnskey, const char *resourcerecord, uint32_t ttl, ldns_rdf* apex);
187 
196 void rrset_print(FILE* fd, rrset_type* rrset, int skip_rrsigs,
197  ods_status* status);
198 
204 void rrset_cleanup(rrset_type* rrset);
205 
212 void rrset_backup2(FILE* fd, rrset_type* rrset);
213 
214 collection_class rrset_store_initialize(void);
215 
216 #endif /* SIGNER_RRSET_H */
void rrset_cleanup(rrset_type *rrset)
Definition: rrset.c:845
void rrset_diff(rrset_type *rrset, unsigned is_ixfr, unsigned more_coming)
Definition: rrset.c:352
size_t rr_count
Definition: rrset.h:65
uint32_t key_flags
Definition: rrset.h:48
collection_t rrsigs
Definition: rrset.h:66
void rrset_print(FILE *fd, rrset_type *rrset, int skip_rrsigs, ods_status *status)
Definition: rrset.c:788
size_t rrset_count_rr_is_added(rrset_type *rrset)
Definition: rrset.c:264
void rrset_drop_rrsigs(zone_type *zone, rrset_type *rrset)
Definition: rrset.c:399
ldns_rr_type rrtype
Definition: rrset.h:63
rrset_type * next
Definition: rrset.h:60
void rrset_backup2(FILE *fd, rrset_type *rrset)
Definition: rrset.c:868
void rrset_del_rr(rrset_type *rrset, uint16_t rrnum)
Definition: rrset.c:320
unsigned exists
Definition: rrset.h:54
void log_rrset(ldns_rdf *dname, ldns_rr_type type, const char *pre, int level)
Definition: rrset.c:99
collection_class rrset_store_initialize(void)
Definition: rrset.c:222
unsigned is_removed
Definition: rrset.h:56
unsigned needs_signing
Definition: rrset.h:67
const char * rrset_type2str(ldns_rr_type type)
Definition: rrset.c:158
ldns_rr * rr
Definition: rrset.h:45
domain_type * owner
Definition: rrset.h:46
const char * key_locator
Definition: rrset.h:47
domain_type * owner
Definition: rrset.h:53
domain_type * domain
Definition: rrset.h:62
void rrset_add_rrsig(rrset_type *rrset, ldns_rr *rr, const char *locator, uint32_t flags)
Definition: rrset.c:416
rr_type * rrset_add_rr(rrset_type *rrset, ldns_rr *rr)
Definition: rrset.c:285
ldns_rr * rr
Definition: rrset.h:52
rr_type * rrset_lookup_rr(rrset_type *rrset, ldns_rr *rr)
Definition: rrset.c:235
unsigned is_added
Definition: rrset.h:55
ods_status rrset_sign(hsm_ctx_t *ctx, rrset_type *rrset, time_t signtime)
Definition: rrset.c:629
rrset_type * rrset_create(zone_type *zone, ldns_rr_type type)
Definition: rrset.c:198
void log_rr(ldns_rr *rr, const char *pre, int level)
Definition: rrset.c:48
rr_type * rrs
Definition: rrset.h:64
ods_status rrset_getliteralrr(ldns_rr **dnskey, const char *resourcerecord, uint32_t ttl, ldns_rdf *apex)
Definition: rrset.c:768
zone_type * zone
Definition: rrset.h:61