Kea 2.7.5
|
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. | |
Flex Option implementation.
The implementation can be divided into two parts:
Definition at line 37 of file flex_option.h.
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.
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.
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.
typedef std::map<uint16_t, SubOptionConfigPtr> isc::flex_option::FlexOptionImpl::SubOptionConfigMap |
The type of the sub-option config map.
Definition at line 248 of file flex_option.h.
typedef std::map<uint16_t, SubOptionConfigMap> isc::flex_option::FlexOptionImpl::SubOptionConfigMapMap |
The type of the map of sub-option config maps.
Definition at line 252 of file flex_option.h.
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.
Action.
Currently supported actions are:
Enumerator | |
---|---|
NONE | |
ADD | |
SUPERSEDE | |
REMOVE |
Definition at line 46 of file flex_option.h.
isc::flex_option::FlexOptionImpl::FlexOptionImpl | ( | ) |
Constructor.
Definition at line 125 of file flex_option.cc.
isc::flex_option::FlexOptionImpl::~FlexOptionImpl | ( | ) |
Destructor.
Definition at line 128 of file flex_option.cc.
|
static |
Check vendor option vendor id mismatch.
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().
void isc::flex_option::FlexOptionImpl::configure | ( | isc::data::ConstElementPtr | options | ) |
Configure the Flex Option implementation.
options | The element with option config list. |
BadValue | and similar exceptions on error. |
Definition at line 134 of file flex_option.cc.
References isc_throw, and isc::data::Element::list.
|
inlineprotected |
Get a mutable reference to the option config map.
Definition at line 595 of file flex_option.h.
|
inlineprotected |
Get a mutable reference to the sub-option config map of maps.
Definition at line 602 of file flex_option.h.
|
inline |
Get the option config map.
Definition at line 263 of file flex_option.h.
Referenced by process().
|
inline |
Get the sub-option config map of maps.
Definition at line 270 of file flex_option.h.
Referenced by process().
|
static |
Log the action for option.
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().
|
static |
Log the action for option.
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.
|
static |
Log the client class for option.
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().
|
static |
Log the action for sub-option.
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().
|
static |
Log the client class for sub-option.
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().
|
inline |
Process a query / response pair.
PktType | The type of pointers to packets: Pkt4Ptr or Pkt6Ptr. |
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().