Electroneum
validator.h
Go to the documentation of this file.
1 /*
2  * validator/validator.h - secure validator DNS query response module
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 
43 #ifndef VALIDATOR_VALIDATOR_H
44 #define VALIDATOR_VALIDATOR_H
45 #include "util/module.h"
46 #include "util/data/msgreply.h"
47 #include "validator/val_utils.h"
48 struct val_anchors;
49 struct key_cache;
50 struct key_entry_key;
51 struct val_neg_cache;
52 struct config_strlist;
53 
59 #define NULL_KEY_TTL 60 /* seconds */
60 
65 #define BOGUS_KEY_TTL 60 /* seconds */
66 
68 #define VAL_MAX_RESTART_COUNT 5
69 
71 #define SENTINEL_IS "root-key-sentinel-is-ta-"
72 
73 #define SENTINEL_NOT "root-key-sentinel-not-ta-"
74 
75 #define SENTINEL_KEYTAG_LEN 5
76 
80 struct val_env {
83  struct key_cache* kcache;
84 
87 
91 
94 
97 
102 
108 
113  size_t* nsec3_keysize;
114 
120  size_t* nsec3_maxiter;
121 
126 };
127 
131 enum val_state {
142 };
143 
147 struct val_qstate {
152 
156  struct dns_msg* orig_msg;
157 
164 
169 
178 
190  size_t rrset_skip;
191 
198 
201 
205  size_t empty_DS_len;
206 
209 
212 
216  size_t signer_len;
217 
220 
235  enum dlv_status {
236  dlv_error, /* server failure */
237  dlv_success, /* got a DLV */
238  dlv_ask_higher, /* ask again */
239  dlv_there_is_no_dlv /* got no DLV, sure of it */
240  } dlv_status;
241 };
242 
248 
254 const char* val_state_to_string(enum val_state state);
255 
257 int val_init(struct module_env* env, int id);
258 
260 void val_deinit(struct module_env* env, int id);
261 
263 void val_operate(struct module_qstate* qstate, enum module_ev event, int id,
264  struct outbound_entry* outbound);
265 
273 void val_inform_super(struct module_qstate* qstate, int id,
274  struct module_qstate* super);
275 
277 void val_clear(struct module_qstate* qstate, int id);
278 
286 size_t val_get_mem(struct module_env* env, int id);
287 
288 #endif /* VALIDATOR_VALIDATOR_H */
enum val_classification subtype
Definition: validator.h:211
void val_deinit(struct module_env *env, int id)
struct key_cache * kcache
Definition: validator.h:83
Definition: dns.h:61
uint8_t * empty_DS_name
Definition: validator.h:203
int32_t skew_max
Definition: validator.h:96
uint8_t * trust_anchor_name
Definition: validator.h:193
Definition: outbound_list.h:61
size_t trust_anchor_len
Definition: validator.h:197
struct val_neg_cache * neg_cache
Definition: validator.h:86
size_t val_get_mem(struct module_env *env, int id)
int nsec3_keyiter_count
Definition: validator.h:107
struct query_info qchase
Definition: validator.h:168
unsigned char uint8_t
Definition: stdint.h:124
lock_basic_type bogus_lock
Definition: validator.h:123
void val_clear(struct module_qstate *qstate, int id)
struct reply_info * chase_reply
Definition: validator.h:177
uint8_t * dlv_insecure_at
Definition: validator.h:231
struct module_func_block * val_get_funcblock(void)
size_t dlv_insecure_at_len
Definition: validator.h:233
size_t * nsec3_keysize
Definition: validator.h:113
const char * val_state_to_string(enum val_state state)
int32_t skew_min
Definition: validator.h:93
val_classification
Definition: val_utils.h:61
size_t empty_DS_len
Definition: validator.h:205
unsigned int uint32_t
Definition: stdint.h:126
int32_t date_override
Definition: validator.h:90
int wait_prime_ta
Definition: validator.h:219
size_t num_rrset_bogus
Definition: validator.h:125
int lock_basic_type
Definition: locks.h:269
int trust_anchor_labs
Definition: validator.h:195
size_t rrset_skip
Definition: validator.h:190
struct sock_list * chain_blacklist
Definition: validator.h:163
module_ev
Definition: module.h:536
uint8_t * signer_name
Definition: validator.h:214
uint8_t * dlv_lookup_name
Definition: validator.h:226
struct key_entry_key * key_entry
Definition: validator.h:208
int restart_count
Definition: validator.h:161
Definition: blake256.h:37
int dlv_checked
Definition: validator.h:222
struct ub_packed_rrset_key * ds_rrset
Definition: validator.h:200
enum val_state state
Definition: validator.h:151
void val_operate(struct module_qstate *qstate, enum module_ev event, int id, struct outbound_entry *outbound)
size_t signer_len
Definition: validator.h:216
size_t * nsec3_maxiter
Definition: validator.h:120
size_t dlv_lookup_name_len
Definition: validator.h:228
val_state
Definition: validator.h:131
int val_init(struct module_env *env, int id)
struct dns_msg * orig_msg
Definition: validator.h:156
signed int int32_t
Definition: stdint.h:123
Definition: val_kentry.h:55
uint32_t bogus_ttl
Definition: validator.h:101
void val_inform_super(struct module_qstate *qstate, int id, struct module_qstate *super)