1 #ifndef PACKETPP_VRRP_LAYER 2 #define PACKETPP_VRRP_LAYER 76 #if (BYTE_ORDER == LITTLE_ENDIAN) 118 bool addIPAddressesAt(
const std::vector<IPAddress> &
ipAddresses,
int offset);
120 uint8_t getIPAddressLen()
const;
122 bool isIPAddressValid(
IPAddress &ipAddress)
const;
124 uint8_t* getFirstIPAddressPtr()
const;
126 uint8_t* getNextIPAddressPtr(uint8_t* ipAddressPtr)
const;
128 IPAddress getIPAddressFromData(uint8_t *data)
const;
130 void copyIPAddressToData(uint8_t *data,
const IPAddress &ipAddress)
const;
137 :
Layer(data, dataLen, prevLayer, packet), m_AddressType(addressType)
139 m_Protocol = vrrpVer;
155 VrrpType_Unknown = 0,
158 VrrpType_Advertisement = 1
190 static ProtocolType getVersionFromData(uint8_t *data,
size_t dataLen);
195 uint8_t getVersion()
const;
205 uint8_t getVirtualRouterID()
const;
211 void setVirtualRouterID(uint8_t virtualRouterID);
216 uint8_t getPriority()
const;
227 void setPriority(uint8_t priority);
232 uint16_t getChecksum()
const;
237 void calculateAndSetChecksum();
243 virtual uint16_t calculateChecksum()
const = 0;
248 bool isChecksumCorrect()
const;
253 uint8_t getIPAddressesCount()
const;
258 std::vector<IPAddress> getIPAddresses()
const;
266 bool addIPAddresses(
const std::vector<IPAddress> &ipAddresses);
274 bool addIPAddress(
const IPAddress &ipAddress);
282 bool removeIPAddressAtIndex(
int index);
289 bool removeAllIPAddresses();
301 void computeCalculateFields()
override;
308 std::string toString()
const override;
320 struct vrrpv2_auth_adv
333 NoAuthentication = 0,
335 SimpleTextPassword = 1,
337 IPAuthenticationHeader = 2,
360 explicit VrrpV2Layer(uint8_t virtualRouterId, uint8_t
priority, uint8_t advInt, uint8_t authType = 0);
370 uint8_t getAdvInt()
const;
376 void setAdvInt(uint8_t advInt);
381 uint8_t getAuthType()
const;
392 void setAuthType(uint8_t authType);
400 uint16_t calculateChecksum()
const override;
410 struct vrrpv3_rsvd_adv
443 uint16_t getMaxAdvInt()
const;
449 void setMaxAdvInt(uint16_t maxAdvInt);
457 uint16_t calculateChecksum()
const override;
461 #endif // PACKETPP_VRRP_LAYER The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:333
Definition: VrrpLayer.h:115
VrrpPriority
Definition: VrrpLayer.h:164
void parseNextLayer() override
Definition: VrrpLayer.h:296
AddressType
Definition: IpAddress.h:327
~VrrpV2Layer()
Definition: VrrpLayer.h:365
size_t getHeaderLen() const override
Definition: VrrpLayer.h:306
Definition: VrrpLayer.h:169
Definition: VrrpLayer.h:167
Definition: ProtocolType.h:340
uint64_t ProtocolType
Definition: ProtocolType.h:18
VrrpV2Layer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: VrrpLayer.h:350
OsiModelLayer getOsiModelLayer() const override
Definition: VrrpLayer.h:310
~VrrpV3Layer()
Definition: VrrpLayer.h:438
Definition: VrrpLayer.h:317
const ProtocolType VRRPv3
Definition: ProtocolType.h:318
Definition: VrrpLayer.h:407
Definition: VrrpLayer.h:171
VrrpType
Definition: VrrpLayer.h:152
const ProtocolType VRRPv2
Definition: ProtocolType.h:313
VrrpAuthType
Definition: VrrpLayer.h:330
Definition: IpAddress.h:321
VrrpV3Layer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet, IPAddress::AddressType addressType)
Definition: VrrpLayer.h:423