PcapPlusPlus  Next
pcpp::internal::IWinDivertDriver Class Referenceabstract

Factory and system-query abstraction used by WinDivertDevice. More...

#include <WinDivertDevice.h>

Classes

struct  NetworkInterface
 Information about a Windows network interface as reported by WinDivert/Windows APIs. More...
 

Public Member Functions

virtual std::unique_ptr< IWinDivertHandleopen (const std::string &filter, int layer, int16_t priority, uint64_t flags)=0
 Open a WinDivert handle with the given filter and settings. More...
 
virtual std::vector< NetworkInterfacegetNetworkInterfaces () const =0
 Enumerate Windows network interfaces relevant to WinDivert. More...
 

Detailed Description

Factory and system-query abstraction used by WinDivertDevice.

The sole responsibilities of this interface are:

  • Creating IWinDivertHandle instances (which expose the WinDivert API surface).
  • Enumerating relevant Windows network interfaces. Keeping these responsibilities here keeps WinDivertDevice decoupled from concrete system/driver calls and enables unit testing and alternative implementations.

Member Function Documentation

◆ getNetworkInterfaces()

virtual std::vector<NetworkInterface> pcpp::internal::IWinDivertDriver::getNetworkInterfaces ( ) const
pure virtual

Enumerate Windows network interfaces relevant to WinDivert.

Returns
A vector of NetworkInterface objects with index, name, description and status.

◆ open()

virtual std::unique_ptr<IWinDivertHandle> pcpp::internal::IWinDivertDriver::open ( const std::string &  filter,
int  layer,
int16_t  priority,
uint64_t  flags 
)
pure virtual

Open a WinDivert handle with the given filter and settings.

Parameters
[in]filterWinDivert filter string (see WinDivert documentation).
[in]layerWinDivert layer value (typically WINDIVERT_LAYER_NETWORK).
[in]priorityInjection/capture priority (lower is higher priority).
[in]flagsWinDivert open flags (sniff mode, fragments, etc.).
Returns
A unique_ptr to an IWinDivertHandle on success, or nullptr on failure.