 |
Kea
1.5.0
|
Go to the documentation of this file.
7 #ifndef OPTION_DEFINITION_H
8 #define OPTION_DEFINITION_H
16 #include <boost/multi_index/hashed_index.hpp>
17 #include <boost/multi_index/mem_fun.hpp>
18 #include <boost/multi_index/sequenced_index.hpp>
19 #include <boost/multi_index_container.hpp>
20 #include <boost/shared_ptr.hpp>
51 class OptionDefinition;
154 const std::string& type,
155 const bool array_type =
false);
167 const bool array_type =
false);
185 const std::string& type,
186 const char* encapsulated_space);
205 const char* encapsulated_space);
270 return (encapsulated_space_);
276 std::string
getName()
const {
return (name_); }
282 return (record_fields_);
325 return (option_space_name_);
334 option_space_name_ = option_space_name;
504 const std::vector<std::string>& values)
const;
615 const std::string& encapsulated_space,
619 option->setEncapsulatedSpace(encapsulated_space);
620 option->unpack(begin, end);
692 return (type == type_);
713 bool convertToBool(
const std::string& value_str)
const;
728 T lexicalCastWithRangeCheck(
const std::string& value_str)
const;
758 std::string encapsulated_space_;
764 std::string option_space_name_;
782 typedef boost::multi_index_container<
786 boost::multi_index::indexed_by<
789 boost::multi_index::sequenced<>,
791 boost::multi_index::hashed_non_unique<
798 boost::multi_index::const_mem_fun<
805 boost::multi_index::hashed_non_unique<
809 boost::multi_index::const_mem_fun<
833 typedef std::pair<OptionDefContainerTypeIndex::const_iterator,
842 typedef std::pair<OptionDefContainerNameIndex::const_iterator,
853 #endif // OPTION_DEFINITION_H
void setContext(const data::ConstElementPtr &ctx)
Sets user context.
std::string getName() const
Return option name.
std::vector< uint8_t > OptionBuffer
buffer types used in DHCP code.
bool equals(const OptionDefinition &other) const
Check if option definition is equal to other.
boost::shared_ptr< OptionDefinition > OptionDefinitionPtr
Pointer to option definition object.
void validate() const
Check if the option definition is valid.
bool haveClientFqdnFormat() const
Check if specified format is OPTION_CLIENT_FQDN option format.
const RecordFieldsCollection & getRecordFields() const
Return list of record fields.
static OptionPtr factoryAddrList6(uint16_t type, OptionBufferConstIter begin, OptionBufferConstIter end)
Factory to create option with address list.
bool haveOpaqueDataTuplesFormat() const
Check if the option has format of OpaqueDataTuples type options.
void addRecordField(const std::string &data_type_name)
Adds data field to the record.
Base class for user context.
bool haveFqdn4Format() const
Check if option has format of the DHCPv4 Client FQDN Option.
std::pair< OptionDefContainerTypeIndex::const_iterator, OptionDefContainerTypeIndex::const_iterator > OptionDefContainerTypeRange
Pair of iterators to represent the range of options definitions having the same option type value.
static OptionPtr factoryAddrList4(uint16_t type, OptionBufferConstIter begin, OptionBufferConstIter end)
Factory to create option with address list.
Simple container for option spaces holding various items.
static OptionPtr factoryIA6(uint16_t type, OptionBufferConstIter begin, OptionBufferConstIter end)
Factory for IA-type of option.
static OptionPtr factoryOpaqueDataTuples(Option::Universe u, uint16_t type, OptionBufferConstIter begin, OptionBufferConstIter end)
Factory to create option with tuple list.
Base class representing a DHCP option definition.
bool operator!=(const OptionDefinition &other) const
Inequality operator.
bool haveIA6Format() const
Check if specified format is IA_NA option format.
static OptionPtr factoryIntegerArray(Option::Universe u, uint16_t type, OptionBufferConstIter begin, OptionBufferConstIter end)
Factory function to create option with array of integer values.
This is a base class for exceptions thrown from the DNS library module.
data::ConstElementPtr getContext() const
Returns const pointer to the user context.
void contextToElement(data::ElementPtr map) const
Merge unparse a user_context object.
data::ConstElementPtr getContext() const
Returns const pointer to the user context.
Defines the logger used by the top-level component of kea-dhcp-ddns.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
bool haveIAAddr6Format() const
Check if specified format is IAADDR option format.
bool haveVendorClass4Format() const
Check if the option has format of DHCPv4 V-I Vendor Class option.
OptionSpaceContainer< OptionDefContainer, OptionDefinitionPtr, std::string > OptionDefSpaceContainer
static OptionPtr factoryInteger(Option::Universe u, uint16_t type, const std::string &encapsulated_space, OptionBufferConstIter begin, OptionBufferConstIter end)
Factory function to create option with integer value.
Exception to be thrown when invalid option value has been specified for a particular option definitio...
static OptionPtr factoryGeneric(Option::Universe u, uint16_t type, OptionBufferConstIter begin, OptionBufferConstIter end)
Factory to create generic option.
This class represents configuration element which is associated with the modification timestamp.
bool haveStatusCodeFormat() const
Check if the option has format of DHCPv6 Status Code option.
OptionDefContainer::nth_index< 2 >::type OptionDefContainerNameIndex
Type of the index #2 - option name.
bool getArrayType() const
Return array type indicator.
bool haveIAPrefix6Format() const
Check if specified format is IAPREFIX option format.
bool haveCompressedFqdnListFormat() const
Check if the option has format of CompressedFqdnList options.
uint16_t getCode() const
Return option code.
OptionDefinition(const std::string &name, const uint16_t code, const std::string &type, const bool array_type=false)
Constructor.
boost::multi_index_container< OptionDefinitionPtr, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::hashed_non_unique< boost::multi_index::const_mem_fun< OptionDefinition, uint16_t, &OptionDefinition::getCode > >, boost::multi_index::hashed_non_unique< boost::multi_index::const_mem_fun< OptionDefinition, std::string, &OptionDefinition::getName > > >> OptionDefContainer
Multi index container for DHCP option definitions.
void setContext(const data::ConstElementPtr &ctx)
Sets user context.
InvalidOptionValue(const char *file, size_t line, const char *what)
std::map< uint32_t, OptionDefContainerPtr > VendorOptionDefContainers
Container that holds various vendor option containers.
bool haveServiceScopeFormat() const
Check if option has format of the SLP Service Scope Option.
void contextToElement(data::ElementPtr map) const
Merge unparse a user_context object.
Forward declaration to OptionInt.
static OptionPtr factoryIAAddr6(uint16_t type, OptionBufferConstIter begin, OptionBufferConstIter end)
Factory for IAADDR-type of option.
Exception to be thrown when the particular option definition duplicates existing option definition.
bool haveVendor6Format() const
Check if option has a format of the Vendor-Specific Information Option.
OptionDataType
Data types of DHCP option fields.
void setOptionSpaceName(const std::string &option_space_name)
Sets option space name for option definition.
std::map< std::string, OptionDefContainerPtr > OptionDefContainers
Container that holds option definitions for various option spaces.
boost::shared_ptr< Option > OptionPtr
OptionDataType getType() const
Return option data type.
bool haveVendor4Format() const
Check if the option has format of Vendor-Identifying Vendor Specific Options.
Forward declaration to OptionIntArray.
Universe
defines option universe DHCPv4 or DHCPv6
boost::shared_ptr< Element > ElementPtr
static OptionPtr factoryEmpty(Option::Universe u, uint16_t type)
Empty option factory.
boost::shared_ptr< const Element > ConstElementPtr
std::pair< OptionDefContainerNameIndex::const_iterator, OptionDefContainerNameIndex::const_iterator > OptionDefContainerNameRange
Pair of iterators to represent the range of options definitions having the same option name.
OptionPtr optionFactory(Option::Universe u, uint16_t type, OptionBufferConstIter begin, OptionBufferConstIter end) const
Option factory.
boost::shared_ptr< OptionDefContainer > OptionDefContainerPtr
Pointer to an option definition container.
DuplicateOptionDefinition(const char *file, size_t line, const char *what)
bool operator==(const OptionDefinition &other) const
Equality operator.
std::string getOptionSpaceName() const
Returns option space name.
std::vector< OptionDataType >::const_iterator RecordFieldsConstIter
Const iterator for record data fields.
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
bool haveVendorClass6Format() const
Check if the option has format of DHCPv6 Vendor Class option.
std::vector< OptionDataType > RecordFieldsCollection
List of fields within the record.
OptionDefContainer::nth_index< 1 >::type OptionDefContainerTypeIndex
Type of the index #1 - option type.
std::string getEncapsulatedSpace() const
Return name of the encapsulated option space.
static OptionPtr factoryIAPrefix6(uint16_t type, OptionBufferConstIter begin, OptionBufferConstIter end)
Factory for IAPREFIX-type of option.