1 #ifndef PCAPPP_PF_RING_DEVICE
2 #define PCAPPP_PF_RING_DEVICE
14 typedef struct __pfring pfring;
25 typedef void (*OnPfRingPacketsArriveCallback)(RawPacket* packets, uint32_t numOfPackets, uint8_t threadId, PfRingDevice* device,
void* userCookie);
37 struct CoreConfiguration
48 pfring** m_PfRingDescriptors;
49 uint8_t m_NumOfOpenedRxChannels;
50 char m_DeviceName[30];
54 CoreConfiguration m_CoreConfiguration[MAX_NUM_OF_CORES];
56 OnPfRingPacketsArriveCallback m_OnPacketsArriveCallback;
57 void* m_OnPacketsArriveUserCookie;
59 bool m_HwClockEnabled;
60 bool m_IsFilterCurrentlySet;
64 bool initCoreConfigurationByCoreMask(CoreMask coreMask);
65 static void* captureThreadMain(
void *ptr);
67 int openSingleRxChannel(
const char* deviceName, pfring** ring);
69 bool getIsHwClockEnable() { setPfRingDeviceAttributes();
return m_HwClockEnabled; }
70 bool setPfRingDeviceClock(pfring* ring);
72 void clearCoreConfiguration();
73 int getCoresInUseCount()
const;
75 void setPfRingDeviceAttributes();
77 bool sendData(
const uint8_t* packetData,
int packetDataLength,
bool flushTxQueues);
128 int getMtu() { setPfRingDeviceAttributes();
return m_DeviceMTU; }
161 bool startCaptureMultiThread(OnPfRingPacketsArriveCallback onPacketsArrive,
void* onPacketsArriveUserCookie, CoreMask coreMask);
176 bool openSingleRxChannel(uint8_t channelId);
270 bool sendPacket(
const uint8_t* packetData,
int packetDataLength);
337 bool setFilter(std::string filterAsString);