tools: add internal sys interface to ipmi
Add internal sys interface to ipmi handler, s.t. the ipmi handler can do
things such as open files, or call ioctls.
Change-Id: I946cfcaed4d75f890f30d579f360688b0d4eb3cc
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 0bb6c2c..61d2907 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -13,4 +13,5 @@
lpc.cpp \
blob_handler.cpp \
ipmi_handler.cpp \
- crc.cpp
+ crc.cpp \
+ ../internal/sys.cpp
diff --git a/tools/ipmi_handler.hpp b/tools/ipmi_handler.hpp
index 144fc22..eec0c87 100644
--- a/tools/ipmi_handler.hpp
+++ b/tools/ipmi_handler.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include "internal/sys.hpp"
#include "ipmi_interface.hpp"
namespace host_tool
@@ -8,10 +9,14 @@
class IpmiHandler : public IpmiInterface
{
public:
- IpmiHandler() = default;
+ explicit IpmiHandler(const internal::Sys* sys = &internal::sys_impl) :
+ sys(sys){};
std::vector<std::uint8_t>
sendPacket(const std::vector<std::uint8_t>& data) override;
+
+ private:
+ const internal::Sys* sys;
};
} // namespace host_tool