/** @file * @brief Config class header. This class represents the actual configuration. * * * * @copyright Intra2net AG * @license GPLv2 */ #ifndef CONFIG_H #define CONFIG_H #include #include "logger.hpp" #include "serviceholder.hpp" #include "httphelper.hpp" #include "service.hpp" #include #include class Config { private: boost::shared_ptr OptDescCmd; boost::shared_ptr OptDescConfMain; boost::shared_ptr OptDescConfService; boost::program_options::variables_map VariablesMap; Logger::Ptr Log; Serviceholder::Ptr ServiceHolder; bool DaemonMode; bool Syslog; bool EnableIPv6; bool LogPasswords; int Loglevel; std::string ConfigPath; std::string WebcheckIpUrl; std::string WebcheckIpUrlAlt; int WebcheckInterval; std::string Proxy; int ProxyPort; std::string ExternalWarningLog; int ExternalWarningLevel; bool StartOffline; bool WebcheckEnabled; bool ExternalLogOnlyOnce; bool DialupMode; int DialupBurstPeriodSeconds; int DialupSleepSeconds; std::string WanIpOverride; Service::Ptr create_service(const std::string& protocol, const std::string& server, const std::string& hostname, const std::string& login, const std::string& password, const int update_interval, const int max_updates_within_interval, const int max_equal_updates_in_succession, const int dns_cache_ttl); int load_main_config_file(const std::string& full_filename); int load_service_config_file(const std::string& full_filename); void define_config_options(); public: typedef boost::shared_ptr Ptr; Config(); Config(Logger::Ptr _log, Serviceholder::Ptr _serviceholder); ~Config(); int parse_cmd_line(int argc, char *argv[]); int load_config_from_files(); boost::shared_ptr get_opt_desc_cmd() const; boost::shared_ptr get_opt_desc_conf_main() const; boost::shared_ptr get_opt_desc_conf_service() const; bool get_daemon_mode() const; int get_loglevel() const; bool get_syslog() const; bool get_log_passwords() const; bool get_enable_ipv6() const; std::string get_proxy() const; int get_proxy_port() const; bool get_webcheck_enabled() const; void set_webcheck_enabled( bool webcheck_enabled ); std::string get_webcheck_ip_url() const; std::string get_webcheck_ip_url_alt() const; int get_webcheck_interval() const; void delete_variables_map(); int get_external_warning_level() const; std::string get_external_warning_log() const; bool get_start_offline() const; bool get_external_log_only_once() const; bool get_dialup_mode() const; int get_dialup_burst_period_seconds() const; int get_dialup_sleep_seconds() const; std::string get_wan_ip_override() const; }; #endif