A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches

Implements the unique identifier for DHCPv6. More...

#include "dhcp6-duid.h"

+ Collaboration diagram for ns3::Duid:

Classes

class  DuidHash
 Class providing a hash for DUIDs. More...
 

Public Types

enum class  Type { LLT = 1 , EN , LL , UUID }
 DUID type. More...
 

Public Member Functions

 Duid ()
 Default constructor.
 
uint32_t Deserialize (Buffer::Iterator start, uint32_t len)
 Deserialize the DUID.
 
Type GetDuidType () const
 Get the DUID type.
 
uint16_t GetHardwareType () const
 Get the hardware type.
 
uint8_t GetLength () const
 Get the length of the DUID.
 
uint32_t GetSerializedSize () const
 Get the DUID serialized size.
 
Time GetTime () const
 Get the time at which the DUID is generated.
 
void Initialize (Ptr< Node > node)
 Initialize the DUID for a client or server.
 
bool IsInvalid () const
 Check if the DUID is invalid.
 
bool operator== (const Duid &duid) const
 Comparison operator.
 
void Serialize (Buffer::Iterator start) const
 Serialize the DUID.
 
void SetDuid (std::vector< uint8_t > identifier)
 Set the identifier as the DUID.
 
void SetDuidType (Type duidType)
 Set the DUID type.
 
void SetHardwareType (uint16_t hardwareType)
 Set the hardware type.
 
void SetTime (Time time)
 Set the time at which DUID is generated.
 

Private Member Functions

std::vector< uint8_t > GetIdentifier () const
 Return the identifier of the node.
 

Private Attributes

Type m_duidType
 Type of the DUID.
 
uint16_t m_hardwareType
 Valid hardware type assigned by IANA.
 
std::vector< uint8_t > m_identifier
 Identifier of the node in bytes.
 
Time m_time
 Time at which the DUID is generated.
 

Friends

bool operator< (const Duid &a, const Duid &b)
 Less than operator.
 

Detailed Description

Implements the unique identifier for DHCPv6.

Definition at line 26 of file dhcp6-duid.h.

Member Enumeration Documentation

◆ Type

enum class ns3::Duid::Type
strong

DUID type.

Enumerator
LLT 
EN 
LL 
UUID 

Definition at line 35 of file dhcp6-duid.h.

Constructor & Destructor Documentation

◆ Duid()

ns3::Duid::Duid ( )

Default constructor.

Definition at line 24 of file dhcp6-duid.cc.

References LL, m_duidType, m_hardwareType, m_identifier, and m_time.

Member Function Documentation

◆ Deserialize()

uint32_t ns3::Duid::Deserialize ( Buffer::Iterator start,
uint32_t len )

Deserialize the DUID.

Parameters
startThe buffer iterator.
lenThe number of bytes to be read.
Returns
The number of bytes read.

Definition at line 209 of file dhcp6-duid.cc.

References m_duidType, m_hardwareType, m_identifier, ns3::Buffer::Iterator::ReadNtohU16(), and ns3::Buffer::Iterator::ReadU8().

Referenced by ns3::Dhcp6Header::Deserialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDuidType()

Duid::Type ns3::Duid::GetDuidType ( ) const

Get the DUID type.

Returns
the DUID type.

Definition at line 81 of file dhcp6-duid.cc.

References m_duidType.

◆ GetHardwareType()

uint16_t ns3::Duid::GetHardwareType ( ) const

Get the hardware type.

Returns
the hardware type

Definition at line 93 of file dhcp6-duid.cc.

References m_hardwareType.

◆ GetIdentifier()

std::vector< uint8_t > ns3::Duid::GetIdentifier ( ) const
private

Return the identifier of the node.

Returns
the identifier.

Definition at line 75 of file dhcp6-duid.cc.

References m_identifier.

◆ GetLength()

uint8_t ns3::Duid::GetLength ( ) const

Get the length of the DUID.

Returns
the DUID length.

Definition at line 69 of file dhcp6-duid.cc.

References m_identifier.

Referenced by ns3::Dhcp6Header::AddIdentifierOption().

+ Here is the caller graph for this function:

◆ GetSerializedSize()

uint32_t ns3::Duid::GetSerializedSize ( ) const

Get the DUID serialized size.

Returns
The DUID serialized sized in bytes.

Definition at line 190 of file dhcp6-duid.cc.

References m_identifier.

Referenced by ns3::Dhcp6Header::Serialize().

+ Here is the caller graph for this function:

◆ GetTime()

Time ns3::Duid::GetTime ( ) const

Get the time at which the DUID is generated.

Returns
the timestamp.

Definition at line 177 of file dhcp6-duid.cc.

References m_time.

◆ Initialize()

void ns3::Duid::Initialize ( Ptr< Node > node)

Initialize the DUID for a client or server.

Parameters
nodeThe node for which the DUID is to be generated.

Definition at line 132 of file dhcp6-duid.cc.

References ns3::Address::CopyTo(), ns3::DynamicCast(), ns3::Address::GetLength(), ns3::Address::IsInvalid(), NS_ASSERT_MSG, NS_LOG_DEBUG, and SetDuid().

Referenced by ns3::Dhcp6Client::Boot(), and ns3::Dhcp6Server::NetHandler().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsInvalid()

bool ns3::Duid::IsInvalid ( ) const

Check if the DUID is invalid.

Returns
true if the DUID is invalid.

Definition at line 63 of file dhcp6-duid.cc.

References m_identifier.

Referenced by ns3::Dhcp6Client::Boot().

+ Here is the caller graph for this function:

◆ operator==()

bool ns3::Duid::operator== ( const Duid & duid) const

Comparison operator.

Parameters
duidheader to compare
Returns
true if the headers are equal

Definition at line 33 of file dhcp6-duid.cc.

References m_duidType, m_hardwareType, and m_identifier.

◆ Serialize()

void ns3::Duid::Serialize ( Buffer::Iterator start) const

Serialize the DUID.

Parameters
startThe buffer iterator.

Definition at line 196 of file dhcp6-duid.cc.

References m_duidType, m_hardwareType, m_identifier, ns3::Buffer::Iterator::WriteHtonU16(), and ns3::Buffer::Iterator::WriteU8().

Referenced by ns3::Dhcp6Header::Serialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetDuid()

void ns3::Duid::SetDuid ( std::vector< uint8_t > identifier)

Set the identifier as the DUID.

Parameters
identifierthe identifier of the node.

Definition at line 106 of file dhcp6-duid.cc.

References LL, m_duidType, m_identifier, NS_ASSERT_MSG, NS_LOG_FUNCTION, and SetHardwareType().

Referenced by ns3::IdentifierOption::IdentifierOption(), and Initialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetDuidType()

void ns3::Duid::SetDuidType ( Duid::Type duidType)

Set the DUID type.

Parameters
duidTypethe DUID type.

Definition at line 87 of file dhcp6-duid.cc.

References m_duidType.

Referenced by ns3::IdentifierOption::IdentifierOption().

+ Here is the caller graph for this function:

◆ SetHardwareType()

void ns3::Duid::SetHardwareType ( uint16_t hardwareType)

Set the hardware type.

Parameters
hardwareTypethe hardware type.

Definition at line 99 of file dhcp6-duid.cc.

References m_hardwareType, and NS_LOG_FUNCTION.

Referenced by ns3::IdentifierOption::IdentifierOption(), and SetDuid().

+ Here is the caller graph for this function:

◆ SetTime()

void ns3::Duid::SetTime ( Time time)

Set the time at which DUID is generated.

Parameters
timethe timestamp.

Definition at line 183 of file dhcp6-duid.cc.

References m_time, and NS_LOG_FUNCTION.

Friends And Related Symbol Documentation

◆ operator<

bool operator< ( const Duid & a,
const Duid & b )
friend

Less than operator.

Parameters
athe first operand
bthe first operand
Returns
true if the operand a is less than operand b

Definition at line 39 of file dhcp6-duid.cc.

Member Data Documentation

◆ m_duidType

Type ns3::Duid::m_duidType
private

Type of the DUID.

We currently use only DUID-LL, based on the link-layer address.

Definition at line 176 of file dhcp6-duid.h.

Referenced by Duid(), Deserialize(), GetDuidType(), operator==(), Serialize(), SetDuid(), and SetDuidType().

◆ m_hardwareType

uint16_t ns3::Duid::m_hardwareType
private

Valid hardware type assigned by IANA.

Definition at line 178 of file dhcp6-duid.h.

Referenced by Duid(), Deserialize(), GetHardwareType(), operator==(), Serialize(), and SetHardwareType().

◆ m_identifier

std::vector<uint8_t> ns3::Duid::m_identifier
private

Identifier of the node in bytes.

Definition at line 180 of file dhcp6-duid.h.

Referenced by Duid(), Deserialize(), GetIdentifier(), GetLength(), GetSerializedSize(), IsInvalid(), operator==(), Serialize(), and SetDuid().

◆ m_time

Time ns3::Duid::m_time
private

Time at which the DUID is generated.

Used in DUID-LLT.

Definition at line 179 of file dhcp6-duid.h.

Referenced by Duid(), GetTime(), and SetTime().


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