Electroneum
iterator.h
Go to the documentation of this file.
1 /*
2  * iterator/iterator.h - iterative resolver DNS query response module
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_ITERATOR_H
44 #define ITERATOR_ITERATOR_H
45 #include "services/outbound_list.h"
46 #include "util/data/msgreply.h"
47 #include "util/module.h"
48 struct delegpt;
49 struct iter_hints;
50 struct iter_forwards;
51 struct iter_donotq;
52 struct iter_prep_list;
53 struct iter_priv;
54 struct rbtree_type;
55 
57 #define MAX_TARGET_COUNT 64
58 
59 #define MAX_RESTART_COUNT 8
60 
61 #define MAX_REFERRAL_COUNT 130
62 
63 #define MAX_SENT_COUNT 32
64 
66 #define DNSSEC_LAME_DETECT_COUNT 4
67 
71 #define MAX_MINIMISE_COUNT 10
72 /* max number of time-outs for minimised query. Prevents resolving failures
73  * when the QNAME minimisation QTYPE is blocked. */
74 #define MAX_MINIMISE_TIMEOUT_COUNT 3
75 
79 #define MINIMISE_ONE_LAB 4
80 #define MINIMISE_MULTIPLE_LABS (MAX_MINIMISE_COUNT - MINIMISE_ONE_LAB)
81 
82 #define TARGET_FETCH_STOP 3
83 
86 #define UNKNOWN_SERVER_NICENESS 376
87 
91 #define USEFUL_SERVER_TOP_TIMEOUT 120000
92 
93 #define OUTBOUND_MSG_RETRY 5
94 
97 #define RTT_BAND 400
98 
99 #define INFRA_BACKOFF_INITIAL 240
100 
104 struct iter_env {
107 
110 
113 
115  struct iter_priv* priv;
116 
119 
122 
132 
137 };
138 
160 };
161 
171 
177 
183 
191 
197 
200 
204 
208 
212 };
213 
217 struct iter_qstate {
226 
235 
241  int depth;
242 
246  struct dns_msg* response;
247 
255 
263 
272 
278  struct delegpt* dp;
279 
283  size_t caps_server;
288 
291 
294 
297 
300 
303 
306 
310 
313 
321 
333 
338 
345 
351 
357 
367 
370 
373 
379 
385 
390 
395 };
396 
405 };
406 
412 
418 const char* iter_state_to_string(enum iter_state state);
419 
426 
428 int iter_init(struct module_env* env, int id);
429 
431 void iter_deinit(struct module_env* env, int id);
432 
434 void iter_operate(struct module_qstate* qstate, enum module_ev event, int id,
435  struct outbound_entry* outbound);
436 
447 void iter_inform_super(struct module_qstate* qstate, int id,
448  struct module_qstate* super);
449 
451 void iter_clear(struct module_qstate* qstate, int id);
452 
454 size_t iter_get_mem(struct module_env* env, int id);
455 
456 #endif /* ITERATOR_ITERATOR_H */
struct iter_donotq * donotq
Definition: iterator.h:112
Definition: dns.h:61
int * target_fetch_policy
Definition: iterator.h:131
struct iter_prep_list * an_prepend_last
Definition: iterator.h:254
size_t caps_server
Definition: iterator.h:283
Definition: outbound_list.h:61
int query_for_pside_glue
Definition: iterator.h:330
struct dns_msg * response
Definition: iterator.h:246
int chase_to_rd
Definition: iterator.h:271
struct reply_info * caps_reply
Definition: iterator.h:286
int dnssec_expected
Definition: iterator.h:344
size_t num_queries_ratelimited
Definition: iterator.h:136
int ratelimit_ok
Definition: iterator.h:312
struct delegpt * store_parent_NS
Definition: iterator.h:320
enum iter_state final_state
Definition: iterator.h:234
struct delegpt * dp
Definition: iterator.h:278
struct module_func_block * iter_get_funcblock(void)
enum minimisation_state minimisation_state
Definition: iterator.h:372
minimisation_state
Definition: iterator.h:142
struct dns_msg * deleg_msg
Definition: iterator.h:290
int * target_count
Definition: iterator.h:309
int query_restart_count
Definition: iterator.h:299
unsigned short uint16_t
Definition: stdint.h:125
int minimise_timeout_count
Definition: iterator.h:389
struct iter_prep_list * an_prepend_list
Definition: iterator.h:252
unsigned char uint8_t
Definition: stdint.h:124
void iter_clear(struct module_qstate *qstate, int id)
int iter_init(struct module_env *env, int id)
struct outbound_list outlist
Definition: iterator.h:369
enum iter_state state
Definition: iterator.h:225
iter_state
Definition: iterator.h:165
struct iter_prep_list * ns_prepend_list
Definition: iterator.h:260
void iter_deinit(struct module_env *env, int id)
int refetch_glue
Definition: iterator.h:366
int dnssec_lame_query
Definition: iterator.h:350
int lock_basic_type
Definition: locks.h:269
void iter_operate(struct module_qstate *qstate, enum module_ev event, int id, struct outbound_entry *outbound)
struct query_info qchase
Definition: iterator.h:267
int auth_zone_response
Definition: iterator.h:392
struct dns_msg * caps_response
Definition: iterator.h:287
int iter_state_is_responsestate(enum iter_state s)
module_ev
Definition: module.h:536
int num_current_queries
Definition: iterator.h:296
int num_target_queries
Definition: iterator.h:293
size_t iter_get_mem(struct module_env *env, int id)
int auth_zone_avoid
Definition: iterator.h:394
size_t dsns_point_len
Definition: iterator.h:337
struct iter_priv * priv
Definition: iterator.h:115
Definition: blake256.h:37
const char * iter_state_to_string(enum iter_state state)
int wait_priming_stub
Definition: iterator.h:356
void iter_inform_super(struct module_qstate *qstate, int id, struct module_qstate *super)
uint16_t chase_flags
Definition: iterator.h:269
int referral_count
Definition: iterator.h:302
int supports_ipv6
Definition: iterator.h:106
int minimise_count
Definition: iterator.h:384
struct query_info qinfo_out
Definition: iterator.h:378
int max_dependency_depth
Definition: iterator.h:121
lock_basic_type queries_ratelimit_lock
Definition: iterator.h:134
int caps_fallback
Definition: iterator.h:281
int supports_ipv4
Definition: iterator.h:109
struct ub_packed_rrset_key * pside_glue
Definition: iterator.h:332
int sent_count
Definition: iterator.h:305
struct rbtree_type * caps_white
Definition: iterator.h:118
struct iter_prep_list * ns_prepend_last
Definition: iterator.h:262
struct ub_packed_rrset_key * rrset
Definition: iterator.h:404
uint8_t * dsns_point
Definition: iterator.h:335
struct iter_prep_list * next
Definition: iterator.h:402