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 (0);
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 (0);
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<HeConfiguration> heConfiguration = GetHeConfiguration ();
314  capabilities.SetHeSupported (1);
315  uint8_t channelWidthSet = 0;
316  if ((m_phy->GetChannelWidth () >= 40) && (m_phy->GetPhyBand () == WIFI_PHY_BAND_2_4GHZ))
317  {
318  channelWidthSet |= 0x01;
319  }
321  {
322  channelWidthSet |= 0x02;
323  }
324  if ((m_phy->GetChannelWidth () >= 160) && ((m_phy->GetPhyBand () == WIFI_PHY_BAND_5GHZ) || (m_phy->GetPhyBand () == WIFI_PHY_BAND_6GHZ)))
325  {
326  channelWidthSet |= 0x04;
327  }
328  capabilities.SetChannelWidthSet (channelWidthSet);
329  uint8_t gi = 0;
330  if (heConfiguration->GetGuardInterval () <= NanoSeconds (1600))
331  {
332  //todo: We assume for now that if we support 800ns GI then 1600ns GI is supported as well
333  gi |= 0x01;
334  }
335  if (heConfiguration->GetGuardInterval () == NanoSeconds (800))
336  {
337  gi |= 0x02;
338  }
339  capabilities.SetHeLtfAndGiForHePpdus (gi);
340  uint32_t maxAmpduLength = std::max ({m_voMaxAmpduSize, m_viMaxAmpduSize,
342  // round to the next power of two minus one
343  maxAmpduLength = (1ul << static_cast<uint32_t> (std::ceil (std::log2 (maxAmpduLength + 1)))) - 1;
344  // The maximum A-MPDU length in HE capabilities elements ranges from 2^20-1 to 2^23-1
345  capabilities.SetMaxAmpduLength (std::min (std::max (maxAmpduLength, 1048575u), 8388607u));
346 
347  uint8_t maxMcs = 0;
348  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
349  {
350  WifiMode mcs = m_phy->GetMcs (i);
351  if ((mcs.GetModulationClass () == WIFI_MOD_CLASS_HE)
352  && (mcs.GetMcsValue () > maxMcs))
353  {
354  maxMcs = mcs.GetMcsValue ();
355  }
356  }
357  capabilities.SetHighestMcsSupported (maxMcs);
359  }
360  return capabilities;
361 }
362 
363 void
365 {
366  NS_LOG_FUNCTION (this << +threshold);
367  GetVOQueue ()->SetBlockAckThreshold (threshold);
368 }
369 
370 void
372 {
373  NS_LOG_FUNCTION (this << +threshold);
374  GetVIQueue ()->SetBlockAckThreshold (threshold);
375 }
376 
377 void
379 {
380  NS_LOG_FUNCTION (this << +threshold);
381  GetBEQueue ()->SetBlockAckThreshold (threshold);
382 }
383 
384 void
386 {
387  NS_LOG_FUNCTION (this << +threshold);
388  GetBKQueue ()->SetBlockAckThreshold (threshold);
389 }
390 
391 void
393 {
394  NS_LOG_FUNCTION (this << timeout);
396 }
397 
398 void
400 {
401  NS_LOG_FUNCTION (this << timeout);
403 }
404 
405 void
407 {
408  NS_LOG_FUNCTION (this << timeout);
410 }
411 
412 void
414 {
415  NS_LOG_FUNCTION (this << timeout);
417 }
418 
419 void
421 {
422  NS_LOG_FUNCTION (this << ac);
423 
424  //Our caller shouldn't be attempting to setup a queue that is
425  //already configured.
426  NS_ASSERT (m_edca.find (ac) == m_edca.end ());
427 
428  Ptr<QosTxop> edca = CreateObject<QosTxop> ();
429  edca->SetMacLow (m_low);
430  edca->SetChannelAccessManager (m_channelAccessManager);
431  edca->SetTxMiddle (m_txMiddle);
432  edca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this));
433  edca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this));
434  edca->SetTxDroppedCallback (MakeCallback (&RegularWifiMac::NotifyTxDrop, this));
435  edca->SetAccessCategory (ac);
436  edca->CompleteConfig ();
437 
438  m_edca.insert (std::make_pair (ac, edca));
439 }
440 
441 void
443 {
444  NS_LOG_FUNCTION (this << type);
445  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
446  {
447  i->second->SetTypeOfStation (type);
448  }
449 }
450 
451 Ptr<Txop>
453 {
454  return m_txop;
455 }
456 
459 {
460  return m_edca.find (AC_VO)->second;
461 }
462 
465 {
466  return m_edca.find (AC_VI)->second;
467 }
468 
471 {
472  return m_edca.find (AC_BE)->second;
473 }
474 
477 {
478  return m_edca.find (AC_BK)->second;
479 }
480 
481 void
483 {
484  NS_LOG_FUNCTION (this << phy);
485  m_phy = phy;
487  m_low->SetPhy (phy);
488 }
489 
492 {
493  NS_LOG_FUNCTION (this);
494  return m_phy;
495 }
496 
497 void
499 {
500  NS_LOG_FUNCTION (this);
501  m_low->ResetPhy ();
503  m_phy = 0;
504 }
505 
506 void
508 {
509  NS_LOG_FUNCTION (this);
510  m_forwardUp = upCallback;
511 }
512 
513 void
515 {
516  NS_LOG_FUNCTION (this);
517  m_linkUp = linkUp;
518 }
519 
520 void
522 {
523  NS_LOG_FUNCTION (this);
524  m_linkDown = linkDown;
525 }
526 
527 void
529 {
530  NS_LOG_FUNCTION (this << enable);
531  m_qosSupported = enable;
532 }
533 
534 bool
536 {
537  return m_qosSupported;
538 }
539 
540 bool
542 {
543  if (GetHtConfiguration ())
544  {
545  return true;
546  }
547  return false;
548 }
549 
550 bool
552 {
553  if (GetVhtConfiguration ())
554  {
555  return true;
556  }
557  return false;
558 }
559 
560 bool
562 {
563  if (GetHeConfiguration ())
564  {
565  return true;
566  }
567  return false;
568 }
569 
570 bool
572 {
573  return m_erpSupported;
574 }
575 
576 void
578 {
579  NS_LOG_FUNCTION (this);
580  if (enable)
581  {
582  SetDsssSupported (true);
583  }
584  m_erpSupported = enable;
585 }
586 
587 void
589 {
590  NS_LOG_FUNCTION (this);
591  m_dsssSupported = enable;
592 }
593 
594 bool
596 {
597  return m_dsssSupported;
598 }
599 
600 void
602 {
603  NS_LOG_FUNCTION (this);
604  m_low->SetCtsToSelfSupported (enable);
605 }
606 
607 void
609 {
610  NS_LOG_FUNCTION (this << address);
611  m_low->SetAddress (address);
612 }
613 
616 {
617  return m_low->GetAddress ();
618 }
619 
620 void
622 {
623  NS_LOG_FUNCTION (this << ssid);
624  m_ssid = ssid;
625 }
626 
627 Ssid
629 {
630  return m_ssid;
631 }
632 
633 void
635 {
636  NS_LOG_FUNCTION (this << bssid);
637  m_low->SetBssid (bssid);
638 }
639 
642 {
643  return m_low->GetBssid ();
644 }
645 
646 void
648 {
649  m_low->SetPromisc ();
650 }
651 
652 void
654 {
655  NS_LOG_FUNCTION (this << enable);
656  m_shortSlotTimeSupported = enable;
657 }
658 
659 bool
661 {
663 }
664 
665 void
667  Mac48Address to, Mac48Address from)
668 {
669  //We expect RegularWifiMac subclasses which do support forwarding (e.g.,
670  //AP) to override this method. Therefore, we throw a fatal error if
671  //someone tries to invoke this method on a class which has not done
672  //this.
673  NS_FATAL_ERROR ("This MAC entity (" << this << ", " << GetAddress ()
674  << ") does not support Enqueue() with from address");
675 }
676 
677 bool
679 {
680  return false;
681 }
682 
683 void
685 {
686  NS_LOG_FUNCTION (this << packet << from << to);
687  m_forwardUp (packet, from, to);
688 }
689 
690 void
692 {
693  NS_LOG_FUNCTION (this << *mpdu);
694 
695  const WifiMacHeader* hdr = &mpdu->GetHeader ();
696  Ptr<Packet> packet = mpdu->GetPacket ()->Copy ();
697  Mac48Address to = hdr->GetAddr1 ();
698  Mac48Address from = hdr->GetAddr2 ();
699 
700  //We don't know how to deal with any frame that is not addressed to
701  //us (and odds are there is nothing sensible we could do anyway),
702  //so we ignore such frames.
703  //
704  //The derived class may also do some such filtering, but it doesn't
705  //hurt to have it here too as a backstop.
706  if (to != GetAddress ())
707  {
708  return;
709  }
710 
711  if (hdr->IsMgt () && hdr->IsAction ())
712  {
713  //There is currently only any reason for Management Action
714  //frames to be flying about if we are a QoS STA.
716 
717  WifiActionHeader actionHdr;
718  packet->RemoveHeader (actionHdr);
719 
720  switch (actionHdr.GetCategory ())
721  {
723 
724  switch (actionHdr.GetAction ().blockAck)
725  {
727  {
728  MgtAddBaRequestHeader reqHdr;
729  packet->RemoveHeader (reqHdr);
730 
731  //We've received an ADDBA Request. Our policy here is
732  //to automatically accept it, so we get the ADDBA
733  //Response on it's way immediately.
734  SendAddBaResponse (&reqHdr, from);
735  //This frame is now completely dealt with, so we're done.
736  return;
737  }
739  {
740  MgtAddBaResponseHeader respHdr;
741  packet->RemoveHeader (respHdr);
742 
743  //We've received an ADDBA Response. We assume that it
744  //indicates success after an ADDBA Request we have
745  //sent (we could, in principle, check this, but it
746  //seems a waste given the level of the current model)
747  //and act by locally establishing the agreement on
748  //the appropriate queue.
749  AcIndex ac = QosUtilsMapTidToAc (respHdr.GetTid ());
750  m_edca[ac]->GotAddBaResponse (&respHdr, from);
751  //This frame is now completely dealt with, so we're done.
752  return;
753  }
755  {
756  MgtDelBaHeader delBaHdr;
757  packet->RemoveHeader (delBaHdr);
758 
759  if (delBaHdr.IsByOriginator ())
760  {
761  //This DELBA frame was sent by the originator, so
762  //this means that an ingoing established
763  //agreement exists in MacLow and we need to
764  //destroy it.
765  m_low->DestroyBlockAckAgreement (from, delBaHdr.GetTid ());
766  }
767  else
768  {
769  //We must have been the originator. We need to
770  //tell the correct queue that the agreement has
771  //been torn down
772  AcIndex ac = QosUtilsMapTidToAc (delBaHdr.GetTid ());
773  m_edca[ac]->GotDelBaFrame (&delBaHdr, from);
774  }
775  //This frame is now completely dealt with, so we're done.
776  return;
777  }
778  default:
779  NS_FATAL_ERROR ("Unsupported Action field in Block Ack Action frame");
780  return;
781  }
782  default:
783  NS_FATAL_ERROR ("Unsupported Action frame received");
784  return;
785  }
786  }
787  NS_FATAL_ERROR ("Don't know how to handle frame (type=" << hdr->GetType ());
788 }
789 
790 void
792 {
793  NS_LOG_FUNCTION (this << *mpdu);
794  for (auto& msduPair : *PeekPointer (mpdu))
795  {
796  ForwardUp (msduPair.first, msduPair.second.GetSourceAddr (),
797  msduPair.second.GetDestinationAddr ());
798  }
799 }
800 
801 void
803  Mac48Address originator)
804 {
805  NS_LOG_FUNCTION (this);
806  WifiMacHeader hdr;
808  hdr.SetAddr1 (originator);
809  hdr.SetAddr2 (GetAddress ());
810  hdr.SetAddr3 (GetBssid ());
811  hdr.SetDsNotFrom ();
812  hdr.SetDsNotTo ();
813 
814  MgtAddBaResponseHeader respHdr;
815  StatusCode code;
816  code.SetSuccess ();
817  respHdr.SetStatusCode (code);
818  //Here a control about queues type?
819  respHdr.SetAmsduSupport (reqHdr->IsAmsduSupported ());
820 
821  if (reqHdr->IsImmediateBlockAck ())
822  {
823  respHdr.SetImmediateBlockAck ();
824  }
825  else
826  {
827  respHdr.SetDelayedBlockAck ();
828  }
829  respHdr.SetTid (reqHdr->GetTid ());
830 
831  Ptr<HeConfiguration> heConfiguration = GetHeConfiguration ();
832  if (heConfiguration && heConfiguration->GetMpduBufferSize () > 64)
833  {
834  respHdr.SetBufferSize (255);
835  }
836  else
837  {
838  respHdr.SetBufferSize (63);
839  }
840  respHdr.SetTimeout (reqHdr->GetTimeout ());
841 
842  WifiActionHeader actionHdr;
845  actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
846 
847  Ptr<Packet> packet = Create<Packet> ();
848  packet->AddHeader (respHdr);
849  packet->AddHeader (actionHdr);
850 
851  //We need to notify our MacLow object as it will have to buffer all
852  //correctly received packets for this Block Ack session
853  m_low->CreateBlockAckAgreement (&respHdr, originator,
854  reqHdr->GetStartingSequence ());
855 
856  //It is unclear which queue this frame should go into. For now we
857  //bung it into the queue corresponding to the TID for which we are
858  //establishing an agreement, and push it to the head.
859  m_edca[QosUtilsMapTidToAc (reqHdr->GetTid ())]->PushFront (packet, hdr);
860 }
861 
862 TypeId
864 {
865  static TypeId tid = TypeId ("ns3::RegularWifiMac")
866  .SetParent<WifiMac> ()
867  .SetGroupName ("Wifi")
868  .AddAttribute ("QosSupported",
869  "This Boolean attribute is set to enable 802.11e/WMM-style QoS support at this STA.",
870  BooleanValue (false),
874  .AddAttribute ("CtsToSelfSupported",
875  "Use CTS to Self when using a rate that is not in the basic rate set.",
876  BooleanValue (false),
879  .AddAttribute ("VO_MaxAmsduSize",
880  "Maximum length in bytes of an A-MSDU for AC_VO access class "
881  "(capped to 7935 for HT PPDUs and 11398 for VHT/HE PPDUs). "
882  "Value 0 means A-MSDU aggregation is disabled for that AC.",
883  UintegerValue (0),
885  MakeUintegerChecker<uint16_t> (0, 11398))
886  .AddAttribute ("VI_MaxAmsduSize",
887  "Maximum length in bytes of an A-MSDU for AC_VI access class "
888  "(capped to 7935 for HT PPDUs and 11398 for VHT/HE PPDUs). "
889  "Value 0 means A-MSDU aggregation is disabled for that AC.",
890  UintegerValue (0),
892  MakeUintegerChecker<uint16_t> (0, 11398))
893  .AddAttribute ("BE_MaxAmsduSize",
894  "Maximum length in bytes of an A-MSDU for AC_BE access class "
895  "(capped to 7935 for HT PPDUs and 11398 for VHT/HE PPDUs). "
896  "Value 0 means A-MSDU aggregation is disabled for that AC.",
897  UintegerValue (0),
899  MakeUintegerChecker<uint16_t> (0, 11398))
900  .AddAttribute ("BK_MaxAmsduSize",
901  "Maximum length in bytes of an A-MSDU for AC_BK access class "
902  "(capped to 7935 for HT PPDUs and 11398 for VHT/HE PPDUs). "
903  "Value 0 means A-MSDU aggregation is disabled for that AC.",
904  UintegerValue (0),
906  MakeUintegerChecker<uint16_t> (0, 11398))
907  .AddAttribute ("VO_MaxAmpduSize",
908  "Maximum length in bytes of an A-MPDU for AC_VO access class "
909  "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, and 8388607 for HE PPDUs). "
910  "Value 0 means A-MPDU aggregation is disabled for that AC.",
911  UintegerValue (0),
913  MakeUintegerChecker<uint32_t> ())
914  .AddAttribute ("VI_MaxAmpduSize",
915  "Maximum length in bytes of an A-MPDU for AC_VI access class "
916  "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, and 8388607 for HE PPDUs). "
917  "Value 0 means A-MPDU aggregation is disabled for that AC.",
918  UintegerValue (65535),
920  MakeUintegerChecker<uint32_t> ())
921  .AddAttribute ("BE_MaxAmpduSize",
922  "Maximum length in bytes of an A-MPDU for AC_BE access class "
923  "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, and 8388607 for HE PPDUs). "
924  "Value 0 means A-MPDU aggregation is disabled for that AC.",
925  UintegerValue (65535),
927  MakeUintegerChecker<uint32_t> ())
928  .AddAttribute ("BK_MaxAmpduSize",
929  "Maximum length in bytes of an A-MPDU for AC_BK access class "
930  "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, and 8388607 for HE PPDUs). "
931  "Value 0 means A-MPDU aggregation is disabled for that AC.",
932  UintegerValue (0),
934  MakeUintegerChecker<uint32_t> ())
935  .AddAttribute ("VO_BlockAckThreshold",
936  "If number of packets in VO queue reaches this value, "
937  "block ack mechanism is used. If this value is 0, block ack is never used."
938  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
939  UintegerValue (0),
941  MakeUintegerChecker<uint8_t> (0, 64))
942  .AddAttribute ("VI_BlockAckThreshold",
943  "If number of packets in VI queue reaches this value, "
944  "block ack mechanism is used. If this value is 0, block ack is never used."
945  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
946  UintegerValue (0),
948  MakeUintegerChecker<uint8_t> (0, 64))
949  .AddAttribute ("BE_BlockAckThreshold",
950  "If number of packets in BE queue reaches this value, "
951  "block ack mechanism is used. If this value is 0, block ack is never used."
952  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
953  UintegerValue (0),
955  MakeUintegerChecker<uint8_t> (0, 64))
956  .AddAttribute ("BK_BlockAckThreshold",
957  "If number of packets in BK queue reaches this value, "
958  "block ack mechanism is used. If this value is 0, block ack is never used."
959  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
960  UintegerValue (0),
962  MakeUintegerChecker<uint8_t> (0, 64))
963  .AddAttribute ("VO_BlockAckInactivityTimeout",
964  "Represents max time (blocks of 1024 microseconds) allowed for block ack"
965  "inactivity for AC_VO. If this value isn't equal to 0 a timer start after that a"
966  "block ack setup is completed and will be reset every time that a block ack"
967  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
968  UintegerValue (0),
970  MakeUintegerChecker<uint16_t> ())
971  .AddAttribute ("VI_BlockAckInactivityTimeout",
972  "Represents max time (blocks of 1024 microseconds) allowed for block ack"
973  "inactivity for AC_VI. If this value isn't equal to 0 a timer start after that a"
974  "block ack setup is completed and will be reset every time that a block ack"
975  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
976  UintegerValue (0),
978  MakeUintegerChecker<uint16_t> ())
979  .AddAttribute ("BE_BlockAckInactivityTimeout",
980  "Represents max time (blocks of 1024 microseconds) allowed for block ack"
981  "inactivity for AC_BE. If this value isn't equal to 0 a timer start after that a"
982  "block ack setup is completed and will be reset every time that a block ack"
983  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
984  UintegerValue (0),
986  MakeUintegerChecker<uint16_t> ())
987  .AddAttribute ("BK_BlockAckInactivityTimeout",
988  "Represents max time (blocks of 1024 microseconds) allowed for block ack"
989  "inactivity for AC_BK. If this value isn't equal to 0 a timer start after that a"
990  "block ack setup is completed and will be reset every time that a block ack"
991  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
992  UintegerValue (0),
994  MakeUintegerChecker<uint16_t> ())
995  .AddAttribute ("ShortSlotTimeSupported",
996  "Whether or not short slot time is supported (only used by ERP APs or STAs).",
997  BooleanValue (true),
1000  MakeBooleanChecker ())
1001  .AddAttribute ("Txop",
1002  "The Txop object.",
1003  PointerValue (),
1005  MakePointerChecker<Txop> ())
1006  .AddAttribute ("VO_Txop",
1007  "Queue that manages packets belonging to AC_VO access class.",
1008  PointerValue (),
1010  MakePointerChecker<QosTxop> ())
1011  .AddAttribute ("VI_Txop",
1012  "Queue that manages packets belonging to AC_VI access class.",
1013  PointerValue (),
1015  MakePointerChecker<QosTxop> ())
1016  .AddAttribute ("BE_Txop",
1017  "Queue that manages packets belonging to AC_BE access class.",
1018  PointerValue (),
1020  MakePointerChecker<QosTxop> ())
1021  .AddAttribute ("BK_Txop",
1022  "Queue that manages packets belonging to AC_BK access class.",
1023  PointerValue (),
1025  MakePointerChecker<QosTxop> ())
1026  .AddTraceSource ("TxOkHeader",
1027  "The header of successfully transmitted packet.",
1029  "ns3::WifiMacHeader::TracedCallback")
1030  .AddTraceSource ("TxErrHeader",
1031  "The header of unsuccessfully transmitted packet.",
1033  "ns3::WifiMacHeader::TracedCallback")
1034  ;
1035  return tid;
1036 }
1037 
1038 void
1040 {
1041  NS_LOG_FUNCTION (this << standard);
1042  uint32_t cwmin = 0;
1043  uint32_t cwmax = 0;
1044  switch (standard)
1045  {
1047  case WIFI_STANDARD_80211ac:
1050  {
1051  EnableAggregation ();
1052  SetQosSupported (true);
1053  cwmin = 15;
1054  cwmax = 1023;
1055  break;
1056  }
1059  {
1060  EnableAggregation ();
1061  SetQosSupported (true);
1062  }
1063  case WIFI_STANDARD_80211g:
1064  SetErpSupported (true);
1065  case WIFI_STANDARD_holland:
1066  case WIFI_STANDARD_80211a:
1067  case WIFI_STANDARD_80211p:
1068  cwmin = 15;
1069  cwmax = 1023;
1070  break;
1071  case WIFI_STANDARD_80211b:
1072  SetDsssSupported (true);
1073  cwmin = 31;
1074  cwmax = 1023;
1075  break;
1076  default:
1077  NS_FATAL_ERROR ("Unsupported WifiPhyStandard in RegularWifiMac::FinishConfigureStandard ()");
1078  }
1079 
1080  ConfigureContentionWindow (cwmin, cwmax);
1081 }
1082 
1083 void
1084 RegularWifiMac::ConfigureContentionWindow (uint32_t cwMin, uint32_t cwMax)
1085 {
1086  bool isDsssOnly = m_dsssSupported && !m_erpSupported;
1087  //The special value of AC_BE_NQOS which exists in the Access
1088  //Category enumeration allows us to configure plain old DCF.
1089  ConfigureDcf (m_txop, cwMin, cwMax, isDsssOnly, AC_BE_NQOS);
1090 
1091  //Now we configure the EDCA functions
1092  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
1093  {
1094  ConfigureDcf (i->second, cwMin, cwMax, isDsssOnly, i->first);
1095  }
1096 }
1097 
1098 void
1100 {
1101  NS_LOG_FUNCTION (this << hdr);
1102  m_txOkCallback (hdr);
1103 }
1104 
1105 void
1107 {
1108  NS_LOG_FUNCTION (this << hdr);
1109  m_txErrCallback (hdr);
1110 }
1111 
1112 void
1114 {
1115  NS_LOG_FUNCTION (this);
1116  if (m_low->GetMsduAggregator () == 0)
1117  {
1118  Ptr<MsduAggregator> msduAggregator = CreateObject<MsduAggregator> ();
1119  msduAggregator->SetEdcaQueues (m_edca);
1120  m_low->SetMsduAggregator (msduAggregator);
1121  }
1122  if (m_low->GetMpduAggregator () == 0)
1123  {
1124  Ptr<MpduAggregator> mpduAggregator = CreateObject<MpduAggregator> ();
1125  mpduAggregator->SetEdcaQueues (m_edca);
1126  m_low->SetMpduAggregator (mpduAggregator);
1127  }
1128 }
1129 
1130 void
1132 {
1133  NS_LOG_FUNCTION (this);
1134  m_low->SetMsduAggregator (0);
1135  m_low->SetMpduAggregator (0);
1136 }
1137 
1138 } //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:4138
#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:1425
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:54
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:60
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:97
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:1515
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:4132
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:1302
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:58
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:463
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.
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:441
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:1548
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:62
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:119
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:1566
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.