Electroneum
val_anchor.h
Go to the documentation of this file.
1 /*
2  * validator/val_anchor.h - validator trust anchor storage.
3  *
4  * Copyright (c) 2007, NLnet Labs. All rights reserved.
5  *
6  * This software is open source.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  *
19  * Neither the name of the NLNET LABS nor the names of its contributors may
20  * be used to endorse or promote products derived from this software without
21  * specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
29  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
42 #ifndef VALIDATOR_VAL_ANCHOR_H
43 #define VALIDATOR_VAL_ANCHOR_H
44 #include "util/rbtree.h"
45 #include "util/locks.h"
46 struct trust_anchor;
47 struct config_file;
48 struct ub_packed_rrset_key;
49 struct autr_point_data;
50 struct autr_global_data;
51 struct sldns_buffer;
52 
60 struct val_anchors {
74 };
75 
79 struct ta_key {
81  struct ta_key* next;
85  size_t len;
88 };
89 
94 struct trust_anchor {
102  size_t namelen;
104  int namelabs;
110  struct ta_key* keylist;
114  size_t numDS;
116  size_t numDNSKEY;
123 };
124 
129 struct val_anchors* anchors_create(void);
130 
135 void anchors_delete(struct val_anchors* anchors);
136 
143 int anchors_apply_cfg(struct val_anchors* anchors, struct config_file* cfg);
144 
153 void anchors_init_parents_locked(struct val_anchors* anchors);
154 
165 struct trust_anchor* anchors_lookup(struct val_anchors* anchors,
166  uint8_t* qname, size_t qname_len, uint16_t qclass);
167 
177 struct trust_anchor* anchor_find(struct val_anchors* anchors,
178  uint8_t* name, int namelabs, size_t namelen, uint16_t dclass);
179 
187 struct trust_anchor* anchor_store_str(struct val_anchors* anchors,
188  struct sldns_buffer* buffer, const char* str);
189 
195 size_t anchors_get_mem(struct val_anchors* anchors);
196 
198 int anchor_cmp(const void* k1, const void* k2);
199 
207 int anchors_add_insecure(struct val_anchors* anchors, uint16_t c, uint8_t* nm);
208 
216 void anchors_delete_insecure(struct val_anchors* anchors, uint16_t c,
217  uint8_t* nm);
218 
228 size_t anchor_list_keytags(struct trust_anchor* ta, uint16_t* list, size_t num);
229 
242 int anchor_has_keytag(struct val_anchors* anchors, uint8_t* name, int namelabs,
243  size_t namelen, uint16_t dclass, uint16_t keytag);
244 
245 #endif /* VALIDATOR_VAL_ANCHOR_H */
void anchors_delete_insecure(struct val_anchors *anchors, uint16_t c, uint8_t *nm)
struct val_anchors * anchors_create(void)
rbtree_type * tree
Definition: val_anchor.h:69
void anchors_delete(struct val_anchors *anchors)
int anchors_apply_cfg(struct val_anchors *anchors, struct config_file *cfg)
struct trust_anchor * anchor_find(struct val_anchors *anchors, uint8_t *name, int namelabs, size_t namelen, uint16_t dclass)
size_t anchor_list_keytags(struct trust_anchor *ta, uint16_t *list, size_t num)
struct trust_anchor * anchors_lookup(struct val_anchors *anchors, uint8_t *qname, size_t qname_len, uint16_t qclass)
lock_basic_type lock
Definition: val_anchor.h:62
size_t numDNSKEY
Definition: val_anchor.h:116
int anchors_add_insecure(struct val_anchors *anchors, uint16_t c, uint8_t *nm)
struct trust_anchor * parent
Definition: val_anchor.h:106
unsigned short uint16_t
Definition: stdint.h:125
struct trust_anchor * anchor_store_str(struct val_anchors *anchors, struct sldns_buffer *buffer, const char *str)
struct autr_point_data * autr
Definition: val_anchor.h:112
unsigned char uint8_t
Definition: stdint.h:124
const char * name
uint16_t dclass
Definition: val_anchor.h:122
void anchors_init_parents_locked(struct val_anchors *anchors)
struct ta_key * keylist
Definition: val_anchor.h:110
uint8_t * name
Definition: val_anchor.h:100
rbnode_type node
Definition: val_anchor.h:96
size_t namelen
Definition: val_anchor.h:102
size_t anchors_get_mem(struct val_anchors *anchors)
int anchor_cmp(const void *k1, const void *k2)
int lock_basic_type
Definition: locks.h:269
struct autr_global_data * autr
Definition: val_anchor.h:73
struct ub_packed_rrset_key * dnskey_rrset
Definition: val_anchor.h:120
uint16_t type
Definition: val_anchor.h:87
uint8_t * data
Definition: val_anchor.h:83
lock_basic_type lock
Definition: val_anchor.h:98
size_t len
Definition: val_anchor.h:85
int anchor_has_keytag(struct val_anchors *anchors, uint8_t *name, int namelabs, size_t namelen, uint16_t dclass, uint16_t keytag)
struct ub_packed_rrset_key * ds_rrset
Definition: val_anchor.h:118
struct trust_anchor * dlv_anchor
Definition: val_anchor.h:71
size_t numDS
Definition: val_anchor.h:114
struct ta_key * next
Definition: val_anchor.h:81