21 #include "ns3/string.h"
23 #include "ns3/object-factory.h"
24 #include "ns3/simulator.h"
25 #include "ns3/wifi-mac-queue.h"
26 #include "ns3/mac-low.h"
27 #include "ns3/edca-txop-n.h"
28 #include "ns3/yans-wifi-phy.h"
29 #include "ns3/mac-tx-middle.h"
30 #include "ns3/dcf-manager.h"
31 #include "ns3/ampdu-tag.h"
32 #include "ns3/wifi-mac-trailer.h"
33 #include "ns3/msdu-standard-aggregator.h"
34 #include "ns3/mpdu-standard-aggregator.h"
45 virtual void DoRun (
void);
57 :
TestCase (
"Check the correctness of MPDU aggregation operations")
67 m_phy = CreateObject<YansWifiPhy> ();
83 m_low = CreateObject<MacLow> ();
93 m_edca = CreateObject<EdcaTxopN> ();
116 Ptr<Packet> currentAggregatedPacket = Create<Packet> ();
123 hdr.SetSequenceNumber (sequence);
124 hdr.SetFragmentNumber (0);
125 hdr.SetNoMoreFragments ();
184 for (; aggregationQueueSize > 0; aggregationQueueSize--, i++)
198 pkt1 = Create<Packet> (1500);
199 pkt2 = Create<Packet> (1500);
204 hdr1.SetSequenceNumber (3);
221 NS_TEST_EXPECT_MSG_EQ (isAmpdu,
false,
"a single packet for this destination should not result in an A-MPDU");
227 NS_TEST_EXPECT_MSG_EQ (isAmpdu,
false,
"no MPDU aggregation should be performed if there is no agreement");
236 Simulator::Destroy ();
248 virtual void DoRun (
void);
259 :
TestCase (
"Check the correctness of two-level aggregation operations")
269 m_phy = CreateObject<YansWifiPhy> ();
284 m_low = CreateObject<MacLow> ();
288 m_edca = CreateObject<EdcaTxopN> ();
301 m_mpduAggregator->SetMaxAmpduSize (65535);
310 Ptr<Packet> currentAggregatedPacket = Create<Packet> ();
331 WifiMacHeader::ADDR1,
340 bool result = (packet != 0);
353 m_factory.SetTypeId (
"ns3::MpduStandardAggregator");
361 result = (packet != 0);
371 m_mpduAggregator->SetMaxAmpduSize (4095);
377 result = (packet != 0);
379 Simulator::Destroy ();
Abstract class that concrete mpdu aggregators have to implement.
Simulation virtual time values and global simulation resolution.
Ptr< const Packet > m_currentPacket
virtual void DoRun(void)
Implementation to actually run this TestCase.
HT OFDM PHY for the 5 GHz band (clause 20)
Ptr< WifiRemoteStationManager > m_manager
Hold variables of type string.
void CreateAgreement(const MgtAddBaRequestHeader *reqHdr, Mac48Address recipient)
void SetupLowListener(Ptr< MacLow > low)
Set up listener for MacLow events.
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > remoteManager)
Set WifiRemoteStationsManager this EdcaTxopN is associated to.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
WifiMacHeader m_currentHdr
virtual void SetupPhy(Ptr< WifiPhy > phy)
Set up PHY associated with this device since it is the object that knows the full set of transmit rat...
Ptr< MsduAggregator > m_msduAggregator
Ptr< Packet > PerformMsduAggregation(Ptr< const Packet > packet, WifiMacHeader *hdr, Time *tstamp, Ptr< Packet > currentAmpduPacket, uint16_t blockAckSize)
Perform MSDU aggregation for a given MPDU in an A-MPDU.
BlockAckManager * m_baManager
Handles sequence numbering of IEEE 802.11 data frames.
void MissedAck(void)
Event handler when an ACK is missed.
void SetLow(Ptr< MacLow > low)
Set MacLow associated with this EdcaTxopN.
WifiTxVector m_currentTxVector
TXVECTOR used for the current packet transmission.
Ptr< WifiMacQueue > m_aggregateQueue
Queue used for MPDU aggregation.
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
Hold an unsigned integer type.
void SetupPhyListener(Ptr< WifiPhy > phy)
Set up listener for Phy events.
Manage a set of ns3::DcfStateHandle a set of independent ns3::DcfState, each of which represents a si...
TwoLevelAggregationTest()
hold a list of per-remote-station state.
WifiAggregationTestSuite()
Ptr< MpduAggregator > m_mpduAggregator
void SetHtSupported(bool enable)
Enable or disable HT capability support.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
uint16_t GetNextSequenceNumberfor(const WifiMacHeader *hdr)
Return the next sequence number for the given header.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetAccessCategory(enum AcIndex ac)
Set the access category of this EDCAF.
static WifiAggregationTestSuite g_wifiAggregationTestSuite
void SetMpduAggregator(Ptr< MpduAggregator > aggr)
void Set(std::string name, const AttributeValue &value)
Set an attribute to be set during construction.
virtual void SetMaxAmsduSize(uint32_t maxSize)=0
void SetManager(DcfManager *manager)
Set DcfManager this EdcaTxopN is associated to.
void SetPhy(Ptr< WifiPhy > phy)
Set up WifiPhy associated with this MacLow.
void SetMsduAggregator(Ptr< MsduAggregator > aggr)
void SetSlot(Time slotTime)
virtual WifiTxVector GetDataTxVector(Ptr< const Packet > packet, const WifiMacHeader *hdr) const
Return a TXVECTOR for the DATA frame given the destination.
Instantiate subclasses of ns3::Object.
void SetMaxSlrc(uint32_t maxSlrc)
Sets the maximum STA long retry count (SLRC).
DcfManager * m_dcfManager
virtual void DoRun(void)
Implementation to actually run this TestCase.
void CompleteConfig(void)
Complete block ACK configuration.
Ptr< Packet > m_currentPacket
Current packet transmitted/to be transmitted.
virtual void ConfigureStandard(enum WifiPhyStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
void SetTxMiddle(MacTxMiddle *txMiddle)
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
WifiMacHeader m_currentHdr
Header of the current transmitted packet.
void SetAddress(Mac48Address ad)
Set MAC address of this MacLow.
bool IsAmpdu(Ptr< const Packet > packet, const WifiMacHeader hdr)
Checks if the given packet will be aggregated to an A-MPDU or not.
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > manager)
Set up WifiRemoteStationManager associated with this MacLow.
Ptr< MpduAggregator > m_mpduAggregator
Ptr< WifiMacQueue > GetEdcaQueue() const
Return the packet queue associated with this EdcaTxopN.
Ptr< WifiRemoteStationManager > m_manager