PcapPlusPlus  20.08
pcpp::VxlanLayer Class Reference

#include <VxlanLayer.h>

Inheritance diagram for pcpp::VxlanLayer:
pcpp::Layer pcpp::IDataContainer

Public Member Functions

 VxlanLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 VxlanLayer (uint32_t vni=0, uint16_t groupPolicyID=0, bool setGbpFlag=false, bool setPolicyAppliedFlag=false, bool setDontLearnFlag=false)
vxlan_headergetVxlanHeader () const
uint32_t getVNI () const
void setVNI (uint32_t vni)
void parseNextLayer ()
size_t getHeaderLen () const
void computeCalculateFields ()
std::string toString () const
OsiModelLayer getOsiModelLayer () const
- Public Member Functions inherited from pcpp::Layer
virtual ~Layer ()
LayergetNextLayer () const
LayergetPrevLayer () 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

Static Public Member Functions

static bool isVxlanPort (uint16_t port)

Detailed Description

Represents a VXLAN (Virtual eXtensible Local Area Network) protocol layer

Constructor & Destructor Documentation

◆ VxlanLayer() [1/2]

pcpp::VxlanLayer::VxlanLayer ( uint8_t *  data,
size_t  dataLen,
Layer prevLayer,
Packet packet 

A constructor that creates the layer from an existing packet raw data

[in]dataA pointer to the raw data
[in]dataLenSize of the data in bytes
[in]prevLayerA pointer to the previous layer
[in]packetA pointer to the Packet instance where layer will be stored in

◆ VxlanLayer() [2/2]

pcpp::VxlanLayer::VxlanLayer ( uint32_t  vni = 0,
uint16_t  groupPolicyID = 0,
bool  setGbpFlag = false,
bool  setPolicyAppliedFlag = false,
bool  setDontLearnFlag = false 

A constructor that creates a new VXLAN header and allocates the data. Note: the VNI present flag is set automatically

[in]vniVNI (VXLAN Network ID) to set. Optional parameter (default is 0)
[in]groupPolicyIDGroup Policy ID to set. Optional parameter (default is 0)
[in]setGbpFlagSet GBP flag. Optional parameter (default is false)
[in]setPolicyAppliedFlagSet Policy Applied flag. Optional parameter (default is false)
[in]setDontLearnFlagSet Don't Learn flag. Optional parameter (default is false)

Member Function Documentation

◆ computeCalculateFields()

void pcpp::VxlanLayer::computeCalculateFields ( )

Does nothing for this layer

Implements pcpp::Layer.

◆ getHeaderLen()

size_t pcpp::VxlanLayer::getHeaderLen ( ) const
Size of vxlan_header

Implements pcpp::Layer.

◆ getOsiModelLayer()

OsiModelLayer pcpp::VxlanLayer::getOsiModelLayer ( ) const
The OSI Model layer this protocol belongs to

Implements pcpp::Layer.

◆ getVNI()

uint32_t pcpp::VxlanLayer::getVNI ( ) const
The VXLAN Network ID (VNI) value

◆ getVxlanHeader()

vxlan_header* pcpp::VxlanLayer::getVxlanHeader ( ) const

Get a pointer to the VXLAN header. Notice this points directly to the data, so every change will change the actual packet data

A pointer to the vxlan_header

◆ isVxlanPort()

static bool pcpp::VxlanLayer::isVxlanPort ( uint16_t  port)

A static method that checks whether the port is considered as VxLAN

[in]portThe port number to be checked

◆ parseNextLayer()

void pcpp::VxlanLayer::parseNextLayer ( )

Next layer for VXLAN is always Ethernet

Implements pcpp::Layer.

◆ setVNI()

void pcpp::VxlanLayer::setVNI ( uint32_t  vni)

Set VXLAN Network ID (VNI) value

[in]vniVNI value to set

◆ toString()

std::string pcpp::VxlanLayer::toString ( ) const
A string representation of the layer most important data (should look like the layer description in Wireshark)

Implements pcpp::Layer.