1 #ifndef PCAPPP_PF_RING_DEVICE 2 #define PCAPPP_PF_RING_DEVICE 11 #include <condition_variable> 17 typedef struct __pfring pfring;
28 typedef void (*OnPfRingPacketsArriveCallback)(RawPacket* packets, uint32_t numOfPackets, uint8_t threadId, PfRingDevice* device,
void* userCookie);
40 struct CoreConfiguration
51 pfring** m_PfRingDescriptors;
52 uint8_t m_NumOfOpenedRxChannels;
53 std::string m_DeviceName;
57 CoreConfiguration m_CoreConfiguration[MAX_NUM_OF_CORES];
59 OnPfRingPacketsArriveCallback m_OnPacketsArriveCallback;
60 void* m_OnPacketsArriveUserCookie;
62 bool m_HwClockEnabled;
63 bool m_IsFilterCurrentlySet;
67 bool initCoreConfigurationByCoreMask(CoreMask coreMask);
68 void captureThreadMain(std::condition_variable* startCond, std::mutex* startMutex,
const int* startState);
70 int openSingleRxChannel(
const char* deviceName, pfring** ring);
72 bool getIsHwClockEnable() { setPfRingDeviceAttributes();
return m_HwClockEnabled; }
73 bool setPfRingDeviceClock(pfring* ring);
75 void clearCoreConfiguration();
76 int getCoresInUseCount()
const;
78 void setPfRingDeviceAttributes();
80 bool sendData(
const uint8_t* packetData,
int packetDataLength,
bool flushTxQueues);
131 int getMtu() { setPfRingDeviceAttributes();
return m_DeviceMTU; }
164 bool startCaptureMultiThread(OnPfRingPacketsArriveCallback onPacketsArrive,
void* onPacketsArriveUserCookie, CoreMask coreMask);
179 bool openSingleRxChannel(uint8_t channelId);
273 bool sendPacket(
const uint8_t* packetData,
int packetDataLength);
340 bool setFilter(std::string filterAsString);
The main namespace for the PcapPlusPlus lib.
std::string getDeviceName() const
Definition: PfRingDevice.h:144
ChannelDistribution
Definition: PfRingDevice.h:86
uint64_t drop
Definition: PfRingDevice.h:107
Definition: SystemUtils.h:27
bool setFilter(std::string filterAsString)
Definition: PointerVector.h:24
Definition: RawPacket.h:254
Definition: PfRingDeviceList.h:22
void getStatistics(PfRingStats &stats) const
Definition: PfRingDevice.h:35
SystemCore getCurrentCoreId() const
uint64_t recv
Definition: PfRingDevice.h:105
Definition: PfRingDevice.h:95
void getThreadStatistics(SystemCore core, PfRingStats &stats) const
bool startCaptureMultiThread(OnPfRingPacketsArriveCallback onPacketsArrive, void *onPacketsArriveUserCookie, CoreMask coreMask)
Definition: PfRingDevice.h:102
void getCurrentThreadStatistics(PfRingStats &stats) const
int getMtu()
Definition: PfRingDevice.h:131
uint8_t getNumOfOpenedRxChannels() const
Definition: PfRingDevice.h:211
int sendPackets(const RawPacket *rawPacketsArr, int arrLength)
bool isFilterCurrentlySet() const
MacAddress getMacAddress()
Definition: PfRingDevice.h:119
int getInterfaceIndex()
Definition: PfRingDevice.h:125
bool startCaptureSingleThread(OnPfRingPacketsArriveCallback onPacketsArrive, void *onPacketsArriveUserCookie)
uint8_t getTotalNumOfRxChannels() const
bool sendPacket(const RawPacket &rawPacket)
Definition: PfRingDevice.h:91
virtual bool setFilter(GeneralFilter &filter)
Definition: Device.h:76
Definition: MacAddress.h:28
bool isHwClockEnabledForDevice()
Definition: PfRingDevice.h:138
bool openMultiRxChannels(const uint8_t *channelIds, int numOfChannelIds)