utils: Add the getSubTree method

The purpose of this patch is to prevent other methods from calling
ObjectMapper's `GetSubTree` property, but to obtain the correct the
objectTree values by calling the standard the getSubTree method.

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: Ia719f92ca31fa75f83a7ffd07fdcb680bd4243b0
diff --git a/include/ipmid/utils.hpp b/include/ipmid/utils.hpp
index 1e2005f..e47c85d 100644
--- a/include/ipmid/utils.hpp
+++ b/include/ipmid/utils.hpp
@@ -102,6 +102,16 @@
 std::string getService(sdbusplus::bus_t& bus, const std::string& intf,
                        const std::string& path);
 
+/** @brief Gets the dbus sub tree implementing the given interface.
+ *  @param[in] bus - DBUS Bus Object.
+ *  @param[in] interfaces - Dbus interface.
+ *  @param[in] subtreePath - subtree from where the search should start.
+ *  @param[in] depth - Search depth
+ *  @return map of object path and service info.
+ */
+ObjectTree getSubTree(sdbusplus::bus_t& bus, const InterfaceList& interface,
+                      const std::string& subtreePath = ROOT, int32_t depth = 0);
+
 /** @brief Gets the dbus object info implementing the given interface
  *         from the given subtree.
  *  @param[in] bus - DBUS Bus Object.
@@ -216,6 +226,20 @@
                                      const std::string& path,
                                      std::string& service);
 
+/** @brief Gets the dbus sub tree implementing the given interface.
+ *  @param[in] ctx - ipmi::Context::ptr
+ *  @param[in] bus - DBUS Bus Object.
+ *  @param[in] interfaces - Dbus interface.
+ *  @param[in] subtreePath - subtree from where the search should start.
+ *  @param[in] depth - Search depth
+ *  @param[out] objectTree - map of object path and service info.
+ *  @return map of object path and service info.
+ */
+boost::system::error_code getSubTree(Context::ptr ctx,
+                                     const InterfaceList& interface,
+                                     const std::string& subtreePath,
+                                     int32_t depth, ObjectTree& objectTree);
+
 /** @brief Gets the D-Bus object info implementing the given interface
  *         from the given subtree.
  *  @param[in] ctx - ipmi::Context::ptr