PcapPlusPlus  20.08+
PcapLiveDeviceList.h
Go to the documentation of this file.
1 #ifndef PCAPPP_LIVE_DEVICE_LIST
2 #define PCAPPP_LIVE_DEVICE_LIST
3 
4 #include "IpAddress.h"
5 #include "PcapLiveDevice.h"
6 #include "WinPcapLiveDevice.h"
7 #include <vector>
8 
9 
11 
16 namespace pcpp
17 {
18 
26  {
27  private:
28  std::vector<PcapLiveDevice*> m_LiveDeviceList;
29 
30  std::vector<IPv4Address> m_DnsServers;
31 
32  // private c'tor
34  // private copy c'tor
35  PcapLiveDeviceList( const PcapLiveDeviceList& other );
36  PcapLiveDeviceList& operator=(const PcapLiveDeviceList& other);
37  // private d'tor
39 
40  void init();
41 
42  void setDnsServers();
43  public:
49  {
50  static PcapLiveDeviceList instance;
51  return instance;
52  }
53 
57  const std::vector<PcapLiveDevice*>& getPcapLiveDevicesList() const { return m_LiveDeviceList; }
58 
64  PcapLiveDevice* getPcapLiveDeviceByIp(const IPAddress& ipAddr) const;
65 
71  PcapLiveDevice* getPcapLiveDeviceByIp(const IPv4Address& ipAddr) const;
72 
78  PcapLiveDevice* getPcapLiveDeviceByIp(const IPv6Address& ip6Addr) const;
79 
85  PcapLiveDevice* getPcapLiveDeviceByIp(const std::string& ipAddrAsString) const;
86 
92  PcapLiveDevice* getPcapLiveDeviceByName(const std::string& name) const;
93 
98  const std::vector<IPv4Address>& getDnsServers() const { return m_DnsServers; }
99 
103  void reset();
104  };
105 
106 } // namespace pcpp
107 
108 #endif
The main namespace for the PcapPlusPlus lib.
PcapLiveDevice * getPcapLiveDeviceByIp(const IPAddress &ipAddr) const
static PcapLiveDeviceList & getInstance()
Definition: PcapLiveDeviceList.h:48
const std::vector< PcapLiveDevice * > & getPcapLiveDevicesList() const
Definition: PcapLiveDeviceList.h:57
PcapLiveDevice * getPcapLiveDeviceByName(const std::string &name) const
Definition: IpAddress.h:26
Definition: IpAddress.h:140
Definition: PcapLiveDevice.h:81
Definition: IpAddress.h:236
const std::vector< IPv4Address > & getDnsServers() const
Definition: PcapLiveDeviceList.h:98
Definition: PcapLiveDeviceList.h:25