PcapPlusPlus  24.09
WinPcapLiveDevice.h
Go to the documentation of this file.
1 #pragma once
2 
3 #if defined(_WIN32)
4 
6 
7 # include "PcapLiveDevice.h"
8 
13 namespace pcpp
14 {
15 
24  {
25  friend class PcapLiveDeviceList;
26 
27  protected:
28  int m_MinAmountOfDataToCopyFromKernelToApplication;
29 
30  // c'tor is not public, there should be only one for every interface (created by PcapLiveDeviceList)
31  WinPcapLiveDevice(pcap_if_t* iface, bool calculateMTU, bool calculateMacAddress, bool calculateDefaultGateway);
32  // copy c'tor is not public
34  WinPcapLiveDevice& operator=(const WinPcapLiveDevice& other);
35 
36  public:
37  virtual LiveDeviceType getDeviceType() const
38  {
39  return WinPcapDevice;
40  }
41 
42  bool startCapture(OnPacketArrivesCallback onPacketArrives, void* onPacketArrivesUserCookie,
43  int intervalInSecondsToUpdateStats, OnStatsUpdateCallback onStatsUpdate,
44  void* onStatsUpdateUserCookie);
45  bool startCapture(int intervalInSecondsToUpdateStats, OnStatsUpdateCallback onStatsUpdate,
46  void* onStatsUpdateUserCookie);
47  bool startCapture(RawPacketVector& capturedPacketsVector)
48  {
49  return PcapLiveDevice::startCapture(capturedPacketsVector);
50  }
51 
53  virtual int sendPackets(RawPacket* rawPacketsArr, int arrLength);
54 
64 
70  {
71  return m_MinAmountOfDataToCopyFromKernelToApplication;
72  }
73 
74  protected:
75  WinPcapLiveDevice* cloneInternal(pcap_if_t& devInterface) const override;
76  };
77 
78 } // namespace pcpp
79 
80 #endif // _WIN32
Definition: PcapLiveDevice.h:79
LiveDeviceType
Definition: PcapLiveDevice.h:140
@ WinPcapDevice
Definition: PcapLiveDevice.h:144
virtual bool startCapture(OnPacketArrivesCallback onPacketArrives, void *onPacketArrivesUserCookie)
virtual int sendPackets(RawPacket *rawPacketsArr, int arrLength, bool checkMtu=false)
Definition: PcapLiveDeviceList.h:25
Definition: PointerVector.h:29
Definition: RawPacket.h:269
Definition: WinPcapLiveDevice.h:24
bool startCapture(int intervalInSecondsToUpdateStats, OnStatsUpdateCallback onStatsUpdate, void *onStatsUpdateUserCookie)
bool startCapture(RawPacketVector &capturedPacketsVector)
Definition: WinPcapLiveDevice.h:47
virtual LiveDeviceType getDeviceType() const
Definition: WinPcapLiveDevice.h:37
int getMinAmountOfDataToCopyFromKernelToApplication() const
Definition: WinPcapLiveDevice.h:69
virtual int sendPackets(RawPacket *rawPacketsArr, int arrLength, bool checkMtu=false)
bool startCapture(OnPacketArrivesCallback onPacketArrives, void *onPacketArrivesUserCookie, int intervalInSecondsToUpdateStats, OnStatsUpdateCallback onStatsUpdate, void *onStatsUpdateUserCookie)
bool setMinAmountOfDataToCopyFromKernelToApplication(int size)
The main namespace for the PcapPlusPlus lib.
std::function< void(RawPacket *, PcapLiveDevice *, void *)> OnPacketArrivesCallback
Definition: PcapLiveDevice.h:36
std::function< void(IPcapDevice::PcapStats &, void *)> OnStatsUpdateCallback
Definition: PcapLiveDevice.h:53