20 AdaptorOption::AdaptorOption() {
23 AdaptorOption::~AdaptorOption() {
27 AdaptorOption::setSpace(
ElementPtr option,
const string& space) {
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)));
81 AdaptorOption::initCodes(
OptionCodes& codes,
const string& space) {
83 initCodesInternal(codes, space, STANDARD_V4_OPTION_DEFINITIONS,
84 STANDARD_V4_OPTION_DEFINITIONS_SIZE);
85 initCodesInternal(codes, space, LAST_RESORT_V4_OPTION_DEFINITIONS,
86 LAST_RESORT_V4_OPTION_DEFINITIONS_SIZE);
87 initCodesInternal(codes,
"vendor-4491",
91 initCodesInternal(codes, space, STANDARD_V6_OPTION_DEFINITIONS,
92 STANDARD_V6_OPTION_DEFINITIONS_SIZE);
93 initCodesInternal(codes,
"vendor-4491",
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);
111 initCodesInternal(codes,
"vendor-2495",
112 ISC_V6_OPTION_DEFINITIONS,
113 ISC_V6_OPTION_DEFINITIONS_SIZE);
118 AdaptorOption::initCodesInternal(
OptionCodes& codes,
const string& space,
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));
std::map< std::string, uint16_t > OptionCodes
Map for DHCP option definitions handling code and an index built from space and name.
#define V4V6_BIND_OPTION_SPACE
#define V4V6_RULE_OPTION_SPACE
boost::shared_ptr< Element > ElementPtr
Parameters being used to make up an option definition.
#define LW_V6_OPTION_SPACE
const OptionDefParams DOCSIS3_V6_OPTION_DEFINITIONS[]
Definitions of standard DHCPv6 options.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define MAPT_V6_OPTION_SPACE
#define MAPE_V6_OPTION_SPACE
boost::shared_ptr< const Element > ConstElementPtr
const OptionDefParams DOCSIS3_V4_OPTION_DEFINITIONS[]
Definitions of standard DHCPv4 options.
Defines the logger used by the top-level component of kea-dhcp-ddns.
const int DOCSIS3_V6_OPTION_DEFINITIONS_SIZE
Number of option definitions defined.
#define DHCP6_OPTION_SPACE
#define DHCP4_OPTION_SPACE
global std option spaces
const int DOCSIS3_V4_OPTION_DEFINITIONS_SIZE
Number of option definitions defined.