A Discrete-Event Network Simulator
API
wifi-remote-station-manager.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005,2006,2007 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/boolean.h"
23 #include "ns3/uinteger.h"
24 #include "ns3/enum.h"
25 #include "ns3/simulator.h"
27 #include "wifi-phy.h"
28 #include "wifi-mac.h"
29 #include "wifi-mac-header.h"
30 #include "wifi-mac-queue-item.h"
31 #include "wifi-mac-trailer.h"
32 #include "ns3/ht-configuration.h"
33 #include "ns3/ht-phy.h"
34 #include "ns3/vht-configuration.h"
35 #include "ns3/he-configuration.h"
36 #include "wifi-net-device.h"
37 
38 namespace ns3 {
39 
40 NS_LOG_COMPONENT_DEFINE ("WifiRemoteStationManager");
41 
42 NS_OBJECT_ENSURE_REGISTERED (WifiRemoteStationManager);
43 
44 TypeId
46 {
47  static TypeId tid = TypeId ("ns3::WifiRemoteStationManager")
48  .SetParent<Object> ()
49  .SetGroupName ("Wifi")
50  .AddAttribute ("MaxSsrc",
51  "The maximum number of retransmission attempts for any packet with size <= RtsCtsThreshold. "
52  "This value will not have any effect on some rate control algorithms.",
53  UintegerValue (7),
55  MakeUintegerChecker<uint32_t> ())
56  .AddAttribute ("MaxSlrc",
57  "The maximum number of retransmission attempts for any packet with size > RtsCtsThreshold. "
58  "This value will not have any effect on some rate control algorithms.",
59  UintegerValue (4),
61  MakeUintegerChecker<uint32_t> ())
62  .AddAttribute ("RtsCtsThreshold",
63  "If the size of the PSDU is bigger than this value, we use an RTS/CTS handshake before sending the data frame."
64  "This value will not have any effect on some rate control algorithms.",
65  UintegerValue (65535),
67  MakeUintegerChecker<uint32_t> ())
68  .AddAttribute ("FragmentationThreshold",
69  "If the size of the PSDU is bigger than this value, we fragment it such that the size of the fragments are equal or smaller. "
70  "This value does not apply when it is carried in an A-MPDU. "
71  "This value will not have any effect on some rate control algorithms.",
72  UintegerValue (65535),
75  MakeUintegerChecker<uint32_t> ())
76  .AddAttribute ("NonUnicastMode",
77  "Wifi mode used for non-unicast transmissions.",
78  WifiModeValue (),
81  .AddAttribute ("DefaultTxPowerLevel",
82  "Default power level to be used for transmissions. "
83  "This is the power level that is used by all those WifiManagers that do not implement TX power control.",
84  UintegerValue (0),
86  MakeUintegerChecker<uint8_t> ())
87  .AddAttribute ("ErpProtectionMode",
88  "Protection mode used when non-ERP STAs are connected to an ERP AP: Rts-Cts or Cts-To-Self",
93  .AddAttribute ("HtProtectionMode",
94  "Protection mode used when non-HT STAs are connected to a HT AP: Rts-Cts or Cts-To-Self",
99  .AddTraceSource ("MacTxRtsFailed",
100  "The transmission of a RTS by the MAC layer has failed",
102  "ns3::Mac48Address::TracedCallback")
103  .AddTraceSource ("MacTxDataFailed",
104  "The transmission of a data packet by the MAC layer has failed",
106  "ns3::Mac48Address::TracedCallback")
107  .AddTraceSource ("MacTxFinalRtsFailed",
108  "The transmission of a RTS has exceeded the maximum number of attempts",
110  "ns3::Mac48Address::TracedCallback")
111  .AddTraceSource ("MacTxFinalDataFailed",
112  "The transmission of a data packet has exceeded the maximum number of attempts",
114  "ns3::Mac48Address::TracedCallback")
115  ;
116  return tid;
117 }
118 
120  : m_pcfSupported (false),
121  m_useNonErpProtection (false),
122  m_useNonHtProtection (false),
123  m_shortPreambleEnabled (false),
124  m_shortSlotTimeEnabled (false)
125 {
126  NS_LOG_FUNCTION (this);
127 }
128 
130 {
131  NS_LOG_FUNCTION (this);
132 }
133 
134 void
136 {
137  NS_LOG_FUNCTION (this);
138  Reset ();
139 }
140 
141 void
143 {
144  NS_LOG_FUNCTION (this << phy);
145  //We need to track our PHY because it is the object that knows the
146  //full set of transmit rates that are supported. We need to know
147  //this in order to find the relevant mandatory rates when choosing a
148  //transmit rate for automatic control responses like
149  //acknowledgments.
150  m_wifiPhy = phy;
151  m_defaultTxMode = phy->GetDefaultMode ();
153  if (GetHtSupported ())
154  {
156  }
157  Reset ();
158 }
159 
160 void
162 {
163  NS_LOG_FUNCTION (this << mac);
164  //We need to track our MAC because it is the object that knows the
165  //full set of interframe spaces.
166  m_wifiMac = mac;
167  Reset ();
168 }
169 
170 void
172 {
173  NS_LOG_FUNCTION (this << maxSsrc);
174  m_maxSsrc = maxSsrc;
175 }
176 
177 void
179 {
180  NS_LOG_FUNCTION (this << maxSlrc);
181  m_maxSlrc = maxSlrc;
182 }
183 
184 void
186 {
187  NS_LOG_FUNCTION (this << threshold);
188  m_rtsCtsThreshold = threshold;
189 }
190 
191 void
193 {
194  NS_LOG_FUNCTION (this << threshold);
195  DoSetFragmentationThreshold (threshold);
196 }
197 
198 void
200 {
201  NS_LOG_FUNCTION (this << enable);
202  m_shortPreambleEnabled = enable;
203 }
204 
205 void
207 {
208  NS_LOG_FUNCTION (this << enable);
209  m_shortSlotTimeEnabled = enable;
210 }
211 
212 bool
214 {
215  return m_shortSlotTimeEnabled;
216 }
217 
218 bool
220 {
221  return m_shortPreambleEnabled;
222 }
223 
224 bool
226 {
227  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
228  Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
229  if (htConfiguration)
230  {
231  return true;
232  }
233  return false;
234 }
235 
236 bool
238 {
239  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
240  Ptr<VhtConfiguration> vhtConfiguration = device->GetVhtConfiguration ();
241  if (vhtConfiguration)
242  {
243  return true;
244  }
245  return false;
246 }
247 
248 bool
250 {
251  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
252  Ptr<HeConfiguration> heConfiguration = device->GetHeConfiguration ();
253  if (heConfiguration)
254  {
255  return true;
256  }
257  return false;
258 }
259 
260 void
262 {
263  m_pcfSupported = enable;
264 }
265 
266 bool
268 {
269  return m_pcfSupported;
270 }
271 
272 bool
274 {
275  if (GetHtSupported ())
276  {
277  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
278  Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
279  NS_ASSERT (htConfiguration); //If HT is supported, we should have a HT configuration attached
280  return htConfiguration->GetLdpcSupported ();
281  }
282  return false;
283 }
284 
285 bool
287 {
288  if (GetHtSupported ())
289  {
290  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
291  Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
292  NS_ASSERT (htConfiguration); //If HT is supported, we should have a HT configuration attached
293  if (htConfiguration->GetShortGuardIntervalSupported ())
294  {
295  return true;
296  }
297  }
298  return false;
299 }
300 
301 uint16_t
303 {
304  uint16_t gi = 0;
305  if (GetHeSupported ())
306  {
307  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
308  Ptr<HeConfiguration> heConfiguration = device->GetHeConfiguration ();
309  NS_ASSERT (heConfiguration); //If HE is supported, we should have a HE configuration attached
310  gi = static_cast<uint16_t>(heConfiguration->GetGuardInterval ().GetNanoSeconds ());
311  }
312  return gi;
313 }
314 
315 uint32_t
317 {
318  return DoGetFragmentationThreshold ();
319 }
320 
321 void
323 {
324  NS_LOG_FUNCTION (this << address << isShortPreambleSupported);
325  NS_ASSERT (!address.IsGroup ());
327  state->m_shortPreamble = isShortPreambleSupported;
328 }
329 
330 void
332 {
333  NS_LOG_FUNCTION (this << address << isShortSlotTimeSupported);
334  NS_ASSERT (!address.IsGroup ());
336  state->m_shortSlotTime = isShortSlotTimeSupported;
337 }
338 
339 void
341 {
342  NS_LOG_FUNCTION (this << address << mode);
343  NS_ASSERT (!address.IsGroup ());
345  for (WifiModeListIterator i = state->m_operationalRateSet.begin (); i != state->m_operationalRateSet.end (); i++)
346  {
347  if ((*i) == mode)
348  {
349  //already in.
350  return;
351  }
352  }
353  state->m_operationalRateSet.push_back (mode);
354 }
355 
356 void
358 {
359  NS_LOG_FUNCTION (this << address);
360  NS_ASSERT (!address.IsGroup ());
362  state->m_operationalRateSet.clear ();
363  for (const auto & mode : m_wifiPhy->GetModeList ())
364  {
365  state->m_operationalRateSet.push_back (mode);
366  if (mode.IsMandatory ())
367  {
368  AddBasicMode (mode);
369  }
370  }
371 }
372 
373 void
375 {
376  NS_LOG_FUNCTION (this << address);
377  NS_ASSERT (!address.IsGroup ());
379  state->m_operationalMcsSet.clear ();
380  for (const auto & mcs : m_wifiPhy->GetMcsList ())
381  {
382  state->m_operationalMcsSet.push_back (mcs);
383  }
384 }
385 
386 void
388 {
389  NS_LOG_FUNCTION (this << address);
390  NS_ASSERT (!address.IsGroup ());
392  state->m_operationalMcsSet.clear ();
393 }
394 
395 void
397 {
398  NS_LOG_FUNCTION (this << address << mcs);
399  NS_ASSERT (!address.IsGroup ());
401  for (WifiModeListIterator i = state->m_operationalMcsSet.begin (); i != state->m_operationalMcsSet.end (); i++)
402  {
403  if ((*i) == mcs)
404  {
405  //already in.
406  return;
407  }
408  }
409  state->m_operationalMcsSet.push_back (mcs);
410 }
411 
412 bool
414 {
416 }
417 
418 bool
420 {
422 }
423 
424 bool
426 {
428 }
429 
430 bool
432 {
433  if (address.IsGroup ())
434  {
435  return false;
436  }
438 }
439 
440 bool
442 {
443  if (address.IsGroup ())
444  {
445  return true;
446  }
448 }
449 
450 bool
452 {
453  if (address.IsGroup ())
454  {
455  return false;
456  }
458 }
459 
460 void
462 {
463  NS_ASSERT (!address.IsGroup ());
465 }
466 
467 void
469 {
470  NS_ASSERT (!address.IsGroup ());
472 }
473 
474 void
476 {
477  NS_ASSERT (!address.IsGroup ());
479 }
480 
481 void
483 {
484  NS_ASSERT (!address.IsGroup ());
486 }
487 
490 {
491  NS_LOG_FUNCTION (this << header);
492  Mac48Address address = header.GetAddr1 ();
493  if (!header.IsMgt () && address.IsGroup ())
494  {
495  WifiMode mode = GetNonUnicastMode ();
496  WifiTxVector v;
497  v.SetMode (mode);
501  v.SetGuardInterval (ConvertGuardIntervalToNanoSeconds (mode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ())));
502  v.SetNTx (1);
503  v.SetNss (1);
504  v.SetNess (0);
505  return v;
506  }
507  WifiTxVector txVector;
508  if (header.IsMgt ())
509  {
510  //Use the lowest basic rate for management frames
511  WifiMode mgtMode;
512  if (GetNBasicModes () > 0)
513  {
514  mgtMode = GetBasicMode (0);
515  }
516  else
517  {
518  mgtMode = GetDefaultMode ();
519  }
520  txVector.SetMode (mgtMode);
524  txVector.SetGuardInterval (ConvertGuardIntervalToNanoSeconds (mgtMode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ())));
525  }
526  else
527  {
528  txVector = DoGetDataTxVector (Lookup (address));
530  }
531  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
532  Ptr<HeConfiguration> heConfiguration = device->GetHeConfiguration ();
533  if (heConfiguration)
534  {
535  UintegerValue bssColor;
536  heConfiguration->GetAttribute ("BssColor", bssColor);
537  txVector.SetBssColor (bssColor.Get ());
538  }
539  return txVector;
540 }
541 
544 {
545  WifiMode defaultMode = GetDefaultMode ();
546  WifiPreamble defaultPreamble;
547  if (defaultMode.GetModulationClass () == WIFI_MOD_CLASS_HE)
548  {
549  defaultPreamble = WIFI_PREAMBLE_HE_SU;
550  }
551  else if (defaultMode.GetModulationClass () == WIFI_MOD_CLASS_VHT)
552  {
553  defaultPreamble = WIFI_PREAMBLE_VHT_SU;
554  }
555  else if (defaultMode.GetModulationClass () == WIFI_MOD_CLASS_HT)
556  {
557  defaultPreamble = WIFI_PREAMBLE_HT_MF;
558  }
559  else
560  {
561  defaultPreamble = WIFI_PREAMBLE_LONG;
562  }
563 
564  return WifiTxVector (defaultMode,
566  defaultPreamble,
567  ConvertGuardIntervalToNanoSeconds (defaultMode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ())),
570  0,
572  false);
573 }
574 
577 {
578  NS_LOG_FUNCTION (this << address);
579  if (address.IsGroup ())
580  {
581  WifiMode mode = GetNonUnicastMode ();
582  WifiTxVector v;
583  v.SetMode (mode);
587  v.SetGuardInterval (ConvertGuardIntervalToNanoSeconds (mode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ())));
588  v.SetNTx (1);
589  v.SetNss (1);
590  v.SetNess (0);
591  return v;
592  }
593  return DoGetRtsTxVector (Lookup (address));
594 }
595 
598 {
599  NS_ASSERT (!to.IsGroup ());
600  WifiMode ctsMode = GetControlAnswerMode (rtsTxMode);
601  WifiTxVector v;
602  v.SetMode (ctsMode);
603  v.SetPreambleType (GetPreambleForTransmission (ctsMode.GetModulationClass (), GetShortPreambleEnabled ()));
606  uint16_t ctsTxGuardInterval = ConvertGuardIntervalToNanoSeconds (ctsMode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ()));
607  v.SetGuardInterval (ctsTxGuardInterval);
608  v.SetNss (1);
609  return v;
610 }
611 
614 {
615  NS_ASSERT (!to.IsGroup ());
616  WifiMode ackMode = GetControlAnswerMode (dataTxMode);
617  WifiTxVector v;
618  v.SetMode (ackMode);
619  v.SetPreambleType (GetPreambleForTransmission (ackMode.GetModulationClass (), GetShortPreambleEnabled ()));
622  uint16_t ackTxGuardInterval = ConvertGuardIntervalToNanoSeconds (ackMode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ()));
623  v.SetGuardInterval (ackTxGuardInterval);
624  v.SetNss (1);
625  return v;
626 }
627 
630 {
631  NS_ASSERT (!to.IsGroup ());
632  WifiMode blockAckMode = GetControlAnswerMode (dataTxMode);
633  WifiTxVector v;
634  v.SetMode (blockAckMode);
635  v.SetPreambleType (GetPreambleForTransmission (blockAckMode.GetModulationClass (), GetShortPreambleEnabled ()));
638  uint16_t blockAckTxGuardInterval = ConvertGuardIntervalToNanoSeconds (blockAckMode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ()));
639  v.SetGuardInterval (blockAckTxGuardInterval);
640  v.SetNss (1);
641  return v;
642 }
643 
644 WifiMode
646 {
661  NS_LOG_FUNCTION (this << reqMode);
662  WifiMode mode = GetDefaultMode ();
663  bool found = false;
664  //First, search the BSS Basic Rate set
665  for (uint8_t i = 0; i < GetNBasicModes (); i++)
666  {
667  WifiMode testMode = GetBasicMode (i);
668  if ((!found || testMode.IsHigherDataRate (mode))
669  && (!testMode.IsHigherDataRate (reqMode))
671  {
672  mode = testMode;
673  //We've found a potentially-suitable transmit rate, but we
674  //need to continue and consider all the basic rates before
675  //we can be sure we've got the right one.
676  found = true;
677  }
678  }
679  if (GetHtSupported ())
680  {
681  if (!found)
682  {
683  mode = GetDefaultMcs ();
684  for (uint8_t i = 0; i != GetNBasicMcs (); i++)
685  {
686  WifiMode testMode = GetBasicMcs (i);
687  if ((!found || testMode.IsHigherDataRate (mode))
688  && (!testMode.IsHigherDataRate (reqMode))
689  && (testMode.GetModulationClass () == reqMode.GetModulationClass ()))
690  {
691  mode = testMode;
692  //We've found a potentially-suitable transmit rate, but we
693  //need to continue and consider all the basic rates before
694  //we can be sure we've got the right one.
695  found = true;
696  }
697  }
698  }
699  }
700  //If we found a suitable rate in the BSSBasicRateSet, then we are
701  //done and can return that mode.
702  if (found)
703  {
704  NS_LOG_DEBUG ("WifiRemoteStationManager::GetControlAnswerMode returning " << mode);
705  return mode;
706  }
707 
725  for (const auto & thismode : m_wifiPhy->GetModeList ())
726  {
727  /* If the rate:
728  *
729  * - is a mandatory rate for the PHY, and
730  * - is equal to or faster than our current best choice, and
731  * - is less than or equal to the rate of the received frame, and
732  * - is of the same modulation class as the received frame
733  *
734  * ...then it's our best choice so far.
735  */
736  if (thismode.IsMandatory ()
737  && (!found || thismode.IsHigherDataRate (mode))
738  && (!thismode.IsHigherDataRate (reqMode))
739  && (IsAllowedControlAnswerModulationClass (reqMode.GetModulationClass (), thismode.GetModulationClass ())))
740  {
741  mode = thismode;
742  //As above; we've found a potentially-suitable transmit
743  //rate, but we need to continue and consider all the
744  //mandatory rates before we can be sure we've got the right one.
745  found = true;
746  }
747  }
748  if (GetHtSupported () )
749  {
750  for (const auto & thismode : m_wifiPhy->GetMcsList ())
751  {
752  if (thismode.IsMandatory ()
753  && (!found || thismode.IsHigherDataRate (mode))
754  && (!thismode.IsHigherCodeRate (reqMode))
755  && (thismode.GetModulationClass () == reqMode.GetModulationClass ()))
756  {
757  mode = thismode;
758  //As above; we've found a potentially-suitable transmit
759  //rate, but we need to continue and consider all the
760  //mandatory rates before we can be sure we've got the right one.
761  found = true;
762  }
763  }
764  }
765 
775  if (!found)
776  {
777  NS_FATAL_ERROR ("Can't find response rate for " << reqMode);
778  }
779 
780  NS_LOG_DEBUG ("WifiRemoteStationManager::GetControlAnswerMode returning " << mode);
781  return mode;
782 }
783 
784 void
786 {
787  NS_LOG_FUNCTION (this << header);
788  NS_ASSERT (!header.GetAddr1 ().IsGroup ());
789  AcIndex ac = QosUtilsMapTidToAc ((header.IsQosData ()) ? header.GetQosTid () : 0);
790  m_ssrc[ac]++;
791  m_macTxRtsFailed (header.GetAddr1 ());
792  DoReportRtsFailed (Lookup (header.GetAddr1 ()));
793 }
794 
795 void
797 {
798  NS_LOG_FUNCTION (this << *mpdu);
799  NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
800  AcIndex ac = QosUtilsMapTidToAc ((mpdu->GetHeader ().IsQosData ()) ? mpdu->GetHeader ().GetQosTid () : 0);
801  bool longMpdu = (mpdu->GetSize () > m_rtsCtsThreshold);
802  if (longMpdu)
803  {
804  m_slrc[ac]++;
805  }
806  else
807  {
808  m_ssrc[ac]++;
809  }
810  m_macTxDataFailed (mpdu->GetHeader ().GetAddr1 ());
811  DoReportDataFailed (Lookup (mpdu->GetHeader ().GetAddr1 ()));
812 }
813 
814 void
816  double ctsSnr, WifiMode ctsMode, double rtsSnr)
817 {
818  NS_LOG_FUNCTION (this << header << ctsSnr << ctsMode << rtsSnr);
819  NS_ASSERT (!header.GetAddr1 ().IsGroup ());
820  WifiRemoteStation *station = Lookup (header.GetAddr1 ());
821  AcIndex ac = QosUtilsMapTidToAc ((header.IsQosData ()) ? header.GetQosTid () : 0);
822  station->m_state->m_info.NotifyTxSuccess (m_ssrc[ac]);
823  m_ssrc[ac] = 0;
824  DoReportRtsOk (station, ctsSnr, ctsMode, rtsSnr);
825 }
826 
827 void
829  WifiMode ackMode, double dataSnr, WifiTxVector dataTxVector)
830 {
831  NS_LOG_FUNCTION (this << *mpdu << ackSnr << ackMode << dataSnr << dataTxVector);
832  const WifiMacHeader& hdr = mpdu->GetHeader ();
833  NS_ASSERT (!hdr.GetAddr1 ().IsGroup ());
834  WifiRemoteStation *station = Lookup (hdr.GetAddr1 ());
835  AcIndex ac = QosUtilsMapTidToAc ((hdr.IsQosData ()) ? hdr.GetQosTid () : 0);
836  bool longMpdu = (mpdu->GetSize () > m_rtsCtsThreshold);
837  if (longMpdu)
838  {
839  station->m_state->m_info.NotifyTxSuccess (m_slrc[ac]);
840  m_slrc[ac] = 0;
841  }
842  else
843  {
844  station->m_state->m_info.NotifyTxSuccess (m_ssrc[ac]);
845  m_ssrc[ac] = 0;
846  }
847  DoReportDataOk (station, ackSnr, ackMode, dataSnr, dataTxVector.GetChannelWidth (), dataTxVector.GetNss ());
848 }
849 
850 void
852 {
853  NS_LOG_FUNCTION (this << header);
854  NS_ASSERT (!header.GetAddr1 ().IsGroup ());
855  WifiRemoteStation *station = Lookup (header.GetAddr1 ());
856  AcIndex ac = QosUtilsMapTidToAc ((header.IsQosData ()) ? header.GetQosTid () : 0);
857  station->m_state->m_info.NotifyTxFailed ();
858  m_ssrc[ac] = 0;
859  m_macTxFinalRtsFailed (header.GetAddr1 ());
860  DoReportFinalRtsFailed (station);
861 }
862 
863 void
865 {
866  NS_LOG_FUNCTION (this << *mpdu);
867  NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
868  WifiRemoteStation *station = Lookup (mpdu->GetHeader ().GetAddr1 ());
869  AcIndex ac = QosUtilsMapTidToAc ((mpdu->GetHeader ().IsQosData ()) ? mpdu->GetHeader ().GetQosTid () : 0);
870  station->m_state->m_info.NotifyTxFailed ();
871  bool longMpdu = (mpdu->GetSize () > m_rtsCtsThreshold);
872  if (longMpdu)
873  {
874  m_slrc[ac] = 0;
875  }
876  else
877  {
878  m_ssrc[ac] = 0;
879  }
880  m_macTxFinalDataFailed (mpdu->GetHeader ().GetAddr1 ());
881  DoReportFinalDataFailed (station);
882 }
883 
884 void
886 {
887  NS_LOG_FUNCTION (this << address << rxSignalInfo << txMode);
888  if (address.IsGroup ())
889  {
890  return;
891  }
892  WifiRemoteStation *station = Lookup (address);
893  DoReportRxOk (station, rxSignalInfo.snr, txMode);
894  station->m_rssiAndUpdateTimePair = std::make_pair (rxSignalInfo.rssi, Simulator::Now ());
895 }
896 
897 void
899  uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus,
900  double rxSnr, double dataSnr, WifiTxVector dataTxVector)
901 {
902  NS_LOG_FUNCTION (this << address << nSuccessfulMpdus << nFailedMpdus << rxSnr << dataSnr << dataTxVector);
903  NS_ASSERT (!address.IsGroup ());
904  for (uint8_t i = 0; i < nFailedMpdus; i++)
905  {
907  }
908  DoReportAmpduTxStatus (Lookup (address), nSuccessfulMpdus, nFailedMpdus, rxSnr, dataSnr, dataTxVector.GetChannelWidth (), dataTxVector.GetNss ());
909 }
910 
911 bool
912 WifiRemoteStationManager::NeedRts (const WifiMacHeader &header, uint32_t size)
913 {
914  NS_LOG_FUNCTION (this << header << size);
915  Mac48Address address = header.GetAddr1 ();
916  WifiTxVector txVector = GetDataTxVector (header);
917  WifiMode mode = txVector.GetMode ();
918  if (address.IsGroup ())
919  {
920  return false;
921  }
924  || (mode.GetModulationClass () == WIFI_MOD_CLASS_HT)
925  || (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT)
926  || (mode.GetModulationClass () == WIFI_MOD_CLASS_HE))
928  {
929  NS_LOG_DEBUG ("WifiRemoteStationManager::NeedRTS returning true to protect non-ERP stations");
930  return true;
931  }
932  else if (m_htProtectionMode == RTS_CTS
933  && ((mode.GetModulationClass () == WIFI_MOD_CLASS_HT)
934  || (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT))
937  {
938  NS_LOG_DEBUG ("WifiRemoteStationManager::NeedRTS returning true to protect non-HT stations");
939  return true;
940  }
941  bool normally = (size > m_rtsCtsThreshold);
942  return DoNeedRts (Lookup (address), size, normally);
943 }
944 
945 bool
947 {
948  WifiMode mode = txVector.GetMode ();
949  NS_LOG_FUNCTION (this << mode);
952  || (mode.GetModulationClass () == WIFI_MOD_CLASS_HT)
953  || (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT)
954  || (mode.GetModulationClass () == WIFI_MOD_CLASS_HE))
956  {
957  NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning true to protect non-ERP stations");
958  return true;
959  }
960  else if (m_htProtectionMode == CTS_TO_SELF
961  && ((mode.GetModulationClass () == WIFI_MOD_CLASS_HT)
962  || (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT))
965  {
966  NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning true to protect non-HT stations");
967  return true;
968  }
969  else if (!m_useNonErpProtection)
970  {
971  //search for the BSS Basic Rate set, if the used mode is in the basic set then there is no need for CTS To Self
972  for (WifiModeListIterator i = m_bssBasicRateSet.begin (); i != m_bssBasicRateSet.end (); i++)
973  {
974  if (mode == *i)
975  {
976  NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning false");
977  return false;
978  }
979  }
980  if (GetHtSupported ())
981  {
982  //search for the BSS Basic MCS set, if the used mode is in the basic set then there is no need for CTS To Self
983  for (WifiModeListIterator i = m_bssBasicMcsSet.begin (); i != m_bssBasicMcsSet.end (); i++)
984  {
985  if (mode == *i)
986  {
987  NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning false");
988  return false;
989  }
990  }
991  }
992  NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning true");
993  return true;
994  }
995  return false;
996 }
997 
998 void
1000 {
1001  NS_LOG_FUNCTION (this << enable);
1002  m_useNonErpProtection = enable;
1003 }
1004 
1005 bool
1007 {
1008  return m_useNonErpProtection;
1009 }
1010 
1011 void
1013 {
1014  NS_LOG_FUNCTION (this << enable);
1015  m_useNonHtProtection = enable;
1016 }
1017 
1018 bool
1020 {
1021  return m_useNonHtProtection;
1022 }
1023 
1024 bool
1026 {
1027  NS_LOG_FUNCTION (this << *mpdu);
1028  NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
1029  AcIndex ac = QosUtilsMapTidToAc ((mpdu->GetHeader ().IsQosData ()) ? mpdu->GetHeader ().GetQosTid () : 0);
1030  bool longMpdu = (mpdu->GetSize () > m_rtsCtsThreshold);
1031  uint32_t retryCount, maxRetryCount;
1032  if (longMpdu)
1033  {
1034  retryCount = m_slrc[ac];
1035  maxRetryCount = m_maxSlrc;
1036  }
1037  else
1038  {
1039  retryCount = m_ssrc[ac];
1040  maxRetryCount = m_maxSsrc;
1041  }
1042  bool normally = retryCount < maxRetryCount;
1043  NS_LOG_DEBUG ("WifiRemoteStationManager::NeedRetransmission count: " << retryCount << " result: " << std::boolalpha << normally);
1044  return DoNeedRetransmission (Lookup (mpdu->GetHeader ().GetAddr1 ()), mpdu->GetPacket (), normally);
1045 }
1046 
1047 bool
1049 {
1050  NS_LOG_FUNCTION (this << *mpdu);
1051  if (mpdu->GetHeader ().GetAddr1 ().IsGroup ())
1052  {
1053  return false;
1054  }
1055  bool normally = mpdu->GetSize () > GetFragmentationThreshold ();
1056  NS_LOG_DEBUG ("WifiRemoteStationManager::NeedFragmentation result: " << std::boolalpha << normally);
1057  return DoNeedFragmentation (Lookup (mpdu->GetHeader ().GetAddr1 ()), mpdu->GetPacket (), normally);
1058 }
1059 
1060 void
1062 {
1063  NS_LOG_FUNCTION (this << threshold);
1064  if (threshold < 256)
1065  {
1066  /*
1067  * ASN.1 encoding of the MAC and PHY MIB (256 ... 8000)
1068  */
1069  NS_LOG_WARN ("Fragmentation threshold should be larger than 256. Setting to 256.");
1071  }
1072  else
1073  {
1074  /*
1075  * The length of each fragment shall be an even number of octets, except for the last fragment if an MSDU or
1076  * MMPDU, which may be either an even or an odd number of octets.
1077  */
1078  if (threshold % 2 != 0)
1079  {
1080  NS_LOG_WARN ("Fragmentation threshold should be an even number. Setting to " << threshold - 1);
1081  m_fragmentationThreshold = threshold - 1;
1082  }
1083  else
1084  {
1085  m_fragmentationThreshold = threshold;
1086  }
1087  }
1088 }
1089 
1090 uint32_t
1092 {
1093  return m_fragmentationThreshold;
1094 }
1095 
1096 uint32_t
1098 {
1099  NS_LOG_FUNCTION (this << *mpdu);
1100  //The number of bytes a fragment can support is (Threshold - WIFI_HEADER_SIZE - WIFI_FCS).
1101  uint32_t nFragments = (mpdu->GetPacket ()->GetSize () / (GetFragmentationThreshold () - mpdu->GetHeader ().GetSize () - WIFI_MAC_FCS_LENGTH));
1102 
1103  //If the size of the last fragment is not 0.
1104  if ((mpdu->GetPacket ()->GetSize () % (GetFragmentationThreshold () - mpdu->GetHeader ().GetSize () - WIFI_MAC_FCS_LENGTH)) > 0)
1105  {
1106  nFragments++;
1107  }
1108  NS_LOG_DEBUG ("WifiRemoteStationManager::GetNFragments returning " << nFragments);
1109  return nFragments;
1110 }
1111 
1112 uint32_t
1114 {
1115  NS_LOG_FUNCTION (this << *mpdu << fragmentNumber);
1116  NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
1117  uint32_t nFragment = GetNFragments (mpdu);
1118  if (fragmentNumber >= nFragment)
1119  {
1120  NS_LOG_DEBUG ("WifiRemoteStationManager::GetFragmentSize returning 0");
1121  return 0;
1122  }
1123  //Last fragment
1124  if (fragmentNumber == nFragment - 1)
1125  {
1126  uint32_t lastFragmentSize = mpdu->GetPacket ()->GetSize () - (fragmentNumber * (GetFragmentationThreshold () - mpdu->GetHeader ().GetSize () - WIFI_MAC_FCS_LENGTH));
1127  NS_LOG_DEBUG ("WifiRemoteStationManager::GetFragmentSize returning " << lastFragmentSize);
1128  return lastFragmentSize;
1129  }
1130  //All fragments but the last, the number of bytes is (Threshold - WIFI_HEADER_SIZE - WIFI_FCS).
1131  else
1132  {
1133  uint32_t fragmentSize = GetFragmentationThreshold () - mpdu->GetHeader ().GetSize () - WIFI_MAC_FCS_LENGTH;
1134  NS_LOG_DEBUG ("WifiRemoteStationManager::GetFragmentSize returning " << fragmentSize);
1135  return fragmentSize;
1136  }
1137 }
1138 
1139 uint32_t
1141 {
1142  NS_LOG_FUNCTION (this << *mpdu << fragmentNumber);
1143  NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
1144  NS_ASSERT (fragmentNumber < GetNFragments (mpdu));
1145  uint32_t fragmentOffset = fragmentNumber * (GetFragmentationThreshold () - mpdu->GetHeader ().GetSize () - WIFI_MAC_FCS_LENGTH);
1146  NS_LOG_DEBUG ("WifiRemoteStationManager::GetFragmentOffset returning " << fragmentOffset);
1147  return fragmentOffset;
1148 }
1149 
1150 bool
1152 {
1153  NS_LOG_FUNCTION (this << *mpdu << fragmentNumber);
1154  NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
1155  bool isLast = fragmentNumber == (GetNFragments (mpdu) - 1);
1156  NS_LOG_DEBUG ("WifiRemoteStationManager::IsLastFragment returning " << std::boolalpha << isLast);
1157  return isLast;
1158 }
1159 
1160 uint8_t
1162 {
1163  return m_defaultTxPowerLevel;
1164 }
1165 
1168 {
1170  return state->m_info;
1171 }
1172 
1173 double
1175 {
1176  double rssi = 0.0;
1177  Time mostRecentUpdateTime = NanoSeconds (0);
1178  for (const auto & station : m_stations)
1179  {
1180  if (station->m_state->m_address == address) //get most recent RSSI irrespective of TID
1181  {
1182  if (station->m_rssiAndUpdateTimePair.second >= mostRecentUpdateTime)
1183  {
1184  rssi = station->m_rssiAndUpdateTimePair.first;
1185  mostRecentUpdateTime = station->m_rssiAndUpdateTimePair.second;
1186  }
1187  }
1188  }
1189  NS_ASSERT (mostRecentUpdateTime.IsStrictlyPositive ());
1190  return rssi;
1191 }
1192 
1195 {
1196  NS_LOG_FUNCTION (this << address);
1197  for (StationStates::const_iterator i = m_states.begin (); i != m_states.end (); i++)
1198  {
1199  if ((*i)->m_address == address)
1200  {
1201  NS_LOG_DEBUG ("WifiRemoteStationManager::LookupState returning existing state");
1202  return (*i);
1203  }
1204  }
1207  state->m_address = address;
1208  state->m_operationalRateSet.push_back (GetDefaultMode ());
1209  state->m_operationalMcsSet.push_back (GetDefaultMcs ());
1210  state->m_htCapabilities = 0;
1211  state->m_vhtCapabilities = 0;
1212  state->m_heCapabilities = 0;
1214  state->m_guardInterval = GetGuardInterval ();
1215  state->m_ness = 0;
1216  state->m_aggregation = false;
1217  state->m_qosSupported = false;
1218  const_cast<WifiRemoteStationManager *> (this)->m_states.push_back (state);
1219  NS_LOG_DEBUG ("WifiRemoteStationManager::LookupState returning new state");
1220  return state;
1221 }
1222 
1225 {
1226  NS_LOG_FUNCTION (this << address);
1227  for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++)
1228  {
1229  if ((*i)->m_state->m_address == address)
1230  {
1231  return (*i);
1232  }
1233  }
1235 
1236  WifiRemoteStation *station = DoCreateStation ();
1237  station->m_state = state;
1238  station->m_rssiAndUpdateTimePair = std::make_pair (0, Seconds (0));
1239  const_cast<WifiRemoteStationManager *> (this)->m_stations.push_back (station);
1240  return station;
1241 }
1242 
1243 void
1245 {
1246  NS_LOG_FUNCTION (this << from << qosSupported);
1247  WifiRemoteStationState *state;
1248  state = LookupState (from);
1249  state->m_qosSupported = qosSupported;
1250 }
1251 
1252 void
1254 {
1255  //Used by all stations to record HT capabilities of remote stations
1256  NS_LOG_FUNCTION (this << from << htCapabilities);
1257  WifiRemoteStationState *state;
1258  state = LookupState (from);
1259  if (htCapabilities.GetSupportedChannelWidth () == 1)
1260  {
1261  state->m_channelWidth = 40;
1262  }
1263  else
1264  {
1265  state->m_channelWidth = 20;
1266  }
1267  SetQosSupport (from, true);
1268  for (const auto & mcs : m_wifiPhy->GetMcsList (WIFI_MOD_CLASS_HT))
1269  {
1270  if (htCapabilities.IsSupportedMcs (mcs.GetMcsValue ()))
1271  {
1272  AddSupportedMcs (from, mcs);
1273  }
1274  }
1275  state->m_htCapabilities = Create<const HtCapabilities> (htCapabilities);
1276 }
1277 
1278 void
1280 {
1281  //Used by all stations to record VHT capabilities of remote stations
1282  NS_LOG_FUNCTION (this << from << vhtCapabilities);
1283  WifiRemoteStationState *state;
1284  state = LookupState (from);
1285  if (vhtCapabilities.GetSupportedChannelWidthSet () == 1)
1286  {
1287  state->m_channelWidth = 160;
1288  }
1289  else
1290  {
1291  state->m_channelWidth = 80;
1292  }
1293  //This is a workaround to enable users to force a 20 or 40 MHz channel for a VHT-compliant device,
1294  //since IEEE 802.11ac standard says that 20, 40 and 80 MHz channels are mandatory.
1295  if (m_wifiPhy->GetChannelWidth () < state->m_channelWidth)
1296  {
1298  }
1299  for (uint8_t i = 1; i <= m_wifiPhy->GetMaxSupportedTxSpatialStreams (); i++)
1300  {
1301  for (const auto & mcs : m_wifiPhy->GetMcsList (WIFI_MOD_CLASS_VHT))
1302  {
1303  if (vhtCapabilities.IsSupportedMcs (mcs.GetMcsValue (), i))
1304  {
1305  AddSupportedMcs (from, mcs);
1306  }
1307  }
1308  }
1309  state->m_vhtCapabilities = Create<const VhtCapabilities> (vhtCapabilities);
1310 }
1311 
1312 void
1314 {
1315  //Used by all stations to record HE capabilities of remote stations
1316  NS_LOG_FUNCTION (this << from << heCapabilities);
1317  WifiRemoteStationState *state;
1318  state = LookupState (from);
1320  {
1321  if (heCapabilities.GetChannelWidthSet () & 0x04)
1322  {
1323  state->m_channelWidth = 160;
1324  }
1325  else if (heCapabilities.GetChannelWidthSet () & 0x02)
1326  {
1327  state->m_channelWidth = 80;
1328  }
1329  //For other cases at 5 GHz, the supported channel width is set by the VHT capabilities
1330  }
1331  else if (m_wifiPhy->GetPhyBand () == WIFI_PHY_BAND_2_4GHZ)
1332  {
1333  if (heCapabilities.GetChannelWidthSet () & 0x01)
1334  {
1335  state->m_channelWidth = 40;
1336  }
1337  else
1338  {
1339  state->m_channelWidth = 20;
1340  }
1341  }
1342  if (heCapabilities.GetHeLtfAndGiForHePpdus () >= 2)
1343  {
1344  state->m_guardInterval = 800;
1345  }
1346  else if (heCapabilities.GetHeLtfAndGiForHePpdus () == 1)
1347  {
1348  state->m_guardInterval = 1600;
1349  }
1350  else
1351  {
1352  state->m_guardInterval = 3200;
1353  }
1354  for (uint8_t i = 1; i <= m_wifiPhy->GetMaxSupportedTxSpatialStreams (); i++)
1355  {
1356  for (const auto & mcs : m_wifiPhy->GetMcsList (WIFI_MOD_CLASS_HE))
1357  {
1358  if (heCapabilities.GetHighestNssSupported () >= i
1359  && heCapabilities.GetHighestMcsSupported () >= mcs.GetMcsValue ())
1360  {
1361  AddSupportedMcs (from, mcs);
1362  }
1363  }
1364  }
1365  state->m_heCapabilities = Create<const HeCapabilities> (heCapabilities);
1366  SetQosSupport (from, true);
1367 }
1368 
1371 {
1372  return LookupState (from)->m_htCapabilities;
1373 }
1374 
1377 {
1378  return LookupState (from)->m_vhtCapabilities;
1379 }
1380 
1383 {
1384  return LookupState (from)->m_heCapabilities;
1385 }
1386 
1387 bool
1389 {
1393  bool supported = false;
1394  if (htCapabilities)
1395  {
1396  supported |= htCapabilities->GetLdpc ();
1397  }
1398  if (vhtCapabilities)
1399  {
1400  supported |= vhtCapabilities->GetRxLdpc ();
1401  }
1402  if (heCapabilities)
1403  {
1404  supported |= heCapabilities->GetLdpcCodingInPayload ();
1405  }
1406  return supported;
1407 }
1408 
1409 WifiMode
1411 {
1412  return m_defaultTxMode;
1413 }
1414 
1415 WifiMode
1417 {
1418  return m_defaultTxMcs;
1419 }
1420 
1421 void
1423 {
1424  NS_LOG_FUNCTION (this);
1425  for (StationStates::const_iterator i = m_states.begin (); i != m_states.end (); i++)
1426  {
1427  delete (*i);
1428  }
1429  m_states.clear ();
1430  for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++)
1431  {
1432  delete (*i);
1433  }
1434  m_stations.clear ();
1435  m_bssBasicRateSet.clear ();
1436  m_bssBasicMcsSet.clear ();
1437  m_ssrc.fill (0);
1438  m_slrc.fill (0);
1439 }
1440 
1441 void
1443 {
1444  NS_LOG_FUNCTION (this << mode);
1445  if (mode.GetModulationClass () >= WIFI_MOD_CLASS_HT)
1446  {
1447  NS_FATAL_ERROR ("It is not allowed to add a HT rate in the BSSBasicRateSet!");
1448  }
1449  for (uint8_t i = 0; i < GetNBasicModes (); i++)
1450  {
1451  if (GetBasicMode (i) == mode)
1452  {
1453  return;
1454  }
1455  }
1456  m_bssBasicRateSet.push_back (mode);
1457 }
1458 
1459 uint8_t
1461 {
1462  return static_cast<uint8_t> (m_bssBasicRateSet.size ());
1463 }
1464 
1465 WifiMode
1467 {
1468  NS_ASSERT (i < GetNBasicModes ());
1469  return m_bssBasicRateSet[i];
1470 }
1471 
1472 uint32_t
1474 {
1475  uint32_t size = 0;
1476  for (WifiModeListIterator i = m_bssBasicRateSet.begin (); i != m_bssBasicRateSet.end (); i++)
1477  {
1478  if (i->GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
1479  {
1480  continue;
1481  }
1482  size++;
1483  }
1484  return size;
1485 }
1486 
1487 WifiMode
1489 {
1491  uint32_t index = 0;
1492  bool found = false;
1493  for (WifiModeListIterator j = m_bssBasicRateSet.begin (); j != m_bssBasicRateSet.end (); )
1494  {
1495  if (i == index)
1496  {
1497  found = true;
1498  }
1499  if (j->GetModulationClass () != WIFI_MOD_CLASS_ERP_OFDM)
1500  {
1501  if (found)
1502  {
1503  break;
1504  }
1505  }
1506  index++;
1507  j++;
1508  }
1509  return m_bssBasicRateSet[index];
1510 }
1511 
1512 void
1514 {
1515  NS_LOG_FUNCTION (this << +mcs.GetMcsValue ());
1516  for (uint8_t i = 0; i < GetNBasicMcs (); i++)
1517  {
1518  if (GetBasicMcs (i) == mcs)
1519  {
1520  return;
1521  }
1522  }
1523  m_bssBasicMcsSet.push_back (mcs);
1524 }
1525 
1526 uint8_t
1528 {
1529  return static_cast<uint8_t> (m_bssBasicMcsSet.size ());
1530 }
1531 
1532 WifiMode
1534 {
1535  NS_ASSERT (i < GetNBasicMcs ());
1536  return m_bssBasicMcsSet[i];
1537 }
1538 
1539 WifiMode
1541 {
1542  if (m_nonUnicastMode == WifiMode ())
1543  {
1544  if (GetNBasicModes () > 0)
1545  {
1546  return GetBasicMode (0);
1547  }
1548  else
1549  {
1550  return GetDefaultMode ();
1551  }
1552  }
1553  else
1554  {
1555  return m_nonUnicastMode;
1556  }
1557 }
1558 
1559 bool
1561  uint32_t size, bool normally)
1562 {
1563  return normally;
1564 }
1565 
1566 bool
1568  Ptr<const Packet> packet, bool normally)
1569 {
1570  return normally;
1571 }
1572 
1573 bool
1575  Ptr<const Packet> packet, bool normally)
1576 {
1577  return normally;
1578 }
1579 
1580 void
1581 WifiRemoteStationManager::DoReportAmpduTxStatus (WifiRemoteStation *station, uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus, double rxSnr, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
1582 {
1583  NS_LOG_DEBUG ("DoReportAmpduTxStatus received but the manager does not handle A-MPDUs!");
1584 }
1585 
1586 WifiMode
1588 {
1589  NS_ASSERT (i < GetNSupported (station));
1590  return station->m_state->m_operationalRateSet[i];
1591 }
1592 
1593 WifiMode
1595 {
1596  NS_ASSERT (i < GetNMcsSupported (station));
1597  return station->m_state->m_operationalMcsSet[i];
1598 }
1599 
1600 WifiMode
1602 {
1603  NS_ASSERT (i < GetNNonErpSupported (station));
1604  //IEEE 802.11g standard defines that if the protection mechanism is enabled, RTS, CTS and CTS-To-Self
1605  //frames should select a rate in the BSSBasicRateSet that corresponds to an 802.11b basic rate.
1606  //This is a implemented here to avoid changes in every RAA, but should maybe be moved in case it breaks standard rules.
1607  uint32_t index = 0;
1608  bool found = false;
1609  for (WifiModeListIterator j = station->m_state->m_operationalRateSet.begin (); j != station->m_state->m_operationalRateSet.end (); )
1610  {
1611  if (i == index)
1612  {
1613  found = true;
1614  }
1615  if (j->GetModulationClass () != WIFI_MOD_CLASS_ERP_OFDM)
1616  {
1617  if (found)
1618  {
1619  break;
1620  }
1621  }
1622  index++;
1623  j++;
1624  }
1625  return station->m_state->m_operationalRateSet[index];
1626 }
1627 
1630 {
1631  return station->m_state->m_address;
1632 }
1633 
1634 uint16_t
1636 {
1637  return station->m_state->m_channelWidth;
1638 }
1639 
1640 bool
1642 {
1643  Ptr<const HtCapabilities> htCapabilities = station->m_state->m_htCapabilities;
1644 
1645  if (!htCapabilities)
1646  {
1647  return false;
1648  }
1649  return htCapabilities->GetShortGuardInterval20 ();
1650 }
1651 
1652 uint16_t
1654 {
1655  return station->m_state->m_guardInterval;
1656 }
1657 
1658 bool
1660 {
1661  return station->m_state->m_aggregation;
1662 }
1663 
1664 uint8_t
1666 {
1667  Ptr<const HtCapabilities> htCapabilities = station->m_state->m_htCapabilities;
1668 
1669  if (!htCapabilities)
1670  {
1671  return 1;
1672  }
1673  return htCapabilities->GetRxHighestSupportedAntennas ();
1674 }
1675 
1676 uint8_t
1678 {
1679  return station->m_state->m_ness;
1680 }
1681 
1684 {
1685  return m_wifiPhy;
1686 }
1687 
1690 {
1691  return m_wifiMac;
1692 }
1693 
1694 uint8_t
1696 {
1697  return static_cast<uint8_t> (station->m_state->m_operationalRateSet.size ());
1698 }
1699 
1700 bool
1702 {
1703  return station->m_state->m_qosSupported;
1704 }
1705 
1706 bool
1708 {
1709  return (station->m_state->m_htCapabilities != 0);
1710 }
1711 
1712 bool
1714 {
1715  return (station->m_state->m_vhtCapabilities != 0);
1716 }
1717 
1718 bool
1720 {
1721  return (station->m_state->m_heCapabilities != 0);
1722 }
1723 
1724 uint8_t
1726 {
1727  return static_cast<uint8_t> (station->m_state->m_operationalMcsSet.size ());
1728 }
1729 
1730 uint32_t
1732 {
1733  uint32_t size = 0;
1734  for (WifiModeListIterator i = station->m_state->m_operationalRateSet.begin (); i != station->m_state->m_operationalRateSet.end (); i++)
1735  {
1736  if (i->GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
1737  {
1738  continue;
1739  }
1740  size++;
1741  }
1742  return size;
1743 }
1744 
1745 uint16_t
1747 {
1749 }
1750 
1751 bool
1753 {
1755 
1756  if (!htCapabilities)
1757  {
1758  return false;
1759  }
1760  return htCapabilities->GetShortGuardInterval20 ();
1761 }
1762 
1763 uint8_t
1765 {
1767 
1768  if (!htCapabilities)
1769  {
1770  return 1;
1771  }
1772  return htCapabilities->GetRxHighestSupportedAntennas ();
1773 }
1774 
1775 uint8_t
1777 {
1778  return static_cast<uint8_t> (LookupState (address)->m_operationalMcsSet.size ());
1779 }
1780 
1781 bool
1783 {
1784  return (LookupState (address)->m_htCapabilities != 0);
1785 }
1786 
1787 bool
1789 {
1790  return (LookupState (address)->m_vhtCapabilities != 0);
1791 }
1792 
1793 bool
1795 {
1796  return (LookupState (address)->m_heCapabilities != 0);
1797 }
1798 
1799 void
1801 {
1802  m_defaultTxPowerLevel = txPower;
1803 }
1804 
1805 uint8_t
1807 {
1808  return m_wifiPhy->GetNumberOfAntennas ();
1809 }
1810 
1811 uint8_t
1813 {
1815 }
1816 
1817 bool
1819 {
1820  return (GetLdpcSupported () && GetLdpcSupported (dest));
1821 }
1822 
1823 } //namespace ns3
std::array< uint32_t, AC_BE_NQOS > m_ssrc
short retry count per AC
uint8_t GetNMcsSupported(Mac48Address address) const
Return the number of MCS supported by the station.
bool m_useNonHtProtection
flag if protection for non-HT stations against HT transmissions is enabled
bool m_shortPreamble
Flag if short PHY preamble is supported by the remote station.
uint8_t GetChannelWidthSet(void) const
Get channel width set.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
void AddSupportedMcs(Mac48Address address, WifiMode mcs)
Record the MCS index supported by the station.
Ptr< WifiMac > GetMac(void) const
Return the WifiMac.
void SetDefaultTxPowerLevel(uint8_t txPower)
Set the default transmission power level.
bool GetVhtSupported(void) const
Return whether the device has VHT capability support enabled.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
uint8_t GetNSupported(const WifiRemoteStation *station) const
Return the number of modes supported by the given station.
Ptr< HeConfiguration > GetHeConfiguration(void) const
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
uint32_t m_rtsCtsThreshold
Threshold for RTS/CTS.
bool m_shortSlotTimeEnabled
flag if short slot time is enabled
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
void SetChannelWidth(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
bool GetShortPreambleSupported(Mac48Address address) const
Return whether the station supports short PHY preamble or not.
void AddAllSupportedMcs(Mac48Address address)
Invoked in a STA or AP to store all of the MCS supported by a destination which is also supported loc...
std::array< uint32_t, AC_BE_NQOS > m_slrc
long retry count per AC
void RecordWaitAssocTxOk(Mac48Address address)
Records that we are waiting for an ACK for the association response we sent.
virtual void DoReportRtsFailed(WifiRemoteStation *station)=0
This method is a pure virtual method that must be implemented by the sub-class.
WifiMode m_nonUnicastMode
Transmission mode for non-unicast Data frames.
void SetBssColor(uint8_t color)
Set the BSS color.
WifiTxVector GetBlockAckTxVector(Mac48Address to, WifiMode dataTxMode) const
Return a TXVECTOR for the BlockAck frame given the destination and the mode of the Data used by the s...
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:1305
void AddStationVhtCapabilities(Mac48Address from, VhtCapabilities vhtCapabilities)
Records VHT capabilities of the remote station.
std::list< WifiMode > GetModeList(void) const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
Definition: wifi-phy.cc:2212
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
void ReportFinalDataFailed(Ptr< const WifiMacQueueItem > mpdu)
Should be invoked after calling ReportDataFailed if NeedRetransmission returns false.
bool GetHeSupported(void) const
Return whether the device has HE capability support enabled.
#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
void ReportAmpduTxStatus(Mac48Address address, uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus, double rxSnr, double dataSnr, WifiTxVector dataTxVector)
Typically called per A-MPDU, either when a Block ACK was successfully received or when a BlockAckTime...
Ptr< const HeCapabilities > m_heCapabilities
remote station HE capabilities
static const uint16_t WIFI_MAC_FCS_LENGTH
The length in octects of the IEEE 802.11 MAC FCS field.
WifiMode GetDefaultMcs(void) const
Return the default Modulation and Coding Scheme (MCS) index.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
uint32_t m_fragmentationThreshold
Current threshold for fragmentation.
The HT Capabilities Information ElementThis class knows how to serialise and deserialise the HT Capab...
uint8_t m_defaultTxPowerLevel
Default transmission power level.
void ReportDataFailed(Ptr< const WifiMacQueueItem > mpdu)
Should be invoked whenever the AckTimeout associated to a transmission attempt expires.
void AddSupportedPhyPreamble(Mac48Address address, bool isShortPreambleSupported)
Record whether the short PHY preamble is supported by the station.
WifiMode GetNonUnicastMode(void) const
Return a mode for non-unicast packets.
WifiMode GetBasicMcs(uint8_t i) const
Return the MCS at the given list index.
Mac48Address m_address
Mac48Address of the remote station.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
bool IsStrictlyPositive(void) const
Exactly equivalent to t > 0.
Definition: nstime.h:333
void SetPcfSupported(bool enable)
Enable or disable PCF capability support.
bool GetUseNonHtProtection(void) const
Return whether the device supports protection of non-HT stations.
The 5 GHz band.
Definition: wifi-phy-band.h:37
uint8_t GetNss(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the number of spatial streams.
uint32_t GetNFragments(Ptr< const WifiMacQueueItem > mpdu)
Return the number of fragments needed for the given packet.
TracedCallback< Mac48Address > m_macTxFinalRtsFailed
The trace source fired when the transmission of a RTS has exceeded the maximum number of attempts...
uint32_t GetFragmentationThreshold(void) const
Return the fragmentation threshold.
void SetLdpc(bool ldpc)
Sets if LDPC FEC coding is being used.
std::list< WifiMode > GetMcsList(void) const
The WifiPhy::GetMcsList() method is used (e.g., by a WifiRemoteStationManager) to determine the set o...
Definition: wifi-phy.cc:2261
WifiMode GetSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether mode associated with the specified station at the specified index. ...
uint8_t GetNBasicMcs(void) const
Return the number of basic MCS index.
Ptr< const AttributeChecker > MakeWifiModeChecker(void)
Definition: wifi-mode.cc:223
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble)
Return the preamble to be used for the transmission.
Definition: wifi-utils.cc:116
void ReportRtsFailed(const WifiMacHeader &header)
Should be invoked whenever the RtsTimeout associated to a transmission attempt expires.
uint32_t GetNNonErpSupported(const WifiRemoteStation *station) const
Return the number of non-ERP modes supported by the given station.
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:68
bool m_shortPreambleEnabled
flag if short PHY preamble is enabled
uint8_t GetSupportedChannelWidth(void) const
Return the supported channel width.
bool NeedFragmentation(Ptr< const WifiMacQueueItem > mpdu)
TID independent remote station statistics.
bool NeedRetransmission(Ptr< const WifiMacQueueItem > mpdu)
void ReportRtsOk(const WifiMacHeader &header, double ctsSnr, WifiMode ctsMode, double rtsSnr)
Should be invoked whenever we receive the CTS associated to an RTS we just sent.
WifiRemoteStationState * m_state
Remote station state.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
bool IsMandatory(void) const
Definition: wifi-mode.cc:118
void RecordDisassociated(Mac48Address address)
Records that the STA was disassociated.
phy
Definition: third.py:93
TracedCallback< Mac48Address > m_macTxFinalDataFailed
The trace source fired when the transmission of a data packet has exceeded the maximum number of atte...
WifiMode GetMode(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the selected payload transmission mode...
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:1395
WifiMode GetControlAnswerMode(WifiMode reqMode) const
Get control answer mode function.
enum ns3::WifiRemoteStationState::@74 m_state
State of the station.
void SetShortSlotTimeEnabled(bool enable)
Enable or disable short slot time.
WifiTxVector GetDataTxVector(const WifiMacHeader &header)
std::pair< double, Time > m_rssiAndUpdateTimePair
RSSI (in dBm) of the most recent packet received from the remote station along with update time...
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
uint8_t GetNumberOfSupportedStreams(Mac48Address address) const
Return the number of spatial streams supported by the station.
bool GetShortPreambleEnabled(void) const
Return whether the device uses short PHY preambles.
RxSignalInfo structure containing info on the received signal.
Definition: phy-entity.h:66
ProtectionMode m_htProtectionMode
Protection mode for HT stations when non-HT stations are detected.
void SetRtsCtsThreshold(uint32_t threshold)
Sets the RTS threshold.
bool GetLdpcSupported(void) const
Return whether the device has LDPC support enabled.
bool m_qosSupported
Flag if QoS is supported by the station.
Hold variables of type enum.
Definition: enum.h:54
WifiRemoteStationState * LookupState(Mac48Address address) const
Return the state of the station associated with the given address.
WifiMode m_defaultTxMcs
The default transmission modulation-coding scheme (MCS)
bool IsSupportedMcs(uint8_t mcs) const
Return the is MCS supported flag.
virtual void DoReportRtsOk(WifiRemoteStation *station, double ctsSnr, WifiMode ctsMode, double rtsSnr)=0
This method is a pure virtual method that must be implemented by the sub-class.
Ptr< WifiPhy > m_wifiPhy
This is a pointer to the WifiPhy associated with this WifiRemoteStationManager that is set on call to...
double rssi
RSSI in dBm.
Definition: phy-entity.h:69
virtual void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode)=0
This method is a pure virtual method that must be implemented by the sub-class.
bool GetPcfSupported(void) const
Return whether the device has PCF capability support enabled.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1313
bool GetShortSlotTimeSupported(Mac48Address address) const
Return whether the station supports short ERP slot time or not.
The IEEE 802.11ac VHT Capabilities.
void SetGuardInterval(uint16_t guardInterval)
Sets the guard interval duration (in nanoseconds)
void AddStationHtCapabilities(Mac48Address from, HtCapabilities htCapabilities)
Records HT capabilities of the remote station.
bool m_useNonErpProtection
flag if protection for non-ERP stations against ERP transmissions is enabled
Hold an unsigned integer type.
Definition: uinteger.h:44
virtual void DoReportDataFailed(WifiRemoteStation *station)=0
This method is a pure virtual method that must be implemented by the sub-class.
uint8_t GetSupportedChannelWidthSet() const
Get the supported channel width set.
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: enum.h:203
void RecordGotAssocTxFailed(Mac48Address address)
Records that we missed an ACK for the association response we sent.
bool GetHtSupported(void) const
Return whether the device has HT capability support enabled.
mac
Definition: third.py:99
uint16_t ConvertGuardIntervalToNanoSeconds(WifiMode mode, const Ptr< WifiNetDevice > device)
Convert the guard interval to nanoseconds based on the WifiMode.
Definition: wifi-utils.cc:59
WifiRemoteStationInfo GetInfo(Mac48Address address)
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
Definition: qos-utils.cc:53
uint8_t GetQosTid(void) const
Return the Traffic ID of a QoS header.
void SetMaxSsrc(uint32_t maxSsrc)
Sets the maximum STA short retry count (SSRC).
virtual void DoReportAmpduTxStatus(WifiRemoteStation *station, uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus, double rxSnr, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
Typically called per A-MPDU, either when a Block ACK was successfully received or when a BlockAckTime...
void AddStationHeCapabilities(Mac48Address from, HeCapabilities heCapabilities)
Records HE capabilities of the remote station.
uint32_t m_maxSlrc
Maximum STA long retry count (SLRC)
bool m_pcfSupported
Flag if PCF capability is supported.
Ptr< const HeCapabilities > GetStationHeCapabilities(Mac48Address from)
Return the HE capabilities sent by the remote station.
Ptr< WifiMac > m_wifiMac
This is a pointer to the WifiMac associated with this WifiRemoteStationManager that is set on call to...
Ptr< const VhtCapabilities > m_vhtCapabilities
remote station VHT capabilities
void ReportDataOk(Ptr< const WifiMacQueueItem > mpdu, double ackSnr, WifiMode ackMode, double dataSnr, WifiTxVector dataTxVector)
Should be invoked whenever we receive the ACK associated to a data packet we just sent...
uint32_t GetNNonErpBasicModes(void) const
Return the number of non-ERP basic modes we support.
WifiTxVector GetCtsTxVector(Mac48Address to, WifiMode rtsTxMode) const
Return a TXVECTOR for the CTS frame given the destination and the mode of the RTS used by the sender...
WifiTxVector GetCtsToSelfTxVector(void)
Since CTS-to-self parameters are not dependent on the station, it is implemented in wifi remote stati...
Ptr< const HtCapabilities > m_htCapabilities
remote station HT capabilities
bool IsSupportedMcs(uint8_t mcs, uint8_t nss) const
Get the is MCS supported.
WifiMode GetNonErpBasicMode(uint8_t i) const
Return a basic mode from the set of basic modes that is not an ERP mode.
bool IsAssociated(Mac48Address address) const
Return whether the station associated.
virtual void SetupPhy(const Ptr< WifiPhy > phy)
Set up PHY associated with this device since it is the object that knows the full set of transmit rat...
hold a list of per-remote-station state.
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:147
bool GetQosSupported(Mac48Address address) const
Return whether the given station is QoS capable.
Ptr< const HtCapabilities > GetStationHtCapabilities(Mac48Address from)
Return the HT capabilities sent by the remote station.
bool NeedRts(const WifiMacHeader &header, uint32_t size)
WifiMode GetDefaultMode(void) const
Return the default transmission mode.
void SetQosSupport(Mac48Address from, bool qosSupported)
Records QoS support of the remote station.
WifiMode m_defaultTxMode
The default transmission mode.
void SetNss(uint8_t nss)
Sets the number of Nss.
WifiModeList m_bssBasicRateSet
This member is the list of WifiMode objects that comprise the BSSBasicRateSet parameter.
uint64_t Get(void) const
Definition: uinteger.cc:35
void ReportRxOk(Mac48Address address, RxSignalInfo rxSignalInfo, WifiMode txMode)
bool GetShortSlotTimeEnabled(void) const
Return whether the device uses short slot time.
WifiTxVector GetAckTxVector(Mac48Address to, WifiMode dataTxMode) const
Return a TXVECTOR for the Ack frame given the destination and the mode of the Data used by the sender...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool IsLastFragment(Ptr< const WifiMacQueueItem > mpdu, uint32_t fragmentNumber)
address
Definition: first.py:44
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
uint8_t GetNumberOfAntennas(void) const
Definition: wifi-phy.cc:1409
void AddSupportedMode(Mac48Address address, WifiMode mode)
Invoked in a STA or AP to store the set of modes supported by a destination which is also supported l...
WifiModeList m_operationalRateSet
This member is the list of WifiMode objects that comprise the OperationalRateSet parameter for this r...
void DoSetFragmentationThreshold(uint32_t threshold)
Actually sets the fragmentation threshold, it also checks the validity of the given threshold...
double GetMostRecentRssi(Mac48Address address) const
void AddBasicMode(WifiMode mode)
Invoked in a STA upon association to store the set of rates which belong to the BSSBasicRateSet of th...
uint16_t GetChannelWidthForTransmission(WifiMode mode, uint16_t maxSupportedChannelWidth)
Return the channel width that corresponds to the selected mode (instead of letting the PHY&#39;s default ...
Definition: wifi-utils.cc:97
void SetUseNonErpProtection(bool enable)
Enable or disable protection for non-ERP stations.
WifiModeList::const_iterator WifiModeListIterator
An iterator for WifiModeList vector.
Definition: wifi-mode.h:259
uint32_t GetFragmentOffset(Ptr< const WifiMacQueueItem > mpdu, uint32_t fragmentNumber)
bool m_aggregation
Flag if MPDU aggregation is used by the remote station.
an EUI-48 address
Definition: mac48-address.h:43
TracedCallback< Mac48Address > m_macTxRtsFailed
The trace source fired when the transmission of a single RTS has failed.
virtual void DoReportDataOk(WifiRemoteStation *station, double ackSnr, WifiMode ackMode, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)=0
This method is a pure virtual method that must be implemented by the sub-class.
Mac48Address GetAddress(const WifiRemoteStation *station) const
Return the address of the station.
WifiMode GetNonErpSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether non-ERP mode associated with the specified station at the specified index...
void SetTxPowerLevel(uint8_t powerlevel)
Sets the selected transmission power level.
Ptr< const AttributeAccessor > MakeWifiModeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: wifi-mode.h:247
void SetNTx(uint8_t nTx)
Sets the number of TX antennas.
bool IsAllowedControlAnswerModulationClass(WifiModulationClass modClassReq, WifiModulationClass modClassAnswer)
Return whether the modulation class of the selected mode for the control answer frame is allowed...
Definition: wifi-utils.cc:141
The 2.4 GHz band.
Definition: wifi-phy-band.h:35
bool IsGroup(void) const
bool GetShortGuardIntervalSupported(void) const
Return whether the device has SGI support enabled.
Stations m_stations
Information for each known stations.
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
TracedCallback< Mac48Address > m_macTxDataFailed
The trace source fired when the transmission of a single data packet has failed.
bool GetAggregation(const WifiRemoteStation *station) const
Return whether the given station supports A-MPDU.
uint16_t m_channelWidth
Channel width (in MHz) supported by the remote station.
virtual bool DoNeedRetransmission(WifiRemoteStation *station, Ptr< const Packet > packet, bool normally)
uint8_t GetHighestMcsSupported(void) const
Get highest MCS supported.
void ReportFinalRtsFailed(const WifiMacHeader &header)
Should be invoked after calling ReportRtsFailed if NeedRetransmission returns false.
void AddBasicMcs(WifiMode mcs)
Add a given Modulation and Coding Scheme (MCS) index to the set of basic MCS.
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
virtual bool DoNeedFragmentation(WifiRemoteStation *station, Ptr< const Packet > packet, bool normally)
bool NeedCtsToSelf(WifiTxVector txVector)
Return if we need to do CTS-to-self before sending a DATA.
uint8_t GetNBasicModes(void) const
Return the number of basic modes we support.
uint8_t GetHeLtfAndGiForHePpdus(void) const
Get HE LTF and GI for HE PDPUs.
void SetUseNonHtProtection(bool enable)
Enable or disable protection for non-HT stations.
virtual void SetupMac(const Ptr< WifiMac > mac)
Set up MAC associated with this device since it is the object that knows the full set of timing param...
void SetMaxSlrc(uint32_t maxSlrc)
Sets the maximum STA long retry count (SLRC).
Ptr< WifiPhy > GetPhy(void) const
Return the WifiPhy.
uint16_t GetGuardInterval(void) const
Return the supported HE guard interval duration (in nanoseconds).
bool IsMgt(void) const
Return true if the Type is Management.
A struct that holds information about each remote station.
WifiModeList m_operationalMcsSet
operational MCS set
static TypeId GetTypeId(void)
Get the type ID.
void AddSupportedErpSlotTime(Mac48Address address, bool isShortSlotTimeSupported)
Record whether the short ERP slot time is supported by the station.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:265
void SetFragmentationThreshold(uint32_t threshold)
Sets a fragmentation threshold.
void Reset(void)
Reset the station, invoked in a STA upon dis-association or in an AP upon reboot. ...
bool GetUseNonErpProtection(void) const
Return whether the device supports protection of non-ERP stations.
uint32_t m_maxSsrc
Maximum STA short retry count (SSRC)
double snr
SNR in linear scale.
Definition: phy-entity.h:68
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
virtual void DoDispose(void)
Destructor implementation.
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
Ptr< const VhtCapabilities > GetStationVhtCapabilities(Mac48Address from)
Return the VHT capabilities sent by the remote station.
WifiTxVector GetRtsTxVector(Mac48Address address)
Ptr< const AttributeChecker > MakeEnumChecker(int v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
Definition: enum.h:161
void SetNess(uint8_t ness)
Sets the Ness number.
Ptr< NetDevice > GetDevice(void) const
Return the device this PHY is associated with.
Definition: wifi-phy.cc:782
bool IsQosData(void) const
Return true if the Type is DATA and Subtype is one of the possible values for QoS Data...
uint8_t m_ness
Number of extended spatial streams of the remote station.
The 6 GHz band.
Definition: wifi-phy-band.h:39
uint16_t GetChannelWidth(void) const
bool UseLdpcForDestination(Mac48Address dest) const
bool m_shortSlotTime
Flag if short ERP slot time is supported by the remote station.
A base class which provides memory management and object aggregation.
Definition: object.h:87
AttributeValue implementation for WifiMode.
Definition: wifi-mode.h:247
StationStates m_states
States of known stations.
bool IsWaitAssocTxOk(Mac48Address address) const
Return whether we are waiting for an ACK for the association response we sent.
void SetShortPreambleEnabled(bool enable)
Enable or disable short PHY preambles.
virtual bool DoNeedRts(WifiRemoteStation *station, uint32_t size, bool normally)
ProtectionMode m_erpProtectionMode
Protection mode for ERP stations when non-ERP stations are detected.
WifiMode GetBasicMode(uint8_t i) const
Return a basic mode from the set of basic modes.
void AddAllSupportedModes(Mac48Address address)
Invoked in a STA or AP to store all of the modes supported by a destination which is also supported l...
virtual WifiTxVector DoGetDataTxVector(WifiRemoteStation *station)=0
Ptr< VhtConfiguration > GetVhtConfiguration(void) const
The IEEE 802.11ax HE Capabilities.
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:125
Ptr< HtConfiguration > GetHtConfiguration(void) const
virtual void DoReportFinalDataFailed(WifiRemoteStation *station)=0
This method is a pure virtual method that must be implemented by the sub-class.
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
uint32_t GetFragmentSize(Ptr< const WifiMacQueueItem > mpdu, uint32_t fragmentNumber)
virtual WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station)=0
bool IsBrandNew(Mac48Address address) const
Return whether the station state is brand new.
uint8_t GetMaxSupportedTxSpatialStreams(void) const
Definition: wifi-phy.cc:1440
a unique identifier for an interface.
Definition: type-id.h:58
bool IsHigherDataRate(WifiMode mode) const
Definition: wifi-mode.cc:169
WifiRemoteStation * Lookup(Mac48Address address) const
Return the station associated with the given address.
void RemoveAllSupportedMcs(Mac48Address address)
Invoked in a STA or AP to delete all of the supported MCS by a destination.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:57
WifiRemoteStationInfo m_info
remote station info
WifiModeList m_bssBasicMcsSet
basic MCS set
virtual void DoReportFinalRtsFailed(WifiRemoteStation *station)=0
This method is a pure virtual method that must be implemented by the sub-class.
hold per-remote-station state.
virtual WifiRemoteStation * DoCreateStation(void) const =0
void RecordGotAssocTxOk(Mac48Address address)
Records that we got an ACK for the association response we sent.
uint8_t GetHighestNssSupported(void) const
Get highest NSS supported.
static WifiMode GetHtMcs(uint8_t index)
Return the HT MCS corresponding to the provided index.
Definition: ht-phy.cc:456
Implements the IEEE 802.11 MAC header.
WifiMode GetMcsSupported(const WifiRemoteStation *station, uint8_t i) const
Return the WifiMode supported by the specified station at the specified index.
uint16_t GetChannelWidthSupported(Mac48Address address) const
Return the channel width supported by the station.
uint16_t GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.
uint8_t GetNess(const WifiRemoteStation *station) const
uint16_t m_guardInterval
HE Guard interval duration (in nanoseconds) supported by the remote station.
uint32_t DoGetFragmentationThreshold(void) const
Return the current fragmentation threshold.