43 duid_ = std::vector<uint8_t>(data, data + len);
50 if (
duid_.size() < 2) {
55 return (static_cast<DUID::DUIDType>(type));
63 std::vector<uint8_t> binary;
65 return (
DUID(binary));
70 static std::vector<uint8_t> empty_duid(1,0);
71 static DUID empty(empty_duid);
76 std::stringstream tmp;
79 for (std::vector<uint8_t>::const_iterator it =
duid_.begin();
80 it !=
duid_.end(); ++it) {
84 tmp << std::setw(2) << std::setfill('0') << static_cast<unsigned int>(*it);
103 <<
"), at least 2 is required");
109 :
DUID(clientid, len) {
112 <<
"), at least 2 is required");
133 std::vector<uint8_t> binary;
const std::vector< uint8_t > & getDuid() const
Returns a const reference to the actual DUID value.
static ClientIdPtr fromText(const std::string &text)
Create client identifier from the textual format.
std::string toText() const
Returns textual representation of a DUID (e.g. 00:01:02:03:ff)
bool operator==(const DUID &other) const
Compares two DUIDs for equality.
static const DUID & EMPTY()
Defines the constant "empty" DUID.
static DUID fromText(const std::string &text)
Create DUID from the textual format.
void decodeFormattedHexString(const std::string &hex_string, std::vector< uint8_t > &binary)
Converts a formatted string of hexadecimal digits into a vector.
Holds DUID (DHCPv6 Unique Identifier)
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
DUIDType
specifies DUID type
DUIDType getType() const
Returns the DUID type.
const std::vector< uint8_t > & getClientId() const
Returns reference to the client-id data.
std::vector< uint8_t > duid_
The actual content of the DUID.
not a real type, just maximum defined value + 1
boost::shared_ptr< ClientId > ClientIdPtr
Shared pointer to a Client ID.
bool operator!=(const ClientId &other) const
Compares two client-ids for inequality.
std::string toText() const
Returns textual representation of a DUID (e.g. 00:01:02:03:ff)
static const size_t MIN_CLIENT_ID_LEN
Minimum size of a client ID.
Defines the logger used by the top-level component of kea-dhcp-ddns.
ClientId(const std::vector< uint8_t > &clientid)
Constructor based on vector
static const size_t MAX_DUID_LEN
maximum duid size As defined in RFC 8415, section 11.1
Holds Client identifier or client IPv4 address.
bool operator!=(const DUID &other) const
Compares two DUIDs for inequality.
DUID(const std::vector< uint8_t > &duid)
Constructor from vector.
bool operator==(const ClientId &other) const
Compares two client-ids for equality.