types: Add types for IPs and MACs in byte form
This will be used by future code, mainly for storing data retrieved over
netlink in a typesafe way.
Change-Id: I663e7cdf5876397426338f6a733aa6a7dd8fca95
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/types.hpp b/types.hpp
index 9ffe5ad..562c3a1 100644
--- a/types.hpp
+++ b/types.hpp
@@ -1,9 +1,12 @@
#pragma once
#include <ifaddrs.h>
+#include <netinet/in.h>
#include <systemd/sd-event.h>
+#include <array>
#include <chrono>
+#include <cstddef>
#include <functional>
#include <list>
#include <map>
@@ -12,6 +15,7 @@
#include <sdeventplus/utility/timer.hpp>
#include <set>
#include <string>
+#include <variant>
#include <vector>
namespace phosphor
@@ -74,6 +78,10 @@
template <typename T>
using UniquePtr = std::unique_ptr<T, std::function<void(T*)>>;
+// Byte representations for common address types in network byte order
+using InAddrAny = std::variant<struct in_addr, struct in6_addr>;
+using MacAddr = std::array<std::byte, 6>;
+
using AddrList = std::list<AddrInfo>;
using IntfAddrMap = std::map<IntfName, AddrList>;
using InterfaceList = std::set<IntfName>;