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/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))    60   virtual void DoRun (
void);
    61   virtual void DoTeardown (
void);
    72   uint16_t destinationPort;   
    77   uint16_t urgentPointer;     
    82   for (uint32_t i = 0; i < 1000; ++i)
   107                              "Different source port found");
   109                              "Different destination port found");
   111                              "Different sequence number found");
   113                              "Different ack number found");
   115                              "Different flags found");
   117                              "Different window size found");
   119                              "Different urgent pointer found");
   129                              "Different source port found in deserialized header");
   131                              "Different destination port found in deserialized header");
   133                              "Different sequence number found in deserialized header");
   135                              "Different ack number found in deserialized header");
   137                              "Different flags found in deserialized header");
   139                              "Different window size found in deserialized header");
   141                              "Different urgent pointer found in deserialized header");
   165   virtual void DoRun (
void);
   243                            buffer.
GetSize (), 
"Header not correctly serialized");
   249     for (uint32_t j = 0; j < 4; ++j)
   251         std::stringstream ss;
   253         uint8_t value = i.ReadU8 ();
   255                                "NOP not present at position " + ss.str ());
   281                            buffer.
GetSize (), 
"Header not correctly serialized");
   300                            buffer.
GetSize (), 
"Header not correctly serialized");
   307     uint8_t value = i.ReadU8 ();
   334                            buffer.
GetSize (), 
"Header not correctly serialized");
   338                            true, 
"MSS option not correctly serialized");
   340                            "MSS Option not counted in the total");
   370   virtual void DoRun (
void);
   381   std::string str, target;
   382   str = TcpHeader::FlagsToString (0x0);
   385   str = TcpHeader::FlagsToString (0x1);
   388   str = TcpHeader::FlagsToString (0x2);
   391   str = TcpHeader::FlagsToString (0x4);
   394   str = TcpHeader::FlagsToString (0x8);
   397   str = TcpHeader::FlagsToString (0x10);
   400   str = TcpHeader::FlagsToString (0x20);
   403   str = TcpHeader::FlagsToString (0x40);
   406   str = TcpHeader::FlagsToString (0x80);
   409   str = TcpHeader::FlagsToString (0x3);
   412   str = TcpHeader::FlagsToString (0x5);
   415   str = TcpHeader::FlagsToString (0xff);
   416   target = 
"FIN|SYN|RST|PSH|ACK|URG|ECE|CWR";
   418   str = TcpHeader::FlagsToString (0xff, 
":");
   419   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 
iterator in a Buffer instance 
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
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 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
void WriteU8(uint8_t data)
Defines the TCP option of kind 2 (maximum segment size) as in RFC 793 
virtual uint32_t GetSerializedSize(void) const
Returns number of bytes required for Option serialization. 
uint32_t GetSize(void) const
This test suite implements a Unit Test. 
Buffer::Iterator Begin(void) const
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number.