PcapPlusPlus  Next
KniDeviceList.h
1 #pragma once
2 
3 // GCOVR_EXCL_START
4 
5 #include <vector>
6 
7 #include "KniDevice.h"
8 #include "DpdkDeviceList.h"
9 
12 namespace pcpp
13 {
19  {
20  KniDeviceList();
21 
32  void destroyDevice(KniDevice* kniDevice);
33 
34  public:
37  {
41  CALLBACKS_OLD = 1
42  };
45  {
55  };
56 
57  ~KniDeviceList();
58 
63 
65  inline bool isInitialized()
66  {
67  return m_Initialized;
68  }
69 
78  KniDevice* createDevice(const KniDevice::KniDeviceConfiguration& config, const size_t mempoolSize);
83  KniDevice* getDeviceByPort(const uint16_t portId);
88  KniDevice* getDeviceByName(const std::string& name);
89 
97  static bool isCallbackSupported(const KniCallbackType cbType);
98 
99  private:
100  std::vector<KniDevice*> m_Devices;
101  bool m_Initialized;
102  int m_KniUniqueId;
103  };
104 } // namespace pcpp
105 
106 // 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:37
@ CALLBACKS_NEW
Reports that DPDK supports only KniDevice::KniIoctlCallbacks callback structure.
Definition: KniDeviceList.h:39
@ CALLBACKS_OLD
Reports that DPDK supports only KniDevice::KniOldIoctlCallbacks callback structure.
Definition: KniDeviceList.h:41
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:65
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:45
@ CALLBACK_LINK
Definition: KniDeviceList.h:50
@ CALLBACK_PROMISC
KniDevice::KniIoctlCallbacks::config_promiscusity callback.
Definition: KniDeviceList.h:54
@ CALLBACK_MTU
KniDevice::KniIoctlCallbacks::change_mtu and KniDevice::KniOldIoctlCallbacks::change_mtu callback.
Definition: KniDeviceList.h:47
@ CALLBACK_MAC
KniDevice::KniIoctlCallbacks::config_mac_address callback.
Definition: KniDeviceList.h:52
static KniCallbackVersion callbackVersion()
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