, DialupBurstPeriodSeconds(120)
, DialupSleepSeconds(10 * 60)
{
- // Available service description config options
- po::options_description opt_desc_service("Service description options");
- opt_desc_service.add_options()
- ("protocol",po::value<string>(),"The service protocol.")
- ("server",po::value<string>(),"Servername needed for gnudip protocol.")
- ("host",po::value<string>(),"The hostname to update.")
- ("login",po::value<string>(),"Login name.")
- ("password",po::value<string>(),"Corresponding password.")
- ("update_interval",po::value<int>()->default_value(-1),"Update interval in minutes.")
- ("max_updates_within_interval",po::value<int>()->default_value(-1),"How many updates can be made in one interval.")
- ("dns_cache_ttl",po::value<int>()->default_value(-1),"How long a dns record is valid.")
- ;
-
- // Available command line only options
- po::options_description opt_desc_cmd_only("Command line only options");
- opt_desc_cmd_only.add_options()
- ("help,?","Show help.")
- ("version,v","Show version.")
- ("config,c",po::value<string>()->default_value("/etc/bpdyndnsd"),"Set the config path.")
- ;
-
- // Available generic options. Valid on cmd or in config file.
- po::options_description opt_desc_generic("Generic config options");
- opt_desc_generic.add_options()
- ("daemon_mode",po::value<bool>()->default_value(false),"Run as system daemon.")
- ("loglevel",po::value<int>()->default_value(0),"Loglevel.")
- ("syslog",po::value<bool>()->default_value(false),"Use syslog facility.")
- ("enable_ipv6",po::value<bool>()->default_value(false),"Try to use IPv6.")
- ("webcheck_enabled",po::value<bool>()->default_value(false),"Use webcheck url to determine actual IP address.")
- ("webcheck_url",po::value<string>()->default_value(""),"Use this URL to determine IP.")
- ("webcheck_url_alt",po::value<string>()->default_value(""),"Use this alternative URL to determine IP.")
- ("webcheck_interval",po::value<int>()->default_value(10),"The webcheck interval in minutes.")
- ("http_proxy",po::value<string>(),"Use this proxy for all http requests.")
- ("http_proxy_port",po::value<int>(),"Port of the proxy.")
- ("external_warning_log",po::value<string>()->default_value(""),"External programm to pass warning log messages to.")
- ("external_warning_level",po::value<int>()->default_value(0),"Warning messages of which loglevel should be passed to external programm.")
- ("external_log_only_once",po::value<bool>()->default_value(false),"Log the same external message only once until next reload or restart.")
- ("start_offline",po::value<bool>()->default_value(false),"Start in offline mode.")
- ("dialup_mode",po::value<bool>()->default_value(false),"Enable dialup mode (sleep periods between network traffic)")
- ("dialup_burst_period_seconds",po::value<int>()->default_value(120),"Seconds of normal operation before entering dialup mode")
- ("dialup_sleep_seconds",po::value<int>()->default_value(10 * 60),"Seconds to sleep between network traffic")
- ;
-
- // Define valid command line parameters
- OptDescCmd = Options_descriptionPtr(new po::options_description("Command line options"));
- OptDescCmd->add(opt_desc_cmd_only);
- OptDescCmd->add(opt_desc_generic);
- OptDescCmd->add(opt_desc_service);
-
- // Define valid config file options
- OptDescConfMain = Options_descriptionPtr(new po::options_description("Config file options"));
- OptDescConfMain->add(opt_desc_generic);
-
- // Define valid service file options
- OptDescConfService = Options_descriptionPtr(new po::options_description("Service file options"));
- OptDescConfService->add(opt_desc_service);
+ define_config_options();
}
, DialupBurstPeriodSeconds(120)
, DialupSleepSeconds(10 * 60)
{
+ define_config_options();
+}
+
+
+/**
+ * Default Destructor
+ */
+Config::~Config()
+{
+}
+
+
+/**
+* Define valid config options with default parameters.
+*/
+void Config::define_config_options()
+{
// Available service description config options
po::options_description opt_desc_service("Service description options");
opt_desc_service.add_options()
("config,c",po::value<string>()->default_value("/etc/bpdyndnsd"),"Set the config path.")
;
- // Available generic options. Valid on cmd or in config file.
+ // Available generic options. Valid on cmd or in config file.
po::options_description opt_desc_generic("Generic config options");
opt_desc_generic.add_options()
("daemon_mode",po::value<bool>()->default_value(false),"Run as system daemon.")
/**
- * Default Destructor
- */
-Config::~Config()
-{
-}
-
-
-/**
* Parses the command line arguments and does the needed actions.
* @param argc Command line argument number given to main.
* @param argv[] Pointer to command line argument array given to main.