Go to the documentation of this file.
29 #include <linux/compiler.h>
34 #define BIT(x) (1 << (x))
36 #define WLAN_ETHHDR_LEN 14
37 #define WLAN_ETHADDR_LEN 6
38 #define WLAN_IEEE_OUI_LEN 3
39 #define WLAN_ADDR_LEN 6
40 #define WLAN_CRC_LEN 4
41 #define WLAN_BSSID_LEN 6
42 #define WLAN_BSS_TS_LEN 8
43 #define WLAN_HDR_A3_LEN 24
44 #define WLAN_HDR_A4_LEN 30
45 #define WLAN_HDR_A3_QOS_LEN 26
46 #define WLAN_HDR_A4_QOS_LEN 32
47 #define WLAN_SSID_MAXLEN 32
48 #define WLAN_DATA_MAXLEN 2312
50 #define WLAN_A3_PN_OFFSET 24
51 #define WLAN_A4_PN_OFFSET 30
53 #define WLAN_MIN_ETHFRM_LEN 60
54 #define WLAN_MAX_ETHFRM_LEN 1514
55 #define WLAN_ETHHDR_LEN 14
57 #define P80211CAPTURE_VERSION 0x80211001
153 #define _TO_DS_ BIT(8)
154 #define _FROM_DS_ BIT(9)
155 #define _MORE_FRAG_ BIT(10)
156 #define _RETRY_ BIT(11)
157 #define _PWRMGT_ BIT(12)
158 #define _MORE_DATA_ BIT(13)
159 #define _PRIVACY_ BIT(14)
160 #define _ORDER_ BIT(15)
162 #define SetToDs(pbuf) \
164 *(unsigned short *)(pbuf) |= cpu_to_le16(_TO_DS_); \
167 #define GetToDs(pbuf) (((*(unsigned short *)(pbuf)) & \
168 le16_to_cpu(_TO_DS_)) != 0)
170 #define ClearToDs(pbuf) \
172 *(unsigned short *)(pbuf) &= (~cpu_to_le16(_TO_DS_)); \
175 #define SetFrDs(pbuf) \
177 *(unsigned short *)(pbuf) |= cpu_to_le16(_FROM_DS_); \
180 #define GetFrDs(pbuf) (((*(unsigned short *)(pbuf)) & \
181 le16_to_cpu(_FROM_DS_)) != 0)
183 #define ClearFrDs(pbuf) \
185 *(unsigned short *)(pbuf) &= (~cpu_to_le16(_FROM_DS_)); \
188 #define get_tofr_ds(pframe) ((GetToDs(pframe) << 1) | GetFrDs(pframe))
191 #define SetMFrag(pbuf) \
193 *(unsigned short *)(pbuf) |= cpu_to_le16(_MORE_FRAG_); \
196 #define GetMFrag(pbuf) (((*(unsigned short *)(pbuf)) & \
197 le16_to_cpu(_MORE_FRAG_)) != 0)
199 #define ClearMFrag(pbuf) \
201 *(unsigned short *)(pbuf) &= (~cpu_to_le16(_MORE_FRAG_)); \
204 #define SetRetry(pbuf) \
206 *(unsigned short *)(pbuf) |= cpu_to_le16(_RETRY_); \
209 #define GetRetry(pbuf) (((*(unsigned short *)(pbuf)) & \
210 le16_to_cpu(_RETRY_)) != 0)
212 #define ClearRetry(pbuf) \
214 *(unsigned short *)(pbuf) &= (~cpu_to_le16(_RETRY_)); \
217 #define SetPwrMgt(pbuf) \
219 *(unsigned short *)(pbuf) |= cpu_to_le16(_PWRMGT_); \
222 #define GetPwrMgt(pbuf) (((*(unsigned short *)(pbuf)) & \
223 le16_to_cpu(_PWRMGT_)) != 0)
225 #define ClearPwrMgt(pbuf) \
227 *(unsigned short *)(pbuf) &= (~cpu_to_le16(_PWRMGT_)); \
230 #define SetMData(pbuf) \
232 *(unsigned short *)(pbuf) |= cpu_to_le16(_MORE_DATA_); \
235 #define GetMData(pbuf) (((*(unsigned short *)(pbuf)) & \
236 le16_to_cpu(_MORE_DATA_)) != 0)
238 #define ClearMData(pbuf) \
240 *(unsigned short *)(pbuf) &= (~cpu_to_le16(_MORE_DATA_)); \
243 #define SetPrivacy(pbuf) \
245 *(unsigned short *)(pbuf) |= cpu_to_le16(_PRIVACY_); \
248 #define GetPrivacy(pbuf) (((*(unsigned short *)(pbuf)) & \
249 le16_to_cpu(_PRIVACY_)) != 0)
251 #define ClearPrivacy(pbuf) \
253 *(unsigned short *)(pbuf) &= (~cpu_to_le16(_PRIVACY_)); \
257 #define GetOrder(pbuf) (((*(unsigned short *)(pbuf)) & \
258 le16_to_cpu(_ORDER_)) != 0)
260 #define GetFrameType(pbuf) (le16_to_cpu(*(unsigned short *)(pbuf)) & \
263 #define SetFrameType(pbuf, type) \
265 *(unsigned short *)(pbuf) &= __constant_cpu_to_le16(~(BIT(3) | \
267 *(unsigned short *)(pbuf) |= __constant_cpu_to_le16(type); \
270 #define GetFrameSubType(pbuf) (cpu_to_le16(*(unsigned short *)(pbuf)) & \
271 (BIT(7) | BIT(6) | BIT(5) | BIT(4) | BIT(3) | \
274 #define SetFrameSubType(pbuf, type) \
276 *(unsigned short *)(pbuf) &= cpu_to_le16(~(BIT(7) | BIT(6) | \
277 BIT(5) | BIT(4) | BIT(3) | BIT(2))); \
278 *(unsigned short *)(pbuf) |= cpu_to_le16(type); \
281 #define GetSequence(pbuf) (cpu_to_le16(*(unsigned short *)\
282 ((addr_t)(pbuf) + 22)) >> 4)
284 #define GetFragNum(pbuf) (cpu_to_le16(*(unsigned short *)((addr_t)\
285 (pbuf) + 22)) & 0x0f)
287 #define GetTupleCache(pbuf) (cpu_to_le16(*(unsigned short *)\
288 ((addr_t)(pbuf) + 22)))
290 #define SetFragNum(pbuf, num) \
292 *(unsigned short *)((addr_t)(pbuf) + 22) = \
293 ((*(unsigned short *)((addr_t)(pbuf) + 22)) & \
294 le16_to_cpu(~(0x000f))) | \
295 cpu_to_le16(0x0f & (num)); \
298 #define SetSeqNum(pbuf, num) \
300 *(unsigned short *)((addr_t)(pbuf) + 22) = \
301 ((*(unsigned short *)((addr_t)(pbuf) + 22)) & \
302 le16_to_cpu((unsigned short)0x000f)) | \
303 le16_to_cpu((unsigned short)(0xfff0 & (num << 4))); \
306 #define SetDuration(pbuf, dur) \
308 *(unsigned short *)((addr_t)(pbuf) + 2) |= \
309 cpu_to_le16(0xffff & (dur)); \
312 #define SetPriority(pbuf, tid) \
314 *(unsigned short *)(pbuf) |= cpu_to_le16(tid & 0xf); \
317 #define GetPriority(pbuf) ((le16_to_cpu(*(unsigned short *)(pbuf))) & 0xf)
319 #define SetAckpolicy(pbuf, ack) \
321 *(unsigned short *)(pbuf) |= cpu_to_le16((ack & 3) << 5); \
324 #define GetAckpolicy(pbuf) (((le16_to_cpu(*(unsigned short *)pbuf)) >> 5) & 0x3)
326 #define GetAMsdu(pbuf) (((le16_to_cpu(*(unsigned short *)pbuf)) >> 7) & 0x1)
328 #define SetAMsdu(pbuf, amsdu) \
330 *(unsigned short *)(pbuf) |= cpu_to_le16((amsdu & 1) << 7); \
333 #define GetAid(pbuf) (cpu_to_le16(*(unsigned short *)((addr_t)(pbuf) + 2)) \
336 #define GetTid(pbuf) (cpu_to_le16(*(unsigned short *)((addr_t)(pbuf) + \
337 (((GetToDs(pbuf) << 1)|GetFrDs(pbuf)) == 3 ? \
340 #define GetAddr1Ptr(pbuf) ((unsigned char *)((addr_t)(pbuf) + 4))
342 #define GetAddr2Ptr(pbuf) ((unsigned char *)((addr_t)(pbuf) + 10))
344 #define GetAddr3Ptr(pbuf) ((unsigned char *)((addr_t)(pbuf) + 16))
346 #define GetAddr4Ptr(pbuf) ((unsigned char *)((addr_t)(pbuf) + 24))
350 static inline int IS_MCAST(
unsigned char *
da)
359 static inline unsigned char *get_da(
unsigned char *pframe)
382 static inline unsigned char *get_sa(
unsigned char *pframe)
405 static inline unsigned char *get_hdr_bssid(
unsigned char *pframe)
432 #define _RESERVED_FRAME_TYPE_ 0
433 #define _SKB_FRAME_TYPE_ 2
434 #define _PRE_ALLOCMEM_ 1
435 #define _PRE_ALLOCHDR_ 3
436 #define _PRE_ALLOCLLCHDR_ 4
437 #define _PRE_ALLOCICVHDR_ 5
438 #define _PRE_ALLOCMICHDR_ 6
440 #define _SIFSTIME_ ((priv->pmib->BssType.net_work_type & \
441 WIRELESS_11A) ? 16 : 10)
442 #define _ACKCTSLNG_ 14
445 #define _ASOCREQ_IE_OFFSET_ 4
446 #define _ASOCRSP_IE_OFFSET_ 6
447 #define _REASOCREQ_IE_OFFSET_ 10
448 #define _REASOCRSP_IE_OFFSET_ 6
449 #define _PROBEREQ_IE_OFFSET_ 0
450 #define _PROBERSP_IE_OFFSET_ 12
451 #define _AUTH_IE_OFFSET_ 6
452 #define _DEAUTH_IE_OFFSET_ 0
453 #define _BEACON_IE_OFFSET_ 12
455 #define _FIXED_IE_LENGTH_ _BEACON_IE_OFFSET_
458 #define _SUPPORTEDRATES_IE_ 1
461 #define _IBSS_PARA_IE_ 6
462 #define _CHLGETXT_IE_ 16
463 #define _RSN_IE_2_ 48`
464 #define _SSN_IE_1_ 221
465 #define _ERPINFO_IE_ 42
466 #define _EXT_SUPPORTEDRATES_IE_ 50
468 #define _HT_CAPABILITY_IE_ 45
469 #define _HT_EXTRA_INFO_IE_ 61
470 #define _HT_ADD_INFO_IE_ 61
472 #define _VENDOR_SPECIFIC_IE_ 221
474 #define _RESERVED47_ 47
480 #define _AUTH_ALGM_NUM_ 2
481 #define _AUTH_SEQ_NUM_ 2
482 #define _BEACON_ITERVAL_ 2
483 #define _CAPABILITY_ 2
484 #define _CURRENT_APADDR_ 6
485 #define _LISTEN_INTERVAL_ 2
486 #define _RSON_CODE_ 2
488 #define _STATUS_CODE_ 2
489 #define _TIMESTAMP_ 8
491 #define AUTH_ODD_TO 0
492 #define AUTH_EVEN_TO 1
494 #define WLAN_ETHCONV_ENCAP 1
495 #define WLAN_ETHCONV_RFC1042 2
496 #define WLAN_ETHCONV_8021h 3
498 #define cap_ESS BIT(0)
499 #define cap_IBSS BIT(1)
500 #define cap_CFPollable BIT(2)
501 #define cap_CFRequest BIT(3)
502 #define cap_Privacy BIT(4)
503 #define cap_ShortPremble BIT(5)
508 #define _IEEE8021X_MGT_ 1
509 #define _IEEE8021X_PSK_ 2
514 #define _WMM_IE_Length_ 7
515 #define _WMM_Para_Element_Length_ 24
523 #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
524 #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
525 #define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0
526 #define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
527 #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800
529 #define SetOrderBit(pbuf) \
531 *(unsigned short *)(pbuf) |= cpu_to_le16(_ORDER_); \
534 #define GetOrderBit(pbuf) (((*(unsigned short *)(pbuf)) & \
535 le16_to_cpu(_ORDER_)) != 0)
554 #define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000
555 #define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004
589 #define IEEE80211_HT_CAP_SUP_WIDTH 0x0002
590 #define IEEE80211_HT_CAP_SM_PS 0x000C
591 #define IEEE80211_HT_CAP_GRN_FLD 0x0010
592 #define IEEE80211_HT_CAP_SGI_20 0x0020
593 #define IEEE80211_HT_CAP_SGI_40 0x0040
594 #define IEEE80211_HT_CAP_TX_STBC 0x0080
595 #define IEEE80211_HT_CAP_DELAY_BA 0x0400
596 #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
597 #define IEEE80211_HT_CAP_DSSSCCK40 0x1000
599 #define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03
600 #define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C
602 #define IEEE80211_SUPP_MCS_SET_UEQM 4
603 #define IEEE80211_HT_CAP_MAX_STREAMS 4
604 #define IEEE80211_SUPP_MCS_SET_LEN 10
606 #define IEEE80211_HT_CAP_MCS_TX_DEFINED 0x01
607 #define IEEE80211_HT_CAP_MCS_TX_RX_DIFF 0x02
608 #define IEEE80211_HT_CAP_MCS_TX_STREAMS 0x0C
609 #define IEEE80211_HT_CAP_MCS_TX_UEQM 0x10
611 #define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03
612 #define IEEE80211_HT_IE_CHA_SEC_NONE 0x00
613 #define IEEE80211_HT_IE_CHA_SEC_ABOVE 0x01
614 #define IEEE80211_HT_IE_CHA_SEC_BELOW 0x03
615 #define IEEE80211_HT_IE_CHA_WIDTH 0x04
616 #define IEEE80211_HT_IE_HT_PROTECTION 0x0003
617 #define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
618 #define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
621 #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
622 #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
623 #define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0
624 #define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
625 #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800
631 #define IEEE80211_MIN_AMPDU_BUF 0x8
632 #define IEEE80211_MAX_AMPDU_BUF 0x40
636 #define WLAN_HT_CAP_SM_PS_STATIC 0
637 #define WLAN_HT_CAP_SM_PS_DYNAMIC 1
638 #define WLAN_HT_CAP_SM_PS_INVALID 2
639 #define WLAN_HT_CAP_SM_PS_DISABLED 3