A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
emlsr-manager.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Universita' degli Studi di Napoli Federico II
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Stefano Avallone <stavallo@unina.it>
18 */
19
20#ifndef EMLSR_MANAGER_H
21#define EMLSR_MANAGER_H
22
23#include "ns3/ctrl-headers.h"
24#include "ns3/mac48-address.h"
25#include "ns3/mgt-headers.h"
26#include "ns3/object.h"
27#include "ns3/sta-wifi-mac.h"
28#include "ns3/wifi-phy-operating-channel.h"
29
30#include <map>
31#include <optional>
32#include <set>
33
34namespace ns3
35{
36
37class EhtFrameExchangeManager;
38class WifiMpdu;
39
46class EmlsrManager : public Object
47{
48 public:
53 static TypeId GetTypeId();
55 ~EmlsrManager() override;
56
63
70
74 std::optional<Time> GetTransitionTimeout() const;
75
82 void SetMainPhyId(uint8_t mainPhyId);
83
87 uint8_t GetMainPhyId() const;
88
96 void SetEmlsrLinks(const std::set<uint8_t>& linkIds);
97
101 const std::set<uint8_t>& GetEmlsrLinks() const;
102
109 void SetCamStateReset(bool enable);
110
115 bool GetCamStateReset() const;
116
123 void NotifyMgtFrameReceived(Ptr<const WifiMpdu> mpdu, uint8_t linkId);
124
130 void NotifyIcfReceived(uint8_t linkId);
131
137 void NotifyUlTxopStart(uint8_t linkId);
138
144 void NotifyTxopEnd(uint8_t linkId);
145
146 protected:
147 void DoDispose() override;
148
153
158 Ptr<EhtFrameExchangeManager> GetEhtFem(uint8_t linkId) const;
159
163 virtual uint8_t GetLinkToSendEmlOmn() = 0;
164
172 virtual std::optional<uint8_t> ResendNotification(Ptr<const WifiMpdu> mpdu) = 0;
173
179 const WifiPhyOperatingChannel& GetChannelForMainPhy(uint8_t linkId) const;
180
186 const WifiPhyOperatingChannel& GetChannelForAuxPhy(uint8_t linkId) const;
187
192
195 uint8_t m_mainPhyId;
197
198 private:
206
210 void SendEmlOmn();
211
218 virtual void DoNotifyMgtFrameReceived(Ptr<const WifiMpdu> mpdu, uint8_t linkId) = 0;
219
225 void TxOk(Ptr<const WifiMpdu> mpdu);
226
234
239 void ChangeEmlsrMode();
240
247 void SwitchMainPhy(uint8_t linkId, bool noSwitchDelay);
248
254
258 virtual void NotifyEmlsrModeChanged() = 0;
259
266 virtual void NotifyMainPhySwitch(uint8_t currLinkId, uint8_t nextLinkId) = 0;
267
269 std::optional<Time> m_emlsrTransitionTimeout;
271 std::set<uint8_t> m_emlsrLinks;
272 std::optional<std::set<uint8_t>> m_nextEmlsrLinks;
280 std::map<uint8_t, WifiPhyOperatingChannel>
282 std::map<uint8_t, WifiPhyOperatingChannel>
284};
285
286} // namespace ns3
287
288#endif /* EMLSR_MANAGER_H */
EmlsrManager is an abstract base class defining the API that EHT non-AP MLDs with EMLSR activated can...
Definition: emlsr-manager.h:47
void SendEmlOmn()
Send an EML Operating Mode Notification frame.
void ComputeOperatingChannels()
Compute the operating channels that the main PHY and the aux PHY(s) must switch to in order to operat...
void ApplyMaxChannelWidthOnAuxPhys()
Adjust the operating channel of all the aux PHYs to meet the constraint on the maximum channel width ...
void SetTransitionTimeout(Time timeout)
Set the Transition Timeout advertised by the associated AP with EMLSR activated.
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 NotifyUlTxopStart(uint8_t linkId)
Notify the start of an UL TXOP on the given link.
void TxOk(Ptr< const WifiMpdu > mpdu)
Notify the acknowledgment of the given MPDU.
virtual void NotifyMainPhySwitch(uint8_t currLinkId, uint8_t nextLinkId)=0
Notify subclass that the main PHY is switching channel to operate on another link.
bool GetCamStateReset() const
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,...
uint8_t m_mainPhyId
ID of main PHY (position in the vector of PHYs held by WifiNetDevice)
void NotifyIcfReceived(uint8_t linkId)
Notify the reception of an initial Control frame on the given link.
void NotifyMgtFrameReceived(Ptr< const WifiMpdu > mpdu, uint8_t linkId)
Notify the reception of a management frame addressed to us.
virtual uint8_t GetLinkToSendEmlOmn()=0
std::map< uint8_t, WifiPhyOperatingChannel > m_auxPhyChannels
link ID-indexed map of operating channels for the aux PHYs
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 NotifyTxopEnd(uint8_t linkId)
Notify the end of a TXOP on the given link.
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.
void SetMainPhyId(uint8_t mainPhyId)
Set the ID of main PHY (position in the vector of PHYs held by WifiNetDevice).
const WifiPhyOperatingChannel & GetChannelForMainPhy(uint8_t linkId) const
~EmlsrManager() override
void SwitchMainPhy(uint8_t linkId, bool noSwitchDelay)
Switch channel on the Main PHY so that it operates on the given link.
Time m_lastAdvTransitionDelay
last advertised transition delay
void DoDispose() override
Destructor implementation.
std::map< uint8_t, WifiPhyOperatingChannel > m_mainPhyChannels
link ID-indexed map of operating channels for the main PHY
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
uint8_t GetMainPhyId() const
void SetCamStateReset(bool enable)
Set the member variable indicating whether the state of the CAM should be reset when the main PHY swi...
EventId m_transitionTimeoutEvent
Timer started after the successful transmission of an EML Operating Mode Notification frame.
uint16_t m_auxPhyMaxWidth
max channel width (MHz) supported by aux PHYs
const WifiPhyOperatingChannel & GetChannelForAuxPhy(uint8_t linkId) const
bool m_resetCamState
whether to reset the state of CAM when main PHY switches channel
static TypeId GetTypeId()
Get the type ID.
std::set< uint8_t > m_emlsrLinks
ID of the EMLSR links (empty if EMLSR mode is disabled)
MgtEmlOmn GetEmlOmn()
An identifier for simulation events.
Definition: event-id.h:55
Implement the header for Action frames of type EML Operating Mode Notification.
Definition: mgt-headers.h:1113
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Class that keeps track of all information about the current PHY operating channel.
WifiMacDropReason
The reason why an MPDU was dropped.
Definition: wifi-mac.h:77
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Time timeout