Kea 2.7.5
isc::perfmon::DurationKeyParser Class Reference

Parses configuration parameters for a single DurationKey. More...

#include <perfmon_config.h>

Public Member Functions

 DurationKeyParser ()=default
 Constructor.
 
 ~DurationKeyParser ()=default
 Destructor.
 

Static Public Member Functions

static uint16_t getMessageNameType4 (const std::string &name)
 Convert string message name to DHCP message type.
 
static uint16_t getMessageNameType6 (const std::string &name)
 Convert string message name to DHCP6 message type.
 
static uint16_t getMessageType (data::ConstElementPtr config, uint16_t family, const std::string &param_name, bool required=true)
 Convert a configuration parameter to family-specific message type.
 
static DurationKeyPtr parse (data::ConstElementPtr config, uint16_t family)
 Convert a map of Elements into a DurationKey.
 
static data::ElementPtr toElement (DurationKeyPtr key)
 Convert a DurationKey into a map of Elements.
 

Static Public Attributes

static const data::SimpleKeywords CONFIG_KEYWORDS
 List of valid parameters and expected types.
 

Detailed Description

Parses configuration parameters for a single DurationKey.

DurationKey is used to identify both MonitoredDurations and Alarms, thus they could be use to define either in configuration as well as identifiy either in API calls. Given this, it seems prudent to define a "duration-key" element with its own parser.

Definition at line 57 of file perfmon_config.h.

Constructor & Destructor Documentation

◆ DurationKeyParser()

isc::perfmon::DurationKeyParser::DurationKeyParser ( )
explicitdefault

Constructor.

◆ ~DurationKeyParser()

isc::perfmon::DurationKeyParser::~DurationKeyParser ( )
default

Destructor.

Member Function Documentation

◆ getMessageNameType4()

uint16_t isc::perfmon::DurationKeyParser::getMessageNameType4 ( const std::string & name)
static

Convert string message name to DHCP message type.

Parameters
nameupper-case message name (e.g "DHCPDISCOVER", "DHCPOFFER").
Returns
numeric message type, returns DHCP_NOTYPE if name is empty.
Exceptions
BadValueif the message name is unknown.

Definition at line 33 of file perfmon_config.cc.

References isc::dhcp::DHCP_NOTYPE, isc::dhcp::DHCPACK, isc::dhcp::DHCPBULKLEASEQUERY, isc::dhcp::DHCPDECLINE, isc::dhcp::DHCPDISCOVER, isc::dhcp::DHCPINFORM, isc::dhcp::DHCPLEASEACTIVE, isc::dhcp::DHCPLEASEQUERY, isc::dhcp::DHCPLEASEQUERYDONE, isc::dhcp::DHCPLEASEQUERYSTATUS, isc::dhcp::DHCPLEASEUNASSIGNED, isc::dhcp::DHCPLEASEUNKNOWN, isc::dhcp::DHCPNAK, isc::dhcp::DHCPOFFER, isc::dhcp::DHCPRELEASE, isc::dhcp::DHCPREQUEST, isc::dhcp::DHCPTLS, and isc_throw.

Referenced by getMessageType().

◆ getMessageNameType6()

uint16_t isc::perfmon::DurationKeyParser::getMessageNameType6 ( const std::string & name)
static

◆ getMessageType()

uint16_t isc::perfmon::DurationKeyParser::getMessageType ( data::ConstElementPtr config,
uint16_t family,
const std::string & param_name,
bool required = true )
static

Convert a configuration parameter to family-specific message type.

Parameters
configelement map containing the duration key parameters.
familyprotocol family AF_INET or AF_INET6.
param_nameconfiguration parameter name.
requiredif true then function will throw if the parameter does not exist in the configuration. Defaults to true.
Returns
numeric message type, returns DHCP_NOTYPE if name is empty.
Exceptions
DhcpConfigErrorif parameter type or value is not valid, or when required is true and the parameter is not in the map.

Definition at line 114 of file perfmon_config.cc.

References getMessageNameType4(), getMessageNameType6(), isc_throw, and isc::Exception::what().

Referenced by parse().

+ Here is the call graph for this function:

◆ parse()

DurationKeyPtr isc::perfmon::DurationKeyParser::parse ( data::ConstElementPtr config,
uint16_t family )
static

Convert a map of Elements into a DurationKey.

Parameters
configelement map containing the duration key parameters.
familyprotocol family AF_INET or AF_INET6.

Definition at line 138 of file perfmon_config.cc.

References isc::data::SimpleParser::checkKeywords(), CONFIG_KEYWORDS, getMessageType(), and isc_throw.

Referenced by isc::perfmon::AlarmParser::parse().

+ Here is the call graph for this function:

◆ toElement()

data::ElementPtr isc::perfmon::DurationKeyParser::toElement ( DurationKeyPtr key)
static

Convert a DurationKey into a map of Elements.

Parameters
keyDurationKey to convert.
Returns
Pointer to a map of elements.

Definition at line 174 of file perfmon_config.cc.

References isc::data::Element::create(), isc::data::Element::createMap(), isc::dhcp::Pkt4::getName(), isc::dhcp::Pkt6::getName(), and isc_throw.

+ Here is the call graph for this function:

Member Data Documentation

◆ CONFIG_KEYWORDS

const data::SimpleKeywords isc::perfmon::DurationKeyParser::CONFIG_KEYWORDS
static
Initial value:
=
{
{"query-type", Element::string},
{"response-type", Element::string},
{"start-event", Element::string},
{"stop-event", Element::string},
{"subnet-id", Element::integer}
}

List of valid parameters and expected types.

Definition at line 60 of file perfmon_config.h.

Referenced by parse().


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