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

#include <AnsaQosClassifiers.h>

List of all members.

Public Member Functions

 Flow ()
 Flow (cMessage *msg)
void parseFromMsg (cMessage *msg)
bool operator== (const Flow &flow) const

Public Attributes

IPAddress srcAddress
IPAddress destAddress
int transportProtocol
short ipPrec
int srcPort
int destPort

Detailed Description

Definition at line 40 of file AnsaQosClassifiers.h.


Constructor & Destructor Documentation

ANSAQOS::Flow::Flow ( ) [inline]

Definition at line 50 of file AnsaQosClassifiers.h.

{}
ANSAQOS::Flow::Flow ( cMessage *  msg) [inline]

Definition at line 51 of file AnsaQosClassifiers.h.

{this->parseFromMsg(msg);}

Member Function Documentation

bool ANSAQOS::Flow::operator== ( const Flow flow) const

Definition at line 25 of file AnsaQosClassifiers.cc.

{
    if(srcAddress != flow.srcAddress)
        return false;
    if(destAddress != flow.destAddress)
        return false;
    if(transportProtocol != flow.transportProtocol)
        return false;
    if(ipPrec != flow.ipPrec)
        return false;
    if(srcPort != flow.srcPort)
        return false;
    if(destPort != flow.destPort)
        return false;
    
    return true;
}
void ANSAQOS::Flow::parseFromMsg ( cMessage *  msg)

Definition at line 49 of file AnsaQosClassifiers.cc.

Referenced by Flow(), and ANSAQOS::SubQueue::setWeight().

{
  cMessage *copy = msg->dup();

  if (dynamic_cast<IPDatagram *>(copy))
  {
    IPDatagram *datagram = (IPDatagram *)copy;
        
    srcAddress = datagram->getSrcAddress();
    destAddress = datagram->getDestAddress();
    transportProtocol = datagram->getTransportProtocol();
    ipPrec = (short) datagram->getDiffServCodePoint()/32; // prve 3 bity ToS
    if(transportProtocol == IP_PROT_TCP)
    {
      TCPSegment *tcpSegm = dynamic_cast<TCPSegment *> (datagram->decapsulate());
      srcPort = tcpSegm->getSrcPort();
      destPort = tcpSegm->getDestPort();
      delete tcpSegm;
    }
    else if(transportProtocol == IP_PROT_UDP)
    {
      UDPPacket *udpDatag  = dynamic_cast<UDPPacket *> (datagram->decapsulate());
      srcPort = udpDatag->getSourcePort();
      destPort = udpDatag->getDestinationPort();
      delete udpDatag;
    }
    else
    {
      srcPort = 0;
      destPort = 0;
    }      
  }
  else
  {
    srcAddress = IPAddress::UNSPECIFIED_ADDRESS;
    destAddress = IPAddress::UNSPECIFIED_ADDRESS;
    transportProtocol = 0;
    ipPrec = 0;
    srcPort = 0;
    destPort = 0;
  }
  
  delete copy;

}

Member Data Documentation

Definition at line 44 of file AnsaQosClassifiers.h.

Referenced by operator==().

Definition at line 48 of file AnsaQosClassifiers.h.

Referenced by operator==().

Definition at line 46 of file AnsaQosClassifiers.h.

Referenced by operator==(), and ANSAQOS::SubQueue::setWeight().

Definition at line 43 of file AnsaQosClassifiers.h.

Referenced by operator==().

Definition at line 47 of file AnsaQosClassifiers.h.

Referenced by operator==().

Definition at line 45 of file AnsaQosClassifiers.h.

Referenced by operator==().


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