xref: /openbmc/phosphor-ipmi-flash/tools/net.hpp (revision 2950c258)
1 #pragma once
2 
3 #include "interface.hpp"
4 #include "internal/sys.hpp"
5 #include "progress.hpp"
6 
7 #include <unistd.h>
8 
9 #include <ipmiblob/blob_interface.hpp>
10 #include <stdplus/handle/managed.hpp>
11 
12 #include <cstdint>
13 #include <string>
14 
15 namespace host_tool
16 {
17 
18 class NetDataHandler : public DataInterface
19 {
20   public:
21     NetDataHandler(ipmiblob::BlobInterface* blob, ProgressInterface* progress,
22                    const std::string& host, const std::string& port,
23                    const internal::Sys* sys = &internal::sys_impl) :
24         blob(blob),
25         progress(progress), host(host), port(port), sys(sys){};
26 
27     bool sendContents(const std::string& input, std::uint16_t session) override;
28     ipmi_flash::FirmwareFlags::UpdateFlags supportedType() const override
29     {
30         return ipmi_flash::FirmwareFlags::UpdateFlags::net;
31     }
32 
33   private:
34     ipmiblob::BlobInterface* blob;
35     ProgressInterface* progress;
36     std::string host;
37     std::string port;
38     const internal::Sys* sys;
39 };
40 
41 } // namespace host_tool
42