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 */ DumpHandler(uint32_t fileHandle,uint16_t fileType)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 fileAckWithMetaData(uint8_t,uint32_t,uint32_t,uint32_t,uint32_t)43 virtual int fileAckWithMetaData( 44 uint8_t /*fileStatus*/, uint32_t /*metaDataValue1*/, 45 uint32_t /*metaDataValue2*/, uint32_t /*metaDataValue3*/, 46 uint32_t /*metaDataValue4*/) 47 { 48 return PLDM_ERROR_UNSUPPORTED_PLDM_CMD; 49 } 50 51 virtual int newFileAvailableWithMetaData( 52 uint64_t length, uint32_t metaDataValue1, uint32_t /*metaDataValue2*/, 53 uint32_t /*metaDataValue3*/, uint32_t /*metaDataValue4*/); 54 55 std::string findDumpObjPath(uint32_t fileHandle); 56 std::string getOffloadUri(uint32_t fileHandle); 57 58 /** @brief DumpHandler destructor 59 */ ~DumpHandler()60 ~DumpHandler() {} 61 62 private: 63 static int fd; //!< fd to manage the dump offload to bmc 64 uint16_t dumpType; //!< type of the dump 65 }; 66 67 } // namespace responder 68 } // namespace pldm 69