2 #ifndef PCAPPP_LIVE_DEVICE     3 #define PCAPPP_LIVE_DEVICE    52     typedef void* (*ThreadStart)(
void*);
    83         pcap_t* m_PcapSendDescriptor;
    85         const char* m_Description;
    88         std::vector<pcap_addr_t> m_Addresses;
    91         PcapThread* m_CaptureThread;
    92         bool m_CaptureThreadStarted;
    93         PcapThread* m_StatsThread;
    94         bool m_StatsThreadStarted;
    97         void* m_cbOnPacketArrivesUserCookie;
    99         void* m_cbOnStatsUpdateUserCookie;
   101         void* m_cbOnPacketArrivesBlockingModeUserCookie;
   102         int m_IntervalToUpdateStats;
   104         bool m_CaptureCallbackMode;
   108         PcapLiveDevice(pcap_if_t* pInterface, 
bool calculateMTU, 
bool calculateMacAddress, 
bool calculateDefaultGateway);
   114         void setDeviceMacAddress();
   115         void setDefaultGateway();
   116         static void* captureThreadMain(
void *ptr);
   117         static void* statsThreadMain(
void *ptr);
   118         static void onPacketArrives(uint8_t *user, 
const struct pcap_pkthdr *pkthdr, 
const uint8_t *packet);
   119         static void onPacketArrivesNoCallback(uint8_t *user, 
const struct pcap_pkthdr *pkthdr, 
const uint8_t *packet);
   120         static void onPacketArrivesBlockingMode(uint8_t *user, 
const struct pcap_pkthdr *pkthdr, 
const uint8_t *packet);
   121         std::string printThreadId(PcapThread* 
id);
   122         virtual ThreadStart getCaptureThreadStart();
   207         inline const char* 
getName() { 
return m_Name; }
   212         inline const char* 
getDesc() { 
return m_Description; }
   222         virtual inline uint16_t 
getMtu() { 
return m_DeviceMtu; }
   231         inline std::vector<pcap_addr_t>& 
getAddresses() { 
return m_Addresses; }
   380         bool sendPacket(
const uint8_t* packetData, 
int packetDataLength);
   449         bool open(
const DeviceConfiguration& config);
   456         pcap_t* doOpen(
const DeviceConfiguration& config);
 DeviceMode
Definition: PcapLiveDevice.h:142
 
Definition: PcapLiveDevice.h:76
 
virtual uint16_t getMtu()
Definition: PcapLiveDevice.h:222
 
virtual LiveDeviceType getDeviceType()
Definition: PcapLiveDevice.h:202
 
int packetBufferSize
Definition: PcapLiveDevice.h:175
 
virtual LinkLayerType getLinkType()
Definition: PcapLiveDevice.h:227
 
Definition: PcapLiveDeviceList.h:25
 
Definition: PointerVector.h:24
 
Definition: IpAddress.h:113
 
Definition: PcapLiveDevice.h:145
 
std::vector< IPv4Address > & getDnsServers()
 
Definition: MacAddress.h:21
 
const char * getDesc()
Definition: PcapLiveDevice.h:212
 
bool sendPacket(RawPacket const &rawPacket)
 
bool getLoopback()
Definition: PcapLiveDevice.h:217
 
IPv4Address getIPv4Address()
 
std::vector< pcap_addr_t > & getAddresses()
Definition: PcapLiveDevice.h:231
 
Definition: PcapLiveDevice.h:135
 
Definition: RawPacket.h:219
 
Definition: PcapLiveDevice.h:156
 
Definition: PcapLiveDevice.h:131
 
virtual MacAddress getMacAddress()
Definition: PcapLiveDevice.h:236
 
virtual int startCaptureBlockingMode(OnPacketArrivesStopBlocking onPacketArrives, void *userCookie, int timeout)
 
DeviceConfiguration(DeviceMode mode=Promiscuous, int packetBufferTimeoutMs=0, int packetBufferSize=0)
Definition: PcapLiveDevice.h:185
 
virtual ~PcapLiveDevice()
 
int packetBufferTimeoutMs
Definition: PcapLiveDevice.h:165
 
Definition: PcapLiveDevice.h:133
 
const char * getName()
Definition: PcapLiveDevice.h:207
 
virtual bool startCapture(OnPacketArrivesCallback onPacketArrives, void *onPacketArrivesUserCookie)
 
void(* OnStatsUpdateCallback)(pcap_stat &stats, void *userCookie)
Definition: PcapLiveDevice.h:49
 
Definition: PcapLiveDevice.h:147
 
IPv4Address getDefaultGateway()
 
LiveDeviceType
Definition: PcapLiveDevice.h:128
 
DeviceMode mode
Definition: PcapLiveDevice.h:159
 
bool(* OnPacketArrivesStopBlocking)(RawPacket *pPacket, PcapLiveDevice *pDevice, void *userData)
Definition: PcapLiveDevice.h:40
 
The main namespace for the PcapPlusPlus lib. 
 
LinkLayerType
Definition: RawPacket.h:24
 
virtual int sendPackets(RawPacket *rawPacketsArr, int arrLength)
 
void(* OnPacketArrivesCallback)(RawPacket *pPacket, PcapLiveDevice *pDevice, void *userCookie)
Definition: PcapLiveDevice.h:30
 
virtual void getStatistics(pcap_stat &stats)
 
Definition: PcapDevice.h:32