Move function from network manager to utility function
Function which fetches the interface address from the system.
Add some types to types.hpp
Change-Id: Ie2c02980a9fd7a0aaeafa22d93bc758b5c79fd04
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
diff --git a/types.hpp b/types.hpp
index 28b34d9..ca35421 100644
--- a/types.hpp
+++ b/types.hpp
@@ -1,9 +1,12 @@
#pragma once
+#include <ifaddrs.h>
+
#include <list>
#include <string>
#include <vector>
#include <map>
+#include <memory>
namespace phosphor
{
@@ -18,6 +21,19 @@
uint16_t prefix;
};
+using Addr_t = ifaddrs*;
+
+struct AddrDeleter
+{
+ void operator()(Addr_t ptr) const
+ {
+ freeifaddrs(ptr);
+ }
+};
+
+using AddrPtr = std::unique_ptr<ifaddrs, AddrDeleter>;
+
+
using AddrList = std::list<AddrInfo>;
using IntfAddrMap = std::map<IntfName, AddrList>;