33#include "ns3/he-configuration.h" 
   34#include "ns3/ht-configuration.h" 
   36#include "ns3/packet.h" 
   37#include "ns3/pointer.h" 
   38#include "ns3/random-variable-stream.h" 
   39#include "ns3/simulator.h" 
   40#include "ns3/string.h" 
   59            .AddAttribute(
"ProbeRequestTimeout",
 
   60                          "The duration to actively probe the channel.",
 
   64            .AddAttribute(
"WaitBeaconTimeout",
 
   65                          "The duration to dwell on a channel while passively scanning for beacon",
 
   69            .AddAttribute(
"AssocRequestTimeout",
 
   70                          "The interval between two consecutive association request attempts.",
 
   74            .AddAttribute(
"MaxMissedBeacons",
 
   75                          "Number of beacons which much be consecutively missed before " 
   76                          "we attempt to restart association.",
 
   79                          MakeUintegerChecker<uint32_t>())
 
   82                "If true, we send probe requests. If false, we don't." 
   83                "NOTE: if more than one STA in your simulation is using active probing, " 
   84                "you should enable it at a different simulation time for each STA, " 
   85                "otherwise all the STAs will start sending probes at the same time resulting in " 
   87                "See bug 1060 for more info.",
 
   91            .AddAttribute(
"ProbeDelay",
 
   92                          "Delay (in microseconds) to be used prior to transmitting a " 
   93                          "Probe frame during active scanning.",
 
   94                          StringValue(
"ns3::UniformRandomVariable[Min=50.0|Max=250.0]"),
 
   96                          MakePointerChecker<RandomVariableStream>())
 
   97            .AddTraceSource(
"Assoc",
 
   98                            "Associated with an access point. If this is an MLD that associated " 
   99                            "with an AP MLD, the AP MLD address is provided.",
 
  101                            "ns3::Mac48Address::TracedCallback")
 
  102            .AddTraceSource(
"LinkSetupCompleted",
 
  103                            "A link was setup in the context of ML setup with an AP MLD. " 
  104                            "Provides ID of the setup link and AP MAC address",
 
  106                            "ns3::StaWifiMac::LinkSetupCallback")
 
  107            .AddTraceSource(
"DeAssoc",
 
  108                            "Association with an access point lost. If this is an MLD " 
  109                            "that disassociated with an AP MLD, the AP MLD address is provided.",
 
  111                            "ns3::Mac48Address::TracedCallback")
 
  112            .AddTraceSource(
"LinkSetupCanceled",
 
  113                            "A link setup in the context of ML setup with an AP MLD was torn down. " 
  114                            "Provides ID of the setup link and AP MAC address",
 
  116                            "ns3::StaWifiMac::LinkSetupCallback")
 
  117            .AddTraceSource(
"BeaconArrival",
 
  118                            "Time of beacons arrival from associated AP",
 
  120                            "ns3::Time::TracedCallback")
 
  121            .AddTraceSource(
"ReceivedBeaconInfo",
 
  122                            "Information about every received Beacon frame",
 
  124                            "ns3::ApInfo::TracedCallback");
 
  129    : m_state(UNASSOCIATED),
 
  131      m_assocRequestEvent()
 
  169std::unique_ptr<WifiMac::LinkEntity>
 
  172    return std::make_unique<StaLinkEntity>();
 
  211        NS_LOG_DEBUG(
"STA is still scanning, reset scanning process");
 
  227    for (
auto& 
phy : phys)
 
  229        phy->SetCapabilitiesChangedCallback(
 
  238    uint16_t width = 
phy->GetOperatingChannel().IsOfdm() ? 20 : 
phy->GetChannelWidth();
 
  239    uint8_t ch = 
phy->GetOperatingChannel().GetPrimaryChannelNumber(width, 
phy->GetStandard());
 
  240    return {ch, 
phy->GetPhyBand()};
 
  294std::variant<MgtAssocRequestHeader, MgtReassocRequestHeader>
 
  299    std::variant<MgtAssocRequestHeader, MgtReassocRequestHeader> mgtFrame;
 
  305        mgtFrame = std::move(reassoc);
 
  313    auto fill = [&](
auto&& frame) {
 
  317        frame.SetListenInterval(0);
 
  337    std::visit(fill, mgtFrame);
 
  360    for (uint8_t index = 0; index < 
GetNLinks(); index++)
 
  363        if (index != linkId && link.apLinkId.has_value())
 
  372            perStaProfile.
SetLinkId(link.apLinkId.value());
 
  375            perStaProfile.SetCompleteProfile();
 
  380            perStaProfile.SetStaMacAddress(link.feManager->GetAddress());
 
  385    return multiLinkElement;
 
  395        if (
GetLink(linkId).sendAssocReq)
 
  404                    "No BSSID set for the link on which the (Re)Association Request is to be sent");
 
  410    hdr.
SetAddr2(link.feManager->GetAddress());
 
  423        auto addMle = [&](
auto&& frame) {
 
  426        std::visit(addMle, frame);
 
  431        packet->
AddHeader(std::get<MgtAssocRequestHeader>(frame));
 
  435        packet->
AddHeader(std::get<MgtReassocRequestHeader>(frame));
 
  513    for (uint8_t linkId = 0; linkId < 
GetNLinks(); linkId++)
 
  542    if (!bestAp.has_value())
 
  544        NS_LOG_DEBUG(
"Exhausted list of candidate AP; restart scanning");
 
  549    NS_LOG_DEBUG(
"Attempting to associate with AP: " << *bestAp);
 
  550    UpdateApInfo(bestAp->m_frame, bestAp->m_apAddr, bestAp->m_bssid, bestAp->m_linkId);
 
  552    for (uint8_t linkId = 0; linkId < 
GetNLinks(); linkId++)
 
  555        link.sendAssocReq = 
false;
 
  556        link.apLinkId = std::nullopt;
 
  557        link.bssid = std::nullopt;
 
  563    for (
const auto& [localLinkId, apLinkId] : bestAp->m_setupLinks)
 
  565        NS_LOG_DEBUG(
"Setting up link (local ID=" << +localLinkId << 
", AP ID=" << +apLinkId
 
  568        if (localLinkId == bestAp->m_linkId)
 
  577                        "AP link address not set for local link " << +localLinkId);
 
  581    auto getBeaconInterval = [](
auto&& frame) {
 
  582        using T = std::decay_t<
decltype(frame)>;
 
  583        if constexpr (std::is_same_v<T, MgtBeaconHeader> ||
 
  584                      std::is_same_v<T, MgtProbeResponseHeader>)
 
  594    Time beaconInterval = std::visit(getBeaconInterval, bestAp->m_frame);
 
  597    for (uint8_t linkId = 0; linkId < 
GetNLinks(); linkId++)
 
  623        if (link.beaconWatchdog.IsRunning())
 
  625            link.beaconWatchdog.Cancel();
 
  651    if (link.apLinkId.has_value())
 
  658    link.apLinkId = std::nullopt;
 
  659    link.bssid = std::nullopt;
 
  660    link.phy->SetOffMode();
 
  662    for (uint8_t 
id = 0; 
id < 
GetNLinks(); 
id++)
 
  671    NS_LOG_DEBUG(
"Set state to UNASSOCIATED and start scanning");
 
  674    if (
GetNLinks() > 1 && mldAddress.has_value())
 
  685    for (uint8_t 
id = 0; 
id < 
GetNLinks(); 
id++)
 
  818            NS_LOG_LOGIC(
"Received data frame while not associated: ignore");
 
  824            NS_LOG_LOGIC(
"Received data frame not from the DS: ignore");
 
  830            NS_LOG_LOGIC(
"Received data frame not from the BSS we are associated with: ignore");
 
  893    mpdu->GetPacket()->PeekHeader(beacon);
 
  902        goodBeacon = bssid.has_value() && (hdr.
GetAddr3() == *bssid);
 
  912    bool found = mpdu->GetPacket()->PeekPacketTag(snrTag);
 
  916                     .m_snr = snrTag.
Get(),
 
  917                     .m_frame = std::move(beacon),
 
  955    mpdu->GetPacket()->PeekHeader(probeResp);
 
  961    bool found = mpdu->GetPacket()->PeekPacketTag(snrTag);
 
  965                                        .m_snr = snrTag.
Get(),
 
  966                                        .m_frame = std::move(probeResp),
 
  967                                        .m_channel = {GetCurrentChannel(linkId)},
 
  968                                        .m_linkId = linkId});
 
  984    mpdu->GetPacket()->PeekHeader(assocResp);
 
 1019        std::list<uint8_t> setupLinks(
GetNLinks());
 
 1020        std::iota(setupLinks.begin(), setupLinks.end(), 0);
 
 1023            setupLinks.remove(linkId);
 
 1030                            "The link on which the Association Response was received " 
 1031                            "is not a link we requested to setup");
 
 1033                            "The link ID of the AP that transmitted the Association " 
 1034                            "Response does not match the stored link ID");
 
 1036                                mle->GetMldMacAddress(),
 
 1037                            "The AP MLD MAC address in the received Multi-Link Element does not " 
 1038                            "match the address stored in the station manager for link " 
 1041            for (std::size_t elem = 0; elem < mle->GetNPerStaProfileSubelements(); elem++)
 
 1043                auto& perStaProfile = mle->GetPerStaProfile(elem);
 
 1044                uint8_t apLinkId = perStaProfile.GetLinkId();
 
 1045                uint8_t staLinkid = 0;
 
 1048                    if (
GetLink(staLinkid).apLinkId == apLinkId)
 
 1054                std::optional<Mac48Address> bssid;
 
 1056                                    !(bssid = 
GetLink(staLinkid).bssid).has_value(),
 
 1057                                "Setup for AP link ID " << apLinkId << 
" was not requested");
 
 1059                                "The BSSID in the Per-STA Profile for link ID " 
 1060                                    << +staLinkid << 
" does not match the stored BSSID");
 
 1063                        perStaProfile.GetStaMacAddress()) != mle->GetMldMacAddress(),
 
 1064                    "The AP MLD MAC address in the received Multi-Link Element does not " 
 1065                    "match the address stored in the station manager for link " 
 1072                                    "AID should be the same for all the links");
 
 1074                    NS_LOG_DEBUG(
"Setup on link " << staLinkid << 
" completed");
 
 1090                setupLinks.remove(staLinkid);
 
 1094        for (
const auto& 
id : setupLinks)
 
 1122    auto check = [&](
auto&& mgtFrame) -> 
bool {
 
 1129                NS_LOG_DEBUG(
"Supported rates do not fit with the BSS membership selector");
 
 1137    return std::visit(check, frame);
 
 1149    auto commonOps = [&](
auto&& frame) {
 
 1165        if (
const auto& erpInformation = frame.GetErpInformation();
 
 1168            isShortPreambleEnabled &= !erpInformation->GetBarkerPreambleMode();
 
 1169            if (erpInformation->GetUseProtection() != 0)
 
 1197        bool qosSupported = 
false;
 
 1198        const auto& edcaParameters = frame.GetEdcaParameterSet();
 
 1199        if (edcaParameters.has_value())
 
 1201            qosSupported = 
true;
 
 1205                              edcaParameters->GetBeCWmin(),
 
 1206                              edcaParameters->GetBeCWmax(),
 
 1207                              edcaParameters->GetBeAifsn(),
 
 1210                              edcaParameters->GetBkCWmin(),
 
 1211                              edcaParameters->GetBkCWmax(),
 
 1212                              edcaParameters->GetBkAifsn(),
 
 1215                              edcaParameters->GetViCWmin(),
 
 1216                              edcaParameters->GetViCWmax(),
 
 1217                              edcaParameters->GetViAifsn(),
 
 1220                              edcaParameters->GetVoCWmin(),
 
 1221                              edcaParameters->GetVoCWmax(),
 
 1222                              edcaParameters->GetVoAifsn(),
 
 1232        if (
const auto& htCapabilities = frame.GetHtCapabilities(); htCapabilities.has_value())
 
 1234            if (!htCapabilities->IsSupportedMcs(0))
 
 1251            const auto& vhtCapabilities = frame.GetVhtCapabilities();
 
 1254            if (vhtCapabilities.has_value() &&
 
 1255                vhtCapabilities->GetRxHighestSupportedLgiDataRate() > 0)
 
 1262                    if (vhtCapabilities->IsSupportedRxMcs(mcs.GetMcsValue()))
 
 1275        const auto& heCapabilities = frame.GetHeCapabilities();
 
 1276        if (heCapabilities.has_value() && heCapabilities->GetSupportedMcsAndNss() != 0)
 
 1281                if (heCapabilities->IsSupportedRxMcs(mcs.GetMcsValue()))
 
 1286            if (
const auto& heOperation = frame.GetHeOperation(); heOperation.has_value())
 
 1293        const auto& muEdcaParameters = frame.GetMuEdcaParameterSet();
 
 1294        if (muEdcaParameters.has_value())
 
 1297                                muEdcaParameters->GetMuCwMin(
AC_BE),
 
 1298                                muEdcaParameters->GetMuCwMax(
AC_BE),
 
 1299                                muEdcaParameters->GetMuAifsn(
AC_BE),
 
 1300                                muEdcaParameters->GetMuEdcaTimer(
AC_BE));
 
 1302                                muEdcaParameters->GetMuCwMin(
AC_BK),
 
 1303                                muEdcaParameters->GetMuCwMax(
AC_BK),
 
 1304                                muEdcaParameters->GetMuAifsn(
AC_BK),
 
 1305                                muEdcaParameters->GetMuEdcaTimer(
AC_BK));
 
 1307                                muEdcaParameters->GetMuCwMin(
AC_VI),
 
 1308                                muEdcaParameters->GetMuCwMax(
AC_VI),
 
 1309                                muEdcaParameters->GetMuAifsn(
AC_VI),
 
 1310                                muEdcaParameters->GetMuEdcaTimer(
AC_VI));
 
 1312                                muEdcaParameters->GetMuCwMin(
AC_VO),
 
 1313                                muEdcaParameters->GetMuCwMax(
AC_VO),
 
 1314                                muEdcaParameters->GetMuAifsn(
AC_VO),
 
 1315                                muEdcaParameters->GetMuEdcaTimer(
AC_VO));
 
 1323        const auto& ehtCapabilities = frame.GetEhtCapabilities();
 
 1330    std::visit(commonOps, frame);
 
 1337    for (
const auto& mode : 
GetWifiPhy(linkId)->GetModeList())
 
 1339        uint64_t modeDataRate = mode.GetDataRate(
GetWifiPhy(linkId)->GetChannelWidth());
 
 1340        NS_LOG_DEBUG(
"Adding supported rate of " << modeDataRate);
 
 1345        for (
const auto& selector : 
GetWifiPhy(linkId)->GetBssMembershipSelectorList())
 
 1360    return capabilities;
 
 1403        NS_LOG_DEBUG(
"PHY capabilities changed: send reassociation request");
 
 1428    os << 
"BSSID=" << apInfo.
m_bssid << 
", AP addr=" << apInfo.
m_apAddr << 
", SNR=" << apInfo.
m_snr 
 1430       << 
"}, Link ID=" << +apInfo.
m_linkId << 
", Frame=[";
 
 1431    std::visit([&os](
auto&& frame) { frame.Print(os); }, apInfo.
m_frame);
 
AttributeValue implementation for Boolean.
bool IsNull() const
Check for null implementation.
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
bool IsRunning() const
This method is syntactic sugar for !IsExpired().
static Mac48Address GetBroadcast()
void SetLinkId(uint8_t linkId)
Set the Link ID subfield in the STA Control field.
void AddPerStaProfileSubelement()
Add a Per-STA Profile Subelement in the Link Info field.
PerStaProfileSubelement & GetPerStaProfile(std::size_t i)
Get a reference to the i-th Per-STA Profile Subelement in the Link Info field.
void SetMldMacAddress(Mac48Address address)
Set the MLD MAC Address subfield in the Common Info field.
std::size_t GetNPerStaProfileSubelements() const
Return the number of Per-STA Profile Subelement in the Link Info field.
bool IsInitialized() const
Check if the object has been initialized.
void AddHeader(const Header &header)
Add header to this packet.
Smart pointer class similar to boost::intrusive_ptr.
void SetMuCwMin(uint16_t cwMin, uint8_t linkId)
Set the minimum contention window size to use while the MU EDCA Timer is running for the given link.
void SetMuCwMax(uint16_t cwMax, uint8_t linkId)
Set the maximum contention window size to use while the MU EDCA Timer is running for the given link.
void SetMuAifsn(uint8_t aifsn, uint8_t linkId)
Set the number of slots that make up an AIFS while the MU EDCA Timer is running for the given link.
void SetMuEdcaTimer(Time timer, uint8_t linkId)
Set the MU EDCA Timer for the given link.
virtual double GetValue()=0
Get the next random value as a double drawn from the distribution.
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static Time Now()
Return the current simulation virtual time.
static Time GetDelayLeft(const EventId &id)
Get the remaining time until this event will execute.
Introspection did not find any typical Config paths.
double Get() const
Return the SNR value.
The Wifi MAC high model for a non-AP STA in a BSS.
void ScanningTimeout(const std::optional< ApInfo > &bestAp)
This method is called after wait beacon timeout or wait probe request timeout has occurred.
Time m_waitBeaconTimeout
wait beacon timeout
Ptr< WifiAssocManager > m_assocManager
Association Manager.
void MissedBeacons(uint8_t linkId)
This method is called after we have not received a beacon from the AP on the given link.
bool m_activeProbing
active probing
void DoInitialize() override
Initialize() implementation.
void SetAssocManager(Ptr< WifiAssocManager > assocManager)
Set the Association Manager.
bool CanForwardPacketsTo(Mac48Address to) const override
Return true if packets can be forwarded to the given destination, false otherwise.
std::unique_ptr< LinkEntity > CreateLinkEntity() const override
Create a LinkEntity object.
void SetEdcaParameters(AcIndex ac, uint32_t cwMin, uint32_t cwMax, uint8_t aifsn, Time txopLimit)
Set the EDCA parameters.
void SetState(MacState value)
Set the current MAC state.
TracedCallback< Mac48Address > m_deAssocLogger
disassociation logger
MacState
The current MAC state of the STA.
void NotifyChannelSwitching(uint8_t linkId) override
Notify that channel on the given link has been switched.
bool GetActiveProbing() const
Return whether active probing is enabled.
void PhyCapabilitiesChanged()
Indicate that PHY capabilities have changed.
void ReceiveProbeResp(Ptr< const WifiMpdu > mpdu, uint8_t linkId)
Process the Probe Response frame received on the given link.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
WifiScanParams::Channel GetCurrentChannel(uint8_t linkId) const
Get the current primary20 channel used on the given link as a (channel number, PHY band) pair.
uint16_t GetAssociationId() const
Return the association ID.
void TryToEnsureAssociated()
Try to ensure that we are associated with an AP by taking an appropriate action depending on the curr...
void ReceiveAssocResp(Ptr< const WifiMpdu > mpdu, uint8_t linkId)
Process the (Re)Association Response frame received on the given link.
void RestartBeaconWatchdog(Time delay, uint8_t linkId)
Restarts the beacon timer for the given link.
std::variant< MgtAssocRequestHeader, MgtReassocRequestHeader > GetAssociationRequest(bool isReassoc, uint8_t linkId) const
Get the (Re)Association Request frame to send on a given link.
static TypeId GetTypeId()
Get the type ID.
void DoDispose() override
Destructor implementation.
StaLinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
uint32_t m_maxMissedBeacons
maximum missed beacons
TracedCallback< uint8_t, Mac48Address > m_setupCompleted
link setup completed logger
TracedCallback< Mac48Address > m_assocLogger
association logger
void SetWifiPhys(const std::vector< Ptr< WifiPhy > > &phys) override
void Disassociated(uint8_t linkId)
Check if any enabled link remains after the given link is disabled (because, e.g.,...
SupportedRates GetSupportedRates(uint8_t linkId) const
Return an instance of SupportedRates that contains all rates that we support including HT rates.
TracedCallback< uint8_t, Mac48Address > m_setupCanceled
link setup canceled logger
bool CheckSupportedRates(std::variant< MgtBeaconHeader, MgtProbeResponseHeader > frame, uint8_t linkId)
Determine whether the supported rates indicated in a given Beacon frame or Probe Response frame fit w...
void Receive(Ptr< const WifiMpdu > mpdu, uint8_t linkId) override
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
Ptr< RandomVariableStream > m_probeDelay
RandomVariable used to randomize the time of the first Probe Response on each channel.
TracedCallback< ApInfo > m_beaconInfo
beacon info logger
uint16_t m_aid
Association AID.
MacState m_state
MAC state.
void Enqueue(Ptr< Packet > packet, Mac48Address to) override
void SetMuEdcaParameters(AcIndex ac, uint16_t cwMin, uint16_t cwMax, uint8_t aifsn, Time muEdcaTimer)
Set the MU EDCA parameters.
void StartScanning()
Start the scanning process which trigger active or passive scanning based on the active probing flag.
TracedCallback< Time > m_beaconArrival
beacon arrival logger
void AssocRequestTimeout()
This method is called after the association timeout occurred.
void UpdateApInfo(const MgtFrameType &frame, const Mac48Address &apAddr, const Mac48Address &bssid, uint8_t linkId)
Update associated AP's information from the given management frame (Beacon, Probe Response or Associa...
void SendProbeRequest()
Forward a probe request packet to the DCF.
Time m_assocRequestTimeout
association request timeout
void ReceiveBeacon(Ptr< const WifiMpdu > mpdu, uint8_t linkId)
Process the Beacon frame received on the given link.
Time m_probeRequestTimeout
probe request timeout
void SetActiveProbing(bool enable)
Enable or disable active probing.
CapabilityInformation GetCapabilities(uint8_t linkId) const
Return the Capability information for the given link.
bool IsAssociated() const
Return whether we are associated with an AP.
std::variant< MgtBeaconHeader, MgtProbeResponseHeader, MgtAssocResponseHeader > MgtFrameType
type of the management frames used to get info about APs
bool IsWaitAssocResp() const
Return whether we are waiting for an association response from an AP.
MultiLinkElement GetMultiLinkElement(bool isReassoc, uint8_t linkId) const
Return the Multi-Link Element to include in the management frames transmitted on the given link.
EventId m_assocRequestEvent
association request event
void SendAssociationRequest(bool isReassoc)
Forward an association or reassociation request packet to the DCF.
bool IsSuccess() const
Return whether the status code is success.
Hold variables of type string.
The Supported Rates Information Element.
void AddBssMembershipSelectorRate(uint64_t bs)
Add a special value to the supported rate set, corresponding to a BSS membership selector.
bool IsBasicRate(uint64_t bs) const
Check if the given rate is a basic rate.
bool IsBssMembershipSelectorRate(uint64_t bs) const
Check if the given rate is a BSS membership selector value.
void AddSupportedRate(uint64_t bs)
Add the given rate to the supported rates.
bool IsSupportedRate(uint64_t bs) const
Check if the given rate is supported.
Simulation virtual time values and global simulation resolution.
AttributeValue implementation for Time.
void SetMaxCw(uint32_t maxCw)
Set the maximum contention window size.
void SetTxopLimit(Time txopLimit)
Set the TXOP limit.
void SetAifsn(uint8_t aifsn)
Set the number of slots that make up an AIFS.
void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
virtual void Queue(Ptr< Packet > packet, const WifiMacHeader &hdr)
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
base class for all MAC-level wifi objects.
Ptr< FrameExchangeManager > GetFrameExchangeManager(uint8_t linkId=SINGLE_LINK_OP_ID) const
Get the Frame Exchange Manager associated with the given link.
Ptr< QosTxop > GetBEQueue() const
Accessor for the AC_BE channel access function.
virtual void NotifyChannelSwitching(uint8_t linkId)
Notify that channel on the given link has been switched.
Mac48Address GetBssid(uint8_t linkId) const
Ptr< HeConfiguration > GetHeConfiguration() const
Ptr< Txop > GetTxop() const
Accessor for the Txop object.
VhtCapabilities GetVhtCapabilities(uint8_t linkId) const
Return the VHT capabilities of the device for the given link.
Callback< void > m_linkDown
Callback when a link is down.
bool GetQosSupported() const
Return whether the device supports QoS.
uint8_t GetNLinks() const
Get the number of links (can be greater than 1 for 11be devices only).
bool GetErpSupported(uint8_t linkId) const
Return whether the device supports ERP on the given link.
bool GetHtSupported() const
Return whether the device supports HT.
Ptr< QosTxop > GetVOQueue() const
Accessor for the AC_VO channel access function.
void SetTypeOfStation(TypeOfStation type)
This method is invoked by a subclass to specify what type of station it is implementing.
Ptr< WifiPhy > GetWifiPhy(uint8_t linkId=SINGLE_LINK_OP_ID) const
bool GetEhtSupported() const
Return whether the device supports EHT.
bool GetHeSupported() const
Return whether the device supports HE.
HtCapabilities GetHtCapabilities(uint8_t linkId) const
Return the HT capabilities of the device for the given link.
bool GetVhtSupported(uint8_t linkId) const
Return whether the device supports VHT on the given link.
virtual void DeaggregateAmsduAndForward(Ptr< const WifiMpdu > mpdu)
This method can be called to de-aggregate an A-MSDU and forward the constituent packets up the stack.
void SetBssid(Mac48Address bssid, uint8_t linkId)
ExtendedCapabilities GetExtendedCapabilities() const
Return the extended capabilities of the device.
bool GetShortSlotTimeSupported() const
void NotifyRxDrop(Ptr< const Packet > packet)
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(uint8_t linkId=0) const
void ForwardUp(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
virtual void Receive(Ptr< const WifiMpdu > mpdu, uint8_t linkId)
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
Mac48Address GetAddress() const
EhtCapabilities GetEhtCapabilities(uint8_t linkId) const
Return the EHT capabilities of the device for the given link.
Callback< void > m_linkUp
Callback when a link is up.
LinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
HeCapabilities GetHeCapabilities(uint8_t linkId) const
Return the HE capabilities of the device for the given link.
virtual void SetWifiPhys(const std::vector< Ptr< WifiPhy > > &phys)
Ptr< QosTxop > GetQosTxop(AcIndex ac) const
Accessor for a specified EDCA object.
void NotifyTxDrop(Ptr< const Packet > packet)
void DoDispose() override
Destructor implementation.
std::list< uint8_t > GetBssMembershipSelectorList() const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
void SetSlot(Time slot)
Set the slot duration for this PHY.
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
void SetOffMode()
Put in off mode.
bool HasFixedPhyBand() const
void ResumeFromOff()
Resume from off mode.
std::list< WifiMode > GetModeList() const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
void SetShortSlotTimeEnabled(bool enable)
Enable or disable short slot time.
void AddBasicMode(WifiMode mode)
Invoked in a STA upon association to store the set of rates which belong to the BSSBasicRateSet of th...
void SetUseNonErpProtection(bool enable)
Enable or disable protection for non-ERP stations.
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 AddSupportedMcs(Mac48Address address, WifiMode mcs)
Record the MCS index supported by the station.
void RemoveAllSupportedMcs(Mac48Address address)
Invoked in a STA or AP to delete all of the supported MCS by a destination.
void AddStationVhtCapabilities(Mac48Address from, VhtCapabilities vhtCapabilities)
Records VHT capabilities of the remote station.
void SetShortPreambleEnabled(bool enable)
Enable or disable short PHY preambles.
void SetQosSupport(Mac48Address from, bool qosSupported)
Records QoS support of the remote station.
void AddStationHeCapabilities(Mac48Address from, HeCapabilities heCapabilities)
Records HE capabilities of the remote station.
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...
void AddStationEhtCapabilities(Mac48Address from, EhtCapabilities ehtCapabilities)
Records EHT capabilities of the remote station.
void AddStationHtCapabilities(Mac48Address from, HtCapabilities htCapabilities)
Records HT capabilities of the remote station.
std::optional< Mac48Address > GetMldAddress(const Mac48Address &address) const
Get the address of the MLD the given station is affiliated with, if any.
#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 AttributeAccessor > MakeBooleanAccessor(T1 a1)
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#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_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t 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.
uint8_t QosUtilsGetTidForPacket(Ptr< const Packet > packet)
If a QoS tag is attached to the packet, returns a value < 8.
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
@ WIFI_PHY_BAND_UNSPECIFIED
Unspecified.
@ WIFI_MOD_CLASS_VHT
VHT (Clause 22)
@ WIFI_MOD_CLASS_HE
HE (Clause 27)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
std::ostream & operator<<(std::ostream &os, const Angles &a)
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
static constexpr uint8_t SINGLE_LINK_OP_ID
Link ID for single link operations (helps tracking places where correct link ID is to be used to supp...
@ WIFI_MAC_MGT_PROBE_REQUEST
@ WIFI_MAC_MGT_ASSOCIATION_RESPONSE
@ WIFI_MAC_MGT_ASSOCIATION_REQUEST
@ WIFI_MAC_MGT_REASSOCIATION_REQUEST
@ WIFI_MAC_MGT_PROBE_RESPONSE
@ WIFI_MAC_MGT_REASSOCIATION_RESPONSE
Struct to hold information regarding observed AP through active/passive scanning.
MgtFrameType m_frame
The body of the management frame used to update AP info.
WifiScanParams::Channel m_channel
The channel the management frame was received on.
Mac48Address m_apAddr
AP MAC address.
uint8_t m_linkId
ID of the link used to communicate with the AP.
Mac48Address m_bssid
BSSID.
double m_snr
SNR in linear scale.
Structure holding information specific to a single link.
bool sendAssocReq
whether this link is used to send the Association Request frame
std::optional< Mac48Address > bssid
BSSID of the AP to associate with over this link.
std::optional< uint8_t > apLinkId
ID (as set by the AP) of the link we have setup or are setting up.
~StaLinkEntity() override
Destructor (a virtual method is needed to make this struct polymorphic)
Ptr< WifiPhy > phy
Wifi PHY object.
Struct identifying a channel to scan.
WifiPhyBand band
PHY band.
uint16_t number
channel number
Structure holding scan parameters.
std::list< Channel > ChannelList
typedef for a list of channels
std::vector< ChannelList > channelList
list of channels to scan, for each link
Time probeDelay
delay prior to transmitting a Probe Request
Time maxChannelTime
maximum time to spend on each channel
Ssid ssid
desired SSID or wildcard SSID
enum ns3::WifiScanParams::@75 type
indicates either active or passive scanning
Time minChannelTime
minimum time to spend on each channel