OpenDNSSEC-signer  1.4.1
rrset.h
Go to the documentation of this file.
1 /*
2  * $Id: rrset.h 6870 2012-11-27 13:01:48Z 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_RRSET_H
35 #define SIGNER_RRSET_H
36 
37 #include "config.h"
38 #include "shared/status.h"
39 #include "signer/stats.h"
40 
41 #include <ldns/ldns.h>
42 #include <libhsm.h>
43 
48 typedef struct rrsig_struct rrsig_type;
49 struct rrsig_struct {
50  ldns_rr* rr;
51  void* owner;
52  const char* key_locator;
53  uint32_t key_flags;
54 };
55 
60 typedef struct rr_struct rr_type;
61 struct rr_struct {
62  ldns_rr* rr;
63  void* owner;
64  unsigned exists : 1;
65  unsigned is_added : 1;
66  unsigned is_removed : 1;
67 };
68 
73 typedef struct rrset_struct rrset_type;
74 struct rrset_struct {
76  void* zone;
77  void* domain;
78  ldns_rr_type rrtype;
81  size_t rr_count;
82  size_t rrsig_count;
83  unsigned needs_signing : 1;
84 };
85 
93 void log_rr(ldns_rr* rr, const char* pre, int level);
94 
103 void log_rrset(ldns_rdf* dname, ldns_rr_type type, const char* pre, int level);
104 
111 const char* rrset_type2str(ldns_rr_type type);
112 
120 rrset_type* rrset_create(void* zoneptr, ldns_rr_type type);
121 
129 rr_type* rrset_lookup_rr(rrset_type* rrset, ldns_rr* rr);
130 
137 size_t rrset_count_rr_is_added(rrset_type* rrset);
138 
146 rr_type* rrset_add_rr(rrset_type* rrset, ldns_rr* rr);
147 
154 void rrset_del_rr(rrset_type* rrset, uint16_t rrnum);
155 
165 rrsig_type* rrset_add_rrsig(rrset_type* rrset, ldns_rr* rr,
166  const char* locator, uint32_t flags);
167 
174 void rrset_del_rrsig(rrset_type* rrset, uint16_t rrnum);
175 
183 void rrset_diff(rrset_type* rrset, unsigned is_ixfr, unsigned more_coming);
184 
193 ods_status rrset_sign(hsm_ctx_t* ctx, rrset_type* rrset, time_t signtime);
194 
203 void rrset_print(FILE* fd, rrset_type* rrset, int skip_rrsigs,
204  ods_status* status);
205 
211 void rrset_cleanup(rrset_type* rrset);
212 
219 void rrset_backup2(FILE* fd, rrset_type* rrset);
220 
221 #endif /* SIGNER_RRSET_H */
rr_type * rrset_lookup_rr(rrset_type *rrset, ldns_rr *rr)
Definition: rrset.c:214
size_t rr_count
Definition: rrset.h:81
void rrset_cleanup(rrset_type *rrset)
Definition: rrset.c:844
const char * rrset_type2str(ldns_rr_type type)
Definition: rrset.c:162
uint32_t key_flags
Definition: rrset.h:53
size_t rrset_count_rr_is_added(rrset_type *rrset)
Definition: rrset.c:243
rrset_type * rrset_create(void *zoneptr, ldns_rr_type type)
Definition: rrset.c:182
enum ods_enum_status ods_status
Definition: status.h:89
rr_type * rrset_add_rr(rrset_type *rrset, ldns_rr *rr)
Definition: rrset.c:264
rrsig_type * rrset_add_rrsig(rrset_type *rrset, ldns_rr *rr, const char *locator, uint32_t flags)
Definition: rrset.c:395
ldns_rr_type rrtype
Definition: rrset.h:78
rrset_type * next
Definition: rrset.h:75
void log_rr(ldns_rr *rr, const char *pre, int level)
Definition: rrset.c:50
unsigned exists
Definition: rrset.h:64
unsigned is_removed
Definition: rrset.h:66
void log_rrset(ldns_rdf *dname, ldns_rr_type type, const char *pre, int level)
Definition: rrset.c:102
unsigned needs_signing
Definition: rrset.h:83
ldns_rr * rr
Definition: rrset.h:50
void * zone
Definition: rrset.h:76
void rrset_del_rrsig(rrset_type *rrset, uint16_t rrnum)
Definition: rrset.c:431
void * owner
Definition: rrset.h:51
const char * key_locator
Definition: rrset.h:52
void * owner
Definition: rrset.h:63
void rrset_backup2(FILE *fd, rrset_type *rrset)
Definition: rrset.c:877
void rrset_del_rr(rrset_type *rrset, uint16_t rrnum)
Definition: rrset.c:302
ldns_rr * rr
Definition: rrset.h:62
size_t rrsig_count
Definition: rrset.h:82
ods_status rrset_sign(hsm_ctx_t *ctx, rrset_type *rrset, time_t signtime)
Definition: rrset.c:654
void rrset_diff(rrset_type *rrset, unsigned is_ixfr, unsigned more_coming)
Definition: rrset.c:339
void * domain
Definition: rrset.h:77
rrsig_type * rrsigs
Definition: rrset.h:80
unsigned is_added
Definition: rrset.h:65
void rrset_print(FILE *fd, rrset_type *rrset, int skip_rrsigs, ods_status *status)
Definition: rrset.c:789
rr_type * rrs
Definition: rrset.h:79