PcapPlusPlus  Next
pcpp::PcapLiveDevice::StatisticsUpdateWorker Class Reference

A worker thread that periodically calls the provided callback with updated statistics. More...

#include <PcapLiveDevice.h>

Public Member Functions

 StatisticsUpdateWorker (PcapLiveDevice const &pcapDevice, OnStatsUpdateCallback onStatsUpdateCallback, void *onStatsUpdateUserCookie=nullptr, unsigned int updateIntervalMs=1000)
 Constructs and starts a worker thread that periodically calls the provided callback with updated statistics. More...
 
void stopWorker ()
 Stops the worker thread.
 

Detailed Description

A worker thread that periodically calls the provided callback with updated statistics.

Constructor & Destructor Documentation

◆ StatisticsUpdateWorker()

pcpp::PcapLiveDevice::StatisticsUpdateWorker::StatisticsUpdateWorker ( PcapLiveDevice const &  pcapDevice,
OnStatsUpdateCallback  onStatsUpdateCallback,
void *  onStatsUpdateUserCookie = nullptr,
unsigned int  updateIntervalMs = 1000 
)

Constructs and starts a worker thread that periodically calls the provided callback with updated statistics.

Parameters
pcapDeviceA pointer to the PcapLiveDevice instance to be monitored.
onStatsUpdateCallbackA callback function to be called with updated statistics.
onStatsUpdateUserCookieA user-defined pointer that is passed to the callback function.
updateIntervalMsThe interval in milliseconds between each callback invocation.