A Discrete-Event Network Simulator
API
he-frame-exchange-manager.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2020 Universita' degli Studi di Napoli Federico II
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Stefano Avallone <stavallo@unina.it>
19  */
20 
21 #ifndef HE_FRAME_EXCHANGE_MANAGER_H
22 #define HE_FRAME_EXCHANGE_MANAGER_H
23 
24 #include "ns3/vht-frame-exchange-manager.h"
25 #include "mu-snr-tag.h"
26 #include <map>
27 #include <unordered_map>
28 
29 namespace ns3 {
30 
31 class MultiUserScheduler;
32 class ApWifiMac;
33 class StaWifiMac;
34 class CtrlTriggerHeader;
35 
39 typedef std::unordered_map <uint16_t /* staId */, Ptr<WifiPsdu> /* PSDU */> WifiPsduMap;
43 typedef std::unordered_map <uint16_t /* staId */, Ptr<const WifiPsdu> /* PSDU */> WifiConstPsduMap;
44 
52 {
53 public:
58  static TypeId GetTypeId (void);
60  virtual ~HeFrameExchangeManager ();
61 
62  uint16_t GetSupportedBaBufferSize (void) const override;
63  bool StartFrameExchange (Ptr<QosTxop> edca, Time availableTime, bool initialFrame) override;
64  void SetWifiMac (const Ptr<RegularWifiMac> mac) override;
65  void CalculateAcknowledgmentTime (WifiAcknowledgment* acknowledgment) const override;
66 
72  void SetMultiUserScheduler (const Ptr<MultiUserScheduler> muScheduler);
73 
82  static Ptr<WifiPsdu> GetPsduTo (Mac48Address to, const WifiPsduMap& psduMap);
83 
91  virtual void SetTargetRssi (CtrlTriggerHeader& trigger) const;
92 
93 protected:
94  void DoDispose () override;
95 
96  void ReceiveMpdu (Ptr<WifiMacQueueItem> mpdu, RxSignalInfo rxSignalInfo,
97  const WifiTxVector& txVector, bool inAmpdu) override;
98  void EndReceiveAmpdu (Ptr<const WifiPsdu> psdu, const RxSignalInfo& rxSignalInfo,
99  const WifiTxVector& txVector, const std::vector<bool>& perMpduStatus) override;
100  Time GetTxDuration (uint32_t ppduPayloadSize, Mac48Address receiver,
101  const WifiTxParameters& txParams) const override;
102  bool SendMpduFromBaManager (Ptr<QosTxop> edca, Time availableTime, bool initialFrame) override;
103 
112  void SendPsduMapWithProtection (WifiPsduMap psduMap, WifiTxParameters& txParams);
113 
120  void ForwardPsduMapDown (WifiConstPsduMap psduMap, WifiTxVector& txVector);
121 
131  virtual void BlockAcksInTbPpduTimeout (WifiPsduMap* psduMap,
132  const std::set<Mac48Address>* staMissedBlockAckFrom,
133  std::size_t nSolicitedStations);
134 
144  virtual void TbPpduTimeout (WifiPsduMap* psduMap,
145  const std::set<Mac48Address>* staMissedTbPpduFrom,
146  std::size_t nSolicitedStations);
147 
155  virtual void BlockAckAfterTbPpduTimeout (Ptr<WifiPsdu> psdu, const WifiTxVector& txVector);
156 
167  WifiTxVector GetHeTbTxVector (CtrlTriggerHeader trigger, Mac48Address triggerSender) const;
168 
181  Ptr<WifiMacQueueItem> PrepareMuBar (const WifiTxVector& responseTxVector,
182  std::map<uint16_t, CtrlBAckRequestHeader> recipients) const;
183 
189  void SendMultiStaBlockAck (const WifiTxParameters& txParams);
190 
199  void SendQosNullFramesInTbPpdu (const CtrlTriggerHeader& trigger, const WifiMacHeader& hdr);
200 
203 
204 private:
208  void SendPsduMap (void);
209 
216  void ReceiveBasicTrigger (const CtrlTriggerHeader& trigger, const WifiMacHeader& hdr);
217 
222  std::set<Mac48Address> m_staExpectTbPpduFrom;
226 };
227 
228 } //namespace ns3
229 
230 #endif /* HE_FRAME_EXCHANGE_MANAGER_H */
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::HeFrameExchangeManager::m_psduMap
WifiPsduMap m_psduMap
the A-MPDU being transmitted
Definition: he-frame-exchange-manager.h:218
ns3::HeFrameExchangeManager
HeFrameExchangeManager handles the frame exchange sequences for HE stations.
Definition: he-frame-exchange-manager.h:52
ns3::VhtFrameExchangeManager
VhtFrameExchangeManager handles the frame exchange sequences for VHT stations.
Definition: vht-frame-exchange-manager.h:35
ns3::WifiPsduMap
std::unordered_map< uint16_t, Ptr< WifiPsdu > > WifiPsduMap
Map of PSDUs indexed by STA-ID.
Definition: he-frame-exchange-manager.h:34
ns3::EventId
An identifier for simulation events.
Definition: event-id.h:54
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::HeFrameExchangeManager::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: he-frame-exchange-manager.cc:44
ns3::HeFrameExchangeManager::SendMultiStaBlockAck
void SendMultiStaBlockAck(const WifiTxParameters &txParams)
Send a Multi-STA Block Ack frame after the reception of some TB PPDUs.
Definition: he-frame-exchange-manager.cc:1038
ns3::HeFrameExchangeManager::m_muScheduler
Ptr< MultiUserScheduler > m_muScheduler
Multi-user Scheduler (HE APs only)
Definition: he-frame-exchange-manager.h:220
ns3::Mac48Address
an EUI-48 address
Definition: mac48-address.h:44
ns3::WifiTxVector
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Definition: wifi-tx-vector.h:71
ns3::HeFrameExchangeManager::StartFrameExchange
bool StartFrameExchange(Ptr< QosTxop > edca, Time availableTime, bool initialFrame) override
Start a frame exchange (including protection frames and acknowledgment frames as needed) that fits wi...
Definition: he-frame-exchange-manager.cc:109
third.mac
mac
Definition: third.py:99
ns3::WifiConstPsduMap
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Definition: he-frame-exchange-manager.h:43
ns3::MuSnrTag
A tag to be attached to a response to a multi-user UL frame, that carries the SNR values with which t...
Definition: mu-snr-tag.h:36
ns3::WifiTxParameters
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism,...
Definition: wifi-tx-parameters.h:45
ns3::HeFrameExchangeManager::GetSupportedBaBufferSize
uint16_t GetSupportedBaBufferSize(void) const override
Get the maximum supported buffer size for a Block Ack agreement.
Definition: he-frame-exchange-manager.cc:66
ns3::HeFrameExchangeManager::m_muSnrTag
MuSnrTag m_muSnrTag
Tag to attach to Multi-STA BlockAck frames.
Definition: he-frame-exchange-manager.h:224
ns3::HeFrameExchangeManager::m_apMac
Ptr< ApWifiMac > m_apMac
MAC pointer (null if not an AP)
Definition: he-frame-exchange-manager.h:201
ns3::WifiMacHeader
Implements the IEEE 802.11 MAC header.
Definition: wifi-mac-header.h:85
ns3::HeFrameExchangeManager::SendMpduFromBaManager
bool SendMpduFromBaManager(Ptr< QosTxop > edca, Time availableTime, bool initialFrame) override
If the Block Ack Manager associated with the given EDCA has a BlockAckReq frame to transmit (the dura...
Definition: he-frame-exchange-manager.cc:170
ns3::HeFrameExchangeManager::PrepareMuBar
Ptr< WifiMacQueueItem > PrepareMuBar(const WifiTxVector &responseTxVector, std::map< uint16_t, CtrlBAckRequestHeader > recipients) const
Build a MU-BAR Trigger Frame starting from the TXVECTOR used to respond to the MU-BAR (in case of mul...
Definition: he-frame-exchange-manager.cc:609
ns3::Ptr< WifiPsdu >
ns3::HeFrameExchangeManager::GetHeTbTxVector
WifiTxVector GetHeTbTxVector(CtrlTriggerHeader trigger, Mac48Address triggerSender) const
Return a TXVECTOR for the UL frame that the station will send in response to the given Trigger frame,...
Definition: he-frame-exchange-manager.cc:960
ns3::HeFrameExchangeManager::DoDispose
void DoDispose() override
Destructor implementation.
Definition: he-frame-exchange-manager.cc:85
ns3::HeFrameExchangeManager::EndReceiveAmpdu
void EndReceiveAmpdu(Ptr< const WifiPsdu > psdu, const RxSignalInfo &rxSignalInfo, const WifiTxVector &txVector, const std::vector< bool > &perMpduStatus) override
This method is called when the reception of an A-MPDU including multiple MPDUs is completed.
Definition: he-frame-exchange-manager.cc:1599
ns3::HeFrameExchangeManager::SendPsduMap
void SendPsduMap(void)
Send the current PSDU map as a DL MU PPDU.
Definition: he-frame-exchange-manager.cc:258
ns3::HeFrameExchangeManager::CalculateAcknowledgmentTime
void CalculateAcknowledgmentTime(WifiAcknowledgment *acknowledgment) const override
Calculate the time required to acknowledge a frame according to the given acknowledgment method.
Definition: he-frame-exchange-manager.cc:659
ns3::HeFrameExchangeManager::ForwardPsduMapDown
void ForwardPsduMapDown(WifiConstPsduMap psduMap, WifiTxVector &txVector)
Forward a map of PSDUs down to the PHY layer.
Definition: he-frame-exchange-manager.cc:584
ns3::HeFrameExchangeManager::HeFrameExchangeManager
HeFrameExchangeManager()
Definition: he-frame-exchange-manager.cc:54
ns3::CtrlTriggerHeader
Headers for Trigger frames.
Definition: ctrl-headers.h:886
ns3::HeFrameExchangeManager::ReceiveMpdu
void ReceiveMpdu(Ptr< WifiMacQueueItem > mpdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, bool inAmpdu) override
This method handles the reception of an MPDU (possibly included in an A-MPDU)
Definition: he-frame-exchange-manager.cc:1299
ns3::HeFrameExchangeManager::SendQosNullFramesInTbPpdu
void SendQosNullFramesInTbPpdu(const CtrlTriggerHeader &trigger, const WifiMacHeader &hdr)
Send QoS Null frames in response to a Basic or BSRP Trigger Frame.
Definition: he-frame-exchange-manager.cc:1226
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::HeFrameExchangeManager::m_multiStaBaEvent
EventId m_multiStaBaEvent
Sending a Multi-STA BlockAck event.
Definition: he-frame-exchange-manager.h:223
ns3::HeFrameExchangeManager::GetTxDuration
Time GetTxDuration(uint32_t ppduPayloadSize, Mac48Address receiver, const WifiTxParameters &txParams) const override
Get the updated TX duration of the frame associated with the given TX parameters if the size of the P...
Definition: he-frame-exchange-manager.cc:809
ns3::HeFrameExchangeManager::BlockAckAfterTbPpduTimeout
virtual void BlockAckAfterTbPpduTimeout(Ptr< WifiPsdu > psdu, const WifiTxVector &txVector)
Take the necessary actions after that a Block Ack is missing after a TB PPDU solicited through a Trig...
Definition: he-frame-exchange-manager.cc:940
ns3::HeFrameExchangeManager::SetWifiMac
void SetWifiMac(const Ptr< RegularWifiMac > mac) override
Set the MAC layer to use.
Definition: he-frame-exchange-manager.cc:77
ns3::RxSignalInfo
RxSignalInfo structure containing info on the received signal.
Definition: phy-entity.h:67
ns3::WifiAcknowledgment
WifiAcknowledgment is an abstract base struct.
Definition: wifi-acknowledgment.h:45
mu-snr-tag.h
ns3::HeFrameExchangeManager::m_txParams
WifiTxParameters m_txParams
the TX parameters for the current PPDU
Definition: he-frame-exchange-manager.h:219
ns3::HeFrameExchangeManager::SendPsduMapWithProtection
void SendPsduMapWithProtection(WifiPsduMap psduMap, WifiTxParameters &txParams)
Send a map of PSDUs as a DL MU PPDU.
Definition: he-frame-exchange-manager.cc:197
ns3::HeFrameExchangeManager::ReceiveBasicTrigger
void ReceiveBasicTrigger(const CtrlTriggerHeader &trigger, const WifiMacHeader &hdr)
Take the necessary actions when receiveing a Basic Trigger Frame.
Definition: he-frame-exchange-manager.cc:1127
ns3::HeFrameExchangeManager::m_staMac
Ptr< StaWifiMac > m_staMac
MAC pointer (null if not a STA)
Definition: he-frame-exchange-manager.h:202
ns3::HeFrameExchangeManager::SetTargetRssi
virtual void SetTargetRssi(CtrlTriggerHeader &trigger) const
Set the UL Target RSSI subfield of every User Info fields of the given Trigger Frame to the most rece...
Definition: he-frame-exchange-manager.cc:1020
ns3::HeFrameExchangeManager::GetPsduTo
static Ptr< WifiPsdu > GetPsduTo(Mac48Address to, const WifiPsduMap &psduMap)
Get the PSDU in the given PSDU map that is addressed to the given MAC address, if any,...
Definition: he-frame-exchange-manager.cc:245
ns3::HeFrameExchangeManager::~HeFrameExchangeManager
virtual ~HeFrameExchangeManager()
Definition: he-frame-exchange-manager.cc:60
ns3::HeFrameExchangeManager::m_staExpectTbPpduFrom
std::set< Mac48Address > m_staExpectTbPpduFrom
set of stations expected to send a TB PPDU
Definition: he-frame-exchange-manager.h:222
ns3::HeFrameExchangeManager::TbPpduTimeout
virtual void TbPpduTimeout(WifiPsduMap *psduMap, const std::set< Mac48Address > *staMissedTbPpduFrom, std::size_t nSolicitedStations)
Take the necessary actions after that some TB PPDUs are missing in response to Trigger Frame.
Definition: he-frame-exchange-manager.cc:841
ns3::HeFrameExchangeManager::BlockAcksInTbPpduTimeout
virtual void BlockAcksInTbPpduTimeout(WifiPsduMap *psduMap, const std::set< Mac48Address > *staMissedBlockAckFrom, std::size_t nSolicitedStations)
Take the necessary actions after that some BlockAck frames are missing in response to a DL MU PPDU.
Definition: he-frame-exchange-manager.cc:872
ns3::HeFrameExchangeManager::m_triggerFrameInAmpdu
bool m_triggerFrameInAmpdu
True if the received A-MPDU contains an MU-BAR.
Definition: he-frame-exchange-manager.h:225
ns3::HeFrameExchangeManager::m_triggerFrame
Ptr< WifiMacQueueItem > m_triggerFrame
Trigger Frame being sent.
Definition: he-frame-exchange-manager.h:221
ns3::HeFrameExchangeManager::SetMultiUserScheduler
void SetMultiUserScheduler(const Ptr< MultiUserScheduler > muScheduler)
Set the Multi-user Scheduler associated with this Frame Exchange Manager.
Definition: he-frame-exchange-manager.cc:98