-emacro(121, BOOST_CLASS_EXPORT_GUID)
-esym(1024, boost::lexical_cast)
-esym(534, boost::program_options::options_description_easy_init::operator*)
+-esym(1793, boost::program_options::options_description_easy_init::operator*)
-esym(534, boost::algorithm::split)
-esym(534, boost::program_options::options_description::add)
// Don't complain about redeclaration of Service::serialize
-esym(1511, Service::serialize)
+
+// Don't complain about absent assignment operator in class Config, HTTPHelper, IPAddrHelper
+-esym(1732, Config)
+-esym(1732, HTTPHelper)
+-esym(1732, IPAddrHelper)
+-esym(1732, NetHelper)
+-esym(1732, Service)
+-esym(1732, ServiceDhs)
+-esym(1732, ServiceDyndns)
+-esym(1732, ServiceDyns)
+-esym(1732, ServiceEasydns)
+-esym(1732, ServiceGnudip)
+-esym(1732, Serviceholder)
+-esym(1732, ServiceTzo)
+-esym(1732, ServiceZoneedit)
+-esym(1732, Updater)
+-esym(1732, Logger)
+-esym(1733, Config)
+-esym(1733, HTTPHelper)
+-esym(1733, IPAddrHelper)
+-esym(1733, NetHelper)
+-esym(1733, Service)
+-esym(1733, ServiceDhs)
+-esym(1733, ServiceDyndns)
+-esym(1733, ServiceDyns)
+-esym(1733, ServiceEasydns)
+-esym(1733, ServiceGnudip)
+-esym(1733, Serviceholder)
+-esym(1733, ServiceTzo)
+-esym(1733, ServiceZoneedit)
+-esym(1733, Updater)
+-esym(1733, Logger)
\ No newline at end of file
ExternalWarningLevel = VariablesMap["external_warning_level"].as<int>();
}
- catch( po::unknown_option& e )
+ catch( const po::unknown_option& e )
{
Log->print_unknown_cmd_option(e.what());
Log->print_usage(OptDescCmd);
return -1;
}
- catch( po::multiple_occurrences& e )
+ catch( const po::multiple_occurrences& e )
{
Log->print_multiple_cmd_option(e.what());
Log->print_usage(OptDescCmd);
return -1;
}
- catch( po::error& e )
+ catch( const po::error& e )
{
Log->print_error_parsing_cmd(e.what());
Log->print_usage(OptDescCmd);
return -1;
}
}
- catch ( po::unknown_option& e )
+ catch( const po::unknown_option& e )
{
// unknown option in config file detected
service_config_file.close();
Log->print_unknown_service_conf_option(full_filename,e.what());
return -1;
}
- catch( po::multiple_occurrences& e )
+ catch( const po::multiple_occurrences& e )
{
service_config_file.close();
Log->print_multiple_service_conf_option(full_filename,e.what());
return -1;
}
- catch( po::error& e )
+ catch( const po::error& e )
{
service_config_file.close();
Log->print_error_parsing_config_file(full_filename,e.what());
ExternalWarningLevel = VariablesMap["external_warning_level"].as<int>();
}
- catch ( po::unknown_option& e ) // at the moment 04-08-2009 this exception is never thrown :-(
+ catch( const po::unknown_option& e ) // at the moment 04-08-2009 this exception is never thrown :-(
{
// unknown option in main config file detected
main_config_file.close();
Log->print_unknown_main_conf_option(e.what());
return -1;
}
- catch(po::multiple_occurrences& e)
+ catch( const po::multiple_occurrences& e )
{
main_config_file.close();
Log->print_multiple_main_conf_option(full_filename,e.what());
* Test if the curl handle is initialized correctly.
* @return True if correctly initialized, false if something went wrong during initialization.
*/
-bool HTTPHelper::is_initialized()
+bool HTTPHelper::is_initialized() const
{
if ( (CurlError == CURLE_OK) && (CurlEasyHandle != NULL) )
{
std::string get_curl_data() const;
- bool is_initialized();
+ bool is_initialized() const;
// libcurl is a C library, so we have to make the callback member function static :-(
static size_t http_receive(const char *inBuffer, size_t size, size_t nmemb, std::string *outBuffer);
/**
* Constructor.
*/
-IPAddrHelper::IPAddrHelper(const Logger::Ptr _log, const string& _webcheck_url, const string& _webcheck_url_alt, const int _webcheck_interval, const int _last_webcheck ,const bool _use_ipv6, const string& _proxy, const int _proxy_port)
+IPAddrHelper::IPAddrHelper(const Logger::Ptr _log, const string& _webcheck_url, const string& _webcheck_url_alt, const int _webcheck_interval, const time_t _last_webcheck ,const bool _use_ipv6, const string& _proxy, const int _proxy_port)
: Log(_log)
, WebcheckIpUrl(_webcheck_url)
, WebcheckIpUrlAlt(_webcheck_url_alt)
if ( address_family == AF_INET )
{
// 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_in), ip_addr_buff, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
+ ret_val = getnameinfo(ifa->ifa_addr, (socklen_t)sizeof(struct sockaddr_in), ip_addr_buff, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
if ( ret_val != 0 )
{
Log->print_error_getting_local_wan_ip("getnameinfo", gai_strerror(ret_val));
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);
+ ret_val = getnameinfo(ifa->ifa_addr, (socklen_t)sizeof(struct sockaddr_in6), ip_addr_buff, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
if ( ret_val != 0 )
{
Log->print_error_getting_local_wan_ip("getnameinfo", gai_strerror(ret_val));
return NULL;
}
- CURLcode curlError = CURLE_OK;
-
- if ( curlError == CURLE_OK )
- curlError = curl_easy_setopt(curl_easy_handle,CURLOPT_NOPROGRESS,1);
+ CURLcode 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)
* Get member LastWebcheck
* @return LastWebcheck
*/
-int IPAddrHelper::get_last_webcheck() const
+time_t IPAddrHelper::get_last_webcheck() const
{
return LastWebcheck;
}
IPAddrHelper();
- IPAddrHelper(const Logger::Ptr _log, const std::string& _webcheck_url, const std::string& _webcheck_url_alt, const int _webcheck_interval, const int _last_webcheck, const bool _use_ipv6, const std::string& _proxy, const int _proxy_port);
+ IPAddrHelper(const Logger::Ptr _log, const std::string& _webcheck_url, const std::string& _webcheck_url_alt, const int _webcheck_interval, const time_t _last_webcheck, const bool _use_ipv6, const std::string& _proxy, const int _proxy_port);
~IPAddrHelper();
// libcurl is a C library, so we have to make the callback member function static :-(
static size_t http_receive(const char *inBuffer, size_t size, size_t nmemb, std::string *outBuffer);
- int get_last_webcheck() const;
+ time_t get_last_webcheck() const;
};
#endif
* @param MaxUpdatesWithinInterval Number of allowed updates in one update interval.
* @param service The service which exceeds update interval.
*/
-void Logger::print_update_not_allowed(const int current_time, const int old_time, const int MaxUpdatesWithinInterval, const string& service) const
+void Logger::print_update_not_allowed(const time_t current_time, const time_t old_time, const int MaxUpdatesWithinInterval, const string& service) const
{
int level = 1;
if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
* @param ip_host Hosts IP
* @param lastupdated Lastupdated
*/
-void Logger::print_update_service(const string& hostname, const string& ip_dns_recheck, const string& ip_last_update, const string& ip_host, const int lastupdated) const{
+void Logger::print_update_service(const string& hostname, const string& ip_dns_recheck, const string& ip_last_update, const string& ip_host, const time_t lastupdated) const{
int level = 1;
if ( level <= Loglevel )
{
* @param dns_cache_ttl DNS cache ttl
* @param current_time Current time
*/
-void Logger::print_update_service_ttl_expired(const string& hostname, const string& ip_dns_recheck, const string& ip_last_update, const string& ip_host, const int lastupdated, const int dns_cache_ttl, const int current_time) const
+void Logger::print_update_service_ttl_expired(const string& hostname, const string& ip_dns_recheck, const string& ip_last_update, const string& ip_host, const time_t lastupdated, const int dns_cache_ttl, const time_t current_time) const
{
int level = 1;
if ( level <= Loglevel )
* @param dns_cache_ttl DNS cache ttl
* @param current_time Current time
*/
-void Logger::print_update_service_ttl_not_expired(const string& hostname, const string& ip_dns_recheck, const string& ip_last_update, const string& ip_host, const int lastupdated, const int dns_cache_ttl, const int current_time) const
+void Logger::print_update_service_ttl_not_expired(const string& hostname, const string& ip_dns_recheck, const string& ip_last_update, const string& ip_host, const time_t lastupdated, const int dns_cache_ttl, const time_t current_time) const
{
int level = 1;
if ( level <= Loglevel )
* @param ip_host Hosts IP
* @param lastupdated Last updated
*/
-void Logger::print_no_update_needed(const string& hostname, const string& ip_dns_recheck, const string& ip_last_update, const string& ip_host, const int lastupdated) const
+void Logger::print_no_update_needed(const string& hostname, const string& ip_dns_recheck, const string& ip_last_update, const string& ip_host, const time_t lastupdated) const
{
int level = 1;
if ( level <= Loglevel )
void print_multiple_main_conf_option(const std::string& main_conf_file, const std::string& message) const;
- void print_update_not_allowed(const int current_time, const int old_time, const int MaxUpdatesWithinInterval, const std::string& service) const;
+ void print_update_not_allowed(const time_t current_time, const time_t old_time, const int MaxUpdatesWithinInterval, const std::string& service) const;
void print_update_service_failure(const std::string& service) const;
void print_update_service_firttime(const std::string& hostname, const std::string& ip_dns_recheck, const std::string& ip_host) const;
- void print_update_service(const std::string& hostname, const std::string& ip_dns_recheck, const std::string& ip_last_update, const std::string& ip_host, const int lastupdated) const;
+ void print_update_service(const std::string& hostname, const std::string& ip_dns_recheck, const std::string& ip_last_update, const std::string& ip_host, const time_t lastupdated) const;
- void print_update_service_ttl_expired(const std::string& hostname, const std::string& ip_dns_recheck, const std::string& ip_last_update, const std::string& ip_host, const int lastupdated, const int dns_cache_ttl, const int current_time) const;
+ void print_update_service_ttl_expired(const std::string& hostname, const std::string& ip_dns_recheck, const std::string& ip_last_update, const std::string& ip_host, const time_t lastupdated, const int dns_cache_ttl, const time_t current_time) const;
- void print_update_service_ttl_not_expired(const std::string& hostname, const std::string& ip_dns_recheck, const std::string& ip_last_update, const std::string& ip_host, const int lastupdated, const int dns_cache_ttl, const int current_time) const;
+ void print_update_service_ttl_not_expired(const std::string& hostname, const std::string& ip_dns_recheck, const std::string& ip_last_update, const std::string& ip_host, const time_t lastupdated, const int dns_cache_ttl, const time_t current_time) const;
- void print_no_update_needed(const std::string& hostname, const std::string& ip_dns_recheck, const std::string& ip_last_update, const std::string& ip_host, const int lastupdated) const;
+ void print_no_update_needed(const std::string& hostname, const std::string& ip_dns_recheck, const std::string& ip_last_update, const std::string& ip_host, const time_t lastupdated) const;
void print_error_getting_local_wan_ip(const std::string& system_call, const std::string& error) const;
};
updater->get_logger()->print_caught_sigterm();
exit(shutdown());
-}
+} /*lint !e715 */
/**
{
updater->get_logger()->print_caught_siguser1();
is_online = false;
-}
+} /*lint !e715 */
/**
if ( updater->reload_config() != 0 )
exit(-1);
is_online = true;
-}
+} /*lint !e715 */
/**
{
IPServicePtr->connect(hostname,port);
}
- catch ( boost::system::system_error& boost_exception )
+ catch ( const boost::system::system_error& boost_exception )
{
ostringstream out;
out << "NetHelper::open_connection(): " << boost_exception.what() << " Host: " << hostname << " Port: " << port;
Log->print_network_error(out.str());
return -1;
}
- catch ( exception& e )
+ catch ( const exception& e )
{
ostringstream out;
out << "NetHelper::open_connection(): " << e.what() << " Host: " << hostname << " Port: " << port;
{
IPServicePtr->write_to_socket(data);
}
- catch ( boost::system::system_error& boost_exception )
+ catch ( const boost::system::system_error& boost_exception )
{
ostringstream out;
out << "NetHelper::send_data(): " << boost_exception.what() << " Data to be send: " << data;
{
received_data = IPServicePtr->read_from_socket();
}
- catch ( boost::system::system_error& boost_exception )
+ catch ( const boost::system::system_error& boost_exception )
{
ostringstream out;
out << "NetHelper::receive_data(): " << boost_exception.what();
{
IPServicePtr->close();
}
- catch ( boost::system::system_error& boost_exception )
+ catch ( const boost::system::system_error& boost_exception )
{
ostringstream out;
out << "NetHelper::close_connection(): " << boost_exception.what();
// 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());
+ BaseUrl = assemble_base_url(host_domain_part.front(),host_domain_part.back()); /*lint !e864 */
}
string url = BaseUrl;
url.append(ip);
- if ( HTTPHelp->is_initialized() == true )
+ if ( HTTPHelp->is_initialized() )
{
// Perform curl operation on given url.
long http_status_code = HTTPHelp->http_get(url);
string url = BaseUrl;
url.append(ip);
- if ( HTTPHelp->is_initialized() == true )
+ if ( HTTPHelp->is_initialized() )
{
// Perform curl operation on given url
long http_status_code = HTTPHelp->http_get(url);
string url = BaseUrl;
url.append(ip);
- if ( HTTPHelp->is_initialized() == true )
+ if ( HTTPHelp->is_initialized() )
{
long http_status_code = HTTPHelp->http_get(url);
string url = BaseUrl;
url.append(ip);
- if ( HTTPHelp->is_initialized() == true )
+ if ( HTTPHelp->is_initialized() )
{
long http_status_code = HTTPHelp->http_get(url);
*/
int ServiceGnudip::perform_update(const std::string& ip)
{
- if ( HTTPHelp->is_initialized() == true )
+ if ( HTTPHelp->is_initialized() )
{
// initial request
long http_status_code = HTTPHelp->http_get(BaseUrl);
string url = BaseUrl;
url.append(ip);
- if ( HTTPHelp->is_initialized() == true )
+ if ( HTTPHelp->is_initialized() )
{
long http_status_code = HTTPHelp->http_get(url);
string url = BaseUrl;
url.append(ip);
- if ( HTTPHelp->is_initialized() == true )
+ if ( HTTPHelp->is_initialized() )
{
long http_status_code = HTTPHelp->http_get(url);
BOOST_FOREACH(const Service::Ptr &service, OldServices)
{
- if ( ( service->get_last_updates().front() + ((time_t)service->get_update_interval()*60) ) >= current_time ) // UpdateInterval timeout of service isn't expired.
+ if ( ( service->get_last_updates().front() + ((time_t)service->get_update_interval()*60) ) >= current_time ) /*lint !e1793 */ // UpdateInterval timeout of service isn't expired.
service_container->add_service(service);
}
boost::archive::text_oarchive oa(ofs);
oa << _service_container << _ip_addr_helper;
}
- catch( boost::archive::archive_exception e )
+ catch( const boost::archive::archive_exception& e )
{
Log->print_exception_serialize(e.what());
ofs.close();
boost::archive::text_iarchive ia(ifs);
ia >> _service_container >> _ip_addr_helper;
}
- catch( boost::archive::archive_exception e )
+ catch( const boost::archive::archive_exception& e )
{
Log->print_exception_deserialize(e.what());
ifs.close();
boost::system::error_code error_code;
// Is blocking until all available data was read or buffer is full
- size_t bytes_read = boost::asio::read(*Socket.get(),stream_buffer,boost::asio::transfer_at_least(1),error_code);
+ size_t bytes_read = boost::asio::read(*Socket.get(),stream_buffer,boost::asio::transfer_at_least(1),error_code); /*lint !e747 */
if ( error_code == boost::asio::error::eof )
throw boost::system::system_error(boost::system::error_code(ECONNABORTED,boost::system::system_category),"Connection closed by peer.");
else if (error_code)
// Copy data from stream buffer to a constant buffer and create a string object from the constant buffer
boost::asio::streambuf::const_buffers_type const_buffer = stream_buffer.data();
- std::string data_read(boost::asio::buffers_begin(const_buffer), boost::asio::buffers_begin(const_buffer) + bytes_read);
+ std::string data_read(boost::asio::buffers_begin(const_buffer), boost::asio::buffers_begin(const_buffer) + bytes_read); /*lint !e713*/
return data_read;
}
std::ostream request_stream(&stream_buffer);
request_stream << data;
- // Init bytes_read and the error_code
- size_t bytes_wrote = 0;
+ // Init error_code
boost::system::error_code error_code;
- bytes_wrote = boost::asio::write(*Socket.get(), stream_buffer, boost::asio::transfer_at_least(data_size), error_code);
+ size_t bytes_wrote = boost::asio::write(*Socket.get(), stream_buffer, boost::asio::transfer_at_least(data_size), error_code);
if (error_code)
throw boost::system::system_error(error_code);
else if ( bytes_wrote != data_size )
* @param argv[] Array with arguments.
* @return 0 if cmd options successfully parsed, 1 if usage or version.
*/
-int Updater::init_config_from_cmd(int argc, char *argv[])
+int Updater::init_config_from_cmd(int argc, char *argv[]) const
{
// Load the command line parameters
if( Conf->parse_cmd_line( argc, argv) != 0)
* Load the main config and the service definition files in config path.
* @return 0 if all is fine,
*/
-int Updater::init_config_from_files()
+int Updater::init_config_from_files() const
{
// Load the main and service config files in config path
if ( Conf->load_config_from_files() != 0 )
else
{
// IPAddrHelper from ServiceHolder was not declared, so init oen with LastWebcheck 0
- IPAddrHelp = IPAddrHelper::Ptr( new IPAddrHelper( Log, Conf->get_webcheck_ip_url(), Conf->get_webcheck_ip_url_alt(), Conf->get_webcheck_interval(), 0, Conf->get_enable_ipv6(), Conf->get_proxy(), Conf->get_proxy_port() ) );
+ IPAddrHelp = IPAddrHelper::Ptr( new IPAddrHelper( Log, Conf->get_webcheck_ip_url(), Conf->get_webcheck_ip_url_alt(), Conf->get_webcheck_interval(), (size_t)0, Conf->get_enable_ipv6(), Conf->get_proxy(), Conf->get_proxy_port() ) );
}
// Put the IPAddrHelper into ServiceHolder, so the LastWebcheck state will be serialized too.
// Try to get the lastupdated time of the actual service if there is one.
if ( service->get_last_updates().size() > 0 )
- lastupdated = service->get_last_updates().front();
+ lastupdated = service->get_last_updates().front(); /*lint !e1793 */
Log->print_check_service_update(hostname, current_time, lastupdated);
void update_services() const;
- int init_config_from_cmd(int argc, char *argv[]);
+ int init_config_from_cmd(int argc, char *argv[]) const;
- int init_config_from_files();
+ int init_config_from_files() const;
Config::Ptr get_config() const;