20 #define __STDC_LIMIT_MACROS 
   23 #include "ns3/core-module.h" 
   24 #include "ns3/tcp-header.h" 
   25 #include "ns3/buffer.h" 
   26 #include "../model/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)) 
   48   virtual void DoRun (
void);
 
   59   uint16_t destinationPort;   
 
   64   uint16_t urgentPointer;     
 
   69   for (uint32_t i = 0; i < 1000; ++i)
 
   94                          "Different source port found");
 
   96                          "Different destination port found");
 
   98                          "Different sequence number found");
 
  100                          "Different ack number found");
 
  102                          "Different flags found");
 
  104                          "Different window size found");
 
  106                          "Different urgent pointer found");
 
  116                          "Different source port found in deserialized header");
 
  118                          "Different destination port found in deserialized header");
 
  120                          "Different sequence number found in deserialized header");
 
  122                          "Different ack number found in deserialized header");
 
  124                          "Different flags found in deserialized header");
 
  126                          "Different window size found in deserialized header");
 
  128                          "Different urgent pointer found in deserialized header");
 
  143   virtual void DoRun (
void);
 
  216                            buffer.
GetSize (), 
"Header not correctly serialized");
 
  222     for (uint32_t j = 0; j < 4; ++j)
 
  224         std::stringstream ss;
 
  226         uint8_t value = i.ReadU8 ();
 
  228                                "NOP not present at position " + ss.str ());
 
  254                            buffer.
GetSize (), 
"Header not correctly serialized");
 
  273                            buffer.
GetSize (), 
"Header not correctly serialized");
 
  280     uint8_t value = i.ReadU8 ();
 
  307                            buffer.
GetSize (), 
"Header not correctly serialized");
 
  311                            true, 
"MSS option not correctly serialized");
 
  331   virtual void DoRun (
void);
 
  342   std::string str, target;
 
  377   target = 
"FIN|SYN|RST|PSH|ACK|URG|ECE|CWR";
 
  380   target = 
"FIN:SYN:RST:PSH:ACK:URG:ECE:CWR";
 
void AddAtStart(uint32_t start)
 
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 
 
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number.