Kea  2.3.4-git
isc::dhcp::CfgGlobals Class Reference

Class to store configured global parameters. More...

#include <cfg_globals.h>

+ Inheritance diagram for isc::dhcp::CfgGlobals:

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, RESERVATION_MODE, 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, DDNS_USE_CONFLICT_RESOLUTION, PARKED_PACKET_LIMIT, ECHO_CLIENT_ID,
  MATCH_CLIENT_ID, AUTHORITATIVE, NEXT_SERVER, SERVER_HOSTNAME,
  BOOT_FILE_NAME, DATA_DIRECTORY, PREFERRED_LIFETIME, MIN_PREFERRED_LIFETIME,
  MAX_PREFERRED_LIFETIME, SIZE
}
 Class members. More...
 
typedef std::map< std::string, isc::data::ConstElementPtrMapType
 Type of name and value map. More...
 

Public Member Functions

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

Static Public Attributes

static const std::map< std::string, int > nameToIndex
 Name to index map. More...
 

Protected Attributes

std::vector< isc::data::ConstElementPtrvalues_
 Vectors of values. More...
 

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

Type of name and value map.

Definition at line 137 of file cfg_globals.h.

Member Enumeration Documentation

◆ Index

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 
RESERVATION_MODE 
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 
DDNS_USE_CONFLICT_RESOLUTION 
PARKED_PACKET_LIMIT 
ECHO_CLIENT_ID 
MATCH_CLIENT_ID 
AUTHORITATIVE 
NEXT_SERVER 
SERVER_HOSTNAME 
BOOT_FILE_NAME 
DATA_DIRECTORY 
PREFERRED_LIFETIME 
MIN_PREFERRED_LIFETIME 
MAX_PREFERRED_LIFETIME 
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 109 of file cfg_globals.cc.

Member Function Documentation

◆ clear()

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

Clear configured parameter values.

Definition at line 147 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
nameName of the global parameter.
Returns
The value of the global parameter with the given name.
Exceptions
NotFoundif no global parameter has the given name.

Definition at line 113 of file cfg_globals.cc.

References isc_throw, and nameToIndex.

◆ get() [2/2]

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

Get a configured parameter value by index.

Parameters
indexIndex of the global parameter.
Returns
The value of the global parameter with the index.
Exceptions
OutOfRangeif the index is out of bounds.

Definition at line 122 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
nameName of the global parameter.
valueValue of the configured parameter to set.
Exceptions
NotFoundif no global parameter has the given name.

Definition at line 130 of file cfg_globals.cc.

References isc_throw, and nameToIndex.

◆ set() [2/2]

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

Set a configured parameter value by index.

Parameters
indexIndex of the global parameter.
valueValue of the configured parameter to set.
Exceptions
OutOfRangeif the index is out of bounds.

Definition at line 139 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 169 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 156 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 96 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 152 of file cfg_globals.h.

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


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