13#include "ns3/ap-wifi-mac.h"
14#include "ns3/boolean.h"
16#include "ns3/wifi-phy.h"
17#include "ns3/wifi-psdu.h"
30 TypeId(
"ns3::AdvancedApEmlsrManager")
34 .AddAttribute(
"UseNotifiedMacHdr",
35 "Whether to use the information about the MAC header of the MPDU "
36 "being received, if notified by the PHY.",
40 .AddAttribute(
"EarlySwitchToListening",
41 "Whether the AP MLD assumes that an EMLSR client is able to detect at "
42 "the end of the MAC header that a PSDU is not addressed to it and "
43 "immediately starts switching to listening mode.",
48 "WaitTransDelayOnPsduRxError",
49 "If true, the AP MLD waits for a response timeout after a PSDU reception "
50 "error before starting the transition delay for the EMLSR client that "
51 "sent the failed PSDU. Otherwise, the AP MLD does not start the "
52 "transition delay timer for the EMLSR client that sent the failed PSDU.",
56 .AddAttribute(
"UpdateCwAfterFailedIcf",
57 "Whether the AP MLD shall double the CW upon CTS timeout after an "
58 "MU-RTS in case all the clients solicited by the MU-RTS are EMLSR "
59 "clients that have sent (or are sending) a frame to the AP",
80 for (uint8_t linkId = 0; linkId <
GetApMac()->GetNLinks(); linkId++)
82 auto phy =
GetApMac()->GetWifiPhy(linkId);
83 phy->TraceDisconnectWithoutContext(
95 for (uint8_t linkId = 0; linkId <
GetApMac()->GetNLinks(); linkId++)
97 auto phy =
GetApMac()->GetWifiPhy(linkId);
98 phy->TraceConnectWithoutContext(
145 auto phy =
GetApMac()->GetWifiPhy(linkId);
147 GetEhtFem(linkId)->EmlsrSwitchToListening(psdu->GetAddr2(), delay);
153 GetApMac()->GetWifiRemoteStationManager(linkId)->GetMldAddress(psdu->GetAddr2());
154 if (!mldAddress.has_value())
156 NS_LOG_DEBUG(psdu->GetAddr2() <<
" is not an EMLSR client");
160 std::set<uint8_t> linkIds;
161 for (uint8_t
id = 0;
id <
GetApMac()->GetNLinks();
id++)
163 if (
GetApMac()->GetWifiRemoteStationManager(
id)->GetEmlsrEnabled(*mldAddress))
186 auto macHdrSize = (*psdu->begin())->GetHeader().GetSerializedSize() +
187 ((psdu->GetNMpdus() > 1 || psdu->IsSingle()) ? 4 : 0);
AdvancedApEmlsrManager is an advanced AP EMLSR manager.
bool m_updateCwAfterFailedIcf
Whether the AP MLD shall double the CW upon CTS timeout.
void DoSetWifiMac(Ptr< ApWifiMac > mac) override
Allow subclasses to take actions when the MAC is set.
void ReceivedMacHdr(uint8_t linkId, const WifiMacHeader &macHdr, const WifiTxVector &txVector, Time psduDuration)
Store information about the MAC header of the MPDU being received on the given link.
bool UpdateCwAfterFailedIcf() override
bool m_useNotifiedMacHdr
whether to use the information about the MAC header of the MPDU being received (if notified by the PH...
bool m_waitTransDelayOnPsduRxError
Whether the AP MLD waits for a response timeout after a PSDU reception error before starting the tran...
Time GetDelayOnTxPsduNotForEmlsr(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector, WifiPhyBand band) override
This method is intended to be called when the AP MLD starts transmitting an SU frame that is not addr...
std::set< uint8_t > m_blockedLinksOnMacHdrRx
links that have been blocked upon receiving a MAC header
void NotifyPsduRxError(uint8_t linkId, Ptr< const WifiPsdu > psdu) override
This method is called when the reception of a PSDU fails on the given link.
void NotifyPsduRxOk(uint8_t linkId, Ptr< const WifiPsdu > psdu) override
This method is called when the reception of a PSDU succeeds on the given link.
~AdvancedApEmlsrManager() override
void DoDispose() override
Destructor implementation.
static TypeId GetTypeId()
Get the type ID.
bool m_earlySwitchToListening
Whether the AP MLD assumes that an EMLSR client is able to detect at the end of the MAC header that a...
Ptr< ApWifiMac > GetApMac() const
Ptr< EhtFrameExchangeManager > GetEhtFem(uint8_t linkId) const
Class for representing data rates.
Time CalculateBytesTxTime(uint32_t bytes) const
Calculate transmission time.
DefaultApEmlsrManager is the default AP EMLSR manager.
Time GetDelayOnTxPsduNotForEmlsr(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector, WifiPhyBand band) override
This method is intended to be called when the AP MLD starts transmitting an SU frame that is not addr...
virtual void DoDispose()
Destructor implementation.
Smart pointer class similar to boost::intrusive_ptr.
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.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
uint64_t GetDataRate(MHz_u channelWidth, Time guardInterval, uint8_t nss) const
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiMode GetMode(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the selected payload transmission mode.
#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_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
WifiPhyBand
Identifies the PHY band.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
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 > MakeBooleanAccessor(T1 a1)
const Time EMLSR_RX_PHY_START_DELAY
aRxPHYStartDelay value to use when waiting for a new frame in the context of EMLSR operations (Sec.