24#include "ns3/address-utils.h"
25#include "ns3/buffer.h"
47 m_calcChecksum(false),
60 static const char* flagNames[8] = {
"FIN",
"SYN",
"RST",
"PSH",
"ACK",
"URG",
"ECE",
"CWR"};
61 std::string flagsDescription =
"";
62 for (uint8_t i = 0; i < 8; ++i)
66 if (flagsDescription.length() > 0)
68 flagsDescription += delimiter;
70 flagsDescription.append(flagNames[i]);
73 return flagsDescription;
266 .SetGroupName(
"Internet")
289 TcpOptionList::const_iterator op;
293 os <<
" " << (*op)->GetInstanceTypeId().GetName() <<
"(";
322 TcpOptionList::const_iterator op;
325 optionLen += (*op)->GetSerializedSize();
327 i.
Next((*op)->GetSerializedSize());
331 while (optionLen % 4)
371 NS_LOG_ERROR(
"Illegal TCP option length " << optionLen <<
"; options discarded");
376 uint8_t kind = i.
PeekU8();
386 NS_LOG_WARN(
"Option kind " <<
static_cast<int>(kind) <<
" unknown, skipping.");
388 optionSize = op->Deserialize(i);
389 if (optionSize != op->GetSerializedSize())
394 if (optionLen >= optionSize)
396 optionLen -= optionSize;
403 NS_LOG_ERROR(
"Option exceeds TCP option space; option discarded");
420 NS_LOG_ERROR(
"Mismatch between calculated length and in-header value");
439 TcpOptionList::const_iterator i;
443 len += (*i)->GetSerializedSize();
448 len += 4 - (len % 4);
460 NS_LOG_WARN(
"The option kind " <<
static_cast<int>(option->GetKind()) <<
" is unknown");
488 TcpOptionList::const_iterator i;
492 if ((*i)->GetKind() == kind)
504 TcpOptionList::const_iterator i;
508 if ((*i)->GetKind() == kind)
a polymophic address class
static constexpr uint32_t MAX_SIZE
The maximum size of a byte buffer which can be stored in an Address instance.
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)
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
Ipv4 addresses are stored in host order in this class.
static bool IsMatchingType(const Address &address)
Describes an IPv6 address.
Smart pointer class similar to boost::intrusive_ptr.
NUMERIC_TYPE GetValue() const
Extracts the numeric value of the sequence number.
static Ptr< TcpOption > CreateOption(uint8_t kind)
Creates an option.
static bool IsKindKnown(uint8_t kind)
Check if the option is implemented.
@ UNKNOWN
not a standardized value; for unknown recv'd options
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
#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.
bool operator==(const EventId &a, const EventId &b)
std::ostream & operator<<(std::ostream &os, const Angles &a)
void WriteTo(Buffer::Iterator &i, Ipv4Address ad)
Write an Ipv4Address to a Buffer.