18 AdaptorOption::AdaptorOption() {
21 AdaptorOption::~AdaptorOption() {
25 AdaptorOption::setSpace(
ElementPtr option,
const string& space) {
26 if (!option->contains(
"space")) {
27 option->set(
"space", Element::create(space));
33 if (!option->contains(
"type")) {
41 if (!option->contains(
"code")) {
52 string index = space->stringValue() +
"@" + name->stringValue();
53 uint16_t val = static_cast<uint16_t>(code->intValue());
54 codes.insert(std::pair<string, uint16_t>(index, val));
68 string index = space->stringValue() +
"@" + name->stringValue();
69 OptionCodes::const_iterator it = codes.find(index);
70 if (it == codes.end()) {
74 option->set(
"code", Element::create(static_cast<int>(it->second)));
79 AdaptorOption::initCodes(
OptionCodes& codes,
const string& space) {
80 if (space ==
"dhcp4") {
81 initCodesInternal(codes, space, STANDARD_V4_OPTION_DEFINITIONS,
82 STANDARD_V4_OPTION_DEFINITIONS_SIZE);
83 initCodesInternal(codes, space, LAST_RESORT_V4_OPTION_DEFINITIONS,
84 LAST_RESORT_V4_OPTION_DEFINITIONS_SIZE);
85 initCodesInternal(codes,
"vendor-4491",
87 }
else if (space ==
"dhcp6") {
88 initCodesInternal(codes, space, STANDARD_V6_OPTION_DEFINITIONS,
89 STANDARD_V6_OPTION_DEFINITIONS_SIZE);
90 initCodesInternal(codes,
"vendor-4491",
93 MAPE_V6_OPTION_DEFINITIONS,
94 MAPE_V6_OPTION_DEFINITIONS_SIZE);
96 MAPT_V6_OPTION_DEFINITIONS,
97 MAPT_V6_OPTION_DEFINITIONS_SIZE);
99 LW_V6_OPTION_DEFINITIONS,
100 LW_V6_OPTION_DEFINITIONS_SIZE);
102 V4V6_RULE_OPTION_DEFINITIONS,
103 V4V6_RULE_OPTION_DEFINITIONS_SIZE);
105 V4V6_BIND_OPTION_DEFINITIONS,
106 V4V6_BIND_OPTION_DEFINITIONS_SIZE);
107 initCodesInternal(codes,
"vendor-2495",
108 ISC_V6_OPTION_DEFINITIONS,
109 ISC_V6_OPTION_DEFINITIONS_SIZE);
114 AdaptorOption::initCodesInternal(
OptionCodes& codes,
const string& space,
116 size_t params_size) {
117 for (
size_t i = 0; i < params_size; ++i) {
118 string index = space +
"@" + params[i].
name;
119 codes.insert(std::pair<string, uint16_t>(index, params[i].code));
std::map< std::string, uint16_t > OptionCodes
Map for DHCP option definitions handling code and an index built from space and name.
const OptionDefParams DOCSIS3_V6_DEFS[]
Definitions of standard DHCPv6 options.
#define V4V6_BIND_OPTION_SPACE
boost::shared_ptr< Element > ElementPtr
Parameters being used to make up an option definition.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
const int DOCSIS3_V6_DEFS_SIZE
Number of option definitions defined.
boost::shared_ptr< const Element > ConstElementPtr
const int DOCSIS3_V4_DEFS_SIZE
Number of option definitions defined.
Defines the logger used by the top-level component of kea-dhcp-ddns.
const OptionDefParams DOCSIS3_V4_DEFS[]
Definitions of standard DHCPv4 options.
#define MAPT_V6_OPTION_SPACE
#define LW_V6_OPTION_SPACE
#define V4V6_RULE_OPTION_SPACE
#define MAPE_V6_OPTION_SPACE