Fix 'occurred' typo
[bpdyndnsd] / src / service_dyns.cpp
index 10d4398..c831296 100644 (file)
@@ -7,8 +7,8 @@
  * @license GPLv2
 */
 
-#include "service_dyns.h"
-#include "util.h"
+#include "service_dyns.hpp"
+#include "util.hpp"
 
 #include <time.h>
 #include <boost/foreach.hpp>
@@ -33,7 +33,7 @@ ServiceDyns::ServiceDyns()
  * @param _login The login name.
  * @param _password The corresponding password.
  */
-ServiceDyns::ServiceDyns(const string& _protocol, 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 _dns_cache_ttl, const string& _proxy, const int _proxy_port)
+ServiceDyns::ServiceDyns(const string& _protocol, 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)
 {
     if ( _update_interval == -1 )        // If _update_interval is default po::option_desc (not specified via config)
         set_update_interval(5);              // use default protocol value
@@ -100,7 +100,7 @@ string ServiceDyns::assemble_base_url(const string& fqhn, const string& username
  * @param ip IP Address to set.
  * @return 0 if all is fine, -1 otherwise.
  */
-int ServiceDyns::perform_update(const std::string& ip)
+Service::UpdateErrorCode ServiceDyns::perform_update(const std::string& ip)
 {
     string url = BaseUrl;
     url.append(ip);
@@ -122,15 +122,17 @@ int ServiceDyns::perform_update(const std::string& ip)
 
             if ( status_code == "200" )
             {
-                return 0;
+                return UpdateOk;
             }
             else if ( status_code == "401" )
             {
                 get_logger()->print_service_not_authorized(url,get_login(),get_password());
+                return NotAuth;
             }
             else
             {
                 get_logger()->print_update_failure(url,curl_data);
+                return UpdateError;
             }
         }
         else
@@ -141,6 +143,7 @@ int ServiceDyns::perform_update(const std::string& ip)
     else
     {
         get_logger()->print_httphelper_not_initialized();
+        HTTPHelp->re_initialize();
     }
-    return -1;
+    return GenericError;
 }