Implement network monitor
This commit listens for the ipaddress add event
and prints the message once it gets the NEWADDR
signal.
Change-Id: I5cdebc023dc8848fc736eca8d785c33387d401df
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
diff --git a/types.hpp b/types.hpp
index eb1f9fe..e792a3e 100644
--- a/types.hpp
+++ b/types.hpp
@@ -8,6 +8,8 @@
#include <map>
#include <memory>
+#include <systemd/sd-event.h>
+
namespace phosphor
{
namespace network
@@ -44,6 +46,18 @@
using AddrPtr = std::unique_ptr<ifaddrs, AddrDeleter>;
+/* Need a custom deleter for freeing up sd_event */
+struct EventDeleter
+{
+ void operator()(sd_event* event) const
+ {
+ event = sd_event_unref(event);
+ }
+};
+using EventPtr = std::unique_ptr<sd_event, EventDeleter>;
+
+template<typename T>
+using UniquePtr = std::unique_ptr<T, std::function<void(T*)>>;
using AddrList = std::list<AddrInfo>;
using IntfAddrMap = std::map<IntfName, AddrList>;