Kea 2.7.6
isc::flex_option::FlexOptionImpl Class Reference

Flex Option implementation. More...

#include <flex_option.h>

Classes

class  OptionConfig
 Base option configuration. More...
 
class  SubOptionConfig
 Sub-option configuration. More...
 

Public Types

enum  Action { NONE , ADD , SUPERSEDE , REMOVE }
 Action. More...
 
typedef std::list< OptionConfigPtrOptionConfigList
 The type of lists of shared pointers to option config.
 
typedef std::map< uint16_t, OptionConfigListOptionConfigMap
 The type of the option config map.
 
typedef boost::shared_ptr< OptionConfigOptionConfigPtr
 The type of shared pointers to option config.
 
typedef std::map< uint16_t, SubOptionConfigPtrSubOptionConfigMap
 The type of the sub-option config map.
 
typedef std::map< uint16_t, SubOptionConfigMapSubOptionConfigMapMap
 The type of the map of sub-option config maps.
 
typedef boost::shared_ptr< SubOptionConfigSubOptionConfigPtr
 The type of shared pointers to sub-option config.
 

Public Member Functions

 FlexOptionImpl ()
 Constructor.
 
 ~FlexOptionImpl ()
 Destructor.
 
void configure (isc::data::ConstElementPtr options)
 Configure the Flex Option implementation.
 
const OptionConfigMapgetOptionConfigMap () const
 Get the option config map.
 
const SubOptionConfigMapMapgetSubOptionConfigMap () const
 Get the sub-option config map of maps.
 
template<typename PktType >
void process (isc::dhcp::Option::Universe universe, PktType query, PktType response)
 Process a query / response pair.
 

Static Public Member Functions

static bool checkVendor (isc::dhcp::OptionPtr opt, uint32_t vendor_id)
 Check vendor option vendor id mismatch.
 
static void logAction (Action action, uint16_t code, const std::string &value)
 Log the action for option.
 
static void logAction (Action action, uint16_t code, uint32_t vendor_id)
 Log the action for option.
 
static void logClass (const isc::dhcp::ClientClass &client_class, uint16_t code)
 Log the client class for option.
 
static void logSubAction (Action action, uint16_t code, uint16_t container_code, const std::string &value)
 Log the action for sub-option.
 
static void logSubClass (const isc::dhcp::ClientClass &client_class, uint16_t code, uint16_t container_code)
 Log the client class for sub-option.
 

Protected Member Functions

OptionConfigMapgetMutableOptionConfigMap ()
 Get a mutable reference to the option config map.
 
SubOptionConfigMapMapgetMutableSubOptionConfigMap ()
 Get a mutable reference to the sub-option config map of maps.
 

Detailed Description

Flex Option implementation.

The implementation can be divided into two parts:

  • the configuration parsed and stored by load()
  • the response packet processing performed by the process method

Definition at line 37 of file flex_option.h.

Member Typedef Documentation

◆ OptionConfigList

The type of lists of shared pointers to option config.

Definition at line 162 of file flex_option.h.

◆ OptionConfigMap

The type of the option config map.

Definition at line 165 of file flex_option.h.

◆ OptionConfigPtr

The type of shared pointers to option config.

Definition at line 159 of file flex_option.h.

◆ SubOptionConfigMap

The type of the sub-option config map.

Note
the index is the sub-option code.

Definition at line 248 of file flex_option.h.

◆ SubOptionConfigMapMap

The type of the map of sub-option config maps.

Note
the index is the container option code.

Definition at line 252 of file flex_option.h.

◆ SubOptionConfigPtr

The type of shared pointers to sub-option config.

Definition at line 244 of file flex_option.h.

Member Enumeration Documentation

◆ Action

Action.

Currently supported actions are:

  • add (if not already existing)
  • supersede (as add but also when already existing)
  • remove
Enumerator
NONE 
ADD 
SUPERSEDE 
REMOVE 

Definition at line 46 of file flex_option.h.

Constructor & Destructor Documentation

◆ FlexOptionImpl()

isc::flex_option::FlexOptionImpl::FlexOptionImpl ( )

Constructor.

Definition at line 125 of file flex_option.cc.

◆ ~FlexOptionImpl()

isc::flex_option::FlexOptionImpl::~FlexOptionImpl ( )

Destructor.

Definition at line 128 of file flex_option.cc.

Member Function Documentation

◆ checkVendor()

bool isc::flex_option::FlexOptionImpl::checkVendor ( isc::dhcp::OptionPtr opt,
uint32_t vendor_id )
static

Check vendor option vendor id mismatch.

Parameters
optThe pointer to the option.
vendor_idThe vendor option vendor id.

Definition at line 598 of file flex_option.cc.

References isc::log::DBGLVL_TRACE_BASIC, isc::flex_option::flex_option_logger, FLEX_OPTION_PROCESS_VENDOR_ID_MISMATCH, and LOG_DEBUG.

Referenced by process().

◆ configure()

void isc::flex_option::FlexOptionImpl::configure ( isc::data::ConstElementPtr options)

Configure the Flex Option implementation.

Parameters
optionsThe element with option config list.
Exceptions
BadValueand similar exceptions on error.

Definition at line 134 of file flex_option.cc.

References isc_throw, and isc::data::Element::list.

◆ getMutableOptionConfigMap()

OptionConfigMap & isc::flex_option::FlexOptionImpl::getMutableOptionConfigMap ( )
inlineprotected

Get a mutable reference to the option config map.

Returns
The option config map.

Definition at line 595 of file flex_option.h.

◆ getMutableSubOptionConfigMap()

SubOptionConfigMapMap & isc::flex_option::FlexOptionImpl::getMutableSubOptionConfigMap ( )
inlineprotected

Get a mutable reference to the sub-option config map of maps.

Returns
The sub-option config map of maps.

Definition at line 602 of file flex_option.h.

◆ getOptionConfigMap()

const OptionConfigMap & isc::flex_option::FlexOptionImpl::getOptionConfigMap ( ) const
inline

Get the option config map.

Returns
The option config map.

Definition at line 263 of file flex_option.h.

Referenced by process().

◆ getSubOptionConfigMap()

const SubOptionConfigMapMap & isc::flex_option::FlexOptionImpl::getSubOptionConfigMap ( ) const
inline

Get the sub-option config map of maps.

Returns
The sub-option config map of maps.

Definition at line 270 of file flex_option.h.

Referenced by process().

◆ logAction() [1/2]

void isc::flex_option::FlexOptionImpl::logAction ( Action action,
uint16_t code,
const std::string & value )
static

Log the action for option.

Parameters
actionThe action.
codeThe option code.
valueThe option value ("" for remove).

Definition at line 499 of file flex_option.cc.

References isc::log::DBGLVL_TRACE_BASIC, isc::flex_option::flex_option_logger, FLEX_OPTION_PROCESS_ADD, FLEX_OPTION_PROCESS_REMOVE, FLEX_OPTION_PROCESS_SUPERSEDE, isc::util::str::isPrintable(), LOG_DEBUG, NONE, REMOVE, and SUPERSEDE.

Referenced by process().

+ Here is the call graph for this function:

◆ logAction() [2/2]

void isc::flex_option::FlexOptionImpl::logAction ( Action action,
uint16_t code,
uint32_t vendor_id )
static

Log the action for option.

Parameters
actionThe action.
codeThe option code.
vendor_idThe vendor option vendor id.

Definition at line 533 of file flex_option.cc.

References isc::log::DBGLVL_TRACE_BASIC, isc::flex_option::flex_option_logger, FLEX_OPTION_PROCESS_ADD, FLEX_OPTION_PROCESS_SUPERSEDE, LOG_DEBUG, and SUPERSEDE.

◆ logClass()

void isc::flex_option::FlexOptionImpl::logClass ( const isc::dhcp::ClientClass & client_class,
uint16_t code )
static

Log the client class for option.

Parameters
client_classThe client class aka guard name.
codeThe option code.

Definition at line 490 of file flex_option.cc.

References isc::log::DBGLVL_TRACE_BASIC, isc::flex_option::flex_option_logger, FLEX_OPTION_PROCESS_CLIENT_CLASS, and LOG_DEBUG.

Referenced by process().

◆ logSubAction()

void isc::flex_option::FlexOptionImpl::logSubAction ( Action action,
uint16_t code,
uint16_t container_code,
const std::string & value )
static

Log the action for sub-option.

Parameters
actionThe action.
codeThe sub-option code.
container_codeThe container option code.
valueThe option value ("" for remove).

Definition at line 560 of file flex_option.cc.

References isc::log::DBGLVL_TRACE_BASIC, isc::flex_option::flex_option_logger, FLEX_OPTION_PROCESS_SUB_ADD, FLEX_OPTION_PROCESS_SUB_REMOVE, FLEX_OPTION_PROCESS_SUB_SUPERSEDE, isc::util::str::isPrintable(), LOG_DEBUG, NONE, REMOVE, and SUPERSEDE.

Referenced by process().

+ Here is the call graph for this function:

◆ logSubClass()

void isc::flex_option::FlexOptionImpl::logSubClass ( const isc::dhcp::ClientClass & client_class,
uint16_t code,
uint16_t container_code )
static

Log the client class for sub-option.

Parameters
client_classThe client class aka guard name.
codeThe sub-option code.
container_codeThe container option code.

Definition at line 549 of file flex_option.cc.

References isc::log::DBGLVL_TRACE_BASIC, isc::flex_option::flex_option_logger, FLEX_OPTION_PROCESS_SUB_CLIENT_CLASS, and LOG_DEBUG.

Referenced by process().

◆ process()

template<typename PktType >
void isc::flex_option::FlexOptionImpl::process ( isc::dhcp::Option::Universe universe,
PktType query,
PktType response )
inline

Process a query / response pair.

Template Parameters
PktTypeThe type of pointers to packets: Pkt4Ptr or Pkt6Ptr.
Parameters
universeThe option universe: Option::V4 or Option::V6.
queryThe query packet.
responseThe response packet.

Definition at line 287 of file flex_option.h.

References ADD, checkVendor(), isc::dhcp::evaluateBool(), isc::dhcp::evaluateString(), getOptionConfigMap(), getSubOptionConfigMap(), logAction(), logClass(), logSubAction(), logSubClass(), NONE, REMOVE, SUPERSEDE, and isc::util::str::tokens().

+ Here is the call graph for this function:

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