PcapPlusPlus  Next
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 () override
 
size_t getHeaderLen () const override
 
void computeCalculateFields () override
 
std::string toString () const override
 
OsiModelLayer getOsiModelLayer () const override
 
- Public Member Functions inherited from pcpp::Layer
 ~Layer () override
 
LayergetNextLayer () const
 
LayergetPrevLayer () const
 
ProtocolType getProtocol () const
 
bool isMemberOfProtocolFamily (ProtocolTypeFamily protocolTypeFamily) 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 override
 

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 
)
inline

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

Parameters
[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 
)
explicit

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

Parameters
[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 ( )
inlineoverridevirtual

Does nothing for this layer

Implements pcpp::Layer.

◆ getHeaderLen()

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

Implements pcpp::Layer.

◆ getOsiModelLayer()

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

Implements pcpp::Layer.

◆ getVNI()

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

◆ getVxlanHeader()

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

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

Returns
A pointer to the vxlan_header

◆ isVxlanPort()

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

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

Parameters
[in]portThe port number to be checked

◆ parseNextLayer()

void pcpp::VxlanLayer::parseNextLayer ( )
overridevirtual

Next layer for VXLAN is always Ethernet

Implements pcpp::Layer.

◆ setVNI()

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

Set VXLAN Network ID (VNI) value

Parameters
[in]vniVNI value to set

◆ toString()

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

Implements pcpp::Layer.