From: Tomek Mrugalski Date: Fri, 18 Sep 2015 18:29:11 +0000 (+0200) Subject: [3682] Compilation fixes after rebasing 3682 to trac3681_rebase X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=010187c628e43a88447bceb4ffff9c54ad2744bc;p=thirdparty%2Fkea.git [3682] Compilation fixes after rebasing 3682 to trac3681_rebase --- diff --git a/src/lib/dhcpsrv/Makefile.am b/src/lib/dhcpsrv/Makefile.am index 3aeefb2e03..36457e2031 100755 --- a/src/lib/dhcpsrv/Makefile.am +++ b/src/lib/dhcpsrv/Makefile.am @@ -93,6 +93,7 @@ libkea_dhcpsrv_la_SOURCES += d2_client_cfg.cc d2_client_cfg.h libkea_dhcpsrv_la_SOURCES += d2_client_mgr.cc d2_client_mgr.h libkea_dhcpsrv_la_SOURCES += daemon.cc daemon.h libkea_dhcpsrv_la_SOURCES += database_connection.cc database_connection.h +libkea_dhcpsrv_la_SOURCES += db_exceptions.h libkea_dhcpsrv_la_SOURCES += dhcpsrv_log.cc dhcpsrv_log.h libkea_dhcpsrv_la_SOURCES += host.cc host.h libkea_dhcpsrv_la_SOURCES += host_container.h diff --git a/src/lib/dhcpsrv/database_connection.cc b/src/lib/dhcpsrv/database_connection.cc index a64cf17ca2..88072d8b22 100755 --- a/src/lib/dhcpsrv/database_connection.cc +++ b/src/lib/dhcpsrv/database_connection.cc @@ -25,7 +25,7 @@ using namespace std; namespace isc { namespace dhcp { -const time_t DataSource::MAX_DB_TIME = 2147483647; +const time_t DatabaseConnection::MAX_DB_TIME = 2147483647; std::string DatabaseConnection::getParameter(const std::string& name) const { diff --git a/src/lib/dhcpsrv/host_data_source_factory.cc b/src/lib/dhcpsrv/host_data_source_factory.cc index 9ccb929d37..4c6d755c61 100644 --- a/src/lib/dhcpsrv/host_data_source_factory.cc +++ b/src/lib/dhcpsrv/host_data_source_factory.cc @@ -46,8 +46,8 @@ HostDataSourceFactory::create(const std::string& dbaccess) { const std::string type = "type"; // Parse the access string and create a redacted string for logging. - DataSource::ParameterMap parameters = DataSource::parse(dbaccess); - std::string redacted = DataSource::redactedAccessString(parameters); + DatabaseConnection::ParameterMap parameters = DatabaseConnection::parse(dbaccess); + std::string redacted = DatabaseConnection::redactedAccessString(parameters); // Is "type" present? if (parameters.find(type) == parameters.end()) { diff --git a/src/lib/dhcpsrv/host_data_source_factory.h b/src/lib/dhcpsrv/host_data_source_factory.h index d485025776..91b9ec7c4d 100644 --- a/src/lib/dhcpsrv/host_data_source_factory.h +++ b/src/lib/dhcpsrv/host_data_source_factory.h @@ -16,7 +16,7 @@ #define HOST_DATA_SOURCE_FACTORY_H #include -#include +#include #include #include diff --git a/src/lib/dhcpsrv/lease_mgr.h b/src/lib/dhcpsrv/lease_mgr.h index 54497f08d0..a18547e9a2 100755 --- a/src/lib/dhcpsrv/lease_mgr.h +++ b/src/lib/dhcpsrv/lease_mgr.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include @@ -68,28 +68,6 @@ namespace isc { namespace dhcp { -/// @brief Multiple lease records found where one expected -class MultipleRecords : public Exception { -public: - MultipleRecords(const char* file, size_t line, const char* what) : - isc::Exception(file, line, what) {} -}; - -/// @brief Attempt to update lease that was not there -class NoSuchLease : public Exception { -public: - NoSuchLease(const char* file, size_t line, const char* what) : - isc::Exception(file, line, what) {} -}; - -/// @brief Data is truncated -class DataTruncated : public Exception { -public: - DataTruncated(const char* file, size_t line, const char* what) : - isc::Exception(file, line, what) {} -}; - - /// @brief Abstract Lease Manager /// /// This is an abstract API for lease database backends. It provides unified diff --git a/src/lib/dhcpsrv/mysql_connection.cc b/src/lib/dhcpsrv/mysql_connection.cc index 3921d9497b..9ea1afc517 100755 --- a/src/lib/dhcpsrv/mysql_connection.cc +++ b/src/lib/dhcpsrv/mysql_connection.cc @@ -192,6 +192,7 @@ MySqlConnection::~MySqlConnection() { } statements_.clear(); text_statements_.clear(); +} // Time conversion methods. // @@ -216,7 +217,7 @@ MySqlConnection::convertToDatabaseTime(const time_t cltt, // Even on 64-bit systems MySQL doesn't seem to accept the timestamps // beyond the max value of int32_t. - if (expire_time_64 > DataSource::MAX_DB_TIME) { + if (expire_time_64 > DatabaseConnection::MAX_DB_TIME) { isc_throw(BadValue, "Time value is too large: " << expire_time_64); } diff --git a/src/lib/dhcpsrv/mysql_host_data_source.cc b/src/lib/dhcpsrv/mysql_host_data_source.cc index b2f0732515..ea5eeb66fb 100644 --- a/src/lib/dhcpsrv/mysql_host_data_source.cc +++ b/src/lib/dhcpsrv/mysql_host_data_source.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include #include diff --git a/src/lib/dhcpsrv/mysql_lease_mgr.cc b/src/lib/dhcpsrv/mysql_lease_mgr.cc index 543f7d3478..a21f6e114a 100755 --- a/src/lib/dhcpsrv/mysql_lease_mgr.cc +++ b/src/lib/dhcpsrv/mysql_lease_mgr.cc @@ -374,8 +374,8 @@ public: // expiry time (expire). The relationship is given by: // // expire = cltt_ + valid_lft_ - MySqlLeaseMgr::convertToDatabaseTime(lease_->cltt_, lease_->valid_lft_, - expire_); + MySqlConnection::convertToDatabaseTime(lease_->cltt_, lease_->valid_lft_, + expire_); bind_[4].buffer_type = MYSQL_TYPE_TIMESTAMP; bind_[4].buffer = reinterpret_cast(&expire_); bind_[4].buffer_length = sizeof(expire_); @@ -536,7 +536,7 @@ public: // Convert times received from the database to times for the lease // structure time_t cltt = 0; - MySqlLeaseMgr::convertFromDatabaseTime(expire_, valid_lifetime_, cltt); + MySqlConnection::convertFromDatabaseTime(expire_, valid_lifetime_, cltt); if (client_id_null_==MLM_TRUE) { // There's no client-id, so we pass client-id_length_ set to 0 @@ -734,8 +734,8 @@ public: // // expire = cltt_ + valid_lft_ // - MySqlLeaseMgr::convertToDatabaseTime(lease_->cltt_, lease_->valid_lft_, - expire_); + MySqlConnection::convertToDatabaseTime(lease_->cltt_, lease_->valid_lft_, + expire_); bind_[3].buffer_type = MYSQL_TYPE_TIMESTAMP; bind_[3].buffer = reinterpret_cast(&expire_); bind_[3].buffer_length = sizeof(expire_); @@ -1087,7 +1087,7 @@ public: subnet_id_, fqdn_fwd_, fqdn_rev_, hostname, hwaddr, prefixlen_)); time_t cltt = 0; - MySqlLeaseMgr::convertFromDatabaseTime(expire_, valid_lifetime_, cltt); + MySqlConnection::convertFromDatabaseTime(expire_, valid_lifetime_, cltt); result->cltt_ = cltt; return (result); diff --git a/src/lib/dhcpsrv/tests/generic_host_data_source_unittest.cc b/src/lib/dhcpsrv/tests/generic_host_data_source_unittest.cc index a03e83e1c4..b0c744dc59 100644 --- a/src/lib/dhcpsrv/tests/generic_host_data_source_unittest.cc +++ b/src/lib/dhcpsrv/tests/generic_host_data_source_unittest.cc @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc index 060e18b145..1306c71b43 100644 --- a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc @@ -693,7 +693,7 @@ GenericLeaseMgrTest::testMaxDate4() { // Set valid_lft_ to 1 day, cllt_ to max time. This should make expire // time too large to store. lease->valid_lft_ = 24*60*60; - lease->cltt_ = DataSource::MAX_DB_TIME; + lease->cltt_ = DatabaseConnection::MAX_DB_TIME; // Insert should throw. ASSERT_THROW(lmptr_->addLease(leases[1]), DbOperationError); @@ -862,7 +862,7 @@ GenericLeaseMgrTest::testMaxDate6() { // Set valid_lft_ to 1 day, cllt_ to max time. This should make expire // time too large to store. lease->valid_lft_ = 24*60*60; - lease->cltt_ = DataSource::MAX_DB_TIME; + lease->cltt_ = DatabaseConnection::MAX_DB_TIME; // Insert should throw. ASSERT_THROW(lmptr_->addLease(leases[1]), DbOperationError);