23 #include "ns3/packet.h"
41 .SetGroupName(
"Internet")
112 os <<
"type=" << (uint32_t)
m_type <<
", code=" << (uint32_t)
m_code;
168 uint32_t size =
data->GetSize();
179 m_data =
new uint8_t[size];
219 .SetGroupName(
"Internet")
273 uint32_t optionalPayloadSize =
start.GetRemainingSize() - 4;
305 static TypeId tid =
TypeId(
"ns3::Icmpv4DestinationUnreachable")
307 .SetGroupName(
"Internet")
317 for (uint8_t j = 0; j < 8; j++)
355 memcpy(payload,
m_data, 8);
404 for (uint8_t j = 0; j < 8; j++)
417 for (uint8_t i = 0; i < 8; i++)
419 os << (uint32_t)
m_data[i];
438 .SetGroupName(
"Internet")
448 for (uint8_t j = 0; j < 8; j++)
472 memcpy(payload,
m_data, 8);
520 for (uint8_t j = 0; j < 8; j++)
533 for (uint8_t i = 0; i < 8; i++)
535 os << (uint32_t)
m_data[i];
iterator in a Buffer instance
uint16_t CalculateIpChecksum(uint16_t size)
Calculate the checksum.
void WriteU8(uint8_t data)
void WriteU16(uint16_t data)
void WriteHtonU16(uint16_t data)
uint32_t GetDistanceFrom(const Iterator &o) const
void Next()
go forward by one byte
ICMP Destination Unreachable header.
Ipv4Header m_header
carried IPv4 header
uint16_t GetNextHopMtu() const
Get the next hop MTU.
uint16_t m_nextHopMtu
next hop MTU
Ipv4Header GetHeader() const
Get the ICMP carried IPv4 header.
void GetData(uint8_t payload[8]) const
Get the ICMP carried data.
void SetNextHopMtu(uint16_t mtu)
Set the next hop MTU.
void Serialize(Buffer::Iterator start) const override
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint32_t GetSerializedSize() const override
void SetHeader(Ipv4Header header)
Set the ICMP carried IPv4 header.
void SetData(Ptr< const Packet > data)
Set the ICMP carried data.
~Icmpv4DestinationUnreachable() override
static TypeId GetTypeId()
Get ICMP type.
uint8_t m_data[8]
carried data
Icmpv4DestinationUnreachable()
void Print(std::ostream &os) const override
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void Print(std::ostream &os) const override
uint16_t m_identifier
identifier
uint16_t m_sequence
sequence number
uint32_t GetData(uint8_t payload[]) const
Get the Echo data.
void SetIdentifier(uint16_t id)
Set the Echo identifier.
void SetData(Ptr< const Packet > data)
Set the Echo data.
uint32_t GetSerializedSize() const override
uint16_t GetIdentifier() const
Get the Echo identifier.
void Serialize(Buffer::Iterator start) const override
static TypeId GetTypeId()
Get ICMP type.
void SetSequenceNumber(uint16_t seq)
Set the Echo sequence number.
uint32_t GetDataSize() const
Get the Echo data size.
uint32_t m_dataSize
data size
uint16_t GetSequenceNumber() const
Get the Echo sequence number.
ICMP Time Exceeded header.
Ipv4Header m_header
carried IPv4 header
Ipv4Header GetHeader() const
Get the ICMP carried IPv4 header.
void SetHeader(Ipv4Header header)
Set the ICMP carried IPv4 header.
uint32_t GetSerializedSize() const override
void GetData(uint8_t payload[8]) const
Get the ICMP carried data.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void Serialize(Buffer::Iterator start) const override
uint8_t m_data[8]
carried data
static TypeId GetTypeId()
Get ICMP type.
void SetData(Ptr< const Packet > data)
Get the ICMP carried data.
~Icmpv4TimeExceeded() override
void Print(std::ostream &os) const override
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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.