PcapPlusPlus  24.09
KniDeviceList.h
1 #pragma once
2 
3 // GCOVR_EXCL_START
4 
5 #include <vector>
6 
7 #include "KniDevice.h"
8 #include "DpdkDeviceList.h"
9 
14 namespace pcpp
15 {
16 
24  {
25  KniDeviceList();
26 
39  void destroyDevice(KniDevice* kniDevice);
40 
41  public:
46  {
50  CALLBACKS_OLD = 1
51  };
56  {
66  };
67 
68  ~KniDeviceList();
69 
76 
80  inline bool isInitialized()
81  {
82  return m_Initialized;
83  }
84 
85  /* Device manipulation */
86 
97  KniDevice* createDevice(const KniDevice::KniDeviceConfiguration& config, const size_t mempoolSize);
104  KniDevice* getDeviceByPort(const uint16_t portId);
111  KniDevice* getDeviceByName(const std::string& name);
112 
113  /* Static information */
114 
126  static bool isCallbackSupported(const KniCallbackType cbType);
127 
128  private:
129  std::vector<KniDevice*> m_Devices;
130  bool m_Initialized;
131  int m_KniUniqueId;
132  };
133 } // namespace pcpp
134 
135 // GCOVR_EXCL_STOP
This file and KniDeviceList.h provide PcapPlusPlus C++ wrapper for DPDK KNI (Kernel Network Interface...
Definition: KniDevice.h:125
Definition: KniDeviceList.h:24
KniCallbackVersion
Definition: KniDeviceList.h:46
@ CALLBACKS_NEW
Definition: KniDeviceList.h:48
@ CALLBACKS_OLD
Definition: KniDeviceList.h:50
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:80
static bool isCallbackSupported(const KniCallbackType cbType)
KniDevice * getDeviceByPort(const uint16_t portId)
Returns KNI device with specified portId.
KniCallbackType
Definition: KniDeviceList.h:56
@ CALLBACK_LINK
Definition: KniDeviceList.h:61
@ CALLBACK_PROMISC
Definition: KniDeviceList.h:65
@ CALLBACK_MTU
Definition: KniDeviceList.h:58
@ CALLBACK_MAC
Definition: KniDeviceList.h:63
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:234