A Discrete-Event Network Simulator
API
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  m_queueDisc = qd;
122 }
123 
124 
126 
128 {
129  static TypeId tid = TypeId ("ns3::QueueDisc")
130  .SetParent<Object> ()
131  .SetGroupName ("TrafficControl")
132  .AddAttribute ("Quota", "The maximum number of packets dequeued in a qdisc run",
136  MakeUintegerChecker<uint32_t> ())
137  .AddAttribute ("InternalQueueList", "The list of internal queues.",
140  MakeObjectVectorChecker<Queue> ())
141  .AddAttribute ("PacketFilterList", "The list of packet filters.",
144  MakeObjectVectorChecker<PacketFilter> ())
145  .AddAttribute ("QueueDiscClassList", "The list of queue disc classes.",
148  MakeObjectVectorChecker<QueueDiscClass> ())
149  .AddTraceSource ("Enqueue", "Enqueue a packet in the queue disc",
151  "ns3::QueueItem::TracedCallback")
152  .AddTraceSource ("Dequeue", "Dequeue a packet from the queue disc",
154  "ns3::QueueItem::TracedCallback")
155  .AddTraceSource ("Requeue", "Requeue a packet in the queue disc",
157  "ns3::QueueItem::TracedCallback")
158  .AddTraceSource ("Drop", "Drop a packet stored in the queue disc",
160  "ns3::QueueItem::TracedCallback")
161  .AddTraceSource ("PacketsInQueue",
162  "Number of packets currently stored in the queue disc",
164  "ns3::TracedValueCallback::Uint32")
165  .AddTraceSource ("BytesInQueue",
166  "Number of bytes currently stored in the queue disc",
168  "ns3::TracedValueCallback::Uint32")
169  ;
170  return tid;
171 }
172 
174  : m_nPackets (0),
175  m_nBytes (0),
176  m_nTotalReceivedPackets (0),
177  m_nTotalReceivedBytes (0),
178  m_nTotalDroppedPackets (0),
179  m_nTotalDroppedBytes (0),
180  m_nTotalRequeuedPackets (0),
181  m_nTotalRequeuedBytes (0),
182  m_running (false)
183 {
184  NS_LOG_FUNCTION (this);
185 }
186 
187 void
189 {
190  NS_LOG_FUNCTION (this);
191  m_queues.clear ();
192  m_filters.clear ();
193  m_classes.clear ();
194  m_device = 0;
195  m_devQueueIface = 0;
196  m_requeued = 0;
198 }
199 
200 void
202 {
203  NS_LOG_FUNCTION (this);
204  // When adding a new interface, the traffic control aggregates
205  // a NetDeviceQueueInterface object to the netdevice
206  if (m_device)
207  {
209  }
210 
211  // Check the configuration and initialize the parameters of this queue disc
212  bool ok = CheckConfig ();
213  NS_ASSERT_MSG (ok, "The queue disc configuration is not correct");
214  NS_UNUSED (ok); // suppress compiler warning
215  InitializeParams ();
216 
217  // Check the configuration and initialize the parameters of the child queue discs
218  for (std::vector<Ptr<QueueDiscClass> >::iterator cl = m_classes.begin ();
219  cl != m_classes.end (); cl++)
220  {
221  (*cl)->GetQueueDisc ()->Initialize ();
222  }
223 
225 }
226 
227 uint32_t
229 {
230  NS_LOG_FUNCTION (this);
231  return m_nPackets;
232 }
233 
234 uint32_t
236 {
237  NS_LOG_FUNCTION (this);
238  return m_nBytes;
239 }
240 
241 uint32_t
243 {
244  NS_LOG_FUNCTION (this);
246 }
247 
248 uint32_t
250 {
251  NS_LOG_FUNCTION (this);
252  return m_nTotalReceivedBytes;
253 }
254 
255 uint32_t
257 {
258  NS_LOG_FUNCTION (this);
259  return m_nTotalDroppedPackets;
260 }
261 
262 uint32_t
264 {
265  NS_LOG_FUNCTION (this);
266  return m_nTotalDroppedBytes;
267 }
268 
269 uint32_t
271 {
272  NS_LOG_FUNCTION (this);
274 }
275 
276 uint32_t
278 {
279  NS_LOG_FUNCTION (this);
280  return m_nTotalRequeuedBytes;
281 }
282 
283 void
285 {
286  NS_LOG_FUNCTION (this << device);
287  m_device = device;
288 }
289 
292 {
293  NS_LOG_FUNCTION (this);
294  return m_device;
295 }
296 
297 void
298 QueueDisc::SetQuota (const uint32_t quota)
299 {
300  NS_LOG_FUNCTION (this << quota);
301  m_quota = quota;
302 }
303 
304 uint32_t
306 {
307  NS_LOG_FUNCTION (this);
308  return m_quota;
309 }
310 
311 void
313 {
314  NS_LOG_FUNCTION (this);
315  m_queues.push_back (queue);
316 }
317 
319 QueueDisc::GetInternalQueue (uint32_t i) const
320 {
321  NS_ASSERT (i < m_queues.size ());
322  return m_queues[i];
323 }
324 
325 uint32_t
327 {
328  return m_queues.size ();
329 }
330 
331 void
333 {
334  NS_LOG_FUNCTION (this);
335  m_filters.push_back (filter);
336 }
337 
339 QueueDisc::GetPacketFilter (uint32_t i) const
340 {
341  NS_ASSERT (i < m_filters.size ());
342  return m_filters[i];
343 }
344 
345 uint32_t
347 {
348  return m_filters.size ();
349 }
350 
351 void
353 {
354  NS_LOG_FUNCTION (this);
355  NS_ABORT_MSG_IF (qdClass->GetQueueDisc () == 0, "Cannot add a class with no attached queue disc");
356  m_classes.push_back (qdClass);
357 }
358 
361 {
362  NS_ASSERT (i < m_classes.size ());
363  return m_classes[i];
364 }
365 
366 uint32_t
368 {
369  return m_classes.size ();
370 }
371 
372 int32_t
374 {
375  NS_LOG_FUNCTION (this << item);
376 
377  int32_t ret = PacketFilter::PF_NO_MATCH;
378  for (std::vector<Ptr<PacketFilter> >::iterator f = m_filters.begin ();
379  f != m_filters.end () && ret == PacketFilter::PF_NO_MATCH; f++)
380  {
381  ret = (*f)->Classify (item);
382  }
383  return ret;
384 }
385 
388 {
389  return WAKE_ROOT;
390 }
391 
392 void
394 {
395  NS_LOG_FUNCTION (this << item);
396  NS_ASSERT_MSG (m_nPackets >= 1u, "No packet in the queue disc, cannot drop");
397  NS_ASSERT_MSG (m_nBytes >= item->GetPacketSize (), "The size of the packet that"
398  << " is reported to be dropped is greater than the amount of bytes"
399  << "stored in the queue disc");
400 
401  m_nPackets--;
402  m_nBytes -= item->GetPacketSize ();
404  m_nTotalDroppedBytes += item->GetPacketSize ();
405 
406  NS_LOG_LOGIC ("m_traceDrop (p)");
407  m_traceDrop (item);
408 }
409 
410 bool
412 {
413  NS_LOG_FUNCTION (this << item);
414 
415  m_nPackets++;
416  m_nBytes += item->GetPacketSize ();
418  m_nTotalReceivedBytes += item->GetPacketSize ();
419 
420  NS_LOG_LOGIC ("m_traceEnqueue (p)");
421  m_traceEnqueue (item);
422 
423  return DoEnqueue (item);
424 }
425 
428 {
429  NS_LOG_FUNCTION (this);
430 
431  Ptr<QueueDiscItem> item;
432  item = DoDequeue ();
433 
434  if (item != 0)
435  {
436  m_nPackets--;
437  m_nBytes -= item->GetPacketSize ();
438 
439  NS_LOG_LOGIC ("m_traceDequeue (p)");
440  m_traceDequeue (item);
441  }
442 
443  return item;
444 }
445 
447 QueueDisc::Peek (void) const
448 {
449  NS_LOG_FUNCTION (this);
450  return DoPeek ();
451 }
452 
453 void
455 {
456  NS_LOG_FUNCTION (this);
457 
458  if (RunBegin ())
459  {
460  uint32_t quota = m_quota;
461  while (Restart ())
462  {
463  quota -= 1;
464  if (quota <= 0)
465  {
467  break;
468  }
469  }
470  RunEnd ();
471  }
472 }
473 
474 bool
476 {
477  NS_LOG_FUNCTION (this);
478  if (m_running)
479  {
480  return false;
481  }
482 
483  m_running = true;
484  return true;
485 }
486 
487 void
489 {
490  NS_LOG_FUNCTION (this);
491  m_running = false;
492 }
493 
494 bool
496 {
497  NS_LOG_FUNCTION (this);
499  if (item == 0)
500  {
501  NS_LOG_LOGIC ("No packet to send");
502  return false;
503  }
504 
505  return Transmit (item);
506 }
507 
510 {
511  NS_LOG_FUNCTION (this);
513  Ptr<QueueDiscItem> item;
514 
515  // First check if there is a requeued packet
516  if (m_requeued != 0)
517  {
518  // If the queue where the requeued packet is destined to is not stopped, return
519  // the requeued packet; otherwise, return an empty packet.
520  // If the device does not support flow control, the device queue is never stopped
521  if (!m_devQueueIface->GetTxQueue (m_requeued->GetTxQueueIndex ())->IsStopped ())
522  {
523  item = m_requeued;
524  m_requeued = 0;
525 
526  m_nPackets--;
527  m_nBytes -= item->GetPacketSize ();
528 
529  NS_LOG_LOGIC ("m_traceDequeue (p)");
530  m_traceDequeue (item);
531  }
532  }
533  else
534  {
535  // If the device is multi-queue (actually, Linux checks if the queue disc has
536  // multiple queues), ask the queue disc to dequeue a packet (a multi-queue aware
537  // queue disc should try not to dequeue a packet destined to a stopped queue).
538  // Otherwise, ask the queue disc to dequeue a packet only if the (unique) queue
539  // is not stopped.
540  if (m_devQueueIface->GetTxQueuesN ()>1 || !m_devQueueIface->GetTxQueue (0)->IsStopped ())
541  {
542  item = Dequeue ();
543  // If the item is not null, add the header to the packet.
544  if (item != 0)
545  {
546  item->AddHeader ();
547  }
548  // Here, Linux tries bulk dequeues
549  }
550  }
551  return item;
552 }
553 
554 void
556 {
557  NS_LOG_FUNCTION (this << item);
558  m_requeued = item;
560 
561  m_nPackets++; // it's still part of the queue
562  m_nBytes += item->GetPacketSize ();
564  m_nTotalRequeuedBytes += item->GetPacketSize ();
565 
566  NS_LOG_LOGIC ("m_traceRequeue (p)");
567  m_traceRequeue (item);
568 }
569 
570 bool
572 {
573  NS_LOG_FUNCTION (this << item);
575  bool ret = false;
576 
577  if (!m_devQueueIface->GetTxQueue (item->GetTxQueueIndex ())->IsStopped ())
578  {
579  // send a copy of the packet because the device might add the
580  // MAC header even if the transmission is unsuccessful (see BUG 2284)
581  Ptr<Packet> copy = item->GetPacket ()->Copy ();
582  ret = m_device->Send (copy, item->GetAddress (), item->GetProtocol ());
583  }
584 
585  // If the transmission did not happen or failed, requeue the item
586  if (!ret)
587  {
588  Requeue (item);
589  }
590 
591  // If the transmission succeeded but now the queue is stopped, return false
592  if (ret && m_devQueueIface->GetTxQueue (item->GetTxQueueIndex ())->IsStopped ())
593  {
594  ret = false;
595  }
596 
597  return ret;
598 }
599 
600 } // 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:542
virtual void DoInitialize(void)
Initialize() implementation.
Definition: object.cc:346
uint32_t GetNQueueDiscClasses(void) const
Get the number of queue disc classes.
Definition: queue-disc.cc:367
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:535
uint32_t GetTotalReceivedPackets(void) const
Get the total number of received packets.
Definition: queue-disc.cc:242
void AddQueueDiscClass(Ptr< QueueDiscClass > qdClass)
Add a queue disc class to the tail of the list of classes.
Definition: queue-disc.cc:352
static const int PF_NO_MATCH
Definition: packet-filter.h:45
bool Enqueue(Ptr< QueueDiscItem > item)
Pass a packet to store to the queue discipline.
Definition: queue-disc.cc:411
#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:319
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:235
uint32_t GetTotalRequeuedPackets(void) const
Get the total number of requeued packets.
Definition: queue-disc.cc:270
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:538
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:525
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:339
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
bool Transmit(Ptr< QueueDiscItem > p)
Modelled after the Linux function sch_direct_xmit (net/sched/sch_generic.c) Sends a packet to the dev...
Definition: queue-disc.cc:571
a polymophic address class
Definition: address.h:90
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:249
std::vector< Ptr< Queue > > m_queues
Internal queues.
Definition: queue-disc.h:518
uint32_t GetNInternalQueues(void) const
Get the number of internal queues.
Definition: queue-disc.cc:326
virtual void DoInitialize(void)
Check whether the configuration is correct and initialize parameters.
Definition: queue-disc.cc:201
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:533
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:312
uint32_t m_nTotalReceivedBytes
Total received bytes.
Definition: queue-disc.h:526
void Run(void)
Modelled after the Linux function __qdisc_run (net/sched/sch_generic.c) Dequeues multiple packets...
Definition: queue-disc.cc:454
Ptr< PacketFilter > GetPacketFilter(uint32_t i) const
Get the i-th packet filter.
Definition: queue-disc.cc:339
uint32_t m_nTotalDroppedBytes
Total dropped bytes.
Definition: queue-disc.h:528
virtual bool DoEnqueue(Ptr< QueueDiscItem > item)=0
This function actually enqueues a packet into the queue disc.
TracedCallback< Ptr< const QueueItem > > m_traceDequeue
Traced callback: fired when a packet is dequeued.
Definition: queue-disc.h:540
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:373
Network device transmission queue interface.
Definition: net-device.h:216
virtual void DoDispose(void)
Dispose of the object.
Definition: queue-disc.cc:188
uint32_t GetNPacketFilters(void) const
Get the number of packet filters.
Definition: queue-disc.cc:346
#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:544
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:516
Ptr< QueueDiscItem > Dequeue(void)
Request the queue discipline to extract a packet.
Definition: queue-disc.cc:427
uint32_t m_nTotalRequeuedBytes
Total requeued bytes.
Definition: queue-disc.h:530
double f(double x, void *params)
Definition: 80211b.c:60
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Hold objects of type Ptr.
Definition: pointer.h:36
uint32_t GetTotalDroppedPackets(void) const
Get the total number of dropped packets.
Definition: queue-disc.cc:256
WakeMode GetWakeMode(void)
When setting up the wake callbacks on the netdevice queues, it is necessary to determine which queue ...
Definition: queue-disc.cc:387
uint32_t m_quota
Maximum number of packets dequeued in a qdisc run.
Definition: queue-disc.h:531
uint32_t GetTotalDroppedBytes(void) const
Get the total amount of dropped bytes.
Definition: queue-disc.cc:263
bool RunBegin(void)
Modelled after the Linux function qdisc_run_begin (include/net/sch_generic.h).
Definition: queue-disc.cc:475
bool m_running
The queue disc is performing multiple dequeue operations.
Definition: queue-disc.h:534
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:305
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:523
#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
void Drop(Ptr< QueueDiscItem > item)
Drop a packet.
Definition: queue-disc.cc:393
TracedValue< uint32_t > m_nPackets
Number of packets in the queue.
Definition: queue-disc.h:522
void Requeue(Ptr< QueueDiscItem > p)
Modelled after the Linux function dev_requeue_skb (net/sched/sch_generic.c) Requeues a packet whose t...
Definition: queue-disc.cc:555
std::vector< Ptr< PacketFilter > > m_filters
Packet filters.
Definition: queue-disc.h:519
#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:532
virtual void SetQuota(const uint32_t quota)
Set the maximum number of dequeue operations following a packet enqueue.
Definition: queue-disc.cc:298
uint32_t GetTotalRequeuedBytes(void) const
Get the total amount of requeued bytes.
Definition: queue-disc.cc:277
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:332
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.
static TypeId GetTypeId(void)
Get the type ID.
Definition: queue-disc.cc:127
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:495
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:826
Ptr< QueueDiscItem > DequeuePacket(void)
Modelled after the Linux function dequeue_skb (net/sched/sch_generic.c)
Definition: queue-disc.cc:509
Ptr< NetDevice > GetNetDevice(void) const
Get the NetDevice on which this queue discipline is installed.
Definition: queue-disc.cc:291
static TypeId GetTypeId(void)
Get the type ID.
Definition: queue-disc.cc:83
uint32_t m_nTotalRequeuedPackets
Total requeued packets.
Definition: queue-disc.h:529
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:447
uint32_t m_nTotalDroppedPackets
Total dropped packets.
Definition: queue-disc.h:527
void SetNetDevice(Ptr< NetDevice > device)
Set the NetDevice on which this queue discipline is installed.
Definition: queue-disc.cc:284
Ptr< QueueDiscClass > GetQueueDiscClass(uint32_t i) const
Get the i-th queue disc class.
Definition: queue-disc.cc:360
void RunEnd(void)
Modelled after the Linux function qdisc_run_end (include/net/sch_generic.h).
Definition: queue-disc.cc:488
std::vector< Ptr< QueueDiscClass > > m_classes
Classes.
Definition: queue-disc.h:520
uint32_t GetNPackets(void) const
Get the number of packets stored by the queue disc.
Definition: queue-disc.cc:228
Ptr< Packet > GetPacket(void) const
Definition: net-device.cc:44