Electroneum
Toggle main menu visibility
Loading...
Searching...
No Matches
val_neg.h
Go to the documentation of this file.
1
/*
2
* validator/val_neg.h - validator aggressive negative caching functions.
3
*
4
* Copyright (c) 2008, 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
44
45
#ifndef VALIDATOR_VAL_NEG_H
46
#define VALIDATOR_VAL_NEG_H
47
#include "
util/locks.h
"
48
#include "
util/rbtree.h
"
49
struct
sldns_buffer
;
50
struct
val_neg_data
;
51
struct
config_file
;
52
struct
reply_info
;
53
struct
rrset_cache
;
54
struct
regional
;
55
struct
query_info
;
56
struct
dns_msg
;
57
struct
ub_packed_rrset_key
;
58
67
struct
val_neg_cache
{
70
lock_basic_type
lock
;
72
rbtree_type
tree
;
74
struct
val_neg_data
*
first
;
76
struct
val_neg_data
*
last
;
78
size_t
use
;
80
size_t
max
;
82
size_t
nsec3_max_iter
;
85
size_t
num_neg_cache_noerror
;
88
size_t
num_neg_cache_nxdomain
;
89
};
90
94
struct
val_neg_zone
{
96
rbnode_type
node
;
98
uint8_t
*
name
;
100
size_t
len
;
102
int
labs
;
103
105
struct
val_neg_zone
*
parent
;
106
110
int
count
;
111
113
int
nsec3_hash
;
115
size_t
nsec3_iter
;
117
uint8_t
*
nsec3_salt
;
119
size_t
nsec3_saltlen
;
120
123
rbtree_type
tree
;
124
126
uint16_t
dclass
;
128
uint8_t
in_use
;
129
};
130
142
struct
val_neg_data
{
144
rbnode_type
node
;
146
uint8_t
*
name
;
148
size_t
len
;
150
int
labs
;
151
153
struct
val_neg_data
*
parent
;
154
158
int
count
;
159
161
struct
val_neg_zone
*
zone
;
162
164
struct
val_neg_data
*
prev
;
166
struct
val_neg_data
*
next
;
167
169
uint8_t
in_use
;
170
};
171
178
struct
val_neg_cache
*
val_neg_create
(
struct
config_file
* cfg,
size_t
maxiter);
179
185
size_t
val_neg_get_mem
(
struct
val_neg_cache
* neg);
186
191
void
neg_cache_delete
(
struct
val_neg_cache
* neg);
192
196
int
val_neg_data_compare
(
const
void
*
a
,
const
void
* b);
197
201
int
val_neg_zone_compare
(
const
void
*
a
,
const
void
* b);
202
209
void
val_neg_addreply
(
struct
val_neg_cache
* neg,
struct
reply_info
* rep);
210
218
void
val_neg_addreferral
(
struct
val_neg_cache
* neg,
struct
reply_info
* rep,
219
uint8_t
* zone);
220
238
int
val_neg_dlvlookup
(
struct
val_neg_cache
* neg,
uint8_t
* qname,
size_t
len,
239
uint16_t
qclass,
struct
rrset_cache
*
rrset_cache
, time_t now);
240
264
struct
dns_msg
*
val_neg_getmsg
(
struct
val_neg_cache
* neg,
265
struct
query_info
*
qinfo
,
struct
regional
* region,
266
struct
rrset_cache
*
rrset_cache
,
struct
sldns_buffer
*
buf
, time_t now,
267
int
addsoa,
uint8_t
* topname,
struct
config_file
* cfg);
268
269
270
/**** functions exposed for unit test ****/
278
void
neg_insert_data
(
struct
val_neg_cache
* neg,
279
struct
val_neg_zone
* zone,
struct
ub_packed_rrset_key
* nsec);
280
289
void
neg_delete_data
(
struct
val_neg_cache
* neg,
struct
val_neg_data
*
el
);
290
300
struct
val_neg_zone
*
neg_find_zone
(
struct
val_neg_cache
* neg,
301
uint8_t
* nm,
size_t
len
,
uint16_t
dclass
);
302
312
struct
val_neg_zone
*
neg_create_zone
(
struct
val_neg_cache
* neg,
313
uint8_t
* nm,
size_t
nm_len,
uint16_t
dclass
);
314
320
void
val_neg_zone_take_inuse
(
struct
val_neg_zone
* zone);
321
322
#endif
/* VALIDATOR_VAL_NEG_H */
locks.h
lock_basic_type
int lock_basic_type
Definition
locks.h:269
el
Easylogging++ entry namespace.
Definition
easylogging++.h:482
a
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition
pointer.h:1124
rbtree.h
buf
const char * buf
Definition
slow_memmem.cpp:74
uint16_t
unsigned short uint16_t
Definition
stdint.h:125
uint8_t
unsigned char uint8_t
Definition
stdint.h:124
config_file
Definition
config_file.h:68
dns_msg
Definition
dns.h:61
dns_msg::qinfo
struct query_info qinfo
Definition
dns.h:63
query_info
Definition
msgreply.h:69
rbnode_type
Definition
rbtree.h:55
rbtree_type
Definition
rbtree.h:76
regional
Definition
regional.h:60
reply_info
Definition
msgreply.h:125
rrset_cache
Definition
rrset.h:56
sldns_buffer
Definition
sbuffer.h:117
ub_packed_rrset_key
Definition
packed_rrset.h:107
val_neg_cache
Definition
val_neg.h:67
val_neg_cache::last
struct val_neg_data * last
Definition
val_neg.h:76
val_neg_cache::first
struct val_neg_data * first
Definition
val_neg.h:74
val_neg_cache::max
size_t max
Definition
val_neg.h:80
val_neg_cache::nsec3_max_iter
size_t nsec3_max_iter
Definition
val_neg.h:82
val_neg_cache::tree
rbtree_type tree
Definition
val_neg.h:72
val_neg_cache::lock
lock_basic_type lock
Definition
val_neg.h:70
val_neg_cache::num_neg_cache_noerror
size_t num_neg_cache_noerror
Definition
val_neg.h:85
val_neg_cache::num_neg_cache_nxdomain
size_t num_neg_cache_nxdomain
Definition
val_neg.h:88
val_neg_cache::use
size_t use
Definition
val_neg.h:78
val_neg_data
Definition
val_neg.h:142
val_neg_data::len
size_t len
Definition
val_neg.h:148
val_neg_data::parent
struct val_neg_data * parent
Definition
val_neg.h:153
val_neg_data::node
rbnode_type node
Definition
val_neg.h:144
val_neg_data::count
int count
Definition
val_neg.h:158
val_neg_data::prev
struct val_neg_data * prev
Definition
val_neg.h:164
val_neg_data::in_use
uint8_t in_use
Definition
val_neg.h:169
val_neg_data::next
struct val_neg_data * next
Definition
val_neg.h:166
val_neg_data::zone
struct val_neg_zone * zone
Definition
val_neg.h:161
val_neg_data::name
uint8_t * name
Definition
val_neg.h:146
val_neg_data::labs
int labs
Definition
val_neg.h:150
val_neg_zone
Definition
val_neg.h:94
val_neg_zone::node
rbnode_type node
Definition
val_neg.h:96
val_neg_zone::dclass
uint16_t dclass
Definition
val_neg.h:126
val_neg_zone::in_use
uint8_t in_use
Definition
val_neg.h:128
val_neg_zone::parent
struct val_neg_zone * parent
Definition
val_neg.h:105
val_neg_zone::nsec3_salt
uint8_t * nsec3_salt
Definition
val_neg.h:117
val_neg_zone::count
int count
Definition
val_neg.h:110
val_neg_zone::name
uint8_t * name
Definition
val_neg.h:98
val_neg_zone::labs
int labs
Definition
val_neg.h:102
val_neg_zone::nsec3_hash
int nsec3_hash
Definition
val_neg.h:113
val_neg_zone::tree
rbtree_type tree
Definition
val_neg.h:123
val_neg_zone::nsec3_iter
size_t nsec3_iter
Definition
val_neg.h:115
val_neg_zone::nsec3_saltlen
size_t nsec3_saltlen
Definition
val_neg.h:119
val_neg_zone::len
size_t len
Definition
val_neg.h:100
val_neg_addreply
void val_neg_addreply(struct val_neg_cache *neg, struct reply_info *rep)
val_neg_create
struct val_neg_cache * val_neg_create(struct config_file *cfg, size_t maxiter)
neg_cache_delete
void neg_cache_delete(struct val_neg_cache *neg)
val_neg_zone_compare
int val_neg_zone_compare(const void *a, const void *b)
val_neg_addreferral
void val_neg_addreferral(struct val_neg_cache *neg, struct reply_info *rep, uint8_t *zone)
neg_create_zone
struct val_neg_zone * neg_create_zone(struct val_neg_cache *neg, uint8_t *nm, size_t nm_len, uint16_t dclass)
val_neg_getmsg
struct dns_msg * val_neg_getmsg(struct val_neg_cache *neg, struct query_info *qinfo, struct regional *region, struct rrset_cache *rrset_cache, struct sldns_buffer *buf, time_t now, int addsoa, uint8_t *topname, struct config_file *cfg)
val_neg_dlvlookup
int val_neg_dlvlookup(struct val_neg_cache *neg, uint8_t *qname, size_t len, uint16_t qclass, struct rrset_cache *rrset_cache, time_t now)
val_neg_zone_take_inuse
void val_neg_zone_take_inuse(struct val_neg_zone *zone)
neg_delete_data
void neg_delete_data(struct val_neg_cache *neg, struct val_neg_data *el)
val_neg_data_compare
int val_neg_data_compare(const void *a, const void *b)
neg_insert_data
void neg_insert_data(struct val_neg_cache *neg, struct val_neg_zone *zone, struct ub_packed_rrset_key *nsec)
neg_find_zone
struct val_neg_zone * neg_find_zone(struct val_neg_cache *neg, uint8_t *nm, size_t len, uint16_t dclass)
val_neg_get_mem
size_t val_neg_get_mem(struct val_neg_cache *neg)
external
unbound
validator
val_neg.h
Generated on
for Electroneum by
1.17.0