move entry point handler to process
Move the entry point handler for IPMI messages to process for two
reasons:
1) this lets one build pieces of this library without including the
constructor
2) this code is part of the command processing, and as such should be
with its kin.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I10ab19b1868a29b158570109b4211e9c8b01be18
diff --git a/process.cpp b/process.cpp
index 661f59d..bad4d70 100644
--- a/process.cpp
+++ b/process.cpp
@@ -142,4 +142,30 @@
return result;
}
+
+ipmi_ret_t handleBlobCommand(ipmi_cmd_t cmd, const uint8_t* reqBuf,
+ uint8_t* replyCmdBuf, size_t* dataLen)
+{
+ /* It's holding at least a sub-command. The OEN is trimmed from the bytes
+ * before this is called.
+ */
+ if ((*dataLen) < 1)
+ {
+ return IPMI_CC_REQ_DATA_LEN_INVALID;
+ }
+
+ /* on failure rc is set to the corresponding IPMI error. */
+ ipmi_ret_t rc = IPMI_CC_OK;
+ IpmiBlobHandler command =
+ validateBlobCommand(reqBuf, replyCmdBuf, dataLen, &rc);
+ if (command == nullptr)
+ {
+ (*dataLen) = 0;
+ return rc;
+ }
+
+ return processBlobCommand(command, getBlobManager(), reqBuf, replyCmdBuf,
+ dataLen);
+}
+
} // namespace blobs