google-ipmi-sys: Refactor to use new version of OEM IPMI Handler
Using the new version of ipmi handler provide a higher level wrapper
over the same functionalities. It helps us parse the input and output to
have more control of the input/output we see.
The input and output will be
`std::uint8_t, std::optional<std::vector<uint8_t>>`.
This represents `subcommand` and any input data.
Changes to note,
- all subcommand in the request/response struct are removed. It will be
managed by the wrapper directly.
- Unit tests checking for input with only the subcommand are
removed.
- Move all reply struct to header files to be accessible in unit test.
Tested:
All IPMI OEM command still works the same as before this change.
Change-Id: I4230ab84a497a867248fe82224e32cc69b314b64
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/psu.hpp b/psu.hpp
index f0d5775..b022881 100644
--- a/psu.hpp
+++ b/psu.hpp
@@ -18,6 +18,9 @@
#include <ipmid/api.h>
+#include <ipmid/api-types.hpp>
+#include <vector>
+
namespace google
{
namespace ipmi
@@ -25,24 +28,17 @@
struct PsuResetRequest
{
- uint8_t subcommand;
// Delay in seconds.
uint32_t delay;
} __attribute__((packed));
-struct PsuResetOnShutdownRequest
-{
- uint8_t subcommand;
-} __attribute__((packed));
-
// Set a time-delayed PSU hard reset.
-ipmi_ret_t psuHardReset(const uint8_t* reqBuf, uint8_t* replyBuf,
- size_t* dataLen, const HandlerInterface* handler);
+Resp psuHardReset(const std::vector<std::uint8_t>& data,
+ const HandlerInterface* handler);
// Arm for PSU hard reset on host shutdown.
-ipmi_ret_t psuHardResetOnShutdown(const uint8_t* reqBuf, uint8_t* replyBuf,
- size_t* dataLen,
- const HandlerInterface* handler);
+Resp psuHardResetOnShutdown(const std::vector<std::uint8_t>& data,
+ const HandlerInterface* handler);
} // namespace ipmi
} // namespace google