Kea 2.7.5
|
JSON adaptor for option data or definition setting defaults. More...
#include <adaptor_option.h>
Public Member Functions | |
virtual | ~AdaptorOption ()=default |
Destructor. | |
Static Public Member Functions | |
static void | checkCode (isc::data::ConstElementPtr option) |
Check if code is specified in option defintion. | |
static void | checkType (isc::data::ConstElementPtr option) |
Checks if type is specified in option definition. | |
static void | collect (isc::data::ConstElementPtr option, OptionCodes &codes) |
Collect definition. | |
static void | initCodes (OptionCodes &codes, const std::string &space) |
Initialize code map. | |
static void | setCode (isc::data::ElementPtr option, const OptionCodes &codes) |
Set code from name and definitions. | |
static void | setSpace (isc::data::ElementPtr option, const std::string &space) |
Set space. | |
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. | |
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 40 of file adaptor_option.h.
|
virtualdefault |
Destructor.
|
static |
Check if code is specified in option defintion.
option | The option. |
MissingKey | if the code is not present. |
Definition at line 37 of file adaptor_option.cc.
References isc_throw.
Referenced by isc::yang::AdaptorConfig::sanitizeOptionDefList().
|
static |
Checks if type is specified in option definition.
option | The option. |
MissingKey | if the type is not present. |
Definition at line 29 of file adaptor_option.cc.
References isc_throw.
Referenced by isc::yang::AdaptorConfig::sanitizeOptionDefList().
|
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 44 of file adaptor_option.cc.
Referenced by isc::yang::AdaptorConfig::sanitizeOptionDefList().
|
static |
Initialize code map.
codes | The reference to option definitions. |
space | The space name. |
Definition at line 76 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, initCodesInternal(), LW_V6_OPTION_SPACE, MAPE_V6_OPTION_SPACE, MAPT_V6_OPTION_SPACE, V4V6_BIND_OPTION_SPACE, and V4V6_RULE_OPTION_SPACE.
Referenced by isc::yang::AdaptorConfig::preProcess().
|
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 113 of file adaptor_option.cc.
Referenced by initCodes().
|
static |
Set code from name and definitions.
option | The option data. |
codes | Option definitions. |
Definition at line 56 of file adaptor_option.cc.
References isc::data::Element::create(), and isc_throw.
Referenced by isc::yang::AdaptorConfig::sanitizeOptionDataList().
|
static |
Set space.
option | The option. |
space | The default space name. |
Definition at line 22 of file adaptor_option.cc.
References isc::data::Element::create().
Referenced by isc::yang::AdaptorConfig::sanitizeOptionDataList(), and isc::yang::AdaptorConfig::sanitizeOptionDefList().