Implements the unique identifier for DHCPv6. More...
#include "dhcp6-duid.h"
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. | |
Implements the unique identifier for DHCPv6.
Definition at line 26 of file dhcp6-duid.h.
|
strong |
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.
uint32_t ns3::Duid::Deserialize | ( | Buffer::Iterator | start, |
uint32_t | len ) |
Deserialize the DUID.
start | The buffer iterator. |
len | The number of bytes to be 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().
Duid::Type ns3::Duid::GetDuidType | ( | ) | const |
Get the DUID type.
Definition at line 81 of file dhcp6-duid.cc.
References m_duidType.
uint16_t ns3::Duid::GetHardwareType | ( | ) | const |
Get the hardware type.
Definition at line 93 of file dhcp6-duid.cc.
References m_hardwareType.
|
private |
Return the identifier of the node.
Definition at line 75 of file dhcp6-duid.cc.
References m_identifier.
uint8_t ns3::Duid::GetLength | ( | ) | const |
Get the length of the DUID.
Definition at line 69 of file dhcp6-duid.cc.
References m_identifier.
Referenced by ns3::Dhcp6Header::AddIdentifierOption().
uint32_t ns3::Duid::GetSerializedSize | ( | ) | const |
Get the DUID serialized size.
Definition at line 190 of file dhcp6-duid.cc.
References m_identifier.
Referenced by ns3::Dhcp6Header::Serialize().
Time ns3::Duid::GetTime | ( | ) | const |
Get the time at which the DUID is generated.
Definition at line 177 of file dhcp6-duid.cc.
References m_time.
Initialize the DUID for a client or server.
node | The 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().
bool ns3::Duid::IsInvalid | ( | ) | const |
Check if the DUID is invalid.
Definition at line 63 of file dhcp6-duid.cc.
References m_identifier.
Referenced by ns3::Dhcp6Client::Boot().
bool ns3::Duid::operator== | ( | const Duid & | duid | ) | const |
Comparison operator.
duid | header to compare |
Definition at line 33 of file dhcp6-duid.cc.
References m_duidType, m_hardwareType, and m_identifier.
void ns3::Duid::Serialize | ( | Buffer::Iterator | start | ) | const |
Serialize the DUID.
start | The 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().
void ns3::Duid::SetDuid | ( | std::vector< uint8_t > | identifier | ) |
Set the identifier as the DUID.
identifier | the 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().
void ns3::Duid::SetDuidType | ( | Duid::Type | duidType | ) |
Set the DUID type.
duidType | the DUID type. |
Definition at line 87 of file dhcp6-duid.cc.
References m_duidType.
Referenced by ns3::IdentifierOption::IdentifierOption().
void ns3::Duid::SetHardwareType | ( | uint16_t | hardwareType | ) |
Set the hardware type.
hardwareType | the 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().
void ns3::Duid::SetTime | ( | Time | time | ) |
Set the time at which DUID is generated.
time | the timestamp. |
Definition at line 183 of file dhcp6-duid.cc.
References m_time, and NS_LOG_FUNCTION.
Less than operator.
a | the first operand |
b | the first operand |
Definition at line 39 of file dhcp6-duid.cc.
|
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().
|
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().
|
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().
|
private |