mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-03 23:45:27 +00:00
[4204] Runtime option definitions held in the libdhcp++ library.
This commit is contained in:
@@ -22,7 +22,6 @@
|
|||||||
#include <dhcpsrv/cfgmgr.h>
|
#include <dhcpsrv/cfgmgr.h>
|
||||||
#include <dhcpsrv/parsers/client_class_def_parser.h>
|
#include <dhcpsrv/parsers/client_class_def_parser.h>
|
||||||
#include <dhcp4/json_config_parser.h>
|
#include <dhcp4/json_config_parser.h>
|
||||||
#include <dhcpsrv/option_space_container.h>
|
|
||||||
#include <dhcpsrv/parsers/dbaccess_parser.h>
|
#include <dhcpsrv/parsers/dbaccess_parser.h>
|
||||||
#include <dhcpsrv/parsers/dhcp_parsers.h>
|
#include <dhcpsrv/parsers/dhcp_parsers.h>
|
||||||
#include <dhcpsrv/parsers/expiration_config_parser.h>
|
#include <dhcpsrv/parsers/expiration_config_parser.h>
|
||||||
|
@@ -43,6 +43,7 @@ libkea_dhcp___la_SOURCES += option_data_types.cc option_data_types.h
|
|||||||
libkea_dhcp___la_SOURCES += option_definition.cc option_definition.h
|
libkea_dhcp___la_SOURCES += option_definition.cc option_definition.h
|
||||||
libkea_dhcp___la_SOURCES += option_opaque_data_tuples.cc option_opaque_data_tuples.h
|
libkea_dhcp___la_SOURCES += option_opaque_data_tuples.cc option_opaque_data_tuples.h
|
||||||
libkea_dhcp___la_SOURCES += option_space.cc option_space.h
|
libkea_dhcp___la_SOURCES += option_space.cc option_space.h
|
||||||
|
libkea_dhcp___la_SOURCES += option_space_container.h
|
||||||
libkea_dhcp___la_SOURCES += option_string.cc option_string.h
|
libkea_dhcp___la_SOURCES += option_string.cc option_string.h
|
||||||
libkea_dhcp___la_SOURCES += protocol_util.cc protocol_util.h
|
libkea_dhcp___la_SOURCES += protocol_util.cc protocol_util.h
|
||||||
libkea_dhcp___la_SOURCES += pkt.cc pkt.h
|
libkea_dhcp___la_SOURCES += pkt.cc pkt.h
|
||||||
|
@@ -52,6 +52,10 @@ VendorOptionDefContainers LibDHCP::vendor4_defs_;
|
|||||||
|
|
||||||
VendorOptionDefContainers LibDHCP::vendor6_defs_;
|
VendorOptionDefContainers LibDHCP::vendor6_defs_;
|
||||||
|
|
||||||
|
// Static container with option definitions created in runtime.
|
||||||
|
OptionDefSpaceContainer LibDHCP::runtime_option_defs_;
|
||||||
|
|
||||||
|
|
||||||
// Those two vendor classes are used for cable modems:
|
// Those two vendor classes are used for cable modems:
|
||||||
|
|
||||||
/// DOCSIS3.0 compatible cable modem
|
/// DOCSIS3.0 compatible cable modem
|
||||||
@@ -194,6 +198,17 @@ LibDHCP::getVendorOptionDef(const Option::Universe u, const uint32_t vendor_id,
|
|||||||
return (OptionDefinitionPtr());
|
return (OptionDefinitionPtr());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
LibDHCP::setRuntimeOptionDefs(const OptionDefSpaceContainer& defs) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
LibDHCP::clearRuntimeOptionDefs() {
|
||||||
|
runtime_option_defs_.clearItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
LibDHCP::isStandardOption(const Option::Universe u, const uint16_t code) {
|
LibDHCP::isStandardOption(const Option::Universe u, const uint16_t code) {
|
||||||
if (u == Option::V6) {
|
if (u == Option::V6) {
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
#define LIBDHCP_H
|
#define LIBDHCP_H
|
||||||
|
|
||||||
#include <dhcp/option_definition.h>
|
#include <dhcp/option_definition.h>
|
||||||
|
#include <dhcp/option_space_container.h>
|
||||||
#include <dhcp/pkt6.h>
|
#include <dhcp/pkt6.h>
|
||||||
#include <util/buffer.h>
|
#include <util/buffer.h>
|
||||||
|
|
||||||
@@ -256,6 +257,21 @@ public:
|
|||||||
const OptionBuffer& buf,
|
const OptionBuffer& buf,
|
||||||
isc::dhcp::OptionCollection& options);
|
isc::dhcp::OptionCollection& options);
|
||||||
|
|
||||||
|
|
||||||
|
/// @brief Copies option definitions created at runtime.
|
||||||
|
///
|
||||||
|
/// Copied option definitions will be used as "runtime" option definitions.
|
||||||
|
/// A typical use case is to set option definitions specified by the user
|
||||||
|
/// in the server configuration. These option definitions should be removed
|
||||||
|
/// or replaced with new option definitions upon reconfiguration.
|
||||||
|
///
|
||||||
|
/// @param defs Const reference to a container holding option definitions
|
||||||
|
/// grouped by option spaces.
|
||||||
|
static void setRuntimeOptionDefs(const OptionDefSpaceContainer& defs);
|
||||||
|
|
||||||
|
/// @brief Removes runtime option definitions.
|
||||||
|
static void clearRuntimeOptionDefs();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/// Initialize standard DHCPv4 option definitions.
|
/// Initialize standard DHCPv4 option definitions.
|
||||||
@@ -301,6 +317,9 @@ private:
|
|||||||
|
|
||||||
/// Container for v6 vendor option definitions
|
/// Container for v6 vendor option definitions
|
||||||
static VendorOptionDefContainers vendor6_defs_;
|
static VendorOptionDefContainers vendor6_defs_;
|
||||||
|
|
||||||
|
/// Container for additional option defnitions created in runtime.
|
||||||
|
static OptionDefSpaceContainer runtime_option_defs_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <dhcp/option.h>
|
#include <dhcp/option.h>
|
||||||
#include <dhcp/option_data_types.h>
|
#include <dhcp/option_data_types.h>
|
||||||
|
#include <dhcp/option_space_container.h>
|
||||||
|
|
||||||
#include <boost/multi_index/hashed_index.hpp>
|
#include <boost/multi_index/hashed_index.hpp>
|
||||||
#include <boost/multi_index/mem_fun.hpp>
|
#include <boost/multi_index/mem_fun.hpp>
|
||||||
@@ -766,6 +767,10 @@ typedef OptionDefContainer::nth_index<2>::type OptionDefContainerNameIndex;
|
|||||||
typedef std::pair<OptionDefContainerNameIndex::const_iterator,
|
typedef std::pair<OptionDefContainerNameIndex::const_iterator,
|
||||||
OptionDefContainerNameIndex::const_iterator> OptionDefContainerNameRange;
|
OptionDefContainerNameIndex::const_iterator> OptionDefContainerNameRange;
|
||||||
|
|
||||||
|
typedef OptionSpaceContainer<
|
||||||
|
OptionDefContainer, OptionDefinitionPtr, std::string
|
||||||
|
> OptionDefSpaceContainer;
|
||||||
|
|
||||||
|
|
||||||
} // namespace isc::dhcp
|
} // namespace isc::dhcp
|
||||||
} // namespace isc
|
} // namespace isc
|
||||||
|
@@ -128,7 +128,6 @@ libkea_dhcpsrv_la_SOURCES += ncr_generator.cc ncr_generator.h
|
|||||||
if HAVE_PGSQL
|
if HAVE_PGSQL
|
||||||
libkea_dhcpsrv_la_SOURCES += pgsql_lease_mgr.cc pgsql_lease_mgr.h
|
libkea_dhcpsrv_la_SOURCES += pgsql_lease_mgr.cc pgsql_lease_mgr.h
|
||||||
endif
|
endif
|
||||||
libkea_dhcpsrv_la_SOURCES += option_space_container.h
|
|
||||||
libkea_dhcpsrv_la_SOURCES += pool.cc pool.h
|
libkea_dhcpsrv_la_SOURCES += pool.cc pool.h
|
||||||
libkea_dhcpsrv_la_SOURCES += srv_config.cc srv_config.h
|
libkea_dhcpsrv_la_SOURCES += srv_config.cc srv_config.h
|
||||||
libkea_dhcpsrv_la_SOURCES += subnet.cc subnet.h
|
libkea_dhcpsrv_la_SOURCES += subnet.cc subnet.h
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
#define CFG_OPTION_H
|
#define CFG_OPTION_H
|
||||||
|
|
||||||
#include <dhcp/option.h>
|
#include <dhcp/option.h>
|
||||||
|
#include <dhcp/option_space_container.h>
|
||||||
#include <dhcpsrv/key_from_key.h>
|
#include <dhcpsrv/key_from_key.h>
|
||||||
#include <dhcpsrv/option_space_container.h>
|
|
||||||
#include <boost/multi_index_container.hpp>
|
#include <boost/multi_index_container.hpp>
|
||||||
#include <boost/multi_index/hashed_index.hpp>
|
#include <boost/multi_index/hashed_index.hpp>
|
||||||
#include <boost/multi_index/sequenced_index.hpp>
|
#include <boost/multi_index/sequenced_index.hpp>
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
#define CFG_OPTION_DEF_H
|
#define CFG_OPTION_DEF_H
|
||||||
|
|
||||||
#include <dhcp/option_definition.h>
|
#include <dhcp/option_definition.h>
|
||||||
#include <dhcpsrv/option_space_container.h>
|
#include <dhcp/option_space_container.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace isc {
|
namespace isc {
|
||||||
|
@@ -18,10 +18,10 @@
|
|||||||
#include <asiolink/io_address.h>
|
#include <asiolink/io_address.h>
|
||||||
#include <cc/data.h>
|
#include <cc/data.h>
|
||||||
#include <dhcp/option_definition.h>
|
#include <dhcp/option_definition.h>
|
||||||
|
#include <dhcp/option_space_container.h>
|
||||||
#include <dhcpsrv/d2_client_cfg.h>
|
#include <dhcpsrv/d2_client_cfg.h>
|
||||||
#include <dhcpsrv/cfg_iface.h>
|
#include <dhcpsrv/cfg_iface.h>
|
||||||
#include <dhcpsrv/cfg_option.h>
|
#include <dhcpsrv/cfg_option.h>
|
||||||
#include <dhcpsrv/option_space_container.h>
|
|
||||||
#include <dhcpsrv/subnet.h>
|
#include <dhcpsrv/subnet.h>
|
||||||
#include <dhcpsrv/parsers/dhcp_config_parser.h>
|
#include <dhcpsrv/parsers/dhcp_config_parser.h>
|
||||||
#include <exceptions/exceptions.h>
|
#include <exceptions/exceptions.h>
|
||||||
@@ -36,12 +36,6 @@
|
|||||||
namespace isc {
|
namespace isc {
|
||||||
namespace dhcp {
|
namespace dhcp {
|
||||||
|
|
||||||
/// @brief Storage for option definitions.
|
|
||||||
typedef OptionSpaceContainer<OptionDefContainer,
|
|
||||||
OptionDefinitionPtr, std::string> OptionDefStorage;
|
|
||||||
/// @brief Shared pointer to option definitions storage.
|
|
||||||
typedef boost::shared_ptr<OptionDefStorage> OptionDefStoragePtr;
|
|
||||||
|
|
||||||
/// Collection of containers holding option spaces. Each container within
|
/// Collection of containers holding option spaces. Each container within
|
||||||
/// a particular option space holds so-called option descriptors.
|
/// a particular option space holds so-called option descriptors.
|
||||||
typedef OptionSpaceContainer<OptionContainer, OptionDescriptor,
|
typedef OptionSpaceContainer<OptionContainer, OptionDescriptor,
|
||||||
|
@@ -18,8 +18,8 @@
|
|||||||
#include <asiolink/io_address.h>
|
#include <asiolink/io_address.h>
|
||||||
#include <dhcp/option.h>
|
#include <dhcp/option.h>
|
||||||
#include <dhcp/classify.h>
|
#include <dhcp/classify.h>
|
||||||
|
#include <dhcp/option_space_container.h>
|
||||||
#include <dhcpsrv/cfg_option.h>
|
#include <dhcpsrv/cfg_option.h>
|
||||||
#include <dhcpsrv/option_space_container.h>
|
|
||||||
#include <dhcpsrv/pool.h>
|
#include <dhcpsrv/pool.h>
|
||||||
#include <dhcpsrv/triplet.h>
|
#include <dhcpsrv/triplet.h>
|
||||||
#include <dhcpsrv/lease.h>
|
#include <dhcpsrv/lease.h>
|
||||||
|
Reference in New Issue
Block a user