PcapPlusPlus  21.05
pcpp::IPLayer Class Referenceabstract

#include <IPLayer.h>

Inheritance diagram for pcpp::IPLayer:
pcpp::IPv4Layer pcpp::IPv6Layer

Public Member Functions

virtual IPAddress getSrcIPAddress () const =0
 
virtual IPAddress getDstIPAddress () const =0
 

Detailed Description

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.

Member Function Documentation

◆ getDstIPAddress()

virtual IPAddress pcpp::IPLayer::getDstIPAddress ( ) const
pure virtual

An abstract method to get the destination IP address

Returns
An IPAddress object containing the destination address

Implemented in pcpp::IPv4Layer, and pcpp::IPv6Layer.

◆ getSrcIPAddress()

virtual IPAddress pcpp::IPLayer::getSrcIPAddress ( ) const
pure virtual

An abstract method to get the source IP address

Returns
An IPAddress object containing the source address

Implemented in pcpp::IPv4Layer, and pcpp::IPv6Layer.