ieee80211.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. /*
  2. * IEEE 802.11 defines
  3. *
  4. * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
  5. * <jkmaline@cc.hut.fi>
  6. * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
  7. * Copyright (c) 2005, Devicescape Software, Inc.
  8. * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #ifndef IEEE80211_H
  15. #define IEEE80211_H
  16. #include <linux/types.h>
  17. #include <asm/byteorder.h>
  18. #define FCS_LEN 4
  19. #define IEEE80211_FCTL_VERS 0x0003
  20. #define IEEE80211_FCTL_FTYPE 0x000c
  21. #define IEEE80211_FCTL_STYPE 0x00f0
  22. #define IEEE80211_FCTL_TODS 0x0100
  23. #define IEEE80211_FCTL_FROMDS 0x0200
  24. #define IEEE80211_FCTL_MOREFRAGS 0x0400
  25. #define IEEE80211_FCTL_RETRY 0x0800
  26. #define IEEE80211_FCTL_PM 0x1000
  27. #define IEEE80211_FCTL_MOREDATA 0x2000
  28. #define IEEE80211_FCTL_PROTECTED 0x4000
  29. #define IEEE80211_FCTL_ORDER 0x8000
  30. #define IEEE80211_SCTL_FRAG 0x000F
  31. #define IEEE80211_SCTL_SEQ 0xFFF0
  32. #define IEEE80211_FTYPE_MGMT 0x0000
  33. #define IEEE80211_FTYPE_CTL 0x0004
  34. #define IEEE80211_FTYPE_DATA 0x0008
  35. /* management */
  36. #define IEEE80211_STYPE_ASSOC_REQ 0x0000
  37. #define IEEE80211_STYPE_ASSOC_RESP 0x0010
  38. #define IEEE80211_STYPE_REASSOC_REQ 0x0020
  39. #define IEEE80211_STYPE_REASSOC_RESP 0x0030
  40. #define IEEE80211_STYPE_PROBE_REQ 0x0040
  41. #define IEEE80211_STYPE_PROBE_RESP 0x0050
  42. #define IEEE80211_STYPE_BEACON 0x0080
  43. #define IEEE80211_STYPE_ATIM 0x0090
  44. #define IEEE80211_STYPE_DISASSOC 0x00A0
  45. #define IEEE80211_STYPE_AUTH 0x00B0
  46. #define IEEE80211_STYPE_DEAUTH 0x00C0
  47. #define IEEE80211_STYPE_ACTION 0x00D0
  48. /* control */
  49. #define IEEE80211_STYPE_BACK_REQ 0x0080
  50. #define IEEE80211_STYPE_BACK 0x0090
  51. #define IEEE80211_STYPE_PSPOLL 0x00A0
  52. #define IEEE80211_STYPE_RTS 0x00B0
  53. #define IEEE80211_STYPE_CTS 0x00C0
  54. #define IEEE80211_STYPE_ACK 0x00D0
  55. #define IEEE80211_STYPE_CFEND 0x00E0
  56. #define IEEE80211_STYPE_CFENDACK 0x00F0
  57. /* data */
  58. #define IEEE80211_STYPE_DATA 0x0000
  59. #define IEEE80211_STYPE_DATA_CFACK 0x0010
  60. #define IEEE80211_STYPE_DATA_CFPOLL 0x0020
  61. #define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030
  62. #define IEEE80211_STYPE_NULLFUNC 0x0040
  63. #define IEEE80211_STYPE_CFACK 0x0050
  64. #define IEEE80211_STYPE_CFPOLL 0x0060
  65. #define IEEE80211_STYPE_CFACKPOLL 0x0070
  66. #define IEEE80211_STYPE_QOS_DATA 0x0080
  67. #define IEEE80211_STYPE_QOS_DATA_CFACK 0x0090
  68. #define IEEE80211_STYPE_QOS_DATA_CFPOLL 0x00A0
  69. #define IEEE80211_STYPE_QOS_DATA_CFACKPOLL 0x00B0
  70. #define IEEE80211_STYPE_QOS_NULLFUNC 0x00C0
  71. #define IEEE80211_STYPE_QOS_CFACK 0x00D0
  72. #define IEEE80211_STYPE_QOS_CFPOLL 0x00E0
  73. #define IEEE80211_STYPE_QOS_CFACKPOLL 0x00F0
  74. /* miscellaneous IEEE 802.11 constants */
  75. #define IEEE80211_MAX_FRAG_THRESHOLD 2352
  76. #define IEEE80211_MAX_RTS_THRESHOLD 2353
  77. #define IEEE80211_MAX_AID 2007
  78. #define IEEE80211_MAX_TIM_LEN 251
  79. /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
  80. 6.2.1.1.2.
  81. 802.11e clarifies the figure in section 7.1.2. The frame body is
  82. up to 2304 octets long (maximum MSDU size) plus any crypt overhead. */
  83. #define IEEE80211_MAX_DATA_LEN 2304
  84. /* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */
  85. #define IEEE80211_MAX_FRAME_LEN 2352
  86. #define IEEE80211_MAX_SSID_LEN 32
  87. #define IEEE80211_MAX_MESH_ID_LEN 32
  88. struct ieee80211_hdr {
  89. __le16 frame_control;
  90. __le16 duration_id;
  91. u8 addr1[6];
  92. u8 addr2[6];
  93. u8 addr3[6];
  94. __le16 seq_ctrl;
  95. u8 addr4[6];
  96. } __attribute__ ((packed));
  97. struct ieee80211s_hdr {
  98. u8 flags;
  99. u8 ttl;
  100. u8 seqnum[3];
  101. u8 eaddr1[6];
  102. u8 eaddr2[6];
  103. u8 eaddr3[6];
  104. } __attribute__ ((packed));
  105. struct ieee80211_mgmt {
  106. __le16 frame_control;
  107. __le16 duration;
  108. u8 da[6];
  109. u8 sa[6];
  110. u8 bssid[6];
  111. __le16 seq_ctrl;
  112. union {
  113. struct {
  114. __le16 auth_alg;
  115. __le16 auth_transaction;
  116. __le16 status_code;
  117. /* possibly followed by Challenge text */
  118. u8 variable[0];
  119. } __attribute__ ((packed)) auth;
  120. struct {
  121. __le16 reason_code;
  122. } __attribute__ ((packed)) deauth;
  123. struct {
  124. __le16 capab_info;
  125. __le16 listen_interval;
  126. /* followed by SSID and Supported rates */
  127. u8 variable[0];
  128. } __attribute__ ((packed)) assoc_req;
  129. struct {
  130. __le16 capab_info;
  131. __le16 status_code;
  132. __le16 aid;
  133. /* followed by Supported rates */
  134. u8 variable[0];
  135. } __attribute__ ((packed)) assoc_resp, reassoc_resp;
  136. struct {
  137. __le16 capab_info;
  138. __le16 listen_interval;
  139. u8 current_ap[6];
  140. /* followed by SSID and Supported rates */
  141. u8 variable[0];
  142. } __attribute__ ((packed)) reassoc_req;
  143. struct {
  144. __le16 reason_code;
  145. } __attribute__ ((packed)) disassoc;
  146. struct {
  147. __le64 timestamp;
  148. __le16 beacon_int;
  149. __le16 capab_info;
  150. /* followed by some of SSID, Supported rates,
  151. * FH Params, DS Params, CF Params, IBSS Params, TIM */
  152. u8 variable[0];
  153. } __attribute__ ((packed)) beacon;
  154. struct {
  155. /* only variable items: SSID, Supported rates */
  156. u8 variable[0];
  157. } __attribute__ ((packed)) probe_req;
  158. struct {
  159. __le64 timestamp;
  160. __le16 beacon_int;
  161. __le16 capab_info;
  162. /* followed by some of SSID, Supported rates,
  163. * FH Params, DS Params, CF Params, IBSS Params */
  164. u8 variable[0];
  165. } __attribute__ ((packed)) probe_resp;
  166. struct {
  167. u8 category;
  168. union {
  169. struct {
  170. u8 action_code;
  171. u8 dialog_token;
  172. u8 status_code;
  173. u8 variable[0];
  174. } __attribute__ ((packed)) wme_action;
  175. struct{
  176. u8 action_code;
  177. u8 element_id;
  178. u8 length;
  179. u8 switch_mode;
  180. u8 new_chan;
  181. u8 switch_count;
  182. } __attribute__((packed)) chan_switch;
  183. struct{
  184. u8 action_code;
  185. u8 dialog_token;
  186. __le16 capab;
  187. __le16 timeout;
  188. __le16 start_seq_num;
  189. } __attribute__((packed)) addba_req;
  190. struct{
  191. u8 action_code;
  192. u8 dialog_token;
  193. __le16 status;
  194. __le16 capab;
  195. __le16 timeout;
  196. } __attribute__((packed)) addba_resp;
  197. struct{
  198. u8 action_code;
  199. __le16 params;
  200. __le16 reason_code;
  201. } __attribute__((packed)) delba;
  202. struct{
  203. u8 action_code;
  204. /* capab_info for open and confirm,
  205. * reason for close
  206. */
  207. __le16 aux;
  208. /* Followed in plink_confirm by status
  209. * code, AID and supported rates,
  210. * and directly by supported rates in
  211. * plink_open and plink_close
  212. */
  213. u8 variable[0];
  214. } __attribute__((packed)) plink_action;
  215. struct{
  216. u8 action_code;
  217. u8 variable[0];
  218. } __attribute__((packed)) mesh_action;
  219. } u;
  220. } __attribute__ ((packed)) action;
  221. } u;
  222. } __attribute__ ((packed));
  223. /* Control frames */
  224. struct ieee80211_rts {
  225. __le16 frame_control;
  226. __le16 duration;
  227. u8 ra[6];
  228. u8 ta[6];
  229. } __attribute__ ((packed));
  230. struct ieee80211_cts {
  231. __le16 frame_control;
  232. __le16 duration;
  233. u8 ra[6];
  234. } __attribute__ ((packed));
  235. /**
  236. * struct ieee80211_bar - HT Block Ack Request
  237. *
  238. * This structure refers to "HT BlockAckReq" as
  239. * described in 802.11n draft section 7.2.1.7.1
  240. */
  241. struct ieee80211_bar {
  242. __le16 frame_control;
  243. __le16 duration;
  244. __u8 ra[6];
  245. __u8 ta[6];
  246. __le16 control;
  247. __le16 start_seq_num;
  248. } __attribute__((packed));
  249. /**
  250. * struct ieee80211_ht_cap - HT capabilities
  251. *
  252. * This structure refers to "HT capabilities element" as
  253. * described in 802.11n draft section 7.3.2.52
  254. */
  255. struct ieee80211_ht_cap {
  256. __le16 cap_info;
  257. u8 ampdu_params_info;
  258. u8 supp_mcs_set[16];
  259. __le16 extended_ht_cap_info;
  260. __le32 tx_BF_cap_info;
  261. u8 antenna_selection_info;
  262. } __attribute__ ((packed));
  263. /**
  264. * struct ieee80211_ht_cap - HT additional information
  265. *
  266. * This structure refers to "HT information element" as
  267. * described in 802.11n draft section 7.3.2.53
  268. */
  269. struct ieee80211_ht_addt_info {
  270. u8 control_chan;
  271. u8 ht_param;
  272. __le16 operation_mode;
  273. __le16 stbc_param;
  274. u8 basic_set[16];
  275. } __attribute__ ((packed));
  276. /* 802.11n HT capabilities masks */
  277. #define IEEE80211_HT_CAP_SUP_WIDTH 0x0002
  278. #define IEEE80211_HT_CAP_MIMO_PS 0x000C
  279. #define IEEE80211_HT_CAP_GRN_FLD 0x0010
  280. #define IEEE80211_HT_CAP_SGI_20 0x0020
  281. #define IEEE80211_HT_CAP_SGI_40 0x0040
  282. #define IEEE80211_HT_CAP_DELAY_BA 0x0400
  283. #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
  284. #define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03
  285. #define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C
  286. /* 802.11n HT IE masks */
  287. #define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03
  288. #define IEEE80211_HT_IE_CHA_WIDTH 0x04
  289. #define IEEE80211_HT_IE_HT_PROTECTION 0x0003
  290. #define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
  291. #define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
  292. /* MIMO Power Save Modes */
  293. #define WLAN_HT_CAP_MIMO_PS_STATIC 0
  294. #define WLAN_HT_CAP_MIMO_PS_DYNAMIC 1
  295. #define WLAN_HT_CAP_MIMO_PS_INVALID 2
  296. #define WLAN_HT_CAP_MIMO_PS_DISABLED 3
  297. /* Authentication algorithms */
  298. #define WLAN_AUTH_OPEN 0
  299. #define WLAN_AUTH_SHARED_KEY 1
  300. #define WLAN_AUTH_FAST_BSS_TRANSITION 2
  301. #define WLAN_AUTH_LEAP 128
  302. #define WLAN_AUTH_CHALLENGE_LEN 128
  303. #define WLAN_CAPABILITY_ESS (1<<0)
  304. #define WLAN_CAPABILITY_IBSS (1<<1)
  305. #define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
  306. #define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
  307. #define WLAN_CAPABILITY_PRIVACY (1<<4)
  308. #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
  309. #define WLAN_CAPABILITY_PBCC (1<<6)
  310. #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
  311. /* 802.11h */
  312. #define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
  313. #define WLAN_CAPABILITY_QOS (1<<9)
  314. #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
  315. #define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
  316. /* 802.11g ERP information element */
  317. #define WLAN_ERP_NON_ERP_PRESENT (1<<0)
  318. #define WLAN_ERP_USE_PROTECTION (1<<1)
  319. #define WLAN_ERP_BARKER_PREAMBLE (1<<2)
  320. /* WLAN_ERP_BARKER_PREAMBLE values */
  321. enum {
  322. WLAN_ERP_PREAMBLE_SHORT = 0,
  323. WLAN_ERP_PREAMBLE_LONG = 1,
  324. };
  325. /* Status codes */
  326. enum ieee80211_statuscode {
  327. WLAN_STATUS_SUCCESS = 0,
  328. WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
  329. WLAN_STATUS_CAPS_UNSUPPORTED = 10,
  330. WLAN_STATUS_REASSOC_NO_ASSOC = 11,
  331. WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
  332. WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
  333. WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
  334. WLAN_STATUS_CHALLENGE_FAIL = 15,
  335. WLAN_STATUS_AUTH_TIMEOUT = 16,
  336. WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
  337. WLAN_STATUS_ASSOC_DENIED_RATES = 18,
  338. /* 802.11b */
  339. WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
  340. WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
  341. WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
  342. /* 802.11h */
  343. WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
  344. WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
  345. WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
  346. /* 802.11g */
  347. WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
  348. WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
  349. /* 802.11i */
  350. WLAN_STATUS_INVALID_IE = 40,
  351. WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
  352. WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
  353. WLAN_STATUS_INVALID_AKMP = 43,
  354. WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
  355. WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
  356. WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
  357. /* 802.11e */
  358. WLAN_STATUS_UNSPECIFIED_QOS = 32,
  359. WLAN_STATUS_ASSOC_DENIED_NOBANDWIDTH = 33,
  360. WLAN_STATUS_ASSOC_DENIED_LOWACK = 34,
  361. WLAN_STATUS_ASSOC_DENIED_UNSUPP_QOS = 35,
  362. WLAN_STATUS_REQUEST_DECLINED = 37,
  363. WLAN_STATUS_INVALID_QOS_PARAM = 38,
  364. WLAN_STATUS_CHANGE_TSPEC = 39,
  365. WLAN_STATUS_WAIT_TS_DELAY = 47,
  366. WLAN_STATUS_NO_DIRECT_LINK = 48,
  367. WLAN_STATUS_STA_NOT_PRESENT = 49,
  368. WLAN_STATUS_STA_NOT_QSTA = 50,
  369. };
  370. /* Reason codes */
  371. enum ieee80211_reasoncode {
  372. WLAN_REASON_UNSPECIFIED = 1,
  373. WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
  374. WLAN_REASON_DEAUTH_LEAVING = 3,
  375. WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
  376. WLAN_REASON_DISASSOC_AP_BUSY = 5,
  377. WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
  378. WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
  379. WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
  380. WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
  381. /* 802.11h */
  382. WLAN_REASON_DISASSOC_BAD_POWER = 10,
  383. WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
  384. /* 802.11i */
  385. WLAN_REASON_INVALID_IE = 13,
  386. WLAN_REASON_MIC_FAILURE = 14,
  387. WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
  388. WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
  389. WLAN_REASON_IE_DIFFERENT = 17,
  390. WLAN_REASON_INVALID_GROUP_CIPHER = 18,
  391. WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
  392. WLAN_REASON_INVALID_AKMP = 20,
  393. WLAN_REASON_UNSUPP_RSN_VERSION = 21,
  394. WLAN_REASON_INVALID_RSN_IE_CAP = 22,
  395. WLAN_REASON_IEEE8021X_FAILED = 23,
  396. WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
  397. /* 802.11e */
  398. WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32,
  399. WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33,
  400. WLAN_REASON_DISASSOC_LOW_ACK = 34,
  401. WLAN_REASON_DISASSOC_QAP_EXCEED_TXOP = 35,
  402. WLAN_REASON_QSTA_LEAVE_QBSS = 36,
  403. WLAN_REASON_QSTA_NOT_USE = 37,
  404. WLAN_REASON_QSTA_REQUIRE_SETUP = 38,
  405. WLAN_REASON_QSTA_TIMEOUT = 39,
  406. WLAN_REASON_QSTA_CIPHER_NOT_SUPP = 45,
  407. };
  408. /* Information Element IDs */
  409. enum ieee80211_eid {
  410. WLAN_EID_SSID = 0,
  411. WLAN_EID_SUPP_RATES = 1,
  412. WLAN_EID_FH_PARAMS = 2,
  413. WLAN_EID_DS_PARAMS = 3,
  414. WLAN_EID_CF_PARAMS = 4,
  415. WLAN_EID_TIM = 5,
  416. WLAN_EID_IBSS_PARAMS = 6,
  417. WLAN_EID_CHALLENGE = 16,
  418. /* 802.11d */
  419. WLAN_EID_COUNTRY = 7,
  420. WLAN_EID_HP_PARAMS = 8,
  421. WLAN_EID_HP_TABLE = 9,
  422. WLAN_EID_REQUEST = 10,
  423. /* 802.11e */
  424. WLAN_EID_QBSS_LOAD = 11,
  425. WLAN_EID_EDCA_PARAM_SET = 12,
  426. WLAN_EID_TSPEC = 13,
  427. WLAN_EID_TCLAS = 14,
  428. WLAN_EID_SCHEDULE = 15,
  429. WLAN_EID_TS_DELAY = 43,
  430. WLAN_EID_TCLAS_PROCESSING = 44,
  431. WLAN_EID_QOS_CAPA = 46,
  432. /* 802.11s */
  433. WLAN_EID_MESH_CONFIG = 36, /* Pending IEEE 802.11 ANA approval */
  434. WLAN_EID_MESH_ID = 37, /* Pending IEEE 802.11 ANA approval */
  435. WLAN_EID_PEER_LINK = 40, /* Pending IEEE 802.11 ANA approval */
  436. WLAN_EID_PREQ = 53, /* Pending IEEE 802.11 ANA approval */
  437. WLAN_EID_PREP = 54, /* Pending IEEE 802.11 ANA approval */
  438. WLAN_EID_PERR = 55, /* Pending IEEE 802.11 ANA approval */
  439. /* 802.11h */
  440. WLAN_EID_PWR_CONSTRAINT = 32,
  441. WLAN_EID_PWR_CAPABILITY = 33,
  442. WLAN_EID_TPC_REQUEST = 34,
  443. WLAN_EID_TPC_REPORT = 35,
  444. WLAN_EID_SUPPORTED_CHANNELS = 36,
  445. WLAN_EID_CHANNEL_SWITCH = 37,
  446. WLAN_EID_MEASURE_REQUEST = 38,
  447. WLAN_EID_MEASURE_REPORT = 39,
  448. WLAN_EID_QUIET = 40,
  449. WLAN_EID_IBSS_DFS = 41,
  450. /* 802.11g */
  451. WLAN_EID_ERP_INFO = 42,
  452. WLAN_EID_EXT_SUPP_RATES = 50,
  453. /* 802.11n */
  454. WLAN_EID_HT_CAPABILITY = 45,
  455. WLAN_EID_HT_EXTRA_INFO = 61,
  456. /* 802.11i */
  457. WLAN_EID_RSN = 48,
  458. WLAN_EID_WPA = 221,
  459. WLAN_EID_GENERIC = 221,
  460. WLAN_EID_VENDOR_SPECIFIC = 221,
  461. WLAN_EID_QOS_PARAMETER = 222
  462. };
  463. /* Action category code */
  464. enum ieee80211_category {
  465. WLAN_CATEGORY_SPECTRUM_MGMT = 0,
  466. WLAN_CATEGORY_QOS = 1,
  467. WLAN_CATEGORY_DLS = 2,
  468. WLAN_CATEGORY_BACK = 3,
  469. WLAN_CATEGORY_WMM = 17,
  470. };
  471. /* BACK action code */
  472. enum ieee80211_back_actioncode {
  473. WLAN_ACTION_ADDBA_REQ = 0,
  474. WLAN_ACTION_ADDBA_RESP = 1,
  475. WLAN_ACTION_DELBA = 2,
  476. };
  477. /* BACK (block-ack) parties */
  478. enum ieee80211_back_parties {
  479. WLAN_BACK_RECIPIENT = 0,
  480. WLAN_BACK_INITIATOR = 1,
  481. WLAN_BACK_TIMER = 2,
  482. };
  483. /* A-MSDU 802.11n */
  484. #define IEEE80211_QOS_CONTROL_A_MSDU_PRESENT 0x0080
  485. /* cipher suite selectors */
  486. #define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00
  487. #define WLAN_CIPHER_SUITE_WEP40 0x000FAC01
  488. #define WLAN_CIPHER_SUITE_TKIP 0x000FAC02
  489. /* reserved: 0x000FAC03 */
  490. #define WLAN_CIPHER_SUITE_CCMP 0x000FAC04
  491. #define WLAN_CIPHER_SUITE_WEP104 0x000FAC05
  492. #define WLAN_MAX_KEY_LEN 32
  493. /**
  494. * ieee80211_get_SA - get pointer to SA
  495. *
  496. * Given an 802.11 frame, this function returns the offset
  497. * to the source address (SA). It does not verify that the
  498. * header is long enough to contain the address, and the
  499. * header must be long enough to contain the frame control
  500. * field.
  501. *
  502. * @hdr: the frame
  503. */
  504. static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
  505. {
  506. u8 *raw = (u8 *) hdr;
  507. u8 tofrom = (*(raw+1)) & 3; /* get the TODS and FROMDS bits */
  508. switch (tofrom) {
  509. case 2:
  510. return hdr->addr3;
  511. case 3:
  512. return hdr->addr4;
  513. }
  514. return hdr->addr2;
  515. }
  516. /**
  517. * ieee80211_get_DA - get pointer to DA
  518. *
  519. * Given an 802.11 frame, this function returns the offset
  520. * to the destination address (DA). It does not verify that
  521. * the header is long enough to contain the address, and the
  522. * header must be long enough to contain the frame control
  523. * field.
  524. *
  525. * @hdr: the frame
  526. */
  527. static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
  528. {
  529. u8 *raw = (u8 *) hdr;
  530. u8 to_ds = (*(raw+1)) & 1; /* get the TODS bit */
  531. if (to_ds)
  532. return hdr->addr3;
  533. return hdr->addr1;
  534. }
  535. /**
  536. * ieee80211_get_morefrag - determine whether the MOREFRAGS bit is set
  537. *
  538. * This function determines whether the "more fragments" bit is set
  539. * in the frame.
  540. *
  541. * @hdr: the frame
  542. */
  543. static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr)
  544. {
  545. return (le16_to_cpu(hdr->frame_control) &
  546. IEEE80211_FCTL_MOREFRAGS) != 0;
  547. }
  548. #endif /* IEEE80211_H */