Patrick Venture | 0088759 | 2018-12-11 10:57:06 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Patrick Venture | 0533d0b | 2018-12-13 08:48:24 -0800 | [diff] [blame] | 3 | #include "firmware_handler.hpp" |
| 4 | |
Patrick Venture | 7871b45 | 2018-12-13 08:53:14 -0800 | [diff] [blame] | 5 | #include <cstdint> |
Patrick Venture | 0088759 | 2018-12-11 10:57:06 -0800 | [diff] [blame] | 6 | #include <string> |
| 7 | #include <vector> |
| 8 | |
Patrick Venture | 0bf8bf0 | 2018-12-12 20:43:25 -0800 | [diff] [blame] | 9 | struct StatResponse |
| 10 | { |
| 11 | std::uint16_t blob_state; |
| 12 | std::uint32_t size; |
| 13 | std::vector<std::uint8_t> metadata; |
| 14 | }; |
| 15 | |
Patrick Venture | 0088759 | 2018-12-11 10:57:06 -0800 | [diff] [blame] | 16 | class BlobInterface |
| 17 | { |
Patrick Venture | 0088759 | 2018-12-11 10:57:06 -0800 | [diff] [blame] | 18 | public: |
| 19 | virtual ~BlobInterface() = default; |
| 20 | |
| 21 | /** |
| 22 | * Get a list of the blob_ids provided by the BMC. |
| 23 | * |
| 24 | * @return list of strings, each representing a blob_id returned. |
| 25 | */ |
| 26 | virtual std::vector<std::string> getBlobList() = 0; |
Patrick Venture | 0bf8bf0 | 2018-12-12 20:43:25 -0800 | [diff] [blame] | 27 | |
| 28 | /** |
| 29 | * Get the stat() on the blob_id. |
| 30 | * |
| 31 | * @param[in] id - the blob_id. |
| 32 | * @return metadata structure. |
| 33 | */ |
| 34 | virtual StatResponse getStat(const std::string& id) = 0; |
Patrick Venture | 0533d0b | 2018-12-13 08:48:24 -0800 | [diff] [blame] | 35 | |
| 36 | /** |
| 37 | * Attempt to open the file using the specific data interface flag. |
| 38 | * |
| 39 | * @param[in] blob - the blob_id to open. |
| 40 | * @param[in] handlerFlags - the data interface flag, if relevant. |
| 41 | * @return the session id on success. |
| 42 | * @throws BlobException on failure. |
| 43 | */ |
| 44 | virtual std::uint16_t |
| 45 | openBlob(const std::string& id, |
| 46 | blobs::FirmwareBlobHandler::UpdateFlags handlerFlags) = 0; |
Patrick Venture | 0088759 | 2018-12-11 10:57:06 -0800 | [diff] [blame] | 47 | }; |