15#include "ns3/address-utils.h"
16#include "ns3/assert.h"
51 std::vector<uint8_t> rovr,
66 std::vector<uint8_t> rovr,
87 static TypeId tid =
TypeId(
"ns3::Icmpv6DuplicateAddress")
89 .SetGroupName(
"Internet")
141 uint8_t rovrLength = rovr.size();
142 NS_ASSERT_MSG((rovrLength == 8) || (rovrLength == 16) || (rovrLength == 24) ||
144 "ROVR length must be 64, 128, 192, or 256 bits");
168 std::ios oldState(
nullptr);
169 oldState.copyfmt(os);
170 uint8_t rovrLength =
m_rovr.size();
173 <<
" lifetime " <<
m_regTime <<
" ROVR len " << rovrLength;
174 for (uint8_t index = 0; index < rovrLength; index++)
176 os << std::hex <<
m_rovr[index];
180 os.copyfmt(oldState);
200 uint8_t codeSfx =
m_rovr.size() / 8;
208 for (
const auto& rovr :
m_rovr)
221 uint8_t codePSfx = i.
ReadU8();
224 NS_LOG_LOGIC(
"Invalid CodeSfx or CodePfx value (" << codePSfx <<
"), discarding message");
227 uint8_t rovrLength = codePSfx * 8;
234 for (uint8_t index = 0; index < rovrLength; index++)
259 const std::vector<uint8_t>& rovr,
277 const std::vector<uint8_t>& rovr,
301 static TypeId tid =
TypeId(
"ns3::Icmpv6OptionAddressRegistration")
303 .SetGroupName(
"Internet")
416 uint8_t rovrLength = rovr.size();
417 NS_ASSERT_MSG((rovrLength == 8) || (rovrLength == 16) || (rovrLength == 24) ||
419 "ROVR length must be 64, 128, 192, or 256 bits");
429 std::ios oldState(
nullptr);
430 oldState.copyfmt(os);
431 uint8_t rovrLength =
m_rovr.size();
435 for (uint8_t index = 0; index < rovrLength; index++)
437 os << std::hex << +
m_rovr[index];
441 os.copyfmt(oldState);
478 for (
const auto& rovr :
m_rovr)
492 uint8_t rovrLength = (
GetLength() - 1) * 8;
497 uint8_t flags = i.
ReadU8();
498 if ((flags & 0x01) != 0x01)
500 NS_LOG_LOGIC(
"Received an EARO without the T flag set - ignoring");
503 if ((flags & 0x02) == 0x02)
507 m_i = (flags >> 2) & 0x03;
513 for (uint8_t index = 0; index < rovrLength; index++)
567 static TypeId tid =
TypeId(
"ns3::Icmpv6OptionSixLowPanContext")
569 .SetGroupName(
"Internet")
662 <<
" context prefix = " <<
m_prefix.ConvertToIpv6Address() <<
"/"
663 << +
m_prefix.GetPrefixLength() <<
")";
680 uint8_t bitfield = 0;
682 memset(buf, 0x0000,
sizeof(buf));
689 bitfield |= (uint8_t)(
m_c << 4);
714 memset(buf, 0x0000,
sizeof(buf));
722 if (bitfield & (uint8_t)(1 << 4))
726 m_cid = bitfield & 0xF;
785 static TypeId tid =
TypeId(
"ns3::Icmpv6OptionAuthoritativeBorderRouter")
787 .SetGroupName(
"Internet")
866 memset(buf, 0x0000,
sizeof(buf));
892 memset(buf, 0x0000,
sizeof(buf));
900 m_version = (versionL &= 0xFFFF) + (versionH &= 0xFFFF0000);
iterator in a Buffer instance
void WriteU8(uint8_t data)
void Write(const uint8_t *buffer, uint32_t size)
void WriteU16(uint16_t data)
void Read(uint8_t *buffer, uint32_t size)
void Next()
go forward by one byte
ICMPv6 Authoritative Border Router Option header (see RFC 8505).
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
void Print(std::ostream &os) const override
Print information.
Ipv6Address m_routerAddress
The 6LBR address value.
uint16_t m_validTime
The valid lifetime value (units of 60 seconds).
static TypeId GetTypeId()
Get the UID of this class.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
void SetValidLifeTime(uint16_t time)
Set the valid lifetime field.
uint32_t GetVersion() const
Get the version field.
void SetVersion(uint32_t version)
Set the version field.
uint32_t GetSerializedSize() const override
Get the serialized size.
Icmpv6OptionSixLowPanAuthoritativeBorderRouter()
Constructor.
uint16_t GetValidLifeTime() const
Get the valid lifetime field.
uint32_t m_version
The version value.
void SetRouterAddress(Ipv6Address router)
Set the 6LBR address field.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
Ipv6Address GetRouterAddress() const
Get the 6LBR address field.
~Icmpv6OptionSixLowPanAuthoritativeBorderRouter() override
Destructor.
ICMPv6 SixLowPan Context Option header (see RFC 8505).
uint8_t GetCid() const
Get the context identifier field.
bool m_c
The compression flag, indicates that this context is valid for use in compression.
Ipv6Prefix GetContextPrefix() const
Get the context prefix field.
void Print(std::ostream &os) const override
Print information.
Icmpv6OptionSixLowPanContext()
Constructor.
uint8_t m_cid
The context identifier value.
void SetFlagC(bool c)
Set the C flag.
Ipv6Prefix m_prefix
The context prefix value.
void SetContextPrefix(Ipv6Prefix prefix)
Set the context prefix field.
uint8_t m_contextLen
The context length value.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
static TypeId GetTypeId()
Get the UID of this class.
uint8_t GetContextLen() const
Get the context length field.
void SetValidTime(uint16_t time)
Set the valid lifetime field.
uint16_t m_validTime
The valid lifetime value (units of 60 seconds).
void SetCid(uint8_t cid)
Set the context identifier field.
bool IsFlagC() const
Is compression flag ?
uint32_t GetSerializedSize() const override
Get the serialized size.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
~Icmpv6OptionSixLowPanContext() override
Destructor.
uint16_t GetValidTime() const
Get the valid lifetime field.
ICMPv6 Extended Address Registration Option header RFC 8505.
uint32_t GetSerializedSize() const override
Get the serialized size.
static TypeId GetTypeId()
Get the UID of this class.
bool GetFlagR() const
Get the R flag.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
Icmpv6OptionSixLowPanExtendedAddressRegistration()
Constructor.
void SetStatus(uint8_t status)
Set the status field.
uint8_t GetOpaque() const
Get the opaque field.
uint8_t m_status
The status value.
uint8_t GetStatus() const
Get the status field.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
uint8_t GetTransactionId() const
Get the transaction ID field.
uint8_t m_opaque
The opaque value.
uint16_t m_regTime
The registration lifetime value (units of 60 seconds).
void SetRovr(const std::vector< uint8_t > &rovr)
Set the ROVR field.
uint16_t m_tid
The Transaction ID value.
uint8_t m_i
The I Two bit value.
std::vector< uint8_t > GetRovr() const
Get the ROVR field.
~Icmpv6OptionSixLowPanExtendedAddressRegistration() override
Destructor.
uint16_t GetRegTime() const
Get the registration lifetime field.
void SetFlagR(bool r)
Set the R flag.
void SetI(uint8_t twobits)
Set the I-TwoBit field.
std::vector< uint8_t > m_rovr
The ROVR value.
void SetTransactionId(uint8_t tid)
Set the transaction ID field.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
void SetRegTime(uint16_t time)
Set the registration lifetime field.
uint8_t GetI() const
Get the I-TwoBit field.
void Print(std::ostream &os) const override
Print information.
void SetOpaque(uint8_t opaque)
Set the opaque field.
ICMPv6 Extended Duplicate Address Request or Confirmation header (see RFC 8505).
Ipv6Address m_regAddress
The registered address value.
uint16_t GetRegTime() const
Get the registration lifetime field.
Icmpv6SixLowPanExtendedDuplicateAddressReqOrConf()
Constructor.
uint8_t m_status
The status value.
void SetRegAddress(Ipv6Address registered)
Set the registered address field.
std::vector< uint8_t > m_rovr
The ROVR value.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
Ipv6Address GetRegAddress() const
Get the registered address field.
uint16_t m_tid
The Transaction ID value.
~Icmpv6SixLowPanExtendedDuplicateAddressReqOrConf() override
Destructor.
void SetStatus(uint8_t status)
Set the status field.
uint16_t m_regTime
The registration lifetime value (units of 60 seconds).
uint8_t GetStatus() const
Get the status field.
uint32_t GetSerializedSize() const override
Get the serialized size.
static TypeId GetTypeId()
Get the UID of this class.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
void SetRovr(const std::vector< uint8_t > &rovr)
Set the ROVR field.
void SetRegTime(uint16_t time)
Set the registration lifetime field.
std::vector< uint8_t > GetRovr() const
Get the ROVR field.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
void Print(std::ostream &os) const override
Print information.
Describes an IPv6 address.
static Ipv6Address Deserialize(const uint8_t buf[16])
Deserialize this address.
Describes an IPv6 prefix.
uint8_t GetPrefixLength() const
Get prefix length.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.