| #include <libpldm/base.h> |
| /** @brief Register a handler for a PLDM Type |
| * @param[in] pldmType - PLDM type code |
| * @param[in] handler - PLDM Type handler |
| void registerHandler(Type pldmType, std::unique_ptr<CmdHandler> handler) |
| handlers.emplace(pldmType, std::move(handler)); |
| /** @brief Invoke a PLDM command handler |
| * @param[in] tid - PLDM request TID |
| * @param[in] pldmType - PLDM type code |
| * @param[in] pldmCommand - PLDM command code |
| * @param[in] request - PLDM request message |
| * @param[in] reqMsgLen - PLDM request message size |
| * @return PLDM response message |
| Response handle(pldm_tid_t tid, Type pldmType, Command pldmCommand, |
| const pldm_msg* request, size_t reqMsgLen) |
| return handlers.at(pldmType)->handle(tid, pldmCommand, request, |
| std::map<Type, std::unique_ptr<CmdHandler>> handlers; |