27#include "ns3/ap-emlsr-manager.h"
28#include "ns3/eht-configuration.h"
29#include "ns3/eht-frame-exchange-manager.h"
30#include "ns3/he-configuration.h"
31#include "ns3/ht-configuration.h"
33#include "ns3/packet.h"
34#include "ns3/pointer.h"
35#include "ns3/random-variable-stream.h"
36#include "ns3/simulator.h"
37#include "ns3/string.h"
56 "Delay between two beacons",
60 .AddAttribute(
"BeaconJitter",
61 "A uniform random variable to cause the initial beacon starting time "
62 "(after simulation time 0) "
63 "to be distributed between 0 and the BeaconInterval.",
67 .AddAttribute(
"EnableBeaconJitter",
68 "If beacons are enabled, whether to jitter the initial send event.",
72 .AddAttribute(
"BeaconGeneration",
73 "Whether or not beacons are generated.",
77 .AddAttribute(
"FdBeaconInterval6GHz",
78 "Time between a Beacon frame and a FILS Discovery (FD) frame or between "
79 "two FD frames to be sent on a 6GHz link. A value of zero disables the "
80 "transmission of FD frames.",
84 .AddAttribute(
"FdBeaconIntervalNon6GHz",
85 "Time between a Beacon frame and a FILS Discovery (FD) frame or between "
86 "two FD frames to be sent on a non-6GHz link. A value of zero disables "
87 "the transmission of FD frames.",
91 .AddAttribute(
"SendUnsolProbeResp",
92 "Send unsolicited broadcast Probe Response instead of FILS Discovery",
96 .AddAttribute(
"EnableNonErpProtection",
97 "Whether or not protection mechanism should be used when non-ERP STAs "
98 "are present within the BSS."
99 "This parameter is only used when ERP is supported by the AP.",
103 .AddAttribute(
"BsrLifetime",
104 "Lifetime of Buffer Status Reports received from stations.",
110 "The CW min values that the AP advertises in EDCA Parameter Set elements and the "
111 "associated stations will use. The value of this attribute is an AC-indexed map "
112 "containing the CW min values for given ACs for all the links (sorted in "
113 "increasing order of link ID). If no values are provided for an AC, the same "
114 "values used by the AP are advertised. In case a string is used to set this "
115 "attribute, the string shall contain the pairs separated by a semicolon (;); "
116 "in every pair, the AC index and the list of values are separated by a blank "
117 "space, and the values of a list are separated by a comma (,) without spaces. "
118 "E.g. \"BE 31,31,31; VI 15,15,15\" defines the CW min values for AC BE and AC VI "
119 "for an AP MLD having three links.",
126 "The CW max values that the AP advertises in EDCA Parameter Set elements and the "
127 "associated stations will use. The value of this attribute is an AC-indexed map "
128 "containing the CW max values for given ACs for all the links (sorted in "
129 "increasing order of link ID). If no values are provided for an AC, the same "
130 "values used by the AP are advertised. In case a string is used to set this "
131 "attribute, the string shall contain the pairs separated by a semicolon (;); "
132 "in every pair, the AC index and the list of values are separated by a blank "
133 "space, and the values of a list are separated by a comma (,) without spaces. "
134 "E.g. \"BE 31,31,31; VI 15,15,15\" defines the CW max values for AC BE and AC VI "
135 "for an AP MLD having three links.",
142 "The AIFSN values that the AP advertises in EDCA Parameter Set elements and the "
143 "associated stations will use. The value of this attribute is an AC-indexed map "
144 "containing the AIFSN values for given ACs for all the links (sorted in "
145 "increasing order of link ID). If no values are provided for an AC, the same "
146 "values used by the AP are advertised. In case a string is used to set this "
147 "attribute, the string shall contain the pairs separated by a semicolon (;); "
148 "in every pair, the AC index and the list of values are separated by a blank "
149 "space, and the values of a list are separated by a comma (,) without spaces. "
150 "E.g. \"BE 3,3,3; VI 2,2,2\" defines the AIFSN values for AC BE and AC VI "
151 "for an AP MLD having three links.",
158 "The TXOP limit values that the AP advertises in EDCA Parameter Set elements and "
159 "the associated stations will use. The value of this attribute is an AC-indexed "
160 "map containing the TXOP limit values for given ACs for all the links (sorted in "
161 "increasing order of link ID). If no values are provided for an AC, the same "
162 "values used by the AP are advertised. In case a string is used to set this "
163 "attribute, the string shall contain the pairs separated by a semicolon (;); "
164 "in every pair, the AC index and the list of values are separated by a blank "
165 "space, and the values of a list are separated by a comma (,) without spaces. "
166 "E.g. \"BE 3200us,3200us,3200us; VI 2400us,2400us,2400us\" defines the TXOP limit "
167 "values for AC BE and AC VI for an AP MLD having three links.",
172 .AddAttribute(
"GcrManager",
173 "The GCR manager object.",
179 .AddTraceSource(
"AssociatedSta",
180 "A station associated with this access point.",
182 "ns3::ApWifiMac::AssociationCallback")
183 .AddTraceSource(
"DeAssociatedSta",
184 "A station lost association with this access point.",
186 "ns3::ApWifiMac::AssociationCallback");
212 : m_enableBeaconGeneration(
false)
253std::unique_ptr<WifiMac::LinkEntity>
256 return std::make_unique<ApLinkEntity>();
296 if (!
hdr.IsQosData())
324 if (
m_gcrManager->GetMemberStasForGroupAddress(
hdr.GetAddr1()).empty())
341 for (uint8_t linkId = 0; linkId <
GetNLinks(); linkId++)
361 for (uint8_t linkId = 0; linkId <
GetNLinks(); ++linkId)
401 NS_FATAL_ERROR(
"beacon interval should be multiple of 1024us (802.11 time unit), see IEEE "
407 "beacon interval should be smaller then or equal to 65535 * 1024us (802.11 time unit)");
430 for (
const auto&
sta : link.staList)
434 link.shortSlotTimeEnabled =
false;
438 link.shortSlotTimeEnabled =
true;
442 link.shortSlotTimeEnabled =
false;
453 for (
const auto&
sta : link.staList)
458 link.shortPreambleEnabled =
false;
462 link.shortPreambleEnabled =
true;
466 link.shortPreambleEnabled =
false;
485 for (uint8_t linkId = 0; linkId <
GetNLinks(); linkId++)
496 NS_ASSERT_MSG(linkId,
"Station " << to <<
"is not associated, cannot send it a frame");
505 auto&
hdr = mpdu->GetHeader();
550 NS_LOG_DEBUG(
"Adding basic mode " << mode.GetUniqueName());
607 if (
GetLink(linkId).shortPreambleEnabled)
632 :
edca->GetMinCw(linkId));
634 :
edca->GetMaxCw(linkId));
636 :
edca->GetAifsn(linkId));
638 :
edca->GetTxopLimit(linkId);
644 :
edca->GetMinCw(linkId));
646 :
edca->GetMaxCw(linkId));
648 :
edca->GetAifsn(linkId));
650 :
edca->GetTxopLimit(linkId);
656 :
edca->GetMinCw(linkId));
658 :
edca->GetMaxCw(linkId));
660 :
edca->GetAifsn(linkId));
662 :
edca->GetTxopLimit(linkId);
668 :
edca->GetMinCw(linkId));
670 :
edca->GetMaxCw(linkId));
672 :
edca->GetAifsn(linkId));
674 :
edca->GetTxopLimit(linkId);
682std::optional<MuEdcaParameterSet>
719 auto aci = {0, 1, 2, 3};
726 "MU EDCA Timers must be all zero if the IE is not advertised.");
731std::optional<ReducedNeighborReport>
744 for (uint8_t index = 0; index <
GetNLinks(); ++index)
749 std::size_t
nbrId =
rnr.GetNNbrApInfoFields() - 1;
756 rnr.SetMldParameters(
nbrId, 0, {0, index, 0, 0, 0});
771 "ML Probe Request Multi-Link Element cannot be provided for frame type "
776 mle.SetLinkIdInfo(linkId);
777 mle.SetBssParamsChangeCount(0);
784 mle.SetEmlsrSupported(
true);
844 mle.AddPerStaProfileSubelement();
866 "Invalid MLE variant " <<
reqVar);
877 NS_ASSERT_MSG(apMldId.has_value(),
"AP MLD ID subfield missing");
883 NS_ASSERT_MSG(*apMldId == 0,
"AP MLD ID expected value is 0. value = " << +apMldId.value());
886 std::set<uint8_t> respLinkIds{};
897 respLinkIds.insert(
i);
902 for (std::size_t
i = 0;
i <
mlProbeReqMle->GetNPerStaProfileSubelements(); ++
i)
918 mle.AddPerStaProfileSubelement();
940 operation.SetPrimaryChannel(phy->GetPrimaryChannelNumber(
MHz_u{20}));
943 if (phy->GetChannelWidth() >
MHz_u{20})
948 if (
GetLink(linkId).numNonHtStations == 0)
959 uint8_t nss = (mcs.GetMcsValue() / 8) + 1;
962 mcs.GetDataRate(phy->GetChannelWidth(),
1013 operation.SetRxHighestSupportedDataRate(
1022 operation.SetLSigTxopProtectionFullSupport(0);
1053 ? phy->GetPrimaryChannelNumber(
MHz_u{80})
1054 : phy->GetChannelNumber());
1066 : phy->GetChannelNumber()
1083 operation.SetMaxVhtMcsPerNss(nss, maxMcs);
1119 const auto bw = phy->GetChannelWidth();
1120 const auto ch = phy->GetOperatingChannel();
1127 op6Ghz.m_chCntrFreqSeg1 = (bw ==
MHz_u{160}) ?
ch.GetNumber() : 0;
1167 hdr.SetAddr2(
GetLink(linkId).feManager->GetAddress());
1168 hdr.SetAddr3(
GetLink(linkId).feManager->GetAddress());
1206 GetLink(linkId).shortPreambleEnabled);
1208 GetLink(linkId).shortSlotTimeEnabled);
1361 if (
assoc.GetStatusCode().IsSuccess())
1370 "Sending a Multi-Link Element to a single link device");
1371 for (std::size_t
idx = 0;
idx <
mle->GetNPerStaProfileSubelements();
idx++)
1375 perStaProfile.GetAssocResponse().GetStatusCode().IsSuccess())
1381 "No STA to associate with on link " << +
otherLinkId);
1384 "More than one Association Response to MLD "
1406 std::set<uint16_t>
aids;
1408 for (
const auto& [
id, link] :
GetLinks())
1410 if (
const auto aid = link->stationManager->GetAssociationId(addr); aid !=
SU_STA_ID)
1432 link.stationManager->SetAssociationId(
staAddr, aid);
1434 if (link.stationManager->GetDsssSupported(
staAddr) &&
1435 !link.stationManager->GetErpOfdmSupported(
staAddr))
1437 link.numNonErpStations++;
1439 if (!link.stationManager->GetHtSupported(
staAddr) &&
1440 !link.stationManager->GetStationHe6GhzCapabilities(
staAddr))
1442 link.numNonHtStations++;
1451 "AID " <<
it->first <<
" already assigned to " <<
staAddr
1452 <<
", could not assign " << aid);
1461 if (
assoc.GetStatusCode().IsSuccess())
1463 assoc.SetAssociationId(aid);
1467 for (std::size_t
idx = 0;
idx <
mle->GetNPerStaProfileSubelements();
idx++)
1471 perStaProfile.GetAssocResponse().GetStatusCode().IsSuccess())
1509 packet->AddHeader(
assoc);
1540 hdr.SetAddr2(link.feManager->GetAddress());
1541 hdr.SetAddr3(link.feManager->GetAddress());
1619 packet->AddHeader(
beacon);
1621 NS_LOG_INFO(
"Generating beacon from " << link.feManager->GetAddress() <<
" linkID " << +linkId);
1634 if (link.shortSlotTimeEnabled)
1653 hdr.SetAddr2(link.feManager->GetAddress());
1654 hdr.SetAddr3(link.feManager->GetAddress());
1669 fils.m_fdCap->SetMaxNss(std::min(link.phy->GetMaxSupportedTxSpatialStreams(),
1670 link.phy->GetMaxSupportedRxSpatialStreams()));
1671 fils.m_fdCap->SetStandard(link.phy->GetStandard());
1673 fils.SetLengthSubfield();
1677 packet->AddHeader(
fils);
1694 NS_LOG_DEBUG(
"Sending FILS Discovery/unsolicited Probe Response disabled");
1724 if (
hdr.IsAssocResp() ||
hdr.IsReassocResp())
1727 mpdu->GetPacket()->PeekHeader(
assocResp);
1728 auto aid =
assocResp.GetAssociationId();
1760 stationManager->IsWaitAssocTxOk(*
staAddress))
1764 stationManager->RecordGotAssocTxOk(*
staAddress);
1784 else if (
hdr.IsAction())
1788 action.protectedEhtAction ==
1798 eventIt->second.PeekEventImpl()->Invoke();
1811 if (
hdr.IsAssocResp() ||
hdr.IsReassocResp())
1819 <<
" association failed with STA=" <<
hdr.GetAddr1());
1833 stationManager->IsWaitAssocTxOk(*
staAddress))
1836 <<
" association failed with STA=" << *
staAddress);
1837 stationManager->RecordGotAssocTxFailed(*
staAddress);
1844 mpdu->GetPacket()->PeekHeader(
assocResp);
1845 auto aid =
assocResp.GetAssociationId();
1850 link.staList.erase(aid);
1863 if (!
staInPsMode && mpdu->GetHeader().IsPowerManagement())
1868 else if (
staInPsMode && !mpdu->GetHeader().IsPowerManagement())
1905std::optional<uint8_t>
1908 for (uint8_t linkId = 0; linkId <
GetNLinks(); linkId++)
1916 return std::nullopt;
1927std::optional<Mac48Address>
1933 return staIt->second;
1935 return std::nullopt;
1948 std::optional<uint8_t> apLinkId;
1949 if (!
hdr->IsFromDs() &&
hdr->IsToDs() &&
1950 (apLinkId =
IsAssociated(mpdu->GetHeader().GetAddr2())) &&
1961 (
hdr->IsQosData() &&
hdr->IsQosAmsdu() && to == mpdu->GetHeader().GetAddr1()))
1964 if (
hdr->IsQosData())
1966 if (
hdr->IsQosAmsdu())
1969 <<
", size=" << packet->GetSize());
1973 else if (
hdr->HasData())
1978 else if (
hdr->HasData())
1985 NS_LOG_DEBUG(
"forwarding frame from=" << from <<
", to=" << to);
1991 if (
hdr->IsQosData())
2001 else if (
hdr->HasData())
2007 else if (
hdr->IsFromDs() &&
hdr->IsToDs())
2022 else if (
hdr->IsMgt())
2031 if (
hdr->IsProbeReq() && (
hdr->GetAddr1().IsGroup() ||
2038 if (
hdr->GetAddr1().IsGroup() && !
hdr->GetAddr3().IsBroadcast() &&
2047 if (ssid ==
GetSsid() || ssid->IsBroadcast())
2049 NS_LOG_DEBUG(
"Probe request received from " << from <<
": send probe response");
2050 const auto isReqBcast =
hdr->GetAddr1().IsGroup() &&
hdr->GetAddr3().IsBroadcast();
2061 switch (
hdr->GetType())
2066 <<
" request received from " << from
2067 << ((
GetNLinks() > 1) ?
" on link ID " + std::to_string(linkId) :
""));
2072 if (
hdr->IsAssocReq())
2092 for (
auto it = staList.begin();
it != staList.end(); ++
it)
2094 if (
it->second == from)
2122 auto pkt = mpdu->GetPacket()->Copy();
2125 action.protectedEhtAction ==
2131 pkt->RemoveHeader(
frame);
2156 auto failure = [&](
const std::string&
msg) ->
bool {
2157 NS_LOG_DEBUG(
"Association Request from " << from <<
" refused: " <<
msg);
2174 if (rates.GetNRates() == 0)
2176 return failure(
"STA's supported rate set not compatible with our Basic Rate set");
2190 return failure(
"HT STA does not support all MCSs in Basic MCS Set");
2206 return failure(
"VHT STA does not support all MCSs in Basic MCS Set");
2222 return failure(
"HE STA does not support all MCSs in Basic MCS Set");
2251 return failure(
"More than two TID-to-Link Mapping IEs");
2273 return failure(
"Incorrect directions in TID-to-Link Mapping IEs");
2276 if (
ehtConfig->m_tidLinkMappingSupport ==
2279 return failure(
"TID-to-Link Mapping negotiation not supported");
2283 if (
tlmIe.m_control.defaultMapping)
2287 for (uint8_t tid = 0; tid < 8; tid++)
2315 if (
ehtConfig->m_tidLinkMappingSupport ==
2319 return failure(
"Mapping TIDs to distinct link sets is incompatible with "
2320 "negotiation support of 1");
2326 "Multi-Link Element not present in an Association Request including "
2327 "TID-to-Link Mapping element(s)");
2340 for (
const auto& mode : phy->GetModeList())
2342 if (rates.IsSupportedRate(mode.GetDataRate(phy->GetChannelWidth())))
2414 NS_LOG_DEBUG(
"Association Request from " << from <<
" accepted");
2431 if (!
mle.has_value())
2436 auto mleCommonInfo = std::make_shared<CommonInfoBasicMle>(
mle->GetCommonInfoBasic());
2439 for (std::size_t
i = 0;
i <
mle->GetNPerStaProfileSubelements();
i++)
2445 <<
"] Cannot setup a link if the STA MAC address is missing");
2456 NS_LOG_DEBUG(
"[i=" <<
i <<
"] No (Re)Association Request frame body present");
2482 "Received an EML Operating Mode Notification frame but EMLSR is not activated");
2486 if (
frame.m_emlControl.emlsrParamUpdateCtrl)
2501 frame.m_emlControl.emlsrMode == 1 ?
frame.GetLinkBitmap() : std::list<uint8_t>{};
2510 NS_ASSERT_MSG(psduMap.size() == 1 && psduMap.begin()->second->GetNMpdus() == 1 &&
2511 psduMap.begin()->second->GetHeader(0).IsAck(),
2512 "Expected a Normal Ack after EML Notification frame");
2520 for (uint8_t id = 0; id < GetNLinks(); id++)
2523 GetWifiRemoteStationManager(id)->GetAffiliatedStaAddress(*mldAddress);
2530 if (!emlsrLinks.empty())
2544 auto enabled = std::find(emlsrLinks.cbegin(), emlsrLinks.cend(), id) !=
2548 StaSwitchingToActiveModeOrDeassociated(*linkAddress, id);
2550 GetWifiRemoteStationManager(id)->SetEmlsrEnabled(*linkAddress, enabled);
2568 GetWifiRemoteStationManager(id)->GetEmlsrEnabled(*linkAddress))
2570 StaSwitchingToPsMode(*linkAddress, id);
2572 GetWifiRemoteStationManager(id)->SetEmlsrEnabled(*linkAddress, false);
2580 auto phy = GetLink(linkId).phy;
2581 phy->TraceConnectWithoutContext(
"PhyTxPsduBegin",
cb);
2583 [=]() { phy->TraceDisconnectWithoutContext(
"PhyTxPsduBegin",
cb); });
2591 frame.m_emlControl.emlsrParamUpdateCtrl = 0;
2599 frame.m_emlsrParamUpdate.reset();
2611 auto from =
i.second.GetSourceAddr();
2612 auto to =
i.second.GetDestinationAddr();
2616 NS_LOG_DEBUG(
"forwarding QoS frame from=" << from <<
", to=" << to);
2630 for (uint8_t linkId = 0; linkId <
GetNLinks(); ++linkId)
2640 NS_LOG_DEBUG(
"Scheduling initial beacon for access point "
2678 if (std::none_of(links.cbegin(), links.cend(), [&](
auto&&
idLinkPair) {
2679 return GetStaList(idLinkPair.first).contains(nextAid);
2689const std::map<uint16_t, Mac48Address>&
2709 return it->second.value;
2732 for (uint8_t tid = 0; tid < 8; tid++)
void SendAssocResp(Mac48Address to, bool isReassoc, uint8_t linkId)
Forward an association or a reassociation response packet to the DCF/EDCA.
uint16_t GetAssociationId(Mac48Address addr, uint8_t linkId) const
std::unique_ptr< LinkEntity > CreateLinkEntity() const override
Create a LinkEntity object.
Ptr< Txop > m_beaconTxop
Dedicated Txop for beacons.
void SetBeaconGeneration(bool enable)
Enable or disable beacon generation of the AP.
void ParseReportedStaInfo(const AssocReqRefVariant &assoc, Mac48Address from, uint8_t linkId)
Given a (Re)Association Request frame body containing a Multi-Link Element, check if a link can be se...
void UpdateShortSlotTimeEnabled(uint8_t linkId)
Update whether short slot time should be enabled or not in the BSS corresponding to the given link.
void DoCompleteConfig() override
Allow subclasses to complete the configuration of the MAC layer components.
const std::map< uint16_t, Mac48Address > & GetStaList(uint8_t linkId) const
Get a const reference to the map of associated stations on the given link.
void DoDispose() override
Destructor implementation.
void SetBeaconInterval(Time interval)
bool ReceiveAssocRequest(const AssocReqRefVariant &assoc, const Mac48Address &from, uint8_t linkId)
Check whether the supported rate set included in the received (Re)Association Request frame is compat...
std::map< uint8_t, Mac48Address > LinkIdStaAddrMap
Map of (link ID, remote STA address) of the links to setup.
std::map< Mac48Address, EventId > m_transitionTimeoutEvents
transition timeout events running for EMLSR clients
UintAccessParamsMap m_cwMaxsForSta
Per-AC CW max values to advertise to stations.
void ScheduleFilsDiscOrUnsolProbeRespFrames(uint8_t linkId)
Schedule the transmission of FILS Discovery frames or unsolicited Probe Response frames on the given ...
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...
CapabilityInformation GetCapabilities(uint8_t linkId) const
Return the Capability information of the current AP for the given link.
Ptr< ApEmlsrManager > m_apEmlsrManager
AP EMLSR Manager.
Ptr< UniformRandomVariable > m_beaconJitter
UniformRandomVariable used to randomize the time of the first beacon.
void EnqueueProbeResp(const MgtProbeResponseHeader &probeResp, Mac48Address to, uint8_t linkId)
Send a packet prepared using the given Probe Response to the given receiver on the given link.
bool CanForwardPacketsTo(Mac48Address to) const override
Return true if packets can be forwarded to the given destination, false otherwise.
bool m_enableNonErpProtection
Flag whether protection mechanism is used or not when non-ERP STAs are present within the BSS.
EdcaParameterSet GetEdcaParameterSet(uint8_t linkId) const
Return the EDCA Parameter Set of the current AP for the given link.
void StaSwitchingToActiveModeOrDeassociated(const Mac48Address &staAddr, uint8_t linkId)
Perform the necessary actions when a given station deassociates or switches from powersave mode to ac...
HtOperation GetHtOperation(uint8_t linkId) const
Return the HT operation of the current AP for the given link.
std::optional< Mac48Address > GetMldOrLinkAddressByAid(uint16_t aid) const
Ptr< GcrManager > m_gcrManager
GCR Manager.
void UpdateShortPreambleEnabled(uint8_t linkId)
Update whether short preamble should be enabled or not in the BSS corresponding to the given link.
uint16_t GetNextAssociationId() const
void TxOk(Ptr< const WifiMpdu > mpdu)
The packet we sent was successfully received by the receiver (i.e.
Time m_fdBeaconIntervalNon6GHz
Time elapsing between a beacon and FILS Discovery (FD) frame or between two FD frames on 2....
std::map< uint16_t, Mac48Address > m_aidToMldOrLinkAddress
Maps AIDs to MLD addresses (for MLDs) or link addresses (in case of single link devices)
TracedCallback< uint16_t, Mac48Address > m_deAssocLogger
deassociation logger
void Enqueue(Ptr< WifiMpdu > mpdu, Mac48Address to, Mac48Address from) override
LinkIdStaAddrMap GetLinkIdStaAddrMap(MgtAssocResponseHeader &assoc, const Mac48Address &to, uint8_t linkId)
Get a map of (link ID, remote STA address) of the links to setup.
void SetAid(MgtAssocResponseHeader &assoc, const LinkIdStaAddrMap &linkIdStaAddrMap)
Set the AID field of the given Association Response frame.
static Ptr< const AttributeChecker > GetTimeAccessParamsChecker()
Get a checker for the TxopLimitsForSta attribute, which can be used to deserialize an ACI-indexed map...
bool m_enableBeaconGeneration
Flag whether beacons are being generated.
Time m_beaconInterval
Beacon interval.
Ptr< GcrManager > GetGcrManager() const
MultiLinkElement GetMultiLinkElement(uint8_t linkId, WifiMacType frameType, const Mac48Address &to=Mac48Address::GetBroadcast(), const std::optional< MultiLinkElement > &mlProbeReqMle=std::nullopt)
Return the Multi-Link Element that the current AP includes in the management frames of the given type...
bool m_enableBeaconJitter
Flag whether the first beacon should be generated at random time.
std::unordered_map< WifiAddressTidPair, BsrType, WifiAddressTidHash > m_bufferStatus
Per (MAC address, TID) buffer status reports.
DsssParameterSet GetDsssParameterSet(uint8_t linkId) const
Return the DSSS Parameter Set that we support on the given link.
TracedCallback< uint16_t, Mac48Address > m_assocLogger
association logger
Time GetBeaconInterval() const
static TypeId GetTypeId()
Get the type ID.
std::optional< ReducedNeighborReport > GetReducedNeighborReport(uint8_t linkId) const
Return the Reduced Neighbor Report (RNR) element that the current AP sends on the given link,...
void ReceiveEmlOmn(MgtEmlOmn &frame, const Mac48Address &sender, uint8_t linkId)
Take necessary actions upon receiving the given EML Operating Mode Notification frame from the given ...
Ptr< ApEmlsrManager > GetApEmlsrManager() const
Time m_fdBeaconInterval6GHz
Time elapsing between a beacon and FILS Discovery (FD) frame or between two FD frames on 6GHz links.
uint8_t GetMaxBufferStatus(Mac48Address address) const
Return the maximum among the values of the Queue Size subfield of the last QoS Data or QoS Null frame...
Time m_bsrLifetime
Lifetime of Buffer Status Reports.
ApLinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
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...
uint8_t GetBufferStatus(uint8_t tid, Mac48Address address) const
Return the value of the Queue Size subfield of the last QoS Data or QoS Null frame received from the ...
EhtOperation GetEhtOperation(uint8_t linkId) const
Return the EHT operation of the current AP for the given link.
bool UseGcr(const WifiMacHeader &hdr) const
Return whether GCR is used to transmit a packet.
bool m_sendUnsolProbeResp
send unsolicited Probe Response instead of FILS Discovery
ErpInformation GetErpInformation(uint8_t linkId) const
Return the ERP information of the current AP for the given link.
void SetLinkUpCallback(Callback< void > linkUp) override
VhtOperation GetVhtOperation(uint8_t linkId) const
Return the VHT operation of the current AP for the given link.
void TxFailed(WifiMacDropReason timeoutReason, Ptr< const WifiMpdu > mpdu)
The packet we sent was successfully received by the receiver (i.e.
HeOperation GetHeOperation(uint8_t linkId) const
Return the HE operation of the current AP for the given link.
bool IsGcrBaAgreementEstablishedWithAllMembers(const Mac48Address &groupAddress, uint8_t tid) const
Check if a GCR Block Ack agreement has been successfully established with all members of its group.
void SetBufferStatus(uint8_t tid, Mac48Address address, uint8_t size)
Store the value of the Queue Size subfield of the last QoS Data or QoS Null frame received from the s...
TimeAccessParamsMap m_txopLimitsForSta
Per-AC TXOP limits values to advertise to stations.
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
std::optional< MuEdcaParameterSet > GetMuEdcaParameterSet() const
Return the MU EDCA Parameter Set of the current AP, if one needs to be advertised.
void ProcessPowerManagementFlag(Ptr< const WifiMpdu > mpdu, uint8_t linkId)
Process the Power Management bit in the Frame Control field of an MPDU successfully received on the g...
void DeaggregateAmsduAndForward(Ptr< const WifiMpdu > mpdu) override
This method is called to de-aggregate an A-MSDU and forward the constituent packets up the stack.
bool SupportsSendFrom() const override
MgtAssocResponseHeader GetAssocResp(Mac48Address to, uint8_t linkId)
Get the Association Response frame to send on a given link.
void SetGcrManager(Ptr< GcrManager > gcrManager)
Set the GCR Manager.
Ptr< WifiMpdu > GetFilsDiscovery(uint8_t linkId) const
Get the FILS Discovery frame to send on the given link.
static Ptr< const AttributeChecker > GetUintAccessParamsChecker()
Get a checker for the CwMinsForSta, CwMaxsForSta and AifsnsForSta attributes, which can be used to de...
void DoInitialize() override
Initialize() implementation.
std::optional< uint8_t > IsAssociated(const Mac48Address &address) const
Get the ID of a link (if any) that has been setup with the station having the given MAC address.
void SendOneBeacon(uint8_t linkId)
Forward a beacon packet to the beacon special DCF for transmission on the given link.
Ptr< WifiMacQueue > GetTxopQueue(AcIndex ac) const override
Get the wifi MAC queue of the (Qos)Txop associated with the given AC, if such (Qos)Txop is installed,...
void SetApEmlsrManager(Ptr< ApEmlsrManager > apEmlsrManager)
Set the AP EMLSR Manager.
bool GetUseNonErpProtection(uint8_t linkId) const
Return whether protection for non-ERP stations is used in the BSS corresponding to the given link.
MgtProbeResponseHeader GetProbeRespProfile(uint8_t linkId) const
Get Probe Response Per-STA Profile for the given link.
UintAccessParamsMap m_cwMinsForSta
Per-AC CW min values to advertise to stations.
UintAccessParamsMap m_aifsnsForSta
Per-AC AIFS values to advertise to stations.
MgtProbeResponseHeader GetProbeResp(uint8_t linkId, const std::optional< MultiLinkElement > &reqMle)
Get Probe Response based on the given Probe Request Multi-link Element (if any)
void StaSwitchingToPsMode(const Mac48Address &staAddr, uint8_t linkId)
Perform the necessary actions when a given station switches from active mode to powersave mode.
AllSupportedRates GetSupportedRates(uint8_t linkId) const
Return an instance of SupportedRates that contains all rates that we support for the given link (incl...
A container for one type of attribute.
AttributeValue implementation for Boolean.
Base class for Callback class.
void SetCurrentChannel(uint8_t currentChannel)
Set the Current Channel field in the DsssParameterSet information element.
The IEEE 802.11be EHT Capabilities.
EHT Operation Information Element.
Hold variables of type enum.
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
The Extended Capabilities Information Element.
The Extended Supported Rates Information Element.
The HE 6 GHz Band Capabilities (IEEE 802.11ax-2021 9.4.2.263)
The IEEE 802.11ax HE Capabilities.
The HE Operation Information Element.
The HT Capabilities Information Element.
The HT Operation Information Element.
static Mac48Address GetBroadcast()
Implement the header for Action frames of type EML Operating Mode Notification.
The MU EDCA Parameter Set.
void SetQosInfo(uint8_t qosInfo)
Set the QoS Info field in the MuEdcaParameterSet information element.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
void Initialize()
Invoke DoInitialize on all Objects aggregated to this one.
void Dispose()
Dispose of this Object.
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
Ptr< BlockAckManager > GetBaManager()
Get the Block Ack Manager associated with this QosTxop.
The Reduced Neighbor Report element.
void AddNbrApInfoField()
Add a Neighbor AP Information field.
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 EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
The IEEE 802.11 SSID Information Element.
Status code for association response.
Hold variables of type string.
The Supported Rates Information Element.
TID-to-Link Mapping Information Element.
Simulation virtual time values and global simulation resolution.
int64_t GetMicroSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
AttributeValue implementation for Time.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
void SetMaxCws(const std::vector< uint32_t > &maxCws)
Set the maximum contention window size for each link.
void SetAifsns(const std::vector< uint8_t > &aifsns)
Set the number of slots that make up an AIFS for each link.
Ptr< WifiMacQueue > GetWifiMacQueue() const
Return the packet queue associated with this Txop.
virtual void SetWifiMac(const Ptr< WifiMac > mac)
Set the wifi MAC this Txop is associated to.
virtual void Queue(Ptr< WifiMpdu > mpdu)
void SetTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set MacTxMiddle this Txop is associated to.
void SetMinCws(const std::vector< uint32_t > &minCws)
Set the minimum contention window size for each link.
a unique identifier for an interface.
@ ATTR_GET
The attribute can be read.
@ ATTR_CONSTRUCT
The attribute can be written at construction-time.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
The IEEE 802.11ac VHT Capabilities.
The VHT Operation Information Element.
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.
std::optional< Mac48Address > GetMldAddress(const Mac48Address &remoteAddr) 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.
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).
void Enqueue(Ptr< Packet > packet, Mac48Address to)
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.
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.
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.
Ptr< MacTxMiddle > m_txMiddle
TX middle (aggregation etc.)
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Ptr< HtConfiguration > GetHtConfiguration() const
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.
He6GhzBandCapabilities GetHe6GhzBandCapabilities(uint8_t linkId) const
Return the HE 6GHz band capabilities of the device for the given 6 GHz link.
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,...
bool GetShortSlotTimeSupported() const
void NotifyRxDrop(Ptr< const Packet > packet)
virtual void SetLinkUpCallback(Callback< void > linkUp)
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(uint8_t linkId=0) const
bool GetHtSupported(uint8_t linkId) const
Return whether the device supports HT on the given link.
void ForwardUp(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
bool Is6GhzBand(uint8_t linkId) const
Indicate if a given link is on the 6 GHz band.
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.
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 DoDispose() override
Destructor implementation.
bool GetDsssSupported(uint8_t linkId) const
Return whether the device supports DSSS on the given link.
represent a single transmission mode
const std::string & GetUniqueName() const
uint64_t GetDataRate(MHz_u channelWidth, Time guardInterval, uint8_t nss) const
uint8_t GetMcsValue() const
std::list< uint8_t > GetBssMembershipSelectorList() const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
uint8_t GetMaxSupportedRxSpatialStreams() const
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.
MHz_u GetChannelWidth() const
std::list< WifiMode > GetModeList() const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
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...
Ptr< AttributeChecker > MakeAttributeContainerChecker()
Make uninitialized AttributeContainerChecker using explicit types.
Ptr< AttributeChecker > MakePairChecker()
Make a PairChecker without abscissa and ordinate AttributeCheckers.
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if a condition is false, with a message.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#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_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_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
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 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.
WifiMacDropReason
The reason why an MPDU was dropped.
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_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)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
U * PeekPointer(const Ptr< U > &p)
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
const Time WIFI_TU
Wi-Fi Time Unit (see IEEE 802.11-2020 sec. 3.1)
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
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)
std::variant< std::reference_wrapper< MgtAssocRequestHeader >, std::reference_wrapper< MgtReassocRequestHeader > > AssocReqRefVariant
variant holding a reference to a (Re)Association Request
Ptr< const AttributeChecker > MakeEnumChecker(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
bool IsGroupcast(const Mac48Address &adr)
Check whether a MAC destination address corresponds to a groupcast transmission.
constexpr uint8_t WIFI_EHT_MAX_MCS_INDEX
IEEE 802.11be D2.0 Figure 9-1002ai.
WifiMacType
Combination of valid MAC header type/subtype.
@ WIFI_MAC_MGT_ASSOCIATION_RESPONSE
@ WIFI_MAC_MGT_DISASSOCIATION
@ 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.
std::pair< Mac48Address, uint8_t > WifiAddressTidPair
(MAC address, TID) pair
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
std::map< uint8_t, std::set< uint8_t > > WifiTidLinkMapping
TID-indexed map of the link set to which the TID is mapped.
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU)
Struct containing all supported rates.
void SetBasicRate(uint64_t bs)
Set the given rate to basic 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.
Structure holding information specific to a single link.
std::map< uint16_t, Mac48Address > staList
Map of all stations currently associated to the AP with their association ID.
EventId beaconEvent
Event to generate one beacon.
~ApLinkEntity() override
Destructor (a virtual method is needed to make this struct polymorphic)
uint16_t numNonHtStations
Number of non-HT stations currently associated to the AP.
uint16_t numNonErpStations
Number of non-ERP stations currently associated to the AP.
6 GHz Operation Information field
Ptr< WifiPhy > phy
Wifi PHY object.
Ptr< FrameExchangeManager > feManager
Frame Exchange Manager object.
Ptr< ChannelAccessManager > channelAccessManager
channel access manager object