ieee802_11.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef _IEEE802_11_H
  2. #define _IEEE802_11_H
  3. #define IEEE802_11_DATA_LEN 2304
  4. /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
  5. 6.2.1.1.2.
  6. The figure in section 7.1.2 suggests a body size of up to 2312
  7. bytes is allowed, which is a bit confusing, I suspect this
  8. represents the 2304 bytes of real data, plus a possible 8 bytes of
  9. WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
  10. #define IEEE802_11_HLEN 30
  11. #define IEEE802_11_FRAME_LEN (IEEE802_11_DATA_LEN + IEEE802_11_HLEN)
  12. struct ieee802_11_hdr {
  13. u16 frame_ctl;
  14. u16 duration_id;
  15. u8 addr1[ETH_ALEN];
  16. u8 addr2[ETH_ALEN];
  17. u8 addr3[ETH_ALEN];
  18. u16 seq_ctl;
  19. u8 addr4[ETH_ALEN];
  20. } __attribute__ ((packed));
  21. /* Frame control field constants */
  22. #define IEEE802_11_FCTL_VERS 0x0002
  23. #define IEEE802_11_FCTL_FTYPE 0x000c
  24. #define IEEE802_11_FCTL_STYPE 0x00f0
  25. #define IEEE802_11_FCTL_TODS 0x0100
  26. #define IEEE802_11_FCTL_FROMDS 0x0200
  27. #define IEEE802_11_FCTL_MOREFRAGS 0x0400
  28. #define IEEE802_11_FCTL_RETRY 0x0800
  29. #define IEEE802_11_FCTL_PM 0x1000
  30. #define IEEE802_11_FCTL_MOREDATA 0x2000
  31. #define IEEE802_11_FCTL_WEP 0x4000
  32. #define IEEE802_11_FCTL_ORDER 0x8000
  33. #define IEEE802_11_FTYPE_MGMT 0x0000
  34. #define IEEE802_11_FTYPE_CTL 0x0004
  35. #define IEEE802_11_FTYPE_DATA 0x0008
  36. /* management */
  37. #define IEEE802_11_STYPE_ASSOC_REQ 0x0000
  38. #define IEEE802_11_STYPE_ASSOC_RESP 0x0010
  39. #define IEEE802_11_STYPE_REASSOC_REQ 0x0020
  40. #define IEEE802_11_STYPE_REASSOC_RESP 0x0030
  41. #define IEEE802_11_STYPE_PROBE_REQ 0x0040
  42. #define IEEE802_11_STYPE_PROBE_RESP 0x0050
  43. #define IEEE802_11_STYPE_BEACON 0x0080
  44. #define IEEE802_11_STYPE_ATIM 0x0090
  45. #define IEEE802_11_STYPE_DISASSOC 0x00A0
  46. #define IEEE802_11_STYPE_AUTH 0x00B0
  47. #define IEEE802_11_STYPE_DEAUTH 0x00C0
  48. /* control */
  49. #define IEEE802_11_STYPE_PSPOLL 0x00A0
  50. #define IEEE802_11_STYPE_RTS 0x00B0
  51. #define IEEE802_11_STYPE_CTS 0x00C0
  52. #define IEEE802_11_STYPE_ACK 0x00D0
  53. #define IEEE802_11_STYPE_CFEND 0x00E0
  54. #define IEEE802_11_STYPE_CFENDACK 0x00F0
  55. /* data */
  56. #define IEEE802_11_STYPE_DATA 0x0000
  57. #define IEEE802_11_STYPE_DATA_CFACK 0x0010
  58. #define IEEE802_11_STYPE_DATA_CFPOLL 0x0020
  59. #define IEEE802_11_STYPE_DATA_CFACKPOLL 0x0030
  60. #define IEEE802_11_STYPE_NULLFUNC 0x0040
  61. #define IEEE802_11_STYPE_CFACK 0x0050
  62. #define IEEE802_11_STYPE_CFPOLL 0x0060
  63. #define IEEE802_11_STYPE_CFACKPOLL 0x0070
  64. #define IEEE802_11_SCTL_FRAG 0x000F
  65. #define IEEE802_11_SCTL_SEQ 0xFFF0
  66. #endif /* _IEEE802_11_H */