PcapPlusPlus
pcpp::IPv6TLVOptionHeader::TLVOptionBuilder Class Reference

#include <IPv6Extensions.h>

Public Member Functions

 TLVOptionBuilder (uint8_t optType, uint8_t optDataLen, const uint8_t *optValue)
 
 TLVOptionBuilder (uint8_t optType, uint8_t optValue)
 
 TLVOptionBuilder (uint8_t optType, uint16_t optValue)
 
 TLVOptionBuilder (const TLVOptionBuilder &other)
 
 ~TLVOptionBuilder ()
 
TLVOptionbuild () const
 
uint8_t * getRawBuffer () const
 

Detailed Description

A class for building Type-Length-Value (TLV) options of type TLVOption. This builder gets the option parameters in its c'tor, builds the option raw buffer and provides a method to build a TLVOption object out of it

Constructor & Destructor Documentation

◆ TLVOptionBuilder() [1/4]

pcpp::IPv6TLVOptionHeader::TLVOptionBuilder::TLVOptionBuilder ( uint8_t  optType,
uint8_t  optDataLen,
const uint8_t *  optValue 
)

A c'tor which gets the option type, option length and a buffer containing the option value and builds the option raw buffer which can later be casted to TLVOption object using the build() method

Parameters
[in]optTypeOption type
[in]optDataLenOption length in bytes
[in]optValueA buffer containing the option data. This buffer is read-only and isn't modified in any way

◆ TLVOptionBuilder() [2/4]

pcpp::IPv6TLVOptionHeader::TLVOptionBuilder::TLVOptionBuilder ( uint8_t  optType,
uint8_t  optValue 
)

A c'tor which gets the option type, a 1-byte option value (which length is 1) and builds the option raw buffer which can later be casted to TLVOption object using the build() method

Parameters
[in]optTypeOption type
[in]optValueA 1-byte option value

◆ TLVOptionBuilder() [3/4]

pcpp::IPv6TLVOptionHeader::TLVOptionBuilder::TLVOptionBuilder ( uint8_t  optType,
uint16_t  optValue 
)

A c'tor which gets the option type, a 2-byte option value (which length is 2) and builds the option raw buffer which can later be casted to TLVOption object using the build() method

Parameters
[in]optTypeOption type
[in]optValueA 2-byte option value

◆ TLVOptionBuilder() [4/4]

pcpp::IPv6TLVOptionHeader::TLVOptionBuilder::TLVOptionBuilder ( const TLVOptionBuilder other)

A copy c'tor which copies all the data from another instance of TLVOptionBuilder

Parameters
[in]otherThe instance to copy from

◆ ~TLVOptionBuilder()

pcpp::IPv6TLVOptionHeader::TLVOptionBuilder::~TLVOptionBuilder ( )
inline

A d'tor for this class, frees all allocated memory

Member Function Documentation

◆ build()

TLVOption* pcpp::IPv6TLVOptionHeader::TLVOptionBuilder::build ( ) const
inline

A method that returns a pointer to TLVOption object containing option parameters. Notice the return value is just a TLVOption-pointer cast of the raw buffer that is stored inside this class so modifying it will modify the internal raw buffer

Returns
A pointer to a TLVOption object

◆ getRawBuffer()

uint8_t* pcpp::IPv6TLVOptionHeader::TLVOptionBuilder::getRawBuffer ( ) const
inline
Returns
A pointer to the raw buffer stored as a private member of this class