11 #include <condition_variable>
17 typedef struct __pfring pfring;
26 typedef void (*OnPfRingPacketsArriveCallback)(RawPacket* packets, uint32_t numOfPackets, uint8_t threadId,
27 PfRingDevice* device,
void* userCookie);
36 struct CoreConfiguration
50 std::condition_variable Cond;
54 pfring** m_PfRingDescriptors;
55 uint8_t m_NumOfOpenedRxChannels;
56 std::string m_DeviceName;
60 CoreConfiguration m_CoreConfiguration[MAX_NUM_OF_CORES];
62 OnPfRingPacketsArriveCallback m_OnPacketsArriveCallback;
63 void* m_OnPacketsArriveUserCookie;
65 bool m_HwClockEnabled;
66 bool m_IsFilterCurrentlySet;
70 bool initCoreConfigurationByCoreMask(CoreMask coreMask);
71 void captureThreadMain(std::shared_ptr<StartupBlock> startupBlock);
73 int openSingleRxChannel(
const char* deviceName, pfring** ring);
75 bool getIsHwClockEnable()
77 setPfRingDeviceAttributes();
78 return m_HwClockEnabled;
80 bool setPfRingDeviceClock(pfring* ring);
82 void clearCoreConfiguration();
83 int getCoresInUseCount()
const;
85 void setPfRingDeviceAttributes();
87 bool sendData(
const uint8_t* packetData,
int packetDataLength,
bool flushTxQueues);
116 setPfRingDeviceAttributes();
124 setPfRingDeviceAttributes();
125 return m_InterfaceIndex;
132 setPfRingDeviceAttributes();
141 setPfRingDeviceAttributes();
142 return m_HwClockEnabled;
206 return m_NumOfOpenedRxChannels;
255 bool sendPacket(
const uint8_t* packetData,
int packetDataLength);
virtual bool setFilter(GeneralFilter &filter)
Definition: Device.h:63
Definition: MacAddress.h:21
Definition: PfRingDevice.h:32
bool sendPacket(const RawPacket &rawPacket)
bool startCaptureMultiThread(OnPfRingPacketsArriveCallback onPacketsArrive, void *onPacketsArriveUserCookie, CoreMask coreMask)
ChannelDistribution
An enum representing the type of packet distribution between different RX channels.
Definition: PfRingDevice.h:92
@ RoundRobin
Packets are distributed between channels in a round-robin manner.
Definition: PfRingDevice.h:94
@ PerFlow
Packets are distributed between channels per flow (each flow goes for different channel)
Definition: PfRingDevice.h:96
bool startCaptureSingleThread(OnPfRingPacketsArriveCallback onPacketsArrive, void *onPacketsArriveUserCookie)
void stopCapture()
Stops capturing packets (works will all type of startCapture*)
int getMtu()
Definition: PfRingDevice.h:130
bool isHwClockEnabledForDevice()
Definition: PfRingDevice.h:139
bool openMultiRxChannels(uint8_t numOfRxChannelsToOpen, ChannelDistribution dist)
bool openSingleRxChannel(uint8_t channelId)
uint8_t getTotalNumOfRxChannels() const
void getThreadStatistics(SystemCore core, PfRingStats &stats) const
~PfRingDevice()
A destructor for PfRingDevice class.
bool sendPacket(const Packet &packet)
int sendPackets(const Packet **packetsArr, int arrLength)
bool openMultiRxChannels(const uint8_t *channelIds, int numOfChannelIds)
int sendPackets(const RawPacketVector &rawPackets)
uint8_t getNumOfOpenedRxChannels() const
Definition: PfRingDevice.h:204
std::string getDeviceName() const
Definition: PfRingDevice.h:147
int getInterfaceIndex()
Definition: PfRingDevice.h:122
bool isFilterCurrentlySet() const
SystemCore getCurrentCoreId() const
void getCurrentThreadStatistics(PfRingStats &stats) const
MacAddress getMacAddress()
Definition: PfRingDevice.h:114
bool sendPacket(const uint8_t *packetData, int packetDataLength)
void close()
Closes all RX channels currently opened in device.
bool setFilter(std::string filterAsString)
void getStatistics(PfRingStats &stats) const
int sendPackets(const RawPacket *rawPacketsArr, int arrLength)
Definition: PfRingDeviceList.h:17
Definition: PointerVector.h:50
Definition: RawPacket.h:269
The main namespace for the PcapPlusPlus lib.
Definition: PfRingDevice.h:102
uint64_t drop
Number of packets dropped.
Definition: PfRingDevice.h:106
uint64_t recv
Number of packets received.
Definition: PfRingDevice.h:104
Definition: SystemUtils.h:23