22 #include "ns3/mac-messages.h"
23 #include "ns3/packet.h"
25 #include "ns3/simulator.h"
27 #include "ns3/wimax-connection.h"
28 #include "ns3/wimax-mac-header.h"
45 void DoRun()
override;
49 :
TestCase(
"Test the packet fragmentation and defragmentation.")
77 hdr.
SetCid(connectionTx->GetCid());
80 connectionTx->Enqueue(packet, packetType, hdr);
82 uint32_t availableByteForFragment = 280;
83 for (
int i = 0; i < 4; i++)
86 if (connectionTx->GetQueue()->GetFirstPacketRequiredByte(packetType) >
87 availableByteForFragment)
89 fragment = connectionTx->Dequeue(packetType, availableByteForFragment);
93 fragment = connectionTx->Dequeue(packetType);
108 uint32_t fc = fragSubhdr.
GetFc();
114 "The fragment in not the middle one");
120 connectionRx->FragmentEnqueue(fragment);
126 connectionRx->FragmentEnqueue(fragment);
130 for (
auto iter = fragmentsQueue.begin(); iter != fragmentsQueue.end(); ++iter)
135 connectionRx->ClearFragmentsQueue();
142 Simulator::Destroy();
Test the wimax packet fragmentation.
Ns3WimaxFragmentationTestCase()
~Ns3WimaxFragmentationTestCase() override
void DoRun() override
Implementation to actually run this TestCase.
Ns3 Wimax Fragmentation Test Suite.
Ns3WimaxFragmentationTestSuite()
Mac Management messages Section 6.3.2.3 MAC Management messages page 42, Table 14 page 43.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
void AddAtEnd(Ptr< const Packet > packet)
Concatenate the input packet at the end of the current packet.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Class to represent WiMAX connections.
std::list< Ptr< const Packet > > FragmentsQueue
Definition of Fragments Queue data type.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static Ns3WimaxFragmentationTestSuite ns3WimaxFragmentationTestSuite
the test suite