blob: implement deleteBlob command

Implement the deleteBlob command for the blob handler. Adding a unit
test to go along with it.

Change-Id: I2bbc93a6e78d5311bd2033d6a8b179374777f794
Signed-off-by: Brandon Kim <brandonkim@google.com>
diff --git a/src/ipmiblob/blob_handler.cpp b/src/ipmiblob/blob_handler.cpp
index 40c725d..d93f5c3 100644
--- a/src/ipmiblob/blob_handler.cpp
+++ b/src/ipmiblob/blob_handler.cpp
@@ -334,6 +334,24 @@
     return;
 }
 
+void BlobHandler::deleteBlob(const std::string& id)
+{
+    std::vector<std::uint8_t> name;
+    std::copy(id.begin(), id.end(), std::back_inserter(name));
+    name.push_back(0x00); /* need to add nul-terminator. */
+
+    try
+    {
+        sendIpmiPayload(BlobOEMCommands::bmcBlobDelete, name);
+    }
+    catch (const BlobException& b)
+    {
+        std::fprintf(stderr, "Received failure on delete: %s\n", b.what());
+    }
+
+    return;
+}
+
 std::vector<std::uint8_t> BlobHandler::readBytes(std::uint16_t session,
                                                  std::uint32_t offset,
                                                  std::uint32_t length)