| Kea 3.0.2-git

isc::dhcp::CfgGlobals Class Reference

Class to store configured global parameters. More...

`#include <cfg_globals.h>`

Inheritance diagram for isc::dhcp::CfgGlobals:
[legend]

## Public Types
enum | Index : int { VALID_LIFETIME , MIN_VALID_LIFETIME , MAX_VALID_LIFETIME , RENEW_TIMER , REBIND_TIMER , DECLINE_PROBATION_PERIOD , DHCP4O6_PORT , COMMENT , SERVER_TAG , RESERVATIONS_GLOBAL , RESERVATIONS_IN_SUBNET , RESERVATIONS_OUT_OF_POOL , CALCULATE_TEE_TIMES , T1_PERCENT , T2_PERCENT , HOSTNAME_CHAR_SET , HOSTNAME_CHAR_REPLACEMENT , DDNS_SEND_UPDATES , DDNS_OVERRIDE_NO_UPDATE , DDNS_OVERRIDE_CLIENT_UPDATE , DDNS_REPLACE_CLIENT_NAME , DDNS_GENERATED_PREFIX , DDNS_QUALIFYING_SUFFIX , STORE_EXTENDED_INFO , STATISTIC_DEFAULT_SAMPLE_COUNT , STATISTIC_DEFAULT_SAMPLE_AGE , CACHE_THRESHOLD , CACHE_MAX_AGE , EARLY_GLOBAL_RESERVATIONS_LOOKUP , IP_RESERVATIONS_UNIQUE , RESERVATIONS_LOOKUP_FIRST , DDNS_UPDATE_ON_RENEW , PARKED_PACKET_LIMIT , ALLOCATOR , DDNS_TTL_PERCENT , DDNS_CONFLICT_RESOLUTION_MODE , COMPATIBILITY , DHCP_DDNS , EXPIRED_LEASES_PROCESSING , MULTI_THREADING , SANITY_CHECKS , DHCP_QUEUE_CONTROL , DDNS_TTL , DDNS_TTL_MIN , DDNS_TTL_MAX , ECHO_CLIENT_ID , MATCH_CLIENT_ID , AUTHORITATIVE , NEXT_SERVER , SERVER_HOSTNAME , BOOT_FILE_NAME , OFFER_LIFETIME , STASH_AGENT_OPTIONS , DATA_DIRECTORY , PREFERRED_LIFETIME , MIN_PREFERRED_LIFETIME , MAX_PREFERRED_LIFETIME , PD_ALLOCATOR , SERVER_ID , SIZE }
| Class members. More...
typedef std::map< std::string, isc::data::ConstElementPtr > | MapType
| Type of name and value map.

## Public Member Functions
| CfgGlobals ()
| Instance members.
void | clear ()
| Clear configured parameter values.
isc::data::ConstElementPtr | get (const std::string &name) const
| Get a configured parameter value by name.
isc::data::ConstElementPtr | get (int index) const
| Get a configured parameter value by index.
void | set (const std::string &name, isc::data::ConstElementPtr value)
| Set a configured parameter value by name.
void | set (int index, isc::data::ConstElementPtr value)
| Set a configured parameter value by index.
isc::data::ElementPtr | toElement () const
| Unparse configured global parameters.
const MapType | valuesMap () const
| Returns configured parameters as a map.
Public Member Functions inherited from isc::data::CfgToElement
virtual | ~CfgToElement ()
| Destructor.

## Static Public Attributes
static const std::map< std::string, int > | nameToIndex
| Name to index map.

## Protected Attributes
std::vector< isc::data::ConstElementPtr > | values_
| Vectors of values.

## Detailed Description

Class to store configured global parameters.

This class provides a direct access to a global parameter value using a vector as soon as the parameter name is known at compile time so in constant time vs in logarithm time using a map.

Definition at line 25 of file cfg_globals.h.

## Member Typedef Documentation

## ◆ MapType

typedef std::map<std::string, isc::data::ConstElementPtr> isc::dhcp::CfgGlobals::MapType

Type of name and value map.

Definition at line 151 of file cfg_globals.h.

## Member Enumeration Documentation

## ◆ Index

enum isc::dhcp::CfgGlobals::Index : int

Class members.

Enumeration of global parameters.

The C++ compiler is required to start with 0 and to increment by 1 so gives an index.

Names taken from `SimpleParser4::GLOBAL4_PARAMETERS` and `SimpleParser6::GLOBAL6_PARAMETERS`, first part with common parameters followed by DHCPv4 and DHCPv6 specific parameters. Keep the order, enum element names is uppercase with - replaced by _.

Enumerator
VALID_LIFETIME |
MIN_VALID_LIFETIME |
MAX_VALID_LIFETIME |
RENEW_TIMER |
REBIND_TIMER |
DECLINE_PROBATION_PERIOD |
DHCP4O6_PORT |
COMMENT |
SERVER_TAG |
RESERVATIONS_GLOBAL |
RESERVATIONS_IN_SUBNET |
RESERVATIONS_OUT_OF_POOL |
CALCULATE_TEE_TIMES |
T1_PERCENT |
T2_PERCENT |
HOSTNAME_CHAR_SET |
HOSTNAME_CHAR_REPLACEMENT |
DDNS_SEND_UPDATES |
DDNS_OVERRIDE_NO_UPDATE |
DDNS_OVERRIDE_CLIENT_UPDATE |
DDNS_REPLACE_CLIENT_NAME |
DDNS_GENERATED_PREFIX |
DDNS_QUALIFYING_SUFFIX |
STORE_EXTENDED_INFO |
STATISTIC_DEFAULT_SAMPLE_COUNT |
STATISTIC_DEFAULT_SAMPLE_AGE |
CACHE_THRESHOLD |
CACHE_MAX_AGE |
EARLY_GLOBAL_RESERVATIONS_LOOKUP |
IP_RESERVATIONS_UNIQUE |
RESERVATIONS_LOOKUP_FIRST |
DDNS_UPDATE_ON_RENEW |
PARKED_PACKET_LIMIT |
ALLOCATOR |
DDNS_TTL_PERCENT |
DDNS_CONFLICT_RESOLUTION_MODE |
COMPATIBILITY |
DHCP_DDNS |
EXPIRED_LEASES_PROCESSING |
MULTI_THREADING |
SANITY_CHECKS |
DHCP_QUEUE_CONTROL |
DDNS_TTL |
DDNS_TTL_MIN |
DDNS_TTL_MAX |
ECHO_CLIENT_ID |
MATCH_CLIENT_ID |
AUTHORITATIVE |
NEXT_SERVER |
SERVER_HOSTNAME |
BOOT_FILE_NAME |
OFFER_LIFETIME |
STASH_AGENT_OPTIONS |
DATA_DIRECTORY |
PREFERRED_LIFETIME |
MIN_PREFERRED_LIFETIME |
MAX_PREFERRED_LIFETIME |
PD_ALLOCATOR |
SERVER_ID |
SIZE |

Definition at line 39 of file cfg_globals.h.

## Constructor & Destructor Documentation

## ◆ CfgGlobals()

isc::dhcp::CfgGlobals::CfgGlobals | ( |  | ) |

Instance members.

Constructor.

Create a vector of null values.

Definition at line 122 of file cfg_globals.cc.

References SIZE, and values_.

## Member Function Documentation

## ◆ clear()

void isc::dhcp::CfgGlobals::clear | ( |  | ) |

Clear configured parameter values.

Definition at line 161 of file cfg_globals.cc.

References SIZE, and values_.

## ◆ get() [1/2]

ConstElementPtr isc::dhcp::CfgGlobals::get | ( | const std::string & | name | ) | const

Get a configured parameter value by name.

Parameters

  name | Name of the global parameter.

Returns
  The value of the global parameter with the given name.

Exceptions

  NotFound | if no global parameter has the given name.

Definition at line 126 of file cfg_globals.cc.

References get(), isc_throw, and nameToIndex.

Referenced by get().

Here is the call graph for this function:

## ◆ get() [2/2]

ConstElementPtr isc::dhcp::CfgGlobals::get | ( | int | index | ) | const

Get a configured parameter value by index.

Parameters

  index | Index of the global parameter.

Returns
  The value of the global parameter with the index.

Exceptions

  OutOfRange | if the index is out of bounds.

Definition at line 135 of file cfg_globals.cc.

References isc_throw, SIZE, and values_.

## ◆ set() [1/2]

void isc::dhcp::CfgGlobals::set | ( | const std::string & | name,
|  | isc::data::ConstElementPtr | value )

Set a configured parameter value by name.

Parameters

  name | Name of the global parameter.
  value | Value of the configured parameter to set.

Exceptions

  NotFound | if no global parameter has the given name.

Definition at line 143 of file cfg_globals.cc.

References isc_throw, nameToIndex, and set().

Referenced by set().

Here is the call graph for this function:

## ◆ set() [2/2]

void isc::dhcp::CfgGlobals::set | ( | int | index,
|  | isc::data::ConstElementPtr | value )

Set a configured parameter value by index.

Parameters

  index | Index of the global parameter.
  value | Value of the configured parameter to set.

Exceptions

  OutOfRange | if the index is out of bounds.

Definition at line 153 of file cfg_globals.cc.

References isc_throw, SIZE, and values_.

## ◆ toElement()

ElementPtr isc::dhcp::CfgGlobals::toElement | ( |  | ) | const
| virtual

Unparse configured global parameters.

Returns
  a pointer to unparsed global parameters.

Implements isc::data::CfgToElement.

Definition at line 183 of file cfg_globals.cc.

References isc::data::Element::createMap(), nameToIndex, and values_.

Here is the call graph for this function:

## ◆ valuesMap()

const CfgGlobals::MapType isc::dhcp::CfgGlobals::valuesMap | ( |  | ) | const

Returns configured parameters as a map.

Note
  : the map includes only set global parameters i.e. ConstElementPtr values are never null.

Definition at line 170 of file cfg_globals.cc.

References nameToIndex, and values_.

## Member Data Documentation

## ◆ nameToIndex

const std::map< std::string, int > isc::dhcp::CfgGlobals::nameToIndex
| static

Name to index map.

Definition at line 110 of file cfg_globals.h.

Referenced by get(), set(), toElement(), and valuesMap().

## ◆ values_

std::vector<isc::data::ConstElementPtr> isc::dhcp::CfgGlobals::values_
| protected

Vectors of values.

Definition at line 166 of file cfg_globals.h.

Referenced by CfgGlobals(), clear(), get(), set(), toElement(), and valuesMap().

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

- cfg_globals.h
- cfg_globals.cc