A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
wifi-mac-queue.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  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Author: Mirko Banchi <mk.banchi@gmail.com>
21  */
22 #ifndef WIFI_MAC_QUEUE_H
23 #define WIFI_MAC_QUEUE_H
24 
25 #include <list>
26 #include <utility>
27 #include "ns3/packet.h"
28 #include "ns3/nstime.h"
29 #include "ns3/object.h"
30 #include "wifi-mac-header.h"
31 
32 namespace ns3 {
33 
34 class WifiMacParameters;
35 class QosBlockedDestinations;
36 
52 class WifiMacQueue : public Object
53 {
54 public:
55  static TypeId GetTypeId (void);
56  WifiMacQueue ();
57  ~WifiMacQueue ();
58 
59  void SetMaxSize (uint32_t maxSize);
60  void SetMaxDelay (Time delay);
61  uint32_t GetMaxSize (void) const;
62  Time GetMaxDelay (void) const;
63 
64  void Enqueue (Ptr<const Packet> packet, const WifiMacHeader &hdr);
65  void PushFront (Ptr<const Packet> packet, const WifiMacHeader &hdr);
76  uint8_t tid,
78  Mac48Address addr);
87  uint8_t tid,
89  Mac48Address addr);
95  bool Remove (Ptr<const Packet> packet);
100  uint32_t GetNPacketsByTidAndAddress (uint8_t tid,
102  Mac48Address addr);
111  Time &tStamp,
112  const QosBlockedDestinations *blockedPackets);
117  Time &tStamp,
118  const QosBlockedDestinations *blockedPackets);
119  void Flush (void);
120 
121  bool IsEmpty (void);
122  uint32_t GetSize (void);
123 private:
124  struct Item;
125 
126  typedef std::list<struct Item> PacketQueue;
127  typedef std::list<struct Item>::reverse_iterator PacketQueueRI;
128  typedef std::list<struct Item>::iterator PacketQueueI;
129 
130  void Cleanup (void);
132 
133  struct Item
134  {
135  Item (Ptr<const Packet> packet,
136  const WifiMacHeader &hdr,
137  Time tstamp);
141  };
142 
144  uint32_t m_size;
145  uint32_t m_maxSize;
147 };
148 
149 } // namespace ns3
150 
151 #endif /* WIFI_MAC_QUEUE_H */
uint32_t GetSize(void)
keep track of time values and allow control of global simulation resolution
Definition: nstime.h:81
void SetMaxDelay(Time delay)
Ptr< const Packet > packet
Ptr< const Packet > PeekByTidAndAddress(WifiMacHeader *hdr, uint8_t tid, WifiMacHeader::AddressType type, Mac48Address addr)
uint32_t GetNPacketsByTidAndAddress(uint8_t tid, WifiMacHeader::AddressType type, Mac48Address addr)
bool Remove(Ptr< const Packet > packet)
void SetMaxSize(uint32_t maxSize)
Ptr< const Packet > DequeueFirstAvailable(WifiMacHeader *hdr, Time &tStamp, const QosBlockedDestinations *blockedPackets)
std::list< struct Item >::reverse_iterator PacketQueueRI
Ptr< const Packet > DequeueByTidAndAddress(WifiMacHeader *hdr, uint8_t tid, WifiMacHeader::AddressType type, Mac48Address addr)
static TypeId GetTypeId(void)
Mac48Address GetAddressForPacket(enum WifiMacHeader::AddressType type, PacketQueueI)
uint32_t GetMaxSize(void) const
Ptr< const Packet > Dequeue(WifiMacHeader *hdr)
Ptr< const Packet > Peek(WifiMacHeader *hdr)
void PushFront(Ptr< const Packet > packet, const WifiMacHeader &hdr)
an EUI-48 address
Definition: mac48-address.h:41
Ptr< const Packet > PeekFirstAvailable(WifiMacHeader *hdr, Time &tStamp, const QosBlockedDestinations *blockedPackets)
void Enqueue(Ptr< const Packet > packet, const WifiMacHeader &hdr)
Time GetMaxDelay(void) const
a base class which provides memory management and object aggregation
Definition: object.h:63
std::list< struct Item > PacketQueue
a unique identifier for an interface.
Definition: type-id.h:49
std::list< struct Item >::iterator PacketQueueI
PacketQueue m_queue
Item(Ptr< const Packet > packet, const WifiMacHeader &hdr, Time tstamp)