PcapPlusPlus  Next
PcapRemoteDeviceList.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include "IpAddress.h"
5 #include "PcapRemoteDevice.h"
6 #include "DeprecationUtils.h"
7 
9 
12 namespace pcpp
13 {
25  {
26  private:
27  std::vector<PcapRemoteDevice*> m_RemoteDeviceList;
28  IPAddress m_RemoteMachineIpAddress;
29  uint16_t m_RemoteMachinePort;
30  std::shared_ptr<PcapRemoteAuthentication> m_RemoteAuthentication;
31 
32  // private c'tor. User should create the list via static methods PcapRemoteDeviceList::createRemoteDeviceList()
33  PcapRemoteDeviceList(const IPAddress& ipAddress, uint16_t port,
34  std::shared_ptr<PcapRemoteAuthentication> remoteAuth,
35  std::vector<PcapRemoteDevice*> deviceList);
36 
37  public:
39  using RemoteDeviceListIterator = typename std::vector<PcapRemoteDevice*>::iterator;
40 
42  using ConstRemoteDeviceListIterator = typename std::vector<PcapRemoteDevice*>::const_iterator;
43 
45  PcapRemoteDeviceList(PcapRemoteDeviceList&&) noexcept = delete;
46  PcapRemoteDeviceList& operator=(const PcapRemoteDeviceList&) = delete;
47  PcapRemoteDeviceList& operator=(PcapRemoteDeviceList&&) noexcept = delete;
48 
50 
68  PCPP_DEPRECATED("Please use 'createRemoteDeviceList' factory method instead.")
69  static PcapRemoteDeviceList* getRemoteDeviceList(const IPAddress& ipAddress, uint16_t port);
70 
86  static std::unique_ptr<PcapRemoteDeviceList> createRemoteDeviceList(const IPAddress& ipAddress, uint16_t port);
87 
103  PCPP_DEPRECATED("Please use 'createRemoteDeviceList' factory method instead.")
104  static PcapRemoteDeviceList* getRemoteDeviceList(const IPAddress& ipAddress, uint16_t port,
105  PcapRemoteAuthentication* remoteAuth);
106 
124  static std::unique_ptr<PcapRemoteDeviceList> createRemoteDeviceList(const IPAddress& ipAddress, uint16_t port,
125  PcapRemoteAuthentication const* remoteAuth);
126 
129  {
130  return m_RemoteMachineIpAddress;
131  }
132 
135  uint16_t getRemoteMachinePort() const
136  {
137  return m_RemoteMachinePort;
138  }
139 
144 
149 
154 
158  PcapRemoteDevice* getRemoteDeviceByIP(const std::string& ipAddrAsString) const;
159 
162  {
163  return m_RemoteDeviceList.begin();
164  }
165 
168  {
169  return m_RemoteDeviceList.begin();
170  }
171 
174  {
175  return m_RemoteDeviceList.end();
176  }
177 
180  {
181  return m_RemoteDeviceList.end();
182  }
183  };
184 } // namespace pcpp
Definition: IpAddress.h:276
Definition: IpAddress.h:28
Definition: IpAddress.h:156
Definition: PcapRemoteDevice.h:68
Definition: PcapRemoteDeviceList.h:25
ConstRemoteDeviceListIterator end() const
Definition: PcapRemoteDeviceList.h:179
ConstRemoteDeviceListIterator begin() const
Definition: PcapRemoteDeviceList.h:167
uint16_t getRemoteMachinePort() const
Definition: PcapRemoteDeviceList.h:135
IPAddress getRemoteMachineIpAddress() const
Definition: PcapRemoteDeviceList.h:128
PcapRemoteDevice * getRemoteDeviceByIP(const IPAddress &ipAddr) const
static PcapRemoteDeviceList * getRemoteDeviceList(const IPAddress &ipAddress, uint16_t port)
typename std::vector< PcapRemoteDevice * >::iterator RemoteDeviceListIterator
Iterator object that can be used for iterating all PcapRemoteDevice in list.
Definition: PcapRemoteDeviceList.h:39
typename std::vector< PcapRemoteDevice * >::const_iterator ConstRemoteDeviceListIterator
Const iterator object that can be used for iterating all PcapRemoteDevice in a constant list.
Definition: PcapRemoteDeviceList.h:42
RemoteDeviceListIterator end()
Definition: PcapRemoteDeviceList.h:173
static std::unique_ptr< PcapRemoteDeviceList > createRemoteDeviceList(const IPAddress &ipAddress, uint16_t port)
PcapRemoteDevice * getRemoteDeviceByIP(const IPv4Address &ip4Addr) const
RemoteDeviceListIterator begin()
Definition: PcapRemoteDeviceList.h:161
PcapRemoteDevice * getRemoteDeviceByIP(const std::string &ipAddrAsString) const
PcapRemoteDevice * getRemoteDeviceByIP(const IPv6Address &ip6Addr) const
The main namespace for the PcapPlusPlus lib.
Definition: PcapRemoteDevice.h:20