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 "wifi-utils.h"
32 #include "mgt-headers.h"
33 #include "amsdu-subframe-header.h"
34 #include "wifi-net-device.h"
35 #include "ht-configuration.h"
36 #include "vht-configuration.h"
37 #include "he-configuration.h"
38 #include <algorithm>
39 #include <cmath>
40 
41 namespace ns3 {
42 
43 NS_LOG_COMPONENT_DEFINE ("RegularWifiMac");
44 
45 NS_OBJECT_ENSURE_REGISTERED (RegularWifiMac);
46 
48  : m_qosSupported (0),
49  m_erpSupported (0),
50  m_dsssSupported (0)
51 {
52  NS_LOG_FUNCTION (this);
53  m_rxMiddle = Create<MacRxMiddle> ();
54  m_rxMiddle->SetForwardCallback (MakeCallback (&RegularWifiMac::Receive, this));
55 
56  m_txMiddle = Create<MacTxMiddle> ();
57 
58  m_low = CreateObject<MacLow> ();
60  m_low->SetMac (this);
61 
62  m_channelAccessManager = CreateObject<ChannelAccessManager> ();
64 
65  m_txop = CreateObject<Txop> ();
72 
73  //Construct the EDCAFs. The ordering is important - highest
74  //priority (Table 9-1 UP-to-AC mapping; IEEE 802.11-2012) must be created
75  //first.
80 }
81 
83 {
84  NS_LOG_FUNCTION (this);
85 }
86 
87 void
89 {
90  NS_LOG_FUNCTION (this);
91  m_txop->Initialize ();
92 
93  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
94  {
95  i->second->Initialize ();
96  }
97 }
98 
99 void
101 {
102  NS_LOG_FUNCTION (this);
103 
104  m_rxMiddle = 0;
105  m_txMiddle = 0;
106 
107  m_low->Dispose ();
108  m_low = 0;
109 
110  m_phy = 0;
111  m_stationManager = 0;
112 
113  m_txop->Dispose ();
114  m_txop = 0;
115 
116  for (EdcaQueues::iterator i = m_edca.begin (); i != m_edca.end (); ++i)
117  {
118  i->second->Dispose ();
119  i->second = 0;
120  }
121 
124 
126 }
127 
128 void
130 {
131  NS_LOG_FUNCTION (this << stationManager);
132  m_stationManager = stationManager;
133  m_low->SetWifiRemoteStationManager (stationManager);
134  m_txop->SetWifiRemoteStationManager (stationManager);
135  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
136  {
137  i->second->SetWifiRemoteStationManager (stationManager);
138  }
139 }
140 
143 {
144  return m_stationManager;
145 }
146 
149 {
150  NS_LOG_FUNCTION (this);
151  ExtendedCapabilities capabilities;
152  capabilities.SetHtSupported (GetHtSupported ());
153  capabilities.SetVhtSupported (GetVhtSupported ());
154  //TODO: to be completed
155  return capabilities;
156 }
157 
160 {
161  NS_LOG_FUNCTION (this);
162  HtCapabilities capabilities;
163  if (GetHtSupported ())
164  {
165  Ptr<HtConfiguration> htConfiguration = GetHtConfiguration ();
166  bool greenfieldSupported = htConfiguration->GetGreenfieldSupported ();
167  bool sgiSupported = htConfiguration->GetShortGuardIntervalSupported ();
168  capabilities.SetHtSupported (1);
169  capabilities.SetLdpc (0);
170  capabilities.SetSupportedChannelWidth (m_phy->GetChannelWidth () >= 40);
171  capabilities.SetShortGuardInterval20 (sgiSupported);
172  capabilities.SetShortGuardInterval40 (m_phy->GetChannelWidth () >= 40 && sgiSupported);
173  capabilities.SetGreenfield (greenfieldSupported);
174  // Set Maximum A-MSDU Length subfield
175  uint16_t maxAmsduSize = std::max ({m_voMaxAmsduSize, m_viMaxAmsduSize,
177  if (maxAmsduSize <= 3839)
178  {
179  capabilities.SetMaxAmsduLength (3839);
180  }
181  else
182  {
183  capabilities.SetMaxAmsduLength (7935);
184  }
185  uint32_t maxAmpduLength = std::max ({m_voMaxAmpduSize, m_viMaxAmpduSize,
187  // round to the next power of two minus one
188  maxAmpduLength = (1ul << static_cast<uint32_t> (std::ceil (std::log2 (maxAmpduLength + 1)))) - 1;
189  // The maximum A-MPDU length in HT capabilities elements ranges from 2^13-1 to 2^16-1
190  capabilities.SetMaxAmpduLength (std::min (std::max (maxAmpduLength, 8191u), 65535u));
191 
192  capabilities.SetLSigProtectionSupport (!greenfieldSupported);
193  uint64_t maxSupportedRate = 0; //in bit/s
194  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
195  {
196  WifiMode mcs = m_phy->GetMcs (i);
198  {
199  continue;
200  }
201  capabilities.SetRxMcsBitmask (mcs.GetMcsValue ());
202  uint8_t nss = (mcs.GetMcsValue () / 8) + 1;
203  NS_ASSERT (nss > 0 && nss < 5);
204  uint64_t dataRate = mcs.GetDataRate (m_phy->GetChannelWidth (), sgiSupported ? 400 : 800, nss);
205  if (dataRate > maxSupportedRate)
206  {
207  maxSupportedRate = dataRate;
208  NS_LOG_DEBUG ("Updating maxSupportedRate to " << maxSupportedRate);
209  }
210  }
211  capabilities.SetRxHighestSupportedDataRate (static_cast<uint16_t> (maxSupportedRate / 1e6)); //in Mbit/s
212  capabilities.SetTxMcsSetDefined (m_phy->GetNMcs () > 0);
214  //we do not support unequal modulations
215  capabilities.SetTxRxMcsSetUnequal (0);
216  capabilities.SetTxUnequalModulation (0);
217  }
218  return capabilities;
219 }
220 
223 {
224  NS_LOG_FUNCTION (this);
225  VhtCapabilities capabilities;
226  if (GetVhtSupported ())
227  {
228  Ptr<HtConfiguration> htConfiguration = GetHtConfiguration ();
229  Ptr<VhtConfiguration> vhtConfiguration = GetVhtConfiguration ();
230  bool sgiSupported = htConfiguration->GetShortGuardIntervalSupported ();
231  capabilities.SetVhtSupported (1);
232  if (m_phy->GetChannelWidth () == 160)
233  {
234  capabilities.SetSupportedChannelWidthSet (1);
235  }
236  else
237  {
238  capabilities.SetSupportedChannelWidthSet (0);
239  }
240  // Set Maximum MPDU Length subfield
241  uint16_t maxAmsduSize = std::max ({m_voMaxAmsduSize, m_viMaxAmsduSize,
243  if (maxAmsduSize <= 3839)
244  {
245  capabilities.SetMaxMpduLength (3895);
246  }
247  else if (maxAmsduSize <= 7935)
248  {
249  capabilities.SetMaxMpduLength (7991);
250  }
251  else
252  {
253  capabilities.SetMaxMpduLength (11454);
254  }
255  uint32_t maxAmpduLength = std::max ({m_voMaxAmpduSize, m_viMaxAmpduSize,
257  // round to the next power of two minus one
258  maxAmpduLength = (1ul << static_cast<uint32_t> (std::ceil (std::log2 (maxAmpduLength + 1)))) - 1;
259  // The maximum A-MPDU length in VHT capabilities elements ranges from 2^13-1 to 2^20-1
260  capabilities.SetMaxAmpduLength (std::min (std::max (maxAmpduLength, 8191u), 1048575u));
261 
262  capabilities.SetRxLdpc (0);
263  capabilities.SetShortGuardIntervalFor80Mhz ((m_phy->GetChannelWidth () == 80) && sgiSupported);
264  capabilities.SetShortGuardIntervalFor160Mhz ((m_phy->GetChannelWidth () == 160) && sgiSupported);
265  uint8_t maxMcs = 0;
266  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
267  {
268  WifiMode mcs = m_phy->GetMcs (i);
269  if ((mcs.GetModulationClass () == WIFI_MOD_CLASS_VHT)
270  && (mcs.GetMcsValue () > maxMcs))
271  {
272  maxMcs = mcs.GetMcsValue ();
273  }
274  }
275  // Support same MaxMCS for each spatial stream
276  for (uint8_t nss = 1; nss <= m_phy->GetMaxSupportedRxSpatialStreams (); nss++)
277  {
278  capabilities.SetRxMcsMap (maxMcs, nss);
279  }
280  for (uint8_t nss = 1; nss <= m_phy->GetMaxSupportedTxSpatialStreams (); nss++)
281  {
282  capabilities.SetTxMcsMap (maxMcs, nss);
283  }
284  uint64_t maxSupportedRateLGI = 0; //in bit/s
285  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
286  {
287  WifiMode mcs = m_phy->GetMcs (i);
289  {
290  continue;
291  }
292  if (mcs.GetDataRate (m_phy->GetChannelWidth ()) > maxSupportedRateLGI)
293  {
294  maxSupportedRateLGI = mcs.GetDataRate (m_phy->GetChannelWidth ());
295  NS_LOG_DEBUG ("Updating maxSupportedRateLGI to " << maxSupportedRateLGI);
296  }
297  }
298  capabilities.SetRxHighestSupportedLgiDataRate (static_cast<uint16_t> (maxSupportedRateLGI / 1e6)); //in Mbit/s
299  capabilities.SetTxHighestSupportedLgiDataRate (static_cast<uint16_t> (maxSupportedRateLGI / 1e6)); //in Mbit/s
300  //To be filled in once supported
301  capabilities.SetRxStbc (0);
302  capabilities.SetTxStbc (0);
303  }
304  return capabilities;
305 }
306 
309 {
310  NS_LOG_FUNCTION (this);
311  HeCapabilities capabilities;
312  if (GetHeSupported ())
313  {
314  Ptr<HeConfiguration> heConfiguration = GetHeConfiguration ();
315  capabilities.SetHeSupported (1);
316  uint8_t channelWidthSet = 0;
317  if (m_phy->GetChannelWidth () >= 40 && Is2_4Ghz (m_phy->GetFrequency ()))
318  {
319  channelWidthSet |= 0x01;
320  }
321  if (m_phy->GetChannelWidth () >= 80 && Is5Ghz (m_phy->GetFrequency ()))
322  {
323  channelWidthSet |= 0x02;
324  }
325  if (m_phy->GetChannelWidth () >= 160 && Is5Ghz (m_phy->GetFrequency ()))
326  {
327  channelWidthSet |= 0x04;
328  }
329  capabilities.SetChannelWidthSet (channelWidthSet);
330  uint8_t gi = 0;
331  if (heConfiguration->GetGuardInterval () <= NanoSeconds (1600))
332  {
333  //todo: We assume for now that if we support 800ns GI then 1600ns GI is supported as well
334  gi |= 0x01;
335  }
336  if (heConfiguration->GetGuardInterval () == NanoSeconds (800))
337  {
338  gi |= 0x02;
339  }
340  capabilities.SetHeLtfAndGiForHePpdus (gi);
341  uint32_t maxAmpduLength = std::max ({m_voMaxAmpduSize, m_viMaxAmpduSize,
343  // round to the next power of two minus one
344  maxAmpduLength = (1ul << static_cast<uint32_t> (std::ceil (std::log2 (maxAmpduLength + 1)))) - 1;
345  // The maximum A-MPDU length in HE capabilities elements ranges from 2^20-1 to 2^23-1
346  capabilities.SetMaxAmpduLength (std::min (std::max (maxAmpduLength, 1048575u), 8388607u));
347 
348  uint8_t maxMcs = 0;
349  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
350  {
351  WifiMode mcs = m_phy->GetMcs (i);
352  if ((mcs.GetModulationClass () == WIFI_MOD_CLASS_HE)
353  && (mcs.GetMcsValue () > maxMcs))
354  {
355  maxMcs = mcs.GetMcsValue ();
356  }
357  }
358  capabilities.SetHighestMcsSupported (maxMcs);
360  }
361  return capabilities;
362 }
363 
364 void
366 {
367  NS_LOG_FUNCTION (this << +threshold);
368  GetVOQueue ()->SetBlockAckThreshold (threshold);
369 }
370 
371 void
373 {
374  NS_LOG_FUNCTION (this << +threshold);
375  GetVIQueue ()->SetBlockAckThreshold (threshold);
376 }
377 
378 void
380 {
381  NS_LOG_FUNCTION (this << +threshold);
382  GetBEQueue ()->SetBlockAckThreshold (threshold);
383 }
384 
385 void
387 {
388  NS_LOG_FUNCTION (this << +threshold);
389  GetBKQueue ()->SetBlockAckThreshold (threshold);
390 }
391 
392 void
394 {
395  NS_LOG_FUNCTION (this << timeout);
397 }
398 
399 void
401 {
402  NS_LOG_FUNCTION (this << timeout);
404 }
405 
406 void
408 {
409  NS_LOG_FUNCTION (this << timeout);
411 }
412 
413 void
415 {
416  NS_LOG_FUNCTION (this << timeout);
418 }
419 
420 void
422 {
423  NS_LOG_FUNCTION (this << ac);
424 
425  //Our caller shouldn't be attempting to setup a queue that is
426  //already configured.
427  NS_ASSERT (m_edca.find (ac) == m_edca.end ());
428 
429  Ptr<QosTxop> edca = CreateObject<QosTxop> ();
430  edca->SetMacLow (m_low);
431  edca->SetChannelAccessManager (m_channelAccessManager);
432  edca->SetTxMiddle (m_txMiddle);
433  edca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this));
434  edca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this));
435  edca->SetTxDroppedCallback (MakeCallback (&RegularWifiMac::NotifyTxDrop, this));
436  edca->SetAccessCategory (ac);
437  edca->CompleteConfig ();
438 
439  m_edca.insert (std::make_pair (ac, edca));
440 }
441 
442 void
444 {
445  NS_LOG_FUNCTION (this << type);
446  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
447  {
448  i->second->SetTypeOfStation (type);
449  }
450 }
451 
452 Ptr<Txop>
454 {
455  return m_txop;
456 }
457 
460 {
461  return m_edca.find (AC_VO)->second;
462 }
463 
466 {
467  return m_edca.find (AC_VI)->second;
468 }
469 
472 {
473  return m_edca.find (AC_BE)->second;
474 }
475 
478 {
479  return m_edca.find (AC_BK)->second;
480 }
481 
482 void
484 {
485  NS_LOG_FUNCTION (this << phy);
486  m_phy = phy;
488  m_low->SetPhy (phy);
489 }
490 
493 {
494  NS_LOG_FUNCTION (this);
495  return m_phy;
496 }
497 
498 void
500 {
501  NS_LOG_FUNCTION (this);
502  m_low->ResetPhy ();
504  m_phy = 0;
505 }
506 
507 void
509 {
510  NS_LOG_FUNCTION (this);
511  m_forwardUp = upCallback;
512 }
513 
514 void
516 {
517  NS_LOG_FUNCTION (this);
518  m_linkUp = linkUp;
519 }
520 
521 void
523 {
524  NS_LOG_FUNCTION (this);
525  m_linkDown = linkDown;
526 }
527 
528 void
530 {
531  NS_LOG_FUNCTION (this << enable);
532  m_qosSupported = enable;
533 }
534 
535 bool
537 {
538  return m_qosSupported;
539 }
540 
541 void
543 {
544  //To be removed once deprecated API is cleaned up
545 }
546 
547 void
549 {
550  //To be removed once deprecated API is cleaned up
551 }
552 
553 void
555 {
556  //To be removed once deprecated API is cleaned up
557 }
558 
559 bool
561 {
562  if (GetHtConfiguration ())
563  {
564  return true;
565  }
566  return false;
567 }
568 
569 bool
571 {
572  if (GetVhtConfiguration ())
573  {
574  return true;
575  }
576  return false;
577 }
578 
579 bool
581 {
582  if (GetHeConfiguration ())
583  {
584  return true;
585  }
586  return false;
587 }
588 
589 bool
591 {
592  return m_erpSupported;
593 }
594 
595 void
597 {
598  NS_LOG_FUNCTION (this);
599  if (enable)
600  {
601  SetDsssSupported (true);
602  }
603  m_erpSupported = enable;
604 }
605 
606 void
608 {
609  NS_LOG_FUNCTION (this);
610  m_dsssSupported = enable;
611 }
612 
613 bool
615 {
616  return m_dsssSupported;
617 }
618 
619 void
621 {
622  NS_LOG_FUNCTION (this);
623  m_low->SetCtsToSelfSupported (enable);
624 }
625 
626 void
628 {
629  NS_LOG_FUNCTION (this << slotTime);
630  m_channelAccessManager->SetSlot (slotTime);
631  m_low->SetSlotTime (slotTime);
632 }
633 
634 Time
636 {
637  return m_low->GetSlotTime ();
638 }
639 
640 void
642 {
643  NS_LOG_FUNCTION (this << sifs);
645  m_low->SetSifs (sifs);
646 }
647 
648 Time
650 {
651  return m_low->GetSifs ();
652 }
653 
654 void
656 {
657  NS_LOG_FUNCTION (this << eifsNoDifs);
659 }
660 
661 Time
663 {
665 }
666 
667 void
669 {
670  NS_LOG_FUNCTION (this << rifs);
671  m_low->SetRifs (rifs);
672 }
673 
674 Time
676 {
677  return m_low->GetRifs ();
678 }
679 
680 void
682 {
683  NS_LOG_FUNCTION (this << pifs);
684  m_low->SetPifs (pifs);
685 }
686 
687 Time
689 {
690  return m_low->GetPifs ();
691 }
692 
693 void
695 {
696  NS_LOG_FUNCTION (this << ackTimeout);
697  m_low->SetAckTimeout (ackTimeout);
698 }
699 
700 Time
702 {
703  return m_low->GetAckTimeout ();
704 }
705 
706 void
708 {
709  NS_LOG_FUNCTION (this << blockAckTimeout);
710  m_low->SetBasicBlockAckTimeout (blockAckTimeout);
711 }
712 
713 Time
715 {
716  return m_low->GetBasicBlockAckTimeout ();
717 }
718 
719 void
721 {
722  NS_LOG_FUNCTION (this << blockAckTimeout);
723  m_low->SetCompressedBlockAckTimeout (blockAckTimeout);
724 }
725 
726 Time
728 {
729  return m_low->GetCompressedBlockAckTimeout ();
730 }
731 
732 void
734 {
735  NS_LOG_FUNCTION (this << address);
736  m_low->SetAddress (address);
737 }
738 
741 {
742  return m_low->GetAddress ();
743 }
744 
745 void
747 {
748  NS_LOG_FUNCTION (this << ssid);
749  m_ssid = ssid;
750 }
751 
752 Ssid
754 {
755  return m_ssid;
756 }
757 
758 void
760 {
761  NS_LOG_FUNCTION (this << bssid);
762  m_low->SetBssid (bssid);
763 }
764 
767 {
768  return m_low->GetBssid ();
769 }
770 
771 void
773 {
774  m_low->SetPromisc ();
775 }
776 
777 void
779 {
780  NS_LOG_FUNCTION (this << enable);
781  m_shortSlotTimeSupported = enable;
782 }
783 
784 bool
786 {
788 }
789 
790 void
792 {
793  NS_LOG_FUNCTION (this << enable);
794  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
795  if (device)
796  {
797  Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
798  if (htConfiguration)
799  {
800  htConfiguration->SetRifsSupported (enable);
801  }
802  }
803  m_rifsSupported = enable;
804 }
805 
806 bool
808 {
809  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
810  if (device)
811  {
812  Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
813  if (htConfiguration)
814  {
815  return htConfiguration->GetRifsSupported ();
816  }
817  }
818  return m_rifsSupported;
819 }
820 
821 void
823  Mac48Address to, Mac48Address from)
824 {
825  //We expect RegularWifiMac subclasses which do support forwarding (e.g.,
826  //AP) to override this method. Therefore, we throw a fatal error if
827  //someone tries to invoke this method on a class which has not done
828  //this.
829  NS_FATAL_ERROR ("This MAC entity (" << this << ", " << GetAddress ()
830  << ") does not support Enqueue() with from address");
831 }
832 
833 bool
835 {
836  return false;
837 }
838 
839 void
841 {
842  NS_LOG_FUNCTION (this << packet << from << to);
843  m_forwardUp (packet, from, to);
844 }
845 
846 void
848 {
849  NS_LOG_FUNCTION (this << *mpdu);
850 
851  const WifiMacHeader* hdr = &mpdu->GetHeader ();
852  Ptr<Packet> packet = mpdu->GetPacket ()->Copy ();
853  Mac48Address to = hdr->GetAddr1 ();
854  Mac48Address from = hdr->GetAddr2 ();
855 
856  //We don't know how to deal with any frame that is not addressed to
857  //us (and odds are there is nothing sensible we could do anyway),
858  //so we ignore such frames.
859  //
860  //The derived class may also do some such filtering, but it doesn't
861  //hurt to have it here too as a backstop.
862  if (to != GetAddress ())
863  {
864  return;
865  }
866 
867  if (hdr->IsMgt () && hdr->IsAction ())
868  {
869  //There is currently only any reason for Management Action
870  //frames to be flying about if we are a QoS STA.
872 
873  WifiActionHeader actionHdr;
874  packet->RemoveHeader (actionHdr);
875 
876  switch (actionHdr.GetCategory ())
877  {
879 
880  switch (actionHdr.GetAction ().blockAck)
881  {
883  {
884  MgtAddBaRequestHeader reqHdr;
885  packet->RemoveHeader (reqHdr);
886 
887  //We've received an ADDBA Request. Our policy here is
888  //to automatically accept it, so we get the ADDBA
889  //Response on it's way immediately.
890  SendAddBaResponse (&reqHdr, from);
891  //This frame is now completely dealt with, so we're done.
892  return;
893  }
895  {
896  MgtAddBaResponseHeader respHdr;
897  packet->RemoveHeader (respHdr);
898 
899  //We've received an ADDBA Response. We assume that it
900  //indicates success after an ADDBA Request we have
901  //sent (we could, in principle, check this, but it
902  //seems a waste given the level of the current model)
903  //and act by locally establishing the agreement on
904  //the appropriate queue.
905  AcIndex ac = QosUtilsMapTidToAc (respHdr.GetTid ());
906  m_edca[ac]->GotAddBaResponse (&respHdr, from);
907  //This frame is now completely dealt with, so we're done.
908  return;
909  }
911  {
912  MgtDelBaHeader delBaHdr;
913  packet->RemoveHeader (delBaHdr);
914 
915  if (delBaHdr.IsByOriginator ())
916  {
917  //This DELBA frame was sent by the originator, so
918  //this means that an ingoing established
919  //agreement exists in MacLow and we need to
920  //destroy it.
921  m_low->DestroyBlockAckAgreement (from, delBaHdr.GetTid ());
922  }
923  else
924  {
925  //We must have been the originator. We need to
926  //tell the correct queue that the agreement has
927  //been torn down
928  AcIndex ac = QosUtilsMapTidToAc (delBaHdr.GetTid ());
929  m_edca[ac]->GotDelBaFrame (&delBaHdr, from);
930  }
931  //This frame is now completely dealt with, so we're done.
932  return;
933  }
934  default:
935  NS_FATAL_ERROR ("Unsupported Action field in Block Ack Action frame");
936  return;
937  }
938  default:
939  NS_FATAL_ERROR ("Unsupported Action frame received");
940  return;
941  }
942  }
943  NS_FATAL_ERROR ("Don't know how to handle frame (type=" << hdr->GetType ());
944 }
945 
946 void
948 {
949  NS_LOG_FUNCTION (this << *mpdu);
950  for (auto& msduPair : *PeekPointer (mpdu))
951  {
952  ForwardUp (msduPair.first, msduPair.second.GetSourceAddr (),
953  msduPair.second.GetDestinationAddr ());
954  }
955 }
956 
957 void
959  Mac48Address originator)
960 {
961  NS_LOG_FUNCTION (this);
962  WifiMacHeader hdr;
964  hdr.SetAddr1 (originator);
965  hdr.SetAddr2 (GetAddress ());
966  hdr.SetAddr3 (GetBssid ());
967  hdr.SetDsNotFrom ();
968  hdr.SetDsNotTo ();
969 
970  MgtAddBaResponseHeader respHdr;
971  StatusCode code;
972  code.SetSuccess ();
973  respHdr.SetStatusCode (code);
974  //Here a control about queues type?
975  respHdr.SetAmsduSupport (reqHdr->IsAmsduSupported ());
976 
977  if (reqHdr->IsImmediateBlockAck ())
978  {
979  respHdr.SetImmediateBlockAck ();
980  }
981  else
982  {
983  respHdr.SetDelayedBlockAck ();
984  }
985  respHdr.SetTid (reqHdr->GetTid ());
986 
987  Ptr<HeConfiguration> heConfiguration = GetHeConfiguration ();
988  if (heConfiguration && heConfiguration->GetMpduBufferSize () > 64)
989  {
990  respHdr.SetBufferSize (255);
991  }
992  else
993  {
994  respHdr.SetBufferSize (63);
995  }
996  respHdr.SetTimeout (reqHdr->GetTimeout ());
997 
998  WifiActionHeader actionHdr;
1001  actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
1002 
1003  Ptr<Packet> packet = Create<Packet> ();
1004  packet->AddHeader (respHdr);
1005  packet->AddHeader (actionHdr);
1006 
1007  //We need to notify our MacLow object as it will have to buffer all
1008  //correctly received packets for this Block Ack session
1009  m_low->CreateBlockAckAgreement (&respHdr, originator,
1010  reqHdr->GetStartingSequence ());
1011 
1012  //It is unclear which queue this frame should go into. For now we
1013  //bung it into the queue corresponding to the TID for which we are
1014  //establishing an agreement, and push it to the head.
1015  m_edca[QosUtilsMapTidToAc (reqHdr->GetTid ())]->PushFront (packet, hdr);
1016 }
1017 
1018 TypeId
1020 {
1021  static TypeId tid = TypeId ("ns3::RegularWifiMac")
1022  .SetParent<WifiMac> ()
1023  .SetGroupName ("Wifi")
1024  .AddAttribute ("QosSupported",
1025  "This Boolean attribute is set to enable 802.11e/WMM-style QoS support at this STA.",
1026  BooleanValue (false),
1029  MakeBooleanChecker ())
1030  .AddAttribute ("HtSupported",
1031  "This Boolean attribute is set to enable 802.11n support at this STA.",
1032  BooleanValue (false),
1035  MakeBooleanChecker (),
1036  TypeId::DEPRECATED, "Not used anymore")
1037  .AddAttribute ("VhtSupported",
1038  "This Boolean attribute is set to enable 802.11ac support at this STA.",
1039  BooleanValue (false),
1042  MakeBooleanChecker (),
1043  TypeId::DEPRECATED, "Not used anymore")
1044  .AddAttribute ("HeSupported",
1045  "This Boolean attribute is set to enable 802.11ax support at this STA.",
1046  BooleanValue (false),
1049  MakeBooleanChecker (),
1050  TypeId::DEPRECATED, "Not used anymore")
1051  .AddAttribute ("CtsToSelfSupported",
1052  "Use CTS to Self when using a rate that is not in the basic rate set.",
1053  BooleanValue (false),
1055  MakeBooleanChecker ())
1056  .AddAttribute ("VO_MaxAmsduSize",
1057  "Maximum length in bytes of an A-MSDU for AC_VO access class "
1058  "(capped to 7935 for HT PPDUs and 11398 for VHT/HE PPDUs). "
1059  "Value 0 means A-MSDU aggregation is disabled for that AC.",
1060  UintegerValue (0),
1062  MakeUintegerChecker<uint16_t> (0, 11398))
1063  .AddAttribute ("VI_MaxAmsduSize",
1064  "Maximum length in bytes of an A-MSDU for AC_VI access class "
1065  "(capped to 7935 for HT PPDUs and 11398 for VHT/HE PPDUs). "
1066  "Value 0 means A-MSDU aggregation is disabled for that AC.",
1067  UintegerValue (0),
1069  MakeUintegerChecker<uint16_t> (0, 11398))
1070  .AddAttribute ("BE_MaxAmsduSize",
1071  "Maximum length in bytes of an A-MSDU for AC_BE access class "
1072  "(capped to 7935 for HT PPDUs and 11398 for VHT/HE PPDUs). "
1073  "Value 0 means A-MSDU aggregation is disabled for that AC.",
1074  UintegerValue (0),
1076  MakeUintegerChecker<uint16_t> (0, 11398))
1077  .AddAttribute ("BK_MaxAmsduSize",
1078  "Maximum length in bytes of an A-MSDU for AC_BK access class "
1079  "(capped to 7935 for HT PPDUs and 11398 for VHT/HE PPDUs). "
1080  "Value 0 means A-MSDU aggregation is disabled for that AC.",
1081  UintegerValue (0),
1083  MakeUintegerChecker<uint16_t> (0, 11398))
1084  .AddAttribute ("VO_MaxAmpduSize",
1085  "Maximum length in bytes of an A-MPDU for AC_VO access class "
1086  "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, and 8388607 for HE PPDUs). "
1087  "Value 0 means A-MPDU aggregation is disabled for that AC.",
1088  UintegerValue (0),
1090  MakeUintegerChecker<uint32_t> ())
1091  .AddAttribute ("VI_MaxAmpduSize",
1092  "Maximum length in bytes of an A-MPDU for AC_VI access class "
1093  "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, and 8388607 for HE PPDUs). "
1094  "Value 0 means A-MPDU aggregation is disabled for that AC.",
1095  UintegerValue (65535),
1097  MakeUintegerChecker<uint32_t> ())
1098  .AddAttribute ("BE_MaxAmpduSize",
1099  "Maximum length in bytes of an A-MPDU for AC_BE access class "
1100  "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, and 8388607 for HE PPDUs). "
1101  "Value 0 means A-MPDU aggregation is disabled for that AC.",
1102  UintegerValue (65535),
1104  MakeUintegerChecker<uint32_t> ())
1105  .AddAttribute ("BK_MaxAmpduSize",
1106  "Maximum length in bytes of an A-MPDU for AC_BK access class "
1107  "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, and 8388607 for HE PPDUs). "
1108  "Value 0 means A-MPDU aggregation is disabled for that AC.",
1109  UintegerValue (0),
1111  MakeUintegerChecker<uint32_t> ())
1112  .AddAttribute ("VO_BlockAckThreshold",
1113  "If number of packets in VO queue reaches this value, "
1114  "block ack mechanism is used. If this value is 0, block ack is never used."
1115  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
1116  UintegerValue (0),
1118  MakeUintegerChecker<uint8_t> (0, 64))
1119  .AddAttribute ("VI_BlockAckThreshold",
1120  "If number of packets in VI queue reaches this value, "
1121  "block ack mechanism is used. If this value is 0, block ack is never used."
1122  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
1123  UintegerValue (0),
1125  MakeUintegerChecker<uint8_t> (0, 64))
1126  .AddAttribute ("BE_BlockAckThreshold",
1127  "If number of packets in BE queue reaches this value, "
1128  "block ack mechanism is used. If this value is 0, block ack is never used."
1129  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
1130  UintegerValue (0),
1132  MakeUintegerChecker<uint8_t> (0, 64))
1133  .AddAttribute ("BK_BlockAckThreshold",
1134  "If number of packets in BK queue reaches this value, "
1135  "block ack mechanism is used. If this value is 0, block ack is never used."
1136  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
1137  UintegerValue (0),
1139  MakeUintegerChecker<uint8_t> (0, 64))
1140  .AddAttribute ("VO_BlockAckInactivityTimeout",
1141  "Represents max time (blocks of 1024 microseconds) allowed for block ack"
1142  "inactivity for AC_VO. If this value isn't equal to 0 a timer start after that a"
1143  "block ack setup is completed and will be reset every time that a block ack"
1144  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
1145  UintegerValue (0),
1147  MakeUintegerChecker<uint16_t> ())
1148  .AddAttribute ("VI_BlockAckInactivityTimeout",
1149  "Represents max time (blocks of 1024 microseconds) allowed for block ack"
1150  "inactivity for AC_VI. If this value isn't equal to 0 a timer start after that a"
1151  "block ack setup is completed and will be reset every time that a block ack"
1152  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
1153  UintegerValue (0),
1155  MakeUintegerChecker<uint16_t> ())
1156  .AddAttribute ("BE_BlockAckInactivityTimeout",
1157  "Represents max time (blocks of 1024 microseconds) allowed for block ack"
1158  "inactivity for AC_BE. If this value isn't equal to 0 a timer start after that a"
1159  "block ack setup is completed and will be reset every time that a block ack"
1160  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
1161  UintegerValue (0),
1163  MakeUintegerChecker<uint16_t> ())
1164  .AddAttribute ("BK_BlockAckInactivityTimeout",
1165  "Represents max time (blocks of 1024 microseconds) allowed for block ack"
1166  "inactivity for AC_BK. If this value isn't equal to 0 a timer start after that a"
1167  "block ack setup is completed and will be reset every time that a block ack"
1168  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
1169  UintegerValue (0),
1171  MakeUintegerChecker<uint16_t> ())
1172  .AddAttribute ("ShortSlotTimeSupported",
1173  "Whether or not short slot time is supported (only used by ERP APs or STAs).",
1174  BooleanValue (true),
1177  MakeBooleanChecker ())
1178  .AddAttribute ("RifsSupported",
1179  "Whether or not RIFS is supported (only used by HT APs or STAs).",
1180  BooleanValue (false),
1183  MakeBooleanChecker (),
1184  TypeId::DEPRECATED, "Use the HtConfiguration instead")
1185  .AddAttribute ("Txop",
1186  "The Txop object.",
1187  PointerValue (),
1189  MakePointerChecker<Txop> ())
1190  .AddAttribute ("VO_Txop",
1191  "Queue that manages packets belonging to AC_VO access class.",
1192  PointerValue (),
1194  MakePointerChecker<QosTxop> ())
1195  .AddAttribute ("VI_Txop",
1196  "Queue that manages packets belonging to AC_VI access class.",
1197  PointerValue (),
1199  MakePointerChecker<QosTxop> ())
1200  .AddAttribute ("BE_Txop",
1201  "Queue that manages packets belonging to AC_BE access class.",
1202  PointerValue (),
1204  MakePointerChecker<QosTxop> ())
1205  .AddAttribute ("BK_Txop",
1206  "Queue that manages packets belonging to AC_BK access class.",
1207  PointerValue (),
1209  MakePointerChecker<QosTxop> ())
1210  .AddTraceSource ("TxOkHeader",
1211  "The header of successfully transmitted packet.",
1213  "ns3::WifiMacHeader::TracedCallback")
1214  .AddTraceSource ("TxErrHeader",
1215  "The header of unsuccessfully transmitted packet.",
1217  "ns3::WifiMacHeader::TracedCallback")
1218  ;
1219  return tid;
1220 }
1221 
1222 void
1224 {
1225  NS_LOG_FUNCTION (this << standard);
1226  uint32_t cwmin = 0;
1227  uint32_t cwmax = 0;
1228  switch (standard)
1229  {
1233  {
1234  EnableAggregation ();
1235  //To be removed once deprecated attributes are removed
1236  Ptr<HtConfiguration> htConfiguration = GetHtConfiguration ();
1237  NS_ASSERT (htConfiguration);
1238  htConfiguration->SetRifsSupported (m_rifsSupported);
1239  SetQosSupported (true);
1240  cwmin = 15;
1241  cwmax = 1023;
1242  break;
1243  }
1246  {
1247  EnableAggregation ();
1248  //To be removed once deprecated RifsSupported attribute is removed
1249  Ptr<HtConfiguration> htConfiguration = GetHtConfiguration ();
1250  NS_ASSERT (htConfiguration);
1251  htConfiguration->SetRifsSupported (m_rifsSupported);
1252  SetQosSupported (true);
1253  }
1255  SetErpSupported (true);
1260  cwmin = 15;
1261  cwmax = 1023;
1262  break;
1264  SetDsssSupported (true);
1265  cwmin = 31;
1266  cwmax = 1023;
1267  break;
1268  default:
1269  NS_FATAL_ERROR ("Unsupported WifiPhyStandard in RegularWifiMac::FinishConfigureStandard ()");
1270  }
1271 
1272  ConfigureContentionWindow (cwmin, cwmax);
1273 }
1274 
1275 void
1276 RegularWifiMac::ConfigureContentionWindow (uint32_t cwMin, uint32_t cwMax)
1277 {
1278  bool isDsssOnly = m_dsssSupported && !m_erpSupported;
1279  //The special value of AC_BE_NQOS which exists in the Access
1280  //Category enumeration allows us to configure plain old DCF.
1281  ConfigureDcf (m_txop, cwMin, cwMax, isDsssOnly, AC_BE_NQOS);
1282 
1283  //Now we configure the EDCA functions
1284  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
1285  {
1286  ConfigureDcf (i->second, cwMin, cwMax, isDsssOnly, i->first);
1287  }
1288 }
1289 
1290 void
1292 {
1293  NS_LOG_FUNCTION (this << hdr);
1294  m_txOkCallback (hdr);
1295 }
1296 
1297 void
1299 {
1300  NS_LOG_FUNCTION (this << hdr);
1301  m_txErrCallback (hdr);
1302 }
1303 
1304 void
1306 {
1307  NS_LOG_FUNCTION (this);
1308  if (m_low->GetMsduAggregator () == 0)
1309  {
1310  Ptr<MsduAggregator> msduAggregator = CreateObject<MsduAggregator> ();
1311  msduAggregator->SetEdcaQueues (m_edca);
1312  m_low->SetMsduAggregator (msduAggregator);
1313  }
1314  if (m_low->GetMpduAggregator () == 0)
1315  {
1316  Ptr<MpduAggregator> mpduAggregator = CreateObject<MpduAggregator> ();
1317  mpduAggregator->SetEdcaQueues (m_edca);
1318  m_low->SetMpduAggregator (mpduAggregator);
1319  }
1320 }
1321 
1322 void
1324 {
1325  NS_LOG_FUNCTION (this);
1326  m_low->SetMsduAggregator (0);
1327  m_low->SetMpduAggregator (0);
1328 }
1329 
1330 } //namespace ns3
virtual void SetQosSupported(bool enable)
Enable or disable QoS support for the device.
ERP-OFDM PHY (Clause 19, Section 19.5)
void SetHeSupported(bool enable)
Enable or disable HE 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:483
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
void SetSifs(Time sifs)
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
OFDM PHY for the 5 GHz band (Clause 17 with 5 MHz channel bandwidth)
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.
Time GetSifs(void) const
HT PHY for the 5 GHz band (clause 20)
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:3994
#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.
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.
bool Is2_4Ghz(double frequency)
Definition: wifi-utils.cc:59
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 SetPifs(Time pifs)
void SetCompressedBlockAckTimeout(Time blockAckTimeout)
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)
bool GetRifsSupported(void) const
#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...
HE PHY for the 2.4 GHz band (clause 26)
void SetHighestNssSupported(uint8_t nss)
Set highest NSS supported.
OFDM PHY for the 5 GHz band (Clause 17 with 10 MHz channel bandwidth)
void SetSsid(Ssid ssid)
void SetSlot(Time slotTime)
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:162
WifiMacType GetType(void) const
Return the type (enum WifiMacType)
bool Is5Ghz(double frequency)
Definition: wifi-utils.cc:65
void SetLinkDownCallback(Callback< void > linkDown)
void SetHtSupported(bool enable)
Enable or disable HT support for the device.
CategoryValue GetCategory()
Return the category value.
HT PHY for the 2.4 GHz band (clause 20)
void SetRifsSupported(bool enable)
Enable or disable RIFS feature.
VHT PHY (Clause 22)
Definition: wifi-mode.h:60
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 SetRifs(Time rifs)
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
Time GetCompressedBlockAckTimeout(void) const
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:412
bool GetShortSlotTimeSupported(void) const
void SetTimeout(uint16_t timeout)
Set timeout.
Ptr< NetDevice > GetDevice(void) const
Return the device this PHY is associated with.
Definition: wifi-mac.cc:222
Time GetRifs(void) const
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.
bool m_rifsSupported
flag whether RIFS is supported (deprecated)
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:1392
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:3988
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
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
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:469
HE PHY for the 5 GHz band (clause 26)
void EnableAggregation(void)
Enable aggregation function.
Time GetBasicBlockAckTimeout(void) const
void SetEifsNoDifs(Time eifsNoDifs)
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 SetBasicBlockAckTimeout(Time blockAckTimeout)
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.
Time GetEifsNoDifs(void) const
void SetEifsNoDifs(Time eifsNoDifs)
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:1086
void FinishConfigureStandard(WifiPhyStandard standard)
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:241
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:210
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.
This is intended to be the configuration used in this paper: Gavin Holland, Nitin Vaidya and Paramvir...
Mac48Address GetAddr2(void) const
Return the address in the Address 2 field.
TracedCallback< const WifiMacHeader & > m_txOkCallback
transmit OK callback
Time GetAckTimeout(void) const
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.
OFDM PHY for the 5 GHz band (Clause 17)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Hold objects of type Ptr<T>.
Definition: pointer.h:36
address
Definition: first.py:44
void DisableAggregation(void)
Disable aggregation function.
uint16_t GetFrequency(void) const
Definition: wifi-phy.cc:1372
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
void SetVhtSupported(bool enable)
Enable or disable VHT support for the device.
DSSS PHY (Clause 15) and HR/DSSS PHY (Clause 18)
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.
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.
Time GetPifs(void) const
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:476
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
Attribute or trace source is deprecated; user is warned.
Definition: type-id.h:73
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
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.
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.
Ptr< HtConfiguration > GetHtConfiguration(void) const
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:1425
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
Time GetSlot(void) const
void SetAckTimeout(Time ackTimeout)
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:1443
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.