1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
4 * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
6 ******************************************************************************/
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
20 #define WLAN_A3_PN_OFFSET 24
21 #define WLAN_A4_PN_OFFSET 30
23 #define WLAN_MIN_ETHFRM_LEN 60
24 #define WLAN_MAX_ETHFRM_LEN 1514
26 #define P80211CAPTURE_VERSION 0x80211001
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.
32 #define WiFiNavUpperUs 30000 /* 30 ms */
34 enum WIFI_FRAME_TYPE {
36 WIFI_CTRL_TYPE = (BIT(2)),
37 WIFI_DATA_TYPE = (BIT(3)),
38 WIFI_QOS_DATA_TYPE = (BIT(7) | BIT(3)), /* QoS Data */
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),
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) |
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),
77 enum WIFI_REASON_CODE {
79 _RSON_UNSPECIFIED_ = 1,
80 _RSON_AUTH_NO_LONGER_VALID_ = 2,
81 _RSON_DEAUTH_STA_LEAVING_ = 3,
82 _RSON_INACTIVITY_ = 4,
83 _RSON_UNABLE_HANDLE_ = 5,
86 _RSON_DISAOC_STA_LEAVING_ = 8,
87 _RSON_ASOC_NOT_AUTH_ = 9,
90 _RSON_INVALID_IE_ = 13,
91 _RSON_MIC_FAILURE_ = 14,
92 _RSON_4WAY_HNDSHK_TIMEOUT_ = 15,
93 _RSON_GROUP_KEY_UPDATE_TIMEOUT_ = 16,
95 _RSON_MLTCST_CIPHER_NOT_VALID_ = 18,
96 _RSON_UNICST_CIPHER_NOT_VALID_ = 19,
97 _RSON_AKMP_NOT_VALID_ = 20,
98 _RSON_UNSUPPORT_RSNE_VER_ = 21,
99 _RSON_INVALID_RSNE_CAP_ = 22,
100 _RSON_IEEE_802DOT1X_AUTH_FAIL_ = 23,
102 /* belowing are Realtek definition */
103 _RSON_PMK_NOT_AVAILABLE_ = 24,
104 _RSON_TDLS_TEAR_TOOFAR_ = 25,
105 _RSON_TDLS_TEAR_UN_RSN_ = 26,
108 enum WIFI_STATUS_CODE {
109 _STATS_SUCCESSFUL_ = 0,
111 _STATS_CAP_FAIL_ = 10,
112 _STATS_NO_ASOC_ = 11,
114 _STATS_NO_SUPP_ALG_ = 13,
115 _STATS_OUT_OF_AUTH_SEQ_ = 14,
116 _STATS_CHALLENGE_FAIL_ = 15,
117 _STATS_AUTH_TIMEOUT_ = 16,
118 _STATS_UNABLE_HANDLE_STA_ = 17,
119 _STATS_RATE_FAIL_ = 18,
122 enum WIFI_REG_DOMAIN {
136 #define _TO_DS_ BIT(8)
137 #define _FROM_DS_ BIT(9)
138 #define _MORE_FRAG_ BIT(10)
139 #define _RETRY_ BIT(11)
140 #define _PWRMGT_ BIT(12)
141 #define _MORE_DATA_ BIT(13)
142 #define _PRIVACY_ BIT(14)
143 #define _ORDER_ BIT(15)
145 #define SetToDs(pbuf) \
146 *(__le16 *)(pbuf) |= cpu_to_le16(_TO_DS_)
148 #define GetToDs(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_TO_DS_)) != 0)
150 #define ClearToDs(pbuf) \
151 *(__le16 *)(pbuf) &= (~cpu_to_le16(_TO_DS_))
153 #define SetFrDs(pbuf) \
154 *(__le16 *)(pbuf) |= cpu_to_le16(_FROM_DS_)
156 #define GetFrDs(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_FROM_DS_)) != 0)
158 #define ClearFrDs(pbuf) \
159 *(__le16 *)(pbuf) &= (~cpu_to_le16(_FROM_DS_))
161 #define get_tofr_ds(pframe) ((GetToDs(pframe) << 1) | GetFrDs(pframe))
163 #define SetMFrag(pbuf) \
164 *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_FRAG_)
166 #define GetMFrag(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_MORE_FRAG_)) != 0)
168 #define ClearMFrag(pbuf) \
169 *(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_FRAG_))
171 #define SetRetry(pbuf) \
172 *(__le16 *)(pbuf) |= cpu_to_le16(_RETRY_)
174 #define GetRetry(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_RETRY_)) != 0)
176 #define ClearRetry(pbuf) \
177 *(__le16 *)(pbuf) &= (~cpu_to_le16(_RETRY_))
179 #define SetPwrMgt(pbuf) \
180 *(__le16 *)(pbuf) |= cpu_to_le16(_PWRMGT_)
182 #define GetPwrMgt(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_PWRMGT_)) != 0)
184 #define ClearPwrMgt(pbuf) \
185 *(__le16 *)(pbuf) &= (~cpu_to_le16(_PWRMGT_))
187 #define SetMData(pbuf) \
188 *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_DATA_)
190 #define GetMData(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_MORE_DATA_)) != 0)
192 #define ClearMData(pbuf) \
193 *(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_DATA_))
195 #define SetPrivacy(pbuf) \
196 *(__le16 *)(pbuf) |= cpu_to_le16(_PRIVACY_)
198 #define GetPrivacy(pbuf) \
199 (((*(__le16 *)(pbuf)) & cpu_to_le16(_PRIVACY_)) != 0)
201 #define GetOrder(pbuf) \
202 (((*(__le16 *)(pbuf)) & cpu_to_le16(_ORDER_)) != 0)
204 #define GetFrameType(pbuf) \
205 (le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(3) | BIT(2)))
207 #define GetFrameSubType(pbuf) (le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(7) |\
208 BIT(6) | BIT(5) | BIT(4) | BIT(3) | BIT(2)))
210 #define SetFrameSubType(pbuf, type) \
212 *(__le16 *)(pbuf) &= cpu_to_le16(~(BIT(7) | BIT(6) | \
213 BIT(5) | BIT(4) | BIT(3) | BIT(2))); \
214 *(__le16 *)(pbuf) |= cpu_to_le16(type); \
217 #define GetSequence(pbuf) \
218 (le16_to_cpu(*(__le16 *)((size_t)(pbuf) + 22)) >> 4)
220 #define GetFragNum(pbuf) \
221 (le16_to_cpu(*(__le16 *)((size_t)(pbuf) + 22)) & 0x0f)
223 #define SetSeqNum(pbuf, num) \
225 *(__le16 *)((size_t)(pbuf) + 22) = \
226 ((*(__le16 *)((size_t)(pbuf) + 22)) & cpu_to_le16((unsigned short)0x000f)) | \
227 cpu_to_le16((unsigned short)(0xfff0 & (num << 4))); \
230 #define SetDuration(pbuf, dur) \
231 *(__le16 *)((size_t)(pbuf) + 2) = cpu_to_le16(0xffff & (dur))
233 #define SetPriority(pbuf, tid) \
234 *(__le16 *)(pbuf) |= cpu_to_le16(tid & 0xf)
236 #define GetPriority(pbuf) ((le16_to_cpu(*(__le16 *)(pbuf))) & 0xf)
238 #define SetEOSP(pbuf, eosp) \
239 *(__le16 *)(pbuf) |= cpu_to_le16((eosp & 1) << 4)
241 #define SetAckpolicy(pbuf, ack) \
242 *(__le16 *)(pbuf) |= cpu_to_le16((ack & 3) << 5)
244 #define GetAckpolicy(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 5) & 0x3)
246 #define GetAMsdu(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 7) & 0x1)
248 #define GetAid(pbuf) (le16_to_cpu(*(__le16 *)((size_t)(pbuf) + 2)) & 0x3fff)
250 #define GetAddr1Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 4))
252 #define GetAddr2Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 10))
254 #define GetAddr3Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 16))
256 #define GetAddr4Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 24))
258 static inline unsigned char *get_da(unsigned char *pframe)
261 unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
264 case 0x00: /* ToDs=0, FromDs=0 */
265 da = GetAddr1Ptr(pframe);
267 case 0x01: /* ToDs=0, FromDs=1 */
268 da = GetAddr1Ptr(pframe);
270 case 0x02: /* ToDs=1, FromDs=0 */
271 da = GetAddr3Ptr(pframe);
273 default: /* ToDs=1, FromDs=1 */
274 da = GetAddr3Ptr(pframe);
280 static inline unsigned char *get_sa(unsigned char *pframe)
283 unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
286 case 0x00: /* ToDs=0, FromDs=0 */
287 sa = GetAddr2Ptr(pframe);
289 case 0x01: /* ToDs=0, FromDs=1 */
290 sa = GetAddr3Ptr(pframe);
292 case 0x02: /* ToDs=1, FromDs=0 */
293 sa = GetAddr2Ptr(pframe);
295 default: /* ToDs=1, FromDs=1 */
296 sa = GetAddr4Ptr(pframe);
302 static inline unsigned char *get_hdr_bssid(unsigned char *pframe)
305 unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
308 case 0x00: /* ToDs=0, FromDs=0 */
309 sa = GetAddr3Ptr(pframe);
311 case 0x01: /* ToDs=0, FromDs=1 */
312 sa = GetAddr2Ptr(pframe);
314 case 0x02: /* ToDs=1, FromDs=0 */
315 sa = GetAddr1Ptr(pframe);
317 case 0x03: /* ToDs=1, FromDs=1 */
318 sa = GetAddr1Ptr(pframe);
327 static inline int IsFrameTypeCtrl(unsigned char *pframe)
329 if (WIFI_CTRL_TYPE == GetFrameType(pframe))
334 /*-----------------------------------------------------------------------------
335 Below is for the security related definition
336 ------------------------------------------------------------------------------*/
337 #define _RESERVED_FRAME_TYPE_ 0
338 #define _SKB_FRAME_TYPE_ 2
339 #define _PRE_ALLOCMEM_ 1
340 #define _PRE_ALLOCHDR_ 3
341 #define _PRE_ALLOCLLCHDR_ 4
342 #define _PRE_ALLOCICVHDR_ 5
343 #define _PRE_ALLOCMICHDR_ 6
346 ((priv->pmib->dot11BssType.net_work_type & WIRELESS_11A) ? 16 : 10)
347 #define _ACKCTSLNG_ 14 /* 14 bytes long, including crclng */
350 #define _ASOCREQ_IE_OFFSET_ 4 /* excluding wlan_hdr */
351 #define _ASOCRSP_IE_OFFSET_ 6
352 #define _REASOCREQ_IE_OFFSET_ 10
353 #define _REASOCRSP_IE_OFFSET_ 6
354 #define _PROBEREQ_IE_OFFSET_ 0
355 #define _PROBERSP_IE_OFFSET_ 12
356 #define _AUTH_IE_OFFSET_ 6
357 #define _DEAUTH_IE_OFFSET_ 0
358 #define _BEACON_IE_OFFSET_ 12
359 #define _PUBLIC_ACTION_IE_OFFSET_ 8
361 #define _FIXED_IE_LENGTH_ _BEACON_IE_OFFSET_
364 #define _SUPPORTEDRATES_IE_ 1
367 #define _IBSS_PARA_IE_ 6
368 #define _COUNTRY_IE_ 7
369 #define _CHLGETXT_IE_ 16
370 #define _SUPPORTED_CH_IE_ 36
371 #define _CH_SWTICH_ANNOUNCE_ 37 /* Secondary Channel Offset */
372 #define _RSN_IE_2_ 48
373 #define _SSN_IE_1_ 221
374 #define _ERPINFO_IE_ 42
375 #define _EXT_SUPPORTEDRATES_IE_ 50
377 #define _HT_CAPABILITY_IE_ 45
379 #define _TIMEOUT_ITVL_IE_ 56
381 #define _HT_EXTRA_INFO_IE_ 61
382 #define _HT_ADD_INFO_IE_ 61 /* _HT_EXTRA_INFO_IE_ */
385 #define EID_BSSCoexistence 72 /* 20/40 BSS Coexistence */
386 #define EID_BSSIntolerantChlReport 73
387 #define _RIC_Descriptor_IE_ 75
389 #define _LINK_ID_IE_ 101
390 #define _CH_SWITCH_TIMING_ 104
391 #define _PTI_BUFFER_STATUS_ 106
392 #define _EXT_CAP_IE_ 127
393 #define _VENDOR_SPECIFIC_IE_ 221
395 #define _RESERVED47_ 47
397 /* ---------------------------------------------------------------------------
398 Below is the fixed elements...
399 -----------------------------------------------------------------------------*/
400 #define _AUTH_ALGM_NUM_ 2
401 #define _AUTH_SEQ_NUM_ 2
402 #define _BEACON_ITERVAL_ 2
403 #define _CAPABILITY_ 2
404 #define _CURRENT_APADDR_ 6
405 #define _LISTEN_INTERVAL_ 2
406 #define _RSON_CODE_ 2
408 #define _STATUS_CODE_ 2
409 #define _TIMESTAMP_ 8
411 #define AUTH_ODD_TO 0
412 #define AUTH_EVEN_TO 1
414 #define WLAN_ETHCONV_ENCAP 1
415 #define WLAN_ETHCONV_RFC1042 2
416 #define WLAN_ETHCONV_8021h 3
418 #define cap_ESS BIT(0)
419 #define cap_IBSS BIT(1)
420 #define cap_CFPollable BIT(2)
421 #define cap_CFRequest BIT(3)
422 #define cap_Privacy BIT(4)
423 #define cap_ShortPremble BIT(5)
424 #define cap_PBCC BIT(6)
425 #define cap_ChAgility BIT(7)
426 #define cap_SpecMgmt BIT(8)
427 #define cap_QoSi BIT(9)
428 #define cap_ShortSlot BIT(10)
430 /*-----------------------------------------------------------------------------
431 Below is the definition for 802.11i / 802.1x
432 ------------------------------------------------------------------------------*/
433 #define _IEEE8021X_MGT_ 1 /* WPA */
434 #define _IEEE8021X_PSK_ 2 /* WPA with pre-shared key */
437 * #define _NO_PRIVACY_ 0
438 * #define _WEP_40_PRIVACY_ 1
439 * #define _TKIP_PRIVACY_ 2
440 * #define _WRAP_PRIVACY_ 3
441 * #define _CCMP_PRIVACY_ 4
442 * #define _WEP_104_PRIVACY_ 5
443 * #define _WEP_WPA_MIXED_PRIVACY_ 6 WEP + WPA
446 /*-----------------------------------------------------------------------------
447 Below is the definition for WMM
448 ------------------------------------------------------------------------------*/
449 #define _WMM_IE_Length_ 7 /* for WMM STA */
450 #define _WMM_Para_Element_Length_ 24
452 /*-----------------------------------------------------------------------------
453 Below is the definition for 802.11n
454 ------------------------------------------------------------------------------*/
457 * struct rtw_ieee80211_ht_cap - HT additional information
459 * This structure refers to "HT information element" as
460 * described in 802.11n draft section 7.3.2.53
462 struct ieee80211_ht_addt_info {
463 unsigned char control_chan;
464 unsigned char ht_param;
465 unsigned short operation_mode;
466 unsigned short stbc_param;
467 unsigned char basic_set[16];
470 struct HT_info_element {
471 unsigned char primary_channel;
472 unsigned char infos[5];
473 unsigned char MCS_rate[16];
477 unsigned char ACI_AIFSN;
482 struct WMM_para_element {
483 unsigned char QoS_info;
484 unsigned char reserved;
485 struct AC_param ac_param[4];
488 struct ADDBA_request {
489 unsigned char dialog_token;
491 unsigned short BA_timeout_value;
492 unsigned short BA_starting_seqctrl;
495 enum ht_cap_ampdu_factor {
496 MAX_AMPDU_FACTOR_8K = 0,
497 MAX_AMPDU_FACTOR_16K = 1,
498 MAX_AMPDU_FACTOR_32K = 2,
499 MAX_AMPDU_FACTOR_64K = 3,
502 #define OP_MODE_PURE 0
503 #define OP_MODE_MAY_BE_LEGACY_STAS 1
504 #define OP_MODE_20MHZ_HT_STA_ASSOCED 2
505 #define OP_MODE_MIXED 3
507 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK ((u8)BIT(0) | BIT(1))
508 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE ((u8)BIT(0))
509 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW ((u8)BIT(0) | BIT(1))
510 #define HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH ((u8)BIT(2))
511 #define HT_INFO_HT_PARAM_RIFS_MODE ((u8)BIT(3))
512 #define HT_INFO_HT_PARAM_CTRL_ACCESS_ONLY ((u8)BIT(4))
513 #define HT_INFO_HT_PARAM_SRV_INTERVAL_GRANULARITY ((u8)BIT(5))
515 #define HT_INFO_OPERATION_MODE_OP_MODE_MASK \
516 ((u16)(0x0001 | 0x0002))
517 #define HT_INFO_OPERATION_MODE_OP_MODE_OFFSET 0
518 #define HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT ((u8)BIT(2))
519 #define HT_INFO_OPERATION_MODE_TRANSMIT_BURST_LIMIT ((u8)BIT(3))
520 #define HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT ((u8)BIT(4))
522 #define HT_INFO_STBC_PARAM_DUAL_BEACON ((u16)BIT(6))
523 #define HT_INFO_STBC_PARAM_DUAL_STBC_PROTECT ((u16)BIT(7))
524 #define HT_INFO_STBC_PARAM_SECONDARY_BC ((u16)BIT(8))
525 #define HT_INFO_STBC_PARAM_LSIG_TXOP_PROTECT_ALLOWED ((u16)BIT(9))
526 #define HT_INFO_STBC_PARAM_PCO_ACTIVE ((u16)BIT(10))
527 #define HT_INFO_STBC_PARAM_PCO_PHASE ((u16)BIT(11))
529 /* ===============WPS Section=============== */
531 #define WPSOUI 0x0050f204
532 /* WPS attribute ID */
533 #define WPS_ATTR_VER1 0x104A
534 #define WPS_ATTR_SIMPLE_CONF_STATE 0x1044
535 #define WPS_ATTR_RESP_TYPE 0x103B
536 #define WPS_ATTR_UUID_E 0x1047
537 #define WPS_ATTR_MANUFACTURER 0x1021
538 #define WPS_ATTR_MODEL_NAME 0x1023
539 #define WPS_ATTR_MODEL_NUMBER 0x1024
540 #define WPS_ATTR_SERIAL_NUMBER 0x1042
541 #define WPS_ATTR_PRIMARY_DEV_TYPE 0x1054
542 #define WPS_ATTR_SEC_DEV_TYPE_LIST 0x1055
543 #define WPS_ATTR_DEVICE_NAME 0x1011
544 #define WPS_ATTR_CONF_METHOD 0x1008
545 #define WPS_ATTR_RF_BANDS 0x103C
546 #define WPS_ATTR_DEVICE_PWID 0x1012
547 #define WPS_ATTR_REQUEST_TYPE 0x103A
548 #define WPS_ATTR_ASSOCIATION_STATE 0x1002
549 #define WPS_ATTR_CONFIG_ERROR 0x1009
550 #define WPS_ATTR_VENDOR_EXT 0x1049
551 #define WPS_ATTR_SELECTED_REGISTRAR 0x1041
553 /* Value of WPS Request Type Attribute */
554 #define WPS_REQ_TYPE_ENROLLEE_INFO_ONLY 0x00
555 #define WPS_REQ_TYPE_ENROLLEE_OPEN_8021X 0x01
556 #define WPS_REQ_TYPE_REGISTRAR 0x02
557 #define WPS_REQ_TYPE_WLAN_MANAGER_REGISTRAR 0x03
559 /* Value of WPS Response Type Attribute */
560 #define WPS_RESPONSE_TYPE_INFO_ONLY 0x00
561 #define WPS_RESPONSE_TYPE_8021X 0x01
562 #define WPS_RESPONSE_TYPE_REGISTRAR 0x02
563 #define WPS_RESPONSE_TYPE_AP 0x03
565 /* Value of WPS WiFi Simple Configuration State Attribute */
566 #define WPS_WSC_STATE_NOT_CONFIG 0x01
567 #define WPS_WSC_STATE_CONFIG 0x02
569 /* Value of WPS Version Attribute */
570 #define WPS_VERSION_1 0x10
572 /* Value of WPS Configuration Method Attribute */
573 #define WPS_CONFIG_METHOD_FLASH 0x0001
574 #define WPS_CONFIG_METHOD_ETHERNET 0x0002
575 #define WPS_CONFIG_METHOD_LABEL 0x0004
576 #define WPS_CONFIG_METHOD_DISPLAY 0x0008
577 #define WPS_CONFIG_METHOD_E_NFC 0x0010
578 #define WPS_CONFIG_METHOD_I_NFC 0x0020
579 #define WPS_CONFIG_METHOD_NFC 0x0040
580 #define WPS_CONFIG_METHOD_PBC 0x0080
581 #define WPS_CONFIG_METHOD_KEYPAD 0x0100
582 #define WPS_CONFIG_METHOD_VPBC 0x0280
583 #define WPS_CONFIG_METHOD_PPBC 0x0480
584 #define WPS_CONFIG_METHOD_VDISPLAY 0x2008
585 #define WPS_CONFIG_METHOD_PDISPLAY 0x4008
587 /* Value of Category ID of WPS Primary Device Type Attribute */
588 #define WPS_PDT_CID_DISPLAYS 0x0007
589 #define WPS_PDT_CID_MULIT_MEDIA 0x0008
590 #define WPS_PDT_CID_RTK_WIDI WPS_PDT_CID_MULIT_MEDIA
592 /* Value of Sub Category ID of WPS Primary Device Type Attribute */
593 #define WPS_PDT_SCID_MEDIA_SERVER 0x0005
594 #define WPS_PDT_SCID_RTK_DMP WPS_PDT_SCID_MEDIA_SERVER
596 /* Value of Device Password ID */
597 #define WPS_DPID_P 0x0000
598 #define WPS_DPID_USER_SPEC 0x0001
599 #define WPS_DPID_MACHINE_SPEC 0x0002
600 #define WPS_DPID_REKEY 0x0003
601 #define WPS_DPID_PBC 0x0004
602 #define WPS_DPID_REGISTRAR_SPEC 0x0005
604 /* Value of WPS RF Bands Attribute */
605 #define WPS_RF_BANDS_2_4_GHZ 0x01
606 #define WPS_RF_BANDS_5_GHZ 0x02
608 /* Value of WPS Association State Attribute */
609 #define WPS_ASSOC_STATE_NOT_ASSOCIATED 0x00
610 #define WPS_ASSOC_STATE_CONNECTION_SUCCESS 0x01
611 #define WPS_ASSOC_STATE_CONFIGURATION_FAILURE 0x02
612 #define WPS_ASSOC_STATE_ASSOCIATION_FAILURE 0x03
613 #define WPS_ASSOC_STATE_IP_FAILURE 0x04
615 /* WPS Configuration Method */
616 #define WPS_CM_NONE 0x0000
617 #define WPS_CM_LABEL 0x0004
618 #define WPS_CM_DISPLYA 0x0008
619 #define WPS_CM_EXTERNAL_NFC_TOKEN 0x0010
620 #define WPS_CM_INTEGRATED_NFC_TOKEN 0x0020
621 #define WPS_CM_NFC_INTERFACE 0x0040
622 #define WPS_CM_PUSH_BUTTON 0x0080
623 #define WPS_CM_KEYPAD 0x0100
624 #define WPS_CM_SW_PUHS_BUTTON 0x0280
625 #define WPS_CM_HW_PUHS_BUTTON 0x0480
626 #define WPS_CM_SW_DISPLAY_P 0x2008
627 #define WPS_CM_LCD_DISPLAY_P 0x4008
629 #define IP_MCAST_MAC(mac) \
630 ((mac[0] == 0x01) && (mac[1] == 0x00) && (mac[2] == 0x5e))
631 #define ICMPV6_MCAST_MAC(mac) \
632 ((mac[0] == 0x33) && (mac[1] == 0x33) && (mac[2] != 0xff))
634 #endif /* _WIFI_H_ */