#include <DropTailQoSQueue.h>
Public Member Functions | |
DropTailQoSQueue () | |
virtual | ~DropTailQoSQueue () |
Protected Member Functions | |
virtual void | initialize () |
virtual bool | enqueue (cMessage *msg) |
virtual cMessage * | dequeue () |
virtual void | sendOut (cMessage *msg) |
Protected Attributes | |
int | frameCapacity |
int | numQueues |
cQueue ** | queues |
IQoSClassifier * | classifier |
cGate * | outGate |
Drop-front QoS queue. See NED for more info.
Definition at line 29 of file DropTailQoSQueue.h.
DropTailQoSQueue::DropTailQoSQueue | ( | ) |
Definition at line 25 of file DropTailQoSQueue.cc.
DropTailQoSQueue::~DropTailQoSQueue | ( | ) | [virtual] |
Definition at line 31 of file DropTailQoSQueue.cc.
cMessage * DropTailQoSQueue::dequeue | ( | ) | [protected, virtual] |
Redefined from PassiveQueueBase.
Implements PassiveQueueBase.
Definition at line 78 of file DropTailQoSQueue.cc.
bool DropTailQoSQueue::enqueue | ( | cMessage * | msg | ) | [protected, virtual] |
Redefined from PassiveQueueBase.
Implements PassiveQueueBase.
Definition at line 60 of file DropTailQoSQueue.cc.
{ int queueIndex = classifier->classifyPacket(msg); cQueue *queue = queues[queueIndex]; if (frameCapacity && queue->length() >= frameCapacity) { EV << "Queue " << queueIndex << " full, dropping packet.\n"; delete msg; return true; } else { queue->insert(msg); return false; } }
void DropTailQoSQueue::initialize | ( | ) | [protected, virtual] |
Reimplemented from PassiveQueueBase.
Definition at line 38 of file DropTailQoSQueue.cc.
{ PassiveQueueBase::initialize(); // configuration frameCapacity = par("frameCapacity"); const char *classifierClass = par("classifierClass"); classifier = check_and_cast<IQoSClassifier *>(createOne(classifierClass)); outGate = gate("out"); numQueues = classifier->getNumQueues(); queues = new cQueue *[numQueues]; for (int i=0; i<numQueues; i++) { char buf[32]; sprintf(buf, "queue-%d", i); queues[i] = new cQueue(buf); } }
void DropTailQoSQueue::sendOut | ( | cMessage * | msg | ) | [protected, virtual] |
Redefined from PassiveQueueBase.
Implements PassiveQueueBase.
Definition at line 87 of file DropTailQoSQueue.cc.
{ send(msg, outGate); }
IQoSClassifier* DropTailQoSQueue::classifier [protected] |
Definition at line 38 of file DropTailQoSQueue.h.
Referenced by enqueue(), and initialize().
int DropTailQoSQueue::frameCapacity [protected] |
Definition at line 33 of file DropTailQoSQueue.h.
Referenced by enqueue(), and initialize().
int DropTailQoSQueue::numQueues [protected] |
Definition at line 36 of file DropTailQoSQueue.h.
Referenced by dequeue(), DropTailQoSQueue(), initialize(), and ~DropTailQoSQueue().
cGate* DropTailQoSQueue::outGate [protected] |
Definition at line 40 of file DropTailQoSQueue.h.
Referenced by initialize(), and sendOut().
cQueue** DropTailQoSQueue::queues [protected] |
Definition at line 37 of file DropTailQoSQueue.h.
Referenced by dequeue(), DropTailQoSQueue(), enqueue(), initialize(), and ~DropTailQoSQueue().