PcapPlusPlus  Next
WinPcapLiveDevice.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 #include "PcapLiveDevice.h"
6 
9 namespace pcpp
10 {
17  {
18  friend class PcapLiveDeviceList;
19 
20  protected:
21  int m_MinAmountOfDataToCopyFromKernelToApplication;
22 
23  // c'tor is not public, there should be only one for every interface (created by PcapLiveDeviceList)
24  WinPcapLiveDevice(pcap_if_t* iface, bool calculateMTU, bool calculateMacAddress, bool calculateDefaultGateway)
25  : WinPcapLiveDevice(DeviceInterfaceDetails(iface), calculateMTU, calculateMacAddress,
26  calculateDefaultGateway)
27  {}
28  WinPcapLiveDevice(DeviceInterfaceDetails interfaceDetails, bool calculateMTU, bool calculateMacAddress,
29  bool calculateDefaultGateway);
30 
31  public:
32  WinPcapLiveDevice(const WinPcapLiveDevice& other) = delete;
33  WinPcapLiveDevice& operator=(const WinPcapLiveDevice& other) = delete;
34 
35  LiveDeviceType getDeviceType() const override
36  {
37  return WinPcapDevice;
38  }
39 
40  bool startCapture(OnPacketArrivesCallback onPacketArrives, void* onPacketArrivesUserCookie,
41  int intervalInSecondsToUpdateStats, OnStatsUpdateCallback onStatsUpdate,
42  void* onStatsUpdateUserCookie) override;
43  bool startCapture(int intervalInSecondsToUpdateStats, OnStatsUpdateCallback onStatsUpdate,
44  void* onStatsUpdateUserCookie) override;
45  bool startCapture(RawPacketVector& capturedPacketsVector) override
46  {
47  return PcapLiveDevice::startCapture(capturedPacketsVector);
48  }
49 
51  virtual int sendPackets(RawPacket* rawPacketsArr, int arrLength);
52 
60 
64  {
65  return m_MinAmountOfDataToCopyFromKernelToApplication;
66  }
67 
68  WinPcapLiveDevice* clone() const override;
69  };
70 } // namespace pcpp
Definition: PcapLiveDevice.h:68
LiveDeviceType
The type of the live device.
Definition: PcapLiveDevice.h:142
@ WinPcapDevice
WinPcap/Npcap live device.
Definition: PcapLiveDevice.h:146
virtual bool startCapture(OnPacketArrivesCallback onPacketArrives, void *onPacketArrivesUserCookie)
virtual int sendPackets(RawPacket *rawPacketsArr, int arrLength, bool checkMtu=false)
Definition: PcapLiveDeviceList.h:20
Definition: PointerVector.h:50
Definition: RawPacket.h:269
Definition: WinPcapLiveDevice.h:17
bool startCapture(RawPacketVector &capturedPacketsVector) override
Definition: WinPcapLiveDevice.h:45
int getMinAmountOfDataToCopyFromKernelToApplication() const
Definition: WinPcapLiveDevice.h:63
virtual int sendPackets(RawPacket *rawPacketsArr, int arrLength, bool checkMtu=false)
LiveDeviceType getDeviceType() const override
Definition: WinPcapLiveDevice.h:35
bool startCapture(OnPacketArrivesCallback onPacketArrives, void *onPacketArrivesUserCookie, int intervalInSecondsToUpdateStats, OnStatsUpdateCallback onStatsUpdate, void *onStatsUpdateUserCookie) override
bool setMinAmountOfDataToCopyFromKernelToApplication(int size)
bool startCapture(int intervalInSecondsToUpdateStats, OnStatsUpdateCallback onStatsUpdate, void *onStatsUpdateUserCookie) override
WinPcapLiveDevice * clone() const override
The main namespace for the PcapPlusPlus lib.
std::function< void(RawPacket *, PcapLiveDevice *, void *)> OnPacketArrivesCallback
Definition: PcapLiveDevice.h:31
std::function< void(IPcapDevice::PcapStats &, void *)> OnStatsUpdateCallback
Definition: PcapLiveDevice.h:44
A struct that contains all details of a network interface.
Definition: PcapLiveDevice.h:75