summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2019-01-30 17:14:23 -0800
committerRatan Gupta <ratagupt@linux.vnet.ibm.com>2019-02-14 05:21:08 +0000
commit0d7ce48e8d36e381e35550450c8bd0903a859e71 (patch)
treef94673620ffa5ac47fb7e3c8e53da572f97275e9
parent461d8f97749a2cb9eb39707bdff3562924d536ef (diff)
downloadphosphor-networkd-0d7ce48e8d36e381e35550450c8bd0903a859e71.tar.gz
phosphor-networkd-0d7ce48e8d36e381e35550450c8bd0903a859e71.zip
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>
-rw-r--r--types.hpp8
1 files changed, 8 insertions, 0 deletions
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 @@ using EventPtr = std::unique_ptr<sd_event, EventDeleter>;
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>;
OpenPOWER on IntegriCloud