0001
0002
0003
0004 #ifndef _WIFI_H_
0005 #define _WIFI_H_
0006
0007 #include <linux/bits.h>
0008 #include <linux/ieee80211.h>
0009
0010 #define WLAN_ETHHDR_LEN 14
0011 #define WLAN_HDR_A3_LEN 24
0012 #define WLAN_HDR_A3_QOS_LEN 26
0013 #define WLAN_SSID_MAXLEN 32
0014
0015 enum WIFI_FRAME_SUBTYPE {
0016
0017 WIFI_ASSOCREQ = (0 | IEEE80211_FTYPE_MGMT),
0018 WIFI_ASSOCRSP = (BIT(4) | IEEE80211_FTYPE_MGMT),
0019 WIFI_REASSOCREQ = (BIT(5) | IEEE80211_FTYPE_MGMT),
0020 WIFI_REASSOCRSP = (BIT(5) | BIT(4) | IEEE80211_FTYPE_MGMT),
0021 WIFI_PROBEREQ = (BIT(6) | IEEE80211_FTYPE_MGMT),
0022 WIFI_PROBERSP = (BIT(6) | BIT(4) | IEEE80211_FTYPE_MGMT),
0023 WIFI_BEACON = (BIT(7) | IEEE80211_FTYPE_MGMT),
0024 WIFI_ATIM = (BIT(7) | BIT(4) | IEEE80211_FTYPE_MGMT),
0025 WIFI_DISASSOC = (BIT(7) | BIT(5) | IEEE80211_FTYPE_MGMT),
0026 WIFI_AUTH = (BIT(7) | BIT(5) | BIT(4) | IEEE80211_FTYPE_MGMT),
0027 WIFI_DEAUTH = (BIT(7) | BIT(6) | IEEE80211_FTYPE_MGMT),
0028 WIFI_ACTION = (BIT(7) | BIT(6) | BIT(4) | IEEE80211_FTYPE_MGMT),
0029
0030
0031 WIFI_PSPOLL = (BIT(7) | BIT(5) | IEEE80211_FTYPE_CTL),
0032
0033
0034 WIFI_DATA = (0 | IEEE80211_FTYPE_DATA),
0035 WIFI_DATA_CFACK = (BIT(4) | IEEE80211_FTYPE_DATA),
0036 WIFI_DATA_CFPOLL = (BIT(5) | IEEE80211_FTYPE_DATA),
0037 WIFI_DATA_CFACKPOLL = (BIT(5) | BIT(4) | IEEE80211_FTYPE_DATA),
0038 WIFI_DATA_NULL = (BIT(6) | IEEE80211_FTYPE_DATA),
0039 WIFI_QOS_DATA_NULL = (BIT(6) | IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA),
0040 };
0041
0042 enum WIFI_REASON_CODE {
0043 _RSON_RESERVED_ = 0,
0044 _RSON_UNSPECIFIED_ = 1,
0045 _RSON_AUTH_NO_LONGER_VALID_ = 2,
0046 _RSON_DEAUTH_STA_LEAVING_ = 3,
0047 _RSON_INACTIVITY_ = 4,
0048 _RSON_UNABLE_HANDLE_ = 5,
0049 _RSON_CLS2_ = 6,
0050 _RSON_CLS3_ = 7,
0051 _RSON_DISAOC_STA_LEAVING_ = 8,
0052 _RSON_ASOC_NOT_AUTH_ = 9,
0053
0054
0055 _RSON_INVALID_IE_ = 13,
0056 _RSON_MIC_FAILURE_ = 14,
0057 _RSON_4WAY_HNDSHK_TIMEOUT_ = 15,
0058 _RSON_GROUP_KEY_UPDATE_TIMEOUT_ = 16,
0059 _RSON_DIFF_IE_ = 17,
0060 _RSON_MLTCST_CIPHER_NOT_VALID_ = 18,
0061 _RSON_UNICST_CIPHER_NOT_VALID_ = 19,
0062 _RSON_AKMP_NOT_VALID_ = 20,
0063 _RSON_UNSUPPORT_RSNE_VER_ = 21,
0064 _RSON_INVALID_RSNE_CAP_ = 22,
0065 _RSON_IEEE_802DOT1X_AUTH_FAIL_ = 23,
0066
0067
0068 _RSON_PMK_NOT_AVAILABLE_ = 24,
0069 _RSON_TDLS_TEAR_TOOFAR_ = 25,
0070 _RSON_TDLS_TEAR_UN_RSN_ = 26,
0071 };
0072
0073 enum WIFI_STATUS_CODE {
0074 _STATS_SUCCESSFUL_ = 0,
0075 _STATS_FAILURE_ = 1,
0076 _STATS_CAP_FAIL_ = 10,
0077 _STATS_NO_ASOC_ = 11,
0078 _STATS_OTHER_ = 12,
0079 _STATS_NO_SUPP_ALG_ = 13,
0080 _STATS_OUT_OF_AUTH_SEQ_ = 14,
0081 _STATS_CHALLENGE_FAIL_ = 15,
0082 _STATS_AUTH_TIMEOUT_ = 16,
0083 _STATS_UNABLE_HANDLE_STA_ = 17,
0084 _STATS_RATE_FAIL_ = 18,
0085 };
0086
0087
0088
0089 #define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
0090 #define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20
0091 #define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21
0092
0093 #define WLAN_STATUS_SPEC_MGMT_REQUIRED 22
0094 #define WLAN_STATUS_PWR_CAPABILITY_NOT_VALID 23
0095 #define WLAN_STATUS_SUPPORTED_CHANNEL_NOT_VALID 24
0096
0097 #define WLAN_STATUS_ASSOC_DENIED_NO_SHORT_SLOT_TIME 25
0098 #define WLAN_STATUS_ASSOC_DENIED_NO_ER_PBCC 26
0099 #define WLAN_STATUS_ASSOC_DENIED_NO_DSSS_OFDM 27
0100
0101 #define WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY 30
0102 #define WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION 31
0103
0104 #define WLAN_STATUS_INVALID_IE 40
0105 #define WLAN_STATUS_GROUP_CIPHER_NOT_VALID 41
0106 #define WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID 42
0107 #define WLAN_STATUS_AKMP_NOT_VALID 43
0108 #define WLAN_STATUS_UNSUPPORTED_RSN_IE_VERSION 44
0109 #define WLAN_STATUS_INVALID_RSN_IE_CAPAB 45
0110 #define WLAN_STATUS_CIPHER_REJECTED_PER_POLICY 46
0111 #define WLAN_STATUS_TS_NOT_CREATED 47
0112 #define WLAN_STATUS_DIRECT_LINK_NOT_ALLOWED 48
0113 #define WLAN_STATUS_DEST_STA_NOT_PRESENT 49
0114 #define WLAN_STATUS_DEST_STA_NOT_QOS_STA 50
0115 #define WLAN_STATUS_ASSOC_DENIED_LISTEN_INT_TOO_LARGE 51
0116
0117 #define WLAN_STATUS_INVALID_FT_ACTION_FRAME_COUNT 52
0118 #define WLAN_STATUS_INVALID_PMKID 53
0119 #define WLAN_STATUS_INVALID_MDIE 54
0120 #define WLAN_STATUS_INVALID_FTIE 55
0121
0122 enum WIFI_REG_DOMAIN {
0123 DOMAIN_FCC = 1,
0124 DOMAIN_IC = 2,
0125 DOMAIN_ETSI = 3,
0126 DOMAIN_SPA = 4,
0127 DOMAIN_FRANCE = 5,
0128 DOMAIN_MKK = 6,
0129 DOMAIN_ISRAEL = 7,
0130 DOMAIN_MKK1 = 8,
0131 DOMAIN_MKK2 = 9,
0132 DOMAIN_MKK3 = 10,
0133 DOMAIN_MAX
0134 };
0135
0136 #define _TO_DS_ BIT(8)
0137 #define _FROM_DS_ BIT(9)
0138 #define _MORE_FRAG_ BIT(10)
0139 #define _RETRY_ BIT(11)
0140 #define _PWRMGT_ BIT(12)
0141 #define _MORE_DATA_ BIT(13)
0142 #define _PRIVACY_ BIT(14)
0143 #define _ORDER_ BIT(15)
0144
0145 #define SetToDs(pbuf) \
0146 *(__le16 *)(pbuf) |= cpu_to_le16(_TO_DS_)
0147
0148 #define GetToDs(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_TO_DS_)) != 0)
0149
0150 #define SetFrDs(pbuf) \
0151 *(__le16 *)(pbuf) |= cpu_to_le16(_FROM_DS_)
0152
0153 #define GetFrDs(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_FROM_DS_)) != 0)
0154
0155 #define SetMFrag(pbuf) \
0156 *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_FRAG_)
0157
0158 #define ClearMFrag(pbuf) \
0159 *(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_FRAG_))
0160
0161 #define GetRetry(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_RETRY_)) != 0)
0162
0163 #define SetPwrMgt(pbuf) \
0164 *(__le16 *)(pbuf) |= cpu_to_le16(_PWRMGT_)
0165
0166 #define GetPwrMgt(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_PWRMGT_)) != 0)
0167
0168 #define SetMData(pbuf) \
0169 *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_DATA_)
0170
0171 #define SetPrivacy(pbuf) \
0172 *(__le16 *)(pbuf) |= cpu_to_le16(_PRIVACY_)
0173
0174 #define GetPrivacy(pbuf) \
0175 (((*(__le16 *)(pbuf)) & cpu_to_le16(_PRIVACY_)) != 0)
0176
0177 #define GetFrameType(pbuf) \
0178 (le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(3) | BIT(2)))
0179
0180 #define GetFrameSubType(pbuf) (le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(7) |\
0181 BIT(6) | BIT(5) | BIT(4) | BIT(3) | BIT(2)))
0182
0183 #define SetFrameSubType(pbuf, type) \
0184 do { \
0185 *(__le16 *)(pbuf) &= cpu_to_le16(~(BIT(7) | BIT(6) | \
0186 BIT(5) | BIT(4) | BIT(3) | BIT(2))); \
0187 *(__le16 *)(pbuf) |= cpu_to_le16(type); \
0188 } while (0)
0189
0190 #define GetTupleCache(pbuf) \
0191 (cpu_to_le16(*(unsigned short *)((size_t)(pbuf) + 22)))
0192
0193 #define SetFragNum(pbuf, num) \
0194 do { \
0195 *(unsigned short *)((size_t)(pbuf) + 22) = \
0196 ((*(unsigned short *)((size_t)(pbuf) + 22)) & \
0197 le16_to_cpu(~(0x000f))) | \
0198 cpu_to_le16(0x0f & (num)); \
0199 } while (0)
0200
0201 #define SetSeqNum(pbuf, num) \
0202 do { \
0203 *(__le16 *)((size_t)(pbuf) + 22) = \
0204 ((*(__le16 *)((size_t)(pbuf) + 22)) & cpu_to_le16((unsigned short)0x000f)) | \
0205 cpu_to_le16((unsigned short)(0xfff0 & (num << 4))); \
0206 } while (0)
0207
0208 #define SetDuration(pbuf, dur) \
0209 *(__le16 *)((size_t)(pbuf) + 2) = cpu_to_le16(0xffff & (dur))
0210
0211 #define SetPriority(pbuf, tid) \
0212 *(__le16 *)(pbuf) |= cpu_to_le16(tid & 0xf)
0213
0214 #define SetEOSP(pbuf, eosp) \
0215 *(__le16 *)(pbuf) |= cpu_to_le16((eosp & 1) << 4)
0216
0217 #define SetAckpolicy(pbuf, ack) \
0218 *(__le16 *)(pbuf) |= cpu_to_le16((ack & 3) << 5)
0219
0220 #define GetAckpolicy(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 5) & 0x3)
0221
0222 #define GetAMsdu(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 7) & 0x1)
0223
0224 #define SetAMsdu(pbuf, amsdu) \
0225 *(__le16 *)(pbuf) |= cpu_to_le16((amsdu & 1) << 7)
0226
0227 #define GetTid(pbuf) (le16_to_cpu(*(__le16 *)((size_t)(pbuf) + \
0228 (((GetToDs(pbuf)<<1) | GetFrDs(pbuf)) == 3 ? \
0229 30 : 24))) & 0x000f)
0230
0231 #define GetAddr1Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 4))
0232
0233 #define GetAddr2Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 10))
0234
0235 #define GetAddr3Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 16))
0236
0237 #define GetAddr4Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 24))
0238
0239 static inline bool IS_MCAST(unsigned char *da)
0240 {
0241 return (*da) & 0x01;
0242 }
0243
0244 static inline unsigned char *get_da(unsigned char *pframe)
0245 {
0246 unsigned char *da;
0247 unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
0248
0249 switch (to_fr_ds) {
0250 case 0x00:
0251 da = GetAddr1Ptr(pframe);
0252 break;
0253 case 0x01:
0254 da = GetAddr1Ptr(pframe);
0255 break;
0256 case 0x02:
0257 da = GetAddr3Ptr(pframe);
0258 break;
0259 default:
0260 da = GetAddr3Ptr(pframe);
0261 break;
0262 }
0263 return da;
0264 }
0265
0266 static inline unsigned char *get_sa(unsigned char *pframe)
0267 {
0268 unsigned char *sa;
0269 unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
0270
0271 switch (to_fr_ds) {
0272 case 0x00:
0273 sa = GetAddr2Ptr(pframe);
0274 break;
0275 case 0x01:
0276 sa = GetAddr3Ptr(pframe);
0277 break;
0278 case 0x02:
0279 sa = GetAddr2Ptr(pframe);
0280 break;
0281 default:
0282 sa = GetAddr4Ptr(pframe);
0283 break;
0284 }
0285 return sa;
0286 }
0287
0288 static inline unsigned char *get_hdr_bssid(unsigned char *pframe)
0289 {
0290 unsigned char *sa;
0291 unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
0292
0293 switch (to_fr_ds) {
0294 case 0x00:
0295 sa = GetAddr3Ptr(pframe);
0296 break;
0297 case 0x01:
0298 sa = GetAddr2Ptr(pframe);
0299 break;
0300 case 0x02:
0301 sa = GetAddr1Ptr(pframe);
0302 break;
0303 case 0x03:
0304 sa = GetAddr1Ptr(pframe);
0305 break;
0306 default:
0307 sa = NULL;
0308 break;
0309 }
0310 return sa;
0311 }
0312
0313
0314
0315
0316 #define _RESERVED_FRAME_TYPE_ 0
0317 #define _SKB_FRAME_TYPE_ 2
0318 #define _PRE_ALLOCMEM_ 1
0319 #define _PRE_ALLOCHDR_ 3
0320 #define _PRE_ALLOCLLCHDR_ 4
0321 #define _PRE_ALLOCICVHDR_ 5
0322 #define _PRE_ALLOCMICHDR_ 6
0323
0324 #define _SIFSTIME_ \
0325 (priv->pmib->dot11BssType.net_work_type = 10)
0326 #define _ACKCTSLNG_ 14
0327 #define _CRCLNG_ 4
0328
0329 #define _ASOCREQ_IE_OFFSET_ 4
0330 #define _ASOCRSP_IE_OFFSET_ 6
0331 #define _REASOCREQ_IE_OFFSET_ 10
0332 #define _REASOCRSP_IE_OFFSET_ 6
0333 #define _PROBEREQ_IE_OFFSET_ 0
0334 #define _PROBERSP_IE_OFFSET_ 12
0335 #define _AUTH_IE_OFFSET_ 6
0336 #define _DEAUTH_IE_OFFSET_ 0
0337 #define _BEACON_IE_OFFSET_ 12
0338 #define _PUBLIC_ACTION_IE_OFFSET_ 8
0339
0340 #define _FIXED_IE_LENGTH_ _BEACON_IE_OFFSET_
0341
0342 #define _SSID_IE_ 0
0343 #define _SUPPORTEDRATES_IE_ 1
0344 #define _DSSET_IE_ 3
0345 #define _TIM_IE_ 5
0346 #define _IBSS_PARA_IE_ 6
0347 #define _COUNTRY_IE_ 7
0348 #define _CHLGETXT_IE_ 16
0349 #define _SUPPORTED_CH_IE_ 36
0350 #define _CH_SWTICH_ANNOUNCE_ 37
0351 #define _RSN_IE_2_ 48
0352 #define _SSN_IE_1_ 221
0353 #define _ERPINFO_IE_ 42
0354 #define _EXT_SUPPORTEDRATES_IE_ 50
0355
0356 #define _HT_CAPABILITY_IE_ 45
0357 #define _FTIE_ 55
0358 #define _TIMEOUT_ITVL_IE_ 56
0359 #define _SRC_IE_ 59
0360 #define _HT_EXTRA_INFO_IE_ 61
0361 #define _HT_ADD_INFO_IE_ 61
0362 #define _WAPI_IE_ 68
0363
0364 #define EID_BSSCoexistence 72
0365 #define EID_BSSIntolerantChlReport 73
0366 #define _RIC_Descriptor_IE_ 75
0367
0368 #define _LINK_ID_IE_ 101
0369 #define _CH_SWITCH_TIMING_ 104
0370 #define _PTI_BUFFER_STATUS_ 106
0371 #define _EXT_CAP_IE_ 127
0372 #define _VENDOR_SPECIFIC_IE_ 221
0373
0374 #define _RESERVED47_ 47
0375
0376
0377
0378
0379 #define _AUTH_ALGM_NUM_ 2
0380 #define _AUTH_SEQ_NUM_ 2
0381 #define _BEACON_ITERVAL_ 2
0382 #define _CAPABILITY_ 2
0383 #define _CURRENT_APADDR_ 6
0384 #define _LISTEN_INTERVAL_ 2
0385 #define _RSON_CODE_ 2
0386 #define _ASOC_ID_ 2
0387 #define _STATUS_CODE_ 2
0388 #define _TIMESTAMP_ 8
0389
0390 #define cap_ESS BIT(0)
0391 #define cap_IBSS BIT(1)
0392 #define cap_CFPollable BIT(2)
0393 #define cap_CFRequest BIT(3)
0394 #define cap_Privacy BIT(4)
0395 #define cap_ShortPremble BIT(5)
0396 #define cap_PBCC BIT(6)
0397 #define cap_ChAgility BIT(7)
0398 #define cap_SpecMgmt BIT(8)
0399 #define cap_QoSi BIT(9)
0400 #define cap_ShortSlot BIT(10)
0401
0402
0403
0404
0405 #define _IEEE8021X_MGT_ 1
0406 #define _IEEE8021X_PSK_ 2
0407
0408
0409
0410
0411 #define _WMM_IE_Length_ 7
0412 #define _WMM_Para_Element_Length_ 24
0413
0414
0415
0416
0417
0418 #define SetOrderBit(pbuf) \
0419 do { \
0420 *(unsigned short *)(pbuf) |= cpu_to_le16(_ORDER_); \
0421 } while (0)
0422
0423 #define GetOrderBit(pbuf) \
0424 (((*(unsigned short *)(pbuf)) & le16_to_cpu(_ORDER_)) != 0)
0425
0426
0427
0428
0429
0430
0431
0432 struct rtw_ieee80211_bar {
0433 __le16 frame_control;
0434 __le16 duration;
0435 unsigned char ra[ETH_ALEN];
0436 unsigned char ta[ETH_ALEN];
0437 __le16 control;
0438 __le16 start_seq_num;
0439 } __packed;
0440
0441
0442
0443
0444
0445
0446
0447 struct ieee80211_ht_addt_info {
0448 unsigned char control_chan;
0449 unsigned char ht_param;
0450 __le16 operation_mode;
0451 __le16 stbc_param;
0452 unsigned char basic_set[16];
0453 } __packed;
0454
0455 struct HT_caps_element {
0456 union {
0457 struct {
0458 __le16 HT_caps_info;
0459 unsigned char AMPDU_para;
0460 unsigned char MCS_rate[16];
0461 __le16 HT_ext_caps;
0462 __le16 Beamforming_caps;
0463 unsigned char ASEL_caps;
0464 } HT_cap_element;
0465 unsigned char HT_cap[26];
0466 } u;
0467 } __packed;
0468
0469 struct HT_info_element {
0470 unsigned char primary_channel;
0471 unsigned char infos[5];
0472 unsigned char MCS_rate[16];
0473 } __packed;
0474
0475 struct AC_param {
0476 unsigned char ACI_AIFSN;
0477 unsigned char CW;
0478 __le16 TXOP_limit;
0479 } __packed;
0480
0481 struct WMM_para_element {
0482 unsigned char QoS_info;
0483 unsigned char reserved;
0484 struct AC_param ac_param[4];
0485 } __packed;
0486
0487 struct ADDBA_request {
0488 unsigned char action_code;
0489 unsigned char dialog_token;
0490 __le16 BA_para_set;
0491 __le16 BA_timeout_value;
0492 __le16 BA_starting_seqctrl;
0493 } __packed;
0494
0495 #define MAX_AMPDU_FACTOR_64K 3
0496
0497
0498 #define WLAN_HT_CAP_SM_PS_STATIC 0
0499 #define WLAN_HT_CAP_SM_PS_DYNAMIC 1
0500 #define WLAN_HT_CAP_SM_PS_INVALID 2
0501 #define WLAN_HT_CAP_SM_PS_DISABLED 3
0502
0503 #define OP_MODE_PURE 0
0504 #define OP_MODE_MAY_BE_LEGACY_STAS 1
0505 #define OP_MODE_20MHZ_HT_STA_ASSOCED 2
0506 #define OP_MODE_MIXED 3
0507
0508 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK ((u8) BIT(0) | BIT(1))
0509 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE ((u8) BIT(0))
0510 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW ((u8) BIT(0) | BIT(1))
0511 #define HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH ((u8) BIT(2))
0512 #define HT_INFO_HT_PARAM_RIFS_MODE ((u8) BIT(3))
0513 #define HT_INFO_HT_PARAM_CTRL_ACCESS_ONLY ((u8) BIT(4))
0514 #define HT_INFO_HT_PARAM_SRV_INTERVAL_GRANULARITY ((u8) BIT(5))
0515
0516 #define HT_INFO_OPERATION_MODE_OP_MODE_MASK \
0517 ((u16) (0x0001 | 0x0002))
0518 #define HT_INFO_OPERATION_MODE_OP_MODE_OFFSET 0
0519 #define HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT ((u8) BIT(2))
0520 #define HT_INFO_OPERATION_MODE_TRANSMIT_BURST_LIMIT ((u8) BIT(3))
0521 #define HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT ((u8) BIT(4))
0522
0523
0524
0525 #define WPSOUI 0x0050f204
0526
0527 #define WPS_ATTR_VER1 0x104A
0528 #define WPS_ATTR_SIMPLE_CONF_STATE 0x1044
0529 #define WPS_ATTR_RESP_TYPE 0x103B
0530 #define WPS_ATTR_UUID_E 0x1047
0531 #define WPS_ATTR_MANUFACTURER 0x1021
0532 #define WPS_ATTR_MODEL_NAME 0x1023
0533 #define WPS_ATTR_MODEL_NUMBER 0x1024
0534 #define WPS_ATTR_SERIAL_NUMBER 0x1042
0535 #define WPS_ATTR_PRIMARY_DEV_TYPE 0x1054
0536 #define WPS_ATTR_SEC_DEV_TYPE_LIST 0x1055
0537 #define WPS_ATTR_DEVICE_NAME 0x1011
0538 #define WPS_ATTR_CONF_METHOD 0x1008
0539 #define WPS_ATTR_RF_BANDS 0x103C
0540 #define WPS_ATTR_DEVICE_PWID 0x1012
0541 #define WPS_ATTR_REQUEST_TYPE 0x103A
0542 #define WPS_ATTR_ASSOCIATION_STATE 0x1002
0543 #define WPS_ATTR_CONFIG_ERROR 0x1009
0544 #define WPS_ATTR_VENDOR_EXT 0x1049
0545 #define WPS_ATTR_SELECTED_REGISTRAR 0x1041
0546
0547
0548 #define WPS_MAX_DEVICE_NAME_LEN 32
0549
0550
0551 #define WPS_REQ_TYPE_ENROLLEE_INFO_ONLY 0x00
0552 #define WPS_REQ_TYPE_ENROLLEE_OPEN_8021X 0x01
0553 #define WPS_REQ_TYPE_REGISTRAR 0x02
0554 #define WPS_REQ_TYPE_WLAN_MANAGER_REGISTRAR 0x03
0555
0556
0557 #define WPS_RESPONSE_TYPE_INFO_ONLY 0x00
0558 #define WPS_RESPONSE_TYPE_8021X 0x01
0559 #define WPS_RESPONSE_TYPE_REGISTRAR 0x02
0560 #define WPS_RESPONSE_TYPE_AP 0x03
0561
0562
0563 #define WPS_WSC_STATE_NOT_CONFIG 0x01
0564 #define WPS_WSC_STATE_CONFIG 0x02
0565
0566
0567 #define WPS_VERSION_1 0x10
0568
0569
0570 #define WPS_CONFIG_METHOD_FLASH 0x0001
0571 #define WPS_CONFIG_METHOD_ETHERNET 0x0002
0572 #define WPS_CONFIG_METHOD_LABEL 0x0004
0573 #define WPS_CONFIG_METHOD_DISPLAY 0x0008
0574 #define WPS_CONFIG_METHOD_E_NFC 0x0010
0575 #define WPS_CONFIG_METHOD_I_NFC 0x0020
0576 #define WPS_CONFIG_METHOD_NFC 0x0040
0577 #define WPS_CONFIG_METHOD_PBC 0x0080
0578 #define WPS_CONFIG_METHOD_KEYPAD 0x0100
0579 #define WPS_CONFIG_METHOD_VPBC 0x0280
0580 #define WPS_CONFIG_METHOD_PPBC 0x0480
0581 #define WPS_CONFIG_METHOD_VDISPLAY 0x2008
0582 #define WPS_CONFIG_METHOD_PDISPLAY 0x4008
0583
0584
0585 #define WPS_PDT_CID_DISPLAYS 0x0007
0586 #define WPS_PDT_CID_MULIT_MEDIA 0x0008
0587 #define WPS_PDT_CID_RTK_WIDI WPS_PDT_CID_MULIT_MEDIA
0588
0589
0590 #define WPS_PDT_SCID_MEDIA_SERVER 0x0005
0591 #define WPS_PDT_SCID_RTK_DMP WPS_PDT_SCID_MEDIA_SERVER
0592
0593
0594 #define WPS_DPID_P 0x0000
0595 #define WPS_DPID_USER_SPEC 0x0001
0596 #define WPS_DPID_MACHINE_SPEC 0x0002
0597 #define WPS_DPID_REKEY 0x0003
0598 #define WPS_DPID_PBC 0x0004
0599 #define WPS_DPID_REGISTRAR_SPEC 0x0005
0600
0601
0602 #define WPS_RF_BANDS_2_4_GHZ 0x01
0603 #define WPS_RF_BANDS_5_GHZ 0x02
0604
0605
0606 #define WPS_ASSOC_STATE_NOT_ASSOCIATED 0x00
0607 #define WPS_ASSOC_STATE_CONNECTION_SUCCESS 0x01
0608 #define WPS_ASSOC_STATE_CONFIGURATION_FAILURE 0x02
0609 #define WPS_ASSOC_STATE_ASSOCIATION_FAILURE 0x03
0610 #define WPS_ASSOC_STATE_IP_FAILURE 0x04
0611
0612
0613
0614 #define P2POUI 0x506F9A09
0615
0616
0617 #define P2P_ATTR_STATUS 0x00
0618 #define P2P_ATTR_MINOR_REASON_CODE 0x01
0619 #define P2P_ATTR_CAPABILITY 0x02
0620 #define P2P_ATTR_DEVICE_ID 0x03
0621 #define P2P_ATTR_GO_INTENT 0x04
0622 #define P2P_ATTR_CONF_TIMEOUT 0x05
0623 #define P2P_ATTR_LISTEN_CH 0x06
0624 #define P2P_ATTR_GROUP_BSSID 0x07
0625 #define P2P_ATTR_EX_LISTEN_TIMING 0x08
0626 #define P2P_ATTR_INTENTED_IF_ADDR 0x09
0627 #define P2P_ATTR_MANAGEABILITY 0x0A
0628 #define P2P_ATTR_CH_LIST 0x0B
0629 #define P2P_ATTR_NOA 0x0C
0630 #define P2P_ATTR_DEVICE_INFO 0x0D
0631 #define P2P_ATTR_GROUP_INFO 0x0E
0632 #define P2P_ATTR_GROUP_ID 0x0F
0633 #define P2P_ATTR_INTERFACE 0x10
0634 #define P2P_ATTR_OPERATING_CH 0x11
0635 #define P2P_ATTR_INVITATION_FLAGS 0x12
0636
0637
0638 #define P2P_STATUS_SUCCESS 0x00
0639 #define P2P_STATUS_FAIL_INFO_UNAVAILABLE 0x01
0640 #define P2P_STATUS_FAIL_INCOMPATIBLE_PARAM 0x02
0641 #define P2P_STATUS_FAIL_LIMIT_REACHED 0x03
0642 #define P2P_STATUS_FAIL_INVALID_PARAM 0x04
0643 #define P2P_STATUS_FAIL_REQUEST_UNABLE 0x05
0644 #define P2P_STATUS_FAIL_PREVOUS_PROTO_ERR 0x06
0645 #define P2P_STATUS_FAIL_NO_COMMON_CH 0x07
0646 #define P2P_STATUS_FAIL_UNKNOWN_P2PGROUP 0x08
0647 #define P2P_STATUS_FAIL_BOTH_GOINTENT_15 0x09
0648 #define P2P_STATUS_FAIL_INCOMPATIBLE_PROVSION 0x0A
0649 #define P2P_STATUS_FAIL_USER_REJECT 0x0B
0650
0651
0652 #define P2P_INVITATION_FLAGS_PERSISTENT BIT(0)
0653
0654 #define DMP_P2P_DEVCAP_SUPPORT (P2P_DEVCAP_SERVICE_DISCOVERY | \
0655 P2P_DEVCAP_CLIENT_DISCOVERABILITY | \
0656 P2P_DEVCAP_CONCURRENT_OPERATION | \
0657 P2P_DEVCAP_INVITATION_PROC)
0658
0659 #define DMP_P2P_GRPCAP_SUPPORT (P2P_GRPCAP_INTRABSS)
0660
0661
0662 #define P2P_DEVCAP_SERVICE_DISCOVERY BIT(0)
0663 #define P2P_DEVCAP_CLIENT_DISCOVERABILITY BIT(1)
0664 #define P2P_DEVCAP_CONCURRENT_OPERATION BIT(2)
0665 #define P2P_DEVCAP_INFRA_MANAGED BIT(3)
0666 #define P2P_DEVCAP_DEVICE_LIMIT BIT(4)
0667 #define P2P_DEVCAP_INVITATION_PROC BIT(5)
0668
0669
0670 #define P2P_GRPCAP_GO BIT(0)
0671 #define P2P_GRPCAP_PERSISTENT_GROUP BIT(1)
0672 #define P2P_GRPCAP_GROUP_LIMIT BIT(2)
0673 #define P2P_GRPCAP_INTRABSS BIT(3)
0674 #define P2P_GRPCAP_CROSS_CONN BIT(4)
0675 #define P2P_GRPCAP_PERSISTENT_RECONN BIT(5)
0676 #define P2P_GRPCAP_GROUP_FORMATION BIT(6)
0677
0678
0679 #define P2P_PUB_ACTION_ACTION 0x09
0680
0681
0682 #define P2P_GO_NEGO_REQ 0
0683 #define P2P_GO_NEGO_RESP 1
0684 #define P2P_GO_NEGO_CONF 2
0685 #define P2P_INVIT_REQ 3
0686 #define P2P_INVIT_RESP 4
0687 #define P2P_DEVDISC_REQ 5
0688 #define P2P_DEVDISC_RESP 6
0689 #define P2P_PROVISION_DISC_REQ 7
0690 #define P2P_PROVISION_DISC_RESP 8
0691
0692
0693 #define P2P_NOTICE_OF_ABSENCE 0
0694 #define P2P_PRESENCE_REQUEST 1
0695 #define P2P_PRESENCE_RESPONSE 2
0696 #define P2P_GO_DISC_REQUEST 3
0697
0698 #define P2P_MAX_PERSISTENT_GROUP_NUM 10
0699
0700 #define P2P_PROVISIONING_SCAN_CNT 3
0701
0702 #define P2P_WILDCARD_SSID_LEN 7
0703
0704
0705
0706 #define P2P_FINDPHASE_EX_NONE 0
0707
0708
0709 #define P2P_FINDPHASE_EX_FULL 1
0710 #define P2P_FINDPHASE_EX_SOCIAL_FIRST (P2P_FINDPHASE_EX_FULL+1)
0711 #define P2P_FINDPHASE_EX_MAX 4
0712 #define P2P_FINDPHASE_EX_SOCIAL_LAST P2P_FINDPHASE_EX_MAX
0713
0714
0715 #define P2P_PROVISION_TIMEOUT 5000
0716
0717 #define P2P_CONCURRENT_PROVISION_TIME 3000
0718
0719 #define P2P_GO_NEGO_TIMEOUT 5000
0720
0721 #define P2P_CONCURRENT_GO_NEGO_TIME 3000
0722
0723 #define P2P_TX_PRESCAN_TIMEOUT 100
0724
0725 #define P2P_INVITE_TIMEOUT 5000
0726
0727 #define P2P_CONCURRENT_INVITE_TIME 3000
0728
0729 #define P2P_RESET_SCAN_CH 25000
0730 #define P2P_MAX_INTENT 15
0731
0732 #define P2P_MAX_NOA_NUM 2
0733
0734
0735 #define WPS_CM_NONE 0x0000
0736 #define WPS_CM_LABEL 0x0004
0737 #define WPS_CM_DISPLYA 0x0008
0738 #define WPS_CM_EXTERNAL_NFC_TOKEN 0x0010
0739 #define WPS_CM_INTEGRATED_NFC_TOKEN 0x0020
0740 #define WPS_CM_NFC_INTERFACE 0x0040
0741 #define WPS_CM_PUSH_BUTTON 0x0080
0742 #define WPS_CM_KEYPAD 0x0100
0743 #define WPS_CM_SW_PUHS_BUTTON 0x0280
0744 #define WPS_CM_HW_PUHS_BUTTON 0x0480
0745 #define WPS_CM_SW_DISPLAY_P 0x2008
0746 #define WPS_CM_LCD_DISPLAY_P 0x4008
0747
0748 enum P2P_ROLE {
0749 P2P_ROLE_DISABLE = 0,
0750 P2P_ROLE_DEVICE = 1,
0751 P2P_ROLE_CLIENT = 2,
0752 P2P_ROLE_GO = 3
0753 };
0754
0755 enum P2P_STATE {
0756 P2P_STATE_NONE = 0,
0757
0758 P2P_STATE_IDLE = 1,
0759 P2P_STATE_LISTEN = 2,
0760 P2P_STATE_SCAN = 3,
0761
0762 P2P_STATE_FIND_PHASE_LISTEN = 4,
0763
0764 P2P_STATE_FIND_PHASE_SEARCH = 5,
0765
0766 P2P_STATE_TX_PROVISION_DIS_REQ = 6,
0767 P2P_STATE_RX_PROVISION_DIS_RSP = 7,
0768 P2P_STATE_RX_PROVISION_DIS_REQ = 8,
0769
0770 P2P_STATE_GONEGO_ING = 9,
0771
0772 P2P_STATE_GONEGO_OK = 10,
0773
0774 P2P_STATE_GONEGO_FAIL = 11,
0775
0776 P2P_STATE_RECV_INVITE_REQ_MATCH = 12,
0777
0778 P2P_STATE_PROVISIONING_ING = 13,
0779
0780 P2P_STATE_PROVISIONING_DONE = 14,
0781
0782 P2P_STATE_TX_INVITE_REQ = 15,
0783
0784 P2P_STATE_RX_INVITE_RESP_OK = 16,
0785
0786 P2P_STATE_RECV_INVITE_REQ_DISMATCH = 17,
0787
0788 P2P_STATE_RECV_INVITE_REQ_GO = 18,
0789
0790 P2P_STATE_RECV_INVITE_REQ_JOIN = 19,
0791
0792 P2P_STATE_RX_INVITE_RESP_FAIL = 20,
0793
0794 P2P_STATE_RX_INFOR_NOREADY = 21,
0795
0796 P2P_STATE_TX_INFOR_NOREADY = 22,
0797 };
0798
0799 enum P2P_WPSINFO {
0800 P2P_NO_WPSINFO = 0,
0801 P2P_GOT_WPSINFO_PEER_DISPLAY_PIN = 1,
0802 P2P_GOT_WPSINFO_SELF_DISPLAY_PIN = 2,
0803 P2P_GOT_WPSINFO_PBC = 3,
0804 };
0805
0806 #define P2P_PRIVATE_IOCTL_SET_LEN 64
0807
0808 enum P2P_PROTO_WK_ID {
0809 P2P_FIND_PHASE_WK = 0,
0810 P2P_RESTORE_STATE_WK = 1,
0811 P2P_PRE_TX_PROVDISC_PROCESS_WK = 2,
0812 P2P_PRE_TX_NEGOREQ_PROCESS_WK = 3,
0813 P2P_PRE_TX_INVITEREQ_PROCESS_WK = 4,
0814 P2P_AP_P2P_CH_SWITCH_PROCESS_WK = 5,
0815 P2P_RO_CH_WK = 6,
0816 };
0817
0818 enum P2P_PS_STATE {
0819 P2P_PS_DISABLE = 0,
0820 P2P_PS_ENABLE = 1,
0821 P2P_PS_SCAN = 2,
0822 P2P_PS_SCAN_DONE = 3,
0823 P2P_PS_ALLSTASLEEP = 4,
0824 };
0825
0826 enum P2P_PS_MODE {
0827 P2P_PS_NONE = 0,
0828 P2P_PS_CTWINDOW = 1,
0829 P2P_PS_NOA = 2,
0830 P2P_PS_MIX = 3,
0831 };
0832
0833 #define IP_MCAST_MAC(mac) \
0834 ((mac[0] == 0x01) && (mac[1] == 0x00) && (mac[2] == 0x5e))
0835 #define ICMPV6_MCAST_MAC(mac) \
0836 ((mac[0] == 0x33) && (mac[1] == 0x33) && (mac[2] != 0xff))
0837
0838 #endif