A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-psdu.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 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_PSDU_H
21#define WIFI_PSDU_H
22
23#include "wifi-mac-header.h"
24#include "wifi-mpdu.h"
25
26#include "ns3/nstime.h"
27
28#include <set>
29#include <vector>
30
31namespace ns3
32{
33
34class Packet;
35
42class WifiPsdu : public SimpleRefCount<WifiPsdu>
43{
44 public:
54
62 WifiPsdu(Ptr<WifiMpdu> mpdu, bool isSingle);
63
71 WifiPsdu(Ptr<const WifiMpdu> mpdu, bool isSingle);
72
78 WifiPsdu(std::vector<Ptr<WifiMpdu>> mpduList);
79
80 virtual ~WifiPsdu();
81
86 bool IsSingle() const;
87
92 bool IsAggregate() const;
93
99
105 const WifiMacHeader& GetHeader(std::size_t i) const;
106
112 WifiMacHeader& GetHeader(std::size_t i);
113
119 Ptr<const Packet> GetPayload(std::size_t i) const;
120
126 Ptr<Packet> GetAmpduSubframe(std::size_t i) const;
127
133 std::size_t GetAmpduSubframeSize(std::size_t i) const;
134
139 Mac48Address GetAddr1() const;
140
145 Mac48Address GetAddr2() const;
146
150 bool HasNav() const;
151
156 Time GetDuration() const;
157
162 void SetDuration(Time duration);
163
171 std::set<uint8_t> GetTids() const;
172
183
191 void SetAckPolicyForTid(uint8_t tid, WifiMacHeader::QosAckPolicy policy);
192
203 uint16_t GetMaxDistFromStartingSeq(uint16_t startingSeq) const;
204
210 uint32_t GetSize() const;
211
217 std::size_t GetNMpdus() const;
218
224 std::vector<Ptr<WifiMpdu>>::const_iterator begin() const;
225
231 std::vector<Ptr<WifiMpdu>>::iterator begin();
232
238 std::vector<Ptr<WifiMpdu>>::const_iterator end() const;
239
245 std::vector<Ptr<WifiMpdu>>::iterator end();
246
251 void Print(std::ostream& os) const;
252
253 private:
255 std::vector<Ptr<WifiMpdu>> m_mpduList;
257};
258
266std::ostream& operator<<(std::ostream& os, const WifiPsdu& psdu);
267
268} // namespace ns3
269
270#endif /* WIFI_PSDU_H */
an EUI-48 address
Definition: mac48-address.h:46
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
A template-based reference counting class.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Implements the IEEE 802.11 MAC header.
QosAckPolicy
Ack policy for QoS frames.
WifiPsdu stores an MPDU, S-MPDU or A-MPDU, by keeping header(s) and payload(s) separate for each cons...
Definition: wifi-psdu.h:43
std::set< uint8_t > GetTids() const
Get the set of TIDs of the QoS Data frames included in the PSDU.
Definition: wifi-psdu.cc:178
void SetAckPolicyForTid(uint8_t tid, WifiMacHeader::QosAckPolicy policy)
Set the QoS Ack Policy of the QoS Data frames included in the PSDU that have the given TID to the giv...
Definition: wifi-psdu.cc:226
const WifiMacHeader & GetHeader(std::size_t i) const
Get the header of the i-th MPDU.
Definition: wifi-psdu.cc:279
void Print(std::ostream &os) const
Print the PSDU contents.
Definition: wifi-psdu.cc:357
Time GetDuration() const
Get the duration from the Duration/ID field, which is common to all the MPDUs.
Definition: wifi-psdu.cc:153
Ptr< const Packet > GetPacket() const
Get the PSDU as a single packet.
Definition: wifi-psdu.cc:89
Ptr< Packet > GetAmpduSubframe(std::size_t i) const
Get a copy of the i-th A-MPDU subframe (includes subframe header, MPDU, and possibly padding)
Definition: wifi-psdu.cc:297
std::vector< Ptr< WifiMpdu > >::const_iterator end() const
Return a const iterator to past-the-last MPDU.
Definition: wifi-psdu.cc:345
std::vector< Ptr< WifiMpdu > >::const_iterator begin() const
Return a const iterator to the first MPDU.
Definition: wifi-psdu.cc:333
Mac48Address GetAddr2() const
Get the Transmitter Address (TA), which is common to all the MPDUs.
Definition: wifi-psdu.cc:128
bool HasNav() const
Definition: wifi-psdu.cc:143
uint32_t m_size
the size of the PSDU in bytes
Definition: wifi-psdu.h:256
virtual ~WifiPsdu()
Definition: wifi-psdu.cc:72
uint32_t GetSize() const
Return the size of the PSDU in bytes.
Definition: wifi-psdu.cc:273
Ptr< const Packet > GetPayload(std::size_t i) const
Get the payload of the i-th MPDU.
Definition: wifi-psdu.cc:291
std::size_t GetAmpduSubframeSize(std::size_t i) const
Return the size of the i-th A-MPDU subframe.
Definition: wifi-psdu.cc:314
bool m_isSingle
true for an S-MPDU
Definition: wifi-psdu.h:254
WifiPsdu(Ptr< const WifiMpdu > mpdu, bool isSingle)
Create a PSDU storing an MPDU or S-MPDU.
Mac48Address GetAddr1() const
Get the Receiver Address (RA), which is common to all the MPDUs.
Definition: wifi-psdu.cc:113
bool IsAggregate() const
Return true if the PSDU is an S-MPDU or A-MPDU.
Definition: wifi-psdu.cc:83
bool IsSingle() const
Return true if the PSDU is an S-MPDU.
Definition: wifi-psdu.cc:77
void SetDuration(Time duration)
Set the Duration/ID field on all the MPDUs.
Definition: wifi-psdu.cc:168
std::vector< Ptr< WifiMpdu > > m_mpduList
list of constituent MPDUs
Definition: wifi-psdu.h:255
uint16_t GetMaxDistFromStartingSeq(uint16_t startingSeq) const
Get the maximum distance between the sequence number of any QoS Data frame included in this PSDU that...
Definition: wifi-psdu.cc:239
std::size_t GetNMpdus() const
Return the number of MPDUs constituting the PSDU.
Definition: wifi-psdu.cc:327
WifiMacHeader::QosAckPolicy GetAckPolicyForTid(uint8_t tid) const
Get the QoS Ack Policy of the QoS Data frames included in the PSDU that have the given TID.
Definition: wifi-psdu.cc:192
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