A Discrete-Event Network Simulator
API
wifi-tx-parameters.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Universita' degli Studi di Napoli Federico II
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: Stefano Avallone <stavallo@unina.it>
18  */
19 
20 #ifndef WIFI_TX_PARAMETERS_H
21 #define WIFI_TX_PARAMETERS_H
22 
23 #include "wifi-mac-header.h"
24 #include "wifi-tx-vector.h"
25 
26 #include "ns3/nstime.h"
27 
28 #include <map>
29 #include <memory>
30 #include <set>
31 
32 namespace ns3
33 {
34 
35 class WifiMpdu;
36 struct WifiProtection;
37 struct WifiAcknowledgment;
38 
47 {
48  public:
55  WifiTxParameters(const WifiTxParameters& txParams);
56 
63 
65  std::unique_ptr<WifiProtection> m_protection;
66  std::unique_ptr<WifiAcknowledgment> m_acknowledgment;
68 
72  void Clear();
73 
80  void AddMpdu(Ptr<const WifiMpdu> mpdu);
81 
89 
96  uint32_t GetSizeIfAddMpdu(Ptr<const WifiMpdu> mpdu) const;
97 
105  std::pair<uint32_t, uint32_t> GetSizeIfAggregateMsdu(Ptr<const WifiMpdu> msdu) const;
106 
113  uint32_t GetSize(Mac48Address receiver) const;
114 
116  struct PsduInfo
117  {
119  uint32_t amsduSize;
121  uint32_t ampduSize;
123  std::map<uint8_t, std::set<uint16_t>> seqNumbers;
125  };
126 
134  const PsduInfo* GetPsduInfo(Mac48Address receiver) const;
135 
137  typedef std::map<Mac48Address, PsduInfo> PsduInfoMap;
138 
144  const PsduInfoMap& GetPsduInfoMap() const;
145 
150  void Print(std::ostream& os) const;
151 
152  private:
155 };
156 
164 std::ostream& operator<<(std::ostream& os, const WifiTxParameters* txParams);
165 
166 } // namespace ns3
167 
168 #endif /* WIFI_TX_PARAMETERS_H */
an EUI-48 address
Definition: mac48-address.h:46
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
static Time Min()
Minimum representable Time Not to be confused with Min(Time,Time).
Definition: nstime.h:287
Implements the IEEE 802.11 MAC header.
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism,...
uint32_t GetSizeIfAddMpdu(Ptr< const WifiMpdu > mpdu) const
Get the size in bytes of the frame in case the given MPDU is added.
const PsduInfoMap & GetPsduInfoMap() const
Get a const reference to the map containing information about PSDUs.
std::pair< uint32_t, uint32_t > GetSizeIfAggregateMsdu(Ptr< const WifiMpdu > msdu) const
Get the size in bytes of the frame in case the given MSDU is aggregated.
std::unique_ptr< WifiProtection > m_protection
protection method
WifiTxParameters & operator=(const WifiTxParameters &txParams)
Copy assignment operator.
uint32_t GetSize(Mac48Address receiver) const
Get the size in bytes of the (A-)MPDU addressed to the given receiver.
std::unique_ptr< WifiAcknowledgment > m_acknowledgment
acknowledgment method
const PsduInfo * GetPsduInfo(Mac48Address receiver) const
Get a pointer to the information about the PSDU addressed to the given receiver, if present,...
Time m_txDuration
TX duration of the frame.
WifiTxVector m_txVector
TXVECTOR of the frame being prepared.
PsduInfoMap m_info
information about the frame being prepared.
void AggregateMsdu(Ptr< const WifiMpdu > msdu)
Record that an MSDU is being aggregated to the last MPDU added to the frame that hase the same receiv...
void Print(std::ostream &os) const
Print the object contents.
void AddMpdu(Ptr< const WifiMpdu > mpdu)
Record that an MPDU is being added to the current frame.
void Clear()
Reset the TX parameters.
std::map< Mac48Address, PsduInfo > PsduInfoMap
Map containing information about the PSDUs addressed to every receiver.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:159
information about the frame being prepared for a specific receiver
std::map< uint8_t, std::set< uint16_t > > seqNumbers
set of the sequence numbers of the MPDUs added for each TID
uint32_t ampduSize
the size in bytes of the A-MPDU if multiple MPDUs have been added, and zero otherwise
WifiMacHeader header
MAC header of the last MPDU added.
uint32_t amsduSize
the size in bytes of the MSDU or A-MSDU included in the last MPDU added