add new protocol variation "gnudip-fullhostname", used by provider dynu.com
[bpdyndnsd] / src / service_gnudip_fullhostname.cpp
diff --git a/src/service_gnudip_fullhostname.cpp b/src/service_gnudip_fullhostname.cpp
new file mode 100644 (file)
index 0000000..7b01199
--- /dev/null
@@ -0,0 +1,74 @@
+/** @file
+ * @brief GNUDIP Service class implementation. This class represents the GNUDIP service.
+ *
+ *
+ *
+ * @copyright Intra2net AG
+ * @license GPLv2
+*/
+
+#include "service_gnudip_fullhostname.hpp"
+#include "util.hpp"
+
+
+using namespace std;
+
+
+/**
+ * Default Constructor, needed for object serialization.
+ */
+ServiceGnudipFullhostname::ServiceGnudipFullhostname()
+{
+}
+
+
+/**
+ * Constructor.
+ * @param _hostname The hostname to update
+ * @param _login The login name.
+ * @param _password The corresponding password.
+ */
+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)
+    : 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)
+{
+}
+
+
+/**
+ * Default destructor
+ */
+ServiceGnudipFullhostname::~ServiceGnudipFullhostname()
+{
+}
+
+/**
+ * Get the assembled update url.
+ * @param salt Salt from the initial request
+ * @param time Time from the initial request
+ * @param sign Sign from the initial request
+ * @param secret Computed md5 secret in HEX
+ * @param ip IP to update
+ * @return The assembled update url.
+ */
+string ServiceGnudipFullhostname::assemble_update_url(const string& salt, const string& curr_time, const string& sign, const string& secret, const string& ip) const
+{
+        string url = BaseUrl;
+
+        url.append("?salt=");
+        url.append(salt);
+        url.append("&time=");
+        url.append(curr_time);
+        url.append("&sign=");
+        url.append(sign);
+        url.append("&user=");
+        url.append(get_login());
+        url.append("&domn=");
+        url.append(get_hostname());
+        url.append("&pass=");
+        url.append(secret);
+        url.append("&reqc=0&addr=");
+        url.append(ip);
+
+        return url;
+}
+