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 "ns3/packet.h"
29 #include "wifi-mac-header.h"
30 #include "amsdu-subframe-header.h"
31 #include "qos-utils.h"
32 #include <list>
33 
34 namespace ns3 {
35 
36 class QosBlockedDestinations;
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 
71  Ptr<WifiMacQueueItem> GetItem (void) const;
72 
77  Ptr<const Packet> GetPacket (void) const;
78 
83  const WifiMacHeader & GetHeader (void) const;
84 
89  WifiMacHeader & GetHeader (void);
90 
96 
101  Time GetTimeStamp (void) const;
102 
109  uint32_t GetSize (void) const;
110 
118  uint32_t GetPacketSize (void) const;
119 
124  bool IsFragment (void) const;
125 
133 
135  typedef std::list<std::pair<Ptr<const Packet>, AmsduSubframeHeader> > DeaggregatedMsdus;
137  typedef std::list<std::pair<Ptr<const Packet>, AmsduSubframeHeader> >::const_iterator DeaggregatedMsdusCI;
138 
144  DeaggregatedMsdusCI begin (void);
150  DeaggregatedMsdusCI end (void);
151 
153  typedef std::list<Ptr<WifiMacQueueItem>>::const_iterator ConstIterator;
154 
160  bool IsQueued (void) const;
167  AcIndex GetQueueAc (void) const;
168 
175  Ptr<Packet> GetProtocolDataUnit (void) const;
176 
180  void SetInFlight (void);
184  void ResetInFlight (void);
190  bool IsInFlight (void) const;
191 
196  virtual void Print (std::ostream &os) const;
197 
198 private:
206 
207  friend class WifiMacQueue; // to set queue AC and iterator information
208 
215  bool m_inFlight;
216 };
217 
225 std::ostream& operator<< (std::ostream& os, const WifiMacQueueItem &item);
226 
227 } //namespace ns3
228 
229 #endif /* WIFI_MAC_QUEUE_ITEM_H */
Headers for A-MSDU subframes.
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.
This queue implements the timeout procedure described in (Section 9.19.2.6 "Retransmit procedures" pa...
WifiMacQueueItem stores (const) packets along with their Wifi MAC headers and the time when they were...
Ptr< const Packet > GetPacket(void) const
Get the packet stored in this item.
uint32_t GetSize(void) const
Return the size of the packet stored by this item, including header size and trailer size.
void Aggregate(Ptr< const WifiMacQueueItem > msdu)
Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU).
std::list< std::pair< Ptr< const Packet >, AmsduSubframeHeader > > DeaggregatedMsdus
DeaggregatedMsdus typedef.
DeaggregatedMsdusCI end(void)
Get a constant iterator indicating past-the-last MSDU in the list of aggregated MSDUs.
AcIndex GetQueueAc(void) const
Get the AC of the queue this item is stored into.
bool IsFragment(void) const
Return true if this item contains an MSDU fragment, false otherwise.
void DoAggregate(Ptr< const WifiMacQueueItem > msdu)
Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU).
bool IsQueued(void) const
Return true if this item is stored in some queue, false otherwise.
DeaggregatedMsdus m_msduList
The list of aggregated MSDUs included in this MPDU.
virtual void Print(std::ostream &os) const
Print the item contents.
WifiMacQueueItem(Ptr< const Packet > p, const WifiMacHeader &header)
Create a Wifi MAC queue item containing a packet and a Wifi MAC header.
AcIndex m_queueAc
AC associated with the queue this MPDU is stored into.
bool IsInFlight(void) const
Return true if this MPDU is in flight, false otherwise.
Ptr< WifiMacQueueItem > GetItem(void) const
Get a pointer to this WifiMacQueueItem object.
Ptr< Packet > GetProtocolDataUnit(void) const
Get the MAC protocol data unit (MPDU) corresponding to this item (i.e.
Time GetTimeStamp(void) const
Get the timestamp included in this item.
bool m_inFlight
whether the MPDU is in flight
std::list< std::pair< Ptr< const Packet >, AmsduSubframeHeader > >::const_iterator DeaggregatedMsdusCI
DeaggregatedMsdusCI typedef.
DeaggregatedMsdusCI begin(void)
Get a constant iterator pointing to the first MSDU in the list of aggregated MSDUs.
uint32_t GetPacketSize(void) const
Return the size in bytes of the packet or control header or management header stored by this item.
Time m_tstamp
timestamp when the packet arrived at the queue
void SetInFlight(void)
Mark this MPDU as being in flight (only used if Block Ack agreement established).
Ptr< const Packet > m_packet
The packet (MSDU or A-MSDU) contained in this queue item.
ConstIterator m_queueIt
Queue iterator pointing to this MPDU, if queued.
void ResetInFlight(void)
Mark this MPDU as not being in flight (only used if Block Ack agreement established).
Mac48Address GetDestinationAddress(void) const
Return the destination address present in the header.
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
WifiMacHeader m_header
Wifi MAC header associated with the packet.
std::list< Ptr< WifiMacQueueItem > >::const_iterator ConstIterator
Const iterator typedef.
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:71
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