ieee80211.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*-
  2. * Copyright (c) 2001 Atsushi Onoe
  3. * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. * 3. The name of the author may not be used to endorse or promote products
  15. * derived from this software without specific prior written permission.
  16. *
  17. * Alternatively, this software may be distributed under the terms of the
  18. * GNU General Public License ("GPL") version 2 as published by the Free
  19. * Software Foundation.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  22. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  23. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  24. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  25. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  26. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  30. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. *
  32. * $FreeBSD: src/sys/net80211/ieee80211.h,v 1.10 2005/07/22 16:55:27 sam Exp $
  33. */
  34. #ifndef _NET80211_IEEE80211_H_
  35. #define _NET80211_IEEE80211_H_
  36. /*
  37. * 802.11 protocol definitions.
  38. */
  39. #define IEEE80211_FC0_VERSION_MASK 0x03
  40. #define IEEE80211_FC0_VERSION_SHIFT 0
  41. #define IEEE80211_FC0_VERSION_0 0x00
  42. #define IEEE80211_FC0_TYPE_MASK 0x0c
  43. #define IEEE80211_FC0_TYPE_SHIFT 2
  44. #define IEEE80211_FC0_TYPE_MGT 0x00
  45. #define IEEE80211_FC0_TYPE_CTL 0x04
  46. #define IEEE80211_FC0_TYPE_DATA 0x08
  47. #define IEEE80211_FC0_SUBTYPE_MASK 0xf0
  48. #define IEEE80211_FC0_SUBTYPE_SHIFT 4
  49. /* for TYPE_MGT */
  50. #define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00
  51. #define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10
  52. #define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20
  53. #define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30
  54. #define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40
  55. #define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50
  56. #define IEEE80211_FC0_SUBTYPE_BEACON 0x80
  57. #define IEEE80211_FC0_SUBTYPE_ATIM 0x90
  58. #define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0
  59. #define IEEE80211_FC0_SUBTYPE_AUTH 0xb0
  60. #define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0
  61. /* for TYPE_CTL */
  62. #define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0
  63. #define IEEE80211_FC0_SUBTYPE_RTS 0xb0
  64. #define IEEE80211_FC0_SUBTYPE_CTS 0xc0
  65. #define IEEE80211_FC0_SUBTYPE_ACK 0xd0
  66. #define IEEE80211_FC0_SUBTYPE_CF_END 0xe0
  67. #define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0
  68. /* for TYPE_DATA (bit combination) */
  69. #define IEEE80211_FC0_SUBTYPE_DATA 0x00
  70. #define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10
  71. #define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20
  72. #define IEEE80211_FC0_SUBTYPE_CF_ACPL 0x30
  73. #define IEEE80211_FC0_SUBTYPE_NODATA 0x40
  74. #define IEEE80211_FC0_SUBTYPE_NODATA_CF_ACK 0x50
  75. #define IEEE80211_FC0_SUBTYPE_NODATA_CF_POLL 0x60
  76. #define IEEE80211_FC0_SUBTYPE_NODATA_CF_ACPL 0x70
  77. #define IEEE80211_FC0_SUBTYPE_QOS 0x80
  78. #define IEEE80211_FC0_SUBTYPE_QOS_NULL 0xc0
  79. #define IEEE80211_FC1_DIR_MASK 0x03
  80. #define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */
  81. #define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */
  82. #define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */
  83. #define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */
  84. #define IEEE80211_FC1_MORE_FRAG 0x04
  85. #define IEEE80211_FC1_RETRY 0x08
  86. #define IEEE80211_FC1_PWR_MGT 0x10
  87. #define IEEE80211_FC1_MORE_DATA 0x20
  88. #define IEEE80211_FC1_WEP 0x40
  89. #define IEEE80211_FC1_ORDER 0x80
  90. #define IEEE80211_SEQ_FRAG_MASK 0x000f
  91. #define IEEE80211_SEQ_FRAG_SHIFT 0
  92. #define IEEE80211_SEQ_SEQ_MASK 0xfff0
  93. #define IEEE80211_SEQ_SEQ_SHIFT 4
  94. #define IEEE80211_NWID_LEN 32
  95. #define IEEE80211_QOS_TXOP 0x00ff
  96. /* bit 8 is reserved */
  97. #define IEEE80211_QOS_ACKPOLICY 0x60
  98. #define IEEE80211_QOS_ACKPOLICY_S 5
  99. #define IEEE80211_QOS_ESOP 0x10
  100. #define IEEE80211_QOS_ESOP_S 4
  101. #define IEEE80211_QOS_TID 0x0f
  102. #define IEEE80211_MGT_SUBTYPE_NAMES { \
  103. "assoc-req", "assoc-resp", \
  104. "reassoc-req", "reassoc-resp", \
  105. "probe-req", "probe-resp", \
  106. "reserved#6", "reserved#7", \
  107. "beacon", "atim", \
  108. "disassoc", "auth", \
  109. "deauth", "reserved#13", \
  110. "reserved#14", "reserved#15" \
  111. }
  112. #define IEEE80211_CTL_SUBTYPE_NAMES { \
  113. "reserved#0", "reserved#1", \
  114. "reserved#2", "reserved#3", \
  115. "reserved#3", "reserved#5", \
  116. "reserved#6", "reserved#7", \
  117. "reserved#8", "reserved#9", \
  118. "ps-poll", "rts", \
  119. "cts", "ack", \
  120. "cf-end", "cf-end-ack" \
  121. }
  122. #define IEEE80211_DATA_SUBTYPE_NAMES { \
  123. "data", "data-cf-ack", \
  124. "data-cf-poll", "data-cf-ack-poll", \
  125. "null", "cf-ack", \
  126. "cf-poll", "cf-ack-poll", \
  127. "qos-data", "qos-data-cf-ack", \
  128. "qos-data-cf-poll", "qos-data-cf-ack-poll", \
  129. "qos", "reserved#13", \
  130. "qos-cf-poll", "qos-cf-ack-poll" \
  131. }
  132. #define IEEE80211_TYPE_NAMES { "mgt", "ctl", "data", "reserved#4" }
  133. #endif /* _NET80211_IEEE80211_H_ */