Add tests for interface add/remove binder API

Bug: 30298058

(cherry picked from commit 46ae27cd20e70393843799efe8de9180295a4953)

Change-Id: I06cd226c75a8cc42eac5b5d1d27031af30c0662e
diff --git a/server/NetdConstants.h b/server/NetdConstants.h
index e3f533a..605362c 100644
--- a/server/NetdConstants.h
+++ b/server/NetdConstants.h
@@ -19,6 +19,8 @@
 
 #include <string>
 #include <list>
+#include <ifaddrs.h>
+#include <netdb.h>
 #include <stdarg.h>
 
 #include <chrono>
@@ -73,6 +75,28 @@
     std::chrono::time_point<std::chrono::steady_clock> mStart;
 };
 
+
+struct AddrinfoDeleter {
+    void operator()(struct addrinfo* p) const {
+        if (p != nullptr) {
+            freeaddrinfo(p);
+        }
+    }
+};
+
+typedef std::unique_ptr<struct addrinfo, struct AddrinfoDeleter> ScopedAddrinfo;
+
+
+struct IfaddrsDeleter {
+    void operator()(struct ifaddrs *p) const {
+        if (p != nullptr) {
+            freeifaddrs(p);
+        }
+    }
+};
+
+typedef std::unique_ptr<struct ifaddrs, struct IfaddrsDeleter> ScopedIfaddrs;
+
 namespace android {
 namespace net {