PcapPlusPlus
pcpp::DpdkWorkerThread Class Referenceabstract

#include <DpdkDeviceList.h>

Public Member Functions

virtual ~DpdkWorkerThread ()
 
virtual bool run (uint32_t coreId)=0
 
virtual void stop ()=0
 
virtual uint32_t getCoreId ()=0
 

Detailed Description

There are two ways to capture packets using DpdkDevice: one of them is using worker threads and the other way is using a callback which is invoked on each a burst of packets are captured (see DpdkDevice::startCaptureSingleThread() ). This class is a base class for implementing workers. A worker is basically a class that is activated by DpdkDeviceList::startDpdkWorkerThreads() and runs on a designated core. When it runs it can do whatever the user wants it to do. The most common use it running in an endless loop and receive, analyze and send packets using one or more DpdkDevice instances. It can do all kinds of processing for these packets. The only restriction for a worker class is that it must implement the 3 abstract methods stated in this class-interface for start running, stop running and get the core ID the worker is running on.

Constructor & Destructor Documentation

virtual pcpp::DpdkWorkerThread::~DpdkWorkerThread ( )
inlinevirtual

A virtual d'tor. Can be overridden by child class if needed

Member Function Documentation

virtual uint32_t pcpp::DpdkWorkerThread::getCoreId ( )
pure virtual

An abstract method that must be implemented by child class. Get the core ID the worker is running on (as sent to the run() method as a parameter)

Returns
The core ID the worker is running on
virtual bool pcpp::DpdkWorkerThread::run ( uint32_t  coreId)
pure virtual

An abstract method that must be implemented by child class. It's the indication for the worker to start running

Parameters
[in]coreIdThe core ID the worker is running on (should be returned in getCoreId() )
Returns
True if all went well or false otherwise
virtual void pcpp::DpdkWorkerThread::stop ( )
pure virtual

An abstract method that must be implemented by child class. It's the indication for the worker to stop running. After this method is called the caller expects the worker to stop running as fast as possible