17#include <boost/multi_index_container.hpp>
18#include <boost/multi_index/hashed_index.hpp>
19#include <boost/multi_index/ordered_index.hpp>
20#include <boost/multi_index/sequenced_index.hpp>
21#include <boost/multi_index/mem_fun.hpp>
22#include <boost/multi_index/member.hpp>
23#include <boost/shared_ptr.hpp>
31class OptionDescriptor;
86 const std::string& formatted_value =
"",
117 if (
this != &other) {
119 data::StampedElement::operator=(other);
139 const std::string& formatted_value =
"",
210typedef boost::multi_index_container<
214 boost::multi_index::indexed_by<
218 boost::multi_index::sequenced<>,
220 boost::multi_index::hashed_non_unique<
228 boost::multi_index::const_mem_fun<
235 boost::multi_index::member<
244 boost::multi_index::hashed_non_unique<
245 boost::multi_index::member<
253 boost::multi_index::ordered_non_unique<
254 boost::multi_index::const_mem_fun<
256 boost::posix_time::ptime,
263 boost::multi_index::hashed_non_unique<
264 boost::multi_index::tag<OptionIdIndexTag>,
278typedef std::pair<OptionContainerTypeIndex::const_iterator,
285typedef std::pair<OptionContainerPersistIndex::const_iterator,
378 void add(
const OptionPtr& option,
const bool persistent,
379 const std::string& option_space,
380 const uint64_t
id = 0);
543 template<
typename Selector>
545 const uint16_t option_code)
const {
549 if (!options || options->empty()) {
555 OptionContainerTypeIndex::const_iterator od_itr = idx.find(option_code);
556 if (od_itr == idx.end()) {
573 size_t del(
const std::string& option_space,
const uint16_t option_code);
581 size_t del(
const uint32_t vendor_id,
const uint16_t option_code);
604 size_t del(
const uint64_t
id);
659 void encapsulateInternal(
const std::string& option_space);
669 void encapsulateInternal(
const OptionPtr& option);
684 template <
typename Selector>
698 uint32_t> VendorOptionSpaceCollection;
700 VendorOptionSpaceCollection vendor_options_;
This class represents configuration element which is associated with database identifier and the modi...
boost::posix_time::ptime getModificationTime() const
Returns timestamp.
uint64_t getId() const
Returns element's database identifier.
This class represents configuration element which is associated with database identifier,...
Represents option data configuration for the DHCP server.
void encapsulate()
Appends encapsulated options to top-level options.
void replace(const OptionDescriptor &desc, const std::string &option_space)
Replaces the instance of an option within this collection.
static bool createDescriptorOption(CfgOptionDefPtr cfg_def, const std::string &space, OptionDescriptor &opt_desc)
Creates an option descriptor's option based on a set of option defs.
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
void createOptions(CfgOptionDefPtr cfg_def)
Re-create the option in each descriptor based on given definitions.
OptionDescriptor get(const Selector &key, const uint16_t option_code) const
Returns option for the specified key and option code.
isc::data::ElementPtr toElementWithMetadata(const bool include_metadata) const
Unparse a configuration object with optionally including the metadata.
size_t del(const std::string &option_space, const uint16_t option_code)
Deletes option for the specified option space and option code.
std::list< std::string > getOptionSpaceNames() const
Returns a list of configured option space names.
bool empty() const
Indicates the object is empty.
bool operator==(const CfgOption &other) const
Equality operator.
bool operator!=(const CfgOption &other) const
Inequality operator.
void mergeTo(CfgOption &other) const
Merges this configuration to another configuration.
void copyTo(CfgOption &other) const
Copies this configuration to another configuration.
CfgOption()
default constructor
std::list< std::string > getVendorIdsSpaceNames() const
Returns a list of option space names for configured vendor ids.
OptionContainerPtr getAll(const std::string &option_space) const
Returns all options for the specified option space.
void merge(CfgOptionDefPtr cfg_def, CfgOption &other)
Merges another option configuration into this one.
void add(const OptionPtr &option, const bool persistent, const std::string &option_space, const uint64_t id=0)
Adds instance of the option to the configuration.
bool equals(const CfgOption &other) const
Check if configuration is equal to other configuration.
std::list< uint32_t > getVendorIds() const
Returns a list of all configured vendor identifiers.
OptionPtr option_
Option instance.
bool operator!=(const OptionDescriptor &other) const
Inequality operator.
std::string space_name_
Option space name.
OptionDescriptor & operator=(const OptionDescriptor &other)
Assignment operator.
OptionDescriptor(bool persist)
Constructor.
bool equals(const OptionDescriptor &other) const
Checks if the one descriptor is equal to another.
OptionDescriptor(const OptionPtr &opt, bool persist, const std::string &formatted_value="", data::ConstElementPtr user_context=data::ConstElementPtr())
Constructor.
std::string formatted_value_
Option value in textual (CSV) format.
static OptionDescriptorPtr create(const OptionPtr &opt, bool persist, const std::string &formatted_value="", data::ConstElementPtr user_context=data::ConstElementPtr())
Factory function creating an instance of the OptionDescriptor.
bool operator==(const OptionDescriptor &other) const
Equality operator.
OptionDescriptor(const OptionDescriptor &desc)
Copy constructor.
bool persistent_
Persistence flag.
Simple container for option spaces holding various items.
std::list< Selector > getOptionSpaceNames() const
Get a list of existing option spaces.
uint16_t getType() const
Returns option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
boost::shared_ptr< CfgOption > CfgOptionPtr
Non-const pointer.
std::pair< OptionContainerTypeIndex::const_iterator, OptionContainerTypeIndex::const_iterator > OptionContainerTypeRange
Pair of iterators to represent the range of options having the same option type value.
OptionContainer::nth_index< 1 >::type OptionContainerTypeIndex
Type of the index #1 - option type.
std::map< std::string, OptionSpacePtr > OptionSpaceCollection
A collection of option spaces.
boost::shared_ptr< CfgOptionDef > CfgOptionDefPtr
Non-const pointer.
std::pair< OptionContainerPersistIndex::const_iterator, OptionContainerPersistIndex::const_iterator > OptionContainerPersistRange
Pair of iterators to represent the range of options having the same persistency flag.
boost::multi_index_container< OptionDescriptor, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::hashed_non_unique< KeyFromKeyExtractor< boost::multi_index::const_mem_fun< Option, uint16_t, &Option::getType >, boost::multi_index::member< OptionDescriptor, OptionPtr, &OptionDescriptor::option_ > > >, boost::multi_index::hashed_non_unique< boost::multi_index::member< OptionDescriptor, bool, &OptionDescriptor::persistent_ > >, boost::multi_index::ordered_non_unique< boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime, &data::BaseStampedElement::getModificationTime > >, boost::multi_index::hashed_non_unique< boost::multi_index::tag< OptionIdIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, uint64_t, &data::BaseStampedElement::getId > > > > OptionContainer
Multi index container for DHCP option descriptors.
boost::shared_ptr< OptionDescriptor > OptionDescriptorPtr
A pointer to option descriptor.
boost::shared_ptr< OptionContainer > OptionContainerPtr
Pointer to the OptionContainer object.
OptionContainer::nth_index< 2 >::type OptionContainerPersistIndex
Type of the index #2 - option persistency flag.
boost::shared_ptr< Option > OptionPtr
std::list< ConstCfgOptionPtr > CfgOptionList
Const pointer list.
boost::shared_ptr< const CfgOption > ConstCfgOptionPtr
Const pointer.
Defines the logger used by the top-level component of kea-lfc.
Abstract class for configuration Cfg_* classes.
Base class for user context.
data::ConstElementPtr getContext() const
Returns const pointer to the user context.
void setContext(const data::ConstElementPtr &ctx)
Sets user context.