Check for pending associations

When the mapper is adding a new D-Bus path to its path map,
either via an introspect or in the interfacesAdded handler,
check if that new path has an outstanding pending association.

If it does, then create the 2 real association paths and
remove that entry from the pending associations maps.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I2da8109b5cba8596eb0c14a6af0d377472ca4145
diff --git a/src/associations.hpp b/src/associations.hpp
index 3f4b81e..60342b2 100644
--- a/src/associations.hpp
+++ b/src/associations.hpp
@@ -120,3 +120,35 @@
  */
 void removeFromPendingAssociations(const std::string& endpointPath,
                                    AssociationMaps& assocMaps);
+
+/** @brief Adds a single association D-Bus object (<path>/<type>)
+ *
+ * @param[in,out] server    - sdbus system object
+ * @param[in] assocPath     - The association D-Bus path
+ * @param[in] endpoint      - The association's D-Bus endpoint path
+ * @param[in] owner         - The owning D-Bus well known name
+ * @param[in] ownerPath     - The D-Bus path hosting the Associations property
+ * @param[in,out] assocMaps - The association maps
+ */
+void addSingleAssociation(sdbusplus::asio::object_server& server,
+                          const std::string& assocPath,
+                          const std::string& endpoint, const std::string& owner,
+                          const std::string& ownerPath,
+                          AssociationMaps& assocMaps);
+
+/** @brief Create a real association out of a pending association
+ *         if there is one for this path.
+ *
+ * If objectPath is now on D-Bus, and it is also in the pending associations
+ * map, create the 2 real association objects and remove its pending
+ * associations entry.  Used when a new path shows up in D-Bus.
+ *
+ * @param[in] objectPath    - the path to check
+ * @param[in] interfaceMap  - The master interface map
+ * @param[in,out] assocMaps - The association maps
+ * @param[in,out] server    - sdbus system object
+ */
+void checkIfPendingAssociation(const std::string& objectPath,
+                               const interface_map_type& interfaceMap,
+                               AssociationMaps& assocMaps,
+                               sdbusplus::asio::object_server& server);