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"
30 
31 namespace ns3 {
32 
33 NS_LOG_COMPONENT_DEFINE ("RegularWifiMac");
34 
35 NS_OBJECT_ENSURE_REGISTERED (RegularWifiMac);
36 
38  : m_htSupported (0),
39  m_vhtSupported (0),
40  m_erpSupported (0),
41  m_dsssSupported (0),
42  m_heSupported (0)
43 {
44  NS_LOG_FUNCTION (this);
45  m_rxMiddle = Create<MacRxMiddle> ();
46  m_rxMiddle->SetForwardCallback (MakeCallback (&RegularWifiMac::Receive, this));
47 
48  m_txMiddle = Create<MacTxMiddle> ();
49 
50  m_low = CreateObject<MacLow> ();
52 
53  m_dcfManager = CreateObject<DcfManager> ();
54  m_dcfManager->SetupLow (m_low);
55 
56  m_dca = CreateObject<DcaTxop> ();
57  m_dca->SetLow (m_low);
58  m_dca->SetManager (m_dcfManager);
59  m_dca->SetTxMiddle (m_txMiddle);
60  m_dca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this));
61  m_dca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this));
62  m_dca->SetTxDroppedCallback (MakeCallback (&RegularWifiMac::NotifyTxDrop, this));
63 
64  //Construct the EDCAFs. The ordering is important - highest
65  //priority (Table 9-1 UP-to-AC mapping; IEEE 802.11-2012) must be created
66  //first.
71 }
72 
74 {
75  NS_LOG_FUNCTION (this);
76 }
77 
78 void
80 {
81  NS_LOG_FUNCTION (this);
82  m_dca->Initialize ();
83 
84  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
85  {
86  i->second->Initialize ();
87  }
88 }
89 
90 void
92 {
93  NS_LOG_FUNCTION (this);
94 
95  m_rxMiddle = 0;
96  m_txMiddle = 0;
97 
98  m_low->Dispose ();
99  m_low = 0;
100 
101  m_phy = 0;
102  m_stationManager = 0;
103 
104  m_dca->Dispose ();
105  m_dca = 0;
106 
107  for (EdcaQueues::iterator i = m_edca.begin (); i != m_edca.end (); ++i)
108  {
109  i->second->Dispose ();
110  i->second = 0;
111  }
112 
113  m_dcfManager->Dispose ();
114  m_dcfManager = 0;
115 }
116 
117 void
119 {
120  NS_LOG_FUNCTION (this << stationManager);
121  m_stationManager = stationManager;
125  m_low->SetWifiRemoteStationManager (stationManager);
126 
127  m_dca->SetWifiRemoteStationManager (stationManager);
128 
129  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
130  {
131  i->second->SetWifiRemoteStationManager (stationManager);
132  }
133 }
134 
137 {
138  return m_stationManager;
139 }
140 
143 {
144  NS_LOG_FUNCTION (this);
145  HtCapabilities capabilities;
146  if (m_htSupported)
147  {
148  capabilities.SetHtSupported (1);
149  capabilities.SetHtSupported (1);
150  capabilities.SetLdpc (m_phy->GetLdpc ());
151  capabilities.SetSupportedChannelWidth (m_phy->GetChannelWidth () >= 40);
154  capabilities.SetGreenfield (m_phy->GetGreenfield ());
156  capabilities.SetMaxAmsduLength (maxAmsduLength > 3839); //0 if 3839 and 1 if 7935
157  capabilities.SetLSigProtectionSupport (!m_phy->GetGreenfield ());
158  double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (m_beMaxAmpduSize, m_bkMaxAmpduSize), std::max (m_voMaxAmpduSize, m_viMaxAmpduSize))
159  + 1.0)
160  / std::log (2.0))
161  - 13.0),
162  0.0);
163  NS_ASSERT (maxAmpduLengthExponent >= 0 && maxAmpduLengthExponent <= 255);
164  capabilities.SetMaxAmpduLength (std::max<uint8_t> (3, static_cast<uint8_t> (maxAmpduLengthExponent))); //0 to 3 for HT
165  uint64_t maxSupportedRate = 0; //in bit/s
166  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
167  {
168  WifiMode mcs = m_phy->GetMcs (i);
170  {
171  continue;
172  }
173  capabilities.SetRxMcsBitmask (mcs.GetMcsValue ());
174  uint8_t nss = (mcs.GetMcsValue () / 8) + 1;
175  NS_ASSERT (nss > 0 && nss < 5);
176  uint64_t dataRate = mcs.GetDataRate (m_phy->GetChannelWidth (), m_phy->GetShortGuardInterval () ? 400 : 800, nss);
177  if (dataRate > maxSupportedRate)
178  {
179  maxSupportedRate = dataRate;
180  NS_LOG_DEBUG ("Updating maxSupportedRate to " << maxSupportedRate);
181  }
182  }
183  capabilities.SetRxHighestSupportedDataRate (maxSupportedRate / 1e6); //in Mbit/s
184  capabilities.SetTxMcsSetDefined (m_phy->GetNMcs () > 0);
186  }
187  return capabilities;
188 }
189 
192 {
193  NS_LOG_FUNCTION (this);
194  VhtCapabilities capabilities;
195  if (m_vhtSupported)
196  {
197  capabilities.SetVhtSupported (1);
198  if (m_phy->GetChannelWidth () == 160)
199  {
200  capabilities.SetSupportedChannelWidthSet (1);
201  }
202  else
203  {
204  capabilities.SetSupportedChannelWidthSet (0);
205  }
206  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
207  capabilities.SetMaxMpduLength (uint8_t (maxMpduLength > 3895) + uint8_t (maxMpduLength > 7991)); //0 if 3895, 1 if 7991, 2 for 11454
208  capabilities.SetRxLdpc (m_phy->GetLdpc ());
211  double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (m_beMaxAmpduSize, m_bkMaxAmpduSize), std::max (m_voMaxAmpduSize, m_viMaxAmpduSize))
212  + 1.0)
213  / std::log (2.0))
214  - 13.0),
215  0.0);
216  NS_ASSERT (maxAmpduLengthExponent >= 0 && maxAmpduLengthExponent <= 255);
217  capabilities.SetMaxAmpduLengthExponent (std::max<uint8_t> (7, static_cast<uint8_t> (maxAmpduLengthExponent))); //0 to 7 for VHT
218  uint8_t maxMcs = 0;
219  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
220  {
221  WifiMode mcs = m_phy->GetMcs (i);
222  if ((mcs.GetModulationClass () == WIFI_MOD_CLASS_VHT)
223  && (mcs.GetMcsValue () > maxMcs))
224  {
225  maxMcs = mcs.GetMcsValue ();
226  }
227  }
228  // Support same MaxMCS for each spatial stream
229  for (uint8_t nss = 1; nss <= m_phy->GetMaxSupportedRxSpatialStreams (); nss++)
230  {
231  capabilities.SetRxMcsMap (maxMcs, nss);
232  }
233  for (uint8_t nss = 1; nss <= m_phy->GetMaxSupportedTxSpatialStreams (); nss++)
234  {
235  capabilities.SetTxMcsMap (maxMcs, nss);
236  }
237  uint64_t maxSupportedRateLGI = 0; //in bit/s
238  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
239  {
240  WifiMode mcs = m_phy->GetMcs (i);
242  {
243  continue;
244  }
245  if (mcs.GetDataRate (m_phy->GetChannelWidth ()) > maxSupportedRateLGI)
246  {
247  maxSupportedRateLGI = mcs.GetDataRate (m_phy->GetChannelWidth ());
248  NS_LOG_DEBUG ("Updating maxSupportedRateLGI to " << maxSupportedRateLGI);
249  }
250  }
251  capabilities.SetRxHighestSupportedLgiDataRate (maxSupportedRateLGI / 1e6); //in Mbit/s
252  }
253  return capabilities;
254 }
255 
258 {
259  NS_LOG_FUNCTION (this);
260  HeCapabilities capabilities;
261  if (m_heSupported)
262  {
263  capabilities.SetHeSupported (1);
264  uint8_t channelWidthSet = 0;
265  if (m_phy->GetChannelWidth () >= 40 && m_phy->Is2_4Ghz (m_phy->GetFrequency ()))
266  {
267  channelWidthSet |= 0x01;
268  }
269  if (m_phy->GetChannelWidth () >= 80 && m_phy->Is5Ghz (m_phy->GetFrequency ()))
270  {
271  channelWidthSet |= 0x02;
272  }
273  if (m_phy->GetChannelWidth () >= 160 && m_phy->Is5Ghz (m_phy->GetFrequency ()))
274  {
275  channelWidthSet |= 0x04;
276  }
277  capabilities.SetChannelWidthSet (channelWidthSet);
278  uint8_t gi = 0;
279  if (m_phy->GetGuardInterval () <= NanoSeconds (1600))
280  {
281  //todo: We assume for now that if we support 800ns GI then 1600ns GI is supported as well
282  gi |= 0x01;
283  }
284  if (m_phy->GetGuardInterval () == NanoSeconds (800))
285  {
286  gi |= 0x02;
287  }
288  capabilities.SetHeLtfAndGiForHePpdus (gi);
289  double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (m_beMaxAmpduSize, m_bkMaxAmpduSize), std::max (m_voMaxAmpduSize, m_viMaxAmpduSize))
290  + 1.0)
291  / std::log (2.0))
292  - 13.0),
293  0.0);
294  NS_ASSERT (maxAmpduLengthExponent >= 0 && maxAmpduLengthExponent <= 255);
295  capabilities.SetMaxAmpduLengthExponent (std::max<uint8_t> (7, static_cast<uint8_t> (maxAmpduLengthExponent))); //assume 0 to 7 for HE
296  uint8_t maxMcs = 0;
297  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
298  {
299  WifiMode mcs = m_phy->GetMcs (i);
300  if ((mcs.GetModulationClass () == WIFI_MOD_CLASS_HE)
301  && (mcs.GetMcsValue () > maxMcs))
302  {
303  maxMcs = mcs.GetMcsValue ();
304  }
305  }
306  capabilities.SetHighestMcsSupported (maxMcs);
308  }
309  return capabilities;
310 }
311 
312 void
314 {
315  NS_LOG_FUNCTION (this << size);
316  m_voMaxAmsduSize = size;
318 }
319 
320 void
322 {
323  NS_LOG_FUNCTION (this << size);
324  m_viMaxAmsduSize = size;
326 }
327 
328 void
330 {
331  NS_LOG_FUNCTION (this << size);
332  m_beMaxAmsduSize = size;
334 }
335 
336 void
338 {
339  NS_LOG_FUNCTION (this << size);
340  m_bkMaxAmsduSize = size;
342 }
343 
344 void
346 {
347  NS_LOG_FUNCTION (this << size);
348  m_voMaxAmpduSize = size;
350 }
351 
352 void
354 {
355  NS_LOG_FUNCTION (this << size);
356  m_viMaxAmpduSize = size;
358 }
359 
360 void
362 {
363  NS_LOG_FUNCTION (this << size);
364  m_beMaxAmpduSize = size;
366 }
367 
368 void
370 {
371  NS_LOG_FUNCTION (this << size);
372  m_bkMaxAmpduSize = size;
374 }
375 
376 void
378 {
379  NS_LOG_FUNCTION (this << (uint16_t) threshold);
380  GetVOQueue ()->SetBlockAckThreshold (threshold);
381 }
382 
383 void
385 {
386  NS_LOG_FUNCTION (this << (uint16_t) threshold);
387  GetVIQueue ()->SetBlockAckThreshold (threshold);
388 }
389 
390 void
392 {
393  NS_LOG_FUNCTION (this << (uint16_t) threshold);
394  GetBEQueue ()->SetBlockAckThreshold (threshold);
395 }
396 
397 void
399 {
400  NS_LOG_FUNCTION (this << (uint16_t) threshold);
401  GetBKQueue ()->SetBlockAckThreshold (threshold);
402 }
403 
404 void
406 {
407  NS_LOG_FUNCTION (this << timeout);
409 }
410 
411 void
413 {
414  NS_LOG_FUNCTION (this << timeout);
416 }
417 
418 void
420 {
421  NS_LOG_FUNCTION (this << timeout);
423 }
424 
425 void
427 {
428  NS_LOG_FUNCTION (this << timeout);
430 }
431 
432 void
434 {
435  NS_LOG_FUNCTION (this << ac);
436 
437  //Our caller shouldn't be attempting to setup a queue that is
438  //already configured.
439  NS_ASSERT (m_edca.find (ac) == m_edca.end ());
440 
441  Ptr<EdcaTxopN> edca = CreateObject<EdcaTxopN> ();
442  edca->SetLow (m_low);
443  edca->SetManager (m_dcfManager);
444  edca->SetTxMiddle (m_txMiddle);
445  edca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this));
446  edca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this));
447  edca->SetTxDroppedCallback (MakeCallback (&RegularWifiMac::NotifyTxDrop, this));
448  edca->SetAccessCategory (ac);
449  edca->CompleteConfig ();
450 
451  m_edca.insert (std::make_pair (ac, edca));
452 }
453 
454 void
456 {
457  NS_LOG_FUNCTION (this << type);
458  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
459  {
460  i->second->SetTypeOfStation (type);
461  }
462 }
463 
466 {
467  return m_dca;
468 }
469 
472 {
473  return m_edca.find (AC_VO)->second;
474 }
475 
478 {
479  return m_edca.find (AC_VI)->second;
480 }
481 
484 {
485  return m_edca.find (AC_BE)->second;
486 }
487 
490 {
491  return m_edca.find (AC_BK)->second;
492 }
493 
494 void
496 {
497  NS_LOG_FUNCTION (this << phy);
498  m_phy = phy;
500  m_low->SetPhy (phy);
501 }
502 
505 {
506  NS_LOG_FUNCTION (this);
507  return m_phy;
508 }
509 
510 void
512 {
513  NS_LOG_FUNCTION (this);
514  m_low->ResetPhy ();
516  m_phy = 0;
517 }
518 
519 void
521 {
522  NS_LOG_FUNCTION (this);
523  m_forwardUp = upCallback;
524 }
525 
526 void
528 {
529  NS_LOG_FUNCTION (this);
530  m_linkUp = linkUp;
531 }
532 
533 void
535 {
536  NS_LOG_FUNCTION (this);
537  m_linkDown = linkDown;
538 }
539 
540 void
542 {
543  NS_LOG_FUNCTION (this << enable);
544  m_qosSupported = enable;
545 }
546 
547 bool
549 {
550  return m_qosSupported;
551 }
552 
553 void
555 {
556  NS_LOG_FUNCTION (this << enable);
557  m_vhtSupported = enable;
558  if (enable)
559  {
560  SetQosSupported (true);
561  }
562  if (!enable && !m_htSupported)
563  {
565  }
566  else
567  {
569  }
570 }
571 
572 void
574 {
575  NS_LOG_FUNCTION (this << enable);
576  m_htSupported = enable;
577  if (enable)
578  {
579  SetQosSupported (true);
580  }
581  if (!enable && !m_vhtSupported)
582  {
584  }
585  else
586  {
588  }
589 }
590 
591 void
593 {
594  NS_LOG_FUNCTION (this << enable);
595  m_heSupported = enable;
596  if (enable)
597  {
598  SetQosSupported (true);
599  }
600  if (!enable && !m_htSupported && !m_vhtSupported)
601  {
603  }
604  else
605  {
607  }
608 }
609 
610 bool
612 {
613  return m_vhtSupported;
614 }
615 
616 bool
618 {
619  return m_htSupported;
620 }
621 
622 bool
624 {
625  return m_heSupported;
626 }
627 
628 bool
630 {
631  return m_erpSupported;
632 }
633 
634 void
636 {
637  NS_LOG_FUNCTION (this);
638  if (enable)
639  {
640  SetDsssSupported (true);
641  }
642  m_erpSupported = enable;
643 }
644 
645 void
647 {
648  NS_LOG_FUNCTION (this);
649  m_dsssSupported = enable;
650 }
651 
652 bool
654 {
655  return m_dsssSupported;
656 }
657 
658 void
660 {
661  NS_LOG_FUNCTION (this);
662  m_low->SetCtsToSelfSupported (enable);
663 }
664 
665 bool
667 {
668  return m_low->GetCtsToSelfSupported ();
669 }
670 
671 void
673 {
674  NS_LOG_FUNCTION (this << slotTime);
675  m_dcfManager->SetSlot (slotTime);
676  m_low->SetSlotTime (slotTime);
677 }
678 
679 Time
681 {
682  return m_low->GetSlotTime ();
683 }
684 
685 void
687 {
688  NS_LOG_FUNCTION (this << sifs);
689  m_dcfManager->SetSifs (sifs);
690  m_low->SetSifs (sifs);
691 }
692 
693 Time
695 {
696  return m_low->GetSifs ();
697 }
698 
699 void
701 {
702  NS_LOG_FUNCTION (this << eifsNoDifs);
703  m_dcfManager->SetEifsNoDifs (eifsNoDifs);
704 }
705 
706 Time
708 {
709  return m_dcfManager->GetEifsNoDifs ();
710 }
711 
712 void
714 {
715  NS_LOG_FUNCTION (this << rifs);
716  m_low->SetRifs (rifs);
717 }
718 
719 Time
721 {
722  return m_low->GetRifs ();
723 }
724 
725 void
727 {
728  NS_LOG_FUNCTION (this << pifs);
729  m_low->SetPifs (pifs);
730 }
731 
732 Time
734 {
735  return m_low->GetPifs ();
736 }
737 
738 void
740 {
741  NS_LOG_FUNCTION (this << ackTimeout);
742  m_low->SetAckTimeout (ackTimeout);
743 }
744 
745 Time
747 {
748  return m_low->GetAckTimeout ();
749 }
750 
751 void
753 {
754  NS_LOG_FUNCTION (this << ctsTimeout);
755  m_low->SetCtsTimeout (ctsTimeout);
756 }
757 
758 Time
760 {
761  return m_low->GetCtsTimeout ();
762 }
763 
764 void
766 {
767  NS_LOG_FUNCTION (this << blockAckTimeout);
768  m_low->SetBasicBlockAckTimeout (blockAckTimeout);
769 }
770 
771 Time
773 {
774  return m_low->GetBasicBlockAckTimeout ();
775 }
776 
777 void
779 {
780  NS_LOG_FUNCTION (this << blockAckTimeout);
781  m_low->SetCompressedBlockAckTimeout (blockAckTimeout);
782 }
783 
784 Time
786 {
788 }
789 
790 void
792 {
793  NS_LOG_FUNCTION (this << address);
794  m_low->SetAddress (address);
795 }
796 
799 {
800  return m_low->GetAddress ();
801 }
802 
803 void
805 {
806  NS_LOG_FUNCTION (this << ssid);
807  m_ssid = ssid;
808 }
809 
810 Ssid
812 {
813  return m_ssid;
814 }
815 
816 void
818 {
819  NS_LOG_FUNCTION (this << bssid);
820  m_low->SetBssid (bssid);
821 }
822 
825 {
826  return m_low->GetBssid ();
827 }
828 
829 void
831 {
832  m_low->SetPromisc ();
833 }
834 
835 void
837 {
838  NS_LOG_FUNCTION (this << enable);
839  m_shortSlotTimeSupported = enable;
840 }
841 
842 bool
844 {
846 }
847 
848 void
850 {
851  NS_LOG_FUNCTION (this << enable);
852  m_rifsSupported = enable;
853 }
854 
855 bool
857 {
858  return m_rifsSupported;
859 }
860 
861 void
863  Mac48Address to, Mac48Address from)
864 {
865  //We expect RegularWifiMac subclasses which do support forwarding (e.g.,
866  //AP) to override this method. Therefore, we throw a fatal error if
867  //someone tries to invoke this method on a class which has not done
868  //this.
869  NS_FATAL_ERROR ("This MAC entity (" << this << ", " << GetAddress ()
870  << ") does not support Enqueue() with from address");
871 }
872 
873 bool
875 {
876  return false;
877 }
878 
879 void
881 {
882  NS_LOG_FUNCTION (this << packet << from << to);
883  m_forwardUp (packet, from, to);
884 }
885 
886 void
888 {
889  NS_LOG_FUNCTION (this << packet << hdr);
890 
891  Mac48Address to = hdr->GetAddr1 ();
892  Mac48Address from = hdr->GetAddr2 ();
893 
894  //We don't know how to deal with any frame that is not addressed to
895  //us (and odds are there is nothing sensible we could do anyway),
896  //so we ignore such frames.
897  //
898  //The derived class may also do some such filtering, but it doesn't
899  //hurt to have it here too as a backstop.
900  if (to != GetAddress ())
901  {
902  return;
903  }
904 
905  if (hdr->IsMgt () && hdr->IsAction ())
906  {
907  //There is currently only any reason for Management Action
908  //frames to be flying about if we are a QoS STA.
910 
911  WifiActionHeader actionHdr;
912  packet->RemoveHeader (actionHdr);
913 
914  switch (actionHdr.GetCategory ())
915  {
917 
918  switch (actionHdr.GetAction ().blockAck)
919  {
921  {
922  MgtAddBaRequestHeader reqHdr;
923  packet->RemoveHeader (reqHdr);
924 
925  //We've received an ADDBA Request. Our policy here is
926  //to automatically accept it, so we get the ADDBA
927  //Response on it's way immediately.
928  SendAddBaResponse (&reqHdr, from);
929  //This frame is now completely dealt with, so we're done.
930  return;
931  }
933  {
934  MgtAddBaResponseHeader respHdr;
935  packet->RemoveHeader (respHdr);
936 
937  //We've received an ADDBA Response. We assume that it
938  //indicates success after an ADDBA Request we have
939  //sent (we could, in principle, check this, but it
940  //seems a waste given the level of the current model)
941  //and act by locally establishing the agreement on
942  //the appropriate queue.
943  AcIndex ac = QosUtilsMapTidToAc (respHdr.GetTid ());
944  m_edca[ac]->GotAddBaResponse (&respHdr, from);
945  //This frame is now completely dealt with, so we're done.
946  return;
947  }
949  {
950  MgtDelBaHeader delBaHdr;
951  packet->RemoveHeader (delBaHdr);
952 
953  if (delBaHdr.IsByOriginator ())
954  {
955  //This DELBA frame was sent by the originator, so
956  //this means that an ingoing established
957  //agreement exists in MacLow and we need to
958  //destroy it.
959  m_low->DestroyBlockAckAgreement (from, delBaHdr.GetTid ());
960  }
961  else
962  {
963  //We must have been the originator. We need to
964  //tell the correct queue that the agreement has
965  //been torn down
966  AcIndex ac = QosUtilsMapTidToAc (delBaHdr.GetTid ());
967  m_edca[ac]->GotDelBaFrame (&delBaHdr, from);
968  }
969  //This frame is now completely dealt with, so we're done.
970  return;
971  }
972  default:
973  NS_FATAL_ERROR ("Unsupported Action field in Block Ack Action frame");
974  return;
975  }
976  default:
977  NS_FATAL_ERROR ("Unsupported Action frame received");
978  return;
979  }
980  }
981  NS_FATAL_ERROR ("Don't know how to handle frame (type=" << hdr->GetType ());
982 }
983 
984 void
986  const WifiMacHeader *hdr)
987 {
989  MsduAggregator::Deaggregate (aggregatedPacket);
990 
991  for (MsduAggregator::DeaggregatedMsdusCI i = packets.begin ();
992  i != packets.end (); ++i)
993  {
994  ForwardUp ((*i).first, (*i).second.GetSourceAddr (),
995  (*i).second.GetDestinationAddr ());
996  }
997 }
998 
999 void
1001  Mac48Address originator)
1002 {
1003  NS_LOG_FUNCTION (this);
1004  WifiMacHeader hdr;
1005  hdr.SetAction ();
1006  hdr.SetAddr1 (originator);
1007  hdr.SetAddr2 (GetAddress ());
1008  hdr.SetAddr3 (GetAddress ());
1009  hdr.SetDsNotFrom ();
1010  hdr.SetDsNotTo ();
1011 
1012  MgtAddBaResponseHeader respHdr;
1013  StatusCode code;
1014  code.SetSuccess ();
1015  respHdr.SetStatusCode (code);
1016  //Here a control about queues type?
1017  respHdr.SetAmsduSupport (reqHdr->IsAmsduSupported ());
1018 
1019  if (reqHdr->IsImmediateBlockAck ())
1020  {
1021  respHdr.SetImmediateBlockAck ();
1022  }
1023  else
1024  {
1025  respHdr.SetDelayedBlockAck ();
1026  }
1027  respHdr.SetTid (reqHdr->GetTid ());
1028  //For now there's not no control about limit of reception. We
1029  //assume that receiver has no limit on reception. However we assume
1030  //that a receiver sets a bufferSize in order to satisfy next
1031  //equation: (bufferSize + 1) % 16 = 0 So if a recipient is able to
1032  //buffer a packet, it should be also able to buffer all possible
1033  //packet's fragments. See section 7.3.1.14 in IEEE802.11e for more details.
1034  respHdr.SetBufferSize (1023);
1035  respHdr.SetTimeout (reqHdr->GetTimeout ());
1036 
1037  WifiActionHeader actionHdr;
1040  actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
1041 
1042  Ptr<Packet> packet = Create<Packet> ();
1043  packet->AddHeader (respHdr);
1044  packet->AddHeader (actionHdr);
1045 
1046  //We need to notify our MacLow object as it will have to buffer all
1047  //correctly received packets for this Block Ack session
1048  m_low->CreateBlockAckAgreement (&respHdr, originator,
1049  reqHdr->GetStartingSequence ());
1050 
1051  //It is unclear which queue this frame should go into. For now we
1052  //bung it into the queue corresponding to the TID for which we are
1053  //establishing an agreement, and push it to the head.
1054  m_edca[QosUtilsMapTidToAc (reqHdr->GetTid ())]->PushFront (packet, hdr);
1055 }
1056 
1057 TypeId
1059 {
1060  static TypeId tid = TypeId ("ns3::RegularWifiMac")
1061  .SetParent<WifiMac> ()
1062  .SetGroupName ("Wifi")
1063  .AddAttribute ("QosSupported",
1064  "This Boolean attribute is set to enable 802.11e/WMM-style QoS support at this STA.",
1065  BooleanValue (false),
1068  MakeBooleanChecker ())
1069  .AddAttribute ("HtSupported",
1070  "This Boolean attribute is set to enable 802.11n support at this STA.",
1071  BooleanValue (false),
1074  MakeBooleanChecker ())
1075  .AddAttribute ("VhtSupported",
1076  "This Boolean attribute is set to enable 802.11ac support at this STA.",
1077  BooleanValue (false),
1080  MakeBooleanChecker ())
1081  .AddAttribute ("HeSupported",
1082  "This Boolean attribute is set to enable 802.11ax support at this STA.",
1083  BooleanValue (false),
1086  MakeBooleanChecker ())
1087  .AddAttribute ("CtsToSelfSupported",
1088  "Use CTS to Self when using a rate that is not in the basic rate set.",
1089  BooleanValue (false),
1092  MakeBooleanChecker ())
1093  .AddAttribute ("VO_MaxAmsduSize",
1094  "Maximum length in bytes of an A-MSDU for AC_VO access class. "
1095  "Value 0 means A-MSDU is disabled for that AC.",
1096  UintegerValue (0),
1098  MakeUintegerChecker<uint32_t> (0, 11426))
1099  .AddAttribute ("VI_MaxAmsduSize",
1100  "Maximum length in bytes of an A-MSDU for AC_VI access class."
1101  "Value 0 means A-MSDU is disabled for that AC.",
1102  UintegerValue (0),
1104  MakeUintegerChecker<uint32_t> (0, 11426))
1105  .AddAttribute ("BE_MaxAmsduSize",
1106  "Maximum length in bytes of an A-MSDU for AC_BE access class."
1107  "Value 0 means A-MSDU is disabled for that AC.",
1108  UintegerValue (0),
1110  MakeUintegerChecker<uint32_t> (0, 11426))
1111  .AddAttribute ("BK_MaxAmsduSize",
1112  "Maximum length in bytes of an A-MSDU for AC_BK access class."
1113  "Value 0 means A-MSDU is disabled for that AC.",
1114  UintegerValue (0),
1116  MakeUintegerChecker<uint32_t> (0, 11426))
1117  .AddAttribute ("VO_MaxAmpduSize",
1118  "Maximum length in bytes of an A-MPDU for AC_VO access class."
1119  "Value 0 means A-MPDU is disabled for that AC.",
1120  UintegerValue (0),
1122  MakeUintegerChecker<uint32_t> (0, 65535))
1123  .AddAttribute ("VI_MaxAmpduSize",
1124  "Maximum length in bytes of an A-MPDU for AC_VI access class."
1125  "Value 0 means A-MPDU is disabled for that AC.",
1126  UintegerValue (65535),
1128  MakeUintegerChecker<uint32_t> (0, 65535))
1129  .AddAttribute ("BE_MaxAmpduSize",
1130  "Maximum length in bytes of an A-MPDU for AC_BE access class."
1131  "Value 0 means A-MPDU is disabled for that AC.",
1132  UintegerValue (65535),
1134  MakeUintegerChecker<uint32_t> (0, 65535))
1135  .AddAttribute ("BK_MaxAmpduSize",
1136  "Maximum length in bytes of an A-MPDU for AC_BK access class."
1137  "Value 0 means A-MPDU is disabled for that AC.",
1138  UintegerValue (0),
1140  MakeUintegerChecker<uint32_t> (0, 65535))
1141  .AddAttribute ("VO_BlockAckThreshold",
1142  "If number of packets in VO queue reaches this value, "
1143  "block ack mechanism is used. If this value is 0, block ack is never used."
1144  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
1145  UintegerValue (0),
1147  MakeUintegerChecker<uint8_t> (0, 64))
1148  .AddAttribute ("VI_BlockAckThreshold",
1149  "If number of packets in VI queue reaches this value, "
1150  "block ack mechanism is used. If this value is 0, block ack is never used."
1151  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
1152  UintegerValue (0),
1154  MakeUintegerChecker<uint8_t> (0, 64))
1155  .AddAttribute ("BE_BlockAckThreshold",
1156  "If number of packets in BE queue reaches this value, "
1157  "block ack mechanism is used. If this value is 0, block ack is never used."
1158  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
1159  UintegerValue (0),
1161  MakeUintegerChecker<uint8_t> (0, 64))
1162  .AddAttribute ("BK_BlockAckThreshold",
1163  "If number of packets in BK 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 ("VO_BlockAckInactivityTimeout",
1170  "Represents max time (blocks of 1024 micro seconds) allowed for block ack"
1171  "inactivity for AC_VO. 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 ("VI_BlockAckInactivityTimeout",
1178  "Represents max time (blocks of 1024 micro seconds) allowed for block ack"
1179  "inactivity for AC_VI. 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 ("BE_BlockAckInactivityTimeout",
1186  "Represents max time (blocks of 1024 micro seconds) allowed for block ack"
1187  "inactivity for AC_BE. If this value isn't equal to 0 a timer start after that a"
1188  "block ack setup is completed and will be reset every time that a block ack"
1189  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
1190  UintegerValue (0),
1192  MakeUintegerChecker<uint16_t> ())
1193  .AddAttribute ("BK_BlockAckInactivityTimeout",
1194  "Represents max time (blocks of 1024 micro seconds) allowed for block ack"
1195  "inactivity for AC_BK. If this value isn't equal to 0 a timer start after that a"
1196  "block ack setup is completed and will be reset every time that a block ack"
1197  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
1198  UintegerValue (0),
1200  MakeUintegerChecker<uint16_t> ())
1201  .AddAttribute ("ShortSlotTimeSupported",
1202  "Whether or not short slot time is supported (only used by ERP APs or STAs).",
1203  BooleanValue (true),
1206  MakeBooleanChecker ())
1207  .AddAttribute ("RifsSupported",
1208  "Whether or not RIFS is supported (only used by HT APs or STAs).",
1209  BooleanValue (false),
1212  MakeBooleanChecker ())
1213  .AddAttribute ("DcaTxop",
1214  "The DcaTxop object.",
1215  PointerValue (),
1217  MakePointerChecker<DcaTxop> ())
1218  .AddAttribute ("VO_EdcaTxopN",
1219  "Queue that manages packets belonging to AC_VO access class.",
1220  PointerValue (),
1222  MakePointerChecker<EdcaTxopN> ())
1223  .AddAttribute ("VI_EdcaTxopN",
1224  "Queue that manages packets belonging to AC_VI access class.",
1225  PointerValue (),
1227  MakePointerChecker<EdcaTxopN> ())
1228  .AddAttribute ("BE_EdcaTxopN",
1229  "Queue that manages packets belonging to AC_BE access class.",
1230  PointerValue (),
1232  MakePointerChecker<EdcaTxopN> ())
1233  .AddAttribute ("BK_EdcaTxopN",
1234  "Queue that manages packets belonging to AC_BK access class.",
1235  PointerValue (),
1237  MakePointerChecker<EdcaTxopN> ())
1238  .AddTraceSource ("TxOkHeader",
1239  "The header of successfully transmitted packet.",
1241  "ns3::WifiMacHeader::TracedCallback")
1242  .AddTraceSource ("TxErrHeader",
1243  "The header of unsuccessfully transmitted packet.",
1245  "ns3::WifiMacHeader::TracedCallback")
1246  ;
1247  return tid;
1248 }
1249 
1250 void
1252 {
1253  NS_LOG_FUNCTION (this << standard);
1254  uint32_t cwmin = 0;
1255  uint32_t cwmax = 0;
1256  switch (standard)
1257  {
1259  SetHeSupported (true);
1261  SetVhtSupported (true);
1263  SetHtSupported (true);
1264  cwmin = 15;
1265  cwmax = 1023;
1266  break;
1268  SetHeSupported (true);
1270  SetHtSupported (true);
1272  SetErpSupported (true);
1277  cwmin = 15;
1278  cwmax = 1023;
1279  break;
1281  SetDsssSupported (true);
1282  cwmin = 31;
1283  cwmax = 1023;
1284  break;
1285  default:
1286  NS_FATAL_ERROR ("Unsupported WifiPhyStandard in RegularWifiMac::FinishConfigureStandard ()");
1287  }
1288 
1289  ConfigureContentionWindow (cwmin, cwmax);
1290 }
1291 
1292 void
1293 RegularWifiMac::ConfigureContentionWindow (uint32_t cwMin, uint32_t cwMax)
1294 {
1295  bool isDsssOnly = m_dsssSupported && !m_erpSupported;
1296  //The special value of AC_BE_NQOS which exists in the Access
1297  //Category enumeration allows us to configure plain old DCF.
1298  ConfigureDcf (m_dca, cwMin, cwMax, isDsssOnly, AC_BE_NQOS);
1299 
1300  //Now we configure the EDCA functions
1301  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
1302  {
1303  ConfigureDcf (i->second, cwMin, cwMax, isDsssOnly, i->first);
1304  }
1305 }
1306 
1307 void
1309 {
1310  NS_LOG_FUNCTION (this << hdr);
1311  m_txOkCallback (hdr);
1312 }
1313 
1314 void
1316 {
1317  NS_LOG_FUNCTION (this << hdr);
1318  m_txErrCallback (hdr);
1319 }
1320 
1321 void
1323 {
1324  NS_LOG_FUNCTION (this);
1325  if (GetVOQueue ()->GetMsduAggregator () != 0)
1326  {
1328  }
1329  if (GetVIQueue ()->GetMsduAggregator () != 0)
1330  {
1332  }
1333  if (GetBEQueue ()->GetMsduAggregator () != 0)
1334  {
1336  }
1337  if (GetBKQueue ()->GetMsduAggregator () != 0)
1338  {
1340  }
1341  if (GetVOQueue ()->GetMpduAggregator () != 0)
1342  {
1344  }
1345  if (GetVIQueue ()->GetMpduAggregator () != 0)
1346  {
1348  }
1349  if (GetBEQueue ()->GetMpduAggregator () != 0)
1350  {
1352  }
1353  if (GetBKQueue ()->GetMpduAggregator () != 0)
1354  {
1356  }
1357 }
1358 
1359 void
1361 {
1362  NS_LOG_FUNCTION (this);
1363  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
1364  {
1365  if (i->second->GetMsduAggregator () == 0)
1366  {
1367  Ptr<MsduStandardAggregator> msduAggregator = CreateObject<MsduStandardAggregator> ();
1368  i->second->SetMsduAggregator (msduAggregator);
1369  }
1370  if (i->second->GetMpduAggregator () == 0)
1371  {
1372  Ptr<MpduStandardAggregator> mpduAggregator = CreateObject<MpduStandardAggregator> ();
1373  i->second->SetMpduAggregator (mpduAggregator);
1374  }
1375  }
1377 }
1378 
1379 void
1381 {
1382  NS_LOG_FUNCTION (this);
1383  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
1384  {
1385  i->second->SetMsduAggregator (0);
1386  i->second->SetMpduAggregator (0);
1387  }
1388 }
1389 
1390 } //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:267
void Dispose(void)
Dispose of this Object.
Definition: object.cc:214
void SetAction()
Set Type/Subtype values for an action header.
Time GetPifs(void) const
Return PCF Interframe Space (PIFS) of this MacLow.
Definition: mac-low.cc:579
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:505
uint32_t m_viMaxAmsduSize
maximum A-MSDU size for AC_VI
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.
#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
void SetPromisc(void)
Enable promiscuous mode.
Definition: mac-low.cc:523
void SetTxMcsMap(uint16_t map)
ForwardUpCallback m_forwardUp
Callback to forward packet up the stack.
void SetHtSupported(uint8_t htsupported)
Set the HT Supported field in the HT Supported information element.
bool GetGreenfield(void) const
Return whether Greenfield is supported.
Definition: wifi-phy.cc:624
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:625
static TypeId GetTypeId(void)
Get the type ID.
void SetRxMcsBitmask(uint8_t index)
Set the receive MCS bitmask.
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
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:421
EdcaQueues m_edca
This is a map from Access Category index to the corresponding channel access function.
uint32_t m_beMaxAmpduSize
maximum A-MPDU size for AC_BE
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:585
void SetSifs(Time sifs)
Set Short Interframe Space (SIFS) of this MacLow.
Definition: mac-low.cc:493
uint8_t GetMaxSupportedRxSpatialStreams(void) const
Definition: wifi-phy.cc:1345
Implement the header for management frames of type add block ack request.
Definition: mgt-headers.h:758
void SetPifs(Time pifs)
void SetCompressedBlockAckTimeout(Time blockAckTimeout)
#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)
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:637
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:597
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...
Time GetCompressedBlockAckTimeout() const
Return Compressed Block ACK timeout of this MacLow.
Definition: mac-low.cc:547
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:3553
void SetLinkDownCallback(Callback< void > linkDown)
void SetHtSupported(bool enable)
Enable or disable HT support for the device.
CategoryValue GetCategory()
Return the category value.
Definition: mgt-headers.cc:888
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
ns3::Time timeout
void SetRifs(Time rifs)
Time GetCtsTimeout(void) const
Return CTS timeout of this MacLow.
Definition: mac-low.cc:553
void SetStatusCode(StatusCode code)
Set the status code.
Ssid GetSsid(void) const
Video.
Definition: qos-utils.h:45
Voice.
Definition: qos-utils.h:47
Best Effort.
Definition: qos-utils.h:41
uint16_t GetFrequency(void) const
Definition: wifi-phy.cc:1270
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:97
uint32_t m_beMaxAmsduSize
maximum A-MSDU size for AC_BE
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capability 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 capability of the device.
void SetViMaxAmpduSize(uint32_t size)
Set the maximum A-MPDU size for AC_VI.
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:475
bool m_rifsSupported
flag whether RIFS is supported
void SetBasicBlockAckTimeout(Time blockAckTimeout)
Set Basic Block ACK timeout of this MacLow.
Definition: mac-low.cc:463
void SetBkMaxAmsduSize(uint32_t size)
Set the maximum A-MSDU size for AC_BK.
void SetVoMaxAmpduSize(uint32_t size)
Set the maximum A-MPDU size for AC_VO.
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:598
void SetChannelWidthSet(uint8_t channelWidthSet)
Set channel width set.
void SetTid(uint8_t tid)
Set Traffic ID (TID).
void SetBeMaxAmpduSize(uint32_t size)
Set the maximum A-MPDU size for AC_BE.
void SetHeLtfAndGiForHePpdus(uint8_t heLtfAndGiForHePpdus)
Set HE LTF and GI for HE PDPUs.
static bool Is2_4Ghz(double frequency)
Definition: wifi-phy.cc:1276
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
uint32_t m_voMaxAmsduSize
maximum A-MSDU size for AC_VO
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:2287
Time GetCtsTimeout(void) const
void SetForwardUpCallback(ForwardUpCallback upCallback)
void SetBeMaxAmsduSize(uint32_t size)
Set the maximum A-MSDU size for AC_BE.
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:2245
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.
void SetVoMaxAmsduSize(uint32_t size)
Set the maximum A-MSDU size for AC_VO.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1017
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:143
virtual void SetMaxAmpduSize(uint32_t maxSize)=0
Sets the maximum A-MPDU size in bytes.
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:131
void SetViMaxAmsduSize(uint32_t size)
Set the maximum A-MSDU size for AC_VI.
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:457
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:651
void SetAddress(Mac48Address address)
Time GetRifs(void) const
Return Reduced Interframe Space (RIFS) of this MacLow.
Definition: mac-low.cc:566
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:529
void SetupLow(Ptr< MacLow > low)
Set up listener for MacLow events.
Definition: dcf-manager.cc:155
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 capability 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:3559
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:714
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:708
Hold objects of type Ptr.
Definition: pointer.h:36
void SetBssid(Mac48Address ad)
Set the Basic Service Set Identification.
Definition: mac-low.cc:517
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
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:176
virtual void SetMaxAmsduSize(uint32_t maxSize)=0
Sets the maximum A-MSDU size in bytes.
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:1332
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:573
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.
Mac48Address GetBssid(void) const
void SetLow(const Ptr< MacLow > low)
Set MacLow associated with this DcaTxop.
Definition: dca-txop.cc:115
void SetSlot(Time slotTime)
Definition: dcf-manager.cc:162
uint8_t GetChannelWidth(void) const
Definition: wifi-phy.cc:1304
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.
void SetRxMcsMap(uint16_t map)
uint16_t GetStartingSequence(void) const
Return the starting sequence number.
static bool Is5Ghz(double frequency)
Definition: wifi-phy.cc:1286
void SetRifs(Time rifs)
Set Reduced Interframe Space (RIFS) of this MacLow.
Definition: mac-low.cc:511
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.
Time GetBasicBlockAckTimeout(void) const
BlockAckActionValue blockAck
block ack
Definition: mgt-headers.h:701
void SetSlotTime(Time slotTime)
Set slot duration of this MacLow.
Definition: mac-low.cc:499
Time GetSifs(void) const
Return Short Interframe Space (SIFS) of this MacLow.
Definition: mac-low.cc:559
Implement the header for management frames of type add block ack response.
Definition: mgt-headers.h:890
Implement the header for management frames of type del block ack.
Definition: mgt-headers.h:1011
#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:696
Total number of ACs.
Definition: qos-utils.h:49
bool GetCtsToSelfSupported() const
Return whether CTS-to-self capability is supported.
Definition: mac-low.cc:481
Time GetEifsNoDifs() const
Definition: dcf-manager.cc:183
virtual void DoInitialize()
Initialize() implementation.
void SetCtsTimeout(Time ctsTimeout)
Set CTS timeout of this MacLow.
Definition: mac-low.cc:487
void SetLdpc(uint8_t ldpc)
Set the LDPC field.
void SetBkBlockAckInactivityTimeout(uint16_t timeout)
Set BK block ack inactivity timeout.
Time GetAckTimeout(void) const
Return ACK timeout of this MacLow.
Definition: mac-low.cc:535
uint32_t m_bkMaxAmsduSize
maximum A-MSDU size for AC_BK
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:451
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.
uint32_t m_viMaxAmpduSize
maximum A-MPDU size for AC_VI
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 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.
Definition: mgt-headers.cc:909
void SetPromisc(void)
Sets the interface in promiscuous mode.
void ResetPhy(void)
Remove WifiPhy associated with this MacLow.
Definition: mac-low.cc:436
The IEEE 802.11ax HE Capabilities.
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.
Definition: mgt-headers.cc:854
Time GetBasicBlockAckTimeout() const
Return Basic Block ACK timeout of this MacLow.
Definition: mac-low.cc:541
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.
void SetWifiPhy(const Ptr< WifiPhy > phy)
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:169
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:445
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 SetCompressedBlockAckTimeout(Time blockAckTimeout)
Set Compressed Block ACK timeout of this MacLow.
Definition: mac-low.cc:469
void SetBkMaxAmpduSize(uint32_t size)
Set the maximum A-MPDU size for AC_BK.
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.