PcapPlusPlus
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

IPAddressgetRemoteMachineIpAddress ()
 
uint16_t getRemoteMachinePort ()
 
PcapRemoteDevicegetRemoteDeviceByIP (IPv4Address ip4Addr)
 
PcapRemoteDevicegetRemoteDeviceByIP (IPv6Address ip6Addr)
 
PcapRemoteDevicegetRemoteDeviceByIP (IPAddress *ipAddr)
 
PcapRemoteDevicegetRemoteDeviceByIP (const char *ipAddrAsString)
 
RemoteDeviceListIterator begin ()
 
ConstRemoteDeviceListIterator begin () const
 
RemoteDeviceListIterator end ()
 
ConstRemoteDeviceListIterator end () const
 

Static Public Member Functions

static PcapRemoteDeviceListgetRemoteDeviceList (IPAddress *ipAddress, uint16_t port)
 
static PcapRemoteDeviceListgetRemoteDeviceList (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 only, this class is available in Windows only

Member Typedef Documentation

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

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

Member Function Documentation

RemoteDeviceListIterator pcpp::PcapRemoteDeviceList::begin ( )
inline
Returns
An iterator object pointing to the first PcapRemoteDevice in list
ConstRemoteDeviceListIterator pcpp::PcapRemoteDeviceList::begin ( ) const
inline
Returns
A const iterator object pointing to the first PcapRemoteDevice in list
RemoteDeviceListIterator pcpp::PcapRemoteDeviceList::end ( )
inline
Returns
An iterator object pointing to the last PcapRemoteDevice in list
ConstRemoteDeviceListIterator pcpp::PcapRemoteDeviceList::end ( ) const
inline
Returns
A const iterator object pointing to the last PcapRemoteDevice in list
PcapRemoteDevice* pcpp::PcapRemoteDeviceList::getRemoteDeviceByIP ( IPv4Address  ip4Addr)

Search a PcapRemoteDevice in the list by its IPv4 address

Parameters
[in]ip4AddrThe IPv4 address
Returns
The PcapRemoteDevice if found, NULL otherwise
PcapRemoteDevice* pcpp::PcapRemoteDeviceList::getRemoteDeviceByIP ( IPv6Address  ip6Addr)

Search a PcapRemoteDevice in the list by its IPv6 address

Parameters
[in]ip6AddrThe IPv6 address
Returns
The PcapRemoteDevice if found, NULL otherwise
PcapRemoteDevice* pcpp::PcapRemoteDeviceList::getRemoteDeviceByIP ( IPAddress ipAddr)

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
PcapRemoteDevice* pcpp::PcapRemoteDeviceList::getRemoteDeviceByIP ( const char *  ipAddrAsString)

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
static PcapRemoteDeviceList* pcpp::PcapRemoteDeviceList::getRemoteDeviceList ( 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 encountered an error in creating the remote connection string
  • WinPcap encountered an error connecting to the rpcapd daemon on the remote machine or retrieving devices on the remote machine
static PcapRemoteDeviceList* pcpp::PcapRemoteDeviceList::getRemoteDeviceList ( 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 encountered an error in creating the remote connection string
  • WinPcap encountered an error connecting to the rpcapd daemon on the remote machine or retrieving devices on the remote machine
IPAddress* pcpp::PcapRemoteDeviceList::getRemoteMachineIpAddress ( )
inline
Returns
The IP address of the remote machine
uint16_t pcpp::PcapRemoteDeviceList::getRemoteMachinePort ( )
inline
Returns
The port of the remote machine where packets are transmitted from the remote machine to the client machine