#include <PassiveQueueBase.h>
Inheritance diagram for PassiveQueueBase:
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 |
virtual cMessage* PassiveQueueBase::dequeue | ( | ) | [protected, pure virtual] |
Returns a packet from the queue, or NULL if the queue is empty.
Implemented in DropTailQoSQueue, DropTailQueue, REDQueue, and Ieee80211MgmtBase.
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 DropTailQoSQueue, DropTailQueue, REDQueue, and Ieee80211MgmtBase.
void PassiveQueueBase::finish | ( | ) | [protected, virtual] |
Reimplemented in REDQueue.
00076 { 00077 recordScalar("packets received by queue", numQueueReceived); 00078 recordScalar("packets dropped by queue", numQueueDropped); 00079 }
void PassiveQueueBase::handleMessage | ( | cMessage * | msg | ) | [protected, virtual] |
Reimplemented in Ieee80211MgmtBase.
00038 { 00039 numQueueReceived++; 00040 if (packetRequested>0) 00041 { 00042 packetRequested--; 00043 sendOut(msg); 00044 } 00045 else 00046 { 00047 bool dropped = enqueue(msg); 00048 if (dropped) 00049 numQueueDropped++; 00050 } 00051 00052 if (ev.isGUI()) 00053 { 00054 char buf[40]; 00055 sprintf(buf, "q rcvd: %d\nq dropped: %d", numQueueReceived, numQueueDropped); 00056 displayString().setTagArg("t",0,buf); 00057 } 00058 }
void PassiveQueueBase::initialize | ( | ) | [protected, virtual] |
Reimplemented in DropTailQoSQueue, DropTailQueue, and REDQueue.
00025 { 00026 // state 00027 packetRequested = 0; 00028 WATCH(packetRequested); 00029 00030 // statistics 00031 numQueueReceived = 0; 00032 numQueueDropped = 0; 00033 WATCH(numQueueReceived); 00034 WATCH(numQueueDropped); 00035 }
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.
00061 { 00062 Enter_Method("requestPacket()"); 00063 00064 cMessage *msg = dequeue(); 00065 if (msg==NULL) 00066 { 00067 packetRequested++; 00068 } 00069 else 00070 { 00071 sendOut(msg); 00072 } 00073 }
virtual void PassiveQueueBase::sendOut | ( | cMessage * | msg | ) | [protected, pure virtual] |
Should be redefined to send out the packet; e.g. send(msg,"out")
.
Implemented in DropTailQoSQueue, DropTailQueue, REDQueue, and Ieee80211MgmtBase.
int PassiveQueueBase::numQueueDropped [protected] |
int PassiveQueueBase::numQueueReceived [protected] |
int PassiveQueueBase::packetRequested [protected] |