/* The software in this package is distributed under the GNU General Public License version 2 (with a special exception described below). A copy of GNU General Public License (GPL) is included in this distribution, in the file COPYING.GPL. As a special exception, if other files instantiate templates or use macros or inline functions from this file, or you compile this file and link it with other works to produce a work based on this file, this file does not by itself cause the resulting work to be covered by the GNU General Public License. However the source code for this file must still be made available in accordance with section (3) of the GNU General Public License. This exception does not invalidate any other reasons why a work based on this file might be covered by the GNU General Public License. */ #ifndef CONFIGURATION_H #define CONFIGURATION_H #include #include #include #include #include #include #include "config/host.h" #include "host/loglevel.h" #include "host/logoutput.h" //----------------------------------------------------------------------------- // Configuration //----------------------------------------------------------------------------- typedef boost::rand48 rand_gen_type; /** * @brief This class works like a POD (Plain Old Data) for configuration options. */ class Configuration { public: Configuration(); virtual ~Configuration(); bool get_daemon() const; void set_daemon( bool daemon ); std::string get_config_file_name() const; void set_config_file_name( const std::string &config_file_name ); I2n::Logger::LogLevel get_log_level() const; void set_log_level( const I2n::Logger::LogLevel &log_level ); LogOutput get_log_output() const; void set_log_output( const LogOutput &log_output ); std::string get_log_file() const; void set_log_file( const std::string &log_file ); std::string get_nameserver() const; void set_nameserver( const std::string &nameserver ); std::string get_source_network_interface() const; void set_source_network_interface( const std::string &source_network_interface ); int get_hosts_down_limit() const; void set_hosts_down_limit( const int hosts_down_limit ); int get_ping_fail_limit() const; void set_ping_fail_limit( const int ping_fail_limit ); std::string get_status_notifier_cmd() const; void set_status_notifier_cmd( const std::string &status_notifier_cmd ); int get_link_up_interval_in_sec() const; void set_link_up_interval_in_sec( const int link_up_interval_in_sec ); int get_link_down_interval_in_sec() const; void set_link_down_interval_in_sec( const int link_down_interval_in_sec ); int get_ping_reply_timeout() const; void set_ping_reply_timeout( const int ping_reply_timeout ); int get_max_address_resolution_attempts() const; void set_max_address_resolution_attempts( const int max_address_resolution_attempts ); int get_resolved_ip_ttl_threshold() const; void set_resolved_ip_ttl_threshold( const int resolved_ip_ttl_threshold ); int get_min_time_between_resolves() const; void set_min_time_between_resolves( const int min_time_between_resolves ); std::string get_dns_cache_file() const; void set_dns_cache_file(const std::string &dns_cache_file); float get_ratio_random_hosts() const; void set_ratio_random_hosts( const float ratio ); HostList get_hosts() const; void set_hosts( const HostList &hosts_list ); int get_random_number(const int lowest, const int highest); void set_print_version( const bool do_print ); bool get_print_version(); bool randomize_hosts(); private: bool Daemon; I2n::Logger::LogLevel LoggingLevel; LogOutput LoggingOutput; std::string LogFileName; std::string ConfigFileName; std::string SourceNetworkInterface; std::string NameServer; int HostsDownLimit; int MinHostsDownLimit; int MaxHostsDownLimit; int PingFailLimit; int MinPingFailLimit; int MaxPingFailLimit; std::string StatusNotifierCmd; int LinkUpIntervalInSec; int LinkDownIntervalInSec; int MinStableLinkIntervalInSec; int MaxStableLinkIntervalInSec; int PingReplyTimeout; int MaxAddressResolutionAttempts; int ResolvedIpTtlThreshold; int MinTimeBetweenResolves; std::string DnsCacheFile; HostList Hosts; float RatioRandomHosts; bool PrintVersion; rand_gen_type RandomNumberGenerator; }; //----------------------------------------------------------------------------- // ConfigurationItem //----------------------------------------------------------------------------- typedef boost::shared_ptr ConfigurationItem; #endif // CONFIGURATION_H