28 if (!option->contains(
"space")) {
29 option->set(
"space", Element::create(space));
35 if (!option->contains(
"type")) {
43 if (!option->contains(
"code")) {
54 string index = space->stringValue() +
"@" + name->stringValue();
55 uint16_t val =
static_cast<uint16_t
>(code->intValue());
56 codes.insert(std::pair<string, uint16_t>(index, val));
70 string index = space->stringValue() +
"@" + name->stringValue();
71 OptionCodes::const_iterator it = codes.find(index);
72 if (it == codes.end()) {
76 option->set(
"code", Element::create(
static_cast<int>(it->second)));
84 STANDARD_V4_OPTION_DEFINITIONS_SIZE);
86 LAST_RESORT_V4_OPTION_DEFINITIONS_SIZE);
92 STANDARD_V6_OPTION_DEFINITIONS_SIZE);
97 MAPE_V6_OPTION_DEFINITIONS,
98 MAPE_V6_OPTION_DEFINITIONS_SIZE);
100 MAPT_V6_OPTION_DEFINITIONS,
101 MAPT_V6_OPTION_DEFINITIONS_SIZE);
103 LW_V6_OPTION_DEFINITIONS,
104 LW_V6_OPTION_DEFINITIONS_SIZE);
106 V4V6_RULE_OPTION_DEFINITIONS,
107 V4V6_RULE_OPTION_DEFINITIONS_SIZE);
109 V4V6_BIND_OPTION_DEFINITIONS,
110 V4V6_BIND_OPTION_DEFINITIONS_SIZE);
112 ISC_V6_OPTION_DEFINITIONS,
113 ISC_V6_OPTION_DEFINITIONS_SIZE);
120 size_t params_size) {
121 for (
size_t i = 0; i < params_size; ++i) {
122 string index = space +
"@" + params[i].
name;
123 codes.insert(std::pair<string, uint16_t>(index, params[i].code));
static void setCode(isc::data::ElementPtr option, const OptionCodes &codes)
Set code from name and definitions.
static void initCodes(OptionCodes &codes, const std::string &space)
Initialize code map.
static void setSpace(isc::data::ElementPtr option, const std::string &space)
Set space.
AdaptorOption()
Constructor.
static void checkType(isc::data::ConstElementPtr option)
Checks if type is specified in option definition.
static void initCodesInternal(OptionCodes &codes, const std::string &space, const isc::dhcp::OptionDefParams *params, size_t params_size)
Initialize code map from option definition parameters.
virtual ~AdaptorOption()
Destructor.
static void collect(isc::data::ConstElementPtr option, OptionCodes &codes)
Collect definition.
static void checkCode(isc::data::ConstElementPtr option)
Check if code is specified in option defintion.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
const OptionDefParams DOCSIS3_V4_OPTION_DEFINITIONS[]
Definitions of standard DHCPv4 options.
const int DOCSIS3_V6_OPTION_DEFINITIONS_SIZE
Number of option definitions defined.
const int DOCSIS3_V4_OPTION_DEFINITIONS_SIZE
Number of option definitions defined.
const OptionDefParams DOCSIS3_V6_OPTION_DEFINITIONS[]
Definitions of standard DHCPv6 options.
std::map< std::string, uint16_t > OptionCodes
Map for DHCP option definitions handling code and an index built from space and name.
Defines the logger used by the top-level component of kea-lfc.
#define V4V6_BIND_OPTION_SPACE
#define DHCP4_OPTION_SPACE
global std option spaces
#define V4V6_RULE_OPTION_SPACE
#define MAPE_V6_OPTION_SPACE
#define LW_V6_OPTION_SPACE
#define DHCP6_OPTION_SPACE
#define MAPT_V6_OPTION_SPACE
Parameters being used to make up an option definition.