20 #define __STDC_LIMIT_MACROS
23 #include "ns3/core-module.h"
24 #include "ns3/tcp-header.h"
25 #include "ns3/buffer.h"
27 #include "../src/internet/model/tcp-option-rfc793.h"
48 virtual void DoRun (
void);
56 uint16_t sourcePort, uint16_t destinationPort,
58 uint8_t flags, uint16_t windowSize, uint16_t urgentPointer,
87 "Different source port found");
89 "Different destination port found");
91 "Different sequence number found");
93 "Different ack number found");
95 "Different flags found");
97 "Different window size found");
99 "Different urgent pointer found");
109 "Different source port found in deserialized header");
111 "Different destination port found in deserialized header");
113 "Different sequence number found in deserialized header");
115 "Different ack number found in deserialized header");
117 "Different flags found in deserialized header");
119 "Different window size found in deserialized header");
121 "Different urgent pointer found in deserialized header");
135 virtual void DoRun (
void);
208 buffer.
GetSize (),
"Header not correctly serialized");
214 for (uint32_t j = 0; j < 4; ++j)
216 std::stringstream ss;
218 uint8_t value = i.ReadU8 ();
220 "NOP not present at position " + ss.str ());
246 buffer.
GetSize (),
"Header not correctly serialized");
265 buffer.
GetSize (),
"Header not correctly serialized");
272 uint8_t value = i.ReadU8 ();
299 buffer.
GetSize (),
"Header not correctly serialized");
303 true,
"MSS option not correctly serialized");
317 #define GET_RANDOM_UINT32(RandomVariable) \
318 static_cast<uint32_t> (RandomVariable->GetInteger (0, UINT32_MAX))
320 #define GET_RANDOM_UINT16(RandomVariable) \
321 static_cast<uint16_t> (RandomVariable->GetInteger (0, UINT16_MAX))
323 #define GET_RANDOM_UINT8(RandomVariable) \
324 static_cast<uint8_t> (RandomVariable->GetInteger (0, UINT8_MAX))
326 #define GET_RANDOM_UINT6(RandomVariable) \
327 static_cast<uint8_t> (RandomVariable->GetInteger (0, UINT8_MAX >> 2))
337 for (uint32_t i = 0; i < 1000; ++i)
339 std::stringstream ss;
349 "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
iterator in a Buffer instance
ns3::TcpHeaderTestSuite g_TcpHeaderTestSuite
#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
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
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)
This test suite implements a Unit Test.