INET Framework for OMNeT++/OMNEST
MPLSPacket Class Reference

#include <MPLSPacket.h>

List of all members.

Public Member Functions

 MPLSPacket (const char *name=NULL)
 MPLSPacket (const MPLSPacket &p)
virtual MPLSPacketoperator= (const MPLSPacket &p)
virtual MPLSPacketdup () const
virtual std::string info () const
void swapLabel (int newLabel)
void pushLabel (int newLabel)
void popLabel ()
bool hasLabel ()
int getTopLabel ()

Protected Types

typedef std::vector< int > LabelStack

Protected Attributes

LabelStack labels

Detailed Description

Represents a packet with MPLS headers


Member Typedef Documentation

typedef std::vector<int> MPLSPacket::LabelStack [protected]

Constructor & Destructor Documentation

MPLSPacket::MPLSPacket ( const char *  name = NULL)
                                       : cPacket(name)
{
}
MPLSPacket::MPLSPacket ( const MPLSPacket p)
{
    setName(p.getName());
    operator=(p);
}

Member Function Documentation

virtual MPLSPacket* MPLSPacket::dup ( ) const [inline, virtual]

cloning function

{return new MPLSPacket(*this);}
int MPLSPacket::getTopLabel ( ) [inline]

Returns the top label

Referenced by MPLS::processMPLSPacketFromL2().

{return labels.back();}
bool MPLSPacket::hasLabel ( ) [inline]

Returns true if the label stack is not empty

Referenced by MPLS::doStackOps(), MPLS::processMPLSPacketFromL2(), and MPLS::tryLabelAndForwardIPDatagram().

{return !labels.empty();}
std::string MPLSPacket::info ( ) const [virtual]

Returns a string with the labels, starting with the top of stack.

{
    std::stringstream out;
    for (int i = (int)labels.size()-1; i >= 0; i--)
        out << labels[i] << (i==0?"":" ");
    return out.str();
}
MPLSPacket & MPLSPacket::operator= ( const MPLSPacket p) [virtual]

Referenced by MPLSPacket().

{
    cPacket::operator=(p);
    labels = p.labels;
    return *this;
}
void MPLSPacket::popLabel ( ) [inline]

Pops the top label

Referenced by MPLS::doStackOps().

{labels.pop_back();addBitLength(-32);}
void MPLSPacket::pushLabel ( int  newLabel) [inline]

Pushes new label on the label stack

Referenced by MPLS::doStackOps().

{labels.push_back(newLabel);addBitLength(32);}
void MPLSPacket::swapLabel ( int  newLabel) [inline]

Swap Label operation

Referenced by MPLS::doStackOps().

{labels.back()=newLabel;}

Member Data Documentation

Referenced by info(), and operator=().


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