1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3 *
4 * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
5 *
6 ******************************************************************************/
7 #ifndef _WIFI_H_
8 #define _WIFI_H_
9
10 #define WLAN_IEEE_OUI_LEN 3
11 #define WLAN_CRC_LEN 4
12 #define WLAN_BSSID_LEN 6
13 #define WLAN_BSS_TS_LEN 8
14 #define WLAN_HDR_A3_LEN 24
15 #define WLAN_HDR_A4_LEN 30
16 #define WLAN_HDR_A3_QOS_LEN 26
17 #define WLAN_HDR_A4_QOS_LEN 32
18 #define WLAN_DATA_MAXLEN 2312
19
20 #define WLAN_A3_PN_OFFSET 24
21 #define WLAN_A4_PN_OFFSET 30
22
23 #define WLAN_MIN_ETHFRM_LEN 60
24 #define WLAN_MAX_ETHFRM_LEN 1514
25
26 #define P80211CAPTURE_VERSION 0x80211001
27
28 /* This value is tested by WiFi 11n Test Plan 5.2.3. */
29 /* This test verifies the WLAN NIC can update the NAV through sending
30 * the CTS with large duration.
31 */
32 #define WiFiNavUpperUs 30000 /* 30 ms */
33
34 enum WIFI_FRAME_TYPE {
35 WIFI_MGT_TYPE = (0),
36 WIFI_CTRL_TYPE = (BIT(2)),
37 WIFI_DATA_TYPE = (BIT(3)),
38 WIFI_QOS_DATA_TYPE = (BIT(7) | BIT(3)), /* QoS Data */
39 };
40
41 enum WIFI_FRAME_SUBTYPE {
42 /* below is for mgt frame */
43 WIFI_ASSOCREQ = (0 | WIFI_MGT_TYPE),
44 WIFI_ASSOCRSP = (BIT(4) | WIFI_MGT_TYPE),
45 WIFI_REASSOCREQ = (BIT(5) | WIFI_MGT_TYPE),
46 WIFI_REASSOCRSP = (BIT(5) | BIT(4) | WIFI_MGT_TYPE),
47 WIFI_PROBEREQ = (BIT(6) | WIFI_MGT_TYPE),
48 WIFI_PROBERSP = (BIT(6) | BIT(4) | WIFI_MGT_TYPE),
49 WIFI_BEACON = (BIT(7) | WIFI_MGT_TYPE),
50 WIFI_ATIM = (BIT(7) | BIT(4) | WIFI_MGT_TYPE),
51 WIFI_DISASSOC = (BIT(7) | BIT(5) | WIFI_MGT_TYPE),
52 WIFI_AUTH = (BIT(7) | BIT(5) | BIT(4) | WIFI_MGT_TYPE),
53 WIFI_DEAUTH = (BIT(7) | BIT(6) | WIFI_MGT_TYPE),
54 WIFI_ACTION = (BIT(7) | BIT(6) | BIT(4) | WIFI_MGT_TYPE),
55
56 /* below is for control frame */
57 WIFI_PSPOLL = (BIT(7) | BIT(5) | WIFI_CTRL_TYPE),
58 WIFI_RTS = (BIT(7) | BIT(5) | BIT(4) | WIFI_CTRL_TYPE),
59 WIFI_CTS = (BIT(7) | BIT(6) | WIFI_CTRL_TYPE),
60 WIFI_ACK = (BIT(7) | BIT(6) | BIT(4) | WIFI_CTRL_TYPE),
61 WIFI_CFEND = (BIT(7) | BIT(6) | BIT(5) | WIFI_CTRL_TYPE),
62 WIFI_CFEND_CFACK = (BIT(7) | BIT(6) | BIT(5) | BIT(4) |
63 WIFI_CTRL_TYPE),
64
65 /* below is for data frame */
66 WIFI_DATA = (0 | WIFI_DATA_TYPE),
67 WIFI_DATA_CFACK = (BIT(4) | WIFI_DATA_TYPE),
68 WIFI_DATA_CFPOLL = (BIT(5) | WIFI_DATA_TYPE),
69 WIFI_DATA_CFACKPOLL = (BIT(5) | BIT(4) | WIFI_DATA_TYPE),
70 WIFI_DATA_NULL = (BIT(6) | WIFI_DATA_TYPE),
71 WIFI_CF_ACK = (BIT(6) | BIT(4) | WIFI_DATA_TYPE),
72 WIFI_CF_POLL = (BIT(6) | BIT(5) | WIFI_DATA_TYPE),
73 WIFI_CF_ACKPOLL = (BIT(6) | BIT(5) | BIT(4) | WIFI_DATA_TYPE),
74 WIFI_QOS_DATA_NULL = (BIT(6) | WIFI_QOS_DATA_TYPE),
75 };
76
77 enum WIFI_STATUS_CODE {
78 _STATS_SUCCESSFUL_ = 0,
79 _STATS_FAILURE_ = 1,
80 _STATS_CAP_FAIL_ = 10,
81 _STATS_NO_ASOC_ = 11,
82 _STATS_OTHER_ = 12,
83 _STATS_NO_SUPP_ALG_ = 13,
84 _STATS_OUT_OF_AUTH_SEQ_ = 14,
85 _STATS_CHALLENGE_FAIL_ = 15,
86 _STATS_AUTH_TIMEOUT_ = 16,
87 _STATS_UNABLE_HANDLE_STA_ = 17,
88 _STATS_RATE_FAIL_ = 18,
89 };
90
91 enum WIFI_REG_DOMAIN {
92 DOMAIN_FCC = 1,
93 DOMAIN_IC = 2,
94 DOMAIN_ETSI = 3,
95 DOMAIN_SPA = 4,
96 DOMAIN_FRANCE = 5,
97 DOMAIN_MKK = 6,
98 DOMAIN_ISRAEL = 7,
99 DOMAIN_MKK1 = 8,
100 DOMAIN_MKK2 = 9,
101 DOMAIN_MKK3 = 10,
102 DOMAIN_MAX
103 };
104
105 #define _TO_DS_ BIT(8)
106 #define _FROM_DS_ BIT(9)
107 #define _MORE_FRAG_ BIT(10)
108 #define _RETRY_ BIT(11)
109 #define _PWRMGT_ BIT(12)
110 #define _MORE_DATA_ BIT(13)
111 #define _PRIVACY_ BIT(14)
112 #define _ORDER_ BIT(15)
113
114 #define SetToDs(pbuf) \
115 *(__le16 *)(pbuf) |= cpu_to_le16(_TO_DS_)
116
117 #define GetToDs(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_TO_DS_)) != 0)
118
119 #define ClearToDs(pbuf) \
120 *(__le16 *)(pbuf) &= (~cpu_to_le16(_TO_DS_))
121
122 #define SetFrDs(pbuf) \
123 *(__le16 *)(pbuf) |= cpu_to_le16(_FROM_DS_)
124
125 #define GetFrDs(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_FROM_DS_)) != 0)
126
127 #define ClearFrDs(pbuf) \
128 *(__le16 *)(pbuf) &= (~cpu_to_le16(_FROM_DS_))
129
130 #define get_tofr_ds(pframe) ((GetToDs(pframe) << 1) | GetFrDs(pframe))
131
132 #define SetMFrag(pbuf) \
133 *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_FRAG_)
134
135 #define GetMFrag(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_MORE_FRAG_)) != 0)
136
137 #define ClearMFrag(pbuf) \
138 *(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_FRAG_))
139
140 #define SetRetry(pbuf) \
141 *(__le16 *)(pbuf) |= cpu_to_le16(_RETRY_)
142
143 #define GetRetry(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_RETRY_)) != 0)
144
145 #define ClearRetry(pbuf) \
146 *(__le16 *)(pbuf) &= (~cpu_to_le16(_RETRY_))
147
148 #define SetPwrMgt(pbuf) \
149 *(__le16 *)(pbuf) |= cpu_to_le16(_PWRMGT_)
150
151 #define GetPwrMgt(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_PWRMGT_)) != 0)
152
153 #define ClearPwrMgt(pbuf) \
154 *(__le16 *)(pbuf) &= (~cpu_to_le16(_PWRMGT_))
155
156 #define SetMData(pbuf) \
157 *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_DATA_)
158
159 #define GetMData(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_MORE_DATA_)) != 0)
160
161 #define ClearMData(pbuf) \
162 *(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_DATA_))
163
164 #define SetPrivacy(pbuf) \
165 *(__le16 *)(pbuf) |= cpu_to_le16(_PRIVACY_)
166
167 #define GetPrivacy(pbuf) \
168 (((*(__le16 *)(pbuf)) & cpu_to_le16(_PRIVACY_)) != 0)
169
170 #define GetOrder(pbuf) \
171 (((*(__le16 *)(pbuf)) & cpu_to_le16(_ORDER_)) != 0)
172
173 #define GetFrameType(pbuf) \
174 (le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(3) | BIT(2)))
175
176 #define GetFrameSubType(pbuf) (le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(7) |\
177 BIT(6) | BIT(5) | BIT(4) | BIT(3) | BIT(2)))
178
179 #define SetFrameSubType(pbuf, type) \
180 do { \
181 *(__le16 *)(pbuf) &= cpu_to_le16(~(BIT(7) | BIT(6) | \
182 BIT(5) | BIT(4) | BIT(3) | BIT(2))); \
183 *(__le16 *)(pbuf) |= cpu_to_le16(type); \
184 } while (0)
185
186 #define GetSequence(pbuf) \
187 (le16_to_cpu(*(__le16 *)((size_t)(pbuf) + 22)) >> 4)
188
189 #define GetFragNum(pbuf) \
190 (le16_to_cpu(*(__le16 *)((size_t)(pbuf) + 22)) & 0x0f)
191
192 #define SetSeqNum(pbuf, num) \
193 do { \
194 *(__le16 *)((size_t)(pbuf) + 22) = \
195 ((*(__le16 *)((size_t)(pbuf) + 22)) & cpu_to_le16((unsigned short)0x000f)) | \
196 cpu_to_le16((unsigned short)(0xfff0 & (num << 4))); \
197 } while (0)
198
199 #define SetDuration(pbuf, dur) \
200 *(__le16 *)((size_t)(pbuf) + 2) = cpu_to_le16(0xffff & (dur))
201
202 #define SetPriority(pbuf, tid) \
203 *(__le16 *)(pbuf) |= cpu_to_le16(tid & 0xf)
204
205 #define GetPriority(pbuf) ((le16_to_cpu(*(__le16 *)(pbuf))) & 0xf)
206
207 #define SetEOSP(pbuf, eosp) \
208 *(__le16 *)(pbuf) |= cpu_to_le16((eosp & 1) << 4)
209
210 #define SetAckpolicy(pbuf, ack) \
211 *(__le16 *)(pbuf) |= cpu_to_le16((ack & 3) << 5)
212
213 #define GetAckpolicy(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 5) & 0x3)
214
215 #define GetAMsdu(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 7) & 0x1)
216
217 #define GetAid(pbuf) (le16_to_cpu(*(__le16 *)((size_t)(pbuf) + 2)) & 0x3fff)
218
219 #define GetAddr1Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 4))
220
221 #define GetAddr2Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 10))
222
223 #define GetAddr3Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 16))
224
225 #define GetAddr4Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 24))
226
get_da(unsigned char * pframe)227 static inline unsigned char *get_da(unsigned char *pframe)
228 {
229 unsigned char *da;
230 unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
231
232 switch (to_fr_ds) {
233 case 0x00: /* ToDs=0, FromDs=0 */
234 da = GetAddr1Ptr(pframe);
235 break;
236 case 0x01: /* ToDs=0, FromDs=1 */
237 da = GetAddr1Ptr(pframe);
238 break;
239 case 0x02: /* ToDs=1, FromDs=0 */
240 da = GetAddr3Ptr(pframe);
241 break;
242 default: /* ToDs=1, FromDs=1 */
243 da = GetAddr3Ptr(pframe);
244 break;
245 }
246 return da;
247 }
248
get_sa(unsigned char * pframe)249 static inline unsigned char *get_sa(unsigned char *pframe)
250 {
251 unsigned char *sa;
252 unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
253
254 switch (to_fr_ds) {
255 case 0x00: /* ToDs=0, FromDs=0 */
256 sa = GetAddr2Ptr(pframe);
257 break;
258 case 0x01: /* ToDs=0, FromDs=1 */
259 sa = GetAddr3Ptr(pframe);
260 break;
261 case 0x02: /* ToDs=1, FromDs=0 */
262 sa = GetAddr2Ptr(pframe);
263 break;
264 default: /* ToDs=1, FromDs=1 */
265 sa = GetAddr4Ptr(pframe);
266 break;
267 }
268 return sa;
269 }
270
get_hdr_bssid(unsigned char * pframe)271 static inline unsigned char *get_hdr_bssid(unsigned char *pframe)
272 {
273 unsigned char *sa;
274 unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
275
276 switch (to_fr_ds) {
277 case 0x00: /* ToDs=0, FromDs=0 */
278 sa = GetAddr3Ptr(pframe);
279 break;
280 case 0x01: /* ToDs=0, FromDs=1 */
281 sa = GetAddr2Ptr(pframe);
282 break;
283 case 0x02: /* ToDs=1, FromDs=0 */
284 sa = GetAddr1Ptr(pframe);
285 break;
286 case 0x03: /* ToDs=1, FromDs=1 */
287 sa = GetAddr1Ptr(pframe);
288 break;
289 default:
290 sa = NULL; /* */
291 break;
292 }
293 return sa;
294 }
295
IsFrameTypeCtrl(unsigned char * pframe)296 static inline int IsFrameTypeCtrl(unsigned char *pframe)
297 {
298 if (GetFrameType(pframe) == WIFI_CTRL_TYPE)
299 return true;
300 else
301 return false;
302 }
303
304 /*-----------------------------------------------------------------------------
305 Below is for the security related definition
306 ------------------------------------------------------------------------------*/
307 #define _RESERVED_FRAME_TYPE_ 0
308 #define _SKB_FRAME_TYPE_ 2
309 #define _PRE_ALLOCMEM_ 1
310 #define _PRE_ALLOCHDR_ 3
311 #define _PRE_ALLOCLLCHDR_ 4
312 #define _PRE_ALLOCICVHDR_ 5
313 #define _PRE_ALLOCMICHDR_ 6
314
315 #define _SIFSTIME_ \
316 ((priv->pmib->dot11BssType.net_work_type & WIRELESS_11A) ? 16 : 10)
317 #define _ACKCTSLNG_ 14 /* 14 bytes long, including crclng */
318 #define _CRCLNG_ 4
319
320 #define _ASOCREQ_IE_OFFSET_ 4 /* excluding wlan_hdr */
321 #define _ASOCRSP_IE_OFFSET_ 6
322 #define _REASOCREQ_IE_OFFSET_ 10
323 #define _REASOCRSP_IE_OFFSET_ 6
324 #define _PROBEREQ_IE_OFFSET_ 0
325 #define _PROBERSP_IE_OFFSET_ 12
326 #define _AUTH_IE_OFFSET_ 6
327 #define _DEAUTH_IE_OFFSET_ 0
328 #define _BEACON_IE_OFFSET_ 12
329 #define _PUBLIC_ACTION_IE_OFFSET_ 8
330
331 #define _FIXED_IE_LENGTH_ _BEACON_IE_OFFSET_
332
333 #define _SSID_IE_ 0
334 #define _SUPPORTEDRATES_IE_ 1
335 #define _DSSET_IE_ 3
336 #define _TIM_IE_ 5
337 #define _IBSS_PARA_IE_ 6
338 #define _COUNTRY_IE_ 7
339 #define _CHLGETXT_IE_ 16
340 #define _SUPPORTED_CH_IE_ 36
341 #define _CH_SWTICH_ANNOUNCE_ 37 /* Secondary Channel Offset */
342 #define _RSN_IE_2_ 48
343 #define _SSN_IE_1_ 221
344 #define _ERPINFO_IE_ 42
345 #define _EXT_SUPPORTEDRATES_IE_ 50
346
347 #define _HT_CAPABILITY_IE_ 45
348 #define _FTIE_ 55
349 #define _TIMEOUT_ITVL_IE_ 56
350 #define _SRC_IE_ 59
351 #define _HT_EXTRA_INFO_IE_ 61
352 #define _HT_ADD_INFO_IE_ 61 /* _HT_EXTRA_INFO_IE_ */
353 #define _WAPI_IE_ 68
354
355 #define EID_BSSCoexistence 72 /* 20/40 BSS Coexistence */
356 #define EID_BSSIntolerantChlReport 73
357 #define _RIC_Descriptor_IE_ 75
358
359 #define _LINK_ID_IE_ 101
360 #define _CH_SWITCH_TIMING_ 104
361 #define _PTI_BUFFER_STATUS_ 106
362 #define _EXT_CAP_IE_ 127
363 #define _VENDOR_SPECIFIC_IE_ 221
364
365 #define _RESERVED47_ 47
366
367 /* ---------------------------------------------------------------------------
368 Below is the fixed elements...
369 -----------------------------------------------------------------------------*/
370 #define _AUTH_ALGM_NUM_ 2
371 #define _AUTH_SEQ_NUM_ 2
372 #define _BEACON_ITERVAL_ 2
373 #define _CAPABILITY_ 2
374 #define _CURRENT_APADDR_ 6
375 #define _LISTEN_INTERVAL_ 2
376 #define _RSON_CODE_ 2
377 #define _ASOC_ID_ 2
378 #define _STATUS_CODE_ 2
379 #define _TIMESTAMP_ 8
380
381 #define AUTH_ODD_TO 0
382 #define AUTH_EVEN_TO 1
383
384 #define WLAN_ETHCONV_ENCAP 1
385 #define WLAN_ETHCONV_RFC1042 2
386 #define WLAN_ETHCONV_8021h 3
387
388 #define cap_ESS BIT(0)
389 #define cap_IBSS BIT(1)
390 #define cap_CFPollable BIT(2)
391 #define cap_CFRequest BIT(3)
392 #define cap_Privacy BIT(4)
393 #define cap_ShortPremble BIT(5)
394 #define cap_PBCC BIT(6)
395 #define cap_ChAgility BIT(7)
396 #define cap_SpecMgmt BIT(8)
397 #define cap_QoSi BIT(9)
398 #define cap_ShortSlot BIT(10)
399
400 /*-----------------------------------------------------------------------------
401 Below is the definition for 802.11i / 802.1x
402 ------------------------------------------------------------------------------*/
403 #define _IEEE8021X_MGT_ 1 /* WPA */
404 #define _IEEE8021X_PSK_ 2 /* WPA with pre-shared key */
405
406 /*
407 * #define _NO_PRIVACY_ 0
408 * #define _WEP_40_PRIVACY_ 1
409 * #define _TKIP_PRIVACY_ 2
410 * #define _WRAP_PRIVACY_ 3
411 * #define _CCMP_PRIVACY_ 4
412 * #define _WEP_104_PRIVACY_ 5
413 * #define _WEP_WPA_MIXED_PRIVACY_ 6 WEP + WPA
414 */
415
416 /*-----------------------------------------------------------------------------
417 Below is the definition for WMM
418 ------------------------------------------------------------------------------*/
419 #define _WMM_IE_Length_ 7 /* for WMM STA */
420 #define _WMM_Para_Element_Length_ 24
421
422 /*-----------------------------------------------------------------------------
423 Below is the definition for 802.11n
424 ------------------------------------------------------------------------------*/
425
426 /**
427 * struct rtw_ieee80211_ht_cap - HT additional information
428 *
429 * This structure refers to "HT information element" as
430 * described in 802.11n draft section 7.3.2.53
431 */
432 struct ieee80211_ht_addt_info {
433 unsigned char control_chan;
434 unsigned char ht_param;
435 unsigned short operation_mode;
436 unsigned short stbc_param;
437 unsigned char basic_set[16];
438 } __packed;
439
440 struct HT_info_element {
441 unsigned char primary_channel;
442 unsigned char infos[5];
443 unsigned char MCS_rate[16];
444 } __packed;
445
446 struct AC_param {
447 unsigned char ACI_AIFSN;
448 unsigned char CW;
449 __le16 TXOP_limit;
450 } __packed;
451
452 struct WMM_para_element {
453 unsigned char QoS_info;
454 unsigned char reserved;
455 struct AC_param ac_param[4];
456 } __packed;
457
458 struct ADDBA_request {
459 unsigned char dialog_token;
460 __le16 BA_para_set;
461 unsigned short BA_timeout_value;
462 unsigned short BA_starting_seqctrl;
463 } __packed;
464
465 enum ht_cap_ampdu_factor {
466 MAX_AMPDU_FACTOR_8K = 0,
467 MAX_AMPDU_FACTOR_16K = 1,
468 MAX_AMPDU_FACTOR_32K = 2,
469 MAX_AMPDU_FACTOR_64K = 3,
470 };
471
472 #define OP_MODE_PURE 0
473 #define OP_MODE_MAY_BE_LEGACY_STAS 1
474 #define OP_MODE_20MHZ_HT_STA_ASSOCED 2
475 #define OP_MODE_MIXED 3
476
477 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK ((u8)BIT(0) | BIT(1))
478 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE ((u8)BIT(0))
479 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW ((u8)BIT(0) | BIT(1))
480 #define HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH ((u8)BIT(2))
481 #define HT_INFO_HT_PARAM_RIFS_MODE ((u8)BIT(3))
482 #define HT_INFO_HT_PARAM_CTRL_ACCESS_ONLY ((u8)BIT(4))
483 #define HT_INFO_HT_PARAM_SRV_INTERVAL_GRANULARITY ((u8)BIT(5))
484
485 #define HT_INFO_OPERATION_MODE_OP_MODE_MASK \
486 ((u16)(0x0001 | 0x0002))
487 #define HT_INFO_OPERATION_MODE_OP_MODE_OFFSET 0
488 #define HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT ((u8)BIT(2))
489 #define HT_INFO_OPERATION_MODE_TRANSMIT_BURST_LIMIT ((u8)BIT(3))
490 #define HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT ((u8)BIT(4))
491
492 #define HT_INFO_STBC_PARAM_DUAL_BEACON ((u16)BIT(6))
493 #define HT_INFO_STBC_PARAM_DUAL_STBC_PROTECT ((u16)BIT(7))
494 #define HT_INFO_STBC_PARAM_SECONDARY_BC ((u16)BIT(8))
495 #define HT_INFO_STBC_PARAM_LSIG_TXOP_PROTECT_ALLOWED ((u16)BIT(9))
496 #define HT_INFO_STBC_PARAM_PCO_ACTIVE ((u16)BIT(10))
497 #define HT_INFO_STBC_PARAM_PCO_PHASE ((u16)BIT(11))
498
499 /* ===============WPS Section=============== */
500 /* For WPSv1.0 */
501 #define WPSOUI 0x0050f204
502 /* WPS attribute ID */
503 #define WPS_ATTR_VER1 0x104A
504 #define WPS_ATTR_SIMPLE_CONF_STATE 0x1044
505 #define WPS_ATTR_RESP_TYPE 0x103B
506 #define WPS_ATTR_UUID_E 0x1047
507 #define WPS_ATTR_MANUFACTURER 0x1021
508 #define WPS_ATTR_MODEL_NAME 0x1023
509 #define WPS_ATTR_MODEL_NUMBER 0x1024
510 #define WPS_ATTR_SERIAL_NUMBER 0x1042
511 #define WPS_ATTR_PRIMARY_DEV_TYPE 0x1054
512 #define WPS_ATTR_SEC_DEV_TYPE_LIST 0x1055
513 #define WPS_ATTR_DEVICE_NAME 0x1011
514 #define WPS_ATTR_CONF_METHOD 0x1008
515 #define WPS_ATTR_RF_BANDS 0x103C
516 #define WPS_ATTR_DEVICE_PWID 0x1012
517 #define WPS_ATTR_REQUEST_TYPE 0x103A
518 #define WPS_ATTR_ASSOCIATION_STATE 0x1002
519 #define WPS_ATTR_CONFIG_ERROR 0x1009
520 #define WPS_ATTR_VENDOR_EXT 0x1049
521 #define WPS_ATTR_SELECTED_REGISTRAR 0x1041
522
523 /* Value of WPS Request Type Attribute */
524 #define WPS_REQ_TYPE_ENROLLEE_INFO_ONLY 0x00
525 #define WPS_REQ_TYPE_ENROLLEE_OPEN_8021X 0x01
526 #define WPS_REQ_TYPE_REGISTRAR 0x02
527 #define WPS_REQ_TYPE_WLAN_MANAGER_REGISTRAR 0x03
528
529 /* Value of WPS Response Type Attribute */
530 #define WPS_RESPONSE_TYPE_INFO_ONLY 0x00
531 #define WPS_RESPONSE_TYPE_8021X 0x01
532 #define WPS_RESPONSE_TYPE_REGISTRAR 0x02
533 #define WPS_RESPONSE_TYPE_AP 0x03
534
535 /* Value of WPS WiFi Simple Configuration State Attribute */
536 #define WPS_WSC_STATE_NOT_CONFIG 0x01
537 #define WPS_WSC_STATE_CONFIG 0x02
538
539 /* Value of WPS Version Attribute */
540 #define WPS_VERSION_1 0x10
541
542 /* Value of WPS Configuration Method Attribute */
543 #define WPS_CONFIG_METHOD_FLASH 0x0001
544 #define WPS_CONFIG_METHOD_ETHERNET 0x0002
545 #define WPS_CONFIG_METHOD_LABEL 0x0004
546 #define WPS_CONFIG_METHOD_DISPLAY 0x0008
547 #define WPS_CONFIG_METHOD_E_NFC 0x0010
548 #define WPS_CONFIG_METHOD_I_NFC 0x0020
549 #define WPS_CONFIG_METHOD_NFC 0x0040
550 #define WPS_CONFIG_METHOD_PBC 0x0080
551 #define WPS_CONFIG_METHOD_KEYPAD 0x0100
552 #define WPS_CONFIG_METHOD_VPBC 0x0280
553 #define WPS_CONFIG_METHOD_PPBC 0x0480
554 #define WPS_CONFIG_METHOD_VDISPLAY 0x2008
555 #define WPS_CONFIG_METHOD_PDISPLAY 0x4008
556
557 /* Value of Category ID of WPS Primary Device Type Attribute */
558 #define WPS_PDT_CID_DISPLAYS 0x0007
559 #define WPS_PDT_CID_MULIT_MEDIA 0x0008
560 #define WPS_PDT_CID_RTK_WIDI WPS_PDT_CID_MULIT_MEDIA
561
562 /* Value of Sub Category ID of WPS Primary Device Type Attribute */
563 #define WPS_PDT_SCID_MEDIA_SERVER 0x0005
564 #define WPS_PDT_SCID_RTK_DMP WPS_PDT_SCID_MEDIA_SERVER
565
566 /* Value of Device Password ID */
567 #define WPS_DPID_P 0x0000
568 #define WPS_DPID_USER_SPEC 0x0001
569 #define WPS_DPID_MACHINE_SPEC 0x0002
570 #define WPS_DPID_REKEY 0x0003
571 #define WPS_DPID_PBC 0x0004
572 #define WPS_DPID_REGISTRAR_SPEC 0x0005
573
574 /* Value of WPS RF Bands Attribute */
575 #define WPS_RF_BANDS_2_4_GHZ 0x01
576 #define WPS_RF_BANDS_5_GHZ 0x02
577
578 /* Value of WPS Association State Attribute */
579 #define WPS_ASSOC_STATE_NOT_ASSOCIATED 0x00
580 #define WPS_ASSOC_STATE_CONNECTION_SUCCESS 0x01
581 #define WPS_ASSOC_STATE_CONFIGURATION_FAILURE 0x02
582 #define WPS_ASSOC_STATE_ASSOCIATION_FAILURE 0x03
583 #define WPS_ASSOC_STATE_IP_FAILURE 0x04
584
585 /* WPS Configuration Method */
586 #define WPS_CM_NONE 0x0000
587 #define WPS_CM_LABEL 0x0004
588 #define WPS_CM_DISPLYA 0x0008
589 #define WPS_CM_EXTERNAL_NFC_TOKEN 0x0010
590 #define WPS_CM_INTEGRATED_NFC_TOKEN 0x0020
591 #define WPS_CM_NFC_INTERFACE 0x0040
592 #define WPS_CM_PUSH_BUTTON 0x0080
593 #define WPS_CM_KEYPAD 0x0100
594 #define WPS_CM_SW_PUHS_BUTTON 0x0280
595 #define WPS_CM_HW_PUHS_BUTTON 0x0480
596 #define WPS_CM_SW_DISPLAY_P 0x2008
597 #define WPS_CM_LCD_DISPLAY_P 0x4008
598
599 #define IP_MCAST_MAC(mac) \
600 ((mac[0] == 0x01) && (mac[1] == 0x00) && (mac[2] == 0x5e))
601 #define ICMPV6_MCAST_MAC(mac) \
602 ((mac[0] == 0x33) && (mac[1] == 0x33) && (mac[2] != 0xff))
603
604 #endif /* _WIFI_H_ */
605