SimpleLink CC3120/CC3220 Host Driver  Version 2.0.1.22
Simplifies the implementation of Internet connectivity
wlan.h
1 /*
2  * wlan.h - CC31xx/CC32xx Host Driver Implementation
3  *
4  * Copyright (C) 2017 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 
39 /*****************************************************************************/
40 /* Include files */
41 /*****************************************************************************/
42 #include <ti/drivers/net/wifi/simplelink.h>
43 
44 #ifndef __WLAN_H__
45 #define __WLAN_H__
46 
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 
53 /*****************************************************************************/
54 /* Macro declarations */
55 /*****************************************************************************/
71 #define SL_WLAN_BSSID_LENGTH (6)
72 #define SL_WLAN_SSID_MAX_LENGTH (32)
73 
74 #define SL_WLAN_NUM_OF_RATE_INDEXES (20)
75 #define SL_WLAN_SIZE_OF_RSSI_HISTOGRAM (6)
76 #define SL_WLAN_SMART_CONFIG_KEY_LENGTH (16)
77 #define SL_WLAN_SMART_CONFIG_DEFAULT_CIPHER (1)
78 #define SL_WLAN_SMART_CONFIG_DEFAULT_GROUP (0)
79 
80 #define SL_WLAN_MAX_PROFILES (7)
81 #define SL_WLAN_DEL_ALL_PROFILES (255)
82 
83 typedef enum
84 {
85  SL_WLAN_P2P_WPS_METHOD_DEFAULT,
86  SL_WLAN_P2P_WPS_METHOD_PIN_USER,
87  SL_WLAN_P2P_WPS_METHOD_PIN_MACHINE,
88  SL_WLAN_P2P_WPS_METHOD_REKEY,
89  SL_WLAN_P2P_WPS_METHOD_PBC,
90  SL_WLAN_P2P_WPS_METHOD_REGISTRAR
91 } SlWlanP2PWpsMethod_e;
92 
93 /* WLAN user events */
94 typedef enum
95 {
96  SL_WLAN_EVENT_CONNECT = 1,
97  SL_WLAN_EVENT_DISCONNECT,
98  SL_WLAN_EVENT_STA_ADDED,
99  SL_WLAN_EVENT_STA_REMOVED,
100 
101  SL_WLAN_EVENT_P2P_CONNECT,
102  SL_WLAN_EVENT_P2P_DISCONNECT,
103  SL_WLAN_EVENT_P2P_CLIENT_ADDED,
104  SL_WLAN_EVENT_P2P_CLIENT_REMOVED,
105  SL_WLAN_EVENT_P2P_DEVFOUND,
106  SL_WLAN_EVENT_P2P_REQUEST,
107  SL_WLAN_EVENT_P2P_CONNECTFAIL,
108 
109  SL_WLAN_EVENT_RXFILTER,
110  SL_WLAN_EVENT_PROVISIONING_STATUS,
111  SL_WLAN_EVENT_PROVISIONING_PROFILE_ADDED,
112  SL_WLAN_EVENT_MAX
113 
114 } SlWlanEventId_e;
115 
116 
117 /* WLAN Disconnect Reason Codes */
118 #define SL_WLAN_DISCONNECT_UNSPECIFIED (1)
119 #define SL_WLAN_DISCONNECT_AUTH_NO_LONGER_VALID (2)
120 #define SL_WLAN_DISCONNECT_DEAUTH_SENDING_STA_LEAVING (3)
121 #define SL_WLAN_DISCONNECT_INACTIVITY (4)
122 #define SL_WLAN_DISCONNECT_TOO_MANY_STA (5)
123 #define SL_WLAN_DISCONNECT_FRAME_FROM_NONAUTH_STA (6)
124 #define SL_WLAN_DISCONNECT_FRAME_FROM_NONASSOC_STA (7)
125 #define SL_WLAN_DISCONNECT_DISS_SENDING_STA_LEAVING (8)
126 #define SL_WLAN_DISCONNECT_STA_NOT_AUTH (9)
127 #define SL_WLAN_DISCONNECT_POWER_CAPABILITY_INVALID (10)
128 #define SL_WLAN_DISCONNECT_SUPPORTED_CHANNELS_INVALID (11)
129 #define SL_WLAN_DISCONNECT_INVALID_IE (13)
130 #define SL_WLAN_DISCONNECT_MIC_FAILURE (14)
131 #define SL_WLAN_DISCONNECT_FOURWAY_HANDSHAKE_TIMEOUT (15)
132 #define SL_WLAN_DISCONNECT_GROUPKEY_HANDSHAKE_TIMEOUT (16)
133 #define SL_WLAN_DISCONNECT_REASSOC_INVALID_IE (17)
134 #define SL_WLAN_DISCONNECT_INVALID_GROUP_CIPHER (18)
135 #define SL_WLAN_DISCONNECT_INVALID_PAIRWISE_CIPHER (19)
136 #define SL_WLAN_DISCONNECT_INVALID_AKMP (20)
137 #define SL_WLAN_DISCONNECT_UNSUPPORTED_RSN_VERSION (21)
138 #define SL_WLAN_DISCONNECT_INVALID_RSN_CAPABILITIES (22)
139 #define SL_WLAN_DISCONNECT_IEEE_802_1X_AUTHENTICATION_FAILED (23)
140 #define SL_WLAN_DISCONNECT_CIPHER_SUITE_REJECTED (24)
141 #define SL_WLAN_DISCONNECT_DISASSOC_QOS (32)
142 #define SL_WLAN_DISCONNECT_DISASSOC_QOS_BANDWIDTH (33)
143 #define SL_WLAN_DISCONNECT_DISASSOC_EXCESSIVE_ACK_PENDING (34)
144 #define SL_WLAN_DISCONNECT_DISASSOC_TXOP_LIMIT (35)
145 #define SL_WLAN_DISCONNECT_STA_LEAVING (36)
146 #define SL_WLAN_DISCONNECT_STA_DECLINED (37)
147 #define SL_WLAN_DISCONNECT_STA_UNKNOWN_BA (38)
148 #define SL_WLAN_DISCONNECT_STA_TIMEOUT (39)
149 #define SL_WLAN_DISCONNECT_STA_UNSUPPORTED_CIPHER_SUITE (40)
150 #define SL_WLAN_DISCONNECT_USER_INITIATED (200)
151 #define SL_WLAN_DISCONNECT_AUTH_TIMEOUT (202)
152 #define SL_WLAN_DISCONNECT_ASSOC_TIMEOUT (203)
153 #define SL_WLAN_DISCONNECT_SECURITY_FAILURE (204)
154 #define SL_WLAN_DISCONNECT_WHILE_CONNNECTING (208)
155 #define SL_WLAN_DISCONNECT_MISSING_CERT (209)
156 #define SL_WLAN_DISCONNECT_CERTIFICATE_EXPIRED (210)
157 
158 
159 
160 #define SL_WLAN_STATUS_DISCONNECTED (0)
161 #define SL_WLAN_STATUS_SCANING (1)
162 #define SL_WLAN_STATUS_CONNECTING (2)
163 #define SL_WLAN_STATUS_CONNECTED (3)
164 
165 #define SL_WLAN_PROVISIONING_GENERAL_ERROR (0)
166 #define SL_WLAN_PROVISIONING_CONFIRMATION_STATUS_FAIL_NETWORK_NOT_FOUND (1)
167 #define SL_WLAN_PROVISIONING_CONFIRMATION_STATUS_FAIL_CONNECTION_FAILED (2)
168 #define SL_WLAN_PROVISIONING_CONFIRMATION_STATUS_CONNECTION_SUCCESS_IP_NOT_ACQUIRED (3)
169 #define SL_WLAN_PROVISIONING_CONFIRMATION_STATUS_SUCCESS_FEEDBACK_FAILED (4)
170 #define SL_WLAN_PROVISIONING_CONFIRMATION_STATUS_SUCCESS (5)
171 #define SL_WLAN_PROVISIONING_ERROR_ABORT (6)
172 #define SL_WLAN_PROVISIONING_ERROR_ABORT_INVALID_PARAM (7)
173 #define SL_WLAN_PROVISIONING_ERROR_ABORT_HTTP_SERVER_DISABLED (8)
174 #define SL_WLAN_PROVISIONING_ERROR_ABORT_PROFILE_LIST_FULL (9)
175 #define SL_WLAN_PROVISIONING_ERROR_ABORT_PROVISIONING_ALREADY_STARTED (10)
176 #define SL_WLAN_PROVISIONING_AUTO_STARTED (11)
177 #define SL_WLAN_PROVISIONING_STOPPED (12)
178 #define SL_WLAN_PROVISIONING_SMART_CONFIG_SYNCED (13)
179 #define SL_WLAN_PROVISIONING_SMART_CONFIG_SYNC_TIMEOUT (14)
180 #define SL_WLAN_PROVISIONING_CONFIRMATION_WLAN_CONNECT (15)
181 #define SL_WLAN_PROVISIONING_CONFIRMATION_IP_ACQUIRED (16)
182 #define SL_WLAN_PROVISIONING_EXTERNAL_CONFIGURATION_READY (17)
183 
184 
185 
186 #define SL_WLAN_SEC_TYPE_OPEN (0)
187 #define SL_WLAN_SEC_TYPE_WEP (1)
188 #define SL_WLAN_SEC_TYPE_WPA (2) /* deprecated */
189 #define SL_WLAN_SEC_TYPE_WPA_WPA2 (2)
190 #define SL_WLAN_SEC_TYPE_WPS_PBC (3)
191 #define SL_WLAN_SEC_TYPE_WPS_PIN (4)
192 #define SL_WLAN_SEC_TYPE_WPA_ENT (5)
193 #define SL_WLAN_SEC_TYPE_P2P_PBC (6)
194 #define SL_WLAN_SEC_TYPE_P2P_PIN_KEYPAD (7)
195 #define SL_WLAN_SEC_TYPE_P2P_PIN_DISPLAY (8)
196 #define SL_WLAN_SEC_TYPE_P2P_PIN_AUTO (9) /* NOT Supported yet */
197 #define SL_WLAN_SEC_TYPE_WEP_SHARED (10)
198 
199 
200 
201 #define SL_TLS (0x1)
202 #define SL_MSCHAP (0x0)
203 #define SL_PSK (0x2)
204 #define SL_TTLS (0x10)
205 #define SL_PEAP0 (0x20)
206 #define SL_PEAP1 (0x40)
207 #define SL_FAST (0x80)
208 
209 
210 #define SL_WLAN_FAST_AUTH_PROVISIONING (0x02)
211 #define SL_WLAN_FAST_UNAUTH_PROVISIONING (0x01)
212 #define SL_WLAN_FAST_NO_PROVISIONING (0x00)
213 
214 #define SL_WLAN_PROVISIONING_CMD_START_MODE_AP (0)
215 #define SL_WLAN_PROVISIONING_CMD_START_MODE_SC (1)
216 #define SL_WLAN_PROVISIONING_CMD_START_MODE_APSC (2)
217 #define SL_WLAN_PROVISIONING_CMD_START_MODE_APSC_EXTERNAL_CONFIGURATION (3)
218 #define SL_WLAN_PROVISIONING_CMD_STOP (4)
219 #define SL_WLAN_PROVISIONING_CMD_ABORT_EXTERNAL_CONFIRMATION (5)
220 
221 /* Provisining API Flags */
222 #define SL_WLAN_PROVISIONING_CMD_FLAG_EXTERNAL_CONFIRMATION (0x00000001)
223 
224 /* to be used only in provisioning stop command */
225 #define SL_WLAN_PROVISIONING_REMAIN_IN_CURRENT_ROLE (0xFF)
226 
227 
228 #define SL_WLAN_EAPMETHOD_PHASE2_SHIFT (8)
229 #define SL_WLAN_EAPMETHOD_PAIRWISE_CIPHER_SHIFT (19)
230 #define SL_WLAN_EAPMETHOD_GROUP_CIPHER_SHIFT (27)
231 
232 #define SL_WLAN_WPA_CIPHER_CCMP (0x1)
233 #define SL_WLAN_WPA_CIPHER_TKIP (0x2)
234 #define SL_WLAN_CC31XX_DEFAULT_CIPHER (SL_WLAN_WPA_CIPHER_CCMP | SL_WLAN_WPA_CIPHER_TKIP)
235 
236 #define SL_WLAN_EAPMETHOD(phase1,phase2,pairwise_cipher,group_cipher) \
237  ((phase1) | \
238  ((phase2) << SL_WLAN_EAPMETHOD_PHASE2_SHIFT ) |\
239  ((_u32)(pairwise_cipher) << SL_WLAN_EAPMETHOD_PAIRWISE_CIPHER_SHIFT ) |\
240  ((_u32)(group_cipher) << SL_WLAN_EAPMETHOD_GROUP_CIPHER_SHIFT ))
241 
242 /* phase1 phase2 pairwise_cipher group_cipher */
243 #define SL_WLAN_ENT_EAP_METHOD_TLS SL_WLAN_EAPMETHOD(SL_TLS, 0, SL_WLAN_CC31XX_DEFAULT_CIPHER , SL_WLAN_CC31XX_DEFAULT_CIPHER)
244 #define SL_WLAN_ENT_EAP_METHOD_TTLS_TLS SL_WLAN_EAPMETHOD(SL_TTLS, SL_TLS, SL_WLAN_CC31XX_DEFAULT_CIPHER , SL_WLAN_CC31XX_DEFAULT_CIPHER)
245 #define SL_WLAN_ENT_EAP_METHOD_TTLS_MSCHAPv2 SL_WLAN_EAPMETHOD(SL_TTLS, SL_MSCHAP, SL_WLAN_CC31XX_DEFAULT_CIPHER , SL_WLAN_CC31XX_DEFAULT_CIPHER)
246 #define SL_WLAN_ENT_EAP_METHOD_TTLS_PSK SL_WLAN_EAPMETHOD(SL_TTLS, SL_PSK, SL_WLAN_CC31XX_DEFAULT_CIPHER , SL_WLAN_CC31XX_DEFAULT_CIPHER)
247 #define SL_WLAN_ENT_EAP_METHOD_PEAP0_TLS SL_WLAN_EAPMETHOD(SL_PEAP0, SL_TLS, SL_WLAN_CC31XX_DEFAULT_CIPHER , SL_WLAN_CC31XX_DEFAULT_CIPHER)
248 #define SL_WLAN_ENT_EAP_METHOD_PEAP0_MSCHAPv2 SL_WLAN_EAPMETHOD(SL_PEAP0, SL_MSCHAP, SL_WLAN_CC31XX_DEFAULT_CIPHER , SL_WLAN_CC31XX_DEFAULT_CIPHER)
249 #define SL_WLAN_ENT_EAP_METHOD_PEAP0_PSK SL_WLAN_EAPMETHOD(SL_PEAP0, SL_PSK, SL_WLAN_CC31XX_DEFAULT_CIPHER , SL_WLAN_CC31XX_DEFAULT_CIPHER)
250 #define SL_WLAN_ENT_EAP_METHOD_PEAP1_TLS SL_WLAN_EAPMETHOD(SL_PEAP1, SL_TLS, SL_WLAN_CC31XX_DEFAULT_CIPHER , SL_WLAN_CC31XX_DEFAULT_CIPHER)
251 #define SL_WLAN_ENT_EAP_METHOD_PEAP1_PSK SL_WLAN_EAPMETHOD(SL_PEAP1, SL_PSK, SL_WLAN_CC31XX_DEFAULT_CIPHER , SL_WLAN_CC31XX_DEFAULT_CIPHER)
252 #define SL_WLAN_ENT_EAP_METHOD_FAST_AUTH_PROVISIONING SL_WLAN_EAPMETHOD(SL_FAST, SL_WLAN_FAST_AUTH_PROVISIONING, SL_WLAN_CC31XX_DEFAULT_CIPHER , SL_WLAN_CC31XX_DEFAULT_CIPHER)
253 #define SL_WLAN_ENT_EAP_METHOD_FAST_UNAUTH_PROVISIONING SL_WLAN_EAPMETHOD(SL_FAST, SL_WLAN_FAST_UNAUTH_PROVISIONING, SL_WLAN_CC31XX_DEFAULT_CIPHER , SL_WLAN_CC31XX_DEFAULT_CIPHER)
254 #define SL_WLAN_ENT_EAP_METHOD_FAST_NO_PROVISIONING SL_WLAN_EAPMETHOD(SL_FAST, SL_WLAN_FAST_NO_PROVISIONING, SL_WLAN_CC31XX_DEFAULT_CIPHER , SL_WLAN_CC31XX_DEFAULT_CIPHER)
255 
256 #define SL_WLAN_LONG_PREAMBLE (0)
257 #define SL_WLAN_SHORT_PREAMBLE (1)
258 
259 #define SL_WLAN_RAW_RF_TX_PARAMS_CHANNEL_SHIFT (0)
260 #define SL_WLAN_RAW_RF_TX_PARAMS_RATE_SHIFT (6)
261 #define SL_WLAN_RAW_RF_TX_PARAMS_POWER_SHIFT (11)
262 #define SL_WLAN_RAW_RF_TX_PARAMS_PREAMBLE_SHIFT (15)
263 
264 #define SL_WLAN_RAW_RF_TX_PARAMS(chan,rate,power,preamble) \
265  ((chan << SL_WLAN_RAW_RF_TX_PARAMS_CHANNEL_SHIFT) | \
266  (rate << SL_WLAN_RAW_RF_TX_PARAMS_RATE_SHIFT) | \
267  (power << SL_WLAN_RAW_RF_TX_PARAMS_POWER_SHIFT) | \
268  (preamble << SL_WLAN_RAW_RF_TX_PARAMS_PREAMBLE_SHIFT))
269 
270 
271 /* wlan config application IDs */
272 #define SL_WLAN_CFG_AP_ID (0)
273 #define SL_WLAN_CFG_GENERAL_PARAM_ID (1)
274 #define SL_WLAN_CFG_P2P_PARAM_ID (2)
275 #define SL_WLAN_CFG_AP_ACCESS_LIST_ID (3)
276 #define SL_WLAN_RX_FILTERS_ID (4)
277 #define SL_WLAN_CONNECTION_INFO (5)
278 
279 /* wlan AP Config set/get options */
280 #define SL_WLAN_AP_OPT_SSID (0)
281 #define SL_WLAN_AP_OPT_CHANNEL (3)
282 #define SL_WLAN_AP_OPT_HIDDEN_SSID (4)
283 #define SL_WLAN_AP_OPT_SECURITY_TYPE (6)
284 #define SL_WLAN_AP_OPT_PASSWORD (7)
285 #define SL_WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE (9)
286 #define SL_WLAN_GENERAL_PARAM_OPT_STA_TX_POWER (10)
287 #define SL_WLAN_GENERAL_PARAM_OPT_AP_TX_POWER (11)
288 #define SL_WLAN_GENERAL_PARAM_DISABLE_ENT_SERVER_AUTH (32)
289 #define SL_WLAN_GENERAL_PARAM_OPT_SUSPEND_PROFILES (33)
290 
291 #define SL_WLAN_P2P_OPT_DEV_NAME (12)
292 #define SL_WLAN_P2P_OPT_DEV_TYPE (13)
293 #define SL_WLAN_P2P_OPT_CHANNEL_N_REGS (14)
294 #define SL_WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT (16)
295 #define SL_WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS (18) /* change the scan channels and RSSI threshold using this configuration option */
296 #define SL_WLAN_AP_OPT_MAX_STATIONS (19)
297 #define SL_WLAN_AP_ACCESS_LIST_ADD_MAC (20)
298 #define SL_WLAN_AP_ACCESS_LIST_DEL_MAC (21)
299 #define SL_WLAN_AP_ACCESS_LIST_DEL_IDX (22)
300 #define SL_WLAN_AP_ACCESS_LIST_NUM_ENTRIES (24)
301 #define SL_WLAN_AP_ACCESS_LIST_MODE (25)
302 #define SL_WLAN_AP_OPT_MAX_STA_AGING (26)
303 
304 #define SL_WLAN_RX_FILTER_STATE (27)
305 #define SL_WLAN_RX_FILTER_REMOVE (28)
306 #define SL_WLAN_RX_FILTER_STORE (29)
307 #define SL_WLAN_RX_FILTER_UPDATE_ARGS (30)
308 #define SL_WLAN_RX_FILTER_SYS_STATE (31)
309 
310 /* SmartConfig CIPHER options */
311 #define SL_WLAN_SMART_CONFIG_CIPHER_SFLASH (0) /* password is not delivered by the application. The Simple Manager should
312  check if the keys are stored in the Flash. */
313 #define SL_WLAN_SMART_CONFIG_CIPHER_AES (1) /* AES (other types are not supported) */
314 #define SL_WLAN_SMART_CONFIG_CIPHER_NONE (0xFF) /* do not check in the flash */
315 
316 
317 #define SL_WLAN_POLICY_CONNECTION (0x10)
318 #define SL_WLAN_POLICY_SCAN (0x20)
319 #define SL_WLAN_POLICY_PM (0x30)
320 #define SL_WLAN_POLICY_P2P (0x40)
321 
322 #define SL_WLAN_VAL_2_MASK(position,value) ((1 & (value))<<(position))
323 #define SL_WLAN_MASK_2_VAL(position,mask) (((1 << position) & (mask)) >> (position))
324 
325 #define SL_WLAN_CONNECTION_POLICY(Auto,Fast,anyP2P,autoProvisioning) (SL_WLAN_VAL_2_MASK(0,Auto) | SL_WLAN_VAL_2_MASK(1,Fast) | SL_WLAN_VAL_2_MASK(2,0) | SL_WLAN_VAL_2_MASK(3,anyP2P) | SL_WLAN_VAL_2_MASK(4,0) | SL_WLAN_VAL_2_MASK(5,autoProvisioning))
326 #define SL_WLAN_SCAN_POLICY_EN(policy) (SL_WLAN_MASK_2_VAL(0,policy))
327 #define SL_WLAN_SCAN_POLICY(Enable,Enable_Hidden) (SL_WLAN_VAL_2_MASK(0,Enable) | SL_WLAN_VAL_2_MASK(1,Enable_Hidden))
328 
329 
330 #define SL_WLAN_ENABLE_SCAN (1)
331 #define SL_WLAN_DISABLE_SCAN (0)
332 #define SL_WLAN_ALLOW_HIDDEN_SSID_RESULTS (1)
333 #define SL_WLAN_BLOCK_HIDDEN_SSID_RESULTS (0)
334 
335 #define SL_WLAN_NORMAL_POLICY (0)
336 #define SL_WLAN_LOW_LATENCY_POLICY (1)
337 #define SL_WLAN_LOW_POWER_POLICY (2)
338 #define SL_WLAN_ALWAYS_ON_POLICY (3)
339 #define SL_WLAN_LONG_SLEEP_INTERVAL_POLICY (4)
340 
341 #define SL_WLAN_P2P_ROLE_NEGOTIATE (3)
342 #define SL_WLAN_P2P_ROLE_GROUP_OWNER (15)
343 #define SL_WLAN_P2P_ROLE_CLIENT (0)
344 
345 #define SL_WLAN_P2P_NEG_INITIATOR_ACTIVE (0)
346 #define SL_WLAN_P2P_NEG_INITIATOR_PASSIVE (1)
347 #define SL_WLAN_P2P_NEG_INITIATOR_RAND_BACKOFF (2)
348 
349 #define SL_WLAN_POLICY_VAL_2_OPTIONS(position,mask,policy) ((mask & policy) << position )
350 
351 #define SL_WLAN_P2P_POLICY(p2pNegType,p2pNegInitiator) (SL_WLAN_POLICY_VAL_2_OPTIONS(0,0xF,(p2pNegType > SL_WLAN_P2P_ROLE_GROUP_OWNER ? SL_WLAN_P2P_ROLE_GROUP_OWNER : p2pNegType)) | \
352  SL_WLAN_POLICY_VAL_2_OPTIONS(4,0x1,(p2pNegType > SL_WLAN_P2P_ROLE_GROUP_OWNER ? 1:0)) | \
353  SL_WLAN_POLICY_VAL_2_OPTIONS(5,0x3, p2pNegInitiator))
354 
355 
356 /* Info elements */
357 #define SL_WLAN_INFO_ELEMENT_DEFAULT_ID (0) /* 221 will be used */
358 
359 /* info element size is up to 252 bytes (+ 3 bytes of OUI). */
360 #define SL_WLAN_INFO_ELEMENT_MAX_SIZE (252)
361 
362 /* For AP - the total length of all info elements is 300 bytes (for example - 4 info elements of 75 bytes each) */
363 #define SL_WLAN_INFO_ELEMENT_MAX_TOTAL_LENGTH_AP (300)
364 
365 /* For P2P - the total length of all info elements is 160 bytes (for example - 4 info elements of 40 bytes each) */
366 #define SL_WLAN_INFO_ELEMENT_MAX_TOTAL_LENGTH_P2P_GO (160)
367 
368 #define SL_WLAN_INFO_ELEMENT_AP_ROLE (0)
369 #define SL_WLAN_INFO_ELEMENT_P2P_GO_ROLE (1)
370 
371 /* we support up to 4 info elements per Role. */
372 #define SL_WLAN_MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED (4)
373 
374 #define SL_WLAN_INFO_ELEMENT_DEFAULT_OUI_0 (0x08)
375 #define SL_WLAN_INFO_ELEMENT_DEFAULT_OUI_1 (0x00)
376 #define SL_WLAN_INFO_ELEMENT_DEFAULT_OUI_2 (0x28)
377 
378 #define SL_WLAN_INFO_ELEMENT_DEFAULT_OUI (0x000000) /* 08, 00, 28 will be used */
379 
380 #define SL_WLAN_AP_ACCESS_LIST_MODE_DISABLED 0
381 #define SL_WLAN_AP_ACCESS_LIST_MODE_DENY_LIST 1
382 #define SL_WLAN_MAX_ACCESS_LIST_STATIONS 8
383 
384 
385 /* Scan results security information */
386 #define SL_WLAN_SCAN_RESULT_GROUP_CIPHER(SecurityInfo) (SecurityInfo & 0xF) /* Possible values: NONE,SL_WLAN_CIPHER_BITMAP_TKIP,SL_WLAN_CIPHER_BITMAP_CCMP */
387 #define SL_WLAN_SCAN_RESULT_UNICAST_CIPHER_BITMAP(SecurityInfo) ((SecurityInfo & 0xF0) >> 4 ) /* Possible values: NONE,SL_WLAN_CIPHER_BITMAP_WEP40,SL_WLAN_CIPHER_BITMAP_WEP104,SL_WLAN_CIPHER_BITMAP_TKIP,SL_WLAN_CIPHER_BITMAP_CCMP*/
388 #define SL_WLAN_SCAN_RESULT_HIDDEN_SSID(SecurityInfo) (SecurityInfo & 0x2000 ) >> 13 /* Possible values: TRUE/FALSE */
389 #define SL_WLAN_SCAN_RESULT_KEY_MGMT_SUITES_BITMAP(SecurityInfo) (SecurityInfo & 0x1800 ) >> 11 /* Possible values: SL_WLAN_KEY_MGMT_SUITE_802_1_X, SL_WLAN_KEY_MGMT_SUITE_PSK */
390 #define SL_WLAN_SCAN_RESULT_SEC_TYPE_BITMAP(SecurityInfo) (SecurityInfo & 0x700 ) >> 8 /* Possible values: SL_WLAN_SECURITY_TYPE_BITMAP_OPEN, SL_WLAN_SECURITY_TYPE_BITMAP_WEP, SL_WLAN_SECURITY_TYPE_BITMAP_WPA, SL_WLAN_SECURITY_TYPE_BITMAP_WPA2, 0x6 (mix mode) SL_WLAN_SECURITY_TYPE_BITMAP_WPA | SL_WLAN_SECURITY_TYPE_BITMAP_WPA2 */
391 
392 #define SL_WLAN_SECURITY_TYPE_BITMAP_OPEN 0x0
393 #define SL_WLAN_SECURITY_TYPE_BITMAP_WEP 0x1
394 #define SL_WLAN_SECURITY_TYPE_BITMAP_WPA 0x2
395 #define SL_WLAN_SECURITY_TYPE_BITMAP_WPA2 0x4
396 
397 #define SL_WLAN_CIPHER_BITMAP_WEP40 0x1
398 #define SL_WLAN_CIPHER_BITMAP_WEP104 0x2
399 #define SL_WLAN_CIPHER_BITMAP_TKIP 0x4
400 #define SL_WLAN_CIPHER_BITMAP_CCMP 0x8
401 
402 #define SL_WLAN_KEY_MGMT_SUITE_802_1_X 1
403 #define SL_WLAN_KEY_MGMT_SUITE_PSK 2
404 
405 
406 
407 #define SL_WLAN_RX_FILTER_MAX_FILTERS (64) /* Max number of filters is 64 filters */
408 #define SL_WLAN_RX_FILTER_MAX_SYS_FILTERS_SETS (32) /* The Max number of system filters */
409 #define SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS (2)
410 #define SL_WLAN_RX_FILTER_NUM_OF_FILTER_PAYLOAD_ARGS (2)
411 #define SL_WLAN_RX_FILTER_RANGE_ARGS (2)
412 #define SL_WLAN_RX_FILTER_NUM_USER_EVENT_ID (64)
413 #define SL_WLAN_RX_FILTER_MAX_USER_EVENT_ID ( ( SL_WLAN_RX_FILTER_NUM_USER_EVENT_ID ) - 1 )
414 
415 /* Bit manipulation for 8 bit */
416 #define SL_WLAN_ISBITSET8(x,i) ((x[i>>3] & (0x80>>(i&7)))!=0) /* Is bit set, 8 bit unsigned numbers = x , location = i */
417 #define SL_WLAN_SETBIT8(x,i) x[i>>3]|=(0x80>>(i&7)); /* Set bit,8 bit unsigned numbers = x , location = i */
418 #define SL_WLAN_CLEARBIT8(x,i) x[i>>3]&=(0x80>>(i&7))^0xFF; /* Clear bit,8 bit unsigned numbers = x , location = i */
419 
420 
421 /*****************************************************************************/
422 /* Structure/Enum declarations */
423 /*****************************************************************************/
424 
425 typedef enum
426 {
427  SL_WLAN_RATE_1M = 1,
428  SL_WLAN_RATE_2M = 2,
429  SL_WLAN_RATE_5_5M = 3,
430  SL_WLAN_RATE_11M = 4,
431  SL_WLAN_RATE_6M = 6,
432  SL_WLAN_RATE_9M = 7,
433  SL_WLAN_RATE_12M = 8,
434  SL_WLAN_RATE_18M = 9,
435  SL_WLAN_RATE_24M = 10,
436  SL_WLAN_RATE_36M = 11,
437  SL_WLAN_RATE_48M = 12,
438  SL_WLAN_RATE_54M = 13,
439  SL_WLAN_RATE_MCS_0 = 14,
440  SL_WLAN_RATE_MCS_1 = 15,
441  SL_WLAN_RATE_MCS_2 = 16,
442  SL_WLAN_RATE_MCS_3 = 17,
443  SL_WLAN_RATE_MCS_4 = 18,
444  SL_WLAN_RATE_MCS_5 = 19,
445  SL_WLAN_RATE_MCS_6 = 20,
446  SL_WLAN_RATE_MCS_7 = 21,
447  SL_WLAN_MAX_NUM_RATES = 0xFF
448 }SlWlanRateIndex_e;
449 
450 typedef enum
451 {
452  SL_WLAN_DEV_PW_DEFAULT = 0,
453  SL_WLAN_DEV_PW_PIN_KEYPAD = 1,
454  SL_WLAN_DEV_PW_PUSH_BUTTON = 4,
455  SL_WLAN_DEV_PW_PIN_DISPLAY = 5
456 } SlWlanP2pDevPwdMethod_e;
457 
458 
459 typedef struct
460 {
461  _u32 Status;
462  _u32 SsidLen;
463  _u8 Ssid[32];
464  _u32 PrivateTokenLen;
465  _u8 PrivateToken[32];
467 
468 typedef struct
469 {
470  _u16 Status;
471  _u16 Padding;
473 
474 typedef struct
475 {
476  _u16 Status;
477  _u16 Padding;
479 
480 typedef struct
481 {
482  _u16 Status;
483  _u16 Padding;
485 
486 /* rx filter event struct
487  this event will be sent from the SL device
488  as a result of a passed rx filter
489  example:
490  suppose we have a filter with an action and we set the following:
491  SlWlanRxFilterAction_t Action;
492  Action.UserId = 2;
493  When the filter result is pass, an SlWlanEventRxFilterInfo_t event will be passed to the user as follows:
494  Type will be set to 0
495  bit 2 in UserActionIdBitmap will be set in this event, because 2 is the user input for the action arg above.
496  an SlWlanEventRxFilterInfo_t event may have several bits set as a result of several rx filters causing different
497  events to pass */
498 
499 typedef struct
500 {
501  _u8 Type; /* Currently only event type 0 is supported. */
502  _u8 UserActionIdBitmap[SL_WLAN_RX_FILTER_NUM_USER_EVENT_ID / 8]; /* Bit X is set indicates that the filter with event action arg X passed. */
504 
505 
506 
507 typedef enum
508 {
509  ROLE_STA = 0,
510  ROLE_RESERVED = 1,
511  ROLE_AP = 2,
512  ROLE_P2P = 3
513 }SlWlanMode_e;
514 
515 typedef struct
516 {
517  _u8 SsidLen;
518  _u8 SsidName[32];
519  _u8 Bssid[6];
520  _u8 Padding;
522 
523 typedef struct
524 {
525  _u8 SsidLen;
526  _u8 SsidName[32];
527  _u8 Bssid[6];
528  _u8 ReasonCode;
530 
531 typedef struct
532 {
533  _u8 Mac[6];
534  _u8 Padding[2];
536 
537 
538 typedef struct
539 {
540  _u8 SsidLen;
541  _u8 SsidName[32];
542  _u8 Bssid[6];
543  _u8 Reserved;
544  _u8 GoDeviceNameLen;
545  _u8 GoDeviceName[32];
546  _u8 Padding[3];
548 
549 typedef struct
550 {
551  _u8 SsidLen;
552  _u8 SsidName[32];
553  _u8 Bssid[6];
554  _u8 ReasonCode;
555  _u8 GoDeviceNameLen;
556  _u8 GoDeviceName[32];
557  _u8 Padding[3];
559 
560 
561 
562 
563 typedef struct
564 {
565  _u8 Mac[6];
566  _u8 ClDeviceNameLen;
567  _u8 ClDeviceName[32];
568  _u8 OwnSsidLen;
569  _u8 OwnSsid[32];
571 
572 
573 typedef struct
574 {
575  _u8 GoDeviceNameLen;
576  _u8 GoDeviceName[32];
577  _u8 Mac[6];
578  _u8 WpsMethod;
580 
581 
582 /**************************************************/
583 typedef struct
584 {
585  _u16 Status;
586  _u16 Padding;
588 
589 
590 typedef struct
591 {
592  _u8 ProvisioningStatus;
593  _u8 Role;
594  _u8 WlanStatus;
595  _u8 Ssidlen;
596  _u8 Ssid[32];
597  _u32 Reserved;
599 
600 typedef struct
601 {
602  _u32 Status;
603  _u32 SsidLen;
604  _u8 Ssid[32];
605  _u32 ReservedLen;
606  _u8 Reserved[32];
608 
609 
610 typedef union
611 {
612  SlWlanEventConnect_t Connect; /* SL_WLAN_EVENT_CONNECT */
613  SlWlanEventDisconnect_t Disconnect; /* SL_WLAN_EVENT_DISCONNECT */
614  SlWlanEventSTAAdded_t STAAdded; /* SL_WLAN_EVENT_STA_ADDED */
615  SlWlanEventSTARemoved_t STARemoved; /* SL_WLAN_EVENT_STA_REMOVED */
616  SlWlanEventP2PConnect_t P2PConnect; /* SL_WLAN_EVENT_P2P_CONNECT */
617  SlWlanEventP2PDisconnect_t P2PDisconnect; /* SL_WLAN_EVENT_P2P_DISCONNECT */
618  SlWlanEventP2PClientAdded_t P2PClientAdded; /* SL_WLAN_EVENT_P2P_CLIENT_ADDED */
619  SlWlanEventP2PClientRemoved_t P2PClientRemoved; /* SL_WLAN_EVENT_P2P_CLIENT_REMOVED */
620  SlWlanEventP2PDevFound_t P2PDevFound; /* SL_WLAN_EVENT_P2P_DEVFOUND */
621  SlWlanEventP2PRequest_t P2PRequest; /* SL_WLAN_EVENT_P2P_REQUEST */
622  SlWlanEventP2PConnectFail_t P2PConnectFail; /* SL_WLAN_EVENT_P2P_CONNECTFAIL */
623  SlWlanEventRxFilterInfo_t RxFilterInfo; /* SL_WLAN_EVENT_RXFILTER */
624  SlWlanEventProvisioningStatus_t ProvisioningStatus; /* SL_WLAN_EVENT_PROVISIONING_STATUS */
625  SlWlanEventProvisioningProfileAdded_t ProvisioningProfileAdded; /* SL_WLAN_EVENT_PROVISIONING_PROFILE_ADDED */
626 
628 
629 
630 typedef struct
631 {
632  _u32 Id;
633  SlWlanEventData_u Data;
634 } SlWlanEvent_t;
635 
636 
637 typedef struct
638 {
639  _u32 ReceivedValidPacketsNumber; /* sum of the packets that been received OK (include filtered) */
640  _u32 ReceivedFcsErrorPacketsNumber; /* sum of the packets that been dropped due to FCS error */
641  _u32 ReceivedAddressMismatchPacketsNumber; /* sum of the packets that been received but filtered out by one of the HW filters */
642  _i16 AvarageDataCtrlRssi; /* average RSSI for all valid data packets received */
643  _i16 AvarageMgMntRssi; /* average RSSI for all valid management packets received */
644  _u16 RateHistogram[SL_WLAN_NUM_OF_RATE_INDEXES]; /* rate histogram for all valid packets received */
645  _u16 RssiHistogram[SL_WLAN_SIZE_OF_RSSI_HISTOGRAM]; /* RSSI histogram from -40 until -87 (all below and above\n RSSI will appear in the first and last cells */
646  _u32 StartTimeStamp; /* the time stamp started collecting the statistics in uSec */
647  _u32 GetTimeStamp; /* the time stamp called the get statistics command */
649 
650 
651 
652 
653 typedef struct
654 {
655  _u8 Ssid[SL_WLAN_SSID_MAX_LENGTH];
656  _u8 Bssid[SL_WLAN_BSSID_LENGTH];
657  _u8 SsidLen;
658  _i8 Rssi;
659  _i16 SecurityInfo;
660  _i8 Channel;
661  _i8 Reserved[1];
663 
664 typedef struct
665 {
666  _u8 Type;
667  _i8* Key;
668  _u8 KeyLen;
670 
671 typedef struct
672 {
673  _i8* User;
674  _u8 UserLen;
675  _i8* AnonUser;
676  _u8 AnonUserLen;
677  _u8 CertIndex; /* not supported */
678  _u32 EapMethod;
680 
681 typedef struct
682 {
683  _i8 User[64];
684  _u8 UserLen;
685  _i8 AnonUser[64];
686  _u8 AnonUserLen;
687  _u8 CertIndex; /* not supported */
688  _u32 EapMethod;
690 
691 
692 #define SL_WLAN_CONNECTION_PROTOCOL_STA 1
693 #define SL_WLAN_CONNECTION_PROTOCOL_P2PCL 2
694 
695 typedef union
696 {
697  SlWlanEventConnect_t StaConnect;
698  SlWlanEventP2PConnect_t P2PConnect;
700 
701 typedef enum
702 {
703  SL_WLAN_DISCONNECTED = 0,
704  SL_WLAN_CONNECTED_STA,
705  SL_WLAN_CONNECTED_P2PCL,
706  SL_WLAN_CONNECTED_P2PGO,
707  SL_WLAN_AP_CONNECTED_STATIONS
708 }SlWlanConnStatusFlags_e;
709 
710 typedef struct
711 {
712  _u8 Mode; /* ROLE_STA, ROLE_AP, ROLE_P2P */
713  _u8 ConnStatus; /* SlWlanConnStatusFlags_e */
714  _u8 SecType; /* Current connection security type - (0 in case of disconnect or AP mode) SL_WLAN_SEC_TYPE_OPEN, SL_WLAN_SEC_TYPE_WEP, SL_WLAN_SEC_TYPE_WPA_WPA2, SL_WLAN_SEC_TYPE_WPA_ENT, SL_WLAN_SEC_TYPE_WPS_PBC, SL_WLAN_SEC_TYPE_WPS_PIN */
715  _u8 Reserved;
716  SlWlanConnectionInfo_u ConnectionInfo;
718 
719 typedef struct
720 {
721  _u32 ChannelsMask;
722  _i32 RssiThershold;
724 
725 
726 typedef struct
727 {
728  _u8 Id;
729  _u8 Oui[3];
730  _u16 Length;
731  _u8 Data[252];
733 
734 typedef struct
735 {
736  _u8 Index; /* 0 - SL_WLAN_MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED */
737  _u8 Role; /* bit0: AP = 0, GO = 1 */
740 
741 
742 typedef struct
743 {
744  _u16 Reserved;
745  _u16 Reserved2;
746  _u16 MaxSleepTimeMs; /* max sleep time in mSec For setting Long Sleep Interval policy use */
747  _u16 Reserved3;
749 
750 
751 
752 typedef _i8 SlWlanRxFilterID_t; /* Unique filter ID which is allocated by the system , negative number means error */
753 
754 /* Representation of filters Id as a bit field
755  The bit field is used to declare which filters are involved
756  in operation. Number of filter can be up to 128 filters.
757  i.e. 128 bits are needed. On the current release, up to 64 filters can be defined. */
758 typedef _u8 SlWlanRxFilterIdMask_t[128/8];
759 
760 
761 typedef _u8 SlWlanRxFilterSysFilters_t; /* Describes the supported system filter sets*/
762 /* possible values for SlWlanRxFilterSysFilters_t */
763 #define SL_WLAN_RX_FILTER_ARP_AUTO_REPLY_SYS_FILTERS (0)
764 #define SL_WLAN_RX_FILTER_MULTICASTSIPV4_SYS_FILTERS (1)
765 #define SL_WLAN_RX_FILTER_MULTICASTSIPV6_SYS_FILTERS (2)
766 #define SL_WLAN_RX_FILTER_MULTICASTSWIFI_SYS_FILTERS (3)
767 #define SL_WLAN_RX_FILTER_SELF_MAC_ADDR_DROP_SYS_FILTERS (4)
768 
769 
770 /* Describes the supported system filter sets, each bit represents different system filter set
771  The filter sets are defined at SlWlanRxFilterSysFilters_t */
772 typedef _u8 SlWlanRxFilterSysFiltersMask_t[SL_WLAN_RX_FILTER_MAX_SYS_FILTERS_SETS/8];
773 
774 typedef struct
775 {
776  _u16 Offset; /* Offset in payload - Where in the payload to search for the pattern */
777  _u8 Length; /* Pattern Length */
778  _u8 Reserved;
779  _u8 Value[16];/* Up to 16 bytes long (based on pattern length above) */
781 
782 
783 typedef _u8 SlWlanRxFilterRuleType_t; /* Different filter types */
784 /* possible values for SlWlanRxFilterRuleType_t */
785 #define SL_WLAN_RX_FILTER_HEADER (0)
786 #define SL_WLAN_RX_FILTER_COMBINATION (1)
787 
788 typedef _u8 SlWlanRxFilterFlags_u;
789 /* Possible values for SlWlanRxFilterFlags_u */
790 #define SL_WLAN_RX_FILTER_BINARY (0x1)
791 #define SL_WLAN_RX_FILTER_PERSISTENT (0x8)
792 #define SL_WLAN_RX_FILTER_ENABLE (0x10)
793 
794 /* Used as comparison function for the header type arguments */
795 typedef _u8 SlWlanRxFilterRuleHeaderCompareFunction_t;
796 /* Possible values for SlWlanRxFilterRuleHeaderCompareFunction_t */
797 #define SL_WLAN_RX_FILTER_CMP_FUNC_IN_BETWEEN (0)
798 #define SL_WLAN_RX_FILTER_CMP_FUNC_EQUAL (1)
799 #define SL_WLAN_RX_FILTER_CMP_FUNC_NOT_EQUAL_TO (2)
800 #define SL_WLAN_RX_FILTER_CMP_FUNC_NOT_IN_BETWEEN (3)
801 
802 
803 typedef _u8 SlWlanRxFilterTriggerCompareFunction_t;
804 /* Possible values for SlWlanRxFilterTriggerCompareFunction_t */
805 #define SL_WLAN_RX_FILTER_TRIGGER_CMP_FUNC_EQUAL (0)
806 #define SL_WLAN_RX_FILTER_TRIGGER_CMP_FUNC_NOT_EQUAL_TO (1) /* arg1 == protocolVal ,not supported in current release */
807 #define SL_WLAN_RX_FILTER_TRIGGER_CMP_FUNC_SMALLER_THAN (2) /* arg1 == protocolVal */
808 #define SL_WLAN_RX_FILTER_TRIGGER_CMP_FUNC_BIGGER_THAN (3) /* arg1 == protocolVal */
809 
810 
811 typedef _u8 SlWlanRxFilterRuleHeaderField_t; /* Provides list of possible header types which may be defined as part of the rule */
812 /* Possible values for SlWlanRxFilterRuleHeaderField_t */
813 #define SL_WLAN_RX_FILTER_HFIELD_NULL (0)
814 #define SL_WLAN_RX_FILTER_HFIELD_FRAME_TYPE (1) /* 802.11 control\data\management */
815 #define SL_WLAN_RX_FILTER_HFIELD_FRAME_SUBTYPE (2) /* 802.11 beacon\probe\.. */
816 #define SL_WLAN_RX_FILTER_HFIELD_BSSID (3) /* 802.11 bssid type */
817 #define SL_WLAN_RX_FILTER_HFIELD_MAC_SRC_ADDR (4)
818 #define SL_WLAN_RX_FILTER_HFIELD_MAC_DST_ADDR (5)
819 #define SL_WLAN_RX_FILTER_HFIELD_FRAME_LENGTH (6)
820 #define SL_WLAN_RX_FILTER_HFIELD_ETHER_TYPE (7)
821 #define SL_WLAN_RX_FILTER_HFIELD_IP_VERSION (8)
822 #define SL_WLAN_RX_FILTER_HFIELD_IP_PROTOCOL (9) /* TCP / UDP / ICMP / ICMPv6 / IGMP */
823 #define SL_WLAN_RX_FILTER_HFIELD_IPV4_SRC_ADDR (10)
824 #define SL_WLAN_RX_FILTER_HFIELD_IPV4_DST_ADDR (11)
825 #define SL_WLAN_RX_FILTER_HFIELD_IPV6_SRC_ADRR (12)
826 #define SL_WLAN_RX_FILTER_HFIELD_IPV6_DST_ADDR (13)
827 #define SL_WLAN_RX_FILTER_HFIELD_PORT_SRC (14)
828 #define SL_WLAN_RX_FILTER_HFIELD_PORT_DST (15)
829 #define SL_WLAN_RX_FILTER_HFIELD_L4_PAYLOAD_PATTERN (19) /* use to look for patterns on the TCP and UDP payloads (after TCP/UDP header) */
830 #define SL_WLAN_RX_FILTER_HFIELD_L1_PAYLOAD_PATTERN (20) /* use to look for patterns on the PHY payload (i.e. beginning of WLAN MAC header) */
831 #define SL_WLAN_RX_FILTER_HFIELD_MAX_FIELD (21) /* Definition */
832 
833 
834 /* Holds the header ARGS which are used in case of HDR rule */
835 typedef union
836 {
837  /* buffer for pattern matching in payload up to 16 bytes (Binary Values) */
839 
840  /* Buffer for ipv4 address filter. binary arguments, number of argument may be up to SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS*/
841  _u8 Ipv4[SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][4]; /* Binary Values for comparison */
842 
843  /* Buffer for ipv4 address filter. Ascii arguments - IPv4 address: 4 bytes: ddd.ddd.ddd.ddd - 15 chars. Number of argument may be up to SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS*/
844  _u8 Ipv4Ascii[SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][16]; /* Ascii Values for comparison */
845 
846  /* Buffer for ipv6 address filter. binary arguments, Ascii format is not supported. number of argument may be up to SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS*/
847  _u8 Ipv6[SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][16]; /* Binary Values for comparison */
848 
849  /* Buffer for mac address filter. binary arguments. number of argument may be up to SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS*/
850  _u8 Mac[SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][6]; /* Binary Values for comparison */
851 
852  /* Buffer for mac address filter. Ascii arguments - MAC address: 6 bytes: xx:xx:xx:xx:xx:xx - 17 chars. number of argument may be up to SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS */
853  _u8 MacAscii[SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][18]; /* Ascii Values for comparison */
854 
855  /* Buffer for BSSID address filter. binary arguments. number of argument may be up to SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS*/
856  _u8 Bssid[SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][6]; /* Binary Values for comparison */
857 
858  /* Buffer for frame length filter. number of argument may be up to SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS */
859  _u32 FrameLength[SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS]; /* Binary Values for comparison */
860 
861  /* Buffer for port filter. number of argument may be up to SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS */
862  _u16 Port[SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS]; /* Binary Values for comparison */
863 
864  /* Buffer for Ether filter. number of argument may be up to SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS (according to host endianity) */
865  _u32 EtherType[SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS]; /* Binary Values for comparison */
866 
867  /* Buffer for ip version filter. Buffer for binary arguments. IP Version - 4 for IPV4 and 6 for IPV6 */
868  _u8 IpVersion;
869 
870  /* Buffer for frame type filter. Buffer for binary arguments. Frame Type (0 - management, 1 - Control, 2 - Data) */
871  _u8 Frametype[SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS];
872 
873  /* Buffer for frame subtype filter. Buffer for binary arguments. Frame Sub Type (checkout the full list in the 802.11 spec). e.g. Beacon=0x80, Data=0x08, Qos-Data=0x04, ACK=0xD4, etc. */
874  _u8 FrameSubtype[SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS];
875 
876  /* Buffer for protocol type filter. Buffer for binary arguments. e.g. 1 – ICMP (IPV4 only), 2 - IGMP (IPV4 only), 6 – TCP. 17 – UDP, 58 – ICMPV6 */
877  _u8 IpProtocol[SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS];
878 
879  /* Buffer for ip version filter. Buffer for ASCII arguments. Use for IP version field comparison settings: "IPV4", "IPV6" */
880  _u8 IpVersionAscii[4];
881 
882  /* Buffer for frame type filter. Buffer for ASCII arguments. Use for Frame type field comparison settings: "MGMT", "CTRL", "DATA" */
883  _u8 FrametypeAscii[SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][4];
884 
885  /* Buffer for protocol type filter. Buffer for ASCII arguments. Use for protocol field comparison settings: "ICMP", "IGMP", "TCP, "UDP", "ICMP6" */
886  /* Note: Use memcpy with these strings instead of strcpy (no \0 should be at the end, as the array is 5 bytes long and ICMP6 is already 5 bytes long without the \0) */
887  _u8 IpProtocolAscii[SL_WLAN_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][5];
888 
890 
891 
892 /* Defines the Header Args and mask */
893 typedef struct
894 {
895  SlWlanRxFilterHeaderArg_u Value; /* Argument for the comparison function */
896  _u8 Mask[16]; /* the mask is used in order to enable partial comparison (bit level), Use the 0xFFFFFFFF in case you don't want to use mask */
897 
899 
900 /* defines the Header rule. The header rule defines the compare function on the protocol header
901  For example destMacAddre is between ( 12:6::78:77, 12:6::78:90 ) */
902 typedef struct
903 {
904  SlWlanRxFilterRuleHeaderArgs_t Args; /* Filter arguemnts */
905  SlWlanRxFilterRuleHeaderField_t Field; /* Packet HDR field which will be compared to the argument */
906  SlWlanRxFilterRuleHeaderCompareFunction_t CompareFunc; /* type of the comparison function */
907  _u8 Padding[2];
909 
910 
911 /* Optional operators for the combination type filterID1 is located in the first arg , filterId2 is the second arg */
912 typedef _u8 SlWlanRxFilterRuleCombinationOperator_t;
913 /* Possible values for SlWlanRxFilterRuleCombinationOperator_t */
914 #define SL_WLAN_RX_FILTER_COMBINED_FUNC_NOT (0) /* filterID1 */
915 #define SL_WLAN_RX_FILTER_COMBINED_FUNC_AND (1) /* filterID1 && filterID2 */
916 #define SL_WLAN_RX_FILTER_COMBINED_FUNC_OR (2) /* filterID1 && filterID2 */
917 
918 
919 /* Defines the structure which define the combination type filter
920  The combined filter enable to make operation on one or two filter,
921  for example filterId1 or and(filterId2,filterId3). */
922 typedef struct
923 {
924  SlWlanRxFilterRuleCombinationOperator_t Operator; /* combination operator */
925  SlWlanRxFilterID_t CombinationFilterId[SL_WLAN_RX_FILTER_RANGE_ARGS]; /* filterID, may be one or two depends on the combination operator type */
926  _u8 Padding;
928 
929 
930 /* Rule structure composed of behavioral flags and the filter rule definitions */
931 typedef union
932 {
933  SlWlanRxFilterRuleHeader_t Header; /* Filter is from type Header */
934  SlWlanRxFilterRuleCombination_t Combination; /* Filter is from type Combination */
936 
937 
938 /* Bit field which represents the roleId possible values
939  In the current release only Station (with or without promiscuous modes) and AP roles are supported.
940  Activating filters before P2P negotiations (i.e. decision whether role is CL or GO) may result with
941  unexpected behaviour. After this stage, filters can be activated whereas STA role is the equivalent of P2P CL role
942  AP role is the equivalent of P2P GO role.
943  */
944 typedef _u8 SlWlanRxFilterTriggerRoles_t;
945 /* Possible values for SlWlanRxFilterTriggerRoles_t */
946 #define SL_WLAN_RX_FILTER_ROLE_AP (1)
947 #define SL_WLAN_RX_FILTER_ROLE_STA (2)
948 #define SL_WLAN_RX_FILTER_ROLE_TRANCIEVER (4)
949 #define SL_WLAN_RX_FILTER_ROLE_NULL (0)
950 
951 
952 typedef _u8 SlWlanRxFilterTriggerConnectionStates_t;
953 /* Possible values for SlWlanRxFilterTriggerConnectionStates_t */
954 #define SL_WLAN_RX_FILTER_STATE_STA_CONNECTED (0x1)
955 #define SL_WLAN_RX_FILTER_STATE_STA_NOT_CONNECTED (0x2)
956 #define SL_WLAN_RX_FILTER_STATE_STA_HAS_IP (0x4)
957 #define SL_WLAN_RX_FILTER_STATE_STA_HAS_NO_IP (0x8)
958 
959 
960 /* There are 8 possible counter. if no counter is needed set to NO_TRIGGER_COUNTER */
961 typedef _u8 SlWlanRxFilterCounterId_t;
962 /* Possible values for SlWlanRxFilterCounterId_t */
963 #define SL_WLAN_RX_FILTER_NO_TRIGGER_COUNTER (0)
964 #define SL_WLAN_RX_FILTER_COUNTER1 (1)
965 #define SL_WLAN_RX_FILTER_COUNTER2 (2)
966 #define SL_WLAN_RX_FILTER_COUNTER3 (3)
967 #define SL_WLAN_RX_FILTER_COUNTER4 (4)
968 #define SL_WLAN_RX_FILTER_COUNTER5 (5)
969 #define SL_WLAN_RX_FILTER_COUNTER6 (6)
970 #define SL_WLAN_RX_FILTER_COUNTER7 (7)
971 #define SL_WLAN_RX_FILTER_COUNTER8 (8)
972 #define SL_WLAN_RX_FILTER_MAX_COUNTER (9)
973 
974 
975 /* The filter trigger, determine when the filter is triggered,
976  The filter is triggered in the following condition :\n
977  1. The filter parent is triggered\n
978  2. The requested connection type exists, i.e. wlan_connect\n
979  3. The filter role is the same as the system role\n */
980 typedef struct
981 {
982  SlWlanRxFilterID_t ParentFilterID; /* The parent filter ID, this is the way to build filter tree. NULL value means tree root */
983  SlWlanRxFilterCounterId_t Counter; /* Trigger only when reach counter threshold */
984  SlWlanRxFilterTriggerConnectionStates_t ConnectionState; /* Trigger only with specific connection state */
985  SlWlanRxFilterTriggerRoles_t Role; /* Trigger only with specific role */
986  _u32 CounterVal; /* Value for the counter if set */
987  SlWlanRxFilterTriggerCompareFunction_t CompareFunction; /* The compare function reffers to the counter if set */
988  _u8 Padding[3];
990 
991 
992 /* The actions are executed only if the filter is matched,\n
993  * In case of false match the packet is transfered to the HOST. \n
994  * The action is composed of bit field structure, up to 2 actions can be defined per filter.\n */
995 typedef _u8 SlWlanRxFilterActionType_t;
996 /* Possible values for SlWlanRxFilterActionType_t */
997 #define SL_WLAN_RX_FILTER_ACTION_NULL (0x0) /* No action to execute*/
998 #define SL_WLAN_RX_FILTER_ACTION_DROP (0x1) /* If not dropped ,The packet is passed to the next filter or in case it is the last filter to the host */
999 #define SL_WLAN_RX_FILTER_ACTION_ON_REG_INCREASE (0x4) /* action increase counter registers */
1000 #define SL_WLAN_RX_FILTER_ACTION_ON_REG_DECREASE (0x8) /* action decrease counter registers */
1001 #define SL_WLAN_RX_FILTER_ACTION_ON_REG_RESET (0x10)/* action reset counter registers */
1002 #define SL_WLAN_RX_FILTER_ACTION_SEND_TEMPLATE (0x20)/* unsupported */
1003 #define SL_WLAN_RX_FILTER_ACTION_EVENT_TO_HOST (0x40)/* action can send events to host */
1004 
1005 
1006 
1007 /* Several actions can be defined The action is executed in case the filter rule is matched. */
1008 typedef struct
1009 {
1010  SlWlanRxFilterActionType_t Type; /* Determine which actions are supported */
1011  _u8 Counter; /* The counter in use. In case the action is of type increase\decrease\reset this arg will contain the counter number, The counter number values are as in ::SlWlanRxFilterCounterId_t.\n*/
1012  _u16 Reserved; /* Must be set to zero */
1013  _u8 UserId; /* In case action set to host event, user can set id which will return in the event arguments */
1014  _u8 Padding[3];
1015 
1017 
1018 /* The supported operation: SL_WLAN_RX_FILTER_STATE, SL_WLAN_RX_FILTER_REMOVE */
1019 typedef struct
1020 {
1021  SlWlanRxFilterIdMask_t FilterBitmap;
1022  _u8 Padding[4];
1023 
1025 
1026 /* The supported operation: SL_WLAN_RX_FILTER_UPDATE_ARGS */
1027 typedef struct
1028 {
1029  _u8 FilterId;
1030  _u8 BinaryOrAscii; /* Set 1 for Binary argument representation, 0 - for Ascii representation */
1031  _u8 Padding[2];
1033 
1034 
1036 
1037 
1038 /* Filters bitmap enable\disable status return value */
1039 typedef struct
1040 {
1041  SlWlanRxFilterIdMask_t FilterIdMask; /* The filter set bit map */
1042 
1044 
1045 /* Disbale/Enable system filters */
1046 typedef struct
1047 {
1048  SlWlanRxFilterSysFiltersMask_t FilterBitmap; /* The filter set bit map */
1049 
1051 
1052 /* System filters status return value */
1053 typedef struct
1054 {
1055  SlWlanRxFilterSysFiltersMask_t FilterBitmap; /* The filter get bit map */
1056 
1058 
1059 
1060 /*****************************************************************************/
1061 /* Function prototypes */
1062 /*****************************************************************************/
1063 
1064 
1102 #if _SL_INCLUDE_FUNC(sl_WlanConnect)
1103 _i16 sl_WlanConnect(const _i8* pName,const _i16 NameLen,const _u8 *pMacAddr,const SlWlanSecParams_t* pSecParams ,const SlWlanSecParamsExt_t* pSecExtParams);
1104 #endif
1105 
1117 #if _SL_INCLUDE_FUNC(sl_WlanDisconnect)
1118 _i16 sl_WlanDisconnect(void);
1119 #endif
1120 
1166 #if _SL_INCLUDE_FUNC(sl_WlanProfileAdd)
1167 _i16 sl_WlanProfileAdd(const _i8* pName,const _i16 NameLen,const _u8 *pMacAddr,const SlWlanSecParams_t* pSecParams ,const SlWlanSecParamsExt_t* pSecExtParams,const _u32 Priority,const _u32 Options);
1168 #endif
1169 
1201 #if _SL_INCLUDE_FUNC(sl_WlanProfileGet)
1202 _i16 sl_WlanProfileGet(const _i16 Index,_i8* pName, _i16 *pNameLen, _u8 *pMacAddr, SlWlanSecParams_t* pSecParams, SlWlanGetSecParamsExt_t* pSecExtParams, _u32 *pPriority);
1203 #endif
1204 
1220 #if _SL_INCLUDE_FUNC(sl_WlanProfileDel)
1221 _i16 sl_WlanProfileDel(const _i16 Index);
1222 #endif
1223 
1351 #if _SL_INCLUDE_FUNC(sl_WlanPolicySet)
1352 _i16 sl_WlanPolicySet(const _u8 Type , const _u8 Policy, _u8 *pVal,const _u8 ValLen);
1353 #endif
1354 
1442 #if _SL_INCLUDE_FUNC(sl_WlanPolicyGet)
1443 _i16 sl_WlanPolicyGet(const _u8 Type ,_u8 *pPolicy,_u8 *pVal,_u8 *pValLen);
1444 #endif
1445 
1486 #if _SL_INCLUDE_FUNC(sl_WlanGetNetworkList)
1487 _i16 sl_WlanGetNetworkList(const _u8 Index,const _u8 Count, SlWlanNetworkEntry_t *pEntries);
1488 #endif
1489 
1528 #if _SL_INCLUDE_FUNC(sl_WlanRxStatStart)
1529 _i16 sl_WlanRxStatStart(void);
1530 #endif
1531 
1543 #if _SL_INCLUDE_FUNC(sl_WlanRxStatStop)
1544 _i16 sl_WlanRxStatStop(void);
1545 #endif
1546 
1547 
1559 #if _SL_INCLUDE_FUNC(sl_WlanRxStatGet)
1560 _i16 sl_WlanRxStatGet(SlWlanGetRxStatResponse_t *pRxStat,const _u32 Flags);
1561 #endif
1562 
1563 
1619 #if _SL_INCLUDE_FUNC(sl_WlanProvisioning)
1620 _i16 sl_WlanProvisioning(_u8 ProvisioningCmd, _u8 RequestedRoleAfterSuccess, _u16 InactivityTimeoutSec, char *pSmartConfigKey, _u32 Flags);
1621 #endif
1622 
1623 
1624 
1650 #if _SL_INCLUDE_FUNC(sl_WlanSetMode)
1651 _i16 sl_WlanSetMode(const _u8 Mode);
1652 #endif
1653 
1654 
1966 #if _SL_INCLUDE_FUNC(sl_WlanSet)
1967 _i16 sl_WlanSet(const _u16 ConfigId ,const _u16 ConfigOpt,const _u16 ConfigLen,const _u8 *pValues);
1968 #endif
1969 
2257 #if _SL_INCLUDE_FUNC(sl_WlanGet)
2258 _i16 sl_WlanGet(const _u16 ConfigId, _u16 *pConfigOpt,_u16 *pConfigLen, _u8 *pValues);
2259 #endif
2260 
2286 #if _SL_INCLUDE_FUNC(sl_WlanRxFilterAdd)
2287 _i16 sl_WlanRxFilterAdd( SlWlanRxFilterRuleType_t RuleType,
2288  SlWlanRxFilterFlags_u Flags,
2289  const SlWlanRxFilterRule_u* const pRule,
2290  const SlWlanRxFilterTrigger_t* const pTrigger,
2291  const SlWlanRxFilterAction_t* const pAction,
2292  SlWlanRxFilterID_t* pFilterId);
2293 
2294 #endif
2295 
2296 
2297 
2298 
2307 #ifdef __cplusplus
2308 }
2309 #endif /* __cplusplus */
2310 
2311 #endif /* __WLAN_H__ */
2312 
_i16 sl_WlanSetMode(const _u8 Mode)
Wlan set mode.
Definition: wlan.c:873
_i16 sl_WlanRxFilterAdd(SlWlanRxFilterRuleType_t RuleType, SlWlanRxFilterFlags_u Flags, const SlWlanRxFilterRule_u *const pRule, const SlWlanRxFilterTrigger_t *const pTrigger, const SlWlanRxFilterAction_t *const pAction, SlWlanRxFilterID_t *pFilterId)
Adds new filter rule to the system.
Definition: wlan.c:698
_i16 sl_WlanConnect(const _i8 *pName, const _i16 NameLen, const _u8 *pMacAddr, const SlWlanSecParams_t *pSecParams, const SlWlanSecParamsExt_t *pSecExtParams)
Connect to wlan network as a station.
Definition: wlan.c:73
_i16 sl_WlanGet(const _u16 ConfigId, _u16 *pConfigOpt, _u16 *pConfigLen, _u8 *pValues)
Getting WLAN configurations.
Definition: wlan.c:953
_i16 sl_WlanProvisioning(_u8 ProvisioningCmd, _u8 RequestedRoleAfterSuccess, _u16 InactivityTimeoutSec, char *pSmartConfigKey, _u32 Flags)
The simpleLink will switch to the appropriate role according to the provisioning mode requested and w...
Definition: wlan.c:806
Definition: wlan.h:653
_i16 sl_WlanPolicySet(const _u8 Type, const _u8 Policy, _u8 *pVal, const _u8 ValLen)
Set policy values.
Definition: wlan.c:244
_i16 sl_WlanProfileAdd(const _i8 *pName, const _i16 NameLen, const _u8 *pMacAddr, const SlWlanSecParams_t *pSecParams, const SlWlanSecParamsExt_t *pSecExtParams, const _u32 Priority, const _u32 Options)
Add profile.
Definition: wlan.c:351
_i16 sl_WlanRxStatStop(void)
Stop collecting wlan RX statistic, (if previous called sl_WlanRxStatStart)
Definition: wlan.c:744
_i16 sl_WlanProfileGet(const _i16 Index, _i8 *pName, _i16 *pNameLen, _u8 *pMacAddr, SlWlanSecParams_t *pSecParams, SlWlanGetSecParamsExt_t *pSecExtParams, _u32 *pPriority)
Get profile.
Definition: wlan.c:537
_i16 sl_WlanSet(const _u16 ConfigId, const _u16 ConfigOpt, const _u16 ConfigLen, const _u8 *pValues)
Setting WLAN configurations.
Definition: wlan.c:911
_i16 sl_WlanProfileDel(const _i16 Index)
Delete WLAN profile.
Definition: wlan.c:604
_i16 sl_WlanDisconnect(void)
Wlan disconnect.
Definition: wlan.c:216
_i16 sl_WlanPolicyGet(const _u8 Type, _u8 *pPolicy, _u8 *pVal, _u8 *pValLen)
Get policy values.
Definition: wlan.c:288
_i16 sl_WlanRxStatStart(void)
Start collecting wlan RX statistics, for unlimited time.
Definition: wlan.c:733
_i16 sl_WlanRxStatGet(SlWlanGetRxStatResponse_t *pRxStat, const _u32 Flags)
Get wlan RX statistics. Upon calling this command, the statistics counters will be cleared...
Definition: wlan.c:755
_i16 sl_WlanGetNetworkList(const _u8 Index, const _u8 Count, SlWlanNetworkEntry_t *pEntries)
Gets the WLAN scan operation results.
Definition: wlan.c:640