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 <vector>
27 #include <set>
28 
29 namespace ns3 {
30 
31 class WifiMacQueueItem;
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 
102  const WifiMacHeader & GetHeader (std::size_t i) const;
103 
108  WifiMacHeader & GetHeader (std::size_t i);
109 
114  Ptr<const Packet> GetPayload (std::size_t i) const;
115 
120  Time GetTimeStamp (std::size_t i) const;
121 
126  Mac48Address GetAddr1 (void) const;
127 
132  Mac48Address GetAddr2 (void) const;
133 
138  Time GetDuration (void) const;
139 
144  void SetDuration (Time duration);
145 
153  std::set<uint8_t> GetTids (void) const;
154 
165 
173  void SetAckPolicyForTid (uint8_t tid, WifiMacHeader::QosAckPolicy policy);
174 
180  uint32_t GetSize (void) const;
181 
187  std::size_t GetNMpdus (void) const;
188 
194  std::vector<Ptr<WifiMacQueueItem>>::const_iterator begin (void) const;
195 
201  std::vector<Ptr<WifiMacQueueItem>>::iterator begin (void);
202 
208  std::vector<Ptr<WifiMacQueueItem>>::const_iterator end (void) const;
209 
215  std::vector<Ptr<WifiMacQueueItem>>::iterator end (void);
216 
217 private:
218  bool m_isSingle;
219  std::vector<Ptr<WifiMacQueueItem>> m_mpduList;
220  uint32_t m_size;
221 };
222 
223 
224 } //namespace ns3
225 
226 #endif /* WIFI_PSDU_H */
bool IsSingle(void) const
Return true if the PSDU is an S-MPDU.
Definition: wifi-psdu.cc:75
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
WifiPsdu(Ptr< const Packet > p, const WifiMacHeader &header)
Create a PSDU storing an MPDU.
Definition: wifi-psdu.cc:33
void SetDuration(Time duration)
Set the Duration/ID field on all the MPDUs.
Definition: wifi-psdu.cc:166
Time GetTimeStamp(std::size_t i) const
Get the timestamp of the i-th MPDU.
Definition: wifi-psdu.cc:269
std::vector< Ptr< WifiMacQueueItem > >::const_iterator end(void) const
Return a const iterator to past-the-last MPDU.
Definition: wifi-psdu.cc:297
bool m_isSingle
true for an S-MPDU
Definition: wifi-psdu.h:218
uint32_t GetSize(void) const
Return the size of the PSDU.
Definition: wifi-psdu.cc:241
Ptr< const Packet > GetPacket(void) const
Get the PSDU as a single packet.
Definition: wifi-psdu.cc:89
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:227
Time GetDuration(void) const
Get the duration from the Duration/ID field, which is common to all the MPDUs.
Definition: wifi-psdu.cc:149
Mac48Address GetAddr2(void) const
Get the Transmitter Address (TA), which is common to all the MPDUs.
Definition: wifi-psdu.cc:132
const WifiMacHeader & GetHeader(std::size_t i) const
Get the header of the i-th MPDU.
Definition: wifi-psdu.cc:248
WifiPsdu stores an MPDU, S-MPDU or A-MPDU, by keeping header(s) and payload(s) separate for each cons...
Definition: wifi-psdu.h:40
std::size_t GetNMpdus(void) const
Return the number of MPDUs constituting the PSDU.
Definition: wifi-psdu.cc:276
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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:177
an EUI-48 address
Definition: mac48-address.h:43
QosAckPolicy
ACK policy for QoS frames.
uint32_t m_size
the size of the PSDU
Definition: wifi-psdu.h:220
std::vector< Ptr< WifiMacQueueItem > >::const_iterator begin(void) const
Return a const iterator to the first MPDU.
Definition: wifi-psdu.cc:283
virtual ~WifiPsdu()
Definition: wifi-psdu.cc:70
Mac48Address GetAddr1(void) const
Get the Receiver Address (RA), which is common to all the MPDUs.
Definition: wifi-psdu.cc:115
std::vector< Ptr< WifiMacQueueItem > > m_mpduList
list of constituent MPDUs
Definition: wifi-psdu.h:219
Ptr< const Packet > GetPayload(std::size_t i) const
Get the payload of the i-th MPDU.
Definition: wifi-psdu.cc:262
A template-based reference counting class.
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:193
Implements the IEEE 802.11 MAC header.
bool IsAggregate(void) const
Return true if the PSDU is an S-MPDU or A-MPDU.
Definition: wifi-psdu.cc:82