diff options
author | Brandon Kim <brandonkim@google.com> | 2019-10-18 10:08:37 -0700 |
---|---|---|
committer | Brandon Kim <brandonkim@google.com> | 2019-10-18 10:33:14 -0700 |
commit | cc4ef0c5a492968e6e7e7df7e41acbd599f0e23f (patch) | |
tree | 62f2d41ffe4ad94a5ef933429c3e304d8e00be86 /src/ipmiblob/blob_handler.cpp | |
parent | 0106f57eab1264e86fc9e75afa453ebbed99345d (diff) | |
download | ipmi-blob-tool-cc4ef0c5a492968e6e7e7df7e41acbd599f0e23f.tar.gz ipmi-blob-tool-cc4ef0c5a492968e6e7e7df7e41acbd599f0e23f.zip |
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>
Diffstat (limited to 'src/ipmiblob/blob_handler.cpp')
-rw-r--r-- | src/ipmiblob/blob_handler.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
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 @@ void BlobHandler::closeBlob(std::uint16_t session) 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) |