INET Framework for OMNeT++/OMNEST
|
#include <PassiveQueueBase.h>
Public Member Functions | |
virtual void | requestPacket () |
Protected Member Functions | |
virtual void | initialize () |
virtual void | handleMessage (cMessage *msg) |
virtual void | finish () |
virtual bool | enqueue (cMessage *msg)=0 |
virtual cMessage * | dequeue ()=0 |
virtual void | sendOut (cMessage *msg)=0 |
Protected Attributes | |
int | packetRequested |
int | numQueueReceived |
int | numQueueDropped |
Abstract base class for passive queues. Implements IPassiveQueue. Enqueue/dequeue have to be implemented in virtual functions in subclasses; the actual queue or piority queue data structure also goes into subclasses.
virtual cMessage* PassiveQueueBase::dequeue | ( | ) | [protected, pure virtual] |
Returns a packet from the queue, or NULL if the queue is empty.
Implemented in Ieee80211MgmtBase, DropTailQoSQueue, DropTailQueue, and REDQueue.
Referenced by requestPacket().
virtual bool PassiveQueueBase::enqueue | ( | cMessage * | msg | ) | [protected, pure virtual] |
Inserts packet into the queue or the priority queue, or drops it (or another packet). Returns true if a packet was dropped.
Implemented in Ieee80211MgmtBase, DropTailQoSQueue, DropTailQueue, and REDQueue.
Referenced by handleMessage().
void PassiveQueueBase::finish | ( | ) | [protected, virtual] |
Reimplemented in REDQueue.
{ recordScalar("packets received by queue", numQueueReceived); recordScalar("packets dropped by queue", numQueueDropped); }
void PassiveQueueBase::handleMessage | ( | cMessage * | msg | ) | [protected, virtual] |
Reimplemented in Ieee80211MgmtBase.
{ numQueueReceived++; if (packetRequested>0) { packetRequested--; sendOut(msg); } else { bool dropped = enqueue(msg); if (dropped) numQueueDropped++; } if (ev.isGUI()) { char buf[40]; sprintf(buf, "q rcvd: %d\nq dropped: %d", numQueueReceived, numQueueDropped); getDisplayString().setTagArg("t",0,buf); } }
void PassiveQueueBase::initialize | ( | ) | [protected, virtual] |
Reimplemented in DropTailQoSQueue, DropTailQueue, and REDQueue.
Referenced by Ieee80211MgmtSTASimplified::initialize(), Ieee80211MgmtSTA::initialize(), Ieee80211MgmtBase::initialize(), Ieee80211MgmtAPSimplified::initialize(), Ieee80211MgmtAPBase::initialize(), Ieee80211MgmtAP::initialize(), and Ieee80211MgmtAdhoc::initialize().
{ // state packetRequested = 0; WATCH(packetRequested); // statistics numQueueReceived = 0; numQueueDropped = 0; WATCH(numQueueReceived); WATCH(numQueueDropped); }
void PassiveQueueBase::requestPacket | ( | ) | [virtual] |
The queue should send a packet whenever this method is invoked. If the queue is currently empty, it should send a packet when when one becomes available.
Implements IPassiveQueue.
{ Enter_Method("requestPacket()"); cMessage *msg = dequeue(); if (msg==NULL) { packetRequested++; } else { sendOut(msg); } }
virtual void PassiveQueueBase::sendOut | ( | cMessage * | msg | ) | [protected, pure virtual] |
Should be redefined to send out the packet; e.g. send(msg,"out")
.
Implemented in Ieee80211MgmtBase, DropTailQoSQueue, DropTailQueue, and REDQueue.
Referenced by handleMessage(), and requestPacket().
int PassiveQueueBase::numQueueDropped [protected] |
Referenced by finish(), handleMessage(), and initialize().
int PassiveQueueBase::numQueueReceived [protected] |
Referenced by finish(), handleMessage(), and initialize().
int PassiveQueueBase::packetRequested [protected] |
Referenced by handleMessage(), initialize(), and requestPacket().