25 #include "ns3/buffer.h"
26 #include "ns3/address-utils.h"
37 m_destinationPort (0),
42 m_windowSize (0xffff),
44 m_calcChecksum (false),
45 m_goodChecksum (true),
57 static const char* flagNames[8] = {
67 std::string flagsDescription =
"";
68 for (uint8_t i = 0; i < 8; ++i)
72 if (flagsDescription.length () > 0)
74 flagsDescription += delimiter;
76 flagsDescription.append (flagNames[i]);
79 return flagsDescription;
235 uint32_t hdrSize = 0;
274 .SetGroupName (
"Internet")
298 TcpOptionList::const_iterator op;
302 os <<
" " << (*op)->GetInstanceTypeId ().GetName () <<
"(";
330 uint32_t optionLen = 0;
331 TcpOptionList::const_iterator op;
334 optionLen += (*op)->GetSerializedSize ();
335 (*op)->Serialize (i);
336 i.
Next ((*op)->GetSerializedSize ());
340 while (optionLen % 4)
377 uint32_t optionLen = (
m_length - 5) * 4;
380 NS_LOG_ERROR (
"Illegal TCP option length " << optionLen <<
"; options discarded");
385 uint8_t kind = i.
PeekU8 ();
395 NS_LOG_WARN (
"Option kind " <<
static_cast<int> (kind) <<
" unknown, skipping.");
397 optionSize = op->Deserialize (i);
398 if (optionSize != op->GetSerializedSize ())
403 if (optionLen >= optionSize)
405 optionLen -= optionSize;
412 NS_LOG_ERROR (
"Option exceeds TCP option space; option discarded");
429 NS_LOG_ERROR (
"Mismatch between calculated length and in-header value");
448 TcpOptionList::const_iterator i;
452 len += (*i)->GetSerializedSize ();
457 len += 4 - (len % 4);
469 NS_LOG_WARN (
"The option kind " <<
static_cast<int> (option->
GetKind ()) <<
" is unknown");
497 TcpOptionList::const_iterator i;
501 if ((*i)->GetKind () == kind)
513 TcpOptionList::const_iterator i;
517 if ((*i)->GetKind () == kind)
a polymophic address class
iterator in a Buffer instance
uint16_t ReadNtohU16(void)
uint16_t CalculateIpChecksum(uint16_t size)
Calculate the checksum.
void WriteU8(uint8_t data)
void Next(void)
go forward by one byte
void WriteU16(uint16_t data)
void WriteHtonU16(uint16_t data)
void WriteHtonU32(uint32_t data)
uint32_t ReadNtohU32(void)
automatically resized byte buffer
void AddAtStart(uint32_t start)
Buffer::Iterator Begin(void) 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.
virtual uint8_t GetKind(void) const =0
Get the ‘kind’ (as in RFC 793) of this option.
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
virtual uint32_t GetSerializedSize(void) const =0
Returns number of bytes required for Option serialization.
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)
void WriteTo(Buffer::Iterator &i, Ipv4Address ad)
Write an Ipv4Address to a Buffer.
std::ostream & operator<<(std::ostream &os, const Angles &a)