From: Marcin Siodelski Date: Wed, 29 Aug 2018 12:14:57 +0000 (+0200) Subject: [#92,!13] Moved NoSuchLease exception back to dhcpsrv library. X-Git-Tag: gitlab116_base~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4255e8fcc06aa2a1094d327f1a05f3ef238bf541;p=thirdparty%2Fkea.git [#92,!13] Moved NoSuchLease exception back to dhcpsrv library. --- diff --git a/src/lib/database/db_exceptions.h b/src/lib/database/db_exceptions.h index 3b8702b9ac..60e10900d9 100644 --- a/src/lib/database/db_exceptions.h +++ b/src/lib/database/db_exceptions.h @@ -31,13 +31,6 @@ public: 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: diff --git a/src/lib/dhcpsrv/Makefile.am b/src/lib/dhcpsrv/Makefile.am index 8b5a26f4f9..b520518bea 100644 --- a/src/lib/dhcpsrv/Makefile.am +++ b/src/lib/dhcpsrv/Makefile.am @@ -117,6 +117,7 @@ libkea_dhcpsrv_la_SOURCES += d2_client_mgr.cc d2_client_mgr.h libkea_dhcpsrv_la_SOURCES += daemon.cc daemon.h libkea_dhcpsrv_la_SOURCES += db_type.h libkea_dhcpsrv_la_SOURCES += dhcp4o6_ipc.cc dhcp4o6_ipc.h +libkea_dhcpsrv_la_SOURCES += dhcpsrv_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 @@ -270,6 +271,7 @@ libkea_dhcpsrv_include_HEADERS = \ client_class_def.h \ csv_lease_file4.h \ csv_lease_file6.h \ + dhcpsrv_exceptions.h \ d2_client_cfg.h \ d2_client_mgr.h \ daemon.h \ diff --git a/src/lib/dhcpsrv/cql_lease_mgr.cc b/src/lib/dhcpsrv/cql_lease_mgr.cc index 79f184c11d..433642dce6 100644 --- a/src/lib/dhcpsrv/cql_lease_mgr.cc +++ b/src/lib/dhcpsrv/cql_lease_mgr.cc @@ -19,6 +19,7 @@ #include #include +#include #include #include diff --git a/src/lib/dhcpsrv/cql_lease_mgr.h b/src/lib/dhcpsrv/cql_lease_mgr.h index 89600fa3d4..e4789add80 100644 --- a/src/lib/dhcpsrv/cql_lease_mgr.h +++ b/src/lib/dhcpsrv/cql_lease_mgr.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -393,7 +394,7 @@ public: /// /// @param lease4 The lease to be updated. /// - /// @throw isc::db::NoSuchLease Attempt to update a lease that did not + /// @throw isc::dhcp::NoSuchLease Attempt to update a lease that did not /// exist. /// @throw isc::db::DbOperationError An operation on the open database has /// failed. @@ -406,7 +407,7 @@ public: /// /// @param lease6 The lease to be updated. /// - /// @throw isc::db::NoSuchLease Attempt to update a lease that did not + /// @throw isc::dhcp::NoSuchLease Attempt to update a lease that did not /// @throw isc::db::DbOperationError An operation on the open database has /// failed. diff --git a/src/lib/dhcpsrv/dhcpsrv_exceptions.h b/src/lib/dhcpsrv/dhcpsrv_exceptions.h new file mode 100644 index 0000000000..e18aa5179a --- /dev/null +++ b/src/lib/dhcpsrv/dhcpsrv_exceptions.h @@ -0,0 +1,26 @@ +// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef DHCPSRV_EXCEPTIONS_H +#define DHCPSRV_EXCEPTIONS_H + +#include + +namespace isc { +namespace dhcp { + +/// @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) {} +}; + + +} // end of namespace isc::dhcp +} // end of namespace isc + +#endif // DHCPSRV_EXCEPTIONS_H diff --git a/src/lib/dhcpsrv/memfile_lease_mgr.cc b/src/lib/dhcpsrv/memfile_lease_mgr.cc index 58e80bcfa9..d060e22057 100644 --- a/src/lib/dhcpsrv/memfile_lease_mgr.cc +++ b/src/lib/dhcpsrv/memfile_lease_mgr.cc @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/src/lib/dhcpsrv/mysql_lease_mgr.h b/src/lib/dhcpsrv/mysql_lease_mgr.h index 08aab94817..ba732f5652 100644 --- a/src/lib/dhcpsrv/mysql_lease_mgr.h +++ b/src/lib/dhcpsrv/mysql_lease_mgr.h @@ -8,6 +8,7 @@ #define MYSQL_LEASE_MGR_H #include +#include #include #include @@ -377,7 +378,7 @@ public: /// /// @param lease4 The lease to be updated. /// - /// @throw isc::db::NoSuchLease Attempt to update a lease that did not + /// @throw isc::dhcp::NoSuchLease Attempt to update a lease that did not /// exist. /// @throw isc::db::DbOperationError An operation on the open database has /// failed. @@ -390,7 +391,7 @@ public: /// /// @param lease6 The lease to be updated. /// - /// @throw isc::db::NoSuchLease Attempt to update a lease that did not + /// @throw isc::dhcp::NoSuchLease Attempt to update a lease that did not /// exist. /// @throw isc::db::DbOperationError An operation on the open database has /// failed. diff --git a/src/lib/dhcpsrv/pgsql_lease_mgr.cc b/src/lib/dhcpsrv/pgsql_lease_mgr.cc index a30eea14e6..3878f7d589 100644 --- a/src/lib/dhcpsrv/pgsql_lease_mgr.cc +++ b/src/lib/dhcpsrv/pgsql_lease_mgr.cc @@ -10,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/src/lib/dhcpsrv/pgsql_lease_mgr.h b/src/lib/dhcpsrv/pgsql_lease_mgr.h index 9bb58ec2d7..053ae78d9f 100644 --- a/src/lib/dhcpsrv/pgsql_lease_mgr.h +++ b/src/lib/dhcpsrv/pgsql_lease_mgr.h @@ -8,6 +8,7 @@ #define PGSQL_LEASE_MGR_H #include +#include #include #include #include @@ -349,7 +350,7 @@ public: /// /// @param lease4 The lease to be updated. /// - /// @throw isc::db::NoSuchLease Attempt to update a lease that did not + /// @throw isc::dhcp::NoSuchLease Attempt to update a lease that did not /// exist. /// @throw isc::db::DbOperationError An operation on the open database has /// failed. @@ -362,7 +363,7 @@ public: /// /// @param lease6 The lease to be updated. /// - /// @throw isc::db::NoSuchLease Attempt to update a lease that did not + /// @throw isc::dhcp::NoSuchLease Attempt to update a lease that did not /// exist. /// @throw isc::db::DbOperationError An operation on the open database has /// failed. diff --git a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc index 245c5fca49..cb213c2ecb 100644 --- a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -1757,7 +1758,7 @@ GenericLeaseMgrTest::testUpdateLease4() { // Try updating a lease not in the database. lmptr_->deleteLease(ioaddress4_[2]); - EXPECT_THROW(lmptr_->updateLease4(leases[2]), isc::db::NoSuchLease); + EXPECT_THROW(lmptr_->updateLease4(leases[2]), isc::dhcp::NoSuchLease); } void @@ -1816,7 +1817,7 @@ GenericLeaseMgrTest::testUpdateLease6() { EXPECT_THROW(lmptr_->updateLease6(leases[1]), isc::db::DbOperationError); // Try updating a lease not in the database. - EXPECT_THROW(lmptr_->updateLease6(leases[2]), isc::db::NoSuchLease); + EXPECT_THROW(lmptr_->updateLease6(leases[2]), isc::dhcp::NoSuchLease); } void