INET Framework for OMNeT++/OMNEST
DropTailQoSQueue Class Reference

#include <DropTailQoSQueue.h>

Inheritance diagram for DropTailQoSQueue:
PassiveQueueBase IPassiveQueue

List of all members.

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
IQoSClassifierclassifier
cGate * outGate

Detailed Description

Drop-front QoS queue. See NED for more info.


Constructor & Destructor Documentation

DropTailQoSQueue::DropTailQoSQueue ( )
{
    queues = NULL;
    numQueues = NULL;
}
DropTailQoSQueue::~DropTailQoSQueue ( ) [virtual]
{
    for (int i=0; i<numQueues; i++)
        delete queues[i];
    delete [] queues;
}

Member Function Documentation

cMessage * DropTailQoSQueue::dequeue ( ) [protected, virtual]

Redefined from PassiveQueueBase.

Implements PassiveQueueBase.

{
    // queue 0 is highest priority
    for (int i=0; i<numQueues; i++)
        if (!queues[i]->empty())
            return (cMessage *)queues[i]->pop();
    return NULL;
}
bool DropTailQoSQueue::enqueue ( cMessage *  msg) [protected, virtual]

Redefined from PassiveQueueBase.

Implements PassiveQueueBase.

{
    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.

{
    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.

{
    send(msg, outGate);
}

Member Data Documentation

Referenced by enqueue(), and initialize().

cGate* DropTailQoSQueue::outGate [protected]

Referenced by initialize(), and sendOut().


The documentation for this class was generated from the following files: