Kea  1.9.9-git
isc::flex_option::FlexOptionImpl Class Reference

Flex Option implementation. More...

#include <flex_option.h>

Classes

class  OptionConfig
 Option configuration. More...
 

Public Types

enum  Action { NONE, ADD, SUPERSEDE, REMOVE }
 Action. More...
 
typedef std::map< uint16_t, OptionConfigPtrOptionConfigMap
 The type of the option config map. More...
 
typedef boost::shared_ptr< OptionConfigOptionConfigPtr
 The type of shared pointers to option config. More...
 

Public Member Functions

 FlexOptionImpl ()
 Constructor. More...
 
 ~FlexOptionImpl ()
 Destructor. More...
 
void configure (isc::data::ConstElementPtr options)
 Configure the Flex Option implementation. More...
 
const OptionConfigMapgetOptionConfigMap () const
 Get the option config map. More...
 
void logAction (Action action, uint16_t code, const std::string &value) const
 Log the action. More...
 
template<typename PktType >
void process (isc::dhcp::Option::Universe universe, PktType query, PktType response)
 Process a query / response pair. More...
 

Protected Member Functions

OptionConfigMapgetMutableOptionConfigMap ()
 Get a mutable reference to the option config map. More...
 

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 34 of file flex_option.h.

Member Typedef Documentation

The type of the option config map.

Definition at line 142 of file flex_option.h.

The type of shared pointers to option config.

Definition at line 139 of file flex_option.h.

Member Enumeration Documentation

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 43 of file flex_option.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 85 of file flex_option.cc.

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

Destructor.

Definition at line 88 of file flex_option.cc.

Member Function Documentation

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 93 of file flex_option.cc.

References isc_throw.

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

Get a mutable reference to the option config map.

Returns
The option config map.

Definition at line 265 of file flex_option.h.

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

Get the option config map.

Returns
The option config map.

Definition at line 153 of file flex_option.h.

Referenced by process().

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

Log the action.

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

Definition at line 244 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:

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 170 of file flex_option.h.

References ADD, isc::dhcp::evaluateBool(), isc::dhcp::evaluateString(), getOptionConfigMap(), logAction(), 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: