#include <MPLSPacket.h>
Public Member Functions | |
MPLSPacket (const char *name=NULL) | |
MPLSPacket (const MPLSPacket &p) | |
virtual MPLSPacket & | operator= (const MPLSPacket &p) |
virtual MPLSPacket * | dup () 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 |
Represents a packet with MPLS headers
Definition at line 26 of file MPLSPacket.h.
typedef std::vector<int> MPLSPacket::LabelStack [protected] |
Definition at line 29 of file MPLSPacket.h.
MPLSPacket::MPLSPacket | ( | const char * | name = NULL |
) |
Definition at line 21 of file MPLSPacket.cc.
: cPacket(name) { }
MPLSPacket::MPLSPacket | ( | const MPLSPacket & | p | ) |
Definition at line 25 of file MPLSPacket.cc.
{ setName(p.getName()); operator=(p); }
virtual MPLSPacket* MPLSPacket::dup | ( | ) | const [inline, virtual] |
int MPLSPacket::getTopLabel | ( | ) | [inline] |
Returns the top label
Definition at line 73 of file MPLSPacket.h.
Referenced by MPLS::processMPLSPacketFromL2().
{return labels.back();}
bool MPLSPacket::hasLabel | ( | ) | [inline] |
Returns true if the label stack is not empty
Definition at line 68 of file MPLSPacket.h.
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.
Definition at line 39 of file MPLSPacket.cc.
MPLSPacket & MPLSPacket::operator= | ( | const MPLSPacket & | p | ) | [virtual] |
Definition at line 32 of file MPLSPacket.cc.
Referenced by MPLSPacket().
{ cPacket::operator=(p); labels = p.labels; return *this; }
void MPLSPacket::popLabel | ( | ) | [inline] |
Pops the top label
Definition at line 63 of file MPLSPacket.h.
Referenced by MPLS::doStackOps().
{labels.pop_back();addBitLength(-32);}
void MPLSPacket::pushLabel | ( | int | newLabel | ) | [inline] |
Pushes new label on the label stack
Definition at line 58 of file MPLSPacket.h.
Referenced by MPLS::doStackOps().
{labels.push_back(newLabel);addBitLength(32);}
void MPLSPacket::swapLabel | ( | int | newLabel | ) | [inline] |
Swap Label operation
Definition at line 53 of file MPLSPacket.h.
Referenced by MPLS::doStackOps().
{labels.back()=newLabel;}
LabelStack MPLSPacket::labels [protected] |
Definition at line 30 of file MPLSPacket.h.
Referenced by info(), and operator=().