xref: /openbmc/pldm/host-bmc/utils.hpp (revision 41ca40dc)
1 #include "common/utils.hpp"
2 #include "libpldmresponder/oem_handler.hpp"
3 
4 #include <libpldm/pdr.h>
5 
6 #include <nlohmann/json.hpp>
7 #include <phosphor-logging/lg2.hpp>
8 
9 #include <filesystem>
10 #include <fstream>
11 #include <map>
12 #include <string>
13 #include <vector>
14 
15 PHOSPHOR_LOG2_USING;
16 
17 namespace pldm
18 {
19 namespace hostbmc
20 {
21 namespace utils
22 {
23 
24 /** @brief Vector a entity name to pldm_entity from entity association tree
25  *  @param[in]  entityAssoc    - Vector of associated pldm entities
26  *  @param[in]  entityTree     - entity association tree
27  *  @param[out] objPathMap     - maps an object path to pldm_entity from the
28  *                               BMC's entity association tree
29  *  @return
30  */
31 void updateEntityAssociation(
32     const pldm::utils::EntityAssociations& entityAssoc,
33     pldm_entity_association_tree* entityTree,
34     pldm::utils::ObjectPathMaps& objPathMap, pldm::utils::EntityMaps entityMaps,
35     pldm::responder::oem_platform::Handler* oemPlatformHandler);
36 
37 /** @brief Parsing entity to DBus string mapping from json file
38  *
39  *  @param[in]  filePath - JSON file path for parsing
40  *
41  *  @return returns the entity to DBus string mapping object
42  */
43 pldm::utils::EntityMaps parseEntityMap(const fs::path& filePath);
44 
45 } // namespace utils
46 } // namespace hostbmc
47 } // namespace pldm
48