Kea 2.7.5
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 , 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 , 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::ConstElementPtrMapType
 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::ConstElementPtrvalues_
 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

Type of name and value map.

Definition at line 148 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 
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 
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 119 of file cfg_globals.cc.

Member Function Documentation

◆ clear()

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

Clear configured parameter values.

Definition at line 158 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 123 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
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 132 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 140 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
indexIndex of the global parameter.
valueValue of the configured parameter to set.
Exceptions
OutOfRangeif the index is out of bounds.

Definition at line 150 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 180 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 167 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 107 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 163 of file cfg_globals.h.

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


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