21 #include "ns3/string.h" 23 #include "ns3/simulator.h" 24 #include "ns3/wifi-mac-queue.h" 25 #include "ns3/mac-low.h" 26 #include "ns3/qos-txop.h" 27 #include "ns3/yans-wifi-phy.h" 28 #include "ns3/mac-tx-middle.h" 29 #include "ns3/msdu-aggregator.h" 30 #include "ns3/mpdu-aggregator.h" 31 #include "ns3/mgt-headers.h" 32 #include "ns3/wifi-remote-station-manager.h" 48 virtual void DoRun (
void);
60 :
TestCase (
"Check the correctness of MPDU aggregation operations")
70 m_phy = CreateObject<YansWifiPhy> ();
86 m_low = CreateObject<MacLow> ();
96 m_txop = CreateObject<QosTxop> ();
119 Ptr<Packet> currentAggregatedPacket = Create<Packet> ();
126 hdr.SetSequenceNumber (sequence);
127 hdr.SetFragmentNumber (0);
128 hdr.SetNoMoreFragments ();
187 for (; aggregationQueueSize > 0; aggregationQueueSize--, i++)
190 dequeuedHdr = dequeuedItem->GetHeader ();
202 pkt1 = Create<Packet> (1500);
203 pkt2 = Create<Packet> (1500);
208 hdr1.SetSequenceNumber (3);
225 NS_TEST_EXPECT_MSG_EQ (isAmpdu,
false,
"a single packet for this destination should not result in an A-MPDU");
231 NS_TEST_EXPECT_MSG_EQ (isAmpdu,
false,
"no MPDU aggregation should be performed if there is no agreement");
240 Simulator::Destroy ();
266 virtual void DoRun (
void);
277 :
TestCase (
"Check the correctness of two-level aggregation operations")
287 m_phy = CreateObject<YansWifiPhy> ();
302 m_low = CreateObject<MacLow> ();
306 m_txop = CreateObject<QosTxop> ();
328 Ptr<Packet> currentAggregatedPacket = Create<Packet> ();
358 bool result = (packet != 0);
379 result = (packet != 0);
395 result = (packet != 0);
398 Simulator::Destroy ();
Aggregator used to construct A-MPDUs.
void Dispose(void)
Dispose of this Object.
void MissedAck(void)
Event handler when an ACK is missed.
Wifi Aggregation Test Suite.
Simulation virtual time values and global simulation resolution.
Ptr< QosTxop > m_txop
QosTxop.
virtual void DoRun(void)
Implementation to actually run this TestCase.
HT PHY for the 5 GHz band (clause 20)
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Ptr< WifiRemoteStationManager > m_manager
remote station manager
Hold variables of type string.
Ptr< MacLow > m_low
MacLow.
ObjectFactory m_factory
factory
void SetPhy(const Ptr< WifiPhy > phy)
Set up WifiPhy associated with this MacLow.
void SetChannelAccessManager(const Ptr< ChannelAccessManager > manager)
Set ChannelAccessManager this Txop is associated to.
void SetupPhyListener(Ptr< WifiPhy > phy)
Set up listener for Phy events.
Time GetTimeStamp(void) const
Get the timestamp included in this item.
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.
virtual WifiTxVector GetDataTxVector(Ptr< const Packet > packet, const WifiMacHeader *hdr) const
Return a TXVECTOR for the DATA frame given the destination.
void SetAccessCategory(AcIndex ac)
Set the access category of this EDCAF.
ObjectFactory m_factory
factory
Ptr< YansWifiPhy > m_phy
Phy.
Ptr< MsduAggregator > m_msduAggregator
A-MSDU aggregator.
Ptr< MacTxMiddle > m_txMiddle
MacTxMiddle.
void SetMsduAggregator(const Ptr< MsduAggregator > aggr)
Set the aggregator used to construct A-MSDU subframes.
WifiTxVector m_currentTxVector
TXVECTOR used for the current packet transmission.
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
uint16_t GetNextSequenceNumberFor(const WifiMacHeader *hdr)
Return the next sequence number for the given header.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Ptr< BlockAckManager > m_baManager
the Block ACK manager
void SetMaxSsrc(uint32_t maxSsrc)
Sets the maximum STA short retry count (SSRC).
TwoLevelAggregationTest()
Ptr< WifiMacQueue > m_aggregateQueue[8]
Queues per TID used for MPDU aggregation.
virtual void SetupPhy(const Ptr< WifiPhy > phy)
Set up PHY associated with this device since it is the object that knows the full set of transmit rat...
hold a list of per-remote-station state.
WifiAggregationTestSuite()
Ptr< MpduAggregator > m_mpduAggregator
A-MPDU aggregrator.
virtual void SetHtSupported(bool enable)
Enable or disable HT capability support.
Ptr< const Packet > GetPacket(void) const
Get the packet stored in this item.
void SetMpduAggregator(const Ptr< MpduAggregator > aggr)
Set the aggregator used to construct A-MPDU subframes.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static WifiAggregationTestSuite g_wifiAggregationTestSuite
the test suite
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Ptr< const Packet > m_currentPacket
the current packet
void Set(std::string name, const AttributeValue &value)
Set an attribute to be set during construction.
void SetMacLow(const Ptr< MacLow > low)
Set MacLow associated with this Txop.
Two Level Aggregation Test.
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > remoteManager)
Set WifiRemoteStationsManager this QosTxop is associated to.
Ptr< QosTxop > m_txop
QosTxop.
void SetMaxAmpduSize(uint16_t maxSize)
Sets the maximum A-MPDU size in bytes.
Instantiate subclasses of ns3::Object.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Ptr< Packet > m_currentPacket
Current packet transmitted/to be transmitted.
Ptr< ChannelAccessManager > m_channelAccessManager
channel access manager
void SetTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set MacTxMiddle this Txop is associated to.
Ptr< WifiMacQueue > GetWifiMacQueue() const
Return the packet queue associated with this Txop.
void CompleteConfig(void)
Complete block ACK configuration.
void SetSlot(Time slotTime)
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.
virtual void ConfigureStandard(WifiPhyStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
Ptr< Packet > PerformMsduAggregation(Ptr< const Packet > packet, WifiMacHeader *hdr, Time *tstamp, Ptr< Packet > currentAmpduPacket, uint8_t blockAckSize)
Perform MSDU aggregation for a given MPDU in an A-MPDU.
WifiMacHeader m_currentHdr
the current header
bool IsAmpdu(Ptr< const Packet > packet, const WifiMacHeader hdr)
Checks if the given packet will be aggregated to an A-MPDU or not.
Ptr< YansWifiPhy > m_phy
Phy.
void SetupLow(Ptr< MacLow > low)
Set up listener for MacLow events.
Ptr< MacLow > m_low
MacLow.
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)
Set up WifiRemoteStationManager associated with this MacLow.
void SetMaxAmsduSize(uint16_t maxSize)
Sets the maximum A-MSDU size in bytes.
Ptr< MpduAggregator > m_mpduAggregator
A-MPDU aggregator.
Ptr< WifiRemoteStationManager > m_manager
remote station manager