Kea: isc::flex_option::FlexOptionImpl Class Reference

| Kea 3.0.0

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< OptionConfigPtr > | OptionConfigList
| The type of lists of shared pointers to option config.
typedef std::map< uint16_t, OptionConfigList > | OptionConfigMap
| The type of the option config map.
typedef boost::shared_ptr< OptionConfig > | OptionConfigPtr
| The type of shared pointers to option config.
typedef std::map< uint16_t, SubOptionConfigPtr > | SubOptionConfigMap
| The type of the sub-option config map.
typedef std::map< uint16_t, SubOptionConfigMap > | SubOptionConfigMapMap
| The type of the map of sub-option config maps.
typedef boost::shared_ptr< SubOptionConfig > | SubOptionConfigPtr
| 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 OptionConfigMap & | getOptionConfigMap () const
| Get the option config map.
const SubOptionConfigMapMap & | getSubOptionConfigMap () 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
OptionConfigMap & | getMutableOptionConfigMap ()
| Get a mutable reference to the option config map.
SubOptionConfigMapMap & | getMutableSubOptionConfigMap ()
| 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

typedef std::list<OptionConfigPtr> isc::flex_option::FlexOptionImpl::OptionConfigList

The type of lists of shared pointers to option config.

Definition at line 162 of file flex_option.h.

## ◆ OptionConfigMap

typedef std::map<uint16_t, OptionConfigList> isc::flex_option::FlexOptionImpl::OptionConfigMap

The type of the option config map.

Definition at line 165 of file flex_option.h.

## ◆ OptionConfigPtr

typedef boost::shared_ptr<OptionConfig> isc::flex_option::FlexOptionImpl::OptionConfigPtr

The type of shared pointers to option config.

Definition at line 159 of file flex_option.h.

## ◆ SubOptionConfigMap

typedef std::map<uint16_t, SubOptionConfigPtr> isc::flex_option::FlexOptionImpl::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

typedef std::map<uint16_t, SubOptionConfigMap> isc::flex_option::FlexOptionImpl::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

typedef boost::shared_ptr<SubOptionConfig> isc::flex_option::FlexOptionImpl::SubOptionConfigPtr

The type of shared pointers to sub-option config.

Definition at line 244 of file flex_option.h.

## Member Enumeration Documentation

## ◆ Action

enum isc::flex_option::FlexOptionImpl::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

  opt | The pointer to the option.
  vendor_id | The 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

  options | The element with option config list.

Exceptions

  BadValue | and similar exceptions on error.

Definition at line 134 of file flex_option.cc.

References isc_throw, and 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

  action | The action.
  code | The option code.
  value | The 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

  action | The action.
  code | The option code.
  vendor_id | The 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_class | The client class aka guard name.
  code | The 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

  action | The action.
  code | The sub-option code.
  container_code | The container option code.
  value | The 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_class | The client class aka guard name.
  code | The sub-option code.
  container_code | The 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

  PktType | The type of pointers to packets: Pkt4Ptr or Pkt6Ptr.

Parameters

  universe | The option universe: Option::V4 or Option::V6.
  query | The query packet.
  response | The 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:

- flex_option.h
- flex_option.cc