A Discrete-Event Network Simulator
API
regular-wifi-mac.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 
21 #include "ns3/log.h"
22 #include "ns3/pointer.h"
23 #include "ns3/packet.h"
24 #include "regular-wifi-mac.h"
25 #include "wifi-phy.h"
26 #include "mac-rx-middle.h"
27 #include "mac-tx-middle.h"
28 #include "mac-low.h"
29 #include "msdu-aggregator.h"
30 #include "mpdu-aggregator.h"
31 #include "mgt-headers.h"
32 #include "amsdu-subframe-header.h"
33 #include "wifi-net-device.h"
34 #include "ht-configuration.h"
35 #include "vht-configuration.h"
36 #include "he-configuration.h"
37 #include <algorithm>
38 #include <cmath>
39 
40 namespace ns3 {
41 
42 NS_LOG_COMPONENT_DEFINE ("RegularWifiMac");
43 
44 NS_OBJECT_ENSURE_REGISTERED (RegularWifiMac);
45 
47  : m_qosSupported (0),
48  m_erpSupported (0),
49  m_dsssSupported (0)
50 {
51  NS_LOG_FUNCTION (this);
52  m_rxMiddle = Create<MacRxMiddle> ();
53  m_rxMiddle->SetForwardCallback (MakeCallback (&RegularWifiMac::Receive, this));
54 
55  m_txMiddle = Create<MacTxMiddle> ();
56 
57  m_low = CreateObject<MacLow> ();
59  m_low->SetMac (this);
60 
61  m_channelAccessManager = CreateObject<ChannelAccessManager> ();
63 
64  m_txop = CreateObject<Txop> ();
71 
72  //Construct the EDCAFs. The ordering is important - highest
73  //priority (Table 9-1 UP-to-AC mapping; IEEE 802.11-2012) must be created
74  //first.
79 }
80 
82 {
83  NS_LOG_FUNCTION (this);
84 }
85 
86 void
88 {
89  NS_LOG_FUNCTION (this);
90  m_txop->Initialize ();
91 
92  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
93  {
94  i->second->Initialize ();
95  }
96 }
97 
98 void
100 {
101  NS_LOG_FUNCTION (this);
102 
103  m_rxMiddle = 0;
104  m_txMiddle = 0;
105 
106  m_low->Dispose ();
107  m_low = 0;
108 
109  m_phy = 0;
110  m_stationManager = 0;
111 
112  m_txop->Dispose ();
113  m_txop = 0;
114 
115  for (EdcaQueues::iterator i = m_edca.begin (); i != m_edca.end (); ++i)
116  {
117  i->second->Dispose ();
118  i->second = 0;
119  }
120 
123 
125 }
126 
127 void
129 {
130  NS_LOG_FUNCTION (this << stationManager);
131  m_stationManager = stationManager;
132  m_low->SetWifiRemoteStationManager (stationManager);
133  m_txop->SetWifiRemoteStationManager (stationManager);
134  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
135  {
136  i->second->SetWifiRemoteStationManager (stationManager);
137  }
138 }
139 
142 {
143  return m_stationManager;
144 }
145 
148 {
149  NS_LOG_FUNCTION (this);
150  ExtendedCapabilities capabilities;
151  capabilities.SetHtSupported (GetHtSupported ());
152  capabilities.SetVhtSupported (GetVhtSupported ());
153  //TODO: to be completed
154  return capabilities;
155 }
156 
159 {
160  NS_LOG_FUNCTION (this);
161  HtCapabilities capabilities;
162  if (GetHtSupported ())
163  {
164  Ptr<HtConfiguration> htConfiguration = GetHtConfiguration ();
165  bool greenfieldSupported = htConfiguration->GetGreenfieldSupported ();
166  bool sgiSupported = htConfiguration->GetShortGuardIntervalSupported ();
167  capabilities.SetHtSupported (1);
168  capabilities.SetLdpc (htConfiguration->GetLdpcSupported ());
169  capabilities.SetSupportedChannelWidth (m_phy->GetChannelWidth () >= 40);
170  capabilities.SetShortGuardInterval20 (sgiSupported);
171  capabilities.SetShortGuardInterval40 (m_phy->GetChannelWidth () >= 40 && sgiSupported);
172  capabilities.SetGreenfield (greenfieldSupported);
173  // Set Maximum A-MSDU Length subfield
174  uint16_t maxAmsduSize = std::max ({m_voMaxAmsduSize, m_viMaxAmsduSize,
176  if (maxAmsduSize <= 3839)
177  {
178  capabilities.SetMaxAmsduLength (3839);
179  }
180  else
181  {
182  capabilities.SetMaxAmsduLength (7935);
183  }
184  uint32_t maxAmpduLength = std::max ({m_voMaxAmpduSize, m_viMaxAmpduSize,
186  // round to the next power of two minus one
187  maxAmpduLength = (1ul << static_cast<uint32_t> (std::ceil (std::log2 (maxAmpduLength + 1)))) - 1;
188  // The maximum A-MPDU length in HT capabilities elements ranges from 2^13-1 to 2^16-1
189  capabilities.SetMaxAmpduLength (std::min (std::max (maxAmpduLength, 8191u), 65535u));
190 
191  capabilities.SetLSigProtectionSupport (!greenfieldSupported);
192  uint64_t maxSupportedRate = 0; //in bit/s
193  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
194  {
195  WifiMode mcs = m_phy->GetMcs (i);
197  {
198  continue;
199  }
200  capabilities.SetRxMcsBitmask (mcs.GetMcsValue ());
201  uint8_t nss = (mcs.GetMcsValue () / 8) + 1;
202  NS_ASSERT (nss > 0 && nss < 5);
203  uint64_t dataRate = mcs.GetDataRate (m_phy->GetChannelWidth (), sgiSupported ? 400 : 800, nss);
204  if (dataRate > maxSupportedRate)
205  {
206  maxSupportedRate = dataRate;
207  NS_LOG_DEBUG ("Updating maxSupportedRate to " << maxSupportedRate);
208  }
209  }
210  capabilities.SetRxHighestSupportedDataRate (static_cast<uint16_t> (maxSupportedRate / 1e6)); //in Mbit/s
211  capabilities.SetTxMcsSetDefined (m_phy->GetNMcs () > 0);
213  //we do not support unequal modulations
214  capabilities.SetTxRxMcsSetUnequal (0);
215  capabilities.SetTxUnequalModulation (0);
216  }
217  return capabilities;
218 }
219 
222 {
223  NS_LOG_FUNCTION (this);
224  VhtCapabilities capabilities;
225  if (GetVhtSupported ())
226  {
227  Ptr<HtConfiguration> htConfiguration = GetHtConfiguration ();
228  Ptr<VhtConfiguration> vhtConfiguration = GetVhtConfiguration ();
229  bool sgiSupported = htConfiguration->GetShortGuardIntervalSupported ();
230  capabilities.SetVhtSupported (1);
231  if (m_phy->GetChannelWidth () == 160)
232  {
233  capabilities.SetSupportedChannelWidthSet (1);
234  }
235  else
236  {
237  capabilities.SetSupportedChannelWidthSet (0);
238  }
239  // Set Maximum MPDU Length subfield
240  uint16_t maxAmsduSize = std::max ({m_voMaxAmsduSize, m_viMaxAmsduSize,
242  if (maxAmsduSize <= 3839)
243  {
244  capabilities.SetMaxMpduLength (3895);
245  }
246  else if (maxAmsduSize <= 7935)
247  {
248  capabilities.SetMaxMpduLength (7991);
249  }
250  else
251  {
252  capabilities.SetMaxMpduLength (11454);
253  }
254  uint32_t maxAmpduLength = std::max ({m_voMaxAmpduSize, m_viMaxAmpduSize,
256  // round to the next power of two minus one
257  maxAmpduLength = (1ul << static_cast<uint32_t> (std::ceil (std::log2 (maxAmpduLength + 1)))) - 1;
258  // The maximum A-MPDU length in VHT capabilities elements ranges from 2^13-1 to 2^20-1
259  capabilities.SetMaxAmpduLength (std::min (std::max (maxAmpduLength, 8191u), 1048575u));
260 
261  capabilities.SetRxLdpc (htConfiguration->GetLdpcSupported ());
262  capabilities.SetShortGuardIntervalFor80Mhz ((m_phy->GetChannelWidth () == 80) && sgiSupported);
263  capabilities.SetShortGuardIntervalFor160Mhz ((m_phy->GetChannelWidth () == 160) && sgiSupported);
264  uint8_t maxMcs = 0;
265  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
266  {
267  WifiMode mcs = m_phy->GetMcs (i);
268  if ((mcs.GetModulationClass () == WIFI_MOD_CLASS_VHT)
269  && (mcs.GetMcsValue () > maxMcs))
270  {
271  maxMcs = mcs.GetMcsValue ();
272  }
273  }
274  // Support same MaxMCS for each spatial stream
275  for (uint8_t nss = 1; nss <= m_phy->GetMaxSupportedRxSpatialStreams (); nss++)
276  {
277  capabilities.SetRxMcsMap (maxMcs, nss);
278  }
279  for (uint8_t nss = 1; nss <= m_phy->GetMaxSupportedTxSpatialStreams (); nss++)
280  {
281  capabilities.SetTxMcsMap (maxMcs, nss);
282  }
283  uint64_t maxSupportedRateLGI = 0; //in bit/s
284  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
285  {
286  WifiMode mcs = m_phy->GetMcs (i);
288  {
289  continue;
290  }
291  if (mcs.GetDataRate (m_phy->GetChannelWidth ()) > maxSupportedRateLGI)
292  {
293  maxSupportedRateLGI = mcs.GetDataRate (m_phy->GetChannelWidth ());
294  NS_LOG_DEBUG ("Updating maxSupportedRateLGI to " << maxSupportedRateLGI);
295  }
296  }
297  capabilities.SetRxHighestSupportedLgiDataRate (static_cast<uint16_t> (maxSupportedRateLGI / 1e6)); //in Mbit/s
298  capabilities.SetTxHighestSupportedLgiDataRate (static_cast<uint16_t> (maxSupportedRateLGI / 1e6)); //in Mbit/s
299  //To be filled in once supported
300  capabilities.SetRxStbc (0);
301  capabilities.SetTxStbc (0);
302  }
303  return capabilities;
304 }
305 
308 {
309  NS_LOG_FUNCTION (this);
310  HeCapabilities capabilities;
311  if (GetHeSupported ())
312  {
313  Ptr<HtConfiguration> htConfiguration = GetHtConfiguration ();
314  Ptr<HeConfiguration> heConfiguration = GetHeConfiguration ();
315  capabilities.SetHeSupported (1);
316  uint8_t channelWidthSet = 0;
317  if ((m_phy->GetChannelWidth () >= 40) && (m_phy->GetPhyBand () == WIFI_PHY_BAND_2_4GHZ))
318  {
319  channelWidthSet |= 0x01;
320  }
322  {
323  channelWidthSet |= 0x02;
324  }
325  if ((m_phy->GetChannelWidth () >= 160) && ((m_phy->GetPhyBand () == WIFI_PHY_BAND_5GHZ) || (m_phy->GetPhyBand () == WIFI_PHY_BAND_6GHZ)))
326  {
327  channelWidthSet |= 0x04;
328  }
329  capabilities.SetChannelWidthSet (channelWidthSet);
330  capabilities.SetLdpcCodingInPayload (htConfiguration->GetLdpcSupported ());
331  uint8_t gi = 0;
332  if (heConfiguration->GetGuardInterval () <= NanoSeconds (1600))
333  {
334  //todo: We assume for now that if we support 800ns GI then 1600ns GI is supported as well
335  gi |= 0x01;
336  }
337  if (heConfiguration->GetGuardInterval () == NanoSeconds (800))
338  {
339  gi |= 0x02;
340  }
341  capabilities.SetHeLtfAndGiForHePpdus (gi);
342  uint32_t maxAmpduLength = std::max ({m_voMaxAmpduSize, m_viMaxAmpduSize,
344  // round to the next power of two minus one
345  maxAmpduLength = (1ul << static_cast<uint32_t> (std::ceil (std::log2 (maxAmpduLength + 1)))) - 1;
346  // The maximum A-MPDU length in HE capabilities elements ranges from 2^20-1 to 2^23-1
347  capabilities.SetMaxAmpduLength (std::min (std::max (maxAmpduLength, 1048575u), 8388607u));
348 
349  uint8_t maxMcs = 0;
350  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
351  {
352  WifiMode mcs = m_phy->GetMcs (i);
353  if ((mcs.GetModulationClass () == WIFI_MOD_CLASS_HE)
354  && (mcs.GetMcsValue () > maxMcs))
355  {
356  maxMcs = mcs.GetMcsValue ();
357  }
358  }
359  capabilities.SetHighestMcsSupported (maxMcs);
361  }
362  return capabilities;
363 }
364 
365 void
367 {
368  NS_LOG_FUNCTION (this << +threshold);
369  GetVOQueue ()->SetBlockAckThreshold (threshold);
370 }
371 
372 void
374 {
375  NS_LOG_FUNCTION (this << +threshold);
376  GetVIQueue ()->SetBlockAckThreshold (threshold);
377 }
378 
379 void
381 {
382  NS_LOG_FUNCTION (this << +threshold);
383  GetBEQueue ()->SetBlockAckThreshold (threshold);
384 }
385 
386 void
388 {
389  NS_LOG_FUNCTION (this << +threshold);
390  GetBKQueue ()->SetBlockAckThreshold (threshold);
391 }
392 
393 void
395 {
396  NS_LOG_FUNCTION (this << timeout);
398 }
399 
400 void
402 {
403  NS_LOG_FUNCTION (this << timeout);
405 }
406 
407 void
409 {
410  NS_LOG_FUNCTION (this << timeout);
412 }
413 
414 void
416 {
417  NS_LOG_FUNCTION (this << timeout);
419 }
420 
421 void
423 {
424  NS_LOG_FUNCTION (this << ac);
425 
426  //Our caller shouldn't be attempting to setup a queue that is
427  //already configured.
428  NS_ASSERT (m_edca.find (ac) == m_edca.end ());
429 
430  Ptr<QosTxop> edca = CreateObject<QosTxop> ();
431  edca->SetMacLow (m_low);
432  edca->SetChannelAccessManager (m_channelAccessManager);
433  edca->SetTxMiddle (m_txMiddle);
434  edca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this));
435  edca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this));
436  edca->SetTxDroppedCallback (MakeCallback (&RegularWifiMac::NotifyTxDrop, this));
437  edca->SetAccessCategory (ac);
438  edca->CompleteConfig ();
439 
440  m_edca.insert (std::make_pair (ac, edca));
441 }
442 
443 void
445 {
446  NS_LOG_FUNCTION (this << type);
447  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
448  {
449  i->second->SetTypeOfStation (type);
450  }
451 }
452 
453 Ptr<Txop>
455 {
456  return m_txop;
457 }
458 
461 {
462  return m_edca.find (AC_VO)->second;
463 }
464 
467 {
468  return m_edca.find (AC_VI)->second;
469 }
470 
473 {
474  return m_edca.find (AC_BE)->second;
475 }
476 
479 {
480  return m_edca.find (AC_BK)->second;
481 }
482 
483 void
485 {
486  NS_LOG_FUNCTION (this << phy);
487  m_phy = phy;
489  m_low->SetPhy (phy);
490 }
491 
494 {
495  NS_LOG_FUNCTION (this);
496  return m_phy;
497 }
498 
499 void
501 {
502  NS_LOG_FUNCTION (this);
503  m_low->ResetPhy ();
505  m_phy = 0;
506 }
507 
508 void
510 {
511  NS_LOG_FUNCTION (this);
512  m_forwardUp = upCallback;
513 }
514 
515 void
517 {
518  NS_LOG_FUNCTION (this);
519  m_linkUp = linkUp;
520 }
521 
522 void
524 {
525  NS_LOG_FUNCTION (this);
526  m_linkDown = linkDown;
527 }
528 
529 void
531 {
532  NS_LOG_FUNCTION (this << enable);
533  m_qosSupported = enable;
534 }
535 
536 bool
538 {
539  return m_qosSupported;
540 }
541 
542 bool
544 {
545  if (GetHtConfiguration ())
546  {
547  return true;
548  }
549  return false;
550 }
551 
552 bool
554 {
555  if (GetVhtConfiguration ())
556  {
557  return true;
558  }
559  return false;
560 }
561 
562 bool
564 {
565  if (GetHeConfiguration ())
566  {
567  return true;
568  }
569  return false;
570 }
571 
572 bool
574 {
575  return m_erpSupported;
576 }
577 
578 void
580 {
581  NS_LOG_FUNCTION (this);
582  if (enable)
583  {
584  SetDsssSupported (true);
585  }
586  m_erpSupported = enable;
587 }
588 
589 void
591 {
592  NS_LOG_FUNCTION (this);
593  m_dsssSupported = enable;
594 }
595 
596 bool
598 {
599  return m_dsssSupported;
600 }
601 
602 void
604 {
605  NS_LOG_FUNCTION (this);
606  m_low->SetCtsToSelfSupported (enable);
607 }
608 
609 void
611 {
612  NS_LOG_FUNCTION (this << address);
613  m_low->SetAddress (address);
614 }
615 
618 {
619  return m_low->GetAddress ();
620 }
621 
622 void
624 {
625  NS_LOG_FUNCTION (this << ssid);
626  m_ssid = ssid;
627 }
628 
629 Ssid
631 {
632  return m_ssid;
633 }
634 
635 void
637 {
638  NS_LOG_FUNCTION (this << bssid);
639  m_low->SetBssid (bssid);
640 }
641 
644 {
645  return m_low->GetBssid ();
646 }
647 
648 void
650 {
651  m_low->SetPromisc ();
652 }
653 
654 void
656 {
657  NS_LOG_FUNCTION (this << enable);
658  m_shortSlotTimeSupported = enable;
659 }
660 
661 bool
663 {
665 }
666 
667 void
669  Mac48Address to, Mac48Address from)
670 {
671  //We expect RegularWifiMac subclasses which do support forwarding (e.g.,
672  //AP) to override this method. Therefore, we throw a fatal error if
673  //someone tries to invoke this method on a class which has not done
674  //this.
675  NS_FATAL_ERROR ("This MAC entity (" << this << ", " << GetAddress ()
676  << ") does not support Enqueue() with from address");
677 }
678 
679 bool
681 {
682  return false;
683 }
684 
685 void
687 {
688  NS_LOG_FUNCTION (this << packet << from << to);
689  m_forwardUp (packet, from, to);
690 }
691 
692 void
694 {
695  NS_LOG_FUNCTION (this << *mpdu);
696 
697  const WifiMacHeader* hdr = &mpdu->GetHeader ();
698  Ptr<Packet> packet = mpdu->GetPacket ()->Copy ();
699  Mac48Address to = hdr->GetAddr1 ();
700  Mac48Address from = hdr->GetAddr2 ();
701 
702  //We don't know how to deal with any frame that is not addressed to
703  //us (and odds are there is nothing sensible we could do anyway),
704  //so we ignore such frames.
705  //
706  //The derived class may also do some such filtering, but it doesn't
707  //hurt to have it here too as a backstop.
708  if (to != GetAddress ())
709  {
710  return;
711  }
712 
713  if (hdr->IsMgt () && hdr->IsAction ())
714  {
715  //There is currently only any reason for Management Action
716  //frames to be flying about if we are a QoS STA.
718 
719  WifiActionHeader actionHdr;
720  packet->RemoveHeader (actionHdr);
721 
722  switch (actionHdr.GetCategory ())
723  {
725 
726  switch (actionHdr.GetAction ().blockAck)
727  {
729  {
730  MgtAddBaRequestHeader reqHdr;
731  packet->RemoveHeader (reqHdr);
732 
733  //We've received an ADDBA Request. Our policy here is
734  //to automatically accept it, so we get the ADDBA
735  //Response on it's way immediately.
736  SendAddBaResponse (&reqHdr, from);
737  //This frame is now completely dealt with, so we're done.
738  return;
739  }
741  {
742  MgtAddBaResponseHeader respHdr;
743  packet->RemoveHeader (respHdr);
744 
745  //We've received an ADDBA Response. We assume that it
746  //indicates success after an ADDBA Request we have
747  //sent (we could, in principle, check this, but it
748  //seems a waste given the level of the current model)
749  //and act by locally establishing the agreement on
750  //the appropriate queue.
751  AcIndex ac = QosUtilsMapTidToAc (respHdr.GetTid ());
752  m_edca[ac]->GotAddBaResponse (&respHdr, from);
753  //This frame is now completely dealt with, so we're done.
754  return;
755  }
757  {
758  MgtDelBaHeader delBaHdr;
759  packet->RemoveHeader (delBaHdr);
760 
761  if (delBaHdr.IsByOriginator ())
762  {
763  //This DELBA frame was sent by the originator, so
764  //this means that an ingoing established
765  //agreement exists in MacLow and we need to
766  //destroy it.
767  m_low->DestroyBlockAckAgreement (from, delBaHdr.GetTid ());
768  }
769  else
770  {
771  //We must have been the originator. We need to
772  //tell the correct queue that the agreement has
773  //been torn down
774  AcIndex ac = QosUtilsMapTidToAc (delBaHdr.GetTid ());
775  m_edca[ac]->GotDelBaFrame (&delBaHdr, from);
776  }
777  //This frame is now completely dealt with, so we're done.
778  return;
779  }
780  default:
781  NS_FATAL_ERROR ("Unsupported Action field in Block Ack Action frame");
782  return;
783  }
784  default:
785  NS_FATAL_ERROR ("Unsupported Action frame received");
786  return;
787  }
788  }
789  NS_FATAL_ERROR ("Don't know how to handle frame (type=" << hdr->GetType ());
790 }
791 
792 void
794 {
795  NS_LOG_FUNCTION (this << *mpdu);
796  for (auto& msduPair : *PeekPointer (mpdu))
797  {
798  ForwardUp (msduPair.first, msduPair.second.GetSourceAddr (),
799  msduPair.second.GetDestinationAddr ());
800  }
801 }
802 
803 void
805  Mac48Address originator)
806 {
807  NS_LOG_FUNCTION (this);
808  WifiMacHeader hdr;
810  hdr.SetAddr1 (originator);
811  hdr.SetAddr2 (GetAddress ());
812  hdr.SetAddr3 (GetBssid ());
813  hdr.SetDsNotFrom ();
814  hdr.SetDsNotTo ();
815 
816  MgtAddBaResponseHeader respHdr;
817  StatusCode code;
818  code.SetSuccess ();
819  respHdr.SetStatusCode (code);
820  //Here a control about queues type?
821  respHdr.SetAmsduSupport (reqHdr->IsAmsduSupported ());
822 
823  if (reqHdr->IsImmediateBlockAck ())
824  {
825  respHdr.SetImmediateBlockAck ();
826  }
827  else
828  {
829  respHdr.SetDelayedBlockAck ();
830  }
831  respHdr.SetTid (reqHdr->GetTid ());
832 
833  Ptr<HeConfiguration> heConfiguration = GetHeConfiguration ();
834  if (heConfiguration && heConfiguration->GetMpduBufferSize () > 64)
835  {
836  respHdr.SetBufferSize (255);
837  }
838  else
839  {
840  respHdr.SetBufferSize (63);
841  }
842  respHdr.SetTimeout (reqHdr->GetTimeout ());
843 
844  WifiActionHeader actionHdr;
847  actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
848 
849  Ptr<Packet> packet = Create<Packet> ();
850  packet->AddHeader (respHdr);
851  packet->AddHeader (actionHdr);
852 
853  //We need to notify our MacLow object as it will have to buffer all
854  //correctly received packets for this Block Ack session
855  m_low->CreateBlockAckAgreement (&respHdr, originator,
856  reqHdr->GetStartingSequence ());
857 
858  //It is unclear which queue this frame should go into. For now we
859  //bung it into the queue corresponding to the TID for which we are
860  //establishing an agreement, and push it to the head.
861  m_edca[QosUtilsMapTidToAc (reqHdr->GetTid ())]->PushFront (packet, hdr);
862 }
863 
864 TypeId
866 {
867  static TypeId tid = TypeId ("ns3::RegularWifiMac")
868  .SetParent<WifiMac> ()
869  .SetGroupName ("Wifi")
870  .AddAttribute ("QosSupported",
871  "This Boolean attribute is set to enable 802.11e/WMM-style QoS support at this STA.",
872  BooleanValue (false),
876  .AddAttribute ("CtsToSelfSupported",
877  "Use CTS to Self when using a rate that is not in the basic rate set.",
878  BooleanValue (false),
881  .AddAttribute ("VO_MaxAmsduSize",
882  "Maximum length in bytes of an A-MSDU for AC_VO access class "
883  "(capped to 7935 for HT PPDUs and 11398 for VHT/HE PPDUs). "
884  "Value 0 means A-MSDU aggregation is disabled for that AC.",
885  UintegerValue (0),
887  MakeUintegerChecker<uint16_t> (0, 11398))
888  .AddAttribute ("VI_MaxAmsduSize",
889  "Maximum length in bytes of an A-MSDU for AC_VI access class "
890  "(capped to 7935 for HT PPDUs and 11398 for VHT/HE PPDUs). "
891  "Value 0 means A-MSDU aggregation is disabled for that AC.",
892  UintegerValue (0),
894  MakeUintegerChecker<uint16_t> (0, 11398))
895  .AddAttribute ("BE_MaxAmsduSize",
896  "Maximum length in bytes of an A-MSDU for AC_BE access class "
897  "(capped to 7935 for HT PPDUs and 11398 for VHT/HE PPDUs). "
898  "Value 0 means A-MSDU aggregation is disabled for that AC.",
899  UintegerValue (0),
901  MakeUintegerChecker<uint16_t> (0, 11398))
902  .AddAttribute ("BK_MaxAmsduSize",
903  "Maximum length in bytes of an A-MSDU for AC_BK access class "
904  "(capped to 7935 for HT PPDUs and 11398 for VHT/HE PPDUs). "
905  "Value 0 means A-MSDU aggregation is disabled for that AC.",
906  UintegerValue (0),
908  MakeUintegerChecker<uint16_t> (0, 11398))
909  .AddAttribute ("VO_MaxAmpduSize",
910  "Maximum length in bytes of an A-MPDU for AC_VO access class "
911  "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, and 8388607 for HE PPDUs). "
912  "Value 0 means A-MPDU aggregation is disabled for that AC.",
913  UintegerValue (0),
915  MakeUintegerChecker<uint32_t> ())
916  .AddAttribute ("VI_MaxAmpduSize",
917  "Maximum length in bytes of an A-MPDU for AC_VI access class "
918  "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, and 8388607 for HE PPDUs). "
919  "Value 0 means A-MPDU aggregation is disabled for that AC.",
920  UintegerValue (65535),
922  MakeUintegerChecker<uint32_t> ())
923  .AddAttribute ("BE_MaxAmpduSize",
924  "Maximum length in bytes of an A-MPDU for AC_BE access class "
925  "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, and 8388607 for HE PPDUs). "
926  "Value 0 means A-MPDU aggregation is disabled for that AC.",
927  UintegerValue (65535),
929  MakeUintegerChecker<uint32_t> ())
930  .AddAttribute ("BK_MaxAmpduSize",
931  "Maximum length in bytes of an A-MPDU for AC_BK access class "
932  "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, and 8388607 for HE PPDUs). "
933  "Value 0 means A-MPDU aggregation is disabled for that AC.",
934  UintegerValue (0),
936  MakeUintegerChecker<uint32_t> ())
937  .AddAttribute ("VO_BlockAckThreshold",
938  "If number of packets in VO queue reaches this value, "
939  "block ack mechanism is used. If this value is 0, block ack is never used."
940  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
941  UintegerValue (0),
943  MakeUintegerChecker<uint8_t> (0, 64))
944  .AddAttribute ("VI_BlockAckThreshold",
945  "If number of packets in VI queue reaches this value, "
946  "block ack mechanism is used. If this value is 0, block ack is never used."
947  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
948  UintegerValue (0),
950  MakeUintegerChecker<uint8_t> (0, 64))
951  .AddAttribute ("BE_BlockAckThreshold",
952  "If number of packets in BE queue reaches this value, "
953  "block ack mechanism is used. If this value is 0, block ack is never used."
954  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
955  UintegerValue (0),
957  MakeUintegerChecker<uint8_t> (0, 64))
958  .AddAttribute ("BK_BlockAckThreshold",
959  "If number of packets in BK queue reaches this value, "
960  "block ack mechanism is used. If this value is 0, block ack is never used."
961  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
962  UintegerValue (0),
964  MakeUintegerChecker<uint8_t> (0, 64))
965  .AddAttribute ("VO_BlockAckInactivityTimeout",
966  "Represents max time (blocks of 1024 microseconds) allowed for block ack"
967  "inactivity for AC_VO. If this value isn't equal to 0 a timer start after that a"
968  "block ack setup is completed and will be reset every time that a block ack"
969  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
970  UintegerValue (0),
972  MakeUintegerChecker<uint16_t> ())
973  .AddAttribute ("VI_BlockAckInactivityTimeout",
974  "Represents max time (blocks of 1024 microseconds) allowed for block ack"
975  "inactivity for AC_VI. If this value isn't equal to 0 a timer start after that a"
976  "block ack setup is completed and will be reset every time that a block ack"
977  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
978  UintegerValue (0),
980  MakeUintegerChecker<uint16_t> ())
981  .AddAttribute ("BE_BlockAckInactivityTimeout",
982  "Represents max time (blocks of 1024 microseconds) allowed for block ack"
983  "inactivity for AC_BE. If this value isn't equal to 0 a timer start after that a"
984  "block ack setup is completed and will be reset every time that a block ack"
985  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
986  UintegerValue (0),
988  MakeUintegerChecker<uint16_t> ())
989  .AddAttribute ("BK_BlockAckInactivityTimeout",
990  "Represents max time (blocks of 1024 microseconds) allowed for block ack"
991  "inactivity for AC_BK. If this value isn't equal to 0 a timer start after that a"
992  "block ack setup is completed and will be reset every time that a block ack"
993  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
994  UintegerValue (0),
996  MakeUintegerChecker<uint16_t> ())
997  .AddAttribute ("ShortSlotTimeSupported",
998  "Whether or not short slot time is supported (only used by ERP APs or STAs).",
999  BooleanValue (true),
1002  MakeBooleanChecker ())
1003  .AddAttribute ("Txop",
1004  "The Txop object.",
1005  PointerValue (),
1007  MakePointerChecker<Txop> ())
1008  .AddAttribute ("VO_Txop",
1009  "Queue that manages packets belonging to AC_VO access class.",
1010  PointerValue (),
1012  MakePointerChecker<QosTxop> ())
1013  .AddAttribute ("VI_Txop",
1014  "Queue that manages packets belonging to AC_VI access class.",
1015  PointerValue (),
1017  MakePointerChecker<QosTxop> ())
1018  .AddAttribute ("BE_Txop",
1019  "Queue that manages packets belonging to AC_BE access class.",
1020  PointerValue (),
1022  MakePointerChecker<QosTxop> ())
1023  .AddAttribute ("BK_Txop",
1024  "Queue that manages packets belonging to AC_BK access class.",
1025  PointerValue (),
1027  MakePointerChecker<QosTxop> ())
1028  .AddTraceSource ("TxOkHeader",
1029  "The header of successfully transmitted packet.",
1031  "ns3::WifiMacHeader::TracedCallback")
1032  .AddTraceSource ("TxErrHeader",
1033  "The header of unsuccessfully transmitted packet.",
1035  "ns3::WifiMacHeader::TracedCallback")
1036  ;
1037  return tid;
1038 }
1039 
1040 void
1042 {
1043  NS_LOG_FUNCTION (this << standard);
1044  uint32_t cwmin = 0;
1045  uint32_t cwmax = 0;
1046  switch (standard)
1047  {
1049  case WIFI_STANDARD_80211ac:
1052  {
1053  EnableAggregation ();
1054  SetQosSupported (true);
1055  cwmin = 15;
1056  cwmax = 1023;
1057  break;
1058  }
1061  {
1062  EnableAggregation ();
1063  SetQosSupported (true);
1064  }
1065  case WIFI_STANDARD_80211g:
1066  SetErpSupported (true);
1067  case WIFI_STANDARD_holland:
1068  case WIFI_STANDARD_80211a:
1069  case WIFI_STANDARD_80211p:
1070  cwmin = 15;
1071  cwmax = 1023;
1072  break;
1073  case WIFI_STANDARD_80211b:
1074  SetDsssSupported (true);
1075  cwmin = 31;
1076  cwmax = 1023;
1077  break;
1078  default:
1079  NS_FATAL_ERROR ("Unsupported WifiPhyStandard in RegularWifiMac::FinishConfigureStandard ()");
1080  }
1081 
1082  ConfigureContentionWindow (cwmin, cwmax);
1083 }
1084 
1085 void
1086 RegularWifiMac::ConfigureContentionWindow (uint32_t cwMin, uint32_t cwMax)
1087 {
1088  bool isDsssOnly = m_dsssSupported && !m_erpSupported;
1089  //The special value of AC_BE_NQOS which exists in the Access
1090  //Category enumeration allows us to configure plain old DCF.
1091  ConfigureDcf (m_txop, cwMin, cwMax, isDsssOnly, AC_BE_NQOS);
1092 
1093  //Now we configure the EDCA functions
1094  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
1095  {
1096  ConfigureDcf (i->second, cwMin, cwMax, isDsssOnly, i->first);
1097  }
1098 }
1099 
1100 void
1102 {
1103  NS_LOG_FUNCTION (this << hdr);
1104  m_txOkCallback (hdr);
1105 }
1106 
1107 void
1109 {
1110  NS_LOG_FUNCTION (this << hdr);
1111  m_txErrCallback (hdr);
1112 }
1113 
1114 void
1116 {
1117  NS_LOG_FUNCTION (this);
1118  if (m_low->GetMsduAggregator () == 0)
1119  {
1120  Ptr<MsduAggregator> msduAggregator = CreateObject<MsduAggregator> ();
1121  msduAggregator->SetEdcaQueues (m_edca);
1122  m_low->SetMsduAggregator (msduAggregator);
1123  }
1124  if (m_low->GetMpduAggregator () == 0)
1125  {
1126  Ptr<MpduAggregator> mpduAggregator = CreateObject<MpduAggregator> ();
1127  mpduAggregator->SetEdcaQueues (m_edca);
1128  m_low->SetMpduAggregator (mpduAggregator);
1129  }
1130 }
1131 
1132 void
1134 {
1135  NS_LOG_FUNCTION (this);
1136  m_low->SetMsduAggregator (0);
1137  m_low->SetMpduAggregator (0);
1138 }
1139 
1140 } //namespace ns3
virtual void SetQosSupported(bool enable)
Enable or disable QoS support for the device.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:280
uint16_t m_voMaxAmsduSize
maximum A-MSDU size for AC_VO (in bytes)
void Dispose(void)
Dispose of this Object.
Definition: object.cc:214
void SetVoBlockAckInactivityTimeout(uint16_t timeout)
Set VO block ack inactivity timeout.
void SetTxMcsSetDefined(uint8_t txMcsSetDefined)
Set the transmit MCS set defined.
void SetupEdcaQueue(AcIndex ac)
This method is a private utility invoked to configure the channel access function for the specified A...
void SetTxStbc(uint8_t txStbc)
Set the transmit STBC.
Ptr< HeConfiguration > GetHeConfiguration(void) const
Definition: wifi-mac.cc:195
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void SetHtSupported(uint8_t htSupported)
Set the HT Supported flag.
AttributeValue implementation for Boolean.
Definition: boolean.h:36
bool GetHeSupported() const
Return whether the device supports HE.
void SetGreenfield(uint8_t greenfield)
Set the Greenfield field.
Ptr< Txop > m_txop
This holds a pointer to the TXOP instance for this WifiMac - used for transmission of frames to non-Q...
void SetSupportedChannelWidthSet(uint8_t channelWidthSet)
Set the supported channel width set.
WifiMode GetMcs(uint8_t mcs) const
The WifiPhy::GetMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of tr...
Definition: wifi-phy.cc:4314
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
uint32_t m_bkMaxAmpduSize
maximum A-MPDU size for AC_BK (in bytes)
ForwardUpCallback m_forwardUp
Callback to forward packet up the stack.
#define min(a, b)
Definition: 80211b.c:42
See IEEE 802.11 chapter 7.3.1.11 Header format: | category: 1 | action value: 1 |.
Definition: mgt-headers.h:870
virtual void DeaggregateAmsduAndForward(Ptr< WifiMacQueueItem > mpdu)
This method can be called to de-aggregate an A-MSDU and forward the constituent packets up the stack...
bool GetQosSupported() const
Return whether the device supports QoS.
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:1426
static TypeId GetTypeId(void)
Get the type ID.
void SetShortGuardInterval40(uint8_t shortGuardInterval)
Set the short guard interval 40 field.
void SetRxMcsBitmask(uint8_t index)
Set the receive MCS bitmask.
bool IsAmsduSupported(void) const
Return whether A-MSDU capability is supported.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: boolean.h:85
void SetHeSupported(uint8_t heSupported)
Set HE supported.
uint16_t m_bkMaxAmsduSize
maximum A-MSDU size for AC_BK (in bytes)
EdcaQueues m_edca
This is a map from Access Category index to the corresponding channel access function.
uint32_t m_beMaxAmpduSize
maximum A-MPDU size for AC_BE (in bytes)
void SetErpSupported(bool enable)
Enable or disable ERP support for the device.
void SetLSigProtectionSupport(uint8_t lSigProtection)
Set the LSIG protection support.
void SetChannelAccessManager(const Ptr< ChannelAccessManager > manager)
Set ChannelAccessManager this Txop is associated to.
Definition: txop.cc:120
Implement the header for management frames of type Add Block Ack request.
Definition: mgt-headers.h:1003
bool IsAllowed(uint16_t channelWidth, uint8_t nss) const
Definition: wifi-mode.cc:55
void SetTxDroppedCallback(TxDropped callback)
Definition: txop.cc:162
ExtendedCapabilities GetExtendedCapabilities(void) const
Return the extended capabilities of the device.
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
The Extended Capabilities Information ElementThis class knows how to serialise and deserialise the Ex...
void SetupPhyListener(Ptr< WifiPhy > phy)
Set up listener for PHY events.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:67
U * PeekPointer(const Ptr< U > &p)
Definition: ptr.h:411
Callback< void > m_linkUp
Callback when a link is up.
void ConfigureContentionWindow(uint32_t cwMin, uint32_t cwMax)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
The HT Capabilities Information ElementThis class knows how to serialise and deserialise the HT Capab...
void SetHighestNssSupported(uint8_t nss)
Set highest NSS supported.
void SetSsid(Ssid ssid)
void SetBlockAckInactivityTimeout(uint16_t timeout)
Set the BlockAck inactivity timeout.
Definition: qos-txop.cc:1567
void RemovePhyListener(Ptr< WifiPhy > phy)
Remove current registered listener for PHY events.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
WifiMacType GetType(void) const
Return the type (enum WifiMacType)
void SetLinkDownCallback(Callback< void > linkDown)
CategoryValue GetCategory()
Return the category value.
VHT PHY (Clause 22)
Definition: wifi-mode.h:62
The 5 GHz band.
Definition: wifi-phy-band.h:35
Ptr< WifiPhy > m_phy
Wifi PHY.
void SetDelayedBlockAck()
Enable delayed BlockAck.
uint32_t m_voMaxAmpduSize
maximum A-MPDU size for AC_VO (in bytes)
Ptr< ChannelAccessManager > m_channelAccessManager
channel access manager
ns3::Time timeout
void SetStatusCode(StatusCode code)
Set the status code.
Video.
Definition: qos-utils.h:45
Voice.
Definition: qos-utils.h:47
uint16_t GetTimeout(void) const
Return the timeout.
Best Effort.
Definition: qos-utils.h:41
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:99
virtual void Receive(Ptr< WifiMacQueueItem > mpdu)
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
void ConfigureDcf(Ptr< Txop > dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, AcIndex ac)
Definition: wifi-mac.cc:124
bool GetShortSlotTimeSupported(void) const
void SetTimeout(uint16_t timeout)
Set timeout.
bool GetDsssSupported() const
Return whether the device supports DSSS.
TracedCallback< const WifiMacHeader & > m_txErrCallback
transmit error callback
void SetMaxAmpduLength(uint32_t maxAmpduLength)
Set the maximum AMPDU length.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
phy
Definition: third.py:93
void SetVoBlockAckThreshold(uint8_t threshold)
Set the block ack threshold for AC_VO.
void SetVhtSupported(uint8_t vhtSupported)
Set the VHT supported field.
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:1516
void SetChannelWidthSet(uint8_t channelWidthSet)
Set channel width set.
void SetTid(uint8_t tid)
Set Traffic ID (TID).
void SetHeLtfAndGiForHePpdus(uint8_t heLtfAndGiForHePpdus)
Set HE LTF and GI for HE PDPUs.
uint8_t GetTid(void) const
Return the Traffic ID (TID).
void SetBssid(Mac48Address bssid)
uint8_t GetNMcs(void) const
The WifiPhy::GetNMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of t...
Definition: wifi-phy.cc:4308
void SetVhtSupported(uint8_t vhtSupported)
Set the VHT Supported flag.
bool IsByOriginator(void) const
Check if the initiator bit in the DELBA is set.
Background.
Definition: qos-utils.h:43
virtual bool SupportsSendFrom(void) const
bool IsAction(void) const
Return true if the header is an Action header.
virtual void Enqueue(Ptr< Packet > packet, Mac48Address to, Mac48Address from)
void SetForwardUpCallback(ForwardUpCallback upCallback)
void SetSuccess(void)
Set success bit to 0 (success).
Definition: status-code.cc:30
Ptr< HtConfiguration > GetHtConfiguration(void) const
Definition: wifi-mac.cc:181
void EnableAggregation(void)
Enable aggregation function.
void SetBkBlockAckThreshold(uint8_t threshold)
Set the block ack threshold for AC_BK.
bool GetErpSupported() const
Return whether the device supports ERP.
bool m_qosSupported
This Boolean is set true iff this WifiMac is to model 802.11e/WMM style Quality of Service...
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: pointer.h:227
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
void SetTypeOfStation(TypeOfStation type)
This method is invoked by a subclass to specify what type of station it is implementing.
#define max(a, b)
Definition: 80211b.c:43
void SetHighestMcsSupported(uint8_t mcs)
Set highest MCS supported.
void SetDsNotTo(void)
Un-set the To DS bit in the Frame Control field.
void SetAddr3(Mac48Address address)
Fill the Address 3 field with the given address.
bool GetVhtSupported() const
Return whether the device supports VHT.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1313
The IEEE 802.11ac VHT Capabilities.
Ssid m_ssid
Service Set ID (SSID)
base class for all MAC-level wifi objects.
Definition: wifi-mac.h:46
void NotifyTxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:100
void SetImmediateBlockAck()
Enable immediate BlockAck.
Hold an unsigned integer type.
Definition: uinteger.h:44
ssid
Definition: third.py:100
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
Definition: qos-utils.cc:32
void SetAddress(Mac48Address address)
HT PHY (Clause 20)
Definition: wifi-mode.h:60
Ptr< MacRxMiddle > m_rxMiddle
RX middle (defragmentation etc.)
virtual void DoDispose()
Destructor implementation.
Definition: wifi-mac.cc:76
void SetTxRxMcsSetUnequal(uint8_t txRxMcsSetUnequal)
Set the transmit / receive MCS set unequal.
Ptr< QosTxop > GetVOQueue(void) const
Accessor for the AC_VO channel access function.
uint16_t m_viMaxAmsduSize
maximum A-MSDU size for AC_VI (in bytes)
Mac48Address GetBssid(void) const
uint16_t m_beMaxAmsduSize
maximum A-MSDU size for AC_BE (in bytes)
HeCapabilities GetHeCapabilities(void) const
Return the HE capabilities of the device.
void ResetWifiPhy(void)
Remove currently attached WifiPhy device from this MAC.
void SetMaxAmpduLength(uint32_t maxAmpduLength)
Set the maximum AMPDU length.
void SetRxHighestSupportedDataRate(uint16_t maxSupportedRate)
Set the receive highest supported data rate.
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:480
Ptr< MacLow > m_low
MacLow (RTS, CTS, Data, Ack etc.)
void SetBeBlockAckThreshold(uint8_t threshold)
Set the block ack threshold for AC_BE.
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(void) const
void SendAddBaResponse(const MgtAddBaRequestHeader *reqHdr, Mac48Address originator)
This method can be called to accept a received ADDBA Request.
Callback< void > m_linkDown
Callback when a link is down.
Mac48Address GetAddr2(void) const
Return the address in the Address 2 field.
TracedCallback< const WifiMacHeader & > m_txOkCallback
transmit OK callback
void SetRxStbc(uint8_t rxStbc)
Set the receive STBC.
Status code for association response.
Definition: status-code.h:31
virtual void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > stationManager)
void SetLinkUpCallback(Callback< void > linkUp)
virtual void DoDispose()
Destructor implementation.
void SetLdpcCodingInPayload(uint8_t ldpcCodingInPayload)
Set indication whether the transmission and reception of LDPC encoded packets is supported.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiStandard
Identifies the allowed configurations that a Wifi device is configured to use.
Hold objects of type Ptr<T>.
Definition: pointer.h:36
address
Definition: first.py:44
void DisableAggregation(void)
Disable aggregation function.
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
void SetBufferSize(uint16_t size)
Set buffer size.
void SetShortGuardIntervalFor80Mhz(uint8_t shortGuardInterval)
Set the short guard interval 80 MHz.
void SetTxUnequalModulation(uint8_t txUnequalModulation)
Set the transmit unequal modulation.
an EUI-48 address
Definition: mac48-address.h:43
void SetRxLdpc(uint8_t rxLdpc)
Set the receive LDPC.
void SetMaxMpduLength(uint16_t length)
Set the maximum MPDU length.
void SetMacLow(const Ptr< MacLow > low)
Set MacLow associated with this Txop.
Definition: txop.cc:134
Ssid GetSsid(void) const
Ptr< QosTxop > GetVIQueue(void) const
Accessor for the AC_VI channel access function.
The 2.4 GHz band.
Definition: wifi-phy-band.h:33
void SetMaxAmsduLength(uint16_t maxAmsduLength)
Set the maximum AMSDU length.
void SetBlockAckThreshold(uint8_t threshold)
Set threshold for block ack mechanism.
Definition: qos-txop.cc:1559
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:35
void SetViBlockAckInactivityTimeout(uint16_t timeout)
Set VI block ack inactivity timeout.
Mac48Address GetAddress(void) const
void SetRxMcsMap(uint8_t mcs, uint8_t nss)
uint8_t GetTid(void) const
Return the Traffic ID (TID).
void SetType(WifiMacType type, bool resetToDsFromDs=true)
Set Type/Subtype values with the correct values depending on the given type.
Ptr< QosTxop > GetBEQueue(void) const
Accessor for the AC_BE channel access function.
Ptr< Txop > GetTxop(void) const
Accessor for the DCF object.
bool IsMgt(void) const
Return true if the Type is Management.
void SetViBlockAckThreshold(uint8_t threshold)
Set the block ack threshold for AC_VI.
void SetShortGuardIntervalFor160Mhz(uint8_t shortGuardInterval)
Set the short guard interval 160 MHz.
Ptr< VhtConfiguration > GetVhtConfiguration(void) const
Definition: wifi-mac.cc:188
BlockAckActionValue blockAck
block ack
Definition: mgt-headers.h:946
bool GetHtSupported() const
Return whether the device supports HT.
void SetMaxAmpduLength(uint32_t maxAmpduLength)
Set the maximum AMPDU length.
Implement the header for management frames of type Add Block Ack response.
Definition: mgt-headers.h:1135
Implement the header for management frames of type Delete Block Ack.
Definition: mgt-headers.h:1256
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
void SetTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set MacTxMiddle this Txop is associated to.
Definition: txop.cc:127
void SetSupportedChannelWidth(uint8_t supportedChannelWidth)
Set the supported channel width field.
typedef for union of different ActionValues
Definition: mgt-headers.h:941
Total number of ACs.
Definition: qos-utils.h:49
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
virtual void DoInitialize()
Initialize() implementation.
void SetLdpc(uint8_t ldpc)
Set the LDPC field.
void SetShortGuardInterval20(uint8_t shortGuardInterval)
Set the short guard interval 20 field.
void SetBkBlockAckInactivityTimeout(uint16_t timeout)
Set BK block ack inactivity timeout.
uint16_t GetStartingSequence(void) const
Return the starting sequence number.
void ForwardUp(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
virtual void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > remoteManager)
Set WifiRemoteStationsManager this Txop is associated to.
Definition: txop.cc:141
The 6 GHz band.
Definition: wifi-phy-band.h:37
bool m_shortSlotTimeSupported
flag whether short slot time is supported
void SetAmsduSupport(bool supported)
Enable or disable A-MSDU support.
virtual void TxOk(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
uint32_t m_viMaxAmpduSize
maximum A-MPDU size for AC_VI (in bytes)
uint8_t GetTid(void) const
Return the Traffic ID (TID).
bool m_erpSupported
This Boolean is set true iff this WifiMac is to model 802.11g.
TypeOfStation
Enumeration for type of station.
Definition: qos-txop.h:47
Ptr< QosTxop > GetBKQueue(void) const
Accessor for the AC_BK channel access function.
void SetTxMaxNSpatialStreams(uint8_t maxTxSpatialStreams)
Set the transmit maximum N spatial streams.
void SetCtsToSelfSupported(bool enable)
Enable or disable CTS-to-self feature.
void Receive(Ptr< WifiMacQueueItem > mpdu)
Receive a packet.
void SetShortSlotTimeSupported(bool enable)
Enable or disable short slot time feature.
void SetDsssSupported(bool enable)
Enable or disable DSSS support for the device.
void ConfigureStandard(WifiStandard standard)
Ptr< WifiRemoteStationManager > m_stationManager
Remote station manager (rate control, RTS/CTS/fragmentation thresholds etc.)
void SetTxFailedCallback(TxFailed callback)
Definition: txop.cc:155
ActionValue GetAction()
Return the action value.
void SetRxHighestSupportedLgiDataRate(uint16_t supportedDatarate)
Set the receive highest supported LGI data rate.
void SetPromisc(void)
Sets the interface in promiscuous mode.
Ptr< WifiPhy > GetWifiPhy(void) const
void SetTxOkCallback(TxOk callback)
Definition: txop.cc:148
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capabilities of the device.
void SetupLow(Ptr< MacLow > low)
Set up listener for MacLow events.
The IEEE 802.11ax HE Capabilities.
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:458
void SetTxHighestSupportedLgiDataRate(uint16_t supportedDatarate)
Set the transmit highest supported LGI data rate.
void SetTxMcsMap(uint8_t mcs, uint8_t nss)
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: uinteger.h:45
void SetAction(CategoryValue type, ActionValue action)
Set action for this Action header.
void SetBeBlockAckInactivityTimeout(uint16_t timeout)
Set BE block ack inactivity timeout.
uint8_t GetMaxSupportedTxSpatialStreams(void) const
Definition: wifi-phy.cc:1549
a unique identifier for an interface.
Definition: type-id.h:58
bool m_dsssSupported
This Boolean is set true iff this WifiMac is to model 802.11b.
virtual void SetWifiPhy(const Ptr< WifiPhy > phy)
bool IsImmediateBlockAck(void) const
Return whether the Block Ack policy is immediate Block Ack.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:38
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
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
Definition: object.cc:183
Ptr< MacTxMiddle > m_txMiddle
TX middle (aggregation etc.)
HE PHY (Clause 26)
Definition: wifi-mode.h:64
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:127
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:256
Implements the IEEE 802.11 MAC header.
uint8_t GetMaxSupportedRxSpatialStreams(void) const
Definition: wifi-phy.cc:1567
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities of the device.
void SetDsNotFrom(void)
Un-set the From DS bit in the Frame Control field.
void SetHtSupported(uint8_t htSupported)
Set the HT supported field.
virtual void TxFailed(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.