blob: 1ba57c15ba742d00e33cd76de6d76cafa2453f55 [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
8/**
9 * Register only one firmware blob handler that will manage all sessions.
10 */
11class FirmwareBlobHandler : public GenericBlobInterface
12{
13 public:
14 FirmwareBlobHandler() = default;
15 ~FirmwareBlobHandler() = default;
16 FirmwareBlobHandler(const FirmwareBlobHandler&) = default;
17 FirmwareBlobHandler& operator=(const FirmwareBlobHandler&) = default;
18 FirmwareBlobHandler(FirmwareBlobHandler&&) = default;
19 FirmwareBlobHandler& operator=(FirmwareBlobHandler&&) = default;
20
21 bool canHandleBlob(const std::string& path) override;
22 std::vector<std::string> getBlobIds() override;
23 bool deleteBlob(const std::string& path) override;
24 bool stat(const std::string& path, struct BlobMeta* meta) override;
25 bool open(uint16_t session, uint16_t flags,
26 const std::string& path) override;
27 std::vector<uint8_t> read(uint16_t session, uint32_t offset,
28 uint32_t requestedSize) override;
29 bool write(uint16_t session, uint32_t offset,
30 const std::vector<uint8_t>& data) override;
31 bool writeMeta(uint16_t session, uint32_t offset,
32 const std::vector<uint8_t>& data) override;
33 bool commit(uint16_t session, const std::vector<uint8_t>& data) override;
34 bool close(uint16_t session) override;
35 bool stat(uint16_t session, struct BlobMeta* meta) override;
36 bool expire(uint16_t session) override;
37};
38
39} // namespace blobs