37 :hwaddr_(hwaddr, hwaddr + len), htype_(htype), source_(0) {
44 :hwaddr_(hwaddr), htype_(htype), source_(0) {
47 "address vector size exceeds MAX_HWADDR_LEN");
52 std::stringstream tmp;
54 tmp <<
"hwtype=" <<
static_cast<unsigned int>(
htype_) <<
" ";
58 for (std::vector<uint8_t>::const_iterator it =
hwaddr_.begin();
63 tmp << std::setw(2) << std::setfill('0') << static_cast<unsigned int>(*it);
71 std::vector<uint8_t> binary;
73 return (
HWAddr(binary, htype));
78 (this->hwaddr_ == other.
hwaddr_));
82 return !(*
this == other);
static const uint32_t HWADDR_SOURCE_ANY
Not really a type, only used in getMAC() calls.
static const uint32_t HWADDR_SOURCE_DOCSIS_MODEM
A cable modem (acting as DHCP client) that supports DOCSIS standard can insert DOCSIS options that co...
static const uint32_t HWADDR_SOURCE_UNKNOWN
Used when actual origin is not known, e.g.
static const size_t MAX_HWADDR_LEN
Maximum size of a hardware address.
std::vector< uint8_t > hwaddr_
std::string toText(bool include_htype=true) const
Returns textual representation of a hardware address (e.g.
static const uint32_t HWADDR_SOURCE_REMOTE_ID
A relay can insert remote-id.
static const uint32_t HWADDR_SOURCE_CLIENT_ADDR_RELAY_OPTION
Get it from RFC6939 option.
#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...
static const uint32_t HWADDR_SOURCE_SUBSCRIBER_ID
A relay can insert a subscriber-id option.
uint16_t htype_
Hardware type.
static const uint32_t HWADDR_SOURCE_IPV6_LINK_LOCAL
Extracted from IPv6 link-local address.
static const uint32_t HWADDR_SOURCE_DOCSIS_CMTS
A CMTS (acting as DHCP relay agent) that supports DOCSIS standard can insert DOCSIS options that cont...
Defines the logger used by the top-level component of kea-dhcp-ddns.
static const uint32_t HWADDR_SOURCE_RAW
Obtained first hand from raw socket (100% reliable).
static HWAddr fromText(const std::string &text, const uint16_t htype=HTYPE_ETHER)
Creates instance of the hardware address from textual format.
HWAddr()
default constructor
bool operator!=(const HWAddr &other) const
Compares two hardware addresses for inequality.
void decodeColonSeparatedHexString(const std::string &hex_string, std::vector< uint8_t > &binary)
Converts a string of hexadecimal digits with colons into a vector.
Hardware type that represents information from DHCPv4 packet.
bool operator==(const HWAddr &other) const
Compares two hardware addresses for equality.
static const uint32_t HWADDR_SOURCE_DUID
Extracted from DUID-LL or DUID-LLT (not 100% reliable as the client can send fake DUID)...