tools: add network bridge support
Add support to the host tool for sending the image data over a network
connection.
Signed-off-by: Benjamin Fair <benjaminfair@google.com>
Change-Id: I88630d79499254d6c80ceaa8c7721c241d394fc8
diff --git a/tools/net.hpp b/tools/net.hpp
new file mode 100644
index 0000000..ba329df
--- /dev/null
+++ b/tools/net.hpp
@@ -0,0 +1,40 @@
+#pragma once
+
+#include "interface.hpp"
+#include "internal/sys.hpp"
+#include "progress.hpp"
+
+#include <unistd.h>
+
+#include <cstdint>
+#include <ipmiblob/blob_interface.hpp>
+#include <stdplus/handle/managed.hpp>
+#include <string>
+
+namespace host_tool
+{
+
+class NetDataHandler : public DataInterface
+{
+ public:
+ NetDataHandler(ipmiblob::BlobInterface* blob, ProgressInterface* progress,
+ const std::string& host, const std::string& port,
+ const internal::Sys* sys = &internal::sys_impl) :
+ blob(blob),
+ progress(progress), host(host), port(port), sys(sys){};
+
+ bool sendContents(const std::string& input, std::uint16_t session) override;
+ ipmi_flash::FirmwareFlags::UpdateFlags supportedType() const override
+ {
+ return ipmi_flash::FirmwareFlags::UpdateFlags::net;
+ }
+
+ private:
+ ipmiblob::BlobInterface* blob;
+ ProgressInterface* progress;
+ std::string host;
+ std::string port;
+ const internal::Sys* sys;
+};
+
+} // namespace host_tool