Renamed within refactoring class naming.
authorBjoern Sikora <bjoern.sikora@intra2net.com>
Mon, 7 Sep 2009 16:37:03 +0000 (18:37 +0200)
committerBjoern Sikora <bjoern.sikora@intra2net.com>
Mon, 7 Sep 2009 16:37:03 +0000 (18:37 +0200)
14 files changed:
src/dhs.cpp [deleted file]
src/dhs.h [deleted file]
src/dyndns.cpp [deleted file]
src/dyndns.h [deleted file]
src/dyns.cpp [deleted file]
src/dyns.h [deleted file]
src/easydns.cpp [deleted file]
src/easydns.h [deleted file]
src/ods.cpp [deleted file]
src/ods.h [deleted file]
src/tzo.cpp [deleted file]
src/tzo.h [deleted file]
src/zoneedit.cpp [deleted file]
src/zoneedit.h [deleted file]

diff --git a/src/dhs.cpp b/src/dhs.cpp
deleted file mode 100644 (file)
index b148867..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/** @file
- * @brief DHS Service class implementation. This class represents the DHS service.
- *
- *
- *
- * @copyright Intra2net AG
- * @license GPLv2
-*/
-
-#include "dhs.h"
-
-#include <time.h>
-#include <boost/foreach.hpp>
-#include <boost/algorithm/string.hpp>
-
-namespace ba = boost::algorithm;
-
-using namespace std;
-
-
-/**
- * Default Constructor, needed for object serialization.
- */
-DHS::DHS()
-{
-}
-
-
-/**
- * Constructor.
- * @param _hostname The hostname to update
- * @param _login The login name.
- * @param _password The corresponding password.
- */
-DHS::DHS(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)
-{
-    if ( _update_interval == -1 )        // If _update_interval is default po::option_desc (not specified via config)
-        set_update_interval(15);              // use default protocol value
-    else
-        set_update_interval(_update_interval);
-
-    if ( _max_updates_within_interval == -1 )
-        set_max_updates_within_interval(3);
-    else
-        set_max_updates_within_interval(_max_updates_within_interval);
-
-    if ( _dns_cache_ttl == -1 )
-        set_dns_cache_ttl(7200);
-    else
-        set_dns_cache_ttl(_dns_cache_ttl);
-
-    set_protocol(_protocol);
-    set_hostname(_hostname);
-    set_login(_login);
-    set_password(_password);
-    set_logger(_logger);
-
-    // create http helper class
-    HTTPHelper::Ptr _http_help(new HTTPHelper(_logger,_proxy,_proxy_port,_login,_password));
-    HTTPHelp = _http_help;
-    _http_help.reset();
-
-    // extract domain part from hostname
-    list<string> host_domain_part = separate_domain_and_host_part(get_hostname());
-
-    BaseUrl = assemble_base_url(host_domain_part.front(),host_domain_part.back());
-}
-
-
-/**
- * Default destructor
- */
-DHS::~DHS()
-{
-}
-
-
-/**
- * Assemble the dhs update url from the given hostname and domain part
- * @param hostname The hostname to update IP for.
- * @param domain_part The domain_part in which the hostname is located.
- * @return The assembled update url without IP.
- */
-string DHS::assemble_base_url(const string& hostname, const string& domain_part) const
-{
-    string base_url;
-
-    base_url = "http://members.dhs.org";
-    base_url.append("/nic/hosts?hostscmd=edit&hostscmdstage=2&type=4&domain=");
-    base_url.append(domain_part);
-    base_url.append("&hostname=");
-    base_url.append(hostname);
-    base_url.append("&updatetype=Online&ip=");
-
-    return base_url;
-}
-
-
-/**
- * Separates the hostname from the domain part.
- * @param fqdn Hostname with domain part.
- * @return A list with 2 elements (first element is the hostname, second element the domain part), or a list with 1 element if the domain part couldn't be determined.
- */
-list<string> DHS::separate_domain_and_host_part(const string& fqdn) const
-{
-    list<string> splitted;
-    ba::split(splitted,fqdn,boost::is_any_of("."));
-
-    if ( splitted.size() > 1 )
-    {
-        string host = splitted.front();
-        splitted.pop_front();
-
-        string domain = splitted.front();
-        splitted.pop_front();
-
-        BOOST_FOREACH(string domain_part, splitted)
-        {
-            domain.append(".");
-            domain.append(domain_part);
-        }
-
-        splitted.clear();
-        splitted.push_back(host);
-        splitted.push_back(domain);
-    }
-
-    return splitted;
-}
-
-
-/**
- * Performs the Service update.
- * @param ip IP Address to set.
- * @return 0 if all is fine, -1 otherwise.
- */
-int DHS::perform_update(const std::string& ip)
-{
-    int ret_val = -1;
-
-    string url = BaseUrl;
-    url.append(ip);
-
-    // Perform curl operation on given url.
-    long http_status_code = HTTPHelp->http_get(url);
-
-    get_logger()->print_http_status_code(url,http_status_code);
-
-    // Check the status code for protocol errors.
-    if ( http_status_code == 200 )
-    {
-        // TODO: Account related errors should be handled here!
-        ret_val = 0;
-    }
-    else if ( http_status_code == 401 )
-        get_logger()->print_http_not_authorized(url,get_login(),get_password());
-    else
-        get_logger()->print_update_failure(url,http_status_code);
-
-    return ret_val;
-}
-
-
-/**
- * Serialize function needed by boost/serialization to define which members should be stored as the object state.
- * @param ar Archive
- * @param version Version
- */
-template<class Archive>
-void DHS::serialize(Archive & ar, const unsigned int version)
-{
-    ar & boost::serialization::base_object<Service>(*this);
-}
diff --git a/src/dhs.h b/src/dhs.h
deleted file mode 100644 (file)
index eb70951..0000000
--- a/src/dhs.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/** @file
- * @brief DHS Service class header. This class represents the DHS service.
- *
- *
- *
- * @copyright Intra2net AG
- * @license GPLv2
-*/
-
-#ifndef DHS_H
-#define DHS_H
-
-#include <string>
-
-#include "service.h"
-#include "logger.h"
-
-#include <boost/serialization/array.hpp>
-#include <boost/shared_ptr.hpp>
-#include <list>
-
-class DHS : public Service
-{
-
-private:
-
-    friend class boost::serialization::access;
-    template<class Archive>
-    void serialize(Archive & ar, const unsigned int version);
-
-    std::string BaseUrl;
-
-    HTTPHelper::Ptr HTTPHelp;
-
-    std::list<std::string> separate_domain_and_host_part(const std::string& str) const;
-
-    std::string assemble_base_url(const std::string& hostname, const std::string& domain_part) const;
-
-public:
-
-    typedef boost::shared_ptr<DHS> Ptr;
-
-    DHS();
-
-    DHS(const std::string& _protocol, 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 dns_cache_ttl, const std::string& proxy, const int proxy_port);
-
-    ~DHS();
-
-    int perform_update(const std::string& ip);
-};
-
-#endif
diff --git a/src/dyndns.cpp b/src/dyndns.cpp
deleted file mode 100644 (file)
index b77fd12..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/** @file
- * @brief DYNDNS Service class implementation. This class represents the DYNDNS service.
- *
- *
- *
- * @copyright Intra2net AG
- * @license GPLv2
-*/
-
-#include "dyndns.h"
-
-#include <time.h>
-#include <boost/foreach.hpp>
-
-using namespace std;
-
-
-/**
- * Default Constructor, needed for object serialization.
- */
-DYNDNS::DYNDNS()
-{
-}
-
-
-/**
- * Constructor.
- * @param _hostname The hostname to update
- * @param _login The login name.
- * @param _password The corresponding password.
- */
-DYNDNS::DYNDNS(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)
-{
-    if ( _update_interval == -1 )        // If _update_interval is default po::option_desc (not specified via config)
-        set_update_interval(0);              // use default protocol value
-    else
-        set_update_interval(_update_interval);
-
-    if ( _max_updates_within_interval == -1 )
-        set_max_updates_within_interval(0);
-    else
-        set_max_updates_within_interval(_max_updates_within_interval);
-
-    if ( _dns_cache_ttl == -1 )
-        set_dns_cache_ttl(60);
-    else
-        set_dns_cache_ttl(_dns_cache_ttl);
-
-    set_protocol(_protocol);
-    set_hostname(_hostname);
-    set_login(_login);
-    set_password(_password);
-    set_logger(_logger);
-
-    // create http helper class
-    HTTPHelper::Ptr _http_help(new HTTPHelper(_logger,_proxy,_proxy_port,_login,_password));
-    HTTPHelp = _http_help;
-    _http_help.reset();
-
-    BaseUrl = assemble_base_url(get_hostname());
-}
-
-
-/**
- * Default destructor
- */
-DYNDNS::~DYNDNS()
-{
-}
-
-
-/**
- * Assemble the dyndns update url from the given fqhn
- * @param hostname The fqhn hostname to update IP for.
- * @return The assembled update url without IP.
- */
-string DYNDNS::assemble_base_url(const string& fqhn) const
-{
-    string base_url;
-
-    base_url = "https://members.dyndns.org";
-    base_url.append("/nic/update?hostname=");
-    base_url.append(fqhn);
-    base_url.append("&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG&myip=");
-
-    return base_url;
-}
-
-
-/**
- * Performs the Service update.
- * @param ip IP Address to set.
- * @return 0 if all is fine, -1 otherwise.
- */
-int DYNDNS::perform_update(const std::string& ip)
-{
-    int ret_val = -1;
-
-    // the result string if update was successful
-    string good = "good ";
-    good.append(ip);
-
-    string url = BaseUrl;
-    url.append(ip);
-
-    // Perform curl operation on given url
-    long http_status_code = HTTPHelp->http_get(url);
-
-    get_logger()->print_http_status_code(url,http_status_code);
-
-    // HTTP operation completed successful.
-    // Now we have to parse the data received by curl,
-    // cause http status code is not significant for dyndns update errors
-    if ( http_status_code == 200 )
-    {
-        // Get the received http data.
-        string curl_data = HTTPHelp->get_curl_data();
-
-        if ( curl_data == good )
-            ret_val = 0;
-        else if ( curl_data == "badauth" )
-            get_logger()->print_http_not_authorized(url,get_login(),get_password());
-        else
-            get_logger()->print_update_failure(url, curl_data);
-    }
-
-    return ret_val;
-}
-
-
-/**
- * Serialize function needed by boost/serialization to define which members should be stored as the object state.
- * @param ar Archive
- * @param version Version
- */
-template<class Archive>
-void DYNDNS::serialize(Archive & ar, const unsigned int version)
-{
-    ar & boost::serialization::base_object<Service>(*this);
-}
diff --git a/src/dyndns.h b/src/dyndns.h
deleted file mode 100644 (file)
index 2bf38db..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/** @file
- * @brief DYNDNS Service class header. This class represents the DYNDNS service.
- *
- *
- *
- * @copyright Intra2net AG
- * @license GPLv2
-*/
-
-#ifndef DYNDNS_H
-#define DYNDNS_H
-
-#include <string>
-
-#include "service.h"
-#include "logger.h"
-
-#include <boost/serialization/array.hpp>
-#include <boost/shared_ptr.hpp>
-#include <list>
-
-class DYNDNS : public Service
-{
-
-private:
-
-    friend class boost::serialization::access;
-    template<class Archive>
-    void serialize(Archive & ar, const unsigned int version);
-
-    std::string BaseUrl;
-
-    HTTPHelper::Ptr HTTPHelp;
-
-    std::string assemble_base_url(const std::string& fqhn) const;
-
-public:
-
-    typedef boost::shared_ptr<DYNDNS> Ptr;
-
-    DYNDNS();
-
-    DYNDNS(const std::string& _protocol, 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 dns_cache_ttl, const std::string& proxy, const int proxy_port);
-
-    ~DYNDNS();
-
-    int perform_update(const std::string& ip);
-
-};
-
-#endif
diff --git a/src/dyns.cpp b/src/dyns.cpp
deleted file mode 100644 (file)
index 4950757..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/** @file
- * @brief DYNS Service class implementation. This class represents the DYNS service.
- *
- *
- *
- * @copyright Intra2net AG
- * @license GPLv2
-*/
-
-#include "dyns.h"
-
-#include <time.h>
-#include <boost/foreach.hpp>
-#include <boost/algorithm/string.hpp>
-
-namespace ba = boost::algorithm;
-
-using namespace std;
-
-
-/**
- * Default Constructor, needed for object serialization.
- */
-DYNS::DYNS()
-{
-}
-
-
-/**
- * Constructor.
- * @param _hostname The hostname to update
- * @param _login The login name.
- * @param _password The corresponding password.
- */
-DYNS::DYNS(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)
-{
-    if ( _update_interval == -1 )        // If _update_interval is default po::option_desc (not specified via config)
-        set_update_interval(5);              // use default protocol value
-    else
-        set_update_interval(_update_interval);
-
-    if ( _max_updates_within_interval == -1 )
-        set_max_updates_within_interval(1);
-    else
-        set_max_updates_within_interval(_max_updates_within_interval);
-
-    if ( _dns_cache_ttl == -1 )
-        set_dns_cache_ttl(300);
-    else
-        set_dns_cache_ttl(_dns_cache_ttl);
-
-    set_protocol(_protocol);
-    set_hostname(_hostname);
-    set_login(_login);
-    set_password(_password);
-    set_logger(_logger);
-
-    // create http helper class
-    HTTPHelper::Ptr _http_help(new HTTPHelper(_logger,_proxy,_proxy_port));
-    HTTPHelp = _http_help;
-    _http_help.reset();
-
-    BaseUrl = assemble_base_url(get_hostname(),get_login(),get_password());
-}
-
-
-/**
- * Default destructor
- */
-DYNS::~DYNS()
-{
-}
-
-
-/**
- * Assemble the dyns update url from the given fqhn
- * @param hostname The fqhn hostname to update IP for.
- * @param username The username to use.
- * @param hostname The password to use.
- * @return The assembled update url without IP.
- */
-string DYNS::assemble_base_url(const string& fqhn, const string& username, const string& password) const
-{
-    string base_url;
-
-    base_url = "http://www.dyns.net";
-    base_url.append("/postscript011.php?username=");
-    base_url.append(username);
-    base_url.append("&password=");
-    base_url.append(password);
-    base_url.append("&host=");
-    base_url.append(fqhn);
-    base_url.append("&ip=");
-
-    return base_url;
-}
-
-
-/**
- * Performs the Service update.
- * @param ip IP Address to set.
- * @return 0 if all is fine, -1 otherwise.
- */
-int DYNS::perform_update(const std::string& ip)
-{
-    int ret_val = -1;
-
-    string url = BaseUrl;
-    url.append(ip);
-
-    long http_status_code = HTTPHelp->http_get(url);
-
-    get_logger()->print_http_status_code(url,http_status_code);
-
-    // HTTP operation completed successful.
-    // Now we have to parse the data received by curl,
-    // cause http status code is not significant for dyns update errors
-    if ( http_status_code == 200 )
-    {
-        // Get the received http data and parse the status code.
-        string curl_data = HTTPHelp->get_curl_data();
-        string status_code = parse_status_code(curl_data);
-
-        if ( status_code == "200" )
-            ret_val = 0;
-        else if ( status_code == "401" )
-            get_logger()->print_http_not_authorized(url,get_login(),get_password());
-        else
-            get_logger()->print_update_failure(url,curl_data);
-    }
-
-    return ret_val;
-}
-
-
-/**
- * Get the status code from the returned http data
- * @param data The returned http data.
- * @return The status code.
- */
-string DYNS::parse_status_code(const string& data) const
-{
-    list<string> tokens;
-    ba::split(tokens,data,boost::is_any_of(" "));
-    return tokens.front();
-}
-
-
-/**
- * Serialize function needed by boost/serialization to define which members should be stored as the object state.
- * @param ar Archive
- * @param version Version
- */
-template<class Archive>
-void DYNS::serialize(Archive & ar, const unsigned int version)
-{
-    ar & boost::serialization::base_object<Service>(*this);
-}
diff --git a/src/dyns.h b/src/dyns.h
deleted file mode 100644 (file)
index f21afd9..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/** @file
- * @brief DYNS Service class header. This class represents the DYNS service.
- *
- *
- *
- * @copyright Intra2net AG
- * @license GPLv2
-*/
-
-#ifndef DYNS_H
-#define DYNS_H
-
-#include <string>
-
-#include "service.h"
-#include "logger.h"
-
-#include <boost/serialization/array.hpp>
-#include <boost/shared_ptr.hpp>
-#include <list>
-
-class DYNS : public Service
-{
-
-private:
-
-    friend class boost::serialization::access;
-    template<class Archive>
-    void serialize(Archive & ar, const unsigned int version);
-
-    std::string BaseUrl;
-
-    HTTPHelper::Ptr HTTPHelp;
-
-    std::string assemble_base_url(const std::string& fqhn, const std::string& username, const std::string& password) const;
-
-    std::string parse_status_code(const std::string& data) const;
-
-public:
-
-    typedef boost::shared_ptr<DYNS> Ptr;
-
-    DYNS();
-
-    DYNS(const std::string& _protocol, 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 dns_cache_ttl, const std::string& proxy, const int proxy_port);
-
-    ~DYNS();
-
-    int perform_update(const std::string& ip);
-};
-
-#endif
diff --git a/src/easydns.cpp b/src/easydns.cpp
deleted file mode 100644 (file)
index b2f0ad9..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-/** @file
- * @brief EASYDNS Service class implementation. This class represents the EASYDNS service.
- *
- *
- *
- * @copyright Intra2net AG
- * @license GPLv2
-*/
-
-#include "easydns.h"
-
-#include <time.h>
-#include <boost/foreach.hpp>
-#include <boost/algorithm/string.hpp>
-
-namespace ba = boost::algorithm;
-
-using namespace std;
-
-
-/**
- * Default Constructor, needed for object serialization.
- */
-EASYDNS::EASYDNS()
-{
-}
-
-
-/**
- * Constructor.
- * @param _hostname The hostname to update
- * @param _login The login name.
- * @param _password The corresponding password.
- */
-EASYDNS::EASYDNS(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)
-{
-    if ( _update_interval == -1 )        // If _update_interval is default po::option_desc (not specified via config)
-        set_update_interval(10);              // use default protocol value
-    else
-        set_update_interval(_update_interval);
-
-    if ( _max_updates_within_interval == -1 )
-        set_max_updates_within_interval(1);
-    else
-        set_max_updates_within_interval(_max_updates_within_interval);
-
-    if ( _dns_cache_ttl == -1 )
-        set_dns_cache_ttl(1200);
-    else
-        set_dns_cache_ttl(_dns_cache_ttl);
-
-    set_protocol(_protocol);
-    set_hostname(_hostname);
-    set_login(_login);
-    set_password(_password);
-    set_logger(_logger);
-
-    // create http helper class
-    HTTPHelper::Ptr _http_help(new HTTPHelper(_logger,_proxy,_proxy_port,_login,_password));
-    HTTPHelp = _http_help;
-    _http_help.reset();
-
-    // extract domain part from hostname
-    list<string> host_domain_part = separate_domain_and_host_part(get_hostname());
-
-    string two_level_tld = get_two_level_tld(host_domain_part.back());
-    if ( !two_level_tld.empty() )
-        BaseUrl = assemble_base_url(get_hostname(),two_level_tld);
-    else
-        BaseUrl = assemble_base_url(get_hostname(),"");
-}
-
-
-/**
- * Default destructor
- */
-EASYDNS::~EASYDNS()
-{
-}
-
-
-/**
- * Tries to extract the two_level domain part if there is one
- * @param domain_part The complete domain part.
- * @return Two_level_domain part if there is one or "" if not so.
- */
-string EASYDNS::get_two_level_tld(const string& domain_part) const
-{
-    // TODO: There is a list with all two level TLD's, use it
-
-    // split the domain_part
-    list<string> domain_tokens;
-    ba::split(domain_tokens,domain_part,boost::is_any_of("."));
-
-    domain_tokens.pop_front();
-
-    if ( domain_tokens.size() > 1 )
-    {
-        string two_level_tld = domain_tokens.front();
-        domain_tokens.pop_front();
-
-        BOOST_FOREACH(string domain_part, domain_tokens)
-        {
-            two_level_tld.append(".");
-            two_level_tld.append(domain_part);
-        }
-
-        return two_level_tld;
-    }
-    else
-    {
-        return "";
-    }
-}
-
-
-/**
- * Assemble the easydns update url from the given hostname and domain part
- * @param hostname The hostname to update IP for.
- * @param domain_part The domain_part in which the hostname is located.
- * @return The assembled update url without IP.
- */
-string EASYDNS::assemble_base_url(const string& hostname, const string& two_level_tld) const
-{
-    string base_url;
-    if ( !two_level_tld.empty() )
-    {
-        base_url = "https://members.easydns.com";
-        base_url.append("/dyn/dyndns.php?hostname=");
-        base_url.append(hostname);
-        base_url.append("&tld=");
-        base_url.append(two_level_tld);
-        base_url.append("&myip=");
-    }
-    else
-    {
-        base_url = "https://members.easydns.com";
-        base_url.append("/dyn/dyndns.php?hostname=");
-        base_url.append(hostname);
-        base_url.append("&myip=");
-    }
-    return base_url;
-}
-
-
-/**
- * Separates the hostname from the domain part.
- * @param fqdn Hostname with domain part.
- * @return A list with 2 elements (first element is the hostname, second element the domain part), or a list with 1 element if the domain part couldn't be determined.
- */
-list<string> EASYDNS::separate_domain_and_host_part(const string& fqdn) const
-{
-    list<string> splitted;
-    ba::split(splitted,fqdn,boost::is_any_of("."));
-
-    if ( splitted.size() > 1 )
-    {
-        string host = splitted.front();
-        splitted.pop_front();
-
-        string domain = splitted.front();
-        splitted.pop_front();
-
-        BOOST_FOREACH(string domain_part, splitted)
-        {
-            domain.append(".");
-            domain.append(domain_part);
-        }
-
-        splitted.clear();
-        splitted.push_back(host);
-        splitted.push_back(domain);
-    }
-
-    return splitted;
-}
-
-
-/**
- * Performs the Service update.
- * @param ip IP Address to set.
- * @return 0 if all is fine, -1 otherwise.
- */
-int EASYDNS::perform_update(const std::string& ip)
-{
-    int ret_val = -1;
-
-    string url = BaseUrl;
-    url.append(ip);
-
-    long http_status_code = HTTPHelp->http_get(url);
-
-    get_logger()->print_http_status_code(url,http_status_code);
-
-    // HTTP operation completed successful.
-    // Now we have to parse the data received by curl,
-    // cause http status code is not significant for easydns update errors
-    if ( http_status_code == 200 )
-    {
-        // Get the received http data.
-        string curl_data = HTTPHelp->get_curl_data();
-
-        if ( curl_data == "NOERROR" )
-            ret_val = 0;
-        else if ( curl_data == "NOACCESS" )
-            get_logger()->print_http_not_authorized(url,get_login(),get_password());
-        else
-            get_logger()->print_update_failure(url, curl_data);
-    }
-
-    return ret_val;
-}
-
-
-/**
- * Serialize function needed by boost/serialization to define which members should be stored as the object state.
- * @param ar Archive
- * @param version Version
- */
-template<class Archive>
-void EASYDNS::serialize(Archive & ar, const unsigned int version)
-{
-    ar & boost::serialization::base_object<Service>(*this);
-}
diff --git a/src/easydns.h b/src/easydns.h
deleted file mode 100644 (file)
index 2e4fed7..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/** @file
- * @brief EASYDNS Service class header. This class represents the EASYDNS service.
- *
- *
- *
- * @copyright Intra2net AG
- * @license GPLv2
-*/
-
-#ifndef EASYDNS_H
-#define EASYDNS_H
-
-#include <string>
-
-#include "service.h"
-#include "logger.h"
-
-#include <boost/serialization/array.hpp>
-#include <boost/shared_ptr.hpp>
-#include <list>
-
-class EASYDNS : public Service
-{
-
-private:
-
-    friend class boost::serialization::access;
-    template<class Archive>
-    void serialize(Archive & ar, const unsigned int version);
-
-    std::string BaseUrl;
-
-    HTTPHelper::Ptr HTTPHelp;
-
-    std::list<std::string> separate_domain_and_host_part(const std::string& str) const;
-
-    std::string assemble_base_url(const std::string& hostname, const std::string& two_level_tld) const;
-
-    std::string get_two_level_tld(const std::string& domain_part) const;
-
-public:
-
-    typedef boost::shared_ptr<DYNDNS> Ptr;
-
-    EASYDNS();
-
-    EASYDNS(const std::string& _protocol, 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 dns_cache_ttl, const std::string& proxy, const int proxy_port);
-
-    ~EASYDNS();
-
-    int perform_update(const std::string& ip);
-
-};
-
-#endif
diff --git a/src/ods.cpp b/src/ods.cpp
deleted file mode 100644 (file)
index 1d02d54..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/** @file
- * @brief ODS Service class implementation. This class represents the ODS service.
- *
- *
- *
- * @copyright Intra2net AG
- * @license GPLv2
-*/
-
-#include "ods.h"
-
-#include <time.h>
-
-using namespace std;
-
-
-/**
- * Default Constructor, needed for object serialization.
- */
-ODS::ODS()
-{
-}
-
-
-/**
- * Constructor.
- * @param _hostname The hostname to update
- * @param _login The login name.
- * @param _password The corresponding password.
- */
-ODS::ODS(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)
-{
-    if ( _update_interval == -1 )        // If _update_interval is default po::option_desc (not specified via config)
-        set_update_interval(15);              // use default protocol value
-    else
-        set_update_interval(_update_interval);
-
-    if ( _max_updates_within_interval == -1 )
-        set_max_updates_within_interval(3);
-    else
-        set_max_updates_within_interval(_max_updates_within_interval);
-
-    if ( _dns_cache_ttl == -1 )
-        set_dns_cache_ttl(180);
-    else
-        set_dns_cache_ttl(_dns_cache_ttl);
-
-    set_protocol(_protocol);
-    set_hostname(_hostname);
-    set_login(_login);
-    set_password(_password);
-    set_logger(_logger);
-}
-
-
-/**
- * Default destructor.
- */
-ODS::~ODS()
-{
-}
-
-
-/**
- * Performs the Service update.
- * @param ip IP Address to set.
- * @return 0 if all is fine, -1 otherwise.
- */
-int ODS::perform_update(const std::string& ip)
-{
-    return 0;
-}
-
-
-/**
- * Serialize function needed by boost/serialization to define which members should be stored as the object state.
- * @param ar Archive
- * @param version Version
- */
-template<class Archive>
-void ODS::serialize(Archive & ar, const unsigned int version)
-{
-    ar & boost::serialization::base_object<Service>(*this);
-}
diff --git a/src/ods.h b/src/ods.h
deleted file mode 100644 (file)
index d2bf628..0000000
--- a/src/ods.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/** @file
- * @brief ODS Service class header. This class represents the ODS service.
- *
- *
- *
- * @copyright Intra2net AG
- * @license GPLv2
-*/
-
-#ifndef ODS_H
-#define ODS_H
-
-#include <string>
-
-#include "service.h"
-#include "logger.h"
-
-#include <boost/serialization/array.hpp>
-#include <boost/shared_ptr.hpp>
-
-
-class ODS : public Service
-{
-
-private:
-
-    friend class boost::serialization::access;
-    template<class Archive>
-    void serialize(Archive & ar, const unsigned int version);
-
-public:
-
-    typedef boost::shared_ptr<ODS> Ptr;
-
-    ODS();
-
-    ODS(const std::string& _protocol, 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 dns_cache_ttl);
-
-    ~ODS();
-
-    int perform_update(const std::string& ip);
-};
-
-#endif
diff --git a/src/tzo.cpp b/src/tzo.cpp
deleted file mode 100644 (file)
index d47a7bc..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/** @file
- * @brief DYNS Service class implementation. This class represents the DYNS service.
- *
- *
- *
- * @copyright Intra2net AG
- * @license GPLv2
-*/
-
-#include "tzo.h"
-
-#include <time.h>
-#include <boost/foreach.hpp>
-#include <boost/algorithm/string.hpp>
-
-namespace ba = boost::algorithm;
-
-using namespace std;
-
-
-/**
- * Default Constructor, needed for object serialization.
- */
-TZO::TZO()
-{
-}
-
-
-/**
- * Constructor.
- * @param _hostname The hostname to update
- * @param _login The login name.
- * @param _password The corresponding password.
- */
-TZO::TZO(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)
-{
-    if ( _update_interval == -1 )        // If _update_interval is default po::option_desc (not specified via config)
-        set_update_interval(0);              // use default protocol value
-    else
-        set_update_interval(_update_interval);
-
-    if ( _max_updates_within_interval == -1 )
-        set_max_updates_within_interval(0);
-    else
-        set_max_updates_within_interval(_max_updates_within_interval);
-
-    if ( _dns_cache_ttl == -1 )
-        set_dns_cache_ttl(60);
-    else
-        set_dns_cache_ttl(_dns_cache_ttl);
-
-    set_protocol(_protocol);
-    set_hostname(_hostname);
-    set_login(_login);
-    set_password(_password);
-    set_logger(_logger);
-
-    // create http helper class
-    HTTPHelper::Ptr _http_help(new HTTPHelper(_logger,_proxy,_proxy_port));
-    HTTPHelp = _http_help;
-    _http_help.reset();
-
-    BaseUrl = assemble_base_url(get_hostname(),get_login(),get_password());
-}
-
-
-/**
- * Default destructor
- */
-TZO::~TZO()
-{
-}
-
-
-/**
- * Assemble the dyns update url from the given fqhn
- * @param hostname The fqhn hostname to update IP for.
- * @param username The username to use.
- * @param hostname The password to use.
- * @return The assembled update url without IP.
- */
-string TZO::assemble_base_url(const string& fqhn, const string& username, const string& password) const
-{
-    string base_url;
-
-    base_url = "http://rh.tzo.com";
-    base_url.append("/webclient/tzoperl.html?system=tzodns&info=1&tzoname=");
-    base_url.append(fqhn);
-    base_url.append("&email=");
-    base_url.append(username);
-    base_url.append("&tzokey=");
-    base_url.append(password);
-    base_url.append("&ipaddress=");
-
-    return base_url;
-}
-
-
-/**
- * Performs the Service update.
- * @param ip IP Address to set.
- * @return 0 if all is fine, -1 otherwise.
- */
-int TZO::perform_update(const std::string& ip)
-{
-    int ret_val = -1;
-
-    string url = BaseUrl;
-    url.append(ip);
-
-    long http_status_code = HTTPHelp->http_get(url);
-
-    get_logger()->print_http_status_code(url,http_status_code);
-
-    // HTTP operation completed successful.
-    // Now we have to parse the data received by curl,
-    // cause http status code is not significant for dyns update errors
-    if ( http_status_code == 200 )
-    {
-        // Get the received http data and parse the status code.
-        string curl_data = HTTPHelp->get_curl_data();
-        string status_code = parse_status_code(curl_data);
-
-        if ( status_code == "200" )
-            ret_val = 0;
-        else if ( status_code == "401" )
-            get_logger()->print_http_not_authorized(url,get_login(),get_password());
-        else
-            get_logger()->print_update_failure(url,curl_data);
-    }
-
-    return ret_val;
-}
-
-
-/**
- * Get the status code from the returned http data
- * @param data The returned http data.
- * @return The status code.
- */
-string TZO::parse_status_code(const string& data) const
-{
-    list<string> tokens;
-    ba::split(tokens,data,boost::is_any_of(" "));
-    return tokens.front();
-}
-
-
-/**
- * Serialize function needed by boost/serialization to define which members should be stored as the object state.
- * @param ar Archive
- * @param version Version
- */
-template<class Archive>
-void TZO::serialize(Archive & ar, const unsigned int version)
-{
-    ar & boost::serialization::base_object<Service>(*this);
-}
diff --git a/src/tzo.h b/src/tzo.h
deleted file mode 100644 (file)
index 34cccd1..0000000
--- a/src/tzo.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/** @file
- * @brief DYNS Service class header. This class represents the DYNS service.
- *
- *
- *
- * @copyright Intra2net AG
- * @license GPLv2
-*/
-
-#ifndef TZO_H
-#define TZO_H
-
-#include <string>
-
-#include "service.h"
-#include "logger.h"
-
-#include <boost/serialization/array.hpp>
-#include <boost/shared_ptr.hpp>
-#include <list>
-
-class TZO : public Service
-{
-
-private:
-
-    friend class boost::serialization::access;
-    template<class Archive>
-    void serialize(Archive & ar, const unsigned int version);
-
-    std::string BaseUrl;
-
-    HTTPHelper::Ptr HTTPHelp;
-
-    std::string assemble_base_url(const std::string& fqhn, const std::string& username, const std::string& password) const;
-
-    std::string parse_status_code(const std::string& data) const;
-
-public:
-
-    typedef boost::shared_ptr<TZO> Ptr;
-
-    TZO();
-
-    TZO(const std::string& _protocol, 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 dns_cache_ttl, const std::string& proxy, const int proxy_port);
-
-    ~TZO();
-
-    int perform_update(const std::string& ip);
-};
-
-#endif
diff --git a/src/zoneedit.cpp b/src/zoneedit.cpp
deleted file mode 100644 (file)
index c4b3b2b..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/** @file
- * @brief DYNS Service class implementation. This class represents the DYNS service.
- *
- *
- *
- * @copyright Intra2net AG
- * @license GPLv2
-*/
-
-#include "zoneedit.h"
-
-#include <time.h>
-#include <boost/foreach.hpp>
-#include <boost/algorithm/string.hpp>
-
-namespace ba = boost::algorithm;
-
-using namespace std;
-
-
-/**
- * Default Constructor, needed for object serialization.
- */
-ZONEEDIT::ZONEEDIT()
-{
-}
-
-
-/**
- * Constructor.
- * @param _hostname The hostname to update
- * @param _login The login name.
- * @param _password The corresponding password.
- */
-ZONEEDIT::ZONEEDIT(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)
-{
-    if ( _update_interval == -1 )        // If _update_interval is default po::option_desc (not specified via config)
-        set_update_interval(0);              // use default protocol value
-    else
-        set_update_interval(_update_interval);
-
-    if ( _max_updates_within_interval == -1 )
-        set_max_updates_within_interval(0);
-    else
-        set_max_updates_within_interval(_max_updates_within_interval);
-
-    if ( _dns_cache_ttl == -1 )
-        set_dns_cache_ttl(60);
-    else
-        set_dns_cache_ttl(_dns_cache_ttl);
-
-    set_protocol(_protocol);
-    set_hostname(_hostname);
-    set_login(_login);
-    set_password(_password);
-    set_logger(_logger);
-
-    // create http helper class
-    HTTPHelper::Ptr _http_help(new HTTPHelper(_logger,_proxy,_proxy_port));
-    HTTPHelp = _http_help;
-    _http_help.reset();
-
-    BaseUrl = assemble_base_url(get_hostname());
-}
-
-
-/**
- * Default destructor
- */
-ZONEEDIT::~ZONEEDIT()
-{
-}
-
-
-/**
- * Assemble the zoneedit update url from the given fqhn
- * @param hostname The fqhn hostname to update IP for.
- * @return The assembled update url without IP.
- */
-string ZONEEDIT::assemble_base_url(const string& fqhn) const
-{
-    string base_url;
-
-    base_url = "http://dynamic.zoneedit.com";
-    base_url.append("/auth/dynamic.html?host=");
-    base_url.append(fqhn);
-    base_url.append("&dnsto=");
-
-    return base_url;
-}
-
-
-/**
- * Performs the Service update.
- * @param ip IP Address to set.
- * @return 0 if all is fine, -1 otherwise.
- */
-int ZONEEDIT::perform_update(const std::string& ip)
-{
-    int ret_val = -1;
-
-    string url = BaseUrl;
-    url.append(ip);
-
-    long http_status_code = HTTPHelp->http_get(url);
-
-    get_logger()->print_http_status_code(url,http_status_code);
-
-    // HTTP operation completed successful.
-    // Now we have to parse the data received by curl,
-    // cause http status code is not significant for dyns update errors
-    if ( http_status_code == 200 )
-    {
-        // Get the received http data and parse the status code.
-        string curl_data = HTTPHelp->get_curl_data();
-        string status_code = parse_status_code(curl_data);
-
-        if ( status_code == "200" )
-            ret_val = 0;
-        else
-            get_logger()->print_update_failure(url,curl_data);
-    }
-    else if ( http_status_code == 401 )
-        get_logger()->print_http_not_authorized(url,get_login(),get_password());
-    else
-        get_logger()->print_update_failure(url,http_status_code);
-
-    return ret_val;
-}
-
-
-/**
- * Get the status code from the returned http data
- * @param data The returned http data.
- * @return The status code.
- */
-string ZONEEDIT::parse_status_code(const string& data) const
-{
-    list<string> tokens;
-    ba::split(tokens,data,boost::is_any_of(" "));
-    return tokens.front();
-}
-
-
-/**
- * Serialize function needed by boost/serialization to define which members should be stored as the object state.
- * @param ar Archive
- * @param version Version
- */
-template<class Archive>
-void ZONEEDIT::serialize(Archive & ar, const unsigned int version)
-{
-    ar & boost::serialization::base_object<Service>(*this);
-}
diff --git a/src/zoneedit.h b/src/zoneedit.h
deleted file mode 100644 (file)
index c7c947b..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/** @file
- * @brief DYNS Service class header. This class represents the DYNS service.
- *
- *
- *
- * @copyright Intra2net AG
- * @license GPLv2
-*/
-
-#ifndef ZONEEDIT_H
-#define ZONEEDIT_H
-
-#include <string>
-
-#include "service.h"
-#include "logger.h"
-
-#include <boost/serialization/array.hpp>
-#include <boost/shared_ptr.hpp>
-#include <list>
-
-class ZONEEDIT : public Service
-{
-
-private:
-
-    friend class boost::serialization::access;
-    template<class Archive>
-    void serialize(Archive & ar, const unsigned int version);
-
-    std::string BaseUrl;
-
-    HTTPHelper::Ptr HTTPHelp;
-
-    std::string assemble_base_url(const std::string& fqhn) const;
-
-    std::string parse_status_code(const std::string& data) const;
-
-public:
-
-    typedef boost::shared_ptr<ZONEEDIT> Ptr;
-
-    ZONEEDIT();
-
-    ZONEEDIT(const std::string& _protocol, 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 dns_cache_ttl, const std::string& proxy, const int proxy_port);
-
-    ~ZONEEDIT();
-
-    int perform_update(const std::string& ip);
-};
-
-#endif