21 #include "ns3/assert.h"
22 #include "ns3/abort.h"
24 #include "ns3/header.h"
34 : m_calcChecksum (false),
43 m_goodChecksum (true),
161 return "Unrecognized DSCP";
189 return "Unknown ECN";
242 NS_ABORT_MSG_IF ((offsetBytes & 0x7),
"offsetBytes must be multiple of 8 bytes");
252 NS_LOG_WARN(
"Fragment will exceed the maximum packet size once reassembled");
323 .SetGroupName (
"Internet")
349 else if (
m_flags & DONT_FRAGMENT)
353 else if (
m_flags & MORE_FRAGMENTS)
361 os <<
"tos 0x" << std::hex <<
m_tos << std::dec <<
" "
364 <<
"ttl " <<
m_ttl <<
" "
368 <<
"flags [" << flags <<
"] "
388 uint8_t verIhl = (4 << 4) | (5);
394 uint8_t flagsFrag = (fragmentOffset >> 8) & 0x1f;
404 uint8_t frag = fragmentOffset & 0xff;
428 uint8_t verIhl = i.
ReadU8 ();
429 uint8_t ihl = verIhl & 0x0f;
430 uint16_t headerSize = ihl * 4;
432 if ((verIhl >> 4) != 4)
434 NS_LOG_WARN (
"Trying to decode a non-IPv4 header, refusing to do it.");
442 uint8_t flags = i.
ReadU8 ();
uint16_t CalculateIpChecksum(uint16_t size)
Calculate the checksum.
#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.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint32_t ReadNtohU32(void)
iterator in a Buffer instance
void Prev(void)
go backward by one byte
uint32_t Get(void) const
Get the host-order 32-bit IP address.
void WriteU16(uint16_t data)
void WriteHtonU16(uint16_t data)
void Next(void)
go forward by one byte
Every class exported by the ns3 library is enclosed in the ns3 namespace.
EcnType
ECN Type defined in RFC 3168
DscpType
DiffServ Code Points Code Points defined in Assured Forwarding (AF) RFC 2597 Expedited Forwarding (EF...
void WriteHtonU32(uint32_t data)
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
void Set(uint32_t address)
input address is in host order.
Ipv4 addresses are stored in host order in this class.
void WriteU8(uint8_t data)
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
uint16_t ReadNtohU16(void)
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.