PcapPlusPlus
Device.h
Go to the documentation of this file.
1 #ifndef PCAPPP_DEVICE
2 #define PCAPPP_DEVICE
3 
5 
6 #include "PointerVector.h"
7 #include "RawPacket.h"
8 #include "PcapFilter.h"
9 
14 namespace pcpp
15 {
18 
24  class IDevice
25  {
26  protected:
27  bool m_DeviceOpened;
28 
29  // c'tor should not be public
30  IDevice() : m_DeviceOpened(false) {}
31 
32  public:
33 
34  virtual ~IDevice() {}
35 
40  virtual bool open() = 0;
41 
45  virtual void close() = 0;
46 
50  inline bool isOpened() { return m_DeviceOpened; }
51  };
52 
53 
61  {
62  protected:
63 
64  // c'tor should not be public
66 
67  public:
68 
69  virtual ~IFilterableDevice() {}
70 
76  virtual bool setFilter(GeneralFilter& filter)
77  {
78  std::string filterAsString;
79  filter.parseToString(filterAsString);
80  return setFilter(filterAsString);
81  }
82 
88  virtual bool setFilter(std::string filterAsString) = 0;
89 
94  virtual bool clearFilter() = 0;
95  };
96 }
97 
98 #endif // PCAPPP_DEVICE
virtual bool setFilter(GeneralFilter &filter)
Definition: Device.h:76
Definition: Device.h:60
Definition: PointerVector.h:24
PointerVector< RawPacket > RawPacketVector
Definition: Device.h:17
virtual bool clearFilter()=0
Definition: Device.h:24
bool isOpened()
Definition: Device.h:50
Definition: PcapFilter.h:72
virtual void close()=0
virtual bool open()=0
virtual void parseToString(std::string &result)=0
The main namespace for the PcapPlusPlus lib.