p80211types.h 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. /* SPDX-License-Identifier: (GPL-2.0 OR MPL-1.1) */
  2. /*
  3. * p80211types.h
  4. *
  5. * Macros, constants, types, and funcs for p80211 data types
  6. *
  7. * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
  8. * --------------------------------------------------------------------
  9. *
  10. * linux-wlan
  11. *
  12. * The contents of this file are subject to the Mozilla Public
  13. * License Version 1.1 (the "License"); you may not use this file
  14. * except in compliance with the License. You may obtain a copy of
  15. * the License at http://www.mozilla.org/MPL/
  16. *
  17. * Software distributed under the License is distributed on an "AS
  18. * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  19. * implied. See the License for the specific language governing
  20. * rights and limitations under the License.
  21. *
  22. * Alternatively, the contents of this file may be used under the
  23. * terms of the GNU Public License version 2 (the "GPL"), in which
  24. * case the provisions of the GPL are applicable instead of the
  25. * above. If you wish to allow the use of your version of this file
  26. * only under the terms of the GPL and not to allow others to use
  27. * your version of this file under the MPL, indicate your decision
  28. * by deleting the provisions above and replace them with the notice
  29. * and other provisions required by the GPL. If you do not delete
  30. * the provisions above, a recipient may use your version of this
  31. * file under either the MPL or the GPL.
  32. *
  33. * --------------------------------------------------------------------
  34. *
  35. * Inquiries regarding the linux-wlan Open Source project can be
  36. * made directly to:
  37. *
  38. * AbsoluteValue Systems Inc.
  39. * info@linux-wlan.com
  40. * http://www.linux-wlan.com
  41. *
  42. * --------------------------------------------------------------------
  43. *
  44. * Portions of the development of this software were funded by
  45. * Intersil Corporation as part of PRISM(R) chipset product development.
  46. *
  47. * --------------------------------------------------------------------
  48. *
  49. * This file declares some of the constants and types used in various
  50. * parts of the linux-wlan system.
  51. *
  52. * Notes:
  53. * - Constant values are always in HOST byte order.
  54. *
  55. * All functions and statics declared here are implemented in p80211types.c
  56. * --------------------------------------------------------------------
  57. */
  58. #ifndef _P80211TYPES_H
  59. #define _P80211TYPES_H
  60. /*----------------------------------------------------------------*/
  61. /* The following constants are indexes into the Mib Category List */
  62. /* and the Message Category List */
  63. /* Mib Category List */
  64. #define P80211_MIB_CAT_DOT11SMT 1
  65. #define P80211_MIB_CAT_DOT11MAC 2
  66. #define P80211_MIB_CAT_DOT11PHY 3
  67. #define P80211SEC_DOT11SMT P80211_MIB_CAT_DOT11SMT
  68. #define P80211SEC_DOT11MAC P80211_MIB_CAT_DOT11MAC
  69. #define P80211SEC_DOT11PHY P80211_MIB_CAT_DOT11PHY
  70. /* Message Category List */
  71. #define P80211_MSG_CAT_DOT11REQ 1
  72. #define P80211_MSG_CAT_DOT11IND 2
  73. /*----------------------------------------------------------------*/
  74. /* p80211 enumeration constants. The value to text mappings for */
  75. /* these is in p80211types.c. These defines were generated */
  76. /* from the mappings. */
  77. /* error codes for lookups */
  78. #define P80211ENUM_truth_false 0
  79. #define P80211ENUM_truth_true 1
  80. #define P80211ENUM_ifstate_disable 0
  81. #define P80211ENUM_ifstate_fwload 1
  82. #define P80211ENUM_ifstate_enable 2
  83. #define P80211ENUM_bsstype_infrastructure 1
  84. #define P80211ENUM_bsstype_independent 2
  85. #define P80211ENUM_bsstype_any 3
  86. #define P80211ENUM_authalg_opensystem 1
  87. #define P80211ENUM_authalg_sharedkey 2
  88. #define P80211ENUM_scantype_active 1
  89. #define P80211ENUM_resultcode_success 1
  90. #define P80211ENUM_resultcode_invalid_parameters 2
  91. #define P80211ENUM_resultcode_not_supported 3
  92. #define P80211ENUM_resultcode_refused 6
  93. #define P80211ENUM_resultcode_cant_set_readonly_mib 10
  94. #define P80211ENUM_resultcode_implementation_failure 11
  95. #define P80211ENUM_resultcode_cant_get_writeonly_mib 12
  96. #define P80211ENUM_status_successful 0
  97. #define P80211ENUM_status_unspec_failure 1
  98. #define P80211ENUM_status_ap_full 17
  99. #define P80211ENUM_msgitem_status_data_ok 0
  100. #define P80211ENUM_msgitem_status_no_value 1
  101. /*----------------------------------------------------------------*/
  102. /* p80211 max length constants for the different pascal strings. */
  103. #define MAXLEN_PSTR6 (6) /* pascal array of 6 bytes */
  104. #define MAXLEN_PSTR14 (14) /* pascal array of 14 bytes */
  105. #define MAXLEN_PSTR32 (32) /* pascal array of 32 bytes */
  106. #define MAXLEN_PSTR255 (255) /* pascal array of 255 bytes */
  107. #define MAXLEN_MIBATTRIBUTE (392) /* maximum mibattribute */
  108. /* where the size of the DATA itself */
  109. /* is a DID-LEN-DATA triple */
  110. /* with a max size of 4+4+384 */
  111. /*----------------------------------------------------------------
  112. * The following constants and macros are used to construct and
  113. * deconstruct the Data ID codes. The coding is as follows:
  114. *
  115. * ...rwtnnnnnnnniiiiiiggggggssssss s - Section
  116. * g - Group
  117. * i - Item
  118. * n - Index
  119. * t - Table flag
  120. * w - Write flag
  121. * r - Read flag
  122. * . - Unused
  123. */
  124. #define P80211DID_LSB_SECTION (0)
  125. #define P80211DID_LSB_GROUP (6)
  126. #define P80211DID_LSB_ITEM (12)
  127. #define P80211DID_LSB_INDEX (18)
  128. #define P80211DID_LSB_ISTABLE (26)
  129. #define P80211DID_LSB_ACCESS (27)
  130. #define P80211DID_MASK_SECTION (0x0000003fUL)
  131. #define P80211DID_MASK_GROUP (0x0000003fUL)
  132. #define P80211DID_MASK_ITEM (0x0000003fUL)
  133. #define P80211DID_MASK_INDEX (0x000000ffUL)
  134. #define P80211DID_MASK_ISTABLE (0x00000001UL)
  135. #define P80211DID_MASK_ACCESS (0x00000003UL)
  136. #define P80211DID_MK(a, m, l) ((((u32)(a)) & (m)) << (l))
  137. #define P80211DID_MKSECTION(a) P80211DID_MK(a, \
  138. P80211DID_MASK_SECTION, \
  139. P80211DID_LSB_SECTION)
  140. #define P80211DID_MKGROUP(a) P80211DID_MK(a, \
  141. P80211DID_MASK_GROUP, \
  142. P80211DID_LSB_GROUP)
  143. #define P80211DID_MKITEM(a) P80211DID_MK(a, \
  144. P80211DID_MASK_ITEM, \
  145. P80211DID_LSB_ITEM)
  146. #define P80211DID_MKINDEX(a) P80211DID_MK(a, \
  147. P80211DID_MASK_INDEX, \
  148. P80211DID_LSB_INDEX)
  149. #define P80211DID_MKISTABLE(a) P80211DID_MK(a, \
  150. P80211DID_MASK_ISTABLE, \
  151. P80211DID_LSB_ISTABLE)
  152. #define P80211DID_MKID(s, g, i, n, t, a) (P80211DID_MKSECTION(s) | \
  153. P80211DID_MKGROUP(g) | \
  154. P80211DID_MKITEM(i) | \
  155. P80211DID_MKINDEX(n) | \
  156. P80211DID_MKISTABLE(t) | \
  157. (a))
  158. #define P80211DID_GET(a, m, l) ((((u32)(a)) >> (l)) & (m))
  159. #define P80211DID_SECTION(a) P80211DID_GET(a, \
  160. P80211DID_MASK_SECTION, \
  161. P80211DID_LSB_SECTION)
  162. #define P80211DID_GROUP(a) P80211DID_GET(a, \
  163. P80211DID_MASK_GROUP, \
  164. P80211DID_LSB_GROUP)
  165. #define P80211DID_ITEM(a) P80211DID_GET(a, \
  166. P80211DID_MASK_ITEM, \
  167. P80211DID_LSB_ITEM)
  168. #define P80211DID_INDEX(a) P80211DID_GET(a, \
  169. P80211DID_MASK_INDEX, \
  170. P80211DID_LSB_INDEX)
  171. #define P80211DID_ISTABLE(a) P80211DID_GET(a, \
  172. P80211DID_MASK_ISTABLE, \
  173. P80211DID_LSB_ISTABLE)
  174. #define P80211DID_ACCESS(a) P80211DID_GET(a, \
  175. P80211DID_MASK_ACCESS, \
  176. P80211DID_LSB_ACCESS)
  177. /*----------------------------------------------------------------*/
  178. /* The following structure types are used to store data items in */
  179. /* messages. */
  180. /* Template pascal string */
  181. struct p80211pstr {
  182. u8 len;
  183. } __packed;
  184. struct p80211pstrd {
  185. u8 len;
  186. u8 data[];
  187. } __packed;
  188. /* Maximum pascal string */
  189. struct p80211pstr255 {
  190. u8 len;
  191. u8 data[MAXLEN_PSTR255];
  192. } __packed;
  193. /* pascal string for macaddress and bssid */
  194. struct p80211pstr6 {
  195. u8 len;
  196. u8 data[MAXLEN_PSTR6];
  197. } __packed;
  198. /* pascal string for channel list */
  199. struct p80211pstr14 {
  200. u8 len;
  201. u8 data[MAXLEN_PSTR14];
  202. } __packed;
  203. /* pascal string for ssid */
  204. struct p80211pstr32 {
  205. u8 len;
  206. u8 data[MAXLEN_PSTR32];
  207. } __packed;
  208. /* MAC address array */
  209. struct p80211macarray {
  210. u32 cnt;
  211. u8 data[1][MAXLEN_PSTR6];
  212. } __packed;
  213. /* prototype template */
  214. struct p80211item {
  215. u32 did;
  216. u16 status;
  217. u16 len;
  218. } __packed;
  219. /* prototype template w/ data item */
  220. struct p80211itemd {
  221. u32 did;
  222. u16 status;
  223. u16 len;
  224. u8 data[];
  225. } __packed;
  226. /* message data item for int, BOUNDEDINT, ENUMINT */
  227. struct p80211item_uint32 {
  228. u32 did;
  229. u16 status;
  230. u16 len;
  231. u32 data;
  232. } __packed;
  233. /* message data item for OCTETSTR, DISPLAYSTR */
  234. struct p80211item_pstr6 {
  235. u32 did;
  236. u16 status;
  237. u16 len;
  238. struct p80211pstr6 data;
  239. } __packed;
  240. /* message data item for OCTETSTR, DISPLAYSTR */
  241. struct p80211item_pstr14 {
  242. u32 did;
  243. u16 status;
  244. u16 len;
  245. struct p80211pstr14 data;
  246. } __packed;
  247. /* message data item for OCTETSTR, DISPLAYSTR */
  248. struct p80211item_pstr32 {
  249. u32 did;
  250. u16 status;
  251. u16 len;
  252. struct p80211pstr32 data;
  253. } __packed;
  254. /* message data item for OCTETSTR, DISPLAYSTR */
  255. struct p80211item_pstr255 {
  256. u32 did;
  257. u16 status;
  258. u16 len;
  259. struct p80211pstr255 data;
  260. } __packed;
  261. /* message data item for UNK 392, namely mib items */
  262. struct p80211item_unk392 {
  263. u32 did;
  264. u16 status;
  265. u16 len;
  266. u8 data[MAXLEN_MIBATTRIBUTE];
  267. } __packed;
  268. /* message data item for UNK 1025, namely p2 pdas */
  269. struct p80211item_unk1024 {
  270. u32 did;
  271. u16 status;
  272. u16 len;
  273. u8 data[1024];
  274. } __packed;
  275. /* message data item for UNK 4096, namely p2 download chunks */
  276. struct p80211item_unk4096 {
  277. u32 did;
  278. u16 status;
  279. u16 len;
  280. u8 data[4096];
  281. } __packed;
  282. #endif /* _P80211TYPES_H */