PcapPlusPlus  Next
pcpp::TcpOption Class Reference

#include <TcpLayer.h>

Inheritance diagram for pcpp::TcpOption:
pcpp::TLVRecord< uint8_t, uint8_t >

Public Member Functions

 TcpOption (uint8_t *optionRawData)
 
 ~TcpOption () override=default
 
TcpOptionType getTcpOptionType () const
 
TcpOptionEnumType getTcpOptionEnumType () const
 
size_t getTotalSize () const override
 
size_t getDataSize () const override
 
- Public Member Functions inherited from pcpp::TLVRecord< uint8_t, uint8_t >
 TLVRecord (uint8_t *recordRawData)
 
 TLVRecord (const TLVRecord &other)
 
virtual ~TLVRecord ()=default
 
void assign (uint8_t *recordRawData)
 
TLVRecordoperator= (const TLVRecord &other)
 
bool operator== (const TLVRecord &rhs) const
 
bool operator!= (const TLVRecord &rhs) const
 
uint8_t getType () const
 
uint8_t * getValue () const
 
bool isNull () const
 
bool isNotNull () const
 
uint8_t * getRecordBasePtr () const
 
void purgeRecordData ()
 
getValueAs (size_t offset=0) const
 
bool setValue (T newValue, int valueOffset=0)
 

Static Public Member Functions

static bool canAssign (const uint8_t *recordRawData, size_t tlvDataLen)
 
- Static Public Member Functions inherited from pcpp::TLVRecord< uint8_t, uint8_t >
static bool canAssign (const uint8_t *recordRawData, size_t tlvDataLen)
 

Detailed Description

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

Constructor & Destructor Documentation

◆ TcpOption()

pcpp::TcpOption::TcpOption ( uint8_t *  optionRawData)
inlineexplicit

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

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

◆ ~TcpOption()

pcpp::TcpOption::~TcpOption ( )
overridedefault

A d'tor for this class, currently does nothing

Member Function Documentation

◆ canAssign()

static bool pcpp::TcpOption::canAssign ( const uint8_t *  recordRawData,
size_t  tlvDataLen 
)
inlinestatic

Check if a pointer can be assigned to the TLV record data

Parameters
[in]recordRawDataA pointer to the TLV record raw data
[in]tlvDataLenThe size of the TLV record raw data
Returns
True if data is valid and can be assigned

◆ getDataSize()

size_t pcpp::TcpOption::getDataSize ( ) const
inlineoverridevirtual
Returns
The size of the record value (meaning the size of the 'V' part in TLV)

Implements pcpp::TLVRecord< uint8_t, uint8_t >.

◆ getTcpOptionEnumType()

TcpOptionEnumType pcpp::TcpOption::getTcpOptionEnumType ( ) const
inline
Returns
TCP option type casted as pcpp::TcpOptionEnumType enum. If the data is null a value of TcpOptionEnumType::Unknown is returned

◆ getTcpOptionType()

TcpOptionType pcpp::TcpOption::getTcpOptionType ( ) const
inline
Deprecated:
This method is deprecated, please use getTcpOptionEnumType()

◆ getTotalSize()

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

Implements pcpp::TLVRecord< uint8_t, uint8_t >.