Electroneum
Loading...
Searching...
No Matches
dns.h
Go to the documentation of this file.
1/*
2 * services/cache/dns.h - Cache services for DNS using msg and rrset caches.
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
41
42#ifndef SERVICES_CACHE_DNS_H
43#define SERVICES_CACHE_DNS_H
45#include "util/data/msgreply.h"
46struct module_env;
47struct query_info;
48struct reply_info;
49struct regional;
50struct delegpt;
51
54
56#define DNSCACHE_STORE_ZEROTTL 0x100000
57
61struct dns_msg {
65 struct reply_info *rep;
66};
67
93int dns_cache_store(struct module_env* env, struct query_info* qinf,
94 struct reply_info* rep, int is_referral, time_t leeway, int pside,
95 struct regional* region, uint32_t flags);
96
117void dns_cache_store_msg(struct module_env* env, struct query_info* qinfo,
118 hashvalue_type hash, struct reply_info* rep, time_t leeway, int pside,
119 struct reply_info* qrep, uint32_t flags, struct regional* region);
120
135 uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass,
136 struct regional* region, struct dns_msg** msg, time_t timenow);
137
148struct dns_msg* tomsg(struct module_env* env, struct query_info* q,
149 struct reply_info* r, struct regional* region, time_t now,
150 struct regional* scratch);
151
169 uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass,
170 uint16_t flags, struct regional* region, struct regional* scratch,
171 int no_partial);
172
181int cache_fill_missing(struct module_env* env, uint16_t qclass,
182 struct regional* region, struct delegpt* dp);
183
195struct dns_msg* dns_msg_create(uint8_t* qname, size_t qnamelen, uint16_t qtype,
196 uint16_t qclass, struct regional* region, size_t capacity);
197
207int dns_msg_authadd(struct dns_msg* msg, struct regional* region,
208 struct ub_packed_rrset_key* rrset, time_t now);
209
219int dns_msg_ansadd(struct dns_msg* msg, struct regional* region,
220 struct ub_packed_rrset_key* rrset, time_t now);
221
233 time_t adjust, uint16_t flags);
234
238 uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass,
239 uint16_t flags, time_t now, int wr);
240
241#endif /* SERVICES_CACHE_DNS_H */
int dns_msg_ansadd(struct dns_msg *msg, struct regional *region, struct ub_packed_rrset_key *rrset, time_t now)
int dns_cache_store(struct module_env *env, struct query_info *qinf, struct reply_info *rep, int is_referral, time_t leeway, int pside, struct regional *region, uint32_t flags)
void dns_cache_store_msg(struct module_env *env, struct query_info *qinfo, hashvalue_type hash, struct reply_info *rep, time_t leeway, int pside, struct reply_info *qrep, uint32_t flags, struct regional *region)
struct delegpt * dns_cache_find_delegation(struct module_env *env, uint8_t *qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, struct regional *region, struct dns_msg **msg, time_t timenow)
struct dns_msg * dns_msg_create(uint8_t *qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, struct regional *region, size_t capacity)
int cache_fill_missing(struct module_env *env, uint16_t qclass, struct regional *region, struct delegpt *dp)
struct dns_msg * dns_cache_lookup(struct module_env *env, uint8_t *qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, uint16_t flags, struct regional *region, struct regional *scratch, int no_partial)
int dns_cache_prefetch_adjust(struct module_env *env, struct query_info *qinfo, time_t adjust, uint16_t flags)
struct msgreply_entry * msg_cache_lookup(struct module_env *env, uint8_t *qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, uint16_t flags, time_t now, int wr)
struct dns_msg * tomsg(struct module_env *env, struct query_info *q, struct reply_info *r, struct regional *region, time_t now, struct regional *scratch)
int dns_msg_authadd(struct dns_msg *msg, struct regional *region, struct ub_packed_rrset_key *rrset, time_t now)
uint32_t hashvalue_type
Definition lruhash.h:119
unsigned short uint16_t
Definition stdint.h:125
unsigned int uint32_t
Definition stdint.h:126
unsigned char uint8_t
Definition stdint.h:124
Definition dns.h:61
struct reply_info * rep
Definition dns.h:65
struct query_info qinfo
Definition dns.h:63
Definition msgreply.h:211
uint16_t flags
Definition msgreply.h:127