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