PcapPlusPlus
21.11
|
#include <TLVData.h>
Classes | |
struct | TLVRawData |
Public Member Functions | |
TLVRecord (uint8_t *recordRawData) | |
TLVRecord (const TLVRecord &other) | |
virtual | ~TLVRecord () |
void | assign (uint8_t *recordRawData) |
TLVRecord & | operator= (const TLVRecord &other) |
bool | operator== (const TLVRecord &rhs) const |
bool | operator!= (const TLVRecord &rhs) const |
TRecType | getType () const |
uint8_t * | getValue () const |
bool | isNull () const |
bool | isNotNull () const |
uint8_t * | getRecordBasePtr () const |
void | purgeRecordData () |
template<typename T > | |
T | getValueAs (size_t offset=0) const |
template<typename T > | |
bool | setValue (T newValue, int valueOffset=0) |
virtual size_t | getTotalSize () const =0 |
virtual size_t | getDataSize () const =0 |
A wrapper class for a Type-Length-Value (TLV) record. This class does not create or modify TLV records, but rather serves as a wrapper and provides useful methods for retrieving data from them. This class has several abstract methods that should be implemented in derived classes. These methods are for record length value calculation (the 'L' in TLV) which is implemented differently in different protocols
|
inline |
A c'tor for this class that gets a pointer to the TLV record raw data (byte array)
[in] | recordRawData | A pointer to the TLV record raw data |
|
inline |
A copy c'tor for this class. This copy c'tor doesn't copy the TLV data, but only the pointer to it, which means that after calling it both the old and the new instance will point to the same TLV raw data
[in] | other | The TLVRecord instance to copy from |
|
inlinevirtual |
A d'tor for this class, currently does nothing
|
inline |
Assign a pointer to the TLV record raw data (byte array)
[in] | recordRawData | A pointer to the TLV record raw data |
|
pure virtual |
Implemented in pcpp::DhcpOption, pcpp::IPv4Option, pcpp::PPPoEDiscoveryLayer::PPPoETag, pcpp::TcpOption, pcpp::IPv6TLVOptionHeader::IPv6Option, pcpp::DhcpV6Option, and pcpp::RadiusAttribute.
|
inline |
|
pure virtual |
Implemented in pcpp::DhcpOption, pcpp::IPv4Option, pcpp::PPPoEDiscoveryLayer::PPPoETag, pcpp::TcpOption, pcpp::DhcpV6Option, pcpp::IPv6TLVOptionHeader::IPv6Option, and pcpp::RadiusAttribute.
|
inline |
|
inline |
|
inline |
A templated method to retrieve the record data as a certain type T. For example, if record data is 4B long (integer) then this method should be used as getValueAs<int>() and it will return the record data as an integer.
Notice this return value is a copy of the data, not a pointer to the actual data
[in] | offset | The offset in the record data to start reading the value from. Useful for cases when you want to read some of the data that doesn't start at offset 0. This is an optional parameter and the default value is 0, meaning start reading the value at the beginning of the record data |
|
inline |
|
inline |
|
inline |
Overload of the not equal operator.
[in] | rhs | The object to compare to |
|
inline |
Overload of the assignment operator. This operator doesn't copy the TLV data, but rather copies the pointer to it, which means that after calling it both the old and the new instance will point to the same TLV raw data
[in] | other | The TLVRecord instance to assign |
|
inline |
Overload of the equality operator. Two record are equal if both of them point to the same data, or if they point to different data but their total size is equal and the raw data they both contain is similar.
[in] | rhs | The object to compare to |
|
inline |
Free the memory of the TLV record raw data
|
inline |
A templated method to copy data of type T into the TLV record data. For example: if record data is 4[Bytes] long use this method with <int> to set an integer value into the record data: setValue<int>(num)
[in] | newValue | The value of type T to copy to the record data |
[in] | valueOffset | An optional parameter that specifies where to start setting the record data (default set to 0). For example: if record data is 20 bytes long and you only need to set the 4 last bytes as integer then use this method like this: setValue<int>(num, 16) |