Electroneum
Toggle main menu visibility
Loading...
Searching...
No Matches
replay.h
Go to the documentation of this file.
1
/*
2
* testcode/replay.h - store and use a replay of events for the DNS resolver.
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
137
138
#ifndef TESTCODE_REPLAY_H
139
#define TESTCODE_REPLAY_H
140
#include "
util/netevent.h
"
141
#include "testcode/testpkts.h"
142
#include "
util/rbtree.h
"
143
struct
replay_answer
;
144
struct
replay_moment
;
145
struct
replay_range
;
146
struct
fake_pending
;
147
struct
fake_timer
;
148
struct
replay_var
;
149
struct
infra_cache
;
150
struct
sldns_buffer
;
151
155
struct
replay_scenario
{
157
char
*
title
;
158
160
struct
replay_moment
*
mom_first
;
162
struct
replay_moment
*
mom_last
;
163
171
struct
replay_range
*
range_list
;
172
};
173
180
struct
replay_moment
{
185
int
time_step
;
187
struct
replay_moment
*
mom_next
;
188
190
enum
replay_event_type
{
192
repevt_nothing
,
194
repevt_front_query
,
196
repevt_front_reply
,
198
repevt_timeout
,
200
repevt_time_passes
,
202
repevt_back_reply
,
204
repevt_back_query
,
206
repevt_autotrust_check
,
208
repevt_tempfile_check
,
210
repevt_error
,
212
repevt_assign
,
214
repevt_infra_rtt
,
216
repevt_traffic
217
}
218
219
evt_type
;
220
222
struct
entry*
match
;
223
225
struct
timeval
elapse
;
226
228
struct
sockaddr_storage
addr
;
230
socklen_t
addrlen
;
231
233
char
*
variable
;
235
char
*
string
;
236
238
char
*
autotrust_id
;
240
struct
config_strlist
*
file_content
;
241
};
242
246
struct
replay_range
{
248
int
start_step
;
250
int
end_step
;
252
struct
sockaddr_storage
addr
;
254
socklen_t
addrlen
;
255
257
struct
entry*
match
;
258
260
struct
replay_range
*
next_range
;
261
};
262
266
struct
replay_runtime
{
270
struct
replay_scenario
*
scenario
;
274
struct
replay_moment
*
now
;
275
280
struct
fake_pending
*
pending_list
;
281
285
struct
replay_answer
*
answer_list
;
286
288
struct
replay_answer
*
answer_last
;
289
291
struct
fake_timer
*
timer_list
;
292
294
comm_point_callback_type
*
callback_query
;
296
void
*
cb_arg
;
297
299
struct
infra_cache
*
infra
;
300
302
time_t
now_secs
;
304
struct
timeval
now_tv
;
305
307
void (*
sig_cb
)(int,
void
*);
309
void
*
sig_cb_arg
;
311
int
exit_cleanly
;
312
314
size_t
bufsize
;
315
319
rbtree_type
*
vars
;
320
};
321
325
struct
fake_pending
{
327
struct
sldns_buffer
*
buffer
;
329
struct
sockaddr_storage
addr
;
331
socklen_t
addrlen
;
333
uint8_t
*
zone
;
335
size_t
zonelen
;
337
int
qtype
;
339
comm_point_callback_type
*
callback
;
341
void
*
cb_arg
;
343
int
timeout
;
344
346
struct
fake_pending
*
next
;
348
uint8_t
*
pkt
;
349
size_t
pkt_len
;
351
enum
transport_type
transport
;
353
int
serviced
;
355
int
tcp_pkt_counter
;
357
struct
replay_runtime
*
runtime
;
358
};
359
363
struct
replay_answer
{
365
struct
replay_answer
*
next
;
367
struct
comm_reply
repinfo
;
369
uint8_t
*
pkt
;
370
size_t
pkt_len
;
371
};
372
376
struct
fake_timer
{
378
struct
fake_timer
*
next
;
380
struct
replay_runtime
*
runtime
;
382
void (*
cb
)(
void
*);
384
void
*
cb_arg
;
386
int
enabled
;
388
struct
timeval
tv
;
389
};
390
394
struct
replay_var
{
396
rbnode_type
node
;
398
char
*
name
;
400
char
*
value
;
401
};
402
410
struct
replay_scenario
*
replay_scenario_read
(FILE* in,
const
char
* name,
411
int
* lineno);
412
417
void
replay_scenario_delete
(
struct
replay_scenario
* scen);
418
420
int
replay_var_compare
(
const
void
*
a
,
const
void
* b);
421
423
struct
fake_timer
*
replay_get_oldest_timer
(
struct
replay_runtime
*
runtime
);
424
429
rbtree_type
*
macro_store_create
(
void
);
430
435
void
macro_store_delete
(
rbtree_type
* store);
436
444
char
*
macro_process
(
rbtree_type
* store,
struct
replay_runtime
*
runtime
,
445
char
* text);
446
454
char
*
macro_lookup
(
rbtree_type
* store,
char
* name);
455
463
int
macro_assign
(
rbtree_type
* store,
char
* name,
char
*
value
);
464
466
void
macro_print_debug
(
rbtree_type
* store);
467
469
void
testbound_selftest
(
void
);
470
471
#endif
/* TESTCODE_REPLAY_H */
netevent.h
comm_point_callback_type
int comm_point_callback_type(struct comm_point *, void *, int, struct comm_reply *)
Definition
netevent.h:76
value
const GenericPointer< typename T::ValueType > T2 value
Definition
pointer.h:1225
a
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition
pointer.h:1124
rbtree.h
macro_process
char * macro_process(rbtree_type *store, struct replay_runtime *runtime, char *text)
macro_lookup
char * macro_lookup(rbtree_type *store, char *name)
macro_store_delete
void macro_store_delete(rbtree_type *store)
macro_print_debug
void macro_print_debug(rbtree_type *store)
replay_scenario_delete
void replay_scenario_delete(struct replay_scenario *scen)
replay_scenario_read
struct replay_scenario * replay_scenario_read(FILE *in, const char *name, int *lineno)
testbound_selftest
void testbound_selftest(void)
macro_assign
int macro_assign(rbtree_type *store, char *name, char *value)
replay_var_compare
int replay_var_compare(const void *a, const void *b)
macro_store_create
rbtree_type * macro_store_create(void)
replay_get_oldest_timer
struct fake_timer * replay_get_oldest_timer(struct replay_runtime *runtime)
uint8_t
unsigned char uint8_t
Definition
stdint.h:124
comm_reply
Definition
netevent.h:112
config_strlist
Definition
config_file.h:617
fake_pending
Definition
replay.h:325
fake_pending::runtime
struct replay_runtime * runtime
Definition
replay.h:357
fake_pending::cb_arg
void * cb_arg
Definition
replay.h:341
fake_pending::transport
enum transport_type transport
Definition
replay.h:351
fake_pending::timeout
int timeout
Definition
replay.h:343
fake_pending::tcp_pkt_counter
int tcp_pkt_counter
Definition
replay.h:355
fake_pending::serviced
int serviced
Definition
replay.h:353
fake_pending::next
struct fake_pending * next
Definition
replay.h:346
fake_pending::addrlen
socklen_t addrlen
Definition
replay.h:331
fake_pending::qtype
int qtype
Definition
replay.h:337
fake_pending::buffer
struct sldns_buffer * buffer
Definition
replay.h:327
fake_pending::zonelen
size_t zonelen
Definition
replay.h:335
fake_pending::callback
comm_point_callback_type * callback
Definition
replay.h:339
fake_pending::addr
struct sockaddr_storage addr
Definition
replay.h:329
fake_pending::zone
uint8_t * zone
Definition
replay.h:333
fake_pending::pkt
uint8_t * pkt
Definition
replay.h:348
fake_pending::pkt_len
size_t pkt_len
Definition
replay.h:349
fake_timer
Definition
replay.h:376
fake_timer::cb
void(* cb)(void *)
Definition
replay.h:382
fake_timer::enabled
int enabled
Definition
replay.h:386
fake_timer::cb_arg
void * cb_arg
Definition
replay.h:384
fake_timer::next
struct fake_timer * next
Definition
replay.h:378
fake_timer::runtime
struct replay_runtime * runtime
Definition
replay.h:380
fake_timer::tv
struct timeval tv
Definition
replay.h:388
infra_cache
Definition
infra.h:112
rbnode_type
Definition
rbtree.h:55
rbtree_type
Definition
rbtree.h:76
replay_answer
Definition
replay.h:363
replay_answer::next
struct replay_answer * next
Definition
replay.h:365
replay_answer::pkt
uint8_t * pkt
Definition
replay.h:369
replay_answer::pkt_len
size_t pkt_len
Definition
replay.h:370
replay_answer::repinfo
struct comm_reply repinfo
Definition
replay.h:367
replay_moment
Definition
replay.h:180
replay_moment::evt_type
enum replay_moment::replay_event_type evt_type
replay_moment::autotrust_id
char * autotrust_id
Definition
replay.h:238
replay_moment::addrlen
socklen_t addrlen
Definition
replay.h:230
replay_moment::string
char * string
Definition
replay.h:235
replay_moment::time_step
int time_step
Definition
replay.h:185
replay_moment::addr
struct sockaddr_storage addr
Definition
replay.h:228
replay_moment::replay_event_type
replay_event_type
Definition
replay.h:190
replay_moment::repevt_timeout
@ repevt_timeout
Definition
replay.h:198
replay_moment::repevt_infra_rtt
@ repevt_infra_rtt
Definition
replay.h:214
replay_moment::repevt_back_query
@ repevt_back_query
Definition
replay.h:204
replay_moment::repevt_error
@ repevt_error
Definition
replay.h:210
replay_moment::repevt_traffic
@ repevt_traffic
Definition
replay.h:216
replay_moment::repevt_front_reply
@ repevt_front_reply
Definition
replay.h:196
replay_moment::repevt_nothing
@ repevt_nothing
Definition
replay.h:192
replay_moment::repevt_assign
@ repevt_assign
Definition
replay.h:212
replay_moment::repevt_front_query
@ repevt_front_query
Definition
replay.h:194
replay_moment::repevt_autotrust_check
@ repevt_autotrust_check
Definition
replay.h:206
replay_moment::repevt_time_passes
@ repevt_time_passes
Definition
replay.h:200
replay_moment::repevt_tempfile_check
@ repevt_tempfile_check
Definition
replay.h:208
replay_moment::repevt_back_reply
@ repevt_back_reply
Definition
replay.h:202
replay_moment::elapse
struct timeval elapse
Definition
replay.h:225
replay_moment::variable
char * variable
Definition
replay.h:233
replay_moment::mom_next
struct replay_moment * mom_next
Definition
replay.h:187
replay_moment::file_content
struct config_strlist * file_content
Definition
replay.h:240
replay_moment::match
struct entry * match
Definition
replay.h:222
replay_range
Definition
replay.h:246
replay_range::next_range
struct replay_range * next_range
Definition
replay.h:260
replay_range::addr
struct sockaddr_storage addr
Definition
replay.h:252
replay_range::start_step
int start_step
Definition
replay.h:248
replay_range::addrlen
socklen_t addrlen
Definition
replay.h:254
replay_range::end_step
int end_step
Definition
replay.h:250
replay_range::match
struct entry * match
Definition
replay.h:257
replay_runtime
Definition
replay.h:266
replay_runtime::timer_list
struct fake_timer * timer_list
Definition
replay.h:291
replay_runtime::answer_last
struct replay_answer * answer_last
Definition
replay.h:288
replay_runtime::now_tv
struct timeval now_tv
Definition
replay.h:304
replay_runtime::infra
struct infra_cache * infra
Definition
replay.h:299
replay_runtime::now
struct replay_moment * now
Definition
replay.h:274
replay_runtime::sig_cb
void(* sig_cb)(int, void *)
Definition
replay.h:307
replay_runtime::bufsize
size_t bufsize
Definition
replay.h:314
replay_runtime::answer_list
struct replay_answer * answer_list
Definition
replay.h:285
replay_runtime::callback_query
comm_point_callback_type * callback_query
Definition
replay.h:294
replay_runtime::now_secs
time_t now_secs
Definition
replay.h:302
replay_runtime::sig_cb_arg
void * sig_cb_arg
Definition
replay.h:309
replay_runtime::vars
rbtree_type * vars
Definition
replay.h:319
replay_runtime::exit_cleanly
int exit_cleanly
Definition
replay.h:311
replay_runtime::scenario
struct replay_scenario * scenario
Definition
replay.h:270
replay_runtime::cb_arg
void * cb_arg
Definition
replay.h:296
replay_runtime::pending_list
struct fake_pending * pending_list
Definition
replay.h:280
replay_scenario
Definition
replay.h:155
replay_scenario::mom_last
struct replay_moment * mom_last
Definition
replay.h:162
replay_scenario::title
char * title
Definition
replay.h:157
replay_scenario::range_list
struct replay_range * range_list
Definition
replay.h:171
replay_scenario::mom_first
struct replay_moment * mom_first
Definition
replay.h:160
replay_var
Definition
replay.h:394
replay_var::value
char * value
Definition
replay.h:400
replay_var::node
rbnode_type node
Definition
replay.h:396
replay_var::name
char * name
Definition
replay.h:398
sldns_buffer
Definition
sbuffer.h:117
sockaddr_storage
Definition
fake-rfc2553.h:54
external
unbound
testcode
replay.h
Generated on
for Electroneum by
1.17.0