]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#92,!13] Moved NoSuchLease exception back to dhcpsrv library.
authorMarcin Siodelski <marcin@isc.org>
Wed, 29 Aug 2018 12:14:57 +0000 (14:14 +0200)
committerMarcin Siodelski <marcin@isc.org>
Mon, 3 Sep 2018 07:31:33 +0000 (03:31 -0400)
src/lib/database/db_exceptions.h
src/lib/dhcpsrv/Makefile.am
src/lib/dhcpsrv/cql_lease_mgr.cc
src/lib/dhcpsrv/cql_lease_mgr.h
src/lib/dhcpsrv/dhcpsrv_exceptions.h [new file with mode: 0644]
src/lib/dhcpsrv/memfile_lease_mgr.cc
src/lib/dhcpsrv/mysql_lease_mgr.h
src/lib/dhcpsrv/pgsql_lease_mgr.cc
src/lib/dhcpsrv/pgsql_lease_mgr.h
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc

index 3b8702b9accb0439b3efa835e5c12ee2675d6daf..60e10900d9057e57bb3867e44cbc427b66f4a2fc 100644 (file)
@@ -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:
index 8b5a26f4f93bc84e91360fbfd971dda8ccd437b2..b520518bead2f48424a1ecaa7da71e0bf1eca55b 100644 (file)
@@ -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 \
index 79f184c11d6ea886ff5d6e0c53a1db62eada246e..433642dce6f0eabfaa6cb830c7e83d034ff4d623 100644 (file)
@@ -19,6 +19,7 @@
 #include <config.h>
 
 #include <dhcpsrv/cql_lease_mgr.h>
+#include <dhcpsrv/dhcpsrv_exceptions.h>
 #include <dhcpsrv/dhcpsrv_log.h>
 
 #include <dhcp/duid.h>
index 89600fa3d4deeabd373852797e60209651eaa9f2..e4789add80eeeb10c4c7ad242f1a91d0aabab797 100644 (file)
@@ -22,6 +22,7 @@
 #include <dhcp/hwaddr.h>
 #include <dhcpsrv/cql_connection.h>
 #include <dhcpsrv/cql_exchange.h>
+#include <dhcpsrv/dhcpsrv_exceptions.h>
 #include <dhcpsrv/lease_mgr.h>
 
 #include <boost/scoped_ptr.hpp>
@@ -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 (file)
index 0000000..e18aa51
--- /dev/null
@@ -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 <exceptions/exceptions.h>
+
+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
index 58e80bcfa9cc3414233eea20486bb1a8770eb132..d060e220574083994f3563c49d962eaf9c020468 100644 (file)
@@ -7,6 +7,7 @@
 #include <config.h>
 #include <database/database_connection.h>
 #include <dhcpsrv/cfgmgr.h>
+#include <dhcpsrv/dhcpsrv_exceptions.h>
 #include <dhcpsrv/dhcpsrv_log.h>
 #include <dhcpsrv/lease_file_loader.h>
 #include <dhcpsrv/memfile_lease_mgr.h>
index 08aab94817a642e5dfe5490822039a3f59cb3107..ba732f565246b468dbefcc65734240b7c4156b43 100644 (file)
@@ -8,6 +8,7 @@
 #define MYSQL_LEASE_MGR_H
 
 #include <dhcp/hwaddr.h>
+#include <dhcpsrv/dhcpsrv_exceptions.h>
 #include <dhcpsrv/lease_mgr.h>
 #include <dhcpsrv/mysql_connection.h>
 
@@ -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.
index a30eea14e609b0a66f9902e1b5578182be1bd273..3878f7d5896950058fb548b9caa148f77c3b4397 100644 (file)
@@ -10,6 +10,7 @@
 #include <dhcp/duid.h>
 #include <dhcp/hwaddr.h>
 #include <dhcpsrv/dhcpsrv_log.h>
+#include <dhcpsrv/dhcpsrv_exceptions.h>
 #include <dhcpsrv/pgsql_lease_mgr.h>
 
 #include <boost/static_assert.hpp>
index 9bb58ec2d7782754a8b08a1ec9cb2bbd47691eaa..053ae78d9fef2c66a7c2fe05f01c303f8be81348 100644 (file)
@@ -8,6 +8,7 @@
 #define PGSQL_LEASE_MGR_H
 
 #include <dhcp/hwaddr.h>
+#include <dhcpsrv/dhcpsrv_exceptions.h>
 #include <dhcpsrv/lease_mgr.h>
 #include <dhcpsrv/pgsql_connection.h>
 #include <dhcpsrv/pgsql_exchange.h>
@@ -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.
index 245c5fca495633cc1df2912ac223c4df83f78c24..cb213c2ecb6dd3fee1ad3cb8c3bc2adac48ed937 100644 (file)
@@ -10,6 +10,7 @@
 #include <database/database_connection.h>
 #include <database/db_exceptions.h>
 #include <dhcpsrv/cfgmgr.h>
+#include <dhcpsrv/dhcpsrv_exceptions.h>
 #include <dhcpsrv/lease_mgr_factory.h>
 #include <dhcpsrv/tests/generic_lease_mgr_unittest.h>
 #include <dhcpsrv/tests/test_utils.h>
@@ -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