PcapPlusPlus
20.08
|
#include <MplsLayer.h>
Public Member Functions | |
MplsLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet) | |
MplsLayer (uint32_t mplsLabel, uint8_t ttl, uint8_t expermentalUseValue, bool bottomOfStack) | |
uint8_t | getTTL () const |
void | setTTL (uint8_t ttl) |
bool | isBottomOfStack () const |
void | setBottomOfStack (bool val) |
uint8_t | getExperimentalUseValue () const |
bool | setExperimentalUseValue (uint8_t val) |
uint32_t | getMplsLabel () const |
bool | setMplsLabel (uint32_t label) |
void | parseNextLayer () |
size_t | getHeaderLen () const |
void | computeCalculateFields () |
std::string | toString () const |
OsiModelLayer | getOsiModelLayer () const |
Public Member Functions inherited from pcpp::Layer | |
virtual | ~Layer () |
Layer * | getNextLayer () const |
Layer * | getPrevLayer () const |
ProtocolType | getProtocol () const |
uint8_t * | getData () const |
size_t | getDataLen () const |
uint8_t * | getLayerPayload () const |
size_t | getLayerPayloadSize () const |
bool | isAllocatedToPacket () const |
void | copyData (uint8_t *toArr) const |
uint8_t * | getDataPtr (size_t offset=0) const |
Represents a MPLS (Multi-Protocol Label Switching) layer
|
inline |
A constructor that creates the layer from an existing packet raw data
[in] | data | A pointer to the raw data |
[in] | dataLen | Size of the data in bytes |
[in] | prevLayer | A pointer to the previous layer |
[in] | packet | A pointer to the Packet instance where layer will be stored in |
pcpp::MplsLayer::MplsLayer | ( | uint32_t | mplsLabel, |
uint8_t | ttl, | ||
uint8_t | expermentalUseValue, | ||
bool | bottomOfStack | ||
) |
A constructor that allocates a new MPLS header
[in] | mplsLabel | MPLS label |
[in] | ttl | Time-to-leave value |
[in] | expermentalUseValue | Experimental use value |
[in] | bottomOfStack | Bottom-of-stack value which indicate whether the next layer will also be a MPLS label or not |
|
virtual |
Set/unset the bottom-of-stack bit according to next layer: if it's a MPLS layer then bottom-of-stack will be unset. If it's not a MPLS layer this bit will be set
Implements pcpp::Layer.
uint8_t pcpp::MplsLayer::getExperimentalUseValue | ( | ) | const |
|
inlinevirtual |
Implements pcpp::Layer.
uint32_t pcpp::MplsLayer::getMplsLabel | ( | ) | const |
|
inlinevirtual |
Implements pcpp::Layer.
|
inline |
bool pcpp::MplsLayer::isBottomOfStack | ( | ) | const |
Get an indication whether the next layer is also be a MPLS label or not
|
virtual |
Currently identifies the following next layers: IPv4Layer, IPv6Layer, MplsLayer. Otherwise sets PayloadLayer
Implements pcpp::Layer.
void pcpp::MplsLayer::setBottomOfStack | ( | bool | val | ) |
Set the bottom-of-stack bit in the MPLS label
[in] | val | Set or unset the bit |
bool pcpp::MplsLayer::setExperimentalUseValue | ( | uint8_t | val | ) |
Set the exp value (3 bits) of the MPLS label
[in] | val | The exp value to set. val must be a valid number meaning between 0 and 7 (inclusive) |
bool pcpp::MplsLayer::setMplsLabel | ( | uint32_t | label | ) |
Set the MPLS label (20 bits)
[in] | label | The label to set. label must be a valid number meaning between 0 and 0xFFFFF (inclusive) |
|
inline |
Set the TTL value
[in] | ttl | The TTL value to set |
|
virtual |
Implements pcpp::Layer.