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 "regular-wifi-mac.h"
22 #include "ns3/log.h"
23 #include "ns3/pointer.h"
24 #include "mac-rx-middle.h"
25 #include "mac-tx-middle.h"
26 #include "mac-low.h"
27 #include "dcf-manager.h"
28 #include "msdu-aggregator.h"
29 #include "mpdu-aggregator.h"
30 #include "wifi-utils.h"
31 
32 namespace ns3 {
33 
34 NS_LOG_COMPONENT_DEFINE ("RegularWifiMac");
35 
36 NS_OBJECT_ENSURE_REGISTERED (RegularWifiMac);
37 
39  : m_htSupported (0),
40  m_vhtSupported (0),
41  m_erpSupported (0),
42  m_dsssSupported (0),
43  m_heSupported (0)
44 {
45  NS_LOG_FUNCTION (this);
46  m_rxMiddle = Create<MacRxMiddle> ();
47  m_rxMiddle->SetForwardCallback (MakeCallback (&RegularWifiMac::Receive, this));
48 
49  m_txMiddle = Create<MacTxMiddle> ();
50 
51  m_low = CreateObject<MacLow> ();
53 
54  m_dcfManager = CreateObject<DcfManager> ();
55  m_dcfManager->SetupLow (m_low);
56 
57  m_dca = CreateObject<DcaTxop> ();
58  m_dca->SetLow (m_low);
59  m_dca->SetManager (m_dcfManager);
60  m_dca->SetTxMiddle (m_txMiddle);
61  m_dca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this));
62  m_dca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this));
63  m_dca->SetTxDroppedCallback (MakeCallback (&RegularWifiMac::NotifyTxDrop, this));
64 
65  //Construct the EDCAFs. The ordering is important - highest
66  //priority (Table 9-1 UP-to-AC mapping; IEEE 802.11-2012) must be created
67  //first.
72 }
73 
75 {
76  NS_LOG_FUNCTION (this);
77 }
78 
79 void
81 {
82  NS_LOG_FUNCTION (this);
83  m_dca->Initialize ();
84 
85  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
86  {
87  i->second->Initialize ();
88  }
89 }
90 
91 void
93 {
94  NS_LOG_FUNCTION (this);
95 
96  m_rxMiddle = 0;
97  m_txMiddle = 0;
98 
99  m_low->Dispose ();
100  m_low = 0;
101 
102  m_phy = 0;
103  m_stationManager = 0;
104 
105  m_dca->Dispose ();
106  m_dca = 0;
107 
108  for (EdcaQueues::iterator i = m_edca.begin (); i != m_edca.end (); ++i)
109  {
110  i->second->Dispose ();
111  i->second = 0;
112  }
113 
114  m_dcfManager->Dispose ();
115  m_dcfManager = 0;
116 }
117 
118 void
120 {
121  NS_LOG_FUNCTION (this << stationManager);
122  m_stationManager = stationManager;
126  m_low->SetWifiRemoteStationManager (stationManager);
127 
128  m_dca->SetWifiRemoteStationManager (stationManager);
129 
130  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
131  {
132  i->second->SetWifiRemoteStationManager (stationManager);
133  }
134 }
135 
138 {
139  return m_stationManager;
140 }
141 
144 {
145  NS_LOG_FUNCTION (this);
146  ExtendedCapabilities capabilities;
148  {
149  if (m_htSupported)
150  {
151  capabilities.SetHtSupported (1);
152  }
153  if (m_vhtSupported)
154  {
155  capabilities.SetVhtSupported (1);
156  }
157  }
158  //TODO: to be completed
159  return capabilities;
160 }
161 
164 {
165  NS_LOG_FUNCTION (this);
166  HtCapabilities capabilities;
167  if (m_htSupported)
168  {
169  capabilities.SetHtSupported (1);
170  capabilities.SetLdpc (m_phy->GetLdpc ());
171  capabilities.SetSupportedChannelWidth (m_phy->GetChannelWidth () >= 40);
174  capabilities.SetGreenfield (m_phy->GetGreenfield ());
176  capabilities.SetMaxAmsduLength (maxAmsduLength > 3839); //0 if 3839 and 1 if 7935
177  capabilities.SetLSigProtectionSupport (!m_phy->GetGreenfield ());
178  double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (m_beMaxAmpduSize, m_bkMaxAmpduSize), std::max (m_voMaxAmpduSize, m_viMaxAmpduSize))
179  + 1.0)
180  / std::log (2.0))
181  - 13.0),
182  0.0);
183  NS_ASSERT (maxAmpduLengthExponent >= 0 && maxAmpduLengthExponent <= 255);
184  capabilities.SetMaxAmpduLength (std::max<uint8_t> (3, static_cast<uint8_t> (maxAmpduLengthExponent))); //0 to 3 for HT
185  uint64_t maxSupportedRate = 0; //in bit/s
186  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
187  {
188  WifiMode mcs = m_phy->GetMcs (i);
190  {
191  continue;
192  }
193  capabilities.SetRxMcsBitmask (mcs.GetMcsValue ());
194  uint8_t nss = (mcs.GetMcsValue () / 8) + 1;
195  NS_ASSERT (nss > 0 && nss < 5);
196  uint64_t dataRate = mcs.GetDataRate (m_phy->GetChannelWidth (), m_phy->GetShortGuardInterval () ? 400 : 800, nss);
197  if (dataRate > maxSupportedRate)
198  {
199  maxSupportedRate = dataRate;
200  NS_LOG_DEBUG ("Updating maxSupportedRate to " << maxSupportedRate);
201  }
202  }
203  capabilities.SetRxHighestSupportedDataRate (maxSupportedRate / 1e6); //in Mbit/s
204  capabilities.SetTxMcsSetDefined (m_phy->GetNMcs () > 0);
206  //we do not support unequal modulations
207  capabilities.SetTxRxMcsSetUnequal (0);
208  capabilities.SetTxUnequalModulation (0);
209  }
210  return capabilities;
211 }
212 
215 {
216  NS_LOG_FUNCTION (this);
217  VhtCapabilities capabilities;
218  if (m_vhtSupported)
219  {
220  capabilities.SetVhtSupported (1);
221  if (m_phy->GetChannelWidth () == 160)
222  {
223  capabilities.SetSupportedChannelWidthSet (1);
224  }
225  else
226  {
227  capabilities.SetSupportedChannelWidthSet (0);
228  }
229  uint32_t maxMpduLength = std::max (std::max (m_beMaxAmsduSize, m_bkMaxAmsduSize), std::max (m_voMaxAmsduSize, m_viMaxAmsduSize)) + 56; //see section 9.11 of 11ac standard
230  capabilities.SetMaxMpduLength (uint8_t (maxMpduLength > 3895) + uint8_t (maxMpduLength > 7991)); //0 if 3895, 1 if 7991, 2 for 11454
231  capabilities.SetRxLdpc (m_phy->GetLdpc ());
234  double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (m_beMaxAmpduSize, m_bkMaxAmpduSize), std::max (m_voMaxAmpduSize, m_viMaxAmpduSize)) + 1.0) / std::log (2.0)) - 13.0), 0.0);
235  NS_ASSERT (maxAmpduLengthExponent >= 0 && maxAmpduLengthExponent <= 255);
236  capabilities.SetMaxAmpduLengthExponent (std::max<uint8_t> (7, static_cast<uint8_t> (maxAmpduLengthExponent))); //0 to 7 for VHT
237  uint8_t maxMcs = 0;
238  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
239  {
240  WifiMode mcs = m_phy->GetMcs (i);
241  if ((mcs.GetModulationClass () == WIFI_MOD_CLASS_VHT)
242  && (mcs.GetMcsValue () > maxMcs))
243  {
244  maxMcs = mcs.GetMcsValue ();
245  }
246  }
247  // Support same MaxMCS for each spatial stream
248  for (uint8_t nss = 1; nss <= m_phy->GetMaxSupportedRxSpatialStreams (); nss++)
249  {
250  capabilities.SetRxMcsMap (maxMcs, nss);
251  }
252  for (uint8_t nss = 1; nss <= m_phy->GetMaxSupportedTxSpatialStreams (); nss++)
253  {
254  capabilities.SetTxMcsMap (maxMcs, nss);
255  }
256  uint64_t maxSupportedRateLGI = 0; //in bit/s
257  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
258  {
259  WifiMode mcs = m_phy->GetMcs (i);
261  {
262  continue;
263  }
264  if (mcs.GetDataRate (m_phy->GetChannelWidth ()) > maxSupportedRateLGI)
265  {
266  maxSupportedRateLGI = mcs.GetDataRate (m_phy->GetChannelWidth ());
267  NS_LOG_DEBUG ("Updating maxSupportedRateLGI to " << maxSupportedRateLGI);
268  }
269  }
270  capabilities.SetRxHighestSupportedLgiDataRate (maxSupportedRateLGI / 1e6); //in Mbit/s
271  capabilities.SetTxHighestSupportedLgiDataRate (maxSupportedRateLGI / 1e6); //in Mbit/s
272  //To be filled in once supported
273  capabilities.SetRxStbc (0);
274  capabilities.SetTxStbc (0);
275  }
276  return capabilities;
277 }
278 
281 {
282  NS_LOG_FUNCTION (this);
283  HeCapabilities capabilities;
284  if (m_heSupported)
285  {
286  capabilities.SetHeSupported (1);
287  uint8_t channelWidthSet = 0;
288  if (m_phy->GetChannelWidth () >= 40 && Is2_4Ghz (m_phy->GetFrequency ()))
289  {
290  channelWidthSet |= 0x01;
291  }
292  if (m_phy->GetChannelWidth () >= 80 && Is5Ghz (m_phy->GetFrequency ()))
293  {
294  channelWidthSet |= 0x02;
295  }
296  if (m_phy->GetChannelWidth () >= 160 && Is5Ghz (m_phy->GetFrequency ()))
297  {
298  channelWidthSet |= 0x04;
299  }
300  capabilities.SetChannelWidthSet (channelWidthSet);
301  uint8_t gi = 0;
302  if (m_phy->GetGuardInterval () <= NanoSeconds (1600))
303  {
304  //todo: We assume for now that if we support 800ns GI then 1600ns GI is supported as well
305  gi |= 0x01;
306  }
307  if (m_phy->GetGuardInterval () == NanoSeconds (800))
308  {
309  gi |= 0x02;
310  }
311  capabilities.SetHeLtfAndGiForHePpdus (gi);
312  double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (m_beMaxAmpduSize, m_bkMaxAmpduSize), std::max (m_voMaxAmpduSize, m_viMaxAmpduSize))
313  + 1.0)
314  / std::log (2.0))
315  - 13.0),
316  0.0);
317  NS_ASSERT (maxAmpduLengthExponent >= 0 && maxAmpduLengthExponent <= 255);
318  capabilities.SetMaxAmpduLengthExponent (std::max<uint8_t> (7, static_cast<uint8_t> (maxAmpduLengthExponent))); //assume 0 to 7 for HE
319  uint8_t maxMcs = 0;
320  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
321  {
322  WifiMode mcs = m_phy->GetMcs (i);
323  if ((mcs.GetModulationClass () == WIFI_MOD_CLASS_HE)
324  && (mcs.GetMcsValue () > maxMcs))
325  {
326  maxMcs = mcs.GetMcsValue ();
327  }
328  }
329  capabilities.SetHighestMcsSupported (maxMcs);
331  }
332  return capabilities;
333 }
334 
335 void
337 {
338  NS_LOG_FUNCTION (this << size);
339  m_voMaxAmsduSize = size;
341 }
342 
343 void
345 {
346  NS_LOG_FUNCTION (this << size);
347  m_viMaxAmsduSize = size;
349 }
350 
351 void
353 {
354  NS_LOG_FUNCTION (this << size);
355  m_beMaxAmsduSize = size;
357 }
358 
359 void
361 {
362  NS_LOG_FUNCTION (this << size);
363  m_bkMaxAmsduSize = size;
365 }
366 
367 void
369 {
370  NS_LOG_FUNCTION (this << size);
371  m_voMaxAmpduSize = size;
373 }
374 
375 void
377 {
378  NS_LOG_FUNCTION (this << size);
379  m_viMaxAmpduSize = size;
381 }
382 
383 void
385 {
386  NS_LOG_FUNCTION (this << size);
387  m_beMaxAmpduSize = size;
389 }
390 
391 void
393 {
394  NS_LOG_FUNCTION (this << size);
395  m_bkMaxAmpduSize = size;
397 }
398 
399 void
401 {
402  NS_LOG_FUNCTION (this << +threshold);
403  GetVOQueue ()->SetBlockAckThreshold (threshold);
404 }
405 
406 void
408 {
409  NS_LOG_FUNCTION (this << +threshold);
410  GetVIQueue ()->SetBlockAckThreshold (threshold);
411 }
412 
413 void
415 {
416  NS_LOG_FUNCTION (this << +threshold);
417  GetBEQueue ()->SetBlockAckThreshold (threshold);
418 }
419 
420 void
422 {
423  NS_LOG_FUNCTION (this << +threshold);
424  GetBKQueue ()->SetBlockAckThreshold (threshold);
425 }
426 
427 void
429 {
430  NS_LOG_FUNCTION (this << timeout);
432 }
433 
434 void
436 {
437  NS_LOG_FUNCTION (this << timeout);
439 }
440 
441 void
443 {
444  NS_LOG_FUNCTION (this << timeout);
446 }
447 
448 void
450 {
451  NS_LOG_FUNCTION (this << timeout);
453 }
454 
455 void
457 {
458  NS_LOG_FUNCTION (this << ac);
459 
460  //Our caller shouldn't be attempting to setup a queue that is
461  //already configured.
462  NS_ASSERT (m_edca.find (ac) == m_edca.end ());
463 
464  Ptr<EdcaTxopN> edca = CreateObject<EdcaTxopN> ();
465  edca->SetLow (m_low);
466  edca->SetManager (m_dcfManager);
467  edca->SetTxMiddle (m_txMiddle);
468  edca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this));
469  edca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this));
470  edca->SetTxDroppedCallback (MakeCallback (&RegularWifiMac::NotifyTxDrop, this));
471  edca->SetAccessCategory (ac);
472  edca->CompleteConfig ();
473 
474  m_edca.insert (std::make_pair (ac, edca));
475 }
476 
477 void
479 {
480  NS_LOG_FUNCTION (this << type);
481  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
482  {
483  i->second->SetTypeOfStation (type);
484  }
485 }
486 
489 {
490  return m_dca;
491 }
492 
495 {
496  return m_edca.find (AC_VO)->second;
497 }
498 
501 {
502  return m_edca.find (AC_VI)->second;
503 }
504 
507 {
508  return m_edca.find (AC_BE)->second;
509 }
510 
513 {
514  return m_edca.find (AC_BK)->second;
515 }
516 
517 void
519 {
520  NS_LOG_FUNCTION (this << phy);
521  m_phy = phy;
523  m_low->SetPhy (phy);
524 }
525 
528 {
529  NS_LOG_FUNCTION (this);
530  return m_phy;
531 }
532 
533 void
535 {
536  NS_LOG_FUNCTION (this);
537  m_low->ResetPhy ();
539  m_phy = 0;
540 }
541 
542 void
544 {
545  NS_LOG_FUNCTION (this);
546  m_forwardUp = upCallback;
547 }
548 
549 void
551 {
552  NS_LOG_FUNCTION (this);
553  m_linkUp = linkUp;
554 }
555 
556 void
558 {
559  NS_LOG_FUNCTION (this);
560  m_linkDown = linkDown;
561 }
562 
563 void
565 {
566  NS_LOG_FUNCTION (this << enable);
567  m_qosSupported = enable;
568 }
569 
570 bool
572 {
573  return m_qosSupported;
574 }
575 
576 void
578 {
579  NS_LOG_FUNCTION (this << enable);
580  m_vhtSupported = enable;
581  if (enable)
582  {
583  SetQosSupported (true);
584  }
585  if (!enable && !m_htSupported)
586  {
588  }
589  else
590  {
592  }
593 }
594 
595 void
597 {
598  NS_LOG_FUNCTION (this << enable);
599  m_htSupported = enable;
600  if (enable)
601  {
602  SetQosSupported (true);
603  }
604  if (!enable && !m_vhtSupported)
605  {
607  }
608  else
609  {
611  }
612 }
613 
614 void
616 {
617  NS_LOG_FUNCTION (this << enable);
618  m_heSupported = enable;
619  if (enable)
620  {
621  SetQosSupported (true);
622  }
623  if (!enable && !m_htSupported && !m_vhtSupported)
624  {
626  }
627  else
628  {
630  }
631 }
632 
633 bool
635 {
636  return m_vhtSupported;
637 }
638 
639 bool
641 {
642  return m_htSupported;
643 }
644 
645 bool
647 {
648  return m_heSupported;
649 }
650 
651 bool
653 {
654  return m_erpSupported;
655 }
656 
657 void
659 {
660  NS_LOG_FUNCTION (this);
661  if (enable)
662  {
663  SetDsssSupported (true);
664  }
665  m_erpSupported = enable;
666 }
667 
668 void
670 {
671  NS_LOG_FUNCTION (this);
672  m_dsssSupported = enable;
673 }
674 
675 bool
677 {
678  return m_dsssSupported;
679 }
680 
681 void
683 {
684  NS_LOG_FUNCTION (this);
685  m_low->SetCtsToSelfSupported (enable);
686 }
687 
688 bool
690 {
691  return m_low->GetCtsToSelfSupported ();
692 }
693 
694 void
696 {
697  NS_LOG_FUNCTION (this << slotTime);
698  m_dcfManager->SetSlot (slotTime);
699  m_low->SetSlotTime (slotTime);
700 }
701 
702 Time
704 {
705  return m_low->GetSlotTime ();
706 }
707 
708 void
710 {
711  NS_LOG_FUNCTION (this << sifs);
712  m_dcfManager->SetSifs (sifs);
713  m_low->SetSifs (sifs);
714 }
715 
716 Time
718 {
719  return m_low->GetSifs ();
720 }
721 
722 void
724 {
725  NS_LOG_FUNCTION (this << eifsNoDifs);
726  m_dcfManager->SetEifsNoDifs (eifsNoDifs);
727 }
728 
729 Time
731 {
732  return m_dcfManager->GetEifsNoDifs ();
733 }
734 
735 void
737 {
738  NS_LOG_FUNCTION (this << rifs);
739  m_low->SetRifs (rifs);
740 }
741 
742 Time
744 {
745  return m_low->GetRifs ();
746 }
747 
748 void
750 {
751  NS_LOG_FUNCTION (this << pifs);
752  m_low->SetPifs (pifs);
753 }
754 
755 Time
757 {
758  return m_low->GetPifs ();
759 }
760 
761 void
763 {
764  NS_LOG_FUNCTION (this << ackTimeout);
765  m_low->SetAckTimeout (ackTimeout);
766 }
767 
768 Time
770 {
771  return m_low->GetAckTimeout ();
772 }
773 
774 void
776 {
777  NS_LOG_FUNCTION (this << ctsTimeout);
778  m_low->SetCtsTimeout (ctsTimeout);
779 }
780 
781 Time
783 {
784  return m_low->GetCtsTimeout ();
785 }
786 
787 void
789 {
790  NS_LOG_FUNCTION (this << blockAckTimeout);
791  m_low->SetBasicBlockAckTimeout (blockAckTimeout);
792 }
793 
794 Time
796 {
797  return m_low->GetBasicBlockAckTimeout ();
798 }
799 
800 void
802 {
803  NS_LOG_FUNCTION (this << blockAckTimeout);
804  m_low->SetCompressedBlockAckTimeout (blockAckTimeout);
805 }
806 
807 Time
809 {
811 }
812 
813 void
815 {
816  NS_LOG_FUNCTION (this << address);
817  m_low->SetAddress (address);
818 }
819 
822 {
823  return m_low->GetAddress ();
824 }
825 
826 void
828 {
829  NS_LOG_FUNCTION (this << ssid);
830  m_ssid = ssid;
831 }
832 
833 Ssid
835 {
836  return m_ssid;
837 }
838 
839 void
841 {
842  NS_LOG_FUNCTION (this << bssid);
843  m_low->SetBssid (bssid);
844 }
845 
848 {
849  return m_low->GetBssid ();
850 }
851 
852 void
854 {
855  m_low->SetPromisc ();
856 }
857 
858 void
860 {
861  NS_LOG_FUNCTION (this << enable);
862  m_shortSlotTimeSupported = enable;
863 }
864 
865 bool
867 {
869 }
870 
871 void
873 {
874  NS_LOG_FUNCTION (this << enable);
875  m_rifsSupported = enable;
876 }
877 
878 bool
880 {
881  return m_rifsSupported;
882 }
883 
884 void
886  Mac48Address to, Mac48Address from)
887 {
888  //We expect RegularWifiMac subclasses which do support forwarding (e.g.,
889  //AP) to override this method. Therefore, we throw a fatal error if
890  //someone tries to invoke this method on a class which has not done
891  //this.
892  NS_FATAL_ERROR ("This MAC entity (" << this << ", " << GetAddress ()
893  << ") does not support Enqueue() with from address");
894 }
895 
896 bool
898 {
899  return false;
900 }
901 
902 void
904 {
905  NS_LOG_FUNCTION (this << packet << from << to);
906  m_forwardUp (packet, from, to);
907 }
908 
909 void
911 {
912  NS_LOG_FUNCTION (this << packet << hdr);
913 
914  Mac48Address to = hdr->GetAddr1 ();
915  Mac48Address from = hdr->GetAddr2 ();
916 
917  //We don't know how to deal with any frame that is not addressed to
918  //us (and odds are there is nothing sensible we could do anyway),
919  //so we ignore such frames.
920  //
921  //The derived class may also do some such filtering, but it doesn't
922  //hurt to have it here too as a backstop.
923  if (to != GetAddress ())
924  {
925  return;
926  }
927 
928  if (hdr->IsMgt () && hdr->IsAction ())
929  {
930  //There is currently only any reason for Management Action
931  //frames to be flying about if we are a QoS STA.
933 
934  WifiActionHeader actionHdr;
935  packet->RemoveHeader (actionHdr);
936 
937  switch (actionHdr.GetCategory ())
938  {
940 
941  switch (actionHdr.GetAction ().blockAck)
942  {
944  {
945  MgtAddBaRequestHeader reqHdr;
946  packet->RemoveHeader (reqHdr);
947 
948  //We've received an ADDBA Request. Our policy here is
949  //to automatically accept it, so we get the ADDBA
950  //Response on it's way immediately.
951  SendAddBaResponse (&reqHdr, from);
952  //This frame is now completely dealt with, so we're done.
953  return;
954  }
956  {
957  MgtAddBaResponseHeader respHdr;
958  packet->RemoveHeader (respHdr);
959 
960  //We've received an ADDBA Response. We assume that it
961  //indicates success after an ADDBA Request we have
962  //sent (we could, in principle, check this, but it
963  //seems a waste given the level of the current model)
964  //and act by locally establishing the agreement on
965  //the appropriate queue.
966  AcIndex ac = QosUtilsMapTidToAc (respHdr.GetTid ());
967  m_edca[ac]->GotAddBaResponse (&respHdr, from);
968  //This frame is now completely dealt with, so we're done.
969  return;
970  }
972  {
973  MgtDelBaHeader delBaHdr;
974  packet->RemoveHeader (delBaHdr);
975 
976  if (delBaHdr.IsByOriginator ())
977  {
978  //This DELBA frame was sent by the originator, so
979  //this means that an ingoing established
980  //agreement exists in MacLow and we need to
981  //destroy it.
982  m_low->DestroyBlockAckAgreement (from, delBaHdr.GetTid ());
983  }
984  else
985  {
986  //We must have been the originator. We need to
987  //tell the correct queue that the agreement has
988  //been torn down
989  AcIndex ac = QosUtilsMapTidToAc (delBaHdr.GetTid ());
990  m_edca[ac]->GotDelBaFrame (&delBaHdr, from);
991  }
992  //This frame is now completely dealt with, so we're done.
993  return;
994  }
995  default:
996  NS_FATAL_ERROR ("Unsupported Action field in Block Ack Action frame");
997  return;
998  }
999  default:
1000  NS_FATAL_ERROR ("Unsupported Action frame received");
1001  return;
1002  }
1003  }
1004  NS_FATAL_ERROR ("Don't know how to handle frame (type=" << hdr->GetType ());
1005 }
1006 
1007 void
1009 {
1010  NS_LOG_FUNCTION (this << aggregatedPacket << hdr);
1012  for (MsduAggregator::DeaggregatedMsdusCI i = packets.begin ();
1013  i != packets.end (); ++i)
1014  {
1015  ForwardUp ((*i).first, (*i).second.GetSourceAddr (),
1016  (*i).second.GetDestinationAddr ());
1017  }
1018 }
1019 
1020 void
1022  Mac48Address originator)
1023 {
1024  NS_LOG_FUNCTION (this);
1025  WifiMacHeader hdr;
1027  hdr.SetAddr1 (originator);
1028  hdr.SetAddr2 (GetAddress ());
1029  hdr.SetAddr3 (GetAddress ());
1030  hdr.SetDsNotFrom ();
1031  hdr.SetDsNotTo ();
1032 
1033  MgtAddBaResponseHeader respHdr;
1034  StatusCode code;
1035  code.SetSuccess ();
1036  respHdr.SetStatusCode (code);
1037  //Here a control about queues type?
1038  respHdr.SetAmsduSupport (reqHdr->IsAmsduSupported ());
1039 
1040  if (reqHdr->IsImmediateBlockAck ())
1041  {
1042  respHdr.SetImmediateBlockAck ();
1043  }
1044  else
1045  {
1046  respHdr.SetDelayedBlockAck ();
1047  }
1048  respHdr.SetTid (reqHdr->GetTid ());
1049  //For now there's not no control about limit of reception. We
1050  //assume that receiver has no limit on reception. However we assume
1051  //that a receiver sets a bufferSize in order to satisfy next
1052  //equation: (bufferSize + 1) % 16 = 0 So if a recipient is able to
1053  //buffer a packet, it should be also able to buffer all possible
1054  //packet's fragments. See section 7.3.1.14 in IEEE802.11e for more details.
1055  respHdr.SetBufferSize (1023);
1056  respHdr.SetTimeout (reqHdr->GetTimeout ());
1057 
1058  WifiActionHeader actionHdr;
1061  actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
1062 
1063  Ptr<Packet> packet = Create<Packet> ();
1064  packet->AddHeader (respHdr);
1065  packet->AddHeader (actionHdr);
1066 
1067  //We need to notify our MacLow object as it will have to buffer all
1068  //correctly received packets for this Block Ack session
1069  m_low->CreateBlockAckAgreement (&respHdr, originator,
1070  reqHdr->GetStartingSequence ());
1071 
1072  //It is unclear which queue this frame should go into. For now we
1073  //bung it into the queue corresponding to the TID for which we are
1074  //establishing an agreement, and push it to the head.
1075  m_edca[QosUtilsMapTidToAc (reqHdr->GetTid ())]->PushFront (packet, hdr);
1076 }
1077 
1078 TypeId
1080 {
1081  static TypeId tid = TypeId ("ns3::RegularWifiMac")
1082  .SetParent<WifiMac> ()
1083  .SetGroupName ("Wifi")
1084  .AddAttribute ("QosSupported",
1085  "This Boolean attribute is set to enable 802.11e/WMM-style QoS support at this STA.",
1086  BooleanValue (false),
1089  MakeBooleanChecker ())
1090  .AddAttribute ("HtSupported",
1091  "This Boolean attribute is set to enable 802.11n support at this STA.",
1092  BooleanValue (false),
1095  MakeBooleanChecker ())
1096  .AddAttribute ("VhtSupported",
1097  "This Boolean attribute is set to enable 802.11ac support at this STA.",
1098  BooleanValue (false),
1101  MakeBooleanChecker ())
1102  .AddAttribute ("HeSupported",
1103  "This Boolean attribute is set to enable 802.11ax support at this STA.",
1104  BooleanValue (false),
1107  MakeBooleanChecker ())
1108  .AddAttribute ("CtsToSelfSupported",
1109  "Use CTS to Self when using a rate that is not in the basic rate set.",
1110  BooleanValue (false),
1113  MakeBooleanChecker ())
1114  .AddAttribute ("VO_MaxAmsduSize",
1115  "Maximum length in bytes of an A-MSDU for AC_VO access class. "
1116  "Value 0 means A-MSDU is disabled for that AC.",
1117  UintegerValue (0),
1119  MakeUintegerChecker<uint16_t> (0, 11426))
1120  .AddAttribute ("VI_MaxAmsduSize",
1121  "Maximum length in bytes of an A-MSDU for AC_VI access class."
1122  "Value 0 means A-MSDU is disabled for that AC.",
1123  UintegerValue (0),
1125  MakeUintegerChecker<uint16_t> (0, 11426))
1126  .AddAttribute ("BE_MaxAmsduSize",
1127  "Maximum length in bytes of an A-MSDU for AC_BE access class."
1128  "Value 0 means A-MSDU is disabled for that AC.",
1129  UintegerValue (0),
1131  MakeUintegerChecker<uint16_t> (0, 11426))
1132  .AddAttribute ("BK_MaxAmsduSize",
1133  "Maximum length in bytes of an A-MSDU for AC_BK access class."
1134  "Value 0 means A-MSDU is disabled for that AC.",
1135  UintegerValue (0),
1137  MakeUintegerChecker<uint16_t> (0, 11426))
1138  .AddAttribute ("VO_MaxAmpduSize",
1139  "Maximum length in bytes of an A-MPDU for AC_VO access class."
1140  "Value 0 means A-MPDU is disabled for that AC.",
1141  UintegerValue (0),
1143  MakeUintegerChecker<uint16_t> ())
1144  .AddAttribute ("VI_MaxAmpduSize",
1145  "Maximum length in bytes of an A-MPDU for AC_VI access class."
1146  "Value 0 means A-MPDU is disabled for that AC.",
1147  UintegerValue (65535),
1149  MakeUintegerChecker<uint16_t> ())
1150  .AddAttribute ("BE_MaxAmpduSize",
1151  "Maximum length in bytes of an A-MPDU for AC_BE access class."
1152  "Value 0 means A-MPDU is disabled for that AC.",
1153  UintegerValue (65535),
1155  MakeUintegerChecker<uint16_t> ())
1156  .AddAttribute ("BK_MaxAmpduSize",
1157  "Maximum length in bytes of an A-MPDU for AC_BK access class."
1158  "Value 0 means A-MPDU is disabled for that AC.",
1159  UintegerValue (0),
1161  MakeUintegerChecker<uint16_t> ())
1162  .AddAttribute ("VO_BlockAckThreshold",
1163  "If number of packets in VO queue reaches this value, "
1164  "block ack mechanism is used. If this value is 0, block ack is never used."
1165  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
1166  UintegerValue (0),
1168  MakeUintegerChecker<uint8_t> (0, 64))
1169  .AddAttribute ("VI_BlockAckThreshold",
1170  "If number of packets in VI queue reaches this value, "
1171  "block ack mechanism is used. If this value is 0, block ack is never used."
1172  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
1173  UintegerValue (0),
1175  MakeUintegerChecker<uint8_t> (0, 64))
1176  .AddAttribute ("BE_BlockAckThreshold",
1177  "If number of packets in BE queue reaches this value, "
1178  "block ack mechanism is used. If this value is 0, block ack is never used."
1179  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
1180  UintegerValue (0),
1182  MakeUintegerChecker<uint8_t> (0, 64))
1183  .AddAttribute ("BK_BlockAckThreshold",
1184  "If number of packets in BK queue reaches this value, "
1185  "block ack mechanism is used. If this value is 0, block ack is never used."
1186  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
1187  UintegerValue (0),
1189  MakeUintegerChecker<uint8_t> (0, 64))
1190  .AddAttribute ("VO_BlockAckInactivityTimeout",
1191  "Represents max time (blocks of 1024 micro seconds) allowed for block ack"
1192  "inactivity for AC_VO. If this value isn't equal to 0 a timer start after that a"
1193  "block ack setup is completed and will be reset every time that a block ack"
1194  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
1195  UintegerValue (0),
1197  MakeUintegerChecker<uint16_t> ())
1198  .AddAttribute ("VI_BlockAckInactivityTimeout",
1199  "Represents max time (blocks of 1024 micro seconds) allowed for block ack"
1200  "inactivity for AC_VI. If this value isn't equal to 0 a timer start after that a"
1201  "block ack setup is completed and will be reset every time that a block ack"
1202  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
1203  UintegerValue (0),
1205  MakeUintegerChecker<uint16_t> ())
1206  .AddAttribute ("BE_BlockAckInactivityTimeout",
1207  "Represents max time (blocks of 1024 micro seconds) allowed for block ack"
1208  "inactivity for AC_BE. If this value isn't equal to 0 a timer start after that a"
1209  "block ack setup is completed and will be reset every time that a block ack"
1210  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
1211  UintegerValue (0),
1213  MakeUintegerChecker<uint16_t> ())
1214  .AddAttribute ("BK_BlockAckInactivityTimeout",
1215  "Represents max time (blocks of 1024 micro seconds) allowed for block ack"
1216  "inactivity for AC_BK. If this value isn't equal to 0 a timer start after that a"
1217  "block ack setup is completed and will be reset every time that a block ack"
1218  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
1219  UintegerValue (0),
1221  MakeUintegerChecker<uint16_t> ())
1222  .AddAttribute ("ShortSlotTimeSupported",
1223  "Whether or not short slot time is supported (only used by ERP APs or STAs).",
1224  BooleanValue (true),
1227  MakeBooleanChecker ())
1228  .AddAttribute ("RifsSupported",
1229  "Whether or not RIFS is supported (only used by HT APs or STAs).",
1230  BooleanValue (false),
1233  MakeBooleanChecker ())
1234  .AddAttribute ("DcaTxop",
1235  "The DcaTxop object.",
1236  PointerValue (),
1238  MakePointerChecker<DcaTxop> ())
1239  .AddAttribute ("VO_EdcaTxopN",
1240  "Queue that manages packets belonging to AC_VO access class.",
1241  PointerValue (),
1243  MakePointerChecker<EdcaTxopN> ())
1244  .AddAttribute ("VI_EdcaTxopN",
1245  "Queue that manages packets belonging to AC_VI access class.",
1246  PointerValue (),
1248  MakePointerChecker<EdcaTxopN> ())
1249  .AddAttribute ("BE_EdcaTxopN",
1250  "Queue that manages packets belonging to AC_BE access class.",
1251  PointerValue (),
1253  MakePointerChecker<EdcaTxopN> ())
1254  .AddAttribute ("BK_EdcaTxopN",
1255  "Queue that manages packets belonging to AC_BK access class.",
1256  PointerValue (),
1258  MakePointerChecker<EdcaTxopN> ())
1259  .AddTraceSource ("TxOkHeader",
1260  "The header of successfully transmitted packet.",
1262  "ns3::WifiMacHeader::TracedCallback")
1263  .AddTraceSource ("TxErrHeader",
1264  "The header of unsuccessfully transmitted packet.",
1266  "ns3::WifiMacHeader::TracedCallback")
1267  ;
1268  return tid;
1269 }
1270 
1271 void
1273 {
1274  NS_LOG_FUNCTION (this << standard);
1275  uint32_t cwmin = 0;
1276  uint32_t cwmax = 0;
1277  switch (standard)
1278  {
1280  SetHeSupported (true);
1282  SetVhtSupported (true);
1284  SetHtSupported (true);
1285  cwmin = 15;
1286  cwmax = 1023;
1287  break;
1289  SetHeSupported (true);
1291  SetHtSupported (true);
1293  SetErpSupported (true);
1298  cwmin = 15;
1299  cwmax = 1023;
1300  break;
1302  SetDsssSupported (true);
1303  cwmin = 31;
1304  cwmax = 1023;
1305  break;
1306  default:
1307  NS_FATAL_ERROR ("Unsupported WifiPhyStandard in RegularWifiMac::FinishConfigureStandard ()");
1308  }
1309 
1310  ConfigureContentionWindow (cwmin, cwmax);
1311 }
1312 
1313 void
1314 RegularWifiMac::ConfigureContentionWindow (uint32_t cwMin, uint32_t cwMax)
1315 {
1316  bool isDsssOnly = m_dsssSupported && !m_erpSupported;
1317  //The special value of AC_BE_NQOS which exists in the Access
1318  //Category enumeration allows us to configure plain old DCF.
1319  ConfigureDcf (m_dca, cwMin, cwMax, isDsssOnly, AC_BE_NQOS);
1320 
1321  //Now we configure the EDCA functions
1322  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
1323  {
1324  ConfigureDcf (i->second, cwMin, cwMax, isDsssOnly, i->first);
1325  }
1326 }
1327 
1328 void
1330 {
1331  NS_LOG_FUNCTION (this << hdr);
1332  m_txOkCallback (hdr);
1333 }
1334 
1335 void
1337 {
1338  NS_LOG_FUNCTION (this << hdr);
1339  m_txErrCallback (hdr);
1340 }
1341 
1342 void
1344 {
1345  NS_LOG_FUNCTION (this);
1346  if (GetVOQueue ()->GetMsduAggregator () != 0)
1347  {
1349  }
1350  if (GetVIQueue ()->GetMsduAggregator () != 0)
1351  {
1353  }
1354  if (GetBEQueue ()->GetMsduAggregator () != 0)
1355  {
1357  }
1358  if (GetBKQueue ()->GetMsduAggregator () != 0)
1359  {
1361  }
1362  if (GetVOQueue ()->GetMpduAggregator () != 0)
1363  {
1365  }
1366  if (GetVIQueue ()->GetMpduAggregator () != 0)
1367  {
1369  }
1370  if (GetBEQueue ()->GetMpduAggregator () != 0)
1371  {
1373  }
1374  if (GetBKQueue ()->GetMpduAggregator () != 0)
1375  {
1377  }
1378 }
1379 
1380 void
1382 {
1383  NS_LOG_FUNCTION (this);
1384  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
1385  {
1386  if (i->second->GetMsduAggregator () == 0)
1387  {
1388  Ptr<MsduAggregator> msduAggregator = CreateObject<MsduAggregator> ();
1389  i->second->SetMsduAggregator (msduAggregator);
1390  }
1391  if (i->second->GetMpduAggregator () == 0)
1392  {
1393  Ptr<MpduAggregator> mpduAggregator = CreateObject<MpduAggregator> ();
1394  i->second->SetMpduAggregator (mpduAggregator);
1395  }
1396  }
1398 }
1399 
1400 void
1402 {
1403  NS_LOG_FUNCTION (this);
1404  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
1405  {
1406  i->second->SetMsduAggregator (0);
1407  i->second->SetMpduAggregator (0);
1408  }
1409 }
1410 
1411 } //namespace ns3
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
Time GetPifs(void) const
Return PCF Interframe Space (PIFS) of this MacLow.
Definition: mac-low.cc:415
Ptr< DcfManager > m_dcfManager
DCF manager (access to channel)
void SetVoBlockAckInactivityTimeout(uint16_t timeout)
Set VO block ack inactivity timeout.
void SetPifs(Time pifs)
Set PCF Interframe Space (PIFS) of this MacLow.
Definition: mac-low.cc:341
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.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
void ConfigureAggregation(void)
Configure aggregation function.
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
void SetGreenfield(uint8_t greenfield)
Set the green field.
HT PHY for the 5 GHz band (clause 20)
bool GetDsssSupported() const
Return whether the device supports DSSS.
bool GetVhtSupported() const
Return whether the device supports VHT.
void SetBlockAckInactivityTimeout(uint16_t timeout)
Set the Block Ack inactivity timeout.
ExtendedCapabilities GetExtendedCapabilities(void) const
Return the extended capabilities of the device.
void SetType(WifiMacType type)
Set Type/Subtype values with the correct values depending on the given type.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
void SetPromisc(void)
Enable promiscuous mode.
Definition: mac-low.cc:359
ForwardUpCallback m_forwardUp
Callback to forward packet up the stack.
void SetHtSupported(uint8_t htsupported)
Set the HT supported field.
bool GetGreenfield(void) const
Return whether Greenfield is supported.
Definition: wifi-phy.cc:608
bool GetCtsToSelfSupported() const
Return whether the device supports CTS-to-self capability.
See IEEE 802.11 chapter 7.3.1.11 Header format: | category: 1 | action value: 1 |.
Definition: mgt-headers.h:850
static TypeId GetTypeId(void)
Get the type ID.
void SetRxMcsBitmask(uint8_t index)
Set the receive MCS bitmask.
void SetBkMaxAmsduSize(uint16_t size)
Set the maximum A-MSDU size for AC_BK.
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
void SetMaxMpduLength(uint8_t length)
Set the maximum MPDU length.
bool IsAction() const
Return true if the header is an Action header.
void SetPhy(const Ptr< WifiPhy > phy)
Set up WifiPhy associated with this MacLow.
Definition: mac-low.cc:257
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:61
void SetErpSupported(bool enable)
Enable or disable ERP support for the device.
Mac48Address GetBssid(void) const
Return the Basic Service Set Identification.
Definition: mac-low.cc:421
void SetSifs(Time sifs)
Set Short Interframe Space (SIFS) of this MacLow.
Definition: mac-low.cc:329
uint8_t GetMaxSupportedRxSpatialStreams(void) const
Definition: wifi-phy.cc:1331
Implement the header for management frames of type add block ack request.
Definition: mgt-headers.h:983
void SetPifs(Time pifs)
void SetCompressedBlockAckTimeout(Time blockAckTimeout)
The Extended Capabilities Information ElementThis class knows how to serialise and deserialise the Ex...
#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)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
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 SetVoMaxAmsduSize(uint16_t size)
Set the maximum A-MSDU size for AC_VO.
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)
Time GetCompressedBlockAckTimeout(void) const
bool GetShortGuardInterval(void) const
Return whether short guard interval is supported.
Definition: wifi-phy.cc:621
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
bool GetQosSupported() const
Return whether the device supports QoS.
void SetRxCallback(Callback< void, Ptr< Packet >, const WifiMacHeader * > callback)
Definition: mac-low.cc:433
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...
bool Is5Ghz(double frequency)
Definition: wifi-utils.cc:71
Time GetCompressedBlockAckTimeout() const
Return Compressed Block ACK timeout of this MacLow.
Definition: mac-low.cc:383
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:3582
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 SetVoMaxAmpduSize(uint16_t size)
Set the maximum A-MPDU size for AC_VO.
void SetDelayedBlockAck()
Enable delayed Block ACK.
ns3::Time timeout
void SetRifs(Time rifs)
Time GetCtsTimeout(void) const
Return CTS timeout of this MacLow.
Definition: mac-low.cc:389
void SetStatusCode(StatusCode code)
Set the status code.
Ssid GetSsid(void) const
Video.
Definition: qos-utils.h:45
Voice.
Definition: qos-utils.h:47
void SetViMaxAmsduSize(uint16_t size)
Set the maximum A-MSDU size for AC_VI.
Best Effort.
Definition: qos-utils.h:41
uint16_t GetFrequency(void) const
Definition: wifi-phy.cc:1260
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:97
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capabilities of the device.
virtual void Enqueue(Ptr< const Packet > packet, Mac48Address to, Mac48Address from)
void SetTimeout(uint16_t timeout)
Set timeout.
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.
HeCapabilities GetHeCapabilities(void) const
Return the HE capabilities of the device.
void Receive(Ptr< Packet > packet, const WifiMacHeader *hdr)
Receive a packet.
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.
void SetCtsToSelfSupported(bool enable)
Enable or disable CTS-to-self capability.
Definition: mac-low.cc:311
bool m_rifsSupported
flag whether RIFS is supported
void SetBasicBlockAckTimeout(Time blockAckTimeout)
Set Basic Block ACK timeout of this MacLow.
Definition: mac-low.cc:299
void SetVoBlockAckThreshold(uint8_t threshold)
Set the Block ACK threshold for AC_VO.
bool GetLdpc(void) const
Return if LDPC is supported.
Definition: wifi-phy.cc:582
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.
void SetBssid(Mac48Address bssid)
Ptr< EdcaTxopN > GetVOQueue(void) const
Accessor for the AC_VO channel access function.
void SetLSigProtectionSupport(uint8_t lsigprotection)
Set the LSIG protection support.
Time GetSifs(void) const
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 void SetVhtSupported(bool enable)
Enable or disable VHT capability support.
void DestroyBlockAckAgreement(Mac48Address originator, uint8_t tid)
Definition: mac-low.cc:2019
Time GetCtsTimeout(void) const
void SetForwardUpCallback(ForwardUpCallback upCallback)
void SetSuccess(void)
Set success bit to 0 (success).
Definition: status-code.cc:30
HE PHY for the 5 GHz band (clause 26)
void EnableAggregation(void)
Enable aggregation function.
void SetEifsNoDifs(Time eifsNoDifs)
void SetBkBlockAckThreshold(uint8_t threshold)
Set the Block ACK threshold for AC_BK.
bool m_qosSupported
This Boolean is set true iff this WifiMac is to model 802.11e/WMM style Quality of Service...
tuple phy
Definition: third.py:86
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:45
void CreateBlockAckAgreement(const MgtAddBaResponseHeader *respHdr, Mac48Address originator, uint16_t startingSeq)
Definition: mac-low.cc:1977
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.
Ptr< DcaTxop > m_dca
This holds a pointer to the DCF instance for this WifiMac - used for transmission of frames to non-Qo...
Ptr< EdcaTxopN > GetBEQueue(void) const
Accessor for the AC_BE channel access function.
void SetAddr3(Mac48Address address)
Fill the Address 3 field with the given address.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1031
void FinishConfigureStandard(WifiPhyStandard standard)
The IEEE 802.11ac VHT Capabilities.
Ssid m_ssid
Service Set ID (SSID)
Ptr< DcaTxop > GetDcaTxop(void) const
Accessor for the DCF object.
base class for all MAC-level wifi objects.
Definition: wifi-mac.h:41
void NotifyTxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:265
void SetImmediateBlockAck()
Enable immediate Block ACK.
Hold an unsigned integer type.
Definition: uinteger.h:44
void RemovePhyListener(Ptr< WifiPhy > phy)
Remove current registered listener for Phy events.
Definition: dcf-manager.cc:153
Time GetAckTimeout(void) const
void SetBlockAckThreshold(uint8_t threshold)
Set threshold for block ACK mechanism.
void SetupPhyListener(Ptr< WifiPhy > phy)
Set up listener for Phy events.
Definition: dcf-manager.cc:141
void SetMaxAmsduLength(uint8_t maxamsdulength)
Set the maximum AMSDU length.
Time GetSlot(void) const
uint64_t GetDataRate(uint8_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:143
void SetAckTimeout(Time ackTimeout)
Set ACK timeout of this MacLow.
Definition: mac-low.cc:293
void SetTxHighestSupportedLgiDataRate(uint16_t supporteddatarate)
Set the transmit highest supported LGI data rate.
bool m_vhtSupported
This Boolean is set true iff this WifiMac is to model 802.11ac.
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
Definition: qos-utils.cc:28
Time GetGuardInterval(void) const
Definition: wifi-phy.cc:635
void SetAddress(Mac48Address address)
Time GetRifs(void) const
Return Reduced Interframe Space (RIFS) of this MacLow.
Definition: mac-low.cc:402
HT PHY (Clause 20)
Definition: wifi-mode.h:58
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:465
void SetMaxAmpduLength(uint8_t maxampdulength)
Set the maximum AMPDU length.
Ptr< MacRxMiddle > m_rxMiddle
RX middle (de-fragmentation etc.)
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1489
Mac48Address GetAddress(void) const
Return the MAC address of this MacLow.
Definition: mac-low.cc:365
void SetupLow(Ptr< MacLow > low)
Set up listener for MacLow events.
Definition: dcf-manager.cc:165
uint16_t m_viMaxAmsduSize
maximum A-MSDU size for AC_VI
uint16_t m_beMaxAmsduSize
maximum A-MSDU size for AC_BE
void ResetWifiPhy(void)
removes attached WifiPhy device from this MAC.
bool IsMgt(void) const
Return true if the Type is Management.
uint8_t GetTid(void) const
Return the Traffic ID (TID).
bool m_heSupported
This Boolean is set true iff this WifiMac is to model 802.11ax.
Time GetPifs(void) const
bool GetHeSupported() const
Return whether the device supports HE.
bool GetErpSupported() const
Return whether the device supports ERP.
Ptr< MacLow > m_low
MacLow (RTS, CTS, DATA, ACK etc.)
void SetBeBlockAckThreshold(uint8_t threshold)
Set the Block ACK threshold for AC_BE.
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities of the device.
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.
void SetMaxAmpduLengthExponent(uint8_t exponent)
Set maximum AMPDU length exponent.
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...
TracedCallback< const WifiMacHeader & > m_txOkCallback
transmit OK callback
virtual void SetHtSupported(bool enable)
Enable or disable HT capability support.
void SetRxHighestSupportedDataRate(uint16_t maxsupportedrate)
Set the receive highest supported data rate.
Status code for association response.
Definition: status-code.h:31
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:3588
bool IsAmsduSupported(void) const
Return whether A-MSDU capability is supported.
Ptr< EdcaTxopN > GetVIQueue(void) const
Accessor for the AC_VI channel access function.
virtual void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > stationManager)
void SetLinkUpCallback(Callback< void > linkUp)
virtual void DoDispose()
Destructor implementation.
Ptr< MpduAggregator > GetMpduAggregator(void) const
Returns the aggregator used to construct A-MPDU subframes.
Definition: edca-txop-n.cc:694
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.
Ptr< MsduAggregator > GetMsduAggregator(void) const
Returns the aggregator used to construct A-MSDU subframes.
Definition: edca-txop-n.cc:688
Hold objects of type Ptr.
Definition: pointer.h:36
void SetBssid(Mac48Address ad)
Set the Basic Service Set Identification.
Definition: mac-low.cc:353
void DisableAggregation(void)
Disable aggregation function.
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.
uint8_t GetTid(void) const
Return the Traffic ID (TID).
bool IsAllowed(uint8_t channelWidth, uint8_t nss) const
Definition: wifi-mode.cc:72
Ptr< WifiPhy > GetWifiPhy(void) const
an EUI-48 address
Definition: mac48-address.h:43
void SetTxUnequalModulation(uint8_t txunequalmodulation)
Set the transmit unequal modulation.
bool IsByOriginator(void) const
Check if the initiator bit in the DELBA is setted.
tuple ssid
Definition: third.py:93
void SetEifsNoDifs(Time eifsNoDifs)
Definition: dcf-manager.cc:186
void SetRxStbc(uint8_t rxstbc)
Set the receive STBC.
uint16_t m_bkMaxAmpduSize
maximum A-MPDU size for AC_BK
void SetCtsTimeout(Time ctsTimeout)
virtual bool SupportsSendFrom(void) const
uint8_t GetTid(void) const
Return the Traffic ID (TID).
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:35
uint8_t GetMaxSupportedTxSpatialStreams(void) const
Definition: wifi-phy.cc:1313
Time GetRifs(void) const
void SetViBlockAckInactivityTimeout(uint16_t timeout)
Set VI block ack inactivity timeout.
Time GetSlotTime(void) const
Return slot duration of this MacLow.
Definition: mac-low.cc:409
bool m_htSupported
This Boolean is set true iff this WifiMac is to model 802.11n.
bool IsImmediateBlockAck(void) const
Return whether the Block ACK policy is immediate Block ACK.
void SetRxMcsMap(uint8_t mcs, uint8_t nss)
uint16_t m_voMaxAmpduSize
maximum A-MPDU size for AC_VO
Mac48Address GetBssid(void) const
void SetLow(const Ptr< MacLow > low)
Set MacLow associated with this DcaTxop.
Definition: dca-txop.cc:115
void SetMaxAmpduSize(uint16_t maxSize)
Sets the maximum A-MPDU size in bytes.
void SetSlot(Time slotTime)
Definition: dcf-manager.cc:172
uint8_t GetChannelWidth(void) const
Definition: wifi-phy.cc:1280
void ConfigureDcf(Ptr< DcaTxop > dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, AcIndex ac)
Definition: wifi-mac.cc:440
void SetRxHighestSupportedLgiDataRate(uint16_t supporteddatarate)
Set the receive highest supported LGI data rate.
uint16_t GetStartingSequence(void) const
Return the starting sequence number.
void SetHtSupported(uint8_t htsupported)
Set the HT Supported flag.
void SetRifs(Time rifs)
Set Reduced Interframe Space (RIFS) of this MacLow.
Definition: mac-low.cc:347
Ptr< EdcaTxopN > GetBKQueue(void) const
Accessor for the AC_BK channel access function.
void SetViBlockAckThreshold(uint8_t threshold)
Set the Block ACK threshold for AC_VI.
uint16_t m_beMaxAmpduSize
maximum A-MPDU size for AC_BE
Time GetBasicBlockAckTimeout(void) const
BlockAckActionValue blockAck
block ack
Definition: mgt-headers.h:926
void SetSlotTime(Time slotTime)
Set slot duration of this MacLow.
Definition: mac-low.cc:335
Time GetSifs(void) const
Return Short Interframe Space (SIFS) of this MacLow.
Definition: mac-low.cc:395
Implement the header for management frames of type add block ack response.
Definition: mgt-headers.h:1115
Implement the header for management frames of type del block ack.
Definition: mgt-headers.h:1236
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:269
void SetHeSupported(uint8_t hesupported)
Set HE supported.
WifiMacType GetType(void) const
Return the type (enum WifiMacType)
Mac48Address GetAddress(void) const
typedef for union of different ActionValues
Definition: mgt-headers.h:921
Total number of ACs.
Definition: qos-utils.h:49
uint16_t m_viMaxAmpduSize
maximum A-MPDU size for AC_VI
void SetViMaxAmpduSize(uint16_t size)
Set the maximum A-MPDU size for AC_VI.
bool GetCtsToSelfSupported() const
Return whether CTS-to-self capability is supported.
Definition: mac-low.cc:317
Time GetEifsNoDifs() const
Definition: dcf-manager.cc:193
virtual void DoInitialize()
Initialize() implementation.
void SetCtsTimeout(Time ctsTimeout)
Set CTS timeout of this MacLow.
Definition: mac-low.cc:323
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.
Time GetAckTimeout(void) const
Return ACK timeout of this MacLow.
Definition: mac-low.cc:371
bool GetHtSupported() const
Return whether the device supports HT.
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(void) const
virtual void SetHeSupported(bool enable)
Enable or disable HE capability support.
bool m_shortSlotTimeSupported
flag whether short slot time is supported
void SetAddress(Mac48Address ad)
Set MAC address of this MacLow.
Definition: mac-low.cc:287
bool GetShortSlotTimeSupported(void) const
void SetTxMaxNSpatialStreams(uint8_t maxtxspatialstreams)
Set the transmit maximum N spatial streams.
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
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.
tuple address
Definition: first.py:37
bool m_erpSupported
This Boolean is set true iff this WifiMac is to model 802.11g.
TypeOfStation
Enumeration for type of station.
Definition: edca-txop-n.h:44
bool GetRifsSupported(void) const
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:487
void SetCtsToSelfSupported(bool enable)
Enable or disable CTS-to-self feature.
void SetBeMaxAmpduSize(uint16_t size)
Set the maximum A-MPDU size for AC_BE.
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.)
ActionValue GetAction()
Return the action value.
void SetPromisc(void)
Sets the interface in promiscuous mode.
void ResetPhy(void)
Remove WifiPhy associated with this MacLow.
Definition: mac-low.cc:272
The IEEE 802.11ax HE Capabilities.
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.
Time GetBasicBlockAckTimeout() const
Return Basic Block ACK timeout of this MacLow.
Definition: mac-low.cc:377
void SetBeBlockAckInactivityTimeout(uint16_t timeout)
Set BE block ack inactivity timeout.
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)
void SetBkMaxAmpduSize(uint16_t size)
Set the maximum A-MPDU size for AC_BK.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:914
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
Ptr< MacTxMiddle > m_txMiddle
TX middle (aggregation etc.)
void SetSifs(Time sifs)
Definition: dcf-manager.cc:179
HE PHY (Clause 26)
Definition: wifi-mode.h:62
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:256
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)
Set up WifiRemoteStationManager associated with this MacLow.
Definition: mac-low.cc:281
Implements the IEEE 802.11 MAC header.
void SetSupportedChannelWidth(uint8_t supportedchannelwidth)
Set the supported channel width field.
Mac48Address GetAddr2(void) const
Return the address in the Address 2 field.
void SetBeMaxAmsduSize(uint16_t size)
Set the maximum A-MSDU size for AC_BE.
void SetCompressedBlockAckTimeout(Time blockAckTimeout)
Set Compressed Block ACK timeout of this MacLow.
Definition: mac-low.cc:305
void SetVhtSupported(uint8_t vhtsupported)
Set the VHT Supported flag.
void SetMaxAmsduSize(uint16_t maxSize)
Sets the maximum A-MSDU size in bytes.
uint16_t GetTimeout(void) const
Return the timeout.
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.
Time GetEifsNoDifs(void) const
void SetMaxAmpduLengthExponent(uint8_t exponent)
Set the maximum AMPDU length exponent.