Verions is loaded from version_info.h.
po::options_description opt_desc_service("Service description options");
opt_desc_service.add_options()
("protocol",po::value<string>(),"The service protocol.")
- ("server",po::value<string>(),"Servername needed for gnudip protocol.")
+ ("server",po::value<string>(),"Servername needed for gnudip/dyndns protocol.")
("host",po::value<string>(),"The hostname to update.")
("login",po::value<string>(),"Login name.")
("password",po::value<string>(),"Corresponding password.")
}
else if(protocol == "dyndns")
{
- Service::Ptr service_dyndns(new ServiceDyndns(protocol,hostname,login,password,Log,update_interval,max_updates_within_interval,dns_cache_ttl,Proxy,ProxyPort));
+ Service::Ptr service_dyndns(new ServiceDyndns(protocol,hostname,login,password,Log,update_interval,max_updates_within_interval,dns_cache_ttl,Proxy,ProxyPort,server));
return service_dyndns;
}
else if(protocol == "dyns")
*/
#include "httphelper.hpp"
+#include "version_info.h"
using namespace std;
CURL* HTTPHelper::init_curl(string& curl_writedata_buff,char* curl_err_buff)
{
CurlInitError = CURLE_OK;
- string user_agent = "Intra2net AG - Bullet Proof DYNDNS Daemon - 0.1.1";
+ ostringstream user_agent_stream;
+ user_agent_stream << "Intra2net AG - Bullet Proof DYNDNS Daemon - " << MAJOR_VERSION << "." << MINOR_VERSION << endl;
+ string user_agent = user_agent_stream.str();
CURL *curl_easy_handle = curl_easy_init();
if ( curl_easy_handle == NULL )
* @param _login The login name.
* @param _password The corresponding password.
*/
-ServiceDyndns::ServiceDyndns(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)
+ServiceDyndns::ServiceDyndns(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, const string& _alternative_server)
+ : AlternativeServer(_alternative_server)
{
if ( _update_interval == -1 ) // If _update_interval is default po::option_desc (not specified via config)
set_update_interval(0); // use default protocol value
*/
string ServiceDyndns::assemble_base_url(const string& fqhn) const
{
- string base_url;
+ string base_url = "https://";
+
+ // Test if a AlternativeServer name is given, needed for e.g. NO-IP
+ if ( AlternativeServer.empty() )
+ base_url.append("members.dyndns.org");
+ else
+ base_url.append("dynupdate.no-ip.com");
- 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=");
ar & boost::serialization::base_object<Service>(*this);
}
+ std::string AlternativeServer; // Needed for NO-IP
std::string BaseUrl;
HTTPHelper::Ptr HTTPHelp;
ServiceDyndns();
- ServiceDyndns(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);
+ ServiceDyndns(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, const std::string& _alternative_server = "");
~ServiceDyndns();