A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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#include <set>
35#include <variant>
36
37namespace ns3
38{
39
47{
48 friend class WifiMacQueue;
49 WmqIteratorTag() = default;
50};
51
60class WifiMpdu : public SimpleRefCount<WifiMpdu>
61{
62 public:
69
70 virtual ~WifiMpdu();
71
75 bool IsOriginal() const;
76
81
87
92 const WifiMacHeader& GetHeader() const;
93
99
105
112 uint32_t GetSize() const;
113
121 uint32_t GetPacketSize() const;
122
127 bool IsFragment() const;
128
136
138 typedef std::list<std::pair<Ptr<const Packet>, AmsduSubframeHeader>> DeaggregatedMsdus;
140 typedef std::list<std::pair<Ptr<const Packet>, AmsduSubframeHeader>>::const_iterator
142
154 DeaggregatedMsdusCI end() const;
155
157 typedef std::list<WifiMacQueueElem>::iterator Iterator;
158
165 void SetQueueIt(std::optional<Iterator> queueIt, WmqIteratorTag tag);
171
177 bool IsQueued() const;
184 AcIndex GetQueueAc() const;
188 Time GetExpiryTime() const;
189
197
203 void SetInFlight(uint8_t linkId) const;
209 void ResetInFlight(uint8_t linkId) const;
213 std::set<uint8_t> GetInFlightLinkIds() const;
217 bool IsInFlight() const;
218
225 void AssignSeqNo(uint16_t seqNo);
229 bool HasSeqNoAssigned() const;
233 void UnassignSeqNo();
234
243 Ptr<WifiMpdu> CreateAlias(uint8_t linkId) const;
244
249 virtual void Print(std::ostream& os) const;
250
251 private:
259
263 Iterator GetQueueIt() const;
264
268 WifiMpdu() = default;
269
274
279 {
282 std::optional<Iterator> m_queueIt;
284 };
285
293 const OriginalInfo& GetOriginalInfo() const;
294
296 using InstanceInfo = std::variant<OriginalInfo, Ptr<WifiMpdu>>;
297
299 static constexpr std::size_t ORIGINAL =
300 0;
301 static constexpr std::size_t ALIAS = 1;
302};
303
311std::ostream& operator<<(std::ostream& os, const WifiMpdu& item);
312
313} // namespace ns3
314
315#endif /* WIFI_MPDU_H */
Headers for A-MSDU subframes.
an EUI-48 address
Definition: mac48-address.h:46
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
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 a (const) packet along with a MAC header.
Definition: wifi-mpdu.h:61
bool IsOriginal() const
Definition: wifi-mpdu.cc:57
InstanceInfo m_instanceInfo
information associated with the instance type
Definition: wifi-mpdu.h:298
bool HasSeqNoAssigned() const
Definition: wifi-mpdu.cc:340
Time GetExpiryTime() const
Definition: wifi-mpdu.cc:287
bool IsInFlight() const
Definition: wifi-mpdu.cc:320
static constexpr std::size_t ALIAS
index of an alias in the InstanceInfo variant
Definition: wifi-mpdu.h:301
void ResetInFlight(uint8_t linkId) const
Mark this MPDU as not being in flight on the given link.
Definition: wifi-mpdu.cc:299
WifiMacHeader m_header
Information stored by both the original copy and the aliases.
Definition: wifi-mpdu.h:273
void SetInFlight(uint8_t linkId) const
Mark this MPDU as being in flight on the given link.
Definition: wifi-mpdu.cc:293
Iterator GetQueueIt() const
Definition: wifi-mpdu.cc:274
std::list< std::pair< Ptr< constPacket >, AmsduSubframeHeader > >::const_iterator DeaggregatedMsdusCI
DeaggregatedMsdusCI typedef.
Definition: wifi-mpdu.h:141
const WifiMacHeader & GetHeader() const
Get the header stored in this item.
Definition: wifi-mpdu.cc:119
std::variant< OriginalInfo, Ptr< WifiMpdu > > InstanceInfo
Information stored by the original copy and an alias, respectively.
Definition: wifi-mpdu.h:296
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:164
OriginalInfo & GetOriginalInfo()
Definition: wifi-mpdu.cc:91
virtual ~WifiMpdu()
Definition: wifi-mpdu.cc:50
uint32_t GetSize() const
Return the size of the packet stored by this item, including header size and trailer size.
Definition: wifi-mpdu.cc:143
Ptr< Packet > GetProtocolDataUnit() const
Get the MAC protocol data unit (MPDU) corresponding to this item (i.e.
Definition: wifi-mpdu.cc:155
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:202
std::list< std::pair< Ptr< const Packet >, AmsduSubframeHeader > > DeaggregatedMsdus
DeaggregatedMsdus typedef.
Definition: wifi-mpdu.h:138
void UnassignSeqNo()
Record that a sequence number is no (longer) assigned to this MPDU.
Definition: wifi-mpdu.cc:346
virtual void Print(std::ostream &os) const
Print the item contents.
Definition: wifi-mpdu.cc:364
WifiMpdu()=default
Private default constructor (used to construct aliases).
Ptr< const Packet > GetPacket() const
Get the packet stored in this item.
Definition: wifi-mpdu.cc:113
DeaggregatedMsdusCI end() const
Get a constant iterator indicating past-the-last MSDU in the list of aggregated MSDUs.
Definition: wifi-mpdu.cc:358
DeaggregatedMsdusCI begin() const
Get a constant iterator pointing to the first MSDU in the list of aggregated MSDUs.
Definition: wifi-mpdu.cc:352
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:137
AcIndex GetQueueAc() const
Get the AC of the queue this item is stored into.
Definition: wifi-mpdu.cc:281
std::list< WifiMacQueueElem >::iterator Iterator
Const iterator typedef.
Definition: wifi-mpdu.h:157
Mac48Address GetDestinationAddress() const
Return the destination address present in the header.
Definition: wifi-mpdu.cc:131
bool IsQueued() const
Return true if this item is stored in some queue, false otherwise.
Definition: wifi-mpdu.cc:252
void SetQueueIt(std::optional< Iterator > queueIt, WmqIteratorTag tag)
Set the queue iterator stored by this object.
Definition: wifi-mpdu.cc:258
bool IsFragment() const
Return true if this item contains an MSDU fragment, false otherwise.
Definition: wifi-mpdu.cc:149
std::set< uint8_t > GetInFlightLinkIds() const
Definition: wifi-mpdu.cc:305
Ptr< const WifiMpdu > GetOriginal() const
Definition: wifi-mpdu.cc:63
void AssignSeqNo(uint16_t seqNo)
Set the sequence number of this MPDU (and of the original copy, if this is an alias) to the given val...
Definition: wifi-mpdu.cc:326
Ptr< WifiMpdu > CreateAlias(uint8_t linkId) const
Create an alias for this MPDU (which must be an original copy) for transmission on the link with the ...
Definition: wifi-mpdu.cc:73
static constexpr std::size_t ORIGINAL
index of original copy in the InstanceInfo variant
Definition: wifi-mpdu.h:299
Tag used to allow (only) WifiMacQueue to access the queue iterator stored by a WifiMpdu.
Definition: wifi-mpdu.h:47
WmqIteratorTag()=default
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:72
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
Information stored by the original copy only.
Definition: wifi-mpdu.h:279
bool m_seqNoAssigned
whether a sequence number has been assigned
Definition: wifi-mpdu.h:283
DeaggregatedMsdus m_msduList
list of aggregated MSDUs included in this MPDU
Definition: wifi-mpdu.h:281
Ptr< const Packet > m_packet
MSDU or A-MSDU contained in this queue item.
Definition: wifi-mpdu.h:280
std::optional< Iterator > m_queueIt
Queue iterator pointing to this MPDU, if queued.
Definition: wifi-mpdu.h:282