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/main.cpp b/server/main.cpp
index 9215f21..50570fd 100644
--- a/server/main.cpp
+++ b/server/main.cpp
@@ -35,15 +35,16 @@
#include <binder/IServiceManager.h>
#include <binder/ProcessState.h>
-#include "Controllers.h"
#include "CommandListener.h"
+#include "Controllers.h"
+#include "DnsProxyListener.h"
+#include "FwmarkServer.h"
+#include "MDnsSdListener.h"
+#include "NFLogListener.h"
#include "NetdConstants.h"
#include "NetdNativeService.h"
#include "NetlinkManager.h"
#include "Stopwatch.h"
-#include "DnsProxyListener.h"
-#include "MDnsSdListener.h"
-#include "FwmarkServer.h"
using android::status_t;
using android::sp;
@@ -55,6 +56,8 @@
using android::net::FwmarkServer;
using android::net::NetdNativeService;
using android::net::NetlinkManager;
+using android::net::NFLogListener;
+using android::net::makeNFLogListener;
static void remove_pid_file();
static bool write_pid_file();
@@ -80,8 +83,19 @@
exit(1);
};
+ std::unique_ptr<NFLogListener> logListener;
+ {
+ auto result = makeNFLogListener();
+ if (!isOk(result)) {
+ ALOGE("Unable to create NFLogListener: %s", result.status().msg().c_str());
+ exit(1);
+ }
+ logListener = std::move(result.value());
+ }
+
gCtls = new android::net::Controllers();
gCtls->init();
+ gCtls->wakeupCtrl.init(logListener.get());
CommandListener cl;
nm->setBroadcaster((SocketListener *) &cl);