hostapd(hidl): Add HIDL interface skeletal code
Adding support for HIDL IPC in hostapd. This CL only adds the skeletal
framework for supporting HIDL interface implementation.
There is also a change in the hostapd.h to fix a C++ compilation error.
Bug: 36646171
Test: Compiles with CONFIG_CTRL_IFACE_HIDL=y in android.config
Change-Id: I4a7047a56f8e9be1ed51f2315df707ef5daddc11
diff --git a/hostapd/main.c b/hostapd/main.c
index ce94d05..8d90b38 100644
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -28,7 +28,9 @@
#include "config_file.h"
#include "eap_register.h"
#include "ctrl_iface.h"
-
+#ifdef CONFIG_CTRL_IFACE_HIDL
+#include "hidl.h"
+#endif /* CONFIG_CTRL_IFACE_HIDL */
struct hapd_global {
void **drv_priv;
@@ -659,8 +661,14 @@
interfaces.reload_config = hostapd_reload_config;
interfaces.config_read_cb = hostapd_config_read;
interfaces.for_each_interface = hostapd_for_each_interface;
+#ifdef CONFIG_CTRL_IFACE_HIDL
+ // No per-netdev setup for HIDL control interface.
+ interfaces.ctrl_iface_init = NULL;
+ interfaces.ctrl_iface_deinit = NULL;
+#else /* CONFIG_CTRL_IFACE_HIDL */
interfaces.ctrl_iface_init = hostapd_ctrl_iface_init;
interfaces.ctrl_iface_deinit = hostapd_ctrl_iface_deinit;
+#endif /* CONFIG_CTRL_IFACE_HIDL */
interfaces.driver_init = hostapd_driver_init;
interfaces.global_iface_path = NULL;
interfaces.global_iface_name = NULL;
@@ -751,9 +759,11 @@
}
}
+#ifndef CONFIG_CTRL_IFACE_HIDL
if (optind == argc && interfaces.global_iface_path == NULL &&
num_bss_configs == 0)
usage();
+#endif
wpa_msg_register_ifname_cb(hostapd_msg_ifname_cb);
@@ -893,7 +903,14 @@
goto out;
}
+#ifdef CONFIG_CTRL_IFACE_HIDL
+ if (hostapd_hidl_init(&interfaces)) {
+ wpa_printf(MSG_ERROR, "Failed to initialize HIDL interface");
+ goto out;
+ }
+#else /* CONFIG_CTRL_IFACE_HIDL */
hostapd_global_ctrl_iface_init(&interfaces);
+#endif /* CONFIG_CTRL_IFACE_HIDL */
if (hostapd_global_run(&interfaces, daemonize, pid_file)) {
wpa_printf(MSG_ERROR, "Failed to start eloop");
@@ -903,7 +920,11 @@
ret = 0;
out:
+#ifdef CONFIG_CTRL_IFACE_HIDL
+ hostapd_hidl_deinit(&interfaces);
+#else /* CONFIG_CTRL_IFACE_HIDL */
hostapd_global_ctrl_iface_deinit(&interfaces);
+#endif /* CONFIG_CTRL_IFACE_HIDL */
/* Deinitialize all interfaces */
for (i = 0; i < interfaces.count; i++) {
if (!interfaces.iface[i])