Add getSubtree utility functions
- Added getSubtree utility function that can returns
the service name & dbus object paths that implement a
particular dbus interface.
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
Change-Id: If1faeba285ce4de26d7343ca400f5820736bb3e0
diff --git a/common/utils.hpp b/common/utils.hpp
index 72170fb..c7c63ef 100644
--- a/common/utils.hpp
+++ b/common/utils.hpp
@@ -145,6 +145,11 @@
std::pair<pldm::dbus::Interface,
std::vector<std::pair<pldm::dbus::Property,
std::variant<pldm::dbus::Property>>>>>;
+using ObjectPath = std::string;
+using ServiceName = std::string;
+using Interfaces = std::vector<std::string>;
+using MapperServiceMap = std::vector<std::pair<ServiceName, Interfaces>>;
+using GetSubTreeResponse = std::vector<std::pair<ObjectPath, MapperServiceMap>>;
/**
* @brief The interface for DBusHandler
@@ -156,6 +161,9 @@
virtual std::string getService(const char* path,
const char* interface) const = 0;
+ virtual GetSubTreeResponse
+ getSubtree(const std::string& path, int depth,
+ const std::vector<std::string>& ifaceList) const = 0;
virtual void setDbusProperty(const DBusMapping& dBusMap,
const PropertyValue& value) const = 0;
@@ -197,6 +205,22 @@
std::string getService(const char* path,
const char* interface) const override;
+ /**
+ * @brief Get the Subtree response from the mapper
+ *
+ * @param[in] path - DBUS object path
+ * @param[in] depth - Search depth
+ * @param[in] ifaceList - list of the interface that are being
+ * queried from the mapper
+ *
+ * @return GetSubTreeResponse - the mapper subtree response
+ *
+ * @throw sdbusplus::exception::exception when it fails
+ */
+ GetSubTreeResponse
+ getSubtree(const std::string& path, int depth,
+ const std::vector<std::string>& ifaceList) const override;
+
/** @brief Get property(type: variant) from the requested dbus
*
* @param[in] objPath - The Dbus object path