|
INET Framework for OMNeT++/OMNEST
|
#include <AnsaQosClassifiers.h>
Public Member Functions | |
| PRECClassifier (cXMLElement &clsfrConfig) | |
| virtual bool | classifyPacket (cMessage *msg) |
| virtual std::string | info () |
Private Attributes | |
| std::vector< short > | values |
| std::string | infoString |
Definition at line 123 of file AnsaQosClassifiers.h.
| ANSAQOS::PRECClassifier::PRECClassifier | ( | cXMLElement & | clsfrConfig | ) |
Definition at line 284 of file AnsaQosClassifiers.cc.
{
/* Do retazca uklada informacie pre graficke rozhranie */
infoString = "PREC:=";
/* Prechadzanie elementov XML konfiguracie */
cXMLElementList dscpDetails = clsfrConfig.getChildren();
for (cXMLElementList::iterator dscpElemIt = dscpDetails.begin(); dscpElemIt != dscpDetails.end(); ++dscpElemIt)
{
std::string nodeName = (*dscpElemIt)->getTagName();
if (nodeName == "value")
{
short val = (short) atoi((*dscpElemIt)->getNodeValue());
if (val >= 0 && val <8) // IP precedence musi byt z rozsahu 0-7
{
values.push_back(val);
infoString += " ";
infoString += (*dscpElemIt)->getNodeValue();
}
}
}
}
| bool ANSAQOS::PRECClassifier::classifyPacket | ( | cMessage * | msg | ) | [virtual] |
Implements ANSAQOS::Classifier.
Definition at line 315 of file AnsaQosClassifiers.cc.
{
short prec;
std::vector<short>::iterator it;
cMessage *copy = msg->dup();
if (dynamic_cast<IPDatagram *>(copy))
{
IPDatagram *datagram = (IPDatagram *)copy;
prec = (short) datagram->getDiffServCodePoint()/32; // prve 3bity TOS
}
delete copy;
for(it = values.begin(); it != values.end(); ++it )
{
if (*it == prec)
return true;
}
return false;
}
| virtual std::string ANSAQOS::PRECClassifier::info | ( | ) | [inline, virtual] |
Implements ANSAQOS::Classifier.
Definition at line 132 of file AnsaQosClassifiers.h.
{return infoString;}
std::string ANSAQOS::PRECClassifier::infoString [private] |
Definition at line 127 of file AnsaQosClassifiers.h.
Referenced by info().
std::vector<short> ANSAQOS::PRECClassifier::values [private] |
Definition at line 126 of file AnsaQosClassifiers.h.