A Discrete-Event Network Simulator
API
wifi-ppdu.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 Orange Labs
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: Rediet <getachew.redieteab@orange.com>
18  */
19 
20 #ifndef WIFI_PPDU_H
21 #define WIFI_PPDU_H
22 
23 #include "wifi-tx-vector.h"
24 
25 #include "ns3/nstime.h"
26 
27 #include <list>
28 #include <optional>
29 #include <unordered_map>
30 
38 namespace ns3
39 {
40 
41 class Packet;
42 class WifiPsdu;
43 
47 typedef std::unordered_map<uint16_t /* STA-ID */, Ptr<const WifiPsdu> /* PSDU */> WifiConstPsduMap;
48 
55 class WifiPpdu : public SimpleRefCount<WifiPpdu>
56 {
57  public:
67  const WifiTxVector& txVector,
68  uint16_t txCenterFreq,
69  uint64_t uid = UINT64_MAX);
78  WifiPpdu(const WifiConstPsduMap& psdus,
79  const WifiTxVector& txVector,
80  uint16_t txCenterFreq,
81  uint64_t uid);
85  virtual ~WifiPpdu();
86 
92  const WifiTxVector& GetTxVector() const;
93 
97  void ResetTxVector() const;
98 
104  void UpdateTxVector(const WifiTxVector& updatedTxVector) const;
105 
112 
116  bool IsTruncatedTx() const;
117 
121  void SetTruncatedTx();
122 
128  virtual Time GetTxDuration() const;
129 
136  virtual uint16_t GetTransmissionChannelWidth() const;
137 
141  uint16_t GetTxCenterFreq() const;
142 
150  bool DoesOverlapChannel(uint16_t minFreq, uint16_t maxFreq) const;
151 
157 
162  uint64_t GetUid() const;
163 
168  WifiPreamble GetPreamble() const;
169 
174  void Print(std::ostream& os) const;
179  virtual Ptr<WifiPpdu> Copy() const;
180 
185  virtual WifiPpduType GetType() const;
186 
192  virtual uint16_t GetStaId() const;
193 
194  protected:
199  virtual std::string PrintPayload() const;
200 
204  uint16_t m_txCenterFreq;
205  uint64_t m_uid;
206  mutable std::optional<WifiTxVector>
209 
210 #ifdef NS3_BUILD_PROFILE_DEBUG
212 #endif
213 
214  private:
220  virtual WifiTxVector DoGetTxVector() const;
221 
224  uint8_t m_txPowerLevel;
226  uint8_t m_txAntennas;
227 }; // class WifiPpdu
228 
236 std::ostream& operator<<(std::ostream& os, const Ptr<const WifiPpdu>& ppdu);
237 
245 std::ostream& operator<<(std::ostream& os, const WifiConstPsduMap& psdus);
246 
247 } // namespace ns3
248 
249 #endif /* WIFI_PPDU_H */
A template-based reference counting class.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
WifiPpdu stores a preamble, a modulation class, PHY headers and a PSDU.
Definition: wifi-ppdu.h:56
void Print(std::ostream &os) const
Print the PPDU contents.
Definition: wifi-ppdu.cc:229
virtual Time GetTxDuration() const
Get the total transmission duration of the PPDU.
Definition: wifi-ppdu.cc:221
bool IsTruncatedTx() const
Definition: wifi-ppdu.cc:123
WifiPreamble GetPreamble() const
Get the preamble of the PPDU.
Definition: wifi-ppdu.cc:203
uint16_t GetTxCenterFreq() const
Definition: wifi-ppdu.cc:148
void ResetTxVector() const
Reset the TXVECTOR.
Definition: wifi-ppdu.cc:102
virtual uint16_t GetStaId() const
Get the ID of the STA that transmitted the PPDU for UL MU, SU_STA_ID otherwise.
Definition: wifi-ppdu.cc:215
uint16_t m_txCenterFreq
the center frequency (MHz) used for the transmission of this PPDU
Definition: wifi-ppdu.h:204
void UpdateTxVector(const WifiTxVector &updatedTxVector) const
Update the TXVECTOR based on some information known at the receiver.
Definition: wifi-ppdu.cc:109
virtual WifiPpduType GetType() const
Return the PPDU type (.
Definition: wifi-ppdu.cc:209
std::optional< WifiTxVector > m_txVector
the TXVECTOR at TX PHY or the reconstructed TXVECTOR at RX PHY (or std::nullopt if TXVECTOR has not b...
Definition: wifi-ppdu.h:207
WifiModulationClass m_modulation
the modulation used for the transmission of this PPDU
Definition: wifi-ppdu.h:202
WifiPreamble m_preamble
the PHY preamble
Definition: wifi-ppdu.h:201
virtual ~WifiPpdu()
Destructor for WifiPpdu.
Definition: wifi-ppdu.cc:72
Ptr< const WifiPsdu > GetPsdu() const
Get the payload of the PPDU.
Definition: wifi-ppdu.cc:117
virtual WifiTxVector DoGetTxVector() const
Get the TXVECTOR used to send the PPDU.
Definition: wifi-ppdu.cc:94
uint64_t m_uid
the unique ID of this PPDU
Definition: wifi-ppdu.h:205
void SetTruncatedTx()
Indicate that the PPDU's transmission was aborted due to transmitter switch off.
Definition: wifi-ppdu.cc:129
WifiPpdu(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector, uint16_t txCenterFreq, uint64_t uid=UINT64_MAX)
Create a PPDU storing a PSDU.
Definition: wifi-ppdu.cc:32
const WifiTxVector & GetTxVector() const
Get the TXVECTOR used to send the PPDU.
Definition: wifi-ppdu.cc:82
uint64_t GetUid() const
Get the UID of the PPDU.
Definition: wifi-ppdu.cc:197
WifiModulationClass GetModulation() const
Get the modulation used for the PPDU.
Definition: wifi-ppdu.cc:136
virtual uint16_t GetTransmissionChannelWidth() const
Get the channel width over which the PPDU will effectively be transmitted.
Definition: wifi-ppdu.cc:142
WifiConstPsduMap m_psdus
the PSDUs contained in this PPDU
Definition: wifi-ppdu.h:203
virtual std::string PrintPayload() const
Print the payload of the PPDU.
Definition: wifi-ppdu.cc:237
uint8_t m_txAntennas
the number of antennas used to transmit this PPDU
Definition: wifi-ppdu.h:226
bool DoesOverlapChannel(uint16_t minFreq, uint16_t maxFreq) const
Check whether the given PPDU overlaps a given channel.
Definition: wifi-ppdu.cc:154
uint8_t m_txPowerLevel
the transmission power level (used only for TX and initializing the returned WifiTxVector)
Definition: wifi-ppdu.h:224
virtual Ptr< WifiPpdu > Copy() const
Copy this instance.
Definition: wifi-ppdu.cc:245
bool m_truncatedTx
flag indicating whether the frame's transmission was aborted due to transmitter switch off
Definition: wifi-ppdu.h:222
Ptr< Packet > m_phyHeaders
the PHY headers contained in this PPDU
Definition: wifi-ppdu.h:211
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
WifiPpduType
The type of PPDU (SU, DL MU, or UL MU)
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:129