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 << ctsTimeout);
710  m_low->SetCtsTimeout (ctsTimeout);
711 }
712 
713 Time
715 {
716  return m_low->GetCtsTimeout ();
717 }
718 
719 void
721 {
722  NS_LOG_FUNCTION (this << blockAckTimeout);
723  m_low->SetBasicBlockAckTimeout (blockAckTimeout);
724 }
725 
726 Time
728 {
729  return m_low->GetBasicBlockAckTimeout ();
730 }
731 
732 void
734 {
735  NS_LOG_FUNCTION (this << blockAckTimeout);
736  m_low->SetCompressedBlockAckTimeout (blockAckTimeout);
737 }
738 
739 Time
741 {
742  return m_low->GetCompressedBlockAckTimeout ();
743 }
744 
745 void
747 {
748  NS_LOG_FUNCTION (this << address);
749  m_low->SetAddress (address);
750 }
751 
754 {
755  return m_low->GetAddress ();
756 }
757 
758 void
760 {
761  NS_LOG_FUNCTION (this << ssid);
762  m_ssid = ssid;
763 }
764 
765 Ssid
767 {
768  return m_ssid;
769 }
770 
771 void
773 {
774  NS_LOG_FUNCTION (this << bssid);
775  m_low->SetBssid (bssid);
776 }
777 
780 {
781  return m_low->GetBssid ();
782 }
783 
784 void
786 {
787  m_low->SetPromisc ();
788 }
789 
790 void
792 {
793  NS_LOG_FUNCTION (this << enable);
794  m_shortSlotTimeSupported = enable;
795 }
796 
797 bool
799 {
801 }
802 
803 void
805 {
806  NS_LOG_FUNCTION (this << enable);
807  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
808  if (device)
809  {
810  Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
811  if (htConfiguration)
812  {
813  htConfiguration->SetRifsSupported (enable);
814  }
815  }
816  m_rifsSupported = enable;
817 }
818 
819 bool
821 {
822  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (GetDevice ());
823  if (device)
824  {
825  Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
826  if (htConfiguration)
827  {
828  return htConfiguration->GetRifsSupported ();
829  }
830  }
831  return m_rifsSupported;
832 }
833 
834 void
836  Mac48Address to, Mac48Address from)
837 {
838  //We expect RegularWifiMac subclasses which do support forwarding (e.g.,
839  //AP) to override this method. Therefore, we throw a fatal error if
840  //someone tries to invoke this method on a class which has not done
841  //this.
842  NS_FATAL_ERROR ("This MAC entity (" << this << ", " << GetAddress ()
843  << ") does not support Enqueue() with from address");
844 }
845 
846 bool
848 {
849  return false;
850 }
851 
852 void
854 {
855  NS_LOG_FUNCTION (this << packet << from << to);
856  m_forwardUp (packet, from, to);
857 }
858 
859 void
861 {
862  NS_LOG_FUNCTION (this << packet << hdr);
863 
864  Mac48Address to = hdr->GetAddr1 ();
865  Mac48Address from = hdr->GetAddr2 ();
866 
867  //We don't know how to deal with any frame that is not addressed to
868  //us (and odds are there is nothing sensible we could do anyway),
869  //so we ignore such frames.
870  //
871  //The derived class may also do some such filtering, but it doesn't
872  //hurt to have it here too as a backstop.
873  if (to != GetAddress ())
874  {
875  return;
876  }
877 
878  if (hdr->IsMgt () && hdr->IsAction ())
879  {
880  //There is currently only any reason for Management Action
881  //frames to be flying about if we are a QoS STA.
883 
884  WifiActionHeader actionHdr;
885  packet->RemoveHeader (actionHdr);
886 
887  switch (actionHdr.GetCategory ())
888  {
890 
891  switch (actionHdr.GetAction ().blockAck)
892  {
894  {
895  MgtAddBaRequestHeader reqHdr;
896  packet->RemoveHeader (reqHdr);
897 
898  //We've received an ADDBA Request. Our policy here is
899  //to automatically accept it, so we get the ADDBA
900  //Response on it's way immediately.
901  SendAddBaResponse (&reqHdr, from);
902  //This frame is now completely dealt with, so we're done.
903  return;
904  }
906  {
907  MgtAddBaResponseHeader respHdr;
908  packet->RemoveHeader (respHdr);
909 
910  //We've received an ADDBA Response. We assume that it
911  //indicates success after an ADDBA Request we have
912  //sent (we could, in principle, check this, but it
913  //seems a waste given the level of the current model)
914  //and act by locally establishing the agreement on
915  //the appropriate queue.
916  AcIndex ac = QosUtilsMapTidToAc (respHdr.GetTid ());
917  m_edca[ac]->GotAddBaResponse (&respHdr, from);
918  //This frame is now completely dealt with, so we're done.
919  return;
920  }
922  {
923  MgtDelBaHeader delBaHdr;
924  packet->RemoveHeader (delBaHdr);
925 
926  if (delBaHdr.IsByOriginator ())
927  {
928  //This DELBA frame was sent by the originator, so
929  //this means that an ingoing established
930  //agreement exists in MacLow and we need to
931  //destroy it.
932  m_low->DestroyBlockAckAgreement (from, delBaHdr.GetTid ());
933  }
934  else
935  {
936  //We must have been the originator. We need to
937  //tell the correct queue that the agreement has
938  //been torn down
939  AcIndex ac = QosUtilsMapTidToAc (delBaHdr.GetTid ());
940  m_edca[ac]->GotDelBaFrame (&delBaHdr, from);
941  }
942  //This frame is now completely dealt with, so we're done.
943  return;
944  }
945  default:
946  NS_FATAL_ERROR ("Unsupported Action field in Block Ack Action frame");
947  return;
948  }
949  default:
950  NS_FATAL_ERROR ("Unsupported Action frame received");
951  return;
952  }
953  }
954  NS_FATAL_ERROR ("Don't know how to handle frame (type=" << hdr->GetType ());
955 }
956 
957 void
959 {
960  NS_LOG_FUNCTION (this << aggregatedPacket << hdr);
962  for (MsduAggregator::DeaggregatedMsdusCI i = packets.begin ();
963  i != packets.end (); ++i)
964  {
965  ForwardUp ((*i).first, (*i).second.GetSourceAddr (),
966  (*i).second.GetDestinationAddr ());
967  }
968 }
969 
970 void
972  Mac48Address originator)
973 {
974  NS_LOG_FUNCTION (this);
975  WifiMacHeader hdr;
977  hdr.SetAddr1 (originator);
978  hdr.SetAddr2 (GetAddress ());
979  hdr.SetAddr3 (GetAddress ());
980  hdr.SetDsNotFrom ();
981  hdr.SetDsNotTo ();
982 
983  MgtAddBaResponseHeader respHdr;
984  StatusCode code;
985  code.SetSuccess ();
986  respHdr.SetStatusCode (code);
987  //Here a control about queues type?
988  respHdr.SetAmsduSupport (reqHdr->IsAmsduSupported ());
989 
990  if (reqHdr->IsImmediateBlockAck ())
991  {
992  respHdr.SetImmediateBlockAck ();
993  }
994  else
995  {
996  respHdr.SetDelayedBlockAck ();
997  }
998  respHdr.SetTid (reqHdr->GetTid ());
999 
1000  Ptr<HeConfiguration> heConfiguration = GetHeConfiguration ();
1001  if (heConfiguration && heConfiguration->GetMpduBufferSize () > 64)
1002  {
1003  respHdr.SetBufferSize (255);
1004  }
1005  else
1006  {
1007  respHdr.SetBufferSize (63);
1008  }
1009  respHdr.SetTimeout (reqHdr->GetTimeout ());
1010 
1011  WifiActionHeader actionHdr;
1014  actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
1015 
1016  Ptr<Packet> packet = Create<Packet> ();
1017  packet->AddHeader (respHdr);
1018  packet->AddHeader (actionHdr);
1019 
1020  //We need to notify our MacLow object as it will have to buffer all
1021  //correctly received packets for this Block Ack session
1022  m_low->CreateBlockAckAgreement (&respHdr, originator,
1023  reqHdr->GetStartingSequence ());
1024 
1025  //It is unclear which queue this frame should go into. For now we
1026  //bung it into the queue corresponding to the TID for which we are
1027  //establishing an agreement, and push it to the head.
1028  m_edca[QosUtilsMapTidToAc (reqHdr->GetTid ())]->PushFront (packet, hdr);
1029 }
1030 
1031 TypeId
1033 {
1034  static TypeId tid = TypeId ("ns3::RegularWifiMac")
1035  .SetParent<WifiMac> ()
1036  .SetGroupName ("Wifi")
1037  .AddAttribute ("QosSupported",
1038  "This Boolean attribute is set to enable 802.11e/WMM-style QoS support at this STA.",
1039  BooleanValue (false),
1042  MakeBooleanChecker ())
1043  .AddAttribute ("HtSupported",
1044  "This Boolean attribute is set to enable 802.11n support at this STA.",
1045  BooleanValue (false),
1048  MakeBooleanChecker (),
1049  TypeId::DEPRECATED, "Not used anymore")
1050  .AddAttribute ("VhtSupported",
1051  "This Boolean attribute is set to enable 802.11ac support at this STA.",
1052  BooleanValue (false),
1055  MakeBooleanChecker (),
1056  TypeId::DEPRECATED, "Not used anymore")
1057  .AddAttribute ("HeSupported",
1058  "This Boolean attribute is set to enable 802.11ax support at this STA.",
1059  BooleanValue (false),
1062  MakeBooleanChecker (),
1063  TypeId::DEPRECATED, "Not used anymore")
1064  .AddAttribute ("CtsToSelfSupported",
1065  "Use CTS to Self when using a rate that is not in the basic rate set.",
1066  BooleanValue (false),
1068  MakeBooleanChecker ())
1069  .AddAttribute ("VO_MaxAmsduSize",
1070  "Maximum length in bytes of an A-MSDU for AC_VO access class "
1071  "(capped to 7935 for HT PPDUs and 11398 for VHT/HE PPDUs). "
1072  "Value 0 means A-MSDU aggregation is disabled for that AC.",
1073  UintegerValue (0),
1075  MakeUintegerChecker<uint16_t> (0, 11398))
1076  .AddAttribute ("VI_MaxAmsduSize",
1077  "Maximum length in bytes of an A-MSDU for AC_VI access class "
1078  "(capped to 7935 for HT PPDUs and 11398 for VHT/HE PPDUs). "
1079  "Value 0 means A-MSDU aggregation is disabled for that AC.",
1080  UintegerValue (0),
1082  MakeUintegerChecker<uint16_t> (0, 11398))
1083  .AddAttribute ("BE_MaxAmsduSize",
1084  "Maximum length in bytes of an A-MSDU for AC_BE access class "
1085  "(capped to 7935 for HT PPDUs and 11398 for VHT/HE PPDUs). "
1086  "Value 0 means A-MSDU aggregation is disabled for that AC.",
1087  UintegerValue (0),
1089  MakeUintegerChecker<uint16_t> (0, 11398))
1090  .AddAttribute ("BK_MaxAmsduSize",
1091  "Maximum length in bytes of an A-MSDU for AC_BK access class "
1092  "(capped to 7935 for HT PPDUs and 11398 for VHT/HE PPDUs). "
1093  "Value 0 means A-MSDU aggregation is disabled for that AC.",
1094  UintegerValue (0),
1096  MakeUintegerChecker<uint16_t> (0, 11398))
1097  .AddAttribute ("VO_MaxAmpduSize",
1098  "Maximum length in bytes of an A-MPDU for AC_VO access class "
1099  "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, and 8388607 for HE PPDUs). "
1100  "Value 0 means A-MPDU aggregation is disabled for that AC.",
1101  UintegerValue (0),
1103  MakeUintegerChecker<uint32_t> ())
1104  .AddAttribute ("VI_MaxAmpduSize",
1105  "Maximum length in bytes of an A-MPDU for AC_VI access class "
1106  "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, and 8388607 for HE PPDUs). "
1107  "Value 0 means A-MPDU aggregation is disabled for that AC.",
1108  UintegerValue (65535),
1110  MakeUintegerChecker<uint32_t> ())
1111  .AddAttribute ("BE_MaxAmpduSize",
1112  "Maximum length in bytes of an A-MPDU for AC_BE access class "
1113  "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, and 8388607 for HE PPDUs). "
1114  "Value 0 means A-MPDU aggregation is disabled for that AC.",
1115  UintegerValue (65535),
1117  MakeUintegerChecker<uint32_t> ())
1118  .AddAttribute ("BK_MaxAmpduSize",
1119  "Maximum length in bytes of an A-MPDU for AC_BK access class "
1120  "(capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, and 8388607 for HE PPDUs). "
1121  "Value 0 means A-MPDU aggregation is disabled for that AC.",
1122  UintegerValue (0),
1124  MakeUintegerChecker<uint32_t> ())
1125  .AddAttribute ("VO_BlockAckThreshold",
1126  "If number of packets in VO queue reaches this value, "
1127  "block ack mechanism is used. If this value is 0, block ack is never used."
1128  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
1129  UintegerValue (0),
1131  MakeUintegerChecker<uint8_t> (0, 64))
1132  .AddAttribute ("VI_BlockAckThreshold",
1133  "If number of packets in VI queue reaches this value, "
1134  "block ack mechanism is used. If this value is 0, block ack is never used."
1135  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
1136  UintegerValue (0),
1138  MakeUintegerChecker<uint8_t> (0, 64))
1139  .AddAttribute ("BE_BlockAckThreshold",
1140  "If number of packets in BE queue reaches this value, "
1141  "block ack mechanism is used. If this value is 0, block ack is never used."
1142  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
1143  UintegerValue (0),
1145  MakeUintegerChecker<uint8_t> (0, 64))
1146  .AddAttribute ("BK_BlockAckThreshold",
1147  "If number of packets in BK queue reaches this value, "
1148  "block ack mechanism is used. If this value is 0, block ack is never used."
1149  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
1150  UintegerValue (0),
1152  MakeUintegerChecker<uint8_t> (0, 64))
1153  .AddAttribute ("VO_BlockAckInactivityTimeout",
1154  "Represents max time (blocks of 1024 micro seconds) allowed for block ack"
1155  "inactivity for AC_VO. If this value isn't equal to 0 a timer start after that a"
1156  "block ack setup is completed and will be reset every time that a block ack"
1157  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
1158  UintegerValue (0),
1160  MakeUintegerChecker<uint16_t> ())
1161  .AddAttribute ("VI_BlockAckInactivityTimeout",
1162  "Represents max time (blocks of 1024 micro seconds) allowed for block ack"
1163  "inactivity for AC_VI. If this value isn't equal to 0 a timer start after that a"
1164  "block ack setup is completed and will be reset every time that a block ack"
1165  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
1166  UintegerValue (0),
1168  MakeUintegerChecker<uint16_t> ())
1169  .AddAttribute ("BE_BlockAckInactivityTimeout",
1170  "Represents max time (blocks of 1024 micro seconds) allowed for block ack"
1171  "inactivity for AC_BE. If this value isn't equal to 0 a timer start after that a"
1172  "block ack setup is completed and will be reset every time that a block ack"
1173  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
1174  UintegerValue (0),
1176  MakeUintegerChecker<uint16_t> ())
1177  .AddAttribute ("BK_BlockAckInactivityTimeout",
1178  "Represents max time (blocks of 1024 micro seconds) allowed for block ack"
1179  "inactivity for AC_BK. If this value isn't equal to 0 a timer start after that a"
1180  "block ack setup is completed and will be reset every time that a block ack"
1181  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
1182  UintegerValue (0),
1184  MakeUintegerChecker<uint16_t> ())
1185  .AddAttribute ("ShortSlotTimeSupported",
1186  "Whether or not short slot time is supported (only used by ERP APs or STAs).",
1187  BooleanValue (true),
1190  MakeBooleanChecker ())
1191  .AddAttribute ("RifsSupported",
1192  "Whether or not RIFS is supported (only used by HT APs or STAs).",
1193  BooleanValue (false),
1196  MakeBooleanChecker (),
1197  TypeId::DEPRECATED, "Use the HtConfiguration instead")
1198  .AddAttribute ("Txop",
1199  "The Txop object.",
1200  PointerValue (),
1202  MakePointerChecker<Txop> ())
1203  .AddAttribute ("VO_Txop",
1204  "Queue that manages packets belonging to AC_VO access class.",
1205  PointerValue (),
1207  MakePointerChecker<QosTxop> ())
1208  .AddAttribute ("VI_Txop",
1209  "Queue that manages packets belonging to AC_VI access class.",
1210  PointerValue (),
1212  MakePointerChecker<QosTxop> ())
1213  .AddAttribute ("BE_Txop",
1214  "Queue that manages packets belonging to AC_BE access class.",
1215  PointerValue (),
1217  MakePointerChecker<QosTxop> ())
1218  .AddAttribute ("BK_Txop",
1219  "Queue that manages packets belonging to AC_BK access class.",
1220  PointerValue (),
1222  MakePointerChecker<QosTxop> ())
1223  .AddTraceSource ("TxOkHeader",
1224  "The header of successfully transmitted packet.",
1226  "ns3::WifiMacHeader::TracedCallback")
1227  .AddTraceSource ("TxErrHeader",
1228  "The header of unsuccessfully transmitted packet.",
1230  "ns3::WifiMacHeader::TracedCallback")
1231  ;
1232  return tid;
1233 }
1234 
1235 void
1237 {
1238  NS_LOG_FUNCTION (this << standard);
1239  uint32_t cwmin = 0;
1240  uint32_t cwmax = 0;
1241  switch (standard)
1242  {
1246  {
1247  EnableAggregation ();
1248  //To be removed once deprecated attributes are removed
1249  Ptr<HtConfiguration> htConfiguration = GetHtConfiguration ();
1250  NS_ASSERT (htConfiguration);
1251  htConfiguration->SetRifsSupported (m_rifsSupported);
1252  SetQosSupported (true);
1253  cwmin = 15;
1254  cwmax = 1023;
1255  break;
1256  }
1259  {
1260  EnableAggregation ();
1261  //To be removed once deprecated RifsSupported attribute is removed
1262  Ptr<HtConfiguration> htConfiguration = GetHtConfiguration ();
1263  NS_ASSERT (htConfiguration);
1264  htConfiguration->SetRifsSupported (m_rifsSupported);
1265  SetQosSupported (true);
1266  }
1268  SetErpSupported (true);
1273  cwmin = 15;
1274  cwmax = 1023;
1275  break;
1277  SetDsssSupported (true);
1278  cwmin = 31;
1279  cwmax = 1023;
1280  break;
1281  default:
1282  NS_FATAL_ERROR ("Unsupported WifiPhyStandard in RegularWifiMac::FinishConfigureStandard ()");
1283  }
1284 
1285  ConfigureContentionWindow (cwmin, cwmax);
1286 }
1287 
1288 void
1289 RegularWifiMac::ConfigureContentionWindow (uint32_t cwMin, uint32_t cwMax)
1290 {
1291  bool isDsssOnly = m_dsssSupported && !m_erpSupported;
1292  //The special value of AC_BE_NQOS which exists in the Access
1293  //Category enumeration allows us to configure plain old DCF.
1294  ConfigureDcf (m_txop, cwMin, cwMax, isDsssOnly, AC_BE_NQOS);
1295 
1296  //Now we configure the EDCA functions
1297  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
1298  {
1299  ConfigureDcf (i->second, cwMin, cwMax, isDsssOnly, i->first);
1300  }
1301 }
1302 
1303 void
1305 {
1306  NS_LOG_FUNCTION (this << hdr);
1307  m_txOkCallback (hdr);
1308 }
1309 
1310 void
1312 {
1313  NS_LOG_FUNCTION (this << hdr);
1314  m_txErrCallback (hdr);
1315 }
1316 
1317 void
1319 {
1320  NS_LOG_FUNCTION (this);
1321  if (m_low->GetMsduAggregator () == 0)
1322  {
1323  Ptr<MsduAggregator> msduAggregator = CreateObject<MsduAggregator> ();
1324  msduAggregator->SetEdcaQueues (m_edca);
1325  m_low->SetMsduAggregator (msduAggregator);
1326  }
1327  if (m_low->GetMpduAggregator () == 0)
1328  {
1329  Ptr<MpduAggregator> mpduAggregator = CreateObject<MpduAggregator> ();
1330  mpduAggregator->SetEdcaQueues (m_edca);
1331  m_low->SetMpduAggregator (mpduAggregator);
1332  }
1333 }
1334 
1335 void
1337 {
1338  NS_LOG_FUNCTION (this);
1339  m_low->SetMsduAggregator (0);
1340  m_low->SetMpduAggregator (0);
1341 }
1342 
1343 } //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
void Dispose(void)
Dispose of this Object.
Definition: object.cc:214
void SetVoBlockAckInactivityTimeout(uint16_t timeout)
Set VO block ack inactivity timeout.
void SetupEdcaQueue(AcIndex ac)
This method is a private utility invoked to configure the channel access function for the specified A...
void SetTxMcsSetDefined(uint8_t txmcssetdefined)
Set the transmit MCS set defined.
void SetShortGuardIntervalFor80Mhz(uint8_t shortguardinterval)
Set the short guard interval 80 Mhz.
Ptr< HeConfiguration > GetHeConfiguration(void) const
Definition: wifi-mac.cc:493
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)
AttributeValue implementation for Boolean.
Definition: boolean.h:36
bool GetHeSupported() const
Return whether the device supports HE.
void SetGreenfield(uint8_t greenfield)
Set the green 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...
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:4090
#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
Time GetCtsTimeout(void) const
ForwardUpCallback m_forwardUp
Callback to forward packet up the stack.
void SetHtSupported(uint8_t htsupported)
Set the HT supported field.
#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:864
bool GetQosSupported() const
Return whether the device supports QoS.
static TypeId GetTypeId(void)
Get the type ID.
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:84
uint16_t m_bkMaxAmsduSize
maximum A-MSDU size for AC_BK
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
void SetErpSupported(bool enable)
Enable or disable ERP support for the device.
void SetChannelAccessManager(const Ptr< ChannelAccessManager > manager)
Set ChannelAccessManager this Txop is associated to.
Definition: txop.cc:119
Implement the header for management frames of type add block ack request.
Definition: mgt-headers.h:997
bool IsAllowed(uint16_t channelWidth, uint8_t nss) const
Definition: wifi-mode.cc:85
void SetPifs(Time pifs)
void SetCompressedBlockAckTimeout(Time blockAckTimeout)
void SetTxDroppedCallback(TxDropped callback)
Definition: txop.cc:161
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
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:204
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)
std::list< std::pair< Ptr< Packet >, AmsduSubframeHeader > >::const_iterator DeaggregatedMsdusCI
DeaggregatedMsdusCI typedef.
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 Block Ack inactivity timeout.
Definition: qos-txop.cc:1580
void RemovePhyListener(Ptr< WifiPhy > phy)
Remove current registered listener for Phy events.
void SetMaxAmpduLength(uint32_t maxampdulength)
Set the maximum AMPDU length.
static DeaggregatedMsdus Deaggregate(Ptr< Packet > aggregatedPacket)
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:162
virtual void DeaggregateAmsduAndForward(Ptr< Packet > aggregatedPacket, const WifiMacHeader *hdr)
This method can be called to de-aggregate an A-MSDU and forward the constituent packets up the stack...
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
void SetVhtSupported(uint8_t vhtsupported)
Set the VHT supported field.
Ptr< WifiPhy > m_phy
Wifi PHY.
void SetRxLdpc(uint8_t rxldpc)
Set the receive LDPC.
void SetDelayedBlockAck()
Enable delayed Block ACK.
uint32_t m_voMaxAmpduSize
maximum A-MPDU size for AC_VO
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
void ConfigureDcf(Ptr< Txop > dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, AcIndex ac)
Definition: wifi-mac.cc:422
virtual void Enqueue(Ptr< const Packet > packet, Mac48Address to, Mac48Address from)
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:227
Time GetRifs(void) const
virtual void Receive(Ptr< Packet > packet, const WifiMacHeader *hdr)
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
void SetShortGuardIntervalFor160Mhz(uint8_t shortguardinterval)
Set the short guard interval 160 Mhz.
void Receive(Ptr< Packet > packet, const WifiMacHeader *hdr)
Receive a packet.
bool GetDsssSupported() const
Return whether the device supports DSSS.
TracedCallback< const WifiMacHeader & > m_txErrCallback
transmit error callback
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:86
void SetVoBlockAckThreshold(uint8_t threshold)
Set the Block ACK threshold for AC_VO.
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:1357
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)
void SetLSigProtectionSupport(uint8_t lsigprotection)
Set the LSIG protection support.
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:4084
bool IsByOriginator(void) const
Check if the initiator bit in the DELBA is set.
Background.
Definition: qos-utils.h:43
void ForwardUp(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
virtual bool SupportsSendFrom(void) const
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:479
HE PHY for the 5 GHz band (clause 26)
void EnableAggregation(void)
Enable aggregation function.
Time GetBasicBlockAckTimeout(void) const
void SetEifsNoDifs(Time eifsNoDifs)
void SetMaxAmpduLength(uint32_t maxampdulength)
Set the maximum AMPDU length.
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:220
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 SetShortGuardInterval20(uint8_t shortguardinterval)
Set the short guard interval 20 field.
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:246
void SetImmediateBlockAck()
Enable immediate Block ACK.
void SetMaxAmpduLength(uint32_t maxampdulength)
Set the maximum AMPDU length.
Hold an unsigned integer type.
Definition: uinteger.h:44
ssid
Definition: third.py:93
void SetTxHighestSupportedLgiDataRate(uint16_t supporteddatarate)
Set the transmit highest supported LGI data rate.
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 (de-fragmentation etc.)
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1489
virtual void DoDispose()
Destructor implementation.
Definition: wifi-mac.cc:215
Ptr< QosTxop > GetVOQueue(void) const
Accessor for the AC_VO channel access function.
uint16_t m_viMaxAmsduSize
maximum A-MSDU size for AC_VI
Mac48Address GetBssid(void) const
uint16_t m_beMaxAmsduSize
maximum A-MSDU size for AC_BE
HeCapabilities GetHeCapabilities(void) const
Return the HE capabilities of the device.
void ResetWifiPhy(void)
removes attached WifiPhy device from this MAC.
void SetMaxAmsduLength(uint16_t maxamsdulength)
Set the maximum AMSDU length.
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:494
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.
void SetSupportedChannelWidthSet(uint8_t channelwidthset)
Set the supported channel width set.
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 SetRxHighestSupportedDataRate(uint16_t maxsupportedrate)
Set the receive highest supported data rate.
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.
std::list< std::pair< Ptr< Packet >, AmsduSubframeHeader > > DeaggregatedMsdus
DeaggregatedMsdus typedef.
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:37
void DisableAggregation(void)
Disable aggregation function.
uint16_t GetFrequency(void) const
Definition: wifi-phy.cc:1337
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
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.
an EUI-48 address
Definition: mac48-address.h:43
void SetTxUnequalModulation(uint8_t txunequalmodulation)
Set the transmit unequal modulation.
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:133
Ssid GetSsid(void) const
Ptr< QosTxop > GetVIQueue(void) const
Accessor for the AC_VI channel access function.
void SetRxStbc(uint8_t rxstbc)
Set the receive STBC.
void SetCtsTimeout(Time ctsTimeout)
void SetBlockAckThreshold(uint8_t threshold)
Set threshold for block ACK mechanism.
Definition: qos-txop.cc:1572
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 SetRxHighestSupportedLgiDataRate(uint16_t supporteddatarate)
Set the receive highest supported LGI data rate.
void SetType(WifiMacType type, bool resetToDsFromDs=true)
Set Type/Subtype values with the correct values depending on the given type.
void SetHtSupported(uint8_t htsupported)
Set the HT Supported flag.
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.
Ptr< VhtConfiguration > GetVhtConfiguration(void) const
Definition: wifi-mac.cc:486
BlockAckActionValue blockAck
block ack
Definition: mgt-headers.h:940
bool GetHtSupported() const
Return whether the device supports HT.
Implement the header for management frames of type add block ack response.
Definition: mgt-headers.h:1129
Implement the header for management frames of type del block ack.
Definition: mgt-headers.h:1250
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:272
void SetHeSupported(uint8_t hesupported)
Set HE supported.
void SetTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set MacTxMiddle this Txop is associated to.
Definition: txop.cc:126
typedef for union of different ActionValues
Definition: mgt-headers.h:935
Total number of ACs.
Definition: qos-utils.h:49
Attribute or trace source is deprecated; user is warned.
Definition: type-id.h:72
virtual void DoInitialize()
Initialize() implementation.
void SetLdpc(uint8_t ldpc)
Set the LDPC field.
void SetBkBlockAckInactivityTimeout(uint16_t timeout)
Set BK block ack inactivity timeout.
void SetTxRxMcsSetUnequal(uint8_t txrxmcssetunequal)
Set the transmit / receive MCS set unequal.
uint16_t GetStartingSequence(void) const
Return the starting sequence number.
virtual void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > remoteManager)
Set WifiRemoteStationsManager this Txop is associated to.
Definition: txop.cc:140
bool IsAction() const
Return true if the header is an Action header.
bool m_shortSlotTimeSupported
flag whether short slot time is supported
void SetTxMaxNSpatialStreams(uint8_t maxtxspatialstreams)
Set the transmit maximum N spatial streams.
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
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:46
Ptr< QosTxop > GetBKQueue(void) const
Accessor for the AC_BK channel access function.
void SetCtsToSelfSupported(bool enable)
Enable or disable CTS-to-self feature.
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:154
ActionValue GetAction()
Return the action value.
void SetPromisc(void)
Sets the interface in promiscuous mode.
Ptr< WifiPhy > GetWifiPhy(void) const
void SetTxOkCallback(TxOk callback)
Definition: txop.cc:147
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:472
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 SetShortGuardInterval40(uint8_t shortguardinterval)
Set the short guard interval 40 field.
void SetAction(CategoryValue type, ActionValue action)
Set action for this Action header.
void SetTxStbc(uint8_t txstbc)
Set the transmit STBC.
void SetBeBlockAckInactivityTimeout(uint16_t timeout)
Set BE block ack inactivity timeout.
uint8_t GetMaxSupportedTxSpatialStreams(void) const
Definition: wifi-phy.cc:1390
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:915
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
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:150
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:256
Implements the IEEE 802.11 MAC header.
void SetSupportedChannelWidth(uint8_t supportedchannelwidth)
Set the supported channel width field.
void SetVhtSupported(uint8_t vhtsupported)
Set the VHT Supported flag.
uint8_t GetMaxSupportedRxSpatialStreams(void) const
Definition: wifi-phy.cc:1408
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.
virtual void TxFailed(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.