Kea 2.7.5
isc::dhcp::CfgDUID Class Reference

Holds manual configuration of the server identifier (DUID). More...

#include <cfg_duid.h>

+ Inheritance diagram for isc::dhcp::CfgDUID:

Public Member Functions

 CfgDUID ()
 Constructor.
 
DuidPtr create (const std::string &duid_file_path)
 Creates instance of a DUID from the current configuration.
 
const DuidPtr getCurrentDuid () const
 Fetches the duid created by create()
 
uint32_t getEnterpriseId () const
 Returns enterprise id for the DUID-EN.
 
uint16_t getHType () const
 Returns hardware type for DUID-LLT and DUID-LL.
 
std::vector< uint8_t > getIdentifier () const
 Returns identifier.
 
uint32_t getTime () const
 Returns time for the DUID-LLT.
 
DUID::DUIDType getType () const
 Returns DUID type.
 
bool persist () const
 Checks if server identifier should be stored on disk.
 
void setEnterpriseId (const uint32_t enterprise_id)
 Sets new enterprise id.
 
void setHType (const uint16_t htype)
 Sets new hardware type for DUID-LLT and DUID-LL.
 
void setIdentifier (const std::string &identifier_as_hex)
 Sets new identifier as hex string.
 
void setPersist (const bool persist)
 Sets a boolean flag indicating if the server identifier should be stored on the disk (if true) or not (if false).
 
void setTime (const uint32_t new_time)
 Sets new time for DUID-LLT.
 
void setType (const DUID::DUIDType &type)
 Sets DUID type.
 
virtual isc::data::ElementPtr toElement () const
 Unparse a configuration object.
 
- Public Member Functions inherited from isc::data::UserContext
void contextToElement (data::ElementPtr map) const
 Merge unparse a user_context object.
 
data::ConstElementPtr getContext () const
 Returns const pointer to the user context.
 
void setContext (const data::ConstElementPtr &ctx)
 Sets user context.
 
- Public Member Functions inherited from isc::data::CfgToElement
virtual ~CfgToElement ()
 Destructor.
 

Additional Inherited Members

- Static Public Member Functions inherited from isc::data::UserContext
static data::ElementPtr toElement (data::ConstElementPtr map)
 Copy an Element map.
 
- Protected Attributes inherited from isc::data::UserContext
data::ConstElementPtr user_context_
 Pointer to the user context (may be NULL)
 

Detailed Description

Holds manual configuration of the server identifier (DUID).

The DHCPv6 server uses DHCPv6 Unique Identifier (DUID) to identify itself to the clients. Typically, the server generates the DUID on the first startup and writes it to the persistent storage so as it doesn't change across restarts of the server. RFC 8415 defines different DUID types. Kea allows for selecting a type of DUID that the server should generate. It also allows for overriding entire default DUID or parts of it via configuration file. This class holds the DUID configuration specified in the server configuration file.

Definition at line 30 of file cfg_duid.h.

Constructor & Destructor Documentation

◆ CfgDUID()

isc::dhcp::CfgDUID::CfgDUID ( )

Constructor.

Definition at line 25 of file cfg_duid.cc.

Member Function Documentation

◆ create()

DuidPtr isc::dhcp::CfgDUID::create ( const std::string & duid_file_path)

Creates instance of a DUID from the current configuration.

The newly created DUID is retained internally to make it accessible anywhere.

Parameters
duid_file_pathAbsolute path to a DUID file.
Returns
Pointer to an instance of new DUID.

Definition at line 55 of file cfg_duid.cc.

References isc::dhcp::DUIDFactory::createEN(), isc::dhcp::DUIDFactory::createLL(), isc::dhcp::DUIDFactory::createLLT(), isc::dhcp::DUID::DUID_EN, isc::dhcp::DUID::DUID_LL, isc::dhcp::DUID::DUID_LLT, isc::dhcp::DUIDFactory::get(), getEnterpriseId(), getHType(), getIdentifier(), getTime(), getType(), isc_throw, and persist().

+ Here is the call graph for this function:

◆ getCurrentDuid()

const DuidPtr isc::dhcp::CfgDUID::getCurrentDuid ( ) const
inline

Fetches the duid created by create()

Returns
a pointer to created duid. Pointer will empty if the duid has not yet been created.

Definition at line 130 of file cfg_duid.h.

◆ getEnterpriseId()

uint32_t isc::dhcp::CfgDUID::getEnterpriseId ( ) const
inline

Returns enterprise id for the DUID-EN.

Definition at line 86 of file cfg_duid.h.

Referenced by create().

◆ getHType()

uint16_t isc::dhcp::CfgDUID::getHType ( ) const
inline

Returns hardware type for DUID-LLT and DUID-LL.

Definition at line 66 of file cfg_duid.h.

Referenced by create().

◆ getIdentifier()

std::vector< uint8_t > isc::dhcp::CfgDUID::getIdentifier ( ) const
inline

Returns identifier.

Identifier is a link layer address for the DUID-LLT and DUID-LL. It is also a variable length identifier in DUID-EN. It may be used for all other existing and future DUID types when there is a need to represent some variable length identifier.

Returns
Vector holding an identifier belonging to a particular DUID type.

Definition at line 55 of file cfg_duid.h.

Referenced by create().

◆ getTime()

uint32_t isc::dhcp::CfgDUID::getTime ( ) const
inline

Returns time for the DUID-LLT.

Definition at line 76 of file cfg_duid.h.

Referenced by create().

◆ getType()

DUID::DUIDType isc::dhcp::CfgDUID::getType ( ) const
inline

Returns DUID type.

Definition at line 37 of file cfg_duid.h.

Referenced by create(), and toElement().

◆ persist()

bool isc::dhcp::CfgDUID::persist ( ) const
inline

Checks if server identifier should be stored on disk.

Returns
true if the server identifier should be stored on the disk, false otherwise.

Definition at line 101 of file cfg_duid.h.

Referenced by create(), and setPersist().

◆ setEnterpriseId()

void isc::dhcp::CfgDUID::setEnterpriseId ( const uint32_t enterprise_id)
inline

Sets new enterprise id.

Parameters
enterprise_idNew enterprise id.

Definition at line 93 of file cfg_duid.h.

◆ setHType()

void isc::dhcp::CfgDUID::setHType ( const uint16_t htype)
inline

Sets new hardware type for DUID-LLT and DUID-LL.

Definition at line 71 of file cfg_duid.h.

◆ setIdentifier()

void isc::dhcp::CfgDUID::setIdentifier ( const std::string & identifier_as_hex)

Sets new identifier as hex string.

Parameters
identifier_as_hexString of hexadecimal digits representing variable length identifier within a DUID.

Definition at line 31 of file cfg_duid.cc.

References isc::util::encode::decodeHex(), isc_throw, and isc::util::str::trim().

+ Here is the call graph for this function:

◆ setPersist()

void isc::dhcp::CfgDUID::setPersist ( const bool persist)
inline

Sets a boolean flag indicating if the server identifier should be stored on the disk (if true) or not (if false).

Parameters
persistNew value of the flag.

Definition at line 109 of file cfg_duid.h.

References persist().

+ Here is the call graph for this function:

◆ setTime()

void isc::dhcp::CfgDUID::setTime ( const uint32_t new_time)
inline

Sets new time for DUID-LLT.

Definition at line 81 of file cfg_duid.h.

◆ setType()

void isc::dhcp::CfgDUID::setType ( const DUID::DUIDType & type)
inline

Sets DUID type.

Definition at line 42 of file cfg_duid.h.

◆ toElement()

ElementPtr isc::dhcp::CfgDUID::toElement ( ) const
virtual

Unparse a configuration object.

Returns
a pointer to unparsed configuration

Implements isc::data::CfgToElement.

Definition at line 86 of file cfg_duid.cc.

References isc::data::UserContext::contextToElement(), isc::data::Element::create(), isc::data::Element::createMap(), isc::dhcp::DUID::DUID_EN, isc::dhcp::DUID::DUID_LL, isc::dhcp::DUID::DUID_LLT, isc::util::encode::encodeHex(), getType(), and isc_throw.

+ Here is the call graph for this function:

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