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"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 *args, 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.
Referenced by spool_auto_file(), and setup_config().
| #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 * | args, |
| int * | pass_argc, | ||
| char * | pass_argv[] | ||
| ) | [static] |
Add options from string to passed argc.
splits on whitespace.
| args,: | 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 MAXARG, and fatal_exit().
Referenced by setup_config(), and main().
| 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 MAXARG, optind, optarg, log_init(), add_opts(), testbound_selftest(), testbound_usage(), log_info(), remove_configfile(), fatal_exit(), setup_playback(), fake_event_init(), echo_cmdline(), and fake_event_cleanup().
| struct listen_port* daemon_remote_open_ports | ( | struct config_file * | cfg | ) | [read] |
Open and create listening ports for remote control.
| cfg,: | config options. |
References log_assert, config_file::remote_control_enable, config_file::control_port, config_file::control_ifs, config_strlist::next, add_open(), config_strlist::str, listening_ports_free(), config_file::do_ip6, and config_file::do_ip4.
| 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 log_err(), daemon_remote::max_active, config_file::remote_control_enable, daemon_remote::ctx, log_crypto_err(), daemon_remote_delete(), fname_after_chroot(), config_file::server_cert_file, config_file::server_key_file, verbose(), and VERB_ALGO.
| void daemon_remote_delete | ( | struct daemon_remote * | rc | ) |
remote control state to delete.
| rc,: | state to delete. |
References daemon_remote_clear(), and daemon_remote::ctx.
| 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 listen_list_delete(), daemon_remote::accept_list, daemon_remote::busy_list, rc_state::next, rc_state::ssl, comm_point_delete(), rc_state::c, daemon_remote::active, 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 daemon_remote::worker, listen_port::next, accept_open(), listen_port::fd, and log_err().
| 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 | ) |