Kea 2.7.6
|
Holds manual configuration of the server identifier (DUID). More...
#include <cfg_duid.h>
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) | |
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.
isc::dhcp::CfgDUID::CfgDUID | ( | ) |
Constructor.
Definition at line 25 of file cfg_duid.cc.
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.
duid_file_path | Absolute path to a DUID file. |
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().
|
inline |
Fetches the duid created by create()
Definition at line 130 of file cfg_duid.h.
|
inline |
Returns enterprise id for the DUID-EN.
Definition at line 86 of file cfg_duid.h.
Referenced by create().
|
inline |
Returns hardware type for DUID-LLT and DUID-LL.
Definition at line 66 of file cfg_duid.h.
Referenced by create().
|
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.
Definition at line 55 of file cfg_duid.h.
Referenced by create().
|
inline |
|
inline |
Returns DUID type.
Definition at line 37 of file cfg_duid.h.
Referenced by create(), and toElement().
|
inline |
Checks if server identifier should be stored on disk.
Definition at line 101 of file cfg_duid.h.
Referenced by create(), and setPersist().
|
inline |
Sets new enterprise id.
enterprise_id | New enterprise id. |
Definition at line 93 of file cfg_duid.h.
|
inline |
Sets new hardware type for DUID-LLT and DUID-LL.
Definition at line 71 of file cfg_duid.h.
void isc::dhcp::CfgDUID::setIdentifier | ( | const std::string & | identifier_as_hex | ) |
Sets new identifier as hex string.
identifier_as_hex | String 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().
|
inline |
Sets a boolean flag indicating if the server identifier should be stored on the disk (if true) or not (if false).
persist | New value of the flag. |
Definition at line 109 of file cfg_duid.h.
References persist().
|
inline |
Sets new time for DUID-LLT.
Definition at line 81 of file cfg_duid.h.
|
inline |
Sets DUID type.
Definition at line 42 of file cfg_duid.h.
|
virtual |
Unparse a configuration object.
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.