A Discrete-Event Network Simulator
API
wifi-mac-queue-item.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005, 2009 INRIA
4  * Copyright (c) 2009 MIRKO BANCHI
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Mirko Banchi <mk.banchi@gmail.com>
21  * Stefano Avallone <stavallo@unina.it>
22  */
23 
24 #ifndef WIFI_MAC_QUEUE_ITEM_H
25 #define WIFI_MAC_QUEUE_ITEM_H
26 
27 #include "ns3/nstime.h"
28 #include "wifi-mac-header.h"
29 #include "amsdu-subframe-header.h"
30 #include "qos-utils.h"
31 #include <list>
32 
33 namespace ns3 {
34 
35 class QosBlockedDestinations;
36 class Packet;
37 
44 class WifiMacQueueItem : public SimpleRefCount<WifiMacQueueItem>
45 {
46 public:
53 
60  WifiMacQueueItem (Ptr<const Packet> p, const WifiMacHeader & header, Time tstamp);
61 
62  virtual ~WifiMacQueueItem ();
63 
68  Ptr<const Packet> GetPacket (void) const;
69 
74  const WifiMacHeader & GetHeader (void) const;
75 
80  WifiMacHeader & GetHeader (void);
81 
87 
92  Time GetTimeStamp (void) const;
93 
100  uint32_t GetSize (void) const;
101 
109  uint32_t GetPacketSize (void) const;
110 
115  bool IsFragment (void) const;
116 
124 
126  typedef std::list<std::pair<Ptr<const Packet>, AmsduSubframeHeader> > DeaggregatedMsdus;
128  typedef std::list<std::pair<Ptr<const Packet>, AmsduSubframeHeader> >::const_iterator DeaggregatedMsdusCI;
129 
135  DeaggregatedMsdusCI begin (void);
141  DeaggregatedMsdusCI end (void);
142 
144  typedef std::list<Ptr<WifiMacQueueItem>>::const_iterator ConstIterator;
145 
151  bool IsQueued (void) const;
158  AcIndex GetQueueAc (void) const;
165  ConstIterator GetQueueIterator (void) const;
166 
173  Ptr<Packet> GetProtocolDataUnit (void) const;
174 
178  void SetInFlight (void);
182  void ResetInFlight (void);
188  bool IsInFlight (void) const;
189 
194  virtual void Print (std::ostream &os) const;
195 
196 private:
204 
205  friend class WifiMacQueue; // to set queue AC and iterator information
206 
213  bool m_inFlight;
214 };
215 
223 std::ostream& operator<< (std::ostream& os, const WifiMacQueueItem &item);
224 
225 } //namespace ns3
226 
227 #endif /* WIFI_MAC_QUEUE_ITEM_H */
ns3::WifiMacQueueItem::~WifiMacQueueItem
virtual ~WifiMacQueueItem()
Definition: wifi-mac-queue-item.cc:54
ns3::WifiMacQueueItem::begin
DeaggregatedMsdusCI begin(void)
Get a constant iterator pointing to the first MSDU in the list of aggregated MSDUs.
Definition: wifi-mac-queue-item.cc:243
ns3::WifiMacQueueItem
WifiMacQueueItem stores (const) packets along with their Wifi MAC headers and the time when they were...
Definition: wifi-mac-queue-item.h:45
ns3::WifiMacQueueItem::Aggregate
void Aggregate(Ptr< const WifiMacQueueItem > msdu)
Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU).
Definition: wifi-mac-queue-item.cc:116
ns3::WifiMacQueueItem::GetPacket
Ptr< const Packet > GetPacket(void) const
Get the packet stored in this item.
Definition: wifi-mac-queue-item.cc:59
ns3::WifiMacQueue
This queue implements the timeout procedure described in (Section 9.19.2.6 "Retransmit procedures" pa...
Definition: wifi-mac-queue.h:60
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
amsdu-subframe-header.h
qos-utils.h
ns3::WifiMacQueueItem::end
DeaggregatedMsdusCI end(void)
Get a constant iterator indicating past-the-last MSDU in the list of aggregated MSDUs.
Definition: wifi-mac-queue-item.cc:249
ns3::WifiMacQueueItem::DeaggregatedMsdus
std::list< std::pair< Ptr< const Packet >, AmsduSubframeHeader > > DeaggregatedMsdus
DeaggregatedMsdus typedef.
Definition: wifi-mac-queue-item.h:126
ns3::AmsduSubframeHeader
Headers for A-MSDU subframes.
Definition: amsdu-subframe-header.h:34
ns3::WifiMacQueueItem::GetQueueAc
AcIndex GetQueueAc(void) const
Get the AC of the queue this item is stored into.
Definition: wifi-mac-queue-item.cc:211
ns3::SimpleRefCount
A template-based reference counting class.
Definition: simple-ref-count.h:74
ns3::Mac48Address
an EUI-48 address
Definition: mac48-address.h:44
ns3::WifiMacQueueItem::GetPacketSize
uint32_t GetPacketSize(void) const
Return the size in bytes of the packet or control header or management header stored by this item.
Definition: wifi-mac-queue-item.cc:89
ns3::WifiMacQueueItem::WifiMacQueueItem
WifiMacQueueItem(Ptr< const Packet > p, const WifiMacHeader &header)
Create a Wifi MAC queue item containing a packet and a Wifi MAC header.
Definition: wifi-mac-queue-item.cc:36
ns3::WifiMacQueueItem::GetHeader
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
Definition: wifi-mac-queue-item.cc:65
wifi-mac-header.h
ns3::WifiMacHeader
Implements the IEEE 802.11 MAC header.
Definition: wifi-mac-header.h:85
ns3::Ptr< const Packet >
ns3::WifiMacQueueItem::GetDestinationAddress
Mac48Address GetDestinationAddress(void) const
Return the destination address present in the header.
Definition: wifi-mac-queue-item.cc:77
ns3::WifiMacQueueItem::ConstIterator
std::list< Ptr< WifiMacQueueItem > >::const_iterator ConstIterator
Const iterator typedef.
Definition: wifi-mac-queue-item.h:144
ns3::WifiMacQueueItem::GetProtocolDataUnit
Ptr< Packet > GetProtocolDataUnit(void) const
Get the MAC protocol data unit (MPDU) corresponding to this item (i.e.
Definition: wifi-mac-queue-item.cc:107
ns3::WifiMacQueueItem::IsInFlight
bool IsInFlight(void) const
Return true if this MPDU is in flight, false otherwise.
Definition: wifi-mac-queue-item.cc:237
ns3::WifiMacQueueItem::DoAggregate
void DoAggregate(Ptr< const WifiMacQueueItem > msdu)
Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU).
Definition: wifi-mac-queue-item.cc:150
ns3::WifiMacQueueItem::m_tstamp
Time m_tstamp
timestamp when the packet arrived at the queue
Definition: wifi-mac-queue-item.h:209
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::WifiMacQueueItem::m_msduList
DeaggregatedMsdus m_msduList
The list of aggregated MSDUs included in this MPDU.
Definition: wifi-mac-queue-item.h:210
ns3::WifiMacQueueItem::DeaggregatedMsdusCI
std::list< std::pair< Ptr< const Packet >, AmsduSubframeHeader > >::const_iterator DeaggregatedMsdusCI
DeaggregatedMsdusCI typedef.
Definition: wifi-mac-queue-item.h:128
ns3::WifiMacQueueItem::SetInFlight
void SetInFlight(void)
Mark this MPDU as being in flight (only used if Block Ack agreement established).
Definition: wifi-mac-queue-item.cc:225
ns3::WifiMacQueueItem::Print
virtual void Print(std::ostream &os) const
Print the item contents.
Definition: wifi-mac-queue-item.cc:255
ns3::WifiMacQueueItem::IsQueued
bool IsQueued(void) const
Return true if this item is stored in some queue, false otherwise.
Definition: wifi-mac-queue-item.cc:205
ns3::WifiMacQueueItem::GetTimeStamp
Time GetTimeStamp(void) const
Get the timestamp included in this item.
Definition: wifi-mac-queue-item.cc:83
ns3::AcIndex
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:71
ns3::WifiMacQueueItem::m_packet
Ptr< const Packet > m_packet
The packet (MSDU or A-MSDU) contained in this queue item.
Definition: wifi-mac-queue-item.h:207
ns3::WifiMacQueueItem::m_inFlight
bool m_inFlight
whether the MPDU is in flight
Definition: wifi-mac-queue-item.h:213
ns3::WifiMacQueueItem::IsFragment
bool IsFragment(void) const
Return true if this item contains an MSDU fragment, false otherwise.
Definition: wifi-mac-queue-item.cc:101
ns3::WifiMacQueueItem::GetQueueIterator
ConstIterator GetQueueIterator(void) const
Get a const iterator pointing to the position of the MPDU in the queue.
Definition: wifi-mac-queue-item.cc:218
ns3::WifiMacQueueItem::ResetInFlight
void ResetInFlight(void)
Mark this MPDU as not being in flight (only used if Block Ack agreement established).
Definition: wifi-mac-queue-item.cc:231
ns3::WifiMacQueueItem::GetSize
uint32_t GetSize(void) const
Return the size of the packet stored by this item, including header size and trailer size.
Definition: wifi-mac-queue-item.cc:95
ns3::WifiMacQueueItem::m_header
WifiMacHeader m_header
Wifi MAC header associated with the packet.
Definition: wifi-mac-queue-item.h:208
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:137
ns3::WifiMacQueueItem::m_queueIt
ConstIterator m_queueIt
Queue iterator pointing to this MPDU, if queued.
Definition: wifi-mac-queue-item.h:211
ns3::WifiMacQueueItem::m_queueAc
AcIndex m_queueAc
AC associated with the queue this MPDU is stored into.
Definition: wifi-mac-queue-item.h:212