PcapPlusPlus
|
#include <DhcpLayer.h>
Public Member Functions | |
template<typename T > | |
T | getValueAs (int valueOffset=0) |
IPv4Address | getValueAsIpAddr () |
std::string | getValueAsString (int valueOffset=0) |
template<typename T > | |
void | setValue (T newValue, int valueOffset=0) |
void | setValueIpAddr (const IPv4Address &addr, int valueOffset=0) |
void | setValueString (const std::string &stringValue, int valueOffset=0) |
size_t | getTotalSize () const |
uint8_t | getLength () |
DhcpOptionTypes | getType () |
Public Attributes | |
uint8_t | opCode |
uint8_t | len |
uint8_t | value [] |
Representing a DHCP option in a TLV (type-length-value) structure
|
inline |
|
inline |
|
inline |
|
inline |
A templated method to retrieve the DHCP option data as a certain type T. For example, if DHCP option data is 4B (integer) then this method should be used as getValueAs<int>() and it will return the DHCP option data as an integer.
Notice this return value is a copy of the data, not a pointer to the actual data
[in] | valueOffset | An optional parameter that specifies where to start copy the DHCP option data. For example: if option data is 20 bytes and you need only the 4 last bytes as integer then use this method like this: getValueAs<int>(16). The default is 0 - start copying from the beginning of option data |
|
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 |
A templated method to copy data of type T into the DHCP option data. For example: if option data is 4[Bytes] long use this method with <int> to set an integer value into the DHCP option data: setValue<int>(num)
[in] | newValue | The value of type T to copy to DHCP option data |
[in] | valueOffset | An optional parameter that specifies where to start setting the option data (default set to 0). For example: if option 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) |
|
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) |
uint8_t pcpp::DhcpOptionData::len |
DHCP option length
uint8_t pcpp::DhcpOptionData::opCode |
DHCP option code, should be on of DhcpOptionTypes
uint8_t pcpp::DhcpOptionData::value[] |
DHCP option value