1 #pragma once 2 3 #include <boost/container/flat_map.hpp> 4 #include <boost/container/flat_set.hpp> 5 #include <memory> 6 #include <sdbusplus/asio/object_server.hpp> 7 #include <string> 8 #include <vector> 9 10 // Associations and some metadata are stored in associationInterfaces. 11 // The fields are: 12 // * ifacePos - holds the D-Bus interface object 13 // * endpointsPos - holds the endpoints array that shadows the property 14 static constexpr auto ifacePos = 0; 15 static constexpr auto endpointsPos = 1; 16 using Endpoints = std::vector<std::string>; 17 18 using AssociationInterfaces = boost::container::flat_map< 19 std::string, 20 std::tuple<std::shared_ptr<sdbusplus::asio::dbus_interface>, Endpoints>>; 21 22 // The associationOwners map contains information about creators of 23 // associations, so that when a org.openbmc.Association interface is 24 // removed or its 'associations' property is changed, the mapper owned 25 // association objects can be correctly handled. It is a map of the 26 // object path of the org.openbmc.Association owner to a map of the 27 // service the path is owned by, to a map of the association objects to 28 // their endpoint paths: 29 // map[ownerPath : map[service : map[assocPath : [endpoint paths]]] 30 // For example: 31 // [/logging/entry/1 : 32 // [xyz.openbmc_project.Logging : 33 // [/logging/entry/1/callout : [/system/cpu0], 34 // /system/cpu0/fault : [/logging/entry/1]]]] 35 36 using AssociationPaths = 37 boost::container::flat_map<std::string, 38 boost::container::flat_set<std::string>>; 39 40 using AssociationOwnersType = boost::container::flat_map< 41 std::string, boost::container::flat_map<std::string, AssociationPaths>>; 42 43 /** @brief Remove input association 44 * 45 * @param[in] sourcePath - Path of the object that contains the 46 * org.openbmc.Associations 47 * @param[in] owner - The Dbus service having its associations 48 * removed 49 * @param[in,out] server - sdbus system object 50 * @param[in,out] assocOwners - Owners of associations 51 * @param[in,out] assocInterfaces - Associations endpoints 52 * 53 * @return Void, server, assocOwners, and assocInterfaces updated if needed 54 */ 55 void removeAssociation(const std::string& sourcePath, const std::string& owner, 56 sdbusplus::asio::object_server& server, 57 AssociationOwnersType& assocOwners, 58 AssociationInterfaces& assocInterfaces); 59