Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <blobs-ipmid/blobs.hpp> |
| 4 | |
| 5 | namespace blobs |
| 6 | { |
| 7 | |
Patrick Venture | df3e6ae | 2018-11-02 17:37:18 -0700 | [diff] [blame] | 8 | enum 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 Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 15 | /** |
| 16 | * Register only one firmware blob handler that will manage all sessions. |
| 17 | */ |
| 18 | class 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 |