PcapPlusPlus
pcpp::VxlanLayer Class Reference

#include <VxlanLayer.h>

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

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 ()
 
uint32_t getVNI ()
 
void setVNI (uint32_t vni)
 
void parseNextLayer ()
 
size_t getHeaderLen ()
 
void computeCalculateFields ()
 
std::string toString ()
 
OsiModelLayer getOsiModelLayer ()
 
- Public Member Functions inherited from pcpp::Layer
virtual ~Layer ()
 
LayergetNextLayer ()
 
LayergetPrevLayer ()
 
ProtocolType getProtocol ()
 
uint8_t * getData ()
 
size_t getDataLen ()
 
uint8_t * getLayerPayload ()
 
size_t getLayerPayloadSize ()
 
bool isAllocatedToPacket ()
 
void copyData (uint8_t *toArr)
 

Detailed Description

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

Constructor & Destructor Documentation

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

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

void pcpp::VxlanLayer::computeCalculateFields ( )
inlinevirtual

Does nothing for this layer

Implements pcpp::Layer.

size_t pcpp::VxlanLayer::getHeaderLen ( )
inlinevirtual
Returns
Size of vxlan_header

Implements pcpp::Layer.

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

Implements pcpp::Layer.

uint32_t pcpp::VxlanLayer::getVNI ( )
Returns
The VXLAN Network ID (VNI) value
vxlan_header* pcpp::VxlanLayer::getVxlanHeader ( )
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
void pcpp::VxlanLayer::parseNextLayer ( )
virtual

Next layer for VXLAN is always Ethernet

Implements pcpp::Layer.

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

Set VXLAN Network ID (VNI) value

Parameters
[in]vniVNI value to set
std::string pcpp::VxlanLayer::toString ( )
virtual
Returns
A string representation of the layer most important data (should look like the layer description in Wireshark)

Implements pcpp::Layer.