hostapd(interface): Add a HIDL interface for hostapd
The HIDL interface exposes 2 methods:
1) addAccessPoint - Starts an access point on the specified interface
with params.
2) removeAccessPoint - Removes a previously started access point.
Bug: 36646171
Test: Compiles
Change-Id: I020f25a74f505e7fa4cfdfc25efb512456021877
diff --git a/wifi/hostapd/1.0/Android.bp b/wifi/hostapd/1.0/Android.bp
new file mode 100644
index 0000000..a17e153
--- /dev/null
+++ b/wifi/hostapd/1.0/Android.bp
@@ -0,0 +1,23 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+ name: "android.hardware.wifi.hostapd@1.0",
+ root: "android.hardware",
+ vndk: {
+ enabled: true,
+ },
+ srcs: [
+ "types.hal",
+ "IHostapd.hal",
+ ],
+ interfaces: [
+ "android.hardware.wifi.supplicant@1.0",
+ "android.hidl.base@1.0",
+ ],
+ types: [
+ "HostapdStatus",
+ "HostapdStatusCode",
+ ],
+ gen_java: true,
+}
+
diff --git a/wifi/hostapd/1.0/IHostapd.hal b/wifi/hostapd/1.0/IHostapd.hal
new file mode 100644
index 0000000..4dc7bf8
--- /dev/null
+++ b/wifi/hostapd/1.0/IHostapd.hal
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi.hostapd@1.0;
+
+import android.hardware.wifi.supplicant@1.0::Ssid;
+
+/**
+ * Top-level object for managing SoftAPs.
+ */
+interface IHostapd {
+ /**
+ * Size limits for some of the params used in this interface.
+ */
+ enum ParamSizeLimits : uint32_t {
+ /** Max length of SSID param. */
+ SSID_MAX_LEN_IN_BYTES = 32,
+
+ /** Min length of PSK passphrase param. */
+ WPA2_PSK_PASSPHRASE_MIN_LEN_IN_BYTES = 8,
+
+ /** Max length of PSK passphrase param. */
+ WPA2_PSK_PASSPHRASE_MAX_LEN_IN_BYTES = 63,
+ };
+
+ /** Possble Security types. */
+ enum EncryptionType : uint32_t {
+ NONE,
+ WPA,
+ WPA2
+ };
+
+ /**
+ * Band to use for the SoftAp operations.
+ * When using ACS, special value |BAND_ANY| can be
+ * used to indicate that any supported band can be used. This special
+ * case is currently supported only with drivers with which
+ * offloaded ACS is used.
+ */
+ enum Band : uint32_t {
+ BAND_2_4_GHZ,
+ BAND_5_GHZ,
+ BAND_ANY
+ };
+
+ /**
+ * Parameters to control the HW mode for the interface.
+ */
+ struct HwModeParams {
+ /**
+ * Whether IEEE 802.11n (HT) is enabled or not.
+ * Note: hwMode=G (2.4 GHz) and hwMode=A (5 GHz) is used to specify
+ * the band.
+ */
+ bool enable80211N;
+ /**
+ * Whether IEEE 802.11ac (VHT) is enabled or not.
+ * Note: hw_mode=a is used to specify that 5 GHz band is used with VHT.
+ */
+ bool enable80211AC;
+ };
+
+ /**
+ * Parameters to control the channel selection for the interface.
+ */
+ struct ChannelParams {
+ /**
+ * Whether to enable ACS (Automatic Channel Selection) or not.
+ * The channel can be selected automatically at run time by setting
+ * this flag, which must enable the ACS survey based algorithm.
+ */
+ bool enableAcs;
+ /**
+ * This option can be used to exclude all DFS channels from the ACS
+ * channel list in cases where the driver supports DFS channels.
+ **/
+ bool acsShouldExcludeDfs;
+ /**
+ * Channel number (IEEE 802.11) to use for the interface.
+ * If ACS is enabled, this field is ignored.
+ */
+ uint32_t channel;
+ /**
+ * Band to use for the SoftAp operations.
+ */
+ Band band;
+ };
+
+ /**
+ * Parameters to use for setting up the access point interface.
+ */
+ struct IfaceParams {
+ /** Name of the interface */
+ string ifaceName;
+ /** Hw mode params for the interface */
+ HwModeParams hwModeParams;
+ /** Chanel params for the interface */
+ ChannelParams channelParams;
+ };
+
+ /**
+ * Parameters to use for setting up the access point network.
+ */
+ struct NetworkParams {
+ /** SSID to set for the network */
+ Ssid ssid;
+ /** Whether the network needs to be hidden or not. */
+ bool isHidden;
+ /** Key management mask for the network. */
+ EncryptionType encryptionType;
+ /** Passphrase for WPA_PSK network. */
+ string pskPassphrase;
+ };
+
+ /**
+ * Adds a new access point for hostapd to control.
+ *
+ * This should trigger the setup of an access point with the specified
+ * interface and network params.
+ *
+ * @param ifaceParams AccessPoint Params for the access point.
+ * @param nwParams Network Params for the access point.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |HostapdStatusCode.SUCCESS|,
+ * |HostapdStatusCode.FAILURE_ARGS_INVALID|,
+ * |HostapdStatusCode.FAILURE_UNKNOWN|,
+ * |HostapdStatusCode.FAILURE_IFACE_EXISTS|
+ */
+ addAccessPoint(IfaceParams ifaceParams, NetworkParams nwParams)
+ generates(HostapdStatus status);
+
+ /**
+ * Removes an existing access point from hostapd.
+ *
+ * This should bring down the access point previously setup on the
+ * interface.
+ *
+ * @param ifaceName Name of the interface.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |HostapdStatusCode.SUCCESS|,
+ * |HostapdStatusCode.FAILURE_UNKNOWN|,
+ * |HostapdStatusCode.FAILURE_IFACE_UNKNOWN|
+ */
+ removeAccessPoint(string ifaceName) generates(HostapdStatus status);
+};
diff --git a/wifi/hostapd/1.0/types.hal b/wifi/hostapd/1.0/types.hal
new file mode 100644
index 0000000..31bbc34
--- /dev/null
+++ b/wifi/hostapd/1.0/types.hal
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi.hostapd@1.0;
+/**
+ * Enum values indicating the status of any hostapd operation.
+ */
+enum HostapdStatusCode : uint32_t {
+ /** No errors. */
+ SUCCESS,
+ /** Unknown failure occured. */
+ FAILURE_UNKNOWN,
+ /** One or more of the incoming args is invalid. */
+ FAILURE_ARGS_INVALID,
+ /** Iface with the provided name does not exist. */
+ FAILURE_IFACE_UNKNOWN,
+ /** Iface with the provided name already exists. */
+ FAILURE_IFACE_EXISTS
+};
+
+/**
+ * Generic structure to return the status of any hostapd operation.
+ */
+struct HostapdStatus {
+ HostapdStatusCode code;
+ /**
+ * A vendor-specific error message to provide more information beyond the
+ * status code.
+ * This must be used for debugging purposes only.
+ */
+ string debugMessage;
+};