replay.h File Reference

Store and use a replay of events for the DNS resolver. More...

#include "util/netevent.h"
#include "testcode/ldns-testpkts.h"

Data Structures

struct  replay_scenario
 A replay scenario. More...
struct  replay_moment
 A replay moment. More...
struct  replay_range
 Range of timesteps, and canned replies to matching queries. More...
struct  replay_runtime
 Replay storage of runtime information. More...
struct  fake_pending
 Pending queries to network, fake replay version. More...
struct  replay_answer
 An answer that is pending to happen. More...

Functions

struct replay_scenarioreplay_scenario_read (FILE *in, const char *name, int *lineno)
 Read a replay scenario from the file.
void replay_scenario_delete (struct replay_scenario *scen)
 Delete scenario.


Detailed Description

Store and use a replay of events for the DNS resolver.

Used to test known scenarios to get known outcomes.

 File format for replay files.

 ; comment line.
 SCENARIO_BEGIN name_of_scenario
 RANGE_BEGIN start_time end_time
    ; give ip of the virtual server, it matches any ip if not present.
    ADDRESS ip_address 
    match_entries
 RANGE_END
 ; more RANGE items.
 ; go to the next moment
 STEP time_step event_type [ADDRESS ip_address]
 ; event_type can be:
	o NOTHING - nothing
	o QUERY - followed by entry
	o CHECK_ANSWER - followed by entry
	o CHECK_OUT_QUERY - followed by entry (if copy-id it is also reply).
	o REPLY - followed by entry
      o TIMEOUT
      o TIME_PASSES ELAPSE [seconds] - increase 'now' time counter, can be 
      			a floating point number.
      o ERROR
 ; following entry starts on the next line, ENTRY_BEGIN.
 ; more STEP items
 SCENARIO_END

 ; Example file
 SCENARIO_BEGIN Example scenario
 RANGE_BEGIN 0 100
   ENTRY_BEGIN
   ; precoded answers to queries.
   ENTRY_END
 END_RANGE
 STEP 0 QUERY
   ENTRY_BEGIN
   ; query
   ENTRY_END
 ; a query is sent out to the network by resolver.
 ; precoded answer from range is returned.
 ; algorithm will do precoded answers from RANGE immediately, except if
 ; the next step specifically checks for that OUT_QUERY.
 ; or if none of the precoded answers match.
 STEP 1 CHECK_ANSWER
   ENTRY_BEGIN
   ; what the reply should look like
   ENTRY_END
 ; successful termination. (if the answer was OK).
 ; also, all answers must have been checked with CHECK_ANSWER.
 ; and, no more pending out_queries (that have not been checked).
 SCENARIO_END

 

Function Documentation

struct replay_scenario* replay_scenario_read ( FILE *  in,
const char *  name,
int *  lineno 
) [read]

Read a replay scenario from the file.

Parameters:
in,: file to read from.
name,: name to print in errors.
lineno,: incremented for every line read.
Returns:
: Scenario. NULL if no scenario read.

References fatal_exit(), log_info(), make_scenario(), MAX_LINE_LEN, replay_scenario::mom_first, replay_scenario::mom_last, replay_moment::mom_next, replay_range::next_range, parse_keyword(), replay_scenario::range_list, replay_moment_read(), replay_range_read(), replay_scenario_delete(), and replay_moment::time_step.

Referenced by setup_playback().

void replay_scenario_delete ( struct replay_scenario scen  ) 


Generated on Tue Oct 13 06:46:31 2009 for unbound by  doxygen 1.5.9