2 * @brief The abstract service class. This class represents all services.
6 * @copyright Intra2net AG
15 #include <boost/archive/text_oarchive.hpp>
16 #include <boost/archive/text_iarchive.hpp>
18 #include <boost/shared_ptr.hpp>
37 int MaxUpdatesWithinInterval;
40 std::list<time_t> LastUpdates;
42 friend class boost::serialization::access;
43 template<class Archive>
44 void serialize(Archive & ar, const unsigned int version)
46 // protocol and hostname are the unique identifier for each service.
49 // lastupdated and actual_ip must also be serialized, cause these are essential infos of each service.
53 ar & MaxUpdatesWithinInterval;
61 typedef boost::shared_ptr<Service> Ptr;
67 virtual int perform_update(const std::string& ip) = 0;
69 void update(const std::string& ip, const time_t current_time);
71 bool update_allowed(const time_t current_time);
73 void set_last_update(const time_t current_time);
75 int get_update_interval()const;
76 void set_update_interval(const int _update_interval);
78 int get_max_updates_within_interval() const;
79 void set_max_updates_within_interval(const int _max_updates_within_interval);
81 int get_dns_cache_ttl() const;
82 void set_dns_cache_ttl(const int _dns_cache_ttl);
84 void set_protocol(const std::string& _protocol);
85 std::string get_protocol() const;
87 void set_hostname(const std::string& _hostname);
88 std::string get_hostname() const;
90 void set_login(const std::string& _login);
91 std::string get_login() const;
93 void set_password(const std::string& _password);
94 std::string get_password() const;
96 void set_last_updates(std::list<time_t> _last_updates);
97 const std::list<time_t> get_last_updates() const;
99 void set_actual_ip(const std::string& _actual_ip);
100 std::string get_actual_ip() const;
102 void set_logger(const Logger::Ptr& _log);
103 Logger::Ptr get_logger() const;
105 std::string get_service_name() const;
107 bool operator== (const Service& other) const;
108 bool operator!= (const Service& other) const;