blob: 73fc2e5edb7ebc64febc2ffe55cec1e19678784a [file] [log] [blame]
Andrew Geisslera80a3af2019-02-04 14:01:49 -06001#pragma once
2
Matt Spinler35396c12019-04-05 11:46:57 -05003#include "types.hpp"
Andrew Geisslera80a3af2019-02-04 14:01:49 -06004
Andrew Geissler4511b332019-02-21 15:40:40 -06005constexpr const char* XYZ_ASSOCIATION_INTERFACE =
6 "xyz.openbmc_project.Association";
7
Andrew Geisslera80a3af2019-02-04 14:01:49 -06008/** @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 */
20void removeAssociation(const std::string& sourcePath, const std::string& owner,
21 sdbusplus::asio::object_server& server,
22 AssociationOwnersType& assocOwners,
23 AssociationInterfaces& assocInterfaces);
Andrew Geisslerff5ce922019-02-21 12:43:09 -060024
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 */
38void removeAssociationEndpoints(
39 sdbusplus::asio::object_server& objectServer, const std::string& assocPath,
40 const boost::container::flat_set<std::string>& endpointsToRemove,
41 AssociationInterfaces& assocInterfaces);
Andrew Geissler7f1c44d2019-02-21 13:44:16 -060042
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 */
63void 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);
Andrew Geissler4511b332019-02-21 15:40:40 -060068
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 */
85void 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);