26#include "ns3/assert.h"
27#include "ns3/attribute-container.h"
29#include "ns3/wifi-mpdu.h"
42 TypeId(
"ns3::EmlsrManager")
45 .AddAttribute(
"EmlsrPaddingDelay",
46 "The EMLSR Paddind Delay (not used by AP MLDs). "
47 "Possible values are 0 us, 32 us, 64 us, 128 us or 256 us.",
51 .AddAttribute(
"EmlsrTransitionDelay",
52 "The EMLSR Transition Delay (not used by AP MLDs). "
53 "Possible values are 0 us, 16 us, 32 us, 64 us, 128 us or 256 us.",
59 "IDs of the links on which EMLSR mode will be enabled. An empty set "
60 "indicates to disable EMLSR.",
63 MakeAttributeContainerChecker<UintegerValue>(MakeUintegerChecker<uint8_t>()));
99 "EmlsrManager can only be installed on non-AP MLDs");
106const std::set<uint8_t>&
141 NS_ABORT_MSG_IF(linkIds.size() == 1,
"Cannot enable EMLSR mode on a single link");
160 const auto& hdr = mpdu->GetHeader();
177 action.protectedEhtAction ==
196 "AP did not advertise a Transition Timeout, cannot send EML notification");
220 if (
auto setupLinkIt = setupLinkIds.find(*emlsrLinkIt); setupLinkIt != setupLinkIds.cend())
222 setupLinkIds.erase(setupLinkIt);
230 NS_LOG_DEBUG(
"Link ID " << +(*emlsrLinkIt) <<
" has not been setup");
256 const auto& hdr = mpdu->GetHeader();
258 if (hdr.IsAssocReq())
262 mpdu->GetPacket()->PeekHeader(assocReq);
264 NS_ASSERT_MSG(mle,
"AssocReq should contain a Multi-Link Element");
269 if (hdr.IsMgt() && hdr.IsAction())
273 action.protectedEhtAction ==
291 const auto& hdr = mpdu->GetHeader();
293 if (hdr.IsMgt() && hdr.IsAction())
295 auto pkt = mpdu->GetPacket()->Copy();
298 action.protectedEhtAction ==
307 pkt->RemoveHeader(frame);
A container for one type of attribute.
void SetTransitionTimeout(Time timeout)
Set the Transition Timeout advertised by the associated AP with EMLSR activated.
virtual uint8_t GetLinkToSendEmlNotification()=0
std::optional< Time > GetTransitionTimeout() const
void ChangeEmlsrMode()
This method is called to make an EMLSR mode change effective after the transition delay has elapsed o...
Ptr< EhtFrameExchangeManager > GetEhtFem(uint8_t linkId) const
void TxDropped(WifiMacDropReason reason, Ptr< const WifiMpdu > mpdu)
Notify that the given MPDU has been discarded for the given reason.
void TxOk(Ptr< const WifiMpdu > mpdu)
Notify the acknowledgment of the given MPDU.
void SetEmlsrLinks(const std::set< uint8_t > &linkIds)
Take actions to enable EMLSR mode on the given set of links, if non-empty, or disable EMLSR mode,...
void NotifyMgtFrameReceived(Ptr< const WifiMpdu > mpdu, uint8_t linkId)
Notify the reception of a management frame addressed to us.
Ptr< StaWifiMac > m_staMac
the MAC of the managed non-AP MLD
virtual void DoNotifyMgtFrameReceived(Ptr< const WifiMpdu > mpdu, uint8_t linkId)=0
Notify the subclass of the reception of a management frame addressed to us.
Time m_emlsrPaddingDelay
EMLSR Padding delay.
void SendEmlOperatingModeNotification()
Send an EML Operating Mode Notification frame.
Time m_emlsrTransitionDelay
EMLSR Transition delay.
void SetWifiMac(Ptr< StaWifiMac > mac)
Set the wifi MAC.
const std::set< uint8_t > & GetEmlsrLinks() const
std::optional< Time > m_emlsrTransitionTimeout
Transition timeout advertised by APs with EMLSR activated.
std::optional< std::set< uint8_t > > m_nextEmlsrLinks
ID of the links that will become the EMLSR links when the pending notification frame is acknowledged.
virtual void NotifyEmlsrModeChanged()=0
Notify subclass that EMLSR mode changed.
Time m_lastAdvTransitionDelay
last advertised transition delay
void DoDispose() override
Destructor implementation.
virtual std::optional< uint8_t > ResendNotification(Ptr< const WifiMpdu > mpdu)=0
A previous EML Operating Mode Notification frame was dropped.
Ptr< StaWifiMac > GetStaMac() const
Time m_lastAdvPaddingDelay
last advertised padding delay
EventId m_transitionTimeoutEvent
Timer started after the successful transmission of an EML Operating Mode Notification frame.
static TypeId GetTypeId()
Get the type ID.
std::set< uint8_t > m_emlsrLinks
ID of the EMLSR links (empty if EMLSR mode is disabled)
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
EventImpl * PeekEventImpl() const
bool IsRunning() const
This method is syntactic sugar for !IsExpired().
void Invoke()
Called by the simulation engine to notify the event that it is time to execute.
Implement the header for Action frames of type EML Operating Mode Notification.
void SetLinkIdInBitmap(uint8_t linkId)
Set the bit position in the link bitmap corresponding to the given link.
EmlControl m_emlControl
EML Control field.
std::optional< EmlsrParamUpdate > m_emlsrParamUpdate
EMLSR Parameter Update field.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
bool TraceDisconnectWithoutContext(std::string name, const CallbackBase &cb)
Disconnect from a TraceSource a Callback previously connected without a context.
A base class which provides memory management and object aggregation.
virtual void DoDispose()
Destructor implementation.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
std::set< uint8_t > GetSetupLinkIds() const
Get the IDs of the setup links (if any).
std::optional< uint8_t > GetApLinkId(uint8_t linkId) const
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.
AttributeValue implementation for Time.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< FrameExchangeManager > GetFrameExchangeManager(uint8_t linkId=SINGLE_LINK_OP_ID) const
Get the Frame Exchange Manager associated with the given link.
Mac48Address GetBssid(uint8_t linkId) const
TypeOfStation GetTypeOfStation() const
Return the type of station.
uint8_t GetNLinks() const
Get the number of links (can be greater than 1 for 11be devices only).
Ptr< EhtConfiguration > GetEhtConfiguration() const
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
#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_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.
WifiMacDropReason
The reason why an MPDU was dropped.
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...
static uint8_t EncodeEmlsrTransitionDelay(Time delay)
static uint8_t EncodeEmlsrPaddingDelay(Time delay)
uint8_t emlsrMode
EMLSR Mode.
uint8_t emlsrParamUpdateCtrl
EMLSR Parameter Update Control.
EMLSR Parameter Update field.