Consitently use dbus::utility types

This saves about 4k on the binary size

Tested: Redfish service validator passes.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I9546227a19c691b1aecb80e80307889548c0293f
diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp
index 481b33d..0c80197 100644
--- a/include/dbus_utility.hpp
+++ b/include/dbus_utility.hpp
@@ -73,6 +73,15 @@
 using MapperGetSubTreeResponse =
     std::vector<std::pair<std::string, MapperServiceMap>>;
 
+using MapperGetObject =
+    std::vector<std::pair<std::string, std::vector<std::string>>>;
+
+using MapperGetAncestorsResponse = std::vector<
+    std::pair<std::string,
+              std::vector<std::pair<std::string, std::vector<std::string>>>>>;
+
+using MapperGetSubTreePathsResponse = std::vector<std::string>;
+
 inline void escapePathForDbus(std::string& path)
 {
     const std::regex reg("[^A-Za-z0-9_/]");
@@ -109,13 +118,10 @@
 template <typename Callback>
 inline void checkDbusPathExists(const std::string& path, Callback&& callback)
 {
-    using GetObjectType =
-        std::vector<std::pair<std::string, std::vector<std::string>>>;
-
     crow::connections::systemBus->async_method_call(
         [callback{std::forward<Callback>(callback)}](
             const boost::system::error_code ec,
-            const GetObjectType& objectNames) {
+            const dbus::utility::MapperGetObject& objectNames) {
             callback(!ec && !objectNames.empty());
         },
         "xyz.openbmc_project.ObjectMapper",
diff --git a/include/hostname_monitor.hpp b/include/hostname_monitor.hpp
index 73c315f..f4e6b27 100644
--- a/include/hostname_monitor.hpp
+++ b/include/hostname_monitor.hpp
@@ -1,7 +1,7 @@
 #pragma once
 #ifdef BMCWEB_ENABLE_SSL
-#include <boost/container/flat_map.hpp>
 #include <dbus_singleton.hpp>
+#include <dbus_utility.hpp>
 #include <include/dbus_utility.hpp>
 #include <sdbusplus/bus/match.hpp>
 #include <sdbusplus/message/types.hpp>
@@ -43,20 +43,19 @@
 
     sdbusplus::message::message message(m);
     std::string iface;
-    boost::container::flat_map<std::string, dbus::utility::DbusVariantType>
-        changedProperties;
+    dbus::utility::DBusPropertiesMap changedProperties;
 
     message.read(iface, changedProperties);
-    auto it = changedProperties.find("HostName");
-    if (it == changedProperties.end())
+    const std::string* hostname = nullptr;
+    for (const auto& propertyPair : changedProperties)
     {
-        return 0;
+        if (propertyPair.first == "HostName")
+        {
+            hostname = std::get_if<std::string>(&propertyPair.second);
+        }
     }
-
-    std::string* hostname = std::get_if<std::string>(&it->second);
     if (hostname == nullptr)
     {
-        BMCWEB_LOG_ERROR << "Unable to read hostname";
         return 0;
     }
 
diff --git a/include/image_upload.hpp b/include/image_upload.hpp
index 1b0a09a..330ea9c 100644
--- a/include/image_upload.hpp
+++ b/include/image_upload.hpp
@@ -64,10 +64,7 @@
             BMCWEB_LOG_DEBUG << "Match fired";
 
             sdbusplus::message::object_path path;
-            std::vector<std::pair<
-                std::string, std::vector<std::pair<
-                                 std::string, dbus::utility::DbusVariantType>>>>
-                interfaces;
+            dbus::utility::DBusInteracesMap interfaces;
             m.read(path, interfaces);
 
             if (std::find_if(interfaces.begin(), interfaces.end(),
diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp
index afb6493..e0a0111 100644
--- a/include/nbd_proxy.hpp
+++ b/include/nbd_proxy.hpp
@@ -261,10 +261,8 @@
 
             auto getUserInfoHandler = [&conn, asyncResp](
                                           const boost::system::error_code ec,
-                                          boost::container::flat_map<
-                                              std::string,
-                                              dbus::utility::DbusVariantType>
-                                              userInfo) {
+                                          const dbus::utilities::
+                                              DBusPropertiesMap& userInfo) {
                 if (ec)
                 {
                     BMCWEB_LOG_ERROR << "GetUserInfo failed...";
diff --git a/include/obmc_console.hpp b/include/obmc_console.hpp
index 478649a..01ee479 100644
--- a/include/obmc_console.hpp
+++ b/include/obmc_console.hpp
@@ -4,7 +4,6 @@
 #include <app.hpp>
 #include <async_resp.hpp>
 #include <boost/asio/local/stream_protocol.hpp>
-#include <boost/container/flat_map.hpp>
 #include <boost/container/flat_set.hpp>
 #include <websocket.hpp>
 
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index af6a720..042f193 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -32,11 +32,6 @@
 {
 namespace openbmc_mapper
 {
-
-using GetSubTreeType = std::vector<
-    std::pair<std::string,
-              std::vector<std::pair<std::string, std::vector<std::string>>>>>;
-
 const constexpr char* notFoundMsg = "404 Not Found";
 const constexpr char* badReqMsg = "400 Bad Request";
 const constexpr char* methodNotAllowedMsg = "405 Method Not Allowed";
@@ -139,10 +134,9 @@
                      << service << " " << interface;
 
     crow::connections::systemBus->async_method_call(
-        [asyncResp, objectPath, service, interface](
-            const boost::system::error_code ec,
-            const std::vector<std::pair<
-                std::string, dbus::utility::DbusVariantType>>& propertiesList) {
+        [asyncResp, objectPath, service,
+         interface](const boost::system::error_code ec,
+                    const dbus::utility::DBusPropertiesMap& propertiesList) {
             if (ec)
             {
                 BMCWEB_LOG_ERROR << "GetAll on path " << objectPath << " iface "
@@ -186,7 +180,7 @@
 // called after all ObjectManagers are searched for and called.
 inline void findRemainingObjectsForEnumerate(
     const std::string& objectPath,
-    const std::shared_ptr<GetSubTreeType>& subtree,
+    const std::shared_ptr<dbus::utility::MapperGetSubTreeResponse>& subtree,
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
     BMCWEB_LOG_DEBUG << "findRemainingObjectsForEnumerate";
@@ -244,7 +238,7 @@
     InProgressEnumerateData& operator=(InProgressEnumerateData&&) = delete;
 
     const std::string objectPath;
-    std::shared_ptr<GetSubTreeType> subtree;
+    std::shared_ptr<dbus::utility::MapperGetSubTreeResponse> subtree;
     std::shared_ptr<bmcweb::AsyncResp> asyncResp;
 };
 
@@ -331,10 +325,7 @@
     crow::connections::systemBus->async_method_call(
         [transaction, objectName, connectionName](
             const boost::system::error_code ec,
-            const boost::container::flat_map<
-                std::string, boost::container::flat_map<
-                                 std::string, std::vector<std::string>>>&
-                objects) {
+            const dbus::utility::MapperGetAncestorsResponse& objects) {
             if (ec)
             {
                 BMCWEB_LOG_ERROR << "GetAncestors on path " << objectName
@@ -369,12 +360,9 @@
 inline void getObjectAndEnumerate(
     const std::shared_ptr<InProgressEnumerateData>& transaction)
 {
-    using GetObjectType =
-        std::vector<std::pair<std::string, std::vector<std::string>>>;
-
     crow::connections::systemBus->async_method_call(
         [transaction](const boost::system::error_code ec,
-                      const GetObjectType& objects) {
+                      const dbus::utility::MapperGetObject& objects) {
             if (ec)
             {
                 BMCWEB_LOG_ERROR << "GetObject for path "
@@ -1627,8 +1615,9 @@
                        const std::string& objectPath, int32_t depth = 0)
 {
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec,
-                    const std::vector<std::string>& objectPaths) {
+        [asyncResp](
+            const boost::system::error_code ec,
+            const dbus::utility::MapperGetSubTreePathsResponse& objectPaths) {
             if (ec)
             {
                 setErrorResponse(asyncResp->res,
@@ -1658,13 +1647,15 @@
                                 {"data", nlohmann::json::object()}};
 
     crow::connections::systemBus->async_method_call(
-        [objectPath, asyncResp](const boost::system::error_code ec,
-                                const GetSubTreeType& objectNames) {
+        [objectPath, asyncResp](
+            const boost::system::error_code ec,
+            const dbus::utility::MapperGetSubTreeResponse& objectNames) {
             auto transaction = std::make_shared<InProgressEnumerateData>(
                 objectPath, asyncResp);
 
             transaction->subtree =
-                std::make_shared<GetSubTreeType>(objectNames);
+                std::make_shared<dbus::utility::MapperGetSubTreeResponse>(
+                    objectNames);
 
             if (ec)
             {
@@ -1696,11 +1687,10 @@
     std::shared_ptr<std::string> path =
         std::make_shared<std::string>(std::move(objectPath));
 
-    using GetObjectType =
-        std::vector<std::pair<std::string, std::vector<std::string>>>;
     crow::connections::systemBus->async_method_call(
-        [asyncResp, path, propertyName](const boost::system::error_code ec,
-                                        const GetObjectType& objectNames) {
+        [asyncResp, path,
+         propertyName](const boost::system::error_code ec,
+                       const dbus::utility::MapperGetObject& objectNames) {
             if (ec || objectNames.empty())
             {
                 setErrorResponse(asyncResp->res,
@@ -1869,12 +1859,9 @@
     transaction->propertyName = destProperty;
     transaction->propertyValue = propertySetValue;
 
-    using GetObjectType =
-        std::vector<std::pair<std::string, std::vector<std::string>>>;
-
     crow::connections::systemBus->async_method_call(
         [transaction](const boost::system::error_code ec2,
-                      const GetObjectType& objectNames) {
+                      const dbus::utility::MapperGetObject& objectNames) {
             if (!ec2 && objectNames.empty())
             {
                 setErrorResponse(transaction->asyncResp->res,
diff --git a/include/persistent_data.hpp b/include/persistent_data.hpp
index 02f2cce..6d0f7c1 100644
--- a/include/persistent_data.hpp
+++ b/include/persistent_data.hpp
@@ -2,7 +2,6 @@
 
 #include <app.hpp>
 #include <boost/beast/http/fields.hpp>
-#include <boost/container/flat_map.hpp>
 #include <boost/uuid/uuid.hpp>
 #include <boost/uuid/uuid_generators.hpp>
 #include <boost/uuid/uuid_io.hpp>
diff --git a/include/sessions.hpp b/include/sessions.hpp
index 85c0cb9..748bb08 100644
--- a/include/sessions.hpp
+++ b/include/sessions.hpp
@@ -6,7 +6,6 @@
 
 #include <openssl/rand.h>
 
-#include <boost/container/flat_map.hpp>
 #include <boost/uuid/uuid.hpp>
 #include <boost/uuid/uuid_generators.hpp>
 #include <boost/uuid/uuid_io.hpp>