DropTailQoSQueue Class Reference

#include <DropTailQoSQueue.h>

Inheritance diagram for DropTailQoSQueue:

PassiveQueueBase IPassiveQueue

List of all members.


Detailed Description

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

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

Constructor & Destructor Documentation

DropTailQoSQueue::DropTailQoSQueue (  ) 

00026 {
00027     queues = NULL;
00028     numQueues = NULL;
00029 }

DropTailQoSQueue::~DropTailQoSQueue (  )  [virtual]

00032 {
00033     for (int i=0; i<numQueues; i++)
00034         delete queues[i];
00035     delete [] queues;
00036 }


Member Function Documentation

void DropTailQoSQueue::initialize (  )  [protected, virtual]

Reimplemented from PassiveQueueBase.

00039 {
00040     PassiveQueueBase::initialize();
00041 
00042     // configuration
00043     frameCapacity = par("frameCapacity");
00044 
00045     const char *classifierClass = par("classifierClass");
00046     classifier = check_and_cast<IQoSClassifier *>(createOne(classifierClass));
00047 
00048     outGate = gate("out");
00049 
00050     numQueues = classifier->getNumQueues();
00051     queues = new cQueue *[numQueues];
00052     for (int i=0; i<numQueues; i++)
00053     {
00054         char buf[32];
00055         sprintf(buf, "queue-%d", i);
00056         queues[i] = new cQueue(buf);
00057     }
00058 }

bool DropTailQoSQueue::enqueue ( cMessage *  msg  )  [protected, virtual]

Redefined from PassiveQueueBase.

Implements PassiveQueueBase.

00061 {
00062     int queueIndex = classifier->classifyPacket(msg);
00063     cQueue *queue = queues[queueIndex];
00064 
00065     if (frameCapacity && queue->length() >= frameCapacity)
00066     {
00067         EV << "Queue " << queueIndex << " full, dropping packet.\n";
00068         delete msg;
00069         return true;
00070     }
00071     else
00072     {
00073         queue->insert(msg);
00074         return false;
00075     }
00076 }

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

Redefined from PassiveQueueBase.

Implements PassiveQueueBase.

00079 {
00080     // queue 0 is highest priority
00081     for (int i=0; i<numQueues; i++)
00082         if (!queues[i]->empty())
00083             return (cMessage *)queues[i]->pop();
00084     return NULL;
00085 }

void DropTailQoSQueue::sendOut ( cMessage *  msg  )  [protected, virtual]

Redefined from PassiveQueueBase.

Implements PassiveQueueBase.

00088 {
00089     send(msg, outGate);
00090 }


Member Data Documentation

Referenced by enqueue(), and initialize().

int DropTailQoSQueue::numQueues [protected]

cQueue** DropTailQoSQueue::queues [protected]

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:

Generated on Fri Mar 20 18:51:18 2009 for INET Framework for OMNeT++/OMNEST by  doxygen 1.5.5