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 <list>
31 
32 namespace ns3 {
33 
34 class QosBlockedDestinations;
35 class Packet;
36 class WifiMacQueue;
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;
147  {
150  };
151 
157  bool IsQueued (void) const;
158 
165  const std::list<QueueIteratorPair>& GetQueueIteratorPairs (void) const;
166 
173  Ptr<Packet> GetProtocolDataUnit (void) const;
174 
179  virtual void Print (std::ostream &os) const;
180 
181 private:
189 
190  friend class WifiMacQueue; // to set QueueIteratorPair information
191 
196  std::list<QueueIteratorPair> m_queueIts;
197 };
198 
206 std::ostream& operator<< (std::ostream& os, const WifiMacQueueItem &item);
207 
208 } //namespace ns3
209 
210 #endif /* WIFI_MAC_QUEUE_ITEM_H */
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
DeaggregatedMsdusCI end(void)
Get a constant iterator indicating past-the-last MSDU in the list of aggregated MSDUs.
virtual void Print(std::ostream &os) const
Print the item contents.
std::list< QueueIteratorPair > m_queueIts
Queue iterators pointing to this MSDU(s), if queued.
DeaggregatedMsdusCI begin(void)
Get a constant iterator pointing to the first MSDU in the list of aggregated MSDUs.
uint32_t GetSize(void) const
Return the size of the packet stored by this item, including header size and trailer size...
Time GetTimeStamp(void) const
Get the timestamp included in this item.
Information needed to remove an MSDU from the queue.
ConstIterator it
iterator pointing to the MSDU in the queue
Mac48Address GetDestinationAddress(void) const
Return the destination address present in the header.
Ptr< const Packet > m_packet
The packet (MSDU or A-MSDU) contained in this queue item.
std::list< std::pair< Ptr< const Packet >, AmsduSubframeHeader > >::const_iterator DeaggregatedMsdusCI
DeaggregatedMsdusCI typedef.
WifiMacQueueItem stores (const) packets along with their Wifi MAC headers and the time when they were...
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
Time m_tstamp
timestamp when the packet arrived at the queue
WifiMacHeader m_header
Wifi MAC header associated with the packet.
void Aggregate(Ptr< const WifiMacQueueItem > msdu)
Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU)...
std::list< Ptr< WifiMacQueueItem > >::const_iterator ConstIterator
Const iterator typedef.
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:42
Ptr< const Packet > GetPacket(void) const
Get the packet stored in this item.
Ptr< Packet > GetProtocolDataUnit(void) const
Get the MAC protocol data unit (MPDU) corresponding to this item (i.e.
bool IsFragment(void) const
Return true if this item contains an MSDU fragment, false otherwise.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiMacQueueItem(Ptr< const Packet > p, const WifiMacHeader &header)
Create a Wifi MAC queue item containing a packet and a Wifi MAC header.
an EUI-48 address
Definition: mac48-address.h:43
DeaggregatedMsdus m_msduList
The list of aggregated MSDUs included in this MPDU.
Headers for A-MSDU subframes.
This queue implements the timeout procedure described in (Section 9.19.2.6 "Retransmit procedures" pa...
WifiMacQueue * queue
pointer to the queue where the MSDU is enqueued
bool IsQueued(void) const
Return true if this item is stored in some queue, false otherwise.
void DoAggregate(Ptr< const WifiMacQueueItem > msdu)
Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU)...
uint32_t GetPacketSize(void) const
Return the size in bytes of the packet or control header or management header stored by this item...
A template-based reference counting class.
std::list< std::pair< Ptr< const Packet >, AmsduSubframeHeader > > DeaggregatedMsdus
DeaggregatedMsdus typedef.
const std::list< QueueIteratorPair > & GetQueueIteratorPairs(void) const
Get a const reference to the list of iterators pointing to the positions of the items in the queue...
Implements the IEEE 802.11 MAC header.