PcapPlusPlus  22.11
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 <vector>
7 
8 
10 
15 namespace pcpp
16 {
17 
25  {
26  private:
27  std::vector<PcapLiveDevice*> m_LiveDeviceList;
28 
29  std::vector<IPv4Address> m_DnsServers;
30 
31  // private c'tor
33  // private copy c'tor
34  PcapLiveDeviceList( const PcapLiveDeviceList& other );
35  PcapLiveDeviceList& operator=(const PcapLiveDeviceList& other);
36 
37  void init();
38 
39  void setDnsServers();
40  public:
46  {
47  static PcapLiveDeviceList instance;
48  return instance;
49  }
50 
54  const std::vector<PcapLiveDevice*>& getPcapLiveDevicesList() const { return m_LiveDeviceList; }
55 
61  PcapLiveDevice* getPcapLiveDeviceByIp(const IPAddress& ipAddr) const;
62 
68  PcapLiveDevice* getPcapLiveDeviceByIp(const IPv4Address& ipAddr) const;
69 
75  PcapLiveDevice* getPcapLiveDeviceByIp(const IPv6Address& ip6Addr) const;
76 
82  PcapLiveDevice* getPcapLiveDeviceByIp(const std::string& ipAddrAsString) const;
83 
89  PcapLiveDevice* getPcapLiveDeviceByName(const std::string& name) const;
90 
96  PcapLiveDevice* getPcapLiveDeviceByIpOrName(const std::string& ipOrName) const;
97 
102  const std::vector<IPv4Address>& getDnsServers() const { return m_DnsServers; }
103 
109 
113  void reset();
114 
115  // d'tor
117  };
118 
119 } // namespace pcpp
120 
121 #endif
The main namespace for the PcapPlusPlus lib.
PcapLiveDevice * getPcapLiveDeviceByIp(const IPAddress &ipAddr) const
static PcapLiveDeviceList & getInstance()
Definition: PcapLiveDeviceList.h:45
const std::vector< PcapLiveDevice * > & getPcapLiveDevicesList() const
Definition: PcapLiveDeviceList.h:54
PcapLiveDevice * getPcapLiveDeviceByIpOrName(const std::string &ipOrName) const
PcapLiveDevice * getPcapLiveDeviceByName(const std::string &name) const
Definition: IpAddress.h:27
Definition: IpAddress.h:167
PcapLiveDeviceList * clone()
Definition: PcapLiveDevice.h:80
Definition: IpAddress.h:278
const std::vector< IPv4Address > & getDnsServers() const
Definition: PcapLiveDeviceList.h:102
Definition: PcapLiveDeviceList.h:24