PcapPlusPlus
|
#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 () |
void | setTTL (uint8_t ttl) |
bool | isBottomOfStack () |
void | setBottomOfStack (bool val) |
uint8_t | getExperimentalUseValue () |
bool | setExperimentalUseValue (uint8_t val) |
uint32_t | getMplsLabel () |
bool | setMplsLabel (uint32_t label) |
void | parseNextLayer () |
size_t | getHeaderLen () |
void | computeCalculateFields () |
std::string | toString () |
OsiModelLayer | getOsiModelLayer () |
Public Member Functions inherited from pcpp::Layer | |
virtual | ~Layer () |
Layer * | getNextLayer () |
Layer * | getPrevLayer () |
ProtocolType | getProtocol () |
uint8_t * | getData () |
size_t | getDataLen () |
uint8_t * | getLayerPayload () |
size_t | getLayerPayloadSize () |
bool | isAllocatedToPacket () |
void | copyData (uint8_t *toArr) |
uint8_t * | getDataPtr (size_t offset=0) |
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 | ( | ) |
|
inlinevirtual |
Implements pcpp::Layer.
uint32_t pcpp::MplsLayer::getMplsLabel | ( | ) |
|
inlinevirtual |
Implements pcpp::Layer.
|
inline |
bool pcpp::MplsLayer::isBottomOfStack | ( | ) |
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.