PcapPlusPlus  Next
PcapRemoteDeviceList.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include "IpAddress.h"
5 #include "DeviceListBase.h"
6 #include "PcapRemoteDevice.h"
7 #include "DeprecationUtils.h"
8 
10 
13 namespace pcpp
14 {
25  class PcapRemoteDeviceList : public internal::DeviceListBase<PcapRemoteDevice>
26  {
27  private:
29 
30  IPAddress m_RemoteMachineIpAddress;
31  uint16_t m_RemoteMachinePort;
32  std::shared_ptr<PcapRemoteAuthentication> m_RemoteAuthentication;
33 
34  // private c'tor. User should create the list via static methods PcapRemoteDeviceList::createRemoteDeviceList()
35  PcapRemoteDeviceList(const IPAddress& ipAddress, uint16_t port,
36  std::shared_ptr<PcapRemoteAuthentication> remoteAuth,
38 
39  public:
41  using RemoteDeviceListIterator = iterator;
42 
44  using ConstRemoteDeviceListIterator = const_iterator;
45 
47  PcapRemoteDeviceList(PcapRemoteDeviceList&&) noexcept = delete;
48  PcapRemoteDeviceList& operator=(const PcapRemoteDeviceList&) = delete;
49  PcapRemoteDeviceList& operator=(PcapRemoteDeviceList&&) noexcept = delete;
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  };
160 } // namespace pcpp
Definition: IpAddress.h:276
Definition: IpAddress.h:28
Definition: IpAddress.h:156
Definition: PcapRemoteDevice.h:68
Definition: PcapRemoteDeviceList.h:26
iterator RemoteDeviceListIterator
Iterator object that can be used for iterating all PcapRemoteDevice in list.
Definition: PcapRemoteDeviceList.h:41
uint16_t getRemoteMachinePort() const
Definition: PcapRemoteDeviceList.h:135
const_iterator ConstRemoteDeviceListIterator
Const iterator object that can be used for iterating all PcapRemoteDevice in a constant list.
Definition: PcapRemoteDeviceList.h:44
IPAddress getRemoteMachineIpAddress() const
Definition: PcapRemoteDeviceList.h:128
PcapRemoteDevice * getRemoteDeviceByIP(const IPAddress &ipAddr) const
static PcapRemoteDeviceList * getRemoteDeviceList(const IPAddress &ipAddress, uint16_t port)
static std::unique_ptr< PcapRemoteDeviceList > createRemoteDeviceList(const IPAddress &ipAddress, uint16_t port)
PcapRemoteDevice * getRemoteDeviceByIP(const IPv4Address &ip4Addr) const
PcapRemoteDevice * getRemoteDeviceByIP(const std::string &ipAddrAsString) const
PcapRemoteDevice * getRemoteDeviceByIP(const IPv6Address &ip6Addr) const
Definition: PointerVector.h:50
A base class for device lists, providing common functionality for managing a list of devices.
Definition: DeviceListBase.h:10
The main namespace for the PcapPlusPlus lib.
Definition: PcapRemoteDevice.h:20