PcapPlusPlus
PcapDevice.h
Go to the documentation of this file.
1 #ifndef PCAPPP_PCAP_DEVICE
2 #define PCAPPP_PCAP_DEVICE
3 
4 #include "Device.h"
5 
14 #if defined(PCAPPP_MINGW_ENV) && !defined(WIN32)
15 # define WIN32
16 #endif
17 #include <pcap.h>
18 
20 
25 namespace pcpp
26 {
32  class IPcapDevice : public IDevice, public IFilterableDevice
33  {
34  protected:
35  pcap_t* m_PcapDescriptor;
36 
37  // c'tor should not be public
38  IPcapDevice() : IDevice() { m_PcapDescriptor = NULL; }
39 
40  public:
41  virtual ~IPcapDevice();
42 
50  virtual void getStatistics(pcap_stat& stats) = 0;
51 
57  static std::string getPcapLibVersionInfo();
58 
64  static bool verifyFilter(std::string filterAsString);
65 
73  static bool matchPacketWithFilter(std::string filterAsString, RawPacket* rawPacket);
74 
75 
76  // implement abstract methods
77 
79 
85  virtual bool setFilter(std::string filterAsString);
86 
91  bool clearFilter();
92  };
93 
94 } // namespace pcpp
95 
96 #endif // PCAPPP_PCAP_DEVICE
virtual bool setFilter(GeneralFilter &filter)
Definition: Device.h:76
Definition: Device.h:60
virtual void getStatistics(pcap_stat &stats)=0
static bool verifyFilter(std::string filterAsString)
virtual bool setFilter(std::string filterAsString)
Definition: RawPacket.h:219
static bool matchPacketWithFilter(std::string filterAsString, RawPacket *rawPacket)
Definition: Device.h:24
The main namespace for the PcapPlusPlus lib.
Definition: PcapDevice.h:32
static std::string getPcapLibVersionInfo()