blob: e20d0d76627e3fc2a544ff44a1827bf277ddb29d [file] [log] [blame]
Sampa Misra18967162020-01-14 02:31:41 -06001#pragma once
2
3#include "file_io_by_type.hpp"
4
5namespace pldm
6{
7namespace responder
8{
9
10/** @class DumpHandler
11 *
12 * @brief Inherits and implements FileHandler. This class is used
13 * handle the dump offload/streaming from host to the destination via bmc
14 */
15class DumpHandler : public FileHandler
16{
17 public:
18 /** @brief DumpHandler constructor
19 */
20 DumpHandler(uint32_t fileHandle) : FileHandler(fileHandle)
21 {
22 }
23
24 virtual int writeFromMemory(uint32_t offset, uint32_t length,
25 uint64_t address);
26
27 virtual int readIntoMemory(uint32_t /*offset*/, uint32_t& /*length*/,
28 uint64_t /*address*/)
29 {
30 return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
31 }
32 virtual int read(uint32_t /*offset*/, uint32_t& /*length*/,
33 Response& /*response*/)
34 {
35 return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
36 }
37
38 virtual int write(const char* buffer, uint32_t offset, uint32_t& length);
39
40 virtual int newFileAvailable(uint64_t length);
41
42 virtual int fileAck(uint8_t /*fileStatus*/)
43 {
44 return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
45 }
46
47 /** @brief DumpHandler destructor
48 */
49 ~DumpHandler()
50 {
51 }
52
53 private:
54 static int fd; //!< fd to manage the dump offload to bmc
55};
56
57} // namespace responder
58} // namespace pldm