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
39namespace ns3 {
40
41NS_LOG_COMPONENT_DEFINE ("WifiRemoteStationManager");
42
43NS_OBJECT_ENSURE_REGISTERED (WifiRemoteStationManager);
44
45TypeId
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.",
80 MakeWifiModeAccessor (&WifiRemoteStationManager::m_nonUnicastMode),
81 MakeWifiModeChecker ())
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
134void
136{
137 NS_LOG_FUNCTION (this);
138 Reset ();
139}
140
141void
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
160void
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
170int64_t
172{
173 NS_LOG_FUNCTION (this << stream);
174 return 0;
175}
176
177void
179{
180 NS_LOG_FUNCTION (this << maxSsrc);
181 m_maxSsrc = maxSsrc;
182}
183
184void
186{
187 NS_LOG_FUNCTION (this << maxSlrc);
188 m_maxSlrc = maxSlrc;
189}
190
191void
193{
194 NS_LOG_FUNCTION (this << threshold);
195 m_rtsCtsThreshold = threshold;
196}
197
198void
200{
201 NS_LOG_FUNCTION (this << threshold);
202 DoSetFragmentationThreshold (threshold);
203}
204
205void
207{
208 NS_LOG_FUNCTION (this << enable);
209 m_shortPreambleEnabled = enable;
210}
211
212void
214{
215 NS_LOG_FUNCTION (this << enable);
216 m_shortSlotTimeEnabled = enable;
217}
218
219bool
221{
223}
224
225bool
227{
229}
230
231bool
233{
234 return m_wifiPhy->GetDevice ()->GetHtConfiguration () != nullptr;
235}
236
237bool
239{
240 return m_wifiPhy->GetDevice ()->GetVhtConfiguration () != nullptr;
241}
242
243bool
245{
246 return m_wifiPhy->GetDevice ()->GetHeConfiguration () != nullptr;
247}
248
249bool
251{
252 if (GetHtSupported ())
253 {
255 NS_ASSERT (htConfiguration); //If HT is supported, we should have a HT configuration attached
256 return htConfiguration->GetLdpcSupported ();
257 }
258 return false;
259}
260
261bool
263{
264 if (GetHtSupported ())
265 {
267 NS_ASSERT (htConfiguration); //If HT is supported, we should have a HT configuration attached
268 if (htConfiguration->GetShortGuardIntervalSupported ())
269 {
270 return true;
271 }
272 }
273 return false;
274}
275
276uint16_t
278{
279 uint16_t gi = 0;
280 if (GetHeSupported ())
281 {
283 NS_ASSERT (heConfiguration); //If HE is supported, we should have a HE configuration attached
284 gi = static_cast<uint16_t>(heConfiguration->GetGuardInterval ().GetNanoSeconds ());
285 }
286 return gi;
287}
288
291{
293}
294
295void
297{
298 NS_LOG_FUNCTION (this << address << isShortPreambleSupported);
299 NS_ASSERT (!address.IsGroup ());
301 state->m_shortPreamble = isShortPreambleSupported;
302}
303
304void
306{
307 NS_LOG_FUNCTION (this << address << isShortSlotTimeSupported);
308 NS_ASSERT (!address.IsGroup ());
310 state->m_shortSlotTime = isShortSlotTimeSupported;
311}
312
313void
315{
316 NS_LOG_FUNCTION (this << address << mode);
317 NS_ASSERT (!address.IsGroup ());
319 for (WifiModeListIterator i = state->m_operationalRateSet.begin (); i != state->m_operationalRateSet.end (); i++)
320 {
321 if ((*i) == mode)
322 {
323 //already in.
324 return;
325 }
326 }
328 {
329 state->m_dsssSupported = true;
330 }
332 {
333 state->m_erpOfdmSupported = true;
334 }
335 else if (mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM)
336 {
337 state->m_ofdmSupported = true;
338 }
339 state->m_operationalRateSet.push_back (mode);
340}
341
342void
344{
345 NS_LOG_FUNCTION (this << address);
346 NS_ASSERT (!address.IsGroup ());
348 state->m_operationalRateSet.clear ();
349 for (const auto & mode : m_wifiPhy->GetModeList ())
350 {
351 state->m_operationalRateSet.push_back (mode);
352 if (mode.IsMandatory ())
353 {
354 AddBasicMode (mode);
355 }
356 }
357}
358
359void
361{
362 NS_LOG_FUNCTION (this << address);
363 NS_ASSERT (!address.IsGroup ());
365 state->m_operationalMcsSet.clear ();
366 for (const auto & mcs : m_wifiPhy->GetMcsList ())
367 {
368 state->m_operationalMcsSet.push_back (mcs);
369 }
370}
371
372void
374{
375 NS_LOG_FUNCTION (this << address);
376 NS_ASSERT (!address.IsGroup ());
378 state->m_operationalMcsSet.clear ();
379}
380
381void
383{
384 NS_LOG_FUNCTION (this << address << mcs);
385 NS_ASSERT (!address.IsGroup ());
387 for (WifiModeListIterator i = state->m_operationalMcsSet.begin (); i != state->m_operationalMcsSet.end (); i++)
388 {
389 if ((*i) == mcs)
390 {
391 //already in.
392 return;
393 }
394 }
395 state->m_operationalMcsSet.push_back (mcs);
396}
397
398bool
400{
402}
403
404bool
406{
408}
409
410bool
412{
414}
415
416bool
418{
419 if (address.IsGroup ())
420 {
421 return false;
422 }
424}
425
426bool
428{
429 if (address.IsGroup ())
430 {
431 return true;
432 }
434}
435
436bool
438{
439 if (address.IsGroup ())
440 {
441 return false;
442 }
444}
445
446void
448{
449 NS_ASSERT (!address.IsGroup ());
451}
452
453void
455{
456 NS_ASSERT (!address.IsGroup ());
458}
459
460void
462{
463 NS_ASSERT (!address.IsGroup ());
465}
466
467void
469{
470 NS_ASSERT (!address.IsGroup ());
472}
473
474uint16_t
476{
478 if (!remoteAddress.IsGroup ()
479 && (state = LookupState (remoteAddress))->m_state == WifiRemoteStationState::GOT_ASSOC_TX_OK)
480 {
481 return state->m_aid;
482 }
483 return SU_STA_ID;
484}
485
486uint16_t
488{
489 NS_LOG_FUNCTION (this << address << txVector);
490
491 uint16_t staId = SU_STA_ID;
492
493 if (txVector.IsMu ())
494 {
495 if (m_wifiMac->GetTypeOfStation () == AP)
496 {
497 staId = GetAssociationId (address);
498 }
499 else if (m_wifiMac->GetTypeOfStation () == STA)
500 {
501 Ptr<StaWifiMac> staMac = StaticCast<StaWifiMac> (m_wifiMac);
502 if (staMac->IsAssociated ())
503 {
504 staId = staMac->GetAssociationId ();
505 }
506 }
507 }
508
509 NS_LOG_DEBUG ("Returning STAID = " << staId);
510 return staId;
511}
512
515{
516 NS_LOG_FUNCTION (this << header);
517 Mac48Address address = header.GetAddr1 ();
518 if (!header.IsMgt () && address.IsGroup ())
519 {
520 WifiMode mode = GetNonUnicastMode ();
521 WifiTxVector v;
522 v.SetMode (mode);
528 v.SetNss (1);
529 v.SetNess (0);
530 return v;
531 }
532 WifiTxVector txVector;
533 if (header.IsMgt ())
534 {
535 //Use the lowest basic rate for management frames
536 WifiMode mgtMode;
537 if (GetNBasicModes () > 0)
538 {
539 mgtMode = GetBasicMode (0);
540 }
541 else
542 {
543 mgtMode = GetDefaultMode ();
544 }
545 txVector.SetMode (mgtMode);
548 uint16_t channelWidth = m_wifiPhy->GetChannelWidth ();
549 if (!header.GetAddr1 ().IsGroup ())
550 {
551 if (uint16_t rxWidth = GetChannelWidthSupported (header.GetAddr1 ());
552 rxWidth < channelWidth)
553 {
554 channelWidth = rxWidth;
555 }
556 }
557
558 txVector.SetChannelWidth (GetChannelWidthForTransmission (mgtMode, channelWidth));
560 }
561 else
562 {
563 txVector = DoGetDataTxVector (Lookup (address));
565 }
567 if (heConfiguration)
568 {
569 txVector.SetBssColor (heConfiguration->GetBssColor ());
570 }
571 return txVector;
572}
573
576{
577 WifiMode defaultMode = GetDefaultMode ();
578 WifiPreamble defaultPreamble;
579 if (defaultMode.GetModulationClass () == WIFI_MOD_CLASS_HE)
580 {
581 defaultPreamble = WIFI_PREAMBLE_HE_SU;
582 }
583 else if (defaultMode.GetModulationClass () == WIFI_MOD_CLASS_VHT)
584 {
585 defaultPreamble = WIFI_PREAMBLE_VHT_SU;
586 }
587 else if (defaultMode.GetModulationClass () == WIFI_MOD_CLASS_HT)
588 {
589 defaultPreamble = WIFI_PREAMBLE_HT_MF;
590 }
591 else
592 {
593 defaultPreamble = WIFI_PREAMBLE_LONG;
594 }
595
596 return WifiTxVector (defaultMode,
598 defaultPreamble,
601 1,
602 0,
604 false);
605}
606
609{
610 NS_LOG_FUNCTION (this << address);
611 if (address.IsGroup ())
612 {
613 WifiMode mode = GetNonUnicastMode ();
614 WifiTxVector v;
615 v.SetMode (mode);
621 v.SetNss (1);
622 v.SetNess (0);
623 return v;
624 }
626}
627
630{
631 NS_ASSERT (!to.IsGroup ());
632 WifiMode ctsMode = GetControlAnswerMode (rtsTxMode);
633 WifiTxVector v;
634 v.SetMode (ctsMode);
638 uint16_t ctsTxGuardInterval = ConvertGuardIntervalToNanoSeconds (ctsMode, m_wifiPhy->GetDevice ());
639 v.SetGuardInterval (ctsTxGuardInterval);
640 v.SetNss (1);
641 return v;
642}
643
646{
647 NS_ASSERT (!to.IsGroup ());
648 WifiMode ackMode = GetControlAnswerMode (dataTxVector.GetMode (GetStaId (to, dataTxVector)));
649 WifiTxVector v;
650 v.SetMode (ackMode);
654 uint16_t ackTxGuardInterval = ConvertGuardIntervalToNanoSeconds (ackMode, m_wifiPhy->GetDevice ());
655 v.SetGuardInterval (ackTxGuardInterval);
656 v.SetNss (1);
657 return v;
658}
659
662{
663 NS_ASSERT (!to.IsGroup ());
664 WifiMode blockAckMode = GetControlAnswerMode (dataTxVector.GetMode (GetStaId (to, dataTxVector)));
665 WifiTxVector v;
666 v.SetMode (blockAckMode);
670 uint16_t blockAckTxGuardInterval = ConvertGuardIntervalToNanoSeconds (blockAckMode, m_wifiPhy->GetDevice ());
671 v.SetGuardInterval (blockAckTxGuardInterval);
672 v.SetNss (1);
673 return v;
674}
675
678{
693 NS_LOG_FUNCTION (this << reqMode);
694 WifiMode mode = GetDefaultMode ();
695 bool found = false;
696 //First, search the BSS Basic Rate set
697 for (uint8_t i = 0; i < GetNBasicModes (); i++)
698 {
699 WifiMode testMode = GetBasicMode (i);
700 if ((!found || testMode.IsHigherDataRate (mode))
701 && (!testMode.IsHigherDataRate (reqMode))
703 {
704 mode = testMode;
705 //We've found a potentially-suitable transmit rate, but we
706 //need to continue and consider all the basic rates before
707 //we can be sure we've got the right one.
708 found = true;
709 }
710 }
711 if (GetHtSupported ())
712 {
713 if (!found)
714 {
715 mode = GetDefaultMcs ();
716 for (uint8_t i = 0; i != GetNBasicMcs (); i++)
717 {
718 WifiMode testMode = GetBasicMcs (i);
719 if ((!found || testMode.IsHigherDataRate (mode))
720 && (!testMode.IsHigherDataRate (reqMode))
721 && (testMode.GetModulationClass () == reqMode.GetModulationClass ()))
722 {
723 mode = testMode;
724 //We've found a potentially-suitable transmit rate, but we
725 //need to continue and consider all the basic rates before
726 //we can be sure we've got the right one.
727 found = true;
728 }
729 }
730 }
731 }
732 //If we found a suitable rate in the BSSBasicRateSet, then we are
733 //done and can return that mode.
734 if (found)
735 {
736 NS_LOG_DEBUG ("WifiRemoteStationManager::GetControlAnswerMode returning " << mode);
737 return mode;
738 }
739
757 for (const auto & thismode : m_wifiPhy->GetModeList ())
758 {
759 /* If the rate:
760 *
761 * - is a mandatory rate for the PHY, and
762 * - is equal to or faster than our current best choice, and
763 * - is less than or equal to the rate of the received frame, and
764 * - is of the same modulation class as the received frame
765 *
766 * ...then it's our best choice so far.
767 */
768 if (thismode.IsMandatory ()
769 && (!found || thismode.IsHigherDataRate (mode))
770 && (!thismode.IsHigherDataRate (reqMode))
771 && (IsAllowedControlAnswerModulationClass (reqMode.GetModulationClass (), thismode.GetModulationClass ())))
772 {
773 mode = thismode;
774 //As above; we've found a potentially-suitable transmit
775 //rate, but we need to continue and consider all the
776 //mandatory rates before we can be sure we've got the right one.
777 found = true;
778 }
779 }
780 if (GetHtSupported () )
781 {
782 for (const auto & thismode : m_wifiPhy->GetMcsList ())
783 {
784 if (thismode.IsMandatory ()
785 && (!found || thismode.IsHigherDataRate (mode))
786 && (!thismode.IsHigherCodeRate (reqMode))
787 && (thismode.GetModulationClass () == reqMode.GetModulationClass ()))
788 {
789 mode = thismode;
790 //As above; we've found a potentially-suitable transmit
791 //rate, but we need to continue and consider all the
792 //mandatory rates before we can be sure we've got the right one.
793 found = true;
794 }
795 }
796 }
797
807 if (!found)
808 {
809 NS_FATAL_ERROR ("Can't find response rate for " << reqMode);
810 }
811
812 NS_LOG_DEBUG ("WifiRemoteStationManager::GetControlAnswerMode returning " << mode);
813 return mode;
814}
815
816void
818{
819 NS_LOG_FUNCTION (this << header);
820 NS_ASSERT (!header.GetAddr1 ().IsGroup ());
821 AcIndex ac = QosUtilsMapTidToAc ((header.IsQosData ()) ? header.GetQosTid () : 0);
822 m_ssrc[ac]++;
823 m_macTxRtsFailed (header.GetAddr1 ());
824 DoReportRtsFailed (Lookup (header.GetAddr1 ()));
825}
826
827void
829{
830 NS_LOG_FUNCTION (this << *mpdu);
831 NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
832 AcIndex ac = QosUtilsMapTidToAc ((mpdu->GetHeader ().IsQosData ()) ? mpdu->GetHeader ().GetQosTid () : 0);
833 bool longMpdu = (mpdu->GetSize () > m_rtsCtsThreshold);
834 if (longMpdu)
835 {
836 m_slrc[ac]++;
837 }
838 else
839 {
840 m_ssrc[ac]++;
841 }
842 m_macTxDataFailed (mpdu->GetHeader ().GetAddr1 ());
843 DoReportDataFailed (Lookup (mpdu->GetHeader ().GetAddr1 ()));
844}
845
846void
848 double ctsSnr, WifiMode ctsMode, double rtsSnr)
849{
850 NS_LOG_FUNCTION (this << header << ctsSnr << ctsMode << rtsSnr);
851 NS_ASSERT (!header.GetAddr1 ().IsGroup ());
852 WifiRemoteStation *station = Lookup (header.GetAddr1 ());
853 AcIndex ac = QosUtilsMapTidToAc ((header.IsQosData ()) ? header.GetQosTid () : 0);
854 station->m_state->m_info.NotifyTxSuccess (m_ssrc[ac]);
855 m_ssrc[ac] = 0;
856 DoReportRtsOk (station, ctsSnr, ctsMode, rtsSnr);
857}
858
859void
861 WifiMode ackMode, double dataSnr, WifiTxVector dataTxVector)
862{
863 NS_LOG_FUNCTION (this << *mpdu << ackSnr << ackMode << dataSnr << dataTxVector);
864 const WifiMacHeader& hdr = mpdu->GetHeader ();
865 NS_ASSERT (!hdr.GetAddr1 ().IsGroup ());
866 WifiRemoteStation *station = Lookup (hdr.GetAddr1 ());
867 AcIndex ac = QosUtilsMapTidToAc ((hdr.IsQosData ()) ? hdr.GetQosTid () : 0);
868 bool longMpdu = (mpdu->GetSize () > m_rtsCtsThreshold);
869 if (longMpdu)
870 {
871 station->m_state->m_info.NotifyTxSuccess (m_slrc[ac]);
872 m_slrc[ac] = 0;
873 }
874 else
875 {
876 station->m_state->m_info.NotifyTxSuccess (m_ssrc[ac]);
877 m_ssrc[ac] = 0;
878 }
879 DoReportDataOk (station, ackSnr, ackMode, dataSnr, dataTxVector.GetChannelWidth (),
880 dataTxVector.GetNss (GetStaId (hdr.GetAddr1 (), dataTxVector)));
881}
882
883void
885{
886 NS_LOG_FUNCTION (this << header);
887 NS_ASSERT (!header.GetAddr1 ().IsGroup ());
888 WifiRemoteStation *station = Lookup (header.GetAddr1 ());
889 AcIndex ac = QosUtilsMapTidToAc ((header.IsQosData ()) ? header.GetQosTid () : 0);
890 station->m_state->m_info.NotifyTxFailed ();
891 m_ssrc[ac] = 0;
893 DoReportFinalRtsFailed (station);
894}
895
896void
898{
899 NS_LOG_FUNCTION (this << *mpdu);
900 NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
901 WifiRemoteStation *station = Lookup (mpdu->GetHeader ().GetAddr1 ());
902 AcIndex ac = QosUtilsMapTidToAc ((mpdu->GetHeader ().IsQosData ()) ? mpdu->GetHeader ().GetQosTid () : 0);
903 station->m_state->m_info.NotifyTxFailed ();
904 bool longMpdu = (mpdu->GetSize () > m_rtsCtsThreshold);
905 if (longMpdu)
906 {
907 m_slrc[ac] = 0;
908 }
909 else
910 {
911 m_ssrc[ac] = 0;
912 }
913 m_macTxFinalDataFailed (mpdu->GetHeader ().GetAddr1 ());
914 DoReportFinalDataFailed (station);
915}
916
917void
919{
920 NS_LOG_FUNCTION (this << address << rxSignalInfo << txVector);
921 if (address.IsGroup ())
922 {
923 return;
924 }
925 WifiRemoteStation *station = Lookup (address);
926 DoReportRxOk (station, rxSignalInfo.snr, txVector.GetMode (GetStaId (address, txVector)));
927 station->m_rssiAndUpdateTimePair = std::make_pair (rxSignalInfo.rssi, Simulator::Now ());
928}
929
930void
932 uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus,
933 double rxSnr, double dataSnr, WifiTxVector dataTxVector)
934{
935 NS_LOG_FUNCTION (this << address << nSuccessfulMpdus << nFailedMpdus << rxSnr << dataSnr << dataTxVector);
936 NS_ASSERT (!address.IsGroup ());
937 for (uint8_t i = 0; i < nFailedMpdus; i++)
938 {
940 }
941 DoReportAmpduTxStatus (Lookup (address), nSuccessfulMpdus, nFailedMpdus, rxSnr, dataSnr, dataTxVector.GetChannelWidth (), dataTxVector.GetNss (GetStaId (address, dataTxVector)));
942}
943
944bool
946{
947 NS_LOG_FUNCTION (this << header << size);
948 Mac48Address address = header.GetAddr1 ();
949 WifiTxVector txVector = GetDataTxVector (header);
950 WifiMode mode = txVector.GetMode ();
951 if (address.IsGroup ())
952 {
953 return false;
954 }
961 {
962 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedRTS returning true to protect non-ERP stations");
963 return true;
964 }
965 else if (m_htProtectionMode == RTS_CTS
970 {
971 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedRTS returning true to protect non-HT stations");
972 return true;
973 }
974 bool normally = (size > m_rtsCtsThreshold);
975 return DoNeedRts (Lookup (address), size, normally);
976}
977
978bool
980{
981 WifiMode mode = txVector.GetMode ();
982 NS_LOG_FUNCTION (this << mode);
989 {
990 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning true to protect non-ERP stations");
991 return true;
992 }
998 {
999 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning true to protect non-HT stations");
1000 return true;
1001 }
1002 else if (!m_useNonErpProtection)
1003 {
1004 //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
1005 for (WifiModeListIterator i = m_bssBasicRateSet.begin (); i != m_bssBasicRateSet.end (); i++)
1006 {
1007 if (mode == *i)
1008 {
1009 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning false");
1010 return false;
1011 }
1012 }
1013 if (GetHtSupported ())
1014 {
1015 //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
1016 for (WifiModeListIterator i = m_bssBasicMcsSet.begin (); i != m_bssBasicMcsSet.end (); i++)
1017 {
1018 if (mode == *i)
1019 {
1020 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning false");
1021 return false;
1022 }
1023 }
1024 }
1025 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning true");
1026 return true;
1027 }
1028 return false;
1029}
1030
1031void
1033{
1034 NS_LOG_FUNCTION (this << enable);
1035 m_useNonErpProtection = enable;
1036}
1037
1038bool
1040{
1041 return m_useNonErpProtection;
1042}
1043
1044void
1046{
1047 NS_LOG_FUNCTION (this << enable);
1048 m_useNonHtProtection = enable;
1049}
1050
1051bool
1053{
1054 return m_useNonHtProtection;
1055}
1056
1057bool
1059{
1060 NS_LOG_FUNCTION (this << *mpdu);
1061 NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
1062 AcIndex ac = QosUtilsMapTidToAc ((mpdu->GetHeader ().IsQosData ()) ? mpdu->GetHeader ().GetQosTid () : 0);
1063 bool longMpdu = (mpdu->GetSize () > m_rtsCtsThreshold);
1064 uint32_t retryCount, maxRetryCount;
1065 if (longMpdu)
1066 {
1067 retryCount = m_slrc[ac];
1068 maxRetryCount = m_maxSlrc;
1069 }
1070 else
1071 {
1072 retryCount = m_ssrc[ac];
1073 maxRetryCount = m_maxSsrc;
1074 }
1075 bool normally = retryCount < maxRetryCount;
1076 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedRetransmission count: " << retryCount << " result: " << std::boolalpha << normally);
1077 return DoNeedRetransmission (Lookup (mpdu->GetHeader ().GetAddr1 ()), mpdu->GetPacket (), normally);
1078}
1079
1080bool
1082{
1083 NS_LOG_FUNCTION (this << *mpdu);
1084 if (mpdu->GetHeader ().GetAddr1 ().IsGroup ())
1085 {
1086 return false;
1087 }
1088 bool normally = mpdu->GetSize () > GetFragmentationThreshold ();
1089 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedFragmentation result: " << std::boolalpha << normally);
1090 return DoNeedFragmentation (Lookup (mpdu->GetHeader ().GetAddr1 ()), mpdu->GetPacket (), normally);
1091}
1092
1093void
1095{
1096 NS_LOG_FUNCTION (this << threshold);
1097 if (threshold < 256)
1098 {
1099 /*
1100 * ASN.1 encoding of the MAC and PHY MIB (256 ... 8000)
1101 */
1102 NS_LOG_WARN ("Fragmentation threshold should be larger than 256. Setting to 256.");
1104 }
1105 else
1106 {
1107 /*
1108 * The length of each fragment shall be an even number of octets, except for the last fragment if an MSDU or
1109 * MMPDU, which may be either an even or an odd number of octets.
1110 */
1111 if (threshold % 2 != 0)
1112 {
1113 NS_LOG_WARN ("Fragmentation threshold should be an even number. Setting to " << threshold - 1);
1114 m_fragmentationThreshold = threshold - 1;
1115 }
1116 else
1117 {
1118 m_fragmentationThreshold = threshold;
1119 }
1120 }
1121}
1122
1125{
1127}
1128
1131{
1132 NS_LOG_FUNCTION (this << *mpdu);
1133 //The number of bytes a fragment can support is (Threshold - WIFI_HEADER_SIZE - WIFI_FCS).
1134 uint32_t nFragments = (mpdu->GetPacket ()->GetSize () / (GetFragmentationThreshold () - mpdu->GetHeader ().GetSize () - WIFI_MAC_FCS_LENGTH));
1135
1136 //If the size of the last fragment is not 0.
1137 if ((mpdu->GetPacket ()->GetSize () % (GetFragmentationThreshold () - mpdu->GetHeader ().GetSize () - WIFI_MAC_FCS_LENGTH)) > 0)
1138 {
1139 nFragments++;
1140 }
1141 NS_LOG_DEBUG ("WifiRemoteStationManager::GetNFragments returning " << nFragments);
1142 return nFragments;
1143}
1144
1147{
1148 NS_LOG_FUNCTION (this << *mpdu << fragmentNumber);
1149 NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
1150 uint32_t nFragment = GetNFragments (mpdu);
1151 if (fragmentNumber >= nFragment)
1152 {
1153 NS_LOG_DEBUG ("WifiRemoteStationManager::GetFragmentSize returning 0");
1154 return 0;
1155 }
1156 //Last fragment
1157 if (fragmentNumber == nFragment - 1)
1158 {
1159 uint32_t lastFragmentSize = mpdu->GetPacket ()->GetSize () - (fragmentNumber * (GetFragmentationThreshold () - mpdu->GetHeader ().GetSize () - WIFI_MAC_FCS_LENGTH));
1160 NS_LOG_DEBUG ("WifiRemoteStationManager::GetFragmentSize returning " << lastFragmentSize);
1161 return lastFragmentSize;
1162 }
1163 //All fragments but the last, the number of bytes is (Threshold - WIFI_HEADER_SIZE - WIFI_FCS).
1164 else
1165 {
1166 uint32_t fragmentSize = GetFragmentationThreshold () - mpdu->GetHeader ().GetSize () - WIFI_MAC_FCS_LENGTH;
1167 NS_LOG_DEBUG ("WifiRemoteStationManager::GetFragmentSize returning " << fragmentSize);
1168 return fragmentSize;
1169 }
1170}
1171
1174{
1175 NS_LOG_FUNCTION (this << *mpdu << fragmentNumber);
1176 NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
1177 NS_ASSERT (fragmentNumber < GetNFragments (mpdu));
1178 uint32_t fragmentOffset = fragmentNumber * (GetFragmentationThreshold () - mpdu->GetHeader ().GetSize () - WIFI_MAC_FCS_LENGTH);
1179 NS_LOG_DEBUG ("WifiRemoteStationManager::GetFragmentOffset returning " << fragmentOffset);
1180 return fragmentOffset;
1181}
1182
1183bool
1185{
1186 NS_LOG_FUNCTION (this << *mpdu << fragmentNumber);
1187 NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
1188 bool isLast = fragmentNumber == (GetNFragments (mpdu) - 1);
1189 NS_LOG_DEBUG ("WifiRemoteStationManager::IsLastFragment returning " << std::boolalpha << isLast);
1190 return isLast;
1191}
1192
1193uint8_t
1195{
1196 return m_defaultTxPowerLevel;
1197}
1198
1201{
1203 return state->m_info;
1204}
1205
1206double
1208{
1209 auto stationIt = m_stations.find (address);
1210 NS_ASSERT_MSG (stationIt != m_stations.end(), "Address: " << address << " not found");
1211 auto station = stationIt->second;
1212 auto rssi = station->m_rssiAndUpdateTimePair.first;
1213 auto ts = station->m_rssiAndUpdateTimePair.second;
1214 NS_ASSERT_MSG (ts.IsStrictlyPositive(), "address: " << address << " ts:" << ts);
1215 return rssi;
1216}
1217
1220{
1221 NS_LOG_FUNCTION (this << address);
1222 auto stateIt = m_states.find (address);
1223
1224 if (stateIt != m_states.end ())
1225 {
1226 NS_LOG_DEBUG ("WifiRemoteStationManager::LookupState returning existing state");
1227 return stateIt->second;
1228 }
1229
1232 state->m_address = address;
1233 state->m_aid = 0;
1234 state->m_operationalRateSet.push_back (GetDefaultMode ());
1235 state->m_operationalMcsSet.push_back (GetDefaultMcs ());
1236 state->m_dsssSupported = false;
1237 state->m_erpOfdmSupported = false;
1238 state->m_ofdmSupported = false;
1239 state->m_htCapabilities = 0;
1240 state->m_vhtCapabilities = 0;
1241 state->m_heCapabilities = 0;
1244 state->m_ness = 0;
1245 state->m_aggregation = false;
1246 state->m_qosSupported = false;
1247 const_cast<WifiRemoteStationManager *> (this)->m_states.insert ({address, state});
1248 NS_LOG_DEBUG ("WifiRemoteStationManager::LookupState returning new state");
1249 return state;
1250}
1251
1252WifiRemoteStation *
1253WifiRemoteStationManager::Lookup (Mac48Address address) const
1254{
1255 NS_LOG_FUNCTION (this << address);
1256 auto stationIt = m_stations.find (address);
1257
1258 if (stationIt != m_stations.end ())
1259 {
1260 return stationIt->second;
1261 }
1262
1263 WifiRemoteStationState *state = LookupState (address);
1264
1265 WifiRemoteStation *station = DoCreateStation ();
1266 station->m_state = state;
1267 station->m_rssiAndUpdateTimePair = std::make_pair (0, Seconds (0));
1268 const_cast<WifiRemoteStationManager *> (this)->m_stations.insert ({address, station});
1269 return station;
1270}
1271
1272void
1273WifiRemoteStationManager::SetAssociationId (Mac48Address remoteAddress, uint16_t aid)
1274{
1275 NS_LOG_FUNCTION (this << remoteAddress << aid);
1276 LookupState (remoteAddress)->m_aid = aid;
1277}
1278
1279void
1280WifiRemoteStationManager::SetQosSupport (Mac48Address from, bool qosSupported)
1281{
1282 NS_LOG_FUNCTION (this << from << qosSupported);
1284 state = LookupState (from);
1285 state->m_qosSupported = qosSupported;
1286}
1287
1288void
1289WifiRemoteStationManager::AddStationHtCapabilities (Mac48Address from, HtCapabilities htCapabilities)
1290{
1291 //Used by all stations to record HT capabilities of remote stations
1292 NS_LOG_FUNCTION (this << from << htCapabilities);
1294 state = LookupState (from);
1295 if (htCapabilities.GetSupportedChannelWidth () == 1)
1296 {
1297 state->m_channelWidth = 40;
1298 }
1299 else
1300 {
1301 state->m_channelWidth = 20;
1302 }
1303 SetQosSupport (from, true);
1304 for (const auto & mcs : m_wifiPhy->GetMcsList (WIFI_MOD_CLASS_HT))
1305 {
1306 if (htCapabilities.IsSupportedMcs (mcs.GetMcsValue ()))
1307 {
1308 AddSupportedMcs (from, mcs);
1309 }
1310 }
1311 state->m_htCapabilities = Create<const HtCapabilities> (htCapabilities);
1312}
1313
1314void
1315WifiRemoteStationManager::AddStationVhtCapabilities (Mac48Address from, VhtCapabilities vhtCapabilities)
1316{
1317 //Used by all stations to record VHT capabilities of remote stations
1318 NS_LOG_FUNCTION (this << from << vhtCapabilities);
1320 state = LookupState (from);
1321 if (vhtCapabilities.GetSupportedChannelWidthSet () == 1)
1322 {
1323 state->m_channelWidth = 160;
1324 }
1325 else
1326 {
1327 state->m_channelWidth = 80;
1328 }
1329 //This is a workaround to enable users to force a 20 or 40 MHz channel for a VHT-compliant device,
1330 //since IEEE 802.11ac standard says that 20, 40 and 80 MHz channels are mandatory.
1331 if (m_wifiPhy->GetChannelWidth () < state->m_channelWidth)
1332 {
1333 state->m_channelWidth = m_wifiPhy->GetChannelWidth ();
1334 }
1335 for (uint8_t i = 1; i <= m_wifiPhy->GetMaxSupportedTxSpatialStreams (); i++)
1336 {
1337 for (const auto & mcs : m_wifiPhy->GetMcsList (WIFI_MOD_CLASS_VHT))
1338 {
1339 if (vhtCapabilities.IsSupportedMcs (mcs.GetMcsValue (), i))
1340 {
1341 AddSupportedMcs (from, mcs);
1342 }
1343 }
1344 }
1345 state->m_vhtCapabilities = Create<const VhtCapabilities> (vhtCapabilities);
1346}
1347
1348void
1349WifiRemoteStationManager::AddStationHeCapabilities (Mac48Address from, HeCapabilities heCapabilities)
1350{
1351 //Used by all stations to record HE capabilities of remote stations
1352 NS_LOG_FUNCTION (this << from << heCapabilities);
1354 state = LookupState (from);
1355 if ((m_wifiPhy->GetPhyBand () == WIFI_PHY_BAND_5GHZ) || (m_wifiPhy->GetPhyBand () == WIFI_PHY_BAND_6GHZ))
1356 {
1357 if (heCapabilities.GetChannelWidthSet () & 0x04)
1358 {
1359 state->m_channelWidth = 160;
1360 }
1361 else if (heCapabilities.GetChannelWidthSet () & 0x02)
1362 {
1363 state->m_channelWidth = 80;
1364 }
1365 //For other cases at 5 GHz, the supported channel width is set by the VHT capabilities
1366 }
1367 else if (m_wifiPhy->GetPhyBand () == WIFI_PHY_BAND_2_4GHZ)
1368 {
1369 if (heCapabilities.GetChannelWidthSet () & 0x01)
1370 {
1371 state->m_channelWidth = 40;
1372 }
1373 else
1374 {
1375 state->m_channelWidth = 20;
1376 }
1377 }
1378 if (heCapabilities.GetHeSuPpdu1xHeLtf800nsGi () == 1)
1379 {
1380 state->m_guardInterval = 800;
1381 }
1382 else
1383 {
1384 //todo: Using 3200ns, default value for HeConfiguration::GuardInterval
1385 state->m_guardInterval = 3200;
1386 }
1387 for (uint8_t i = 1; i <= m_wifiPhy->GetMaxSupportedTxSpatialStreams (); i++)
1388 {
1389 for (const auto & mcs : m_wifiPhy->GetMcsList (WIFI_MOD_CLASS_HE))
1390 {
1391 if (heCapabilities.GetHighestNssSupported () >= i
1392 && heCapabilities.GetHighestMcsSupported () >= mcs.GetMcsValue ())
1393 {
1394 AddSupportedMcs (from, mcs);
1395 }
1396 }
1397 }
1398 state->m_heCapabilities = Create<const HeCapabilities> (heCapabilities);
1399 SetQosSupport (from, true);
1400}
1401
1403WifiRemoteStationManager::GetStationHtCapabilities (Mac48Address from)
1404{
1405 return LookupState (from)->m_htCapabilities;
1406}
1407
1409WifiRemoteStationManager::GetStationVhtCapabilities (Mac48Address from)
1410{
1411 return LookupState (from)->m_vhtCapabilities;
1412}
1413
1415WifiRemoteStationManager::GetStationHeCapabilities (Mac48Address from)
1416{
1417 return LookupState (from)->m_heCapabilities;
1418}
1419
1420bool
1421WifiRemoteStationManager::GetLdpcSupported (Mac48Address address) const
1422{
1423 Ptr<const HtCapabilities> htCapabilities = LookupState (address)->m_htCapabilities;
1424 Ptr<const VhtCapabilities> vhtCapabilities = LookupState (address)->m_vhtCapabilities;
1425 Ptr<const HeCapabilities> heCapabilities = LookupState (address)->m_heCapabilities;
1426 bool supported = false;
1427 if (htCapabilities)
1428 {
1429 supported |= htCapabilities->GetLdpc ();
1430 }
1431 if (vhtCapabilities)
1432 {
1433 supported |= vhtCapabilities->GetRxLdpc ();
1434 }
1435 if (heCapabilities)
1436 {
1437 supported |= heCapabilities->GetLdpcCodingInPayload ();
1438 }
1439 return supported;
1440}
1441
1443WifiRemoteStationManager::GetDefaultMode (void) const
1444{
1445 return m_defaultTxMode;
1446}
1447
1449WifiRemoteStationManager::GetDefaultMcs (void) const
1450{
1451 return m_defaultTxMcs;
1452}
1453
1455WifiRemoteStationManager::GetDefaultModeForSta (const WifiRemoteStation *st) const
1456{
1457 NS_LOG_FUNCTION (this << st);
1458
1459 if (!GetHtSupported () || !GetHtSupported (st))
1460 {
1461 return GetDefaultMode ();
1462 }
1463
1464 // find the highest modulation class supported by both stations
1466 if (GetHeSupported () && GetHeSupported (st))
1467 {
1468 modClass = WIFI_MOD_CLASS_HE;
1469 }
1470 else if (GetVhtSupported () && GetVhtSupported (st))
1471 {
1472 modClass = WIFI_MOD_CLASS_VHT;
1473 }
1474
1475 // return the MCS with lowest index
1476 return *m_wifiPhy->GetPhyEntity (modClass)->begin ();
1477}
1478
1479void
1481{
1482 NS_LOG_FUNCTION (this);
1483 for (auto& state : m_states)
1484 {
1485 delete (state.second);
1486 }
1487 m_states.clear ();
1488 for (auto& state: m_stations)
1489 {
1490 delete (state.second);
1491 }
1492 m_stations.clear ();
1493 m_bssBasicRateSet.clear ();
1494 m_bssBasicMcsSet.clear ();
1495 m_ssrc.fill (0);
1496 m_slrc.fill (0);
1497}
1498
1499void
1500WifiRemoteStationManager::AddBasicMode (WifiMode mode)
1501{
1502 NS_LOG_FUNCTION (this << mode);
1504 {
1505 NS_FATAL_ERROR ("It is not allowed to add a HT rate in the BSSBasicRateSet!");
1506 }
1507 for (uint8_t i = 0; i < GetNBasicModes (); i++)
1508 {
1509 if (GetBasicMode (i) == mode)
1510 {
1511 return;
1512 }
1513 }
1514 m_bssBasicRateSet.push_back (mode);
1515}
1516
1517uint8_t
1518WifiRemoteStationManager::GetNBasicModes (void) const
1519{
1520 return static_cast<uint8_t> (m_bssBasicRateSet.size ());
1521}
1522
1524WifiRemoteStationManager::GetBasicMode (uint8_t i) const
1525{
1526 NS_ASSERT (i < GetNBasicModes ());
1527 return m_bssBasicRateSet[i];
1528}
1529
1531WifiRemoteStationManager::GetNNonErpBasicModes (void) const
1532{
1533 uint32_t size = 0;
1534 for (WifiModeListIterator i = m_bssBasicRateSet.begin (); i != m_bssBasicRateSet.end (); i++)
1535 {
1536 if (i->GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
1537 {
1538 continue;
1539 }
1540 size++;
1541 }
1542 return size;
1543}
1544
1546WifiRemoteStationManager::GetNonErpBasicMode (uint8_t i) const
1547{
1548 NS_ASSERT (i < GetNNonErpBasicModes ());
1549 uint32_t index = 0;
1550 bool found = false;
1551 for (WifiModeListIterator j = m_bssBasicRateSet.begin (); j != m_bssBasicRateSet.end (); )
1552 {
1553 if (i == index)
1554 {
1555 found = true;
1556 }
1557 if (j->GetModulationClass () != WIFI_MOD_CLASS_ERP_OFDM)
1558 {
1559 if (found)
1560 {
1561 break;
1562 }
1563 }
1564 index++;
1565 j++;
1566 }
1567 return m_bssBasicRateSet[index];
1568}
1569
1570void
1571WifiRemoteStationManager::AddBasicMcs (WifiMode mcs)
1572{
1573 NS_LOG_FUNCTION (this << +mcs.GetMcsValue ());
1574 for (uint8_t i = 0; i < GetNBasicMcs (); i++)
1575 {
1576 if (GetBasicMcs (i) == mcs)
1577 {
1578 return;
1579 }
1580 }
1581 m_bssBasicMcsSet.push_back (mcs);
1582}
1583
1584uint8_t
1585WifiRemoteStationManager::GetNBasicMcs (void) const
1586{
1587 return static_cast<uint8_t> (m_bssBasicMcsSet.size ());
1588}
1589
1591WifiRemoteStationManager::GetBasicMcs (uint8_t i) const
1592{
1593 NS_ASSERT (i < GetNBasicMcs ());
1594 return m_bssBasicMcsSet[i];
1595}
1596
1598WifiRemoteStationManager::GetNonUnicastMode (void) const
1599{
1600 if (m_nonUnicastMode == WifiMode ())
1601 {
1602 if (GetNBasicModes () > 0)
1603 {
1604 return GetBasicMode (0);
1605 }
1606 else
1607 {
1608 return GetDefaultMode ();
1609 }
1610 }
1611 else
1612 {
1613 return m_nonUnicastMode;
1614 }
1615}
1616
1617bool
1618WifiRemoteStationManager::DoNeedRts (WifiRemoteStation *station,
1619 uint32_t size, bool normally)
1620{
1621 return normally;
1622}
1623
1624bool
1625WifiRemoteStationManager::DoNeedRetransmission (WifiRemoteStation *station,
1626 Ptr<const Packet> packet, bool normally)
1627{
1628 return normally;
1629}
1630
1631bool
1632WifiRemoteStationManager::DoNeedFragmentation (WifiRemoteStation *station,
1633 Ptr<const Packet> packet, bool normally)
1634{
1635 return normally;
1636}
1637
1638void
1639WifiRemoteStationManager::DoReportAmpduTxStatus (WifiRemoteStation *station, uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus, double rxSnr, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
1640{
1641 NS_LOG_DEBUG ("DoReportAmpduTxStatus received but the manager does not handle A-MPDUs!");
1642}
1643
1645WifiRemoteStationManager::GetSupported (const WifiRemoteStation *station, uint8_t i) const
1646{
1647 NS_ASSERT (i < GetNSupported (station));
1648 return station->m_state->m_operationalRateSet[i];
1649}
1650
1652WifiRemoteStationManager::GetMcsSupported (const WifiRemoteStation *station, uint8_t i) const
1653{
1654 NS_ASSERT (i < GetNMcsSupported (station));
1655 return station->m_state->m_operationalMcsSet[i];
1656}
1657
1659WifiRemoteStationManager::GetNonErpSupported (const WifiRemoteStation *station, uint8_t i) const
1660{
1661 NS_ASSERT (i < GetNNonErpSupported (station));
1662 //IEEE 802.11g standard defines that if the protection mechanism is enabled, RTS, CTS and CTS-To-Self
1663 //frames should select a rate in the BSSBasicRateSet that corresponds to an 802.11b basic rate.
1664 //This is a implemented here to avoid changes in every RAA, but should maybe be moved in case it breaks standard rules.
1665 uint32_t index = 0;
1666 bool found = false;
1667 for (WifiModeListIterator j = station->m_state->m_operationalRateSet.begin (); j != station->m_state->m_operationalRateSet.end (); )
1668 {
1669 if (i == index)
1670 {
1671 found = true;
1672 }
1673 if (j->GetModulationClass () != WIFI_MOD_CLASS_ERP_OFDM)
1674 {
1675 if (found)
1676 {
1677 break;
1678 }
1679 }
1680 index++;
1681 j++;
1682 }
1683 return station->m_state->m_operationalRateSet[index];
1684}
1685
1687WifiRemoteStationManager::GetAddress (const WifiRemoteStation *station) const
1688{
1689 return station->m_state->m_address;
1690}
1691
1692uint16_t
1693WifiRemoteStationManager::GetChannelWidth (const WifiRemoteStation *station) const
1694{
1695 return station->m_state->m_channelWidth;
1696}
1697
1698bool
1699WifiRemoteStationManager::GetShortGuardIntervalSupported (const WifiRemoteStation *station) const
1700{
1701 Ptr<const HtCapabilities> htCapabilities = station->m_state->m_htCapabilities;
1702
1703 if (!htCapabilities)
1704 {
1705 return false;
1706 }
1707 return htCapabilities->GetShortGuardInterval20 ();
1708}
1709
1710uint16_t
1711WifiRemoteStationManager::GetGuardInterval (const WifiRemoteStation *station) const
1712{
1713 return station->m_state->m_guardInterval;
1714}
1715
1716bool
1717WifiRemoteStationManager::GetAggregation (const WifiRemoteStation *station) const
1718{
1719 return station->m_state->m_aggregation;
1720}
1721
1722uint8_t
1723WifiRemoteStationManager::GetNumberOfSupportedStreams (const WifiRemoteStation *station) const
1724{
1725 Ptr<const HtCapabilities> htCapabilities = station->m_state->m_htCapabilities;
1726
1727 if (!htCapabilities)
1728 {
1729 return 1;
1730 }
1731 return htCapabilities->GetRxHighestSupportedAntennas ();
1732}
1733
1734uint8_t
1735WifiRemoteStationManager::GetNess (const WifiRemoteStation *station) const
1736{
1737 return station->m_state->m_ness;
1738}
1739
1741WifiRemoteStationManager::GetPhy (void) const
1742{
1743 return m_wifiPhy;
1744}
1745
1747WifiRemoteStationManager::GetMac (void) const
1748{
1749 return m_wifiMac;
1750}
1751
1752uint8_t
1753WifiRemoteStationManager::GetNSupported (const WifiRemoteStation *station) const
1754{
1755 return static_cast<uint8_t> (station->m_state->m_operationalRateSet.size ());
1756}
1757
1758bool
1759WifiRemoteStationManager::GetQosSupported (const WifiRemoteStation *station) const
1760{
1761 return station->m_state->m_qosSupported;
1762}
1763
1764bool
1765WifiRemoteStationManager::GetHtSupported (const WifiRemoteStation *station) const
1766{
1767 return (station->m_state->m_htCapabilities != 0);
1768}
1769
1770bool
1771WifiRemoteStationManager::GetVhtSupported (const WifiRemoteStation *station) const
1772{
1773 return (station->m_state->m_vhtCapabilities != 0);
1774}
1775
1776bool
1777WifiRemoteStationManager::GetHeSupported (const WifiRemoteStation *station) const
1778{
1779 return (station->m_state->m_heCapabilities != 0);
1780}
1781
1782uint8_t
1783WifiRemoteStationManager::GetNMcsSupported (const WifiRemoteStation *station) const
1784{
1785 return static_cast<uint8_t> (station->m_state->m_operationalMcsSet.size ());
1786}
1787
1789WifiRemoteStationManager::GetNNonErpSupported (const WifiRemoteStation *station) const
1790{
1791 uint32_t size = 0;
1792 for (WifiModeListIterator i = station->m_state->m_operationalRateSet.begin (); i != station->m_state->m_operationalRateSet.end (); i++)
1793 {
1794 if (i->GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
1795 {
1796 continue;
1797 }
1798 size++;
1799 }
1800 return size;
1801}
1802
1803uint16_t
1804WifiRemoteStationManager::GetChannelWidthSupported (Mac48Address address) const
1805{
1806 return LookupState (address)->m_channelWidth;
1807}
1808
1809bool
1810WifiRemoteStationManager::GetShortGuardIntervalSupported (Mac48Address address) const
1811{
1812 Ptr<const HtCapabilities> htCapabilities = LookupState (address)->m_htCapabilities;
1813
1814 if (!htCapabilities)
1815 {
1816 return false;
1817 }
1818 return htCapabilities->GetShortGuardInterval20 ();
1819}
1820
1821uint8_t
1822WifiRemoteStationManager::GetNumberOfSupportedStreams (Mac48Address address) const
1823{
1824 Ptr<const HtCapabilities> htCapabilities = LookupState (address)->m_htCapabilities;
1825
1826 if (!htCapabilities)
1827 {
1828 return 1;
1829 }
1830 return htCapabilities->GetRxHighestSupportedAntennas ();
1831}
1832
1833uint8_t
1834WifiRemoteStationManager::GetNMcsSupported (Mac48Address address) const
1835{
1836 return static_cast<uint8_t> (LookupState (address)->m_operationalMcsSet.size ());
1837}
1838
1839bool
1840WifiRemoteStationManager::GetDsssSupported (const Mac48Address& address) const
1841{
1842 return (LookupState (address)->m_dsssSupported);
1843}
1844
1845bool
1846WifiRemoteStationManager::GetErpOfdmSupported (const Mac48Address& address) const
1847{
1848 return (LookupState (address)->m_erpOfdmSupported);
1849}
1850
1851bool
1852WifiRemoteStationManager::GetOfdmSupported (const Mac48Address& address) const
1853{
1854 return (LookupState (address)->m_ofdmSupported);
1855}
1856
1857bool
1858WifiRemoteStationManager::GetHtSupported (Mac48Address address) const
1859{
1860 return (LookupState (address)->m_htCapabilities != 0);
1861}
1862
1863bool
1864WifiRemoteStationManager::GetVhtSupported (Mac48Address address) const
1865{
1866 return (LookupState (address)->m_vhtCapabilities != 0);
1867}
1868
1869bool
1870WifiRemoteStationManager::GetHeSupported (Mac48Address address) const
1871{
1872 return (LookupState (address)->m_heCapabilities != 0);
1873}
1874
1875void
1876WifiRemoteStationManager::SetDefaultTxPowerLevel (uint8_t txPower)
1877{
1878 m_defaultTxPowerLevel = txPower;
1879}
1880
1881uint8_t
1882WifiRemoteStationManager::GetNumberOfAntennas (void) const
1883{
1884 return m_wifiPhy->GetNumberOfAntennas ();
1885}
1886
1887uint8_t
1888WifiRemoteStationManager::GetMaxNumberOfTransmitStreams (void) const
1889{
1890 return m_wifiPhy->GetMaxSupportedTxSpatialStreams ();
1891}
1892
1893bool
1894WifiRemoteStationManager::UseLdpcForDestination (Mac48Address dest) const
1895{
1896 return (GetLdpcSupported () && GetLdpcSupported (dest));
1897}
1898
1899} //namespace ns3
Hold variables of type enum.
Definition: enum.h:55
The IEEE 802.11ax HE Capabilities.
uint8_t GetHighestMcsSupported(void) const
Get highest MCS supported.
bool GetHeSuPpdu1xHeLtf800nsGi(void) const
Get 1xHE-LTF and 800ns GI in HE SU PPDU reception support.
uint8_t GetChannelWidthSet(void) const
Get channel width set.
uint8_t GetHighestNssSupported(void) const
Get highest NSS supported.
The HT Capabilities Information Element.
bool IsSupportedMcs(uint8_t mcs) const
Return the is MCS supported flag.
uint8_t GetSupportedChannelWidth(void) const
Return the supported channel width.
static WifiMode GetHtMcs(uint8_t index)
Return the HT MCS corresponding to the provided index.
Definition: ht-phy.cc:457
an EUI-48 address
Definition: mac48-address.h:44
bool IsGroup(void) const
A base class which provides memory management and object aggregation.
Definition: object.h:88
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
uint16_t GetAssociationId(void) const
Return the association ID.
bool IsAssociated(void) const
Return whether we are associated with an AP.
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
Hold an unsigned integer type.
Definition: uinteger.h:44
The IEEE 802.11ac VHT Capabilities.
bool IsSupportedMcs(uint8_t mcs, uint8_t nss) const
Get the is MCS supported.
uint8_t GetSupportedChannelWidthSet() const
Get the supported channel width set.
Implements the IEEE 802.11 MAC header.
uint8_t GetQosTid(void) const
Return the Traffic ID of a QoS header.
bool IsQosData(void) const
Return true if the Type is DATA and Subtype is one of the possible values for QoS Data.
bool IsMgt(void) const
Return true if the Type is Management.
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
represent a single transmission mode
Definition: wifi-mode.h:48
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:155
bool IsHigherDataRate(WifiMode mode) const
Definition: wifi-mode.cc:199
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:177
bool IsMandatory(void) const
Definition: wifi-mode.cc:148
AttributeValue implementation for WifiMode.
Ptr< HtConfiguration > GetHtConfiguration(void) const
Ptr< VhtConfiguration > GetVhtConfiguration(void) const
Ptr< HeConfiguration > GetHeConfiguration(void) const
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:1767
Ptr< WifiNetDevice > GetDevice(void) const
Return the device this PHY is associated with.
Definition: wifi-phy.cc:541
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:1718
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:918
TID independent remote station statistics.
void NotifyTxSuccess(uint32_t retryCounter)
Updates average frame error rate when data or RTS was transmitted successfully.
void NotifyTxFailed()
Updates average frame error rate when final data or RTS has failed.
hold a list of per-remote-station state.
bool GetQosSupported(Mac48Address address) const
Return whether the given station is QoS capable.
bool GetLdpcSupported(void) const
Return whether the device has LDPC support enabled.
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...
virtual bool DoNeedFragmentation(WifiRemoteStation *station, Ptr< const Packet > packet, bool normally)
WifiMode GetDefaultMode(void) const
Return the default transmission mode.
uint32_t m_fragmentationThreshold
Current threshold for fragmentation.
void SetShortSlotTimeEnabled(bool enable)
Enable or disable short slot time.
void AddBasicMode(WifiMode mode)
Invoked in a STA upon association to store the set of rates which belong to the BSSBasicRateSet of th...
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
bool NeedFragmentation(Ptr< const WifiMacQueueItem > mpdu)
uint16_t GetAssociationId(Mac48Address remoteAddress) const
Get the AID of a remote station.
WifiMode m_defaultTxMcs
The default transmission modulation-coding scheme (MCS)
ProtectionMode m_htProtectionMode
Protection mode for HT stations when non-HT stations are detected.
std::array< uint32_t, AC_BE_NQOS > m_slrc
long retry count per AC
WifiRemoteStation * Lookup(Mac48Address address) const
Return the station associated with the given address.
WifiMode GetDefaultMcs(void) const
Return the default Modulation and Coding Scheme (MCS) index.
bool UseLdpcForDestination(Mac48Address dest) const
uint32_t m_maxSsrc
Maximum STA short retry count (SSRC)
void SetRtsCtsThreshold(uint32_t threshold)
Sets the RTS threshold.
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...
TracedCallback< Mac48Address > m_macTxRtsFailed
The trace source fired when the transmission of a single RTS has failed.
virtual bool DoNeedRts(WifiRemoteStation *station, uint32_t size, bool normally)
void DoSetFragmentationThreshold(uint32_t threshold)
Actually sets the fragmentation threshold, it also checks the validity of the given threshold.
bool IsBrandNew(Mac48Address address) const
Return whether the station state is brand new.
virtual void DoReportFinalDataFailed(WifiRemoteStation *station)=0
This method is a pure virtual method that must be implemented by the sub-class.
uint32_t DoGetFragmentationThreshold(void) const
Return the current fragmentation threshold.
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.
bool GetVhtSupported(void) const
Return whether the device has VHT capability support enabled.
uint8_t GetNBasicMcs(void) const
Return the number of basic MCS index.
virtual void DoReportDataFailed(WifiRemoteStation *station)=0
This method is a pure virtual method that must be implemented by the sub-class.
bool NeedRts(const WifiMacHeader &header, uint32_t size)
virtual void DoDispose(void)
Destructor implementation.
void SetUseNonErpProtection(bool enable)
Enable or disable protection for non-ERP stations.
bool m_useNonHtProtection
flag if protection for non-HT stations against HT transmissions is enabled
bool GetShortPreambleSupported(Mac48Address address) const
Return whether the station supports short PHY preamble or not.
uint32_t GetFragmentSize(Ptr< const WifiMacQueueItem > mpdu, uint32_t fragmentNumber)
uint8_t GetNBasicModes(void) const
Return the number of basic modes we support.
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...
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.
uint32_t GetFragmentOffset(Ptr< const WifiMacQueueItem > mpdu, uint32_t fragmentNumber)
void AddSupportedMcs(Mac48Address address, WifiMode mcs)
Record the MCS index supported by the station.
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 GetUseNonErpProtection(void) const
Return whether the device supports protection of non-ERP stations.
void RemoveAllSupportedMcs(Mac48Address address)
Invoked in a STA or AP to delete all of the supported MCS by a destination.
WifiModeList m_bssBasicMcsSet
basic MCS set
virtual WifiTxVector DoGetDataTxVector(WifiRemoteStation *station)=0
TracedCallback< Mac48Address > m_macTxFinalRtsFailed
The trace source fired when the transmission of a RTS has exceeded the maximum number of attempts.
void ReportDataFailed(Ptr< const WifiMacQueueItem > mpdu)
Should be invoked whenever the AckTimeout associated to a transmission attempt expires.
bool m_shortPreambleEnabled
flag if short PHY preamble is enabled
bool GetShortSlotTimeSupported(Mac48Address address) const
Return whether the station supports short ERP slot time or not.
void SetShortPreambleEnabled(bool enable)
Enable or disable short PHY preambles.
WifiMode GetNonUnicastMode(void) const
Return a mode for non-unicast packets.
Ptr< WifiPhy > m_wifiPhy
This is a pointer to the WifiPhy associated with this WifiRemoteStationManager that is set on call to...
WifiTxVector GetDataTxVector(const WifiMacHeader &header)
void ReportRxOk(Mac48Address address, RxSignalInfo rxSignalInfo, WifiTxVector txVector)
WifiRemoteStationState * LookupState(Mac48Address address) const
Return the state of the station associated with the given address.
uint8_t m_defaultTxPowerLevel
Default transmission power level.
WifiMode m_nonUnicastMode
Transmission mode for non-unicast Data frames.
void SetUseNonHtProtection(bool enable)
Enable or disable protection for non-HT stations.
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.
bool IsAssociated(Mac48Address address) const
Return whether the station associated.
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...
double GetMostRecentRssi(Mac48Address address) const
uint32_t GetNFragments(Ptr< const WifiMacQueueItem > mpdu)
Return the number of fragments needed for the given packet.
WifiRemoteStationInfo GetInfo(Mac48Address address)
void RecordWaitAssocTxOk(Mac48Address address)
Records that we are waiting for an ACK for the association response we sent.
void SetFragmentationThreshold(uint32_t threshold)
Sets a fragmentation threshold.
Ptr< WifiMac > m_wifiMac
This is a pointer to the WifiMac associated with this WifiRemoteStationManager that is set on call to...
uint32_t GetFragmentationThreshold(void) const
Return the fragmentation threshold.
void RecordGotAssocTxOk(Mac48Address address)
Records that we got an ACK for the association response we sent.
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...
std::array< uint32_t, AC_BE_NQOS > m_ssrc
short retry count per AC
bool GetShortPreambleEnabled(void) const
Return whether the device uses short PHY preambles.
void ReportFinalRtsFailed(const WifiMacHeader &header)
Should be invoked after calling ReportRtsFailed if NeedRetransmission returns false.
StationStates m_states
States of known stations.
bool NeedCtsToSelf(WifiTxVector txVector)
Return if we need to do CTS-to-self before sending a DATA.
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.
static TypeId GetTypeId(void)
Get the type ID.
void SetMaxSsrc(uint32_t maxSsrc)
Sets the maximum STA short retry count (SSRC).
WifiMode GetBasicMcs(uint8_t i) const
Return the MCS at the given list index.
TracedCallback< Mac48Address > m_macTxDataFailed
The trace source fired when the transmission of a single data packet has failed.
void ReportFinalDataFailed(Ptr< const WifiMacQueueItem > mpdu)
Should be invoked after calling ReportDataFailed if NeedRetransmission returns false.
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...
WifiMode GetBasicMode(uint8_t i) const
Return a basic mode from the set of basic modes.
void AddSupportedPhyPreamble(Mac48Address address, bool isShortPreambleSupported)
Record whether the short PHY preamble is supported by the station.
WifiTxVector GetCtsToSelfTxVector(void)
Since CTS-to-self parameters are not dependent on the station, it is implemented in wifi remote stati...
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...
virtual void DoReportRtsFailed(WifiRemoteStation *station)=0
This method is a pure virtual method that must be implemented by the sub-class.
void RecordDisassociated(Mac48Address address)
Records that the STA was disassociated.
Stations m_stations
Information for each known stations.
virtual WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station)=0
bool GetHeSupported(void) const
Return whether the device has HE capability support enabled.
uint16_t GetChannelWidthSupported(Mac48Address address) const
Return the channel width supported by the station.
uint32_t m_maxSlrc
Maximum STA long retry count (SLRC)
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...
ProtectionMode m_erpProtectionMode
Protection mode for ERP stations when non-ERP stations are detected.
WifiModeList m_bssBasicRateSet
This member is the list of WifiMode objects that comprise the BSSBasicRateSet parameter.
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.
void Reset(void)
Reset the station, invoked in a STA upon dis-association or in an AP upon reboot.
bool GetUseNonHtProtection(void) const
Return whether the device supports protection of non-HT stations.
void ReportRtsFailed(const WifiMacHeader &header)
Should be invoked whenever the RtsTimeout associated to a transmission attempt expires.
void AddSupportedErpSlotTime(Mac48Address address, bool isShortSlotTimeSupported)
Record whether the short ERP slot time is supported by the station.
bool GetShortGuardIntervalSupported(void) const
Return whether the device has SGI support enabled.
WifiMode m_defaultTxMode
The default transmission mode.
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.
virtual bool DoNeedRetransmission(WifiRemoteStation *station, Ptr< const Packet > packet, bool normally)
bool GetHtSupported(void) const
Return whether the device has HT capability support enabled.
bool NeedRetransmission(Ptr< const WifiMacQueueItem > mpdu)
void RecordGotAssocTxFailed(Mac48Address address)
Records that we missed an ACK for the association response we sent.
virtual void DoReportFinalRtsFailed(WifiRemoteStation *station)=0
This method is a pure virtual method that must be implemented by the sub-class.
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...
bool IsLastFragment(Ptr< const WifiMacQueueItem > mpdu, uint32_t fragmentNumber)
uint16_t GetGuardInterval(void) const
Return the supported HE guard interval duration (in nanoseconds).
bool GetShortSlotTimeEnabled(void) const
Return whether the device uses short slot time.
WifiTxVector GetRtsTxVector(Mac48Address address)
uint32_t m_rtsCtsThreshold
Threshold for RTS/CTS.
bool m_useNonErpProtection
flag if protection for non-ERP stations against ERP transmissions is enabled
WifiMode GetControlAnswerMode(WifiMode reqMode) const
Get control answer mode function.
bool m_shortSlotTimeEnabled
flag if short slot time is enabled
bool IsWaitAssocTxOk(Mac48Address address) const
Return whether we are waiting for an ACK for the association response we sent.
void SetMaxSlrc(uint32_t maxSlrc)
Sets the maximum STA long retry count (SLRC).
TracedCallback< Mac48Address > m_macTxFinalDataFailed
The trace source fired when the transmission of a data packet has exceeded the maximum number of atte...
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
void SetNess(uint8_t ness)
Sets the Ness number.
void SetTxPowerLevel(uint8_t powerlevel)
Sets the selected transmission power level.
void SetLdpc(bool ldpc)
Sets if LDPC FEC coding is being used.
void SetChannelWidth(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
void SetGuardInterval(uint16_t guardInterval)
Sets the guard interval duration (in nanoseconds)
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.
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.
bool IsMu(void) const
Return true if this TX vector is used for a multi-user transmission.
void SetBssColor(uint8_t color)
Set the BSS color.
void SetNTx(uint8_t nTx)
Sets the number of TX antennas.
uint16_t GetChannelWidth(void) const
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
void SetNss(uint8_t nss)
Sets the number of Nss.
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
#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
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:88
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Definition: enum.h:205
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition: uinteger.h:45
void Reset(void)
Reset the initial value of every attribute as well as the value of every global to what they were bef...
Definition: config.cc:820
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:265
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1244
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
Definition: qos-utils.cc:126
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:71
@ WIFI_PREAMBLE_LONG
@ WIFI_PREAMBLE_HE_SU
@ WIFI_PREAMBLE_VHT_SU
@ WIFI_PREAMBLE_HT_MF
@ WIFI_PHY_BAND_6GHZ
The 6 GHz band.
Definition: wifi-phy-band.h:39
@ WIFI_PHY_BAND_2_4GHZ
The 2.4 GHz band.
Definition: wifi-phy-band.h:35
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Definition: wifi-phy-band.h:37
@ WIFI_MOD_CLASS_OFDM
OFDM (Clause 17)
@ WIFI_MOD_CLASS_HR_DSSS
HR/DSSS (Clause 16)
@ WIFI_MOD_CLASS_HT
HT (Clause 19)
@ WIFI_MOD_CLASS_VHT
VHT (Clause 22)
@ WIFI_MOD_CLASS_HE
HE (Clause 27)
@ WIFI_MOD_CLASS_DSSS
DSSS (Clause 15)
@ WIFI_MOD_CLASS_ERP_OFDM
ERP-OFDM (18.4)
address
Definition: first.py:44
Every class exported by the ns3 library is enclosed in the ns3 namespace.
@ STA
Definition: wifi-mac.h:53
@ AP
Definition: wifi-mac.h:54
static const uint16_t WIFI_MAC_FCS_LENGTH
The length in octects of the IEEE 802.11 MAC FCS field.
bool IsAllowedControlAnswerModulationClass(WifiModulationClass modClassReq, WifiModulationClass modClassAnswer)
Return whether the modulation class of the selected mode for the control answer frame is allowed.
WifiModeList::const_iterator WifiModeListIterator
An iterator for WifiModeList vector.
Definition: wifi-mode.h:264
uint16_t GetChannelWidthForTransmission(WifiMode mode, uint16_t maxAllowedChannelWidth)
Return the channel width that is allowed based on the selected mode and the given maximum channel wid...
uint16_t ConvertGuardIntervalToNanoSeconds(WifiMode mode, const Ptr< WifiNetDevice > device)
Convert the guard interval to nanoseconds based on the WifiMode.
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble)
Return the preamble to be used for the transmission.
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:162
mac
Definition: third.py:96
phy
Definition: third.py:93
RxSignalInfo structure containing info on the received signal.
Definition: phy-entity.h:67
double rssi
RSSI in dBm.
Definition: phy-entity.h:69
double snr
SNR in linear scale.
Definition: phy-entity.h:68
hold per-remote-station state.
WifiRemoteStationState * m_state
Remote station state.
std::pair< double, Time > m_rssiAndUpdateTimePair
RSSI (in dBm) of the most recent packet received from the remote station along with update time.
A struct that holds information about each remote station.
Mac48Address m_address
Mac48Address of the remote station.
bool m_shortSlotTime
Flag if short ERP slot time is supported by the remote station.
bool m_dsssSupported
Flag if DSSS is supported by the remote station.
uint16_t m_channelWidth
Channel width (in MHz) supported by the remote station.
uint16_t m_aid
AID of the remote station (unused if this object is installed on a non-AP station)
bool m_ofdmSupported
Flag if OFDM is supported by the remote station.
uint8_t m_ness
Number of extended spatial streams of the remote station.
bool m_aggregation
Flag if MPDU aggregation is used by the remote station.
bool m_qosSupported
Flag if QoS is supported by the station.
WifiModeList m_operationalRateSet
This member is the list of WifiMode objects that comprise the OperationalRateSet parameter for this r...
WifiModeList m_operationalMcsSet
operational MCS set
uint16_t m_guardInterval
HE Guard interval duration (in nanoseconds) supported by the remote station.
bool m_shortPreamble
Flag if short PHY preamble is supported by the remote station.
bool m_erpOfdmSupported
Flag if ERP OFDM is supported by the remote station.
Ptr< const VhtCapabilities > m_vhtCapabilities
remote station VHT capabilities
enum ns3::WifiRemoteStationState::@77 m_state
State of the station.
WifiRemoteStationInfo m_info
remote station info
Ptr< const HtCapabilities > m_htCapabilities
remote station HT capabilities
Ptr< const HeCapabilities > m_heCapabilities
remote station HE capabilities
#define SU_STA_ID
Definition: wifi-mode.h:32