View | Details | Raw Unified | Return to bug 2751
Collapse All | Expand All

(-)a/src/traffic-control/model/queue-disc.cc (-44 / +30 lines)
 Lines 330-379   QueueDisc::QueueDisc () Link Here 
330
{
330
{
331
  NS_LOG_FUNCTION (this);
331
  NS_LOG_FUNCTION (this);
332
332
333
  using namespace std::placeholders;
333
  // These lambdas call the DropBeforeEnqueue or DropAfterDequeue methods of this
334
334
  // QueueDisc object. Given that a callback to the operator() of these lambdas
335
  // Remove ambiguity for overloaded member functions
335
  // is connected to the DropBeforeEnqueue and DropAfterDequeue traces of the
336
  typedef std::basic_string<char>& (std::basic_string<char>::*Function) (const char*);
336
  // internal queues, the INTERNAL_QUEUE_DROP constant is passed as the reason
337
337
  // why the packet is dropped.
338
  Function append = &std::basic_string<char>::append,
338
  m_internalQueueDbeFunctor = [this] (Ptr<const QueueDiscItem> item)
339
           assign = &std::basic_string<char>::assign;
339
    {
340
340
      return DropBeforeEnqueue (item, INTERNAL_QUEUE_DROP);
341
  // The operator() of these function objects calls the QueueDisc::DropBeforeEnqueue
341
    };
342
  // and QueueDisc::DropAfterDequeue methods of this QueueDisc object (these function
342
  m_internalQueueDadFunctor = [this] (Ptr<const QueueDiscItem> item)
343
  // objects are bound to this QueueDisc object), which require two arguments: a
343
    {
344
  // Ptr<const QueueDiscItem> and a const char*. Given that a callback to the operator()
344
      return DropAfterDequeue (item, INTERNAL_QUEUE_DROP);
345
  // is connected to the DropBeforeEnqueue and DropAfterDequeue traces of the Queue
345
    };
346
  // class, the first argument is provided by such traces, while the second argument
346
347
  // (the reason why the packet was dropped) is bound to the INTERNAL_QUEUE_DROP constant.
347
  // These lambdas call the DropBeforeEnqueue or DropAfterDequeue methods of this
348
  m_internalQueueDbeFunctor = std::bind (&QueueDisc::DropBeforeEnqueue, this,
348
  // QueueDisc object. Given that a callback to the operator() of these lambdas
349
                                         _1, (const char*)INTERNAL_QUEUE_DROP);
349
  // is connected to the DropBeforeEnqueue and DropAfterDequeue traces of the
350
  m_internalQueueDadFunctor = std::bind (&QueueDisc::DropAfterDequeue, this,
350
  // child queue discs, the concatenation of the CHILD_QUEUE_DISC_DROP constant
351
                                         _1, (const char*)INTERNAL_QUEUE_DROP);
351
  // and the second argument provided by such traces is passed as the reason why
352
352
  // the packet is dropped.
353
  // The operator() of these function objects calls the QueueDisc::DropBeforeEnqueue
353
  m_childQueueDiscDbeFunctor = [this] (Ptr<const QueueDiscItem> item, const char* r)
354
  // and QueueDisc::DropAfterDequeue methods of this QueueDisc object (these function
354
    {
355
  // objects are bound to this QueueDisc object), which require two arguments: a
355
      return DropBeforeEnqueue (item,
356
  // Ptr<const QueueDiscItem> and a const char*. Given that a callback to the operator()
356
                                m_childQueueDiscDropMsg.assign (CHILD_QUEUE_DISC_DROP).append (r).data ());
357
  // is connected to the DropBeforeEnqueue and DropAfterDequeue traces of the QueueDisc
357
    };
358
  // class, both arguments are provided by such traces. The first argument is provided
358
  m_childQueueDiscDadFunctor = [this] (Ptr<const QueueDiscItem> item, const char* r)
359
  // as is, while the second argument (the reason why the packet was dropped) is obtained
359
    {
360
  // by calling m_childQueueDiscDropMsg.assign (CHILD_QUEUE_DISC_DROP).append (_2).data ()
360
      return DropAfterDequeue (item,
361
  // i.e., the second argument is the concatenation of the CHILD_QUEUE_DISC_DROP constant
361
                               m_childQueueDiscDropMsg.assign (CHILD_QUEUE_DISC_DROP).append (r).data ());
362
  // and the second argument provided by the traces of the QueueDisc class.
362
    };
363
  m_childQueueDiscDbeFunctor = std::bind (&QueueDisc::DropBeforeEnqueue, this, _1,
364
                                          std::bind (&std::basic_string<char>::data,
365
                                                     std::bind (append,
366
                                                                std::bind (assign,
367
                                                                           &m_childQueueDiscDropMsg,
368
                                                                           (const char*)CHILD_QUEUE_DISC_DROP),
369
                                                                _2)));
370
  m_childQueueDiscDadFunctor = std::bind (&QueueDisc::DropAfterDequeue, this, _1,
371
                                          std::bind (&std::basic_string<char>::data,
372
                                                     std::bind (append,
373
                                                                std::bind (assign,
374
                                                                           &m_childQueueDiscDropMsg,
375
                                                                           (const char*)CHILD_QUEUE_DISC_DROP),
376
                                                                _2)));
377
}
363
}
378
364
379
QueueDisc::~QueueDisc ()
365
QueueDisc::~QueueDisc ()
(-)a/src/traffic-control/model/queue-disc.h (-3 / +2 lines)
 Lines 142-149   private: Link Here 
142
 * the sojourn time of every packet dequeued from a queue disc, including packets
142
 * the sojourn time of every packet dequeued from a queue disc, including packets
143
 * that are dropped or requeued after being dequeued. The sojourn time is taken
143
 * that are dropped or requeued after being dequeued. The sojourn time is taken
144
 * when the packet is dequeued from the queue disc, hence it does not account for
144
 * when the packet is dequeued from the queue disc, hence it does not account for
145
 * the additional time the packet is retained within the queue disc in case it is
145
 * the additional time the packet is retained within the traffic control
146
 * requeued.
146
 * infrastructure in case it is requeued.
147
 *
147
 *
148
 * The design and implementation of this class is heavily inspired by Linux.
148
 * The design and implementation of this class is heavily inspired by Linux.
149
 * For more details, see the traffic-control model page.
149
 * For more details, see the traffic-control model page.
150
- 

Return to bug 2751