Added file from the ignore list.
authorBjoern Sikora <bjoern.sikora@intra2net.com>
Fri, 17 Sep 2010 14:40:07 +0000 (16:40 +0200)
committerBjoern Sikora <bjoern.sikora@intra2net.com>
Fri, 17 Sep 2010 14:40:07 +0000 (16:40 +0200)
src/config.hpp [new file with mode: 0644]

diff --git a/src/config.hpp b/src/config.hpp
new file mode 100644 (file)
index 0000000..8be4128
--- /dev/null
@@ -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 <string>
+
+#include "logger.hpp"
+#include "serviceholder.hpp"
+#include "httphelper.hpp"
+#include "service.hpp"
+
+#include <boost/program_options.hpp>
+#include <boost/shared_ptr.hpp>
+
+
+class Config
+{
+
+private:
+
+    boost::shared_ptr<boost::program_options::options_description> OptDescCmd;
+    boost::shared_ptr<boost::program_options::options_description> OptDescConfMain;
+    boost::shared_ptr<boost::program_options::options_description> 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<Config> 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<boost::program_options::options_description> get_opt_desc_cmd() const;
+
+    boost::shared_ptr<boost::program_options::options_description> get_opt_desc_conf_main() const;
+
+    boost::shared_ptr<boost::program_options::options_description> 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