PcapPlusPlus  20.08
PcapRemoteDevice.h
Go to the documentation of this file.
1 #ifndef PCAPPP_PCAP_REMOTE_DEVICE
2 #define PCAPPP_PCAP_REMOTE_DEVICE
3 
4 #if defined(WIN32) || defined(WINx64) || defined(PCAPPP_MINGW_ENV)
5 
6 #include <vector>
7 #include "PcapLiveDevice.h"
8 
9 
11 
12 struct pcap_rmtauth;
13 
18 namespace pcpp
19 {
20 
28  {
29  public:
35  PcapRemoteAuthentication(const std::string username, const std::string password) { userName = username; this->password = password; }
36 
42 
46  std::string userName;
47 
51  std::string password;
52 
59  pcap_rmtauth getPcapRmAuth() const;
60  };
61 
80  {
81  friend class PcapRemoteDeviceList;
82  private:
83  IPAddress m_RemoteMachineIpAddress;
84  uint16_t m_RemoteMachinePort;
85  PcapRemoteAuthentication* m_RemoteAuthentication;
86 
87  // c'tor is private, as only PcapRemoteDeviceList should create instances of it, and it'll create only one for every remote interface
88  PcapRemoteDevice(pcap_if_t* iface, PcapRemoteAuthentication* remoteAuthentication, const IPAddress& remoteMachineIP, uint16_t remoteMachinePort);
89 
90  // private copy c'tor
91  PcapRemoteDevice( const PcapRemoteDevice& other );
92  // private assignment operator
93  PcapRemoteDevice& operator=(const PcapRemoteDevice& other);
94 
95  static void* remoteDeviceCaptureThreadMain(void *ptr);
96 
97  //overridden methods
98  ThreadStart getCaptureThreadStart();
99 
100  public:
101  virtual ~PcapRemoteDevice() {}
102 
106  IPAddress getRemoteMachineIpAddress() const { return m_RemoteMachineIpAddress; }
107 
111  uint16_t getRemoteMachinePort() const { return m_RemoteMachinePort; }
112 
113  //overridden methods
114 
115  virtual LiveDeviceType getDeviceType() const { return RemoteDevice; }
116 
121  virtual uint32_t getMtu() const;
122 
127  virtual MacAddress getMacAddress() const;
128 
138  virtual bool open();
139 
140  virtual void getStatistics(pcap_stat& stats) const;
141  };
142 
143 } // namespace pcpp
144 
145 #endif // WIN32 || WINx64
146 
147 #endif /* PCAPPP_PCAP_REMOTE_DEVICE */
pcpp::PcapRemoteAuthentication::userName
std::string userName
Definition: PcapRemoteDevice.h:46
pcpp::PcapLiveDevice::RemoteDevice
@ RemoteDevice
Definition: PcapLiveDevice.h:135
pcpp::PcapRemoteAuthentication::getPcapRmAuth
pcap_rmtauth getPcapRmAuth() const
pcpp::PcapLiveDevice
Definition: PcapLiveDevice.h:76
pcpp::PcapRemoteAuthentication::password
std::string password
Definition: PcapRemoteDevice.h:51
pcpp::IPAddress
‍**
Definition: IpAddress.h:236
pcpp::MacAddress
Definition: MacAddress.h:27
pcpp::PcapRemoteDevice::getStatistics
virtual void getStatistics(pcap_stat &stats) const
pcpp::PcapLiveDevice::LiveDeviceType
LiveDeviceType
Definition: PcapLiveDevice.h:128
PcapLiveDevice.h
pcpp::PcapRemoteAuthentication
Definition: PcapRemoteDevice.h:27
pcpp
The main namespace for the PcapPlusPlus lib.
pcpp::PcapRemoteDevice::getDeviceType
virtual LiveDeviceType getDeviceType() const
Definition: PcapRemoteDevice.h:115
pcpp::PcapRemoteDevice::getMacAddress
virtual MacAddress getMacAddress() const
pcpp::PcapRemoteDevice::open
virtual bool open()
pcpp::PcapRemoteDevice
Definition: PcapRemoteDevice.h:79
pcpp::PcapRemoteDevice::getMtu
virtual uint32_t getMtu() const
pcpp::PcapRemoteAuthentication::PcapRemoteAuthentication
PcapRemoteAuthentication(const std::string username, const std::string password)
Definition: PcapRemoteDevice.h:35
pcpp::PcapRemoteAuthentication::PcapRemoteAuthentication
PcapRemoteAuthentication(const PcapRemoteAuthentication &other)
Definition: PcapRemoteDevice.h:41
pcpp::PcapRemoteDevice::getRemoteMachineIpAddress
IPAddress getRemoteMachineIpAddress() const
Definition: PcapRemoteDevice.h:106
pcpp::PcapRemoteDevice::getRemoteMachinePort
uint16_t getRemoteMachinePort() const
Definition: PcapRemoteDevice.h:111
pcpp::PcapRemoteDeviceList
Definition: PcapRemoteDeviceList.h:28