From 4f63f66efb073e48a57898533b242390a9ea4982 Mon Sep 17 00:00:00 2001 From: Bjoern Sikora Date: Fri, 17 Sep 2010 16:40:07 +0200 Subject: [PATCH] Added file from the ignore list. --- src/config.hpp | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 111 insertions(+), 0 deletions(-) create mode 100644 src/config.hpp diff --git a/src/config.hpp b/src/config.hpp new file mode 100644 index 0000000..8be4128 --- /dev/null +++ b/src/config.hpp @@ -0,0 +1,111 @@ +/** @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; + 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; + + 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 dns_cache_ttl); + int load_main_config_file(const std::string& full_filename); + int load_service_config_file(const std::string& full_filename); + +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_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; + +}; + +#endif -- 1.7.1