blob: 4ba55ecab3a9b0803baab08220e592ad4bcda4a9 [file] [log] [blame]
Raj Kushwaha41027212010-10-13 00:11:12 -07001/*
Duy Truongd48aa312013-02-10 02:16:54 -08002 * Copyright (c) 2010, The Linux Foundation. All rights reserved.
Raj Kushwaha41027212010-10-13 00:11:12 -07003
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above
10 * copyright notice, this list of conditions and the following
11 * disclaimer in the documentation and/or other materials provided
12 * with the distribution.
Duy Truongd48aa312013-02-10 02:16:54 -080013 * * Neither the name of The Linux Foundation nor the names of its
Raj Kushwaha41027212010-10-13 00:11:12 -070014 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16
17 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30
31#ifndef _QSAP_API_H_
32#define _QSAP_API_H_
33
34#if __cplusplus
35extern "C" {
36#endif
Purushottam Kushwahaa49496a2017-05-30 14:34:37 +053037#include <android/log.h>
Raj Kushwaha41027212010-10-13 00:11:12 -070038typedef unsigned char u8;
39typedef char s8;
40typedef unsigned short int u16;
41typedef signed short int s16;
Ravi Joshi9b8ed112014-04-02 14:52:40 -070042typedef unsigned int u32;
43typedef signed int s32;
Raj Kushwaha41027212010-10-13 00:11:12 -070044
45/** Success and error messages */
46#define SUCCESS "success"
47#define ERR_INVALID_ARG "failure invalid arguments"
48#define ERR_INVALID_PARAM "failure invalid parameter"
49#define ERR_UNKNOWN "failure unknown error"
50#define ERR_INVALIDCMD "failure invalid command"
51#define ERR_INVALIDREQ "failure invalid request"
52#define ERR_FEATURE_NOT_ENABLED "failure feature not enabled"
53#define ERR_NOT_SUPPORTED "failure not supported"
54#define ERR_NOT_READY "failure not ready"
55#define ERR_RES_UNAVAILABLE "failure resource unavailable"
56#define ERR_SOFTAP_NOT_STARTED "failure softap not started"
57
58/** Error numbers used with the SDK */
59enum error_val {
60 eERR_UNKNOWN = -1,
61 eSUCCESS = 0,
62 eERR_STOP_BSS,
63 eERR_BSS_NOT_STARTED,
64 eERR_COMMIT,
65 eERR_START_SAP,
66 eERR_STOP_SAP,
67 eERR_RELOAD_SAP,
68 eERR_FILE_OPEN,
69 eERR_CONF_FILE,
70 eERR_INVALID_MAC_ADDR,
71 eERR_SEND_TO_HOSTAPD,
72 eERR_CONFIG_PARAM_MISSING,
73 eERR_CHAN_READ,
74 eERR_FEATURE_NOT_ENABLED,
75 eERR_UNLOAD_FAILED_SDIO,
76 eERR_UNLOAD_FAILED_SOFTAP,
77 eERR_LOAD_FAILED_SDIOIF,
Deepthi Gowri684d2f92012-05-23 23:28:16 +053078 eERR_LOAD_FAILED_SOFTAP,
Deepthi Gowri6ce57562012-06-27 01:18:15 +053079 eERR_SET_CHAN_RANGE,
80 eERR_GET_AUTO_CHAN
Raj Kushwaha41027212010-10-13 00:11:12 -070081};
82
Deepthi Gowriae5a4f72012-01-31 19:39:06 +053083#ifndef WIFI_DRIVER_CONF_FILE
84#define WIFI_DRIVER_CONF_FILE NULL
85#endif
86
87#ifndef WIFI_DRIVER_DEF_CONF_FILE
88#define WIFI_DRIVER_DEF_CONF_FILE NULL
89#endif
90
Ajit Vaishyaa21d2652017-07-04 21:32:27 +053091/** Configuration file name for SAP+SAP*/
Purushottam Kushwaha9283d3e2018-05-12 20:21:53 +053092#define CONFIG_FILE_2G "/data/vendor/wifi/hostapd/hostapd_dual2g.conf"
93#define CONFIG_FILE_5G "/data/vendor/wifi/hostapd/hostapd_dual5g.conf"
Dedy Lanskya2dd08f2019-11-10 13:58:58 +020094#define CONFIG_FILE_60G "/data/vendor/wifi/hostapd/hostapd_60g.conf"
Ajit Vaishyaa21d2652017-07-04 21:32:27 +053095
Hu Wangd8555002018-12-06 18:13:00 +080096/** Configuration file name for OWE-transition */
97#define CONFIG_FILE_OWE "/data/vendor/wifi/hostapd/hostapd_owe.conf"
98
Raj Kushwaha41027212010-10-13 00:11:12 -070099/** Configuration file name */
Purushottam Kushwaha9283d3e2018-05-12 20:21:53 +0530100#define CONFIG_FILE "/data/vendor/wifi/hostapd/hostapd.conf"
Raj Kushwaha41027212010-10-13 00:11:12 -0700101
102/** Default configuration file path */
Abhishek Srivastava24430242019-03-04 14:26:55 +0530103#define DEFAULT_CONFIG_FILE_PATH "/vendor/etc/hostapd/hostapd_default.conf"
Deepthi Gowri80a36e22012-10-16 18:33:51 +0530104
105/** Default Accept list file name */
Abhishek Srivastava24430242019-03-04 14:26:55 +0530106#define DEFAULT_ACCEPT_LIST_FILE_PATH "/vendor/etc/hostapd/hostapd.accept"
Raj Kushwaha41027212010-10-13 00:11:12 -0700107
Raj Kushwahaae27f822010-11-14 17:47:11 -0800108/** Accept list file name */
Purushottam Kushwaha9283d3e2018-05-12 20:21:53 +0530109#define ACCEPT_LIST_FILE "/data/vendor/wifi/hostapd/hostapd.accept"
Raj Kushwahaae27f822010-11-14 17:47:11 -0800110
Deepthi Gowri80a36e22012-10-16 18:33:51 +0530111/** Default Deny list file name */
Abhishek Srivastava24430242019-03-04 14:26:55 +0530112#define DEFAULT_DENY_LIST_FILE_PATH "/vendor/etc/hostapd/hostapd.deny"
Deepthi Gowri80a36e22012-10-16 18:33:51 +0530113
Raj Kushwahaae27f822010-11-14 17:47:11 -0800114/** Deny list file name */
Purushottam Kushwaha9283d3e2018-05-12 20:21:53 +0530115#define DENY_LIST_FILE "/data/vendor/wifi/hostapd/hostapd.deny"
Raj Kushwahaae27f822010-11-14 17:47:11 -0800116
Raj Kushwaha41027212010-10-13 00:11:12 -0700117/** Default Ini file */
118#define DEFAULT_INI_FILE "/persist/qcom/softap/qcom_cfg_default.ini"
119
120/** SDK control interface path */
Purushottam Kushwaha9283d3e2018-05-12 20:21:53 +0530121#define SDK_CTRL_IF "/data/vendor/wifi/hostapd/ctrl/softap_sdk_ctrl"
Raj Kushwaha41027212010-10-13 00:11:12 -0700122
123/** Maximum length of the line in the configuration file */
124#define MAX_CONF_LINE_LEN (156)
125
126/** MAC address length in acsii string format*/
127#define MAC_ADDR_LEN (17)
128
129/** MAC address length, as integer */
130#define MAC_ADDR_LEN_INT (6)
131/** Maximum number of MAC address in the allow / deny MAC list */
132#define MAX_ALLOWED_MAC (15)
133
134/** Maximum length of the file path */
135#define MAX_FILE_PATH_LEN (128)
136
137/** WPS key length - 8 digit key, usually*/
138#define WPS_KEY_LEN (8)
139
140/** Maximum length of the SSID */
141#define SSD_MAX_LEN (32)
Santosh Sajjanc463f732011-12-22 18:24:56 +0530142#define CTRY_MAX_LEN (3)
Raj Kushwaha41027212010-10-13 00:11:12 -0700143
144/** Beacon interval 50 to 65535 */
145#define BCN_INTERVAL_MIN (1)
146#define BCN_INTERVAL_MAX (65535)
147
148/** Passphrase max length 63 bytes, Minumum lenght is 8.
149 * NOTE: If Passphrase length is 64, then phassphrase is treated as PSK.
150 */
151#define PASSPHRASE_MIN (8)
152#define PASSPHRASE_MAX (63)
153
154/** DTIM period 1 to 255 -- Qualcomm 10 */
155#define DTIM_PERIOD_MIN (1)
156#define DTIM_PERIOD_MAX (255)
157
Raj Kushwaha41027212010-10-13 00:11:12 -0700158/** WEP key lengths in ASCII and hex */
159#define WEP_64_KEY_ASCII (5)
160#define WEP_64_KEY_HEX (10)
161
162#define WEP_128_KEY_ASCII (13)
163#define WEP_128_KEY_HEX (26)
164
165#define WEP_152_KEY_ASCII (16)
166#define WEP_152_KEY_HEX (32)
167
168#define WPS_PIN_LEN (8)
169
170#define CHANNEL_MIN (0)
171#define CHANNEL_MAX (14)
172#define AUTO_CHANNEL (0)
173#define BG_MAX_CHANNEL (11)
174
Raj Kushwahaae27f822010-11-14 17:47:11 -0800175/** Fragmentation threshold 256 to 2346 */
Raj Kushwaha41027212010-10-13 00:11:12 -0700176#define FRAG_THRESHOLD_MIN (256)
177#define FRAG_THRESHOLD_MAX (2346)
178
Raj Kushwahaae27f822010-11-14 17:47:11 -0800179/** RTS threshold 1 to 2347 */
180#define RTS_THRESHOLD_MIN (1)
Raj Kushwaha41027212010-10-13 00:11:12 -0700181#define RTS_THRESHOLD_MAX (2347)
182
183#define MIN_UUID_LEN (1)
184#define MAX_UUID_LEN (36)
185
186#define MIN_DEVICENAME_LEN (1)
187#define MAX_DEVICENAME_LEN (32)
188
189#define MIN_MANUFACTURER_LEN (1)
190#define MAX_MANUFACTURER_LEN (64)
191
192#define MIN_MODELNAME_LEN (1)
193#define MAX_MODELNAME_LEN (32)
194
195#define MIN_MODELNUM_LEN (1)
196#define MAX_MODELNUM_LEN (32)
197
198#define MIN_SERIALNUM_LEN (1)
199#define MAX_SERIALNUM_LEN (32)
200
201#define MIN_DEV_TYPE_LEN (1)
202#define MAX_DEV_TYPE_LEN (20)
203
204#define MIN_OS_VERSION_LEN (1)
205#define MAX_OS_VERSION_LEN (12)
206
207#define MIN_FRIENDLY_NAME_LEN (1)
208#define MAX_FRIENDLY_NAME_LEN (64)
209
210#define MAX_URL_LEN (128)
211
212#define MIN_MODEL_DESC_LEN (1)
213#define MAX_MODEL_DESC_LEN (128)
214
215#define MIN_UPC_LEN (1)
216#define MAX_UPC_LEN (128)
217
c_rrajivc1606972016-06-08 13:05:12 +0530218#define GTK_MIN (30)
Raj Kushwaha41027212010-10-13 00:11:12 -0700219
220#define MAX_INT_STR (8)
221
222/** Tx Power range 2dBm to 18 dBm */
223#define MIN_TX_POWER (2)
224#define MAX_TX_POWER (30)
225
226/** Data rate index */
227#define MIN_DATA_RATE_IDX (0)
228#define MAX_DATA_RATE_IDX (28)
229#define AUTO_DATA_RATE (0)
230#define B_MODE_MAX_DATA_RATE_IDX (4)
231#define G_ONLY_MODE_MAX_DATA_RATE_IDX (12)
232
233/** parameters for read config */
234#define GET_COMMENTED_VALUE 1
235#define GET_ENABLED_ONLY 0
236
237#define MAX_RESP_LEN 255
238
239/** AP shutoff time */
240#define AP_SHUTOFF_MIN (0)
241#define AP_SHUTOFF_MAX (120)
242
243/** AP shutoff time */
244#define AP_ENERGY_DETECT_TH_MIN (0)
Raj Kushwahaae27f822010-11-14 17:47:11 -0800245#define AP_ENERGY_DETECT_TH_MAX (9)
Raj Kushwaha41027212010-10-13 00:11:12 -0700246
247/** command request index - in the array Cmd_req[] */
248enum eCmd_req {
249 eCMD_GET = 0,
250 eCMD_SET = 1,
251
252 eCMD_REQ_LAST
253};
254
Ajit Vaishyaa21d2652017-07-04 21:32:27 +0530255/** config request index - in the array Conf_req[] */
256enum eConf_req {
257 CONF_2g = 0,
258 CONF_5g = 1,
Hu Wangd8555002018-12-06 18:13:00 +0800259 CONF_owe = 2,
Dedy Lanskya2dd08f2019-11-10 13:58:58 +0200260 CONF_60g = 3,
Ajit Vaishyaa21d2652017-07-04 21:32:27 +0530261
262 CONF_REQ_LAST
263};
264
Raj Kushwaha41027212010-10-13 00:11:12 -0700265/**
266 * Command numbers, these numbers form the index into the array of
267 * command names stored in the 'cmd_list'.
268 *
269 * Warning: An addtion of an entry in 'esap_cmd', should be followed
270 * by an addition of a command name string in the 'cmd_list' array
271 */
272typedef enum esap_cmd {
273 eCMD_INVALID = -1,
274 eCMD_SSID = 0,
275 eCMD_BSSID = 1,
276 eCMD_CHAN = 2,
277 eCMD_BCN_INTERVAL = 3,
278 eCMD_DTIM_PERIOD = 4,
279 eCMD_HW_MODE = 5,
280 eCMD_AUTH_ALGS = 6,
281 eCMD_SEC_MODE = 7,
282 eCMD_WEP_KEY0 = 8,
283 eCMD_WEP_KEY1 = 9,
284 eCMD_WEP_KEY2 = 10,
285 eCMD_WEP_KEY3 = 11,
286 eCMD_DEFAULT_KEY = 12,
287 eCMD_PASSPHRASE = 13,
288 eCMD_WPA_PAIRWISE = 14,
289 eCMD_RSN_PAIRWISE = 15,
290 eCMD_MAC_ADDR = 16,
291 eCMD_RESET_AP = 17,
292 eCMD_MAC_ACL = 18,
293 eCMD_ADD_TO_ALLOW = 19,
294 eCMD_ADD_TO_DENY = 20,
295 eCMD_REMOVE_FROM_ALLOW = 21,
296 eCMD_REMOVE_FROM_DENY = 22,
297 eCMD_ALLOW_LIST = 23,
298 eCMD_DENY_LIST = 24,
299 eCMD_COMMIT = 25,
300 eCMD_ENABLE_SOFTAP = 26,
301 eCMD_DISASSOC_STA = 27,
302 eCMD_RESET_TO_DEFAULT = 28,
303 eCMD_PROTECTION_FLAG = 29,
304 eCMD_DATA_RATES = 30,
305 eCMD_ASSOC_STA_MACS = 31,
306 eCMD_TX_POWER = 32,
307 eCMD_SDK_VERSION = 33,
308 eCMD_WMM_STATE = 34,
309
310 /** WARNING: The order of WPS commands should not be altered.
311 New commands SHOULD be added above or below this */
312 eCMD_WPS_STATE = 35,
313 eCMD_WPS_CONFIG_METHOD = 36,
314 eCMD_UUID = 37,
315 eCMD_DEVICE_NAME = 38,
316 eCMD_MANUFACTURER = 39,
317 eCMD_MODEL_NAME = 40,
318 eCMD_MODEL_NUMBER = 41,
319 eCMD_SERIAL_NUMBER = 42,
320 eCMD_DEVICE_TYPE = 43,
321 eCMD_OS_VERSION = 44,
322 eCMD_FRIENDLY_NAME = 45,
323 eCMD_MANUFACTURER_URL = 46,
324 eCMD_MODEL_DESC = 47,
325 eCMD_MODEL_URL = 48,
326 eCMD_UPC = 49,
327 /******************************************************/
328
329 eCMD_FRAG_THRESHOLD = 50,
330 eCMD_RTS_THRESHOLD = 51,
331 eCMD_GTK_TIMEOUT = 52,
332 eCMD_COUNTRY_CODE = 53,
333 eCMD_INTRA_BSS_FORWARD = 54,
334 eCMD_REGULATORY_DOMAIN = 55,
335 eCMD_AP_STATISTICS = 56,
336 eCMD_AP_AUTOSHUTOFF = 57,
337 eCMD_AP_ENERGY_DETECT_TH = 58,
Santosh Sajjanc463f732011-12-22 18:24:56 +0530338 eCMD_BASIC_RATES = 59,
339 eCMD_REQUIRE_HT = 60,
340 eCMD_IEEE80211N = 61,
Deepthi Gowri684d2f92012-05-23 23:28:16 +0530341 eCMD_SET_CHANNEL_RANGE = 62,
Deepthi Gowri6ce57562012-06-27 01:18:15 +0530342 eCMD_GET_AUTO_CHANNEL = 63,
Chet Lanctot4c15b562013-07-25 11:02:06 -0700343 eCMD_IEEE80211W = 64,
Chet Lanctot7a2827f2013-09-09 17:48:58 -0700344 eCMD_WPA_KEY_MGMT = 65,
Changzhi Dengfddc6be2015-05-21 15:47:07 +0800345 eCMD_SET_MAX_CLIENTS = 66,
Manikandan Mohane1bfb732015-08-18 16:30:11 -0700346 eCMD_IEEE80211AC = 67,
347 eCMD_VHT_OPER_CH_WIDTH = 68,
348 eCMD_ACS_CHAN_LIST = 69,
349 eCMD_HT_CAPAB = 70,
Pradeep Reddy POTTETI5c1a3ab2016-01-07 20:01:40 +0530350 eCMD_IEEE80211H = 71,
Raj Kushwaha41027212010-10-13 00:11:12 -0700351
Dedy Lansky350c3532016-05-16 11:54:10 +0300352 eCMD_ENABLE_WIGIG_SOFTAP = 72,
Nalla Kartheekf4eef252016-04-29 18:09:35 +0530353 eCMD_INTERFACE = 73,
Purushottam Kushwahaa7c3aa82017-07-21 22:03:58 +0530354 eCMD_SSID2 = 74,
355 eCMD_BRIDGE = 75,
Ajit Vaishya8c3357c2017-08-11 16:52:38 +0530356 eCMD_CTRL_INTERFACE = 76,
Ajit Vaishya3f875322017-08-14 22:31:29 +0530357 eCMD_VENDOR_ELEMENT = 77,
358 eCMD_ASSOCRESP_ELEMENT = 78,
Purushottam Kushwaha68e72482018-08-20 12:18:04 +0530359 eCMD_ACS_EXCLUDE_DFS = 79,
Abhishek Srivastavab44cdad2018-10-23 19:18:50 +0530360 eCMD_WOWLAN_TRIGGERS = 80,
361 eCMD_ACCEPT_MAC_FILE = 81,
362 eCMD_DENY_MAC_FILE = 82,
Hu Wangaa4c6ca2018-11-26 18:26:00 +0800363 eCMD_OWE_TRANS_IFNAME = 83,
Hu Wang62ae34e2019-01-31 10:26:14 +0800364 eCMD_SAE_REQUIRE_MPF = 84,
Dedy Lansky350c3532016-05-16 11:54:10 +0300365
Dedy Lanskya2dd08f2019-11-10 13:58:58 +0200366 eCMD_IEEE80211AX = 85,
367
Alexei Avshalom Lazar1b6053c2019-11-14 11:33:49 +0200368 eCMD_ENABLE_EDMG = 86,
369 eCMD_EDMG_CHANNEL = 87,
370
Raj Kushwaha41027212010-10-13 00:11:12 -0700371 eCMD_LAST /** New command numbers should be added above this */
372} esap_cmd_t;
373
374/** non-commands */
375typedef enum esap_str {
376 STR_WPA = 0,
377 STR_ACCEPT_MAC_FILE = 1,
378 STR_DENY_MAC_FILE = 2,
379 STR_MAC_IN_INI = 3,
380 STR_PROT_FLAG_IN_INI = 4,
381 STR_DATA_RATE_IN_INI = 5,
382 STR_TX_POWER_IN_INI = 6,
383 STR_FRAG_THRESHOLD_IN_INI = 7,
384 STR_RTS_THRESHOLD_IN_INI = 8,
385 STR_COUNTRY_CODE_IN_INI = 9,
386 STR_INTRA_BSS_FORWARD_IN_INI = 10,
387 STR_WMM_IN_INI = 11,
388 STR_802DOT11D_IN_INI = 12,
389 STR_HT_80211N = 13,
390 STR_CTRL_INTERFACE = 14,
391 STR_INTERFACE = 15,
392 STR_EAP_SERVER = 16,
393 STR_AP_AUTOSHUTOFF = 17,
394 STR_AP_ENERGY_DETECT_TH = 18,
395 eSTR_LAST
396} esap_str_t;
397
398/** Supported security mode */
399typedef enum sec_mode {
400 SEC_MODE_NONE = 0,
401 SEC_MODE_WEP = 1,
402 SEC_MODE_WPA_PSK = 2,
403 SEC_MODE_WPA2_PSK = 3,
404 SEC_MODE_WPA_WPA2_PSK = 4,
405
406 SEC_MODE_INVALID
407} sec_mode_t;
408
409/** security mode in the configuration file */
410enum wpa_in_conf_file {
411 WPA_IN_CONF_FILE = 1,
412 WPA2_IN_CONF_FILE = 2,
413 WPA_WPA2_IN_CONF_FILE = 3
414};
415
416enum {
417 DISABLE = 0,
418 ENABLE = 1
419};
420
421enum {
422 FALSE = 0,
423 TRUE = 1
424};
425
426/** IEEE 802.11 operating mode */
427enum oper_mode {
428 HW_MODE_B = 0,
429 HW_MODE_G = 1,
430 HW_MODE_N = 2,
431 HW_MODE_G_ONLY = 3,
432 HW_MODE_N_ONLY = 4,
Santosh Sajjanc463f732011-12-22 18:24:56 +0530433 HW_MODE_A = 5,
Purushottam Kushwaha2ef0af22018-05-31 13:32:10 +0530434 HW_MODE_ANY = 6,
Dedy Lansky59c014f2019-08-08 09:58:36 +0300435 HW_MODE_AD = 7,
Raj Kushwaha41027212010-10-13 00:11:12 -0700436
437 HW_MODE_UNKNOWN
438};
439
440/** Authentication algorithm */
441enum auth_alg {
442 AHTH_ALG_OPEN = 1,
443 AUTH_ALG_SHARED = 2,
444 AUTH_ALG_OPEN_SHARED = 3,
445
446 AUTH_ALG_INVALID
447};
448
449/** Allow or Deny MAC address list selection */
450enum macaddr_acl {
451 ACL_DENY_LIST = 0,
Sameer Thalappilcaf87922012-01-30 16:56:29 -0800452 ACL_ALLOW_LIST = 1,
453 ACL_ALLOW_AND_DENY_LIST = 2
Raj Kushwaha41027212010-10-13 00:11:12 -0700454};
455
456enum ap_reset {
457 SAP_RESET_BSS = 0,
458 SAP_RESET_DRIVER_BSS = 1,
459 SAP_STOP_BSS = 2,
460 SAP_STOP_DRIVER_BSS = 3,
Sameer Thalappilcaf87922012-01-30 16:56:29 -0800461#ifdef QCOM_WLAN_CONCURRENCY
462 SAP_INITAP = 4,
463 SAP_EXITAP = 5,
464#endif
Raj Kushwaha41027212010-10-13 00:11:12 -0700465 SAP_RESET_INVALID
466};
467
468enum wmm_state {
Raj Kushwahaae27f822010-11-14 17:47:11 -0800469 WMM_AUTO_IN_INI = 0,
Raj Kushwaha41027212010-10-13 00:11:12 -0700470 WMM_ENABLED_IN_INI = 1,
471 WMM_DISABLED_IN_INI = 2
472};
473
474enum wps_state {
475 WPS_STATE_DISABLE = 0,
476 WPS_STATE_ENABLE = 2
477};
478
479
480enum wps_config {
481 WPS_CONFIG_PBC = 0,
482 WPS_CONFIG_PIN = 1,
483};
484
485/** Choose the configuration file */
486enum eChoose_conf_file {
Santosh Sajjan47e3a842011-12-10 21:11:12 +0530487 HOSTAPD_CONF_QCOM_FILE = 0,
Raj Kushwaha41027212010-10-13 00:11:12 -0700488 INI_CONF_FILE = 1
489};
490
Raj Kushwahaae27f822010-11-14 17:47:11 -0800491struct Command
492{
493 s8 * name;
494 s8 * default_value;
495};
496
Deepthi Gowri684d2f92012-05-23 23:28:16 +0530497/** STA Channel information*/
498typedef struct sta_channel_info {
499 int subioctl;
500 int stastartchan;
501 int staendchan;
502 int staband;
503} sta_channel_info;
504
505/**SAP Channel information*/
506typedef struct sap_channel_info {
507 int startchan;
508 int endchan;
509 int band;
510} sap_channel_info;
511
Deepthi Gowri6ce57562012-06-27 01:18:15 +0530512/**SAP auto Channel information*/
513typedef struct sap_auto_channel_info {
514 int subioctl;
515} sap_auto_channel_info;
516
Raj Kushwaha41027212010-10-13 00:11:12 -0700517/** Validate enable / disable softap */
518#define IS_VALID_SOFTAP_ENABLE(x) (((value == ENABLE) || (value == DISABLE)) ? TRUE: FALSE)
519
520/** Validate the channel */
521#define IS_VALID_CHANNEL(x) ((value >= CHANNEL_MIN) && (value <= CHANNEL_MAX) ? TRUE : FALSE)
522
523/** Validate the security mode */
524#define IS_VALID_SEC_MODE(x) (((x >= SEC_MODE_NONE) && (x < SEC_MODE_INVALID)) ? TRUE : FALSE)
525
526/** Validate the selection of access or deny MAC address list */
Sameer Thalappilcaf87922012-01-30 16:56:29 -0800527#define IS_VALID_MAC_ACL(x) (((x==ACL_DENY_LIST) || (x==ACL_ALLOW_LIST) || (x==ACL_ALLOW_AND_DENY_LIST)) ? TRUE : FALSE)
Raj Kushwaha41027212010-10-13 00:11:12 -0700528
529/** Validate the broadcast SSID status */
530#define IS_VALID_BSSID(x) (((value == ENABLE) || (value == DISABLE)) ? TRUE: FALSE)
531
532/** Validate the length of the passphrase */
Abhishek Srivastava80064982017-08-03 19:05:17 +0530533#define IS_VALID_PASSPHRASE_LEN(x) ((((x >= PASSPHRASE_MIN) && (x <= PASSPHRASE_MAX)) || (x == 0)) ? TRUE: FALSE)
Raj Kushwaha41027212010-10-13 00:11:12 -0700534
535/** Validate the beacon interval */
536#define IS_VALID_BEACON(x) (((x >= BCN_INTERVAL_MIN) && (x <= BCN_INTERVAL_MAX)) ? TRUE: FALSE)
537
538/** Validate the DTIM period */
539#define IS_VALID_DTIM_PERIOD(x) (((x >= DTIM_PERIOD_MIN) && (x <= DTIM_PERIOD_MAX)) ? TRUE: FALSE)
540
541/** Validate the WEP index */
542#define IS_VALID_WEP_KEY_IDX(x) ((x >= 0) && (x < 4) ? TRUE : FALSE)
543
544/** Validate the pairwise encryption */
545#define IS_VALID_PAIRWISE(x) (((!strcmp(x, "TKIP")) || (!strcmp(x, "CCMP")) || \
Dedy Lansky59c014f2019-08-08 09:58:36 +0300546 (!strcmp(x, "TKIP CCMP")) || (!strcmp(x, "CCMP TKIP")) || (!strcmp(x, "GCMP"))) ? TRUE : FALSE)
Raj Kushwaha41027212010-10-13 00:11:12 -0700547
548/** Validate the WMM status */
Raj Kushwahaae27f822010-11-14 17:47:11 -0800549#define IS_VALID_WMM_STATE(x) (((x >= WMM_AUTO_IN_INI) && (x <= WMM_DISABLED_IN_INI)) ? TRUE: FALSE)
Raj Kushwaha41027212010-10-13 00:11:12 -0700550
551/** Validate the WPS status */
552#define IS_VALID_WPS_STATE(x) (((x == ENABLE) || (x == DISABLE)) ? TRUE: FALSE)
553
554/** Validate the fragmentation threshold */
555#define IS_VALID_FRAG_THRESHOLD(x) (((x >= FRAG_THRESHOLD_MIN) && (x <= FRAG_THRESHOLD_MAX)) ? TRUE: FALSE)
556
557/** Validate the RTS threshold value */
558#define IS_VALID_RTS_THRESHOLD(x) (((x >= RTS_THRESHOLD_MIN) && (x <= RTS_THRESHOLD_MAX)) ? TRUE: FALSE)
559
560/** Validate the GTK */
561#define IS_VALID_GTK(x) ((x >= GTK_MIN) ? TRUE: FALSE)
562
563/** Validate the intra-bss forwarding status */
564#define IS_VALID_INTRA_BSS_STATUS(x) (((x == ENABLE) || (x == DISABLE)) ? TRUE: FALSE)
565
566/** Validate the protection flag */
567#define IS_VALID_PROTECTION(x) (((x == ENABLE) || (x == DISABLE)) ? TRUE: FALSE)
568
569/** Validate the UUID length */
570#define IS_VALID_UUID_LEN(x) (((x >= MIN_UUID_LEN) && (x <= MAX_UUID_LEN)) ? TRUE : FALSE)
571
572/** Validate the device name length */
573#define IS_VALID_DEVICENAME_LEN(x) (((x >= MIN_DEVICENAME_LEN) && (x <= MAX_DEVICENAME_LEN)) ? TRUE : FALSE)
574
575/** Validate the Manufacturer length */
576#define IS_VALID_MANUFACTURER_LEN(x) (((x >= MIN_MANUFACTURER_LEN) && (x <= MAX_MANUFACTURER_LEN)) ? TRUE : FALSE)
577
578/** Validate the Model name length */
579#define IS_VALID_MODELNAME_LEN(x) (((x >= MIN_MODELNAME_LEN) && (x <= MAX_MODELNAME_LEN)) ? TRUE : FALSE)
580
581/** Validate the Model number length */
582#define IS_VALID_MODELNUM_LEN(x) (((x >= MIN_MODELNUM_LEN) && (x <= MAX_MODELNUM_LEN)) ? TRUE : FALSE)
583
584/** Validate the Model serial number length */
585#define IS_VALID_SERIALNUM_LEN(x) (((x >= MIN_SERIALNUM_LEN) && (x <= MAX_SERIALNUM_LEN)) ? TRUE : FALSE)
586
587/** Validate the Primary device type length */
588#define IS_VALID_DEV_TYPE_LEN(x) (((x >= MIN_DEV_TYPE_LEN) && (x <= MAX_DEV_TYPE_LEN)) ? TRUE : FALSE)
589
590/** Validate the OS version length */
591#define IS_VALID_OS_VERSION_LEN(x) (((x >= MIN_OS_VERSION_LEN) && (x <= MAX_OS_VERSION_LEN)) ? TRUE : FALSE)
592
593/** Validate the friendly name length */
594#define IS_VALID_FRIENDLY_NAME_LEN(x) (((x >= MIN_FRIENDLY_NAME_LEN) && (x <= MAX_FRIENDLY_NAME_LEN)) ? TRUE : FALSE)
595
596/** Validate the URL length */
597#define IS_VALID_URL_LEN(x) (((x > 0) && (x <= MAX_URL_LEN)) ? TRUE : FALSE)
598
599/** Validate the model description length */
600#define IS_VALID_MODEL_DESC_LEN(x) (((x > MIN_MODEL_DESC_LEN) && (x <= MAX_MODEL_DESC_LEN)) ? TRUE : FALSE)
601
602/** Validate the Universal Product Code (UPC) length */
603#define IS_VALID_UPC_LEN(x) (((x > MIN_UPC_LEN) && (x <= MAX_UPC_LEN)) ? TRUE : FALSE)
604
605/** Validate the Tx power index */
606#define IS_VALID_TX_POWER(x) (((x >= MIN_TX_POWER ) && (x <= MAX_TX_POWER)) ? TRUE : FALSE)
607
608/** Validate the Data rate */
609#define IS_VALID_DATA_RATE_IDX(x) (((x >= MIN_DATA_RATE_IDX) && (x <= MAX_DATA_RATE_IDX)) ? TRUE : FALSE )
610
611/** Validate WPS config */
612#define IS_VALID_WPS_CONFIG(x) (((x == WPS_CONFIG_PBC) || (x == WPS_CONFIG_PIN)) ? TRUE : FALSE)
613
614/** Validate the 802dot11d state */
615#define IS_VALID_802DOT11D_STATE(x) (((x == ENABLE) || (x == DISABLE)) ? TRUE: FALSE)
616
617/** Validate the AP shutoff time */
618#define IS_VALID_APSHUTOFFTIME(x) (((x >= AP_SHUTOFF_MIN) && (x <= AP_SHUTOFF_MAX)) ? TRUE : FALSE)
619
620/** Validate the AP shutoff time */
Raj Kushwahaae27f822010-11-14 17:47:11 -0800621#define IS_VALID_ENERGY_DETECT_TH(x) ((((x >= AP_ENERGY_DETECT_TH_MIN) && (x <= AP_ENERGY_DETECT_TH_MAX)) ||( x == 128)) ? TRUE : FALSE)
Raj Kushwaha41027212010-10-13 00:11:12 -0700622
Pradeep Reddy POTTETI5c1a3ab2016-01-07 20:01:40 +0530623/** Validate the 802dot11h state */
624#define IS_VALID_DFS_STATE(x) (((x == ENABLE) || (x == DISABLE)) ? TRUE: FALSE)
625
Raj Kushwaha41027212010-10-13 00:11:12 -0700626/** Function declartion */
c_rrajive629e822015-07-20 15:21:20 +0530627int qsap_hostd_exec(int argc, char ** argv);
Raj Kushwaha41027212010-10-13 00:11:12 -0700628void qsap_hostd_exec_cmd(s8 *pcmd, s8 *presp, u32 *plen);
Raj Kushwahaae27f822010-11-14 17:47:11 -0800629s8 *qsap_get_config_value(s8 *pfile, struct Command *pcmd, s8 *pbuf, u32 *plen);
Raj Kushwaha41027212010-10-13 00:11:12 -0700630int qsapsetSoftap(int argc, char *argv[]);
Nalla Kartheekf4eef252016-04-29 18:09:35 +0530631int qsap_add_or_remove_interface(const char *iface_name, int create_iface);
Raj Kushwaha41027212010-10-13 00:11:12 -0700632void qsap_del_ctrl_iface(void);
Raj Kushwahaae27f822010-11-14 17:47:11 -0800633s16 wifi_qsap_reset_to_default(s8 *pcfgfile, s8 *pdefault);
634void check_for_configuration_files(void);
Yunsen Wang458db7c2011-11-15 21:23:32 -0800635void qsap_set_ini_filename(void);
Deepthi Gowri684d2f92012-05-23 23:28:16 +0530636int qsap_set_channel_range(s8 * cmd);
Deepthi Gowri6ce57562012-06-27 01:18:15 +0530637int qsap_get_sap_auto_channel_slection(s32 *pautochan);
Mingcheng Zhu69b91cc2013-11-23 00:37:03 -0800638int qsap_get_mode(s32 *pmode);
Hamad Kadmany421ce6f2016-06-12 12:24:38 +0300639int qsap_prepare_softap(void);
640int qsap_unprepare_softap(void);
641int qsap_is_fst_enabled(void);
Ajit Vaishya5d72c3a2017-07-15 20:22:10 +0530642int qsap_control_bridge(int argc, char ** argv);
Purushottam Kushwaha0e5ec062017-07-21 22:11:45 +0530643int linux_get_ifhwaddr(const char *ifname, char *addr);
Raj Kushwaha41027212010-10-13 00:11:12 -0700644
645#if __cplusplus
646}; // extern "C"
647#endif
648
649#endif
650