1 #pragma once
2 
3 #include "file_io_by_type.hpp"
4 
5 namespace pldm
6 {
7 namespace responder
8 {
9 
10 /** @class PelHandler
11  *
12  *  @brief Inherits and implements FileHandler. This class is used
13  *  to read/write pels.
14  */
15 class PelHandler : public FileHandler
16 {
17   public:
18     /** @brief PelHandler constructor
19      */
PelHandler(uint32_t fileHandle)20     PelHandler(uint32_t fileHandle) : FileHandler(fileHandle) {}
21 
22     virtual int writeFromMemory(uint32_t offset, uint32_t length,
23                                 uint64_t address,
24                                 oem_platform::Handler* /*oemPlatformHandler*/);
25 
26     virtual int readIntoMemory(uint32_t offset, uint32_t length,
27                                uint64_t address,
28                                oem_platform::Handler* /*oemPlatformHandler*/);
29 
30     virtual int read(uint32_t offset, uint32_t& length, Response& response,
31                      oem_platform::Handler* /*oemPlatformHandler*/);
32 
33     virtual int write(const char* /*buffer*/, uint32_t /*offset*/,
34                       uint32_t& /*length*/,
35                       oem_platform::Handler* /*oemPlatformHandler*/);
36 
37     virtual int fileAck(uint8_t fileStatus);
38 
39     /** @brief method to store a pel file in tempfs and send
40      *  d-bus notification to pel daemon that it is ready for consumption
41      *
42      *  @param[in] pelFileName - the pel file path
43      */
44     virtual int storePel(std::string&& pelFileName);
45 
newFileAvailable(uint64_t)46     virtual int newFileAvailable(uint64_t /*length*/)
47     {
48         return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
49     }
50 
51     /** @brief PelHandler destructor
52      */
~PelHandler()53     ~PelHandler() {}
54 };
55 
56 } // namespace responder
57 } // namespace pldm
58