22 #include "ns3/abort.h"
24 #include "ns3/uinteger.h"
25 #include "ns3/inet-socket-address.h"
26 #include "ns3/point-to-point-helper.h"
27 #include "ns3/internet-stack-helper.h"
28 #include "ns3/ipv4-address-helper.h"
29 #include "ns3/ipv4-header.h"
30 #include "ns3/packet-sink-helper.h"
31 #include "ns3/udp-client-server-helper.h"
32 #include "ns3/udp-header.h"
33 #include "ns3/simulator.h"
34 #include "ns3/wimax-helper.h"
35 #include "ns3/mobility-helper.h"
36 #include "ns3/global-route-manager.h"
37 #include "ns3/wimax-tlv.h"
38 #include "ns3/ipcs-classifier-record.h"
39 #include "ns3/service-flow.h"
40 #include "ns3/wimax-connection.h"
55 virtual void DoRun (
void);
60 :
TestCase (
"Test the packet fragmentation and defragmentation.")
91 connectionTx->
Enqueue (packet, packetType, hdr);
93 uint32_t availableByteForFragment = 280;
94 for (
int i = 0; i < 4; i++)
97 if (connectionTx->
GetQueue ()->GetFirstPacketRequiredByte (packetType) > availableByteForFragment)
99 fragment = connectionTx->
Dequeue (packetType, availableByteForFragment);
103 fragment = connectionTx->
Dequeue (packetType);
109 uint8_t type = gnrcMacHdr.
GetType ();
117 fragment->RemoveHeader (fragSubhdr);
118 uint32_t fc = fragSubhdr.
GetFc ();
122 NS_TEST_EXPECT_MSG_EQ (((fc == 3 && i != 1) && (fc == 3 && i != 2)),
false,
"The fragment in not the middle one");
139 iter != fragmentsQueue.end (); ++iter)
151 Simulator::Destroy ();
162 :
TestSuite (
"wimax-fragmentation", UNIT)
static Ns3WimaxFragmentationTestSuite ns3WimaxFragmentationTestSuite
Ns3WimaxFragmentationTestSuite()
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Doxygen introspection did not find any typical Config paths.
void FragmentEnqueue(Ptr< const Packet > fragment)
enqueue a received packet (that is a fragment) into the fragments queue
Ns3WimaxFragmentationTestCase()
uint32_t GetSize(void) const
Ptr< WimaxMacQueue > GetQueue(void) const
void AddAtEnd(Ptr< const Packet > packet)
Concatenate the input packet at the end of the current packet.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
const FragmentsQueue GetFragmentsQueue(void) const
get a queue of received fragments
void ClearFragmentsQueue(void)
delete all enqueued fragments
bool Enqueue(Ptr< Packet > packet, const MacHeaderType &hdrType, const GenericMacHeader &hdr)
enqueue a packet in the queue of the connection
std::list< Ptr< const Packet > > FragmentsQueue
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
Ptr< Packet > Dequeue(MacHeaderType::HeaderType packetType=MacHeaderType::HEADER_TYPE_GENERIC)
dequeue a packet from the queue of the connection
virtual ~Ns3WimaxFragmentationTestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.