INET Framework for OMNeT++/OMNEST
ANSAQOS::SubQueue Class Reference

#include <AnsaQosSystem.h>

List of all members.

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

Classifierclsfr
QueueType qt
SubQueueType sbqt
int queueId
int maxLength
int lastSn
int droped
int weight
int actualBytes
cOutVector * qlenVec
cOutVector * dropVec
std::vector< SNPacketsnPackets

Detailed Description

Definition at line 147 of file AnsaQosSystem.h.


Constructor & Destructor Documentation

Definition at line 168 of file AnsaQosSystem.h.

{lastSn = 0; qlenVec = dropVec = NULL;}
ANSAQOS::SubQueue::SubQueue ( cMessage *  msg,
int  cdt 
)

Definition at line 547 of file AnsaQosSystem.cc.

{
  qlenVec = dropVec = NULL;
  lastSn = 0;
  maxLength = cdt;
  qt = Q_WFQ;
  sbqt = S_FIFO;
  droped = 0;
  this->setWeight(msg);
  clsfr = new WFQClassifier(msg);
  this->enqueue(msg,true);
}
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;
  }
  
}

Member Function Documentation

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;
}

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);
        }
    }    
}

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
}

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<<().

{return clsfr->info();}
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;}

Definition at line 202 of file AnsaQosSystem.h.

{return (snPackets.front()).getSn();}

Definition at line 181 of file AnsaQosSystem.h.

Referenced by ANSAQOS::operator<<().

{return maxLength;}

Definition at line 179 of file AnsaQosSystem.h.

Referenced by ANSAQOS::operator<<().

{return queueId;}

Definition at line 199 of file AnsaQosSystem.h.

Referenced by isQueueEmpty(), and ANSAQOS::operator<<().

{return snPackets.size();}

Definition at line 175 of file AnsaQosSystem.h.

Referenced by ANSAQOS::operator<<().

{return qt;}

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;}

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;}

Definition at line 189 of file AnsaQosSystem.h.

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;}

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.

{ qlenVec = l; dropVec = d;}
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;}

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;
    }
}

Definition at line 197 of file AnsaQosSystem.h.

{if(dropVec) dropVec->record(1);}

Definition at line 196 of file AnsaQosSystem.h.

{if(qlenVec) qlenVec->record(snPackets.size());}

Member Data Documentation

Definition at line 150 of file AnsaQosSystem.h.

Referenced by getClassifierInfo(), and SubQueue().

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().

Definition at line 155 of file AnsaQosSystem.h.

Referenced by getLastSn(), setLastSn(), and SubQueue().

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().

Definition at line 151 of file AnsaQosSystem.h.

Referenced by getQueueType(), setQueueType(), and SubQueue().

Definition at line 153 of file AnsaQosSystem.h.

Referenced by getQueueId(), and setQueueId().

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().

Definition at line 157 of file AnsaQosSystem.h.

Referenced by getWeight(), setActualBytes(), and setWeight().


The documentation for this class was generated from the following files: