Electroneum
iter_utils.h
Go to the documentation of this file.
1 /*
2  * iterator/iter_utils.h - iterative resolver module utility functions.
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 
43 #ifndef ITERATOR_ITER_UTILS_H
44 #define ITERATOR_ITER_UTILS_H
45 #include "iterator/iter_resptype.h"
46 struct sldns_buffer;
47 struct iter_env;
48 struct iter_hints;
49 struct iter_forwards;
50 struct config_file;
51 struct module_env;
52 struct delegpt_addr;
53 struct delegpt;
54 struct regional;
55 struct msg_parse;
56 struct ub_randstate;
57 struct query_info;
58 struct reply_info;
59 struct module_qstate;
60 struct sock_list;
61 struct ub_packed_rrset_key;
62 
70 int iter_apply_cfg(struct iter_env* iter_env, struct config_file* cfg);
71 
98  struct module_env* env, struct delegpt* dp, uint8_t* name,
99  size_t namelen, uint16_t qtype, int* dnssec_lame,
100  int* chase_to_rd, int open_target, struct sock_list* blacklist,
101  time_t prefetch);
102 
110 struct dns_msg* dns_alloc_msg(struct sldns_buffer* pkt, struct msg_parse* msg,
111  struct regional* regional);
112 
119 struct dns_msg* dns_copy_msg(struct dns_msg* from, struct regional* regional);
120 
139 void iter_dns_store(struct module_env* env, struct query_info* qinf,
140  struct reply_info* rep, int is_referral, time_t leeway, int pside,
141  struct regional* region, uint16_t flags);
142 
151 int iter_ns_probability(struct ub_randstate* rnd, int n, int m);
152 
159 void iter_mark_cycle_targets(struct module_qstate* qstate, struct delegpt* dp);
160 
167 void iter_mark_pside_cycle_targets(struct module_qstate* qstate,
168  struct delegpt* dp);
169 
178 int iter_dp_is_useless(struct query_info* qinfo, uint16_t qflags,
179  struct delegpt* dp);
180 
190  struct query_info *qinfo);
191 
202 int iter_indicates_dnssec(struct module_env* env, struct delegpt* dp,
203  struct dns_msg* msg, uint16_t dclass);
204 
213 int iter_msg_has_dnssec(struct dns_msg* msg);
214 
227 int iter_msg_from_zone(struct dns_msg* msg, struct delegpt* dp,
228  enum response_type type, uint16_t dclass);
229 
239 int reply_equal(struct reply_info* p, struct reply_info* q, struct regional* region);
240 
248 void caps_strip_reply(struct reply_info* rep);
249 
256 int caps_failed_rcode(struct reply_info* rep);
257 
266 void iter_store_parentside_rrset(struct module_env* env,
267  struct ub_packed_rrset_key* rrset);
268 
275 void iter_store_parentside_NS(struct module_env* env, struct reply_info* rep);
276 
285 void iter_store_parentside_neg(struct module_env* env,
286  struct query_info* qinfo, struct reply_info* rep);
287 
301  struct delegpt* dp, struct regional* region, struct query_info* qinfo);
302 
315  struct delegpt* dp, struct regional* region, struct query_info* qinfo);
316 
324 int iter_get_next_root(struct iter_hints* hints, struct iter_forwards* fwd,
325  uint16_t* c);
326 
334 void iter_scrub_ds(struct dns_msg* msg, struct ub_packed_rrset_key* ns,
335  uint8_t* z);
336 
342 void iter_dec_attempts(struct delegpt* dp, int d);
343 
350 void iter_merge_retry_counts(struct delegpt* dp, struct delegpt* old);
351 
361 int iter_ds_toolow(struct dns_msg* msg, struct delegpt* dp);
362 
370 int iter_dp_cangodown(struct query_info* qinfo, struct delegpt* dp);
371 
372 #endif /* ITERATOR_ITER_UTILS_H */
int iter_lookup_parent_glue_from_cache(struct module_env *env, struct delegpt *dp, struct regional *region, struct query_info *qinfo)
int iter_apply_cfg(struct iter_env *iter_env, struct config_file *cfg)
Definition: dns.h:61
struct reply_info * rep
Definition: dns.h:65
void dp(key a)
Definition: rctTypes.cpp:46
int iter_indicates_dnssec(struct module_env *env, struct delegpt *dp, struct dns_msg *msg, uint16_t dclass)
response_type
Definition: iter_resptype.h:52
int reply_equal(struct reply_info *p, struct reply_info *q, struct regional *region)
void caps_strip_reply(struct reply_info *rep)
void iter_merge_retry_counts(struct delegpt *dp, struct delegpt *old)
unsigned short uint16_t
Definition: stdint.h:125
void iter_mark_pside_cycle_targets(struct module_qstate *qstate, struct delegpt *dp)
struct dns_msg * dns_alloc_msg(struct sldns_buffer *pkt, struct msg_parse *msg, struct regional *regional)
unsigned char uint8_t
Definition: stdint.h:124
int iter_dp_is_useless(struct query_info *qinfo, uint16_t qflags, struct delegpt *dp)
const char * name
int iter_ns_probability(struct ub_randstate *rnd, int n, int m)
void iter_store_parentside_NS(struct module_env *env, struct reply_info *rep)
int iter_msg_from_zone(struct dns_msg *msg, struct delegpt *dp, enum response_type type, uint16_t dclass)
void iter_dec_attempts(struct delegpt *dp, int d)
int iter_get_next_root(struct iter_hints *hints, struct iter_forwards *fwd, uint16_t *c)
void iter_dns_store(struct module_env *env, struct query_info *qinf, struct reply_info *rep, int is_referral, time_t leeway, int pside, struct regional *region, uint16_t flags)
int iter_dp_cangodown(struct query_info *qinfo, struct delegpt *dp)
void iter_store_parentside_neg(struct module_env *env, struct query_info *qinfo, struct reply_info *rep)
int iter_ds_toolow(struct dns_msg *msg, struct delegpt *dp)
struct delegpt_addr * iter_server_selection(struct iter_env *iter_env, struct module_env *env, struct delegpt *dp, uint8_t *name, size_t namelen, uint16_t qtype, int *dnssec_lame, int *chase_to_rd, int open_target, struct sock_list *blacklist, time_t prefetch)
int caps_failed_rcode(struct reply_info *rep)
void iter_mark_cycle_targets(struct module_qstate *qstate, struct delegpt *dp)
int iter_qname_indicates_dnssec(struct module_env *env, struct query_info *qinfo)
int iter_msg_has_dnssec(struct dns_msg *msg)
struct dns_msg * dns_copy_msg(struct dns_msg *from, struct regional *regional)
struct query_info qinfo
Definition: dns.h:63
void iter_scrub_ds(struct dns_msg *msg, struct ub_packed_rrset_key *ns, uint8_t *z)
void iter_store_parentside_rrset(struct module_env *env, struct ub_packed_rrset_key *rrset)
int iter_lookup_parent_NS_from_cache(struct module_env *env, struct delegpt *dp, struct regional *region, struct query_info *qinfo)