|
|
| 118 |
QueueDiscClass::SetQueueDisc (Ptr<QueueDisc> qd) |
118 |
QueueDiscClass::SetQueueDisc (Ptr<QueueDisc> qd) |
| 119 |
{ |
119 |
{ |
| 120 |
NS_LOG_FUNCTION (this); |
120 |
NS_LOG_FUNCTION (this); |
|
|
121 |
NS_ABORT_MSG_IF (qd, "Cannot set the queue disc on a class already having an attached queue disc"); |
| 121 |
m_queueDisc = qd; |
122 |
m_queueDisc = qd; |
| 122 |
} |
123 |
} |
| 123 |
|
124 |
|
|
Lines 353-358
QueueDisc::AddQueueDiscClass (Ptr<QueueDiscClass> qdClass)
|
Link Here
|
|---|
|
| 353 |
{ |
354 |
{ |
| 354 |
NS_LOG_FUNCTION (this); |
355 |
NS_LOG_FUNCTION (this); |
| 355 |
NS_ABORT_MSG_IF (qdClass->GetQueueDisc () == 0, "Cannot add a class with no attached queue disc"); |
356 |
NS_ABORT_MSG_IF (qdClass->GetQueueDisc () == 0, "Cannot add a class with no attached queue disc"); |
|
|
357 |
// the child queue disc cannot be one with wake mode equal to WAKE_CHILD because |
| 358 |
// such queue discs do not implement the enqueue/dequeue methods |
| 359 |
NS_ABORT_MSG_IF (qdClass->GetQueueDisc ()->GetWakeMode () == WAKE_CHILD, |
| 360 |
"A queue disc with WAKE_CHILD as wake mode can only be a root queue disc"); |
| 361 |
// set the parent drop callback on the child queue disc, so that it can notify |
| 362 |
// packet drops to the parent queue disc |
| 363 |
qdClass->GetQueueDisc ()->SetParentDropCallback (MakeCallback (&QueueDisc::Drop, this)); |
| 356 |
m_classes.push_back (qdClass); |
364 |
m_classes.push_back (qdClass); |
| 357 |
} |
365 |
} |
| 358 |
|
366 |
|
|
Lines 390-398
QueueDisc::GetWakeMode (void)
|
Link Here
|
|---|
|
| 390 |
} |
398 |
} |
| 391 |
|
399 |
|
| 392 |
void |
400 |
void |
|
|
401 |
QueueDisc::SetParentDropCallback (ParentDropCallback cb) |
| 402 |
{ |
| 403 |
m_parentDropCallback = cb; |
| 404 |
} |
| 405 |
|
| 406 |
void |
| 393 |
QueueDisc::Drop (Ptr<QueueDiscItem> item) |
407 |
QueueDisc::Drop (Ptr<QueueDiscItem> item) |
| 394 |
{ |
408 |
{ |
| 395 |
NS_LOG_FUNCTION (this << item); |
409 |
NS_LOG_FUNCTION (this << item); |
|
|
410 |
|
| 411 |
// if the wake mode of this queue disc is WAKE_CHILD, packets are directly |
| 412 |
// enqueued/dequeued from the child queue discs, thus this queue disc does not |
| 413 |
// keep valid packets/bytes counters and no actions need to be performed. |
| 414 |
if (this->GetWakeMode () == WAKE_CHILD) |
| 415 |
{ |
| 416 |
return; |
| 417 |
} |
| 418 |
|
| 396 |
NS_ASSERT_MSG (m_nPackets >= 1u, "No packet in the queue disc, cannot drop"); |
419 |
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" |
420 |
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" |
421 |
<< " is reported to be dropped is greater than the amount of bytes" |
|
Lines 405-410
QueueDisc::Drop (Ptr<QueueDiscItem> item)
|
Link Here
|
|---|
|
| 405 |
|
428 |
|
| 406 |
NS_LOG_LOGIC ("m_traceDrop (p)"); |
429 |
NS_LOG_LOGIC ("m_traceDrop (p)"); |
| 407 |
m_traceDrop (item); |
430 |
m_traceDrop (item); |
|
|
431 |
|
| 432 |
NotifyParentDrop (item); |
| 433 |
} |
| 434 |
|
| 435 |
void |
| 436 |
QueueDisc::NotifyParentDrop (Ptr<QueueDiscItem> item) |
| 437 |
{ |
| 438 |
NS_LOG_FUNCTION (this << item); |
| 439 |
// the parent drop callback is clearly null on root queue discs |
| 440 |
if (!m_parentDropCallback.IsNull ()) |
| 441 |
{ |
| 442 |
m_parentDropCallback (item); |
| 443 |
} |
| 408 |
} |
444 |
} |
| 409 |
|
445 |
|
| 410 |
bool |
446 |
bool |