20 #define __STDC_LIMIT_MACROS
23 #include "ns3/core-module.h"
24 #include "ns3/tcp-header.h"
25 #include "ns3/buffer.h"
26 #include "ns3/private/tcp-option-rfc793.h"
47 virtual void DoRun (
void);
55 uint16_t sourcePort, uint16_t destinationPort,
57 uint8_t flags, uint16_t windowSize, uint16_t urgentPointer,
86 "Different source port found");
88 "Different destination port found");
90 "Different sequence number found");
92 "Different ack number found");
94 "Different flags found");
96 "Different window size found");
98 "Different urgent pointer found");
108 "Different source port found in deserialized header");
110 "Different destination port found in deserialized header");
112 "Different sequence number found in deserialized header");
114 "Different ack number found in deserialized header");
116 "Different flags found in deserialized header");
118 "Different window size found in deserialized header");
120 "Different urgent pointer found in deserialized header");
134 virtual void DoRun (
void);
207 buffer.
GetSize (),
"Header not correctly serialized");
213 for (uint32_t j = 0; j < 4; ++j)
215 std::stringstream ss;
217 uint8_t value = i.ReadU8 ();
219 "NOP not present at position " + ss.str ());
245 buffer.
GetSize (),
"Header not correctly serialized");
264 buffer.
GetSize (),
"Header not correctly serialized");
271 uint8_t value = i.ReadU8 ();
298 buffer.
GetSize (),
"Header not correctly serialized");
302 true,
"MSS option not correctly serialized");
316 #define GET_RANDOM_UINT32(RandomVariable) \
317 static_cast<uint32_t> (RandomVariable->GetInteger (0, UINT32_MAX))
319 #define GET_RANDOM_UINT16(RandomVariable) \
320 static_cast<uint16_t> (RandomVariable->GetInteger (0, UINT16_MAX))
322 #define GET_RANDOM_UINT8(RandomVariable) \
323 static_cast<uint8_t> (RandomVariable->GetInteger (0, UINT8_MAX))
325 #define GET_RANDOM_UINT6(RandomVariable) \
326 static_cast<uint8_t> (RandomVariable->GetInteger (0, UINT8_MAX >> 2))
336 for (uint32_t i = 0; i < 1000; ++i)
338 std::stringstream ss;
348 "Case number " + ss.str ()),
void SetMSS(uint16_t mss)
Set the Maximum Segment Size stored in the Option.
Defines the TCP option of kind 1 (no operation) as in RFC 793
automatically resized byte buffer
This test suite implements a Unit Test.
iterator in a Buffer instance
ns3::TcpHeaderTestSuite g_TcpHeaderTestSuite
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
#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.
Defines the TCP option of kind 0 (end of option list) as in RFC 793
void Next(void)
go forward by one byte
Buffer::Iterator Begin(void) const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t GetSize(void) const
void WriteU8(uint8_t data)
Defines the TCP option of kind 2 (maximum segment size) as in RFC 793
bool AddAtStart(uint32_t start)