A Discrete-Event Network Simulator
API
wifi-mac-queue.cc
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 #include "ns3/simulator.h"
25 #include "wifi-mac-queue.h"
27 #include <functional>
28 
29 namespace ns3 {
30 
31 NS_LOG_COMPONENT_DEFINE ("WifiMacQueue");
32 
33 NS_OBJECT_ENSURE_REGISTERED (WifiMacQueue);
34 NS_OBJECT_TEMPLATE_CLASS_DEFINE (Queue, WifiMacQueueItem);
35 
36 TypeId
38 {
39  static TypeId tid = TypeId ("ns3::WifiMacQueue")
41  .SetGroupName ("Wifi")
42  .AddConstructor<WifiMacQueue> ()
43  .AddAttribute ("MaxSize",
44  "The max queue size",
45  QueueSizeValue (QueueSize ("500p")),
49  .AddAttribute ("MaxDelay", "If a packet stays longer than this delay in the queue, it is dropped.",
50  TimeValue (MilliSeconds (500)),
52  MakeTimeChecker ())
53  .AddAttribute ("DropPolicy", "Upon enqueue with full queue, drop oldest (DropOldest) or newest (DropNewest) packet",
57  WifiMacQueue::DROP_NEWEST, "DropNewest"))
58  .AddTraceSource ("Expired", "MPDU dropped because its lifetime expired.",
60  "ns3::WifiMacQueueItem::TracedCallback")
61  ;
62  return tid;
63 }
64 
66  : m_ac (ac),
67  NS_LOG_TEMPLATE_DEFINE ("WifiMacQueue")
68 {
69 }
70 
72 {
74  m_nQueuedPackets.clear ();
75  m_nQueuedBytes.clear ();
76 }
77 
78 static std::list<Ptr<WifiMacQueueItem>> g_emptyWifiMacQueue;
79 
80 const WifiMacQueue::ConstIterator WifiMacQueue::EMPTY = g_emptyWifiMacQueue.end ();
81 
82 void
84 {
85  NS_LOG_FUNCTION (this << delay);
86  m_maxDelay = delay;
87 }
88 
89 Time
91 {
92  return m_maxDelay;
93 }
94 
95 bool
97 {
98  NS_LOG_FUNCTION (this << *item);
99 
100  return Insert (end (), item);
101 }
102 
103 bool
105 {
106  NS_LOG_FUNCTION (this << *item);
107 
108  return Insert (begin (), item);
109 }
110 
111 bool
113 {
114  NS_LOG_FUNCTION (this << *item);
115  NS_ASSERT_MSG (GetMaxSize ().GetUnit () == QueueSizeUnit::PACKETS,
116  "WifiMacQueues must be in packet mode");
117 
118  // insert the item if the queue is not full
119  if (QueueBase::GetNPackets () < GetMaxSize ().GetValue ())
120  {
121  return DoEnqueue (pos, item);
122  }
123 
124  // the queue is full; scan the list in the attempt to remove stale packets
125  ConstIterator it = begin ();
126  const Time now = Simulator::Now ();
127  while (it != end ())
128  {
129  if (it == pos && TtlExceeded (it, now))
130  {
131  return DoEnqueue (it, item);
132  }
133  if (TtlExceeded (it, now))
134  {
135  return DoEnqueue (pos, item);
136  }
137  it++;
138  }
139 
140  // the queue is still full, remove the oldest item if the policy is drop oldest
141  if (m_dropPolicy == DROP_OLDEST)
142  {
143  NS_LOG_DEBUG ("Remove the oldest item in the queue");
144  if (pos == begin ())
145  {
146  // Avoid invalidating pos
147  DoRemove (begin ());
148  pos = begin ();
149  }
150  else
151  {
152  DoRemove (begin ());
153  }
154  }
155 
156  return DoEnqueue (pos, item);
157 }
158 
161 {
162  NS_LOG_FUNCTION (this);
163  const Time now = Simulator::Now ();
164  for (ConstIterator it = begin (); it != end (); )
165  {
166  if (!TtlExceeded (it, now))
167  {
168  return DoDequeue (it);
169  }
170  }
171  NS_LOG_DEBUG ("The queue is empty");
172  return 0;
173 }
174 
175 void
177 {
178  NS_LOG_FUNCTION (this << *mpdu);
179 
180  if (mpdu->IsQueued ())
181  {
182  NS_ASSERT (mpdu->m_queueAc == m_ac);
183  NS_ASSERT (*mpdu->m_queueIt == mpdu);
184 
185  DoDequeue (mpdu->m_queueIt);
186  }
187 }
188 
190 WifiMacQueue::Peek (void) const
191 {
192  NS_LOG_FUNCTION (this);
193  const Time now = Simulator::Now ();
194  for (auto it = begin (); it != end (); it++)
195  {
196  // skip packets that stayed in the queue for too long. They will be
197  // actually removed from the queue by the next call to a non-const method
198  if (now <= (*it)->GetTimeStamp () + m_maxDelay)
199  {
200  return DoPeek (it);
201  }
202  }
203  NS_LOG_DEBUG ("The queue is empty");
204  return 0;
205 }
206 
207 WifiMacQueue::ConstIterator
208 WifiMacQueue::PeekByAddress (Mac48Address dest, ConstIterator pos) const
209 {
210  NS_LOG_FUNCTION (this << dest);
211  ConstIterator it = (pos != EMPTY ? pos : begin ());
212  const Time now = Simulator::Now ();
213  while (it != end ())
214  {
215  // skip packets that stayed in the queue for too long. They will be
216  // actually removed from the queue by the next call to a non-const method
217  if (now <= (*it)->GetTimeStamp () + m_maxDelay)
218  {
219  if (((*it)->GetHeader ().IsData () || (*it)->GetHeader ().IsQosData ())
220  && (*it)->GetDestinationAddress () == dest)
221  {
222  return it;
223  }
224  }
225  it++;
226  }
227  NS_LOG_DEBUG ("The queue is empty");
228  return end ();
229 }
230 
231 WifiMacQueue::ConstIterator
232 WifiMacQueue::PeekByTid (uint8_t tid, ConstIterator pos) const
233 {
234  NS_LOG_FUNCTION (this << +tid);
235  ConstIterator it = (pos != EMPTY ? pos : begin ());
236  const Time now = Simulator::Now ();
237  while (it != end ())
238  {
239  // skip packets that stayed in the queue for too long. They will be
240  // actually removed from the queue by the next call to a non-const method
241  if (now <= (*it)->GetTimeStamp () + m_maxDelay)
242  {
243  if ((*it)->GetHeader ().IsQosData () && (*it)->GetHeader ().GetQosTid () == tid)
244  {
245  return it;
246  }
247  }
248  it++;
249  }
250  NS_LOG_DEBUG ("The queue is empty");
251  return end ();
252 }
253 
254 WifiMacQueue::ConstIterator
255 WifiMacQueue::PeekByTidAndAddress (uint8_t tid, Mac48Address dest, ConstIterator pos) const
256 {
257  NS_LOG_FUNCTION (this << +tid << dest);
258  ConstIterator it = (pos != EMPTY ? pos : begin ());
259  const Time now = Simulator::Now ();
260  while (it != end ())
261  {
262  // skip packets that stayed in the queue for too long. They will be
263  // actually removed from the queue by the next call to a non-const method
264  if (now <= (*it)->GetTimeStamp () + m_maxDelay)
265  {
266  if ((*it)->GetHeader ().IsQosData () && (*it)->GetDestinationAddress () == dest
267  && (*it)->GetHeader ().GetQosTid () == tid)
268  {
269  return it;
270  }
271  }
272  it++;
273  }
274  NS_LOG_DEBUG ("The queue is empty");
275  return end ();
276 }
277 
278 WifiMacQueue::ConstIterator
279 WifiMacQueue::PeekFirstAvailable (const Ptr<QosBlockedDestinations> blockedPackets, ConstIterator pos) const
280 {
281  NS_LOG_FUNCTION (this);
282  ConstIterator it = (pos != EMPTY ? pos : begin ());
283  const Time now = Simulator::Now ();
284  while (it != end ())
285  {
286  // skip packets that stayed in the queue for too long. They will be
287  // actually removed from the queue by the next call to a non-const method
288  if (now <= (*it)->GetTimeStamp () + m_maxDelay)
289  {
290  if (!(*it)->GetHeader ().IsQosData () || !blockedPackets
291  || !blockedPackets->IsBlocked ((*it)->GetHeader ().GetAddr1 (), (*it)->GetHeader ().GetQosTid ()))
292  {
293  return it;
294  }
295  }
296  it++;
297  }
298  NS_LOG_DEBUG ("The queue is empty");
299  return end ();
300 }
301 
304 {
305  NS_LOG_FUNCTION (this);
306 
307  const Time now = Simulator::Now ();
308  for (ConstIterator it = begin (); it != end (); )
309  {
310  if (!TtlExceeded (it, now))
311  {
312  return DoRemove (it);
313  }
314  }
315  NS_LOG_DEBUG ("The queue is empty");
316  return 0;
317 }
318 
319 bool
321 {
322  NS_LOG_FUNCTION (this << packet);
323 
324  const Time now = Simulator::Now ();
325  for (ConstIterator it = begin (); it != end (); )
326  {
327  if (!TtlExceeded (it, now))
328  {
329  if ((*it)->GetPacket () == packet)
330  {
331  DoRemove (it);
332  return true;
333  }
334 
335  it++;
336  }
337  }
338  NS_LOG_DEBUG ("Packet " << packet << " not found in the queue");
339  return false;
340 }
341 
342 WifiMacQueue::ConstIterator
343 WifiMacQueue::Remove (ConstIterator pos, bool removeExpired)
344 {
345  NS_LOG_FUNCTION (this);
346 
347  if (!removeExpired)
348  {
349  ConstIterator curr = pos++;
350  DoRemove (curr);
351  return pos;
352  }
353 
354  const Time now = Simulator::Now ();
355 
356  // remove stale items queued before the given position
357  ConstIterator it = begin ();
358  while (it != end ())
359  {
360  if (it == pos)
361  {
362  ConstIterator curr = pos++;
363  DoRemove (curr);
364  return pos;
365  }
366  else if (!TtlExceeded (it, now))
367  {
368  it++;
369  }
370  }
371  NS_LOG_DEBUG ("Invalid iterator");
372  return end ();
373 }
374 
375 uint32_t
377 {
378  NS_LOG_FUNCTION (this << dest);
379 
380  uint32_t nPackets = 0;
381  const Time now = Simulator::Now ();
382 
383  for (ConstIterator it = begin (); it != end (); )
384  {
385  if (!TtlExceeded (it, now))
386  {
387  if ((*it)->GetHeader ().IsData () && (*it)->GetDestinationAddress () == dest)
388  {
389  nPackets++;
390  }
391 
392  it++;
393  }
394  }
395  NS_LOG_DEBUG ("returns " << nPackets);
396  return nPackets;
397 }
398 
399 uint32_t
401 {
402  NS_LOG_FUNCTION (this << dest);
403  uint32_t nPackets = 0;
404  const Time now = Simulator::Now ();
405 
406  for (ConstIterator it = begin (); it != end (); )
407  {
408  if (!TtlExceeded (it, now))
409  {
410  if ((*it)->GetHeader ().IsQosData () && (*it)->GetDestinationAddress () == dest
411  && (*it)->GetHeader ().GetQosTid () == tid)
412  {
413  nPackets++;
414  }
415 
416  it++;
417  }
418  }
419  NS_LOG_DEBUG ("returns " << nPackets);
420  return nPackets;
421 }
422 
423 bool
425 {
426  NS_LOG_FUNCTION (this);
427  const Time now = Simulator::Now ();
428 
429  for (ConstIterator it = begin (); it != end (); )
430  {
431  if (!TtlExceeded (it, now))
432  {
433  NS_LOG_DEBUG ("returns false");
434  return false;
435  }
436  }
437  NS_LOG_DEBUG ("returns true");
438  return true;
439 }
440 
441 uint32_t
443 {
444  NS_LOG_FUNCTION (this);
445  const Time now = Simulator::Now ();
446 
447  // remove packets that stayed in the queue for too long
448  for (ConstIterator it = begin (); it != end (); )
449  {
450  if (!TtlExceeded (it, now))
451  {
452  it++;
453  }
454  }
455  return QueueBase::GetNPackets ();
456 }
457 
458 uint32_t
460 {
461  NS_LOG_FUNCTION (this);
462  const Time now = Simulator::Now ();
463 
464  // remove packets that stayed in the queue for too long
465  for (ConstIterator it = begin (); it != end (); )
466  {
467  if (!TtlExceeded (it, now))
468  {
469  it++;
470  }
471  }
472  return QueueBase::GetNBytes ();
473 }
474 
475 uint32_t
476 WifiMacQueue::GetNPackets (uint8_t tid, Mac48Address dest) const
477 {
478  WifiAddressTidPair addressTidPair (dest, tid);
479  auto it = m_nQueuedPackets.find (addressTidPair);
480  if (it == m_nQueuedPackets.end ())
481  {
482  return 0;
483  }
484  return m_nQueuedPackets.at (addressTidPair);
485 }
486 
487 uint32_t
488 WifiMacQueue::GetNBytes (uint8_t tid, Mac48Address dest) const
489 {
490  WifiAddressTidPair addressTidPair (dest, tid);
491  auto it = m_nQueuedBytes.find (addressTidPair);
492  if (it == m_nQueuedBytes.end ())
493  {
494  return 0;
495  }
496  return m_nQueuedBytes.at (addressTidPair);
497 }
498 
499 bool
501 {
502  Iterator ret;
503  if (Queue<WifiMacQueueItem>::DoEnqueue (pos, item, ret))
504  {
505  // update statistics about queued packets
506  if (item->GetHeader ().IsQosData ())
507  {
508  WifiAddressTidPair addressTidPair (item->GetHeader ().GetAddr1 (), item->GetHeader ().GetQosTid ());
509  auto it = m_nQueuedPackets.find (addressTidPair);
510  if (it == m_nQueuedPackets.end ())
511  {
512  m_nQueuedPackets[addressTidPair] = 0;
513  m_nQueuedBytes[addressTidPair] = 0;
514  }
515  m_nQueuedPackets[addressTidPair]++;
516  m_nQueuedBytes[addressTidPair] += item->GetSize ();
517  }
518  // set item's information about its position in the queue
519  item->m_queueAc = m_ac;
520  item->m_queueIt = ret;
521  return true;
522  }
523  return false;
524 }
525 
527 WifiMacQueue::DoDequeue (ConstIterator pos)
528 {
529  NS_LOG_FUNCTION (this);
530 
531  if (TtlExceeded (pos, Simulator::Now ()))
532  {
533  NS_LOG_DEBUG ("Packet lifetime expired");
534  return nullptr;
535  }
536 
538 
539  if (item != 0 && item->GetHeader ().IsQosData ())
540  {
541  WifiAddressTidPair addressTidPair (item->GetHeader ().GetAddr1 (), item->GetHeader ().GetQosTid ());
542  NS_ASSERT (m_nQueuedPackets.find (addressTidPair) != m_nQueuedPackets.end ());
543  NS_ASSERT (m_nQueuedPackets[addressTidPair] >= 1);
544  NS_ASSERT (m_nQueuedBytes[addressTidPair] >= item->GetSize ());
545 
546  m_nQueuedPackets[addressTidPair]--;
547  m_nQueuedBytes[addressTidPair] -= item->GetSize ();
548  }
549 
550  if (item != 0)
551  {
552  NS_ASSERT (item->IsQueued ());
553  item->m_queueAc = AC_UNDEF;
554  }
555 
556  return item;
557 }
558 
560 WifiMacQueue::DoRemove (ConstIterator pos)
561 {
563 
564  if (item != 0 && item->GetHeader ().IsQosData ())
565  {
566  WifiAddressTidPair addressTidPair (item->GetHeader ().GetAddr1 (), item->GetHeader ().GetQosTid ());
567  NS_ASSERT (m_nQueuedPackets.find (addressTidPair) != m_nQueuedPackets.end ());
568  NS_ASSERT (m_nQueuedPackets[addressTidPair] >= 1);
569  NS_ASSERT (m_nQueuedBytes[addressTidPair] >= item->GetSize ());
570 
571  m_nQueuedPackets[addressTidPair]--;
572  m_nQueuedBytes[addressTidPair] -= item->GetSize ();
573  }
574 
575  if (item != 0)
576  {
577  NS_ASSERT (item->IsQueued ());
578  item->m_queueAc = AC_UNDEF;
579  }
580 
581  return item;
582 }
583 
584 } //namespace ns3
ns3::QueueBase::SetMaxSize
void SetMaxSize(QueueSize size)
Set the maximum size of this queue.
Definition: queue.cc:200
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::Queue::DoDequeue
Ptr< Item > DoDequeue(ConstIterator pos)
Pull the item to dequeue from the queue.
Definition: queue.h:531
ns3::QueueBase::GetNBytes
uint32_t GetNBytes(void) const
Definition: queue.cc:98
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
NS_ASSERT
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:67
ns3::MakeTimeChecker
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:533
ns3::QueueBase::GetNPackets
uint32_t GetNPackets(void) const
Definition: queue.cc:90
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::Queue::DoRemove
Ptr< Item > DoRemove(ConstIterator pos)
Pull the item to drop from the queue.
Definition: queue.h:560
ns3::Simulator::Now
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WifiMacQueue::GetNPackets
uint32_t GetNPackets(void)
Definition: wifi-mac-queue.cc:442
ns3::MakeEnumChecker
Ptr< const AttributeChecker > MakeEnumChecker(int v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
Definition: enum.h:161
ns3::WifiMacQueue::GetNPacketsByAddress
uint32_t GetNPacketsByAddress(Mac48Address dest)
Return the number of packets having destination address specified by dest.
Definition: wifi-mac-queue.cc:376
ns3::WifiMacQueue::PeekFirstAvailable
ConstIterator PeekFirstAvailable(const Ptr< QosBlockedDestinations > blockedPackets=nullptr, ConstIterator pos=EMPTY) const
Return first available packet for transmission.
Definition: wifi-mac-queue.cc:279
ns3::WifiMacQueue::~WifiMacQueue
~WifiMacQueue()
Definition: wifi-mac-queue.cc:71
ns3::MakeQueueSizeChecker
Ptr< const AttributeChecker > MakeQueueSizeChecker(void)
Definition: queue-size.cc:29
ns3::WifiMacQueue::GetMaxDelay
Time GetMaxDelay(void) const
Return the maximum delay before the packet is discarded.
Definition: wifi-mac-queue.cc:90
ns3::Mac48Address
an EUI-48 address
Definition: mac48-address.h:44
ns3::PACKETS
@ PACKETS
Use number of packets for queue size.
Definition: queue-size.h:44
ns3::WifiMacHeader::GetAddr1
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
Definition: wifi-mac-header.cc:424
ns3::WifiMacQueue::m_nQueuedPackets
std::unordered_map< WifiAddressTidPair, uint32_t, WifiAddressTidHash > m_nQueuedPackets
Per (MAC address, TID) pair queued packets.
Definition: wifi-mac-queue.h:336
ns3::WifiMacQueue::DoRemove
Ptr< WifiMacQueueItem > DoRemove(ConstIterator pos)
Wrapper for the DoRemove method provided by the base class that additionally resets the iterator fiel...
Definition: wifi-mac-queue.cc:560
ns3::WifiMacQueueItem::GetHeader
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
Definition: wifi-mac-queue-item.cc:65
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::WifiMacQueue::Insert
bool Insert(ConstIterator pos, Ptr< WifiMacQueueItem > item)
Enqueue the given Wifi MAC queue item before the given position.
Definition: wifi-mac-queue.cc:112
ns3::EnumValue
Hold variables of type enum.
Definition: enum.h:55
ns3::MakeTraceSourceAccessor
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Definition: trace-source-accessor.h:202
ns3::WifiMacQueue::IsEmpty
bool IsEmpty(void)
Definition: wifi-mac-queue.cc:424
wifi-mac-queue.h
ns3::QueueSizeValue
Definition: queue-size.h:221
ns3::Ptr< WifiMacQueueItem >
ns3::WifiMacQueue::GetNPacketsByTidAndAddress
uint32_t GetNPacketsByTidAndAddress(uint8_t tid, Mac48Address dest)
Return the number of QoS packets having TID equal to tid and destination address equal to dest.
Definition: wifi-mac-queue.cc:400
ns3::WifiMacQueue::Dequeue
Ptr< WifiMacQueueItem > Dequeue(void) override
Dequeue the packet in the front of the queue.
Definition: wifi-mac-queue.cc:160
ns3::WifiMacQueue::m_maxDelay
Time m_maxDelay
Time to live for packets in the queue.
Definition: wifi-mac-queue.h:331
ns3::WifiMacQueue::Enqueue
bool Enqueue(Ptr< WifiMacQueueItem > item) override
Enqueue the given Wifi MAC queue item at the end of the queue.
Definition: wifi-mac-queue.cc:96
ns3::WifiMacQueue::m_ac
AcIndex m_ac
the access category
Definition: wifi-mac-queue.h:333
ns3::WifiMacQueue::DoEnqueue
bool DoEnqueue(ConstIterator pos, Ptr< WifiMacQueueItem > item)
Wrapper for the DoEnqueue method provided by the base class that additionally sets the iterator field...
Definition: wifi-mac-queue.cc:500
ns3::WifiMacQueue::DROP_NEWEST
@ DROP_NEWEST
Definition: wifi-mac-queue.h:80
ns3::WifiMacQueue::m_nQueuedBytes
std::unordered_map< WifiAddressTidPair, uint32_t, WifiAddressTidHash > m_nQueuedBytes
Per (MAC address, TID) pair queued bytes.
Definition: wifi-mac-queue.h:338
Queue< WifiMacQueueItem >
Introspection did not find any typical Config paths.
ns3::WifiMacQueue::DequeueIfQueued
void DequeueIfQueued(Ptr< const WifiMacQueueItem > mpdu)
Dequeue the given MPDU if it is stored in this queue.
Definition: wifi-mac-queue.cc:176
ns3::WifiMacQueue::PeekByTid
ConstIterator PeekByTid(uint8_t tid, ConstIterator pos=EMPTY) const
Search and return, if present in the queue, the first packet having the TID equal to tid.
Definition: wifi-mac-queue.cc:232
ns3::MilliSeconds
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1297
ns3::AC_UNDEF
@ AC_UNDEF
Total number of ACs.
Definition: qos-utils.h:85
ns3::WifiMacHeader::IsQosData
bool IsQosData(void) const
Return true if the Type is DATA and Subtype is one of the possible values for QoS Data.
Definition: wifi-mac-header.cc:565
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
NS_ASSERT_MSG
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:88
ns3::WifiMacQueue::DoDequeue
Ptr< WifiMacQueueItem > DoDequeue(ConstIterator pos)
Wrapper for the DoDequeue method provided by the base class that additionally resets the iterator fie...
Definition: wifi-mac-queue.cc:527
ns3::WifiMacQueue::PeekByTidAndAddress
ConstIterator PeekByTidAndAddress(uint8_t tid, Mac48Address dest, ConstIterator pos=EMPTY) const
Search and return, if present in the queue, the first packet having the receiver address equal to des...
Definition: wifi-mac-queue.cc:255
ns3::WifiMacQueue::PeekByAddress
ConstIterator PeekByAddress(Mac48Address dest, ConstIterator pos=EMPTY) const
Search and return, if present in the queue, the first packet (either Data frame or QoS Data frame) ha...
Definition: wifi-mac-queue.cc:208
ns3::g_emptyWifiMacQueue
static std::list< Ptr< WifiMacQueueItem > > g_emptyWifiMacQueue
empty Wi-Fi MAC queue
Definition: wifi-mac-queue.cc:78
qos-blocked-destinations.h
ns3::WifiMacHeader::GetQosTid
uint8_t GetQosTid(void) const
Return the Traffic ID of a QoS header.
Definition: wifi-mac-header.cc:862
NS_LOG_FUNCTION_NOARGS
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
Definition: log-macros-enabled.h:209
ns3::WifiAddressTidPair
std::pair< Mac48Address, uint8_t > WifiAddressTidPair
(MAC address, TID) pair
Definition: qos-utils.h:32
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::WifiMacQueue::Remove
Ptr< WifiMacQueueItem > Remove(void) override
Remove the packet in the front of the queue.
Definition: wifi-mac-queue.cc:303
ns3::WifiMacQueue::PushFront
bool PushFront(Ptr< WifiMacQueueItem > item)
Enqueue the given Wifi MAC queue item at the front of the queue.
Definition: wifi-mac-queue.cc:104
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
ns3::WifiMacQueue::m_dropPolicy
DropPolicy m_dropPolicy
Drop behavior of queue.
Definition: wifi-mac-queue.h:332
ns3::WifiMacQueue::DROP_OLDEST
@ DROP_OLDEST
Definition: wifi-mac-queue.h:81
NS_LOG_TEMPLATE_DEFINE
#define NS_LOG_TEMPLATE_DEFINE(name)
Initialize a reference to a Log component.
Definition: log.h:239
ns3::MakeEnumAccessor
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: enum.h:203
ns3::WifiMacQueue::SetMaxDelay
void SetMaxDelay(Time delay)
Set the maximum delay before the packet is discarded.
Definition: wifi-mac-queue.cc:83
ns3::TimeValue
AttributeValue implementation for Time.
Definition: nstime.h:1353
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition: log-macros-enabled.h:244
ns3::AcIndex
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:71
ns3::MakeQueueSizeAccessor
Ptr< const AttributeAccessor > MakeQueueSizeAccessor(T1 a1)
Definition: queue-size.h:221
ns3::WifiMacQueue::WifiMacQueue
WifiMacQueue(AcIndex ac=AC_UNDEF)
Constructor.
Definition: wifi-mac-queue.cc:65
ns3::WifiMacQueue::Peek
Ptr< const WifiMacQueueItem > Peek(void) const override
Peek the packet in the front of the queue.
Definition: wifi-mac-queue.cc:190
ns3::QueueBase::GetMaxSize
QueueSize GetMaxSize(void) const
Definition: queue.cc:217
NS_OBJECT_TEMPLATE_CLASS_DEFINE
#define NS_OBJECT_TEMPLATE_CLASS_DEFINE(type, param)
Explicitly instantiate a template class and register the resulting instance with the TypeId system.
Definition: object-base.h:67
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::WifiMacQueue::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: wifi-mac-queue.cc:37
ns3::QueueSize
Class for representing queue sizes.
Definition: queue-size.h:95
ns3::Queue
Template class for packet Queues.
Definition: queue.h:254
ns3::WifiMacQueueItem::m_queueIt
ConstIterator m_queueIt
Queue iterator pointing to this MPDU, if queued.
Definition: wifi-mac-queue-item.h:211
ns3::WifiMacQueue::GetNBytes
uint32_t GetNBytes(void)
Definition: wifi-mac-queue.cc:459
ns3::WifiMacQueue::EMPTY
static const ConstIterator EMPTY
Invalid iterator to signal an empty queue.
Definition: wifi-mac-queue.h:298
ns3::WifiMacQueue::TtlExceeded
bool TtlExceeded(ConstIterator &it, const Time &now)
Remove the item pointed to by the iterator it if it has been in the queue for too long.
Definition: wifi-mac-queue.h:352
ns3::MakeTimeAccessor
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: nstime.h:1354
ns3::WifiMacQueue::m_traceExpired
TracedCallback< Ptr< const WifiMacQueueItem > > m_traceExpired
Traced callback: fired when a packet is dropped due to lifetime expiration.
Definition: wifi-mac-queue.h:341
ns3::WifiMacQueueItem::m_queueAc
AcIndex m_queueAc
AC associated with the queue this MPDU is stored into.
Definition: wifi-mac-queue-item.h:212