#include "config.h"
#include "testcode/ldns-testpkts.h"
#include "testcode/replay.h"
#include "testcode/fake_event.h"
#include "daemon/remote.h"
#include "daemon/unbound.c"
Defines | |
#define | main daemon_main |
include the main program from the unbound daemon. | |
#define | MAX_LINE_LEN 1024 |
maximum line length for lines in the replay file. | |
#define | MAXARG 100 |
Max number of arguments to pass to unbound. | |
Functions | |
static void | testbound_usage () |
give commandline usage for testbound. | |
static void | add_opts (const char *optarg, int *pass_argc, char *pass_argv[]) |
Add options from string to passed argc. | |
static void | echo_cmdline (int argc, char *argv[]) |
pretty print commandline for unbound in this test | |
static void | setup_config (FILE *in, char *configfile, int *lineno, int *pass_argc, char *pass_argv[]) |
process config elements | |
static struct replay_scenario * | setup_playback (const char *filename, char *configfile, int *pass_argc, char *pass_argv[]) |
read playback file | |
void | remove_configfile (void) |
remove config file at exit | |
int | main (int argc, char *argv[]) |
Main fake event test program. | |
struct listen_port * | daemon_remote_open_ports (struct config_file *cfg) |
Open and create listening ports for remote control. | |
struct daemon_remote * | daemon_remote_create (struct worker *worker) |
Create new remote control state for the daemon. | |
void | daemon_remote_delete (struct daemon_remote *rc) |
remote control state to delete. | |
int | daemon_remote_open_accept (struct daemon_remote *rc, struct listen_port *ports) |
Setup comm points for accepting remote control connections. | |
int | remote_accept_callback (struct comm_point *c, void *arg, int error, struct comm_reply *repinfo) |
handle remote control accept callbacks | |
int | remote_control_callback (struct comm_point *c, void *arg, int error, struct comm_reply *repinfo) |
handle remote control data callbacks | |
Variables | |
static char | cfgfile [MAX_LINE_LEN] |
the config file (removed at exit) |
0 if all unit tests are successfull.
#define main daemon_main |
include the main program from the unbound daemon.
rename main to daemon_main to call it
#define MAX_LINE_LEN 1024 |
maximum line length for lines in the replay file.
#define MAXARG 100 |
static void testbound_usage | ( | ) | [static] |
static void add_opts | ( | const char * | optarg, | |
int * | pass_argc, | |||
char * | pass_argv[] | |||
) | [static] |
Add options from string to passed argc.
splits on whitespace.
optarg,: | the option argument, "-v -p 12345" or so. | |
pass_argc,: | ptr to the argc for unbound. Modified. | |
pass_argv,: | the argv to pass to unbound. Modified. |
References fatal_exit(), and MAXARG.
Referenced by main(), and setup_config().
int main | ( | int | argc, | |
char * | argv[] | |||
) |
Main fake event test program.
Setup, teardown and report errors.
argc,: | arg count. | |
argv,: | array of commandline arguments. |
References add_opts(), cfgfile, echo_cmdline(), fake_event_cleanup(), fake_event_init(), fatal_exit(), log_info(), log_init(), MAXARG, optarg, optind, remove_configfile(), setup_playback(), and testbound_usage().
struct listen_port* daemon_remote_open_ports | ( | struct config_file * | cfg | ) | [read] |
Open and create listening ports for remote control.
cfg,: | config options. |
References add_open(), config_file::control_ifs, config_file::control_port, config_file::do_ip4, config_file::do_ip6, listening_ports_free(), log_assert, config_strlist::next, config_file::remote_control_enable, and config_strlist::str.
struct daemon_remote* daemon_remote_create | ( | struct worker * | worker | ) | [read] |
Create new remote control state for the daemon.
References daemon::cfg, config_file::chrootdir, daemon_remote::ctx, worker::daemon, daemon_remote_delete(), log_crypto_err(), log_err(), daemon_remote::max_active, config_file::remote_control_enable, config_file::server_cert_file, config_file::server_key_file, VERB_ALGO, verbose(), and daemon_remote::worker.
void daemon_remote_delete | ( | struct daemon_remote * | rc | ) |
remote control state to delete.
rc,: | state to delete. |
References daemon_remote::accept_list, daemon_remote::busy_list, rc_state::c, comm_point_delete(), daemon_remote::ctx, listen_list_delete(), rc_state::next, and rc_state::ssl.
int daemon_remote_open_accept | ( | struct daemon_remote * | rc, | |
struct listen_port * | ports | |||
) |
Setup comm points for accepting remote control connections.
rc,: | state | |
ports,: | already opened ports. |
References accept_open(), listen_port::fd, log_err(), and listen_port::next.