1/* 2 * Copyright 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package android.hardware.wifi.hostapd@1.0; 18 19import android.hardware.wifi.supplicant@1.0::Ssid; 20 21/** 22 * Top-level object for managing SoftAPs. 23 */ 24interface IHostapd { 25 /** 26 * Size limits for some of the params used in this interface. 27 */ 28 enum ParamSizeLimits : uint32_t { 29 /** Max length of SSID param. */ 30 SSID_MAX_LEN_IN_BYTES = 32, 31 32 /** Min length of PSK passphrase param. */ 33 WPA2_PSK_PASSPHRASE_MIN_LEN_IN_BYTES = 8, 34 35 /** Max length of PSK passphrase param. */ 36 WPA2_PSK_PASSPHRASE_MAX_LEN_IN_BYTES = 63, 37 }; 38 39 /** Possble Security types. */ 40 enum EncryptionType : uint32_t { 41 NONE, 42 WPA, 43 WPA2 44 }; 45 46 /** 47 * Band to use for the SoftAp operations. 48 * When using ACS, special value |BAND_ANY| can be 49 * used to indicate that any supported band can be used. This special 50 * case is currently supported only with drivers with which 51 * offloaded ACS is used. 52 */ 53 enum Band : uint32_t { 54 BAND_2_4_GHZ, 55 BAND_5_GHZ, 56 BAND_ANY 57 }; 58 59 /** 60 * Parameters to control the HW mode for the interface. 61 */ 62 struct HwModeParams { 63 /** 64 * Whether IEEE 802.11n (HT) is enabled or not. 65 * Note: hwMode=G (2.4 GHz) and hwMode=A (5 GHz) is used to specify 66 * the band. 67 */ 68 bool enable80211N; 69 /** 70 * Whether IEEE 802.11ac (VHT) is enabled or not. 71 * Note: hw_mode=a is used to specify that 5 GHz band is used with VHT. 72 */ 73 bool enable80211AC; 74 }; 75 76 /** 77 * Parameters to control the channel selection for the interface. 78 */ 79 struct ChannelParams { 80 /** 81 * Whether to enable ACS (Automatic Channel Selection) or not. 82 * The channel can be selected automatically at run time by setting 83 * this flag, which must enable the ACS survey based algorithm. 84 */ 85 bool enableAcs; 86 /** 87 * This option can be used to exclude all DFS channels from the ACS 88 * channel list in cases where the driver supports DFS channels. 89 **/ 90 bool acsShouldExcludeDfs; 91 /** 92 * Channel number (IEEE 802.11) to use for the interface. 93 * If ACS is enabled, this field is ignored. 94 */ 95 uint32_t channel; 96 /** 97 * Band to use for the SoftAp operations. 98 */ 99 Band band; 100 }; 101 102 /** 103 * Parameters to use for setting up the access point interface. 104 */ 105 struct IfaceParams { 106 /** Name of the interface */ 107 string ifaceName; 108 /** Hw mode params for the interface */ 109 HwModeParams hwModeParams; 110 /** Chanel params for the interface */ 111 ChannelParams channelParams; 112 }; 113 114 /** 115 * Parameters to use for setting up the access point network. 116 */ 117 struct NetworkParams { 118 /** SSID to set for the network */ 119 Ssid ssid; 120 /** Whether the network needs to be hidden or not. */ 121 bool isHidden; 122 /** Key management mask for the network. */ 123 EncryptionType encryptionType; 124 /** Passphrase for WPA_PSK network. */ 125 string pskPassphrase; 126 }; 127 128 /** 129 * Adds a new access point for hostapd to control. 130 * 131 * This should trigger the setup of an access point with the specified 132 * interface and network params. 133 * 134 * @param ifaceParams AccessPoint Params for the access point. 135 * @param nwParams Network Params for the access point. 136 * @return status Status of the operation. 137 * Possible status codes: 138 * |HostapdStatusCode.SUCCESS|, 139 * |HostapdStatusCode.FAILURE_ARGS_INVALID|, 140 * |HostapdStatusCode.FAILURE_UNKNOWN|, 141 * |HostapdStatusCode.FAILURE_IFACE_EXISTS| 142 */ 143 addAccessPoint(IfaceParams ifaceParams, NetworkParams nwParams) 144 generates(HostapdStatus status); 145 146 /** 147 * Removes an existing access point from hostapd. 148 * 149 * This should bring down the access point previously setup on the 150 * interface. 151 * 152 * @param ifaceName Name of the interface. 153 * @return status Status of the operation. 154 * Possible status codes: 155 * |HostapdStatusCode.SUCCESS|, 156 * |HostapdStatusCode.FAILURE_UNKNOWN|, 157 * |HostapdStatusCode.FAILURE_IFACE_UNKNOWN| 158 */ 159 removeAccessPoint(string ifaceName) generates(HostapdStatus status); 160 161 /** 162 * Terminate the service. 163 * This must de-register the service and clear all state. If this HAL 164 * supports the lazy HAL protocol, then this may trigger daemon to exit and 165 * wait to be restarted. 166 */ 167 oneway terminate(); 168}; 169