PcapPlusPlus  Next
pcpp::VrrpV2Layer Class Reference

#include <VrrpLayer.h>

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

Public Types

enum class  VrrpAuthType : uint8_t {
  NoAuthentication = 0 , SimpleTextPassword = 1 , IPAuthenticationHeader = 2 , MD5 = 3 ,
  Other = 4
}
 
- Public Types inherited from pcpp::VrrpLayer
enum  VrrpType { VrrpType_Unknown = 0 , VrrpType_Advertisement = 1 }
 
enum  VrrpPriority { Default , Stop , Owner , Other }
 

Public Member Functions

 VrrpV2Layer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
 VrrpV2Layer (uint8_t virtualRouterId, uint8_t priority, uint8_t advInt, uint8_t authType=0)
 
 ~VrrpV2Layer () override=default
 
uint8_t getAdvInt () const
 
void setAdvInt (uint8_t advInt)
 
uint8_t getAuthType () const
 
VrrpAuthType getAuthTypeAsEnum () const
 
void setAuthType (uint8_t authType)
 
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
 ~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
 

Additional Inherited Members

- Static Public Member Functions inherited from pcpp::VrrpLayer
static ProtocolType getVersionFromData (uint8_t *data, size_t dataLen)
 

Detailed Description

Represents VRRPv2 (Virtual Router Redundancy Protocol ver 2) layer. This class represents all the different messages of VRRPv2

Member Enumeration Documentation

◆ VrrpAuthType

enum pcpp::VrrpV2Layer::VrrpAuthType : uint8_t
strong

VRRP v2 authentication types

Enumerator
NoAuthentication 

No Authentication

SimpleTextPassword 

Simple Text Password

IPAuthenticationHeader 

IP Authentication Header

MD5 

Cisco VRRP MD5 Authentication

Other 

Other/Unknown Authentication Type

Constructor & Destructor Documentation

◆ VrrpV2Layer() [1/2]

pcpp::VrrpV2Layer::VrrpV2Layer ( 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

◆ VrrpV2Layer() [2/2]

pcpp::VrrpV2Layer::VrrpV2Layer ( uint8_t  virtualRouterId,
uint8_t  priority,
uint8_t  advInt,
uint8_t  authType = 0 
)
explicit

A constructor that allocates a new VRRP v2 layer

Parameters
virtualRouterIdVirtual router ID
priorityPriority
advIntAdvertisement interval
authTypeAuthentication type (default value is 0)

◆ ~VrrpV2Layer()

pcpp::VrrpV2Layer::~VrrpV2Layer ( )
overridedefault

A destructor for this layer (does nothing)

Member Function Documentation

◆ calculateChecksum()

uint16_t pcpp::VrrpV2Layer::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.

◆ getAdvInt()

uint8_t pcpp::VrrpV2Layer::getAdvInt ( ) const
Returns
The VRRP advertisement interval in this message

◆ getAuthType()

uint8_t pcpp::VrrpV2Layer::getAuthType ( ) const
Returns
The authentication type in this message

◆ getAuthTypeAsEnum()

VrrpAuthType pcpp::VrrpV2Layer::getAuthTypeAsEnum ( ) const
Returns
The VRRP authentication type as enum

◆ setAdvInt()

void pcpp::VrrpV2Layer::setAdvInt ( uint8_t  advInt)

Set advertisement interval value in this message

Parameters
advIntvalue to set

◆ setAuthType()

void pcpp::VrrpV2Layer::setAuthType ( uint8_t  authType)

Set VRRP authentication type

Parameters
authTypevalue to set