22 #include "ns3/packet.h"
41 .AddConstructor<Icmpv4Header> ()
48 m_calcChecksum (false)
105 os <<
"type=" << (uint32_t)
m_type <<
", code=" << (uint32_t)
m_code;
157 uint32_t size = data->
GetSize ();
168 m_data =
new uint8_t[size];
203 .AddConstructor<Icmpv4Echo> ()
253 uint32_t size = start.
GetSize () - 4;
257 m_data =
new uint8_t[size];
281 static TypeId tid =
TypeId (
"ns3::Icmpv4DestinationUnreachable")
283 .AddConstructor<Icmpv4DestinationUnreachable> ()
292 for (uint8_t j = 0; j < 8; j++)
327 memcpy (payload,
m_data, 8);
373 for (uint8_t j = 0; j < 8; j++)
385 for (uint8_t i = 0; i < 8; i++)
387 os << (uint32_t)
m_data[i];
407 .AddConstructor<Icmpv4TimeExceeded> ()
416 for (uint8_t j = 0; j < 8; j++)
439 memcpy (payload,
m_data, 8);
484 for (uint8_t j = 0; j < 8; j++)
496 for (uint8_t i = 0; i < 8; i++)
498 os << (uint32_t)
m_data[i];
uint16_t CalculateIpChecksum(uint16_t size)
Calculate the checksum.
virtual void Print(std::ostream &os) const
virtual TypeId GetInstanceTypeId(void) const
void GetData(uint8_t payload[8]) const
Get the ICMP carried data.
#define NS_LOG_FUNCTION(parameters)
virtual TypeId GetInstanceTypeId(void) const
void SetHeader(Ipv4Header header)
Set the ICMP carried IPv4 header.
uint16_t m_sequence
sequence number
Doxygen introspection did not find any typical Config paths.
void SetData(Ptr< const Packet > data)
Set the ICMP carried data.
virtual uint32_t GetSerializedSize(void) const
uint32_t GetDataSize(void) const
Get the Echo data size.
static TypeId GetTypeId(void)
Get ICMP type.
#define NS_ASSERT(condition)
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
virtual uint32_t Deserialize(Buffer::Iterator start)
virtual ~Icmpv4DestinationUnreachable()
uint32_t GetSize(void) const
virtual void Print(std::ostream &os) const
virtual void Serialize(Buffer::Iterator start) const
uint16_t GetIdentifier(void) const
Get the Echo identifier.
uint32_t GetDistanceFrom(Iterator const &o) const
iterator in a Buffer instance
uint16_t GetNextHopMtu(void) const
Get the next hop MTU.
virtual void Serialize(Buffer::Iterator start) const
uint16_t m_nextHopMtu
next hop MTU
uint32_t m_dataSize
data size
NS_LOG_COMPONENT_DEFINE("Icmpv4Header")
static TypeId GetTypeId(void)
Get ICMP type.
void WriteU16(uint16_t data)
Ipv4Header m_header
carried IPv4 header
void WriteHtonU16(uint16_t data)
virtual uint32_t GetSerializedSize(void) const
void Next(void)
go forward by one byte
uint8_t m_data[8]
carried data
void SetHeader(Ipv4Header header)
Set the ICMP carried IPv4 header.
void SetData(Ptr< const Packet > data)
Get the ICMP carried data.
void SetNextHopMtu(uint16_t mtu)
Set the next hop MTU.
Ipv4Header m_header
carried IPv4 header
Doxygen introspection did not find any typical Config paths.
void Read(uint8_t *buffer, uint32_t size)
uint32_t GetData(uint8_t payload[]) const
Get the Echo data.
virtual uint32_t Deserialize(Buffer::Iterator start)
Icmpv4DestinationUnreachable()
void SetData(Ptr< const Packet > data)
Set the Echo data.
virtual ~Icmpv4TimeExceeded()
virtual uint32_t GetSerializedSize(void) const
void WriteU8(uint8_t data)
uint16_t m_identifier
identifier
void GetData(uint8_t payload[8]) const
Get the ICMP carried data.
Doxygen introspection did not find any typical Config paths.
void SetSequenceNumber(uint16_t seq)
Set the Echo sequence number.
virtual TypeId GetInstanceTypeId(void) const
void Write(uint8_t const *buffer, uint32_t size)
virtual uint32_t Deserialize(Buffer::Iterator start)
uint16_t GetSequenceNumber(void) const
Get the Echo sequence number.
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
Ipv4Header GetHeader(void) const
Get the ICMP carried IPv4 header.
static TypeId GetTypeId(void)
Get ICMP type.
uint16_t ReadNtohU16(void)
uint8_t m_data[8]
carried data
void WriteU32(uint32_t data)
virtual void Print(std::ostream &os) const
uint32_t GetSize(void) const
a unique identifier for an interface.
Ipv4Header GetHeader(void) const
Get the ICMP carried IPv4 header.
TypeId SetParent(TypeId tid)
void SetIdentifier(uint16_t id)
Set the Echo identifier.
virtual void Serialize(Buffer::Iterator start) const