Util: Add common dbus code to util namespace

Add dbus code that can be used by analyzer, isolator, attention to util.

Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
Change-Id: I6205ea227b72c7bafa230446c3c2120b87abc207
diff --git a/util/dbus.hpp b/util/dbus.hpp
new file mode 100644
index 0000000..03fb5be
--- /dev/null
+++ b/util/dbus.hpp
@@ -0,0 +1,69 @@
+#pragma once
+
+#include <sdbusplus/bus.hpp>
+
+#include <string>
+#include <variant>
+#include <vector>
+
+namespace util
+{
+
+namespace dbus
+{
+
+using DBusValue         = std::variant<std::string, bool, std::vector<uint8_t>,
+                               std::vector<std::string>>;
+using DBusProperty      = std::string;
+using DBusInterface     = std::string;
+using DBusService       = std::string;
+using DBusPath          = std::string;
+using DBusInterfaceList = std::vector<DBusInterface>;
+using DBusSubTree =
+    std::map<DBusPath, std::map<DBusService, DBusInterfaceList>>;
+
+/**
+ * Find the dbus object path and service that implements the given interface
+ *
+ * @param[in]   i_interface Interface to search for
+ * @param[out]  o_path      Path of dbus object implementing the interface
+ * @param[out]  o_service   Service implementing the dbus object path
+ * @return      non-zero on error
+ */
+int find(const std::string& i_interface, std::string& o_path,
+         std::string& o_service);
+
+/**
+ * Find the dbus service that implements the given dbus object and interface
+ *
+ * @param[in]   i_interface Interface that maps to the service
+ * @param[in]   i_path      Path that maps to the service
+ * @param[out]  o_service   Service implementing the dbus object and interface
+ * @return      non-zer on error
+ */
+int findService(const std::string& i_interface, const std::string& i_path,
+                std::string& o_service);
+
+/**
+ * Read a property from a dbus object interface
+ *
+ * @param[in]   i_interface Interface implementing the property
+ * @param[in]   i_path      Path of the dbus object
+ * @param[in]   i_service   Service implementing the dbus object and interface
+ * @param[in]   i_property  Property to read
+ * @return      non-zero on error
+ */
+int getProperty(const std::string& i_interface, const std::string& i_path,
+                const std::string& i_service, const std::string& i_property,
+                DBusValue& o_response);
+
+/**
+ * Get the IBM compatible names defined for this system
+ *
+ * @return     A vector of strings containing the system names
+ */
+std::vector<std::string> systemNames();
+
+} // namespace dbus
+
+} // namespace util