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 
14 namespace pcpp
15 {
16 
30  {
31  private:
32  std::vector<PcapRemoteDevice*> m_RemoteDeviceList;
33  IPAddress m_RemoteMachineIpAddress;
34  uint16_t m_RemoteMachinePort;
35  std::shared_ptr<PcapRemoteAuthentication> m_RemoteAuthentication;
36 
37  // private c'tor. User should create the list via static methods PcapRemoteDeviceList::createRemoteDeviceList()
38  PcapRemoteDeviceList(const IPAddress& ipAddress, uint16_t port,
39  std::shared_ptr<PcapRemoteAuthentication> remoteAuth,
40  std::vector<PcapRemoteDevice*> deviceList);
41 
42  public:
46  using RemoteDeviceListIterator = typename std::vector<PcapRemoteDevice*>::iterator;
47 
51  using ConstRemoteDeviceListIterator = typename std::vector<PcapRemoteDevice*>::const_iterator;
52 
54  PcapRemoteDeviceList(PcapRemoteDeviceList&&) noexcept = delete;
55  PcapRemoteDeviceList& operator=(const PcapRemoteDeviceList&) = delete;
56  PcapRemoteDeviceList& operator=(PcapRemoteDeviceList&&) noexcept = delete;
57 
59 
79  PCPP_DEPRECATED("Please use 'createRemoteDeviceList' factory method instead.")
80  static PcapRemoteDeviceList* getRemoteDeviceList(const IPAddress& ipAddress, uint16_t port);
81 
99  static std::unique_ptr<PcapRemoteDeviceList> createRemoteDeviceList(const IPAddress& ipAddress, uint16_t port);
100 
118  PCPP_DEPRECATED("Please use 'createRemoteDeviceList' factory method instead.")
119  static PcapRemoteDeviceList* getRemoteDeviceList(const IPAddress& ipAddress, uint16_t port,
120  PcapRemoteAuthentication* remoteAuth);
121 
141  static std::unique_ptr<PcapRemoteDeviceList> createRemoteDeviceList(const IPAddress& ipAddress, uint16_t port,
142  PcapRemoteAuthentication const* remoteAuth);
143 
148  {
149  return m_RemoteMachineIpAddress;
150  }
151 
156  uint16_t getRemoteMachinePort() const
157  {
158  return m_RemoteMachinePort;
159  }
160 
167 
174 
181 
187  PcapRemoteDevice* getRemoteDeviceByIP(const std::string& ipAddrAsString) const;
188 
193  {
194  return m_RemoteDeviceList.begin();
195  }
196 
201  {
202  return m_RemoteDeviceList.begin();
203  }
204 
209  {
210  return m_RemoteDeviceList.end();
211  }
212 
217  {
218  return m_RemoteDeviceList.end();
219  }
220  };
221 
222 } // namespace pcpp
Definition: IpAddress.h:358
Definition: IpAddress.h:32
Definition: IpAddress.h:199
Definition: PcapRemoteDevice.h:85
Definition: PcapRemoteDeviceList.h:30
ConstRemoteDeviceListIterator end() const
Definition: PcapRemoteDeviceList.h:216
ConstRemoteDeviceListIterator begin() const
Definition: PcapRemoteDeviceList.h:200
uint16_t getRemoteMachinePort() const
Definition: PcapRemoteDeviceList.h:156
IPAddress getRemoteMachineIpAddress() const
Definition: PcapRemoteDeviceList.h:147
PcapRemoteDevice * getRemoteDeviceByIP(const IPAddress &ipAddr) const
static PcapRemoteDeviceList * getRemoteDeviceList(const IPAddress &ipAddress, uint16_t port)
typename std::vector< PcapRemoteDevice * >::iterator RemoteDeviceListIterator
Definition: PcapRemoteDeviceList.h:46
typename std::vector< PcapRemoteDevice * >::const_iterator ConstRemoteDeviceListIterator
Definition: PcapRemoteDeviceList.h:51
RemoteDeviceListIterator end()
Definition: PcapRemoteDeviceList.h:208
static std::unique_ptr< PcapRemoteDeviceList > createRemoteDeviceList(const IPAddress &ipAddress, uint16_t port)
PcapRemoteDevice * getRemoteDeviceByIP(const IPv4Address &ip4Addr) const
RemoteDeviceListIterator begin()
Definition: PcapRemoteDeviceList.h:192
PcapRemoteDevice * getRemoteDeviceByIP(const std::string &ipAddrAsString) const
PcapRemoteDevice * getRemoteDeviceByIP(const IPv6Address &ip6Addr) const
The main namespace for the PcapPlusPlus lib.
Definition: PcapRemoteDevice.h:25