Electroneum
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"
49struct sldns_buffer;
50struct val_neg_data;
51struct config_file;
52struct reply_info;
53struct rrset_cache;
54struct regional;
55struct query_info;
56struct dns_msg;
58
90
130
171
178struct val_neg_cache* val_neg_create(struct config_file* cfg, size_t maxiter);
179
185size_t val_neg_get_mem(struct val_neg_cache* neg);
186
192
196int val_neg_data_compare(const void* a, const void* b);
197
201int val_neg_zone_compare(const void* a, const void* b);
202
209void val_neg_addreply(struct val_neg_cache* neg, struct reply_info* rep);
210
218void val_neg_addreferral(struct val_neg_cache* neg, struct reply_info* rep,
219 uint8_t* zone);
220
238int 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
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 ****/
279 struct val_neg_zone* zone, struct ub_packed_rrset_key* nsec);
280
289void neg_delete_data(struct val_neg_cache* neg, struct val_neg_data* el);
290
301 uint8_t* nm, size_t len, uint16_t dclass);
302
313 uint8_t* nm, size_t nm_len, uint16_t dclass);
314
321
322#endif /* VALIDATOR_VAL_NEG_H */
int lock_basic_type
Definition locks.h:269
Easylogging++ entry namespace.
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1124
const char * buf
unsigned short uint16_t
Definition stdint.h:125
unsigned char uint8_t
Definition stdint.h:124
Definition dns.h:61
struct query_info qinfo
Definition dns.h:63
struct val_neg_data * last
Definition val_neg.h:76
struct val_neg_data * first
Definition val_neg.h:74
size_t max
Definition val_neg.h:80
size_t nsec3_max_iter
Definition val_neg.h:82
rbtree_type tree
Definition val_neg.h:72
lock_basic_type lock
Definition val_neg.h:70
size_t num_neg_cache_noerror
Definition val_neg.h:85
size_t num_neg_cache_nxdomain
Definition val_neg.h:88
size_t use
Definition val_neg.h:78
size_t len
Definition val_neg.h:148
struct val_neg_data * parent
Definition val_neg.h:153
rbnode_type node
Definition val_neg.h:144
struct val_neg_data * prev
Definition val_neg.h:164
uint8_t in_use
Definition val_neg.h:169
struct val_neg_data * next
Definition val_neg.h:166
struct val_neg_zone * zone
Definition val_neg.h:161
uint8_t * name
Definition val_neg.h:146
rbnode_type node
Definition val_neg.h:96
uint16_t dclass
Definition val_neg.h:126
uint8_t in_use
Definition val_neg.h:128
struct val_neg_zone * parent
Definition val_neg.h:105
uint8_t * nsec3_salt
Definition val_neg.h:117
uint8_t * name
Definition val_neg.h:98
int nsec3_hash
Definition val_neg.h:113
rbtree_type tree
Definition val_neg.h:123
size_t nsec3_iter
Definition val_neg.h:115
size_t nsec3_saltlen
Definition val_neg.h:119
size_t len
Definition val_neg.h:100
void val_neg_addreply(struct val_neg_cache *neg, struct reply_info *rep)
struct val_neg_cache * val_neg_create(struct config_file *cfg, size_t maxiter)
void neg_cache_delete(struct val_neg_cache *neg)
int val_neg_zone_compare(const void *a, const void *b)
void val_neg_addreferral(struct val_neg_cache *neg, struct reply_info *rep, uint8_t *zone)
struct val_neg_zone * neg_create_zone(struct val_neg_cache *neg, uint8_t *nm, size_t nm_len, uint16_t dclass)
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)
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)
void val_neg_zone_take_inuse(struct val_neg_zone *zone)
void neg_delete_data(struct val_neg_cache *neg, struct val_neg_data *el)
int val_neg_data_compare(const void *a, const void *b)
void neg_insert_data(struct val_neg_cache *neg, struct val_neg_zone *zone, struct ub_packed_rrset_key *nsec)
struct val_neg_zone * neg_find_zone(struct val_neg_cache *neg, uint8_t *nm, size_t len, uint16_t dclass)
size_t val_neg_get_mem(struct val_neg_cache *neg)