replay.c File Reference

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

#include "config.h"
#include "util/log.h"
#include "util/net_help.h"
#include "testcode/replay.h"
#include "testcode/ldns-testpkts.h"

Defines

#define MAX_LINE_LEN   10240
 max length of lines in file

Functions

static int parse_keyword (char **line, char *keyword)
 parse keyword in string.
static void replay_moment_delete (struct replay_moment *mom)
 delete moment
static void replay_range_delete (struct replay_range *rng)
 delete range
static void strip_end_white (char *p)
 strip whitespace from end of string
static struct replay_rangereplay_range_read (char *remain, FILE *in, const char *name, int *lineno, char *line, uint32_t *ttl, ldns_rdf **or, ldns_rdf **prev)
 Read a range from file.
static struct replay_momentreplay_moment_read (char *remain, FILE *in, const char *name, int *lineno, uint32_t *ttl, ldns_rdf **or, ldns_rdf **prev)
 Read a replay moment 'STEP' from file.
static struct replay_scenariomake_scenario (char *line)
 makes scenario with title on rest of line
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.


Function Documentation

static int parse_keyword ( char **  line,
char *  keyword 
) [static]

parse keyword in string.

Parameters:
line,: if found, the line is advanced to after the keyword.
keyword,: string.
Returns:
: true if found, false if not.

Referenced by replay_moment_read(), replay_range_read(), and replay_scenario_read().

static struct replay_range* replay_range_read ( char *  remain,
FILE *  in,
const char *  name,
int *  lineno,
char *  line,
uint32_t *  ttl,
ldns_rdf **  or,
ldns_rdf **  prev 
) [static, read]

Read a range from file.

Parameters:
remain,: Rest of line (after RANGE keyword).
in,: file to read from.
name,: name to print in errors.
lineno,: incremented as lines are read.
line,: line buffer.
ttl,: for readentry
or,: for readentry
prev,: for readentry
Returns:
: range object to add to list, or NULL on error.

References replay_range::addr, replay_range::addrlen, replay_range::end_step, extstrtoaddr(), fatal_exit(), log_err(), replay_range::match, MAX_LINE_LEN, entry::next, parse_keyword(), read_entry(), replay_range_delete(), replay_range::start_step, and strip_end_white().

Referenced by replay_scenario_read().

static struct replay_moment* replay_moment_read ( char *  remain,
FILE *  in,
const char *  name,
int *  lineno,
uint32_t *  ttl,
ldns_rdf **  or,
ldns_rdf **  prev 
) [static, read]

Read a replay moment 'STEP' from file.

Parameters:
remain,: Rest of line (after STEP keyword).
in,: file to read from.
name,: name to print in errors.
lineno,: incremented as lines are read.
ttl,: for readentry
or,: for readentry
prev,: for readentry
Returns:
: range object to add to list, or NULL on error.

References replay_moment::addr, replay_moment::addrlen, replay_moment::evt_type, extstrtoaddr(), fatal_exit(), log_err(), replay_moment::match, parse_keyword(), read_entry(), replay_moment::repevt_back_query, replay_moment::repevt_back_reply, replay_moment::repevt_error, replay_moment::repevt_front_query, replay_moment::repevt_front_reply, replay_moment::repevt_nothing, replay_moment::repevt_timeout, and replay_moment::time_step.

Referenced by replay_scenario_read().

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 Sun Sep 21 16:24:55 2008 for unbound by  doxygen 1.5.6