|
INET Framework for OMNeT++/OMNEST
|
#include <AnsaQosSystem.h>
Public Member Functions | |
| SubQueue () | |
| SubQueue (cMessage *msg, int cdt) | |
| SubQueue (QueueType t1, SubQueueType t2, int len, cXMLElement &clsfrConfig) | |
| void | clearSubQueue () |
| void | setQueueType (QueueType type) |
| QueueType | getQueueType () |
| void | setSubQueueType (SubQueueType type) |
| SubQueueType | getSubQueueType () |
| void | setQueueId (int id) |
| int | getQueueId () |
| void | setMaxLength (int len) |
| int | getMaxLength () |
| void | setLastSn (int n_sn) |
| int | getLastSn () |
| void | addDroped () |
| int | getDroped () |
| void | setWeight (cMessage *msg) |
| void | setWeight (int w) |
| int | getWeight () |
| void | setActualBytes () |
| void | setActualBytes (int b) |
| void | addActualBytes (int b) |
| void | remActualBytes (int b) |
| int | getActualBytes () |
| std::string | getClassifierInfo () |
| void | setVectorPointer (cOutVector *l, cOutVector *d) |
| void | updateVectorLenght () |
| void | updateVectorDrop () |
| int | getQueueLength () |
| bool | isQueueEmpty () |
| void | substractSnFromAll (int subNum) |
| int | getLowestSn () |
| int | calculateSn (cMessage *msg) |
| short | enqueue (cMessage *msg, bool classify) |
| cMessage * | dequeue () |
Private Attributes | |
| Classifier * | clsfr |
| QueueType | qt |
| SubQueueType | sbqt |
| int | queueId |
| int | maxLength |
| int | lastSn |
| int | droped |
| int | weight |
| int | actualBytes |
| cOutVector * | qlenVec |
| cOutVector * | dropVec |
| std::vector< SNPacket > | snPackets |
Definition at line 147 of file AnsaQosSystem.h.
| ANSAQOS::SubQueue::SubQueue | ( | ) | [inline] |
Definition at line 168 of file AnsaQosSystem.h.
| ANSAQOS::SubQueue::SubQueue | ( | cMessage * | msg, |
| int | cdt | ||
| ) |
| ANSAQOS::SubQueue::SubQueue | ( | QueueType | t1, |
| SubQueueType | t2, | ||
| int | len, | ||
| cXMLElement & | clsfrConfig | ||
| ) |
Definition at line 569 of file AnsaQosSystem.cc.
{
qlenVec = dropVec = NULL;
lastSn = 0;
maxLength = len;
qt = t1;
sbqt = t2;
droped = 0;
switch (qt) // na zaklade typu fronty sa vytvori klasifikator podfronty
{
case Q_FIFO :
clsfr = new MatchAnyClassifier();
break;
case Q_PQ :
case Q_CQ :
if (&clsfrConfig != NULL)
{
std::string cType = clsfrConfig.getAttribute("type");
if(cType == "DSCP")
clsfr = new DSCPClassifier(clsfrConfig);
else if (cType == "PREC")
clsfr = new PRECClassifier(clsfrConfig);
else if (cType == "ACL")
clsfr = new ACLClassifier(clsfrConfig);
}
else
clsfr = new MatchNoneClassifier();
break;
default :
break;
}
}
| void ANSAQOS::SubQueue::addActualBytes | ( | int | b | ) | [inline] |
Definition at line 191 of file AnsaQosSystem.h.
{actualBytes += b;}
| void ANSAQOS::SubQueue::addDroped | ( | ) | [inline] |
Definition at line 184 of file AnsaQosSystem.h.
{++droped; }
| int ANSAQOS::SubQueue::calculateSn | ( | cMessage * | msg | ) |
Definition at line 683 of file AnsaQosSystem.cc.
{
int sn;
cPacket *pkt = dynamic_cast<cPacket *> (msg->dup());
int len = pkt->getByteLength();
short ipPrec = 0;
if (dynamic_cast<IPDatagram *>(pkt))
{
IPDatagram *datagram = (IPDatagram *)pkt;
ipPrec = (short) datagram->getDiffServCodePoint()/32;
}
delete pkt;
sn = this->getLastSn() + ((32384 / (ipPrec + 1)) * len);
return sn;
}
| void ANSAQOS::SubQueue::clearSubQueue | ( | ) |
Definition at line 609 of file AnsaQosSystem.cc.
{
if(!isQueueEmpty())
{
for (std::vector<SNPacket>::iterator it = snPackets.begin(); it!=snPackets.end(); ++it)
{
delete it->getMsg();
it->setMsg(NULL);
}
}
}
| cMessage * ANSAQOS::SubQueue::dequeue | ( | ) |
Definition at line 666 of file AnsaQosSystem.cc.
{
cMessage *msg = (snPackets.front()).getMsg();
snPackets.erase(snPackets.begin());
this->updateVectorLenght();
return msg;
}
| short ANSAQOS::SubQueue::enqueue | ( | cMessage * | msg, |
| bool | classify | ||
| ) |
Definition at line 629 of file AnsaQosSystem.cc.
Referenced by SubQueue().
{
int sn = 0;
if(classify && !clsfr->classifyPacket(msg))
return NOMATCH; // paket nebol do fronty klasifikovany
if(this->getQueueLength() >= maxLength)
{
this->addDroped();
this->updateVectorDrop();
return NOTQUEUED; // fronta je plna
}
switch (qt)
{
case Q_WFQ :
sn = this->calculateSn(msg); // vypocet SN v pripade WFQ fronty
setLastSn(sn);
break;
default :
break;
}
SNPacket newSNPacket(msg, sn);
snPackets.push_back(newSNPacket); // vlozenie paketu do podfronty
this->updateVectorLenght();
return QUEUED; // paket vlozeny do fronty
}
| int ANSAQOS::SubQueue::getActualBytes | ( | ) | [inline] |
Definition at line 193 of file AnsaQosSystem.h.
Referenced by ANSAQOS::operator<<().
{return actualBytes;}
| std::string ANSAQOS::SubQueue::getClassifierInfo | ( | ) | [inline] |
Definition at line 194 of file AnsaQosSystem.h.
Referenced by ANSAQOS::operator<<().
| int ANSAQOS::SubQueue::getDroped | ( | ) | [inline] |
Definition at line 185 of file AnsaQosSystem.h.
Referenced by ANSAQOS::operator<<().
{return droped;}
| int ANSAQOS::SubQueue::getLastSn | ( | ) | [inline] |
Definition at line 183 of file AnsaQosSystem.h.
{return lastSn;}
| int ANSAQOS::SubQueue::getLowestSn | ( | ) | [inline] |
Definition at line 202 of file AnsaQosSystem.h.
{return (snPackets.front()).getSn();}
| int ANSAQOS::SubQueue::getMaxLength | ( | ) | [inline] |
Definition at line 181 of file AnsaQosSystem.h.
Referenced by ANSAQOS::operator<<().
{return maxLength;}
| int ANSAQOS::SubQueue::getQueueId | ( | ) | [inline] |
Definition at line 179 of file AnsaQosSystem.h.
Referenced by ANSAQOS::operator<<().
{return queueId;}
| int ANSAQOS::SubQueue::getQueueLength | ( | ) | [inline] |
Definition at line 199 of file AnsaQosSystem.h.
Referenced by isQueueEmpty(), and ANSAQOS::operator<<().
{return snPackets.size();}
| QueueType ANSAQOS::SubQueue::getQueueType | ( | ) | [inline] |
| SubQueueType ANSAQOS::SubQueue::getSubQueueType | ( | ) | [inline] |
Definition at line 177 of file AnsaQosSystem.h.
{return sbqt;}
| int ANSAQOS::SubQueue::getWeight | ( | ) | [inline] |
Definition at line 188 of file AnsaQosSystem.h.
Referenced by ANSAQOS::operator<<().
{return weight;}
| bool ANSAQOS::SubQueue::isQueueEmpty | ( | ) | [inline] |
Definition at line 200 of file AnsaQosSystem.h.
{return getQueueLength()>0 ? false : true ;}
| void ANSAQOS::SubQueue::remActualBytes | ( | int | b | ) | [inline] |
Definition at line 192 of file AnsaQosSystem.h.
{actualBytes -= b;}
| void ANSAQOS::SubQueue::setActualBytes | ( | ) | [inline] |
Definition at line 189 of file AnsaQosSystem.h.
{actualBytes = weight;}
| void ANSAQOS::SubQueue::setActualBytes | ( | int | b | ) | [inline] |
Definition at line 190 of file AnsaQosSystem.h.
{actualBytes = b;}
| void ANSAQOS::SubQueue::setLastSn | ( | int | n_sn | ) | [inline] |
Definition at line 182 of file AnsaQosSystem.h.
{lastSn = n_sn;}
| void ANSAQOS::SubQueue::setMaxLength | ( | int | len | ) | [inline] |
Definition at line 180 of file AnsaQosSystem.h.
{maxLength = len;}
| void ANSAQOS::SubQueue::setQueueId | ( | int | id | ) | [inline] |
Definition at line 178 of file AnsaQosSystem.h.
{queueId = id;}
| void ANSAQOS::SubQueue::setQueueType | ( | QueueType | type | ) | [inline] |
Definition at line 174 of file AnsaQosSystem.h.
{qt = type;}
| void ANSAQOS::SubQueue::setSubQueueType | ( | SubQueueType | type | ) | [inline] |
Definition at line 176 of file AnsaQosSystem.h.
{sbqt = type;}
| void ANSAQOS::SubQueue::setVectorPointer | ( | cOutVector * | l, |
| cOutVector * | d | ||
| ) | [inline] |
Definition at line 195 of file AnsaQosSystem.h.
| void ANSAQOS::SubQueue::setWeight | ( | cMessage * | msg | ) |
Definition at line 730 of file AnsaQosSystem.cc.
Referenced by SubQueue().
{
Flow flowID;
flowID.parseFromMsg(msg);
weight = 32384 / (flowID.ipPrec +1); // vypocet vahy pre podfrontu
}
| void ANSAQOS::SubQueue::setWeight | ( | int | w | ) | [inline] |
Definition at line 187 of file AnsaQosSystem.h.
{weight = w;}
| void ANSAQOS::SubQueue::substractSnFromAll | ( | int | subNum | ) |
Definition at line 711 of file AnsaQosSystem.cc.
{
if(!isQueueEmpty())
{
for (std::vector<SNPacket>::iterator it = snPackets.begin(); it!=snPackets.end(); ++it)
{
it->substractSn(subNum);
}
lastSn -= subNum;
}
}
| void ANSAQOS::SubQueue::updateVectorDrop | ( | ) | [inline] |
Definition at line 197 of file AnsaQosSystem.h.
| void ANSAQOS::SubQueue::updateVectorLenght | ( | ) | [inline] |
Definition at line 196 of file AnsaQosSystem.h.
int ANSAQOS::SubQueue::actualBytes [private] |
Definition at line 158 of file AnsaQosSystem.h.
Referenced by addActualBytes(), getActualBytes(), remActualBytes(), and setActualBytes().
Classifier* ANSAQOS::SubQueue::clsfr [private] |
Definition at line 150 of file AnsaQosSystem.h.
Referenced by getClassifierInfo(), and SubQueue().
int ANSAQOS::SubQueue::droped [private] |
Definition at line 156 of file AnsaQosSystem.h.
Referenced by addDroped(), getDroped(), and SubQueue().
cOutVector* ANSAQOS::SubQueue::dropVec [private] |
Definition at line 161 of file AnsaQosSystem.h.
Referenced by setVectorPointer(), SubQueue(), and updateVectorDrop().
int ANSAQOS::SubQueue::lastSn [private] |
Definition at line 155 of file AnsaQosSystem.h.
Referenced by getLastSn(), setLastSn(), and SubQueue().
int ANSAQOS::SubQueue::maxLength [private] |
Definition at line 154 of file AnsaQosSystem.h.
Referenced by getMaxLength(), setMaxLength(), and SubQueue().
cOutVector* ANSAQOS::SubQueue::qlenVec [private] |
Definition at line 160 of file AnsaQosSystem.h.
Referenced by setVectorPointer(), SubQueue(), and updateVectorLenght().
QueueType ANSAQOS::SubQueue::qt [private] |
Definition at line 151 of file AnsaQosSystem.h.
Referenced by getQueueType(), setQueueType(), and SubQueue().
int ANSAQOS::SubQueue::queueId [private] |
Definition at line 153 of file AnsaQosSystem.h.
Referenced by getQueueId(), and setQueueId().
SubQueueType ANSAQOS::SubQueue::sbqt [private] |
Definition at line 152 of file AnsaQosSystem.h.
Referenced by getSubQueueType(), setSubQueueType(), and SubQueue().
std::vector<SNPacket> ANSAQOS::SubQueue::snPackets [private] |
Definition at line 163 of file AnsaQosSystem.h.
Referenced by getLowestSn(), getQueueLength(), and updateVectorLenght().
int ANSAQOS::SubQueue::weight [private] |
Definition at line 157 of file AnsaQosSystem.h.
Referenced by getWeight(), setActualBytes(), and setWeight().