A Discrete-Event Network Simulator
API
wifi-psdu.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2019 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 WIFI_PSDU_H
22 #define WIFI_PSDU_H
23 
24 #include "ns3/nstime.h"
25 #include "wifi-mac-header.h"
26 #include "wifi-mac-queue-item.h"
27 #include <vector>
28 #include <set>
29 
30 namespace ns3 {
31 
32 class Packet;
33 
40 class WifiPsdu : public SimpleRefCount<WifiPsdu>
41 {
42 public:
51  WifiPsdu (Ptr<const Packet> p, const WifiMacHeader & header);
52 
60  WifiPsdu (Ptr<WifiMacQueueItem> mpdu, bool isSingle);
61 
69  WifiPsdu (Ptr<const WifiMacQueueItem> mpdu, bool isSingle);
70 
76  WifiPsdu (std::vector<Ptr<WifiMacQueueItem>> mpduList);
77 
78  virtual ~WifiPsdu ();
79 
84  bool IsSingle (void) const;
85 
90  bool IsAggregate (void) const;
91 
96  Ptr<const Packet> GetPacket (void) const;
97 
103  const WifiMacHeader & GetHeader (std::size_t i) const;
104 
110  WifiMacHeader & GetHeader (std::size_t i);
111 
117  Ptr<const Packet> GetPayload (std::size_t i) const;
118 
124  Time GetTimeStamp (std::size_t i) const;
125 
131  Ptr<Packet> GetAmpduSubframe (std::size_t i) const;
132 
138  std::size_t GetAmpduSubframeSize (std::size_t i) const;
139 
144  Mac48Address GetAddr1 (void) const;
145 
150  Mac48Address GetAddr2 (void) const;
151 
156  Time GetDuration (void) const;
157 
162  void SetDuration (Time duration);
163 
171  std::set<uint8_t> GetTids (void) 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 (void) const;
211 
217  std::size_t GetNMpdus (void) const;
218 
224  std::vector<Ptr<WifiMacQueueItem>>::const_iterator begin (void) const;
225 
231  std::vector<Ptr<WifiMacQueueItem>>::iterator begin (void);
232 
238  std::vector<Ptr<WifiMacQueueItem>>::const_iterator end (void) const;
239 
245  std::vector<Ptr<WifiMacQueueItem>>::iterator end (void);
246 
251  void Print (std::ostream &os) const;
252 
253 private:
254  bool m_isSingle;
255  std::vector<Ptr<WifiMacQueueItem>> m_mpduList;
256  uint32_t m_size;
257 };
258 
266 std::ostream& operator<< (std::ostream& os, const WifiPsdu &psdu);
267 
268 
269 } //namespace ns3
270 
271 #endif /* WIFI_PSDU_H */
an EUI-48 address
Definition: mac48-address.h:44
A template-based reference counting class.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
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:41
Time GetDuration(void) const
Get the duration from the Duration/ID field, which is common to all the MPDUs.
Definition: wifi-psdu.cc:141
uint32_t GetSize(void) const
Return the size of the PSDU in bytes.
Definition: wifi-psdu.cc:260
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:214
std::vector< Ptr< WifiMacQueueItem > >::const_iterator begin(void) const
Return a const iterator to the first MPDU.
Definition: wifi-psdu.cc:325
const WifiMacHeader & GetHeader(std::size_t i) const
Get the header of the i-th MPDU.
Definition: wifi-psdu.cc:266
std::size_t GetNMpdus(void) const
Return the number of MPDUs constituting the PSDU.
Definition: wifi-psdu.cc:319
std::vector< Ptr< WifiMacQueueItem > > m_mpduList
list of constituent MPDUs
Definition: wifi-psdu.h:255
void Print(std::ostream &os) const
Print the PSDU contents.
Definition: wifi-psdu.cc:349
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:290
WifiPsdu(Ptr< const Packet > p, const WifiMacHeader &header)
Create a PSDU storing an MPDU.
Definition: wifi-psdu.cc:33
std::vector< Ptr< WifiMacQueueItem > >::const_iterator end(void) const
Return a const iterator to past-the-last MPDU.
Definition: wifi-psdu.cc:337
uint32_t m_size
the size of the PSDU in bytes
Definition: wifi-psdu.h:256
virtual ~WifiPsdu()
Definition: wifi-psdu.cc:70
Ptr< const Packet > GetPayload(std::size_t i) const
Get the payload of the i-th MPDU.
Definition: wifi-psdu.cc:278
std::size_t GetAmpduSubframeSize(std::size_t i) const
Return the size of the i-th A-MPDU subframe.
Definition: wifi-psdu.cc:306
bool IsAggregate(void) const
Return true if the PSDU is an S-MPDU or A-MPDU.
Definition: wifi-psdu.cc:81
bool m_isSingle
true for an S-MPDU
Definition: wifi-psdu.h:254
Mac48Address GetAddr2(void) const
Get the Transmitter Address (TA), which is common to all the MPDUs.
Definition: wifi-psdu.cc:126
void SetDuration(Time duration)
Set the Duration/ID field on all the MPDUs.
Definition: wifi-psdu.cc:156
bool IsSingle(void) const
Return true if the PSDU is an S-MPDU.
Definition: wifi-psdu.cc:75
Mac48Address GetAddr1(void) const
Get the Receiver Address (RA), which is common to all the MPDUs.
Definition: wifi-psdu.cc:111
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:227
Time GetTimeStamp(std::size_t i) const
Get the timestamp of the i-th MPDU.
Definition: wifi-psdu.cc:284
std::set< uint8_t > GetTids(void) const
Get the set of TIDs of the QoS Data frames included in the PSDU.
Definition: wifi-psdu.cc:166
WifiPsdu(Ptr< const WifiMacQueueItem > mpdu, bool isSingle)
Create a PSDU storing an MPDU or S-MPDU.
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:180
Ptr< const Packet > GetPacket(void) const
Get the PSDU as a single packet.
Definition: wifi-psdu.cc:87
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:139