PcapPlusPlus  Next
WinPcapLiveDevice.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 #include "PcapLiveDevice.h"
6 
11 namespace pcpp
12 {
13 
22  {
23  friend class PcapLiveDeviceList;
24 
25  protected:
26  int m_MinAmountOfDataToCopyFromKernelToApplication;
27 
28  // c'tor is not public, there should be only one for every interface (created by PcapLiveDeviceList)
29  WinPcapLiveDevice(pcap_if_t* iface, bool calculateMTU, bool calculateMacAddress, bool calculateDefaultGateway)
30  : WinPcapLiveDevice(DeviceInterfaceDetails(iface), calculateMTU, calculateMacAddress,
31  calculateDefaultGateway)
32  {}
33  WinPcapLiveDevice(DeviceInterfaceDetails interfaceDetails, bool calculateMTU, bool calculateMacAddress,
34  bool calculateDefaultGateway);
35 
36  public:
37  WinPcapLiveDevice(const WinPcapLiveDevice& other) = delete;
38  WinPcapLiveDevice& operator=(const WinPcapLiveDevice& other) = delete;
39 
40  LiveDeviceType getDeviceType() const override
41  {
42  return WinPcapDevice;
43  }
44 
45  bool startCapture(OnPacketArrivesCallback onPacketArrives, void* onPacketArrivesUserCookie,
46  int intervalInSecondsToUpdateStats, OnStatsUpdateCallback onStatsUpdate,
47  void* onStatsUpdateUserCookie) override;
48  bool startCapture(int intervalInSecondsToUpdateStats, OnStatsUpdateCallback onStatsUpdate,
49  void* onStatsUpdateUserCookie) override;
50  bool startCapture(RawPacketVector& capturedPacketsVector) override
51  {
52  return PcapLiveDevice::startCapture(capturedPacketsVector);
53  }
54 
56  virtual int sendPackets(RawPacket* rawPacketsArr, int arrLength);
57 
67 
73  {
74  return m_MinAmountOfDataToCopyFromKernelToApplication;
75  }
76 
77  WinPcapLiveDevice* clone() const override;
78  };
79 
80 } // namespace pcpp
Definition: PcapLiveDevice.h:79
LiveDeviceType
Definition: PcapLiveDevice.h:155
@ WinPcapDevice
Definition: PcapLiveDevice.h:159
virtual bool startCapture(OnPacketArrivesCallback onPacketArrives, void *onPacketArrivesUserCookie)
virtual int sendPackets(RawPacket *rawPacketsArr, int arrLength, bool checkMtu=false)
Definition: PcapLiveDeviceList.h:25
Definition: PointerVector.h:58
Definition: RawPacket.h:269
Definition: WinPcapLiveDevice.h:22
bool startCapture(RawPacketVector &capturedPacketsVector) override
Definition: WinPcapLiveDevice.h:50
int getMinAmountOfDataToCopyFromKernelToApplication() const
Definition: WinPcapLiveDevice.h:72
virtual int sendPackets(RawPacket *rawPacketsArr, int arrLength, bool checkMtu=false)
LiveDeviceType getDeviceType() const override
Definition: WinPcapLiveDevice.h:40
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:36
std::function< void(IPcapDevice::PcapStats &, void *)> OnStatsUpdateCallback
Definition: PcapLiveDevice.h:53
A struct that contains all details of a network interface.
Definition: PcapLiveDevice.h:86