{
// Some options could not be set, so destroy the CURL handle.
Log->print_curl_error_init("Could not set CURL options properly.",CurlError);
- curl_easy_cleanup(CurlEasyHandle);
+ curl_easy_cleanup(curl_easy_handle);
curl_easy_handle = NULL;
}
* @param outBuffer Pointer to output stream.
* @return The size received.
*/
-int HTTPHelper::http_receive( char *inBuffer, size_t size, size_t nmemb, string *outBuffer )
+size_t HTTPHelper::http_receive( const char *inBuffer, size_t size, size_t nmemb, string *outBuffer )
{
outBuffer->append(inBuffer);
return (size*nmemb);
bool is_initialized();
// libcurl is a C library, so we have to make the callback member function static :-(
- static int http_receive(char *inBuffer, size_t size, size_t nmemb, std::string *outBuffer);
+ static size_t http_receive(const char *inBuffer, size_t size, size_t nmemb, std::string *outBuffer);
};
#endif
* Get the IP address of the local wan interface if there is one.
* @return The IP address of the wan interface or an empty string if something went wrong.
*/
-string IPAddrHelper::get_local_wan_nic_ip()
+string IPAddrHelper::get_local_wan_nic_ip() const
{
struct ifaddrs *if_addr_struct, *ifa;
- int address_family, ret_val;
+ unsigned short address_family;
+ int ret_val;
char ip_addr_buff[NI_MAXHOST];
list<string> external_ipv4_addresses;
list<string> external_ipv6_addresses;
Log->print_ip_is_local(ipv4_addr);
}
// If it is an IPv6 address and IPv6 is enabled then process further.
- else if ( (address_family == AF_INET6) && (UseIPv6 == true) )
+ else if ( (address_family == AF_INET6) && (UseIPv6) )
{
// Translate the address to a protocol independent representation (dottet format). Copy address into ip_addr_buff.
ret_val = getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in6), ip_addr_buff, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
freeifaddrs(if_addr_struct);
// Return the first element in IPv6 list if IPv6 is enabled, otherwise return first element in IPv4 list.
- if ( (UseIPv6 == true) && (!external_ipv6_addresses.empty()) )
+ if ( (UseIPv6) && (!external_ipv6_addresses.empty()) )
return external_ipv6_addresses.front();
else if ( !external_ipv4_addresses.empty() )
return external_ipv4_addresses.front();
Log->print_ip_is_local(ipv4_addr);
}
// Test if it is a IPv6 address and if IPv6 is enabled.
- else if ( (ip.is_v6()) && (UseIPv6 == true) )
+ else if ( (ip.is_v6()) && (UseIPv6) )
{
// Get the string representation.
string ipv6_addr = ip.to_string();
}
io_service.reset();
}
- catch(exception& e)
+ catch(const exception& e)
{
Log->print_error_hostname_to_ip(e.what(),hostname);
return "";
}
// Return the first element in IPv6 list if IPv6 is enabled, otherwise return first element in IPv4 list.
- if ( (UseIPv6 == true) && (!external_ipv6_addresses.empty()) )
+ if ( (UseIPv6) && (!external_ipv6_addresses.empty()) )
return external_ipv6_addresses.front();
else if ( !external_ipv4_addresses.empty() )
return external_ipv4_addresses.front();
string ip_addr = "";
// Get the current time.
- int current_time = time(NULL);
+ time_t current_time = time(NULL);
// Test if webcheck is allowed due to webcheck_interval.
if ( (LastWebcheck + (WebcheckInterval*60)) >= current_time )
// Init CURL
CURL * curl_easy_handle = init_curl(curl_writedata_buff,curl_err_buff);
+ if ( curl_easy_handle == NULL )
+ {
+ return "";
+ }
// If perform_curl_operation returns a connection problem indicating return code, try the next ip webcheck url if there is one.
while ( (curl_err_code == 1) && (url_list.size() != 0) && (url_list.front() != "") )
* @param actual_url The actual configured URL.
* @return 0 if all is fine, 1 if an connection problem to the configured url occurs, -1 on other errors.
*/
-int IPAddrHelper::perform_curl_operation(CURL * curl_easy_handle, char* curl_err_buff, const string& actual_url) const
+int IPAddrHelper::perform_curl_operation(CURL * curl_easy_handle, const char* curl_err_buff, const string& actual_url) const
{
- int curl_err_code;
- if ( (curl_err_code = curl_easy_perform(curl_easy_handle) ) != 0 )
+ CURLcode curl_err_code;
+ if ( (curl_err_code = curl_easy_perform(curl_easy_handle) ) != CURLE_OK )
{
// CURL error occured
if ( (curl_err_code == CURLE_COULDNT_CONNECT) || (curl_err_code == CURLE_OPERATION_TIMEOUTED) || (curl_err_code == CURLE_COULDNT_RESOLVE_HOST) )
*/
CURL * IPAddrHelper::init_curl(string& curl_writedata_buff,char* curl_err_buff) const
{
+ string user_agent = "Bullet Proof DYNDNS Daemon 0.1.1 - Intra2net AG 2009";
+
CURL *curl_easy_handle = curl_easy_init();
+ if ( curl_easy_handle == NULL )
+ {
+ // something went wrong.
+ Log->print_curl_error_init("Could not initialize CURL object.",CURLE_FAILED_INIT);
+ return NULL;
+ }
- curl_easy_setopt(curl_easy_handle,CURLOPT_NOPROGRESS,1);
- curl_easy_setopt(curl_easy_handle,CURLOPT_CONNECTTIMEOUT,5);
- curl_easy_setopt(curl_easy_handle,CURLOPT_TIMEOUT,10);
- curl_easy_setopt(curl_easy_handle,CURLOPT_BUFFERSIZE,1024);
- curl_easy_setopt(curl_easy_handle,CURLOPT_ERRORBUFFER,curl_err_buff);
- curl_easy_setopt(curl_easy_handle,CURLOPT_WRITEFUNCTION,http_receive);
- curl_easy_setopt(curl_easy_handle,CURLOPT_WRITEDATA,&curl_writedata_buff);
+ CURLcode curlError = CURLE_OK;
+
+ if ( curlError == CURLE_OK )
+ curlError = curl_easy_setopt(curl_easy_handle,CURLOPT_NOPROGRESS,1);
+ if ( curlError == CURLE_OK)
+ curlError = curl_easy_setopt(curl_easy_handle,CURLOPT_CONNECTTIMEOUT,5);
+ if ( curlError == CURLE_OK)
+ curlError = curl_easy_setopt(curl_easy_handle,CURLOPT_TIMEOUT,10);
+ if ( curlError == CURLE_OK)
+ curlError = curl_easy_setopt(curl_easy_handle,CURLOPT_BUFFERSIZE,1024);
+ if ( curlError == CURLE_OK)
+ curlError = curl_easy_setopt(curl_easy_handle,CURLOPT_ERRORBUFFER,curl_err_buff);
+ if ( curlError == CURLE_OK)
+ curlError = curl_easy_setopt(curl_easy_handle,CURLOPT_WRITEFUNCTION,http_receive);
+ if ( curlError == CURLE_OK)
+ curlError = curl_easy_setopt(curl_easy_handle,CURLOPT_WRITEDATA,&curl_writedata_buff);
+ if ( curlError == CURLE_OK)
+ curlError = curl_easy_setopt(curl_easy_handle,CURLOPT_USERAGENT,&user_agent);
if ( !Proxy.empty() )
{
- curl_easy_setopt(curl_easy_handle,CURLOPT_PROXY,Proxy.c_str());
- curl_easy_setopt(curl_easy_handle,CURLOPT_PROXYPORT,ProxyPort);
+ if ( curlError == CURLE_OK)
+ curlError = curl_easy_setopt(curl_easy_handle,CURLOPT_PROXY,Proxy.c_str());
+ if ( curlError == CURLE_OK)
+ curlError = curl_easy_setopt(curl_easy_handle,CURLOPT_PROXYPORT,ProxyPort);
+ }
+
+ if ( curlError != CURLE_OK )
+ {
+ // Some options could not be set, so destroy the CURL handle.
+ Log->print_curl_error_init("Could not set CURL options properly.",curlError);
+ curl_easy_cleanup(curl_easy_handle);
+ curl_easy_handle = NULL;
}
return curl_easy_handle;
* @param outBuffer Pointer to output stream.
* @return The size received.
*/
-int IPAddrHelper::http_receive( char *inBuffer, size_t size, size_t nmemb, string *outBuffer )
+size_t IPAddrHelper::http_receive( const char *inBuffer, size_t size, size_t nmemb, string *outBuffer )
{
outBuffer->append(inBuffer);
return (size*nmemb);
bool is_local_ipv6(const std::string ip) const;
std::string webcheck_ip();
CURL * init_curl(std::string& curl_writedata_buff, char* curl_err_buff) const;
- int perform_curl_operation(CURL * curl_easy_handle, char* curl_err_buff, const std::string& actual_url) const;
+ int perform_curl_operation(CURL * curl_easy_handle, const char* curl_err_buff, const std::string& actual_url) const;
std::string parse_ipv4(const std::string& data) const;
public:
std::string get_actual_ip();
- std::string get_local_wan_nic_ip();
+ std::string get_local_wan_nic_ip() const;
// libcurl is a C library, so we have to make the callback member function static :-(
- static int http_receive(char *inBuffer, size_t size, size_t nmemb, std::string *outBuffer);
+ static size_t http_receive(const char *inBuffer, size_t size, size_t nmemb, std::string *outBuffer);
void set_curl_url(CURL * curl_easy_handle, const std::string& url) const;
* Decides if Logging through syslog if enabled or through std.
* @param msg The message to log.
*/
-void Logger::log_notice(const string& msg, int level) const
+void Logger::log_notice(const string& msg) const
{
if ( Syslog )
syslog(LOG_NOTICE,msg.c_str());
* Decides if Logging through syslog if enabled or through std.
* @param msg The message to log.
*/
-void Logger::log_error(const string& msg, int level) const
+void Logger::log_error(const string& msg) const
{
if ( Syslog )
syslog(LOG_ERR,msg.c_str());
ostringstream msg;
msg << "Usage: bpdyndnsd [Command line options]" << "\n" << endl;
msg << *opt_desc << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Bullet proof dynamic dns daemon.\nbpdyndnsd " << VERSION << "." << REVISION << "." << RELEASE << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
int level = 1;
if ( level <= Loglevel )
{
- log_notice("Command line options successfully parsed.",level);
+ log_notice("Command line options successfully parsed.");
}
}
int level = 1;
if ( level <= Loglevel )
{
- log_notice("Config files successfully parsed.",level);
+ log_notice("Config files successfully parsed.");
}
}
{
ostringstream msg;
msg << "Config files successfully loaded in: " << config_path << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Config files couldn't be loaded in: " << config_path << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
{
ostringstream msg;
msg << "Error opening file for reading: " << filename << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
{
ostringstream msg;
msg << "Error opening file for writing: " << filename << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
{
ostringstream msg;
msg << "Destructor call: " << _class << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Constructor call: " << _class << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Running update for service: " << service << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Unknown option on command line detected: " << unknown_option << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
{
ostringstream msg;
msg << "Unknown protocol defined: " << protocol << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
{
ostringstream msg;
msg << "Loading service config file: " << filename << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Loading main config file: " << filename << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Unknown option in service config file detected: " << service_conf_file << " Unknown option: " << unknown_option << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
{
ostringstream msg;
msg << "Unknown option in main config file detected: " << unknown_option << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
{
ostringstream msg;
msg << "Config path doesn't exists or is not a diretory: " << config_path << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
int level = 0;
if ( level <= Loglevel )
{
- log_error("Missing option to initialize service. Protocol, host, login and password must be specified.",level);
+ log_error("Missing option to initialize service. Protocol, host, login and password must be specified.");
}
}
{
ostringstream msg;
msg << "Missing option in service config file " << service_conf_file << " to initialize service. Protocol, host, login and password must be specified." << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
{
ostringstream msg;
msg << "Runnig as daemon: " << pid << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
mode = "enabled";
ostringstream msg;
msg << "Daemon mode is " << mode << "." << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
int level = 0;
if ( level <= Loglevel )
{
- log_error("Error while trying to fork.",level);
+ log_error("Error while trying to fork.");
}
}
{
ostringstream msg;
msg << "Pidfile found: " << pid << ". Checking if process is still runnig..." << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Another bpdyndnsd process with PID " << pid << " is already running!" << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
int level = 0;
if ( level <= Loglevel )
{
- log_notice("Caught SIGTERM. Exiting...",level);
+ log_notice("Caught SIGTERM. Exiting...");
}
}
int level = 0;
if ( level <= Loglevel )
{
- log_notice("Caught SIGUSR1. Switching to offline mode...",level);
+ log_notice("Caught SIGUSR1. Switching to offline mode...");
}
}
int level = 1;
if ( level <= Loglevel )
{
- log_notice("Caught SIGHUP. Reloading config and switching to online mode...",level);
+ log_notice("Caught SIGHUP. Reloading config and switching to online mode...");
}
}
{
ostringstream msg;
msg << "Error while setting signal handler for: " << signal << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
{
ostringstream msg;
msg << "Initialized logging facility." << " Loglevel: " << Loglevel << " Syslog: " << Syslog << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
int level = 0;
if ( level <= Loglevel )
{
- log_notice("Offline mode...",level);
+ log_notice("Offline mode...");
}
}
int level = 1;
if ( level <= Loglevel )
{
- log_notice("Serialized objects successfully.",level);
+ log_notice("Serialized objects successfully.");
}
}
int level = 1;
if ( level <= Loglevel )
{
- log_notice("De-serialized objects successfully.",level);
+ log_notice("De-serialized objects successfully.");
}
}
{
msg << "\t" << "Lastupdated: " << update_time << endl;
}
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
* Caught exception while serialize.
* @param exception Exception message.
*/
-void Logger::print_exception_serialize(const string& exception) const
+void Logger::print_exception_serialize(const string& errMsg) const
{
int level = 0;
if ( level <= Loglevel )
{
ostringstream msg;
- msg << "Error while trying to serialize Serviceholder object: " << exception << endl;
- log_error(msg.str(),level);
+ msg << "Error while trying to serialize Serviceholder object: " << errMsg << endl;
+ log_error(msg.str());
}
}
* Caught exception while de-serialize.
* @param exception Exception message.
*/
-void Logger::print_exception_deserialize(const string& exception) const
+void Logger::print_exception_deserialize(const string& errMsg) const
{
int level = 0;
if ( level <= Loglevel )
{
ostringstream msg;
- msg << "Error while trying to de-serialize Serviceholder object: " << exception << endl;
- log_error(msg.str(),level);
+ msg << "Error while trying to de-serialize Serviceholder object: " << errMsg << endl;
+ log_error(msg.str());
}
}
{
ostringstream msg;
msg << "Could not kill child process with PID: " << pid << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
{
ostringstream msg;
msg << "Killed child process with PID: " << pid << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Detected following hostname of localhost: " << hostname << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Detected following IPv4-Address of host: " << hostname << " : " << ip_addr_v4 << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Detected following IPv6-Address of host: " << hostname << " : " << ip_addr_v6 << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
* @param exception The exception caught.
* @param hostname The hostname.
*/
-void Logger::print_error_hostname_to_ip(const string& exception, const string& hostname) const
+void Logger::print_error_hostname_to_ip(const string& errMsg, const string& hostname) const
{
int level = 0;
if ( level <= Loglevel )
{
ostringstream msg;
- msg << "Could not resolve the hostname: " << hostname << " to an IP-Address: " << exception << endl;
+ msg << "Could not resolve the hostname: " << hostname << " to an IP-Address: " << errMsg << endl;
log_warning(msg.str(),level);
}
}
{
ostringstream msg;
msg << "Updated service successful: " << service << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "There was an error while trying to connect to following URL: " << url << " CURL error: " << curl_err_buff << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
{
ostringstream msg;
msg << "Received CURL data: " << curl_data << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Found IP-Address via regex: " << ip << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "The same option is only allowed once: " << message << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
int level = 0;
if ( level <= Loglevel )
{
- log_notice("Shutting down ...",level);
+ log_notice("Shutting down ...");
}
}
int level = 0;
if ( level <= Loglevel )
{
- log_notice("Shutting down complete ...",level);
+ log_notice("Shutting down complete ...");
}
}
int level = 0;
if ( level <= Loglevel )
{
- log_notice("Shutting down parent process completed ...",level);
+ log_notice("Shutting down parent process completed ...");
}
}
int level = 0;
if ( level <= Loglevel )
{
- log_notice("Shutting down parent process ...",level);
+ log_notice("Shutting down parent process ...");
}
}
{
ostringstream msg;
msg << "DNS cache record for host <" << hostname << "> expired or host will be updated for the first time: Lastupdated: " << lastupdated << " DNS cache ttl: " << dns_cache_ttl << " Current time: " << current_time << " Checking current DNS cache status." << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
int level = 0;
if ( level <= Loglevel )
{
- log_error("Missing option to initialize proxy. http_proxy and http_proxy_port must be specified.",level);
+ log_error("Missing option to initialize proxy. http_proxy and http_proxy_port must be specified.");
}
}
{
ostringstream msg;
msg << "Multiple occurrences of the same option in service config file detected: " << service_conf_file << " " << message << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
{
ostringstream msg;
msg << "Multiple occurrences of the same option in main config file detected: " << main_conf_file << " " << message << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
{
ostringstream msg;
msg << "Missing option to initialize proxy in main config file: " << main_conf_filename << " http_proxy and http_proxy_port must be specified." << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
{
ostringstream msg;
msg << "There is no domain part in the given hostname: " << hostname << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Curl error: " << msg << " Curl error code: " << curl_err_code << " "<< curl_err << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
{
ostringstream msg;
msg << "Data received by curl: " << curl_writedata_buff << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Requested URL: " << url << " Received HTTP status code: " << http_code << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Regex: " << regex << " is matching in: " << matching_string << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "An exception occured while computing a md5 sum: " << what << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
{
ostringstream msg;
msg << "An netowrk exception occured: " << what << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
{
ostringstream msg;
msg << "An undefined protocol error occured. Protocol: " << protocol << " Error: " << error << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
{
ostringstream msg;
msg << "Error while trying to log through external program: " << external_prog << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Error while parsing config file: " << filename << " Error: " << error << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Error while parsing cmd options: " << error << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
* @param webcheck_interval Webcheck interval time.
* @param current_time Current system time.
*/
-void Logger::print_webcheck_exceed_interval( const int last_webcheck, const int webcheck_interval, const int current_time ) const
+void Logger::print_webcheck_exceed_interval( const int last_webcheck, const int webcheck_interval, const time_t current_time ) const
{
int level = 0;
if ( level <= Loglevel )
{
ostringstream msg;
msg << "Exceeding webcheck interval: LastWebcheck " << last_webcheck << " + WebcheckInterval(sec) " << webcheck_interval << " >= CurrentTime " << current_time << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Checking if host: " << hostname << " needs update. Current time: " << current_time << " Last updated: " << lastupdated << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Cached DNS record for host <" << hostname << "> : " << ip_dns_recheck << " Last updated IP: " << ip_last_update << " Hosts IP: " << ip_host << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Updating service for the first time. Hostname: " << hostname << " DNS-Record: " << ip_dns_recheck << " Hosts IP: " << ip_host << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Updating service. Hostname: " << hostname << " DNS-Record: " << ip_dns_recheck << " IP set in last update: " << ip_last_update << " Lastupdated: " << lastupdated << " Hosts IP: " << ip_host << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "TTL for service expired and still pointing to old IP. Hostname: " << hostname << " DNS-Record: " << ip_dns_recheck << " IP set in last update: " << ip_last_update << " Lastupdated: " << lastupdated << "DNS Cache TTL: " << dns_cache_ttl << " Current Time: " << current_time << " Hosts IP: " << ip_host << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Waiting for DNS cache TTL to expire. Hostname: " << hostname << " DNS-Record: " << ip_dns_recheck << " IP set in last update: " << ip_last_update << " Lastupdated: " << lastupdated << "DNS Cache TTL: " << dns_cache_ttl << " Current Time: " << current_time << " Hosts IP: " << ip_host << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "No update needed for host: " << hostname << " Cached DNS record: " << ip_dns_recheck << " IP set in last update: " << ip_last_update << " Hosts IP: " << ip_host << " Last updated: " << lastupdated << endl;
- log_notice(msg.str(),level);
+ log_notice(msg.str());
}
}
{
ostringstream msg;
msg << "Error while trying to get local wan interface IP address through '" << system_call << "': " << error << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
{
ostringstream msg;
msg << "Could not get IP address of local wan interface." << endl;
- log_error(msg.str(),level);
+ log_error(msg.str());
}
}
~Logger();
- void log_notice(const std::string& msg, int loglevel) const;
+ void log_notice(const std::string& msg) const;
void log_warning(const std::string& msg, int loglevel) const;
- void log_error(const std::string& msg, int loglevel) const;
+ void log_error(const std::string& msg) const;
void set_loglevel(const int _loglevel);
void print_service_object(const std::string& message, const std::string& protocol, const std::string& hostname, const std::string& login, const std::string& password, const int update_interval, const int max_updates_within_interval, const int dns_cache_ttl , const std::string& actual_ip, std::list<int> lastupdated) const;
- void print_exception_serialize(const std::string& exception) const;
+ void print_exception_serialize(const std::string& errMsg) const;
- void print_exception_deserialize(const std::string& exception) const;
+ void print_exception_deserialize(const std::string& errMsg) const;
void print_error_kill_child(const int pid) const;
void print_own_ipv6(const std::string& ip_addr_v6, const std::string& hostname) const;
- void print_error_hostname_to_ip(const std::string& exception, const std::string& hostname) const;
+ void print_error_hostname_to_ip(const std::string& errMsg, const std::string& hostname) const;
void print_update_service_successful(const std::string& service) const;
void print_error_parsing_cmd(const std::string& error) const;
- void print_webcheck_exceed_interval( const int last_webcheck, const int webcheck_interval, const int current_time ) const;
+ void print_webcheck_exceed_interval( const int last_webcheck, const int webcheck_interval, const time_t current_time ) const;
void print_check_service_update(const std::string& hostname, const int current_time, const int lastupdated) const;
set_logger(_logger);
// create http helper class
- HTTPHelper::Ptr _http_help(new HTTPHelper(_logger,_proxy,_proxy_port,_login,_password));
- HTTPHelp.swap(_http_help);
+ HTTPHelp = HTTPHelper::Ptr(new HTTPHelper(_logger,_proxy,_proxy_port,_login,_password));
BaseUrl = assemble_base_url(get_hostname());
}
set_logger(_logger);
// create http helper class
- HTTPHelper::Ptr _http_help(new HTTPHelper(_logger,_proxy,_proxy_port));
- HTTPHelp.swap(_http_help);
+ HTTPHelp = HTTPHelper::Ptr(new HTTPHelper(_logger,_proxy,_proxy_port));
BaseUrl = assemble_base_url(get_hostname(),get_login(),get_password());
}
set_logger(_logger);
// create http helper class
- HTTPHelper::Ptr _http_help(new HTTPHelper(_logger,_proxy,_proxy_port,_login,_password));
- HTTPHelp.swap(_http_help);
- //HTTPHelp = HTTPHelper::Ptr(new HTTPHelper(_logger,_proxy,_proxy_port,_login,_password));
+ HTTPHelp = HTTPHelper::Ptr(new HTTPHelper(_logger,_proxy,_proxy_port,_login,_password));
// extract domain part from hostname
list<string> host_domain_part = separate_domain_and_host_part(get_hostname());
set_logger(_logger);
// create http helper class
- HTTPHelper::Ptr _http_help(new HTTPHelper(_logger,_proxy,_proxy_port,_login,_password));
- HTTPHelp.swap(_http_help);
+ HTTPHelp = HTTPHelper::Ptr(new HTTPHelper(_logger,_proxy,_proxy_port,_login,_password));
BaseUrl = assemble_base_url(get_hostname(),_gnudip_server);
}
set_logger(_logger);
// create http helper class
- HTTPHelper::Ptr _http_help(new HTTPHelper(_logger,_proxy,_proxy_port));
- HTTPHelp.swap(_http_help);
+ HTTPHelp = HTTPHelper::Ptr(new HTTPHelper(_logger,_proxy,_proxy_port));
BaseUrl = assemble_base_url(get_hostname(),get_login(),get_password());
}
set_logger(_logger);
// create http helper class
- HTTPHelper::Ptr _http_help(new HTTPHelper(_logger,_proxy,_proxy_port));
- HTTPHelp.swap(_http_help);
+ HTTPHelp = HTTPHelper::Ptr(new HTTPHelper(_logger,_proxy,_proxy_port));
BaseUrl = assemble_base_url(get_hostname());
}