Add WakeupController and NFLogListener

These classes work together to parse and dispatch NFLOG messages in
response to inbound packets annotated by the WiFi driver.

Test: as follows
    - built
    - flashed
    - booted
    - netd_unit_test passes

Change-Id: Id26d62858bf4bc4186ae66850f08077adf6fc2ac
diff --git a/server/NetdNativeService.cpp b/server/NetdNativeService.cpp
index f0729b1..7e555f5 100644
--- a/server/NetdNativeService.cpp
+++ b/server/NetdNativeService.cpp
@@ -46,8 +46,16 @@
 namespace {
 
 const char CONNECTIVITY_INTERNAL[] = "android.permission.CONNECTIVITY_INTERNAL";
+const char NETWORK_STACK[] = "android.permission.NETWORK_STACK";
 const char DUMP[] = "android.permission.DUMP";
 
+binder::Status toBinderStatus(const netdutils::Status s) {
+    if (isOk(s)) {
+        return binder::Status::ok();
+    }
+    return binder::Status::fromExceptionCode(s.code(), s.msg().c_str());
+}
+
 binder::Status checkPermission(const char *permission) {
     pid_t pid;
     uid_t uid;
@@ -410,5 +418,19 @@
                     socket));
 }
 
+binder::Status NetdNativeService::wakeupAddInterface(const std::string& ifName,
+                                                     const std::string& prefix, int32_t mark,
+                                                     int32_t mask) {
+    ENFORCE_PERMISSION(NETWORK_STACK);
+    return toBinderStatus(gCtls->wakeupCtrl.addInterface(ifName, prefix, mark, mask));
+}
+
+binder::Status NetdNativeService::wakeupDelInterface(const std::string& ifName,
+                                                     const std::string& prefix, int32_t mark,
+                                                     int32_t mask) {
+    ENFORCE_PERMISSION(NETWORK_STACK);
+    return toBinderStatus(gCtls->wakeupCtrl.delInterface(ifName, prefix, mark, mask));
+}
+
 }  // namespace net
 }  // namespace android