35 #include "ns3/attribute-container.h"
36 #include "ns3/eht-configuration.h"
37 #include "ns3/emlsr-manager.h"
38 #include "ns3/he-configuration.h"
39 #include "ns3/ht-configuration.h"
41 #include "ns3/packet.h"
43 #include "ns3/pointer.h"
44 #include "ns3/random-variable-stream.h"
45 #include "ns3/simulator.h"
46 #include "ns3/string.h"
65 .AddAttribute(
"ProbeRequestTimeout",
66 "The duration to actively probe the channel.",
70 .AddAttribute(
"WaitBeaconTimeout",
71 "The duration to dwell on a channel while passively scanning for beacon",
75 .AddAttribute(
"AssocRequestTimeout",
76 "The interval between two consecutive association request attempts.",
80 .AddAttribute(
"MaxMissedBeacons",
81 "Number of beacons which much be consecutively missed before "
82 "we attempt to restart association.",
85 MakeUintegerChecker<uint32_t>())
88 "If true, we send probe requests. If false, we don't."
89 "NOTE: if more than one STA in your simulation is using active probing, "
90 "you should enable it at a different simulation time for each STA, "
91 "otherwise all the STAs will start sending probes at the same time resulting in "
93 "See bug 1060 for more info.",
97 .AddAttribute(
"ProbeDelay",
98 "Delay (in microseconds) to be used prior to transmitting a "
99 "Probe frame during active scanning.",
100 StringValue(
"ns3::UniformRandomVariable[Min=50.0|Max=250.0]"),
102 MakePointerChecker<RandomVariableStream>())
105 "Enable/disable power save mode on the given link. The power management mode is "
106 "actually changed when the AP acknowledges a frame sent with the Power Management "
107 "field set to the value corresponding to the requested mode",
112 MakeUintegerChecker<uint8_t>()))
113 .AddAttribute(
"PmModeSwitchTimeout",
114 "If switching to a new Power Management mode is not completed within "
115 "this amount of time, make another attempt at switching Power "
120 .AddTraceSource(
"Assoc",
121 "Associated with an access point. If this is an MLD that associated "
122 "with an AP MLD, the AP MLD address is provided.",
124 "ns3::Mac48Address::TracedCallback")
125 .AddTraceSource(
"LinkSetupCompleted",
126 "A link was setup in the context of ML setup with an AP MLD. "
127 "Provides ID of the setup link and AP MAC address",
129 "ns3::StaWifiMac::LinkSetupCallback")
130 .AddTraceSource(
"DeAssoc",
131 "Association with an access point lost. If this is an MLD "
132 "that disassociated with an AP MLD, the AP MLD address is provided.",
134 "ns3::Mac48Address::TracedCallback")
135 .AddTraceSource(
"LinkSetupCanceled",
136 "A link setup in the context of ML setup with an AP MLD was torn down. "
137 "Provides ID of the setup link and AP MAC address",
139 "ns3::StaWifiMac::LinkSetupCallback",
141 "Disassociation only occurs at MLD level; use DeAssoc trace.")
142 .AddTraceSource(
"BeaconArrival",
143 "Time of beacons arrival from associated AP",
145 "ns3::Time::TracedCallback")
146 .AddTraceSource(
"ReceivedBeaconInfo",
147 "Information about every received Beacon frame",
149 "ns3::ApInfo::TracedCallback");
154 : m_state(UNASSOCIATED),
156 m_assocRequestEvent()
215 std::unique_ptr<WifiMac::LinkEntity>
218 return std::make_unique<StaLinkEntity>();
277 NS_LOG_DEBUG(
"STA is still scanning, reset scanning process");
293 for (
auto&
phy : phys)
295 phy->SetCapabilitiesChangedCallback(
304 uint16_t width =
phy->GetOperatingChannel().IsOfdm() ? 20 :
phy->GetChannelWidth();
305 uint8_t ch =
phy->GetOperatingChannel().GetPrimaryChannelNumber(width,
phy->GetStandard());
306 return {ch,
phy->GetPhyBand()};
314 for (
const auto& [linkId, lnk] :
GetLinks())
318 if (linkIds.count(linkId) > 0)
321 link.emlsrEnabled =
true;
327 if (
link.emlsrEnabled)
331 link.emlsrEnabled =
false;
395 std::variant<MgtAssocRequestHeader, MgtReassocRequestHeader>
400 std::variant<MgtAssocRequestHeader, MgtReassocRequestHeader> mgtFrame;
406 mgtFrame = std::move(reassoc);
414 auto fill = [&](
auto&& frame) {
415 frame.template Get<Ssid>() =
GetSsid();
417 frame.template Get<SupportedRates>() = supportedRates.rates;
418 frame.template Get<ExtendedSupportedRatesIE>() = supportedRates.extendedRates;
420 frame.SetListenInterval(0);
440 std::visit(fill, mgtFrame);
478 mldCapabilities.emplace();
479 mldCapabilities->maxNSimultaneousLinks =
GetNLinks() - 1;
480 mldCapabilities->srsSupport = 0;
485 ehtConfiguration->GetAttributeFailSafe(
"TidToLinkMappingNegSupport", negSupport);
487 mldCapabilities->tidToLinkMappingSupport = negSupport.
Get();
488 mldCapabilities->freqSepForStrApMld = 0;
489 mldCapabilities->aarSupport = 0;
499 if (index != linkId && staLink.bssid.has_value())
511 perStaProfile.SetCompleteProfile();
516 perStaProfile.SetStaMacAddress(staLink.feManager->GetAddress());
521 return multiLinkElement;
524 std::vector<TidToLinkMapping>
533 ehtConfig->GetAttributeFailSafe(
"TidToLinkMappingNegSupport", negSupport);
536 "Cannot request TID-to-Link Mapping if negotiation is not supported");
545 negSupport.
Get() == 1 && !mappingValidForNegType1,
546 "Mapping TIDs to distinct link sets is incompatible with negotiation support of 1");
548 if (apNegSupport == 1 && !mappingValidForNegType1)
555 NS_LOG_DEBUG(
"Using default mapping because AP MLD advertised negotiation support of 1");
560 std::vector<TidToLinkMapping> ret(1);
565 auto fillIe = [&ret](
const auto& mapping) {
566 ret.back().m_control.defaultMapping = mapping.empty();
568 for (
const auto& [tid, linkSet] : mapping)
574 NS_ABORT_MSG_IF(linkSet.empty(),
"Cannot map a TID to an empty link set");
575 ret.back().SetLinkMappingOfTid(tid, linkSet);
608 "No link selected to send the (Re)Association Request");
609 uint8_t linkId = it->first;
612 "No BSSID set for the link on which the (Re)Association Request is to be sent");
633 auto addMle = [&](
auto&& frame) {
636 std::visit(addMle, frame);
639 if (
const auto& mldCapabilities =
641 mldCapabilities && (negSupport = mldCapabilities->get().tidToLinkMappingSupport) > 0)
643 auto addTlm = [&](
auto&& frame) {
646 std::visit(addTlm, frame);
652 packet->
AddHeader(std::get<MgtAssocRequestHeader>(frame));
656 packet->
AddHeader(std::get<MgtReassocRequestHeader>(frame));
761 if (!bestAp.has_value())
763 NS_LOG_DEBUG(
"Exhausted list of candidate AP; restart scanning");
768 NS_LOG_DEBUG(
"Attempting to associate with AP: " << *bestAp);
769 UpdateApInfo(bestAp->m_frame, bestAp->m_apAddr, bestAp->m_bssid, bestAp->m_linkId);
774 staLink.sendAssocReq =
false;
775 staLink.bssid = std::nullopt;
780 std::shared_ptr<CommonInfoBasicMle> mleCommonInfo;
783 std::visit([](
auto&& frame) {
return frame.template Get<MultiLinkElement>(); },
785 std::map<uint8_t, uint8_t> swapInfo;
786 for (
const auto& [localLinkId, apLinkId, bssid] : bestAp->m_setupLinks)
789 NS_LOG_DEBUG(
"Setting up link (local ID=" << +localLinkId <<
", AP ID=" << +apLinkId
794 mleCommonInfo = std::make_shared<CommonInfoBasicMle>(mle->GetCommonInfoBasic());
797 swapInfo.emplace(localLinkId, apLinkId);
803 auto getBeaconInterval = [](
auto&& frame) {
804 using T = std::decay_t<decltype(frame)>;
805 if constexpr (std::is_same_v<T, MgtBeaconHeader> ||
806 std::is_same_v<T, MgtProbeResponseHeader>)
816 Time beaconInterval = std::visit(getBeaconInterval, bestAp->m_frame);
857 if (
link->phy &&
link->phy->IsStateRx())
859 delay =
std::max(delay,
link->phy->GetDelayUntilIdle());
879 bssid = std::nullopt;
882 NS_LOG_DEBUG(
"Set state to UNASSOCIATED and start scanning");
924 std::set<uint8_t> linkIds;
940 uint8_t linkId = *linkIds.begin();
1007 uint8_t linkId = *linkIds.begin();
1084 const WifiMacHeader* hdr = &mpdu->GetOriginal()->GetHeader();
1104 NS_LOG_LOGIC(
"Received data frame while not associated: ignore");
1110 NS_LOG_LOGIC(
"Received data frame not from the DS: ignore");
1114 std::set<Mac48Address> apAddresses;
1119 if (apAddresses.count(mpdu->GetHeader().GetAddr2()) == 0)
1121 NS_LOG_LOGIC(
"Received data frame not from the BSS we are associated with: ignore");
1127 NS_LOG_LOGIC(
"Received (QoS) Null Data frame: ignore");
1135 NS_ASSERT(apAddresses.count(mpdu->GetHeader().GetAddr3()) != 0);
1176 action.protectedEhtAction ==
1205 mpdu->GetPacket()->PeekHeader(beacon);
1214 goodBeacon = bssid.has_value() && (hdr.
GetAddr3() == *bssid);
1224 bool found = mpdu->GetPacket()->PeekPacketTag(snrTag);
1228 .m_snr = snrTag.
Get(),
1229 .m_frame = std::move(beacon),
1231 .m_linkId = linkId};
1267 mpdu->GetPacket()->PeekHeader(probeResp);
1273 bool found = mpdu->GetPacket()->PeekPacketTag(snrTag);
1277 .m_snr = snrTag.
Get(),
1278 .m_frame = std::move(probeResp),
1279 .m_channel = {GetCurrentChannel(linkId)},
1280 .m_linkId = linkId});
1295 std::optional<Mac48Address> apMldAddress;
1297 mpdu->GetPacket()->PeekHeader(assocResp);
1317 if (
const auto& mldCapabilities =
1319 mldCapabilities && mldCapabilities->get().tidToLinkMappingSupport > 0)
1367 std::list<uint8_t> setupLinks;
1370 setupLinks.push_back(
id);
1374 setupLinks.remove(linkId);
1381 "The link on which the Association Response was received "
1382 "is not a link we requested to setup");
1384 "The link ID of the AP that transmitted the Association "
1385 "Response does not match the stored link ID");
1387 mle->GetMldMacAddress(),
1388 "The AP MLD MAC address in the received Multi-Link Element does not "
1389 "match the address stored in the station manager for link "
1392 for (std::size_t elem = 0; elem < mle->GetNPerStaProfileSubelements(); elem++)
1394 auto& perStaProfile = mle->GetPerStaProfile(elem);
1395 uint8_t apLinkId = perStaProfile.GetLinkId();
1396 auto it =
GetLinks().find(apLinkId);
1397 uint8_t staLinkid = 0;
1398 std::optional<Mac48Address> bssid;
1400 !(bssid =
GetLink((staLinkid = it->first)).
bssid).has_value(),
1401 "Setup for AP link ID " << apLinkId <<
" was not requested");
1403 "The BSSID in the Per-STA Profile for link ID "
1404 << +staLinkid <<
" does not match the stored BSSID");
1407 perStaProfile.GetStaMacAddress()) != mle->GetMldMacAddress(),
1408 "The AP MLD MAC address in the received Multi-Link Element does not "
1409 "match the address stored in the station manager for link "
1416 "AID should be the same for all the links");
1418 NS_LOG_DEBUG(
"Setup on link " << staLinkid <<
" completed");
1430 setupLinks.remove(staLinkid);
1434 for (
const auto&
id : setupLinks)
1453 if (
const auto txop =
GetTxop())
1455 txop->StartAccessAfterEvent(
id,
1463 edca->StartAccessAfterEvent(
id,
1484 NS_ASSERT_MSG(psduMap.size() == 1 && psduMap.begin()->second->GetNMpdus() == 1 &&
1485 psduMap.begin()->second->GetHeader(0).IsAck(),
1486 "Expected a Normal Ack after Association Response frame");
1491 for (
const auto& [
id, lnk] :
GetLinks())
1518 std::pair<bool, uint8_t>{
true,
id});
1539 std::pair<bool, uint8_t>{
false,
id});
1549 phy->TraceConnectWithoutContext(
"PhyTxPsduBegin", cb);
1551 [=]() {
phy->TraceDisconnectWithoutContext(
"PhyTxPsduBegin", cb); });
1561 auto check = [&](
auto&& mgtFrame) ->
bool {
1563 NS_ASSERT(mgtFrame.template Get<SupportedRates>());
1565 mgtFrame.template Get<ExtendedSupportedRatesIE>()};
1566 for (
const auto& selector :
GetWifiPhy(linkId)->GetBssMembershipSelectorList())
1568 if (!rates.IsBssMembershipSelectorRate(selector))
1570 NS_LOG_DEBUG(
"Supported rates do not fit with the BSS membership selector");
1578 return std::visit(check, frame);
1590 const std::optional<ErpInformation>* erpInformation =
nullptr;
1592 if (
const auto* beacon = std::get_if<MgtBeaconHeader>(&frame))
1596 else if (
const auto* probe = std::get_if<MgtProbeResponseHeader>(&frame))
1602 auto commonOps = [&](
auto&& frame) {
1603 const auto& capabilities = frame.Capabilities();
1604 NS_ASSERT(frame.template Get<SupportedRates>());
1606 frame.template Get<ExtendedSupportedRatesIE>()};
1607 for (
const auto& mode :
GetWifiPhy(linkId)->GetModeList())
1609 if (rates.IsSupportedRate(mode.GetDataRate(
GetWifiPhy(linkId)->GetChannelWidth())))
1612 if (rates.IsBasicRate(mode.GetDataRate(
GetWifiPhy(linkId)->GetChannelWidth())))
1619 bool isShortPreambleEnabled = capabilities.IsShortPreamble();
1620 if (erpInformation && erpInformation->has_value() &&
GetErpSupported(linkId))
1622 isShortPreambleEnabled &= !(*erpInformation)->GetBarkerPreambleMode();
1623 if ((*erpInformation)->GetUseProtection() != 0)
1631 if (capabilities.IsShortSlotTime() ==
true)
1644 capabilities.IsShortSlotTime());
1651 bool qosSupported =
false;
1652 const auto& edcaParameters = frame.template Get<EdcaParameterSet>();
1653 if (edcaParameters.has_value())
1655 qosSupported =
true;
1659 edcaParameters->GetBeCWmin(),
1660 edcaParameters->GetBeCWmax(),
1661 edcaParameters->GetBeAifsn(),
1665 edcaParameters->GetBkCWmin(),
1666 edcaParameters->GetBkCWmax(),
1667 edcaParameters->GetBkAifsn(),
1671 edcaParameters->GetViCWmin(),
1672 edcaParameters->GetViCWmax(),
1673 edcaParameters->GetViAifsn(),
1677 edcaParameters->GetVoCWmin(),
1678 edcaParameters->GetVoCWmax(),
1679 edcaParameters->GetVoAifsn(),
1690 if (
const auto& htCapabilities = frame.template Get<HtCapabilities>();
1691 htCapabilities.has_value())
1693 if (!htCapabilities->IsSupportedMcs(0))
1710 const auto& vhtCapabilities = frame.template Get<VhtCapabilities>();
1713 if (vhtCapabilities.has_value() &&
1714 vhtCapabilities->GetRxHighestSupportedLgiDataRate() > 0)
1721 if (vhtCapabilities->IsSupportedRxMcs(mcs.GetMcsValue()))
1734 const auto& heCapabilities = frame.template Get<HeCapabilities>();
1735 if (heCapabilities.has_value() && heCapabilities->GetSupportedMcsAndNss() != 0)
1740 if (heCapabilities->IsSupportedRxMcs(mcs.GetMcsValue()))
1745 if (
const auto& heOperation = frame.template Get<HeOperation>();
1746 heOperation.has_value())
1753 const auto& muEdcaParameters = frame.template Get<MuEdcaParameterSet>();
1754 if (muEdcaParameters.has_value())
1757 muEdcaParameters->GetMuCwMin(
AC_BE),
1758 muEdcaParameters->GetMuCwMax(
AC_BE),
1759 muEdcaParameters->GetMuAifsn(
AC_BE),
1760 muEdcaParameters->GetMuEdcaTimer(
AC_BE)},
1763 muEdcaParameters->GetMuCwMin(
AC_BK),
1764 muEdcaParameters->GetMuCwMax(
AC_BK),
1765 muEdcaParameters->GetMuAifsn(
AC_BK),
1766 muEdcaParameters->GetMuEdcaTimer(
AC_BK)},
1769 muEdcaParameters->GetMuCwMin(
AC_VI),
1770 muEdcaParameters->GetMuCwMax(
AC_VI),
1771 muEdcaParameters->GetMuAifsn(
AC_VI),
1772 muEdcaParameters->GetMuEdcaTimer(
AC_VI)},
1775 muEdcaParameters->GetMuCwMin(
AC_VO),
1776 muEdcaParameters->GetMuCwMax(
AC_VO),
1777 muEdcaParameters->GetMuAifsn(
AC_VO),
1778 muEdcaParameters->GetMuEdcaTimer(
AC_VO)},
1787 const auto& ehtCapabilities = frame.template Get<EhtCapabilities>();
1792 if (
const auto& mle = frame.template Get<MultiLinkElement>(); mle &&
m_emlsrManager)
1794 if (mle->HasEmlCapabilities())
1796 m_emlsrManager->SetTransitionTimeout(mle->GetTransitionTimeout());
1798 if (
const auto& common = mle->GetCommonInfoBasic(); common.m_mediumSyncDelayInfo)
1800 m_emlsrManager->SetMediumSyncDuration(common.GetMediumSyncDelayTimer());
1801 m_emlsrManager->SetMediumSyncOfdmEdThreshold(common.GetMediumSyncOfdmEdThreshold());
1802 m_emlsrManager->SetMediumSyncMaxNTxops(common.GetMediumSyncMaxNTxops());
1808 std::visit(commonOps, frame);
1814 const auto [enable, linkId] = enableLinkIdPair;
1821 NS_LOG_DEBUG(
"Not associated yet, record the PM mode to switch to upon association");
1828 NS_LOG_DEBUG(
"Link " << +linkId <<
" has not been setup, ignore request");
1849 NS_LOG_DEBUG(
"Next transmitted frame will be sent with PM=" << enable);
1868 m_txop->
Queue(Create<WifiMpdu>(Create<Packet>(), hdr));
1889 auto linkIds = mpdu->GetInFlightLinkIds();
1891 "The TA of the acked MPDU (" << *mpdu
1892 <<
") is not a link "
1893 "address and the MPDU is not inflight");
1898 linkId = *linkIds.begin();
1899 mpdu =
GetTxopQueue(mpdu->GetQueueAc())->GetAlias(mpdu, *linkId);
1920 for (
const auto& mode :
GetWifiPhy(linkId)->GetModeList())
1922 uint64_t modeDataRate = mode.GetDataRate(
GetWifiPhy(linkId)->GetChannelWidth());
1923 NS_LOG_DEBUG(
"Adding supported rate of " << modeDataRate);
1928 for (
const auto& selector :
GetWifiPhy(linkId)->GetBssMembershipSelectorList())
1943 return capabilities;
1978 NS_LOG_DEBUG(
"PHY capabilities changed: send reassociation request");
2040 if (
link->phy ==
phy &&
id != linkId)
2042 link->phy =
nullptr;
2047 auto connectPhy = [=,
this]()
mutable {
2048 auto& newLink =
GetLink(linkId);
2052 newLink.channelAccessManager->SetupPhyListener(
phy);
2056 newLink.channelAccessManager->ResetState();
2059 newLink.feManager->ResetPhy();
2061 newLink.feManager->SetWifiPhy(
phy);
2063 newLink.stationManager->SetupPhy(
phy);
2098 os <<
"BSSID=" << apInfo.
m_bssid <<
", AP addr=" << apInfo.
m_apAddr <<
", SNR=" << apInfo.
m_snr
2100 <<
"}, Link ID=" << +apInfo.
m_linkId <<
", Frame=[";
2101 std::visit([&os](
auto&& frame) { frame.Print(os); }, apInfo.
m_frame);
A container for one type of attribute.
Base class for Callback class.
bool IsNull() const
Check for null implementation.
The IEEE 802.11be EHT Capabilities.
Hold variables of type enum.
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
bool IsExpired() const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
bool IsRunning() const
This method is syntactic sugar for !IsExpired().
The Extended Capabilities Information Element.
The Extended Supported Rates Information Element.
The IEEE 802.11ax HE Capabilities.
The HT Capabilities Information Element.
static Mac48Address ConvertFrom(const Address &address)
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.
void SetEmlsrSupported(bool supported)
Set the EMLSR Support subfield of the EML Capabilities subfield in the Common Info field to 1 if EMLS...
CommonInfoBasicMle & GetCommonInfoBasic()
void SetEmlsrTransitionDelay(Time delay)
Set the EMLSR Transition Delay subfield of the EML Capabilities subfield in the Common 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 SetEmlsrPaddingDelay(Time delay)
Set the EMLSR Padding Delay subfield of the EML Capabilities subfield in the Common 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 TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
bool IsInitialized() const
Check if the object has been initialized.
void AddHeader(const Header &header)
Add header to this packet.
Hold objects of type std::pair<A, B>.
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 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.
double Get() const
Return the SNR value.
The IEEE 802.11 SSID Information Element.
The Wifi MAC high model for a non-AP STA in a BSS.
std::set< uint8_t > GetSetupLinkIds() const
Get the IDs of the setup links (if any).
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
void SetPowerSaveMode(const std::pair< bool, uint8_t > &enableLinkIdPair)
Enable or disable Power Save mode on the given link.
Ptr< WifiAssocManager > m_assocManager
Association Manager.
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 SetState(MacState value)
Set the current MAC state.
Time m_beaconWatchdogEnd
beacon watchdog end
AllSupportedRates GetSupportedRates(uint8_t linkId) const
Return an instance of SupportedRates that contains all rates that we support including HT rates.
void SetEdcaParameters(const EdcaParams ¶ms, uint8_t linkId)
Set the EDCA parameters for the given link.
void UnblockTxOnLink(uint8_t linkId, WifiQueueBlockedReason reason)
Unblock transmissions on the given link for the given reason.
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.
EventId m_beaconWatchdog
beacon watchdog
void PhyCapabilitiesChanged()
Indicate that PHY capabilities have changed.
StaLinkEntity & GetStaLink(const std::unique_ptr< WifiMac::LinkEntity > &link) const
Cast the given LinkEntity object to StaLinkEntity.
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.
void SetPmModeAfterAssociation(uint8_t linkId)
Set the Power Management mode of the setup links after association.
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 NotifySwitchingEmlsrLink(Ptr< WifiPhy > phy, uint8_t linkId, Time delay)
Notify that the given PHY switched channel to operate on another EMLSR 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.
void SendProbeRequest(uint8_t linkId)
Enqueue a probe request packet for transmission on the given link.
void BlockTxOnLink(uint8_t linkId, WifiQueueBlockedReason reason)
Block transmissions on the given link for the given reason.
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 SetMuEdcaParameters(const MuEdcaParams ¶ms, uint8_t linkId)
Set the MU EDCA parameters for the given link.
TracedCallback< uint8_t, Mac48Address > m_setupCanceled
link setup canceled logger
void NotifyEmlsrModeChanged(const std::set< uint8_t > &linkIds)
Notify the MAC that EMLSR mode has changed on the given set of links.
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...
Mac48Address DoGetLocalAddress(const Mac48Address &remoteAddr) const override
This method is called if this device is an MLD to determine the MAC address of the affiliated STA use...
void RestartBeaconWatchdog(Time delay)
Restarts the beacon timer.
void SetEmlsrManager(Ptr< EmlsrManager > emlsrManager)
Set the EMLSR Manager.
Time m_pmModeSwitchTimeout
PM mode switch timeout.
void Disassociated()
Set the state to unassociated and try to associate again.
Ptr< EmlsrManager > GetEmlsrManager() const
void TxOk(Ptr< const WifiMpdu > mpdu)
Notify that the MPDU we sent was successfully received by the receiver (i.e.
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...
WifiTidLinkMapping m_ulTidLinkMappingInAssocReq
store the UL TID-to-Link Mapping included in the Association Request frame
WifiPowerManagementMode GetPmMode(uint8_t linkId) const
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
void MissedBeacons()
This method is called after we have not received a beacon from the AP on any link.
uint16_t m_aid
Association AID.
MacState m_state
MAC state.
bool IsEmlsrLink(uint8_t linkId) const
void Enqueue(Ptr< Packet > packet, Mac48Address to) override
void StartScanning()
Start the scanning process which trigger active or passive scanning based on the active probing flag.
void SetWifiPhys(const std::vector< Ptr< WifiPhy >> &phys) override
TracedCallback< Time > m_beaconArrival
beacon arrival logger
void AssocRequestTimeout()
This method is called after the association timeout occurred.
Ptr< EmlsrManager > m_emlsrManager
EMLSR Manager.
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...
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.
std::vector< TidToLinkMapping > GetTidToLinkMappingElements(uint8_t apNegSupport)
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.
WifiTidLinkMapping m_dlTidLinkMappingInAssocReq
store the DL TID-to-Link Mapping included in the Association Request frame
bool IsSuccess() const
Return whether the status code is success.
Hold variables of type string.
The Supported Rates Information Element.
TID-to-Link Mapping Information Element.
Simulation virtual time values and global simulation resolution.
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
void SetMaxCw(uint32_t maxCw)
Set the maximum contention window size.
static constexpr bool DIDNT_HAVE_FRAMES_TO_TRANSMIT
no packet available for transmission was in the queue
void SetTxopLimit(Time txopLimit)
Set the TXOP limit.
void SetAifsn(uint8_t aifsn)
Set the number of slots that make up an AIFS.
static constexpr bool CHECK_MEDIUM_BUSY
generation of backoff (also) depends on the busy/idle state of the medium
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.
@ ATTR_GET
The attribute can be read.
@ ATTR_SET
The attribute can be written.
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.
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.
std::optional< Mac48Address > GetMldAddress(const Mac48Address &remoteAddr) const
Mac48Address GetBssid(uint8_t linkId) const
Ptr< HeConfiguration > GetHeConfiguration() const
const std::map< uint8_t, std::unique_ptr< LinkEntity > > & GetLinks() 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.
Ptr< Txop > m_txop
TXOP used for transmission of frames to non-QoS peers.
Ptr< WifiMacQueueScheduler > GetMacQueueScheduler() const
Get the wifi MAC queue scheduler.
uint8_t GetNLinks() const
Get the number of links (can be greater than 1 for 11be devices only).
void SwapLinks(std::map< uint8_t, uint8_t > links)
Swap the links based on the information included in the given map.
void DoInitialize() override
Initialize() implementation.
void UnblockUnicastTxOnLinks(WifiQueueBlockedReason reason, const Mac48Address &address, const std::set< uint8_t > &linkIds)
Unblock the transmission on the given links of all unicast frames addressed to the station with the g...
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
void BlockUnicastTxOnLinks(WifiQueueBlockedReason reason, const Mac48Address &address, const std::set< uint8_t > &linkIds)
Block the transmission on the given links of all unicast frames addressed to the station with the giv...
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.
virtual std::optional< uint8_t > GetLinkIdByAddress(const Mac48Address &address) const
Get the ID of the link having the given MAC address, if any.
virtual bool HasFramesToTransmit(uint8_t linkId)
Check if the MAC has frames to transmit over the given link.
virtual void SetWifiPhys(const std::vector< Ptr< WifiPhy >> &phys)
void ApplyTidLinkMapping(const Mac48Address &mldAddr, WifiDirection dir)
Apply the TID-to-Link Mapping negotiated with the given MLD for the given direction by properly confi...
Ptr< EhtConfiguration > GetEhtConfiguration() const
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)
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
void UpdateTidToLinkMapping(const Mac48Address &mldAddr, WifiDirection dir, const WifiTidLinkMapping &mapping)
Update the TID-to-Link Mappings for the given MLD in the given direction based on the given negotiate...
ExtendedCapabilities GetExtendedCapabilities() const
Return the extended capabilities of the device.
virtual Ptr< WifiMacQueue > GetTxopQueue(AcIndex ac) const
Get the wifi MAC queue of the (Qos)Txop associated with the given AC, if such (Qos)Txop is installed,...
std::optional< uint8_t > GetLinkForPhy(Ptr< const WifiPhy > phy) const
Get the ID of the link (if any) on which the given PHY is operating.
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.
Ptr< QosTxop > GetQosTxop(AcIndex ac) const
Accessor for a specified EDCA object.
void NotifyTxDrop(Ptr< const Packet > packet)
void DoDispose() override
Destructor implementation.
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
void SetSlot(Time slot)
Set the slot duration for this PHY.
void SetOffMode()
Put in off mode.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
#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...
#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_ABORT_IF(cond)
Abnormal program termination if a condition is true.
#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 NanoSeconds(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.
WifiPowerManagementMode
Enumeration for power management modes.
uint8_t QosUtilsGetTidForPacket(Ptr< const Packet > packet)
If a QoS tag is attached to the packet, returns a value < 8.
WifiQueueBlockedReason
Enumeration of the reasons to block container queues.
@ WIFI_PM_SWITCHING_TO_ACTIVE
@ WIFI_PM_SWITCHING_TO_PS
@ 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.
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
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...
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
const std::map< AcIndex, WifiAc > wifiAcList
Map containing the four ACs in increasing order of priority (according to Table 10-1 "UP-to-AC Mappin...
@ 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
bool TidToLinkMappingValidForNegType1(const WifiTidLinkMapping &dlLinkMapping, const WifiTidLinkMapping &ulLinkMapping)
Check if the given TID-to-Link Mappings are valid for a negotiation type of 1.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
std::ostream & operator<<(std::ostream &os, const Angles &a)
params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.
Struct containing all supported rates.
void AddBssMembershipSelectorRate(uint64_t bs)
Add a special value to the supported rate set, corresponding to a BSS membership selector.
void AddSupportedRate(uint64_t bs)
Add the given rate to the supported rates.
std::optional< MldCapabilities > m_mldCapabilities
MLD Capabilities.
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.
bool emlsrEnabled
whether EMLSR mode is enabled on this link
WifiPowerManagementMode pmMode
the current PM mode, if the STA is associated, or the PM mode to switch to upon association,...
~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
WifiScanType type
indicates either active or passive scanning
Time maxChannelTime
maximum time to spend on each channel
Ssid ssid
desired SSID or wildcard SSID
Time minChannelTime
minimum time to spend on each channel