A Discrete-Event Network Simulator
API
regular-wifi-mac.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008 INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 
21 #include "ns3/log.h"
22 #include "ns3/pointer.h"
23 #include "ns3/packet.h"
24 #include "regular-wifi-mac.h"
25 #include "wifi-phy.h"
26 #include "mac-rx-middle.h"
27 #include "mac-tx-middle.h"
28 #include "mac-low.h"
29 #include "msdu-aggregator.h"
30 #include "mpdu-aggregator.h"
31 #include "wifi-utils.h"
32 #include "mgt-headers.h"
33 #include "amsdu-subframe-header.h"
34 
35 namespace ns3 {
36 
37 NS_LOG_COMPONENT_DEFINE ("RegularWifiMac");
38 
39 NS_OBJECT_ENSURE_REGISTERED (RegularWifiMac);
40 
42  : m_qosSupported (0),
43  m_htSupported (0),
44  m_vhtSupported (0),
45  m_erpSupported (0),
46  m_dsssSupported (0),
47  m_heSupported (0)
48 {
49  NS_LOG_FUNCTION (this);
50  m_rxMiddle = Create<MacRxMiddle> ();
51  m_rxMiddle->SetForwardCallback (MakeCallback (&RegularWifiMac::Receive, this));
52 
53  m_txMiddle = Create<MacTxMiddle> ();
54 
55  m_low = CreateObject<MacLow> ();
57 
58  m_channelAccessManager = CreateObject<ChannelAccessManager> ();
60 
61  m_txop = CreateObject<Txop> ();
62  m_txop->SetMacLow (m_low);
68 
69  //Construct the EDCAFs. The ordering is important - highest
70  //priority (Table 9-1 UP-to-AC mapping; IEEE 802.11-2012) must be created
71  //first.
76 }
77 
79 {
80  NS_LOG_FUNCTION (this);
81 }
82 
83 void
85 {
86  NS_LOG_FUNCTION (this);
87  m_txop->Initialize ();
88 
89  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
90  {
91  i->second->Initialize ();
92  }
93 }
94 
95 void
97 {
98  NS_LOG_FUNCTION (this);
99 
100  m_rxMiddle = 0;
101  m_txMiddle = 0;
102 
103  m_low->Dispose ();
104  m_low = 0;
105 
106  m_phy = 0;
107  m_stationManager = 0;
108 
109  m_txop->Dispose ();
110  m_txop = 0;
111 
112  for (EdcaQueues::iterator i = m_edca.begin (); i != m_edca.end (); ++i)
113  {
114  i->second->Dispose ();
115  i->second = 0;
116  }
117 
120 }
121 
122 void
124 {
125  NS_LOG_FUNCTION (this << stationManager);
126  m_stationManager = stationManager;
130  m_low->SetWifiRemoteStationManager (stationManager);
131 
132  m_txop->SetWifiRemoteStationManager (stationManager);
133 
134  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
135  {
136  i->second->SetWifiRemoteStationManager (stationManager);
137  }
138 }
139 
142 {
143  return m_stationManager;
144 }
145 
148 {
149  NS_LOG_FUNCTION (this);
150  ExtendedCapabilities capabilities;
152  {
153  if (m_htSupported)
154  {
155  capabilities.SetHtSupported (1);
156  }
157  if (m_vhtSupported)
158  {
159  capabilities.SetVhtSupported (1);
160  }
161  }
162  //TODO: to be completed
163  return capabilities;
164 }
165 
168 {
169  NS_LOG_FUNCTION (this);
170  HtCapabilities capabilities;
171  if (m_htSupported)
172  {
173  capabilities.SetHtSupported (1);
174  capabilities.SetLdpc (m_phy->GetLdpc ());
175  capabilities.SetSupportedChannelWidth (m_phy->GetChannelWidth () >= 40);
178  capabilities.SetGreenfield (m_phy->GetGreenfield ());
180  capabilities.SetMaxAmsduLength (maxAmsduLength > 3839); //0 if 3839 and 1 if 7935
181  capabilities.SetLSigProtectionSupport (!m_phy->GetGreenfield ());
182  double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (m_beMaxAmpduSize, m_bkMaxAmpduSize), std::max (m_voMaxAmpduSize, m_viMaxAmpduSize))
183  + 1.0)
184  / std::log (2.0))
185  - 13.0),
186  0.0);
187  NS_ASSERT (maxAmpduLengthExponent >= 0 && maxAmpduLengthExponent <= 255);
188  capabilities.SetMaxAmpduLength (std::max<uint8_t> (3, static_cast<uint8_t> (maxAmpduLengthExponent))); //0 to 3 for HT
189  uint64_t maxSupportedRate = 0; //in bit/s
190  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
191  {
192  WifiMode mcs = m_phy->GetMcs (i);
194  {
195  continue;
196  }
197  capabilities.SetRxMcsBitmask (mcs.GetMcsValue ());
198  uint8_t nss = (mcs.GetMcsValue () / 8) + 1;
199  NS_ASSERT (nss > 0 && nss < 5);
200  uint64_t dataRate = mcs.GetDataRate (m_phy->GetChannelWidth (), m_phy->GetShortGuardInterval () ? 400 : 800, nss);
201  if (dataRate > maxSupportedRate)
202  {
203  maxSupportedRate = dataRate;
204  NS_LOG_DEBUG ("Updating maxSupportedRate to " << maxSupportedRate);
205  }
206  }
207  capabilities.SetRxHighestSupportedDataRate (static_cast<uint16_t> (maxSupportedRate / 1e6)); //in Mbit/s
208  capabilities.SetTxMcsSetDefined (m_phy->GetNMcs () > 0);
210  //we do not support unequal modulations
211  capabilities.SetTxRxMcsSetUnequal (0);
212  capabilities.SetTxUnequalModulation (0);
213  }
214  return capabilities;
215 }
216 
219 {
220  NS_LOG_FUNCTION (this);
221  VhtCapabilities capabilities;
222  if (m_vhtSupported)
223  {
224  capabilities.SetVhtSupported (1);
225  if (m_phy->GetChannelWidth () == 160)
226  {
227  capabilities.SetSupportedChannelWidthSet (1);
228  }
229  else
230  {
231  capabilities.SetSupportedChannelWidthSet (0);
232  }
233  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
234  capabilities.SetMaxMpduLength (uint8_t (maxMpduLength > 3895) + uint8_t (maxMpduLength > 7991)); //0 if 3895, 1 if 7991, 2 for 11454
235  capabilities.SetRxLdpc (m_phy->GetLdpc ());
238  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);
239  NS_ASSERT (maxAmpduLengthExponent >= 0 && maxAmpduLengthExponent <= 255);
240  capabilities.SetMaxAmpduLengthExponent (std::max<uint8_t> (7, static_cast<uint8_t> (maxAmpduLengthExponent))); //0 to 7 for VHT
241  uint8_t maxMcs = 0;
242  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
243  {
244  WifiMode mcs = m_phy->GetMcs (i);
245  if ((mcs.GetModulationClass () == WIFI_MOD_CLASS_VHT)
246  && (mcs.GetMcsValue () > maxMcs))
247  {
248  maxMcs = mcs.GetMcsValue ();
249  }
250  }
251  // Support same MaxMCS for each spatial stream
252  for (uint8_t nss = 1; nss <= m_phy->GetMaxSupportedRxSpatialStreams (); nss++)
253  {
254  capabilities.SetRxMcsMap (maxMcs, nss);
255  }
256  for (uint8_t nss = 1; nss <= m_phy->GetMaxSupportedTxSpatialStreams (); nss++)
257  {
258  capabilities.SetTxMcsMap (maxMcs, nss);
259  }
260  uint64_t maxSupportedRateLGI = 0; //in bit/s
261  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
262  {
263  WifiMode mcs = m_phy->GetMcs (i);
265  {
266  continue;
267  }
268  if (mcs.GetDataRate (m_phy->GetChannelWidth ()) > maxSupportedRateLGI)
269  {
270  maxSupportedRateLGI = mcs.GetDataRate (m_phy->GetChannelWidth ());
271  NS_LOG_DEBUG ("Updating maxSupportedRateLGI to " << maxSupportedRateLGI);
272  }
273  }
274  capabilities.SetRxHighestSupportedLgiDataRate (static_cast<uint16_t> (maxSupportedRateLGI / 1e6)); //in Mbit/s
275  capabilities.SetTxHighestSupportedLgiDataRate (static_cast<uint16_t> (maxSupportedRateLGI / 1e6)); //in Mbit/s
276  //To be filled in once supported
277  capabilities.SetRxStbc (0);
278  capabilities.SetTxStbc (0);
279  }
280  return capabilities;
281 }
282 
285 {
286  NS_LOG_FUNCTION (this);
287  HeCapabilities capabilities;
288  if (m_heSupported)
289  {
290  capabilities.SetHeSupported (1);
291  uint8_t channelWidthSet = 0;
292  if (m_phy->GetChannelWidth () >= 40 && Is2_4Ghz (m_phy->GetFrequency ()))
293  {
294  channelWidthSet |= 0x01;
295  }
296  if (m_phy->GetChannelWidth () >= 80 && Is5Ghz (m_phy->GetFrequency ()))
297  {
298  channelWidthSet |= 0x02;
299  }
300  if (m_phy->GetChannelWidth () >= 160 && Is5Ghz (m_phy->GetFrequency ()))
301  {
302  channelWidthSet |= 0x04;
303  }
304  capabilities.SetChannelWidthSet (channelWidthSet);
305  uint8_t gi = 0;
306  if (m_phy->GetGuardInterval () <= NanoSeconds (1600))
307  {
308  //todo: We assume for now that if we support 800ns GI then 1600ns GI is supported as well
309  gi |= 0x01;
310  }
311  if (m_phy->GetGuardInterval () == NanoSeconds (800))
312  {
313  gi |= 0x02;
314  }
315  capabilities.SetHeLtfAndGiForHePpdus (gi);
316  double maxAmpduLengthExponent = std::max (std::ceil ((std::log (std::max (std::max (m_beMaxAmpduSize, m_bkMaxAmpduSize), std::max (m_voMaxAmpduSize, m_viMaxAmpduSize))
317  + 1.0)
318  / std::log (2.0))
319  - 13.0),
320  0.0);
321  NS_ASSERT (maxAmpduLengthExponent >= 0 && maxAmpduLengthExponent <= 255);
322  capabilities.SetMaxAmpduLengthExponent (std::max<uint8_t> (7, static_cast<uint8_t> (maxAmpduLengthExponent))); //assume 0 to 7 for HE
323  uint8_t maxMcs = 0;
324  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
325  {
326  WifiMode mcs = m_phy->GetMcs (i);
327  if ((mcs.GetModulationClass () == WIFI_MOD_CLASS_HE)
328  && (mcs.GetMcsValue () > maxMcs))
329  {
330  maxMcs = mcs.GetMcsValue ();
331  }
332  }
333  capabilities.SetHighestMcsSupported (maxMcs);
335  }
336  return capabilities;
337 }
338 
339 void
341 {
342  NS_LOG_FUNCTION (this << size);
343  m_voMaxAmsduSize = size;
345 }
346 
347 void
349 {
350  NS_LOG_FUNCTION (this << size);
351  m_viMaxAmsduSize = size;
353 }
354 
355 void
357 {
358  NS_LOG_FUNCTION (this << size);
359  m_beMaxAmsduSize = size;
361 }
362 
363 void
365 {
366  NS_LOG_FUNCTION (this << size);
367  m_bkMaxAmsduSize = size;
369 }
370 
371 void
373 {
374  NS_LOG_FUNCTION (this << size);
375  m_voMaxAmpduSize = size;
377 }
378 
379 void
381 {
382  NS_LOG_FUNCTION (this << size);
383  m_viMaxAmpduSize = size;
385 }
386 
387 void
389 {
390  NS_LOG_FUNCTION (this << size);
391  m_beMaxAmpduSize = size;
393 }
394 
395 void
397 {
398  NS_LOG_FUNCTION (this << size);
399  m_bkMaxAmpduSize = size;
401 }
402 
403 void
405 {
406  NS_LOG_FUNCTION (this << +threshold);
407  GetVOQueue ()->SetBlockAckThreshold (threshold);
408 }
409 
410 void
412 {
413  NS_LOG_FUNCTION (this << +threshold);
414  GetVIQueue ()->SetBlockAckThreshold (threshold);
415 }
416 
417 void
419 {
420  NS_LOG_FUNCTION (this << +threshold);
421  GetBEQueue ()->SetBlockAckThreshold (threshold);
422 }
423 
424 void
426 {
427  NS_LOG_FUNCTION (this << +threshold);
428  GetBKQueue ()->SetBlockAckThreshold (threshold);
429 }
430 
431 void
433 {
434  NS_LOG_FUNCTION (this << timeout);
436 }
437 
438 void
440 {
441  NS_LOG_FUNCTION (this << timeout);
443 }
444 
445 void
447 {
448  NS_LOG_FUNCTION (this << timeout);
450 }
451 
452 void
454 {
455  NS_LOG_FUNCTION (this << timeout);
457 }
458 
459 void
461 {
462  NS_LOG_FUNCTION (this << ac);
463 
464  //Our caller shouldn't be attempting to setup a queue that is
465  //already configured.
466  NS_ASSERT (m_edca.find (ac) == m_edca.end ());
467 
468  Ptr<QosTxop> edca = CreateObject<QosTxop> ();
469  edca->SetMacLow (m_low);
470  edca->SetChannelAccessManager (m_channelAccessManager);
471  edca->SetTxMiddle (m_txMiddle);
472  edca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this));
473  edca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this));
474  edca->SetTxDroppedCallback (MakeCallback (&RegularWifiMac::NotifyTxDrop, this));
475  edca->SetAccessCategory (ac);
476  edca->CompleteConfig ();
477 
478  m_edca.insert (std::make_pair (ac, edca));
479 }
480 
481 void
483 {
484  NS_LOG_FUNCTION (this << type);
485  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
486  {
487  i->second->SetTypeOfStation (type);
488  }
489 }
490 
491 Ptr<Txop>
493 {
494  return m_txop;
495 }
496 
499 {
500  return m_edca.find (AC_VO)->second;
501 }
502 
505 {
506  return m_edca.find (AC_VI)->second;
507 }
508 
511 {
512  return m_edca.find (AC_BE)->second;
513 }
514 
517 {
518  return m_edca.find (AC_BK)->second;
519 }
520 
521 void
523 {
524  NS_LOG_FUNCTION (this << phy);
525  m_phy = phy;
527  m_low->SetPhy (phy);
528 }
529 
532 {
533  NS_LOG_FUNCTION (this);
534  return m_phy;
535 }
536 
537 void
539 {
540  NS_LOG_FUNCTION (this);
541  m_low->ResetPhy ();
543  m_phy = 0;
544 }
545 
546 void
548 {
549  NS_LOG_FUNCTION (this);
550  m_forwardUp = upCallback;
551 }
552 
553 void
555 {
556  NS_LOG_FUNCTION (this);
557  m_linkUp = linkUp;
558 }
559 
560 void
562 {
563  NS_LOG_FUNCTION (this);
564  m_linkDown = linkDown;
565 }
566 
567 void
569 {
570  NS_LOG_FUNCTION (this << enable);
571  m_qosSupported = enable;
572 }
573 
574 bool
576 {
577  return m_qosSupported;
578 }
579 
580 void
582 {
583  NS_LOG_FUNCTION (this << enable);
584  m_vhtSupported = enable;
585  if (enable)
586  {
587  SetQosSupported (true);
588  }
589  if (!enable && !m_htSupported)
590  {
592  }
593  else
594  {
596  }
597 }
598 
599 void
601 {
602  NS_LOG_FUNCTION (this << enable);
603  m_htSupported = enable;
604  if (enable)
605  {
606  SetQosSupported (true);
607  }
608  if (!enable && !m_vhtSupported)
609  {
611  }
612  else
613  {
615  }
616 }
617 
618 void
620 {
621  NS_LOG_FUNCTION (this << enable);
622  m_heSupported = enable;
623  if (enable)
624  {
625  SetQosSupported (true);
626  }
627  if (!enable && !m_htSupported && !m_vhtSupported)
628  {
630  }
631  else
632  {
634  }
635 }
636 
637 bool
639 {
640  return m_vhtSupported;
641 }
642 
643 bool
645 {
646  return m_htSupported;
647 }
648 
649 bool
651 {
652  return m_heSupported;
653 }
654 
655 bool
657 {
658  return m_erpSupported;
659 }
660 
661 void
663 {
664  NS_LOG_FUNCTION (this);
665  if (enable)
666  {
667  SetDsssSupported (true);
668  }
669  m_erpSupported = enable;
670 }
671 
672 void
674 {
675  NS_LOG_FUNCTION (this);
676  m_dsssSupported = enable;
677 }
678 
679 bool
681 {
682  return m_dsssSupported;
683 }
684 
685 void
687 {
688  NS_LOG_FUNCTION (this);
689  m_low->SetCtsToSelfSupported (enable);
690 }
691 
692 void
694 {
695  NS_LOG_FUNCTION (this << slotTime);
696  m_channelAccessManager->SetSlot (slotTime);
697  m_low->SetSlotTime (slotTime);
698 }
699 
700 Time
702 {
703  return m_low->GetSlotTime ();
704 }
705 
706 void
708 {
709  NS_LOG_FUNCTION (this << sifs);
711  m_low->SetSifs (sifs);
712 }
713 
714 Time
716 {
717  return m_low->GetSifs ();
718 }
719 
720 void
722 {
723  NS_LOG_FUNCTION (this << eifsNoDifs);
725 }
726 
727 Time
729 {
731 }
732 
733 void
735 {
736  NS_LOG_FUNCTION (this << rifs);
737  m_low->SetRifs (rifs);
738 }
739 
740 Time
742 {
743  return m_low->GetRifs ();
744 }
745 
746 void
748 {
749  NS_LOG_FUNCTION (this << pifs);
750  m_low->SetPifs (pifs);
751 }
752 
753 Time
755 {
756  return m_low->GetPifs ();
757 }
758 
759 void
761 {
762  NS_LOG_FUNCTION (this << ackTimeout);
763  m_low->SetAckTimeout (ackTimeout);
764 }
765 
766 Time
768 {
769  return m_low->GetAckTimeout ();
770 }
771 
772 void
774 {
775  NS_LOG_FUNCTION (this << ctsTimeout);
776  m_low->SetCtsTimeout (ctsTimeout);
777 }
778 
779 Time
781 {
782  return m_low->GetCtsTimeout ();
783 }
784 
785 void
787 {
788  NS_LOG_FUNCTION (this << blockAckTimeout);
789  m_low->SetBasicBlockAckTimeout (blockAckTimeout);
790 }
791 
792 Time
794 {
795  return m_low->GetBasicBlockAckTimeout ();
796 }
797 
798 void
800 {
801  NS_LOG_FUNCTION (this << blockAckTimeout);
802  m_low->SetCompressedBlockAckTimeout (blockAckTimeout);
803 }
804 
805 Time
807 {
809 }
810 
811 void
813 {
814  NS_LOG_FUNCTION (this << address);
815  m_low->SetAddress (address);
816 }
817 
820 {
821  return m_low->GetAddress ();
822 }
823 
824 void
826 {
827  NS_LOG_FUNCTION (this << ssid);
828  m_ssid = ssid;
829 }
830 
831 Ssid
833 {
834  return m_ssid;
835 }
836 
837 void
839 {
840  NS_LOG_FUNCTION (this << bssid);
841  m_low->SetBssid (bssid);
842 }
843 
846 {
847  return m_low->GetBssid ();
848 }
849 
850 void
852 {
853  m_low->SetPromisc ();
854 }
855 
856 void
858 {
859  NS_LOG_FUNCTION (this << enable);
860  m_shortSlotTimeSupported = enable;
861 }
862 
863 bool
865 {
867 }
868 
869 void
871 {
872  NS_LOG_FUNCTION (this << enable);
873  m_rifsSupported = enable;
874 }
875 
876 bool
878 {
879  return m_rifsSupported;
880 }
881 
882 void
884  Mac48Address to, Mac48Address from)
885 {
886  //We expect RegularWifiMac subclasses which do support forwarding (e.g.,
887  //AP) to override this method. Therefore, we throw a fatal error if
888  //someone tries to invoke this method on a class which has not done
889  //this.
890  NS_FATAL_ERROR ("This MAC entity (" << this << ", " << GetAddress ()
891  << ") does not support Enqueue() with from address");
892 }
893 
894 bool
896 {
897  return false;
898 }
899 
900 void
902 {
903  NS_LOG_FUNCTION (this << packet << from << to);
904  m_forwardUp (packet, from, to);
905 }
906 
907 void
909 {
910  NS_LOG_FUNCTION (this << packet << hdr);
911 
912  Mac48Address to = hdr->GetAddr1 ();
913  Mac48Address from = hdr->GetAddr2 ();
914 
915  //We don't know how to deal with any frame that is not addressed to
916  //us (and odds are there is nothing sensible we could do anyway),
917  //so we ignore such frames.
918  //
919  //The derived class may also do some such filtering, but it doesn't
920  //hurt to have it here too as a backstop.
921  if (to != GetAddress ())
922  {
923  return;
924  }
925 
926  if (hdr->IsMgt () && hdr->IsAction ())
927  {
928  //There is currently only any reason for Management Action
929  //frames to be flying about if we are a QoS STA.
931 
932  WifiActionHeader actionHdr;
933  packet->RemoveHeader (actionHdr);
934 
935  switch (actionHdr.GetCategory ())
936  {
938 
939  switch (actionHdr.GetAction ().blockAck)
940  {
942  {
943  MgtAddBaRequestHeader reqHdr;
944  packet->RemoveHeader (reqHdr);
945 
946  //We've received an ADDBA Request. Our policy here is
947  //to automatically accept it, so we get the ADDBA
948  //Response on it's way immediately.
949  SendAddBaResponse (&reqHdr, from);
950  //This frame is now completely dealt with, so we're done.
951  return;
952  }
954  {
955  MgtAddBaResponseHeader respHdr;
956  packet->RemoveHeader (respHdr);
957 
958  //We've received an ADDBA Response. We assume that it
959  //indicates success after an ADDBA Request we have
960  //sent (we could, in principle, check this, but it
961  //seems a waste given the level of the current model)
962  //and act by locally establishing the agreement on
963  //the appropriate queue.
964  AcIndex ac = QosUtilsMapTidToAc (respHdr.GetTid ());
965  m_edca[ac]->GotAddBaResponse (&respHdr, from);
966  //This frame is now completely dealt with, so we're done.
967  return;
968  }
970  {
971  MgtDelBaHeader delBaHdr;
972  packet->RemoveHeader (delBaHdr);
973 
974  if (delBaHdr.IsByOriginator ())
975  {
976  //This DELBA frame was sent by the originator, so
977  //this means that an ingoing established
978  //agreement exists in MacLow and we need to
979  //destroy it.
980  m_low->DestroyBlockAckAgreement (from, delBaHdr.GetTid ());
981  }
982  else
983  {
984  //We must have been the originator. We need to
985  //tell the correct queue that the agreement has
986  //been torn down
987  AcIndex ac = QosUtilsMapTidToAc (delBaHdr.GetTid ());
988  m_edca[ac]->GotDelBaFrame (&delBaHdr, from);
989  }
990  //This frame is now completely dealt with, so we're done.
991  return;
992  }
993  default:
994  NS_FATAL_ERROR ("Unsupported Action field in Block Ack Action frame");
995  return;
996  }
997  default:
998  NS_FATAL_ERROR ("Unsupported Action frame received");
999  return;
1000  }
1001  }
1002  NS_FATAL_ERROR ("Don't know how to handle frame (type=" << hdr->GetType ());
1003 }
1004 
1005 void
1007 {
1008  NS_LOG_FUNCTION (this << aggregatedPacket << hdr);
1010  for (MsduAggregator::DeaggregatedMsdusCI i = packets.begin ();
1011  i != packets.end (); ++i)
1012  {
1013  ForwardUp ((*i).first, (*i).second.GetSourceAddr (),
1014  (*i).second.GetDestinationAddr ());
1015  }
1016 }
1017 
1018 void
1020  Mac48Address originator)
1021 {
1022  NS_LOG_FUNCTION (this);
1023  WifiMacHeader hdr;
1025  hdr.SetAddr1 (originator);
1026  hdr.SetAddr2 (GetAddress ());
1027  hdr.SetAddr3 (GetAddress ());
1028  hdr.SetDsNotFrom ();
1029  hdr.SetDsNotTo ();
1030 
1031  MgtAddBaResponseHeader respHdr;
1032  StatusCode code;
1033  code.SetSuccess ();
1034  respHdr.SetStatusCode (code);
1035  //Here a control about queues type?
1036  respHdr.SetAmsduSupport (reqHdr->IsAmsduSupported ());
1037 
1038  if (reqHdr->IsImmediateBlockAck ())
1039  {
1040  respHdr.SetImmediateBlockAck ();
1041  }
1042  else
1043  {
1044  respHdr.SetDelayedBlockAck ();
1045  }
1046  respHdr.SetTid (reqHdr->GetTid ());
1047  //For now there's not no control about limit of reception. We
1048  //assume that receiver has no limit on reception. However we assume
1049  //that a receiver sets a bufferSize in order to satisfy next
1050  //equation: (bufferSize + 1) % 16 = 0 So if a recipient is able to
1051  //buffer a packet, it should be also able to buffer all possible
1052  //packet's fragments. See section 7.3.1.14 in IEEE802.11e for more details.
1053  respHdr.SetBufferSize (1023);
1054  respHdr.SetTimeout (reqHdr->GetTimeout ());
1055 
1056  WifiActionHeader actionHdr;
1059  actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
1060 
1061  Ptr<Packet> packet = Create<Packet> ();
1062  packet->AddHeader (respHdr);
1063  packet->AddHeader (actionHdr);
1064 
1065  //We need to notify our MacLow object as it will have to buffer all
1066  //correctly received packets for this Block Ack session
1067  m_low->CreateBlockAckAgreement (&respHdr, originator,
1068  reqHdr->GetStartingSequence ());
1069 
1070  //It is unclear which queue this frame should go into. For now we
1071  //bung it into the queue corresponding to the TID for which we are
1072  //establishing an agreement, and push it to the head.
1073  m_edca[QosUtilsMapTidToAc (reqHdr->GetTid ())]->PushFront (packet, hdr);
1074 }
1075 
1076 TypeId
1078 {
1079  static TypeId tid = TypeId ("ns3::RegularWifiMac")
1080  .SetParent<WifiMac> ()
1081  .SetGroupName ("Wifi")
1082  .AddAttribute ("QosSupported",
1083  "This Boolean attribute is set to enable 802.11e/WMM-style QoS support at this STA.",
1084  BooleanValue (false),
1087  MakeBooleanChecker ())
1088  .AddAttribute ("HtSupported",
1089  "This Boolean attribute is set to enable 802.11n support at this STA.",
1090  BooleanValue (false),
1093  MakeBooleanChecker ())
1094  .AddAttribute ("VhtSupported",
1095  "This Boolean attribute is set to enable 802.11ac support at this STA.",
1096  BooleanValue (false),
1099  MakeBooleanChecker ())
1100  .AddAttribute ("HeSupported",
1101  "This Boolean attribute is set to enable 802.11ax support at this STA.",
1102  BooleanValue (false),
1105  MakeBooleanChecker ())
1106  .AddAttribute ("CtsToSelfSupported",
1107  "Use CTS to Self when using a rate that is not in the basic rate set.",
1108  BooleanValue (false),
1110  MakeBooleanChecker ())
1111  .AddAttribute ("VO_MaxAmsduSize",
1112  "Maximum length in bytes of an A-MSDU for AC_VO access class. "
1113  "Value 0 means A-MSDU is disabled for that AC.",
1114  UintegerValue (0),
1116  MakeUintegerChecker<uint16_t> (0, 11426))
1117  .AddAttribute ("VI_MaxAmsduSize",
1118  "Maximum length in bytes of an A-MSDU for AC_VI access class."
1119  "Value 0 means A-MSDU is disabled for that AC.",
1120  UintegerValue (0),
1122  MakeUintegerChecker<uint16_t> (0, 11426))
1123  .AddAttribute ("BE_MaxAmsduSize",
1124  "Maximum length in bytes of an A-MSDU for AC_BE access class."
1125  "Value 0 means A-MSDU is disabled for that AC.",
1126  UintegerValue (0),
1128  MakeUintegerChecker<uint16_t> (0, 11426))
1129  .AddAttribute ("BK_MaxAmsduSize",
1130  "Maximum length in bytes of an A-MSDU for AC_BK access class."
1131  "Value 0 means A-MSDU is disabled for that AC.",
1132  UintegerValue (0),
1134  MakeUintegerChecker<uint16_t> (0, 11426))
1135  .AddAttribute ("VO_MaxAmpduSize",
1136  "Maximum length in bytes of an A-MPDU for AC_VO access class."
1137  "Value 0 means A-MPDU is disabled for that AC.",
1138  UintegerValue (0),
1140  MakeUintegerChecker<uint16_t> ())
1141  .AddAttribute ("VI_MaxAmpduSize",
1142  "Maximum length in bytes of an A-MPDU for AC_VI access class."
1143  "Value 0 means A-MPDU is disabled for that AC.",
1144  UintegerValue (65535),
1146  MakeUintegerChecker<uint16_t> ())
1147  .AddAttribute ("BE_MaxAmpduSize",
1148  "Maximum length in bytes of an A-MPDU for AC_BE access class."
1149  "Value 0 means A-MPDU is disabled for that AC.",
1150  UintegerValue (65535),
1152  MakeUintegerChecker<uint16_t> ())
1153  .AddAttribute ("BK_MaxAmpduSize",
1154  "Maximum length in bytes of an A-MPDU for AC_BK access class."
1155  "Value 0 means A-MPDU is disabled for that AC.",
1156  UintegerValue (0),
1158  MakeUintegerChecker<uint16_t> ())
1159  .AddAttribute ("VO_BlockAckThreshold",
1160  "If number of packets in VO queue reaches this value, "
1161  "block ack mechanism is used. If this value is 0, block ack is never used."
1162  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
1163  UintegerValue (0),
1165  MakeUintegerChecker<uint8_t> (0, 64))
1166  .AddAttribute ("VI_BlockAckThreshold",
1167  "If number of packets in VI queue reaches this value, "
1168  "block ack mechanism is used. If this value is 0, block ack is never used."
1169  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
1170  UintegerValue (0),
1172  MakeUintegerChecker<uint8_t> (0, 64))
1173  .AddAttribute ("BE_BlockAckThreshold",
1174  "If number of packets in BE queue reaches this value, "
1175  "block ack mechanism is used. If this value is 0, block ack is never used."
1176  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
1177  UintegerValue (0),
1179  MakeUintegerChecker<uint8_t> (0, 64))
1180  .AddAttribute ("BK_BlockAckThreshold",
1181  "If number of packets in BK queue reaches this value, "
1182  "block ack mechanism is used. If this value is 0, block ack is never used."
1183  "When A-MPDU is enabled, block ack mechanism is used regardless of this value.",
1184  UintegerValue (0),
1186  MakeUintegerChecker<uint8_t> (0, 64))
1187  .AddAttribute ("VO_BlockAckInactivityTimeout",
1188  "Represents max time (blocks of 1024 micro seconds) allowed for block ack"
1189  "inactivity for AC_VO. If this value isn't equal to 0 a timer start after that a"
1190  "block ack setup is completed and will be reset every time that a block ack"
1191  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
1192  UintegerValue (0),
1194  MakeUintegerChecker<uint16_t> ())
1195  .AddAttribute ("VI_BlockAckInactivityTimeout",
1196  "Represents max time (blocks of 1024 micro seconds) allowed for block ack"
1197  "inactivity for AC_VI. If this value isn't equal to 0 a timer start after that a"
1198  "block ack setup is completed and will be reset every time that a block ack"
1199  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
1200  UintegerValue (0),
1202  MakeUintegerChecker<uint16_t> ())
1203  .AddAttribute ("BE_BlockAckInactivityTimeout",
1204  "Represents max time (blocks of 1024 micro seconds) allowed for block ack"
1205  "inactivity for AC_BE. If this value isn't equal to 0 a timer start after that a"
1206  "block ack setup is completed and will be reset every time that a block ack"
1207  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
1208  UintegerValue (0),
1210  MakeUintegerChecker<uint16_t> ())
1211  .AddAttribute ("BK_BlockAckInactivityTimeout",
1212  "Represents max time (blocks of 1024 micro seconds) allowed for block ack"
1213  "inactivity for AC_BK. If this value isn't equal to 0 a timer start after that a"
1214  "block ack setup is completed and will be reset every time that a block ack"
1215  "frame is received. If this value is 0, block ack inactivity timeout won't be used.",
1216  UintegerValue (0),
1218  MakeUintegerChecker<uint16_t> ())
1219  .AddAttribute ("ShortSlotTimeSupported",
1220  "Whether or not short slot time is supported (only used by ERP APs or STAs).",
1221  BooleanValue (true),
1224  MakeBooleanChecker ())
1225  .AddAttribute ("RifsSupported",
1226  "Whether or not RIFS is supported (only used by HT APs or STAs).",
1227  BooleanValue (false),
1230  MakeBooleanChecker ())
1231  .AddAttribute ("Txop",
1232  "The Txop object.",
1233  PointerValue (),
1235  MakePointerChecker<Txop> ())
1236  .AddAttribute ("VO_Txop",
1237  "Queue that manages packets belonging to AC_VO access class.",
1238  PointerValue (),
1240  MakePointerChecker<QosTxop> ())
1241  .AddAttribute ("VI_Txop",
1242  "Queue that manages packets belonging to AC_VI access class.",
1243  PointerValue (),
1245  MakePointerChecker<QosTxop> ())
1246  .AddAttribute ("BE_Txop",
1247  "Queue that manages packets belonging to AC_BE access class.",
1248  PointerValue (),
1250  MakePointerChecker<QosTxop> ())
1251  .AddAttribute ("BK_Txop",
1252  "Queue that manages packets belonging to AC_BK access class.",
1253  PointerValue (),
1255  MakePointerChecker<QosTxop> ())
1256  .AddTraceSource ("TxOkHeader",
1257  "The header of successfully transmitted packet.",
1259  "ns3::WifiMacHeader::TracedCallback")
1260  .AddTraceSource ("TxErrHeader",
1261  "The header of unsuccessfully transmitted packet.",
1263  "ns3::WifiMacHeader::TracedCallback")
1264  ;
1265  return tid;
1266 }
1267 
1268 void
1270 {
1271  NS_LOG_FUNCTION (this << standard);
1272  uint32_t cwmin = 0;
1273  uint32_t cwmax = 0;
1274  switch (standard)
1275  {
1277  SetHeSupported (true);
1279  SetVhtSupported (true);
1281  SetHtSupported (true);
1282  cwmin = 15;
1283  cwmax = 1023;
1284  break;
1286  SetHeSupported (true);
1288  SetHtSupported (true);
1290  SetErpSupported (true);
1295  cwmin = 15;
1296  cwmax = 1023;
1297  break;
1299  SetDsssSupported (true);
1300  cwmin = 31;
1301  cwmax = 1023;
1302  break;
1303  default:
1304  NS_FATAL_ERROR ("Unsupported WifiPhyStandard in RegularWifiMac::FinishConfigureStandard ()");
1305  }
1306 
1307  ConfigureContentionWindow (cwmin, cwmax);
1308 }
1309 
1310 void
1311 RegularWifiMac::ConfigureContentionWindow (uint32_t cwMin, uint32_t cwMax)
1312 {
1313  bool isDsssOnly = m_dsssSupported && !m_erpSupported;
1314  //The special value of AC_BE_NQOS which exists in the Access
1315  //Category enumeration allows us to configure plain old DCF.
1316  ConfigureDcf (m_txop, cwMin, cwMax, isDsssOnly, AC_BE_NQOS);
1317 
1318  //Now we configure the EDCA functions
1319  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
1320  {
1321  ConfigureDcf (i->second, cwMin, cwMax, isDsssOnly, i->first);
1322  }
1323 }
1324 
1325 void
1327 {
1328  NS_LOG_FUNCTION (this << hdr);
1329  m_txOkCallback (hdr);
1330 }
1331 
1332 void
1334 {
1335  NS_LOG_FUNCTION (this << hdr);
1336  m_txErrCallback (hdr);
1337 }
1338 
1339 void
1341 {
1342  NS_LOG_FUNCTION (this);
1343  if (GetVOQueue ()->GetMsduAggregator () != 0)
1344  {
1346  }
1347  if (GetVIQueue ()->GetMsduAggregator () != 0)
1348  {
1350  }
1351  if (GetBEQueue ()->GetMsduAggregator () != 0)
1352  {
1354  }
1355  if (GetBKQueue ()->GetMsduAggregator () != 0)
1356  {
1358  }
1359  if (GetVOQueue ()->GetMpduAggregator () != 0)
1360  {
1362  }
1363  if (GetVIQueue ()->GetMpduAggregator () != 0)
1364  {
1366  }
1367  if (GetBEQueue ()->GetMpduAggregator () != 0)
1368  {
1370  }
1371  if (GetBKQueue ()->GetMpduAggregator () != 0)
1372  {
1374  }
1375 }
1376 
1377 void
1379 {
1380  NS_LOG_FUNCTION (this);
1381  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
1382  {
1383  if (i->second->GetMsduAggregator () == 0)
1384  {
1385  Ptr<MsduAggregator> msduAggregator = CreateObject<MsduAggregator> ();
1386  i->second->SetMsduAggregator (msduAggregator);
1387  }
1388  if (i->second->GetMpduAggregator () == 0)
1389  {
1390  Ptr<MpduAggregator> mpduAggregator = CreateObject<MpduAggregator> ();
1391  i->second->SetMpduAggregator (mpduAggregator);
1392  }
1393  }
1395 }
1396 
1397 void
1399 {
1400  NS_LOG_FUNCTION (this);
1401  for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
1402  {
1403  i->second->SetMsduAggregator (0);
1404  i->second->SetMpduAggregator (0);
1405  }
1406 }
1407 
1408 } //namespace ns3
virtual void SetQosSupported(bool enable)
Enable or disable QoS support for the device.
ERP-OFDM PHY (Clause 19, Section 19.5)
void SetHeSupported(bool enable)
Enable or disable HE support for the device.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:280
uint16_t m_voMaxAmsduSize
maximum A-MSDU size for AC_VO
void Dispose(void)
Dispose of this Object.
Definition: object.cc:214
Time GetPifs(void) const
Return PCF Interframe Space (PIFS) of this MacLow.
Definition: mac-low.cc:420
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:334
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)
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:156
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)
Ptr< Txop > m_txop
This holds a pointer to the TXOP instance for this WifiMac - used for transmission of frames to non-Q...
bool GetDsssSupported() const
Return whether the device supports DSSS.
bool GetVhtSupported() const
Return whether the device supports VHT.
ExtendedCapabilities GetExtendedCapabilities(void) const
Return the extended capabilities of the device.
#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:364
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:596
See IEEE 802.11 chapter 7.3.1.11 Header format: | category: 1 | action value: 1 |.
Definition: mgt-headers.h:864
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:250
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:65
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:426
void SetSifs(Time sifs)
Set Short Interframe Space (SIFS) of this MacLow.
Definition: mac-low.cc:322
uint8_t GetMaxSupportedRxSpatialStreams(void) const
Definition: wifi-phy.cc:1306
void SetChannelAccessManager(const Ptr< ChannelAccessManager > manager)
Set ChannelAccessManager this Txop is associated to.
Definition: txop.cc:109
Implement the header for management frames of type add block ack request.
Definition: mgt-headers.h:997
void SetPifs(Time pifs)
void SetCompressedBlockAckTimeout(Time blockAckTimeout)
void SetTxDroppedCallback(TxDropped callback)
Definition: txop.cc:151
The Extended Capabilities Information ElementThis class knows how to serialise and deserialise the Ex...
void SetupPhyListener(Ptr< WifiPhy > phy)
Set up listener for Phy events.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:67
Callback< void > m_linkUp
Callback when a link is up.
void ConfigureContentionWindow(uint32_t cwMin, uint32_t cwMax)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
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
void SetBlockAckInactivityTimeout(uint16_t timeout)
Set the Block Ack inactivity timeout.
Definition: qos-txop.cc:1430
bool GetShortGuardInterval(void) const
Return whether short guard interval is supported.
Definition: wifi-phy.cc:609
void RemovePhyListener(Ptr< WifiPhy > phy)
Remove current registered listener for Phy events.
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:450
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:75
Time GetCompressedBlockAckTimeout() const
Return Compressed Block ACK timeout of this MacLow.
Definition: mac-low.cc:388
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:3507
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.
Ptr< ChannelAccessManager > m_channelAccessManager
channel access manager
ns3::Time timeout
void SetRifs(Time rifs)
Time GetCtsTimeout(void) const
Return CTS timeout of this MacLow.
Definition: mac-low.cc:394
void SetStatusCode(StatusCode code)
Set the status code.
Ssid GetSsid(void) const
Video.
Definition: qos-utils.h:44
Voice.
Definition: qos-utils.h:46
bool IsAllowed(uint16_t channelWidth, uint8_t nss) const
Definition: wifi-mode.cc:85
void SetViMaxAmsduSize(uint16_t size)
Set the maximum A-MSDU size for AC_VI.
Best Effort.
Definition: qos-utils.h:40
uint16_t GetFrequency(void) const
Definition: wifi-phy.cc:1235
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:97
void ConfigureDcf(Ptr< Txop > dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, AcIndex ac)
Definition: wifi-mac.cc:399
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:304
bool m_rifsSupported
flag whether RIFS is supported
void SetBasicBlockAckTimeout(Time blockAckTimeout)
Set Basic Block ACK timeout of this MacLow.
Definition: mac-low.cc:292
phy
Definition: third.py:86
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:570
void SetChannelWidthSet(uint8_t channelWidthSet)
Set channel width set.
void SetTid(uint8_t tid)
Set Traffic ID (TID).
Ptr< MsduAggregator > GetMsduAggregator(void) const
Returns the aggregator used to construct A-MSDU subframes.
Definition: qos-txop.cc:696
void SetHeLtfAndGiForHePpdus(uint8_t heLtfAndGiForHePpdus)
Set HE LTF and GI for HE PDPUs.
void SetBssid(Mac48Address bssid)
void SetLSigProtectionSupport(uint8_t lsigprotection)
Set the LSIG protection support.
Time GetSifs(void) const
Background.
Definition: qos-utils.h:42
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:2156
Time GetCtsTimeout(void) const
void SetForwardUpCallback(ForwardUpCallback upCallback)
void SetSuccess(void)
Set success bit to 0 (success).
Definition: status-code.cc:30
Ptr< QosTxop > GetBKQueue(void) const
Accessor for the AC_BK channel access function.
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...
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: pointer.h:220
void SetBasicBlockAckTimeout(Time blockAckTimeout)
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
void SetTypeOfStation(TypeOfStation type)
This method is invoked by a subclass to specify what type of station it is implementing.
#define max(a, b)
Definition: 80211b.c:43
void CreateBlockAckAgreement(const MgtAddBaResponseHeader *respHdr, Mac48Address originator, uint16_t startingSeq)
Definition: mac-low.cc:2114
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.
void SetEifsNoDifs(Time eifsNoDifs)
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)
base class for all MAC-level wifi objects.
Definition: wifi-mac.h:42
void NotifyTxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:224
void SetImmediateBlockAck()
Enable immediate Block ACK.
Hold an unsigned integer type.
Definition: uinteger.h:44
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:1255
Time GetAckTimeout(void) const
ssid
Definition: third.py:93
void SetMaxAmsduLength(uint8_t maxamsdulength)
Set the maximum AMSDU length.
Time GetSlot(void) const
void SetAckTimeout(Time ackTimeout)
Set ACK timeout of this MacLow.
Definition: mac-low.cc:286
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:31
Time GetGuardInterval(void) const
Definition: wifi-phy.cc:623
void SetAddress(Mac48Address address)
Time GetRifs(void) const
Return Reduced Interframe Space (RIFS) of this MacLow.
Definition: mac-low.cc:407
HT PHY (Clause 20)
Definition: wifi-mode.h:58
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:478
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:370
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:3513
bool IsAmsduSupported(void) const
Return whether A-MSDU capability is supported.
virtual void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > stationManager)
void SetLinkUpCallback(Callback< void > linkUp)
Ptr< Txop > GetTxop(void) const
Accessor for the DCF object.
virtual void DoDispose()
Destructor implementation.
std::list< std::pair< Ptr< Packet >, AmsduSubframeHeader > > DeaggregatedMsdus
DeaggregatedMsdus typedef.
OFDM PHY for the 5 GHz band (Clause 17)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Hold objects of type Ptr<T>.
Definition: pointer.h:36
address
Definition: first.py:37
void SetBssid(Mac48Address ad)
Set the Basic Service Set Identification.
Definition: mac-low.cc:358
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).
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 set.
void SetMacLow(const Ptr< MacLow > low)
Set MacLow associated with this Txop.
Definition: txop.cc:123
void SetRxStbc(uint8_t rxstbc)
Set the receive STBC.
uint16_t m_bkMaxAmpduSize
maximum A-MPDU size for AC_BK
void SetCtsTimeout(Time ctsTimeout)
Ptr< MpduAggregator > GetMpduAggregator(void) const
Returns the aggregator used to construct A-MPDU subframes.
Definition: qos-txop.cc:702
virtual bool SupportsSendFrom(void) const
void SetBlockAckThreshold(uint8_t threshold)
Set threshold for block ACK mechanism.
Definition: qos-txop.cc:1422
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:1288
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:414
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 SetMaxAmpduSize(uint16_t maxSize)
Sets the maximum A-MPDU size in bytes.
void SetRxHighestSupportedLgiDataRate(uint16_t supporteddatarate)
Set the receive highest supported LGI data rate.
void SetType(WifiMacType type, bool resetToDsFromDs=true)
Set Type/Subtype values with the correct values depending on the given type.
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:340
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:940
void SetSlotTime(Time slotTime)
Set slot duration of this MacLow.
Definition: mac-low.cc:328
Time GetSifs(void) const
Return Short Interframe Space (SIFS) of this MacLow.
Definition: mac-low.cc:400
Implement the header for management frames of type add block ack response.
Definition: mgt-headers.h:1129
Implement the header for management frames of type del block ack.
Definition: mgt-headers.h:1250
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:270
void SetHeSupported(uint8_t hesupported)
Set HE supported.
void SetTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set MacTxMiddle this Txop is associated to.
Definition: txop.cc:116
WifiMacType GetType(void) const
Return the type (enum WifiMacType)
Mac48Address GetAddress(void) const
typedef for union of different ActionValues
Definition: mgt-headers.h:935
Total number of ACs.
Definition: qos-utils.h:48
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.
virtual void DoInitialize()
Initialize() implementation.
void SetCtsTimeout(Time ctsTimeout)
Set CTS timeout of this MacLow.
Definition: mac-low.cc:316
void SetLdpc(uint8_t ldpc)
Set the LDPC field.
void SetBkBlockAckInactivityTimeout(uint16_t timeout)
Set BK block ack inactivity timeout.
Ptr< QosTxop > GetBEQueue(void) const
Accessor for the AC_BE channel access function.
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:376
virtual void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > remoteManager)
Set WifiRemoteStationsManager this Txop is associated to.
Definition: txop.cc:130
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:280
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.
bool m_erpSupported
This Boolean is set true iff this WifiMac is to model 802.11g.
TypeOfStation
Enumeration for type of station.
Definition: qos-txop.h:45
bool GetRifsSupported(void) const
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:500
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.)
void SetTxFailedCallback(TxFailed callback)
Definition: txop.cc:144
ActionValue GetAction()
Return the action value.
Ptr< QosTxop > GetVOQueue(void) const
Accessor for the AC_VO channel access function.
void SetPromisc(void)
Sets the interface in promiscuous mode.
void SetTxOkCallback(TxOk callback)
Definition: txop.cc:137
void SetupLow(Ptr< MacLow > low)
Set up listener for MacLow events.
void ResetPhy(void)
Remove WifiPhy associated with this MacLow.
Definition: mac-low.cc:265
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:382
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:915
void SetAckTimeout(Time ackTimeout)
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:37
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
Definition: object.cc:183
Ptr< MacTxMiddle > m_txMiddle
TX middle (aggregation etc.)
HE PHY (Clause 26)
Definition: wifi-mode.h:62
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:274
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:298
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.
Ptr< QosTxop > GetVIQueue(void) const
Accessor for the AC_VI channel access function.
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.