Exits with code 1 on a failure. More...
#include "config.h"
#include "testcode/ldns-testpkts.h"
#include "testcode/replay.h"
#include "testcode/fake_event.h"
#include "daemon/remote.h"
#include "util/config_file.h"
#include "daemon/unbound.c"
#include "util/log.h"
#include "daemon/daemon.h"
#include "util/storage/slabhash.h"
#include "services/listen_dnsport.h"
#include "services/cache/rrset.h"
#include "services/cache/infra.h"
#include "util/data/msgreply.h"
#include "util/module.h"
#include <signal.h>
#include <fcntl.h>
#include <openssl/crypto.h>
#include <pwd.h>
#include <grp.h>
#include <sys/resource.h>
#include <event.h>
Defines | |
#define | unbound_testbound 1 |
signal that this is a testbound compile | |
#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 | spool_auto_file (FILE *in, int *lineno, FILE *cfg, char *id) |
spool autotrust file | |
static void | setup_config (FILE *in, int *lineno, int *pass_argc, char *pass_argv[]) |
process config elements | |
static struct replay_scenario * | setup_playback (const char *filename, 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 config_file *cfg) |
Create new remote control state for the daemon. | |
void | daemon_remote_delete (struct daemon_remote *rc) |
remote control state to delete. | |
void | daemon_remote_clear (struct daemon_remote *rc) |
remote control state to clear up. | |
int | daemon_remote_open_accept (struct daemon_remote *rc, struct listen_port *ports, struct worker *worker) |
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 | |
void | remote_get_opt_ssl (char *str, void *arg) |
routine to printout option values over SSL | |
void | wsvc_command_option (const char *wopt, const char *cfgfile, int v, int c) |
Handle commandline service for windows. | |
void | wsvc_setup_worker (struct worker *worker) |
Setup lead worker events. | |
void | wsvc_desetup_worker (struct worker *worker) |
Desetup lead worker events. | |
Variables | |
static struct config_strlist * | cfgfiles = NULL |
config files (removed at exit) |
Exits with code 1 on a failure.
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 |
Max number of arguments to pass to unbound.
Referenced by add_opts(), and main().
static void testbound_usage | ( | ) | [static] |
give commandline usage for testbound.
Referenced by main().
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(), echo_cmdline(), fake_event_cleanup(), fake_event_init(), fatal_exit(), log_info(), log_init(), MAXARG, optarg, optind, remove_configfile(), setup_playback(), testbound_selftest(), 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 config_file * | cfg | ) | [read] |
Create new remote control state for the daemon.
cfg,: | config file with key file settings. |
References daemon_remote::ctx, daemon_remote_delete(), fname_after_chroot(), 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, and verbose().
void daemon_remote_delete | ( | struct daemon_remote * | rc | ) |
remote control state to delete.
rc,: | state to delete. |
References daemon_remote::ctx, and daemon_remote_clear().
void daemon_remote_clear | ( | struct daemon_remote * | rc | ) |
remote control state to clear up.
Busy and accept points are closed. Does not delete the rc itself, or the ssl context (with its keys).
rc,: | state to clear. |
References daemon_remote::accept_list, daemon_remote::active, daemon_remote::busy_list, rc_state::c, comm_point_delete(), listen_list_delete(), rc_state::next, rc_state::ssl, and daemon_remote::worker.
int daemon_remote_open_accept | ( | struct daemon_remote * | rc, | |
struct listen_port * | ports, | |||
struct worker * | worker | |||
) |
Setup comm points for accepting remote control connections.
rc,: | state | |
ports,: | already opened ports. | |
worker,: | worker with communication base. and links to command channels. |
References accept_open(), listen_port::fd, log_err(), listen_port::next, and daemon_remote::worker.
void wsvc_command_option | ( | const char * | wopt, | |
const char * | cfgfile, | |||
int | v, | |||
int | c | |||
) |
Handle commandline service for windows.
wopt,: | windows option string (install, remove, service). | |
cfgfile,: | configfile to open (default or passed with -c). | |
v,: | amount of commandline verbosity added with -v. | |
c,: | true if cfgfile was set by commandline -c option. |
Referenced by main().
void wsvc_setup_worker | ( | struct worker * | worker | ) |
void wsvc_desetup_worker | ( | struct worker * | worker | ) |