A Discrete-Event Network Simulator
API
wifi-mpdu.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005, 2009 INRIA
3 * Copyright (c) 2009 MIRKO BANCHI
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 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19 * Mirko Banchi <mk.banchi@gmail.com>
20 * Stefano Avallone <stavallo@unina.it>
21 */
22
23#ifndef WIFI_MPDU_H
24#define WIFI_MPDU_H
25
27#include "wifi-mac-header.h"
28#include "wifi-mac-queue-elem.h"
29
30#include "ns3/packet.h"
31
32#include <list>
33#include <optional>
34
35namespace ns3
36{
37
45{
46 friend class WifiMacQueue;
47 WmqIteratorTag() = default;
48};
49
56class WifiMpdu : public SimpleRefCount<WifiMpdu>
57{
58 public:
65
66 virtual ~WifiMpdu();
67
73
78 const WifiMacHeader& GetHeader() const;
79
85
91
98 uint32_t GetSize() const;
99
107 uint32_t GetPacketSize() const;
108
113 bool IsFragment() const;
114
122
124 typedef std::list<std::pair<Ptr<const Packet>, AmsduSubframeHeader>> DeaggregatedMsdus;
126 typedef std::list<std::pair<Ptr<const Packet>, AmsduSubframeHeader>>::const_iterator
128
140 DeaggregatedMsdusCI end() const;
141
143 typedef std::list<WifiMacQueueElem>::iterator Iterator;
144
151 void SetQueueIt(std::optional<Iterator> queueIt, WmqIteratorTag tag);
157
163 bool IsQueued() const;
170 AcIndex GetQueueAc() const;
174 Time GetExpiryTime() const;
175
183
187 void SetInFlight();
191 void ResetInFlight();
197 bool IsInFlight() const;
198
203 virtual void Print(std::ostream& os) const;
204
205 private:
213
217 std::optional<Iterator> m_queueIt;
219};
220
228std::ostream& operator<<(std::ostream& os, const WifiMpdu& item);
229
230} // namespace ns3
231
232#endif /* WIFI_MPDU_H */
Headers for A-MSDU subframes.
an EUI-48 address
Definition: mac48-address.h:46
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.
This queue implements the timeout procedure described in (Section 9.19.2.6 "Retransmit procedures" pa...
WifiMpdu stores (const) packets along with their Wifi MAC headers and the time when they were enqueue...
Definition: wifi-mpdu.h:57
Time GetExpiryTime() const
Definition: wifi-mpdu.cc:213
bool IsInFlight() const
Return true if this MPDU is in flight, false otherwise.
Definition: wifi-mpdu.cc:232
DeaggregatedMsdus m_msduList
The list of aggregated MSDUs included in this MPDU.
Definition: wifi-mpdu.h:216
Ptr< const Packet > m_packet
The packet (MSDU or A-MSDU) contained in this queue item.
Definition: wifi-mpdu.h:214
WifiMacHeader m_header
Wifi MAC header associated with the packet.
Definition: wifi-mpdu.h:215
std::list< std::pair< Ptr< constPacket >, AmsduSubframeHeader > >::const_iterator DeaggregatedMsdusCI
DeaggregatedMsdusCI typedef.
Definition: wifi-mpdu.h:127
const WifiMacHeader & GetHeader() const
Get the header stored in this item.
Definition: wifi-mpdu.cc:60
void Aggregate(Ptr< const WifiMpdu > msdu)
Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU).
Definition: wifi-mpdu.cc:105
void ResetInFlight()
Mark this MPDU as not being in flight (only used if Block Ack agreement established).
Definition: wifi-mpdu.cc:226
virtual ~WifiMpdu()
Definition: wifi-mpdu.cc:49
uint32_t GetSize() const
Return the size of the packet stored by this item, including header size and trailer size.
Definition: wifi-mpdu.cc:84
Ptr< Packet > GetProtocolDataUnit() const
Get the MAC protocol data unit (MPDU) corresponding to this item (i.e.
Definition: wifi-mpdu.cc:96
void DoAggregate(Ptr< const WifiMpdu > msdu)
Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU).
Definition: wifi-mpdu.cc:139
std::list< std::pair< Ptr< const Packet >, AmsduSubframeHeader > > DeaggregatedMsdus
DeaggregatedMsdus typedef.
Definition: wifi-mpdu.h:124
bool m_inFlight
whether the MPDU is in flight
Definition: wifi-mpdu.h:218
virtual void Print(std::ostream &os) const
Print the item contents.
Definition: wifi-mpdu.cc:250
Iterator GetQueueIt(WmqIteratorTag tag) const
Definition: wifi-mpdu.cc:199
void SetInFlight()
Mark this MPDU as being in flight (only used if Block Ack agreement established).
Definition: wifi-mpdu.cc:220
Ptr< const Packet > GetPacket() const
Get the packet stored in this item.
Definition: wifi-mpdu.cc:54
DeaggregatedMsdusCI end() const
Get a constant iterator indicating past-the-last MSDU in the list of aggregated MSDUs.
Definition: wifi-mpdu.cc:244
DeaggregatedMsdusCI begin() const
Get a constant iterator pointing to the first MSDU in the list of aggregated MSDUs.
Definition: wifi-mpdu.cc:238
uint32_t GetPacketSize() const
Return the size in bytes of the packet or control header or management header stored by this item.
Definition: wifi-mpdu.cc:78
AcIndex GetQueueAc() const
Get the AC of the queue this item is stored into.
Definition: wifi-mpdu.cc:206
std::list< WifiMacQueueElem >::iterator Iterator
Const iterator typedef.
Definition: wifi-mpdu.h:143
Mac48Address GetDestinationAddress() const
Return the destination address present in the header.
Definition: wifi-mpdu.cc:72
bool IsQueued() const
Return true if this item is stored in some queue, false otherwise.
Definition: wifi-mpdu.cc:187
void SetQueueIt(std::optional< Iterator > queueIt, WmqIteratorTag tag)
Set the queue iterator stored by this object.
Definition: wifi-mpdu.cc:193
bool IsFragment() const
Return true if this item contains an MSDU fragment, false otherwise.
Definition: wifi-mpdu.cc:90
WifiMpdu(Ptr< const Packet > p, const WifiMacHeader &header)
Create a Wifi MAC queue item containing a packet and a Wifi MAC header.
Definition: wifi-mpdu.cc:38
std::optional< Iterator > m_queueIt
Queue iterator pointing to this MPDU, if queued.
Definition: wifi-mpdu.h:217
Tag used to allow (only) WifiMacQueue to access the queue iterator stored by a WifiMpdu.
Definition: wifi-mpdu.h:45
WmqIteratorTag()=default
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:74
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:129