30 #include "ns3/boolean.h"
31 #include "ns3/eht-configuration.h"
33 #include "ns3/erp-ofdm-phy.h"
34 #include "ns3/he-configuration.h"
35 #include "ns3/ht-configuration.h"
36 #include "ns3/ht-phy.h"
38 #include "ns3/simulator.h"
39 #include "ns3/uinteger.h"
40 #include "ns3/vht-configuration.h"
53 TypeId(
"ns3::WifiRemoteStationManager")
56 .AddAttribute(
"MaxSsrc",
57 "The maximum number of retransmission attempts for any packet with size "
58 "<= RtsCtsThreshold. "
59 "This value will not have any effect on some rate control algorithms.",
62 MakeUintegerChecker<uint32_t>())
63 .AddAttribute(
"MaxSlrc",
64 "The maximum number of retransmission attempts for any packet with size "
66 "This value will not have any effect on some rate control algorithms.",
69 MakeUintegerChecker<uint32_t>())
70 .AddAttribute(
"RtsCtsThreshold",
71 "If the size of the PSDU is bigger than this value, we use an RTS/CTS "
72 "handshake before sending the data frame."
73 "This value will not have any effect on some rate control algorithms.",
76 MakeUintegerChecker<uint32_t>(0, 4692480))
78 "FragmentationThreshold",
79 "If the size of the PSDU is bigger than this value, we fragment it such that the "
80 "size of the fragments are equal or smaller. "
81 "This value does not apply when it is carried in an A-MPDU. "
82 "This value will not have any effect on some rate control algorithms.",
86 MakeUintegerChecker<uint32_t>())
87 .AddAttribute(
"NonUnicastMode",
88 "Wifi mode used for non-unicast transmissions.",
91 MakeWifiModeChecker())
92 .AddAttribute(
"DefaultTxPowerLevel",
93 "Default power level to be used for transmissions. "
94 "This is the power level that is used by all those WifiManagers that do "
95 "not implement TX power control.",
98 MakeUintegerChecker<uint8_t>())
99 .AddAttribute(
"ErpProtectionMode",
100 "Protection mode used when non-ERP STAs are connected to an ERP AP: "
101 "Rts-Cts or Cts-To-Self",
103 MakeEnumAccessor<WifiRemoteStationManager::ProtectionMode>(
109 .AddAttribute(
"HtProtectionMode",
110 "Protection mode used when non-HT STAs are connected to a HT AP: Rts-Cts "
113 MakeEnumAccessor<WifiRemoteStationManager::ProtectionMode>(
119 .AddTraceSource(
"MacTxRtsFailed",
120 "The transmission of a RTS by the MAC layer has failed",
122 "ns3::Mac48Address::TracedCallback")
123 .AddTraceSource(
"MacTxDataFailed",
124 "The transmission of a data packet by the MAC layer has failed",
126 "ns3::Mac48Address::TracedCallback")
128 "MacTxFinalRtsFailed",
129 "The transmission of a RTS has exceeded the maximum number of attempts",
131 "ns3::Mac48Address::TracedCallback")
133 "MacTxFinalDataFailed",
134 "The transmission of a data packet has exceeded the maximum number of attempts",
136 "ns3::Mac48Address::TracedCallback");
141 : m_useNonErpProtection(false),
142 m_useNonHtProtection(false),
143 m_shortPreambleEnabled(false),
144 m_shortSlotTimeEnabled(false)
278 return htConfiguration->GetLdpcSupported();
291 if (htConfiguration->GetShortGuardIntervalSupported())
308 gi =
static_cast<uint16_t
>(heConfiguration->GetGuardInterval().GetNanoSeconds());
321 bool isShortPreambleSupported)
330 bool isShortSlotTimeSupported)
343 for (
const auto& i : state->m_operationalRateSet)
353 state->m_dsssSupported =
true;
357 state->m_erpOfdmSupported =
true;
361 state->m_ofdmSupported =
true;
363 state->m_operationalRateSet.push_back(mode);
372 state->m_operationalRateSet.clear();
375 state->m_operationalRateSet.push_back(mode);
376 if (mode.IsMandatory())
391 state->m_operationalMcsSet =
WifiModeList(mcsList.begin(), mcsList.end());
408 for (
const auto& i : state->m_operationalMcsSet)
415 state->m_operationalMcsSet.push_back(mcs);
514 std::shared_ptr<WifiRemoteStationState> state;
562 std::optional<Mac48Address>
566 stateIt !=
m_states.end() && stateIt->second->m_mleCommonInfo)
568 return stateIt->second->m_mleCommonInfo->m_mldMacAddress;
574 std::optional<Mac48Address>
577 auto stateIt =
m_states.find(mldAddress);
579 if (stateIt ==
m_states.end() || !stateIt->second->m_mleCommonInfo)
585 NS_ASSERT(stateIt->second->m_mleCommonInfo->m_mldMacAddress == mldAddress);
586 return stateIt->second->m_address;
626 uint16_t channelWidth = allowedWidth;
630 rxWidth < channelWidth)
632 channelWidth = rxWidth;
650 txVector.
SetBssColor(heConfiguration->GetBssColor());
657 <<
" MHz) exceeds allowed width (" << allowedWidth
723 if (allowedWidth >= 40 &&
754 uint16_t ctsTxGuardInterval =
766 auto txMode = txVector.
GetMode();
774 else if (rate >= 12e6)
805 uint16_t ackTxGuardInterval =
824 uint16_t blockAckTxGuardInterval =
891 NS_LOG_DEBUG(
"WifiRemoteStationManager::GetControlAnswerMode returning " << mode);
923 if (thismode.IsMandatory() && (!found || thismode.IsHigherDataRate(mode)) &&
924 (!thismode.IsHigherDataRate(reqMode)) &&
926 thismode.GetModulationClass())))
939 if (thismode.IsMandatory() && (!found || thismode.IsHigherDataRate(mode)) &&
940 (!thismode.IsHigherCodeRate(reqMode)) &&
966 NS_LOG_DEBUG(
"WifiRemoteStationManager::GetControlAnswerMode returning " << mode);
985 NS_ASSERT(!mpdu->GetHeader().GetAddr1().IsGroup());
987 QosUtilsMapTidToAc((mpdu->GetHeader().IsQosData()) ? mpdu->GetHeader().GetQosTid() : 0);
1023 NS_LOG_FUNCTION(
this << *mpdu << ackSnr << ackMode << dataSnr << dataTxVector);
1064 NS_ASSERT(!mpdu->GetHeader().GetAddr1().IsGroup());
1067 QosUtilsMapTidToAc((mpdu->GetHeader().IsQosData()) ? mpdu->GetHeader().GetQosTid() : 0);
1099 uint16_t nSuccessfulMpdus,
1100 uint16_t nFailedMpdus,
1108 for (uint16_t i = 0; i < nFailedMpdus; i++)
1139 "WifiRemoteStationManager::NeedRTS returning true to protect non-ERP stations");
1146 NS_LOG_DEBUG(
"WifiRemoteStationManager::NeedRTS returning true to protect non-HT stations");
1167 "WifiRemoteStationManager::NeedCtsToSelf returning true to protect non-ERP stations");
1176 "WifiRemoteStationManager::NeedCtsToSelf returning true to protect non-HT stations");
1187 NS_LOG_DEBUG(
"WifiRemoteStationManager::NeedCtsToSelf returning false");
1199 NS_LOG_DEBUG(
"WifiRemoteStationManager::NeedCtsToSelf returning false");
1204 NS_LOG_DEBUG(
"WifiRemoteStationManager::NeedCtsToSelf returning true");
1240 NS_ASSERT(!mpdu->GetHeader().GetAddr1().IsGroup());
1242 QosUtilsMapTidToAc((mpdu->GetHeader().IsQosData()) ? mpdu->GetHeader().GetQosTid() : 0);
1244 uint32_t retryCount;
1245 uint32_t maxRetryCount;
1256 bool normally = retryCount < maxRetryCount;
1257 NS_LOG_DEBUG(
"WifiRemoteStationManager::NeedRetransmission count: "
1258 << retryCount <<
" result: " << std::boolalpha << normally);
1266 if (mpdu->GetHeader().GetAddr1().IsGroup())
1271 NS_LOG_DEBUG(
"WifiRemoteStationManager::NeedFragmentation result: " << std::boolalpha
1280 if (threshold < 256)
1285 NS_LOG_WARN(
"Fragmentation threshold should be larger than 256. Setting to 256.");
1294 if (threshold % 2 != 0)
1296 NS_LOG_WARN(
"Fragmentation threshold should be an even number. Setting to "
1318 uint32_t nFragments =
1319 (mpdu->GetPacket()->GetSize() /
1323 if ((mpdu->GetPacket()->GetSize() %
1328 NS_LOG_DEBUG(
"WifiRemoteStationManager::GetNFragments returning " << nFragments);
1336 NS_ASSERT(!mpdu->GetHeader().GetAddr1().IsGroup());
1338 if (fragmentNumber >= nFragment)
1340 NS_LOG_DEBUG(
"WifiRemoteStationManager::GetFragmentSize returning 0");
1344 if (fragmentNumber == nFragment - 1)
1346 uint32_t lastFragmentSize =
1347 mpdu->GetPacket()->GetSize() -
1350 NS_LOG_DEBUG(
"WifiRemoteStationManager::GetFragmentSize returning " << lastFragmentSize);
1351 return lastFragmentSize;
1356 uint32_t fragmentSize =
1358 NS_LOG_DEBUG(
"WifiRemoteStationManager::GetFragmentSize returning " << fragmentSize);
1359 return fragmentSize;
1367 NS_ASSERT(!mpdu->GetHeader().GetAddr1().IsGroup());
1371 NS_LOG_DEBUG(
"WifiRemoteStationManager::GetFragmentOffset returning " << fragmentOffset);
1372 return fragmentOffset;
1379 NS_ASSERT(!mpdu->GetHeader().GetAddr1().IsGroup());
1381 NS_LOG_DEBUG(
"WifiRemoteStationManager::IsLastFragment returning " << std::boolalpha << isLast);
1397 std::optional<double>
1401 auto rssi = station->m_rssiAndUpdateTimePair.first;
1402 auto ts = station->m_rssiAndUpdateTimePair.second;
1403 if (ts.IsStrictlyPositive())
1407 return std::nullopt;
1410 std::shared_ptr<WifiRemoteStationState>
1418 NS_LOG_DEBUG(
"WifiRemoteStationManager::LookupState returning existing state");
1419 return stateIt->second;
1422 auto state = std::make_shared<WifiRemoteStationState>();
1428 state->m_dsssSupported =
false;
1429 state->m_erpOfdmSupported =
false;
1430 state->m_ofdmSupported =
false;
1431 state->m_htCapabilities =
nullptr;
1432 state->m_vhtCapabilities =
nullptr;
1433 state->m_heCapabilities =
nullptr;
1434 state->m_ehtCapabilities =
nullptr;
1435 state->m_mleCommonInfo =
nullptr;
1436 state->m_emlsrEnabled =
false;
1440 state->m_aggregation =
false;
1441 state->m_qosSupported =
false;
1442 state->m_isInPsMode =
false;
1444 NS_LOG_DEBUG(
"WifiRemoteStationManager::LookupState returning new state");
1454 auto stationIt = m_stations.find(
address);
1456 if (stationIt != m_stations.end())
1458 return stationIt->second;
1476 WifiRemoteStationManager::SetQosSupport(
Mac48Address from,
bool qosSupported)
1479 LookupState(from)->m_qosSupported = qosSupported;
1483 WifiRemoteStationManager::SetEmlsrEnabled(
const Mac48Address& from,
bool emlsrEnabled)
1486 LookupState(from)->m_emlsrEnabled = emlsrEnabled;
1494 auto state = LookupState(from);
1497 state->m_channelWidth = 40;
1501 state->m_channelWidth = 20;
1503 SetQosSupport(from,
true);
1508 AddSupportedMcs(from, mcs);
1511 state->m_htCapabilities = Create<const HtCapabilities>(htCapabilities);
1520 auto state = LookupState(from);
1523 state->m_channelWidth = 160;
1527 state->m_channelWidth = 80;
1529 for (uint8_t i = 1; i <= m_wifiPhy->GetMaxSupportedTxSpatialStreams(); i++)
1535 AddSupportedMcs(from, mcs);
1539 state->m_vhtCapabilities = Create<const VhtCapabilities>(vhtCapabilities);
1547 auto state = LookupState(from);
1553 state->m_channelWidth = 160;
1557 state->m_channelWidth = 80;
1565 state->m_channelWidth = 40;
1569 state->m_channelWidth = 20;
1574 state->m_guardInterval = 800;
1579 state->m_guardInterval = 3200;
1585 AddSupportedMcs(from, mcs);
1588 state->m_heCapabilities = Create<const HeCapabilities>(heCapabilities);
1589 SetQosSupport(from,
true);
1598 auto state = LookupState(from);
1601 for (uint8_t mapType = 0; mapType < EhtMcsAndNssSet::EHT_MCS_MAP_TYPE_MAX; ++mapType)
1606 AddSupportedMcs(from, mcs);
1610 state->m_ehtCapabilities = Create<const EhtCapabilities>(ehtCapabilities);
1611 SetQosSupport(from,
true);
1615 WifiRemoteStationManager::AddStationMleCommonInfo(
1617 const std::shared_ptr<CommonInfoBasicMle>& mleCommonInfo)
1620 auto state = LookupState(from);
1621 state->m_mleCommonInfo = mleCommonInfo;
1624 {mleCommonInfo->m_mldMacAddress, state});
1627 Ptr<const HtCapabilities>
1630 return LookupState(from)->m_htCapabilities;
1636 return LookupState(from)->m_vhtCapabilities;
1642 return LookupState(from)->m_heCapabilities;
1648 return LookupState(from)->m_ehtCapabilities;
1651 std::optional<std::reference_wrapper<CommonInfoBasicMle::EmlCapabilities>>
1652 WifiRemoteStationManager::GetStationEmlCapabilities(
const Mac48Address& from)
1654 if (
auto state = LookupState(from);
1655 state->m_mleCommonInfo && state->m_mleCommonInfo->m_emlCapabilities)
1657 return state->m_mleCommonInfo->m_emlCapabilities.value();
1659 return std::nullopt;
1662 std::optional<std::reference_wrapper<CommonInfoBasicMle::MldCapabilities>>
1663 WifiRemoteStationManager::GetStationMldCapabilities(
const Mac48Address& from)
1665 if (
auto state = LookupState(from);
1666 state->m_mleCommonInfo && state->m_mleCommonInfo->m_mldCapabilities)
1668 return state->m_mleCommonInfo->m_mldCapabilities.value();
1670 return std::nullopt;
1679 bool supported =
false;
1682 supported |= htCapabilities->GetLdpc();
1684 if (vhtCapabilities)
1686 supported |= vhtCapabilities->GetRxLdpc();
1690 supported |= heCapabilities->GetLdpcCodingInPayload();
1696 WifiRemoteStationManager::GetDefaultMode()
const
1699 auto defaultTxMode = m_wifiPhy->GetDefaultMode();
1701 return defaultTxMode;
1705 WifiRemoteStationManager::GetDefaultMcs()
const
1707 return HtPhy::GetHtMcs0();
1715 if (!GetHtSupported() || !GetHtSupported(st))
1717 return GetDefaultMode();
1722 if (GetHeSupported() && GetHeSupported(st))
1726 else if (GetVhtSupported() && GetVhtSupported(st))
1732 return *m_wifiPhy->GetPhyEntity(modClass)->begin();
1740 for (
auto& state : m_stations)
1742 delete (state.second);
1745 m_bssBasicRateSet.clear();
1746 m_bssBasicMcsSet.clear();
1757 NS_FATAL_ERROR(
"It is not allowed to add a HT rate in the BSSBasicRateSet!");
1759 for (uint8_t i = 0; i < GetNBasicModes(); i++)
1761 if (GetBasicMode(i) == mode)
1766 m_bssBasicRateSet.push_back(mode);
1770 WifiRemoteStationManager::GetNBasicModes()
const
1772 return static_cast<uint8_t
>(m_bssBasicRateSet.size());
1776 WifiRemoteStationManager::GetBasicMode(uint8_t i)
const
1779 return m_bssBasicRateSet[i];
1783 WifiRemoteStationManager::GetNNonErpBasicModes()
const
1786 for (
auto i = m_bssBasicRateSet.begin(); i != m_bssBasicRateSet.end(); i++)
1798 WifiRemoteStationManager::GetNonErpBasicMode(uint8_t i)
const
1803 for (
auto j = m_bssBasicRateSet.begin(); j != m_bssBasicRateSet.end();)
1819 return m_bssBasicRateSet[index];
1826 for (uint8_t i = 0; i < GetNBasicMcs(); i++)
1828 if (GetBasicMcs(i) == mcs)
1833 m_bssBasicMcsSet.push_back(mcs);
1837 WifiRemoteStationManager::GetNBasicMcs()
const
1839 return static_cast<uint8_t
>(m_bssBasicMcsSet.size());
1843 WifiRemoteStationManager::GetBasicMcs(uint8_t i)
const
1846 return m_bssBasicMcsSet[i];
1850 WifiRemoteStationManager::GetNonUnicastMode()
const
1852 if (m_nonUnicastMode ==
WifiMode())
1854 if (GetNBasicModes() > 0)
1856 return GetBasicMode(0);
1860 return GetDefaultMode();
1865 return m_nonUnicastMode;
1893 uint16_t nSuccessfulMpdus,
1894 uint16_t nFailedMpdus,
1897 uint16_t dataChannelWidth,
1900 NS_LOG_DEBUG(
"DoReportAmpduTxStatus received but the manager does not handle A-MPDUs!");
1913 NS_ASSERT(i < GetNMcsSupported(station));
1920 NS_ASSERT(i < GetNNonErpSupported(station));
1964 if (!htCapabilities)
1968 return htCapabilities->GetShortGuardInterval20();
1988 if (!htCapabilities)
1992 return htCapabilities->GetRxHighestSupportedAntennas();
2002 WifiRemoteStationManager::GetPhy()
const
2008 WifiRemoteStationManager::GetMac()
const
2053 return mleCommonInfo && mleCommonInfo->m_emlCapabilities &&
2054 mleCommonInfo->m_emlCapabilities->emlsrSupport == 1;
2089 return LookupState(
address)->m_channelWidth;
2097 if (!htCapabilities)
2101 return htCapabilities->GetShortGuardInterval20();
2109 if (!htCapabilities)
2113 return htCapabilities->GetRxHighestSupportedAntennas();
2119 return static_cast<uint8_t
>(LookupState(
address)->m_operationalMcsSet.size());
2125 return (LookupState(
address)->m_dsssSupported);
2131 return (LookupState(
address)->m_erpOfdmSupported);
2137 return (LookupState(
address)->m_ofdmSupported);
2143 return bool(LookupState(
address)->m_htCapabilities);
2149 return bool(LookupState(
address)->m_vhtCapabilities);
2155 return bool(LookupState(
address)->m_heCapabilities);
2161 return (
bool)(LookupState(
address)->m_ehtCapabilities);
2167 auto mleCommonInfo = LookupState(
address)->m_mleCommonInfo;
2168 return mleCommonInfo && mleCommonInfo->m_emlCapabilities &&
2169 mleCommonInfo->m_emlCapabilities->emlsrSupport == 1;
2175 if (
auto stateIt = m_states.find(
address); stateIt != m_states.cend())
2177 return stateIt->second->m_emlsrEnabled;
2183 WifiRemoteStationManager::SetDefaultTxPowerLevel(uint8_t txPower)
2185 m_defaultTxPowerLevel = txPower;
2189 WifiRemoteStationManager::GetNumberOfAntennas()
const
2191 return m_wifiPhy->GetNumberOfAntennas();
2195 WifiRemoteStationManager::GetMaxNumberOfTransmitStreams()
const
2197 return m_wifiPhy->GetMaxSupportedTxSpatialStreams();
2203 return (GetLdpcSupported() && GetLdpcSupported(dest));
The IEEE 802.11be EHT Capabilities.
uint8_t GetHighestSupportedRxMcs(EhtMcsAndNssSet::EhtMcsMapType mapType)
Get the highest supported RX MCS for a given EHT-MCS map type.
Hold variables of type enum.
static WifiMode GetErpOfdmRate(uint64_t rate)
Return a WifiMode for ERP-OFDM corresponding to the provided rate.
static WifiMode GetErpOfdmRate6Mbps()
Return a WifiMode for ERP-OFDM at 6 Mbps.
The IEEE 802.11ax HE Capabilities.
uint8_t GetHighestMcsSupported() const
Get highest MCS supported.
bool GetHeSuPpdu1xHeLtf800nsGi() const
Get 1xHE-LTF and 800ns GI in HE SU PPDU reception support.
uint8_t GetChannelWidthSet() const
Get channel width set.
The HT Capabilities Information Element.
uint8_t GetSupportedChannelWidth() const
Return the supported channel width.
bool IsSupportedMcs(uint8_t mcs) const
Return the is MCS supported flag.
A base class which provides memory management and object aggregation.
static WifiMode GetOfdmRate(uint64_t rate, uint16_t bw=20)
Return a WifiMode for OFDM corresponding to the provided rate and the channel bandwidth (20,...
static Time Now()
Return the current simulation virtual time.
uint16_t GetAssociationId() const
Return the association ID.
bool IsAssociated() const
Return whether we are associated with an AP.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
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.
TypeOfStation GetTypeOfStation() const
Return the type of station.
represent a single transmission mode
bool IsHigherDataRate(WifiMode mode) const
WifiModulationClass GetModulationClass() const
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
uint8_t GetMcsValue() const
Ptr< VhtConfiguration > GetVhtConfiguration() const
Ptr< EhtConfiguration > GetEhtConfiguration() const
Ptr< HtConfiguration > GetHtConfiguration() const
Ptr< HeConfiguration > GetHeConfiguration() const
uint16_t GetChannelWidth() const
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
uint16_t GetTxBandwidth(WifiMode mode, uint16_t maxAllowedBandWidth=std::numeric_limits< uint16_t >::max()) const
Get the bandwidth for a transmission occurring on the current operating channel and using the given W...
std::list< WifiMode > GetMcsList() const
The WifiPhy::GetMcsList() method is used (e.g., by a WifiRemoteStationManager) to determine the set o...
std::list< WifiMode > GetModeList() const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
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.
void ReportDataFailed(Ptr< const WifiMpdu > mpdu)
Should be invoked whenever the AckTimeout associated to a transmission attempt expires.
bool GetQosSupported(Mac48Address address) const
Return whether the given station is QoS capable.
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)
uint32_t m_fragmentationThreshold
Current threshold for fragmentation.
void SetShortSlotTimeEnabled(bool enable)
Enable or disable short slot time.
void SetPsMode(const Mac48Address &address, bool isInPsMode)
Register whether the STA is in Power Save mode or not.
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.
uint32_t GetNFragments(Ptr< const WifiMpdu > mpdu)
Return the number of fragments needed for the given packet.
uint16_t GetAssociationId(Mac48Address remoteAddress) const
Get the AID of a remote station.
ProtectionMode m_htProtectionMode
Protection mode for HT stations when non-HT stations are detected.
void AdjustTxVectorForIcf(WifiTxVector &txVector) const
Adjust the TXVECTOR for an initial Control frame to ensure that the modulation class is non-HT and th...
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.
uint32_t GetFragmentationThreshold() const
Return the fragmentation threshold.
bool NeedRetransmission(Ptr< const WifiMpdu > mpdu)
uint8_t GetNBasicModes() const
Return the number of basic modes we support.
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.
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 GetShortSlotTimeEnabled() const
Return whether the device uses short slot time.
void DoDispose() override
Destructor implementation.
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)
uint8_t GetDefaultTxPowerLevel() const
bool IsLastFragment(Ptr< const WifiMpdu > mpdu, uint32_t fragmentNumber)
void ReportFinalDataFailed(Ptr< const WifiMpdu > mpdu)
Should be invoked after calling ReportDataFailed if NeedRetransmission returns false.
~WifiRemoteStationManager() override
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.
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...
std::optional< Mac48Address > GetAffiliatedStaAddress(const Mac48Address &mldAddress) const
Get the address of the remote station operating on this link and affiliated with the MLD having the g...
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.
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...
void RemoveAllSupportedMcs(Mac48Address address)
Invoked in a STA or AP to delete all of the supported MCS by a destination.
uint32_t DoGetFragmentationThreshold() const
Return the current fragmentation threshold.
WifiModeList m_bssBasicMcsSet
basic MCS set
TracedCallback< Mac48Address > m_macTxFinalRtsFailed
The trace source fired when the transmission of a RTS has exceeded the maximum number of attempts.
WifiMode GetNonUnicastMode() const
Return a mode for non-unicast packets.
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.
virtual WifiTxVector DoGetDataTxVector(WifiRemoteStation *station, uint16_t allowedWidth)=0
WifiMode GetDefaultMcs() const
Return the default Modulation and Coding Scheme (MCS) index.
Ptr< WifiPhy > m_wifiPhy
This is a pointer to the WifiPhy associated with this WifiRemoteStationManager that is set on call to...
void ReportRxOk(Mac48Address address, RxSignalInfo rxSignalInfo, WifiTxVector txVector)
uint8_t m_defaultTxPowerLevel
Default transmission power level.
static TypeId GetTypeId()
Get the type ID.
WifiMode m_nonUnicastMode
Transmission mode for non-unicast Data frames.
void SetUseNonHtProtection(bool enable)
Enable or disable protection for non-HT stations.
uint16_t GetGuardInterval() const
Return the supported HE guard interval duration (in nanoseconds).
bool IsAssociated(Mac48Address address) const
Return whether the station associated.
WifiRemoteStationManager()
bool NeedFragmentation(Ptr< const WifiMpdu > mpdu)
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...
uint32_t GetFragmentOffset(Ptr< const WifiMpdu > mpdu, uint32_t fragmentNumber)
WifiRemoteStationInfo GetInfo(Mac48Address address)
uint32_t GetFragmentSize(Ptr< const WifiMpdu > mpdu, uint32_t fragmentNumber)
WifiTxVector GetCtsToSelfTxVector()
Since CTS-to-self parameters are not dependent on the station, it is implemented in wifi remote stati...
uint8_t GetNBasicMcs() const
Return the number of basic MCS index.
bool GetHtSupported() const
Return whether the device has HT capability support enabled.
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...
void RecordGotAssocTxOk(Mac48Address address)
Records that we got an ACK for the association response we sent.
bool GetLdpcSupported() const
Return whether the device has LDPC support enabled.
WifiTxVector GetRtsTxVector(Mac48Address address, uint16_t allowedWidth)
bool GetEhtSupported() const
Return whether the device has EHT capability support enabled.
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::optional< double > GetMostRecentRssi(Mac48Address address) const
std::shared_ptr< WifiRemoteStationState > LookupState(Mac48Address address) const
Return the state of the station associated with the given address.
std::array< uint32_t, AC_BE_NQOS > m_ssrc
short retry count per AC
void RecordAssocRefused(Mac48Address address)
Records that association request was refused.
bool IsInPsMode(const Mac48Address &address) const
Return whether the STA is currently in Power Save mode.
void ReportFinalRtsFailed(const WifiMacHeader &header)
Should be invoked after calling ReportRtsFailed if NeedRetransmission returns false.
uint8_t GetNumberOfAntennas() const
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.
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.
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.
bool GetShortGuardIntervalSupported() const
Return whether the device has SGI support enabled.
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.
virtual WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station)=0
uint16_t GetChannelWidthSupported(Mac48Address address) const
Return the channel width supported by the station.
uint32_t m_maxSlrc
Maximum STA long retry count (SLRC)
void Reset()
Reset the station, invoked in a STA upon dis-association or in an AP upon reboot.
bool GetUseNonErpProtection() const
Return whether the device supports protection of non-ERP stations.
bool IsAssocRefused(Mac48Address address) const
Return whether we refused an association request from the given station.
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...
bool GetVhtSupported() const
Return whether the device has VHT capability support enabled.
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.
WifiTxVector GetDataTxVector(const WifiMacHeader &header, uint16_t allowedWidth)
void ReportDataOk(Ptr< const WifiMpdu > 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.
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 GetShortPreambleEnabled() const
Return whether the device uses short PHY preambles.
bool GetHeSupported() const
Return whether the device has HE capability support enabled.
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)
WifiMode GetDefaultMode() const
Return the default transmission mode.
void RecordGotAssocTxFailed(Mac48Address address)
Records that we missed an ACK for the association response we sent.
std::optional< Mac48Address > GetMldAddress(const Mac48Address &address) const
Get the address of the MLD the given station is affiliated with, if any.
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...
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...
bool GetUseNonHtProtection() const
Return whether the device supports protection of non-HT stations.
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.
WifiModulationClass GetModulationClass() const
Get the modulation class specified by this TXVECTOR.
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.
void SetBssColor(uint8_t color)
Set the BSS color.
void SetNTx(uint8_t nTx)
Sets the number of TX antennas.
uint16_t GetChannelWidth() 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,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
void Reset()
Reset the initial value of every attribute as well as the value of every global to what they were bef...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#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.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time Seconds(double value)
Construct a Time in the indicated unit.
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.
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 ...
@ WIFI_PHY_BAND_6GHZ
The 6 GHz band.
@ WIFI_PHY_BAND_2_4GHZ
The 2.4 GHz band.
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
@ 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_EHT
EHT (Clause 36)
@ 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)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static const uint16_t WIFI_MAC_FCS_LENGTH
The length in octets 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.
Ptr< const AttributeChecker > MakeEnumChecker(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
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 AttributeAccessor > MakeUintegerAccessor(T1 a1)
std::vector< WifiMode > WifiModeList
In various parts of the code, folk are interested in maintaining a list of transmission modes.
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU)
EhtMcsMapType
The different EHT-MCS map types as defined in 9.4.2.313.4 Supported EHT-MCS And NSS Set field.
RxSignalInfo structure containing info on the received signal.
double snr
SNR in linear scale.
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.
std::shared_ptr< CommonInfoBasicMle > m_mleCommonInfo
remote station Multi-Link Element Common Info
Mac48Address m_address
Mac48Address of the remote station.
uint16_t m_channelWidth
Channel width (in MHz) 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.
Ptr< const EhtCapabilities > m_ehtCapabilities
remote station EHT capabilities
Ptr< const VhtCapabilities > m_vhtCapabilities
remote station VHT capabilities
WifiRemoteStationInfo m_info
remote station info
bool m_emlsrEnabled
whether EMLSR mode is enabled on this link
Ptr< const HtCapabilities > m_htCapabilities
remote station HT capabilities
Ptr< const HeCapabilities > m_heCapabilities
remote station HE capabilities