PcapPlusPlus  20.08
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
pcpp::IFilterableDevice::setFilter
virtual bool setFilter(GeneralFilter &filter)
Definition: Device.h:76
RawPacket.h
pcpp::IDevice::open
virtual bool open()=0
PointerVector.h
pcpp::IFilterableDevice
Definition: Device.h:60
pcpp::IFilterableDevice::clearFilter
virtual bool clearFilter()=0
PcapFilter.h
pcpp
The main namespace for the PcapPlusPlus lib.
pcpp::IDevice::close
virtual void close()=0
pcpp::IDevice::isOpened
bool isOpened()
Definition: Device.h:50
pcpp::PointerVector
Definition: PointerVector.h:24
pcpp::GeneralFilter
Definition: PcapFilter.h:79
pcpp::IDevice
Definition: Device.h:24
pcpp::GeneralFilter::parseToString
virtual void parseToString(std::string &result)=0
pcpp::RawPacketVector
PointerVector< RawPacket > RawPacketVector
Definition: Device.h:17