blob: 947d397319a7e223408ec3ebba298472cc4fc498 [file] [log] [blame]
Archana Kakanid6b00562024-03-31 17:53:58 -05001#pragma once
2
3#include "file_io_by_type.hpp"
4
5#include <unordered_map>
6
7namespace pldm
8{
9namespace responder
10{
11
12/** @class PCIeInfoHandler
13 *
14 * @brief Inherits and implements FileHandler. This class is used to handle the
15 * pcie topology file and cable information from remote PLDM terminus to the
16 * bmc
17 */
18class PCIeInfoHandler : public FileHandler
19{
20 public:
21 /** @brief PCIeInfoHandler constructor
22 */
23 PCIeInfoHandler(uint32_t fileHandle, uint16_t fileType);
24
25 virtual int writeFromMemory(uint32_t offset, uint32_t length,
26 uint64_t address,
27 oem_platform::Handler* /*oemPlatformHandler*/);
28
29 virtual int write(const char* buffer, uint32_t offset, uint32_t& length,
30 oem_platform::Handler* /*oemPlatformHandler*/);
31
32 virtual int fileAck(uint8_t fileStatus);
33
34 virtual int readIntoMemory(uint32_t /*offset*/, uint32_t& /*length*/,
35 uint64_t /*address*/,
36 oem_platform::Handler* /*oemPlatformHandler*/)
37 {
38 return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
39 }
40
41 virtual int read(uint32_t /*offset*/, uint32_t& /*length*/,
42 Response& /*response*/,
43 oem_platform::Handler* /*oemPlatformHandler*/)
44 {
45 return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
46 }
47
48 virtual int newFileAvailable(uint64_t /*length*/)
49 {
50 return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
51 }
52
53 virtual int fileAckWithMetaData(uint8_t /*fileStatus*/,
54 uint32_t /*metaDataValue1*/,
55 uint32_t /*metaDataValue2*/,
56 uint32_t /*metaDataValue3*/,
57 uint32_t /*metaDataValue4*/)
58 {
59 return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
60 }
61
62 virtual int newFileAvailableWithMetaData(uint64_t /*length*/,
63 uint32_t /*metaDataValue1*/,
64 uint32_t /*metaDataValue2*/,
65 uint32_t /*metaDataValue3*/,
66 uint32_t /*metaDataValue4*/)
67 {
68 return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
69 }
70
71 /** @brief PCIeInfoHandler destructor
72 */
73 ~PCIeInfoHandler() {}
74
75 private:
76 uint16_t infoType; //!< type of the information
77
78 /** @brief A static unordered map storing information about received files.
79 *
80 * This unordered map associates file type with a boolean value indicating
81 * whether the file of that type has been received or not.
82 */
83 static std::unordered_map<uint16_t, bool> receivedFiles;
84};
85
86} // namespace responder
87} // namespace pldm