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);
550 }
551 else
552 {
553 txVector = DoGetDataTxVector (Lookup (address));
555 }
557 if (heConfiguration)
558 {
559 txVector.SetBssColor (heConfiguration->GetBssColor ());
560 }
561 return txVector;
562}
563
566{
567 WifiMode defaultMode = GetDefaultMode ();
568 WifiPreamble defaultPreamble;
569 if (defaultMode.GetModulationClass () == WIFI_MOD_CLASS_HE)
570 {
571 defaultPreamble = WIFI_PREAMBLE_HE_SU;
572 }
573 else if (defaultMode.GetModulationClass () == WIFI_MOD_CLASS_VHT)
574 {
575 defaultPreamble = WIFI_PREAMBLE_VHT_SU;
576 }
577 else if (defaultMode.GetModulationClass () == WIFI_MOD_CLASS_HT)
578 {
579 defaultPreamble = WIFI_PREAMBLE_HT_MF;
580 }
581 else
582 {
583 defaultPreamble = WIFI_PREAMBLE_LONG;
584 }
585
586 return WifiTxVector (defaultMode,
588 defaultPreamble,
591 1,
592 0,
594 false);
595}
596
599{
600 NS_LOG_FUNCTION (this << address);
601 if (address.IsGroup ())
602 {
603 WifiMode mode = GetNonUnicastMode ();
604 WifiTxVector v;
605 v.SetMode (mode);
611 v.SetNss (1);
612 v.SetNess (0);
613 return v;
614 }
616}
617
620{
621 NS_ASSERT (!to.IsGroup ());
622 WifiMode ctsMode = GetControlAnswerMode (rtsTxMode);
623 WifiTxVector v;
624 v.SetMode (ctsMode);
628 uint16_t ctsTxGuardInterval = ConvertGuardIntervalToNanoSeconds (ctsMode, m_wifiPhy->GetDevice ());
629 v.SetGuardInterval (ctsTxGuardInterval);
630 v.SetNss (1);
631 return v;
632}
633
636{
637 NS_ASSERT (!to.IsGroup ());
638 WifiMode ackMode = GetControlAnswerMode (dataTxVector.GetMode (GetStaId (to, dataTxVector)));
639 WifiTxVector v;
640 v.SetMode (ackMode);
644 uint16_t ackTxGuardInterval = ConvertGuardIntervalToNanoSeconds (ackMode, m_wifiPhy->GetDevice ());
645 v.SetGuardInterval (ackTxGuardInterval);
646 v.SetNss (1);
647 return v;
648}
649
652{
653 NS_ASSERT (!to.IsGroup ());
654 WifiMode blockAckMode = GetControlAnswerMode (dataTxVector.GetMode (GetStaId (to, dataTxVector)));
655 WifiTxVector v;
656 v.SetMode (blockAckMode);
660 uint16_t blockAckTxGuardInterval = ConvertGuardIntervalToNanoSeconds (blockAckMode, m_wifiPhy->GetDevice ());
661 v.SetGuardInterval (blockAckTxGuardInterval);
662 v.SetNss (1);
663 return v;
664}
665
668{
683 NS_LOG_FUNCTION (this << reqMode);
684 WifiMode mode = GetDefaultMode ();
685 bool found = false;
686 //First, search the BSS Basic Rate set
687 for (uint8_t i = 0; i < GetNBasicModes (); i++)
688 {
689 WifiMode testMode = GetBasicMode (i);
690 if ((!found || testMode.IsHigherDataRate (mode))
691 && (!testMode.IsHigherDataRate (reqMode))
693 {
694 mode = testMode;
695 //We've found a potentially-suitable transmit rate, but we
696 //need to continue and consider all the basic rates before
697 //we can be sure we've got the right one.
698 found = true;
699 }
700 }
701 if (GetHtSupported ())
702 {
703 if (!found)
704 {
705 mode = GetDefaultMcs ();
706 for (uint8_t i = 0; i != GetNBasicMcs (); i++)
707 {
708 WifiMode testMode = GetBasicMcs (i);
709 if ((!found || testMode.IsHigherDataRate (mode))
710 && (!testMode.IsHigherDataRate (reqMode))
711 && (testMode.GetModulationClass () == reqMode.GetModulationClass ()))
712 {
713 mode = testMode;
714 //We've found a potentially-suitable transmit rate, but we
715 //need to continue and consider all the basic rates before
716 //we can be sure we've got the right one.
717 found = true;
718 }
719 }
720 }
721 }
722 //If we found a suitable rate in the BSSBasicRateSet, then we are
723 //done and can return that mode.
724 if (found)
725 {
726 NS_LOG_DEBUG ("WifiRemoteStationManager::GetControlAnswerMode returning " << mode);
727 return mode;
728 }
729
747 for (const auto & thismode : m_wifiPhy->GetModeList ())
748 {
749 /* If the rate:
750 *
751 * - is a mandatory rate for the PHY, and
752 * - is equal to or faster than our current best choice, and
753 * - is less than or equal to the rate of the received frame, and
754 * - is of the same modulation class as the received frame
755 *
756 * ...then it's our best choice so far.
757 */
758 if (thismode.IsMandatory ()
759 && (!found || thismode.IsHigherDataRate (mode))
760 && (!thismode.IsHigherDataRate (reqMode))
761 && (IsAllowedControlAnswerModulationClass (reqMode.GetModulationClass (), thismode.GetModulationClass ())))
762 {
763 mode = thismode;
764 //As above; we've found a potentially-suitable transmit
765 //rate, but we need to continue and consider all the
766 //mandatory rates before we can be sure we've got the right one.
767 found = true;
768 }
769 }
770 if (GetHtSupported () )
771 {
772 for (const auto & thismode : m_wifiPhy->GetMcsList ())
773 {
774 if (thismode.IsMandatory ()
775 && (!found || thismode.IsHigherDataRate (mode))
776 && (!thismode.IsHigherCodeRate (reqMode))
777 && (thismode.GetModulationClass () == reqMode.GetModulationClass ()))
778 {
779 mode = thismode;
780 //As above; we've found a potentially-suitable transmit
781 //rate, but we need to continue and consider all the
782 //mandatory rates before we can be sure we've got the right one.
783 found = true;
784 }
785 }
786 }
787
797 if (!found)
798 {
799 NS_FATAL_ERROR ("Can't find response rate for " << reqMode);
800 }
801
802 NS_LOG_DEBUG ("WifiRemoteStationManager::GetControlAnswerMode returning " << mode);
803 return mode;
804}
805
806void
808{
809 NS_LOG_FUNCTION (this << header);
810 NS_ASSERT (!header.GetAddr1 ().IsGroup ());
811 AcIndex ac = QosUtilsMapTidToAc ((header.IsQosData ()) ? header.GetQosTid () : 0);
812 m_ssrc[ac]++;
813 m_macTxRtsFailed (header.GetAddr1 ());
814 DoReportRtsFailed (Lookup (header.GetAddr1 ()));
815}
816
817void
819{
820 NS_LOG_FUNCTION (this << *mpdu);
821 NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
822 AcIndex ac = QosUtilsMapTidToAc ((mpdu->GetHeader ().IsQosData ()) ? mpdu->GetHeader ().GetQosTid () : 0);
823 bool longMpdu = (mpdu->GetSize () > m_rtsCtsThreshold);
824 if (longMpdu)
825 {
826 m_slrc[ac]++;
827 }
828 else
829 {
830 m_ssrc[ac]++;
831 }
832 m_macTxDataFailed (mpdu->GetHeader ().GetAddr1 ());
833 DoReportDataFailed (Lookup (mpdu->GetHeader ().GetAddr1 ()));
834}
835
836void
838 double ctsSnr, WifiMode ctsMode, double rtsSnr)
839{
840 NS_LOG_FUNCTION (this << header << ctsSnr << ctsMode << rtsSnr);
841 NS_ASSERT (!header.GetAddr1 ().IsGroup ());
842 WifiRemoteStation *station = Lookup (header.GetAddr1 ());
843 AcIndex ac = QosUtilsMapTidToAc ((header.IsQosData ()) ? header.GetQosTid () : 0);
844 station->m_state->m_info.NotifyTxSuccess (m_ssrc[ac]);
845 m_ssrc[ac] = 0;
846 DoReportRtsOk (station, ctsSnr, ctsMode, rtsSnr);
847}
848
849void
851 WifiMode ackMode, double dataSnr, WifiTxVector dataTxVector)
852{
853 NS_LOG_FUNCTION (this << *mpdu << ackSnr << ackMode << dataSnr << dataTxVector);
854 const WifiMacHeader& hdr = mpdu->GetHeader ();
855 NS_ASSERT (!hdr.GetAddr1 ().IsGroup ());
856 WifiRemoteStation *station = Lookup (hdr.GetAddr1 ());
857 AcIndex ac = QosUtilsMapTidToAc ((hdr.IsQosData ()) ? hdr.GetQosTid () : 0);
858 bool longMpdu = (mpdu->GetSize () > m_rtsCtsThreshold);
859 if (longMpdu)
860 {
861 station->m_state->m_info.NotifyTxSuccess (m_slrc[ac]);
862 m_slrc[ac] = 0;
863 }
864 else
865 {
866 station->m_state->m_info.NotifyTxSuccess (m_ssrc[ac]);
867 m_ssrc[ac] = 0;
868 }
869 DoReportDataOk (station, ackSnr, ackMode, dataSnr, dataTxVector.GetChannelWidth (),
870 dataTxVector.GetNss (GetStaId (hdr.GetAddr1 (), dataTxVector)));
871}
872
873void
875{
876 NS_LOG_FUNCTION (this << header);
877 NS_ASSERT (!header.GetAddr1 ().IsGroup ());
878 WifiRemoteStation *station = Lookup (header.GetAddr1 ());
879 AcIndex ac = QosUtilsMapTidToAc ((header.IsQosData ()) ? header.GetQosTid () : 0);
880 station->m_state->m_info.NotifyTxFailed ();
881 m_ssrc[ac] = 0;
883 DoReportFinalRtsFailed (station);
884}
885
886void
888{
889 NS_LOG_FUNCTION (this << *mpdu);
890 NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
891 WifiRemoteStation *station = Lookup (mpdu->GetHeader ().GetAddr1 ());
892 AcIndex ac = QosUtilsMapTidToAc ((mpdu->GetHeader ().IsQosData ()) ? mpdu->GetHeader ().GetQosTid () : 0);
893 station->m_state->m_info.NotifyTxFailed ();
894 bool longMpdu = (mpdu->GetSize () > m_rtsCtsThreshold);
895 if (longMpdu)
896 {
897 m_slrc[ac] = 0;
898 }
899 else
900 {
901 m_ssrc[ac] = 0;
902 }
903 m_macTxFinalDataFailed (mpdu->GetHeader ().GetAddr1 ());
904 DoReportFinalDataFailed (station);
905}
906
907void
909{
910 NS_LOG_FUNCTION (this << address << rxSignalInfo << txVector);
911 if (address.IsGroup ())
912 {
913 return;
914 }
915 WifiRemoteStation *station = Lookup (address);
916 DoReportRxOk (station, rxSignalInfo.snr, txVector.GetMode (GetStaId (address, txVector)));
917 station->m_rssiAndUpdateTimePair = std::make_pair (rxSignalInfo.rssi, Simulator::Now ());
918}
919
920void
922 uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus,
923 double rxSnr, double dataSnr, WifiTxVector dataTxVector)
924{
925 NS_LOG_FUNCTION (this << address << nSuccessfulMpdus << nFailedMpdus << rxSnr << dataSnr << dataTxVector);
926 NS_ASSERT (!address.IsGroup ());
927 for (uint8_t i = 0; i < nFailedMpdus; i++)
928 {
930 }
931 DoReportAmpduTxStatus (Lookup (address), nSuccessfulMpdus, nFailedMpdus, rxSnr, dataSnr, dataTxVector.GetChannelWidth (), dataTxVector.GetNss (GetStaId (address, dataTxVector)));
932}
933
934bool
936{
937 NS_LOG_FUNCTION (this << header << size);
938 Mac48Address address = header.GetAddr1 ();
939 WifiTxVector txVector = GetDataTxVector (header);
940 WifiMode mode = txVector.GetMode ();
941 if (address.IsGroup ())
942 {
943 return false;
944 }
951 {
952 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedRTS returning true to protect non-ERP stations");
953 return true;
954 }
955 else if (m_htProtectionMode == RTS_CTS
960 {
961 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedRTS returning true to protect non-HT stations");
962 return true;
963 }
964 bool normally = (size > m_rtsCtsThreshold);
965 return DoNeedRts (Lookup (address), size, normally);
966}
967
968bool
970{
971 WifiMode mode = txVector.GetMode ();
972 NS_LOG_FUNCTION (this << mode);
979 {
980 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning true to protect non-ERP stations");
981 return true;
982 }
988 {
989 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning true to protect non-HT stations");
990 return true;
991 }
992 else if (!m_useNonErpProtection)
993 {
994 //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
995 for (WifiModeListIterator i = m_bssBasicRateSet.begin (); i != m_bssBasicRateSet.end (); i++)
996 {
997 if (mode == *i)
998 {
999 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning false");
1000 return false;
1001 }
1002 }
1003 if (GetHtSupported ())
1004 {
1005 //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
1006 for (WifiModeListIterator i = m_bssBasicMcsSet.begin (); i != m_bssBasicMcsSet.end (); i++)
1007 {
1008 if (mode == *i)
1009 {
1010 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning false");
1011 return false;
1012 }
1013 }
1014 }
1015 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning true");
1016 return true;
1017 }
1018 return false;
1019}
1020
1021void
1023{
1024 NS_LOG_FUNCTION (this << enable);
1025 m_useNonErpProtection = enable;
1026}
1027
1028bool
1030{
1031 return m_useNonErpProtection;
1032}
1033
1034void
1036{
1037 NS_LOG_FUNCTION (this << enable);
1038 m_useNonHtProtection = enable;
1039}
1040
1041bool
1043{
1044 return m_useNonHtProtection;
1045}
1046
1047bool
1049{
1050 NS_LOG_FUNCTION (this << *mpdu);
1051 NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
1052 AcIndex ac = QosUtilsMapTidToAc ((mpdu->GetHeader ().IsQosData ()) ? mpdu->GetHeader ().GetQosTid () : 0);
1053 bool longMpdu = (mpdu->GetSize () > m_rtsCtsThreshold);
1054 uint32_t retryCount, maxRetryCount;
1055 if (longMpdu)
1056 {
1057 retryCount = m_slrc[ac];
1058 maxRetryCount = m_maxSlrc;
1059 }
1060 else
1061 {
1062 retryCount = m_ssrc[ac];
1063 maxRetryCount = m_maxSsrc;
1064 }
1065 bool normally = retryCount < maxRetryCount;
1066 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedRetransmission count: " << retryCount << " result: " << std::boolalpha << normally);
1067 return DoNeedRetransmission (Lookup (mpdu->GetHeader ().GetAddr1 ()), mpdu->GetPacket (), normally);
1068}
1069
1070bool
1072{
1073 NS_LOG_FUNCTION (this << *mpdu);
1074 if (mpdu->GetHeader ().GetAddr1 ().IsGroup ())
1075 {
1076 return false;
1077 }
1078 bool normally = mpdu->GetSize () > GetFragmentationThreshold ();
1079 NS_LOG_DEBUG ("WifiRemoteStationManager::NeedFragmentation result: " << std::boolalpha << normally);
1080 return DoNeedFragmentation (Lookup (mpdu->GetHeader ().GetAddr1 ()), mpdu->GetPacket (), normally);
1081}
1082
1083void
1085{
1086 NS_LOG_FUNCTION (this << threshold);
1087 if (threshold < 256)
1088 {
1089 /*
1090 * ASN.1 encoding of the MAC and PHY MIB (256 ... 8000)
1091 */
1092 NS_LOG_WARN ("Fragmentation threshold should be larger than 256. Setting to 256.");
1094 }
1095 else
1096 {
1097 /*
1098 * The length of each fragment shall be an even number of octets, except for the last fragment if an MSDU or
1099 * MMPDU, which may be either an even or an odd number of octets.
1100 */
1101 if (threshold % 2 != 0)
1102 {
1103 NS_LOG_WARN ("Fragmentation threshold should be an even number. Setting to " << threshold - 1);
1104 m_fragmentationThreshold = threshold - 1;
1105 }
1106 else
1107 {
1108 m_fragmentationThreshold = threshold;
1109 }
1110 }
1111}
1112
1115{
1117}
1118
1121{
1122 NS_LOG_FUNCTION (this << *mpdu);
1123 //The number of bytes a fragment can support is (Threshold - WIFI_HEADER_SIZE - WIFI_FCS).
1124 uint32_t nFragments = (mpdu->GetPacket ()->GetSize () / (GetFragmentationThreshold () - mpdu->GetHeader ().GetSize () - WIFI_MAC_FCS_LENGTH));
1125
1126 //If the size of the last fragment is not 0.
1127 if ((mpdu->GetPacket ()->GetSize () % (GetFragmentationThreshold () - mpdu->GetHeader ().GetSize () - WIFI_MAC_FCS_LENGTH)) > 0)
1128 {
1129 nFragments++;
1130 }
1131 NS_LOG_DEBUG ("WifiRemoteStationManager::GetNFragments returning " << nFragments);
1132 return nFragments;
1133}
1134
1137{
1138 NS_LOG_FUNCTION (this << *mpdu << fragmentNumber);
1139 NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
1140 uint32_t nFragment = GetNFragments (mpdu);
1141 if (fragmentNumber >= nFragment)
1142 {
1143 NS_LOG_DEBUG ("WifiRemoteStationManager::GetFragmentSize returning 0");
1144 return 0;
1145 }
1146 //Last fragment
1147 if (fragmentNumber == nFragment - 1)
1148 {
1149 uint32_t lastFragmentSize = mpdu->GetPacket ()->GetSize () - (fragmentNumber * (GetFragmentationThreshold () - mpdu->GetHeader ().GetSize () - WIFI_MAC_FCS_LENGTH));
1150 NS_LOG_DEBUG ("WifiRemoteStationManager::GetFragmentSize returning " << lastFragmentSize);
1151 return lastFragmentSize;
1152 }
1153 //All fragments but the last, the number of bytes is (Threshold - WIFI_HEADER_SIZE - WIFI_FCS).
1154 else
1155 {
1156 uint32_t fragmentSize = GetFragmentationThreshold () - mpdu->GetHeader ().GetSize () - WIFI_MAC_FCS_LENGTH;
1157 NS_LOG_DEBUG ("WifiRemoteStationManager::GetFragmentSize returning " << fragmentSize);
1158 return fragmentSize;
1159 }
1160}
1161
1164{
1165 NS_LOG_FUNCTION (this << *mpdu << fragmentNumber);
1166 NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
1167 NS_ASSERT (fragmentNumber < GetNFragments (mpdu));
1168 uint32_t fragmentOffset = fragmentNumber * (GetFragmentationThreshold () - mpdu->GetHeader ().GetSize () - WIFI_MAC_FCS_LENGTH);
1169 NS_LOG_DEBUG ("WifiRemoteStationManager::GetFragmentOffset returning " << fragmentOffset);
1170 return fragmentOffset;
1171}
1172
1173bool
1175{
1176 NS_LOG_FUNCTION (this << *mpdu << fragmentNumber);
1177 NS_ASSERT (!mpdu->GetHeader ().GetAddr1 ().IsGroup ());
1178 bool isLast = fragmentNumber == (GetNFragments (mpdu) - 1);
1179 NS_LOG_DEBUG ("WifiRemoteStationManager::IsLastFragment returning " << std::boolalpha << isLast);
1180 return isLast;
1181}
1182
1183uint8_t
1185{
1186 return m_defaultTxPowerLevel;
1187}
1188
1191{
1193 return state->m_info;
1194}
1195
1196double
1198{
1199 auto stationIt = m_stations.find (address);
1200 NS_ASSERT_MSG (stationIt != m_stations.end(), "Address: " << address << " not found");
1201 auto station = stationIt->second;
1202 auto rssi = station->m_rssiAndUpdateTimePair.first;
1203 auto ts = station->m_rssiAndUpdateTimePair.second;
1204 NS_ASSERT_MSG (ts.IsStrictlyPositive(), "address: " << address << " ts:" << ts);
1205 return rssi;
1206}
1207
1210{
1211 NS_LOG_FUNCTION (this << address);
1212 auto stateIt = m_states.find (address);
1213
1214 if (stateIt != m_states.end ())
1215 {
1216 NS_LOG_DEBUG ("WifiRemoteStationManager::LookupState returning existing state");
1217 return stateIt->second;
1218 }
1219
1222 state->m_address = address;
1223 state->m_aid = 0;
1224 state->m_operationalRateSet.push_back (GetDefaultMode ());
1225 state->m_operationalMcsSet.push_back (GetDefaultMcs ());
1226 state->m_dsssSupported = false;
1227 state->m_erpOfdmSupported = false;
1228 state->m_ofdmSupported = false;
1229 state->m_htCapabilities = 0;
1230 state->m_vhtCapabilities = 0;
1231 state->m_heCapabilities = 0;
1234 state->m_ness = 0;
1235 state->m_aggregation = false;
1236 state->m_qosSupported = false;
1237 const_cast<WifiRemoteStationManager *> (this)->m_states.insert ({address, state});
1238 NS_LOG_DEBUG ("WifiRemoteStationManager::LookupState returning new state");
1239 return state;
1240}
1241
1242WifiRemoteStation *
1243WifiRemoteStationManager::Lookup (Mac48Address address) const
1244{
1245 NS_LOG_FUNCTION (this << address);
1246 auto stationIt = m_stations.find (address);
1247
1248 if (stationIt != m_stations.end ())
1249 {
1250 return stationIt->second;
1251 }
1252
1253 WifiRemoteStationState *state = LookupState (address);
1254
1255 WifiRemoteStation *station = DoCreateStation ();
1256 station->m_state = state;
1257 station->m_rssiAndUpdateTimePair = std::make_pair (0, Seconds (0));
1258 const_cast<WifiRemoteStationManager *> (this)->m_stations.insert ({address, station});
1259 return station;
1260}
1261
1262void
1263WifiRemoteStationManager::SetAssociationId (Mac48Address remoteAddress, uint16_t aid)
1264{
1265 NS_LOG_FUNCTION (this << remoteAddress << aid);
1266 LookupState (remoteAddress)->m_aid = aid;
1267}
1268
1269void
1270WifiRemoteStationManager::SetQosSupport (Mac48Address from, bool qosSupported)
1271{
1272 NS_LOG_FUNCTION (this << from << qosSupported);
1274 state = LookupState (from);
1275 state->m_qosSupported = qosSupported;
1276}
1277
1278void
1279WifiRemoteStationManager::AddStationHtCapabilities (Mac48Address from, HtCapabilities htCapabilities)
1280{
1281 //Used by all stations to record HT capabilities of remote stations
1282 NS_LOG_FUNCTION (this << from << htCapabilities);
1284 state = LookupState (from);
1285 if (htCapabilities.GetSupportedChannelWidth () == 1)
1286 {
1287 state->m_channelWidth = 40;
1288 }
1289 else
1290 {
1291 state->m_channelWidth = 20;
1292 }
1293 SetQosSupport (from, true);
1294 for (const auto & mcs : m_wifiPhy->GetMcsList (WIFI_MOD_CLASS_HT))
1295 {
1296 if (htCapabilities.IsSupportedMcs (mcs.GetMcsValue ()))
1297 {
1298 AddSupportedMcs (from, mcs);
1299 }
1300 }
1301 state->m_htCapabilities = Create<const HtCapabilities> (htCapabilities);
1302}
1303
1304void
1305WifiRemoteStationManager::AddStationVhtCapabilities (Mac48Address from, VhtCapabilities vhtCapabilities)
1306{
1307 //Used by all stations to record VHT capabilities of remote stations
1308 NS_LOG_FUNCTION (this << from << vhtCapabilities);
1310 state = LookupState (from);
1311 if (vhtCapabilities.GetSupportedChannelWidthSet () == 1)
1312 {
1313 state->m_channelWidth = 160;
1314 }
1315 else
1316 {
1317 state->m_channelWidth = 80;
1318 }
1319 //This is a workaround to enable users to force a 20 or 40 MHz channel for a VHT-compliant device,
1320 //since IEEE 802.11ac standard says that 20, 40 and 80 MHz channels are mandatory.
1321 if (m_wifiPhy->GetChannelWidth () < state->m_channelWidth)
1322 {
1323 state->m_channelWidth = m_wifiPhy->GetChannelWidth ();
1324 }
1325 for (uint8_t i = 1; i <= m_wifiPhy->GetMaxSupportedTxSpatialStreams (); i++)
1326 {
1327 for (const auto & mcs : m_wifiPhy->GetMcsList (WIFI_MOD_CLASS_VHT))
1328 {
1329 if (vhtCapabilities.IsSupportedMcs (mcs.GetMcsValue (), i))
1330 {
1331 AddSupportedMcs (from, mcs);
1332 }
1333 }
1334 }
1335 state->m_vhtCapabilities = Create<const VhtCapabilities> (vhtCapabilities);
1336}
1337
1338void
1339WifiRemoteStationManager::AddStationHeCapabilities (Mac48Address from, HeCapabilities heCapabilities)
1340{
1341 //Used by all stations to record HE capabilities of remote stations
1342 NS_LOG_FUNCTION (this << from << heCapabilities);
1344 state = LookupState (from);
1345 if ((m_wifiPhy->GetPhyBand () == WIFI_PHY_BAND_5GHZ) || (m_wifiPhy->GetPhyBand () == WIFI_PHY_BAND_6GHZ))
1346 {
1347 if (heCapabilities.GetChannelWidthSet () & 0x04)
1348 {
1349 state->m_channelWidth = 160;
1350 }
1351 else if (heCapabilities.GetChannelWidthSet () & 0x02)
1352 {
1353 state->m_channelWidth = 80;
1354 }
1355 //For other cases at 5 GHz, the supported channel width is set by the VHT capabilities
1356 }
1357 else if (m_wifiPhy->GetPhyBand () == WIFI_PHY_BAND_2_4GHZ)
1358 {
1359 if (heCapabilities.GetChannelWidthSet () & 0x01)
1360 {
1361 state->m_channelWidth = 40;
1362 }
1363 else
1364 {
1365 state->m_channelWidth = 20;
1366 }
1367 }
1368 if (heCapabilities.GetHeSuPpdu1xHeLtf800nsGi () == 1)
1369 {
1370 state->m_guardInterval = 800;
1371 }
1372 else
1373 {
1374 //todo: Using 3200ns, default value for HeConfiguration::GuardInterval
1375 state->m_guardInterval = 3200;
1376 }
1377 for (uint8_t i = 1; i <= m_wifiPhy->GetMaxSupportedTxSpatialStreams (); i++)
1378 {
1379 for (const auto & mcs : m_wifiPhy->GetMcsList (WIFI_MOD_CLASS_HE))
1380 {
1381 if (heCapabilities.GetHighestNssSupported () >= i
1382 && heCapabilities.GetHighestMcsSupported () >= mcs.GetMcsValue ())
1383 {
1384 AddSupportedMcs (from, mcs);
1385 }
1386 }
1387 }
1388 state->m_heCapabilities = Create<const HeCapabilities> (heCapabilities);
1389 SetQosSupport (from, true);
1390}
1391
1393WifiRemoteStationManager::GetStationHtCapabilities (Mac48Address from)
1394{
1395 return LookupState (from)->m_htCapabilities;
1396}
1397
1399WifiRemoteStationManager::GetStationVhtCapabilities (Mac48Address from)
1400{
1401 return LookupState (from)->m_vhtCapabilities;
1402}
1403
1405WifiRemoteStationManager::GetStationHeCapabilities (Mac48Address from)
1406{
1407 return LookupState (from)->m_heCapabilities;
1408}
1409
1410bool
1411WifiRemoteStationManager::GetLdpcSupported (Mac48Address address) const
1412{
1413 Ptr<const HtCapabilities> htCapabilities = LookupState (address)->m_htCapabilities;
1414 Ptr<const VhtCapabilities> vhtCapabilities = LookupState (address)->m_vhtCapabilities;
1415 Ptr<const HeCapabilities> heCapabilities = LookupState (address)->m_heCapabilities;
1416 bool supported = false;
1417 if (htCapabilities)
1418 {
1419 supported |= htCapabilities->GetLdpc ();
1420 }
1421 if (vhtCapabilities)
1422 {
1423 supported |= vhtCapabilities->GetRxLdpc ();
1424 }
1425 if (heCapabilities)
1426 {
1427 supported |= heCapabilities->GetLdpcCodingInPayload ();
1428 }
1429 return supported;
1430}
1431
1433WifiRemoteStationManager::GetDefaultMode (void) const
1434{
1435 return m_defaultTxMode;
1436}
1437
1439WifiRemoteStationManager::GetDefaultMcs (void) const
1440{
1441 return m_defaultTxMcs;
1442}
1443
1444void
1446{
1447 NS_LOG_FUNCTION (this);
1448 for (auto& state : m_states)
1449 {
1450 delete (state.second);
1451 }
1452 m_states.clear ();
1453 for (auto& state: m_stations)
1454 {
1455 delete (state.second);
1456 }
1457 m_stations.clear ();
1458 m_bssBasicRateSet.clear ();
1459 m_bssBasicMcsSet.clear ();
1460 m_ssrc.fill (0);
1461 m_slrc.fill (0);
1462}
1463
1464void
1465WifiRemoteStationManager::AddBasicMode (WifiMode mode)
1466{
1467 NS_LOG_FUNCTION (this << mode);
1469 {
1470 NS_FATAL_ERROR ("It is not allowed to add a HT rate in the BSSBasicRateSet!");
1471 }
1472 for (uint8_t i = 0; i < GetNBasicModes (); i++)
1473 {
1474 if (GetBasicMode (i) == mode)
1475 {
1476 return;
1477 }
1478 }
1479 m_bssBasicRateSet.push_back (mode);
1480}
1481
1482uint8_t
1483WifiRemoteStationManager::GetNBasicModes (void) const
1484{
1485 return static_cast<uint8_t> (m_bssBasicRateSet.size ());
1486}
1487
1489WifiRemoteStationManager::GetBasicMode (uint8_t i) const
1490{
1491 NS_ASSERT (i < GetNBasicModes ());
1492 return m_bssBasicRateSet[i];
1493}
1494
1496WifiRemoteStationManager::GetNNonErpBasicModes (void) const
1497{
1498 uint32_t size = 0;
1499 for (WifiModeListIterator i = m_bssBasicRateSet.begin (); i != m_bssBasicRateSet.end (); i++)
1500 {
1501 if (i->GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
1502 {
1503 continue;
1504 }
1505 size++;
1506 }
1507 return size;
1508}
1509
1511WifiRemoteStationManager::GetNonErpBasicMode (uint8_t i) const
1512{
1513 NS_ASSERT (i < GetNNonErpBasicModes ());
1514 uint32_t index = 0;
1515 bool found = false;
1516 for (WifiModeListIterator j = m_bssBasicRateSet.begin (); j != m_bssBasicRateSet.end (); )
1517 {
1518 if (i == index)
1519 {
1520 found = true;
1521 }
1522 if (j->GetModulationClass () != WIFI_MOD_CLASS_ERP_OFDM)
1523 {
1524 if (found)
1525 {
1526 break;
1527 }
1528 }
1529 index++;
1530 j++;
1531 }
1532 return m_bssBasicRateSet[index];
1533}
1534
1535void
1536WifiRemoteStationManager::AddBasicMcs (WifiMode mcs)
1537{
1538 NS_LOG_FUNCTION (this << +mcs.GetMcsValue ());
1539 for (uint8_t i = 0; i < GetNBasicMcs (); i++)
1540 {
1541 if (GetBasicMcs (i) == mcs)
1542 {
1543 return;
1544 }
1545 }
1546 m_bssBasicMcsSet.push_back (mcs);
1547}
1548
1549uint8_t
1550WifiRemoteStationManager::GetNBasicMcs (void) const
1551{
1552 return static_cast<uint8_t> (m_bssBasicMcsSet.size ());
1553}
1554
1556WifiRemoteStationManager::GetBasicMcs (uint8_t i) const
1557{
1558 NS_ASSERT (i < GetNBasicMcs ());
1559 return m_bssBasicMcsSet[i];
1560}
1561
1563WifiRemoteStationManager::GetNonUnicastMode (void) const
1564{
1565 if (m_nonUnicastMode == WifiMode ())
1566 {
1567 if (GetNBasicModes () > 0)
1568 {
1569 return GetBasicMode (0);
1570 }
1571 else
1572 {
1573 return GetDefaultMode ();
1574 }
1575 }
1576 else
1577 {
1578 return m_nonUnicastMode;
1579 }
1580}
1581
1582bool
1583WifiRemoteStationManager::DoNeedRts (WifiRemoteStation *station,
1584 uint32_t size, bool normally)
1585{
1586 return normally;
1587}
1588
1589bool
1590WifiRemoteStationManager::DoNeedRetransmission (WifiRemoteStation *station,
1591 Ptr<const Packet> packet, bool normally)
1592{
1593 return normally;
1594}
1595
1596bool
1597WifiRemoteStationManager::DoNeedFragmentation (WifiRemoteStation *station,
1598 Ptr<const Packet> packet, bool normally)
1599{
1600 return normally;
1601}
1602
1603void
1604WifiRemoteStationManager::DoReportAmpduTxStatus (WifiRemoteStation *station, uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus, double rxSnr, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
1605{
1606 NS_LOG_DEBUG ("DoReportAmpduTxStatus received but the manager does not handle A-MPDUs!");
1607}
1608
1610WifiRemoteStationManager::GetSupported (const WifiRemoteStation *station, uint8_t i) const
1611{
1612 NS_ASSERT (i < GetNSupported (station));
1613 return station->m_state->m_operationalRateSet[i];
1614}
1615
1617WifiRemoteStationManager::GetMcsSupported (const WifiRemoteStation *station, uint8_t i) const
1618{
1619 NS_ASSERT (i < GetNMcsSupported (station));
1620 return station->m_state->m_operationalMcsSet[i];
1621}
1622
1624WifiRemoteStationManager::GetNonErpSupported (const WifiRemoteStation *station, uint8_t i) const
1625{
1626 NS_ASSERT (i < GetNNonErpSupported (station));
1627 //IEEE 802.11g standard defines that if the protection mechanism is enabled, RTS, CTS and CTS-To-Self
1628 //frames should select a rate in the BSSBasicRateSet that corresponds to an 802.11b basic rate.
1629 //This is a implemented here to avoid changes in every RAA, but should maybe be moved in case it breaks standard rules.
1630 uint32_t index = 0;
1631 bool found = false;
1632 for (WifiModeListIterator j = station->m_state->m_operationalRateSet.begin (); j != station->m_state->m_operationalRateSet.end (); )
1633 {
1634 if (i == index)
1635 {
1636 found = true;
1637 }
1638 if (j->GetModulationClass () != WIFI_MOD_CLASS_ERP_OFDM)
1639 {
1640 if (found)
1641 {
1642 break;
1643 }
1644 }
1645 index++;
1646 j++;
1647 }
1648 return station->m_state->m_operationalRateSet[index];
1649}
1650
1652WifiRemoteStationManager::GetAddress (const WifiRemoteStation *station) const
1653{
1654 return station->m_state->m_address;
1655}
1656
1657uint16_t
1658WifiRemoteStationManager::GetChannelWidth (const WifiRemoteStation *station) const
1659{
1660 return station->m_state->m_channelWidth;
1661}
1662
1663bool
1664WifiRemoteStationManager::GetShortGuardIntervalSupported (const WifiRemoteStation *station) const
1665{
1666 Ptr<const HtCapabilities> htCapabilities = station->m_state->m_htCapabilities;
1667
1668 if (!htCapabilities)
1669 {
1670 return false;
1671 }
1672 return htCapabilities->GetShortGuardInterval20 ();
1673}
1674
1675uint16_t
1676WifiRemoteStationManager::GetGuardInterval (const WifiRemoteStation *station) const
1677{
1678 return station->m_state->m_guardInterval;
1679}
1680
1681bool
1682WifiRemoteStationManager::GetAggregation (const WifiRemoteStation *station) const
1683{
1684 return station->m_state->m_aggregation;
1685}
1686
1687uint8_t
1688WifiRemoteStationManager::GetNumberOfSupportedStreams (const WifiRemoteStation *station) const
1689{
1690 Ptr<const HtCapabilities> htCapabilities = station->m_state->m_htCapabilities;
1691
1692 if (!htCapabilities)
1693 {
1694 return 1;
1695 }
1696 return htCapabilities->GetRxHighestSupportedAntennas ();
1697}
1698
1699uint8_t
1700WifiRemoteStationManager::GetNess (const WifiRemoteStation *station) const
1701{
1702 return station->m_state->m_ness;
1703}
1704
1706WifiRemoteStationManager::GetPhy (void) const
1707{
1708 return m_wifiPhy;
1709}
1710
1712WifiRemoteStationManager::GetMac (void) const
1713{
1714 return m_wifiMac;
1715}
1716
1717uint8_t
1718WifiRemoteStationManager::GetNSupported (const WifiRemoteStation *station) const
1719{
1720 return static_cast<uint8_t> (station->m_state->m_operationalRateSet.size ());
1721}
1722
1723bool
1724WifiRemoteStationManager::GetQosSupported (const WifiRemoteStation *station) const
1725{
1726 return station->m_state->m_qosSupported;
1727}
1728
1729bool
1730WifiRemoteStationManager::GetHtSupported (const WifiRemoteStation *station) const
1731{
1732 return (station->m_state->m_htCapabilities != 0);
1733}
1734
1735bool
1736WifiRemoteStationManager::GetVhtSupported (const WifiRemoteStation *station) const
1737{
1738 return (station->m_state->m_vhtCapabilities != 0);
1739}
1740
1741bool
1742WifiRemoteStationManager::GetHeSupported (const WifiRemoteStation *station) const
1743{
1744 return (station->m_state->m_heCapabilities != 0);
1745}
1746
1747uint8_t
1748WifiRemoteStationManager::GetNMcsSupported (const WifiRemoteStation *station) const
1749{
1750 return static_cast<uint8_t> (station->m_state->m_operationalMcsSet.size ());
1751}
1752
1754WifiRemoteStationManager::GetNNonErpSupported (const WifiRemoteStation *station) const
1755{
1756 uint32_t size = 0;
1757 for (WifiModeListIterator i = station->m_state->m_operationalRateSet.begin (); i != station->m_state->m_operationalRateSet.end (); i++)
1758 {
1759 if (i->GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
1760 {
1761 continue;
1762 }
1763 size++;
1764 }
1765 return size;
1766}
1767
1768uint16_t
1769WifiRemoteStationManager::GetChannelWidthSupported (Mac48Address address) const
1770{
1771 return LookupState (address)->m_channelWidth;
1772}
1773
1774bool
1775WifiRemoteStationManager::GetShortGuardIntervalSupported (Mac48Address address) const
1776{
1777 Ptr<const HtCapabilities> htCapabilities = LookupState (address)->m_htCapabilities;
1778
1779 if (!htCapabilities)
1780 {
1781 return false;
1782 }
1783 return htCapabilities->GetShortGuardInterval20 ();
1784}
1785
1786uint8_t
1787WifiRemoteStationManager::GetNumberOfSupportedStreams (Mac48Address address) const
1788{
1789 Ptr<const HtCapabilities> htCapabilities = LookupState (address)->m_htCapabilities;
1790
1791 if (!htCapabilities)
1792 {
1793 return 1;
1794 }
1795 return htCapabilities->GetRxHighestSupportedAntennas ();
1796}
1797
1798uint8_t
1799WifiRemoteStationManager::GetNMcsSupported (Mac48Address address) const
1800{
1801 return static_cast<uint8_t> (LookupState (address)->m_operationalMcsSet.size ());
1802}
1803
1804bool
1805WifiRemoteStationManager::GetDsssSupported (const Mac48Address& address) const
1806{
1807 return (LookupState (address)->m_dsssSupported);
1808}
1809
1810bool
1811WifiRemoteStationManager::GetErpOfdmSupported (const Mac48Address& address) const
1812{
1813 return (LookupState (address)->m_erpOfdmSupported);
1814}
1815
1816bool
1817WifiRemoteStationManager::GetOfdmSupported (const Mac48Address& address) const
1818{
1819 return (LookupState (address)->m_ofdmSupported);
1820}
1821
1822bool
1823WifiRemoteStationManager::GetHtSupported (Mac48Address address) const
1824{
1825 return (LookupState (address)->m_htCapabilities != 0);
1826}
1827
1828bool
1829WifiRemoteStationManager::GetVhtSupported (Mac48Address address) const
1830{
1831 return (LookupState (address)->m_vhtCapabilities != 0);
1832}
1833
1834bool
1835WifiRemoteStationManager::GetHeSupported (Mac48Address address) const
1836{
1837 return (LookupState (address)->m_heCapabilities != 0);
1838}
1839
1840void
1841WifiRemoteStationManager::SetDefaultTxPowerLevel (uint8_t txPower)
1842{
1843 m_defaultTxPowerLevel = txPower;
1844}
1845
1846uint8_t
1847WifiRemoteStationManager::GetNumberOfAntennas (void) const
1848{
1849 return m_wifiPhy->GetNumberOfAntennas ();
1850}
1851
1852uint8_t
1853WifiRemoteStationManager::GetMaxNumberOfTransmitStreams (void) const
1854{
1855 return m_wifiPhy->GetMaxSupportedTxSpatialStreams ();
1856}
1857
1858bool
1859WifiRemoteStationManager::UseLdpcForDestination (Mac48Address dest) const
1860{
1861 return (GetLdpcSupported () && GetLdpcSupported (dest));
1862}
1863
1864} //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:456
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:1750
Ptr< WifiNetDevice > GetDevice(void) const
Return the device this PHY is associated with.
Definition: wifi-phy.cc:532
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:1701
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:901
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.
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.
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.
uint16_t GetChannelWidthForTransmission(WifiMode mode, uint16_t maxSupportedChannelWidth)
Return the channel width that corresponds to the selected mode (instead of letting the PHY's default ...
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 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