Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __INET_MPLSPACKET_H
00017 #define __INET_MPLSPACKET_H
00018
00019 #include <stack>
00020 #include <omnetpp.h>
00021 #include "INETDefs.h"
00022
00026 class INET_API MPLSPacket: public cPacket
00027 {
00028 protected:
00029 typedef std::vector<int> LabelStack;
00030 LabelStack labels;
00031
00032 public:
00033
00034 MPLSPacket(const char *name=NULL);
00035 MPLSPacket(const MPLSPacket &p);
00036
00037
00038 virtual MPLSPacket& operator=(const MPLSPacket& p);
00039
00043 virtual MPLSPacket *dup() const {return new MPLSPacket(*this);}
00044
00048 virtual std::string info() const;
00049
00053 inline void swapLabel(int newLabel) {labels.back()=newLabel;}
00054
00058 inline void pushLabel(int newLabel) {labels.push_back(newLabel);addBitLength(32);}
00059
00063 inline void popLabel() {labels.pop_back();addBitLength(-32);}
00064
00068 inline bool hasLabel() {return !labels.empty();}
00069
00073 inline int getTopLabel() {return labels.back();}
00074 };
00075
00076 #endif
00077
00078