67 #if (BYTE_ORDER == LITTLE_ENDIAN)
101 static_assert(
sizeof(
vrrp_header) == 8,
"vrrp_header size is not 8 bytes");
110 bool addIPAddressesAt(
const std::vector<IPAddress>& ipAddresses,
int offset);
112 uint8_t getIPAddressLen()
const;
114 bool isIPAddressValid(
IPAddress& ipAddress)
const;
116 uint8_t* getFirstIPAddressPtr()
const;
118 uint8_t* getNextIPAddressPtr(uint8_t* ipAddressPtr)
const;
120 IPAddress getIPAddressFromData(uint8_t* data)
const;
122 void copyIPAddressToData(uint8_t* data,
const IPAddress& ipAddress)
const;
129 :
Layer(data, dataLen, prevLayer, packet, vrrpVer), m_AddressType(addressType)
274 struct vrrpv2_auth_adv
310 explicit VrrpV2Layer(uint8_t virtualRouterId, uint8_t priority, uint8_t advInt, uint8_t authType = 0);
345 struct vrrpv3_rsvd_adv
Definition: IpAddress.h:276
AddressType
An enum representing the address type: IPv4 or IPv6.
Definition: IpAddress.h:280
Definition: VrrpLayer.h:108
bool isChecksumCorrect() const
void setVirtualRouterID(uint8_t virtualRouterID)
virtual uint16_t calculateChecksum() const =0
static ProtocolType getVersionFromData(uint8_t *data, size_t dataLen)
size_t getHeaderLen() const override
Definition: VrrpLayer.h:255
uint8_t getPriority() const
bool addIPAddresses(const std::vector< IPAddress > &ipAddresses)
IPAddress::AddressType getAddressType() const
void parseNextLayer() override
Does nothing for this layer (VRRP layer is always last)
Definition: VrrpLayer.h:247
std::string toString() const override
void calculateAndSetChecksum()
Fill the checksum from header and data and write the result to vrrp_header::checksum.
uint8_t getIPAddressesCount() const
VrrpPriority getPriorityAsEnum() const
VrrpType
VRRP message types.
Definition: VrrpLayer.h:144
@ VrrpType_Unknown
Unknown VRRP message.
Definition: VrrpLayer.h:146
@ VrrpType_Advertisement
VRRP advertisement message.
Definition: VrrpLayer.h:149
void computeCalculateFields() override
Calculate the VRRP checksum.
uint8_t getVersion() const
bool removeIPAddressAtIndex(int index)
uint8_t getVirtualRouterID() const
void setPriority(uint8_t priority)
OsiModelLayer getOsiModelLayer() const override
Definition: VrrpLayer.h:262
uint16_t getChecksum() const
std::vector< IPAddress > getIPAddresses() const
bool removeAllIPAddresses()
VrrpPriority
An enum describing VRRP special priority values.
Definition: VrrpLayer.h:154
@ Other
Other priority.
Definition: VrrpLayer.h:162
@ Stop
Current Master has stopped participating in VRRP (value of 0)
Definition: VrrpLayer.h:158
@ Default
Default priority for a backup VRRP router (value of 100)
Definition: VrrpLayer.h:156
@ Owner
This VRRP router owns the virtual router's IP address(es) (value of 255)
Definition: VrrpLayer.h:160
bool addIPAddress(const IPAddress &ipAddress)
Definition: VrrpLayer.h:272
VrrpAuthType
VRRP v2 authentication types.
Definition: VrrpLayer.h:283
@ Other
Other/Unknown Authentication Type.
@ MD5
Cisco VRRP MD5 Authentication.
@ IPAuthenticationHeader
IP Authentication Header.
@ NoAuthentication
No Authentication.
@ SimpleTextPassword
Simple Text Password.
uint8_t getAdvInt() const
~VrrpV2Layer() override=default
A destructor for this layer (does nothing)
VrrpAuthType getAuthTypeAsEnum() const
VrrpV2Layer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: VrrpLayer.h:301
uint16_t calculateChecksum() const override
void setAdvInt(uint8_t advInt)
uint8_t getAuthType() const
void setAuthType(uint8_t authType)
VrrpV2Layer(uint8_t virtualRouterId, uint8_t priority, uint8_t advInt, uint8_t authType=0)
Definition: VrrpLayer.h:343
uint16_t calculateChecksum() const override
~VrrpV3Layer() override=default
A destructor for this layer (does nothing)
void setMaxAdvInt(uint16_t maxAdvInt)
VrrpV3Layer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet, IPAddress::AddressType addressType)
Definition: VrrpLayer.h:357
VrrpV3Layer(IPAddress::AddressType addressType, uint8_t virtualRouterId, uint8_t priority, uint16_t maxAdvInt)
uint16_t getMaxAdvInt() const
The main namespace for the PcapPlusPlus lib.
const ProtocolType VRRPv3
VRRP version 3 protocol.
Definition: ProtocolType.h:194
uint8_t ProtocolType
Definition: ProtocolType.h:13
OsiModelLayer
An enum representing OSI model layers.
Definition: ProtocolType.h:225
@ OsiModelNetworkLayer
Network layer (layer 3)
Definition: ProtocolType.h:231
const ProtocolType VRRPv2
VRRP version 2 protocol.
Definition: ProtocolType.h:191