35 #include <libxml/parser.h> 42 #define AUTHOR_NAME "Matthijs Mekking, Yuri Schaeffer, René Post" 43 #define COPYRIGHT_STR "Copyright (C) 2010-2011 NLnet Labs OpenDNSSEC" 45 static const char* enforcerd_str =
"engine";
54 fprintf(out,
"Usage: %s [OPTIONS]\n",
"ods-enforcerd");
55 fprintf(out,
"Start the OpenDNSSEC key and signing policy enforcer " 57 fprintf(out,
"Supported options:\n");
58 fprintf(out,
" -c | --config <cfgfile> Read configuration from file.\n");
59 fprintf(out,
" -d | --no-daemon Do not daemonize the enforcer " 61 fprintf(out,
" -1 | --single-run Run once, then exit.\n");
62 fprintf(out,
" -h | --help Show this help and exit.\n");
63 fprintf(out,
" -i | --info Print configuration and exit.\n");
64 fprintf(out,
" -v | --verbose Increase verbosity.\n");
65 fprintf(out,
" -V | --version Show version and exit.\n");
66 fprintf(out,
" --set-time <time> Start daemon at specific time. " 67 "Notation \"YYYY-MM-DD-HH:MM:SS\" or seconds since Unix epoch.\n");
68 fprintf(out,
"\nBSD licensed, see LICENSE in source package for " 70 fprintf(out,
"Version %s. Report bugs to <%s>.\n",
71 PACKAGE_VERSION, PACKAGE_BUGREPORT);
82 fprintf(out,
"%s version %s\n", PACKAGE_NAME, PACKAGE_VERSION);
85 fprintf(out,
"See source files for more license information\n");
90 program_setup(
int cmdline_verbosity)
93 ods_log_init(
"ods-enforcerd", 0, NULL, cmdline_verbosity);
127 int options_index = 0;
131 int cmdline_verbosity = 0;
132 char *time_arg = NULL;
133 const char* cfgfile = ODS_SE_CFGFILE;
134 static struct option long_options[] = {
135 {
"single-run", no_argument, 0,
'1'},
136 {
"config", required_argument, 0,
'c'},
137 {
"no-daemon", no_argument, 0,
'd'},
138 {
"help", no_argument, 0,
'h'},
139 {
"info", no_argument, 0,
'i'},
140 {
"verbose", no_argument, 0,
'v'},
141 {
"version", no_argument, 0,
'V'},
142 {
"set-time", required_argument, 0, 256},
147 while ((c=getopt_long(argc, argv,
"1c:dhivV",
148 long_options, &options_index)) != -1) {
187 if(set_time_now_str(time_arg)) {
188 fprintf(stderr,
"Error: Failed to interpret start time argument. Daemon not started.\n");
194 fprintf(stdout,
"OpenDNSSEC key and signing policy enforcer version %s\n",
197 program_setup(cmdline_verbosity);
222 ods_log_crit(
"[%s] cfgfile %s has errors", enforcerd_str, cfgfile);
242 fprintf(stderr,
"setup failed: %s\n", ods_status2str(status));
257 ods_log_info(
"[%s] enforcerd (pid: %lu) stopped with exitcode %d",
258 enforcerd_str, (
unsigned long) engine->
pid, returncode);
260 if (returncode && daemonize) {
261 fprintf(stderr,
"enforcerd stopped with exitcode %d\n",
void engine_config_cleanup(engineconfig_type *config)
void engine_config_print(FILE *out, engineconfig_type *config)
void engine_teardown(engine_type *engine)
engineconfig_type * engine_config(const char *cfgfile, int cmdline_verbosity, engineconfig_type *oldcfg)
ods_status engine_setup(engine_type *engine)
void ods_log_info(const char *format,...)
void autostart(engine_type *engine)
void ods_log_error(const char *format,...)
int engine_run(engine_type *engine, start_cb_t start, int single_run)
void ods_log_crit(const char *format,...)
engineconfig_type * config
void engine_init(engine_type *engine, int daemonize)
engine_type * engine_alloc(void)
int main(int argc, char *argv[])
void ods_log_verbose(const char *format,...)
ods_status engine_config_check(engineconfig_type *config)
void engine_dealloc(engine_type *engine)