* @param ip IP Address to set.
* @return 0 if all is fine, -1 otherwise.
*/
-int ServiceGnudip::perform_update(const std::string& ip)
+Service::UpdateErrorCode ServiceGnudip::perform_update(const std::string& ip)
{
if ( HTTPHelp->is_initialized() )
{
if ( salt_time_sign.empty() )
{
get_logger()->print_could_not_parse_received_data(curl_data);
- return -1;
+ return GenericError;
}
// at this point we have salt, time and sign parsed successfully
catch ( exception& e )
{
get_logger()->print_exception_md5_sum(e.what());
- return -1;
+ return GenericError;
}
catch ( ... )
{
get_logger()->print_exception_md5_sum("Unknown exception");
- return -1;
+ return GenericError;
}
// append "." and salt and compute md5 sum and get the HEX representation
catch ( exception& e )
{
get_logger()->print_exception_md5_sum(e.what());
- return -1;
+ return GenericError;
}
catch ( ... )
{
get_logger()->print_exception_md5_sum("Unknown exception");
- return -1;
+ return GenericError;
}
// Now its time to issue the second http_get operation
string update_return_code = parse_return_code(curl_data);
if ( update_return_code == "0" )
{
- return 0;
+ return UpdateOk;
}
else if ( update_return_code == "1" )
{
get_logger()->print_httphelper_not_initialized();
HTTPHelp->re_initialize();
}
- return -1;
+ return GenericError;
}