PcapPlusPlus
22.11
|
#include <VlanLayer.h>
Public Member Functions | |
VlanLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet) | |
VlanLayer (const uint16_t vlanID, bool cfi, uint8_t priority, uint16_t etherType=0) | |
vlan_header * | getVlanHeader () const |
uint16_t | getVlanID () const |
uint8_t | getCFI () const |
uint8_t | getPriority () const |
void | setVlanID (uint16_t id) |
void | setCFI (bool cfi) |
void | setPriority (uint8_t priority) |
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 VLAN tunnel 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::VlanLayer::VlanLayer | ( | const uint16_t | vlanID, |
bool | cfi, | ||
uint8_t | priority, | ||
uint16_t | etherType = 0 |
||
) |
A constructor that allocates a new VLAN header
[in] | vlanID | VLAN ID |
[in] | cfi | CFI value |
[in] | priority | Priority value |
[in] | etherType | Protocol EtherType of the next layer. It's an optional parameter, a value of 0 will be set if not provided |
|
virtual |
Calculate the EtherType for known protocols: IPv4, IPv6, ARP, VLAN
Implements pcpp::Layer.
uint8_t pcpp::VlanLayer::getCFI | ( | ) | const |
|
inlinevirtual |
Implements pcpp::Layer.
|
inlinevirtual |
Implements pcpp::Layer.
uint8_t pcpp::VlanLayer::getPriority | ( | ) | const |
|
inline |
Get a pointer to the VLAN header. Notice this points directly to the data, so every change will change the actual packet data
uint16_t pcpp::VlanLayer::getVlanID | ( | ) | const |
Get the VLAN ID value. This method differs from vlan_header::vlanID because vlan_header::vlanID is 12 bits long in a 16 bit field. This methods extracts only the 12 bit relevant for the VLAN ID
|
virtual |
Currently identifies the following next layers: IPv4Layer, IPv6Layer, ArpLayer, VlanLayer, MplsLayer. Otherwise sets PayloadLayer
Implements pcpp::Layer.
void pcpp::VlanLayer::setCFI | ( | bool | cfi | ) |
Set CFI bit
[in] | cfi | The CFI bit to set |
void pcpp::VlanLayer::setPriority | ( | uint8_t | priority | ) |
Set priority value
[in] | priority | The priority value to set |
void pcpp::VlanLayer::setVlanID | ( | uint16_t | id | ) |
Set VLAN ID. This method differs from setting vlan_header::vlanID because vlan_header::vlanID is 12 bits long in a 16 bit field. This methods sets only the 12 bit relevant for the VLAN ID
[in] | id | The VLAN ID to set |
|
virtual |
Implements pcpp::Layer.