1 #ifndef PCAPPP_PF_RING_DEVICE 2 #define PCAPPP_PF_RING_DEVICE 9 #include <condition_variable> 15 typedef struct __pfring pfring;
26 typedef void (*OnPfRingPacketsArriveCallback)(RawPacket* packets, uint32_t numOfPackets, uint8_t threadId, PfRingDevice* device,
void* userCookie);
38 struct CoreConfiguration
49 pfring** m_PfRingDescriptors;
50 uint8_t m_NumOfOpenedRxChannels;
51 std::string m_DeviceName;
55 CoreConfiguration m_CoreConfiguration[MAX_NUM_OF_CORES];
57 OnPfRingPacketsArriveCallback m_OnPacketsArriveCallback;
58 void* m_OnPacketsArriveUserCookie;
60 bool m_HwClockEnabled;
61 bool m_IsFilterCurrentlySet;
65 bool initCoreConfigurationByCoreMask(CoreMask coreMask);
66 void captureThreadMain(std::condition_variable* startCond, std::mutex* startMutex,
const int* startState);
68 int openSingleRxChannel(
const char* deviceName, pfring** ring);
70 bool getIsHwClockEnable() { setPfRingDeviceAttributes();
return m_HwClockEnabled; }
71 bool setPfRingDeviceClock(pfring* ring);
73 void clearCoreConfiguration();
74 int getCoresInUseCount()
const;
76 void setPfRingDeviceAttributes();
78 bool sendData(
const uint8_t* packetData,
int packetDataLength,
bool flushTxQueues);
129 int getMtu() { setPfRingDeviceAttributes();
return m_DeviceMTU; }
162 bool startCaptureMultiThread(OnPfRingPacketsArriveCallback onPacketsArrive,
void* onPacketsArriveUserCookie, CoreMask coreMask);
177 bool openSingleRxChannel(uint8_t channelId);
271 bool sendPacket(
const uint8_t* packetData,
int packetDataLength);
338 bool setFilter(std::string filterAsString);
The main namespace for the PcapPlusPlus lib.
std::string getDeviceName() const
Definition: PfRingDevice.h:142
ChannelDistribution
Definition: PfRingDevice.h:84
uint64_t drop
Definition: PfRingDevice.h:105
Definition: SystemUtils.h:27
bool setFilter(std::string filterAsString)
Definition: PointerVector.h:24
Definition: RawPacket.h:252
Definition: PfRingDeviceList.h:20
void getStatistics(PfRingStats &stats) const
Definition: PfRingDevice.h:33
SystemCore getCurrentCoreId() const
uint64_t recv
Definition: PfRingDevice.h:103
Definition: PfRingDevice.h:93
void getThreadStatistics(SystemCore core, PfRingStats &stats) const
bool startCaptureMultiThread(OnPfRingPacketsArriveCallback onPacketsArrive, void *onPacketsArriveUserCookie, CoreMask coreMask)
Definition: PfRingDevice.h:100
void getCurrentThreadStatistics(PfRingStats &stats) const
int getMtu()
Definition: PfRingDevice.h:129
uint8_t getNumOfOpenedRxChannels() const
Definition: PfRingDevice.h:209
int sendPackets(const RawPacket *rawPacketsArr, int arrLength)
bool isFilterCurrentlySet() const
MacAddress getMacAddress()
Definition: PfRingDevice.h:117
int getInterfaceIndex()
Definition: PfRingDevice.h:123
bool startCaptureSingleThread(OnPfRingPacketsArriveCallback onPacketsArrive, void *onPacketsArriveUserCookie)
uint8_t getTotalNumOfRxChannels() const
bool sendPacket(const RawPacket &rawPacket)
Definition: PfRingDevice.h:89
virtual bool setFilter(GeneralFilter &filter)
Definition: Device.h:77
Definition: MacAddress.h:28
bool isHwClockEnabledForDevice()
Definition: PfRingDevice.h:136
bool openMultiRxChannels(const uint8_t *channelIds, int numOfChannelIds)