A Discrete-Event Network Simulator
API
wifi-aggregation-test.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2015
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Sébastien Deronne <sebastien.deronne@gmail.com>
19  */
20 
21 #include "ns3/string.h"
22 #include "ns3/test.h"
23 #include "ns3/simulator.h"
24 #include "ns3/wifi-mac-queue.h"
25 #include "ns3/wifi-psdu.h"
26 #include "ns3/sta-wifi-mac.h"
27 #include "ns3/yans-wifi-phy.h"
28 #include "ns3/mac-tx-middle.h"
29 #include "ns3/ht-frame-exchange-manager.h"
30 #include "ns3/msdu-aggregator.h"
31 #include "ns3/mpdu-aggregator.h"
32 #include "ns3/wifi-net-device.h"
33 #include "ns3/ht-configuration.h"
34 #include "ns3/vht-configuration.h"
35 #include "ns3/he-configuration.h"
36 #include "ns3/node-container.h"
37 #include "ns3/yans-wifi-helper.h"
38 #include "ns3/mobility-helper.h"
39 #include "ns3/pointer.h"
40 #include "ns3/packet-socket-server.h"
41 #include "ns3/packet-socket-client.h"
42 #include "ns3/packet-socket-helper.h"
43 #include "ns3/wifi-default-protection-manager.h"
44 #include "ns3/wifi-default-ack-manager.h"
45 #include <iterator>
46 #include <algorithm>
47 
48 using namespace ns3;
49 
57 {
58 public:
60 
61 private:
68  void MpduDiscarded (WifiMacDropReason reason, Ptr<const WifiMacQueueItem> mpdu);
69 
70  void DoRun (void) override;
76  bool m_discarded;
77 };
78 
80  : TestCase ("Check the correctness of MPDU aggregation operations"),
81  m_discarded (false)
82 {
83 }
84 
85 void
87 {
88  m_discarded = true;
89 }
90 
91 void
93 {
94  /*
95  * Create device and attach HT configuration.
96  */
97  m_device = CreateObject<WifiNetDevice> ();
98  Ptr<HtConfiguration> htConfiguration = CreateObject<HtConfiguration> ();
99  m_device->SetHtConfiguration (htConfiguration);
100 
101  /*
102  * Create and configure phy layer.
103  */
104  m_phy = CreateObject<YansWifiPhy> ();
107  m_device->SetPhy (m_phy);
108 
109  /*
110  * Create and configure manager.
111  */
113  m_factory.SetTypeId ("ns3::ConstantRateWifiManager");
114  m_factory.Set ("DataMode", StringValue ("HtMcs7"));
118 
119  /*
120  * Create and configure mac layer.
121  */
122  m_mac = CreateObject<StaWifiMac> ();
125  m_mac->SetAddress (Mac48Address ("00:00:00:00:00:01"));
128  Ptr<WifiProtectionManager> protectionManager = CreateObject<WifiDefaultProtectionManager> ();
129  protectionManager->SetWifiMac (m_mac);
130  fem->SetProtectionManager (protectionManager);
131  Ptr<WifiAckManager> ackManager = CreateObject<WifiDefaultAckManager> ();
132  ackManager->SetWifiMac (m_mac);
133  fem->SetAckManager (ackManager);
135  m_device->SetMac (m_mac);
136 
137  /*
138  * Configure MPDU aggregation.
139  */
140  m_mac->SetAttribute ("BE_MaxAmpduSize", UintegerValue (65535));
141  HtCapabilities htCapabilities;
142  htCapabilities.SetMaxAmpduLength (65535);
143  m_manager->AddStationHtCapabilities (Mac48Address ("00:00:00:00:00:02"), htCapabilities);
144  m_manager->AddStationHtCapabilities (Mac48Address ("00:00:00:00:00:03"), htCapabilities);
145 
146  /*
147  * Create a dummy packet of 1500 bytes and fill mac header fields.
148  */
149  Ptr<const Packet> pkt = Create<Packet> (1500);
150  Ptr<Packet> currentAggregatedPacket = Create<Packet> ();
151  WifiMacHeader hdr;
152  hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
153  hdr.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
154  hdr.SetType (WIFI_MAC_QOSDATA);
155  hdr.SetQosTid (0);
156  hdr.SetFragmentNumber (0);
157  hdr.SetNoMoreFragments ();
158  hdr.SetNoRetry ();
159 
160  /*
161  * Establish agreement.
162  */
163  MgtAddBaRequestHeader reqHdr;
164  reqHdr.SetImmediateBlockAck ();
165  reqHdr.SetTid (0);
166  reqHdr.SetBufferSize (64);
167  reqHdr.SetTimeout (0);
168  reqHdr.SetStartingSequence (0);
169  m_mac->GetBEQueue ()->GetBaManager ()->CreateAgreement (&reqHdr, hdr.GetAddr1 ());
170 
171  MgtAddBaResponseHeader respHdr;
172  StatusCode code;
173  code.SetSuccess ();
174  respHdr.SetStatusCode (code);
175  respHdr.SetAmsduSupport (reqHdr.IsAmsduSupported ());
176  respHdr.SetImmediateBlockAck ();
177  respHdr.SetTid (reqHdr.GetTid ());
178  respHdr.SetBufferSize (63);
179  respHdr.SetTimeout (reqHdr.GetTimeout ());
180  m_mac->GetBEQueue ()->GetBaManager ()->UpdateAgreement (&respHdr, hdr.GetAddr1 (), 0);
181 
182  //-----------------------------------------------------------------------------------------------------
183 
184  /*
185  * Test behavior when no other packets are in the queue
186  */
187  Ptr<HtFrameExchangeManager> htFem = DynamicCast<HtFrameExchangeManager> (fem);
188  Ptr<MpduAggregator> mpduAggregator = htFem->GetMpduAggregator ();
189 
190  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt, hdr));
191 
193  WifiTxParameters txParams;
196  Ptr<WifiMacQueueItem> item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (),
197  true, queueIt);
198 
199  auto mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min (), queueIt);
200 
201  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), true, "a single packet should not result in an A-MPDU");
202 
203  // the packet has not been "transmitted", release its sequence number
204  m_mac->m_txMiddle->SetSequenceNumberFor (&item->GetHeader ());
205 
206  //-----------------------------------------------------------------------------------------------------
207 
208  /*
209  * Test behavior when 2 more packets are in the queue
210  */
211  Ptr<const Packet> pkt1 = Create<Packet> (1500);
212  Ptr<const Packet> pkt2 = Create<Packet> (1500);
213  WifiMacHeader hdr1, hdr2;
214 
215  hdr1.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
216  hdr1.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
217  hdr1.SetType (WIFI_MAC_QOSDATA);
218  hdr1.SetQosTid (0);
219 
220  hdr2.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
221  hdr2.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
222  hdr2.SetType (WIFI_MAC_QOSDATA);
223  hdr2.SetQosTid (0);
224 
225  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt1, hdr1));
226  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt2, hdr2));
227 
228  item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (), true, queueIt);
229  mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min (), queueIt);
230 
231  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), false, "MPDU aggregation failed");
232 
233  Ptr<WifiPsdu> psdu = Create<WifiPsdu> (mpduList);
234  htFem->DequeuePsdu (psdu);
235 
236  NS_TEST_EXPECT_MSG_EQ (psdu->GetSize (), 4606, "A-MPDU size is not correct");
237  NS_TEST_EXPECT_MSG_EQ (mpduList.size (), 3, "A-MPDU should contain 3 MPDUs");
238  NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), 0, "queue should be empty");
239 
240  for (uint32_t i = 0; i < psdu->GetNMpdus (); i++)
241  {
242  NS_TEST_EXPECT_MSG_EQ (psdu->GetHeader (i).GetSequenceNumber (), i, "wrong sequence number");
243  }
244 
245  //-----------------------------------------------------------------------------------------------------
246 
247  /*
248  * Test behavior when the 802.11n station and another non-QoS station are associated to the AP.
249  * The AP sends an A-MPDU to the 802.11n station followed by the last retransmission of a non-QoS data frame to the non-QoS station.
250  * This is used to reproduce bug 2224.
251  */
252  pkt1 = Create<Packet> (1500);
253  pkt2 = Create<Packet> (1500);
254  hdr1.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
255  hdr1.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
256  hdr1.SetType (WIFI_MAC_QOSDATA);
257  hdr1.SetQosTid (0);
258  hdr1.SetSequenceNumber (3);
259  hdr2.SetAddr1 (Mac48Address ("00:00:00:00:00:03"));
260  hdr2.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
261  hdr2.SetType (WIFI_MAC_QOSDATA);
262  hdr2.SetQosTid (0);
263 
264  Ptr<const Packet> pkt3 = Create<Packet> (1500);
265  WifiMacHeader hdr3;
266  hdr3.SetSequenceNumber (0);
267  hdr3.SetAddr1 (Mac48Address ("00:00:00:00:00:03"));
268  hdr3.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
269  hdr3.SetType (WIFI_MAC_QOSDATA);
270  hdr3.SetQosTid (0);
271 
272  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt1, hdr1));
273  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt2, hdr2));
274  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt3, hdr3));
275 
276  peeked = m_mac->GetBEQueue ()->PeekNextMpdu ();
277  txParams.Clear ();
279  queueIt = {nullptr, WifiMacQueue::EMPTY}; // reset queueIt
280  item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (), true, queueIt);
281 
282  mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min (), queueIt);
283 
284  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), true, "a single packet for this destination should not result in an A-MPDU");
285  // dequeue the MPDU
286  htFem->DequeueMpdu (item);
287 
288  peeked = m_mac->GetBEQueue ()->PeekNextMpdu ();
289  txParams.Clear ();
291  queueIt = {nullptr, WifiMacQueue::EMPTY}; // reset queueIt
292  item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (), true, queueIt);
293 
294  mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min (), queueIt);
295 
296  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), true, "no MPDU aggregation should be performed if there is no agreement");
297 
298  m_manager->SetMaxSsrc (0); //set to 0 in order to fake that the maximum number of retries has been reached
300  htFem->m_dcf = m_mac->GetBEQueue ();
301  htFem->NormalAckTimeout (item, txParams.m_txVector);
302 
303  NS_TEST_EXPECT_MSG_EQ (m_discarded, true, "packet should be discarded");
304  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Flush ();
305 
306  Simulator::Destroy ();
307 
308  m_manager->Dispose ();
309  m_manager = 0;
310 
311  m_device->Dispose ();
312  m_device = 0;
313 
314  htConfiguration = 0;
315 }
316 
324 {
325 public:
327 
328 private:
329  void DoRun (void) override;
335 };
336 
338  : TestCase ("Check the correctness of two-level aggregation operations")
339 {
340 }
341 
342 void
344 {
345  /*
346  * Create device and attach HT configuration.
347  */
348  m_device = CreateObject<WifiNetDevice> ();
349  Ptr<HtConfiguration> htConfiguration = CreateObject<HtConfiguration> ();
350  m_device->SetHtConfiguration (htConfiguration);
351 
352  /*
353  * Create and configure phy layer.
354  */
355  m_phy = CreateObject<YansWifiPhy> ();
358  m_device->SetPhy (m_phy);
359 
360  /*
361  * Create and configure manager.
362  */
364  m_factory.SetTypeId ("ns3::ConstantRateWifiManager");
365  m_factory.Set ("DataMode", StringValue ("HtMcs7"));
369 
370  /*
371  * Create and configure mac layer.
372  */
373  m_mac = CreateObject<StaWifiMac> ();
376  m_mac->SetAddress (Mac48Address ("00:00:00:00:00:01"));
379  Ptr<WifiProtectionManager> protectionManager = CreateObject<WifiDefaultProtectionManager> ();
380  protectionManager->SetWifiMac (m_mac);
381  fem->SetProtectionManager (protectionManager);
382  Ptr<WifiAckManager> ackManager = CreateObject<WifiDefaultAckManager> ();
383  ackManager->SetWifiMac (m_mac);
384  fem->SetAckManager (ackManager);
386  m_device->SetMac (m_mac);
387 
388  /*
389  * Configure aggregation.
390  */
391  m_mac->SetAttribute ("BE_MaxAmsduSize", UintegerValue (4095));
392  m_mac->SetAttribute ("BE_MaxAmpduSize", UintegerValue (65535));
393  HtCapabilities htCapabilities;
394  htCapabilities.SetMaxAmsduLength (7935);
395  htCapabilities.SetMaxAmpduLength (65535);
396  m_manager->AddStationHtCapabilities (Mac48Address ("00:00:00:00:00:02"), htCapabilities);
397 
398  /*
399  * Create dummy packets of 1500 bytes and fill mac header fields that will be used for the tests.
400  */
401  Ptr<const Packet> pkt = Create<Packet> (1500);
402  WifiMacHeader hdr;
403  hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
404  hdr.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
405  hdr.SetType (WIFI_MAC_QOSDATA);
406  hdr.SetQosTid (0);
407 
408  //-----------------------------------------------------------------------------------------------------
409 
410  /*
411  * Test MSDU and MPDU aggregation. Three MSDUs are in the queue and the maximum A-MSDU size
412  * is such that only two MSDUs can be aggregated. Therefore, the first MPDU we get contains
413  * an A-MSDU of 2 MSDUs.
414  */
415  Ptr<HtFrameExchangeManager> htFem = DynamicCast<HtFrameExchangeManager> (fem);
416  Ptr<MsduAggregator> msduAggregator = htFem->GetMsduAggregator ();
417  Ptr<MpduAggregator> mpduAggregator = htFem->GetMpduAggregator ();
418 
419  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (Create<Packet> (1500), hdr));
420  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (Create<Packet> (1500), hdr));
421  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (Create<Packet> (1500), hdr));
422 
424  WifiTxParameters txParams;
426  htFem->TryAddMpdu (peeked, txParams, Time::Min ());
428  Ptr<WifiMacQueueItem> item = msduAggregator->GetNextAmsdu (peeked, txParams, Time::Min (), queueIt);
429 
430  bool result = (item != 0);
431  NS_TEST_EXPECT_MSG_EQ (result, true, "aggregation failed");
432  NS_TEST_EXPECT_MSG_EQ (item->GetPacketSize (), 3030, "wrong packet size");
433 
434  // dequeue the MSDUs
435  htFem->DequeueMpdu (item);
436 
437  NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), 1,
438  "Unexpected number of MSDUs left in the EDCA queue");
439 
440  //-----------------------------------------------------------------------------------------------------
441 
442  /*
443  * A-MSDU aggregation fails when there is just one MSDU in the queue.
444  */
445 
446  peeked = m_mac->GetBEQueue ()->PeekNextMpdu ();
447  txParams.Clear ();
448  txParams.m_txVector = m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (peeked->GetHeader ());
449  htFem->TryAddMpdu (peeked, txParams, Time::Min ());
450  item = msduAggregator->GetNextAmsdu (peeked, txParams, Time::Min (), queueIt);
451 
452  NS_TEST_EXPECT_MSG_EQ ((item == 0), true, "A-MSDU aggregation did not fail");
453 
454  htFem->DequeueMpdu (*peeked->GetQueueIteratorPairs ().front ().it);
455 
456  NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), 0, "queue should be empty");
457 
458  //-----------------------------------------------------------------------------------------------------
459 
460  /*
461  * Aggregation of MPDUs is stopped to prevent that the PPDU duration exceeds the TXOP limit.
462  * In this test, the VI AC is used, which has a default TXOP limit of 3008 microseconds.
463  */
464 
465  // Establish agreement.
466  uint8_t tid = 5;
467  MgtAddBaRequestHeader reqHdr;
468  reqHdr.SetImmediateBlockAck ();
469  reqHdr.SetTid (tid);
470  reqHdr.SetBufferSize (64);
471  reqHdr.SetTimeout (0);
472  reqHdr.SetStartingSequence (0);
473  m_mac->GetVIQueue ()->GetBaManager ()->CreateAgreement (&reqHdr, hdr.GetAddr1 ());
474 
475  MgtAddBaResponseHeader respHdr;
476  StatusCode code;
477  code.SetSuccess ();
478  respHdr.SetStatusCode (code);
479  respHdr.SetAmsduSupport (reqHdr.IsAmsduSupported ());
480  respHdr.SetImmediateBlockAck ();
481  respHdr.SetTid (reqHdr.GetTid ());
482  respHdr.SetBufferSize (63);
483  respHdr.SetTimeout (reqHdr.GetTimeout ());
484  m_mac->GetVIQueue ()->GetBaManager ()->UpdateAgreement (&respHdr, hdr.GetAddr1 (), 0);
485 
486  m_mac->SetAttribute ("VI_MaxAmsduSize", UintegerValue (3050)); // max 2 MSDUs per A-MSDU
487  m_mac->SetAttribute ("VI_MaxAmpduSize", UintegerValue (65535));
488  m_manager->SetAttribute ("DataMode", StringValue ("HtMcs2")); // 19.5Mbps
489 
490  hdr.SetQosTid (tid);
491 
492  // Add 10 MSDUs to the EDCA queue
493  for (uint8_t i = 0; i < 10; i++)
494  {
495  m_mac->GetVIQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (Create<Packet> (1300), hdr));
496  }
497 
498  peeked = m_mac->GetVIQueue ()->PeekNextMpdu ();
499  txParams.Clear ();
500  txParams.m_txVector = m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (peeked->GetHeader ());
501  Time txopLimit = m_mac->GetVIQueue ()->GetTxopLimit (); // 3.008 ms
502 
503  // Compute the first MPDU to be aggregated in an A-MPDU. It must contain an A-MSDU
504  // aggregating two MSDUs
505  queueIt = {nullptr, WifiMacQueue::EMPTY}; // reset queueIt
506  item = m_mac->GetVIQueue ()->GetNextMpdu (peeked, txParams, txopLimit, true, queueIt);
507 
508  NS_TEST_EXPECT_MSG_EQ (std::distance (item->begin (), item->end ()), 2, "There must be 2 MSDUs in the A-MSDU");
509 
510  auto mpduList = mpduAggregator->GetNextAmpdu (item, txParams, txopLimit, queueIt);
511 
512  // The maximum number of bytes that can be transmitted in a TXOP is (approximately, as we
513  // do not consider that the preamble is transmitted at a different rate):
514  // 19.5 Mbps * 3.008 ms = 7332 bytes
515  // Given that the max A-MSDU size is set to 3050, an A-MSDU will contain two MSDUs and have
516  // a size of 2 * 1300 (MSDU size) + 2 * 14 (A-MSDU subframe header size) + 2 (one padding field) = 2630 bytes
517  // Hence, we expect that the A-MPDU will consist of:
518  // - 2 MPDUs containing each an A-MSDU. The size of each MPDU is 2630 (A-MSDU) + 30 (header+trailer) = 2660
519  // - 1 MPDU containing a single MSDU. The size of such MPDU is 1300 (MSDU) + 30 (header+trailer) = 1330
520  // The size of the A-MPDU is 4 + 2660 + 4 + 2660 + 4 + 1330 = 6662
521  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), false, "aggregation failed");
522  NS_TEST_EXPECT_MSG_EQ (mpduList.size (), 3, "Unexpected number of MPDUs in the A-MPDU");
523  NS_TEST_EXPECT_MSG_EQ (mpduList.at (0)->GetSize (), 2660, "Unexpected size of the first MPDU");
524  NS_TEST_EXPECT_MSG_EQ (mpduList.at (1)->GetSize (), 2660, "Unexpected size of the second MPDU");
525  NS_TEST_EXPECT_MSG_EQ (mpduList.at (2)->GetSize (), 1330, "Unexpected size of the first MPDU");
526 
527  Ptr<WifiPsdu> psdu = Create<WifiPsdu> (mpduList);
528  htFem->DequeuePsdu (psdu);
529 
530  NS_TEST_EXPECT_MSG_EQ (m_mac->GetVIQueue ()->GetWifiMacQueue ()->GetNPackets (), 5,
531  "Unexpected number of MSDUs left in the EDCA queue");
532 
533  NS_TEST_EXPECT_MSG_EQ (psdu->GetSize (), 6662, "Unexpected size of the A-MPDU");
534 
535  Simulator::Destroy ();
536 
537  m_device->Dispose ();
538  m_device = 0;
539  htConfiguration = 0;
540 }
541 
549 {
550 public:
552 
553 private:
554  void DoRun (void) override;
560  void DoRunSubTest (uint16_t bufferSize);
566 };
567 
569  : TestCase ("Check the correctness of 802.11ax aggregation operations")
570 {
571 }
572 
573 void
574 HeAggregationTest::DoRunSubTest (uint16_t bufferSize)
575 {
576  /*
577  * Create device and attach configurations.
578  */
579  m_device = CreateObject<WifiNetDevice> ();
580  Ptr<HtConfiguration> htConfiguration = CreateObject<HtConfiguration> ();
581  m_device->SetHtConfiguration (htConfiguration);
582  Ptr<VhtConfiguration> vhtConfiguration = CreateObject<VhtConfiguration> ();
583  m_device->SetVhtConfiguration (vhtConfiguration);
584  Ptr<HeConfiguration> heConfiguration = CreateObject<HeConfiguration> ();
585  m_device->SetHeConfiguration (heConfiguration);
586 
587  /*
588  * Create and configure phy layer.
589  */
590  m_phy = CreateObject<YansWifiPhy> ();
593  m_device->SetPhy (m_phy);
594 
595  /*
596  * Create and configure manager.
597  */
599  m_factory.SetTypeId ("ns3::ConstantRateWifiManager");
600  m_factory.Set ("DataMode", StringValue ("HeMcs11"));
604 
605  /*
606  * Create and configure mac layer.
607  */
608  m_mac = CreateObject<StaWifiMac> ();
611  m_mac->SetAddress (Mac48Address ("00:00:00:00:00:01"));
614  Ptr<WifiProtectionManager> protectionManager = CreateObject<WifiDefaultProtectionManager> ();
615  protectionManager->SetWifiMac (m_mac);
616  fem->SetProtectionManager (protectionManager);
617  Ptr<WifiAckManager> ackManager = CreateObject<WifiDefaultAckManager> ();
618  ackManager->SetWifiMac (m_mac);
619  fem->SetAckManager (ackManager);
621  m_device->SetMac (m_mac);
622 
623  /*
624  * Configure aggregation.
625  */
626  HeCapabilities heCapabilities;
627  m_manager->AddStationHeCapabilities (Mac48Address ("00:00:00:00:00:02"), heCapabilities);
628 
629  /*
630  * Fill mac header fields.
631  */
632  WifiMacHeader hdr;
633  hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
634  hdr.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
636  hdr.SetQosTid (0);
637  uint16_t sequence = m_mac->m_txMiddle->PeekNextSequenceNumberFor (&hdr);
638  hdr.SetSequenceNumber (sequence);
639  hdr.SetFragmentNumber (0);
640  hdr.SetNoMoreFragments ();
641  hdr.SetNoRetry ();
642 
643  /*
644  * Establish agreement.
645  */
646  MgtAddBaRequestHeader reqHdr;
647  reqHdr.SetImmediateBlockAck ();
648  reqHdr.SetTid (0);
649  reqHdr.SetBufferSize (bufferSize);
650  reqHdr.SetTimeout (0);
651  reqHdr.SetStartingSequence (0);
652  m_mac->GetBEQueue ()->GetBaManager ()->CreateAgreement (&reqHdr, hdr.GetAddr1 ());
653 
654  MgtAddBaResponseHeader respHdr;
655  StatusCode code;
656  code.SetSuccess ();
657  respHdr.SetStatusCode (code);
658  respHdr.SetAmsduSupport (reqHdr.IsAmsduSupported ());
659  respHdr.SetImmediateBlockAck ();
660  respHdr.SetTid (reqHdr.GetTid ());
661  respHdr.SetBufferSize (bufferSize - 1);
662  respHdr.SetTimeout (reqHdr.GetTimeout ());
663  m_mac->GetBEQueue ()->GetBaManager ()->UpdateAgreement (&respHdr, hdr.GetAddr1 (), 0);
664 
665  /*
666  * Test behavior when 300 packets are ready for transmission but negociated buffer size is 64
667  */
668  Ptr<HtFrameExchangeManager> htFem = DynamicCast<HtFrameExchangeManager> (fem);
669  Ptr<MpduAggregator> mpduAggregator = htFem->GetMpduAggregator ();
670 
671  for (uint16_t i = 0; i < 300; i++)
672  {
673  Ptr<const Packet> pkt = Create<Packet> (100);
674  WifiMacHeader hdr;
675 
676  hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
677  hdr.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
678  hdr.SetType (WIFI_MAC_QOSDATA);
679  hdr.SetQosTid (0);
680 
681  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt, hdr));
682  }
683 
685  WifiTxParameters txParams;
688  Ptr<WifiMacQueueItem> item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (),
689  true, queueIt);
690 
691  auto mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min (), queueIt);
692  Ptr<WifiPsdu> psdu = Create<WifiPsdu> (mpduList);
693  htFem->DequeuePsdu (psdu);
694 
695  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), false, "MPDU aggregation failed");
696  NS_TEST_EXPECT_MSG_EQ (mpduList.size (), bufferSize, "A-MPDU should countain " << bufferSize << " MPDUs");
697  uint16_t expectedRemainingPacketsInQueue = 300 - bufferSize;
698  NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), expectedRemainingPacketsInQueue, "queue should contain 300 - "<< bufferSize << " = "<< expectedRemainingPacketsInQueue << " packets");
699 
700  Simulator::Destroy ();
701 
702  m_manager->Dispose ();
703  m_manager = 0;
704 
705  m_device->Dispose ();
706  m_device = 0;
707 
708  htConfiguration = 0;
709  vhtConfiguration = 0;
710  heConfiguration = 0;
711 }
712 
713 void
715 {
716  DoRunSubTest (64);
717  DoRunSubTest (256);
718 }
719 
740 {
741 public:
743  virtual ~PreservePacketsInAmpdus ();
744 
745  void DoRun (void) override;
746 
747 
748 private:
749  std::list<Ptr<const Packet>> m_packetList;
750  std::vector<std::size_t> m_nMpdus;
751  std::vector<std::size_t> m_nMsdus;
752 
757  void NotifyMacTransmit (Ptr<const Packet> packet);
764  void NotifyPsduForwardedDown (WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW);
770 };
771 
773  : TestCase ("Test case to check that the Wifi Mac forwards up the same packets received at sender side.")
774 {
775 }
776 
778 {
779 }
780 
781 void
783 {
784  m_packetList.push_back (packet);
785 }
786 
787 void
789 {
790  NS_TEST_EXPECT_MSG_EQ ((psduMap.size () == 1 && psduMap.begin ()->first == SU_STA_ID),
791  true, "No DL MU PPDU expected");
792 
793  if (!psduMap[SU_STA_ID]->GetHeader (0).IsQosData ())
794  {
795  return;
796  }
797 
798  m_nMpdus.push_back (psduMap[SU_STA_ID]->GetNMpdus ());
799 
800  for (auto& mpdu : *PeekPointer (psduMap[SU_STA_ID]))
801  {
802  std::size_t dist = std::distance (mpdu->begin (), mpdu->end ());
803  // the list of aggregated MSDUs is empty if the MPDU includes a non-aggregated MSDU
804  m_nMsdus.push_back (dist > 0 ? dist : 1);
805  }
806 }
807 
808 void
810 {
811  auto it = std::find (m_packetList.begin (), m_packetList.end (), p);
812  NS_TEST_EXPECT_MSG_EQ ((it != m_packetList.end ()), true, "Packet being forwarded up not found");
813  m_packetList.erase (it);
814 }
815 
816 void
818 {
819  NodeContainer wifiStaNode;
820  wifiStaNode.Create (1);
821 
823  wifiApNode.Create (1);
824 
825  YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
827  phy.SetChannel (channel.Create ());
828 
830  wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
831  wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
832 
834  Ssid ssid = Ssid ("ns-3-ssid");
835  mac.SetType ("ns3::StaWifiMac",
836  "BE_MaxAmsduSize", UintegerValue (4500),
837  "BE_MaxAmpduSize", UintegerValue (7500),
838  "Ssid", SsidValue (ssid),
839  /* setting blockack threshold for sta's BE queue */
840  "BE_BlockAckThreshold", UintegerValue (2),
841  "ActiveProbing", BooleanValue (false));
842 
844  staDevices = wifi.Install (phy, mac, wifiStaNode);
845 
846  mac.SetType ("ns3::ApWifiMac",
847  "Ssid", SsidValue (ssid),
848  "BeaconGeneration", BooleanValue (true));
849 
851  apDevices = wifi.Install (phy, mac, wifiApNode);
852 
854  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
855 
856  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
857  positionAlloc->Add (Vector (1.0, 0.0, 0.0));
858  mobility.SetPositionAllocator (positionAlloc);
859 
860  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
861  mobility.Install (wifiApNode);
862  mobility.Install (wifiStaNode);
863 
864  Ptr<WifiNetDevice> ap_device = DynamicCast<WifiNetDevice> (apDevices.Get (0));
865  Ptr<WifiNetDevice> sta_device = DynamicCast<WifiNetDevice> (staDevices.Get (0));
866 
867  PacketSocketAddress socket;
868  socket.SetSingleDevice (sta_device->GetIfIndex ());
869  socket.SetPhysicalAddress (ap_device->GetAddress ());
870  socket.SetProtocol (1);
871 
872  // install packet sockets on nodes.
873  PacketSocketHelper packetSocket;
874  packetSocket.Install (wifiStaNode);
875  packetSocket.Install (wifiApNode);
876 
877  Ptr<PacketSocketClient> client = CreateObject<PacketSocketClient> ();
878  client->SetAttribute ("PacketSize", UintegerValue (1000));
879  client->SetAttribute ("MaxPackets", UintegerValue (8));
880  client->SetAttribute ("Interval", TimeValue (Seconds (1)));
881  client->SetRemote (socket);
882  wifiStaNode.Get (0)->AddApplication (client);
883  client->SetStartTime (Seconds (1));
884  client->SetStopTime (Seconds (3.0));
885  Simulator::Schedule (Seconds (1.5), &PacketSocketClient::SetAttribute, client,
886  "Interval", TimeValue (MicroSeconds (0)));
887 
888  Ptr<PacketSocketServer> server = CreateObject<PacketSocketServer> ();
889  server->SetLocal (socket);
890  wifiApNode.Get (0)->AddApplication (server);
891  server->SetStartTime (Seconds (0.0));
892  server->SetStopTime (Seconds (4.0));
893 
894  sta_device->GetMac ()->TraceConnectWithoutContext ("MacTx",
896  sta_device->GetPhy ()->TraceConnectWithoutContext ("PhyTxPsduBegin",
898  ap_device->GetMac ()->TraceConnectWithoutContext ("MacRx",
900 
901  Simulator::Stop (Seconds (5));
902  Simulator::Run ();
903 
904  Simulator::Destroy ();
905 
906  // Two packets are transmitted. The first one is an MPDU containing a single MSDU.
907  // The second one is an A-MPDU containing two MPDUs: the first MPDU contains 4 MSDUs
908  // and the second MPDU contains 3 MSDUs
909  NS_TEST_EXPECT_MSG_EQ (m_nMpdus.size (), 2, "Unexpected number of transmitted packets");
910  NS_TEST_EXPECT_MSG_EQ (m_nMsdus.size (), 3, "Unexpected number of transmitted MPDUs");
911  NS_TEST_EXPECT_MSG_EQ (m_nMpdus[0], 1, "Unexpected number of MPDUs in the first A-MPDU");
912  NS_TEST_EXPECT_MSG_EQ (m_nMsdus[0], 1, "Unexpected number of MSDUs in the first MPDU");
913  NS_TEST_EXPECT_MSG_EQ (m_nMpdus[1], 2, "Unexpected number of MPDUs in the second A-MPDU");
914  NS_TEST_EXPECT_MSG_EQ (m_nMsdus[1], 4, "Unexpected number of MSDUs in the second MPDU");
915  NS_TEST_EXPECT_MSG_EQ (m_nMsdus[2], 3, "Unexpected number of MSDUs in the third MPDU");
916  // All the packets must have been forwarded up at the receiver
917  NS_TEST_EXPECT_MSG_EQ (m_packetList.empty (), true, "Some packets have not been forwarded up");
918 }
919 
927 {
928 public:
930 };
931 
933  : TestSuite ("wifi-aggregation", UNIT)
934 {
935  AddTestCase (new AmpduAggregationTest, TestCase::QUICK);
936  AddTestCase (new TwoLevelAggregationTest, TestCase::QUICK);
937  AddTestCase (new HeAggregationTest, TestCase::QUICK);
938  AddTestCase (new PreservePacketsInAmpdus, TestCase::QUICK);
939 }
940 
void Dispose(void)
Dispose of this Object.
Definition: object.cc:214
Ptr< StaWifiMac > m_mac
Mac.
ObjectFactory m_factory
factory
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
Definition: node.cc:159
Wifi Aggregation Test Suite.
Test for A-MSDU and A-MPDU aggregation.
Ptr< const WifiMacQueueItem > PeekNextMpdu(uint8_t tid=8, Mac48Address recipient=Mac48Address::GetBroadcast())
Peek the next frame to transmit to the given receiver and of the given TID from the block ack manager...
Definition: qos-txop.cc:277
void SetStopTime(Time stop)
Specify application stop time.
Definition: application.cc:75
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
std::list< Ptr< const Packet > > m_packetList
List of packets passed to the MAC.
std::vector< Ptr< WifiMacQueueItem > > GetNextAmpdu(Ptr< WifiMacQueueItem > mpdu, WifiTxParameters &txParams, Time availableTime, WifiMacQueueItem::QueueIteratorPair queueIt) const
Attempt to aggregate other MPDUs to the given MPDU, while meeting the following constraints: ...
AttributeValue implementation for Boolean.
Definition: boolean.h:36
virtual void SetProtectionManager(Ptr< WifiProtectionManager > protectionManager)
Set the Protection Manager to use.
DeaggregatedMsdusCI end(void)
Get a constant iterator indicating past-the-last MSDU in the list of aggregated MSDUs.
void SetLocal(PacketSocketAddress addr)
set the local address and protocol to be used
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
std::vector< std::size_t > m_nMpdus
Number of MPDUs in PSDUs passed to the PHY.
Ptr< WifiRemoteStationManager > m_manager
remote station manager
Hold variables of type string.
Definition: string.h:41
Make it easy to create and manage PHY objects for the YANS model.
void NotifyMacTransmit(Ptr< const Packet > packet)
Callback invoked when an MSDU is passed to the MAC.
ObjectFactory m_factory
factory
void MpduDiscarded(WifiMacDropReason reason, Ptr< const WifiMacQueueItem > mpdu)
Fired when the MAC discards an MPDU.
A suite of tests to run.
Definition: test.h:1343
void SetImmediateBlockAck()
Enable immediate BlockAck.
bool IsAmsduSupported(void) const
Return whether A-MSDU capability is supported.
virtual void ConfigureStandardAndBand(WifiPhyStandard standard, WifiPhyBand band)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:1069
DeaggregatedMsdusCI begin(void)
Get a constant iterator pointing to the first MSDU in the list of aggregated MSDUs.
void Clear(void)
Reset the TX parameters.
void SetBufferSize(uint16_t size)
Set buffer size.
Implement the header for management frames of type Add Block Ack request.
Definition: mgt-headers.h:990
void SetNoMoreFragments(void)
Un-set the More Fragment bit in the Frame Control Field.
an address for a packet socket
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > stationManager) override
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
U * PeekPointer(const Ptr< U > &p)
Definition: ptr.h:411
void SetHtConfiguration(Ptr< HtConfiguration > htConfiguration)
Information needed to remove an MSDU from the queue.
The HT Capabilities Information ElementThis class knows how to serialise and deserialise the HT Capab...
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.
Definition: test.h:283
Ptr< BlockAckManager > GetBaManager(void)
Get the Block Ack Manager associated with this QosTxop.
Definition: qos-txop.cc:155
staDevices
Definition: third.py:103
Ptr< WifiNetDevice > m_device
WifiNetDevice.
The 5 GHz band.
Definition: wifi-phy-band.h:37
encapsulates test code
Definition: test.h:1153
Ptr< StaWifiMac > m_mac
Mac.
ObjectFactory m_factory
factory
helps to create WifiNetDevice objects
Definition: wifi-helper.h:326
void SetStatusCode(StatusCode code)
Set the status code.
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(void) const override
uint16_t GetTimeout(void) const
Return the timeout.
Ptr< YansWifiPhy > m_phy
Phy.
void SetWifiPhy(const Ptr< WifiPhy > phy) override
Give ns3::PacketSocket powers to ns3::Node.
void SetTimeout(uint16_t timeout)
Set timeout.
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
void DoRun(void) override
Implementation to actually run this TestCase.
void SetMaxAmpduLength(uint32_t maxAmpduLength)
Set the maximum AMPDU length.
channel
Definition: third.py:92
mobility
Definition: third.py:108
void NotifyMacForwardUp(Ptr< const Packet > p)
Callback invoked when the receiver MAC forwards a packet up to the upper layer.
phy
Definition: third.py:93
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:777
void SetTid(uint8_t tid)
Set Traffic ID (TID).
void SetWifiMac(Ptr< RegularWifiMac > mac)
Set the MAC which is using this Acknowledgment Manager.
WifiTxVector GetDataTxVector(const WifiMacHeader &header)
void SetHeConfiguration(Ptr< HeConfiguration > heConfiguration)
virtual void SetAckManager(Ptr< WifiAckManager > ackManager)
Set the Acknowledgment Manager to use.
void SetSuccess(void)
Set success bit to 0 (success).
Definition: status-code.cc:30
void DoRun(void) override
Implementation to actually run this TestCase.
Ptr< WifiRemoteStationManager > m_manager
remote station manager
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-mac.cc:85
AttributeValue implementation for Time.
Definition: nstime.h:1353
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
void SetMac(const Ptr< WifiMac > mac)
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
void AddStationHtCapabilities(Mac48Address from, HtCapabilities htCapabilities)
Records HT capabilities of the remote station.
void SetImmediateBlockAck()
Enable immediate BlockAck.
Ptr< WifiNetDevice > m_device
WifiNetDevice.
Hold an unsigned integer type.
Definition: uinteger.h:44
Address GetAddress(void) const override
void SetTid(uint8_t tid)
Set Traffic ID (TID).
ssid
Definition: third.py:100
void SetWifiMac(Ptr< RegularWifiMac > mac)
Set the MAC which is using this Protection Manager.
holds a vector of ns3::NetDevice pointers
mac
Definition: third.py:99
void DequeueMpdu(Ptr< WifiMacQueueItem > mpdu) override
Dequeue the given MPDU from the queue in which it is stored.
void SetMaxSsrc(uint32_t maxSsrc)
Sets the maximum STA short retry count (SSRC).
void AddStationHeCapabilities(Mac48Address from, HeCapabilities heCapabilities)
Records HE capabilities of the remote station.
Ptr< StaWifiMac > m_mac
Mac.
void SetStartingSequence(uint16_t seq)
Set the starting sequence number.
wifiApNode
Definition: third.py:90
bool m_discarded
whether the packet should be discarded
Ptr< WifiNetDevice > m_device
WifiNetDevice.
void SetAddress(Mac48Address address) override
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.
void DoRunSubTest(uint16_t bufferSize)
Run test for a given buffer size.
void SetQosTid(uint8_t tid)
Set the TID for the QoS header.
Ptr< FrameExchangeManager > GetFrameExchangeManager(void) const
Get the Frame Exchange Manager.
Status code for association response.
Definition: status-code.h:31
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Definition: object-base.cc:293
void SetNoRetry(void)
Un-set the Retry bit in the Frame Control field.
WifiTxVector m_txVector
TXVECTOR of the frame being prepared.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
static WifiAggregationTestSuite g_wifiAggregationTestSuite
the test suite
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
void SetBufferSize(uint16_t size)
Set buffer size.
an EUI-48 address
Definition: mac48-address.h:43
Ptr< QosTxop > GetVIQueue(void) const
Accessor for the AC_VI channel access function.
manage and create wifi channel objects for the YANS model.
create MAC layers for a ns3::WifiNetDevice.
void DoRun(void) override
Implementation to actually run this TestCase.
void SetMaxAmsduLength(uint16_t maxAmsduLength)
Set the maximum AMSDU length.
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:35
Two Level Aggregation Test.
Ampdu Aggregation Test.
uint8_t GetTid(void) const
Return the Traffic ID (TID).
wifi
Definition: third.py:96
Helper class used to assign positions and mobility models to nodes.
void SetType(WifiMacType type, bool resetToDsFromDs=true)
Set Type/Subtype values with the correct values depending on the given type.
Ptr< MpduAggregator > GetMpduAggregator(void) const
Returns the aggregator used to construct A-MPDU subframes.
Instantiate subclasses of ns3::Object.
void SetPhy(const Ptr< WifiPhy > phy)
Ptr< QosTxop > GetBEQueue(void) const
Accessor for the AC_BE channel access function.
Ptr< WifiMac > GetMac(void) const
void DoRun(void) override
Implementation to actually run this TestCase.
void NormalAckTimeout(Ptr< WifiMacQueueItem > mpdu, const WifiTxVector &txVector)
Called when the Ack timeout expires.
void SetSequenceNumber(uint16_t seq)
Set the sequence number of the header.
void SetRemote(PacketSocketAddress addr)
set the remote address and protocol to be used
Ptr< MsduAggregator > GetMsduAggregator(void) const
Returns the aggregator used to construct A-MSDU subframes.
802.11ax aggregation test which permits 64 or 256 MPDUs in A-MPDU according to the negociated buffer ...
Implement the header for management frames of type Add Block Ack response.
Definition: mgt-headers.h:1122
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
AttributeValue implementation for Ssid.
Definition: ssid.h:105
Ptr< WifiMacQueue > GetWifiMacQueue() const
Return the packet queue associated with this Txop.
Definition: txop.cc:150
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism...
Ptr< Txop > m_dcf
the DCF/EDCAF that gained channel access
#define Min(a, b)
void Add(Vector v)
Add a position to the list of positions.
void ConfigureStandard(WifiStandard standard) override
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
apDevices
Definition: third.py:106
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1305
Ptr< YansWifiPhy > m_phy
Phy.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void SetAmsduSupport(bool supported)
Enable or disable A-MSDU support.
void SetTimeout(uint16_t timeout)
Set timeout.
Ptr< WifiMacQueueItem > GetNextMpdu(Ptr< const WifiMacQueueItem > peekedItem, WifiTxParameters &txParams, Time availableTime, bool initialFrame, WifiMacQueueItem::QueueIteratorPair &queueIt)
Prepare the frame to transmit starting from the MPDU that has been previously peeked by calling PeekN...
Definition: qos-txop.cc:359
void NotifyPsduForwardedDown(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
Callback invoked when the sender MAC passes a PSDU(s) to the PHY.
bool TryAddMpdu(Ptr< const WifiMacQueueItem > mpdu, WifiTxParameters &txParams, Time availableTime) const
Recompute the protection and acknowledgment methods to use if the given MPDU is added to the frame be...
uint32_t GetPacketSize(void) const
Return the size in bytes of the packet or control header or management header stored by this item...
Ptr< YansWifiPhy > m_phy
Phy.
void SetFragmentNumber(uint8_t frag)
Set the fragment number of the header.
The IEEE 802.11ax HE Capabilities.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:185
void DequeuePsdu(Ptr< const WifiPsdu > psdu)
Dequeue the MPDUs of the given PSDU from the queue in which they are stored.
void SetStartTime(Time start)
Specify application start time.
Definition: application.cc:69
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
#define SU_STA_ID
Definition: wifi-mode.h:32
void SetVhtConfiguration(Ptr< VhtConfiguration > vhtConfiguration)
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:1642
WifiMacDropReason
The reason why an MPDU was dropped.
Definition: wifi-mac.h:54
Ptr< MacTxMiddle > m_txMiddle
TX middle (aggregation etc.)
std::vector< std::size_t > m_nMsdus
Number of MSDUs in MPDUs passed to the PHY.
Implements the IEEE 802.11 MAC header.
void SetRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)
Ptr< WifiRemoteStationManager > m_manager
remote station manager
Time GetTxopLimit(void) const
Return the TXOP limit.
Definition: txop.cc:274