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 | |
| 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. | |
| std::vector< uint8_t > | GetIdentifier () const |
| Return the identifier of the node. | |
| 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. | |
| std::strong_ordering | operator<=> (const Duid &other) const =default |
| Spaceship 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 Attributes | |
| Type | m_duidType {Duid::Type::LL} |
| Type of the DUID. | |
| uint16_t | m_hardwareType {0} |
| Valid hardware type assigned by IANA. | |
| std::vector< uint8_t > | m_identifier {} |
| Identifier of the node in bytes. | |
| uint32_t | m_time {0} |
| Time at which the DUID is generated. | |
Implements the unique identifier for DHCPv6.
Definition at line 26 of file dhcp6-duid.h.
|
strong |
| 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 188 of file dhcp6-duid.cc.
References GetSerializedSize(), LL, LLT, m_duidType, m_hardwareType, m_identifier, m_time, NS_ASSERT_MSG, ns3::Buffer::Iterator::ReadNtohU16(), ns3::Buffer::Iterator::ReadNtohU32(), and ns3::Buffer::Iterator::ReadU8().
Referenced by ns3::Dhcp6Header::Deserialize().
| Duid::Type ns3::Duid::GetDuidType | ( | ) | const |
Get the DUID type.
Definition at line 43 of file dhcp6-duid.cc.
References m_duidType.
Referenced by ns3::Dhcp6Header::AddIdentifierOption().
| uint16_t ns3::Duid::GetHardwareType | ( | ) | const |
Get the hardware type.
Definition at line 57 of file dhcp6-duid.cc.
References m_hardwareType.
| std::vector< uint8_t > ns3::Duid::GetIdentifier | ( | ) | const |
Return the identifier of the node.
Definition at line 37 of file dhcp6-duid.cc.
References m_identifier.
| uint8_t ns3::Duid::GetLength | ( | ) | const |
Get the length of the DUID.
Definition at line 31 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 161 of file dhcp6-duid.cc.
References LLT, m_duidType, and m_identifier.
Referenced by Deserialize(), and ns3::Dhcp6Header::Serialize().
| Time ns3::Duid::GetTime | ( | ) | const |
Get the time at which the DUID is generated.
Definition at line 141 of file dhcp6-duid.cc.
References m_time, and ns3::Seconds().
Initialize the DUID for a client or server.
| node | The node for which the DUID is to be generated. |
Definition at line 96 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().
| bool ns3::Duid::IsInvalid | ( | ) | const |
Check if the DUID is invalid.
Definition at line 25 of file dhcp6-duid.cc.
References m_identifier.
|
default |
Spaceship comparison operator.
All the other comparison operators are automatically generated from this one.
| other | DUID to compare to this one |
| void ns3::Duid::Serialize | ( | Buffer::Iterator | start | ) | const |
Serialize the DUID.
| start | The buffer iterator. |
Definition at line 171 of file dhcp6-duid.cc.
References LLT, m_duidType, m_hardwareType, m_identifier, m_time, ns3::Buffer::Iterator::WriteHtonU16(), ns3::Buffer::Iterator::WriteHtonU32(), 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 70 of file dhcp6-duid.cc.
References LL, m_duidType, m_identifier, NS_ASSERT_MSG, NS_LOG_FUNCTION, and SetHardwareType().
Referenced by Initialize().
| void ns3::Duid::SetDuidType | ( | Duid::Type | duidType | ) |
Set the DUID type.
| duidType | the DUID type. |
Definition at line 49 of file dhcp6-duid.cc.
References LL, LLT, m_duidType, and NS_ASSERT_MSG.
| void ns3::Duid::SetHardwareType | ( | uint16_t | hardwareType | ) |
Set the hardware type.
| hardwareType | the hardware type. |
Definition at line 63 of file dhcp6-duid.cc.
References m_hardwareType, and NS_LOG_FUNCTION.
Referenced by SetDuid().
| void ns3::Duid::SetTime | ( | Time | time | ) |
Set the time at which DUID is generated.
| time | the timestamp. |
Definition at line 150 of file dhcp6-duid.cc.
References ns3::Time::GetSeconds(), m_time, and NS_LOG_FUNCTION.
|
private |
Type of the DUID.
We currently use only DUID-LL, based on the link-layer address.
Definition at line 158 of file dhcp6-duid.h.
Referenced by Deserialize(), GetDuidType(), GetSerializedSize(), Serialize(), SetDuid(), and SetDuidType().
|
private |
Valid hardware type assigned by IANA.
Definition at line 160 of file dhcp6-duid.h.
Referenced by Deserialize(), GetHardwareType(), Serialize(), and SetHardwareType().
|
private |
Identifier of the node in bytes.
Definition at line 162 of file dhcp6-duid.h.
Referenced by Deserialize(), GetIdentifier(), GetLength(), GetSerializedSize(), IsInvalid(), Serialize(), and SetDuid().
|
private |
Time at which the DUID is generated.
Used in DUID-LLT.
Definition at line 161 of file dhcp6-duid.h.
Referenced by Deserialize(), GetTime(), Serialize(), and SetTime().