PcapPlusPlus  19.12
pcpp::PcapLiveDevice::DeviceConfiguration Struct Reference

#include <PcapLiveDevice.h>

Public Member Functions

 DeviceConfiguration (DeviceMode mode=Promiscuous, int packetBufferTimeoutMs=0, int packetBufferSize=0, PcapDirection direction=PCPP_INOUT)
 

Public Attributes

DeviceMode mode
 
int packetBufferTimeoutMs
 
int packetBufferSize
 
PcapDirection direction
 

Detailed Description

A struct that contains user configurable parameters for opening a device. All parameters have default values so the user isn't expected to set all parameters or understand exactly how they work

Constructor & Destructor Documentation

◆ DeviceConfiguration()

pcpp::PcapLiveDevice::DeviceConfiguration::DeviceConfiguration ( DeviceMode  mode = Promiscuous,
int  packetBufferTimeoutMs = 0,
int  packetBufferSize = 0,
PcapDirection  direction = PCPP_INOUT 
)
inline

A c'tor for this struct

Parameters
[in]modeThe mode to open the device: promiscuous or non-promiscuous. Default value is promiscuous
[in]packetBufferTimeoutMsBuffer timeout in millisecond. Default value is 0 which means set timeout of 1 or -1 (depends on the platform)
[in]packetBufferSizeThe packet buffer size. Default value is 0 which means use the default value (varies between different OS's)
[in]directionDirection for capturing packtes. Default value is INOUT which means capture both incoming and outgoing packets (not all platforms support this)

Member Data Documentation

◆ direction

PcapDirection pcpp::PcapLiveDevice::DeviceConfiguration::direction

Set the direction for capturing packets. You can read more here: https://www.tcpdump.org/manpages/pcap.3pcap.html#lbAI.

◆ mode

DeviceMode pcpp::PcapLiveDevice::DeviceConfiguration::mode

Indicates whether to open the device in promiscuous or normal mode

◆ packetBufferSize

int pcpp::PcapLiveDevice::DeviceConfiguration::packetBufferSize

Set the packet buffer size. You can read more about the packet buffer here: https://www.tcpdump.org/manpages/pcap.3pcap.html . Any value of 100 or above is considered valid, otherwise the default value is used (which varies between different OS's). However, please notice that setting values which are too low or two high may result in failure to open the device. These too low or too high thresholds may vary between OS's, as an example please refer to this thread: https://stackoverflow.com/questions/11397367/issue-in-pcap-set-buffer-size

◆ packetBufferTimeoutMs

int pcpp::PcapLiveDevice::DeviceConfiguration::packetBufferTimeoutMs

Set the packet buffer timeout in milliseconds. You can read more here: https://www.tcpdump.org/manpages/pcap.3pcap.html . Any value above 0 is considered legal, otherwise a value of 1 or -1 is used (depends on the platform)