transporthandler: Generic set exception handling

This makes it easier to handle errors across multiple command types as
they all have common return codes for specific types of failures.

Change-Id: I033a171b5fca78a62b52424db970ecfdf7a15e17
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/transporthandler.hpp b/transporthandler.hpp
index 0cfaf01..db5df56 100644
--- a/transporthandler.hpp
+++ b/transporthandler.hpp
@@ -17,23 +17,21 @@
 #include <phosphor-logging/log.hpp>
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/exception.hpp>
+#include <stdplus/raw.hpp>
 #include <user_channel/channel_layer.hpp>
 #include <xyz/openbmc_project/Common/error.hpp>
 #include <xyz/openbmc_project/Network/EthernetInterface/server.hpp>
 #include <xyz/openbmc_project/Network/IP/server.hpp>
 #include <xyz/openbmc_project/Network/Neighbor/server.hpp>
 
-#include <array>
 #include <bitset>
 #include <cinttypes>
 #include <cstdint>
-#include <cstring>
 #include <fstream>
 #include <functional>
 #include <optional>
 #include <string>
 #include <string_view>
-#include <type_traits>
 #include <unordered_map>
 #include <unordered_set>
 #include <utility>
@@ -183,44 +181,6 @@
     std::string logicalPath;
 };
 
-/** @brief A trivial helper used to determine if two PODs are equal
- *
- *  @params[in] a - The first object to compare
- *  @params[in] b - The second object to compare
- *  @return True if the objects are the same bytewise
- */
-template <typename T>
-bool equal(const T& a, const T& b)
-{
-    static_assert(std::is_trivially_copyable_v<T>);
-    return std::memcmp(&a, &b, sizeof(T)) == 0;
-}
-
-/** @brief Copies bytes from an array into a trivially copyable container
- *
- *  @params[out] t     - The container receiving the data
- *  @params[in]  bytes - The data to copy
- */
-template <size_t N, typename T>
-void copyInto(T& t, const std::array<uint8_t, N>& bytes)
-{
-    static_assert(std::is_trivially_copyable_v<T>);
-    static_assert(N == sizeof(T));
-    std::memcpy(&t, bytes.data(), bytes.size());
-}
-
-/** @brief Gets a generic view of the bytes in the input container
- *
- *  @params[in] t - The data to reference
- *  @return A string_view referencing the bytes in the container
- */
-template <typename T>
-std::string_view dataRef(const T& t)
-{
-    static_assert(std::is_trivially_copyable_v<T>);
-    return {reinterpret_cast<const char*>(&t), sizeof(T)};
-}
-
 /** @brief Determines the ethernet interface name corresponding to a channel
  *         Tries to map a VLAN object first so that the address information
  *         is accurate. Otherwise it gets the standard ethernet interface.
@@ -586,7 +546,7 @@
         {
             continue;
         }
-        if (!equal(*neighIP, ip))
+        if (!stdplus::raw::equal(*neighIP, ip))
         {
             continue;
         }