blob: ada0c147e618f2403df2e2f5d88ece302b5a9107 [file] [log] [blame]
Patrick Venturec7ca2912018-11-02 11:38:33 -07001#pragma once
2
3#include <blobs-ipmid/blobs.hpp>
4
5namespace blobs
6{
7
Patrick Venturedf3e6ae2018-11-02 17:37:18 -07008enum class FirmwareUpdateFlags
9{
10 bt = (1 << 8), /* Expect to send contents over IPMI BlockTransfer. */
11 p2a = (1 << 9), /* Expect to send contents over P2A bridge. */
12 lpc = (1 << 10), /* Expect to send contents over LPC bridge. */
13};
14
Patrick Venturec7ca2912018-11-02 11:38:33 -070015/**
16 * Register only one firmware blob handler that will manage all sessions.
17 */
18class FirmwareBlobHandler : public GenericBlobInterface
19{
20 public:
21 FirmwareBlobHandler() = default;
22 ~FirmwareBlobHandler() = default;
23 FirmwareBlobHandler(const FirmwareBlobHandler&) = default;
24 FirmwareBlobHandler& operator=(const FirmwareBlobHandler&) = default;
25 FirmwareBlobHandler(FirmwareBlobHandler&&) = default;
26 FirmwareBlobHandler& operator=(FirmwareBlobHandler&&) = default;
27
28 bool canHandleBlob(const std::string& path) override;
29 std::vector<std::string> getBlobIds() override;
30 bool deleteBlob(const std::string& path) override;
31 bool stat(const std::string& path, struct BlobMeta* meta) override;
32 bool open(uint16_t session, uint16_t flags,
33 const std::string& path) override;
34 std::vector<uint8_t> read(uint16_t session, uint32_t offset,
35 uint32_t requestedSize) override;
36 bool write(uint16_t session, uint32_t offset,
37 const std::vector<uint8_t>& data) override;
38 bool writeMeta(uint16_t session, uint32_t offset,
39 const std::vector<uint8_t>& data) override;
40 bool commit(uint16_t session, const std::vector<uint8_t>& data) override;
41 bool close(uint16_t session) override;
42 bool stat(uint16_t session, struct BlobMeta* meta) override;
43 bool expire(uint16_t session) override;
44};
45
46} // namespace blobs