blob: bf179345616c94db81a08675084e85242b3a0625 (
plain)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#pragma once
#include <cstdint>
#include <vector>
namespace ipmi_flash
{
/**
* Each data transport mechanism must implement the DataInterface.
*/
class DataInterface
{
public:
virtual ~DataInterface() = default;
/**
* Initialize data transport mechanism. Calling this should be idempotent
* if possible.
*
* @return true if successful
*/
virtual bool open() = 0;
/**
* Close the data transport mechanism.
*
* @return true if successful
*/
virtual bool close() = 0;
/**
* Copy bytes from external interface (blocking call).
*
* @param[in] length - number of bytes to copy
* @return the bytes read
*/
virtual std::vector<std::uint8_t> copyFrom(std::uint32_t length) = 0;
/**
* set configuration.
*
* @param[in] configuration - byte vector of data.
* @return bool - returns true on success.
*/
virtual bool writeMeta(const std::vector<std::uint8_t>& configuration) = 0;
/**
* read configuration.
*
* @return bytes - whatever bytes are required configuration information for
* the mechanism.
*/
virtual std::vector<std::uint8_t> readMeta() = 0;
};
struct DataHandlerPack
{
std::uint16_t bitmask;
DataInterface* handler;
};
} // namespace ipmi_flash
|