19#define __STDC_LIMIT_MACROS
20#include "ns3/buffer.h"
21#include "ns3/core-module.h"
22#include "ns3/tcp-header.h"
23#include "ns3/tcp-option-rfc793.h"
30#define GET_RANDOM_UINT32(RandomVariable) \
31 static_cast<uint32_t>(RandomVariable->GetInteger(0, UINT32_MAX))
33#define GET_RANDOM_UINT16(RandomVariable) \
34 static_cast<uint16_t>(RandomVariable->GetInteger(0, UINT16_MAX))
36#define GET_RANDOM_UINT8(RandomVariable) \
37 static_cast<uint8_t>(RandomVariable->GetInteger(0, UINT8_MAX))
39#define GET_RANDOM_UINT6(RandomVariable) \
40 static_cast<uint8_t>(RandomVariable->GetInteger(0, UINT8_MAX >> 2))
59 void DoRun()
override;
72 uint16_t destinationPort;
77 uint16_t urgentPointer;
102 "TcpHeader without option is"
111 "Different destination port found");
114 "Different sequence number found");
120 "Different urgent pointer found");
124 "TcpHeader without option is"
133 "Different source port found in deserialized header");
136 "Different destination port found in deserialized header");
139 "Different sequence number found in deserialized header");
142 "Different ack number found in deserialized header");
145 "Different flags found in deserialized header");
148 "Different window size found in deserialized header");
151 "Different urgent pointer found in deserialized header");
176 void DoRun()
override;
242 "TcpHeader without option is"
251 "Four byte added as option "
255 "Four byte added as option "
263 "Header not correctly serialized");
271 std::stringstream ss;
289 "TcpHeader without option is"
294 "Length has changed also for"
298 "Length has changed also for"
306 "Header not correctly serialized");
316 "TcpHeader without option is"
322 "Different length found for"
330 "Header not correctly serialized");
356 "TcpHeader without option is"
362 "Different length found for"
370 "Header not correctly serialized");
375 "MSS option not correctly serialized");
378 "MSS Option not counted in the total");
403 void DoRun()
override;
416 str = TcpHeader::FlagsToString(0x0);
419 str = TcpHeader::FlagsToString(0x1);
422 str = TcpHeader::FlagsToString(0x2);
425 str = TcpHeader::FlagsToString(0x4);
428 str = TcpHeader::FlagsToString(0x8);
431 str = TcpHeader::FlagsToString(0x10);
434 str = TcpHeader::FlagsToString(0x20);
437 str = TcpHeader::FlagsToString(0x40);
440 str = TcpHeader::FlagsToString(0x80);
443 str = TcpHeader::FlagsToString(0x3);
446 str = TcpHeader::FlagsToString(0x5);
449 str = TcpHeader::FlagsToString(0xff);
450 target =
"FIN|SYN|RST|PSH|ACK|URG|ECE|CWR";
452 str = TcpHeader::FlagsToString(0xff,
":");
453 target =
"FIN:SYN:RST:PSH:ACK:URG:ECE:CWR";
iterator in a Buffer instance
void WriteU8(uint8_t data)
void Next()
go forward by one byte
automatically resized byte buffer
void AddAtStart(uint32_t start)
Buffer::Iterator Begin() const
Defines the TCP option of kind 0 (end of option list) as in RFC 793
Defines the TCP option of kind 2 (maximum segment size) as in RFC 793
void SetMSS(uint16_t mss)
Set the Maximum Segment Size stored in the Option.
uint32_t GetSerializedSize() const override
Returns number of bytes required for Option serialization.
Defines the TCP option of kind 1 (no operation) as in RFC 793
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
@ UNIT
This test suite implements a Unit Test.
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
#define END
End of a line.