Electroneum
rrset.h
Go to the documentation of this file.
1 /*
2  * services/cache/rrset.h - Resource record set cache.
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 SERVICES_CACHE_RRSET_H
43 #define SERVICES_CACHE_RRSET_H
44 #include "util/storage/lruhash.h"
45 #include "util/storage/slabhash.h"
46 #include "util/data/packed_rrset.h"
47 struct config_file;
48 struct alloc_cache;
49 struct rrset_ref;
50 struct regional;
51 
56 struct rrset_cache {
58  struct slabhash table;
59 };
60 
67 struct rrset_cache* rrset_cache_create(struct config_file* cfg,
68  struct alloc_cache* alloc);
69 
74 void rrset_cache_delete(struct rrset_cache* r);
75 
85 struct rrset_cache* rrset_cache_adjust(struct rrset_cache* r,
86  struct config_file* cfg, struct alloc_cache* alloc);
87 
104 void rrset_cache_touch(struct rrset_cache* r, struct ub_packed_rrset_key* key,
106 
133 int rrset_cache_update(struct rrset_cache* r, struct rrset_ref* ref,
134  struct alloc_cache* alloc, time_t timenow);
135 
151  struct ub_packed_rrset_key* rrset, uint8_t* ce, size_t ce_len,
152  struct alloc_cache* alloc, time_t timenow);
153 
169  uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass,
170  uint32_t flags, time_t timenow, int wr);
171 
184 int rrset_array_lock(struct rrset_ref* ref, size_t count, time_t timenow);
185 
192 void rrset_array_unlock(struct rrset_ref* ref, size_t count);
193 
206 void rrset_array_unlock_touch(struct rrset_cache* r, struct regional* scratch,
207  struct rrset_ref* ref, size_t count);
208 
219 void rrset_update_sec_status(struct rrset_cache* r,
220  struct ub_packed_rrset_key* rrset, time_t now);
221 
231 void rrset_check_sec_status(struct rrset_cache* r,
232  struct ub_packed_rrset_key* rrset, time_t now);
233 
243 void rrset_cache_remove(struct rrset_cache* r, uint8_t* nm, size_t nmlen,
244  uint16_t type, uint16_t dclass, uint32_t flags);
245 
247 void rrset_markdel(void* key);
248 
249 #endif /* SERVICES_CACHE_RRSET_H */
void rrset_cache_remove(struct rrset_cache *r, uint8_t *nm, size_t nmlen, uint16_t type, uint16_t dclass, uint32_t flags)
struct rrset_cache * rrset_cache_create(struct config_file *cfg, struct alloc_cache *alloc)
void rrset_update_sec_status(struct rrset_cache *r, struct ub_packed_rrset_key *rrset, time_t now)
struct slabhash table
Definition: rrset.h:58
void rrset_cache_touch(struct rrset_cache *r, struct ub_packed_rrset_key *key, hashvalue_type hash, rrset_id_type id)
const char * key
Definition: hmac_keccak.cpp:39
unsigned short uint16_t
Definition: stdint.h:125
unsigned char uint8_t
Definition: stdint.h:124
void rrset_cache_delete(struct rrset_cache *r)
mdb_size_t count(MDB_cursor *cur)
void rrset_markdel(void *key)
unsigned int uint32_t
Definition: stdint.h:126
uint32_t hashvalue_type
Definition: lruhash.h:119
void rrset_cache_update_wildcard(struct rrset_cache *rrset_cache, struct ub_packed_rrset_key *rrset, uint8_t *ce, size_t ce_len, struct alloc_cache *alloc, time_t timenow)
int rrset_array_lock(struct rrset_ref *ref, size_t count, time_t timenow)
struct rrset_cache * rrset_cache_adjust(struct rrset_cache *r, struct config_file *cfg, struct alloc_cache *alloc)
int rrset_cache_update(struct rrset_cache *r, struct rrset_ref *ref, struct alloc_cache *alloc, time_t timenow)
uint64_t rrset_id_type
Definition: packed_rrset.h:46
POD_CLASS hash
Definition: hash.h:50
void rrset_check_sec_status(struct rrset_cache *r, struct ub_packed_rrset_key *rrset, time_t now)
void rrset_array_unlock(struct rrset_ref *ref, size_t count)
void rrset_array_unlock_touch(struct rrset_cache *r, struct regional *scratch, struct rrset_ref *ref, size_t count)
struct ub_packed_rrset_key * rrset_cache_lookup(struct rrset_cache *r, uint8_t *qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, uint32_t flags, time_t timenow, int wr)