13b025e69SAndrew Geissler #pragma once 23b025e69SAndrew Geissler 3*2067926aSAndrew Geissler #include "associations.hpp" 4*2067926aSAndrew Geissler 53b025e69SAndrew Geissler #include <boost/container/flat_map.hpp> 682815dacSAndrew Geissler #include <boost/container/flat_set.hpp> 73b025e69SAndrew Geissler #include <string> 83b025e69SAndrew Geissler 982815dacSAndrew Geissler /** @brief Define white list and black list data structure */ 1082815dacSAndrew Geissler using WhiteBlackList = boost::container::flat_set<std::string>; 1182815dacSAndrew Geissler 12*2067926aSAndrew Geissler /** @brief Dbus interface which contains org.openbmc Associations */ 13*2067926aSAndrew Geissler constexpr const char* ASSOCIATIONS_INTERFACE = "org.openbmc.Associations"; 14*2067926aSAndrew Geissler 15*2067926aSAndrew Geissler /** @brief interface_map_type is the underlying datastructure the mapper uses. 16*2067926aSAndrew Geissler * 17*2067926aSAndrew Geissler * The 3 levels of map are 18*2067926aSAndrew Geissler * object paths 19*2067926aSAndrew Geissler * connection names 20*2067926aSAndrew Geissler * interface names 21*2067926aSAndrew Geissler */ 22*2067926aSAndrew Geissler using interface_map_type = boost::container::flat_map< 23*2067926aSAndrew Geissler std::string, boost::container::flat_map< 24*2067926aSAndrew Geissler std::string, boost::container::flat_set<std::string>>>; 25*2067926aSAndrew Geissler 263b025e69SAndrew Geissler /** @brief Get well known name of input unique name 273b025e69SAndrew Geissler * 283b025e69SAndrew Geissler * If user passes in well known name then that will be returned. 293b025e69SAndrew Geissler * 303b025e69SAndrew Geissler * @param[in] owners - Current list of owners 313b025e69SAndrew Geissler * @param[in] request - The name to look up 323b025e69SAndrew Geissler * @param[out] wellKnown - The well known name if found 333b025e69SAndrew Geissler * 343b025e69SAndrew Geissler * @return True if well known name is found, false otherwise 353b025e69SAndrew Geissler */ 363b025e69SAndrew Geissler bool getWellKnown( 373b025e69SAndrew Geissler const boost::container::flat_map<std::string, std::string>& owners, 3882815dacSAndrew Geissler const std::string& request, std::string& well_known); 3982815dacSAndrew Geissler 4082815dacSAndrew Geissler /** @brief Determine if dbus service is something to monitor 4182815dacSAndrew Geissler * 4282815dacSAndrew Geissler * mapper supports a whitelist and blacklist concept. If a whitelist is provided 4382815dacSAndrew Geissler * as input then only dbus objects matching that list is monitored. If a 4482815dacSAndrew Geissler * blacklist is provided then objects matching it will not be monitored. 4582815dacSAndrew Geissler * 4682815dacSAndrew Geissler * @param[in] processName - Dbus service name 4782815dacSAndrew Geissler * @param[in] whiteList - The white list 4882815dacSAndrew Geissler * @param[in] blackList - The black list 4982815dacSAndrew Geissler * 5082815dacSAndrew Geissler * @return True if input process_name should be monitored, false otherwise 5182815dacSAndrew Geissler */ 5282815dacSAndrew Geissler bool needToIntrospect(const std::string& processName, 5382815dacSAndrew Geissler const WhiteBlackList& whiteList, 5482815dacSAndrew Geissler const WhiteBlackList& blackList); 55*2067926aSAndrew Geissler 56*2067926aSAndrew Geissler /** @brief Handle the removal of an existing name in objmgr data structures 57*2067926aSAndrew Geissler * 58*2067926aSAndrew Geissler * @param[in,out] nameOwners - Map of unique name to well known name 59*2067926aSAndrew Geissler * @param[in] wellKnown - Well known name that has new owner 60*2067926aSAndrew Geissler * @param[in] oldOwner - Old unique name 61*2067926aSAndrew Geissler * @param[in,out] interfaceMap - Map of interfaces 62*2067926aSAndrew Geissler * @param[in,out] assocOwners - Owners of associations 63*2067926aSAndrew Geissler * @param[in,out] assocInterfaces - Associations endpoints 64*2067926aSAndrew Geissler * @param[in,out] server - sdbus system object 65*2067926aSAndrew Geissler * 66*2067926aSAndrew Geissler */ 67*2067926aSAndrew Geissler void processNameChangeDelete( 68*2067926aSAndrew Geissler boost::container::flat_map<std::string, std::string>& nameOwners, 69*2067926aSAndrew Geissler const std::string& wellKnown, const std::string& oldOwner, 70*2067926aSAndrew Geissler interface_map_type& interfaceMap, AssociationOwnersType& assocOwners, 71*2067926aSAndrew Geissler AssociationInterfaces& assocInterfaces, 72*2067926aSAndrew Geissler sdbusplus::asio::object_server& server); 73