Kea  2.1.7-git
isc::dhcp::ClientId Class Reference

Holds Client identifier or client IPv4 address. More...

#include <duid.h>

+ Inheritance diagram for isc::dhcp::ClientId:

Public Member Functions

 ClientId (const std::vector< uint8_t > &clientid)
 Constructor based on vector<uint8_t> More...
 
 ClientId (const uint8_t *clientid, size_t len)
 Constructor based on array and array size. More...
 
const std::vector< uint8_t > & getClientId () const
 Returns reference to the client-id data. More...
 
bool operator!= (const ClientId &other) const
 Compares two client-ids for inequality. More...
 
bool operator== (const ClientId &other) const
 Compares two client-ids for equality. More...
 
std::string toText () const
 Returns textual representation of a DUID (e.g. 00:01:02:03:ff) More...
 
- Public Member Functions inherited from isc::dhcp::DUID
 DUID (const std::vector< uint8_t > &duid)
 Constructor from vector. More...
 
 DUID (const uint8_t *duid, size_t len)
 Constructor from array and array size. More...
 
const std::vector< uint8_t > & getDuid () const
 Returns a const reference to the actual DUID value. More...
 
DUIDType getType () const
 Returns the DUID type. More...
 
bool operator!= (const DUID &other) const
 Compares two DUIDs for inequality. More...
 
bool operator== (const DUID &other) const
 Compares two DUIDs for equality. More...
 
std::string toText () const
 Returns textual representation of a DUID (e.g. 00:01:02:03:ff) More...
 

Static Public Member Functions

static ClientIdPtr fromText (const std::string &text)
 Create client identifier from the textual format. More...
 
- Static Public Member Functions inherited from isc::dhcp::DUID
static const DUIDEMPTY ()
 Defines the constant "empty" DUID. More...
 
static DUID fromText (const std::string &text)
 Create DUID from the textual format. More...
 

Static Public Attributes

static const size_t MAX_CLIENT_ID_LEN = DUID::MAX_DUID_LEN
 Maximum size of a client ID. More...
 
static const size_t MIN_CLIENT_ID_LEN = 2
 Minimum size of a client ID. More...
 
- Static Public Attributes inherited from isc::dhcp::DUID
static const size_t MAX_DUID_LEN = 128
 maximum duid size As defined in RFC 8415, section 11.1 More...
 
static const size_t MIN_DUID_LEN = 1
 minimum duid size The minimal DUID size specified in RFC 8415 is 1. More...
 

Additional Inherited Members

- Public Types inherited from isc::dhcp::DUID
enum  DUIDType {
  DUID_UNKNOWN = 0, DUID_LLT = 1, DUID_EN = 2, DUID_LL = 3,
  DUID_UUID = 4, DUID_MAX
}
 specifies DUID type More...
 
- Protected Attributes inherited from isc::dhcp::DUID
std::vector< uint8_t > duid_
 The actual content of the DUID. More...
 

Detailed Description

Holds Client identifier or client IPv4 address.

This class is intended to be a generic IPv4 client identifier. It can hold a client-id

Definition at line 111 of file duid.h.

Constructor & Destructor Documentation

◆ ClientId() [1/2]

isc::dhcp::ClientId::ClientId ( const std::vector< uint8_t > &  clientid)

Constructor based on vector<uint8_t>

Definition at line 99 of file duid.cc.

References isc_throw, and MIN_CLIENT_ID_LEN.

Referenced by fromText().

◆ ClientId() [2/2]

isc::dhcp::ClientId::ClientId ( const uint8_t *  clientid,
size_t  len 
)

Constructor based on array and array size.

Definition at line 108 of file duid.cc.

References isc_throw, and MIN_CLIENT_ID_LEN.

Member Function Documentation

◆ fromText()

ClientIdPtr isc::dhcp::ClientId::fromText ( const std::string &  text)
static

Create client identifier from the textual format.

This static function creates the instance of the ClientId from the textual format. Internally it calls DUID::fromText. The format of the input must match the format of the DUID in DUID::fromText.

Parameters
textClient identifier in the textual format.
Returns
Pointer to the instance of the ClientId.
Exceptions
isc::BadValueif parsing the client identifier failed.
isc::OutOfRangeif the client identifier is truncated.

Definition at line 132 of file duid.cc.

References ClientId(), and isc::util::str::decodeFormattedHexString().

Referenced by isc::dhcp::Lease4::fromElement(), isc::lease_cmds::LeaseCmdsImpl::getParameters(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByClientIdHandler(), and isc::dhcp::CSVLeaseFile4::next().

+ Here is the call graph for this function:

◆ getClientId()

const std::vector< uint8_t > & isc::dhcp::ClientId::getClientId ( ) const

Returns reference to the client-id data.

Warning
Since this function returns a reference to the vector (not a copy) the returned object must be used with caution because it remains valid only for the time period when the object which returned it is valid.
Returns
A reference to a vector holding a client identifier.

Definition at line 117 of file duid.cc.

References isc::dhcp::DUID::duid_.

Referenced by isc::dhcp::Memfile_LeaseMgr::getLease4(), isc::dhcp::PgSqlLeaseMgr::getLease4(), and isc::dhcp::MySqlLeaseMgr::getLease4().

◆ operator!=()

bool isc::dhcp::ClientId::operator!= ( const ClientId other) const

Compares two client-ids for inequality.

Definition at line 144 of file duid.cc.

References isc::dhcp::DUID::duid_.

◆ operator==()

bool isc::dhcp::ClientId::operator== ( const ClientId other) const

Compares two client-ids for equality.

Definition at line 139 of file duid.cc.

References isc::dhcp::DUID::duid_.

◆ toText()

std::string isc::dhcp::ClientId::toText ( ) const

Returns textual representation of a DUID (e.g. 00:01:02:03:ff)

Definition at line 122 of file duid.cc.

References isc::dhcp::DUID::toText().

Referenced by isc::dhcp::Memfile_LeaseMgr::getLease4(), isc::dhcp::PgSqlLeaseMgr::getLease4(), and isc::dhcp::MySqlLeaseMgr::getLease4().

+ Here is the call graph for this function:

Member Data Documentation

◆ MAX_CLIENT_ID_LEN

const size_t isc::dhcp::ClientId::MAX_CLIENT_ID_LEN = DUID::MAX_DUID_LEN
static

Maximum size of a client ID.

This is the same as the maximum size of the underlying DUID.

Note
RFC 2131 does not specify an upper length of a client ID, the value chosen here just being that of the underlying DUID. For some backend database, there may be a possible (minor) performance enhancement if this were smaller.

Definition at line 128 of file duid.h.

◆ MIN_CLIENT_ID_LEN

const size_t isc::dhcp::ClientId::MIN_CLIENT_ID_LEN = 2
static

Minimum size of a client ID.

Excerpt from RFC2132, section 9.14. The code for this option is 61, and its minimum length is 2.

Definition at line 118 of file duid.h.

Referenced by ClientId().


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