PcapPlusPlus
pcpp::IPv4Option Class Reference

#include <IPv4Layer.h>

Inheritance diagram for pcpp::IPv4Option:
pcpp::TLVRecord

Public Member Functions

 IPv4Option (uint8_t *optionRawData)
 
 ~IPv4Option ()
 
std::vector< IPv4AddressgetValueAsIpList ()
 
IPv4TimestampOptionValue getTimestampOptionValue ()
 
IPv4OptionTypes getIPv4OptionType () const
 
size_t getTotalSize () const
 
size_t getDataSize ()
 
- Public Member Functions inherited from pcpp::TLVRecord
 TLVRecord (uint8_t *recordRawData)
 
 TLVRecord (const TLVRecord &other)
 
virtual ~TLVRecord ()
 
TLVRecordoperator= (const TLVRecord &other)
 
bool operator== (const TLVRecord &rhs)
 
uint8_t getType ()
 
uint8_t * getValue ()
 
bool isNull ()
 
bool isNotNull ()
 
uint8_t * getRecordBasePtr ()
 
void purgeRecordData ()
 
template<typename T >
getValueAs (size_t offset=0)
 
template<typename T >
bool setValue (T newValue, int valueOffset=0)
 

Detailed Description

A wrapper class for IPv4 options. This class does not create or modify IPv4 option records, but rather serves as a wrapper and provides useful methods for retrieving data from them

Constructor & Destructor Documentation

◆ IPv4Option()

pcpp::IPv4Option::IPv4Option ( uint8_t *  optionRawData)
inline

A c'tor for this class that gets a pointer to the option raw data (byte array)

Parameters
[in]optionRawDataA pointer to the IPv4 option raw data

◆ ~IPv4Option()

pcpp::IPv4Option::~IPv4Option ( )
inline

A d'tor for this class, currently does nothing

Member Function Documentation

◆ getDataSize()

size_t pcpp::IPv4Option::getDataSize ( )
inlinevirtual
Returns
The size of the record value (meaning the size of the 'V' part in TLV)

Implements pcpp::TLVRecord.

◆ getIPv4OptionType()

IPv4OptionTypes pcpp::IPv4Option::getIPv4OptionType ( ) const
inline
Returns
IPv4 option type casted as pcpp::IPv4OptionTypes enum

◆ getTimestampOptionValue()

IPv4TimestampOptionValue pcpp::IPv4Option::getTimestampOptionValue ( )
inline

A method for parsing the IPv4 timestamp option value. This method is relevant only for IPv4 timestamp option. For other option types an empty result will be returned. The returned structure contains the timestamp value type (timestamp only, timestamp + IP addresses, etc.) as well as 2 vectors containing the list of timestamps and the list of IP addresses (if applicable for the timestamp value type). Blank timestamps or IP addresses (meaning zeroed values - timestamp=0 or IP address=0.0.0.0) will not be added to the lists. If some error occurs during the parsing or the value is invalid an empty result is returned

Returns
A structured containing the IPv4 timestamp value

◆ getTotalSize()

size_t pcpp::IPv4Option::getTotalSize ( ) const
inlinevirtual
Returns
The total size of the TLV record (in bytes)

Implements pcpp::TLVRecord.

◆ getValueAsIpList()

std::vector<IPv4Address> pcpp::IPv4Option::getValueAsIpList ( )
inline

A method for parsing the IPv4 option value as a list of IPv4 addresses. This method is relevant only for certain types of IPv4 options which their value is a list of IPv4 addresses such as IPV4OPT_RecordRoute, IPV4OPT_StrictSourceRoute, IPV4OPT_LooseSourceRoute, etc. This method returns a vector of the IPv4 addresses. Blank IP addresses (meaning zeroed addresses - 0.0.0.0) will not be added to the returned list. If some error occurs during the parsing or the value is invalid an empty vector is returned

Returns
A vector of IPv4 addresses parsed from the IPv4 option value