13#include "ns3/address-utils.h" 
   14#include "ns3/assert.h" 
   29                            .SetGroupName(
"Internet")
 
 
   42    : m_calcChecksum(true),
 
 
  196                            .SetGroupName(
"Internet")
 
 
  275    uint8_t buff_target[16];
 
  276    uint16_t checksum = 0;
 
  284    i.
Write(buff_target, 16);
 
 
  320                            .SetGroupName(
"Internet")
 
 
  438    uint8_t buff_target[16];
 
  439    uint16_t checksum = 0;
 
  464    i.
Write(buff_target, 16);
 
 
  520                            .SetGroupName(
"Internet")
 
 
  668    uint16_t checksum = 0;
 
  679        flags |= (uint8_t)(1 << 7);
 
  684        flags |= (uint8_t)(1 << 6);
 
  689        flags |= (uint8_t)(1 << 5);
 
 
  714    uint8_t flags = i.
ReadU8();
 
  719    if (flags & (1 << 7))
 
  724    if (flags & (1 << 6))
 
  729    if (flags & (1 << 5))
 
 
  747                            .SetGroupName(
"Internet")
 
 
  806    uint16_t checksum = 0;
 
 
  846                            .SetGroupName(
"Internet")
 
 
  937    uint16_t checksum = 0;
 
 
  990                            .SetGroupName(
"Internet")
 
 
 1059    os << 
"( type = " << (
GetType() == 128 ? 
"128 (Request)" : 
"129 (Reply)")
 
 
 1075    uint16_t checksum = 0;
 
 
 1115    static TypeId tid = 
TypeId(
"ns3::Icmpv6DestinationUnreachable")
 
 1117                            .SetGroupName(
"Internet")
 
 
 1171    uint16_t checksum = 0;
 
 1184    auto buf = 
new uint8_t[size];
 
 1186    iter.
Write(buf, size);
 
 1189    iter = secondaryBuffer.
Begin();
 
 
 1219                            .SetGroupName(
"Internet")
 
 
 1232    : m_packet(nullptr),
 
 
 1287    uint16_t checksum = 0;
 
 1300    auto buf = 
new uint8_t[size];
 
 1302    iter.
Write(buf, size);
 
 1305    iter = secondaryBuffer.
Begin();
 
 
 1335                            .SetGroupName(
"Internet")
 
 
 1389    uint16_t checksum = 0;
 
 1402    auto buf = 
new uint8_t[size];
 
 1404    iter.
Write(buf, size);
 
 1407    iter = secondaryBuffer.
Begin();
 
 
 1435    static TypeId tid = 
TypeId(
"ns3::Icmpv6ParameterError")
 
 1437                            .SetGroupName(
"Internet")
 
 
 1450    : m_packet(nullptr),
 
 
 1506    uint16_t checksum = 0;
 
 1519    auto buf = 
new uint8_t[size];
 
 1521    iter.
Write(buf, size);
 
 1524    iter = secondaryBuffer.
Begin();
 
 
 1554                            .SetGroupName(
"Internet")
 
 
 1641                            .SetGroupName(
"Internet")
 
 
 1708       << 
" MTU = " << 
m_mtu << 
")";
 
 
 1746    static TypeId tid = 
TypeId(
"ns3::Icmpv6OptionPrefixInformation")
 
 1748                            .SetGroupName(
"Internet")
 
 
 1898    memset(buf, 0x00, 
sizeof(buf));
 
 
 1938    static TypeId tid = 
TypeId(
"ns3::Icmpv6OptionLinkLayerAddress")
 
 1940                            .SetGroupName(
"Internet")
 
 
 2004       << 
" L2 Address = " << 
m_addr << 
")";
 
 
 2028    for (uint8_t nb = 0; nb < len; nb++)
 
 
 2057    static TypeId tid = 
TypeId(
"ns3::Icmpv6OptionRedirected")
 
 2059                            .SetGroupName(
"Internet")
 
 
 2120    auto buf = 
new uint8_t[size];
 
 
 2133    uint8_t length = i.
ReadU8();
 
 2139    auto buff = 
new uint8_t[len2];
 
 
a polymophic address class
uint32_t CopyFrom(const uint8_t *buffer, uint8_t len)
uint8_t GetLength() const
Get the length of the underlying address.
uint32_t CopyTo(uint8_t buffer[MAX_SIZE]) const
Copy the address bytes into a buffer.
iterator in a Buffer instance
void WriteU32(uint32_t data)
uint16_t CalculateIpChecksum(uint16_t size)
Calculate the checksum.
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 WriteHtonU16(uint16_t data)
void WriteHtonU32(uint32_t data)
void Next()
go forward by one byte
automatically resized byte buffer
void AddAtStart(uint32_t start)
Buffer::Iterator Begin() const
ICMPv6 Error Destination Unreachable header.
uint32_t GetSerializedSize() const override
Get the serialized size.
void SetPacket(Ptr< Packet > p)
Set the incorrect packet.
~Icmpv6DestinationUnreachable() override
Destructor.
void Print(std::ostream &os) const override
Print information.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
Icmpv6DestinationUnreachable()
Constructor.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
Ptr< Packet > m_packet
The incorrect Packet.
static TypeId GetTypeId()
Get the UID of this class.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
static TypeId GetTypeId()
Get the UID of this class.
void SetId(uint16_t id)
Set the ID of the packet.
uint16_t m_seq
Sequence number (to distinguish response).
Icmpv6Echo()
Default constructor.
~Icmpv6Echo() override
Destructor.
uint16_t m_id
ID of the packet (to distinguish response between many ping program).
uint16_t GetId() const
Get the ID of the packet.
void Print(std::ostream &os) const override
Print information.
void SetSeq(uint16_t seq)
Set the sequence number.
uint32_t GetSerializedSize() const override
Get the serialized size.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
uint16_t GetSeq() const
Get the sequence number.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
ICMPv6 Neighbor Advertisement header.
bool GetFlagS() const
Get the S flag.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
uint32_t m_reserved
The reserved value.
~Icmpv6NA() override
Destructor.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
void SetFlagS(bool s)
Set the S flag.
void SetIpv6Target(Ipv6Address target)
Set the IPv6 target field.
void SetFlagR(bool r)
Set the R flag.
Ipv6Address GetIpv6Target() const
Get the IPv6 target field.
bool GetFlagR() const
Get the R flag.
uint32_t GetSerializedSize() const override
Get the serialized size.
bool GetFlagO() const
Get the O flag.
void SetFlagO(bool o)
Set the O flag.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
void SetReserved(uint32_t reserved)
Set the reserved field.
void Print(std::ostream &os) const override
Print information.
static TypeId GetTypeId()
Get the UID of this class.
Ipv6Address m_target
The IPv6 target address.
uint32_t GetReserved() const
Get the reserved field.
ICMPv6 Neighbor Solicitation header.
uint32_t m_reserved
The reserved value.
uint32_t GetSerializedSize() const override
Get the serialized size.
void SetIpv6Target(Ipv6Address target)
Set the IPv6 target field.
uint32_t GetReserved() const
Get the reserved field.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
static TypeId GetTypeId()
Get the UID of this class.
void Print(std::ostream &os) const override
Print information.
Ipv6Address m_target
The IPv6 target address.
void SetReserved(uint32_t reserved)
Set the reserved field.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
Ipv6Address GetIpv6Target() const
Get the IPv6 target field.
~Icmpv6NS() override
Destructor.
ICMPv6 link-layer address option.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
~Icmpv6OptionLinkLayerAddress() override
Destructor.
Icmpv6OptionLinkLayerAddress()
Constructor.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
void Print(std::ostream &os) const override
Print information.
static TypeId GetTypeId()
Get the UID of this class.
uint32_t GetSerializedSize() const override
Get the serialized size.
Address m_addr
The hardware address.
Address GetAddress() const
Get the hardware address.
void SetAddress(Address addr)
Set the hardware address.
~Icmpv6OptionMtu() override
Destructor.
uint32_t GetSerializedSize() const override
Get the serialized size.
uint16_t m_reserved
The reserved value.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
void SetReserved(uint16_t reserved)
Set the reserved field.
uint32_t GetMtu() const
Get the MTU.
static TypeId GetTypeId()
Get the UID of this class.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
void Print(std::ostream &os) const override
Print information.
void SetMtu(uint32_t mtu)
Set the MTU.
uint32_t m_mtu
The MTU value.
Icmpv6OptionMtu()
Constructor.
uint16_t GetReserved() const
Get the reserved field.
ICMPv6 redirected option.
Icmpv6OptionRedirected()
Constructor.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
~Icmpv6OptionRedirected() override
Destructor.
Ptr< Packet > m_packet
The redirected packet.
void Print(std::ostream &os) const override
Print information.
uint32_t GetSerializedSize() const override
Get the serialized size.
static TypeId GetTypeId()
Get the UID of this class.
void SetPacket(Ptr< Packet > packet)
Set the redirected packet.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
ICMPv6 Error Parameter Error header.
uint32_t GetSerializedSize() const override
Get the serialized size.
uint32_t m_ptr
The pointer field.
void SetPacket(Ptr< Packet > p)
Set the incorrect packet.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
static TypeId GetTypeId()
Get the UID of this class.
void SetPtr(uint32_t ptr)
Set the pointer field.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
~Icmpv6ParameterError() override
Destructor.
void Print(std::ostream &os) const override
Print information.
Ptr< Packet > m_packet
The incorrect packet.
uint32_t GetPtr() const
Get the pointer field.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
Icmpv6ParameterError()
Constructor.
ICMPv6 Router Advertisement header.
void Print(std::ostream &os) const override
Print information.
void SetLifeTime(uint16_t l)
Set the node Life time (Neighbor Discovery).
uint32_t GetRetransmissionTime() const
Get the node Retransmission time (Neighbor Discovery).
void SetFlagH(bool h)
Set the H flag.
void SetRetransmissionTime(uint32_t r)
Set the node Retransmission time (Neighbor Discovery).
void SetCurHopLimit(uint8_t m)
Set the IPv6 maximum number of jumps.
void SetFlagO(bool o)
Set the O flag.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
void SetFlagM(bool m)
Set the M flag.
void SetReachableTime(uint32_t r)
Set the node Reachable time (Neighbor Discovery).
static TypeId GetTypeId()
Get the UID of this class.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
uint32_t m_RetransmissionTimer
The retransmission timer.
uint32_t GetSerializedSize() const override
Get the serialized size.
uint16_t GetLifeTime() const
Get the node Life time (Neighbor Discovery).
uint32_t GetReachableTime() const
Get the node Reachable time (Neighbor Discovery).
uint8_t GetCurHopLimit() const
Get the IPv6 maximum number of jumps.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
bool GetFlagO() const
Get the O flag.
uint16_t m_LifeTime
The lifetime value.
bool GetFlagM() const
Get the M flag.
uint8_t m_curHopLimit
The max jumps.
uint32_t m_ReachableTime
The reachable time value.
~Icmpv6RA() override
Destructor.
bool GetFlagH() const
Get the H flag.
ICMPv6 Router Solicitation header.
void SetReserved(uint32_t reserved)
Set the reserved field.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
~Icmpv6RS() override
Destructor.
uint32_t GetReserved() const
Get the reserved field.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
uint32_t GetSerializedSize() const override
Get the serialized size.
uint32_t m_reserved
The reserved value.
static TypeId GetTypeId()
Get the UID of this class.
void Print(std::ostream &os) const override
Print information.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
ICMPv6 Redirection header.
Ipv6Address m_target
IPv6 target address.
Ipv6Address GetTarget() const
Get the IPv6 target address.
Ipv6Address m_destination
IPv6 destination address.
uint32_t GetReserved() const
Get the reserved field.
uint32_t GetSerializedSize() const override
Get the serialized size.
~Icmpv6Redirection() override
Destructor.
void Print(std::ostream &os) const override
Print information.
Icmpv6Redirection()
Constructor.
void SetDestination(Ipv6Address destination)
Set the IPv6 destination address.
void SetReserved(uint32_t reserved)
Set the reserved field.
Ipv6Address GetDestination() const
Get the IPv6 destination address.
void SetTarget(Ipv6Address target)
Set the IPv6 target address.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
static TypeId GetTypeId()
Get the UID of this class.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
uint32_t m_reserved
Reserved value.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
ICMPv6 Error Time Exceeded header.
uint32_t GetSerializedSize() const override
Get the serialized size.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
void SetPacket(Ptr< Packet > p)
Set the incorrect packet.
~Icmpv6TimeExceeded() override
Destructor.
Icmpv6TimeExceeded()
Constructor.
static TypeId GetTypeId()
Get the UID of this class.
void Print(std::ostream &os) const override
Print information.
Ptr< Packet > m_packet
The incorrect packet.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
ICMPv6 Error Too Big header.
static TypeId GetTypeId()
Get the UID of this class.
void SetMtu(uint32_t mtu)
Set the MTU.
void Print(std::ostream &os) const override
Print information.
Ptr< Packet > m_packet
the incorrect packet.
Icmpv6TooBig()
Constructor.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
uint32_t GetSerializedSize() const override
Get the serialized size.
~Icmpv6TooBig() override
Destructor.
void SetPacket(Ptr< Packet > p)
Set the incorrect packet.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
uint32_t m_mtu
The MTU value.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
uint32_t GetMtu() const
Get the MTU field.
Describes an IPv6 address.
void GetBytes(uint8_t buf[16]) const
Get the bytes corresponding to the address.
void Set(const char *address)
Sets an Ipv6Address by parsing the input C-string.
void Serialize(uint8_t buf[16]) const
Serialize this address to a 16-byte buffer.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
Smart pointer class similar to boost::intrusive_ptr.
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_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#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.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.