16#include <boost/lexical_cast.hpp>
36 std::string duid_type =
getString(duid_configuration,
"type");
39 if (duid_type ==
"LLT") {
41 }
else if (duid_type ==
"EN") {
43 }
else if (duid_type ==
"LL") {
47 << duid_type <<
"'. Expected: LLT, EN or LL");
53 if (duid_configuration->contains(param)) {
54 cfg->setIdentifier(
getString(duid_configuration, param));
58 if (duid_configuration->contains(param)) {
59 cfg->setHType(
getUint16(duid_configuration, param));
63 if (duid_configuration->contains(param)) {
64 cfg->setTime(
getUint32(duid_configuration, param));
67 param =
"enterprise-id";
68 if (duid_configuration->contains(param)) {
69 cfg->setEnterpriseId(
getUint32(duid_configuration, param));
73 if (duid_configuration->contains(param)) {
74 cfg->setPersist(
getBoolean(duid_configuration, param));
77 param =
"user-context";
80 cfg->setContext(user_context);
84 }
catch (
const std::exception& ex) {
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
static const data::Element::Position & getPosition(const std::string &name, const data::ConstElementPtr parent)
Utility method that returns position of an element.
static std::string getString(isc::data::ConstElementPtr scope, const std::string &name)
Returns a string parameter from a scope.
uint32_t getUint32(isc::data::ConstElementPtr scope, const std::string &name)
Returns a value converted to uint32_t.
static bool getBoolean(isc::data::ConstElementPtr scope, const std::string &name)
Returns a boolean parameter from a scope.
uint16_t getUint16(isc::data::ConstElementPtr scope, const std::string &name)
Returns a value converted to uint16_t.
void parse(const CfgDUIDPtr &cfg, isc::data::ConstElementPtr duid_configuration)
Parses DUID configuration.
DUIDType
specifies DUID type
@ DUID_LL
link-layer, see RFC3315, section 11.4
@ DUID_LLT
link-layer + time, see RFC3315, section 11.2
@ DUID_UNKNOWN
invalid/unknown type
@ DUID_EN
enterprise-id, see RFC3315, section 11.3
To be removed. Please use ConfigError instead.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_WARN(LOGGER, MESSAGE)
Macro to conveniently test warn output and log it.
boost::shared_ptr< const Element > ConstElementPtr
isc::log::Logger dhcpsrv_logger("dhcpsrv")
DHCP server library Logger.
boost::shared_ptr< CfgDUID > CfgDUIDPtr
Pointer to the Non-const object.
const isc::log::MessageID DHCPSRV_CFGMGR_CONFIGURE_SERVERID
Defines the logger used by the top-level component of kea-lfc.