| 1 | /** @file |
| 2 | * @brief GNUDIP Service class implementation. This class represents the GNUDIP service. |
| 3 | * |
| 4 | * |
| 5 | * |
| 6 | * @copyright Intra2net AG |
| 7 | * @license GPLv2 |
| 8 | */ |
| 9 | |
| 10 | #include "service_gnudip_fullhostname.hpp" |
| 11 | #include "util.hpp" |
| 12 | |
| 13 | |
| 14 | using namespace std; |
| 15 | |
| 16 | |
| 17 | /** |
| 18 | * Default Constructor, needed for object serialization. |
| 19 | */ |
| 20 | ServiceGnudipFullhostname::ServiceGnudipFullhostname() |
| 21 | { |
| 22 | } |
| 23 | |
| 24 | |
| 25 | /** |
| 26 | * Constructor. |
| 27 | * @param _hostname The hostname to update |
| 28 | * @param _login The login name. |
| 29 | * @param _password The corresponding password. |
| 30 | */ |
| 31 | ServiceGnudipFullhostname::ServiceGnudipFullhostname(const string& _protocol, const string& _gnudip_server, const string& _hostname, const string& _login, const 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 string& _proxy, const int _proxy_port) |
| 32 | : ServiceGnudip(_protocol, _gnudip_server, _hostname, _login, _password, _logger, _update_interval, _max_updates_within_interval, _max_equal_updates_in_succession, _dns_cache_ttl, _proxy, _proxy_port) |
| 33 | { |
| 34 | } |
| 35 | |
| 36 | |
| 37 | /** |
| 38 | * Default destructor |
| 39 | */ |
| 40 | ServiceGnudipFullhostname::~ServiceGnudipFullhostname() |
| 41 | { |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Get the assembled update url. |
| 46 | * @param salt Salt from the initial request |
| 47 | * @param time Time from the initial request |
| 48 | * @param sign Sign from the initial request |
| 49 | * @param secret Computed md5 secret in HEX |
| 50 | * @param ip IP to update |
| 51 | * @return The assembled update url. |
| 52 | */ |
| 53 | string ServiceGnudipFullhostname::assemble_update_url(const string& salt, const string& curr_time, const string& sign, const string& secret, const string& ip) const |
| 54 | { |
| 55 | string url = BaseUrl; |
| 56 | |
| 57 | url.append("?salt="); |
| 58 | url.append(salt); |
| 59 | url.append("&time="); |
| 60 | url.append(curr_time); |
| 61 | url.append("&sign="); |
| 62 | url.append(sign); |
| 63 | url.append("&user="); |
| 64 | url.append(get_login()); |
| 65 | url.append("&domn="); |
| 66 | url.append(get_hostname()); |
| 67 | url.append("&pass="); |
| 68 | url.append(secret); |
| 69 | url.append("&reqc=0&addr="); |
| 70 | url.append(ip); |
| 71 | |
| 72 | return url; |
| 73 | } |
| 74 | |