| #pragma once |
| |
| #include "Utils.hpp" |
| |
| #include <sdbusplus/asio/connection.hpp> |
| |
| #include <functional> |
| #include <map> |
| #include <memory> |
| #include <string> |
| #include <variant> |
| #include <vector> |
| |
| using BusInfo = std::map<std::string, std::string>; |
| |
| enum class MctpMessageType : uint8_t |
| { |
| CONTROL = 0, |
| PLDM = 2, |
| NVME_MI = 4, |
| SPDM = 5 |
| }; |
| |
| // Global maps (declared extern) |
| |
| class MctpReactorBusInfo |
| { |
| public: |
| explicit MctpReactorBusInfo(const std::vector<SensorData>& configData); |
| bool operator==(const std::vector<BusInfo>& targetBusInfo) const; |
| std::vector<std::string> getType() const |
| { |
| return types; |
| } |
| bool isValid() const |
| { |
| return valid; |
| } |
| const std::vector<std::map<std::string, std::string>> & |
| getProperties() const |
| { |
| return propertiesList; |
| } |
| |
| private: |
| std::vector<std::string> types; |
| bool valid = false; |
| std::vector<std::map<std::string, std::string>> propertiesList; |
| }; |
| |
| extern std::map<std::string, std::vector<SensorData>> mctpEndpointConfigMap; |
| |
| using MctpEndpointCallback = std::function<void( |
| const std::string& endpointPath, |
| const std::vector<SensorData>& endpointConfig, bool isRemoved)>; |
| using MctpCallbackToken = size_t; |
| |
| MctpCallbackToken registerMctpEndpointCallback(MctpEndpointCallback&& cb); |
| void unregisterMctpEndpointCallback(MctpCallbackToken token); |
| void unregisterAllMctpEndpointCallbacks(); |
| |
| void setupMctpEndpointListener( |
| const std::shared_ptr<sdbusplus::asio::connection>& conn, |
| MctpMessageType msgType); |
| void cleanupMctpEndpointListener(); |