mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-04 07:55:18 +00:00
[#92,!13] Moved NoSuchLease exception back to dhcpsrv library.
This commit is contained in:
@@ -31,13 +31,6 @@ public:
|
|||||||
isc::Exception(file, line, 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
|
/// @brief Data is truncated
|
||||||
class DataTruncated : public Exception {
|
class DataTruncated : public Exception {
|
||||||
public:
|
public:
|
||||||
|
@@ -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 += daemon.cc daemon.h
|
||||||
libkea_dhcpsrv_la_SOURCES += db_type.h
|
libkea_dhcpsrv_la_SOURCES += db_type.h
|
||||||
libkea_dhcpsrv_la_SOURCES += dhcp4o6_ipc.cc dhcp4o6_ipc.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 += dhcpsrv_log.cc dhcpsrv_log.h
|
||||||
libkea_dhcpsrv_la_SOURCES += host.cc host.h
|
libkea_dhcpsrv_la_SOURCES += host.cc host.h
|
||||||
libkea_dhcpsrv_la_SOURCES += host_container.h
|
libkea_dhcpsrv_la_SOURCES += host_container.h
|
||||||
@@ -270,6 +271,7 @@ libkea_dhcpsrv_include_HEADERS = \
|
|||||||
client_class_def.h \
|
client_class_def.h \
|
||||||
csv_lease_file4.h \
|
csv_lease_file4.h \
|
||||||
csv_lease_file6.h \
|
csv_lease_file6.h \
|
||||||
|
dhcpsrv_exceptions.h \
|
||||||
d2_client_cfg.h \
|
d2_client_cfg.h \
|
||||||
d2_client_mgr.h \
|
d2_client_mgr.h \
|
||||||
daemon.h \
|
daemon.h \
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <dhcpsrv/cql_lease_mgr.h>
|
#include <dhcpsrv/cql_lease_mgr.h>
|
||||||
|
#include <dhcpsrv/dhcpsrv_exceptions.h>
|
||||||
#include <dhcpsrv/dhcpsrv_log.h>
|
#include <dhcpsrv/dhcpsrv_log.h>
|
||||||
|
|
||||||
#include <dhcp/duid.h>
|
#include <dhcp/duid.h>
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
#include <dhcp/hwaddr.h>
|
#include <dhcp/hwaddr.h>
|
||||||
#include <dhcpsrv/cql_connection.h>
|
#include <dhcpsrv/cql_connection.h>
|
||||||
#include <dhcpsrv/cql_exchange.h>
|
#include <dhcpsrv/cql_exchange.h>
|
||||||
|
#include <dhcpsrv/dhcpsrv_exceptions.h>
|
||||||
#include <dhcpsrv/lease_mgr.h>
|
#include <dhcpsrv/lease_mgr.h>
|
||||||
|
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
@@ -393,7 +394,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// @param lease4 The lease to be updated.
|
/// @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.
|
/// exist.
|
||||||
/// @throw isc::db::DbOperationError An operation on the open database has
|
/// @throw isc::db::DbOperationError An operation on the open database has
|
||||||
/// failed.
|
/// failed.
|
||||||
@@ -406,7 +407,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// @param lease6 The lease to be updated.
|
/// @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
|
/// @throw isc::db::DbOperationError An operation on the open database has
|
||||||
/// failed.
|
/// failed.
|
||||||
|
26
src/lib/dhcpsrv/dhcpsrv_exceptions.h
Normal file
26
src/lib/dhcpsrv/dhcpsrv_exceptions.h
Normal file
@@ -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
|
@@ -7,6 +7,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <database/database_connection.h>
|
#include <database/database_connection.h>
|
||||||
#include <dhcpsrv/cfgmgr.h>
|
#include <dhcpsrv/cfgmgr.h>
|
||||||
|
#include <dhcpsrv/dhcpsrv_exceptions.h>
|
||||||
#include <dhcpsrv/dhcpsrv_log.h>
|
#include <dhcpsrv/dhcpsrv_log.h>
|
||||||
#include <dhcpsrv/lease_file_loader.h>
|
#include <dhcpsrv/lease_file_loader.h>
|
||||||
#include <dhcpsrv/memfile_lease_mgr.h>
|
#include <dhcpsrv/memfile_lease_mgr.h>
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
#define MYSQL_LEASE_MGR_H
|
#define MYSQL_LEASE_MGR_H
|
||||||
|
|
||||||
#include <dhcp/hwaddr.h>
|
#include <dhcp/hwaddr.h>
|
||||||
|
#include <dhcpsrv/dhcpsrv_exceptions.h>
|
||||||
#include <dhcpsrv/lease_mgr.h>
|
#include <dhcpsrv/lease_mgr.h>
|
||||||
#include <dhcpsrv/mysql_connection.h>
|
#include <dhcpsrv/mysql_connection.h>
|
||||||
|
|
||||||
@@ -377,7 +378,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// @param lease4 The lease to be updated.
|
/// @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.
|
/// exist.
|
||||||
/// @throw isc::db::DbOperationError An operation on the open database has
|
/// @throw isc::db::DbOperationError An operation on the open database has
|
||||||
/// failed.
|
/// failed.
|
||||||
@@ -390,7 +391,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// @param lease6 The lease to be updated.
|
/// @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.
|
/// exist.
|
||||||
/// @throw isc::db::DbOperationError An operation on the open database has
|
/// @throw isc::db::DbOperationError An operation on the open database has
|
||||||
/// failed.
|
/// failed.
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
#include <dhcp/duid.h>
|
#include <dhcp/duid.h>
|
||||||
#include <dhcp/hwaddr.h>
|
#include <dhcp/hwaddr.h>
|
||||||
#include <dhcpsrv/dhcpsrv_log.h>
|
#include <dhcpsrv/dhcpsrv_log.h>
|
||||||
|
#include <dhcpsrv/dhcpsrv_exceptions.h>
|
||||||
#include <dhcpsrv/pgsql_lease_mgr.h>
|
#include <dhcpsrv/pgsql_lease_mgr.h>
|
||||||
|
|
||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
#define PGSQL_LEASE_MGR_H
|
#define PGSQL_LEASE_MGR_H
|
||||||
|
|
||||||
#include <dhcp/hwaddr.h>
|
#include <dhcp/hwaddr.h>
|
||||||
|
#include <dhcpsrv/dhcpsrv_exceptions.h>
|
||||||
#include <dhcpsrv/lease_mgr.h>
|
#include <dhcpsrv/lease_mgr.h>
|
||||||
#include <dhcpsrv/pgsql_connection.h>
|
#include <dhcpsrv/pgsql_connection.h>
|
||||||
#include <dhcpsrv/pgsql_exchange.h>
|
#include <dhcpsrv/pgsql_exchange.h>
|
||||||
@@ -349,7 +350,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// @param lease4 The lease to be updated.
|
/// @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.
|
/// exist.
|
||||||
/// @throw isc::db::DbOperationError An operation on the open database has
|
/// @throw isc::db::DbOperationError An operation on the open database has
|
||||||
/// failed.
|
/// failed.
|
||||||
@@ -362,7 +363,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// @param lease6 The lease to be updated.
|
/// @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.
|
/// exist.
|
||||||
/// @throw isc::db::DbOperationError An operation on the open database has
|
/// @throw isc::db::DbOperationError An operation on the open database has
|
||||||
/// failed.
|
/// failed.
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
#include <database/database_connection.h>
|
#include <database/database_connection.h>
|
||||||
#include <database/db_exceptions.h>
|
#include <database/db_exceptions.h>
|
||||||
#include <dhcpsrv/cfgmgr.h>
|
#include <dhcpsrv/cfgmgr.h>
|
||||||
|
#include <dhcpsrv/dhcpsrv_exceptions.h>
|
||||||
#include <dhcpsrv/lease_mgr_factory.h>
|
#include <dhcpsrv/lease_mgr_factory.h>
|
||||||
#include <dhcpsrv/tests/generic_lease_mgr_unittest.h>
|
#include <dhcpsrv/tests/generic_lease_mgr_unittest.h>
|
||||||
#include <dhcpsrv/tests/test_utils.h>
|
#include <dhcpsrv/tests/test_utils.h>
|
||||||
@@ -1757,7 +1758,7 @@ GenericLeaseMgrTest::testUpdateLease4() {
|
|||||||
|
|
||||||
// Try updating a lease not in the database.
|
// Try updating a lease not in the database.
|
||||||
lmptr_->deleteLease(ioaddress4_[2]);
|
lmptr_->deleteLease(ioaddress4_[2]);
|
||||||
EXPECT_THROW(lmptr_->updateLease4(leases[2]), isc::db::NoSuchLease);
|
EXPECT_THROW(lmptr_->updateLease4(leases[2]), isc::dhcp::NoSuchLease);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1816,7 +1817,7 @@ GenericLeaseMgrTest::testUpdateLease6() {
|
|||||||
EXPECT_THROW(lmptr_->updateLease6(leases[1]), isc::db::DbOperationError);
|
EXPECT_THROW(lmptr_->updateLease6(leases[1]), isc::db::DbOperationError);
|
||||||
|
|
||||||
// Try updating a lease not in the database.
|
// 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
|
void
|
||||||
|
Reference in New Issue
Block a user