PcapPlusPlus
19.12
|
#include <DhcpLayer.h>
Public Member Functions | |
DhcpOption (uint8_t *optionRawData) | |
virtual | ~DhcpOption () |
IPv4Address | getValueAsIpAddr () const |
void | setValueIpAddr (const IPv4Address &addr, int valueOffset=0) |
std::string | getValueAsString (int valueOffset=0) const |
void | setValueString (const std::string &stringValue, int valueOffset=0) |
size_t | getTotalSize () const |
size_t | getDataSize () const |
Public Member Functions inherited from pcpp::TLVRecord | |
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 |
uint8_t | 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) |
A wrapper class for DHCP options. This class does not create or modify DHCP option records, but rather serves as a wrapper and provides useful methods for setting and retrieving data to/from them
|
inline |
A c'tor for this class that gets a pointer to the option raw data (byte array)
[in] | optionRawData | A pointer to the option raw data |
|
inlinevirtual |
A d'tor for this class, currently does nothing
|
inlinevirtual |
Implements pcpp::TLVRecord.
|
inlinevirtual |
Implements pcpp::TLVRecord.
|
inline |
Retrieve DHCP option data as IPv4 address. Relevant only if option value is indeed an IPv4 address
|
inline |
Retrieve DHCP option data as string. Relevant only if option value is indeed a string
[in] | valueOffset | An optional parameter that specifies where to start copy the DHCP option data. For example: when retrieving Client FQDN option, you may ignore the flags and RCODE fields using this method like this: getValueAsString(3). The default is 0 - start copying from the beginning of option data |
|
inline |
Set DHCP option data as IPv4 address. This method copies the 4 bytes of the IP address to the option value
[in] | addr | The IPv4 address to set |
[in] | valueOffset | An optional parameter that specifies where to start set the option data (default set to 0). For example: if option data is 20 bytes long and you want to set the IP address in the 4 last bytes then use this method like this: setValueIpAddr(your_addr, 16) |
|
inline |
Set DHCP option data as string. This method copies the string to the option value. If the string is longer than option length the string is trimmed so it will fit the option length
[in] | stringValue | The string to set |
[in] | valueOffset | An optional parameter that specifies where to start set the option data (default set to 0). For example: if option data is 20 bytes long and you want to set a 6 char-long string in the 6 last bytes then use this method like this: setValueString("string", 14) |