Kea  2.3.3-git
isc::dhcp_ddns::D2Dhcid Class Reference

Container class for handling the DHCID value within a NameChangeRequest. More...

#include <ncr_msg.h>

Public Member Functions

 D2Dhcid ()
 Default constructor. More...
 
 D2Dhcid (const std::string &data)
 Constructor - Creates a new instance, populated by converting a given string of digits into an array of unsigned bytes. More...
 
 D2Dhcid (const isc::dhcp::HWAddrPtr &hwaddr, const std::vector< uint8_t > &wire_fqdn)
 Constructor, creates an instance of the D2Dhcid from the HW address. More...
 
 D2Dhcid (const std::vector< uint8_t > &clientid_data, const std::vector< uint8_t > &wire_fqdn)
 Constructor, creates an instance of the D2Dhcid from the client identifier carried in the Client Identifier option. More...
 
 D2Dhcid (const isc::dhcp::DUID &duid, const std::vector< uint8_t > &wire_fqdn)
 Constructor, creates an instance of the D2Dhcid from the isc::dhcp::DUID. More...
 
void fromClientId (const std::vector< uint8_t > &clientid_data, const std::vector< uint8_t > &wire_fqdn)
 Sets the DHCID value based on the Client Identifier. More...
 
void fromDUID (const isc::dhcp::DUID &duid, const std::vector< uint8_t > &wire_fqdn)
 Sets the DHCID value based on the DUID and FQDN. More...
 
void fromHWAddr (const isc::dhcp::HWAddrPtr &hwaddr, const std::vector< uint8_t > &wire_fqdn)
 Sets the DHCID value based on the HW address and FQDN. More...
 
void fromStr (const std::string &data)
 Sets the DHCID value based on the given string. More...
 
const std::vector< uint8_t > & getBytes () const
 Returns a reference to the DHCID byte vector. More...
 
bool operator!= (const D2Dhcid &other) const
 Compares two D2Dhcids for inequality. More...
 
bool operator< (const D2Dhcid &other) const
 Compares two D2Dhcids lexically. More...
 
bool operator== (const D2Dhcid &other) const
 Compares two D2Dhcids for equality. More...
 
std::string toStr () const
 Returns the DHCID value as a string of hexadecimal digits. More...
 

Detailed Description

Container class for handling the DHCID value within a NameChangeRequest.

It provides conversion to and from string for JSON formatting, but stores the data internally as unsigned bytes.

Definition at line 86 of file ncr_msg.h.

Constructor & Destructor Documentation

◆ D2Dhcid() [1/5]

isc::dhcp_ddns::D2Dhcid::D2Dhcid ( )

Default constructor.

Definition at line 61 of file ncr_msg.cc.

◆ D2Dhcid() [2/5]

isc::dhcp_ddns::D2Dhcid::D2Dhcid ( const std::string &  data)

Constructor - Creates a new instance, populated by converting a given string of digits into an array of unsigned bytes.

Parameters
datais a string of hexadecimal digits. The format is simply a contiguous stream of digits, with no delimiters. For example a string containing "14A3" converts to a byte array containing: 0x14, 0xA3.
Exceptions
NcrMessageErrorif the input data contains non-digits or there is an odd number of digits.

Definition at line 64 of file ncr_msg.cc.

References fromStr().

+ Here is the call graph for this function:

◆ D2Dhcid() [3/5]

isc::dhcp_ddns::D2Dhcid::D2Dhcid ( const isc::dhcp::HWAddrPtr hwaddr,
const std::vector< uint8_t > &  wire_fqdn 
)

Constructor, creates an instance of the D2Dhcid from the HW address.

Parameters
hwaddrA pointer to the object encapsulating HW address.
wire_fqdnA on-wire canonical representation of the FQDN.

Definition at line 68 of file ncr_msg.cc.

References fromHWAddr().

+ Here is the call graph for this function:

◆ D2Dhcid() [4/5]

isc::dhcp_ddns::D2Dhcid::D2Dhcid ( const std::vector< uint8_t > &  clientid_data,
const std::vector< uint8_t > &  wire_fqdn 
)

Constructor, creates an instance of the D2Dhcid from the client identifier carried in the Client Identifier option.

Parameters
clientid_dataHolds the raw bytes representing client identifier.
wire_fqdnA on-wire canonical representation of the FQDN.

Definition at line 73 of file ncr_msg.cc.

References fromClientId().

+ Here is the call graph for this function:

◆ D2Dhcid() [5/5]

isc::dhcp_ddns::D2Dhcid::D2Dhcid ( const isc::dhcp::DUID duid,
const std::vector< uint8_t > &  wire_fqdn 
)

Constructor, creates an instance of the D2Dhcid from the isc::dhcp::DUID.

Parameters
duidAn object representing DUID.
wire_fqdnA on-wire canonical representation of the FQDN.

Definition at line 78 of file ncr_msg.cc.

References fromDUID().

+ Here is the call graph for this function:

Member Function Documentation

◆ fromClientId()

void isc::dhcp_ddns::D2Dhcid::fromClientId ( const std::vector< uint8_t > &  clientid_data,
const std::vector< uint8_t > &  wire_fqdn 
)

Sets the DHCID value based on the Client Identifier.

Parameters
clientid_dataHolds the raw bytes representing client identifier.
wire_fqdnA on-wire canonical representation of the FQDN.

Definition at line 100 of file ncr_msg.cc.

References isc_throw.

Referenced by D2Dhcid().

◆ fromDUID()

void isc::dhcp_ddns::D2Dhcid::fromDUID ( const isc::dhcp::DUID duid,
const std::vector< uint8_t > &  wire_fqdn 
)

Sets the DHCID value based on the DUID and FQDN.

This function requires that the FQDN conforms to the section 3.5 of the RFC4701, which says that the FQDN must be in lowercase. This function doesn't validate if it really converted.

Parameters
duidA isc::dhcp::DUID object encapsulating DUID.
wire_fqdnA on-wire canonical representation of the FQDN.

Definition at line 151 of file ncr_msg.cc.

References isc::cryptolink::digest(), isc::util::OutputBuffer::getData(), isc::dhcp::DUID::getDuid(), isc::util::OutputBuffer::getLength(), isc_throw, isc::cryptolink::SHA256, and isc::Exception::what().

Referenced by D2Dhcid().

+ Here is the call graph for this function:

◆ fromHWAddr()

void isc::dhcp_ddns::D2Dhcid::fromHWAddr ( const isc::dhcp::HWAddrPtr hwaddr,
const std::vector< uint8_t > &  wire_fqdn 
)

Sets the DHCID value based on the HW address and FQDN.

Parameters
hwaddrA pointer to the object encapsulating HW address.
wire_fqdnA on-wire canonical representation of the FQDN.

Definition at line 131 of file ncr_msg.cc.

References isc_throw.

Referenced by D2Dhcid().

◆ fromStr()

void isc::dhcp_ddns::D2Dhcid::fromStr ( const std::string &  data)

Sets the DHCID value based on the given string.

Parameters
datais a string of hexadecimal digits. The format is simply a contiguous stream of digits, with no delimiters. For example a string containing "14A3" converts to a byte array containing: 0x14, 0xA3.
Exceptions
NcrMessageErrorif the input data contains non-digits or there is an odd number of digits.

Definition at line 85 of file ncr_msg.cc.

References isc::util::encode::decodeHex(), isc_throw, and isc::Exception::what().

Referenced by D2Dhcid(), and isc::dhcp_ddns::NameChangeRequest::setDhcid().

+ Here is the call graph for this function:

◆ getBytes()

const std::vector<uint8_t>& isc::dhcp_ddns::D2Dhcid::getBytes ( ) const
inline

Returns a reference to the DHCID byte vector.

Returns
a reference to the vector.

Definition at line 169 of file ncr_msg.h.

Referenced by isc::dhcp_ddns::NameChangeRequest::validateContent().

◆ operator!=()

bool isc::dhcp_ddns::D2Dhcid::operator!= ( const D2Dhcid other) const
inline

Compares two D2Dhcids for inequality.

Definition at line 179 of file ncr_msg.h.

◆ operator<()

bool isc::dhcp_ddns::D2Dhcid::operator< ( const D2Dhcid other) const
inline

Compares two D2Dhcids lexically.

Definition at line 184 of file ncr_msg.h.

References isc::dhcp_ddns::operator<<().

+ Here is the call graph for this function:

◆ operator==()

bool isc::dhcp_ddns::D2Dhcid::operator== ( const D2Dhcid other) const
inline

Compares two D2Dhcids for equality.

Definition at line 174 of file ncr_msg.h.

◆ toStr()

std::string isc::dhcp_ddns::D2Dhcid::toStr ( ) const

Returns the DHCID value as a string of hexadecimal digits.

Returns
a string containing a contiguous stream of digits.

Definition at line 95 of file ncr_msg.cc.

References isc::util::encode::encodeHex().

Referenced by isc::d2::D2UpdateMgr::makeTransaction(), isc::dhcp_ddns::operator<<(), isc::dhcp_ddns::NameChangeRequest::toJSON(), and isc::dhcp_ddns::NameChangeRequest::toText().

+ Here is the call graph for this function:

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