A Discrete-Event Network Simulator
API
wifi-ppdu.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2019 Orange Labs
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: Rediet <getachew.redieteab@orange.com>
19  */
20 
21 #ifndef WIFI_PPDU_H
22 #define WIFI_PPDU_H
23 
24 #include "wifi-tx-vector.h"
25 #include "ns3/nstime.h"
26 #include <list>
27 #include <unordered_map>
28 
36 namespace ns3 {
37 
38 class WifiPsdu;
39 
43 typedef std::unordered_map <uint16_t /* STA-ID */, Ptr<const WifiPsdu> /* PSDU */> WifiConstPsduMap;
44 
51 class WifiPpdu : public SimpleRefCount<WifiPpdu>
52 {
53 public:
61  WifiPpdu (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector, uint64_t uid = UINT64_MAX);
69  WifiPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, uint64_t uid);
73  virtual ~WifiPpdu ();
74 
80  WifiTxVector GetTxVector (void) const;
81 
87  Ptr<const WifiPsdu> GetPsdu (void) const;
88 
92  bool IsTruncatedTx (void) const;
93 
97  void SetTruncatedTx (void);
98 
104  virtual Time GetTxDuration (void) const;
105 
113  virtual uint16_t GetTransmissionChannelWidth (void) const;
114 
127  virtual bool CanBeReceived (uint16_t txCenterFreq, uint16_t p20MinFreq,
128  uint16_t p20MaxFreq) const;
129 
134  WifiModulationClass GetModulation (void) const;
135 
140  uint64_t GetUid (void) const;
141 
146  WifiPreamble GetPreamble (void) const;
147 
152  void Print (std::ostream &os) const;
157  virtual Ptr<WifiPpdu> Copy (void) const;
158 
163  virtual WifiPpduType GetType (void) const;
164 
170  virtual uint16_t GetStaId (void) const;
171 
172 protected:
177  virtual std::string PrintPayload (void) const;
178 
182  uint64_t m_uid;
183 
184 private:
190  virtual WifiTxVector DoGetTxVector (void) const;
191 
193  uint8_t m_txPowerLevel;
194  uint8_t m_txAntennas;
195 }; //class WifiPpdu
196 
204 std::ostream& operator<< (std::ostream& os, const Ptr<const WifiPpdu> &ppdu);
205 
213 std::ostream & operator << (std::ostream &os, const WifiConstPsduMap &psdus);
214 
215 } //namespace ns3
216 
217 #endif /* WIFI_PPDU_H */
ns3::WifiPpdu::SetTruncatedTx
void SetTruncatedTx(void)
Indicate that the PPDU's transmission was aborted due to transmitter switch off.
Definition: wifi-ppdu.cc:91
ns3::WifiPpdu::GetTxDuration
virtual Time GetTxDuration(void) const
Get the total transmission duration of the PPDU.
Definition: wifi-ppdu.cc:153
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WifiPpdu::GetTxVector
WifiTxVector GetTxVector(void) const
Get the TXVECTOR used to send the PPDU.
Definition: wifi-ppdu.cc:63
ns3::WifiPpdu::CanBeReceived
virtual bool CanBeReceived(uint16_t txCenterFreq, uint16_t p20MinFreq, uint16_t p20MaxFreq) const
Check whether the given PPDU can be received on the specified primary channel.
Definition: wifi-ppdu.cc:110
ns3::WifiPpdu::m_modulation
WifiModulationClass m_modulation
the modulation used for the transmission of this PPDU
Definition: wifi-ppdu.h:180
ns3::WifiPpdu::GetUid
uint64_t GetUid(void) const
Get the UID of the PPDU.
Definition: wifi-ppdu.cc:129
ns3::SimpleRefCount
A template-based reference counting class.
Definition: simple-ref-count.h:74
ns3::WifiPpdu
WifiPpdu stores a preamble, a modulation class, PHY headers and a PSDU.
Definition: wifi-ppdu.h:52
ns3::WifiPpdu::DoGetTxVector
virtual WifiTxVector DoGetTxVector(void) const
Get the TXVECTOR used to send the PPDU.
Definition: wifi-ppdu.cc:72
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::WifiPpdu::IsTruncatedTx
bool IsTruncatedTx(void) const
Definition: wifi-ppdu.cc:85
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::WifiPpdu::GetModulation
WifiModulationClass GetModulation(void) const
Get the modulation used for the PPDU.
Definition: wifi-ppdu.cc:98
ns3::Ptr< const WifiPsdu >
ns3::WifiPpdu::m_txPowerLevel
uint8_t m_txPowerLevel
the transmission power level (used only for TX and initializing the returned WifiTxVector)
Definition: wifi-ppdu.h:193
wifi-tx-vector.h
ns3::WifiPpdu::WifiPpdu
WifiPpdu(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector, uint64_t uid=UINT64_MAX)
Create a PPDU storing a PSDU.
Definition: wifi-ppdu.cc:30
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::WifiPpdu::Copy
virtual Ptr< WifiPpdu > Copy(void) const
Copy this instance.
Definition: wifi-ppdu.cc:179
ns3::WifiPpdu::Print
void Print(std::ostream &os) const
Print the PPDU contents.
Definition: wifi-ppdu.cc:160
ns3::WifiPreamble
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Definition: wifi-phy-common.h:68
ns3::WifiPpdu::~WifiPpdu
virtual ~WifiPpdu()
Destructor for WifiPpdu.
Definition: wifi-ppdu.cc:53
ns3::WifiPpduType
WifiPpduType
The type of PPDU (SU, DL MU, or UL MU)
Definition: wifi-phy-common.h:229
ns3::WifiPpdu::m_txAntennas
uint8_t m_txAntennas
the number of antennas used to transmit this PPDU
Definition: wifi-ppdu.h:194
ns3::WifiPpdu::m_truncatedTx
bool m_truncatedTx
flag indicating whether the frame's transmission was aborted due to transmitter switch off
Definition: wifi-ppdu.h:192
ns3::WifiPpdu::PrintPayload
virtual std::string PrintPayload(void) const
Print the payload of the PPDU.
Definition: wifi-ppdu.cc:171
ns3::WifiPpdu::GetPreamble
WifiPreamble GetPreamble(void) const
Get the preamble of the PPDU.
Definition: wifi-ppdu.cc:135
ns3::WifiPpdu::m_uid
uint64_t m_uid
the unique ID of this PPDU
Definition: wifi-ppdu.h:182
ns3::WifiPpdu::GetTransmissionChannelWidth
virtual uint16_t GetTransmissionChannelWidth(void) const
Get the channel width over which the PPDU will effectively be transmitted.
Definition: wifi-ppdu.cc:104
ns3::WifiPpdu::GetStaId
virtual uint16_t GetStaId(void) const
Get the ID of the STA that transmitted the PPDU for UL MU, SU_STA_ID otherwise.
Definition: wifi-ppdu.cc:147
ns3::WifiPpdu::GetType
virtual WifiPpduType GetType(void) const
Return the PPDU type (.
Definition: wifi-ppdu.cc:141
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:137
ns3::WifiPpdu::GetPsdu
Ptr< const WifiPsdu > GetPsdu(void) const
Get the payload of the PPDU.
Definition: wifi-ppdu.cc:79
ns3::WifiPpdu::m_preamble
WifiPreamble m_preamble
the PHY preamble
Definition: wifi-ppdu.h:179
ns3::WifiPpdu::m_psdus
WifiConstPsduMap m_psdus
the PSDUs contained in this PPDU
Definition: wifi-ppdu.h:181
ns3::WifiModulationClass
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
Definition: wifi-phy-common.h:122