PcapPlusPlus  Next
KniDeviceList.h
1 #pragma once
2 
3 // GCOVR_EXCL_START
4 
5 #include <vector>
6 
7 #include "KniDevice.h"
8 #include "DeviceListBase.h"
9 
12 namespace pcpp
13 {
18  class KniDeviceList : public internal::DeviceListBase<KniDevice>
19  {
21 
22  KniDeviceList();
23 
34  void destroyDevice(KniDevice* kniDevice);
35 
36  public:
39  {
43  CALLBACKS_OLD = 1
44  };
47  {
57  };
58 
59  ~KniDeviceList();
60 
65 
67  inline bool isInitialized()
68  {
69  return m_Initialized;
70  }
71 
80  KniDevice* createDevice(const KniDevice::KniDeviceConfiguration& config, const size_t mempoolSize);
85  KniDevice* getDeviceByPort(const uint16_t portId);
90  KniDevice* getDeviceByName(const std::string& name);
91 
99  static bool isCallbackSupported(const KniCallbackType cbType);
100 
101  private:
102  bool m_Initialized;
103  int m_KniUniqueId;
104  };
105 } // namespace pcpp
106 
107 // GCOVR_EXCL_STOP
This file and KniDeviceList.h provide PcapPlusPlus C++ wrapper for DPDK KNI (Kernel Network Interface...
Definition: KniDevice.h:116
Definition: KniDeviceList.h:19
KniCallbackVersion
Callback related constants for KNI device.
Definition: KniDeviceList.h:39
@ CALLBACKS_NEW
Reports that DPDK supports only KniDevice::KniIoctlCallbacks callback structure.
Definition: KniDeviceList.h:41
@ CALLBACKS_OLD
Reports that DPDK supports only KniDevice::KniOldIoctlCallbacks callback structure.
Definition: KniDeviceList.h:43
KniDevice * createDevice(const KniDevice::KniDeviceConfiguration &config, const size_t mempoolSize)
Factory method for KNI devices. Newly created device is remembered under portId and name provided in ...
KniDevice * getDeviceByName(const std::string &name)
Returns KNI device with specified name.
static KniDeviceList & getInstance()
Getter for singleton.
bool isInitialized()
Definition: KniDeviceList.h:67
static bool isCallbackSupported(const KniCallbackType cbType)
KniDevice * getDeviceByPort(const uint16_t portId)
Returns KNI device with specified portId.
KniCallbackType
Various callback types supported by KNI device.
Definition: KniDeviceList.h:47
@ CALLBACK_LINK
Definition: KniDeviceList.h:52
@ CALLBACK_PROMISC
KniDevice::KniIoctlCallbacks::config_promiscusity callback.
Definition: KniDeviceList.h:56
@ CALLBACK_MTU
KniDevice::KniIoctlCallbacks::change_mtu and KniDevice::KniOldIoctlCallbacks::change_mtu callback.
Definition: KniDeviceList.h:49
@ CALLBACK_MAC
KniDevice::KniIoctlCallbacks::config_mac_address callback.
Definition: KniDeviceList.h:54
static KniCallbackVersion callbackVersion()
A base class for device lists, providing common functionality for managing a list of devices.
Definition: DeviceListBase.h:10
The main namespace for the PcapPlusPlus lib.
KNI device initialization data. Used to create new KNI device. Usage of callbacks member or oldCallba...
Definition: KniDevice.h:201