Added Util::parse_status_code().
[bpdyndnsd] / src / service_ods.cpp
CommitLineData
089a7152
BS
1/** @file
2 * @brief ODS Service class implementation. This class represents the ODS service.
3 *
4 *
5 *
6 * @copyright Intra2net AG
7 * @license GPLv2
8*/
9
10#include "service_ods.h"
11
12#include <time.h>
13
14using namespace std;
15
16
17/**
18 * Default Constructor, needed for object serialization.
19 */
629d8110 20ServiceOds::ServiceOds()
089a7152
BS
21{
22}
23
24
25/**
26 * Constructor.
27 * @param _hostname The hostname to update
28 * @param _login The login name.
29 * @param _password The corresponding password.
30 */
629d8110 31ServiceOds::ServiceOds(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)
089a7152
BS
32{
33 if ( _update_interval == -1 ) // If _update_interval is default po::option_desc (not specified via config)
34 set_update_interval(15); // use default protocol value
35 else
36 set_update_interval(_update_interval);
37
38 if ( _max_updates_within_interval == -1 )
39 set_max_updates_within_interval(3);
40 else
41 set_max_updates_within_interval(_max_updates_within_interval);
42
43 if ( _dns_cache_ttl == -1 )
44 set_dns_cache_ttl(180);
45 else
46 set_dns_cache_ttl(_dns_cache_ttl);
47
48 set_protocol(_protocol);
49 set_hostname(_hostname);
50 set_login(_login);
51 set_password(_password);
52 set_logger(_logger);
53}
54
55
56/**
57 * Default destructor.
58 */
629d8110 59ServiceOds::~ServiceOds()
089a7152
BS
60{
61}
62
63
64/**
65 * Performs the Service update.
66 * @param ip IP Address to set.
67 * @return 0 if all is fine, -1 otherwise.
68 */
629d8110 69int ServiceOds::perform_update(const std::string& ip)
089a7152
BS
70{
71 return 0;
72}
73
74
75/**
76 * Serialize function needed by boost/serialization to define which members should be stored as the object state.
77 * @param ar Archive
78 * @param version Version
79 */
80template<class Archive>
629d8110 81void ServiceOds::serialize(Archive & ar, const unsigned int version)
089a7152
BS
82{
83 ar & boost::serialization::base_object<Service>(*this);
84}