Commit | Line | Data |
---|---|---|
a78b44b5 BS |
1 | /** @file |
2 | * @brief GNUDIP Service class header. This class represents the GNUDIP service. | |
3 | * | |
4 | * | |
5 | * | |
6 | * @copyright Intra2net AG | |
7 | * @license GPLv2 | |
8 | */ | |
9 | ||
10 | #ifndef ServiceGnudip_H | |
11 | #define ServiceGnudip_H | |
12 | ||
4de6a9b8 BS |
13 | #include "service.hpp" |
14 | #include "logger.hpp" | |
15 | #include "httphelper.hpp" | |
a78b44b5 | 16 | |
a78b44b5 | 17 | #include <boost/shared_ptr.hpp> |
a78b44b5 | 18 | #include <map> |
ca5d6889 BS |
19 | #include <string> |
20 | ||
a78b44b5 BS |
21 | |
22 | class ServiceGnudip : public Service | |
23 | { | |
24 | ||
ca28857e | 25 | protected: |
a78b44b5 BS |
26 | |
27 | friend class boost::serialization::access; | |
28 | template<class Archive> | |
ca5d6889 BS |
29 | void serialize(Archive & ar, const unsigned int version) |
30 | { | |
31 | ar & boost::serialization::base_object<Service>(*this); | |
32 | } | |
a78b44b5 BS |
33 | |
34 | std::string GnudipServer; | |
35 | std::string BaseUrl; | |
36 | ||
37 | HTTPHelper::Ptr HTTPHelp; | |
38 | ||
62df5f33 | 39 | std::string assemble_base_url(const std::string& gnudip_server) const; |
a78b44b5 | 40 | std::map<std::string,std::string> parse_initial_request(const std::string& curl_data) const; |
ca28857e | 41 | virtual std::string assemble_update_url(const std::string& salt, const std::string& curr_time, const std::string& sign, const std::string& secret, const std::string& ip) const; |
3208f713 | 42 | std::string parse_return_code(const std::string& curl_data) const; |
a78b44b5 BS |
43 | |
44 | public: | |
45 | ||
46 | typedef boost::shared_ptr<ServiceGnudip> Ptr; | |
47 | ||
48 | ServiceGnudip(); | |
49 | ||
4553e833 | 50 | ServiceGnudip(const std::string& _protocol, const std::string& _gnudip_server ,const std::string& _hostname, const std::string& _login, const std::string& _password, const Logger::Ptr& _logger, const int _update_interval, const int _max_updates_within_interval, const int _max_equal_updates_in_succession, const int dns_cache_ttl, const std::string& proxy, const int proxy_port); |
a78b44b5 BS |
51 | |
52 | ~ServiceGnudip(); | |
53 | ||
d008afbe | 54 | UpdateErrorCode perform_update(const std::string& ip); |
a78b44b5 BS |
55 | |
56 | }; | |
57 | ||
58 | #endif |