PcapPlusPlus  21.05
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(IPcapDevice::PcapStats& stats) const;
141  };
142 
143 } // namespace pcpp
144 
145 #endif // WIN32 || WINx64
146 
147 #endif /* PCAPPP_PCAP_REMOTE_DEVICE */
Definition: PcapRemoteDevice.h:27
The main namespace for the PcapPlusPlus lib.
LiveDeviceType
Definition: PcapLiveDevice.h:133
std::string userName
Definition: PcapRemoteDevice.h:46
virtual LiveDeviceType getDeviceType() const
Definition: PcapRemoteDevice.h:115
PcapRemoteAuthentication(const PcapRemoteAuthentication &other)
Definition: PcapRemoteDevice.h:41
Definition: PcapRemoteDeviceList.h:28
pcap_rmtauth getPcapRmAuth() const
Definition: PcapLiveDevice.h:81
IPAddress getRemoteMachineIpAddress() const
Definition: PcapRemoteDevice.h:106
std::string password
Definition: PcapRemoteDevice.h:51
uint16_t getRemoteMachinePort() const
Definition: PcapRemoteDevice.h:111
PcapRemoteAuthentication(const std::string username, const std::string password)
Definition: PcapRemoteDevice.h:35
Definition: IpAddress.h:265
Definition: PcapRemoteDevice.h:79
Definition: MacAddress.h:27
Definition: PcapDevice.h:53