Only check config option start_offline once, not in the loop which would avoid signal...
[bpdyndnsd] / src / config.h
CommitLineData
5c460c94
BS
1/** @file
2 * @brief Config class header. This class represents the actual configuration.
3 *
4 *
5 *
6 * @copyright Intra2net AG
7 * @license GPLv2
8*/
9
4545a371
BS
10#ifndef CONFIG_H
11#define CONFIG_H
12
4545a371 13#include <string>
6d64d311 14
254bbf53 15#include "logger.h"
e0080b78 16#include "serviceholder.h"
efbde536 17#include "httphelper.h"
b6228761 18#include "service.h"
4545a371 19
88a594e8
BS
20#include <boost/program_options.hpp>
21#include <boost/shared_ptr.hpp>
4545a371 22
85a0abf9 23
4248e8ca
TJ
24class Config
25{
88a594e8 26
92beaba3 27private:
88a594e8 28
92beaba3
BS
29 boost::shared_ptr<boost::program_options::options_description> OptDescCmd;
30 boost::shared_ptr<boost::program_options::options_description> OptDescConfMain;
31 boost::shared_ptr<boost::program_options::options_description> OptDescConfService;
025abebb 32 boost::program_options::variables_map VariablesMap;
4545a371 33
88a594e8 34 Logger::Ptr Log;
e0080b78 35 Serviceholder::Ptr ServiceHolder;
4545a371 36
025abebb 37 bool DaemonMode;
5c460c94 38 bool Syslog;
019dc0d9 39 bool EnableIPv6;
e0080b78
BS
40 int Loglevel;
41 std::string ConfigPath;
019dc0d9
BS
42 std::string WebcheckIpUrl;
43 std::string WebcheckIpUrlAlt;
2b0f7c11 44 int WebcheckInterval;
4eb87664
BS
45 std::string Proxy;
46 int ProxyPort;
cbbdeb6c
BS
47 std::string ExternalWarningLog;
48 int ExternalWarningLevel;
6b63b758 49 bool StartOffline;
0680036d 50
a78b44b5 51 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);
e8d4a6f8 52 int load_main_config_file(const std::string& full_filename);
e95a6634 53 int load_service_config_file(const std::string& full_filename);
4545a371 54
254bbf53 55public:
4545a371 56
88a594e8
BS
57 typedef boost::shared_ptr<Config> Ptr;
58
31af6a2e
BS
59 Config();
60
e8d4a6f8 61 Config(Logger::Ptr _log, Serviceholder::Ptr _serviceholder);
4545a371 62
254bbf53 63 ~Config();
4545a371 64
e95a6634 65 int parse_cmd_line(int argc, char *argv[]);
4545a371 66
e95a6634 67 int load_config_from_files();
4545a371 68
92beaba3 69 boost::shared_ptr<boost::program_options::options_description> get_opt_desc_cmd() const;
38060291 70
92beaba3 71 boost::shared_ptr<boost::program_options::options_description> get_opt_desc_conf_main() const;
38060291 72
92beaba3 73 boost::shared_ptr<boost::program_options::options_description> get_opt_desc_conf_service() const;
3434b35f 74
b38684ce 75 bool get_daemon_mode() const;
388f4ab0 76
b38684ce 77 int get_loglevel() const;
8bca3c5d 78
b38684ce 79 bool get_syslog() const;
8bca3c5d 80
019dc0d9
BS
81 bool get_enable_ipv6() const;
82
4eb87664
BS
83 std::string get_proxy() const;
84
85 int get_proxy_port() const;
86
019dc0d9
BS
87 std::string get_webcheck_ip_url() const;
88
89 std::string get_webcheck_ip_url_alt() const;
90
2b0f7c11
BS
91 int get_webcheck_interval() const;
92
8bca3c5d
BS
93 void delete_variables_map();
94
cbbdeb6c
BS
95 int get_external_warning_level() const;
96
97 std::string get_external_warning_log() const;
98
6b63b758
BS
99 bool get_start_offline() const;
100
4545a371
BS
101};
102
103#endif