61 lines
1.4 KiB
C++
61 lines
1.4 KiB
C++
#pragma once
|
|
|
|
|
|
#include <memory>
|
|
#include <map>
|
|
|
|
struct _fm_eventPort;
|
|
|
|
|
|
namespace FM10K {
|
|
|
|
class IES {
|
|
public:
|
|
static IES& getInstance();
|
|
|
|
bool isInitialized() const{
|
|
return m_initialized;
|
|
}
|
|
|
|
enum class TlvType{
|
|
Text,
|
|
Integer,
|
|
UnsignedInteger,
|
|
UnsignedInteger64,
|
|
Boolean,
|
|
Null
|
|
};
|
|
|
|
bool addConfigEntry(const std::string& key, const std::string& value);
|
|
bool addConfigEntry(const std::string& key, int32_t value);
|
|
bool addConfigEntry(const std::string& key, uint32_t value);
|
|
bool addConfigEntry(const std::string& key, uint64_t value);
|
|
bool addConfigEntry(const std::string& key, bool value);
|
|
|
|
bool addConfigEntry(const std::string& key, TlvType type, const std::string& value);
|
|
|
|
bool replaceConfigEntry(const std::string& key, TlvType type, const std::string& value);
|
|
|
|
bool loadKnownConfiguration(const std::string& key);
|
|
|
|
std::string getPlatformConfiguration() const;
|
|
|
|
private:
|
|
IES();
|
|
|
|
std::map<std::string, std::pair<TlvType, std::string>> m_configuration{};
|
|
bool m_initialized = false;
|
|
|
|
|
|
static std::unique_ptr<IES> instance;
|
|
static bool init();
|
|
|
|
void handleSwitchInsertedEvent(int sw);
|
|
void handlePortEvent(int sw, struct _fm_eventPort&);
|
|
|
|
static void eventHandler(int event, int sw, void *ptr);
|
|
};
|
|
}
|
|
|
|
|