EPONImplementationforOMNet++
0.8Beta
|
#include <OLT_QPL_RR.h>
Public Member Functions | |
virtual | ~OLT_QPL_RR () |
virtual void | initialize () |
virtual void | requestPacket () |
This method returns the next frame and removes it from the queue. |
OLT_QPL_RR::~OLT_QPL_RR | ( | ) | [virtual] |
{}
void OLT_QPL_RR::initialize | ( | ) | [virtual] |
Reimplemented from OLTQPerLLiDBase.
Reimplemented in OLTQPerLLiDBase_P.
{ OLTQPerLLiDBase::initialize(); }
void OLT_QPL_RR::requestPacket | ( | ) | [virtual] |
This method returns the next frame and removes it from the queue.
Thus this method controls the queue's priorities and QoS. The default behavior is to do Round Robin on the queues. NOTE: RR is per frame...
This could be overridden in a subclass and change the default behavior.
{ Enter_Method("requestPacket()"); bool found=false; // if the current Q is empty find the next one if (pon_queues[nextQIndex].isEmpty()){ for (int i=(nextQIndex+1)%pon_queues.size(); i!=nextQIndex; i=((i+1)%pon_queues.size())){ if (!pon_queues[i].isEmpty()) { nextQIndex=i; found=true; break; } } // If not empty.. we have a frame }else found=true; // if all empty return NULL if (!found){ allQsEmpty = true; return; } // Send the next message to lower layer out cPacket * msg = (cPacket *)pon_queues[nextQIndex].pop(); // Log Statistics pon_queues[nextQIndex].vec->numBytesSent+=msg->getByteLength(); pon_queues[nextQIndex].vec->numFramesSent++; pon_queues[nextQIndex].vec->recordVectors(); // Point to the next Q (Round Robin) nextQIndex=(nextQIndex+1)%pon_queues.size(); // Check is it was the last one... checkIfAllEmpty(); send(msg, "lowerLayerOut"); }