|
PcapPlusPlus
19.12
|
Go to the documentation of this file.
2 #ifndef PCAPPP_LIVE_DEVICE
3 #define PCAPPP_LIVE_DEVICE
52 typedef void* (*ThreadStart)(
void*);
83 pcap_t* m_PcapSendDescriptor;
85 const char* m_Description;
88 std::vector<pcap_addr_t> m_Addresses;
91 PcapThread* m_CaptureThread;
92 bool m_CaptureThreadStarted;
93 PcapThread* m_StatsThread;
94 bool m_StatsThreadStarted;
97 void* m_cbOnPacketArrivesUserCookie;
99 void* m_cbOnStatsUpdateUserCookie;
101 void* m_cbOnPacketArrivesBlockingModeUserCookie;
102 int m_IntervalToUpdateStats;
104 bool m_CaptureCallbackMode;
108 PcapLiveDevice(pcap_if_t* pInterface,
bool calculateMTU,
bool calculateMacAddress,
bool calculateDefaultGateway);
114 void setDeviceMacAddress();
115 void setDefaultGateway();
116 static void* captureThreadMain(
void* ptr);
117 static void* statsThreadMain(
void* ptr);
118 static void onPacketArrives(uint8_t* user,
const struct pcap_pkthdr* pkthdr,
const uint8_t* packet);
119 static void onPacketArrivesNoCallback(uint8_t* user,
const struct pcap_pkthdr* pkthdr,
const uint8_t* packet);
120 static void onPacketArrivesBlockingMode(uint8_t* user,
const struct pcap_pkthdr* pkthdr,
const uint8_t* packet);
121 std::string printThreadId(PcapThread*
id);
122 virtual ThreadStart getCaptureThreadStart();
230 const char*
getName()
const {
return m_Name; }
235 const char*
getDesc()
const {
return m_Description; }
245 virtual uint16_t
getMtu()
const {
return m_DeviceMtu; }
254 const std::vector<pcap_addr_t>&
getAddresses()
const {
return m_Addresses; }
409 bool sendPacket(
const uint8_t* packetData,
int packetDataLength);
478 bool open(
const DeviceConfiguration& config);
485 pcap_t* doOpen(
const DeviceConfiguration& config);
Definition: PcapLiveDevice.h:147
Definition: IpAddress.h:119
Definition: PcapLiveDevice.h:135
Definition: PcapLiveDevice.h:76
Definition: PcapLiveDevice.h:131
virtual bool startCapture(OnPacketArrivesCallback onPacketArrives, void *onPacketArrivesUserCookie)
Definition: PcapLiveDevice.h:170
IPv4Address getIPv4Address() const
int packetBufferTimeoutMs
Definition: PcapLiveDevice.h:179
PcapDirection direction
Definition: PcapLiveDevice.h:195
const char * getDesc() const
Definition: PcapLiveDevice.h:235
Definition: MacAddress.h:27
DeviceMode mode
Definition: PcapLiveDevice.h:173
virtual int sendPackets(RawPacket *rawPacketsArr, int arrLength)
PcapDirection
Definition: PcapLiveDevice.h:154
Definition: PcapLiveDevice.h:159
virtual void getStatistics(pcap_stat &stats) const
virtual MacAddress getMacAddress() const
Definition: PcapLiveDevice.h:259
const std::vector< IPv4Address > & getDnsServers() const
bool sendPacket(RawPacket const &rawPacket)
int packetBufferSize
Definition: PcapLiveDevice.h:189
Definition: PcapLiveDevice.h:161
LiveDeviceType
Definition: PcapLiveDevice.h:128
bool getLoopback() const
Definition: PcapLiveDevice.h:240
void(* OnPacketArrivesCallback)(RawPacket *pPacket, PcapLiveDevice *pDevice, void *userCookie)
Definition: PcapLiveDevice.h:30
Definition: PcapLiveDevice.h:133
virtual int startCaptureBlockingMode(OnPacketArrivesStopBlocking onPacketArrives, void *userCookie, int timeout)
Definition: PcapLiveDevice.h:157
Definition: PcapLiveDevice.h:145
virtual LinkLayerType getLinkType() const
Definition: PcapLiveDevice.h:250
Definition: PcapDevice.h:35
DeviceConfiguration(DeviceMode mode=Promiscuous, int packetBufferTimeoutMs=0, int packetBufferSize=0, PcapDirection direction=PCPP_INOUT)
Definition: PcapLiveDevice.h:207
Definition: PcapLiveDeviceList.h:25
virtual ~PcapLiveDevice()
The main namespace for the PcapPlusPlus lib.
bool(* OnPacketArrivesStopBlocking)(RawPacket *pPacket, PcapLiveDevice *pDevice, void *userData)
Definition: PcapLiveDevice.h:40
LinkLayerType
Definition: RawPacket.h:24
virtual LiveDeviceType getDeviceType() const
Definition: PcapLiveDevice.h:225
const std::vector< pcap_addr_t > & getAddresses() const
Definition: PcapLiveDevice.h:254
DeviceMode
Definition: PcapLiveDevice.h:142
virtual uint16_t getMtu() const
Definition: PcapLiveDevice.h:245
void(* OnStatsUpdateCallback)(pcap_stat &stats, void *userCookie)
Definition: PcapLiveDevice.h:49
IPv4Address getDefaultGateway() const
Definition: PointerVector.h:24
Definition: RawPacket.h:219
const char * getName() const
Definition: PcapLiveDevice.h:230