blob: fd722f6aa237445c4d55ce755d1733e763a1c8da [file] [log] [blame] [edit]
#pragma once
#include "pdr_utils.hpp"
#include <libpldm/platform.h>
#include <nlohmann/json.hpp>
namespace pldm
{
namespace responder
{
namespace pdr_file
{
/**
* Data structue to hold the complete file path, C style file pointer, 16 bit
* file indetifier and record handle
*/
struct FileInfo
{
std::string filePath = "";
uint32_t fileSize;
FILE* fp = nullptr;
uint16_t fileIdentifier = 0;
uint32_t recordHandle = 0;
};
/**
* @brief Parse PDR JSON file and generate file descriptor PDR structure
*
* @param[in] json - the JSON Object with the file descriptor PDR
* @param[out] fileIdentifierToFileInfo - store FileInfo details based on the
* fileIdentifier
* @param[out] recordHandleToFileInfo - store FileInfo details based on the
* recordHandle
* @param[out] repo - pdr::RepoInterface
*/
void generateFileDescriptorPDR(
const nlohmann::json& json,
std::map<uint16_t, FileInfo>& fileIdentifierToFileInfo,
std::map<uint32_t, FileInfo>& recordHandleToFileInfo,
pdr_utils::RepoInterface& repo);
} // namespace pdr_file
} // namespace responder
} // namespace pldm