PcapPlusPlus  23.09
pcpp::VrrpV3Layer Class Reference

#include <VrrpLayer.h>

Inheritance diagram for pcpp::VrrpV3Layer:
pcpp::VrrpLayer pcpp::Layer pcpp::IDataContainer

Public Member Functions

 VrrpV3Layer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet, IPAddress::AddressType addressType)
 
 VrrpV3Layer (IPAddress::AddressType addressType, uint8_t virtualRouterId, uint8_t priority, uint16_t maxAdvInt)
 
 ~VrrpV3Layer ()
 
uint16_t getMaxAdvInt () const
 
void setMaxAdvInt (uint16_t maxAdvInt)
 
uint16_t calculateChecksum () const override
 
- Public Member Functions inherited from pcpp::VrrpLayer
IPAddress::AddressType getAddressType () const
 
uint8_t getVersion () const
 
VrrpType getType () const
 
uint8_t getVirtualRouterID () const
 
void setVirtualRouterID (uint8_t virtualRouterID)
 
uint8_t getPriority () const
 
VrrpPriority getPriorityAsEnum () const
 
void setPriority (uint8_t priority)
 
uint16_t getChecksum () const
 
void calculateAndSetChecksum ()
 
bool isChecksumCorrect () const
 
uint8_t getIPAddressesCount () const
 
std::vector< IPAddressgetIPAddresses () const
 
bool addIPAddresses (const std::vector< IPAddress > &ipAddresses)
 
bool addIPAddress (const IPAddress &ipAddress)
 
bool removeIPAddressAtIndex (int index)
 
bool removeAllIPAddresses ()
 
void parseNextLayer () override
 
void computeCalculateFields () override
 
size_t getHeaderLen () const override
 
std::string toString () const override
 
OsiModelLayer getOsiModelLayer () const override
 
- 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
 

Additional Inherited Members

- Public Types inherited from pcpp::VrrpLayer
enum  VrrpType { VrrpType_Unknown = 0, VrrpType_Advertisement = 1 }
 
enum  VrrpPriority { Default, Stop, Owner, Other }
 
- Static Public Member Functions inherited from pcpp::VrrpLayer
static ProtocolType getVersionFromData (uint8_t *data, size_t dataLen)
 

Detailed Description

Represents VRRPv3 (Virtual Router Redundancy Protocol ver 3) layer. This class represents all the different messages of VRRP

Constructor & Destructor Documentation

◆ VrrpV3Layer() [1/2]

pcpp::VrrpV3Layer::VrrpV3Layer ( uint8_t *  data,
size_t  dataLen,
Layer prevLayer,
Packet packet,
IPAddress::AddressType  addressType 
)
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
[in]addressTypeThe IP address type to set for this layer

◆ VrrpV3Layer() [2/2]

pcpp::VrrpV3Layer::VrrpV3Layer ( IPAddress::AddressType  addressType,
uint8_t  virtualRouterId,
uint8_t  priority,
uint16_t  maxAdvInt 
)
explicit

A constructor that allocates a new VRRPv3

Parameters
addressTypeThe IP address type to set for this layer
virtualRouterIdVirtual router ID
priorityPriority
maxAdvIntMax advertisement interval

◆ ~VrrpV3Layer()

pcpp::VrrpV3Layer::~VrrpV3Layer ( )
inline

A destructor for this layer (does nothing)

Member Function Documentation

◆ calculateChecksum()

uint16_t pcpp::VrrpV3Layer::calculateChecksum ( ) const
overridevirtual

Calculate the checksum from header and data and write the result to vrrp_header::checksum

Returns
The checksum result

Implements pcpp::VrrpLayer.

◆ getMaxAdvInt()

uint16_t pcpp::VrrpV3Layer::getMaxAdvInt ( ) const
Returns
The maximum advertisement interval in this message

◆ setMaxAdvInt()

void pcpp::VrrpV3Layer::setMaxAdvInt ( uint16_t  maxAdvInt)

Set the maximum advertisement interval value

Parameters
maxAdvIntValue to set