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