tools: blob: implement layer above ipmi
Implement the layer above actual IPMI calls, such that we can verify the
behavior. There is a layer beneath this that'll compute CRCs before
passing the commands down, that will go in next.
Change-Id: I0b8e3aa93c171d829e32727c7bb1b411659d80bd
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/tools/blob_handler.hpp b/tools/blob_handler.hpp
index 285bbf1..fb2dcb5 100644
--- a/tools/blob_handler.hpp
+++ b/tools/blob_handler.hpp
@@ -6,8 +6,50 @@
class BlobHandler : public BlobInterface
{
public:
+ enum BlobOEMCommands
+ {
+ bmcBlobGetCount = 0,
+ bmcBlobEnumerate = 1,
+ bmcBlobOpen = 2,
+ bmcBlobRead = 3,
+ bmcBlobWrite = 4,
+ bmcBlobCommit = 5,
+ bmcBlobClose = 6,
+ bmcBlobDelete = 7,
+ bmcBlobStat = 8,
+ bmcBlobSessionStat = 9,
+ bmcBlobWriteMeta = 10,
+ };
+
explicit BlobHandler(IpmiInterface* ipmi) : ipmi(ipmi){};
+ /**
+ * Send the contents of the payload to IPMI, this method handles wrapping
+ * with the OEN, subcommand and CRC.
+ *
+ * @param[in] command - the blob command.
+ * @param[in] payload - the payload bytes.
+ * @return the bytes returned from the ipmi interface.
+ */
+ std::vector<std::uint8_t>
+ sendIpmiPayload(BlobOEMCommands command,
+ const std::vector<std::uint8_t>& payload);
+
+ /**
+ * Retrieve the blob count.
+ *
+ * @return the number of blob_ids found (0 on failure).
+ */
+ int getBlobCount();
+
+ /**
+ * Given an index into the list of blobs, return the name.
+ *
+ * @param[in] index - the index into the list of blob ids.
+ * @return the name as a string or empty on failure.
+ */
+ std::string enumerateBlob(std::uint32_t index);
+
std::vector<std::string> getBlobList() override;
private: