1 #pragma once 2 3 #include "associations.hpp" 4 #include "types.hpp" 5 6 #include <boost/container/flat_map.hpp> 7 #include <boost/container/flat_set.hpp> 8 9 #include <cassert> 10 #include <string> 11 12 /** @brief Define allow list and deny list data structure */ 13 using AllowDenyList = boost::container::flat_set<std::string>; 14 15 /** @brief The associations definitions interface */ 16 constexpr const char* assocDefsInterface = 17 "xyz.openbmc_project.Association.Definitions"; 18 19 /** @brief The associations definitions property name */ 20 constexpr const char* assocDefsProperty = "Associations"; 21 22 /** @brief InterfacesAdded represents the dbus data from the signal 23 * 24 * There are 2 pairs 25 * pair1: D-bus Interface,vector[pair2] 26 * pair2: D-bus Method,vector[Associations] 27 */ 28 using InterfacesAdded = std::vector<std::pair< 29 std::string, std::vector<std::pair< 30 std::string, std::variant<std::vector<Association>>>>>>; 31 32 /** @brief Get well known name of input unique name 33 * 34 * If user passes in well known name then that will be returned. 35 * 36 * @param[in] owners - Current list of owners 37 * @param[in] request - The name to look up 38 * @param[out] wellKnown - The well known name if found 39 * 40 * @return True if well known name is found, false otherwise 41 */ 42 bool getWellKnown( 43 const boost::container::flat_map<std::string, std::string>& owners, 44 const std::string& request, std::string& wellKnown); 45 46 /** @brief Determine if dbus service is something to monitor 47 * 48 * mapper supports an allowlist concept. If an allowlist is provided as input 49 * then only dbus objects matching that list is monitored. 50 * 51 * @param[in] processName - Dbus service name 52 * @param[in] allowList - The allow list 53 * 54 * @return True if input processName should be monitored, false otherwise 55 */ 56 bool needToIntrospect(const std::string& processName, 57 const AllowDenyList& allowList); 58 59 /** @brief Handle the removal of an existing name in objmgr data structures 60 * 61 * @param[in,out] nameOwners - Map of unique name to well known name 62 * @param[in] wellKnown - Well known name that has new owner 63 * @param[in] oldOwner - Old unique name 64 * @param[in,out] interfaceMap - Map of interfaces 65 * @param[in,out] assocMaps - The association maps 66 * @param[in,out] server - sdbus system object 67 * 68 */ 69 void processNameChangeDelete( 70 boost::container::flat_map<std::string, std::string>& nameOwners, 71 const std::string& wellKnown, const std::string& oldOwner, 72 InterfaceMapType& interfaceMap, AssociationMaps& assocMaps, 73 sdbusplus::asio::object_server& server); 74 75 /** @brief Handle an interfaces added signal 76 * 77 * @param[in,out] interfaceMap - Global map of interfaces 78 * @param[in] objPath - New path to process 79 * @param[in] interfacesAdded - New interfaces to process 80 * @param[in] wellKnown - Well known name that has new owner 81 * @param[in,out] assocMaps - The association maps 82 * @param[in,out] server - sdbus system object 83 * 84 */ 85 void processInterfaceAdded(InterfaceMapType& interfaceMap, 86 const sdbusplus::message::object_path& objPath, 87 const InterfacesAdded& intfAdded, 88 const std::string& wellKnown, 89 AssociationMaps& assocMaps, 90 sdbusplus::asio::object_server& server); 91