PcapPlusPlus  23.09
KniDeviceList.h
1 #ifndef PCAPPP_KNI_DEVICE_LIST
2 #define PCAPPP_KNI_DEVICE_LIST
3 
4 // GCOVR_EXCL_START
5 
6 #include <vector>
7 
8 #include "KniDevice.h"
9 #include "DpdkDeviceList.h"
10 
15 namespace pcpp
16 {
17 
25  {
26  KniDeviceList();
27 
40  void destroyDevice(KniDevice* kniDevice);
41  public:
46  {
51  };
56  {
65  };
66 
67  ~KniDeviceList();
68 
74  static KniDeviceList& getInstance();
75 
79  inline bool isInitialized() { return m_Initialized; }
80 
81  /* Device manipulation */
82 
93  KniDevice* createDevice(const KniDevice::KniDeviceConfiguration& config, const size_t mempoolSize);
100  KniDevice* getDeviceByPort(const uint16_t portId);
107  KniDevice* getDeviceByName(const std::string& name);
108 
109  /* Static information */
110 
122  static bool isCallbackSupported(const KniCallbackType cbType);
123  private:
124  std::vector<KniDevice*> m_Devices;
125  bool m_Initialized;
126  int m_KniUniqueId;
127  };
128 } // namespace pcpp
129 
130 // GCOVR_EXCL_STOP
131 
132 #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:123
Definition: KniDeviceList.h:50
static bool isCallbackSupported(const KniCallbackType cbType)
static KniDeviceList & getInstance()
Getter for singleton.
Definition: KniDeviceList.h:62
Definition: KniDeviceList.h:64
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:79
Definition: KniDeviceList.h:24
KniCallbackType
Definition: KniDeviceList.h:55
This file and KniDeviceList.h provide PcapPlusPlus C++ wrapper for DPDK KNI (Kernel Network Interface...
Definition: KniDeviceList.h:60
KNI device initialization data. Used to create new KNI device. Usage of callbacks member or oldCallba...
Definition: KniDevice.h:231
Definition: KniDeviceList.h:58
static KniCallbackVersion callbackVersion()
Definition: KniDeviceList.h:48
KniCallbackVersion
Definition: KniDeviceList.h:45