| Kea 3.0.2-git

isc::yang::AdaptorOption Class Reference

JSON adaptor for option data or definition setting defaults. More...

`#include <adaptor_option.h>`

Inheritance diagram for isc::yang::AdaptorOption:
[legend]

## 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.

## Detailed Description

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.

## Constructor & Destructor Documentation

## ◆ ~AdaptorOption()

virtual isc::yang::AdaptorOption::~AdaptorOption | ( |  | ) |
| virtual default

Destructor.

## Member Function Documentation

## ◆ checkCode()

void isc::yang::AdaptorOption::checkCode | ( | isc::data::ConstElementPtr | option | ) |
| static

Check if code is specified in option defintion.

Parameters

  option | The option.

Exceptions

  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().

## ◆ checkType()

void isc::yang::AdaptorOption::checkType | ( | isc::data::ConstElementPtr | option | ) |
| static

Checks if type is specified in option definition.

Parameters

  option | The option.

Exceptions

  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().

## ◆ collect()

void isc::yang::AdaptorOption::collect | ( | isc::data::ConstElementPtr | option,
|  | OptionCodes & | codes )
| 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.

Parameters

  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().

## ◆ initCodes()

void isc::yang::AdaptorOption::initCodes | ( | OptionCodes & | codes,
|  | const std::string & | space )
| static

Initialize code map.

Parameters

  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().

Here is the call graph for this function:

## ◆ initCodesInternal()

void isc::yang::AdaptorOption::initCodesInternal | ( | OptionCodes & | codes,
|  | const std::string & | space,
|  | const isc::dhcp::OptionDefParams * | params,
|  | size_t | params_size )
| static protected

Initialize code map from option definition parameters.

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.

References isc::dhcp::OptionDefParams::name.

Referenced by initCodes().

## ◆ setCode()

void isc::yang::AdaptorOption::setCode | ( | isc::data::ElementPtr | option,
|  | const OptionCodes & | codes )
| static

Set code from name and definitions.

Parameters

  option | The option data.
  codes | Option definitions.

Definition at line 56 of file adaptor_option.cc.

References Element::create(), and isc_throw.

Referenced by isc::yang::AdaptorConfig::sanitizeOptionDataList().

Here is the call graph for this function:

## ◆ setSpace()

void isc::yang::AdaptorOption::setSpace | ( | isc::data::ElementPtr | option,
|  | const std::string & | space )
| static

Set space.

Parameters

  option | The option.
  space | The default space name.

Definition at line 22 of file adaptor_option.cc.

References Element::create().

Referenced by isc::yang::AdaptorConfig::sanitizeOptionDataList(), and isc::yang::AdaptorConfig::sanitizeOptionDefList().

Here is the call graph for this function:

The documentation for this class was generated from the following files:

- adaptor_option.h
- adaptor_option.cc