blob: bd194847aff7d26a6d2a291f90275729e1a1ae3c [file] [log] [blame]
Patrick Ventureaf696252018-12-11 10:22:14 -08001#pragma once
2
Patrick Venture84778b82019-06-26 20:11:09 -07003#include "flags.hpp"
Patrick Venturecf9b2192019-06-27 12:09:52 -07004#include "progress.hpp"
Patrick Venture8a55dcb2018-12-12 21:12:58 -08005
Willy Tu3f596282024-04-12 16:27:17 +00006#include <chrono>
Patrick Ventureaf696252018-12-11 10:22:14 -08007#include <cstdint>
8#include <string>
Willy Tu3f596282024-04-12 16:27:17 +00009#include <thread>
Patrick Ventureaf696252018-12-11 10:22:14 -080010
Patrick Venture9b534f02018-12-13 16:10:02 -080011namespace host_tool
12{
13
Patrick Ventureaf696252018-12-11 10:22:14 -080014class DataInterface
15{
16 public:
17 virtual ~DataInterface() = default;
18
19 /**
20 * Given an open session to either /flash/image, /flash/tarball, or
21 * /flash/hash, this method will configure, and send the data, but not close
22 * the session.
23 *
24 * @param[in] input - path to file to send.
25 * @param[in] session - the session ID to use.
26 * @return bool on success.
27 */
28 virtual bool sendContents(const std::string& input,
29 std::uint16_t session) = 0;
Patrick Venture8a55dcb2018-12-12 21:12:58 -080030
Willy Tu3f596282024-04-12 16:27:17 +000031 virtual void waitForRetry()
32 {
33 std::this_thread::sleep_for(std::chrono::seconds(1));
34 }
35
Patrick Venture8a55dcb2018-12-12 21:12:58 -080036 /**
37 * Return the supported data interface for this.
38 *
39 * @return the enum value corresponding to the supported type.
40 */
Patrick Venture84778b82019-06-26 20:11:09 -070041 virtual ipmi_flash::FirmwareFlags::UpdateFlags supportedType() const = 0;
Patrick Ventureaf696252018-12-11 10:22:14 -080042};
Patrick Venture9b534f02018-12-13 16:10:02 -080043
44} // namespace host_tool