mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 13:37:55 +00:00
[#28,!20] Implemented Config Backend pool for DHCPv4.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <database/backend_selector.h>
|
||||
#include <database/db_exceptions.h>
|
||||
#include <database/server_selector.h>
|
||||
#include <util/optional_value.h>
|
||||
#include <functional>
|
||||
#include <list>
|
||||
#include <string>
|
||||
@@ -75,7 +76,7 @@ protected:
|
||||
/// const BackendSelector& selector,
|
||||
/// const ServerSelector& server_selector) const {
|
||||
/// Subnet4Ptr subnet;
|
||||
/// getPropertyPtrConst<Subnet4Ptr, const SubnetID&, ConfigBackendDHCPv4::getSubnet4>
|
||||
/// getPropertyPtrConst<Subnet4Ptr, const SubnetID&>
|
||||
/// (&ConfigBackendDHCPv4::getSubnet4, selector, subnet, subnet_id);
|
||||
/// return (subnet);
|
||||
/// }
|
||||
@@ -142,6 +143,84 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
/// @brief Retrieve a single value encapsulated in the @c OptionalValue
|
||||
/// template.
|
||||
///
|
||||
/// This is common method for retrieving a single configuration property
|
||||
/// from the databases. The property is encapsulated in the @c OptionalValue
|
||||
/// class. The value is set to "unspecified" if it is null in the database.
|
||||
/// The following is the example implementation of the method retrieving
|
||||
/// global conifguration value:
|
||||
///
|
||||
/// @code
|
||||
/// OptionalValue<std::string>
|
||||
/// getGlobalParameter4(const std::string& parameter_name,
|
||||
/// const BackendSelector& selector,
|
||||
/// const ServerSelector& server_selector) const {
|
||||
/// std::string parameter;
|
||||
/// getOptionalPropertyConst<std::string, const std::string&>
|
||||
/// (&ConfigBackendDHCPv4::getGlobalParameter4, selector, server_selector,
|
||||
/// parameter, parameter_name);
|
||||
/// return (parameter);
|
||||
/// }
|
||||
/// @endcode
|
||||
///
|
||||
/// where @c ConfigBackendDHCPv4::getGlobalParameter has the following signature:
|
||||
///
|
||||
/// @code
|
||||
/// std::string getGlobalParameter4(const ServerSelector&, const std::string&) const;
|
||||
/// @endcode
|
||||
///
|
||||
///
|
||||
/// @tparam PropertyType Type of the object returned by the backend call.
|
||||
/// @tparam InputType Type of the objects used as input to the backend call.
|
||||
///
|
||||
/// @param MethodPointer Pointer to the backend method to be called.
|
||||
/// @param selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param [out] property Reference to the shared pointer where retrieved
|
||||
/// property should be assigned.
|
||||
/// @param input Values to be used as input to the backend call.
|
||||
///
|
||||
/// @throw db::NoSuchDatabase if no database matching the given selector
|
||||
/// was found.
|
||||
template<typename PropertyType, typename... InputType>
|
||||
void getOptionalPropertyConst(util::OptionalValue<PropertyType>
|
||||
(ConfigBackendType::*MethodPointer)
|
||||
(const db::ServerSelector&, InputType...) const,
|
||||
const db::BackendSelector& selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
util::OptionalValue<PropertyType>& property,
|
||||
InputType... input) const {
|
||||
|
||||
// If no particular backend is selected, call each backend and return
|
||||
// the first non-null (non zero) value.
|
||||
if (selector.amUnspecified()) {
|
||||
for (auto backend : backends_) {
|
||||
property = ((*backend).*MethodPointer)(server_selector, input...);
|
||||
if (property.isSpecified()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// Backend selected, find the one that matches selection.
|
||||
auto backends = selectBackends(selector);
|
||||
if (!backends.empty()) {
|
||||
for (auto backend : backends) {
|
||||
property = ((*backend).*MethodPointer)(server_selector, input...);
|
||||
if (property.isSpecified()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
isc_throw(db::NoSuchDatabase, "no such database found for selector: "
|
||||
<< selector.toText());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// @brief Retrieve multiple configuration properties from the pool.
|
||||
///
|
||||
/// This is a common method for retrieving multiple configuration properties
|
||||
|
@@ -108,6 +108,8 @@ libkea_dhcpsrv_la_SOURCES += cfg_subnets6.cc cfg_subnets6.h
|
||||
libkea_dhcpsrv_la_SOURCES += cfg_mac_source.cc cfg_mac_source.h
|
||||
libkea_dhcpsrv_la_SOURCES += cfgmgr.cc cfgmgr.h
|
||||
libkea_dhcpsrv_la_SOURCES += client_class_def.cc client_class_def.h
|
||||
libkea_dhcpsrv_la_SOURCES += config_backend_dhcp4.h
|
||||
libkea_dhcpsrv_la_SOURCES += config_backend_pool_dhcp4.cc config_backend_pool_dhcp4.h
|
||||
libkea_dhcpsrv_la_SOURCES += csv_lease_file4.cc csv_lease_file4.h
|
||||
libkea_dhcpsrv_la_SOURCES += csv_lease_file6.cc csv_lease_file6.h
|
||||
libkea_dhcpsrv_la_SOURCES += d2_client_cfg.cc d2_client_cfg.h
|
||||
@@ -211,6 +213,7 @@ if HAVE_CQL
|
||||
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/cql/libkea-cql.la
|
||||
endif
|
||||
|
||||
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/config_backend/libkea-cb.la
|
||||
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/database/libkea-database.la
|
||||
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
|
||||
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/cc/libkea-cc.la
|
||||
@@ -270,6 +273,8 @@ libkea_dhcpsrv_include_HEADERS = \
|
||||
cfg_subnets6.h \
|
||||
cfgmgr.h \
|
||||
client_class_def.h \
|
||||
config_backend_dhcp4.h \
|
||||
config_backend_pool_dhcp4.h \
|
||||
csv_lease_file4.h \
|
||||
csv_lease_file6.h \
|
||||
dhcpsrv_exceptions.h \
|
||||
|
318
src/lib/dhcpsrv/config_backend_dhcp4.h
Normal file
318
src/lib/dhcpsrv/config_backend_dhcp4.h
Normal file
@@ -0,0 +1,318 @@
|
||||
// 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 CONFIG_BACKEND_DHCP4_H
|
||||
#define CONFIG_BACKEND_DHCP4_H
|
||||
|
||||
#include <config_backend/base_config_backend.h>
|
||||
#include <database/server_selector.h>
|
||||
#include <dhcp/option.h>
|
||||
#include <dhcp/option_definition.h>
|
||||
#include <dhcpsrv/shared_network.h>
|
||||
#include <dhcpsrv/subnet.h>
|
||||
#include <util/optional_value.h>
|
||||
#include <boost/date_time/posix_time/ptime.hpp>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
namespace isc {
|
||||
namespace dhcp {
|
||||
|
||||
/// @brief Interface implemented by DHCPv4 configuration backends.
|
||||
class ConfigBackendDHCPv4 : public cb::BaseConfigBackend {
|
||||
public:
|
||||
|
||||
/// @brief Virtual destructor.
|
||||
virtual ~ConfigBackendDHCPv4() { }
|
||||
|
||||
/// @brief Retrieves a single subnet by subnet_prefix.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param subnet_prefix Prefix of the subnet to be retrieved.
|
||||
/// @return Pointer to the retrieved subnet or NULL if not found.
|
||||
virtual Subnet4Ptr
|
||||
getSubnet4(const db::ServerSelector& selector,
|
||||
const std::string& subnet_prefix) const = 0;
|
||||
|
||||
/// @brief Retrieves a single subnet by subnet identifier.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param subnet_id Identifier of a subnet to be retrieved.
|
||||
/// @return Pointer to the retrieved subnet or NULL if not found.
|
||||
virtual Subnet4Ptr
|
||||
getSubnet4(const db::ServerSelector& selector, const SubnetID& subnet_id) const = 0;
|
||||
|
||||
/// @brief Retrieves all subnets.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @return Collection of subnets or empty collection if no subnet found.
|
||||
virtual Subnet4Collection
|
||||
getAllSubnets4(const db::ServerSelector& selector) const = 0;
|
||||
|
||||
/// @brief Retrieves subnets modified after specified time.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param modification_time Lower bound subnet modification time.
|
||||
/// @return Collection of subnets or empty collection if no subnet found.
|
||||
virtual Subnet4Collection
|
||||
getModifiedSubnets4(const db::ServerSelector& selector,
|
||||
const boost::posix_time::ptime& modification_time) const = 0;
|
||||
|
||||
/// @brief Retrieves shared network by name.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param name Name of the shared network to be retrieved.
|
||||
/// @return Pointer to the shared network or NULL if not found.
|
||||
virtual SharedNetwork4Ptr
|
||||
getSharedNetwork4(const db::ServerSelector& selector,
|
||||
const std::string& name) const = 0;
|
||||
|
||||
/// @brief Retrieves all shared networks.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @return Collection of shared network or empty collection if
|
||||
/// no shared network found.
|
||||
virtual SharedNetwork4Collection
|
||||
getAllSharedNetworks4(const db::ServerSelector& selector) const = 0;
|
||||
|
||||
/// @brief Retrieves shared networks modified after specified time.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param Lower bound shared network modification time.
|
||||
/// @return Collection of shared network or empty collection if
|
||||
/// no shared network found.
|
||||
virtual SharedNetwork4Collection
|
||||
getModifiedSharedNetworks4(const db::ServerSelector& selector,
|
||||
const boost::posix_time::ptime& modification_time) const = 0;
|
||||
|
||||
/// @brief Retrieves single option definition by code and space.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param code Code of the option to be retrieved.
|
||||
/// @param space Option space of the option to be retrieved.
|
||||
/// @return Pointer to the option definition or NULL if not found.
|
||||
virtual OptionDefinitionPtr
|
||||
getOptionDef4(const db::ServerSelector& selector, const uint16_t code,
|
||||
const std::string& space) const = 0;
|
||||
|
||||
/// @brief Retrieves all option definitions.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @return Collection of option definitions or empty collection if
|
||||
/// no option definition found.
|
||||
virtual OptionDefContainer
|
||||
getAllOptionDefs4(const db::ServerSelector& selector) const = 0;
|
||||
|
||||
/// @brief Retrieves option definitions modified after specified time.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param modification_time Lower bound option definition modification
|
||||
/// time.
|
||||
/// @return Collection of option definitions or empty collection if
|
||||
/// no option definition found.
|
||||
virtual OptionDefContainer
|
||||
getModifiedOptionDefs4(const db::ServerSelector& selector,
|
||||
const boost::posix_time::ptime& modification_time) const = 0;
|
||||
|
||||
/// @brief Retrieves global string parameter value.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param name Name of the global parameter to be retrieved.
|
||||
/// @return Value of the global string parameter.
|
||||
virtual util::OptionalValue<std::string>
|
||||
getGlobalStringParameter4(const db::ServerSelector& selector,
|
||||
const std::string& name) const = 0;
|
||||
|
||||
/// @brief Retrieves global number parameter.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param name Name of the parameter to be retrieved.
|
||||
virtual util::OptionalValue<int64_t>
|
||||
getGlobalNumberParameter4(const db::ServerSelector& selector,
|
||||
const std::string& name) const = 0;
|
||||
|
||||
/// @brief Retrieves all global parameters as strings.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
virtual std::map<std::string, std::string>
|
||||
getAllGlobalParameters4(const db::ServerSelector& selector) const = 0;
|
||||
|
||||
/// @brief Creates or updates a subnet.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param subnet Subnet to be added or updated.
|
||||
virtual void
|
||||
createUpdateSubnet4(const db::ServerSelector& selector,
|
||||
const Subnet4Ptr& subnet) = 0;
|
||||
|
||||
/// @brief Creates or updates a shared network.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param shared_network Shared network to be added or updated.
|
||||
virtual void
|
||||
createUpdateSharedNetwork4(const db::ServerSelector& selector,
|
||||
const SharedNetwork4Ptr& shared_network) = 0;
|
||||
|
||||
/// @brief Creates or updates an option definition.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param option_def Option definition to be added or updated.
|
||||
virtual void
|
||||
createUpdateOptionDef4(const db::ServerSelector& selector,
|
||||
const OptionDefinitionPtr& option_def) = 0;
|
||||
|
||||
/// @brief Creates or updates global option.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param option Option to be added or updated.
|
||||
virtual void
|
||||
createUpdateOption4(const db::ServerSelector& selector,
|
||||
const OptionPtr& option) = 0;
|
||||
|
||||
/// @brief Creates or updates subnet level option.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param subnet_id Identifier of a subnet to which option belongs.
|
||||
virtual void
|
||||
createUpdateOption4(const db::ServerSelector& selector,
|
||||
const SubnetID& subnet_id, const OptionPtr& option) = 0;
|
||||
|
||||
/// @brief Creates or updates pool level option.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param pool_start_address Lower bound address of the pool to which
|
||||
/// the option belongs.
|
||||
/// @param pool_end_address Upper bound address of the pool to which the
|
||||
/// option belongs.
|
||||
virtual void
|
||||
createUpdateOption4(const db::ServerSelector& selector,
|
||||
const asiolink::IOAddress& pool_start_address,
|
||||
const asiolink::IOAddress& pool_end_address,
|
||||
const OptionPtr& option) = 0;
|
||||
|
||||
/// @brief Creates or updates global string parameter.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param name Name of the global parameter.
|
||||
/// @param value Value of the global parameter.
|
||||
virtual void
|
||||
createUpdateGlobalParameter4(const db::ServerSelector& selector,
|
||||
const std::string& name,
|
||||
const std::string& value) = 0;
|
||||
|
||||
/// @brief Creates or updates global number parameter.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param name Name of the global parameter.
|
||||
/// @param value Value of the global parameter.
|
||||
virtual void
|
||||
createUpdateGlobalParameter4(const db::ServerSelector& selector,
|
||||
const std::string& name,
|
||||
const int64_t value) = 0;
|
||||
|
||||
/// @brief Deletes subnet by prefix.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param subnet_prefix Prefix of the subnet to be deleted.
|
||||
virtual void
|
||||
deleteSubnet4(const db::ServerSelector& selector,
|
||||
const std::string& subnet_prefix) = 0;
|
||||
|
||||
/// @brief Deletes subnet by identifier.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param subnet_id Identifier of the subnet to be deleted.
|
||||
virtual void
|
||||
deleteSubnet4(const db::ServerSelector& selector, const SubnetID& subnet_id) = 0;
|
||||
|
||||
/// @brief Deletes all subnets.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
virtual void
|
||||
deleteAllSubnets4(const db::ServerSelector& selector) = 0;
|
||||
|
||||
/// @brief Deletes shared network by name.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param name Name of the shared network to be deleted.
|
||||
virtual void
|
||||
deleteSharedNetwork4(const db::ServerSelector& selector,
|
||||
const std::string& name) = 0;
|
||||
|
||||
/// @brief Deletes all shared networks.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
virtual void
|
||||
deleteAllSharedNetworks4(const db::ServerSelector& selector) = 0;
|
||||
|
||||
/// @brief Deletes option definition.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param code Code of the option to be deleted.
|
||||
/// @param space Option space of the option to be deleted.
|
||||
virtual void
|
||||
deleteOptionDef4(const db::ServerSelector& selector, const uint16_t code,
|
||||
const std::string& space) = 0;
|
||||
|
||||
/// @brief Deletes all option definitions.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
virtual void
|
||||
deleteAllOptionDefs4(const db::ServerSelector& selector) = 0;
|
||||
|
||||
/// @brief Deletes global option.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param code Code of the option to be deleted.
|
||||
/// @param space Option space of the option to be deleted.
|
||||
virtual void
|
||||
deleteOption4(const db::ServerSelector& selector, const uint16_t code,
|
||||
const std::string& space) = 0;
|
||||
|
||||
/// @brief Deletes subnet level option.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param subnet_id Identifier of the subnet to which deleted option
|
||||
/// belongs.
|
||||
/// @param code Code of the deleted option.
|
||||
/// @param space Option space of the deleted option.
|
||||
virtual void
|
||||
deleteOption4(const db::ServerSelector& selector, const SubnetID& subnet_id,
|
||||
const uint16_t code, const std::string& space) = 0;
|
||||
|
||||
/// @brief Deletes pool level option.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param pool_start_address Lower bound address of the pool to which
|
||||
/// deleted option belongs.
|
||||
/// @param pool_end_start Upper bound address of the pool to which the
|
||||
/// deleted option belongs.
|
||||
virtual void
|
||||
deleteOption4(const db::ServerSelector& selector,
|
||||
const asiolink::IOAddress& pool_start_address,
|
||||
const asiolink::IOAddress& pool_end_address,
|
||||
const uint16_t code,
|
||||
const std::string& space) = 0;
|
||||
|
||||
/// @brief Deletes global parameter.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
/// @param name Name of the global parameter to be deleted.
|
||||
virtual void
|
||||
deleteGlobalParameter4(const db::ServerSelector& selector,
|
||||
const std::string& name) = 0;
|
||||
|
||||
/// @brief Deletes all global parameters.
|
||||
///
|
||||
/// @param selector Server selector.
|
||||
virtual void
|
||||
deleteAllGlobalParameters4(const db::ServerSelector& selector) = 0;
|
||||
};
|
||||
|
||||
} // end of namespace isc::dhcp
|
||||
} // end of namespace isc
|
||||
|
||||
#endif // CONFIG_BACKEND_DHCP4_H
|
346
src/lib/dhcpsrv/config_backend_pool_dhcp4.cc
Normal file
346
src/lib/dhcpsrv/config_backend_pool_dhcp4.cc
Normal file
@@ -0,0 +1,346 @@
|
||||
// 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/.
|
||||
|
||||
#include <config.h>
|
||||
#include <dhcpsrv/config_backend_pool_dhcp4.h>
|
||||
|
||||
using namespace isc::asiolink;
|
||||
using namespace isc::db;
|
||||
using namespace isc::util;
|
||||
|
||||
namespace isc {
|
||||
namespace dhcp {
|
||||
|
||||
Subnet4Ptr
|
||||
ConfigBackendPoolDHCPv4::getSubnet4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const std::string& subnet_prefix) const {
|
||||
Subnet4Ptr subnet;
|
||||
getPropertyPtrConst<Subnet4Ptr, const std::string&>
|
||||
(&ConfigBackendDHCPv4::getSubnet4, backend_selector, server_selector,
|
||||
subnet, subnet_prefix);
|
||||
return (subnet);
|
||||
}
|
||||
|
||||
Subnet4Ptr
|
||||
ConfigBackendPoolDHCPv4::getSubnet4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const SubnetID& subnet_id) const {
|
||||
Subnet4Ptr subnet;
|
||||
getPropertyPtrConst<Subnet4Ptr, const SubnetID&>
|
||||
(&ConfigBackendDHCPv4::getSubnet4, backend_selector, server_selector,
|
||||
subnet, subnet_id);
|
||||
return (subnet);
|
||||
}
|
||||
|
||||
Subnet4Collection
|
||||
ConfigBackendPoolDHCPv4::getAllSubnets4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector) const {
|
||||
Subnet4Collection subnets;
|
||||
getAllPropertiesConst<Subnet4Collection>
|
||||
(&ConfigBackendDHCPv4::getAllSubnets4, backend_selector, server_selector,
|
||||
subnets);
|
||||
return (subnets);
|
||||
}
|
||||
|
||||
Subnet4Collection
|
||||
ConfigBackendPoolDHCPv4::getModifiedSubnets4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const boost::posix_time::ptime& modification_time) const {
|
||||
Subnet4Collection subnets;
|
||||
getMultiplePropertiesConst<Subnet4Collection, const boost::posix_time::ptime&>
|
||||
(&ConfigBackendDHCPv4::getModifiedSubnets4, backend_selector, server_selector,
|
||||
subnets, modification_time);
|
||||
return (subnets);
|
||||
}
|
||||
|
||||
SharedNetwork4Ptr
|
||||
ConfigBackendPoolDHCPv4::getSharedNetwork4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const std::string& name) const {
|
||||
SharedNetwork4Ptr shared_network;
|
||||
getPropertyPtrConst<SharedNetwork4Ptr, const std::string&>
|
||||
(&ConfigBackendDHCPv4::getSharedNetwork4, backend_selector, server_selector,
|
||||
shared_network, name);
|
||||
return (shared_network);
|
||||
}
|
||||
|
||||
SharedNetwork4Collection
|
||||
ConfigBackendPoolDHCPv4::getAllSharedNetworks4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector) const {
|
||||
SharedNetwork4Collection shared_networks;
|
||||
getAllPropertiesConst<SharedNetwork4Collection>
|
||||
(&ConfigBackendDHCPv4::getAllSharedNetworks4, backend_selector, server_selector,
|
||||
shared_networks);
|
||||
return (shared_networks);
|
||||
}
|
||||
|
||||
SharedNetwork4Collection
|
||||
ConfigBackendPoolDHCPv4::
|
||||
getModifiedSharedNetworks4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const boost::posix_time::ptime& modification_time) const {
|
||||
SharedNetwork4Collection shared_networks;
|
||||
getMultiplePropertiesConst<SharedNetwork4Collection, const boost::posix_time::ptime&>
|
||||
(&ConfigBackendDHCPv4::getModifiedSharedNetworks4, backend_selector, server_selector,
|
||||
shared_networks, modification_time);
|
||||
return (shared_networks);
|
||||
}
|
||||
|
||||
OptionDefinitionPtr
|
||||
ConfigBackendPoolDHCPv4::getOptionDef4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const uint16_t code,
|
||||
const std::string& space) const {
|
||||
OptionDefinitionPtr option_def;
|
||||
getPropertyPtrConst<OptionDefinitionPtr, const uint16_t, const std::string&>
|
||||
(&ConfigBackendDHCPv4::getOptionDef4, backend_selector, server_selector,
|
||||
option_def, code, space);
|
||||
return (option_def);
|
||||
}
|
||||
|
||||
OptionDefContainer
|
||||
ConfigBackendPoolDHCPv4::getAllOptionDefs4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector) const {
|
||||
OptionDefContainer option_defs;
|
||||
getAllPropertiesConst<OptionDefContainer>
|
||||
(&ConfigBackendDHCPv4::getAllOptionDefs4, backend_selector, server_selector,
|
||||
option_defs);
|
||||
return (option_defs);
|
||||
}
|
||||
|
||||
OptionDefContainer
|
||||
ConfigBackendPoolDHCPv4::getModifiedOptionDefs4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const boost::posix_time::ptime& modification_time) const {
|
||||
OptionDefContainer option_defs;
|
||||
getMultiplePropertiesConst<OptionDefContainer, const boost::posix_time::ptime&>
|
||||
(&ConfigBackendDHCPv4::getModifiedOptionDefs4, backend_selector, server_selector,
|
||||
option_defs, modification_time);
|
||||
return (option_defs);
|
||||
}
|
||||
|
||||
util::OptionalValue<std::string>
|
||||
ConfigBackendPoolDHCPv4::getGlobalStringParameter4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const std::string& name) const {
|
||||
OptionalValue<std::string> parameter;
|
||||
getOptionalPropertyConst<std::string, const std::string&>
|
||||
(&ConfigBackendDHCPv4::getGlobalStringParameter4, backend_selector,
|
||||
server_selector, parameter, name);
|
||||
return (parameter);
|
||||
}
|
||||
|
||||
util::OptionalValue<int64_t>
|
||||
ConfigBackendPoolDHCPv4::getGlobalNumberParameter4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const std::string& name) const {
|
||||
OptionalValue<int64_t> parameter;
|
||||
getOptionalPropertyConst<int64_t, const std::string&>
|
||||
(&ConfigBackendDHCPv4::getGlobalNumberParameter4, backend_selector,
|
||||
server_selector, parameter, name);
|
||||
return (parameter);
|
||||
}
|
||||
|
||||
std::map<std::string, std::string>
|
||||
ConfigBackendPoolDHCPv4::getAllGlobalParameters4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector) const {
|
||||
std::map<std::string, std::string> parameters;
|
||||
getAllPropertiesConst<std::map<std::string, std::string> >
|
||||
(&ConfigBackendDHCPv4::getAllGlobalParameters4, backend_selector,
|
||||
server_selector, parameters);
|
||||
return (parameters);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigBackendPoolDHCPv4::createUpdateSubnet4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const Subnet4Ptr& subnet) {
|
||||
createUpdateDeleteProperty<const Subnet4Ptr&>
|
||||
(&ConfigBackendDHCPv4::createUpdateSubnet4, backend_selector,
|
||||
server_selector, subnet);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigBackendPoolDHCPv4::createUpdateSharedNetwork4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const SharedNetwork4Ptr& shared_network) {
|
||||
createUpdateDeleteProperty<const SharedNetwork4Ptr&>
|
||||
(&ConfigBackendDHCPv4::createUpdateSharedNetwork4, backend_selector,
|
||||
server_selector, shared_network);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigBackendPoolDHCPv4::createUpdateOptionDef4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const OptionDefinitionPtr& option_def) {
|
||||
createUpdateDeleteProperty<const OptionDefinitionPtr&>
|
||||
(&ConfigBackendDHCPv4::createUpdateOptionDef4, backend_selector,
|
||||
server_selector, option_def);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigBackendPoolDHCPv4::createUpdateOption4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const OptionPtr& option) {
|
||||
createUpdateDeleteProperty<const OptionPtr&>
|
||||
(&ConfigBackendDHCPv4::createUpdateOption4, backend_selector,
|
||||
server_selector, option);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigBackendPoolDHCPv4::createUpdateOption4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const SubnetID& subnet_id,
|
||||
const OptionPtr& option) {
|
||||
createUpdateDeleteProperty<const SubnetID&, const OptionPtr&>
|
||||
(&ConfigBackendDHCPv4::createUpdateOption4, backend_selector,
|
||||
server_selector, subnet_id, option);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigBackendPoolDHCPv4::createUpdateOption4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const IOAddress& pool_start_address,
|
||||
const IOAddress& pool_end_address,
|
||||
const OptionPtr& option) {
|
||||
createUpdateDeleteProperty<const IOAddress&, const IOAddress&, const OptionPtr&>
|
||||
(&ConfigBackendDHCPv4::createUpdateOption4, backend_selector,
|
||||
server_selector, pool_start_address, pool_end_address, option);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigBackendPoolDHCPv4::createUpdateGlobalParameter4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const std::string& name,
|
||||
const std::string& value) {
|
||||
createUpdateDeleteProperty<const std::string&, const std::string&>
|
||||
(&ConfigBackendDHCPv4::createUpdateGlobalParameter4, backend_selector,
|
||||
server_selector, name, value);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigBackendPoolDHCPv4::createUpdateGlobalParameter4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const std::string& name,
|
||||
const int64_t value) {
|
||||
createUpdateDeleteProperty<const std::string&, const int64_t>
|
||||
(&ConfigBackendDHCPv4::createUpdateGlobalParameter4, backend_selector,
|
||||
server_selector, name, value);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigBackendPoolDHCPv4::deleteSubnet4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const std::string& subnet_prefix) {
|
||||
createUpdateDeleteProperty<const std::string&>
|
||||
(&ConfigBackendDHCPv4::deleteSubnet4, backend_selector, server_selector,
|
||||
subnet_prefix);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigBackendPoolDHCPv4::deleteSubnet4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const SubnetID& subnet_id) {
|
||||
createUpdateDeleteProperty<const SubnetID&>
|
||||
(&ConfigBackendDHCPv4::deleteSubnet4, backend_selector, server_selector,
|
||||
subnet_id);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigBackendPoolDHCPv4::deleteAllSubnets4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector) {
|
||||
createUpdateDeleteProperty<>
|
||||
(&ConfigBackendDHCPv4::deleteAllSubnets4, backend_selector, server_selector);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigBackendPoolDHCPv4::deleteSharedNetwork4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const std::string& name) {
|
||||
createUpdateDeleteProperty<const std::string&>
|
||||
(&ConfigBackendDHCPv4::deleteSharedNetwork4, backend_selector,
|
||||
server_selector, name);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigBackendPoolDHCPv4::deleteAllSharedNetworks4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector) {
|
||||
createUpdateDeleteProperty<>
|
||||
(&ConfigBackendDHCPv4::deleteAllSharedNetworks4, backend_selector, server_selector);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigBackendPoolDHCPv4::deleteOptionDef4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const uint16_t code,
|
||||
const std::string& space) {
|
||||
createUpdateDeleteProperty<const uint16_t, const std::string&>
|
||||
(&ConfigBackendDHCPv4::deleteOptionDef4, backend_selector,
|
||||
server_selector, code, space);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigBackendPoolDHCPv4::deleteAllOptionDefs4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector) {
|
||||
createUpdateDeleteProperty<>
|
||||
(&ConfigBackendDHCPv4::deleteAllOptionDefs4, backend_selector, server_selector);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigBackendPoolDHCPv4::deleteOption4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const uint16_t code,
|
||||
const std::string& space) {
|
||||
createUpdateDeleteProperty<const uint16_t, const std::string&>
|
||||
(&ConfigBackendDHCPv4::deleteOption4, backend_selector, server_selector,
|
||||
code, space);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigBackendPoolDHCPv4::deleteOption4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const SubnetID& subnet_id,
|
||||
const uint16_t code,
|
||||
const std::string& space) {
|
||||
createUpdateDeleteProperty<const SubnetID&, const uint16_t, const std::string&>
|
||||
(&ConfigBackendDHCPv4::deleteOption4, backend_selector, server_selector,
|
||||
subnet_id, code, space);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigBackendPoolDHCPv4::deleteOption4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const asiolink::IOAddress& pool_start_address,
|
||||
const asiolink::IOAddress& pool_end_address,
|
||||
const uint16_t code,
|
||||
const std::string& space) {
|
||||
createUpdateDeleteProperty<const IOAddress&, const IOAddress&, const uint16_t,
|
||||
const std::string&>
|
||||
(&ConfigBackendDHCPv4::deleteOption4, backend_selector, server_selector,
|
||||
pool_start_address, pool_end_address, code, space);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigBackendPoolDHCPv4::deleteGlobalParameter4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector,
|
||||
const std::string& name) {
|
||||
createUpdateDeleteProperty<const std::string&>
|
||||
(&ConfigBackendDHCPv4::deleteGlobalParameter4, backend_selector,
|
||||
server_selector, name);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigBackendPoolDHCPv4::deleteAllGlobalParameters4(const BackendSelector& backend_selector,
|
||||
const ServerSelector& server_selector) {
|
||||
createUpdateDeleteProperty<>
|
||||
(&ConfigBackendDHCPv4::deleteAllGlobalParameters4, backend_selector,
|
||||
server_selector);
|
||||
}
|
||||
|
||||
|
||||
} // end of namespace isc::dhcp
|
||||
} // end of namespace isc
|
389
src/lib/dhcpsrv/config_backend_pool_dhcp4.h
Normal file
389
src/lib/dhcpsrv/config_backend_pool_dhcp4.h
Normal file
@@ -0,0 +1,389 @@
|
||||
// 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 CONFIG_BACKEND_POOL_DHCP4_H
|
||||
#define CONFIG_BACKEND_POOL_DHCP4_H
|
||||
|
||||
#include <config_backend/base_config_backend_pool.h>
|
||||
#include <database/backend_selector.h>
|
||||
#include <database/server_selector.h>
|
||||
#include <dhcp/option.h>
|
||||
#include <dhcp/option_definition.h>
|
||||
#include <dhcpsrv/config_backend_dhcp4.h>
|
||||
#include <dhcpsrv/shared_network.h>
|
||||
#include <dhcpsrv/subnet.h>
|
||||
#include <util/optional_value.h>
|
||||
#include <boost/date_time/posix_time/ptime.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace isc {
|
||||
namespace dhcp {
|
||||
|
||||
/// @brief Implementation of the Configuration Backend Pool for DHCPv4.
|
||||
class ConfigBackendPoolDHCPv4 : cb::BaseConfigBackendPool<ConfigBackendDHCPv4> {
|
||||
public:
|
||||
|
||||
/// @brief Retrieves a single subnet by subnet_prefix.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param subnet_prefix Prefix of the subnet to be retrieved.
|
||||
/// @return Pointer to the retrieved subnet or NULL if not found.
|
||||
virtual Subnet4Ptr
|
||||
getSubnet4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const std::string& subnet_prefix) const;
|
||||
|
||||
/// @brief Retrieves a single subnet by subnet identifier.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param subnet_id Identifier of a subnet to be retrieved.
|
||||
/// @return Pointer to the retrieved subnet or NULL if not found.
|
||||
virtual Subnet4Ptr
|
||||
getSubnet4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const SubnetID& subnet_id) const;
|
||||
|
||||
/// @brief Retrieves all subnets.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @return Collection of subnets or empty collection if no subnet found.
|
||||
virtual Subnet4Collection
|
||||
getAllSubnets4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector) const;
|
||||
|
||||
/// @brief Retrieves subnets modified after specified time.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param modification_time Lower bound subnet modification time.
|
||||
/// @return Collection of subnets or empty collection if no subnet found.
|
||||
virtual Subnet4Collection
|
||||
getModifiedSubnets4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const boost::posix_time::ptime& modification_time) const;
|
||||
|
||||
/// @brief Retrieves shared network by name.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param name Name of the shared network to be retrieved.
|
||||
/// @return Pointer to the shared network or NULL if not found.
|
||||
virtual SharedNetwork4Ptr
|
||||
getSharedNetwork4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const std::string& name) const;
|
||||
|
||||
/// @brief Retrieves all shared networks.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @return Collection of shared network or empty collection if
|
||||
/// no shared network found.
|
||||
virtual SharedNetwork4Collection
|
||||
getAllSharedNetworks4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector) const;
|
||||
|
||||
/// @brief Retrieves shared networks modified after specified time.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param Lower bound shared network modification time.
|
||||
/// @return Collection of shared network or empty collection if
|
||||
/// no shared network found.
|
||||
virtual SharedNetwork4Collection
|
||||
getModifiedSharedNetworks4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const boost::posix_time::ptime& modification_time) const;
|
||||
|
||||
/// @brief Retrieves single option definition by code and space.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param code Code of the option to be retrieved.
|
||||
/// @param space Option space of the option to be retrieved.
|
||||
/// @return Pointer to the option definition or NULL if not found.
|
||||
virtual OptionDefinitionPtr
|
||||
getOptionDef4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const uint16_t code,
|
||||
const std::string& space) const;
|
||||
|
||||
/// @brief Retrieves all option definitions.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @return Collection of option definitions or empty collection if
|
||||
/// no option definition found.
|
||||
virtual OptionDefContainer
|
||||
getAllOptionDefs4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector) const;
|
||||
|
||||
/// @brief Retrieves option definitions modified after specified time.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param modification_time Lower bound option definition modification
|
||||
/// time.
|
||||
/// @return Collection of option definitions or empty collection if
|
||||
/// no option definition found.
|
||||
virtual OptionDefContainer
|
||||
getModifiedOptionDefs4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const boost::posix_time::ptime& modification_time) const;
|
||||
|
||||
/// @brief Retrieves global string parameter value.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param name Name of the global parameter to be retrieved.
|
||||
/// @return Value of the global string parameter.
|
||||
virtual util::OptionalValue<std::string>
|
||||
getGlobalStringParameter4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const std::string& name) const;
|
||||
|
||||
/// @brief Retrieves global number parameter.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param name Name of the parameter to be retrieved.
|
||||
virtual util::OptionalValue<int64_t>
|
||||
getGlobalNumberParameter4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const std::string& name) const;
|
||||
|
||||
/// @brief Retrieves all global parameters as strings.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
virtual std::map<std::string, std::string>
|
||||
getAllGlobalParameters4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector) const;
|
||||
|
||||
/// @brief Creates or updates a subnet.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param subnet Subnet to be added or updated.
|
||||
virtual void
|
||||
createUpdateSubnet4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const Subnet4Ptr& subnet);
|
||||
|
||||
/// @brief Creates or updates a shared network.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param shared_network Shared network to be added or updated.
|
||||
virtual void
|
||||
createUpdateSharedNetwork4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const SharedNetwork4Ptr& shared_network);
|
||||
|
||||
/// @brief Creates or updates an option definition.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param option_def Option definition to be added or updated.
|
||||
virtual void
|
||||
createUpdateOptionDef4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const OptionDefinitionPtr& option_def);
|
||||
|
||||
/// @brief Creates or updates global option.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param option Option to be added or updated.
|
||||
virtual void
|
||||
createUpdateOption4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const OptionPtr& option);
|
||||
|
||||
/// @brief Creates or updates subnet level option.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param subnet_id Identifier of a subnet to which option belongs.
|
||||
virtual void
|
||||
createUpdateOption4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const SubnetID& subnet_id, const OptionPtr& option);
|
||||
|
||||
/// @brief Creates or updates pool level option.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param pool_start_address Lower bound address of the pool to which
|
||||
/// the option belongs.
|
||||
/// @param pool_end_address Upper bound address of the pool to which the
|
||||
/// option belongs.
|
||||
virtual void
|
||||
createUpdateOption4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const asiolink::IOAddress& pool_start_address,
|
||||
const asiolink::IOAddress& pool_end_address,
|
||||
const OptionPtr& option);
|
||||
|
||||
/// @brief Creates or updates global string parameter.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param name Name of the global parameter.
|
||||
/// @param value Value of the global parameter.
|
||||
virtual void
|
||||
createUpdateGlobalParameter4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const std::string& name,
|
||||
const std::string& value);
|
||||
|
||||
/// @brief Creates or updates global number parameter.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param name Name of the global parameter.
|
||||
/// @param value Value of the global parameter.
|
||||
virtual void
|
||||
createUpdateGlobalParameter4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const std::string& name,
|
||||
const int64_t value);
|
||||
|
||||
/// @brief Deletes subnet by prefix.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param subnet_prefix Prefix of the subnet to be deleted.
|
||||
virtual void
|
||||
deleteSubnet4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const std::string& subnet_prefix);
|
||||
|
||||
/// @brief Deletes subnet by identifier.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param subnet_id Identifier of the subnet to be deleted.
|
||||
virtual void
|
||||
deleteSubnet4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const SubnetID& subnet_id);
|
||||
|
||||
/// @brief Deletes all subnets.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
virtual void
|
||||
deleteAllSubnets4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector);
|
||||
|
||||
/// @brief Deletes shared network by name.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param name Name of the shared network to be deleted.
|
||||
virtual void
|
||||
deleteSharedNetwork4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const std::string& name);
|
||||
|
||||
/// @brief Deletes all shared networks.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
virtual void
|
||||
deleteAllSharedNetworks4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector);
|
||||
|
||||
/// @brief Deletes option definition.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param code Code of the option to be deleted.
|
||||
/// @param space Option space of the option to be deleted.
|
||||
virtual void
|
||||
deleteOptionDef4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const uint16_t code,
|
||||
const std::string& space);
|
||||
|
||||
/// @brief Deletes all option definitions.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
virtual void
|
||||
deleteAllOptionDefs4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector);
|
||||
|
||||
/// @brief Deletes global option.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param code Code of the option to be deleted.
|
||||
/// @param space Option space of the option to be deleted.
|
||||
virtual void
|
||||
deleteOption4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const uint16_t code,
|
||||
const std::string& space);
|
||||
|
||||
/// @brief Deletes subnet level option.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param subnet_id Identifier of the subnet to which deleted option
|
||||
/// belongs.
|
||||
/// @param code Code of the deleted option.
|
||||
/// @param space Option space of the deleted option.
|
||||
virtual void
|
||||
deleteOption4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const SubnetID& subnet_id,
|
||||
const uint16_t code, const std::string& space);
|
||||
|
||||
/// @brief Deletes pool level option.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param pool_start_address Lower bound address of the pool to which
|
||||
/// deleted option belongs.
|
||||
/// @param pool_end_start Upper bound address of the pool to which the
|
||||
/// deleted option belongs.
|
||||
virtual void
|
||||
deleteOption4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const asiolink::IOAddress& pool_start_address,
|
||||
const asiolink::IOAddress& pool_end_address,
|
||||
const uint16_t code,
|
||||
const std::string& space);
|
||||
|
||||
/// @brief Deletes global parameter.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
/// @param name Name of the global parameter to be deleted.
|
||||
virtual void
|
||||
deleteGlobalParameter4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector,
|
||||
const std::string& name);
|
||||
|
||||
/// @brief Deletes all global parameters.
|
||||
///
|
||||
/// @param backend_selector Backend selector.
|
||||
/// @param server_selector Server selector.
|
||||
virtual void
|
||||
deleteAllGlobalParameters4(const db::BackendSelector& backend_selector,
|
||||
const db::ServerSelector& server_selector);
|
||||
};
|
||||
|
||||
|
||||
} // end of namespace isc::dhcp
|
||||
} // end of namespace isc
|
||||
|
||||
#endif // CONFIG_BACKEND_POOL_DHCP4_H
|
Reference in New Issue
Block a user