Electroneum
packed_rrset.h
Go to the documentation of this file.
1 /*
2  * util/data/packed_rrset.h - data storage for a set of resource records.
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 UTIL_DATA_PACKED_RRSET_H
43 #define UTIL_DATA_PACKED_RRSET_H
44 #include "util/storage/lruhash.h"
45 struct alloc_cache;
46 struct regional;
47 
50 typedef uint64_t rrset_id_type;
51 
53 #define PACKED_RRSET_NSEC_AT_APEX 0x1
54 
55 #define PACKED_RRSET_PARENT_SIDE 0x2
56 
59 #define PACKED_RRSET_SOA_NEG 0x4
60 
63 #define PACKED_RRSET_FIXEDTTL 0x80000000
64 
69 #define RR_COUNT_MAX 0xffffff
70 
84  size_t dname_len;
97 };
98 
125 };
126 
170 };
171 
197 };
198 
238  time_t ttl;
240  size_t count;
242  size_t rrsig_count;
248  size_t* rr_len;
250  time_t *rr_ttl;
259 };
260 
266 struct packed_rrset {
271 };
272 
281 };
282 
290  struct alloc_cache* alloc);
291 
297 size_t packed_rrset_sizeof(struct packed_rrset_data* data);
298 
305 
312 size_t ub_rrset_sizefunc(void* key, void* data);
313 
320 int ub_rrset_compare(void* k1, void* k2);
321 
329 int rrsetdata_equal(struct packed_rrset_data* d1, struct packed_rrset_data* d2);
330 
338 void ub_rrset_key_delete(void* key, void* userdata);
339 
345 void rrset_data_delete(void* data, void* userdata);
346 
353 
359 void packed_rrset_ptr_fixup(struct packed_rrset_data* data);
360 
366 void packed_rrset_ttl_add(struct packed_rrset_data* data, time_t add);
367 
379 void get_cname_target(struct ub_packed_rrset_key* rrset, uint8_t** dname,
380  size_t* dname_len);
381 
387 const char* rrset_trust_to_string(enum rrset_trust s);
388 
394 const char* sec_status_to_string(enum sec_status s);
395 
402 void log_rrset_key(enum verbosity_value v, const char* str,
403  struct ub_packed_rrset_key* rrset);
404 
414 int packed_rr_to_string(struct ub_packed_rrset_key* rrset, size_t i,
415  time_t now, char* dest, size_t dest_len);
416 
423 void log_packed_rrset(enum verbosity_value v, const char* str,
424  struct ub_packed_rrset_key* rrset);
425 
435  struct ub_packed_rrset_key* key, struct regional* region,
436  time_t now);
437 
446  struct ub_packed_rrset_key* key, struct alloc_cache* alloc,
447  time_t now);
448 
449 #endif /* UTIL_DATA_PACKED_RRSET_H */
int packed_rr_to_string(struct ub_packed_rrset_key *rrset, size_t i, time_t now, char *dest, size_t dest_len)
struct ub_packed_rrset_key * packed_rrset_copy_alloc(struct ub_packed_rrset_key *key, struct alloc_cache *alloc, time_t now)
uint8_t ** rr_data
Definition: packed_rrset.h:258
int ub_rrset_compare(void *k1, void *k2)
void packed_rrset_ttl_add(struct packed_rrset_data *data, time_t add)
CXA_THROW_INFO_T void(* dest)(void *))
Definition: stack_trace.cpp:91
void packed_rrset_ptr_fixup(struct packed_rrset_data *data)
struct packed_rrset_data * d
Definition: packed_rrset.h:270
rrset_id_type id
Definition: packed_rrset.h:122
const char * key
Definition: hmac_keccak.cpp:39
unsigned short uint16_t
Definition: stdint.h:125
void get_cname_target(struct ub_packed_rrset_key *rrset, uint8_t **dname, size_t *dname_len)
unsigned char uint8_t
Definition: stdint.h:124
const char * rrset_trust_to_string(enum rrset_trust s)
struct packed_rrset rrset
Definition: packed_rrset.h:280
void log_rrset_key(enum verbosity_value v, const char *str, struct ub_packed_rrset_key *rrset)
enum rrset_trust trust
Definition: packed_rrset.h:244
void ub_packed_rrset_parsedelete(struct ub_packed_rrset_key *pkey, struct alloc_cache *alloc)
size_t ub_rrset_sizefunc(void *key, void *data)
void rrset_data_delete(void *data, void *userdata)
unsigned int uint32_t
Definition: stdint.h:126
uint32_t hashvalue_type
Definition: lruhash.h:119
sec_status
Definition: packed_rrset.h:176
unsigned __int64 uint64_t
Definition: stdint.h:136
verbosity_value
Definition: log.h:49
struct packed_rrset_list * next
Definition: packed_rrset.h:278
int rrsetdata_equal(struct packed_rrset_data *d1, struct packed_rrset_data *d2)
uint8_t * dname
Definition: packed_rrset.h:80
void log_packed_rrset(enum verbosity_value v, const char *str, struct ub_packed_rrset_key *rrset)
rrset_trust
Definition: packed_rrset.h:140
struct packed_rrset_key * k
Definition: packed_rrset.h:268
size_t packed_rrset_sizeof(struct packed_rrset_data *data)
uint64_t rrset_id_type
Definition: packed_rrset.h:46
enum sec_status security
Definition: packed_rrset.h:246
const char * sec_status_to_string(enum sec_status s)
struct lruhash_entry entry
Definition: packed_rrset.h:113
void ub_rrset_key_delete(void *key, void *userdata)
uint16_t rrset_class
Definition: packed_rrset.h:96
struct ub_packed_rrset_key * packed_rrset_copy_region(struct ub_packed_rrset_key *key, struct regional *region, time_t now)
struct packed_rrset_key rk
Definition: packed_rrset.h:124
hashvalue_type rrset_key_hash(struct packed_rrset_key *key)
Definition: lruhash.h:203
time_t ub_packed_rrset_ttl(struct ub_packed_rrset_key *key)