1 #pragma once 2 3 #include "ipmi.hpp" 4 #include "manager.hpp" 5 6 #include <ipmid/api.h> 7 8 #include <functional> 9 #include <ipmid/api-types.hpp> 10 #include <span> 11 #include <utility> 12 #include <vector> 13 14 namespace blobs 15 { 16 17 using IpmiBlobHandler = 18 std::function<Resp(ManagerInterface* mgr, std::span<const uint8_t> data)>; 19 20 /** 21 * Validate the IPMI request and determine routing. 22 * 23 * @param[in] cmd Requested command 24 * @param[in] data Requested data 25 * @return the ipmi command handler, or nullopt on failure. 26 */ 27 IpmiBlobHandler validateBlobCommand(uint8_t cmd, std::span<const uint8_t> data); 28 29 /** 30 * Call the IPMI command and process the result, including running the CRC 31 * computation for the reply message if there is one. 32 * 33 * @param[in] cmd - a funtion pointer to the ipmi command to process. 34 * @param[in] mgr - a pointer to the manager interface. 35 * @param[in] data - Requested data. 36 * @param[in,out] maxSize - Maximum ipmi reply size 37 * @return the ipmi command result. 38 */ 39 Resp processBlobCommand(IpmiBlobHandler cmd, ManagerInterface* mgr, 40 std::span<const uint8_t> data, size_t maxSize); 41 42 /** 43 * Given an IPMI command, request buffer, and reply buffer, validate the request 44 * and call processBlobCommand. 45 */ 46 Resp handleBlobCommand(uint8_t cmd, std::vector<uint8_t> data, size_t maxSize); 47 } // namespace blobs 48