22#include "ns3/boolean.h" 
   23#include "ns3/eht-configuration.h" 
   25#include "ns3/erp-ofdm-phy.h" 
   26#include "ns3/he-configuration.h" 
   27#include "ns3/ht-configuration.h" 
   28#include "ns3/ht-phy.h" 
   30#include "ns3/simulator.h" 
   31#include "ns3/uinteger.h" 
   32#include "ns3/vht-configuration.h" 
   45        TypeId(
"ns3::WifiRemoteStationManager")
 
   49            .AddAttribute(
"MaxSsrc",
 
   50                          "The maximum number of retransmission attempts for any packet with size " 
   51                          "<= RtsCtsThreshold. " 
   52                          "This value will not have any effect on some rate control algorithms.",
 
   57                          "Use WifiMac::FrameRetryLimit instead")
 
   59            .AddAttribute(
"MaxSlrc",
 
   60                          "The maximum number of retransmission attempts for any packet with size " 
   62                          "This value will not have any effect on some rate control algorithms.",
 
   67                          "Use WifiMac::FrameRetryLimit instead")
 
   69                "IncrementRetryCountUnderBa",
 
   70                "The 802.11-2020 standard states that the retry count for frames that are part of " 
   71                "a Block Ack agreement shall not be incremented when a transmission fails. As a " 
   72                "consequence, frames that are part of a Block Ack agreement are not dropped based " 
   73                "on the number of retries. Set this attribute to true to override the standard " 
   74                "behavior and increment the retry count (and eventually drop) frames that are " 
   75                "part of a Block Ack agreement.",
 
   81                "If the size of the PSDU is bigger than this value, we use an RTS/CTS " 
   82                "handshake before sending the data frame." 
   83                "This value will not have any effect on some rate control algorithms.",
 
   87            .AddAttribute(
"RtsCtsTxDurationThresh",
 
   88                          "If this threshold is a strictly positive value and the TX duration of " 
   89                          "the PSDU is greater than or equal to this threshold, we use an RTS/CTS " 
   90                          "handshake before sending the data frame.",
 
   95                "FragmentationThreshold",
 
   96                "If the size of the PSDU is bigger than this value, we fragment it such that the " 
   97                "size of the fragments are equal or smaller. " 
   98                "This value does not apply when it is carried in an A-MPDU. " 
   99                "This value will not have any effect on some rate control algorithms.",
 
  104            .AddAttribute(
"NonUnicastMode",
 
  105                          "Wifi mode used for non-unicast transmissions.",
 
  109            .AddAttribute(
"DefaultTxPowerLevel",
 
  110                          "Default power level to be used for transmissions. " 
  111                          "This is the power level that is used by all those WifiManagers that do " 
  112                          "not implement TX power control.",
 
  116            .AddAttribute(
"ErpProtectionMode",
 
  117                          "Protection mode used when non-ERP STAs are connected to an ERP AP: " 
  118                          "Rts-Cts or Cts-To-Self",
 
  126            .AddAttribute(
"HtProtectionMode",
 
  127                          "Protection mode used when non-HT STAs are connected to a HT AP: Rts-Cts " 
  136            .AddTraceSource(
"MacTxRtsFailed",
 
  137                            "The transmission of a RTS by the MAC layer has failed",
 
  139                            "ns3::Mac48Address::TracedCallback")
 
  140            .AddTraceSource(
"MacTxDataFailed",
 
  141                            "The transmission of a data packet by the MAC layer has failed",
 
  143                            "ns3::Mac48Address::TracedCallback")
 
  145                "MacTxFinalRtsFailed",
 
  146                "The transmission of a RTS has exceeded the maximum number of attempts",
 
  148                "ns3::Mac48Address::TracedCallback")
 
  150                "MacTxFinalDataFailed",
 
  151                "The transmission of a data packet has exceeded the maximum number of attempts",
 
  153                "ns3::Mac48Address::TracedCallback");
 
 
  159      m_useNonErpProtection(false),
 
  160      m_useNonHtProtection(false),
 
  161      m_shortPreambleEnabled(false),
 
  162      m_shortSlotTimeEnabled(false)
 
 
  302        return htConfiguration->m_ldpcSupported;
 
 
  312        return htConfiguration->m_sgiSupported;
 
 
  326        gi = heConfiguration->GetGuardInterval();
 
 
  339                                                  bool isShortPreambleSupported)
 
  343    LookupState(address)->m_shortPreamble = isShortPreambleSupported;
 
 
  348                                                  bool isShortSlotTimeSupported)
 
  352    LookupState(address)->m_shortSlotTime = isShortSlotTimeSupported;
 
 
  361    for (
const auto& i : state->m_operationalRateSet)
 
  371        state->m_dsssSupported = 
true;
 
  375        state->m_erpOfdmSupported = 
true;
 
  379        state->m_ofdmSupported = 
true;
 
  381    state->m_operationalRateSet.push_back(mode);
 
 
  390    state->m_operationalRateSet.clear();
 
  393        state->m_operationalRateSet.push_back(mode);
 
  394        if (mode.IsMandatory())
 
 
  409    state->m_operationalMcsSet = 
WifiModeList(mcsList.begin(), mcsList.end());
 
 
  426    for (
const auto& i : state->m_operationalMcsSet)
 
  433    state->m_operationalMcsSet.push_back(mcs);
 
 
  457    if (address.IsGroup())
 
 
  467    if (address.IsGroup())
 
 
  477    if (address.IsGroup())
 
 
  515    if (address.IsGroup())
 
 
  532    std::shared_ptr<WifiRemoteStationState> state;
 
  533    if (!remoteAddress.IsGroup() &&
 
 
  557            if (staMac->IsAssociated())
 
  559                staId = staMac->GetAssociationId();
 
 
  580std::optional<Mac48Address>
 
  583    if (
auto stateIt = 
m_states.find(address);
 
  584        stateIt != 
m_states.end() && stateIt->second->m_mleCommonInfo)
 
  586        return stateIt->second->m_mleCommonInfo->m_mldMacAddress;
 
 
  592std::optional<Mac48Address>
 
  595    auto stateIt = 
m_states.find(mldAddress);
 
  597    if (stateIt == 
m_states.end() || !stateIt->second->m_mleCommonInfo)
 
  603    NS_ASSERT(stateIt->second->m_mleCommonInfo->m_mldMacAddress == mldAddress);
 
  604    return stateIt->second->m_address;
 
 
  611    const auto address = header.
GetAddr1();
 
  612    if (!header.
IsMgt() && address.IsGroup())
 
  633        auto channelWidth = allowedWidth;
 
  637                rxWidth < channelWidth)
 
  639                channelWidth = rxWidth;
 
  661                      (
static_cast<uint16_t
>(allowedWidth) % 20 != 0) ||
 
  664                                             << 
" MHz) exceeds allowed width (" << allowedWidth
 
 
  708                                                       MHz_u allowedWidth)
 const 
  714    if (allowedWidth >= 40 &&
 
 
  737    if (address.IsGroup())
 
 
  783    auto txMode = txVector.
GetMode();
 
  791        else if (rate >= 12e6)
 
 
  910        NS_LOG_DEBUG(
"WifiRemoteStationManager::GetControlAnswerMode returning " << mode);
 
  942        if (thismode.IsMandatory() && (!found || thismode.IsHigherDataRate(mode)) &&
 
  943            (!thismode.IsHigherDataRate(reqMode)) &&
 
  945                                                   thismode.GetModulationClass())))
 
  958            if (thismode.IsMandatory() && (!found || thismode.IsHigherDataRate(mode)) &&
 
  959                (!thismode.IsHigherCodeRate(reqMode)) &&
 
  985    NS_LOG_DEBUG(
"WifiRemoteStationManager::GetControlAnswerMode returning " << mode);
 
 
 1005    NS_ASSERT(!mpdu->GetHeader().GetAddr1().IsGroup());
 
 1007        QosUtilsMapTidToAc((mpdu->GetHeader().IsQosData()) ? mpdu->GetHeader().GetQosTid() : 0);
 
 
 1044    NS_LOG_FUNCTION(
this << *mpdu << ackSnr << ackMode << dataSnr << dataTxVector);
 
 
 1085    NS_ASSERT(!mpdu->GetHeader().GetAddr1().IsGroup());
 
 1088        QosUtilsMapTidToAc((mpdu->GetHeader().IsQosData()) ? mpdu->GetHeader().GetQosTid() : 0);
 
 
 1109    if (address.IsGroup())
 
 
 1120                                              uint16_t nSuccessfulMpdus,
 
 1121                                              uint16_t nFailedMpdus,
 
 1126    NS_LOG_FUNCTION(
this << address << nSuccessfulMpdus << nFailedMpdus << rxSnr << dataSnr
 
 1129    for (uint16_t i = 0; i < nFailedMpdus; i++)
 
 
 1142std::list<Ptr<WifiMpdu>>
 
 1168    const auto& hdr = psdu->GetHeader(0);
 
 1170    if (hdr.IsMgt() || (hdr.IsData() && !hdr.IsQosData()) ||
 
 1171        (hdr.IsQosData() && (!
m_wifiMac->GetBaAgreementEstablishedAsOriginator(
 
 1175        psdu->IncrementRetryCount();
 
 
 1179std::list<Ptr<WifiMpdu>>
 
 1185    std::list<Ptr<WifiMpdu>> mpdusToDrop;
 
 1189        if (mpdu->GetRetryCount() == 
m_wifiMac->GetFrameRetryLimit())
 
 1192            mpdusToDrop.push_back(mpdu);
 
 
 1205    if (!isGcr && address.IsGroup())
 
 1213        apMac->GetGcrManager()->GetAttribute(
"GcrProtectionMode", enumValue);
 
 1218        address = apMac->GetGcrManager()->GetIndividuallyAddressedRecipient(address);
 
 1228            "WifiRemoteStationManager::NeedRTS returning true to protect non-ERP stations");
 
 1235        NS_LOG_DEBUG(
"WifiRemoteStationManager::NeedRTS returning true to protect non-HT stations");
 
 
 1258            "WifiRemoteStationManager::NeedCtsToSelf returning true to protect non-ERP stations");
 
 1267            "WifiRemoteStationManager::NeedCtsToSelf returning true to protect non-HT stations");
 
 1274        apMac->GetGcrManager()->GetAttribute(
"GcrProtectionMode", enumValue);
 
 
 1343    if (mpdu->GetHeader().GetAddr1().IsGroup())
 
 1348    NS_LOG_DEBUG(
"WifiRemoteStationManager::NeedFragmentation result: " << std::boolalpha
 
 
 1359        NS_LOG_WARN(
"Fragmentation threshold should be larger than " 
 1370        if (threshold % 2 != 0)
 
 1372            NS_LOG_WARN(
"Fragmentation threshold should be an even number. Setting to " 
 
 1395        (mpdu->GetPacket()->GetSize() /
 
 1399    if ((mpdu->GetPacket()->GetSize() %
 
 1404    NS_LOG_DEBUG(
"WifiRemoteStationManager::GetNFragments returning " << nFragments);
 
 
 1412    NS_ASSERT(!mpdu->GetHeader().GetAddr1().IsGroup());
 
 1414    if (fragmentNumber >= nFragment)
 
 1416        NS_LOG_DEBUG(
"WifiRemoteStationManager::GetFragmentSize returning 0");
 
 1420    if (fragmentNumber == nFragment - 1)
 
 1423            mpdu->GetPacket()->GetSize() -
 
 1426        NS_LOG_DEBUG(
"WifiRemoteStationManager::GetFragmentSize returning " << lastFragmentSize);
 
 1427        return lastFragmentSize;
 
 1434        NS_LOG_DEBUG(
"WifiRemoteStationManager::GetFragmentSize returning " << fragmentSize);
 
 1435        return fragmentSize;
 
 
 1443    NS_ASSERT(!mpdu->GetHeader().GetAddr1().IsGroup());
 
 1447    NS_LOG_DEBUG(
"WifiRemoteStationManager::GetFragmentOffset returning " << fragmentOffset);
 
 1448    return fragmentOffset;
 
 
 1455    NS_ASSERT(!mpdu->GetHeader().GetAddr1().IsGroup());
 
 1457    NS_LOG_DEBUG(
"WifiRemoteStationManager::IsLastFragment returning " << std::boolalpha << isLast);
 
 
 1476    auto station = 
Lookup(address);
 
 1477    auto rssi = station->m_rssiAndUpdateTimePair.first;
 
 1478    auto ts = station->m_rssiAndUpdateTimePair.second;
 
 1479    if (ts.IsStrictlyPositive())
 
 1483    return std::nullopt;
 
 
 1486std::shared_ptr<WifiRemoteStationState>
 
 1489    if (
const auto stateIt = 
m_states.find(address); stateIt != 
m_states.cend())
 
 1491        return stateIt->second;
 
 1494    auto state = std::make_shared<WifiRemoteStationState>();
 
 1496    state->m_address = address;
 
 1500    state->m_dsssSupported = 
false;
 
 1501    state->m_erpOfdmSupported = 
false;
 
 1502    state->m_ofdmSupported = 
false;
 
 1503    state->m_htCapabilities = 
nullptr;
 
 1504    state->m_htOperation = 
nullptr;
 
 1505    state->m_vhtCapabilities = 
nullptr;
 
 1506    state->m_vhtOperation = 
nullptr;
 
 1507    state->m_heCapabilities = 
nullptr;
 
 1508    state->m_heOperation = 
nullptr;
 
 1509    state->m_ehtCapabilities = 
nullptr;
 
 1510    state->m_ehtOperation = 
nullptr;
 
 1511    state->m_mleCommonInfo = 
nullptr;
 
 1512    state->m_emlsrEnabled = 
false;
 
 1516    state->m_aggregation = 
false;
 
 1517    state->m_qosSupported = 
false;
 
 1518    state->m_isInPsMode = 
false;
 
 1520    NS_LOG_DEBUG(
"WifiRemoteStationManager::LookupState returning new state");
 
 
 1529    NS_ASSERT(address != m_wifiMac->GetAddress());
 
 1530    auto stationIt = m_stations.find(address);
 
 1532    if (stationIt != m_stations.end())
 
 1534        return stationIt->second;
 
 1538    station->
m_state = LookupState(address).get();
 
 
 1545WifiRemoteStationManager::SetAssociationId(
Mac48Address remoteAddress, uint16_t aid)
 
 1548    LookupState(remoteAddress)->m_aid = aid;
 
 
 1552WifiRemoteStationManager::SetQosSupport(
Mac48Address from, 
bool qosSupported)
 
 1555    LookupState(from)->m_qosSupported = qosSupported;
 
 
 1559WifiRemoteStationManager::SetEmlsrEnabled(
const Mac48Address& from, 
bool emlsrEnabled)
 
 1562    LookupState(from)->m_emlsrEnabled = emlsrEnabled;
 
 
 1571    auto state = LookupState(from);
 
 1574        state->m_channelWidth = 
MHz_u{40};
 
 1578        state->m_channelWidth = 
MHz_u{20};
 
 1580    SetQosSupport(from, 
true);
 
 1585            AddSupportedMcs(from, mcs);
 
 1588    state->m_htCapabilities = Create<const HtCapabilities>(htCapabilities);
 
 
 1595    auto state = LookupState(from);
 
 1598        state->m_channelWidth = 
MHz_u{20};
 
 1600    state->m_htOperation = Create<const HtOperation>(htOperation);
 
 
 1604WifiRemoteStationManager::AddStationExtendedCapabilities(
 
 1609    auto state = LookupState(from);
 
 1610    state->m_extendedCapabilities = Create<const ExtendedCapabilities>(extendedCapabilities);
 
 
 1619    auto state = LookupState(from);
 
 1622        state->m_channelWidth = 
MHz_u{160};
 
 1626        state->m_channelWidth = 
MHz_u{80};
 
 1628    for (uint8_t i = 1; i <= m_wifiPhy->GetMaxSupportedTxSpatialStreams(); i++)
 
 1634                AddSupportedMcs(from, mcs);
 
 1638    state->m_vhtCapabilities = Create<const VhtCapabilities>(vhtCapabilities);
 
 
 1646    auto state = LookupState(from);
 
 1654        state->m_channelWidth = std::min(
MHz_u{40}, state->m_channelWidth);
 
 1658        state->m_channelWidth = std::min(
MHz_u{160}, state->m_channelWidth);
 
 1660    state->m_vhtOperation = Create<const VhtOperation>(vhtOperation);
 
 
 1666    return LookupState(from)->m_vhtOperation;
 
 
 1675    auto state = LookupState(from);
 
 1681            state->m_channelWidth = 
MHz_u{160};
 
 1685            state->m_channelWidth = 
MHz_u{80};
 
 1689            state->m_channelWidth = 
MHz_u{20};
 
 1697            state->m_channelWidth = 
MHz_u{40};
 
 1701            state->m_channelWidth = 
MHz_u{20};
 
 1717            AddSupportedMcs(from, mcs);
 
 1720    state->m_heCapabilities = Create<const HeCapabilities>(heCapabilities);
 
 1721    SetQosSupport(from, 
true);
 
 
 1728    auto state = LookupState(from);
 
 1731        switch (operation6GHz->m_chWid)
 
 1734            state->m_channelWidth = 
MHz_u{20};
 
 1737            state->m_channelWidth = 
MHz_u{40};
 
 1740            state->m_channelWidth = 
MHz_u{80};
 
 1743            state->m_channelWidth = 
MHz_u{160};
 
 1746            NS_FATAL_ERROR(
"Invalid channel width value in 6 GHz Operation Information field");
 
 1749    state->m_heOperation = Create<const HeOperation>(heOperation);
 
 
 1753WifiRemoteStationManager::AddStationHe6GhzCapabilities(
 
 1759    auto state = LookupState(from);
 
 1760    state->m_he6GhzBandCapabilities = Create<const He6GhzBandCapabilities>(he6GhzCapabilities);
 
 1761    SetQosSupport(from, 
true);
 
 
 1770    auto state = LookupState(from);
 
 1774        state->m_channelWidth = 
MHz_u{320};
 
 1779        for (uint8_t mapType = 0; mapType < EhtMcsAndNssSet::EHT_MCS_MAP_TYPE_MAX; ++mapType)
 
 1784                AddSupportedMcs(from, mcs);
 
 1788    state->m_ehtCapabilities = Create<const EhtCapabilities>(ehtCapabilities);
 
 1789    SetQosSupport(from, 
true);
 
 
 1797    auto state = LookupState(from);
 
 1798    if (
auto opControl = ehtOperation.
m_opInfo)
 
 1800        switch (opControl->control.channelWidth)
 
 1803            state->m_channelWidth = 
MHz_u{20};
 
 1806            state->m_channelWidth = 
MHz_u{40};
 
 1809            state->m_channelWidth = 
MHz_u{80};
 
 1812            state->m_channelWidth = 
MHz_u{160};
 
 1815            state->m_channelWidth = 
MHz_u{320};
 
 1818            NS_FATAL_ERROR(
"Invalid channel width value in EHT Operation Information field");
 
 1821    state->m_ehtOperation = Create<const EhtOperation>(ehtOperation);
 
 
 1825WifiRemoteStationManager::AddStationMleCommonInfo(
 
 1827    const std::shared_ptr<CommonInfoBasicMle>& mleCommonInfo)
 
 1830    auto state = LookupState(from);
 
 1831    state->m_mleCommonInfo = mleCommonInfo;
 
 1834        mleCommonInfo->m_mldMacAddress,
 
 
 1841    return LookupState(from)->m_htCapabilities;
 
 
 1847    return LookupState(from)->m_htOperation;
 
 
 1851WifiRemoteStationManager::GetStationExtendedCapabilities(
const Mac48Address& from)
 
 1853    return LookupState(from)->m_extendedCapabilities;
 
 
 1859    return LookupState(from)->m_vhtCapabilities;
 
 
 1865    return LookupState(from)->m_heCapabilities;
 
 
 1871    return LookupState(from)->m_heOperation;
 
 
 1875WifiRemoteStationManager::GetStationHe6GhzCapabilities(
const Mac48Address& from)
 const 
 1877    return LookupState(from)->m_he6GhzBandCapabilities;
 
 
 1883    return LookupState(from)->m_ehtCapabilities;
 
 
 1889    return LookupState(from)->m_ehtOperation;
 
 
 1892std::optional<std::reference_wrapper<CommonInfoBasicMle::EmlCapabilities>>
 
 1893WifiRemoteStationManager::GetStationEmlCapabilities(
const Mac48Address& from)
 
 1895    if (
auto state = LookupState(from);
 
 1896        state->m_mleCommonInfo && state->m_mleCommonInfo->m_emlCapabilities)
 
 1898        return state->m_mleCommonInfo->m_emlCapabilities.value();
 
 1900    return std::nullopt;
 
 
 1903std::optional<std::reference_wrapper<CommonInfoBasicMle::MldCapabilities>>
 
 1904WifiRemoteStationManager::GetStationMldCapabilities(
const Mac48Address& from)
 
 1906    if (
auto state = LookupState(from);
 
 1907        state->m_mleCommonInfo && state->m_mleCommonInfo->m_mldCapabilities)
 
 1909        return state->m_mleCommonInfo->m_mldCapabilities.value();
 
 1911    return std::nullopt;
 
 
 1920    bool supported = 
false;
 
 1923        supported |= htCapabilities->GetLdpc();
 
 1925    if (vhtCapabilities)
 
 1927        supported |= vhtCapabilities->GetRxLdpc();
 
 1931        supported |= heCapabilities->GetLdpcCodingInPayload();
 
 
 1937WifiRemoteStationManager::GetDefaultMode()
 const 
 1940    auto defaultTxMode = m_wifiPhy->GetDefaultMode();
 
 1942    return defaultTxMode;
 
 
 1946WifiRemoteStationManager::GetDefaultMcs()
 const 
 1948    return HtPhy::GetHtMcs0();
 
 
 1956    if ((!m_wifiPhy->GetDevice()->GetHtConfiguration()) ||
 
 1957        (!GetHtSupported(st) && !GetStationHe6GhzCapabilities(st->
m_state->
m_address)))
 
 1959        return GetDefaultMode();
 
 1964    if (GetHeSupported() && GetHeSupported(st))
 
 1968    else if (GetVhtSupported() && GetVhtSupported(st))
 
 1974    return *m_wifiPhy->GetPhyEntity(modClass)->begin();
 
 
 1978WifiRemoteStationManager::Reset()
 
 1982    for (
auto& state : m_stations)
 
 1984        delete (state.second);
 
 1987    m_bssBasicRateSet.clear();
 
 1988    m_bssBasicMcsSet.clear();
 
 
 1999        NS_FATAL_ERROR(
"It is not allowed to add a HT rate in the BSSBasicRateSet!");
 
 2001    for (uint8_t i = 0; i < GetNBasicModes(); i++)
 
 2003        if (GetBasicMode(i) == mode)
 
 2008    m_bssBasicRateSet.push_back(mode);
 
 
 2012WifiRemoteStationManager::GetNBasicModes()
 const 
 2014    return static_cast<uint8_t
>(m_bssBasicRateSet.size());
 
 
 2018WifiRemoteStationManager::GetBasicMode(uint8_t i)
 const 
 2021    return m_bssBasicRateSet[i];
 
 
 2025WifiRemoteStationManager::GetNNonErpBasicModes()
 const 
 2028    for (
auto i = m_bssBasicRateSet.begin(); i != m_bssBasicRateSet.end(); i++)
 
 
 2040WifiRemoteStationManager::GetNonErpBasicMode(uint8_t i)
 const 
 2045    for (
auto j = m_bssBasicRateSet.begin(); j != m_bssBasicRateSet.end();)
 
 2061    return m_bssBasicRateSet[index];
 
 
 2068    for (uint8_t i = 0; i < GetNBasicMcs(); i++)
 
 2070        if (GetBasicMcs(i) == mcs)
 
 2075    m_bssBasicMcsSet.push_back(mcs);
 
 
 2079WifiRemoteStationManager::GetNBasicMcs()
 const 
 2081    return static_cast<uint8_t
>(m_bssBasicMcsSet.size());
 
 
 2085WifiRemoteStationManager::GetBasicMcs(uint8_t i)
 const 
 2088    return m_bssBasicMcsSet[i];
 
 
 2092WifiRemoteStationManager::GetNonUnicastMode()
 const 
 2094    if (m_nonUnicastMode == 
WifiMode())
 
 2096        if (GetNBasicModes() > 0)
 
 2098            return GetBasicMode(0);
 
 2102            return GetDefaultMode();
 
 2107        return m_nonUnicastMode;
 
 
 2114    const auto& to = header.
GetAddr1();
 
 2118    const auto mode = GetNonUnicastMode();
 
 2119    groupcastTxVector.SetMode(mode);
 
 2120    groupcastTxVector.SetPreambleType(
 
 2122    groupcastTxVector.SetTxPowerLevel(m_defaultTxPowerLevel);
 
 2123    groupcastTxVector.SetChannelWidth(m_wifiPhy->GetTxBandwidth(mode, allowedWidth));
 
 2124    groupcastTxVector.SetNTx(GetNumberOfAntennas());
 
 2126    if (to.IsBroadcast())
 
 2128        return groupcastTxVector;
 
 2131    auto apMac = DynamicCast<ApWifiMac>(m_wifiMac);
 
 2134        return groupcastTxVector;
 
 2137    auto gcrManager = apMac->GetGcrManager();
 
 2140        return groupcastTxVector;
 
 2143    const auto& groupStas = gcrManager->GetMemberStasForGroupAddress(to);
 
 2144    if (groupStas.empty())
 
 2146        return groupcastTxVector;
 
 2149    if (!gcrManager->UseConcealment(header))
 
 2151        return groupcastTxVector;
 
 2157    std::optional<WifiMode> groupcastMode;
 
 2158    auto maxWidth = allowedWidth;
 
 2159    auto maxNss = m_wifiPhy->GetMaxSupportedTxSpatialStreams();
 
 2160    std::map<WifiModulationClass, Time> minGisPerMc{
 
 2163    const std::map<WifiModulationClass, WifiModulationClass> giRefModClass{
 
 2170    for (
const auto& staAddress : groupStas)
 
 2176        const auto unicastTxVector = GetDataTxVector(hdr, allowedWidth);
 
 2183        if (!groupcastMode.has_value() ||
 
 2184            (unicastTxVector.GetModulationClass() < groupcastMode->GetModulationClass()) ||
 
 2185            ((unicastTxVector.GetModulationClass() == groupcastMode->GetModulationClass()) &&
 
 2186             (unicastTxVector.GetMode().GetMcsValue() < groupcastMode->GetMcsValue())))
 
 2188            groupcastMode = unicastTxVector.GetMode();
 
 2190        maxWidth = std::min(unicastTxVector.GetChannelWidth(), maxWidth);
 
 2191        maxNss = std::min(unicastTxVector.GetNss(), maxNss);
 
 2192        auto mc = unicastTxVector.GetModulationClass();
 
 2193        if (
const auto it = giRefModClass.find(mc); it != giRefModClass.cend())
 
 2197        if (
auto it = minGisPerMc.find(mc); it != minGisPerMc.end())
 
 2199            it->second = std::max(unicastTxVector.GetGuardInterval(), it->second);
 
 2204    groupcastTxVector.SetMode(*groupcastMode);
 
 2205    groupcastTxVector.SetPreambleType(
 
 2207    groupcastTxVector.SetChannelWidth(maxWidth);
 
 2208    groupcastTxVector.SetNss(maxNss);
 
 2209    auto mc = groupcastMode->GetModulationClass();
 
 2210    if (
const auto it = giRefModClass.find(mc); it != giRefModClass.cend())
 
 2214    if (
const auto it = minGisPerMc.find(mc); it != minGisPerMc.cend())
 
 2216        groupcastTxVector.SetGuardInterval(it->second);
 
 2219    return groupcastTxVector;
 
 
 2238                                                uint16_t nSuccessfulMpdus,
 
 2239                                                uint16_t nFailedMpdus,
 
 2242                                                MHz_u dataChannelWidth,
 
 2245    NS_LOG_DEBUG(
"DoReportAmpduTxStatus received but the manager does not handle A-MPDUs!");
 
 
 2258    NS_ASSERT(i < GetNMcsSupported(station));
 
 
 2265    NS_ASSERT(i < GetNNonErpSupported(station));
 
 
 2309    if (!htCapabilities)
 
 2313    return htCapabilities->GetShortGuardInterval20();
 
 
 2333    if (!htCapabilities)
 
 2337            return heCapabilities->GetHighestNssSupported();
 
 2341    return htCapabilities->GetRxHighestSupportedAntennas();
 
 
 2351WifiRemoteStationManager::GetPhy()
 const 
 
 2357WifiRemoteStationManager::GetMac()
 const 
 
 2402    return mleCommonInfo && mleCommonInfo->m_emlCapabilities &&
 
 2403           mleCommonInfo->m_emlCapabilities->emlsrSupport == 1;
 
 
 2436WifiRemoteStationManager::GetChannelWidthSupported(
Mac48Address address)
 const 
 2438    return LookupState(address)->m_channelWidth;
 
 
 2442WifiRemoteStationManager::GetShortGuardIntervalSupported(
Mac48Address address)
 const 
 2446    if (!htCapabilities)
 
 2450    return htCapabilities->GetShortGuardInterval20();
 
 
 2454WifiRemoteStationManager::GetNumberOfSupportedStreams(
Mac48Address address)
 const 
 2458    if (!htCapabilities)
 
 2462    return htCapabilities->GetRxHighestSupportedAntennas();
 
 
 2468    return static_cast<uint8_t
>(LookupState(address)->m_operationalMcsSet.size());
 
 
 2472WifiRemoteStationManager::GetDsssSupported(
const Mac48Address& address)
 const 
 2474    return (LookupState(address)->m_dsssSupported);
 
 
 2478WifiRemoteStationManager::GetErpOfdmSupported(
const Mac48Address& address)
 const 
 2480    return (LookupState(address)->m_erpOfdmSupported);
 
 
 2484WifiRemoteStationManager::GetOfdmSupported(
const Mac48Address& address)
 const 
 2486    return (LookupState(address)->m_ofdmSupported);
 
 
 2492    return bool(LookupState(address)->m_htCapabilities);
 
 
 2498    return bool(LookupState(address)->m_vhtCapabilities);
 
 
 2504    return bool(LookupState(address)->m_heCapabilities);
 
 
 2510    return (
bool)(LookupState(address)->m_ehtCapabilities);
 
 
 2514WifiRemoteStationManager::GetEmlsrSupported(
const Mac48Address& address)
 const 
 2516    auto mleCommonInfo = LookupState(address)->m_mleCommonInfo;
 
 2517    return mleCommonInfo && mleCommonInfo->m_emlCapabilities &&
 
 2518           mleCommonInfo->m_emlCapabilities->emlsrSupport == 1;
 
 
 2522WifiRemoteStationManager::GetEmlsrEnabled(
const Mac48Address& address)
 const 
 2524    if (
auto stateIt = m_states.find(address); stateIt != m_states.cend())
 
 2526        return stateIt->second->m_emlsrEnabled;
 
 
 2532WifiRemoteStationManager::SetDefaultTxPowerLevel(uint8_t txPower)
 
 2534    m_defaultTxPowerLevel = txPower;
 
 
 2538WifiRemoteStationManager::GetNumberOfAntennas()
 const 
 2540    return m_wifiPhy->GetNumberOfAntennas();
 
 
 2544WifiRemoteStationManager::GetMaxNumberOfTransmitStreams()
 const 
 2546    return m_wifiPhy->GetMaxSupportedTxSpatialStreams();
 
 
 2552    return (GetLdpcSupported() && GetLdpcSupported(dest));
 
 
AttributeValue implementation for Boolean.
The IEEE 802.11be EHT Capabilities.
EhtPhyCapabilities m_phyCapabilities
EHT PHY Capabilities Info subfield.
uint8_t GetHighestSupportedRxMcs(EhtMcsAndNssSet::EhtMcsMapType mapType) const
Get the highest supported RX MCS for a given EHT-MCS map type.
EHT Operation Information Element.
std::optional< EhtOpInfo > m_opInfo
EHT Operation Information.
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 Extended Capabilities Information Element.
The HE 6 GHz Band Capabilities (IEEE 802.11ax-2021 9.4.2.263)
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 HE Operation Information Element.
OptFieldWithPresenceInd< OpInfo6GHz > m_6GHzOpInfo
6 GHz Operation Information field
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.
The HT Operation Information Element.
uint8_t GetStaChannelWidth() const
Return the STA channel width.
A base class which provides memory management and object aggregation.
static WifiMode GetOfdmRate(uint64_t rate, MHz_u bw=MHz_u{20})
Return a WifiMode for OFDM corresponding to the provided rate and the channel bandwidth (20,...
Smart pointer class similar to boost::intrusive_ptr.
static Time Now()
Return the current simulation virtual time.
Simulation virtual time values and global simulation resolution.
bool IsStrictlyPositive() const
Exactly equivalent to t > 0.
AttributeValue implementation for Time.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
@ OBSOLETE
Attribute or trace source is not used anymore; simulation fails.
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.
The VHT Operation Information Element.
uint8_t GetChannelWidth() const
Return the Channel Width field in the VHT Operation information element.
represent a single transmission mode
bool IsHigherDataRate(WifiMode mode) const
WifiModulationClass GetModulationClass() const
uint64_t GetDataRate(MHz_u channelWidth, Time guardInterval, uint8_t nss) const
uint8_t GetMcsValue() const
AttributeValue implementation for WifiMode.
MHz_u GetTxBandwidth(WifiMode mode, MHz_u maxAllowedBandWidth=MHz_u{ std::numeric_limits< double >::max()}) const
Get the bandwidth for a transmission occurring on the current operating channel and using the given W...
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
MHz_u GetChannelWidth() const
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
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.
virtual WifiTxVector DoGetDataTxVector(WifiRemoteStation *station, MHz_u allowedWidth)=0
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.
virtual void DoIncrementRetryCountOnTxFailure(WifiRemoteStation *station, Ptr< WifiPsdu > psdu)
Increment the retry count (if needed) for the given PSDU, whose transmission failed.
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.
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)
Time GetGuardInterval() const
Return the shortest supported HE guard interval duration.
WifiTxVector GetRtsTxVector(Mac48Address address, MHz_u allowedWidth)
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.
void AdjustTxVectorForCtlResponse(WifiTxVector &txVector, MHz_u allowedWidth) const
Adjust the TXVECTOR for a control response frame to ensure that, if appropriate, the non-HT duplicate...
Time m_rtsCtsTxDurationThresh
TX duration threshold for RTS/CTS.
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.
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 frames are dropped.
~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...
virtual void DoReportAmpduTxStatus(WifiRemoteStation *station, uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus, double rxSnr, double dataSnr, MHz_u dataChannelWidth, uint8_t dataNss)
Typically called per A-MPDU, either when a Block ACK was successfully received or when a BlockAckTime...
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...
std::list< Ptr< WifiMpdu > > GetMpdusToDropOnTxFailure(Ptr< WifiPsdu > psdu)
Increment the retry count for all the MPDUs (if needed) in the given PSDU and find the MPDUs to drop ...
WifiTxVector GetDataTxVector(const WifiMacHeader &header, MHz_u allowedWidth)
std::optional< dBm_u > GetMostRecentRssi(Mac48Address address) const
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.
void ReportRxOk(Mac48Address address, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector)
uint32_t DoGetFragmentationThreshold() const
Return the current fragmentation threshold.
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
WifiTxVector GetGroupcastTxVector(const WifiMacHeader &header, MHz_u allowedWidth)
Return the TXVECTOR to use for a groupcast packet.
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 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...
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.
MHz_u GetChannelWidthSupported(Mac48Address address) const
Return the channel width supported by the station.
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 on the link this manager is associated wi...
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.
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::shared_ptr< WifiRemoteStationState > LookupState(Mac48Address address) const
Return the state of the station associated with the given address.
bool m_incrRetryCountUnderBa
whether to increment the retry count of frames that are part of a Block Ack agreement
std::array< uint32_t, AC_BE_NQOS > m_ssrc
short retry count per AC
virtual std::list< Ptr< WifiMpdu > > DoGetMpdusToDropOnTxFailure(WifiRemoteStation *station, Ptr< WifiPsdu > psdu)
Find the MPDUs to drop (possibly based on their frame retry count) in the given PSDU,...
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 frames are dropped.
uint8_t GetNumberOfAntennas() const
StationStates m_states
States of known stations.
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.
bool NeedCtsToSelf(const WifiTxVector &txVector, const WifiMacHeader &header)
Return if we need to do CTS-to-self before sending a DATA.
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...
virtual void DoReportDataOk(WifiRemoteStation *station, double ackSnr, WifiMode ackMode, double dataSnr, MHz_u dataChannelWidth, uint8_t dataNss)=0
This method is a pure virtual method that must be implemented by the sub-class.
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
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.
bool GetVhtSupported() const
Return whether the device has VHT capability support enabled on the link this manager is associated w...
ProtectionMode m_erpProtectionMode
Protection mode for ERP stations when non-ERP stations are detected.
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.
uint8_t m_linkId
the ID of the link this object is associated with
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.
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...
void SetLinkId(uint8_t linkId)
Set the ID of the link this Remote Station Manager is associated with.
bool NeedRts(const WifiMacHeader &header, const WifiTxParameters &txParams)
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 stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism,...
std::optional< Time > m_txDuration
TX duration of the frame.
uint32_t GetSize(Mac48Address receiver) const
Get the size in bytes of the (A-)MPDU addressed to the given receiver.
WifiTxVector m_txVector
TXVECTOR of the frame being prepared.
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 SetGuardInterval(Time 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.
void SetChannelWidth(MHz_u channelWidth)
Sets the selected channelWidth.
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.
MHz_u GetChannelWidth() const
void SetBssColor(uint8_t color)
Set the BSS color.
void SetNTx(uint8_t nTx)
Sets the number of TX antennas.
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...
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Ptr< const AttributeChecker > MakeUintegerChecker()
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeWifiModeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeChecker > MakeWifiModeChecker()
#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 NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
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.
U * PeekPointer(const Ptr< U > &p)
static constexpr uint32_t WIFI_DEFAULT_FRAG_THRESHOLD
The default value for dot11FragmentationThreshold (C.3 MIB detail in IEEE Std 802....
Time GetGuardIntervalForMode(WifiMode mode, const Ptr< WifiNetDevice > device)
Get the guard interval for a given WifiMode.
static constexpr 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.
double MHz_u
MHz weak type.
Ptr< const AttributeChecker > MakeEnumChecker(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
static constexpr uint32_t WIFI_MIN_RTS_THRESHOLD
The minimum value for dot11RTSThreshold (C.3 MIB detail in IEEE Std 802.11-2020)
static constexpr uint32_t WIFI_MIN_FRAG_THRESHOLD
The minimum value for dot11FragmentationThreshold (C.3 MIB detail in IEEE Std 802....
static constexpr uint32_t WIFI_MAX_FRAG_THRESHOLD
The maximum value for dot11FragmentationThreshold (C.3 MIB detail in IEEE Std 802....
static constexpr uint32_t WIFI_DEFAULT_RTS_THRESHOLD
The default value for dot11RTSThreshold (C.3 MIB detail in IEEE Std 802.11-2020)
Ptr< T1 > StaticCast(const Ptr< T2 > &p)
Cast a Ptr.
std::vector< WifiMode > WifiModeList
In various parts of the code, folk are interested in maintaining a list of transmission modes.
static constexpr uint32_t WIFI_MAX_RTS_THRESHOLD
The maximum value for dot11RTSThreshold (C.3 MIB detail in IEEE Std 802.11-2020)
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU)
bool IsGcr(Ptr< WifiMac > mac, const WifiMacHeader &hdr)
Return whether a given packet is transmitted using the GCR service.
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble)
Return the preamble to be used for the transmission.
Mac48Address GetIndividuallyAddressedRecipient(Ptr< WifiMac > mac, const WifiMacHeader &hdr)
Get the MAC address of the individually addressed recipient to use for a given packet.
EhtMcsMapType
The different EHT-MCS map types as defined in 9.4.2.313.4 Supported EHT-MCS And NSS Set field.
uint8_t support320MhzIn6Ghz
Support For 320 MHz In 6 GHz.
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< dBm_u, Time > m_rssiAndUpdateTimePair
RSSI 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.
MHz_u m_channelWidth
Channel width 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
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
Time m_guardInterval
HE Guard interval durationsupported by the remote station.
Ptr< const HeCapabilities > m_heCapabilities
remote station HE capabilities