PcapPlusPlus  23.09
pcpp::PcapRemoteDeviceList Class Reference

#include <PcapRemoteDeviceList.h>

Public Types

typedef std::vector< PcapRemoteDevice * >::iterator RemoteDeviceListIterator
 
typedef std::vector< PcapRemoteDevice * >::const_iterator ConstRemoteDeviceListIterator
 

Public Member Functions

IPAddress getRemoteMachineIpAddress () const
 
uint16_t getRemoteMachinePort () const
 
PcapRemoteDevicegetRemoteDeviceByIP (const IPv4Address &ip4Addr) const
 
PcapRemoteDevicegetRemoteDeviceByIP (const IPv6Address &ip6Addr) const
 
PcapRemoteDevicegetRemoteDeviceByIP (const IPAddress &ipAddr) const
 
PcapRemoteDevicegetRemoteDeviceByIP (const std::string &ipAddrAsString) const
 
RemoteDeviceListIterator begin ()
 
ConstRemoteDeviceListIterator begin () const
 
RemoteDeviceListIterator end ()
 
ConstRemoteDeviceListIterator end () const
 

Static Public Member Functions

static PcapRemoteDeviceListgetRemoteDeviceList (const IPAddress &ipAddress, uint16_t port)
 
static PcapRemoteDeviceListgetRemoteDeviceList (const IPAddress &ipAddress, uint16_t port, PcapRemoteAuthentication *remoteAuth)
 

Detailed Description

A class that creates, stores and provides access to all instances of PcapRemoteDevice for a certain remote machine. To get an instance of this class use one of the static methods of getRemoteDeviceList(). These methods creates a PcapRemoteDeviceList instance for the certain remote machine which holds a list of PcapRemoteDevice instances, one for each remote network interface. Note there is not a public constructor for this class, so the only way to get an instance of it is through getRemoteDeviceList(). After getting this object, this class provides ways to access the PcapRemoteDevice instances: either through IP address of the remote network interface or by iterating the PcapRemoteDevice instances (through the PcapRemoteDeviceList::RemoteDeviceListIterator iterator)
Since Remote Capture is supported in WinPcap and Npcap only, this class is available in Windows only

Member Typedef Documentation

◆ ConstRemoteDeviceListIterator

Const iterator object that can be used for iterating all PcapRemoteDevice in a constant list

◆ RemoteDeviceListIterator

Iterator object that can be used for iterating all PcapRemoteDevice in list

Member Function Documentation

◆ begin() [1/2]

RemoteDeviceListIterator pcpp::PcapRemoteDeviceList::begin ( )
inline
Returns
An iterator object pointing to the first PcapRemoteDevice in list

◆ begin() [2/2]

ConstRemoteDeviceListIterator pcpp::PcapRemoteDeviceList::begin ( ) const
inline
Returns
A const iterator object pointing to the first PcapRemoteDevice in list

◆ end() [1/2]

RemoteDeviceListIterator pcpp::PcapRemoteDeviceList::end ( )
inline
Returns
An iterator object pointing to the last PcapRemoteDevice in list

◆ end() [2/2]

ConstRemoteDeviceListIterator pcpp::PcapRemoteDeviceList::end ( ) const
inline
Returns
A const iterator object pointing to the last PcapRemoteDevice in list

◆ getRemoteDeviceByIP() [1/4]

PcapRemoteDevice* pcpp::PcapRemoteDeviceList::getRemoteDeviceByIP ( const IPv4Address ip4Addr) const

Search a PcapRemoteDevice in the list by its IPv4 address

Parameters
[in]ip4AddrThe IPv4 address
Returns
The PcapRemoteDevice if found, NULL otherwise

◆ getRemoteDeviceByIP() [2/4]

PcapRemoteDevice* pcpp::PcapRemoteDeviceList::getRemoteDeviceByIP ( const IPv6Address ip6Addr) const

Search a PcapRemoteDevice in the list by its IPv6 address

Parameters
[in]ip6AddrThe IPv6 address
Returns
The PcapRemoteDevice if found, NULL otherwise

◆ getRemoteDeviceByIP() [3/4]

PcapRemoteDevice* pcpp::PcapRemoteDeviceList::getRemoteDeviceByIP ( const IPAddress ipAddr) const

Search a PcapRemoteDevice in the list by its IP address (IPv4 or IPv6)

Parameters
[in]ipAddrThe IP address
Returns
The PcapRemoteDevice if found, NULL otherwise

◆ getRemoteDeviceByIP() [4/4]

PcapRemoteDevice* pcpp::PcapRemoteDeviceList::getRemoteDeviceByIP ( const std::string &  ipAddrAsString) const

Search a PcapRemoteDevice in the list by its IP address

Parameters
[in]ipAddrAsStringThe IP address in string format
Returns
The PcapRemoteDevice if found, NULL otherwise

◆ getRemoteDeviceList() [1/2]

static PcapRemoteDeviceList* pcpp::PcapRemoteDeviceList::getRemoteDeviceList ( const IPAddress ipAddress,
uint16_t  port 
)
static

A static method for creating a PcapRemoteDeviceList instance for a certain remote machine. This methods creates the instance, and also creates a list of PcapRemoteDevice instances stored in it, one for each remote network interface. Notice this method allocates the PcapRemoteDeviceList instance and returns a pointer to it. It's the user responsibility to free it when done using it
This method overload is for remote daemons which don't require authentication for accessing them. For daemons which do require authentication use the other method overload

Parameters
[in]ipAddressThe IP address of the remote machine through which clients can connect to the rpcapd daemon
[in]portThe port of the remote machine through which clients can connect to the rpcapd daemon
Returns
A pointer to the newly created PcapRemoteDeviceList, or NULL if (an appropriate error will be printed to log in each case):
  • IP address provided is NULL or not valid
  • WinPcap/Npcap encountered an error in creating the remote connection string
  • WinPcap/Npcap encountered an error connecting to the rpcapd daemon on the remote machine or retrieving devices on the remote machine

◆ getRemoteDeviceList() [2/2]

static PcapRemoteDeviceList* pcpp::PcapRemoteDeviceList::getRemoteDeviceList ( const IPAddress ipAddress,
uint16_t  port,
PcapRemoteAuthentication remoteAuth 
)
static

An overload of the previous getRemoteDeviceList() method but with authentication support. This method is suitable for connecting to remote daemons which require authentication for accessing them

Parameters
[in]ipAddressThe IP address of the remote machine through which clients can connect to the rpcapd daemon
[in]portThe port of the remote machine through which clients can connect to the rpcapd daemon
[in]remoteAuthA pointer to the authentication object which contains the username and password for connecting to the remote daemon
Returns
A pointer to the newly created PcapRemoteDeviceList, or NULL if (an appropriate error will be printed to log in each case):
  • IP address provided is NULL or not valid
  • WinPcap/Npcap encountered an error in creating the remote connection string
  • WinPcap/Npcap encountered an error connecting to the rpcapd daemon on the remote machine or retrieving devices on the remote machine

◆ getRemoteMachineIpAddress()

IPAddress pcpp::PcapRemoteDeviceList::getRemoteMachineIpAddress ( ) const
inline
Returns
The IP address of the remote machine

◆ getRemoteMachinePort()

uint16_t pcpp::PcapRemoteDeviceList::getRemoteMachinePort ( ) const
inline
Returns
The port of the remote machine where packets are transmitted from the remote machine to the client machine