A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
queue-disc.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007, 2014 University of Washington
4  * 2015 Universita' degli Studi di Napoli Federico II
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 
20 #include "ns3/log.h"
21 #include "ns3/abort.h"
22 #include "ns3/uinteger.h"
23 #include "ns3/pointer.h"
24 #include "ns3/object-vector.h"
25 #include "ns3/packet.h"
26 #include "ns3/unused.h"
27 #include "queue-disc.h"
28 
29 namespace ns3 {
30 
31 NS_LOG_COMPONENT_DEFINE ("QueueDisc");
32 
33 QueueDiscItem::QueueDiscItem (Ptr<Packet> p, const Address& addr, uint16_t protocol)
34  : QueueItem (p),
35  m_address (addr),
36  m_protocol (protocol),
37  m_txq (0)
38 {
39 }
40 
42 {
43  NS_LOG_FUNCTION (this);
44 }
45 
46 Address
48 {
49  return m_address;
50 }
51 
52 uint16_t
54 {
55  return m_protocol;
56 }
57 
58 uint8_t
60 {
61  return m_txq;
62 }
63 
64 void
66 {
67  m_txq = txq;
68 }
69 
70 void
71 QueueDiscItem::Print (std::ostream& os) const
72 {
73  os << GetPacket () << " "
74  << "Dst addr " << m_address << " "
75  << "proto " << (uint16_t) m_protocol << " "
76  << "txq " << (uint8_t) m_txq
77  ;
78 }
79 
80 
82 
84 {
85  static TypeId tid = TypeId ("ns3::QueueDiscClass")
86  .SetParent<Object> ()
87  .SetGroupName ("TrafficControl")
88  .AddConstructor<QueueDiscClass> ()
89  .AddAttribute ("QueueDisc", "The queue disc attached to the class",
90  PointerValue (),
92  MakePointerChecker<QueueDisc> ())
93  ;
94  return tid;
95 }
96 
98 {
99  NS_LOG_FUNCTION (this);
100 }
101 
102 void
104 {
105  NS_LOG_FUNCTION (this);
106  m_queueDisc = 0;
108 }
109 
112 {
113  NS_LOG_FUNCTION (this);
114  return m_queueDisc;
115 }
116 
117 void
119 {
120  NS_LOG_FUNCTION (this);
121  NS_ABORT_MSG_IF (m_queueDisc, "Cannot set the queue disc on a class already having an attached queue disc");
122  m_queueDisc = qd;
123 }
124 
125 
127 
129 {
130  static TypeId tid = TypeId ("ns3::QueueDisc")
131  .SetParent<Object> ()
132  .SetGroupName ("TrafficControl")
133  .AddAttribute ("Quota", "The maximum number of packets dequeued in a qdisc run",
137  MakeUintegerChecker<uint32_t> ())
138  .AddAttribute ("InternalQueueList", "The list of internal queues.",
141  MakeObjectVectorChecker<Queue> ())
142  .AddAttribute ("PacketFilterList", "The list of packet filters.",
145  MakeObjectVectorChecker<PacketFilter> ())
146  .AddAttribute ("QueueDiscClassList", "The list of queue disc classes.",
149  MakeObjectVectorChecker<QueueDiscClass> ())
150  .AddTraceSource ("Enqueue", "Enqueue a packet in the queue disc",
152  "ns3::QueueItem::TracedCallback")
153  .AddTraceSource ("Dequeue", "Dequeue a packet from the queue disc",
155  "ns3::QueueItem::TracedCallback")
156  .AddTraceSource ("Requeue", "Requeue a packet in the queue disc",
158  "ns3::QueueItem::TracedCallback")
159  .AddTraceSource ("Drop", "Drop a packet stored in the queue disc",
161  "ns3::QueueItem::TracedCallback")
162  .AddTraceSource ("PacketsInQueue",
163  "Number of packets currently stored in the queue disc",
165  "ns3::TracedValueCallback::Uint32")
166  .AddTraceSource ("BytesInQueue",
167  "Number of bytes currently stored in the queue disc",
169  "ns3::TracedValueCallback::Uint32")
170  ;
171  return tid;
172 }
173 
175  : m_nPackets (0),
176  m_nBytes (0),
177  m_nTotalReceivedPackets (0),
178  m_nTotalReceivedBytes (0),
179  m_nTotalDroppedPackets (0),
180  m_nTotalDroppedBytes (0),
181  m_nTotalRequeuedPackets (0),
182  m_nTotalRequeuedBytes (0),
183  m_running (false)
184 {
185  NS_LOG_FUNCTION (this);
186 }
187 
188 void
190 {
191  NS_LOG_FUNCTION (this);
192  m_queues.clear ();
193  m_filters.clear ();
194  m_classes.clear ();
195  m_device = 0;
196  m_devQueueIface = 0;
197  m_requeued = 0;
199 }
200 
201 void
203 {
204  NS_LOG_FUNCTION (this);
205  // When adding a new interface, the traffic control aggregates
206  // a NetDeviceQueueInterface object to the netdevice
207  if (m_device)
208  {
210  }
211 
212  // Check the configuration and initialize the parameters of this queue disc
213  bool ok = CheckConfig ();
214  NS_ASSERT_MSG (ok, "The queue disc configuration is not correct");
215  NS_UNUSED (ok); // suppress compiler warning
216  InitializeParams ();
217 
218  // Check the configuration and initialize the parameters of the child queue discs
219  for (std::vector<Ptr<QueueDiscClass> >::iterator cl = m_classes.begin ();
220  cl != m_classes.end (); cl++)
221  {
222  (*cl)->GetQueueDisc ()->Initialize ();
223  }
224 
226 }
227 
228 uint32_t
230 {
231  NS_LOG_FUNCTION (this);
232  return m_nPackets;
233 }
234 
235 uint32_t
237 {
238  NS_LOG_FUNCTION (this);
239  return m_nBytes;
240 }
241 
242 uint32_t
244 {
245  NS_LOG_FUNCTION (this);
247 }
248 
249 uint32_t
251 {
252  NS_LOG_FUNCTION (this);
253  return m_nTotalReceivedBytes;
254 }
255 
256 uint32_t
258 {
259  NS_LOG_FUNCTION (this);
260  return m_nTotalDroppedPackets;
261 }
262 
263 uint32_t
265 {
266  NS_LOG_FUNCTION (this);
267  return m_nTotalDroppedBytes;
268 }
269 
270 uint32_t
272 {
273  NS_LOG_FUNCTION (this);
275 }
276 
277 uint32_t
279 {
280  NS_LOG_FUNCTION (this);
281  return m_nTotalRequeuedBytes;
282 }
283 
284 void
286 {
287  NS_LOG_FUNCTION (this << device);
288  m_device = device;
289 }
290 
293 {
294  NS_LOG_FUNCTION (this);
295  return m_device;
296 }
297 
298 void
299 QueueDisc::SetQuota (const uint32_t quota)
300 {
301  NS_LOG_FUNCTION (this << quota);
302  m_quota = quota;
303 }
304 
305 uint32_t
307 {
308  NS_LOG_FUNCTION (this);
309  return m_quota;
310 }
311 
312 void
314 {
315  NS_LOG_FUNCTION (this);
316  // set the drop callback on the internal queue, so that the queue disc is
317  // notified of packets dropped by the internal queue
318  queue->SetDropCallback (MakeCallback (&QueueDisc::Drop, this));
319  m_queues.push_back (queue);
320 }
321 
323 QueueDisc::GetInternalQueue (uint32_t i) const
324 {
325  NS_ASSERT (i < m_queues.size ());
326  return m_queues[i];
327 }
328 
329 uint32_t
331 {
332  return m_queues.size ();
333 }
334 
335 void
337 {
338  NS_LOG_FUNCTION (this);
339  m_filters.push_back (filter);
340 }
341 
343 QueueDisc::GetPacketFilter (uint32_t i) const
344 {
345  NS_ASSERT (i < m_filters.size ());
346  return m_filters[i];
347 }
348 
349 uint32_t
351 {
352  return m_filters.size ();
353 }
354 
355 void
357 {
358  NS_LOG_FUNCTION (this);
359  NS_ABORT_MSG_IF (qdClass->GetQueueDisc () == 0, "Cannot add a class with no attached queue disc");
360  // the child queue disc cannot be one with wake mode equal to WAKE_CHILD because
361  // such queue discs do not implement the enqueue/dequeue methods
362  NS_ABORT_MSG_IF (qdClass->GetQueueDisc ()->GetWakeMode () == WAKE_CHILD,
363  "A queue disc with WAKE_CHILD as wake mode can only be a root queue disc");
364  // set the parent drop callback on the child queue disc, so that it can notify
365  // packet drops to the parent queue disc
366  qdClass->GetQueueDisc ()->SetParentDropCallback (MakeCallback (&QueueDisc::Drop, this));
367  m_classes.push_back (qdClass);
368 }
369 
372 {
373  NS_ASSERT (i < m_classes.size ());
374  return m_classes[i];
375 }
376 
377 uint32_t
379 {
380  return m_classes.size ();
381 }
382 
383 int32_t
385 {
386  NS_LOG_FUNCTION (this << item);
387 
388  int32_t ret = PacketFilter::PF_NO_MATCH;
389  for (std::vector<Ptr<PacketFilter> >::iterator f = m_filters.begin ();
390  f != m_filters.end () && ret == PacketFilter::PF_NO_MATCH; f++)
391  {
392  ret = (*f)->Classify (item);
393  }
394  return ret;
395 }
396 
399 {
400  return WAKE_ROOT;
401 }
402 
403 void
405 {
407 }
408 
409 void
411 {
412  NS_LOG_FUNCTION (this << item);
413 
414  // if the wake mode of this queue disc is WAKE_CHILD, packets are directly
415  // enqueued/dequeued from the child queue discs, thus this queue disc does not
416  // keep valid packets/bytes counters and no actions need to be performed.
417  if (this->GetWakeMode () == WAKE_CHILD)
418  {
419  return;
420  }
421 
422  NS_ASSERT_MSG (m_nPackets >= 1u, "No packet in the queue disc, cannot drop");
423  NS_ASSERT_MSG (m_nBytes >= item->GetPacketSize (), "The size of the packet that"
424  << " is reported to be dropped is greater than the amount of bytes"
425  << "stored in the queue disc");
426 
427  m_nPackets--;
428  m_nBytes -= item->GetPacketSize ();
430  m_nTotalDroppedBytes += item->GetPacketSize ();
431 
432  NS_LOG_LOGIC ("m_traceDrop (p)");
433  m_traceDrop (item);
434 
435  NotifyParentDrop (item);
436 }
437 
438 void
440 {
441  NS_LOG_FUNCTION (this << item);
442  // the parent drop callback is clearly null on root queue discs
444  {
445  m_parentDropCallback (item);
446  }
447 }
448 
449 bool
451 {
452  NS_LOG_FUNCTION (this << item);
453 
454  m_nPackets++;
455  m_nBytes += item->GetPacketSize ();
457  m_nTotalReceivedBytes += item->GetPacketSize ();
458 
459  NS_LOG_LOGIC ("m_traceEnqueue (p)");
460  m_traceEnqueue (item);
461 
462  return DoEnqueue (item);
463 }
464 
467 {
468  NS_LOG_FUNCTION (this);
469 
470  Ptr<QueueDiscItem> item;
471  item = DoDequeue ();
472 
473  if (item != 0)
474  {
475  m_nPackets--;
476  m_nBytes -= item->GetPacketSize ();
477 
478  NS_LOG_LOGIC ("m_traceDequeue (p)");
479  m_traceDequeue (item);
480  }
481 
482  return item;
483 }
484 
486 QueueDisc::Peek (void) const
487 {
488  NS_LOG_FUNCTION (this);
489  return DoPeek ();
490 }
491 
492 void
494 {
495  NS_LOG_FUNCTION (this);
496 
497  if (RunBegin ())
498  {
499  uint32_t quota = m_quota;
500  while (Restart ())
501  {
502  quota -= 1;
503  if (quota <= 0)
504  {
506  break;
507  }
508  }
509  RunEnd ();
510  }
511 }
512 
513 bool
515 {
516  NS_LOG_FUNCTION (this);
517  if (m_running)
518  {
519  return false;
520  }
521 
522  m_running = true;
523  return true;
524 }
525 
526 void
528 {
529  NS_LOG_FUNCTION (this);
530  m_running = false;
531 }
532 
533 bool
535 {
536  NS_LOG_FUNCTION (this);
538  if (item == 0)
539  {
540  NS_LOG_LOGIC ("No packet to send");
541  return false;
542  }
543 
544  return Transmit (item);
545 }
546 
549 {
550  NS_LOG_FUNCTION (this);
552  Ptr<QueueDiscItem> item;
553 
554  // First check if there is a requeued packet
555  if (m_requeued != 0)
556  {
557  // If the queue where the requeued packet is destined to is not stopped, return
558  // the requeued packet; otherwise, return an empty packet.
559  // If the device does not support flow control, the device queue is never stopped
560  if (!m_devQueueIface->GetTxQueue (m_requeued->GetTxQueueIndex ())->IsStopped ())
561  {
562  item = m_requeued;
563  m_requeued = 0;
564 
565  m_nPackets--;
566  m_nBytes -= item->GetPacketSize ();
567 
568  NS_LOG_LOGIC ("m_traceDequeue (p)");
569  m_traceDequeue (item);
570  }
571  }
572  else
573  {
574  // If the device is multi-queue (actually, Linux checks if the queue disc has
575  // multiple queues), ask the queue disc to dequeue a packet (a multi-queue aware
576  // queue disc should try not to dequeue a packet destined to a stopped queue).
577  // Otherwise, ask the queue disc to dequeue a packet only if the (unique) queue
578  // is not stopped.
579  if (m_devQueueIface->GetTxQueuesN ()>1 || !m_devQueueIface->GetTxQueue (0)->IsStopped ())
580  {
581  item = Dequeue ();
582  // If the item is not null, add the header to the packet.
583  if (item != 0)
584  {
585  item->AddHeader ();
586  }
587  // Here, Linux tries bulk dequeues
588  }
589  }
590  return item;
591 }
592 
593 void
595 {
596  NS_LOG_FUNCTION (this << item);
597  m_requeued = item;
599 
600  m_nPackets++; // it's still part of the queue
601  m_nBytes += item->GetPacketSize ();
603  m_nTotalRequeuedBytes += item->GetPacketSize ();
604 
605  NS_LOG_LOGIC ("m_traceRequeue (p)");
606  m_traceRequeue (item);
607 }
608 
609 bool
611 {
612  NS_LOG_FUNCTION (this << item);
614 
615  // if the device queue is stopped, requeue the packet and return false.
616  // Note that if the underlying device is tc-unaware, packets are never
617  // requeued because the queues of tc-unaware devices are never stopped
618  if (m_devQueueIface->GetTxQueue (item->GetTxQueueIndex ())->IsStopped ())
619  {
620  Requeue (item);
621  return false;
622  }
623 
624  m_device->Send (item->GetPacket (), item->GetAddress (), item->GetProtocol ());
625 
626  // the behavior here slightly diverges from Linux. In Linux, it is advised that
627  // the function called when a packet needs to be transmitted (ndo_start_xmit)
628  // should always return NETDEV_TX_OK, which means that the packet is consumed by
629  // the device driver and thus is not requeued. However, the ndo_start_xmit function
630  // of the device driver is allowed to return NETDEV_TX_BUSY (and hence the packet
631  // is requeued) when there is no room for the received packet in the device queue,
632  // despite the queue is not stopped. This case is considered as a corner case or
633  // an hard error, and should be avoided.
634  // Here, we do not handle such corner case and always assume that the packet is
635  // consumed by the netdevice. Thus, we ignore the value returned by Send and a
636  // packet sent to a netdevice is never requeued. The reason is that the semantics
637  // of the value returned by NetDevice::Send does not match that of the value
638  // returned by ndo_start_xmit.
639 
640  // if the queue disc is empty or the device queue is now stopped, return false so
641  // that the Run method does not attempt to dequeue other packets and exits
642  if (GetNPackets () == 0 || m_devQueueIface->GetTxQueue (item->GetTxQueueIndex ())->IsStopped ())
643  {
644  return false;
645  }
646 
647  return true;
648 }
649 
650 } // namespace ns3
uint8_t GetTxQueueIndex(void) const
Get the transmission queue index included in this item.
Definition: queue-disc.cc:59
TracedCallback< Ptr< const QueueItem > > m_traceRequeue
Traced callback: fired when a packet is requeued.
Definition: queue-disc.h:561
virtual void DoInitialize(void)
Initialize() implementation.
Definition: object.cc:347
uint32_t GetNQueueDiscClasses(void) const
Get the number of queue disc classes.
Definition: queue-disc.cc:378
Base class to represent items of packet Queues.
Definition: net-device.h:55
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Ptr< QueueDiscItem > m_requeued
The last packet that failed to be transmitted.
Definition: queue-disc.h:553
uint32_t GetTotalReceivedPackets(void) const
Get the total number of received packets.
Definition: queue-disc.cc:243
void AddQueueDiscClass(Ptr< QueueDiscClass > qdClass)
Add a queue disc class to the tail of the list of classes.
Definition: queue-disc.cc:356
static const int PF_NO_MATCH
Standard value used by packet filters to indicate that no match was possible.
Definition: packet-filter.h:48
bool Enqueue(Ptr< QueueDiscItem > item)
Pass a packet to store to the queue discipline.
Definition: queue-disc.cc:450
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:44
Ptr< Queue > GetInternalQueue(uint32_t i) const
Get the i-th internal queue.
Definition: queue-disc.cc:323
virtual ~QueueDiscItem()
Definition: queue-disc.cc:41
uint32_t GetNBytes(void) const
Get the amount of bytes stored by the queue disc.
Definition: queue-disc.cc:236
uint32_t GetTotalRequeuedPackets(void) const
Get the total number of requeued packets.
Definition: queue-disc.cc:271
uint8_t m_txq
Transmission queue index.
Definition: queue-disc.h:117
Ptr< QueueDisc > m_queueDisc
Queue disc attached to this class.
Definition: queue-disc.h:159
virtual void DoDispose(void)
Dispose of the object.
Definition: queue-disc.cc:103
void SetQueueDisc(Ptr< QueueDisc > qd)
Set the queue disc attached to this class.
Definition: queue-disc.cc:118
void SetTxQueueIndex(uint8_t txq)
Set the transmission queue index to store in this item.
Definition: queue-disc.cc:65
TracedCallback< Ptr< const QueueItem > > m_traceEnqueue
Traced callback: fired when a packet is enqueued.
Definition: queue-disc.h:557
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1270
Ptr< const AttributeAccessor > MakeObjectVectorAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
Definition: object-vector.h:81
#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
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
uint32_t m_nTotalReceivedPackets
Total received packets.
Definition: queue-disc.h:543
virtual Ptr< QueueDiscItem > DoDequeue(void)=0
This function actually extracts a packet from the queue disc.
#define NS_UNUSED(x)
Mark a local variable as unused.
Definition: unused.h:36
virtual void DoDispose(void)
Destructor implementation.
Definition: object.cc:340
QueueDisc is an abstract base class providing the interface and implementing the operations common to...
Definition: queue-disc.h:205
Address GetAddress(void) const
Get the MAC address included in this item.
Definition: queue-disc.cc:47
void NotifyParentDrop(Ptr< QueueItem > item)
Notify the parent queue disc of a packet drop.
Definition: queue-disc.cc:439
a polymophic address class
Definition: address.h:90
ParentDropCallback m_parentDropCallback
Parent drop callback.
Definition: queue-disc.h:554
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
uint32_t GetTotalReceivedBytes(void) const
Get the total amount of received bytes.
Definition: queue-disc.cc:250
std::vector< Ptr< Queue > > m_queues
Internal queues.
Definition: queue-disc.h:536
uint32_t GetNInternalQueues(void) const
Get the number of internal queues.
Definition: queue-disc.cc:330
void Drop(Ptr< QueueItem > item)
Drop a packet.
Definition: queue-disc.cc:410
virtual void DoInitialize(void)
Check whether the configuration is correct and initialize parameters.
Definition: queue-disc.cc:202
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: pointer.h:220
Ptr< NetDeviceQueueInterface > m_devQueueIface
NetDevice queue interface.
Definition: queue-disc.h:551
Hold an unsigned integer type.
Definition: uinteger.h:44
uint16_t m_protocol
L3 Protocol number.
Definition: queue-disc.h:116
QueueDiscItem()
Default constructor.
void AddInternalQueue(Ptr< Queue > queue)
Add an internal queue to the tail of the list of queues.
Definition: queue-disc.cc:313
uint32_t m_nTotalReceivedBytes
Total received bytes.
Definition: queue-disc.h:544
void Run(void)
Modelled after the Linux function __qdisc_run (net/sched/sch_generic.c) Dequeues multiple packets...
Definition: queue-disc.cc:493
Ptr< PacketFilter > GetPacketFilter(uint32_t i) const
Get the i-th packet filter.
Definition: queue-disc.cc:343
uint32_t m_nTotalDroppedBytes
Total dropped bytes.
Definition: queue-disc.h:546
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1489
virtual bool DoEnqueue(Ptr< QueueDiscItem > item)=0
This function actually enqueues a packet into the queue disc.
bool Transmit(Ptr< QueueDiscItem > item)
Modelled after the Linux function sch_direct_xmit (net/sched/sch_generic.c) Sends a packet to the dev...
Definition: queue-disc.cc:610
TracedCallback< Ptr< const QueueItem > > m_traceDequeue
Traced callback: fired when a packet is dequeued.
Definition: queue-disc.h:559
Ptr< QueueDisc > GetQueueDisc(void) const
Get the queue disc attached to this class.
Definition: queue-disc.cc:111
int32_t Classify(Ptr< QueueDiscItem > item)
Classify a packet by calling the packet filters, one at a time, until either a filter able to classif...
Definition: queue-disc.cc:384
Network device transmission queue interface.
Definition: net-device.h:219
virtual void DoDispose(void)
Dispose of the object.
Definition: queue-disc.cc:189
uint32_t GetNPacketFilters(void) const
Get the number of packet filters.
Definition: queue-disc.cc:350
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:252
TracedCallback< Ptr< const QueueItem > > m_traceDrop
Traced callback: fired when a packet is dropped.
Definition: queue-disc.h:563
QueueDiscClass is the base class for classes that are included in a queue disc.
Definition: queue-disc.h:130
static const uint32_t DEFAULT_QUOTA
Default quota (as in /proc/sys/net/core/dev_weight)
Definition: queue-disc.h:534
Ptr< QueueDiscItem > Dequeue(void)
Request the queue discipline to extract a packet.
Definition: queue-disc.cc:466
uint32_t m_nTotalRequeuedBytes
Total requeued bytes.
Definition: queue-disc.h:548
double f(double x, void *params)
Definition: 80211b.c:60
Hold objects of type Ptr<T>.
Definition: pointer.h:36
uint32_t GetTotalDroppedPackets(void) const
Get the total number of dropped packets.
Definition: queue-disc.cc:257
WakeMode GetWakeMode(void)
When setting up the wake callbacks on the netdevice queues, it is necessary to determine which queue ...
Definition: queue-disc.cc:398
uint32_t m_quota
Maximum number of packets dequeued in a qdisc run.
Definition: queue-disc.h:549
uint32_t GetTotalDroppedBytes(void) const
Get the total amount of dropped bytes.
Definition: queue-disc.cc:264
bool RunBegin(void)
Modelled after the Linux function qdisc_run_begin (include/net/sch_generic.h).
Definition: queue-disc.cc:514
bool m_running
The queue disc is performing multiple dequeue operations.
Definition: queue-disc.h:552
virtual void Print(std::ostream &os) const
Print the item contents.
Definition: queue-disc.cc:71
virtual uint32_t GetQuota(void) const
Get the maximum number of dequeue operations following a packet enqueue.
Definition: queue-disc.cc:306
virtual bool CheckConfig(void)=0
Check whether the current configuration is correct.
TracedValue< uint32_t > m_nBytes
Number of bytes in the queue.
Definition: queue-disc.h:541
void Requeue(Ptr< QueueDiscItem > item)
Modelled after the Linux function dev_requeue_skb (net/sched/sch_generic.c) Requeues a packet whose t...
Definition: queue-disc.cc:594
#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:90
TracedValue< uint32_t > m_nPackets
Number of packets in the queue.
Definition: queue-disc.h:540
std::vector< Ptr< PacketFilter > > m_filters
Packet filters.
Definition: queue-disc.h:537
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
Ptr< NetDevice > m_device
The NetDevice on which this queue discipline is installed.
Definition: queue-disc.h:550
virtual void SetQuota(const uint32_t quota)
Set the maximum number of dequeue operations following a packet enqueue.
Definition: queue-disc.cc:299
uint32_t GetTotalRequeuedBytes(void) const
Get the total amount of requeued bytes.
Definition: queue-disc.cc:278
void AddPacketFilter(Ptr< PacketFilter > filter)
Add a packet filter to the tail of the list of filters used to classify packets.
Definition: queue-disc.cc:336
WakeMode
Used to determine whether the queue disc itself or its children must be activated when a netdevice wa...
Definition: queue-disc.h:405
virtual void InitializeParams(void)=0
Initialize parameters (if any) before the first packet is enqueued.
virtual void SetParentDropCallback(ParentDropCallback cb)
Set the parent drop callback.
Definition: queue-disc.cc:404
static TypeId GetTypeId(void)
Get the type ID.
Definition: queue-disc.cc:128
uint16_t GetProtocol(void) const
Get the L3 protocol included in this item.
Definition: queue-disc.cc:53
A base class which provides memory management and object aggregation.
Definition: object.h:87
Container for a set of ns3::Object pointers.
virtual Ptr< const QueueDiscItem > DoPeek(void) const =0
This function returns a copy of the next packet the queue disc will extract.
bool Restart(void)
Modelled after the Linux function qdisc_restart (net/sched/sch_generic.c) Dequeue a packet (by callin...
Definition: queue-disc.cc:534
Address m_address
MAC destination address.
Definition: queue-disc.h:115
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: uinteger.h:45
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:827
Ptr< QueueDiscItem > DequeuePacket(void)
Modelled after the Linux function dequeue_skb (net/sched/sch_generic.c)
Definition: queue-disc.cc:548
Ptr< NetDevice > GetNetDevice(void) const
Get the NetDevice on which this queue discipline is installed.
Definition: queue-disc.cc:292
static TypeId GetTypeId(void)
Get the type ID.
Definition: queue-disc.cc:83
uint32_t m_nTotalRequeuedPackets
Total requeued packets.
Definition: queue-disc.h:547
Ptr< const QueueDiscItem > Peek(void) const
Get a copy of the next packet the queue discipline will extract, without actually extracting the pack...
Definition: queue-disc.cc:486
uint32_t m_nTotalDroppedPackets
Total dropped packets.
Definition: queue-disc.h:545
void SetNetDevice(Ptr< NetDevice > device)
Set the NetDevice on which this queue discipline is installed.
Definition: queue-disc.cc:285
Ptr< QueueDiscClass > GetQueueDiscClass(uint32_t i) const
Get the i-th queue disc class.
Definition: queue-disc.cc:371
void RunEnd(void)
Modelled after the Linux function qdisc_run_end (include/net/sch_generic.h).
Definition: queue-disc.cc:527
std::vector< Ptr< QueueDiscClass > > m_classes
Classes.
Definition: queue-disc.h:538
uint32_t GetNPackets(void) const
Get the number of packets stored by the queue disc.
Definition: queue-disc.cc:229
Ptr< Packet > GetPacket(void) const
Definition: net-device.cc:44