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 "ap-wifi-mac.h"
29 #include "sta-wifi-mac.h"
30 #include "wifi-mac-header.h"
31 #include "wifi-mac-queue-item.h"
32 #include "wifi-mac-trailer.h"
33 #include "ns3/ht-configuration.h"
34 #include "ns3/ht-phy.h"
35 #include "ns3/vht-configuration.h"
36 #include "ns3/he-configuration.h"
37 #include "wifi-net-device.h"
38 
39 namespace ns3 {
40 
41 NS_LOG_COMPONENT_DEFINE ("WifiRemoteStationManager");
42 
43 NS_OBJECT_ENSURE_REGISTERED (WifiRemoteStationManager);
44 
45 TypeId
47 {
48  static TypeId tid = TypeId ("ns3::WifiRemoteStationManager")
49  .SetParent<Object> ()
50  .SetGroupName ("Wifi")
51  .AddAttribute ("MaxSsrc",
52  "The maximum number of retransmission attempts for any packet with size <= RtsCtsThreshold. "
53  "This value will not have any effect on some rate control algorithms.",
54  UintegerValue (7),
56  MakeUintegerChecker<uint32_t> ())
57  .AddAttribute ("MaxSlrc",
58  "The maximum number of retransmission attempts for any packet with size > RtsCtsThreshold. "
59  "This value will not have any effect on some rate control algorithms.",
60  UintegerValue (4),
62  MakeUintegerChecker<uint32_t> ())
63  .AddAttribute ("RtsCtsThreshold",
64  "If the size of the PSDU is bigger than this value, we use an RTS/CTS handshake before sending the data frame."
65  "This value will not have any effect on some rate control algorithms.",
66  UintegerValue (65535),
68  MakeUintegerChecker<uint32_t> ())
69  .AddAttribute ("FragmentationThreshold",
70  "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. "
71  "This value does not apply when it is carried in an A-MPDU. "
72  "This value will not have any effect on some rate control algorithms.",
73  UintegerValue (65535),
76  MakeUintegerChecker<uint32_t> ())
77  .AddAttribute ("NonUnicastMode",
78  "Wifi mode used for non-unicast transmissions.",
79  WifiModeValue (),
82  .AddAttribute ("DefaultTxPowerLevel",
83  "Default power level to be used for transmissions. "
84  "This is the power level that is used by all those WifiManagers that do not implement TX power control.",
85  UintegerValue (0),
87  MakeUintegerChecker<uint8_t> ())
88  .AddAttribute ("ErpProtectionMode",
89  "Protection mode used when non-ERP STAs are connected to an ERP AP: Rts-Cts or Cts-To-Self",
94  .AddAttribute ("HtProtectionMode",
95  "Protection mode used when non-HT STAs are connected to a HT AP: Rts-Cts or Cts-To-Self",
100  .AddTraceSource ("MacTxRtsFailed",
101  "The transmission of a RTS by the MAC layer has failed",
103  "ns3::Mac48Address::TracedCallback")
104  .AddTraceSource ("MacTxDataFailed",
105  "The transmission of a data packet by the MAC layer has failed",
107  "ns3::Mac48Address::TracedCallback")
108  .AddTraceSource ("MacTxFinalRtsFailed",
109  "The transmission of a RTS has exceeded the maximum number of attempts",
111  "ns3::Mac48Address::TracedCallback")
112  .AddTraceSource ("MacTxFinalDataFailed",
113  "The transmission of a data packet has exceeded the maximum number of attempts",
115  "ns3::Mac48Address::TracedCallback")
116  ;
117  return tid;
118 }
119 
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 int64_t
172 {
173  NS_LOG_FUNCTION (this << stream);
174  return 0;
175 }
176 
177 void
179 {
180  NS_LOG_FUNCTION (this << maxSsrc);
181  m_maxSsrc = maxSsrc;
182 }
183 
184 void
186 {
187  NS_LOG_FUNCTION (this << maxSlrc);
188  m_maxSlrc = maxSlrc;
189 }
190 
191 void
193 {
194  NS_LOG_FUNCTION (this << threshold);
195  m_rtsCtsThreshold = threshold;
196 }
197 
198 void
200 {
201  NS_LOG_FUNCTION (this << threshold);
202  DoSetFragmentationThreshold (threshold);
203 }
204 
205 void
207 {
208  NS_LOG_FUNCTION (this << enable);
209  m_shortPreambleEnabled = enable;
210 }
211 
212 void
214 {
215  NS_LOG_FUNCTION (this << enable);
216  m_shortSlotTimeEnabled = enable;
217 }
218 
219 bool
221 {
222  return m_shortSlotTimeEnabled;
223 }
224 
225 bool
227 {
228  return m_shortPreambleEnabled;
229 }
230 
231 bool
233 {
234  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
235  Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
236  if (htConfiguration)
237  {
238  return true;
239  }
240  return false;
241 }
242 
243 bool
245 {
246  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
247  Ptr<VhtConfiguration> vhtConfiguration = device->GetVhtConfiguration ();
248  if (vhtConfiguration)
249  {
250  return true;
251  }
252  return false;
253 }
254 
255 bool
257 {
258  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
259  Ptr<HeConfiguration> heConfiguration = device->GetHeConfiguration ();
260  if (heConfiguration)
261  {
262  return true;
263  }
264  return false;
265 }
266 
267 bool
269 {
270  if (GetHtSupported ())
271  {
272  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
273  Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
274  NS_ASSERT (htConfiguration); //If HT is supported, we should have a HT configuration attached
275  return htConfiguration->GetLdpcSupported ();
276  }
277  return false;
278 }
279 
280 bool
282 {
283  if (GetHtSupported ())
284  {
285  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
286  Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration ();
287  NS_ASSERT (htConfiguration); //If HT is supported, we should have a HT configuration attached
288  if (htConfiguration->GetShortGuardIntervalSupported ())
289  {
290  return true;
291  }
292  }
293  return false;
294 }
295 
296 uint16_t
298 {
299  uint16_t gi = 0;
300  if (GetHeSupported ())
301  {
302  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
303  Ptr<HeConfiguration> heConfiguration = device->GetHeConfiguration ();
304  NS_ASSERT (heConfiguration); //If HE is supported, we should have a HE configuration attached
305  gi = static_cast<uint16_t>(heConfiguration->GetGuardInterval ().GetNanoSeconds ());
306  }
307  return gi;
308 }
309 
310 uint32_t
312 {
313  return DoGetFragmentationThreshold ();
314 }
315 
316 void
318 {
319  NS_LOG_FUNCTION (this << address << isShortPreambleSupported);
320  NS_ASSERT (!address.IsGroup ());
322  state->m_shortPreamble = isShortPreambleSupported;
323 }
324 
325 void
327 {
328  NS_LOG_FUNCTION (this << address << isShortSlotTimeSupported);
329  NS_ASSERT (!address.IsGroup ());
331  state->m_shortSlotTime = isShortSlotTimeSupported;
332 }
333 
334 void
336 {
337  NS_LOG_FUNCTION (this << address << mode);
338  NS_ASSERT (!address.IsGroup ());
340  for (WifiModeListIterator i = state->m_operationalRateSet.begin (); i != state->m_operationalRateSet.end (); i++)
341  {
342  if ((*i) == mode)
343  {
344  //already in.
345  return;
346  }
347  }
348  state->m_operationalRateSet.push_back (mode);
349 }
350 
351 void
353 {
354  NS_LOG_FUNCTION (this << address);
355  NS_ASSERT (!address.IsGroup ());
357  state->m_operationalRateSet.clear ();
358  for (const auto & mode : m_wifiPhy->GetModeList ())
359  {
360  state->m_operationalRateSet.push_back (mode);
361  if (mode.IsMandatory ())
362  {
363  AddBasicMode (mode);
364  }
365  }
366 }
367 
368 void
370 {
371  NS_LOG_FUNCTION (this << address);
372  NS_ASSERT (!address.IsGroup ());
374  state->m_operationalMcsSet.clear ();
375  for (const auto & mcs : m_wifiPhy->GetMcsList ())
376  {
377  state->m_operationalMcsSet.push_back (mcs);
378  }
379 }
380 
381 void
383 {
384  NS_LOG_FUNCTION (this << address);
385  NS_ASSERT (!address.IsGroup ());
387  state->m_operationalMcsSet.clear ();
388 }
389 
390 void
392 {
393  NS_LOG_FUNCTION (this << address << mcs);
394  NS_ASSERT (!address.IsGroup ());
396  for (WifiModeListIterator i = state->m_operationalMcsSet.begin (); i != state->m_operationalMcsSet.end (); i++)
397  {
398  if ((*i) == mcs)
399  {
400  //already in.
401  return;
402  }
403  }
404  state->m_operationalMcsSet.push_back (mcs);
405 }
406 
407 bool
409 {
411 }
412 
413 bool
415 {
417 }
418 
419 bool
421 {
423 }
424 
425 bool
427 {
428  if (address.IsGroup ())
429  {
430  return false;
431  }
433 }
434 
435 bool
437 {
438  if (address.IsGroup ())
439  {
440  return true;
441  }
443 }
444 
445 bool
447 {
448  if (address.IsGroup ())
449  {
450  return false;
451  }
453 }
454 
455 void
457 {
458  NS_ASSERT (!address.IsGroup ());
460 }
461 
462 void
464 {
465  NS_ASSERT (!address.IsGroup ());
467 }
468 
469 void
471 {
472  NS_ASSERT (!address.IsGroup ());
474 }
475 
476 void
478 {
479  NS_ASSERT (!address.IsGroup ());
481 }
482 
483 uint16_t
485 {
486  NS_LOG_FUNCTION (this << address << txVector);
487 
488  uint16_t staId = SU_STA_ID;
489 
490  if (txVector.IsMu ())
491  {
492  if (m_wifiMac->GetTypeOfStation () == AP)
493  {
494  staId = StaticCast<ApWifiMac> (m_wifiMac)->GetAssociationId (address);
495  }
496  else if (m_wifiMac->GetTypeOfStation () == STA)
497  {
498  Ptr<StaWifiMac> staMac = StaticCast<StaWifiMac> (m_wifiMac);
499  if (staMac->IsAssociated ())
500  {
501  staId = staMac->GetAssociationId ();
502  }
503  }
504  }
505 
506  NS_LOG_DEBUG ("Returning STAID = " << staId);
507  return staId;
508 }
509 
512 {
513  NS_LOG_FUNCTION (this << header);
514  Mac48Address address = header.GetAddr1 ();
515  if (!header.IsMgt () && address.IsGroup ())
516  {
517  WifiMode mode = GetNonUnicastMode ();
518  WifiTxVector v;
519  v.SetMode (mode);
523  v.SetGuardInterval (ConvertGuardIntervalToNanoSeconds (mode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ())));
525  v.SetNss (1);
526  v.SetNess (0);
527  return v;
528  }
529  WifiTxVector txVector;
530  if (header.IsMgt ())
531  {
532  //Use the lowest basic rate for management frames
533  WifiMode mgtMode;
534  if (GetNBasicModes () > 0)
535  {
536  mgtMode = GetBasicMode (0);
537  }
538  else
539  {
540  mgtMode = GetDefaultMode ();
541  }
542  txVector.SetMode (mgtMode);
546  txVector.SetGuardInterval (ConvertGuardIntervalToNanoSeconds (mgtMode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ())));
547  }
548  else
549  {
550  txVector = DoGetDataTxVector (Lookup (address));
552  }
553  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
554  Ptr<HeConfiguration> heConfiguration = device->GetHeConfiguration ();
555  if (heConfiguration)
556  {
557  txVector.SetBssColor (heConfiguration->GetBssColor ());
558  }
559  return txVector;
560 }
561 
564 {
565  WifiMode defaultMode = GetDefaultMode ();
566  WifiPreamble defaultPreamble;
567  if (defaultMode.GetModulationClass () == WIFI_MOD_CLASS_HE)
568  {
569  defaultPreamble = WIFI_PREAMBLE_HE_SU;
570  }
571  else if (defaultMode.GetModulationClass () == WIFI_MOD_CLASS_VHT)
572  {
573  defaultPreamble = WIFI_PREAMBLE_VHT_SU;
574  }
575  else if (defaultMode.GetModulationClass () == WIFI_MOD_CLASS_HT)
576  {
577  defaultPreamble = WIFI_PREAMBLE_HT_MF;
578  }
579  else
580  {
581  defaultPreamble = WIFI_PREAMBLE_LONG;
582  }
583 
584  return WifiTxVector (defaultMode,
586  defaultPreamble,
587  ConvertGuardIntervalToNanoSeconds (defaultMode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ())),
589  1,
590  0,
592  false);
593 }
594 
597 {
598  NS_LOG_FUNCTION (this << address);
599  if (address.IsGroup ())
600  {
601  WifiMode mode = GetNonUnicastMode ();
602  WifiTxVector v;
603  v.SetMode (mode);
607  v.SetGuardInterval (ConvertGuardIntervalToNanoSeconds (mode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ())));
609  v.SetNss (1);
610  v.SetNess (0);
611  return v;
612  }
613  return DoGetRtsTxVector (Lookup (address));
614 }
615 
618 {
619  NS_ASSERT (!to.IsGroup ());
620  WifiMode ctsMode = GetControlAnswerMode (rtsTxMode);
621  WifiTxVector v;
622  v.SetMode (ctsMode);
623  v.SetPreambleType (GetPreambleForTransmission (ctsMode.GetModulationClass (), GetShortPreambleEnabled ()));
626  uint16_t ctsTxGuardInterval = ConvertGuardIntervalToNanoSeconds (ctsMode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ()));
627  v.SetGuardInterval (ctsTxGuardInterval);
628  v.SetNss (1);
629  return v;
630 }
631 
634 {
635  NS_ASSERT (!to.IsGroup ());
636  WifiMode ackMode = GetControlAnswerMode (dataTxVector.GetMode (GetStaId (to, dataTxVector)));
637  WifiTxVector v;
638  v.SetMode (ackMode);
639  v.SetPreambleType (GetPreambleForTransmission (ackMode.GetModulationClass (), GetShortPreambleEnabled ()));
640  v.SetTxPowerLevel (GetDefaultTxPowerLevel ());
641  v.SetChannelWidth (GetChannelWidthForTransmission (ackMode, m_wifiPhy->GetChannelWidth ()));
642  uint16_t ackTxGuardInterval = ConvertGuardIntervalToNanoSeconds (ackMode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ()));
643  v.SetGuardInterval (ackTxGuardInterval);
644  v.SetNss (1);
645  return v;
646 }
647 
650 {
651  NS_ASSERT (!to.IsGroup ());
652  WifiMode blockAckMode = GetControlAnswerMode (dataTxVector.GetMode (GetStaId (to, dataTxVector)));
653  WifiTxVector v;
654  v.SetMode (blockAckMode);
655  v.SetPreambleType (GetPreambleForTransmission (blockAckMode.GetModulationClass (), GetShortPreambleEnabled ()));
656  v.SetTxPowerLevel (GetDefaultTxPowerLevel ());
657  v.SetChannelWidth (GetChannelWidthForTransmission (blockAckMode, m_wifiPhy->GetChannelWidth ()));
658  uint16_t blockAckTxGuardInterval = ConvertGuardIntervalToNanoSeconds (blockAckMode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ()));
659  v.SetGuardInterval (blockAckTxGuardInterval);
660  v.SetNss (1);
661  return v;
662 }
663 
664 WifiMode
666 {
681  NS_LOG_FUNCTION (this << reqMode);
682  WifiMode mode = GetDefaultMode ();
683  bool found = false;
684  //First, search the BSS Basic Rate set
685  for (uint8_t i = 0; i < GetNBasicModes (); i++)
686  {
687  WifiMode testMode = GetBasicMode (i);
688  if ((!found || testMode.IsHigherDataRate (mode))
689  && (!testMode.IsHigherDataRate (reqMode))
691  {
692  mode = testMode;
693  //We've found a potentially-suitable transmit rate, but we
694  //need to continue and consider all the basic rates before
695  //we can be sure we've got the right one.
696  found = true;
697  }
698  }
699  if (GetHtSupported ())
700  {
701  if (!found)
702  {
703  mode = GetDefaultMcs ();
704  for (uint8_t i = 0; i != GetNBasicMcs (); i++)
705  {
706  WifiMode testMode = GetBasicMcs (i);
707  if ((!found || testMode.IsHigherDataRate (mode))
708  && (!testMode.IsHigherDataRate (reqMode))
709  && (testMode.GetModulationClass () == reqMode.GetModulationClass ()))
710  {
711  mode = testMode;
712  //We've found a potentially-suitable transmit rate, but we
713  //need to continue and consider all the basic rates before
714  //we can be sure we've got the right one.
715  found = true;
716  }
717  }
718  }
719  }
720  //If we found a suitable rate in the BSSBasicRateSet, then we are
721  //done and can return that mode.
722  if (found)
723  {
724  NS_LOG_DEBUG ("WifiRemoteStationManager::GetControlAnswerMode returning " << mode);
725  return mode;
726  }
727 
745  for (const auto & thismode : m_wifiPhy->GetModeList ())
746  {
747  /* If the rate:
748  *
749  * - is a mandatory rate for the PHY, and
750  * - is equal to or faster than our current best choice, and
751  * - is less than or equal to the rate of the received frame, and
752  * - is of the same modulation class as the received frame
753  *
754  * ...then it's our best choice so far.
755  */
756  if (thismode.IsMandatory ()
757  && (!found || thismode.IsHigherDataRate (mode))
758  && (!thismode.IsHigherDataRate (reqMode))
759  && (IsAllowedControlAnswerModulationClass (reqMode.GetModulationClass (), thismode.GetModulationClass ())))
760  {
761  mode = thismode;
762  //As above; we've found a potentially-suitable transmit
763  //rate, but we need to continue and consider all the
764  //mandatory rates before we can be sure we've got the right one.
765  found = true;
766  }
767  }
768  if (GetHtSupported () )
769  {
770  for (const auto & thismode : m_wifiPhy->GetMcsList ())
771  {
772  if (thismode.IsMandatory ()
773  && (!found || thismode.IsHigherDataRate (mode))
774  && (!thismode.IsHigherCodeRate (reqMode))
775  && (thismode.GetModulationClass () == reqMode.GetModulationClass ()))
776  {
777  mode = thismode;
778  //As above; we've found a potentially-suitable transmit
779  //rate, but we need to continue and consider all the
780  //mandatory rates before we can be sure we've got the right one.
781  found = true;
782  }
783  }
784  }
785 
795  if (!found)
796  {
797  NS_FATAL_ERROR ("Can't find response rate for " << reqMode);
798  }
799 
800  NS_LOG_DEBUG ("WifiRemoteStationManager::GetControlAnswerMode returning " << mode);
801  return mode;
802 }
803 
804 void
806 {
807  NS_LOG_FUNCTION (this << header);
808  NS_ASSERT (!header.GetAddr1 ().IsGroup ());
809  AcIndex ac = QosUtilsMapTidToAc ((header.IsQosData ()) ? header.GetQosTid () : 0);
810  m_ssrc[ac]++;
811  m_macTxRtsFailed (header.GetAddr1 ());
812  DoReportRtsFailed (Lookup (header.GetAddr1 ()));
813 }
814 
815 void
817 {
818  NS_LOG_FUNCTION (this << *mpdu);
819  NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
820  AcIndex ac = QosUtilsMapTidToAc ((mpdu->GetHeader ().IsQosData ()) ? mpdu->GetHeader ().GetQosTid () : 0);
821  bool longMpdu = (mpdu->GetSize () > m_rtsCtsThreshold);
822  if (longMpdu)
823  {
824  m_slrc[ac]++;
825  }
826  else
827  {
828  m_ssrc[ac]++;
829  }
830  m_macTxDataFailed (mpdu->GetHeader ().GetAddr1 ());
831  DoReportDataFailed (Lookup (mpdu->GetHeader ().GetAddr1 ()));
832 }
833 
834 void
836  double ctsSnr, WifiMode ctsMode, double rtsSnr)
837 {
838  NS_LOG_FUNCTION (this << header << ctsSnr << ctsMode << rtsSnr);
839  NS_ASSERT (!header.GetAddr1 ().IsGroup ());
840  WifiRemoteStation *station = Lookup (header.GetAddr1 ());
841  AcIndex ac = QosUtilsMapTidToAc ((header.IsQosData ()) ? header.GetQosTid () : 0);
842  station->m_state->m_info.NotifyTxSuccess (m_ssrc[ac]);
843  m_ssrc[ac] = 0;
844  DoReportRtsOk (station, ctsSnr, ctsMode, rtsSnr);
845 }
846 
847 void
849  WifiMode ackMode, double dataSnr, WifiTxVector dataTxVector)
850 {
851  NS_LOG_FUNCTION (this << *mpdu << ackSnr << ackMode << dataSnr << dataTxVector);
852  const WifiMacHeader& hdr = mpdu->GetHeader ();
853  NS_ASSERT (!hdr.GetAddr1 ().IsGroup ());
854  WifiRemoteStation *station = Lookup (hdr.GetAddr1 ());
855  AcIndex ac = QosUtilsMapTidToAc ((hdr.IsQosData ()) ? hdr.GetQosTid () : 0);
856  bool longMpdu = (mpdu->GetSize () > m_rtsCtsThreshold);
857  if (longMpdu)
858  {
859  station->m_state->m_info.NotifyTxSuccess (m_slrc[ac]);
860  m_slrc[ac] = 0;
861  }
862  else
863  {
864  station->m_state->m_info.NotifyTxSuccess (m_ssrc[ac]);
865  m_ssrc[ac] = 0;
866  }
867  DoReportDataOk (station, ackSnr, ackMode, dataSnr, dataTxVector.GetChannelWidth (),
868  dataTxVector.GetNss (GetStaId (hdr.GetAddr1 (), dataTxVector)));
869 }
870 
871 void
873 {
874  NS_LOG_FUNCTION (this << header);
875  NS_ASSERT (!header.GetAddr1 ().IsGroup ());
876  WifiRemoteStation *station = Lookup (header.GetAddr1 ());
877  AcIndex ac = QosUtilsMapTidToAc ((header.IsQosData ()) ? header.GetQosTid () : 0);
878  station->m_state->m_info.NotifyTxFailed ();
879  m_ssrc[ac] = 0;
880  m_macTxFinalRtsFailed (header.GetAddr1 ());
881  DoReportFinalRtsFailed (station);
882 }
883 
884 void
886 {
887  NS_LOG_FUNCTION (this << *mpdu);
888  NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
889  WifiRemoteStation *station = Lookup (mpdu->GetHeader ().GetAddr1 ());
890  AcIndex ac = QosUtilsMapTidToAc ((mpdu->GetHeader ().IsQosData ()) ? mpdu->GetHeader ().GetQosTid () : 0);
891  station->m_state->m_info.NotifyTxFailed ();
892  bool longMpdu = (mpdu->GetSize () > m_rtsCtsThreshold);
893  if (longMpdu)
894  {
895  m_slrc[ac] = 0;
896  }
897  else
898  {
899  m_ssrc[ac] = 0;
900  }
901  m_macTxFinalDataFailed (mpdu->GetHeader ().GetAddr1 ());
902  DoReportFinalDataFailed (station);
903 }
904 
905 void
907 {
908  NS_LOG_FUNCTION (this << address << rxSignalInfo << txVector);
909  if (address.IsGroup ())
910  {
911  return;
912  }
913  WifiRemoteStation *station = Lookup (address);
914  DoReportRxOk (station, rxSignalInfo.snr, txVector.GetMode (GetStaId (address, txVector)));
915  station->m_rssiAndUpdateTimePair = std::make_pair (rxSignalInfo.rssi, Simulator::Now ());
916 }
917 
918 void
920  uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus,
921  double rxSnr, double dataSnr, WifiTxVector dataTxVector)
922 {
923  NS_LOG_FUNCTION (this << address << nSuccessfulMpdus << nFailedMpdus << rxSnr << dataSnr << dataTxVector);
924  NS_ASSERT (!address.IsGroup ());
925  for (uint8_t i = 0; i < nFailedMpdus; i++)
926  {
928  }
929  DoReportAmpduTxStatus (Lookup (address), nSuccessfulMpdus, nFailedMpdus, rxSnr, dataSnr, dataTxVector.GetChannelWidth (), dataTxVector.GetNss (GetStaId (address, dataTxVector)));
930 }
931 
932 bool
933 WifiRemoteStationManager::NeedRts (const WifiMacHeader &header, uint32_t size)
934 {
935  NS_LOG_FUNCTION (this << header << size);
936  Mac48Address address = header.GetAddr1 ();
937  WifiTxVector txVector = GetDataTxVector (header);
938  WifiMode mode = txVector.GetMode ();
939  if (address.IsGroup ())
940  {
941  return false;
942  }
945  || (mode.GetModulationClass () == WIFI_MOD_CLASS_HT)
946  || (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT)
947  || (mode.GetModulationClass () == WIFI_MOD_CLASS_HE))
949  {
950  NS_LOG_DEBUG ("WifiRemoteStationManager::NeedRTS returning true to protect non-ERP stations");
951  return true;
952  }
953  else if (m_htProtectionMode == RTS_CTS
954  && ((mode.GetModulationClass () == WIFI_MOD_CLASS_HT)
955  || (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT))
958  {
959  NS_LOG_DEBUG ("WifiRemoteStationManager::NeedRTS returning true to protect non-HT stations");
960  return true;
961  }
962  bool normally = (size > m_rtsCtsThreshold);
963  return DoNeedRts (Lookup (address), size, normally);
964 }
965 
966 bool
968 {
969  WifiMode mode = txVector.GetMode ();
970  NS_LOG_FUNCTION (this << mode);
973  || (mode.GetModulationClass () == WIFI_MOD_CLASS_HT)
974  || (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT)
975  || (mode.GetModulationClass () == WIFI_MOD_CLASS_HE))
977  {
978  NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning true to protect non-ERP stations");
979  return true;
980  }
981  else if (m_htProtectionMode == CTS_TO_SELF
982  && ((mode.GetModulationClass () == WIFI_MOD_CLASS_HT)
983  || (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT))
986  {
987  NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning true to protect non-HT stations");
988  return true;
989  }
990  else if (!m_useNonErpProtection)
991  {
992  //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
993  for (WifiModeListIterator i = m_bssBasicRateSet.begin (); i != m_bssBasicRateSet.end (); i++)
994  {
995  if (mode == *i)
996  {
997  NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning false");
998  return false;
999  }
1000  }
1001  if (GetHtSupported ())
1002  {
1003  //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
1004  for (WifiModeListIterator i = m_bssBasicMcsSet.begin (); i != m_bssBasicMcsSet.end (); i++)
1005  {
1006  if (mode == *i)
1007  {
1008  NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning false");
1009  return false;
1010  }
1011  }
1012  }
1013  NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning true");
1014  return true;
1015  }
1016  return false;
1017 }
1018 
1019 void
1021 {
1022  NS_LOG_FUNCTION (this << enable);
1023  m_useNonErpProtection = enable;
1024 }
1025 
1026 bool
1028 {
1029  return m_useNonErpProtection;
1030 }
1031 
1032 void
1034 {
1035  NS_LOG_FUNCTION (this << enable);
1036  m_useNonHtProtection = enable;
1037 }
1038 
1039 bool
1041 {
1042  return m_useNonHtProtection;
1043 }
1044 
1045 bool
1047 {
1048  NS_LOG_FUNCTION (this << *mpdu);
1049  NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
1050  AcIndex ac = QosUtilsMapTidToAc ((mpdu->GetHeader ().IsQosData ()) ? mpdu->GetHeader ().GetQosTid () : 0);
1051  bool longMpdu = (mpdu->GetSize () > m_rtsCtsThreshold);
1052  uint32_t retryCount, maxRetryCount;
1053  if (longMpdu)
1054  {
1055  retryCount = m_slrc[ac];
1056  maxRetryCount = m_maxSlrc;
1057  }
1058  else
1059  {
1060  retryCount = m_ssrc[ac];
1061  maxRetryCount = m_maxSsrc;
1062  }
1063  bool normally = retryCount < maxRetryCount;
1064  NS_LOG_DEBUG ("WifiRemoteStationManager::NeedRetransmission count: " << retryCount << " result: " << std::boolalpha << normally);
1065  return DoNeedRetransmission (Lookup (mpdu->GetHeader ().GetAddr1 ()), mpdu->GetPacket (), normally);
1066 }
1067 
1068 bool
1070 {
1071  NS_LOG_FUNCTION (this << *mpdu);
1072  if (mpdu->GetHeader ().GetAddr1 ().IsGroup ())
1073  {
1074  return false;
1075  }
1076  bool normally = mpdu->GetSize () > GetFragmentationThreshold ();
1077  NS_LOG_DEBUG ("WifiRemoteStationManager::NeedFragmentation result: " << std::boolalpha << normally);
1078  return DoNeedFragmentation (Lookup (mpdu->GetHeader ().GetAddr1 ()), mpdu->GetPacket (), normally);
1079 }
1080 
1081 void
1083 {
1084  NS_LOG_FUNCTION (this << threshold);
1085  if (threshold < 256)
1086  {
1087  /*
1088  * ASN.1 encoding of the MAC and PHY MIB (256 ... 8000)
1089  */
1090  NS_LOG_WARN ("Fragmentation threshold should be larger than 256. Setting to 256.");
1092  }
1093  else
1094  {
1095  /*
1096  * The length of each fragment shall be an even number of octets, except for the last fragment if an MSDU or
1097  * MMPDU, which may be either an even or an odd number of octets.
1098  */
1099  if (threshold % 2 != 0)
1100  {
1101  NS_LOG_WARN ("Fragmentation threshold should be an even number. Setting to " << threshold - 1);
1102  m_fragmentationThreshold = threshold - 1;
1103  }
1104  else
1105  {
1106  m_fragmentationThreshold = threshold;
1107  }
1108  }
1109 }
1110 
1111 uint32_t
1113 {
1114  return m_fragmentationThreshold;
1115 }
1116 
1117 uint32_t
1119 {
1120  NS_LOG_FUNCTION (this << *mpdu);
1121  //The number of bytes a fragment can support is (Threshold - WIFI_HEADER_SIZE - WIFI_FCS).
1122  uint32_t nFragments = (mpdu->GetPacket ()->GetSize () / (GetFragmentationThreshold () - mpdu->GetHeader ().GetSize () - WIFI_MAC_FCS_LENGTH));
1123 
1124  //If the size of the last fragment is not 0.
1125  if ((mpdu->GetPacket ()->GetSize () % (GetFragmentationThreshold () - mpdu->GetHeader ().GetSize () - WIFI_MAC_FCS_LENGTH)) > 0)
1126  {
1127  nFragments++;
1128  }
1129  NS_LOG_DEBUG ("WifiRemoteStationManager::GetNFragments returning " << nFragments);
1130  return nFragments;
1131 }
1132 
1133 uint32_t
1135 {
1136  NS_LOG_FUNCTION (this << *mpdu << fragmentNumber);
1137  NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
1138  uint32_t nFragment = GetNFragments (mpdu);
1139  if (fragmentNumber >= nFragment)
1140  {
1141  NS_LOG_DEBUG ("WifiRemoteStationManager::GetFragmentSize returning 0");
1142  return 0;
1143  }
1144  //Last fragment
1145  if (fragmentNumber == nFragment - 1)
1146  {
1147  uint32_t lastFragmentSize = mpdu->GetPacket ()->GetSize () - (fragmentNumber * (GetFragmentationThreshold () - mpdu->GetHeader ().GetSize () - WIFI_MAC_FCS_LENGTH));
1148  NS_LOG_DEBUG ("WifiRemoteStationManager::GetFragmentSize returning " << lastFragmentSize);
1149  return lastFragmentSize;
1150  }
1151  //All fragments but the last, the number of bytes is (Threshold - WIFI_HEADER_SIZE - WIFI_FCS).
1152  else
1153  {
1154  uint32_t fragmentSize = GetFragmentationThreshold () - mpdu->GetHeader ().GetSize () - WIFI_MAC_FCS_LENGTH;
1155  NS_LOG_DEBUG ("WifiRemoteStationManager::GetFragmentSize returning " << fragmentSize);
1156  return fragmentSize;
1157  }
1158 }
1159 
1160 uint32_t
1162 {
1163  NS_LOG_FUNCTION (this << *mpdu << fragmentNumber);
1164  NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
1165  NS_ASSERT (fragmentNumber < GetNFragments (mpdu));
1166  uint32_t fragmentOffset = fragmentNumber * (GetFragmentationThreshold () - mpdu->GetHeader ().GetSize () - WIFI_MAC_FCS_LENGTH);
1167  NS_LOG_DEBUG ("WifiRemoteStationManager::GetFragmentOffset returning " << fragmentOffset);
1168  return fragmentOffset;
1169 }
1170 
1171 bool
1173 {
1174  NS_LOG_FUNCTION (this << *mpdu << fragmentNumber);
1175  NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
1176  bool isLast = fragmentNumber == (GetNFragments (mpdu) - 1);
1177  NS_LOG_DEBUG ("WifiRemoteStationManager::IsLastFragment returning " << std::boolalpha << isLast);
1178  return isLast;
1179 }
1180 
1181 uint8_t
1183 {
1184  return m_defaultTxPowerLevel;
1185 }
1186 
1189 {
1191  return state->m_info;
1192 }
1193 
1194 double
1196 {
1197  double rssi = 0.0;
1198  Time mostRecentUpdateTime = NanoSeconds (0);
1199  for (const auto & station : m_stations)
1200  {
1201  if (station->m_state->m_address == address) //get most recent RSSI irrespective of TID
1202  {
1203  if (station->m_rssiAndUpdateTimePair.second >= mostRecentUpdateTime)
1204  {
1205  rssi = station->m_rssiAndUpdateTimePair.first;
1206  mostRecentUpdateTime = station->m_rssiAndUpdateTimePair.second;
1207  }
1208  }
1209  }
1210  NS_ASSERT (mostRecentUpdateTime.IsStrictlyPositive ());
1211  return rssi;
1212 }
1213 
1216 {
1217  NS_LOG_FUNCTION (this << address);
1218  for (StationStates::const_iterator i = m_states.begin (); i != m_states.end (); i++)
1219  {
1220  if ((*i)->m_address == address)
1221  {
1222  NS_LOG_DEBUG ("WifiRemoteStationManager::LookupState returning existing state");
1223  return (*i);
1224  }
1225  }
1228  state->m_address = address;
1229  state->m_operationalRateSet.push_back (GetDefaultMode ());
1230  state->m_operationalMcsSet.push_back (GetDefaultMcs ());
1231  state->m_htCapabilities = 0;
1232  state->m_vhtCapabilities = 0;
1233  state->m_heCapabilities = 0;
1235  state->m_guardInterval = GetGuardInterval ();
1236  state->m_ness = 0;
1237  state->m_aggregation = false;
1238  state->m_qosSupported = false;
1239  const_cast<WifiRemoteStationManager *> (this)->m_states.push_back (state);
1240  NS_LOG_DEBUG ("WifiRemoteStationManager::LookupState returning new state");
1241  return state;
1242 }
1243 
1246 {
1247  NS_LOG_FUNCTION (this << address);
1248  for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++)
1249  {
1250  if ((*i)->m_state->m_address == address)
1251  {
1252  return (*i);
1253  }
1254  }
1256 
1257  WifiRemoteStation *station = DoCreateStation ();
1258  station->m_state = state;
1259  station->m_rssiAndUpdateTimePair = std::make_pair (0, Seconds (0));
1260  const_cast<WifiRemoteStationManager *> (this)->m_stations.push_back (station);
1261  return station;
1262 }
1263 
1264 void
1266 {
1267  NS_LOG_FUNCTION (this << from << qosSupported);
1268  WifiRemoteStationState *state;
1269  state = LookupState (from);
1270  state->m_qosSupported = qosSupported;
1271 }
1272 
1273 void
1275 {
1276  //Used by all stations to record HT capabilities of remote stations
1277  NS_LOG_FUNCTION (this << from << htCapabilities);
1278  WifiRemoteStationState *state;
1279  state = LookupState (from);
1280  if (htCapabilities.GetSupportedChannelWidth () == 1)
1281  {
1282  state->m_channelWidth = 40;
1283  }
1284  else
1285  {
1286  state->m_channelWidth = 20;
1287  }
1288  SetQosSupport (from, true);
1289  for (const auto & mcs : m_wifiPhy->GetMcsList (WIFI_MOD_CLASS_HT))
1290  {
1291  if (htCapabilities.IsSupportedMcs (mcs.GetMcsValue ()))
1292  {
1293  AddSupportedMcs (from, mcs);
1294  }
1295  }
1296  state->m_htCapabilities = Create<const HtCapabilities> (htCapabilities);
1297 }
1298 
1299 void
1301 {
1302  //Used by all stations to record VHT capabilities of remote stations
1303  NS_LOG_FUNCTION (this << from << vhtCapabilities);
1304  WifiRemoteStationState *state;
1305  state = LookupState (from);
1306  if (vhtCapabilities.GetSupportedChannelWidthSet () == 1)
1307  {
1308  state->m_channelWidth = 160;
1309  }
1310  else
1311  {
1312  state->m_channelWidth = 80;
1313  }
1314  //This is a workaround to enable users to force a 20 or 40 MHz channel for a VHT-compliant device,
1315  //since IEEE 802.11ac standard says that 20, 40 and 80 MHz channels are mandatory.
1316  if (m_wifiPhy->GetChannelWidth () < state->m_channelWidth)
1317  {
1319  }
1320  for (uint8_t i = 1; i <= m_wifiPhy->GetMaxSupportedTxSpatialStreams (); i++)
1321  {
1322  for (const auto & mcs : m_wifiPhy->GetMcsList (WIFI_MOD_CLASS_VHT))
1323  {
1324  if (vhtCapabilities.IsSupportedMcs (mcs.GetMcsValue (), i))
1325  {
1326  AddSupportedMcs (from, mcs);
1327  }
1328  }
1329  }
1330  state->m_vhtCapabilities = Create<const VhtCapabilities> (vhtCapabilities);
1331 }
1332 
1333 void
1335 {
1336  //Used by all stations to record HE capabilities of remote stations
1337  NS_LOG_FUNCTION (this << from << heCapabilities);
1338  WifiRemoteStationState *state;
1339  state = LookupState (from);
1341  {
1342  if (heCapabilities.GetChannelWidthSet () & 0x04)
1343  {
1344  state->m_channelWidth = 160;
1345  }
1346  else if (heCapabilities.GetChannelWidthSet () & 0x02)
1347  {
1348  state->m_channelWidth = 80;
1349  }
1350  //For other cases at 5 GHz, the supported channel width is set by the VHT capabilities
1351  }
1352  else if (m_wifiPhy->GetPhyBand () == WIFI_PHY_BAND_2_4GHZ)
1353  {
1354  if (heCapabilities.GetChannelWidthSet () & 0x01)
1355  {
1356  state->m_channelWidth = 40;
1357  }
1358  else
1359  {
1360  state->m_channelWidth = 20;
1361  }
1362  }
1363  if (heCapabilities.GetHeLtfAndGiForHePpdus () >= 2)
1364  {
1365  state->m_guardInterval = 800;
1366  }
1367  else if (heCapabilities.GetHeLtfAndGiForHePpdus () == 1)
1368  {
1369  state->m_guardInterval = 1600;
1370  }
1371  else
1372  {
1373  state->m_guardInterval = 3200;
1374  }
1375  for (uint8_t i = 1; i <= m_wifiPhy->GetMaxSupportedTxSpatialStreams (); i++)
1376  {
1377  for (const auto & mcs : m_wifiPhy->GetMcsList (WIFI_MOD_CLASS_HE))
1378  {
1379  if (heCapabilities.GetHighestNssSupported () >= i
1380  && heCapabilities.GetHighestMcsSupported () >= mcs.GetMcsValue ())
1381  {
1382  AddSupportedMcs (from, mcs);
1383  }
1384  }
1385  }
1386  state->m_heCapabilities = Create<const HeCapabilities> (heCapabilities);
1387  SetQosSupport (from, true);
1388 }
1389 
1392 {
1393  return LookupState (from)->m_htCapabilities;
1394 }
1395 
1398 {
1399  return LookupState (from)->m_vhtCapabilities;
1400 }
1401 
1404 {
1405  return LookupState (from)->m_heCapabilities;
1406 }
1407 
1408 bool
1410 {
1414  bool supported = false;
1415  if (htCapabilities)
1416  {
1417  supported |= htCapabilities->GetLdpc ();
1418  }
1419  if (vhtCapabilities)
1420  {
1421  supported |= vhtCapabilities->GetRxLdpc ();
1422  }
1423  if (heCapabilities)
1424  {
1425  supported |= heCapabilities->GetLdpcCodingInPayload ();
1426  }
1427  return supported;
1428 }
1429 
1430 WifiMode
1432 {
1433  return m_defaultTxMode;
1434 }
1435 
1436 WifiMode
1438 {
1439  return m_defaultTxMcs;
1440 }
1441 
1442 void
1444 {
1445  NS_LOG_FUNCTION (this);
1446  for (StationStates::const_iterator i = m_states.begin (); i != m_states.end (); i++)
1447  {
1448  delete (*i);
1449  }
1450  m_states.clear ();
1451  for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++)
1452  {
1453  delete (*i);
1454  }
1455  m_stations.clear ();
1456  m_bssBasicRateSet.clear ();
1457  m_bssBasicMcsSet.clear ();
1458  m_ssrc.fill (0);
1459  m_slrc.fill (0);
1460 }
1461 
1462 void
1464 {
1465  NS_LOG_FUNCTION (this << mode);
1466  if (mode.GetModulationClass () >= WIFI_MOD_CLASS_HT)
1467  {
1468  NS_FATAL_ERROR ("It is not allowed to add a HT rate in the BSSBasicRateSet!");
1469  }
1470  for (uint8_t i = 0; i < GetNBasicModes (); i++)
1471  {
1472  if (GetBasicMode (i) == mode)
1473  {
1474  return;
1475  }
1476  }
1477  m_bssBasicRateSet.push_back (mode);
1478 }
1479 
1480 uint8_t
1482 {
1483  return static_cast<uint8_t> (m_bssBasicRateSet.size ());
1484 }
1485 
1486 WifiMode
1488 {
1489  NS_ASSERT (i < GetNBasicModes ());
1490  return m_bssBasicRateSet[i];
1491 }
1492 
1493 uint32_t
1495 {
1496  uint32_t size = 0;
1497  for (WifiModeListIterator i = m_bssBasicRateSet.begin (); i != m_bssBasicRateSet.end (); i++)
1498  {
1499  if (i->GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
1500  {
1501  continue;
1502  }
1503  size++;
1504  }
1505  return size;
1506 }
1507 
1508 WifiMode
1510 {
1512  uint32_t index = 0;
1513  bool found = false;
1514  for (WifiModeListIterator j = m_bssBasicRateSet.begin (); j != m_bssBasicRateSet.end (); )
1515  {
1516  if (i == index)
1517  {
1518  found = true;
1519  }
1520  if (j->GetModulationClass () != WIFI_MOD_CLASS_ERP_OFDM)
1521  {
1522  if (found)
1523  {
1524  break;
1525  }
1526  }
1527  index++;
1528  j++;
1529  }
1530  return m_bssBasicRateSet[index];
1531 }
1532 
1533 void
1535 {
1536  NS_LOG_FUNCTION (this << +mcs.GetMcsValue ());
1537  for (uint8_t i = 0; i < GetNBasicMcs (); i++)
1538  {
1539  if (GetBasicMcs (i) == mcs)
1540  {
1541  return;
1542  }
1543  }
1544  m_bssBasicMcsSet.push_back (mcs);
1545 }
1546 
1547 uint8_t
1549 {
1550  return static_cast<uint8_t> (m_bssBasicMcsSet.size ());
1551 }
1552 
1553 WifiMode
1555 {
1556  NS_ASSERT (i < GetNBasicMcs ());
1557  return m_bssBasicMcsSet[i];
1558 }
1559 
1560 WifiMode
1562 {
1563  if (m_nonUnicastMode == WifiMode ())
1564  {
1565  if (GetNBasicModes () > 0)
1566  {
1567  return GetBasicMode (0);
1568  }
1569  else
1570  {
1571  return GetDefaultMode ();
1572  }
1573  }
1574  else
1575  {
1576  return m_nonUnicastMode;
1577  }
1578 }
1579 
1580 bool
1582  uint32_t size, bool normally)
1583 {
1584  return normally;
1585 }
1586 
1587 bool
1589  Ptr<const Packet> packet, bool normally)
1590 {
1591  return normally;
1592 }
1593 
1594 bool
1596  Ptr<const Packet> packet, bool normally)
1597 {
1598  return normally;
1599 }
1600 
1601 void
1602 WifiRemoteStationManager::DoReportAmpduTxStatus (WifiRemoteStation *station, uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus, double rxSnr, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
1603 {
1604  NS_LOG_DEBUG ("DoReportAmpduTxStatus received but the manager does not handle A-MPDUs!");
1605 }
1606 
1607 WifiMode
1609 {
1610  NS_ASSERT (i < GetNSupported (station));
1611  return station->m_state->m_operationalRateSet[i];
1612 }
1613 
1614 WifiMode
1616 {
1617  NS_ASSERT (i < GetNMcsSupported (station));
1618  return station->m_state->m_operationalMcsSet[i];
1619 }
1620 
1621 WifiMode
1623 {
1624  NS_ASSERT (i < GetNNonErpSupported (station));
1625  //IEEE 802.11g standard defines that if the protection mechanism is enabled, RTS, CTS and CTS-To-Self
1626  //frames should select a rate in the BSSBasicRateSet that corresponds to an 802.11b basic rate.
1627  //This is a implemented here to avoid changes in every RAA, but should maybe be moved in case it breaks standard rules.
1628  uint32_t index = 0;
1629  bool found = false;
1630  for (WifiModeListIterator j = station->m_state->m_operationalRateSet.begin (); j != station->m_state->m_operationalRateSet.end (); )
1631  {
1632  if (i == index)
1633  {
1634  found = true;
1635  }
1636  if (j->GetModulationClass () != WIFI_MOD_CLASS_ERP_OFDM)
1637  {
1638  if (found)
1639  {
1640  break;
1641  }
1642  }
1643  index++;
1644  j++;
1645  }
1646  return station->m_state->m_operationalRateSet[index];
1647 }
1648 
1651 {
1652  return station->m_state->m_address;
1653 }
1654 
1655 uint16_t
1657 {
1658  return station->m_state->m_channelWidth;
1659 }
1660 
1661 bool
1663 {
1664  Ptr<const HtCapabilities> htCapabilities = station->m_state->m_htCapabilities;
1665 
1666  if (!htCapabilities)
1667  {
1668  return false;
1669  }
1670  return htCapabilities->GetShortGuardInterval20 ();
1671 }
1672 
1673 uint16_t
1675 {
1676  return station->m_state->m_guardInterval;
1677 }
1678 
1679 bool
1681 {
1682  return station->m_state->m_aggregation;
1683 }
1684 
1685 uint8_t
1687 {
1688  Ptr<const HtCapabilities> htCapabilities = station->m_state->m_htCapabilities;
1689 
1690  if (!htCapabilities)
1691  {
1692  return 1;
1693  }
1694  return htCapabilities->GetRxHighestSupportedAntennas ();
1695 }
1696 
1697 uint8_t
1699 {
1700  return station->m_state->m_ness;
1701 }
1702 
1705 {
1706  return m_wifiPhy;
1707 }
1708 
1711 {
1712  return m_wifiMac;
1713 }
1714 
1715 uint8_t
1717 {
1718  return static_cast<uint8_t> (station->m_state->m_operationalRateSet.size ());
1719 }
1720 
1721 bool
1723 {
1724  return station->m_state->m_qosSupported;
1725 }
1726 
1727 bool
1729 {
1730  return (station->m_state->m_htCapabilities != 0);
1731 }
1732 
1733 bool
1735 {
1736  return (station->m_state->m_vhtCapabilities != 0);
1737 }
1738 
1739 bool
1741 {
1742  return (station->m_state->m_heCapabilities != 0);
1743 }
1744 
1745 uint8_t
1747 {
1748  return static_cast<uint8_t> (station->m_state->m_operationalMcsSet.size ());
1749 }
1750 
1751 uint32_t
1753 {
1754  uint32_t size = 0;
1755  for (WifiModeListIterator i = station->m_state->m_operationalRateSet.begin (); i != station->m_state->m_operationalRateSet.end (); i++)
1756  {
1757  if (i->GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
1758  {
1759  continue;
1760  }
1761  size++;
1762  }
1763  return size;
1764 }
1765 
1766 uint16_t
1768 {
1770 }
1771 
1772 bool
1774 {
1776 
1777  if (!htCapabilities)
1778  {
1779  return false;
1780  }
1781  return htCapabilities->GetShortGuardInterval20 ();
1782 }
1783 
1784 uint8_t
1786 {
1788 
1789  if (!htCapabilities)
1790  {
1791  return 1;
1792  }
1793  return htCapabilities->GetRxHighestSupportedAntennas ();
1794 }
1795 
1796 uint8_t
1798 {
1799  return static_cast<uint8_t> (LookupState (address)->m_operationalMcsSet.size ());
1800 }
1801 
1802 bool
1804 {
1805  return (LookupState (address)->m_htCapabilities != 0);
1806 }
1807 
1808 bool
1810 {
1811  return (LookupState (address)->m_vhtCapabilities != 0);
1812 }
1813 
1814 bool
1816 {
1817  return (LookupState (address)->m_heCapabilities != 0);
1818 }
1819 
1820 void
1822 {
1823  m_defaultTxPowerLevel = txPower;
1824 }
1825 
1826 uint8_t
1828 {
1829  return m_wifiPhy->GetNumberOfAntennas ();
1830 }
1831 
1832 uint8_t
1834 {
1836 }
1837 
1838 bool
1840 {
1841  return (GetLdpcSupported () && GetLdpcSupported (dest));
1842 }
1843 
1844 } //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
enum ns3::WifiRemoteStationState::@77 m_state
State of the station.
#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
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:58
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.
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:1124
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:2000
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
bool IsMu(void) const
Return true if this TX vector is used for a multi-user transmission.
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:2049
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:235
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.
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
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:47
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:130
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:1233
WifiMode GetControlAnswerMode(WifiMode reqMode) const
Get control answer mode function.
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.
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:126
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)
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:159
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.
bool GetShortSlotTimeEnabled(void) const
Return whether the device uses short slot time.
uint16_t GetStaId(Mac48Address address, const WifiTxVector &txVector) const
If the given TXVECTOR is used for a MU transmission, return the STAID of the station with the given a...
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:1372
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:258
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:246
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:783
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
WifiTxVector GetBlockAckTxVector(Mac48Address to, const WifiTxVector &dataTxVector) const
Return a TXVECTOR for the BlockAck frame given the destination and the mode of the Data used by the s...
bool UseLdpcForDestination(Mac48Address dest) const
uint16_t GetAssociationId(void) const
Return the association ID.
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
WifiTxVector GetAckTxVector(Mac48Address to, const WifiTxVector &dataTxVector) const
Return a TXVECTOR for the Ack frame given the destination and the mode of the Data used by the sender...
AttributeValue implementation for WifiMode.
Definition: wifi-mode.h:246
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)
void ReportRxOk(Mac48Address address, RxSignalInfo rxSignalInfo, WifiTxVector txVector)
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:137
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:1403
a unique identifier for an interface.
Definition: type-id.h:58
bool IsHigherDataRate(WifiMode mode) const
Definition: wifi-mode.cc:181
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
#define SU_STA_ID
Definition: wifi-mode.h:32
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.
bool IsAssociated(void) const
Return whether we are associated with an AP.
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.