PcapPlusPlus  24.09
PcapRemoteDeviceList.h
Go to the documentation of this file.
1 #pragma once
2 
3 #if defined(_WIN32)
4 
5 # include <memory>
6 # include "IpAddress.h"
7 # include "PcapRemoteDevice.h"
8 # include "DeprecationUtils.h"
9 
11 
16 namespace pcpp
17 {
18 
32  {
33  private:
34  std::vector<PcapRemoteDevice*> m_RemoteDeviceList;
35  IPAddress m_RemoteMachineIpAddress;
36  uint16_t m_RemoteMachinePort;
37  std::shared_ptr<PcapRemoteAuthentication> m_RemoteAuthentication;
38 
39  // private c'tor. User should create the list via static methods PcapRemoteDeviceList::createRemoteDeviceList()
40  PcapRemoteDeviceList(const IPAddress& ipAddress, uint16_t port,
41  std::shared_ptr<PcapRemoteAuthentication> remoteAuth,
42  std::vector<PcapRemoteDevice*> deviceList);
43 
44  public:
48  using RemoteDeviceListIterator = typename std::vector<PcapRemoteDevice*>::iterator;
49 
53  using ConstRemoteDeviceListIterator = typename std::vector<PcapRemoteDevice*>::const_iterator;
54 
56  PcapRemoteDeviceList(PcapRemoteDeviceList&&) noexcept = delete;
57  PcapRemoteDeviceList& operator=(const PcapRemoteDeviceList&) = delete;
58  PcapRemoteDeviceList& operator=(PcapRemoteDeviceList&&) noexcept = delete;
59 
61 
81  PCPP_DEPRECATED("Please use 'createRemoteDeviceList' factory method instead.")
82  static PcapRemoteDeviceList* getRemoteDeviceList(const IPAddress& ipAddress, uint16_t port);
83 
101  static std::unique_ptr<PcapRemoteDeviceList> createRemoteDeviceList(const IPAddress& ipAddress, uint16_t port);
102 
120  PCPP_DEPRECATED("Please use 'createRemoteDeviceList' factory method instead.")
121  static PcapRemoteDeviceList* getRemoteDeviceList(const IPAddress& ipAddress, uint16_t port,
122  PcapRemoteAuthentication* remoteAuth);
123 
143  static std::unique_ptr<PcapRemoteDeviceList> createRemoteDeviceList(const IPAddress& ipAddress, uint16_t port,
144  PcapRemoteAuthentication const* remoteAuth);
145 
150  {
151  return m_RemoteMachineIpAddress;
152  }
153 
158  uint16_t getRemoteMachinePort() const
159  {
160  return m_RemoteMachinePort;
161  }
162 
169 
176 
183 
189  PcapRemoteDevice* getRemoteDeviceByIP(const std::string& ipAddrAsString) const;
190 
195  {
196  return m_RemoteDeviceList.begin();
197  }
198 
203  {
204  return m_RemoteDeviceList.begin();
205  }
206 
211  {
212  return m_RemoteDeviceList.end();
213  }
214 
219  {
220  return m_RemoteDeviceList.end();
221  }
222  };
223 
224 } // namespace pcpp
225 
226 #endif // _WIN32
Definition: IpAddress.h:358
Definition: IpAddress.h:32
Definition: IpAddress.h:199
Definition: PcapRemoteDevice.h:87
Definition: PcapRemoteDeviceList.h:32
ConstRemoteDeviceListIterator end() const
Definition: PcapRemoteDeviceList.h:218
ConstRemoteDeviceListIterator begin() const
Definition: PcapRemoteDeviceList.h:202
uint16_t getRemoteMachinePort() const
Definition: PcapRemoteDeviceList.h:158
IPAddress getRemoteMachineIpAddress() const
Definition: PcapRemoteDeviceList.h:149
PcapRemoteDevice * getRemoteDeviceByIP(const IPAddress &ipAddr) const
static PcapRemoteDeviceList * getRemoteDeviceList(const IPAddress &ipAddress, uint16_t port)
typename std::vector< PcapRemoteDevice * >::iterator RemoteDeviceListIterator
Definition: PcapRemoteDeviceList.h:48
typename std::vector< PcapRemoteDevice * >::const_iterator ConstRemoteDeviceListIterator
Definition: PcapRemoteDeviceList.h:53
RemoteDeviceListIterator end()
Definition: PcapRemoteDeviceList.h:210
static std::unique_ptr< PcapRemoteDeviceList > createRemoteDeviceList(const IPAddress &ipAddress, uint16_t port)
PcapRemoteDevice * getRemoteDeviceByIP(const IPv4Address &ip4Addr) const
RemoteDeviceListIterator begin()
Definition: PcapRemoteDeviceList.h:194
PcapRemoteDevice * getRemoteDeviceByIP(const std::string &ipAddrAsString) const
PcapRemoteDevice * getRemoteDeviceByIP(const IPv6Address &ip6Addr) const
The main namespace for the PcapPlusPlus lib.
Definition: PcapRemoteDevice.h:27