p80211types.h 12 KB

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