Kea
1.9.9-git
|
JSON adaptor for option data or definition setting defaults. More...
#include <adaptor_option.h>
Public Member Functions | |
AdaptorOption () | |
Constructor. More... | |
virtual | ~AdaptorOption () |
Destructor. More... | |
Static Public Member Functions | |
static void | checkCode (isc::data::ConstElementPtr option) |
Check if code is specified in option defintion. More... | |
static void | checkType (isc::data::ConstElementPtr option) |
Checks if type is specified in option definition. More... | |
static void | collect (isc::data::ConstElementPtr option, OptionCodes &codes) |
Collect definition. More... | |
static void | initCodes (OptionCodes &codes, const std::string &space) |
Initialize code map. More... | |
static void | setCode (isc::data::ElementPtr option, const OptionCodes &codes) |
Set code from name and definitions. More... | |
static void | setSpace (isc::data::ElementPtr option, const std::string &space) |
Set space. More... | |
Static Protected Member Functions | |
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. More... | |
JSON adaptor for option data or definition setting defaults.
Both option data and option definition lists are keyed by the code and space pair so both must be available in setOptionXXX methods. For space there is an implicit default so setSpace must be called to add this default to option entries without space. Note remaining adaptors assume this was done first.
checkCode and checkType can be used to check if code or type is present (type is mandatory in option definitions).
A missing code can be found in standard definitions (loaded by initCodes) or in configuration option definitions (at global and client classes scopes). setCode uses the space+name to code map to set missing codes and raises an error when it can't.
Definition at line 45 of file adaptor_option.h.
isc::yang::AdaptorOption::AdaptorOption | ( | ) |
Constructor.
Definition at line 20 of file adaptor_option.cc.
|
virtual |
Destructor.
Definition at line 23 of file adaptor_option.cc.
|
static |
Check if code is specified in option defintion.
option | The option. |
MissingKey | if the code is not present. |
Definition at line 42 of file adaptor_option.cc.
References isc_throw.
|
static |
Checks if type is specified in option definition.
option | The option. |
MissingKey | if the type is not present. |
Definition at line 34 of file adaptor_option.cc.
References isc_throw.
|
static |
Collect definition.
This method looks at an option definition and adds the space+name to code mapping into the OptionCodes codes store aka definitions.
option | The option definition. |
codes | The reference to option definitions. |
Definition at line 49 of file adaptor_option.cc.
|
static |
Initialize code map.
codes | The reference to option definitions. |
space | The space name. |
Definition at line 81 of file adaptor_option.cc.
References DHCP4_OPTION_SPACE, DHCP6_OPTION_SPACE, isc::dhcp::DOCSIS3_V4_OPTION_DEFINITIONS, isc::dhcp::DOCSIS3_V4_OPTION_DEFINITIONS_SIZE, isc::dhcp::DOCSIS3_V6_OPTION_DEFINITIONS, isc::dhcp::DOCSIS3_V6_OPTION_DEFINITIONS_SIZE, LW_V6_OPTION_SPACE, MAPE_V6_OPTION_SPACE, MAPT_V6_OPTION_SPACE, V4V6_BIND_OPTION_SPACE, and V4V6_RULE_OPTION_SPACE.
|
staticprotected |
Initialize code map from option definition parameters.
codes | The reference to option definitions. |
space | The space name. |
params | Array of option definition parameters |
params_size | The size of the array. |
Definition at line 118 of file adaptor_option.cc.
References isc::dhcp::OptionDefParams::name.
|
static |
Set code from name and definitions.
option | The option data. |
codes | Option definitions. |
Definition at line 61 of file adaptor_option.cc.
References isc_throw.
|
static |
Set space.
option | The option. |
space | The default space name. |
Definition at line 27 of file adaptor_option.cc.