PcapPlusPlus  22.05
KniDeviceList.h
1 #ifndef PCAPPP_KNI_DEVICE_LIST
2 #define PCAPPP_KNI_DEVICE_LIST
3 
4 #include <vector>
5 
6 #include "KniDevice.h"
7 #include "DpdkDeviceList.h"
8 
13 namespace pcpp
14 {
15 
23  {
24  KniDeviceList();
25 
38  void destroyDevice(KniDevice* kniDevice);
39  public:
44  {
49  };
54  {
63  };
64 
65  ~KniDeviceList();
66 
72  static KniDeviceList& getInstance();
73 
77  inline bool isInitialized() { return m_Initialized; }
78 
79  /* Device manipulation */
80 
91  KniDevice* createDevice(const KniDevice::KniDeviceConfiguration& config, const size_t mempoolSize);
98  KniDevice* getDeviceByPort(const uint16_t portId);
105  KniDevice* getDeviceByName(const std::string& name);
106 
107  /* Static information */
108 
120  static bool isCallbackSupported(const KniCallbackType cbType);
121  private:
122  std::vector<KniDevice*> m_Devices;
123  bool m_Initialized;
124  int m_KniUniqueId;
125  };
126 } // namespace pcpp
127 #endif /* PCAPPP_KNI_DEVICE_LIST */
The main namespace for the PcapPlusPlus lib.
KniDevice * getDeviceByPort(const uint16_t portId)
Returns KNI device with specified portId.
Definition: KniDevice.h:120
Definition: KniDeviceList.h:48
static bool isCallbackSupported(const KniCallbackType cbType)
static KniDeviceList & getInstance()
Getter for singleton.
Definition: KniDeviceList.h:60
Definition: KniDeviceList.h:62
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.
bool isInitialized()
Definition: KniDeviceList.h:77
Definition: KniDeviceList.h:22
KniCallbackType
Definition: KniDeviceList.h:53
This file and KniDeviceList.h provide PcapPlusPlus C++ wrapper for DPDK KNI (Kernel Network Interface...
Definition: KniDeviceList.h:58
KNI device initialization data. Used to create new KNI device. Usage of callbacks member or oldCallba...
Definition: KniDevice.h:228
Definition: KniDeviceList.h:56
static KniCallbackVersion callbackVersion()
Definition: KniDeviceList.h:46
KniCallbackVersion
Definition: KniDeviceList.h:43