diff options
author | Marcin Siodelski <marcin@isc.org> | 2021-06-14 17:47:26 +0200 |
---|---|---|
committer | Marcin Siodelski <marcin@isc.org> | 2021-07-21 12:49:50 +0200 |
commit | 725f3259b9c3bc2552776d5d3ec6f2064d9689e8 (patch) | |
tree | ed3261882589e826e38c769ca64a61c4959e9565 /src/hooks/dhcp | |
parent | [#1950] Added a ChangeLog entry (diff) | |
download | kea-725f3259b9c3bc2552776d5d3ec6f2064d9689e8.tar.xz kea-725f3259b9c3bc2552776d5d3ec6f2064d9689e8.zip |
[#1928] Client classes added to CB API
The CB API exposes a couple new API calls to support getting, adding and
deleting client classes in DHCPv4.
Diffstat (limited to 'src/hooks/dhcp')
-rw-r--r-- | src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc | 35 | ||||
-rw-r--r-- | src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.h | 51 |
2 files changed, 85 insertions, 1 deletions
diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc index c74bcbbe97..9dafd1043b 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc @@ -3222,6 +3222,23 @@ MySqlConfigBackendDHCPv4::getModifiedGlobalParameters4(const db::ServerSelector& return (parameters); } +ClientClassDefPtr +MySqlConfigBackendDHCPv4::getClientClientClass4(const db::ServerSelector& selector, + const std::string& name) const { + isc_throw(NotImplemented, "getClientClass4 is not implemented"); +} + +ClientClassDictionary +MySqlConfigBackendDHCPv4::getAllClientClasses4(const db::ServerSelector& selector) const { + isc_throw(NotImplemented, "getAllClientClasses4 is not implemented"); +} + +ClientClassDictionary +MySqlConfigBackendDHCPv4::getModifiedClientClasses4(const db::ServerSelector& selector, + const boost::posix_time::ptime& modification_time) const { + isc_throw(NotImplemented, "getModifiedClientClasses4 is not implemented"); +} + AuditEntryCollection MySqlConfigBackendDHCPv4::getRecentAuditEntries(const db::ServerSelector& server_selector, const boost::posix_time::ptime& modification_time, @@ -3327,6 +3344,13 @@ MySqlConfigBackendDHCPv4::createUpdateGlobalParameter4(const ServerSelector& ser } void +MySqlConfigBackendDHCPv4::createUpdateClientClass4(const db::ServerSelector& server_selector, + const ClientClassDefPtr& client_class) { + isc_throw(NotImplemented, "createUpdateClientClass4 is not implemented"); +} + + +void MySqlConfigBackendDHCPv4::createUpdateServer4(const ServerPtr& server) { LOG_DEBUG(mysql_cb_logger, DBGLVL_TRACE_BASIC, MYSQL_CB_CREATE_UPDATE_SERVER4) .arg(server->getServerTagAsText()); @@ -3547,6 +3571,17 @@ MySqlConfigBackendDHCPv4::deleteAllGlobalParameters4(const ServerSelector& serve } uint64_t +MySqlConfigBackendDHCPv4::deleteClientClass4(const db::ServerSelector& server_selector, + const std::string& name) { + isc_throw(NotImplemented, "deleteClientClass4 is not implemented"); +} + +uint64_t +MySqlConfigBackendDHCPv4::deleteAllClientClasses4(const db::ServerSelector& server_selector) { + isc_throw(NotImplemented, "deleteAllClientClasses4 is not implemented"); +} + +uint64_t MySqlConfigBackendDHCPv4::deleteServer4(const ServerTag& server_tag) { LOG_DEBUG(mysql_cb_logger, DBGLVL_TRACE_BASIC, MYSQL_CB_DELETE_SERVER4) .arg(server_tag.get()); diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.h b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.h index ba483ed906..26355c9a04 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.h +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.h @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2018-2021 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 @@ -9,6 +9,7 @@ #include <mysql_cb_impl.h> #include <database/database_connection.h> +#include <dhcpsrv/client_class_def.h> #include <dhcpsrv/config_backend_dhcp4.h> #include <mysql_cb_log.h> #include <boost/shared_ptr.hpp> @@ -225,6 +226,30 @@ public: getModifiedGlobalParameters4(const db::ServerSelector& server_selector, const boost::posix_time::ptime& modification_time) const; + /// @brief Retrieves a client class by name. + /// + /// @param server_selector Server selector. + /// @param name Client class name. + /// @return Pointer to the retrieved client class. + virtual ClientClassDefPtr + getClientClientClass4(const db::ServerSelector& selector, const std::string& name) const; + + /// @brief Retrieves all client classes. + /// + /// @param selector Server selector. + /// @return Collection of client classes. + virtual ClientClassDictionary + getAllClientClasses4(const db::ServerSelector& selector) const; + + /// @brief Retrieves client classes modified after specified time. + /// + /// @param selector Server selector. + /// @param modification_time Modification time. + /// @return Collection of client classes. + virtual ClientClassDictionary + getModifiedClientClasses4(const db::ServerSelector& selector, + const boost::posix_time::ptime& modification_time) const; + /// @brief Retrieves the most recent audit entries. /// /// @param selector Server selector. @@ -340,6 +365,14 @@ public: createUpdateGlobalParameter4(const db::ServerSelector& server_selector, const data::StampedValuePtr& value); + /// @brief Creates or updates DHCPv4 client class. + /// + /// @param server_selector Server selector. + /// @param client_class Client class to be added or updated. + virtual void + createUpdateClientClass4(const db::ServerSelector& server_selector, + const ClientClassDefPtr& client_class); + /// @brief Creates or updates a server. /// /// @param server Instance of the server to be stored. @@ -495,6 +528,22 @@ public: virtual uint64_t deleteAllGlobalParameters4(const db::ServerSelector& server_selector); + /// @brief Deletes DHCPv4 client class. + /// + /// @param server_selector Server selector. + /// @param name Name of the class to be deleted. + /// @return Number of deleted client classes. + virtual uint64_t + deleteClientClass4(const db::ServerSelector& server_selector, + const std::string& name); + + /// @brief Deletes all client classes. + /// + /// @param server_selector Server selector. + /// @return Number of deleted client classes. + virtual uint64_t + deleteAllClientClasses4(const db::ServerSelector& server_selector); + /// @brief Deletes a server from the backend. /// /// @param server_tag Tag of the server to be deleted. |