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 /// Store information about a main PHY switch.
80 {
81 Time end; //!< end of channel switching
82 uint8_t from; //!< ID of the link which the main PHY is/has been leaving
83 uint8_t to; //!< ID of the link which the main PHY is moving to
84 };
85
86 bool m_switchAuxPhy; /**< whether Aux PHY should switch channel to operate on the link on which
87 the Main PHY was operating before moving to the link of the Aux PHY */
88 Ptr<WifiPhy> m_auxPhyToReconnect; //!< Aux PHY the ChannelAccessManager of the link on which
89 //!< the main PHY is operating has to connect a listener to
90 //!< when the main PHY is back operating on its previous link
91 EventId m_auxPhySwitchEvent; //!< event scheduled for an aux PHY to switch link
92 MainPhySwitchInfo m_mainPhySwitchInfo; //!< main PHY switch info
93 std::map<uint8_t, Time> m_switchMainPhyOnRtsTx; //!< link ID-indexed map of the time when an RTS
94 //!< that requires the main PHY to switch link
95 //!< is expected to be transmitted on the link
96
97 private:
98 void DoNotifyMgtFrameReceived(Ptr<const WifiMpdu> mpdu, uint8_t linkId) override;
99 void NotifyMainPhySwitch(std::optional<uint8_t> currLinkId,
100 uint8_t nextLinkId,
101 Ptr<WifiPhy> auxPhy,
102 Time duration) override;
103 void DoNotifyIcfReceived(uint8_t linkId) override;
104 void DoNotifyUlTxopStart(uint8_t linkId) override;
105 void DoNotifyTxopEnd(uint8_t linkId) override;
106};
107
108} // namespace ns3
109
110#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.
MainPhySwitchInfo m_mainPhySwitchInfo
main PHY switch info
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:48
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.
Store information about a main PHY switch.
uint8_t to
ID of the link which the main PHY is moving to.
uint8_t from
ID of the link which the main PHY is/has been leaving.
Base struct for EMLSR Main PHY switch traces.