A Discrete-Event Network Simulator
API
qos-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 QOS_FRAME_EXCHANGE_MANAGER_H
22 #define QOS_FRAME_EXCHANGE_MANAGER_H
23 
24 #include "frame-exchange-manager.h"
25 
26 namespace ns3 {
27 
28 
37 {
38 public:
43  static TypeId GetTypeId (void);
45  virtual ~QosFrameExchangeManager ();
46 
47  // Overridden from FrameExchangeManager
48  virtual bool StartTransmission (Ptr<Txop> edca) override;
49 
63  bool TryAddMpdu (Ptr<const WifiMacQueueItem> mpdu, WifiTxParameters& txParams, Time availableTime) const;
64 
75  virtual bool IsWithinLimitsIfAddMpdu (Ptr<const WifiMacQueueItem> mpdu, const WifiTxParameters& txParams,
76  Time ppduDurationLimit) const;
77 
91  virtual bool IsWithinSizeAndTimeLimits (uint32_t ppduPayloadSize, Mac48Address receiver,
92  const WifiTxParameters& txParams, Time ppduDurationLimit) const;
93 
94 protected:
95  virtual void DoDispose () override;
96 
97  // Overridden from FrameExchangeManager
98  virtual void ReceiveMpdu (Ptr<WifiMacQueueItem> mpdu, RxSignalInfo rxSignalInfo,
99  const WifiTxVector& txVector, bool inAmpdu) override;
100  virtual void PreProcessFrame (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector) override;
101  virtual Time GetFrameDurationId (const WifiMacHeader& header, uint32_t size,
102  const WifiTxParameters& txParams,
103  Ptr<Packet> fragmentedPacket) const override;
104  virtual Time GetRtsDurationId (const WifiTxVector& rtsTxVector, Time txDuration,
105  Time response) const override;
106  virtual Time GetCtsToSelfDurationId (const WifiTxVector& ctsTxVector, Time txDuration,
107  Time response) const override;
108  virtual void TransmissionSucceeded (void) override;
109  virtual void TransmissionFailed (void) override;
110 
120  virtual bool StartTransmission (Ptr<QosTxop> edca, Time txopDuration);
121 
135  virtual bool StartFrameExchange (Ptr<QosTxop> edca, Time availableTime, bool initialFrame);
136 
142  void PifsRecovery (void);
143 
150  virtual bool SendCfEndIfNeeded (void);
151 
158  virtual void SetTxopHolder (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector);
159 
162 
163 private:
164 
169  void CancelPifsRecovery (void);
170 
175 };
176 
177 } //namespace ns3
178 
179 #endif /* QOS_FRAME_EXCHANGE_MANAGER_H */
EventId m_pifsRecoveryEvent
event associated with an attempt of PIFS recovery
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
virtual Time GetRtsDurationId(const WifiTxVector &rtsTxVector, Time txDuration, Time response) const override
Compute how to set the Duration/ID field of an RTS frame to send to protect a frame transmitted with ...
void PifsRecovery(void)
Perform a PIFS recovery as a response to transmission failure within a TXOP.
virtual bool StartTransmission(Ptr< Txop > edca) override
Request the FrameExchangeManager to start a frame exchange sequence.
virtual void DoDispose() override
Destructor implementation.
virtual void TransmissionSucceeded(void) override
Take necessary actions upon a transmission success.
RxSignalInfo structure containing info on the received signal.
Definition: phy-entity.h:66
virtual void PreProcessFrame(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector) override
Perform actions that are possibly needed when receiving any frame, independently of whether the frame...
QosFrameExchangeManager handles the frame exchange sequences for QoS stations.
virtual bool IsWithinSizeAndTimeLimits(uint32_t ppduPayloadSize, Mac48Address receiver, const WifiTxParameters &txParams, Time ppduDurationLimit) const
Check whether the transmission time of the frame being built (as described by the given TX parameters...
static TypeId GetTypeId(void)
Get the type ID.
Ptr< Txop > m_edcaBackingOff
channel access function that invoked backoff during TXOP
virtual void SetTxopHolder(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
Set the TXOP holder, if needed, based on the received frame.
virtual bool SendCfEndIfNeeded(void)
Send a CF-End frame to indicate the completion of the TXOP, provided that the remaining duration is l...
bool m_initialFrame
true if transmitting the initial frame of a TXOP
void CancelPifsRecovery(void)
Cancel the PIFS recovery event and have the EDCAF attempting PIFS recovery release the channel...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool m_pifsRecovery
true if performing a PIFS recovery after failure
an EUI-48 address
Definition: mac48-address.h:43
Mac48Address m_txopHolder
MAC address of the TXOP holder.
Ptr< QosTxop > m_edca
the EDCAF that gained channel access
virtual Time GetFrameDurationId(const WifiMacHeader &header, uint32_t size, const WifiTxParameters &txParams, Ptr< Packet > fragmentedPacket) const override
Compute how to set the Duration/ID field of a frame being transmitted with the given TX parameters...
FrameExchangeManager is a base class handling the basic frame exchange sequences for non-QoS stations...
An identifier for simulation events.
Definition: event-id.h:53
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism...
virtual 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)
virtual void TransmissionFailed(void) override
Take necessary actions upon a transmission failure.
bool TryAddMpdu(Ptr< const WifiMacQueueItem > mpdu, WifiTxParameters &txParams, Time availableTime) const
Recompute the protection and acknowledgment methods to use if the given MPDU is added to the frame be...
virtual bool StartFrameExchange(Ptr< QosTxop > edca, Time availableTime, bool initialFrame)
Start a frame exchange (including protection frames and acknowledgment frames as needed) that fits wi...
a unique identifier for an interface.
Definition: type-id.h:58
virtual Time GetCtsToSelfDurationId(const WifiTxVector &ctsTxVector, Time txDuration, Time response) const override
Compute how to set the Duration/ID field of a CTS-to-self frame to send to protect a frame transmitte...
virtual bool IsWithinLimitsIfAddMpdu(Ptr< const WifiMacQueueItem > mpdu, const WifiTxParameters &txParams, Time ppduDurationLimit) const
Check whether the given MPDU can be added to the frame being built (as described by the given TX para...
Implements the IEEE 802.11 MAC header.