1 #pragma once 2 3 #include "types.hpp" 4 5 constexpr const char* XYZ_ASSOCIATION_INTERFACE = 6 "xyz.openbmc_project.Association"; 7 8 /** @brief Remove input association 9 * 10 * @param[in] sourcePath - Path of the object that contains the 11 * org.openbmc.Associations 12 * @param[in] owner - The Dbus service having its associations 13 * removed 14 * @param[in,out] server - sdbus system object 15 * @param[in,out] assocOwners - Owners of associations 16 * @param[in,out] assocInterfaces - Associations endpoints 17 * 18 * @return Void, server, assocOwners, and assocInterfaces updated if needed 19 */ 20 void removeAssociation(const std::string& sourcePath, const std::string& owner, 21 sdbusplus::asio::object_server& server, 22 AssociationOwnersType& assocOwners, 23 AssociationInterfaces& assocInterfaces); 24 25 /** @brief Remove input paths from endpoints of an association 26 * 27 * If the last endpoint was removed, then remove the whole 28 * association object, otherwise just set the property 29 * 30 * @param[in] objectServer - sdbus system object 31 * @param[in] assocPath - Path of the object that contains the 32 * org.openbmc.Associations 33 * @param[in] endpointsToRemove - Endpoints to remove 34 * @param[in,out] assocInterfaces - Associations endpoints 35 * 36 * @return Void, objectServer and assocInterfaces updated if needed 37 */ 38 void removeAssociationEndpoints( 39 sdbusplus::asio::object_server& objectServer, const std::string& assocPath, 40 const boost::container::flat_set<std::string>& endpointsToRemove, 41 AssociationInterfaces& assocInterfaces); 42 43 /** @brief Check and remove any changed associations 44 * 45 * Based on the latest values of the org.openbmc.Associations.associations 46 * property, passed in via the newAssociations param, check if any of the 47 * paths in the xyz.openbmc_project.Association.endpoints D-Bus property 48 * for that association need to be removed. If the last path is removed 49 * from the endpoints property, remove that whole association object from 50 * D-Bus. 51 * 52 * @param[in] sourcePath - Path of the object that contains the 53 * org.openbmc.Associations 54 * @param[in] owner - The Dbus service having it's associatons 55 * changed 56 * @param[in] newAssociations - New associations to look at for change 57 * @param[in,out] objectServer - sdbus system object 58 * @param[in,out] assocOwners - Owners of associations 59 * @param[in,out] assocInterfaces - Associations endpoints 60 * 61 * @return Void, objectServer and assocOwners updated if needed 62 */ 63 void checkAssociationEndpointRemoves( 64 const std::string& sourcePath, const std::string& owner, 65 const AssociationPaths& newAssociations, 66 sdbusplus::asio::object_server& objectServer, 67 AssociationOwnersType& assocOwners, AssociationInterfaces& assocInterfaces); 68 69 /** @brief Handle new or changed association interfaces 70 * 71 * Called when either a new org.openbmc.Associations interface was 72 * created, or the associations property on that interface changed 73 * 74 * @param[in,out] objectServer - sdbus system object 75 * @param[in] associations - New associations to look at for change 76 * @param[in] path - Path of the object that contains the 77 * org.openbmc.Associations 78 * @param[in] owner - The Dbus service having it's associatons 79 * changed 80 * @param[in,out] assocOwners - Owners of associations 81 * @param[in,out] assocInterfaces - Associations endpoints 82 * 83 * @return Void, objectServer and assocOwners updated if needed 84 */ 85 void associationChanged(sdbusplus::asio::object_server& objectServer, 86 const std::vector<Association>& associations, 87 const std::string& path, const std::string& owner, 88 AssociationOwnersType& assocOwners, 89 AssociationInterfaces& assocInterfaces); 90