SimpleLink CC3100/CC3200 Host Driver  Version 1.0.1.6
Simplifies the implementation of Internet connectivity
wlan.h
1 /*
2  * wlan.h - CC31xx/CC32xx Host Driver Implementation
3  *
4  * Copyright (C) 2015 Texas Instruments Incorporated - https://www.ti.com/
5  *
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
14  * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the
17  * distribution.
18  *
19  * Neither the name of Texas Instruments Incorporated nor the names of
20  * its contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  *
35 */
36 
37 /*****************************************************************************/
38 /* Include files */
39 /*****************************************************************************/
40 #include "simplelink.h"
41 
42 #ifndef __WLAN_H__
43 #define __WLAN_H__
44 
45 
46 
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 
53 /*****************************************************************************/
54 /* Macro declarations */
55 /*****************************************************************************/
56 
64 #define SL_BSSID_LENGTH (6)
65 #define MAXIMAL_SSID_LENGTH (32)
66 
67 #define NUM_OF_RATE_INDEXES (20)
68 #define SIZE_OF_RSSI_HISTOGRAM (6)
69 
70 /* WLAN Disconnect Reason Codes */
71 #define SL_WLAN_DISCONNECT_UNSPECIFIED_REASON (1)
72 #define SL_WLAN_DISCONNECT_PREV_AUTH_NOT_VALID (2)
73 #define SL_WLAN_DISCONNECT_DEAUTH_LEAVING (3)
74 #define SL_WLAN_DISCONNECT_DISASSOC_DUE_TO_INACTIVITY (4)
75 #define SL_WLAN_DISCONNECT_DISASSOC_AP_BUSY (5)
76 #define SL_WLAN_DISCONNECT_CLASS2_FRAME_FROM_NONAUTH_STA (6)
77 #define SL_WLAN_DISCONNECT_CLASS3_FRAME_FROM_NONASSOC_STA (7)
78 #define SL_WLAN_DISCONNECT_DISASSOC_STA_HAS_LEFT (8)
79 #define SL_WLAN_DISCONNECT_STA_REQ_ASSOC_WITHOUT_AUTH (9)
80 #define SL_WLAN_DISCONNECT_PWR_CAPABILITY_NOT_VALID (10)
81 #define SL_WLAN_DISCONNECT_SUPPORTED_CHANNEL_NOT_VALID (11)
82 #define SL_WLAN_DISCONNECT_INVALID_IE (13)
83 #define SL_WLAN_DISCONNECT_MIC_FAILURE (14)
84 #define SL_WLAN_DISCONNECT_4WAY_HANDSHAKE_TIMEOUT (15)
85 #define SL_WLAN_DISCONNECT_GROUP_KEY_UPDATE_TIMEOUT (16)
86 #define SL_WLAN_DISCONNECT_IE_IN_4WAY_DIFFERS (17)
87 #define SL_WLAN_DISCONNECT_GROUP_CIPHER_NOT_VALID (18)
88 #define SL_WLAN_DISCONNECT_PAIRWISE_CIPHER_NOT_VALID (19)
89 #define SL_WLAN_DISCONNECT_AKMP_NOT_VALID (20)
90 #define SL_WLAN_DISCONNECT_UNSUPPORTED_RSN_IE_VERSION (21)
91 #define SL_WLAN_DISCONNECT_INVALID_RSN_IE_CAPAB (22)
92 #define SL_WLAN_DISCONNECT_IEEE_802_1X_AUTH_FAILED (23)
93 #define SL_WLAN_DISCONNECT_CIPHER_SUITE_REJECTED (24)
94 #define SL_WLAN_DISCONNECT_DISASSOC_LOW_ACK (34)
95 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_NONE (100)
96 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_LOW_TX_RATE (104)
97 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_LOW_SNR (105)
98 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_LOW_QUALITY (106)
99 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_TSPEC_REJECTED (107)
100 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_MAX_TX_RETRIES (108)
101 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_BSS_LOSS (109)
102 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_BSS_LOSS_DUE_TO_MAX_TX_RETRY (110)
103 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_SWITCH_CHANNEL (111)
104 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_AP_DISCONNECT (112)
105 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_SECURITY_ATTACK (113)
106 #define SL_WLAN_DISCONNECT_USER_INITIATED_DISCONNECTION (200)
107 
108 
109 /* Wlan error codes */
110 #define SL_ERROR_KEY_ERROR (-3)
111 #define SL_ERROR_INVALID_ROLE (-71)
112 #define SL_ERROR_INVALID_SECURITY_TYPE (-84)
113 #define SL_ERROR_PASSPHRASE_TOO_LONG (-85)
114 #define SL_ERROR_WPS_NO_PIN_OR_WRONG_PIN_LEN (-87)
115 #define SL_ERROR_EAP_WRONG_METHOD (-88)
116 #define SL_ERROR_PASSWORD_ERROR (-89)
117 #define SL_ERROR_EAP_ANONYMOUS_LEN_ERROR (-90)
118 #define SL_ERROR_SSID_LEN_ERROR (-91)
119 #define SL_ERROR_USER_ID_LEN_ERROR (-92)
120 #define SL_ERROR_ILLEGAL_WEP_KEY_INDEX (-95)
121 #define SL_ERROR_INVALID_DWELL_TIME_VALUES (-96)
122 #define SL_ERROR_INVALID_POLICY_TYPE (-97)
123 #define SL_ERROR_PM_POLICY_INVALID_OPTION (-98)
124 #define SL_ERROR_PM_POLICY_INVALID_PARAMS (-99)
125 #define SL_ERROR_WIFI_ALREADY_DISCONNECTED (-129)
126 #define SL_ERROR_WIFI_NOT_CONNECTED (-59)
127 
128 
129 
130 #define SL_SEC_TYPE_OPEN (0)
131 #define SL_SEC_TYPE_WEP (1)
132 #define SL_SEC_TYPE_WPA (2) /* deprecated */
133 #define SL_SEC_TYPE_WPA_WPA2 (2)
134 #define SL_SEC_TYPE_WPS_PBC (3)
135 #define SL_SEC_TYPE_WPS_PIN (4)
136 #define SL_SEC_TYPE_WPA_ENT (5)
137 #define SL_SEC_TYPE_P2P_PBC (6)
138 #define SL_SEC_TYPE_P2P_PIN_KEYPAD (7)
139 #define SL_SEC_TYPE_P2P_PIN_DISPLAY (8)
140 #define SL_SEC_TYPE_P2P_PIN_AUTO (9) /* NOT Supported yet */
141 
142 
143 
144 #define SL_SCAN_SEC_TYPE_OPEN (0)
145 #define SL_SCAN_SEC_TYPE_WEP (1)
146 #define SL_SCAN_SEC_TYPE_WPA (2)
147 #define SL_SCAN_SEC_TYPE_WPA2 (3)
148 
149 
150 #define TLS (0x1)
151 #define MSCHAP (0x0)
152 #define PSK (0x2)
153 #define TTLS (0x10)
154 #define PEAP0 (0x20)
155 #define PEAP1 (0x40)
156 #define FAST (0x80)
157 
158 #define FAST_AUTH_PROVISIONING (0x02)
159 #define FAST_UNAUTH_PROVISIONING (0x01)
160 #define FAST_NO_PROVISIONING (0x00)
161 
162 #define EAPMETHOD_PHASE2_SHIFT (8)
163 #define EAPMETHOD_PAIRWISE_CIPHER_SHIFT (19)
164 #define EAPMETHOD_GROUP_CIPHER_SHIFT (27)
165 
166 #define WPA_CIPHER_CCMP (0x1)
167 #define WPA_CIPHER_TKIP (0x2)
168 #define CC31XX_DEFAULT_CIPHER (WPA_CIPHER_CCMP | WPA_CIPHER_TKIP)
169 
170 #define EAPMETHOD(phase1,phase2,pairwise_cipher,group_cipher) \
171 ((phase1) | \
172  ((phase2) << EAPMETHOD_PHASE2_SHIFT ) |\
173  ((_u32)(pairwise_cipher) << EAPMETHOD_PAIRWISE_CIPHER_SHIFT ) |\
174  ((_u32)(group_cipher) << EAPMETHOD_GROUP_CIPHER_SHIFT ))
175 
176 /* phase1 phase2 pairwise_cipher group_cipher */
177 #define SL_ENT_EAP_METHOD_TLS EAPMETHOD(TLS , 0 , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
178 #define SL_ENT_EAP_METHOD_TTLS_TLS EAPMETHOD(TTLS , TLS , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
179 #define SL_ENT_EAP_METHOD_TTLS_MSCHAPv2 EAPMETHOD(TTLS , MSCHAP , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
180 #define SL_ENT_EAP_METHOD_TTLS_PSK EAPMETHOD(TTLS , PSK , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
181 #define SL_ENT_EAP_METHOD_PEAP0_TLS EAPMETHOD(PEAP0 , TLS , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
182 #define SL_ENT_EAP_METHOD_PEAP0_MSCHAPv2 EAPMETHOD(PEAP0 , MSCHAP , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
183 #define SL_ENT_EAP_METHOD_PEAP0_PSK EAPMETHOD(PEAP0 , PSK , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
184 #define SL_ENT_EAP_METHOD_PEAP1_TLS EAPMETHOD(PEAP1 , TLS , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
185 #define SL_ENT_EAP_METHOD_PEAP1_MSCHAPv2 EAPMETHOD(PEAP1 , MSCHAP , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
186 #define SL_ENT_EAP_METHOD_PEAP1_PSK EAPMETHOD(PEAP1 , PSK , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
187 #define SL_ENT_EAP_METHOD_FAST_AUTH_PROVISIONING EAPMETHOD(FAST , FAST_AUTH_PROVISIONING , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
188 #define SL_ENT_EAP_METHOD_FAST_UNAUTH_PROVISIONING EAPMETHOD(FAST , FAST_UNAUTH_PROVISIONING , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
189 #define SL_ENT_EAP_METHOD_FAST_NO_PROVISIONING EAPMETHOD(FAST , FAST_NO_PROVISIONING , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
190 
191 #define SL_LONG_PREAMBLE (0)
192 #define SL_SHORT_PREAMBLE (1)
193 
194 #define SL_RAW_RF_TX_PARAMS_CHANNEL_SHIFT (0)
195 #define SL_RAW_RF_TX_PARAMS_RATE_SHIFT (6)
196 #define SL_RAW_RF_TX_PARAMS_POWER_SHIFT (11)
197 #define SL_RAW_RF_TX_PARAMS_PREAMBLE_SHIFT (15)
198 
199 #define SL_RAW_RF_TX_PARAMS(chan,rate,power,preamble) \
200  ((chan << SL_RAW_RF_TX_PARAMS_CHANNEL_SHIFT) | \
201  (rate << SL_RAW_RF_TX_PARAMS_RATE_SHIFT) | \
202  (power << SL_RAW_RF_TX_PARAMS_POWER_SHIFT) | \
203  (preamble << SL_RAW_RF_TX_PARAMS_PREAMBLE_SHIFT))
204 
205 
206 /* wlan config application IDs */
207 #define SL_WLAN_CFG_AP_ID (0)
208 #define SL_WLAN_CFG_GENERAL_PARAM_ID (1)
209 #define SL_WLAN_CFG_P2P_PARAM_ID (2)
210 
211 /* wlan AP Config set/get options */
212 #define WLAN_AP_OPT_SSID (0)
213 #define WLAN_AP_OPT_CHANNEL (3)
214 #define WLAN_AP_OPT_HIDDEN_SSID (4)
215 #define WLAN_AP_OPT_SECURITY_TYPE (6)
216 #define WLAN_AP_OPT_PASSWORD (7)
217 #define WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE (9)
218 #define WLAN_GENERAL_PARAM_OPT_STA_TX_POWER (10)
219 #define WLAN_GENERAL_PARAM_OPT_AP_TX_POWER (11)
220 
221 #define WLAN_P2P_OPT_DEV_NAME (12)
222 #define WLAN_P2P_OPT_DEV_TYPE (13)
223 #define WLAN_P2P_OPT_CHANNEL_N_REGS (14)
224 #define WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT (16)
225 #define WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS (18) /* change the scan channels and RSSI threshold using this configuration option */
226 
227 /* SmartConfig CIPHER options */
228 #define SMART_CONFIG_CIPHER_SFLASH (0) /* password is not delivered by the application. The Simple Manager should */
229  /* check if the keys are stored in the Flash. */
230 #define SMART_CONFIG_CIPHER_AES (1) /* AES (other types are not supported) */
231 #define SMART_CONFIG_CIPHER_NONE (0xFF) /* do not check in the flash */
232 
233 
234 #define SL_POLICY_CONNECTION (0x10)
235 #define SL_POLICY_SCAN (0x20)
236 #define SL_POLICY_PM (0x30)
237 #define SL_POLICY_P2P (0x40)
238 
239 #define VAL_2_MASK(position,value) ((1 & (value))<<(position))
240 #define MASK_2_VAL(position,mask) (((1 << position) & (mask)) >> (position))
241 
242 #define SL_CONNECTION_POLICY(Auto,Fast,Open,anyP2P,autoSmartConfig) (VAL_2_MASK(0,Auto) | VAL_2_MASK(1,Fast) | VAL_2_MASK(2,Open) | VAL_2_MASK(3,anyP2P) | VAL_2_MASK(4,autoSmartConfig))
243 #define SL_SCAN_POLICY_EN(policy) (MASK_2_VAL(0,policy))
244 #define SL_SCAN_POLICY(Enable) (VAL_2_MASK(0,Enable))
245 
246 
247 #define SL_NORMAL_POLICY (0)
248 #define SL_LOW_LATENCY_POLICY (1)
249 #define SL_LOW_POWER_POLICY (2)
250 #define SL_ALWAYS_ON_POLICY (3)
251 #define SL_LONG_SLEEP_INTERVAL_POLICY (4)
252 
253 #define SL_P2P_ROLE_NEGOTIATE (3)
254 #define SL_P2P_ROLE_GROUP_OWNER (15)
255 #define SL_P2P_ROLE_CLIENT (0)
256 
257 #define SL_P2P_NEG_INITIATOR_ACTIVE (0)
258 #define SL_P2P_NEG_INITIATOR_PASSIVE (1)
259 #define SL_P2P_NEG_INITIATOR_RAND_BACKOFF (2)
260 
261 #define POLICY_VAL_2_OPTIONS(position,mask,policy) ((mask & policy) << position )
262 
263 #define SL_P2P_POLICY(p2pNegType,p2pNegInitiator) (POLICY_VAL_2_OPTIONS(0,0xF,(p2pNegType > SL_P2P_ROLE_GROUP_OWNER ? SL_P2P_ROLE_GROUP_OWNER : p2pNegType)) | \
264  POLICY_VAL_2_OPTIONS(4,0x1,(p2pNegType > SL_P2P_ROLE_GROUP_OWNER ? 1:0)) | \
265  POLICY_VAL_2_OPTIONS(5,0x3, p2pNegInitiator))
266 
267 
268 /* Info elements */
269 
270 #define INFO_ELEMENT_DEFAULT_ID (0) /* 221 will be used */
271 
272 /* info element size is up to 252 bytes (+ 3 bytes of OUI). */
273 #define INFO_ELEMENT_MAX_SIZE (252)
274 
275 /* For AP - the total length of all info elements is 300 bytes (for example - 4 info elements of 75 bytes each) */
276 #define INFO_ELEMENT_MAX_TOTAL_LENGTH_AP (300)
277 /* For P2P - the total length of all info elements is 150 bytes (for example - 4 info elements of 40 bytes each) */
278 #define INFO_ELEMENT_MAX_TOTAL_LENGTH_P2P_GO (160)
279 
280 #define INFO_ELEMENT_AP_ROLE (0)
281 #define INFO_ELEMENT_P2P_GO_ROLE (1)
282 
283 /* we support up to 4 info elements per Role. */
284 #define MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED (4)
285 
286 #define INFO_ELEMENT_DEFAULT_OUI_0 (0x08)
287 #define INFO_ELEMENT_DEFAULT_OUI_1 (0x00)
288 #define INFO_ELEMENT_DEFAULT_OUI_2 (0x28)
289 
290 #define INFO_ELEMENT_DEFAULT_OUI (0x000000) /* 08, 00, 28 will be used */
291 
292 
293 
294 
295 /**************************************************
296 For backward compatability (version 1.0.0.10)
297 **************************************************/
298 #define SL_DISCONNECT_UNSPECIFIED_REASON SL_WLAN_DISCONNECT_UNSPECIFIED_REASON
299 #define SL_PREVIOUS_AUTHENTICATION_NO_LONGER_VALID SL_WLAN_DISCONNECT_PREV_AUTH_NOT_VALID
300 #define SL_DEAUTHENTICATED_BECAUSE_SENDING_STATION_IS_LEAVING SL_WLAN_DISCONNECT_DEAUTH_LEAVING
301 #define SL_DISASSOCIATED_DUE_TO_INACTIVITY SL_WLAN_DISCONNECT_DISASSOC_DUE_TO_INACTIVITY
302 #define SL_DISASSOCIATED_BECAUSE_AP_IS_UNABLE_TO_HANDLE_ALL_CURRENTLY_ASSOCIATED_STATIONS SL_WLAN_DISCONNECT_DISASSOC_AP_BUSY
303 #define SL_CLASS_2_FRAME_RECEIVED_FROM_NONAUTHENTICATED_STATION SL_WLAN_DISCONNECT_CLASS2_FRAME_FROM_NONAUTH_STA
304 #define SL_CLASS_3_FRAME_RECEIVED_FROM_NONASSOCIATED_STATION SL_WLAN_DISCONNECT_CLASS3_FRAME_FROM_NONASSOC_STA
305 #define SL_DISASSOCIATED_BECAUSE_SENDING_STATION_IS_LEAVING_BSS SL_WLAN_DISCONNECT_DISASSOC_STA_HAS_LEFT
306 #define SL_STATION_REQUESTING_ASSOCIATION_IS_NOT_AUTHENTICATED_WITH_RESPONDING_STATION SL_WLAN_DISCONNECT_STA_REQ_ASSOC_WITHOUT_AUTH
307 #define SL_DISASSOCIATED_BECAUSE_THE_INFORMATION_IN_THE_POWER_CAPABILITY_ELEMENT_IS_UNACCEPTABLE SL_WLAN_DISCONNECT_PWR_CAPABILITY_NOT_VALID
308 #define SL_DISASSOCIATED_BECAUSE_THE_INFORMATION_IN_THE_SUPPORTED_CHANNELS_ELEMENT_IS_UNACCEPTABLE SL_WLAN_DISCONNECT_SUPPORTED_CHANNEL_NOT_VALID
309 #define SL_INVALID_INFORMATION_ELEMENT SL_WLAN_DISCONNECT_INVALID_IE
310 #define SL_MESSAGE_INTEGRITY_CODE_MIC_FAILURE SL_WLAN_DISCONNECT_MIC_FAILURE
311 #define SL_FOUR_WAY_HANDSHAKE_TIMEOUT SL_WLAN_DISCONNECT_4WAY_HANDSHAKE_TIMEOUT
312 #define SL_GROUP_KEY_HANDSHAKE_TIMEOUT SL_WLAN_DISCONNECT_GROUP_KEY_UPDATE_TIMEOUT
313 #define SL_RE_ASSOCIATION_REQUEST_PROBE_RESPONSE_BEACON_FRAME SL_WLAN_DISCONNECT_IE_IN_4WAY_DIFFERS
314 #define SL_INVALID_GROUP_CIPHER SL_WLAN_DISCONNECT_GROUP_CIPHER_NOT_VALID
315 #define SL_INVALID_PAIRWISE_CIPHER SL_WLAN_DISCONNECT_PAIRWISE_CIPHER_NOT_VALID
316 #define SL_INVALID_AKMP SL_WLAN_DISCONNECT_AKMP_NOT_VALID
317 #define SL_UNSUPPORTED_RSN_INFORMATION_ELEMENT_VERSION SL_WLAN_DISCONNECT_UNSUPPORTED_RSN_IE_VERSION
318 #define SL_INVALID_RSN_INFORMATION_ELEMENT_CAPABILITIES SL_WLAN_DISCONNECT_INVALID_RSN_IE_CAPAB
319 #define SL_IEEE_802_1X_AUTHENTICATION_FAILED SL_WLAN_DISCONNECT_IEEE_802_1X_AUTH_FAILED
320 #define SL_CIPHER_SUITE_REJECTED_BECAUSE_OF_THE_SECURITY_POLICY SL_WLAN_DISCONNECT_CIPHER_SUITE_REJECTED
321 #define SL_USER_INITIATED_DISCONNECTION SL_WLAN_DISCONNECT_USER_INITIATED_DISCONNECTION
322 
323 
324 #define SL_DISCONNECT_RESERVED_0 (0)
325 #define SL_DISCONNECT_RESERVED_1 (12)
326 #define SL_DISCONNECT_RESERVED_2 (26)
327 #define SL_DISCONNECT_RESERVED_3 (27)
328 #define SL_DISCONNECT_RESERVED_4 (28)
329 #define SL_DISCONNECT_RESERVED_5 (29)
330 #define SL_DISCONNECT_RESERVED_6 (30)
331 #define SL_DISCONNECT_RESERVED_7 (31)
332 #define SL_DISCONNECT_RESERVED_8 (32)
333 
334 /******************************
335 End of backward compatability.
336 *******************************/
337 
338 
339 
340 /*****************************************************************************/
341 /* Structure/Enum declarations */
342 /*****************************************************************************/
343 
344 typedef enum
345 {
346  RATE_1M = 1,
347  RATE_2M = 2,
348  RATE_5_5M = 3,
349  RATE_11M = 4,
350  RATE_6M = 6,
351  RATE_9M = 7,
352  RATE_12M = 8,
353  RATE_18M = 9,
354  RATE_24M = 10,
355  RATE_36M = 11,
356  RATE_48M = 12,
357  RATE_54M = 13,
358  RATE_MCS_0 = 14,
359  RATE_MCS_1 = 15,
360  RATE_MCS_2 = 16,
361  RATE_MCS_3 = 17,
362  RATE_MCS_4 = 18,
363  RATE_MCS_5 = 19,
364  RATE_MCS_6 = 20,
365  RATE_MCS_7 = 21,
366  MAX_NUM_RATES = 0xFF
367 }SlRateIndex_e;
368 
369 typedef enum {
370  DEV_PW_DEFAULT=0,
371  DEV_PW_PIN_KEYPAD=1,
372  DEV_PW_PUSH_BUTTON=4,
373  DEV_PW_PIN_DISPLAY=5
374 } sl_p2p_dev_password_method;
375 
376 
377 typedef struct
378 {
379  _u32 status;
380  _u32 ssid_len;
381  _u8 ssid[32];
382  _u32 private_token_len;
383  _u8 private_token[32];
385 
386 typedef struct
387 {
388  _u16 status;
389  _u16 padding;
391 
392 typedef struct
393 {
394  _u16 status;
395  _u16 padding;
397 
398 typedef struct
399 {
400  _u8 connection_type;/* 0-STA,3-P2P_CL */
401  _u8 ssid_len;
402  _u8 ssid_name[32];
403  _u8 go_peer_device_name_len;
404  _u8 go_peer_device_name[32];
405  _u8 bssid[6];
406  _u8 reason_code;
407  _u8 padding[2];
409 
410 typedef struct
411 {
412  _u8 go_peer_device_name[32];
413  _u8 mac[6];
414  _u8 go_peer_device_name_len;
415  _u8 wps_dev_password_id;
416  _u8 own_ssid[32];/* relevant for event sta-connected only */
417  _u8 own_ssid_len;/* relevant for event sta-connected only */
418  _u8 padding[3];
420 
421 
422 typedef union
423 {
424  slSmartConfigStartAsyncResponse_t smartConfigStartResponse; /*SL_WLAN_SMART_CONFIG_COMPLETE_EVENT*/
425  slSmartConfigStopAsyncResponse_t smartConfigStopResponse; /*SL_WLAN_SMART_CONFIG_STOP_EVENT */
426  slPeerInfoAsyncResponse_t APModeStaConnected; /* SL_WLAN_STA_CONNECTED_EVENT - relevant only in AP mode - holds information regarding a new STA connection */
427  slPeerInfoAsyncResponse_t APModestaDisconnected; /* SL_WLAN_STA_DISCONNECTED_EVENT - relevant only in AP mode - holds information regarding a STA disconnection */
428  slWlanConnectAsyncResponse_t STAandP2PModeWlanConnected; /* SL_WLAN_CONNECT_EVENT - relevant only in STA and P2P mode - holds information regarding a new connection */
429  slWlanConnectAsyncResponse_t STAandP2PModeDisconnected; /* SL_WLAN_DISCONNECT_EVENT - relevant only in STA and P2P mode - holds information regarding a disconnection */
430  slPeerInfoAsyncResponse_t P2PModeDevFound; /* SL_WLAN_P2P_DEV_FOUND_EVENT - relevant only in P2P mode */
431  slPeerInfoAsyncResponse_t P2PModeNegReqReceived; /* SL_WLAN_P2P_NEG_REQ_RECEIVED_EVENT - relevant only in P2P mode */
432  slWlanConnFailureAsyncResponse_t P2PModewlanConnectionFailure; /* SL_WLAN_CONNECTION_FAILED_EVENT - relevant only in P2P mode */
433 
435 
436 typedef struct
437 {
438  _u32 Event;
439  SlWlanEventData_u EventData;
440 } SlWlanEvent_t;
441 
442 
443 typedef struct
444 {
445  _u32 ReceivedValidPacketsNumber; /* sum of the packets that been received OK (include filtered) */
446  _u32 ReceivedFcsErrorPacketsNumber; /* sum of the packets that been dropped due to FCS error */
447  _u32 ReceivedAddressMismatchPacketsNumber; /* sum of the packets that been received but filtered out by one of the HW filters */
448  _i16 AvarageDataCtrlRssi; /* average RSSI for all valid data packets received */
449  _i16 AvarageMgMntRssi; /* average RSSI for all valid management packets received */
450  _u16 RateHistogram[NUM_OF_RATE_INDEXES]; /* rate histogram for all valid packets received */
451  _u16 RssiHistogram[SIZE_OF_RSSI_HISTOGRAM]; /* RSSI histogram from -40 until -87 (all below and above\n RSSI will appear in the first and last cells */
452  _u32 StartTimeStamp; /* the time stamp started collecting the statistics in uSec */
453  _u32 GetTimeStamp; /* the time stamp called the get statistics command */
455 
456 
457 typedef struct
458 {
459  _u8 ssid[MAXIMAL_SSID_LENGTH];
460  _u8 ssid_len;
461  _u8 sec_type;
462  _u8 bssid[SL_BSSID_LENGTH];
463  _i8 rssi;
464  _i8 reserved[3];
466 
467 
468 typedef struct
469 {
470  _u8 Type;
471  _i8* Key;
472  _u8 KeyLen;
474 
475 typedef struct
476 {
477  _i8* User;
478  _u8 UserLen;
479  _i8* AnonUser;
480  _u8 AnonUserLen;
481  _u8 CertIndex; /* not supported */
482  _u32 EapMethod;
484 
485 typedef struct
486 {
487  _i8 User[32];
488  _u8 UserLen;
489  _i8 AnonUser[32];
490  _u8 AnonUserLen;
491  _u8 CertIndex; /* not supported */
492  _u32 EapMethod;
494 
495 typedef enum
496 {
497  ROLE_STA = 0,
498  ROLE_UNKNOWN = 1,
499  ROLE_AP = 2,
500  ROLE_P2P = 3,
501  ROLE_STA_ERR = -1, /* Failure to load MAC/PHY in STA role */
502  ROLE_AP_ERR = -2, /* Failure to load MAC/PHY in AP role */
503  ROLE_P2P_ERR = -3, /* Failure to load MAC/PHY in P2P role */
504  INIT_CALIB_FAIL = -4 /* Failure of calibration */
505 }SlWlanMode_e;
506 
507 
508 typedef struct
509 {
510  _u32 G_Channels_mask;
511  _i32 rssiThershold;
513 
514 
515 typedef struct
516 {
517  _u8 id;
518  _u8 oui[3];
519  _u16 length;
520  _u8 data[252];
522 
523 typedef struct
524 {
525  _u8 index; /* 0 - MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED */
526  _u8 role; /* bit0: AP = 0, GO = 1 */
529 
530 
531 /*****************************************************************************/
532 /* Function prototypes */
533 /*****************************************************************************/
534 
535 
561 #if _SL_INCLUDE_FUNC(sl_WlanConnect)
562 _i16 sl_WlanConnect(const _i8* pName,const _i16 NameLen,const _u8 *pMacAddr,const SlSecParams_t* pSecParams ,const SlSecParamsExt_t* pSecExtParams);
563 #endif
564 
576 #if _SL_INCLUDE_FUNC(sl_WlanDisconnect)
577 _i16 sl_WlanDisconnect(void);
578 #endif
579 
618 #if _SL_INCLUDE_FUNC(sl_WlanProfileAdd)
619 _i16 sl_WlanProfileAdd(const _i8* pName,const _i16 NameLen,const _u8 *pMacAddr,const SlSecParams_t* pSecParams ,const SlSecParamsExt_t* pSecExtParams,const _u32 Priority,const _u32 Options);
620 #endif
621 
650 #if _SL_INCLUDE_FUNC(sl_WlanProfileGet)
651 _i16 sl_WlanProfileGet(const _i16 Index,_i8* pName, _i16 *pNameLen, _u8 *pMacAddr, SlSecParams_t* pSecParams, SlGetSecParamsExt_t* pSecExtParams, _u32 *pPriority);
652 #endif
653 
669 #if _SL_INCLUDE_FUNC(sl_WlanProfileDel)
670 _i16 sl_WlanProfileDel(const _i16 Index);
671 #endif
672 
738 #if _SL_INCLUDE_FUNC(sl_WlanPolicySet)
739 _i16 sl_WlanPolicySet(const _u8 Type , const _u8 Policy, _u8 *pVal,const _u8 ValLen);
740 #endif
741 
761 #if _SL_INCLUDE_FUNC(sl_WlanPolicyGet)
762 _i16 sl_WlanPolicyGet(const _u8 Type , _u8 Policy,_u8 *pVal,_u8 *pValLen);
763 #endif
764 
792 #if _SL_INCLUDE_FUNC(sl_WlanGetNetworkList)
793 _i16 sl_WlanGetNetworkList(const _u8 Index,const _u8 Count, Sl_WlanNetworkEntry_t *pEntries);
794 #endif
795 
831 #if _SL_INCLUDE_FUNC(sl_WlanRxStatStart)
832 _i16 sl_WlanRxStatStart(void);
833 #endif
834 
835 
845 #if _SL_INCLUDE_FUNC(sl_WlanRxStatStop)
846 _i16 sl_WlanRxStatStop(void);
847 #endif
848 
849 
861 #if _SL_INCLUDE_FUNC(sl_WlanRxStatGet)
862 _i16 sl_WlanRxStatGet(SlGetRxStatResponse_t *pRxStat,const _u32 Flags);
863 #endif
864 
865 
880 #if _SL_INCLUDE_FUNC(sl_WlanSmartConfigStop)
881 _i16 sl_WlanSmartConfigStop(void);
882 #endif
883 
931 #if _SL_INCLUDE_FUNC(sl_WlanSmartConfigStart)
932 _i16 sl_WlanSmartConfigStart(const _u32 groupIdBitmask,
933  const _u8 cipher,
934  const _u8 publicKeyLen,
935  const _u8 group1KeyLen,
936  const _u8 group2KeyLen,
937  const _u8* publicKey,
938  const _u8* group1Key,
939  const _u8* group2Key);
940 #endif
941 
942 
965 #if _SL_INCLUDE_FUNC(sl_WlanSetMode)
966 _i16 sl_WlanSetMode(const _u8 mode);
967 #endif
968 
969 
1163 #if _SL_INCLUDE_FUNC(sl_WlanSet)
1164 _i16 sl_WlanSet(const _u16 ConfigId ,const _u16 ConfigOpt,const _u16 ConfigLen,const _u8 *pValues);
1165 #endif
1166 
1346 #if _SL_INCLUDE_FUNC(sl_WlanGet)
1347 _i16 sl_WlanGet(const _u16 ConfigId, _u16 *pConfigOpt,_u16 *pConfigLen, _u8 *pValues);
1348 #endif
1349 
1357 #ifdef __cplusplus
1358 }
1359 #endif /* __cplusplus */
1360 
1361 #endif /* __WLAN_H__ */
1362 
_i16 sl_WlanRxStatStart(void)
Start collecting wlan RX statistics, for unlimited time.
_i16 sl_WlanProfileGet(const _i16 Index, _i8 *pName, _i16 *pNameLen, _u8 *pMacAddr, SlSecParams_t *pSecParams, SlGetSecParamsExt_t *pSecExtParams, _u32 *pPriority)
get profile
_i16 sl_WlanProfileDel(const _i16 Index)
Delete WLAN profile.
_i16 sl_WlanPolicySet(const _u8 Type, const _u8 Policy, _u8 *pVal, const _u8 ValLen)
Set policy values.
_i16 sl_WlanGet(const _u16 ConfigId, _u16 *pConfigOpt, _u16 *pConfigLen, _u8 *pValues)
Internal function for getting WLAN configurations.
_i16 sl_WlanRxStatGet(SlGetRxStatResponse_t *pRxStat, const _u32 Flags)
Get wlan RX statistics. upon calling this command, the statistics counters will be cleared...
_i16 sl_WlanDisconnect(void)
wlan disconnect
Definition: wlan.h:457
_i16 sl_WlanPolicyGet(const _u8 Type, _u8 Policy, _u8 *pVal, _u8 *pValLen)
get policy values
_i16 sl_WlanSetMode(const _u8 mode)
Wlan set mode.
_i16 sl_WlanSmartConfigStart(const _u32 groupIdBitmask, const _u8 cipher, const _u8 publicKeyLen, const _u8 group1KeyLen, const _u8 group2KeyLen, const _u8 *publicKey, const _u8 *group1Key, const _u8 *group2Key)
Start Smart Config procedure.
_i16 sl_WlanGetNetworkList(const _u8 Index, const _u8 Count, Sl_WlanNetworkEntry_t *pEntries)
Gets the WLAN scan operation results.
_i16 sl_WlanSmartConfigStop(void)
Stop Smart Config procedure. Once Smart Config will be stopped, Asynchronous event will be received -...
_i16 sl_WlanSet(const _u16 ConfigId, const _u16 ConfigOpt, const _u16 ConfigLen, const _u8 *pValues)
Internal function for setting WLAN configurations.
_i16 sl_WlanRxStatStop(void)
Stop collecting wlan RX statistic, (if previous called sl_WlanRxStatStart)
_i16 sl_WlanConnect(const _i8 *pName, const _i16 NameLen, const _u8 *pMacAddr, const SlSecParams_t *pSecParams, const SlSecParamsExt_t *pSecExtParams)
Connect to wlan network as a station.
_i16 sl_WlanProfileAdd(const _i8 *pName, const _i16 NameLen, const _u8 *pMacAddr, const SlSecParams_t *pSecParams, const SlSecParamsExt_t *pSecExtParams, const _u32 Priority, const _u32 Options)
add profile