A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
default-emlsr-manager.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Universita' degli Studi di Napoli Federico II
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Stefano Avallone <stavallo@unina.it>
7 */
8
9#ifndef DEFAULT_EMLSR_MANAGER_H
10#define DEFAULT_EMLSR_MANAGER_H
11
12#include "emlsr-manager.h"
13
14#include <optional>
15
16namespace ns3
17{
18
19/**
20 * @ingroup wifi
21 *
22 * DefaultEmlsrManager is the default EMLSR manager.
23 */
25{
26 public:
27 /**
28 * @brief Get the type ID.
29 * @return the object TypeId
30 */
31 static TypeId GetTypeId();
32
34 ~DefaultEmlsrManager() override;
35
36 void NotifyRtsSent(uint8_t linkId,
38 const WifiTxVector& txVector) override;
39
40 protected:
41 uint8_t GetLinkToSendEmlOmn() override;
42 std::optional<uint8_t> ResendNotification(Ptr<const WifiMpdu> mpdu) override;
43 std::pair<bool, Time> DoGetDelayUntilAccessRequest(uint8_t linkId) override;
44 void SwitchMainPhyIfTxopGainedByAuxPhy(uint8_t linkId, AcIndex aci) override;
45 std::pair<bool, Time> GetDelayUnlessMainPhyTakesOverUlTxop(uint8_t linkId) override;
46 void NotifyEmlsrModeChanged() override;
47
48 /**
49 * This function is intended to be called when an aux PHY is about to transmit an RTS on
50 * the given link to calculate the time remaining to the end of the CTS reception.
51 *
52 * @param linkId the ID of the given link
53 * @return the time remaining to the end of the CTS reception
54 */
55 Time GetTimeToCtsEnd(uint8_t linkId) const;
56
57 /**
58 * This function is intended to be called when an aux PHY is about to transmit an RTS on
59 * the given link to calculate the time remaining to the end of the CTS reception.
60 *
61 * @param linkId the ID of the given link
62 * @param rtsTxVector the TXVECTOR used to transmit the RTS
63 * @return the time remaining to the end of the CTS reception
64 */
65 Time GetTimeToCtsEnd(uint8_t linkId, const WifiTxVector& rtsTxVector) const;
66
67 /**
68 * This method can only be called when aux PHYs do not switch link. Switch the main PHY back
69 * to the preferred link and reconnect the aux PHY that was operating on the link left by the
70 * main PHY.
71 *
72 * @param linkId the ID of the link that the main PHY is leaving
73 * @param traceInfo information to pass to the main PHY switch traced callback (the fromLinkId
74 * and toLinkId fields are set by SwitchMainPhy)
75 */
76 void SwitchMainPhyBackToPreferredLink(uint8_t linkId, EmlsrMainPhySwitchTrace&& traceInfo);
77
78 bool m_switchAuxPhy; /**< whether Aux PHY should switch channel to operate on the link on which
79 the Main PHY was operating before moving to the link of the Aux PHY */
80 Ptr<WifiPhy> m_auxPhyToReconnect; //!< Aux PHY the ChannelAccessManager of the link on which
81 //!< the main PHY is operating has to connect a listener to
82 //!< when the main PHY is back operating on its previous link
83 EventId m_auxPhySwitchEvent; //!< event scheduled for an aux PHY to switch link
84 std::map<uint8_t, Time> m_switchMainPhyOnRtsTx; //!< link ID-indexed map of the time when an RTS
85 //!< that requires the main PHY to switch link
86 //!< is expected to be transmitted on the link
87
88 private:
89 /**
90 * This function shall be called when the main PHY starts switching to a link on which an aux
91 * PHY that is capable of switching link is operating. This function schedules the aux PHY
92 * switch to occur when the main PHY completes the switch and, in case the connection of the
93 * main PHY to the aux PHY link is postponed because the aux PHY is receiving a PPDU, the
94 * aux PHY switch is postponed accordingly.
95 *
96 * @param auxPhy the aux PHY that has to switch link
97 * @param currLinkId the link on which the aux PHY is operating
98 * @param nextLinkId the link to which the aux PHY will switch
99 * @param duration the remaining time until the aux PHY switch starts
100 */
102 uint8_t currLinkId,
103 uint8_t nextLinkId,
104 Time duration);
105
106 void DoNotifyMgtFrameReceived(Ptr<const WifiMpdu> mpdu, uint8_t linkId) override;
107 void NotifyMainPhySwitch(std::optional<uint8_t> currLinkId,
108 uint8_t nextLinkId,
109 Ptr<WifiPhy> auxPhy,
110 Time duration) override;
111 void DoNotifyIcfReceived(uint8_t linkId) override;
112 void DoNotifyUlTxopStart(uint8_t linkId) override;
113 void DoNotifyTxopEnd(uint8_t linkId) override;
114};
115
116} // namespace ns3
117
118#endif /* DEFAULT_EMLSR_MANAGER_H */
DefaultEmlsrManager is the default EMLSR manager.
void DoNotifyMgtFrameReceived(Ptr< const WifiMpdu > mpdu, uint8_t linkId) override
Notify the subclass of the reception of a management frame addressed to us.
void SwitchMainPhyIfTxopGainedByAuxPhy(uint8_t linkId, AcIndex aci) override
Subclasses have to provide an implementation for this method, that is called by the base class when t...
void NotifyEmlsrModeChanged() override
Notify subclass that EMLSR mode changed.
EventId m_auxPhySwitchEvent
event scheduled for an aux PHY to switch link
Ptr< WifiPhy > m_auxPhyToReconnect
Aux PHY the ChannelAccessManager of the link on which the main PHY is operating has to connect a list...
void DoNotifyUlTxopStart(uint8_t linkId) override
Notify the subclass of the start of an UL TXOP on the given link.
void NotifyMainPhySwitch(std::optional< uint8_t > currLinkId, uint8_t nextLinkId, Ptr< WifiPhy > auxPhy, Time duration) override
Notify subclass that the main PHY is switching channel to operate on another link.
bool m_switchAuxPhy
whether Aux PHY should switch channel to operate on the link on which the Main PHY was operating befo...
void NotifyRtsSent(uint8_t linkId, Ptr< const WifiPsdu > rts, const WifiTxVector &txVector) override
Notify that RTS transmission is starting on the given link.
std::pair< bool, Time > DoGetDelayUntilAccessRequest(uint8_t linkId) override
Subclasses have to provide an implementation for this method, that is called by the base class when t...
Time GetTimeToCtsEnd(uint8_t linkId) const
This function is intended to be called when an aux PHY is about to transmit an RTS on the given link ...
std::map< uint8_t, Time > m_switchMainPhyOnRtsTx
link ID-indexed map of the time when an RTS that requires the main PHY to switch link is expected to ...
static TypeId GetTypeId()
Get the type ID.
void DoNotifyIcfReceived(uint8_t linkId) override
Notify the subclass of the reception of an initial Control frame on the given link.
std::optional< uint8_t > ResendNotification(Ptr< const WifiMpdu > mpdu) override
A previous EML Operating Mode Notification frame was dropped.
void SwitchMainPhyBackToPreferredLink(uint8_t linkId, EmlsrMainPhySwitchTrace &&traceInfo)
This method can only be called when aux PHYs do not switch link.
void DoNotifyTxopEnd(uint8_t linkId) override
Notify the subclass of the end of a TXOP on the given link.
void SwitchAuxPhyAfterMainPhy(Ptr< WifiPhy > auxPhy, uint8_t currLinkId, uint8_t nextLinkId, Time duration)
This function shall be called when the main PHY starts switching to a link on which an aux PHY that i...
std::pair< bool, Time > GetDelayUnlessMainPhyTakesOverUlTxop(uint8_t linkId) override
Subclasses have to provide an implementation for this method, that is called by the base class when t...
uint8_t GetLinkToSendEmlOmn() override
EmlsrManager is an abstract base class defining the API that EHT non-AP MLDs with EMLSR activated can...
An identifier for simulation events.
Definition event-id.h:45
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:49
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition qos-utils.h:62
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Base struct for EMLSR Main PHY switch traces.