Convert variant usage to std interface

This is just a refactoring to use the c++17 std::variant interfaces
instead of the mapbox::variant specific ones. We should be able to use
mapbox::variant and std::variant interchangeably now.

Tested:
    Built against sdbusplus with mapbox::variant and sbusplus using
    std::variant. Both variant compile and test out.

Change-Id: I6fbaad3d12dd34968db6a10f3d74a65e07d0f0cc
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/transporthandler.cpp b/transporthandler.cpp
index 9c42887..39b1c9f 100644
--- a/transporthandler.cpp
+++ b/transporthandler.cpp
@@ -12,6 +12,7 @@
 #include <fstream>
 #include <phosphor-logging/elog-errors.hpp>
 #include <phosphor-logging/log.hpp>
+#include <sdbusplus/message/types.hpp>
 #include <sdbusplus/timer.hpp>
 #include <string>
 #include <xyz/openbmc_project/Common/error.hpp>
@@ -47,6 +48,7 @@
 using namespace sdbusplus::xyz::openbmc_project::Common::Error;
 
 namespace fs = std::filesystem;
+namespace variant_ns = sdbusplus::message::variant_ns;
 
 void register_netfn_transport_functions() __attribute__((constructor));
 
@@ -97,7 +99,8 @@
                             bus, ipObjectInfo.second, ipObjectInfo.first,
                             ipmi::network::IP_INTERFACE);
 
-                        ipaddress = properties["Address"].get<std::string>();
+                        ipaddress =
+                            variant_ns::get<std::string>(properties["Address"]);
                     }
                     // ignore the exception, as it is a valid condition that
                     // the system is not configured with any IP.
@@ -171,7 +174,7 @@
                         bus, ipmi::network::SERVICE, networkInterfacePath,
                         ipmi::network::ETHERNET_INTERFACE, "DHCPEnabled");
 
-                    auto dhcpEnabled = variant.get<bool>();
+                    auto dhcpEnabled = variant_ns::get<bool>(variant);
                     // As per IPMI spec 2=>DHCP, 1=STATIC
                     auto ipsrc = dhcpEnabled ? ipmi::network::IPOrigin::DHCP
                                              : ipmi::network::IPOrigin::STATIC;
@@ -201,7 +204,8 @@
                             bus, ipObjectInfo.second, ipObjectInfo.first,
                             ipmi::network::IP_INTERFACE);
 
-                        auto prefix = properties["PrefixLength"].get<uint8_t>();
+                        auto prefix = variant_ns::get<uint8_t>(
+                            properties["PrefixLength"]);
                         mask = ipmi::network::MASK_32_BIT;
                         mask = htonl(mask << (ipmi::network::BITS_32 - prefix));
                     }
@@ -238,8 +242,8 @@
                             bus, systemObject.second, systemObject.first,
                             ipmi::network::SYSTEMCONFIG_INTERFACE);
 
-                        gateway = systemProperties["DefaultGateway"]
-                                      .get<std::string>();
+                        gateway = variant_ns::get<std::string>(
+                            systemProperties["DefaultGateway"]);
                     }
                     // ignore the exception, as it is a valid condition that
                     // the system is not configured with any IP.
@@ -271,7 +275,7 @@
                         bus, macObjectInfo.second, macObjectInfo.first,
                         ipmi::network::MAC_INTERFACE, "MACAddress");
 
-                    macAddress = variant.get<std::string>();
+                    macAddress = variant_ns::get<std::string>(variant);
                 }
                 else if (channelConf->lan_set_in_progress == SET_IN_PROGRESS)
                 {
@@ -777,11 +781,9 @@
             }
 
             // get the configured mode on the system.
-            auto enableDHCP =
-                ipmi::getDbusProperty(
-                    bus, ipmi::network::SERVICE, networkInterfacePath,
-                    ipmi::network::ETHERNET_INTERFACE, "DHCPEnabled")
-                    .get<bool>();
+            auto enableDHCP = variant_ns::get<bool>(ipmi::getDbusProperty(
+                bus, ipmi::network::SERVICE, networkInterfacePath,
+                ipmi::network::ETHERNET_INTERFACE, "DHCPEnabled"));
 
             // if ip address source is not given then get the ip source mode
             // from the system so that it can be applied later.
@@ -824,11 +826,13 @@
                         ipmi::network::IP_INTERFACE);
 
                     ipaddress = channelConf->ipaddr.empty()
-                                    ? properties["Address"].get<std::string>()
+                                    ? variant_ns::get<std::string>(
+                                          properties["Address"])
                                     : channelConf->ipaddr;
 
                     prefix = channelConf->netmask.empty()
-                                 ? properties["PrefixLength"].get<uint8_t>()
+                                 ? variant_ns::get<uint8_t>(
+                                       properties["PrefixLength"])
                                  : ipmi::network::toPrefix(
                                        AF_INET, channelConf->netmask);
                 }
@@ -844,10 +848,10 @@
                     bus, systemObject.second, systemObject.first,
                     ipmi::network::SYSTEMCONFIG_INTERFACE);
 
-                gateway =
-                    channelConf->gateway.empty()
-                        ? systemProperties["DefaultGateway"].get<std::string>()
-                        : channelConf->gateway;
+                gateway = channelConf->gateway.empty()
+                              ? variant_ns::get<std::string>(
+                                    systemProperties["DefaultGateway"])
+                              : channelConf->gateway;
             }
         }