1 #pragma once 2 3 #include "file_io_by_type.hpp" 4 5 namespace pldm 6 { 7 namespace 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 */ 15 class DumpHandler : public FileHandler 16 { 17 public: 18 /** @brief DumpHandler constructor 19 */ 20 DumpHandler(uint32_t fileHandle, uint16_t fileType) : 21 FileHandler(fileHandle), dumpType(fileType) 22 {} 23 24 virtual int writeFromMemory(uint32_t offset, uint32_t length, 25 uint64_t address, 26 oem_platform::Handler* /*oemPlatformHandler*/); 27 28 virtual int readIntoMemory(uint32_t offset, uint32_t& length, 29 uint64_t address, 30 oem_platform::Handler* /*oemPlatformHandler*/); 31 32 virtual int read(uint32_t offset, uint32_t& length, Response& response, 33 oem_platform::Handler* /*oemPlatformHandler*/); 34 35 virtual int write(const char* buffer, uint32_t offset, uint32_t& length, 36 oem_platform::Handler* /*oemPlatformHandler*/); 37 38 virtual int newFileAvailable(uint64_t length); 39 40 virtual int fileAck(uint8_t fileStatus); 41 42 std::string findDumpObjPath(uint32_t fileHandle); 43 std::string getOffloadUri(uint32_t fileHandle); 44 45 /** @brief DumpHandler destructor 46 */ 47 ~DumpHandler() 48 {} 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