Kea  1.9.9-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:

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

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 45 of file adaptor_option.h.

Constructor & Destructor Documentation

isc::yang::AdaptorOption::AdaptorOption ( )

Constructor.

Definition at line 20 of file adaptor_option.cc.

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

Destructor.

Definition at line 23 of file adaptor_option.cc.

Member Function Documentation

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

Check if code is specified in option defintion.

Parameters
optionThe option.
Exceptions
MissingKeyif the code is not present.

Definition at line 42 of file adaptor_option.cc.

References isc_throw.

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

Checks if type is specified in option definition.

Parameters
optionThe option.
Exceptions
MissingKeyif the type is not present.

Definition at line 34 of file adaptor_option.cc.

References isc_throw.

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
optionThe option definition.
codesThe reference to option definitions.

Definition at line 49 of file adaptor_option.cc.

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

Initialize code map from option definition parameters.

Parameters
codesThe reference to option definitions.
spaceThe space name.
paramsArray of option definition parameters
params_sizeThe size of the array.

Definition at line 118 of file adaptor_option.cc.

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

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

Set code from name and definitions.

Parameters
optionThe option data.
codesOption definitions.

Definition at line 61 of file adaptor_option.cc.

References isc_throw.

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

Set space.

Parameters
optionThe option.
spaceThe default space name.

Definition at line 27 of file adaptor_option.cc.


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