PcapPlusPlus
Next
|
#include <IPLayer.h>
Public Member Functions | |
virtual IPAddress | getSrcIPAddress () const =0 |
virtual IPAddress | getDstIPAddress () const =0 |
virtual | ~IPLayer ()=default |
An empty destructor. | |
Static Public Member Functions | |
static ProtocolType | getIPVersion (uint8_t const *data, size_t dataLen) |
Get the IP version of a given packet data. More... | |
This is an interface (abstract class) implemented in the IP layers (IPv4Layer and IPv6Layer). It provides methods to fetch the source and destination IP addresses in an abdtract way that hides the IP type (IPv4 or IPv6). This is useful for use-cases in which the IP type doesn't matter. For example: if you're only interested in printing the IP address the IP type shouldn't matter.
|
pure virtual |
An abstract method to get the destination IP address
Implemented in pcpp::IPv6Layer, and pcpp::IPv4Layer.
|
static |
Get the IP version of a given packet data.
The buffer is expected to start with the IP header and contain at least the first byte of it. The method will recognize IPv4 and IPv6 headers and return the respective protocol constant. If the IP version is not recognized or the buffer is malformed, UnknownProtocol will be returned.
[in] | data | A pointer to the packet data |
[in] | dataLen | The length of the packet data in bytes |
|
pure virtual |
An abstract method to get the source IP address
Implemented in pcpp::IPv6Layer, and pcpp::IPv4Layer.