OpenDNSSEC-signer  1.4.5
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 
32 #ifndef SIGNER_RRSET_H
33 #define SIGNER_RRSET_H
34 
35 #include "config.h"
36 #include "shared/status.h"
37 #include "signer/stats.h"
38 
39 #include <ldns/ldns.h>
40 #include <libhsm.h>
41 
46 typedef struct rrsig_struct rrsig_type;
47 struct rrsig_struct {
48  ldns_rr* rr;
49  void* owner;
50  const char* key_locator;
51  uint32_t key_flags;
52 };
53 
58 typedef struct rr_struct rr_type;
59 struct rr_struct {
60  ldns_rr* rr;
61  void* owner;
62  unsigned exists : 1;
63  unsigned is_added : 1;
64  unsigned is_removed : 1;
65 };
66 
71 typedef struct rrset_struct rrset_type;
72 struct rrset_struct {
74  void* zone;
75  void* domain;
76  ldns_rr_type rrtype;
79  size_t rr_count;
80  size_t rrsig_count;
81  unsigned needs_signing : 1;
82 };
83 
91 void log_rr(ldns_rr* rr, const char* pre, int level);
92 
101 void log_rrset(ldns_rdf* dname, ldns_rr_type type, const char* pre, int level);
102 
109 const char* rrset_type2str(ldns_rr_type type);
110 
118 rrset_type* rrset_create(void* zoneptr, ldns_rr_type type);
119 
127 rr_type* rrset_lookup_rr(rrset_type* rrset, ldns_rr* rr);
128 
135 size_t rrset_count_rr_is_added(rrset_type* rrset);
136 
144 rr_type* rrset_add_rr(rrset_type* rrset, ldns_rr* rr);
145 
152 void rrset_del_rr(rrset_type* rrset, uint16_t rrnum);
153 
163 rrsig_type* rrset_add_rrsig(rrset_type* rrset, ldns_rr* rr,
164  const char* locator, uint32_t flags);
165 
172 void rrset_del_rrsig(rrset_type* rrset, uint16_t rrnum);
173 
181 void rrset_diff(rrset_type* rrset, unsigned is_ixfr, unsigned more_coming);
182 
191 ods_status rrset_sign(hsm_ctx_t* ctx, rrset_type* rrset, time_t signtime);
192 
201 void rrset_print(FILE* fd, rrset_type* rrset, int skip_rrsigs,
202  ods_status* status);
203 
209 void rrset_cleanup(rrset_type* rrset);
210 
217 void rrset_backup2(FILE* fd, rrset_type* rrset);
218 
219 #endif /* SIGNER_RRSET_H */