* This function serializes all Service objects in Services and OldServices (where the update Timeout isn't expired) into a specified file.
* @return 0 if all is fine, -1 if output file could not be opened for reading or error while serializing.
*/
-int Config::serialize_services()
+int Config::serialize_services() const
{
// Put Services and OldServices into Serviceholder.
Serviceholder::Ptr service_holder(new Serviceholder());
* @param input String.
* @return String in lowercase.
*/
-string Config::to_lower(string input)
+string Config::to_lower(string input) const
{
int i = 0;
while ( input[i] && i<10 )
* Getter method for Service list member.
* @return Pointer to a list of Service's.
*/
-list<Service::Ptr> Config::get_services()
+list<Service::Ptr> Config::get_services() const
{
return this->Services;
}
* Getter method for member OptDescCmd.
* @return options_description*.
*/
-Config::Options_descriptionPtr Config::get_opt_desc_cmd()
+Config::Options_descriptionPtr Config::get_opt_desc_cmd() const
{
return OptDescCmd;
}
* Getter method for member OptDescConfMain.
* @return options_description*.
*/
-Config::Options_descriptionPtr Config::get_opt_desc_conf_main()
+Config::Options_descriptionPtr Config::get_opt_desc_conf_main() const
{
return OptDescConfMain;
}
* Getter method for member OptDescConfService.
* @return options_description*.
*/
-Config::Options_descriptionPtr Config::get_opt_desc_conf_service()
+Config::Options_descriptionPtr Config::get_opt_desc_conf_service() const
{
return OptDescConfService;
}
* Getter for member Loglevel.
* @return Member Loglevel.
*/
-int Config::get_loglevel()
+int Config::get_loglevel() const
{
return Loglevel;
}
* Getter for member DaemonMode.
* @return TRUE if enabled, FALSE if disabled.
*/
-bool Config::get_daemon_mode()
+bool Config::get_daemon_mode() const
{
return DaemonMode;
}
* Getter for member Syslog.
* @return True if logging through syslog is enabled, false otherwise.
*/
-bool Config::get_syslog()
+bool Config::get_syslog() const
{
return Syslog;
}
Service::Ptr create_service(const std::string&,const std::string&,const std::string&,const std::string&);
int load_main_config_file(const std::string&);
int load_service_config_file(const std::string&);
- std::string to_lower(std::string);
+ std::string to_lower(std::string) const;
public:
~Config();
- int serialize_services();
+ int serialize_services() const;
int deserialize_services();
int load_config_from_files();
- std::list<Service::Ptr> get_services();
+ std::list<Service::Ptr> get_services() const;
- Options_descriptionPtr get_opt_desc_cmd();
+ Options_descriptionPtr get_opt_desc_cmd() const;
- Options_descriptionPtr get_opt_desc_conf_main();
+ Options_descriptionPtr get_opt_desc_conf_main() const;
- Options_descriptionPtr get_opt_desc_conf_service();
+ Options_descriptionPtr get_opt_desc_conf_service() const;
- bool get_daemon_mode();
+ bool get_daemon_mode() const;
void delete_services();
- int get_loglevel();
+ int get_loglevel() const;
- bool get_syslog();
+ bool get_syslog() const;
void delete_variables_map();
* Getter for member Timeout.
* @return Value of Timeout.
*/
-int DHS::get_timeout()
+int DHS::get_timeout() const
{
return Timeout;
}
* Setter for member MaxUpdatesWithinTimeout.
* @param _max_updates_per_timeout Value to set MaxUpdatesWithinTimeout to.
*/
-void DHS::set_max_updates_per_timeout(const int _max_updates_per_timeout)
+void DHS::set_max_updates_within_timeout(const int _max_updates_per_timeout)
{
MaxUpdatesWithinTimeout = _max_updates_per_timeout;
}
* Getter for member MaxUpdatesWithinTimeout.
* @return Value of MaxUpdatesWithinTimeout.
*/
-int DHS::get_max_updates_per_timeout() const
+int DHS::get_max_updates_within_timeout() const
{
return MaxUpdatesWithinTimeout;
}
~DHS();
void set_timeout(const int);
- int get_timeout();
+ int get_timeout() const;
- void set_max_updates_per_timeout(const int);
- int get_max_updates_per_timeout() const;
+ void set_max_updates_within_timeout(const int);
+ int get_max_updates_within_timeout() const;
void update(const std::string&);
};
* Decides if Logging through syslog if enabled or through std.
* @param msg The message to log.
*/
-void Logger::log_notice(const string& msg)
+void Logger::log_notice(const string& msg) const
{
if ( Syslog )
syslog(LOG_NOTICE,msg.c_str());
* Decides if Logging through syslog if enabled or through std.
* @param msg The message to log.
*/
-void Logger::log_warning(const string& msg)
+void Logger::log_warning(const string& msg) const
{
if ( Syslog )
syslog(LOG_WARNING,msg.c_str());
* Decides if Logging through syslog if enabled or through std.
* @param msg The message to log.
*/
-void Logger::log_error(const string& msg)
+void Logger::log_error(const string& msg) const
{
if ( Syslog )
syslog(LOG_ERR,msg.c_str());
* Getter for member Loglevel.
* @return Loglevel.
*/
-int Logger::get_loglevel()
+int Logger::get_loglevel() const
{
return Loglevel;
}
* Getter for member Syslog.
* @return True if logging through syslog is enabled, false otherwise.
*/
-bool Logger::get_syslog()
+bool Logger::get_syslog() const
{
return Syslog;
}
/**
* Prints out the usage to the command line.
*/
-void Logger::print_usage(const Options_descriptionPtr opt_desc)
+void Logger::print_usage(const Options_descriptionPtr opt_desc) const
{
if ( 0 <= Loglevel )
{
* Prints out the programm name and the given version string on stdout.
* @param version Version string.
*/
-void Logger::print_version()
+void Logger::print_version() const
{
if ( 0 <= Loglevel )
{
/**
* Prints out the successful parsing of the command line options.
*/
-void Logger::print_cmd_parsed()
+void Logger::print_cmd_parsed() const
{
if ( 1 <= Loglevel )
{
}
-void Logger::print_conf_files_parsed()
+void Logger::print_conf_files_parsed() const
{
if ( 1 <= Loglevel )
{
* Prints out the successful parsing of the config files.
* @param config_path The specified config path.
*/
-void Logger::print_conf_loaded(const string& config_path)
+void Logger::print_conf_loaded(const string& config_path) const
{
if ( 1 <= Loglevel )
{
* Prints out the unsuccessful parsing of the config files.
* @param config_path The specified config path.
*/
-void Logger::print_conf_not_loaded(const string& config_path)
+void Logger::print_conf_not_loaded(const string& config_path) const
{
if ( 0 <= Loglevel )
{
* A file could not be opened for reading.
* @param filename The filename.
*/
-void Logger::print_error_opening_r(const string& filename)
+void Logger::print_error_opening_r(const string& filename) const
{
if ( 0 <= Loglevel )
{
* A file could not be opened for writing.
* @param filename The filename.
*/
-void Logger::print_error_opening_rw(const string& filename)
+void Logger::print_error_opening_rw(const string& filename) const
{
if ( 0 <= Loglevel )
{
* Desctructor of specified class was called.
* @param _class Name of the class.
*/
-void Logger::print_destructor_call(const string& _class)
+void Logger::print_destructor_call(const string& _class) const
{
if ( 1 <= Loglevel )
{
* Constructor of specified class was called.
* @param _class Name of the class.
*/
-void Logger::print_constructor_call(const string& _class)
+void Logger::print_constructor_call(const string& _class) const
{
if ( 1 <= Loglevel )
{
* Update method for specified service was called.
* @param service The service for which is the update running.
*/
-void Logger::print_update_service(const string& service)
+void Logger::print_update_service(const string& service) const
{
if ( 0 <= Loglevel )
{
* An unknown option on the command line was detected.
* @param unknown_option The unknown option.
*/
-void Logger::print_unknown_cmd_option(const string& unknown_option)
+void Logger::print_unknown_cmd_option(const string& unknown_option) const
{
if ( 0 <= Loglevel )
{
* An unknown protocol was specified.
* @param protocol The unknown protocol.
*/
-void Logger::print_unknown_protocol(const string& protocol)
+void Logger::print_unknown_protocol(const string& protocol) const
{
if ( 0 <= Loglevel )
{
* Loading a service config file.
* @param filename The service config file.
*/
-void Logger::print_load_service_conf(const string& filename)
+void Logger::print_load_service_conf(const string& filename) const
{
if ( 1 <= Loglevel )
{
* Loading the main config file.
* @param filename The main config file.
*/
-void Logger::print_load_main_conf(const string& filename)
+void Logger::print_load_main_conf(const string& filename) const
{
if ( 1 <= Loglevel )
{
* There is an unknown option in a service config file.
* @param unknown_option The unknown option.
*/
-void Logger::print_unknown_service_conf_option(const string& unknown_option)
+void Logger::print_unknown_service_conf_option(const string& unknown_option) const
{
if ( 0 <= Loglevel )
{
* There is an unknown option in the main config file.
* @param unknown_option The unknown option.
*/
-void Logger::print_unknown_main_conf_option(const string& unknown_option)
+void Logger::print_unknown_main_conf_option(const string& unknown_option) const
{
if ( 0 <= Loglevel )
{
* The defined config path doesn't exist or is not a directory.
* @param config_path The defined config path.
*/
-void Logger::print_error_config_path(const string& config_path)
+void Logger::print_error_config_path(const string& config_path) const
{
if ( 0 <= Loglevel )
{
/**
* There is a missing command line option to initialize a service object.
*/
-void Logger::print_missing_cmd_service_option()
+void Logger::print_missing_cmd_service_option() const
{
if ( 0 <= Loglevel )
{
* Process running as daemon.
* @param pid The pid of the daemon.
*/
-void Logger::print_runnig_as_daemon(const int pid)
+void Logger::print_runnig_as_daemon(const int pid) const
{
if ( 1 <= Loglevel )
{
* Prints out the daemon mode.
* @param daemon_mode The daemon mode.
*/
-void Logger::print_daemon_mode(const bool daemon_mode)
+void Logger::print_daemon_mode(const bool daemon_mode) const
{
if ( 1 <= Loglevel )
{
/**
* There was an error while trying to fork.
*/
-void Logger::print_error_fork()
+void Logger::print_error_fork() const
{
if ( 0 <= Loglevel )
{
* A pid in the pidfile was found.
* @param pid The pid found in the pidfile.
*/
-void Logger::print_pid_found(const int pid)
+void Logger::print_pid_found(const int pid) const
{
if ( 1 <= Loglevel )
{
* Another process is already running.
* @param pid The pid of the other process.
*/
-void Logger::print_process_already_running(const int pid)
+void Logger::print_process_already_running(const int pid) const
{
if ( 0 <= Loglevel )
{
/**
* SIGTERM caught.
*/
-void Logger::print_caught_sigterm()
+void Logger::print_caught_sigterm() const
{
if ( 0 <= Loglevel )
{
/**
* SIGUSR1 caught.
*/
-void Logger::print_caught_siguser1()
+void Logger::print_caught_siguser1() const
{
if ( 0 <= Loglevel )
{
/**
* SIGHUP caught.
*/
-void Logger::print_caught_sighup()
+void Logger::print_caught_sighup() const
{
if ( 0 <= Loglevel )
{
/**
* Error while setting signal handler.
*/
-void Logger::print_error_setting_signal(const string& signal)
+void Logger::print_error_setting_signal(const string& signal) const
{
if ( 0 <= Loglevel )
{
/**
* Error while setting signal handler.
*/
-void Logger::print_init_log_facility()
+void Logger::print_init_log_facility() const
{
if ( 1 <= Loglevel )
{
/**
* Be verbose. Currently we are in offline mode.
*/
-void Logger::print_offline_mode()
+void Logger::print_offline_mode() const
{
if ( 0 <= Loglevel )
{
/**
* Objects successfully serialized.
*/
-void Logger::print_serialized_objects_success()
+void Logger::print_serialized_objects_success() const
{
if ( 1 <= Loglevel )
{
/**
* Objects successfully de-serialized.
*/
-void Logger::print_deserialized_objects_success()
+void Logger::print_deserialized_objects_success() const
{
if ( 1 <= Loglevel )
{
* @param actual_ip Service's actual_ip.
* @param lastupdated Service's lastupdated.
*/
-void Logger::print_service_object(const string& message, const string& protocol, const string& hostname, const string& login, const string& password, const string& actual_ip, const int lastupdated)
+void Logger::print_service_object(const string& message, const string& protocol, const string& hostname, const string& login, const string& password, const string& actual_ip, const int lastupdated) const
{
if ( 1 <= Loglevel )
{
* Caught exception while serialize.
* @param exception Exception message.
*/
-void Logger::print_exception_serialize(const string& exception)
+void Logger::print_exception_serialize(const string& exception) const
{
if ( 0 <= Loglevel )
{
* Caught exception while de-serialize.
* @param exception Exception message.
*/
-void Logger::print_exception_deserialize(const std::string& exception)
+void Logger::print_exception_deserialize(const std::string& exception) const
{
if ( 0 <= Loglevel )
{
* Child couldn't be killed by parent.
* @param pid Pid of the child.
*/
-void Logger::print_error_kill_child(const int pid)
+void Logger::print_error_kill_child(const int pid) const
{
if ( 0 <= Loglevel )
{
}
-void Logger::print_child_killed(const int pid)
+void Logger::print_child_killed(const int pid) const
{
if ( 0 <= Loglevel )
{
* There is no object file.
* @param object_file The object file.
*/
-void Logger::print_no_object_file(const std::string& object_file)
+void Logger::print_no_object_file(const std::string& object_file) const
{
if ( 1 <= Loglevel )
{
~Logger();
- void log_notice(const std::string&);
+ void log_notice(const std::string&) const;
- void log_warning(const std::string&);
+ void log_warning(const std::string&) const;
- void log_error(const std::string&);
+ void log_error(const std::string&) const;
void set_loglevel(const int);
- int get_loglevel();
+ int get_loglevel() const;
void set_syslog(const bool);
- bool get_syslog();
+ bool get_syslog() const;
void set_log_facility(const int, const bool);
- void print_usage(const Options_descriptionPtr);
+ void print_usage(const Options_descriptionPtr) const;
- void print_version();
+ void print_version() const;
- void print_cmd_parsed();
+ void print_cmd_parsed() const;
- void print_conf_files_parsed();
+ void print_conf_files_parsed() const;
- void print_destructor_call(const std::string&);
+ void print_destructor_call(const std::string&) const;
- void print_constructor_call(const std::string&);
+ void print_constructor_call(const std::string&) const;
- void print_update_service(const std::string&);
+ void print_update_service(const std::string&) const;
- void print_unknown_cmd_option(const std::string&);
+ void print_unknown_cmd_option(const std::string&) const;
- void print_unknown_protocol(const std::string&);
+ void print_unknown_protocol(const std::string&) const;
- void print_load_service_conf(const std::string&);
+ void print_load_service_conf(const std::string&) const;
- void print_load_main_conf(const std::string&);
+ void print_load_main_conf(const std::string&) const;
- void print_unknown_service_conf_option(const std::string&);
+ void print_unknown_service_conf_option(const std::string&) const;
- void print_unknown_main_conf_option(const std::string&);
+ void print_unknown_main_conf_option(const std::string&) const;
- void print_error_opening_r(const std::string&);
+ void print_error_opening_r(const std::string&) const;
- void print_error_opening_rw(const std::string&);
+ void print_error_opening_rw(const std::string&) const;
- void print_error_config_path(const std::string&);
+ void print_error_config_path(const std::string&) const;
- void print_conf_loaded(const std::string&);
+ void print_conf_loaded(const std::string&) const;
- void print_conf_not_loaded(const std::string&);
+ void print_conf_not_loaded(const std::string&) const;
- void print_missing_cmd_service_option();
+ void print_missing_cmd_service_option() const;
- void print_runnig_as_daemon(const int);
+ void print_runnig_as_daemon(const int) const;
- void print_daemon_mode(const bool);
+ void print_daemon_mode(const bool) const;
- void print_error_fork();
+ void print_error_fork() const;
- void print_pid_found(const int);
+ void print_pid_found(const int) const;
- void print_process_already_running(const int);
+ void print_process_already_running(const int) const;
- void print_caught_sigterm();
+ void print_caught_sigterm() const;
- void print_caught_siguser1();
+ void print_caught_siguser1() const;
- void print_caught_sighup();
+ void print_caught_sighup() const;
- void print_error_setting_signal(const std::string&);
+ void print_error_setting_signal(const std::string&) const;
- void print_init_log_facility();
+ void print_init_log_facility() const;
- void print_offline_mode();
+ void print_offline_mode() const;
- void print_serialized_objects_success();
+ void print_serialized_objects_success() const;
- void print_deserialized_objects_success();
+ void print_deserialized_objects_success() const;
- void print_service_object(const std::string&, const std::string&, const std::string&, const std::string&, const std::string&, const std::string&, const int);
+ void print_service_object(const std::string&, const std::string&, const std::string&, const std::string&, const std::string&, const std::string&, const int) const;
- void print_exception_serialize(const std::string&);
+ void print_exception_serialize(const std::string&) const;
- void print_exception_deserialize(const std::string&);
+ void print_exception_deserialize(const std::string&) const;
- void print_error_kill_child(const int);
+ void print_error_kill_child(const int) const;
- void print_child_killed(const int);
+ void print_child_killed(const int) const;
- void print_no_object_file(const std::string&);
+ void print_no_object_file(const std::string&) const;
};
#endif
* Getter for member Timeout.
* @return Value of Timeout.
*/
-int ODS::get_timeout()
+int ODS::get_timeout() const
{
return Timeout;
}
* Getter for member Max_updates_per_timeout.
* @return Value of Max_updates_per_timeout.
*/
-int ODS::get_max_updates_within_timeout()
+int ODS::get_max_updates_within_timeout() const
{
return MaxUpdatesWithinTimeout;
}
~ODS();
void set_timeout(const int);
- int get_timeout();
+ int get_timeout() const;
void set_max_updates_within_timeout(const int);
- int get_max_updates_within_timeout();
+ int get_max_updates_within_timeout() const;
void update(const std::string&);
};
* Getter for memeber Protocol.
* @return Value of member Protocol.
*/
-string Service::get_protocol()
+string Service::get_protocol() const
{
return Protocol;
}
* Getter for member Hostname.
* @return Value of member Hostname.
*/
-string Service::get_hostname()
+string Service::get_hostname() const
{
return Hostname;
}
* Getter for member Login.
* @return Value of member Login.
*/
-string Service::get_login()
+string Service::get_login() const
{
return Login;
}
* Getter for member Password.
* @return Value of member Password.
*/
-string Service::get_password()
+string Service::get_password() const
{
return Password;
}
* Getter for member Log.
* @return Shared pointer to Logger object.
*/
-Logger::Ptr Service::get_logger()
+Logger::Ptr Service::get_logger() const
{
return Log;
}
* Getter for member Lastupdated.
* @return Value of member Lastupdated.
*/
-int Service::get_lastupdated()
+int Service::get_lastupdated() const
{
return Lastupdated;
}
* Getter for member ActualIP.
* @return Value of member ActualIP.
*/
-std::string Service::get_actual_ip()
+std::string Service::get_actual_ip() const
{
return ActualIP;
}
virtual void update(const std::string&)=0;
- virtual int get_timeout()=0;
+ virtual int get_timeout()const =0 ;
virtual void set_timeout(const int)=0;
+ virtual int get_max_updates_within_timeout() const =0;
+ virtual void set_max_updates_within_timeout(const int)=0;
+
void set_protocol(const std::string&);
- std::string get_protocol();
+ std::string get_protocol() const;
void set_hostname(const std::string&);
- std::string get_hostname();
+ std::string get_hostname() const;
void set_login(const std::string&);
- std::string get_login();
+ std::string get_login() const;
void set_password(const std::string&);
- std::string get_password();
+ std::string get_password() const;
void set_lastupdated(const int);
- int get_lastupdated();
+ int get_lastupdated() const;
void set_actual_ip(const std::string&);
- std::string get_actual_ip();
+ std::string get_actual_ip() const;
void set_logger(const Logger::Ptr&);
- Logger::Ptr get_logger();
+ Logger::Ptr get_logger() const;
bool operator== (const Service&) const;
bool operator!= (const Service&) const;
* Needed after deserialization to get the valid list of Service* back.
* @return The list of Service*.
*/
-std::list<Service::Ptr> Serviceholder::get_hold_services()
+std::list<Service::Ptr> Serviceholder::get_hold_services() const
{
return HoldServices;
}
void add_service(Service::Ptr);
- std::list<Service::Ptr> get_hold_services();
+ std::list<Service::Ptr> get_hold_services() const;
};
#endif
* Getter for member Config.
* @return Member Config.
*/
-Config::Ptr Updater::get_config()
+Config::Ptr Updater::get_config() const
{
return Conf;
}
* Getter for member Logger.
* @return Member Logger.
*/
-Logger::Ptr Updater::get_logger()
+Logger::Ptr Updater::get_logger() const
{
return Log;
}
int init_config_from_files();
- Config::Ptr get_config();
+ Config::Ptr get_config() const;
- Logger::Ptr get_logger();
+ Logger::Ptr get_logger() const;
int reload_config();