PcapPlusPlus  20.08+
pcpp::IPv4OptionBuilder Class Reference

#include <IPv4Layer.h>

Inheritance diagram for pcpp::IPv4OptionBuilder:
pcpp::TLVRecordBuilder

Public Member Functions

 IPv4OptionBuilder (IPv4OptionTypes optionType, const uint8_t *optionValue, uint8_t optionValueLen)
 
 IPv4OptionBuilder (IPv4OptionTypes optionType, uint16_t optionValue)
 
 IPv4OptionBuilder (IPv4OptionTypes optionType, const std::vector< IPv4Address > &ipList)
 
 IPv4OptionBuilder (const IPv4TimestampOptionValue &timestampValue)
 
IPv4Option build () const
 

Detailed Description

A class for building IPv4 option records. This builder receives the IPv4 option parameters in its c'tor, builds the IPv4 option raw buffer and provides a build() method to get a IPv4Option object out of it

Constructor & Destructor Documentation

◆ IPv4OptionBuilder() [1/4]

pcpp::IPv4OptionBuilder::IPv4OptionBuilder ( IPv4OptionTypes  optionType,
const uint8_t *  optionValue,
uint8_t  optionValueLen 
)
inline

A c'tor for building IPv4 options which their value is a byte array. The IPv4Option object can be later retrieved by calling build()

Parameters
[in]optionTypeIPv4 option type
[in]optionValueA buffer containing the option value. This buffer is read-only and isn't modified in any way. For option types IPV4OPT_NOP and IPV4OPT_EndOfOptionsList this parameter is ignored (expected to be NULL) as these option types don't contain any data
[in]optionValueLenOption value length in bytes

◆ IPv4OptionBuilder() [2/4]

pcpp::IPv4OptionBuilder::IPv4OptionBuilder ( IPv4OptionTypes  optionType,
uint16_t  optionValue 
)
inline

A c'tor for building IPv4 options which have a 2-byte value. The IPv4Option object can be later retrieved by calling build()

Parameters
[in]optionTypeIPv4 option type
[in]optionValueA 2-byte option value

◆ IPv4OptionBuilder() [3/4]

pcpp::IPv4OptionBuilder::IPv4OptionBuilder ( IPv4OptionTypes  optionType,
const std::vector< IPv4Address > &  ipList 
)

A c'tor for building IPv4 options which their value is a list of IPv4 addresses, for example: IPV4OPT_RecordRoute, IPV4OPT_StrictSourceRoute, IPV4OPT_LooseSourceRoute. The IPv4Option object can be later retrieved by calling build()

Parameters
[in]optionTypeIPv4 option type
[in]ipListA vector of IPv4 addresses that will be used as the option value

◆ IPv4OptionBuilder() [4/4]

pcpp::IPv4OptionBuilder::IPv4OptionBuilder ( const IPv4TimestampOptionValue timestampValue)

A c'tor for building IPv4 timestamp option (IPV4OPT_Timestamp). The IPv4Option object can be later retrieved by calling build()

Parameters
[in]timestampValueThe timestamp value to build the IPv4 option with

Member Function Documentation

◆ build()

IPv4Option pcpp::IPv4OptionBuilder::build ( ) const

Build the IPv4Option object out of the parameters defined in the c'tor

Returns
The IPv4Option object