Electroneum
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 
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 
157  char* title;
158 
163 
172 };
173 
188 
217  }
219  evt_type;
220 
222  struct entry* match;
223 
225  struct timeval elapse;
226 
230  socklen_t addrlen;
231 
233  char* variable;
235  char* string;
236 
241 };
242 
246 struct replay_range {
250  int end_step;
254  socklen_t addrlen;
255 
257  struct entry* match;
258 
261 };
262 
275 
281 
286 
289 
292 
296  void *cb_arg;
297 
300 
302  time_t now_secs;
304  struct timeval now_tv;
305 
307  void (*sig_cb)(int, void*);
309  void *sig_cb_arg;
312 
314  size_t bufsize;
315 
320 };
321 
325 struct fake_pending {
331  socklen_t addrlen;
335  size_t zonelen;
337  int qtype;
341  void* cb_arg;
343  int timeout;
344 
349  size_t pkt_len;
351  enum transport_type transport;
353  int serviced;
358 };
359 
370  size_t pkt_len;
371 };
372 
376 struct fake_timer {
378  struct fake_timer* next;
382  void (*cb)(void*);
384  void* cb_arg;
386  int enabled;
388  struct timeval tv;
389 };
390 
394 struct replay_var {
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 
424 
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 */
int timeout
Definition: replay.h:343
struct replay_range * next_range
Definition: replay.h:260
struct replay_moment * mom_last
Definition: replay.h:162
char * title
Definition: replay.h:157
struct entry * match
Definition: replay.h:257
struct entry * match
Definition: replay.h:222
int end_step
Definition: replay.h:250
struct fake_pending * pending_list
Definition: replay.h:280
comm_point_callback_type * callback
Definition: replay.h:339
struct replay_answer * next
Definition: replay.h:365
int start_step
Definition: replay.h:248
socklen_t addrlen
Definition: replay.h:230
struct replay_scenario * replay_scenario_read(FILE *in, const char *name, int *lineno)
void * cb_arg
Definition: replay.h:341
rbtree_type * macro_store_create(void)
enum replay_moment::replay_event_type evt_type
size_t bufsize
Definition: replay.h:314
struct replay_runtime * runtime
Definition: replay.h:357
int enabled
Definition: replay.h:386
void * cb_arg
Definition: replay.h:384
struct fake_pending * next
Definition: replay.h:346
enum transport_type transport
Definition: replay.h:351
struct replay_scenario * scenario
Definition: replay.h:270
char * macro_lookup(rbtree_type *store, char *name)
socklen_t addrlen
Definition: replay.h:254
struct infra_cache * infra
Definition: replay.h:299
int comm_point_callback_type(struct comm_point *, void *, int, struct comm_reply *)
Definition: netevent.h:76
void(* cb)(void *)
Definition: replay.h:382
unsigned char uint8_t
Definition: stdint.h:124
const char * name
void * sig_cb_arg
Definition: replay.h:309
struct sockaddr_storage addr
Definition: replay.h:329
struct fake_timer * replay_get_oldest_timer(struct replay_runtime *runtime)
struct replay_answer * answer_last
Definition: replay.h:288
size_t zonelen
Definition: replay.h:335
struct replay_moment * now
Definition: replay.h:274
struct sockaddr_storage addr
Definition: replay.h:228
struct timeval tv
Definition: replay.h:388
struct sockaddr_storage addr
Definition: replay.h:252
struct replay_runtime * runtime
Definition: replay.h:380
char * macro_process(rbtree_type *store, struct replay_runtime *runtime, char *text)
void macro_store_delete(rbtree_type *store)
void replay_scenario_delete(struct replay_scenario *scen)
char * variable
Definition: replay.h:233
struct fake_timer * timer_list
Definition: replay.h:291
rbnode_type node
Definition: replay.h:396
size_t pkt_len
Definition: replay.h:349
struct sldns_buffer * buffer
Definition: replay.h:327
struct replay_answer * answer_list
Definition: replay.h:285
int tcp_pkt_counter
Definition: replay.h:355
void(* sig_cb)(int, void *)
Definition: replay.h:307
int qtype
Definition: replay.h:337
socklen_t addrlen
Definition: replay.h:331
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124
uint8_t * pkt
Definition: replay.h:348
int time_step
Definition: replay.h:185
struct config_strlist * file_content
Definition: replay.h:240
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
void testbound_selftest(void)
uint8_t * pkt
Definition: replay.h:369
struct timeval now_tv
Definition: replay.h:304
time_t now_secs
Definition: replay.h:302
struct timeval elapse
Definition: replay.h:225
uint8_t * zone
Definition: replay.h:333
comm_point_callback_type * callback_query
Definition: replay.h:294
struct replay_range * range_list
Definition: replay.h:171
char * name
Definition: replay.h:398
struct replay_moment * mom_next
Definition: replay.h:187
char * autotrust_id
Definition: replay.h:238
int replay_var_compare(const void *a, const void *b)
int exit_cleanly
Definition: replay.h:311
struct fake_timer * next
Definition: replay.h:378
rbtree_type * vars
Definition: replay.h:319
char * value
Definition: replay.h:400
void * cb_arg
Definition: replay.h:296
int macro_assign(rbtree_type *store, char *name, char *value)
int serviced
Definition: replay.h:353
size_t pkt_len
Definition: replay.h:370
struct replay_moment * mom_first
Definition: replay.h:160
char * string
Definition: replay.h:235
void macro_print_debug(rbtree_type *store)
struct comm_reply repinfo
Definition: replay.h:367