Kea: isc::perfmon::DurationKeyParser Class Reference

| Kea 3.2.0-git

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

  name | upper-case message name (e.g "DHCPDISCOVER", "DHCPOFFER").

Returns
  numeric message type, returns DHCP_NOTYPE if name is empty.

Exceptions

  BadValue | if 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

Convert string message name to DHCP6 message type.

Parameters

  name | upper-case message name (e.g "DHCPV6_SOLICIT", "DHCV6_REPLY").

Returns
  numeric message type, returns DHCPV6_NOTYPE if name is empty.

Exceptions

  BadValue | if the message name is unknown.

Definition at line 64 of file perfmon_config.cc.

References DHCPV6_ACTIVELEASEQUERY, DHCPV6_ADVERTISE, DHCPV6_BNDREPLY, DHCPV6_BNDUPD, DHCPV6_CONFIRM, DHCPV6_CONNECT, DHCPV6_CONNECTREPLY, DHCPV6_CONTACT, DHCPV6_DECLINE, DHCPV6_DHCPV4_QUERY, DHCPV6_DHCPV4_RESPONSE, DHCPV6_DISCONNECT, DHCPV6_INFORMATION_REQUEST, DHCPV6_LEASEQUERY, DHCPV6_LEASEQUERY_DATA, DHCPV6_LEASEQUERY_DONE, DHCPV6_LEASEQUERY_REPLY, DHCPV6_NOTYPE, DHCPV6_POOLREQ, DHCPV6_POOLRESP, DHCPV6_REBIND, DHCPV6_RECONFIGURE, DHCPV6_RECONFIGURE_REPLY, DHCPV6_RECONFIGURE_REQUEST, DHCPV6_RELAY_FORW, DHCPV6_RELAY_REPL, DHCPV6_RELEASE, DHCPV6_RENEW, DHCPV6_REPLY, DHCPV6_REQUEST, DHCPV6_SOLICIT, DHCPV6_STARTTLS, DHCPV6_STATE, DHCPV6_UPDDONE, DHCPV6_UPDREQ, DHCPV6_UPDREQALL, and isc_throw.

Referenced by getMessageType().

## ◆ 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

  config | element map containing the duration key parameters.
  family | protocol family AF_INET or AF_INET6.
  param_name | configuration parameter name.
  required | if 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

  DhcpConfigError | if 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(), and isc_throw.

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

  config | element map containing the duration key parameters.
  family | protocol 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

  key | DurationKey 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}
}
Element::integer
@ integer
Definition data.h:153
Element::string
@ string
Definition data.h:157
isc::data::Element::string
@ string
Definition data.h:157

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:

- perfmon_config.h
- perfmon_config.cc