1 /* SPDX-License-Identifier: (GPL-2.0 OR MPL-1.1) */
5 * Macros, constants, types, and funcs for p80211 data types
7 * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
8 * --------------------------------------------------------------------
12 * --------------------------------------------------------------------
14 * Inquiries regarding the linux-wlan Open Source project can be
17 * AbsoluteValue Systems Inc.
19 * http://www.linux-wlan.com
21 * --------------------------------------------------------------------
23 * Portions of the development of this software were funded by
24 * Intersil Corporation as part of PRISM(R) chipset product development.
26 * --------------------------------------------------------------------
28 * This file declares some of the constants and types used in various
29 * parts of the linux-wlan system.
32 * - Constant values are always in HOST byte order.
34 * All functions and statics declared here are implemented in p80211types.c
35 * --------------------------------------------------------------------
38 #ifndef _P80211TYPES_H
39 #define _P80211TYPES_H
41 /*----------------------------------------------------------------*/
42 /* The following constants are indexes into the Mib Category List */
43 /* and the Message Category List */
45 /* Mib Category List */
46 #define P80211_MIB_CAT_DOT11SMT 1
47 #define P80211_MIB_CAT_DOT11MAC 2
48 #define P80211_MIB_CAT_DOT11PHY 3
50 #define P80211SEC_DOT11SMT P80211_MIB_CAT_DOT11SMT
51 #define P80211SEC_DOT11MAC P80211_MIB_CAT_DOT11MAC
52 #define P80211SEC_DOT11PHY P80211_MIB_CAT_DOT11PHY
54 /* Message Category List */
55 #define P80211_MSG_CAT_DOT11REQ 1
56 #define P80211_MSG_CAT_DOT11IND 2
58 /*----------------------------------------------------------------*/
59 /* p80211 enumeration constants. The value to text mappings for */
60 /* these is in p80211types.c. These defines were generated */
61 /* from the mappings. */
63 /* error codes for lookups */
65 #define P80211ENUM_truth_false 0
66 #define P80211ENUM_truth_true 1
67 #define P80211ENUM_ifstate_disable 0
68 #define P80211ENUM_ifstate_fwload 1
69 #define P80211ENUM_ifstate_enable 2
70 #define P80211ENUM_bsstype_infrastructure 1
71 #define P80211ENUM_bsstype_independent 2
72 #define P80211ENUM_bsstype_any 3
73 #define P80211ENUM_authalg_opensystem 1
74 #define P80211ENUM_authalg_sharedkey 2
75 #define P80211ENUM_scantype_active 1
76 #define P80211ENUM_resultcode_success 1
77 #define P80211ENUM_resultcode_invalid_parameters 2
78 #define P80211ENUM_resultcode_not_supported 3
79 #define P80211ENUM_resultcode_refused 6
80 #define P80211ENUM_resultcode_cant_set_readonly_mib 10
81 #define P80211ENUM_resultcode_implementation_failure 11
82 #define P80211ENUM_resultcode_cant_get_writeonly_mib 12
83 #define P80211ENUM_status_successful 0
84 #define P80211ENUM_status_unspec_failure 1
85 #define P80211ENUM_status_ap_full 17
86 #define P80211ENUM_msgitem_status_data_ok 0
87 #define P80211ENUM_msgitem_status_no_value 1
89 /*----------------------------------------------------------------*/
90 /* p80211 max length constants for the different pascal strings. */
92 #define MAXLEN_PSTR6 (6) /* pascal array of 6 bytes */
93 #define MAXLEN_PSTR14 (14) /* pascal array of 14 bytes */
94 #define MAXLEN_PSTR32 (32) /* pascal array of 32 bytes */
95 #define MAXLEN_PSTR255 (255) /* pascal array of 255 bytes */
96 #define MAXLEN_MIBATTRIBUTE (392) /* maximum mibattribute */
97 /* where the size of the DATA itself */
98 /* is a DID-LEN-DATA triple */
99 /* with a max size of 4+4+384 */
101 /*----------------------------------------------------------------
102 * The following constants and macros are used to construct and
103 * deconstruct the Data ID codes. The coding is as follows:
105 * ...rwtnnnnnnnniiiiiiggggggssssss s - Section
115 #define P80211DID_LSB_SECTION (0)
116 #define P80211DID_LSB_GROUP (6)
117 #define P80211DID_LSB_ITEM (12)
118 #define P80211DID_LSB_INDEX (18)
119 #define P80211DID_LSB_ISTABLE (26)
120 #define P80211DID_LSB_ACCESS (27)
122 #define P80211DID_MASK_SECTION (0x0000003fUL)
123 #define P80211DID_MASK_GROUP (0x0000003fUL)
124 #define P80211DID_MASK_ITEM (0x0000003fUL)
125 #define P80211DID_MASK_INDEX (0x000000ffUL)
126 #define P80211DID_MASK_ISTABLE (0x00000001UL)
127 #define P80211DID_MASK_ACCESS (0x00000003UL)
129 #define P80211DID_MK(a, m, l) ((((u32)(a)) & (m)) << (l))
131 #define P80211DID_MKSECTION(a) P80211DID_MK(a, \
132 P80211DID_MASK_SECTION, \
133 P80211DID_LSB_SECTION)
134 #define P80211DID_MKGROUP(a) P80211DID_MK(a, \
135 P80211DID_MASK_GROUP, \
137 #define P80211DID_MKITEM(a) P80211DID_MK(a, \
138 P80211DID_MASK_ITEM, \
140 #define P80211DID_MKINDEX(a) P80211DID_MK(a, \
141 P80211DID_MASK_INDEX, \
143 #define P80211DID_MKISTABLE(a) P80211DID_MK(a, \
144 P80211DID_MASK_ISTABLE, \
145 P80211DID_LSB_ISTABLE)
147 #define P80211DID_MKID(s, g, i, n, t, a) (P80211DID_MKSECTION(s) | \
148 P80211DID_MKGROUP(g) | \
149 P80211DID_MKITEM(i) | \
150 P80211DID_MKINDEX(n) | \
151 P80211DID_MKISTABLE(t) | \
154 #define P80211DID_GET(a, m, l) ((((u32)(a)) >> (l)) & (m))
156 #define P80211DID_SECTION(a) P80211DID_GET(a, \
157 P80211DID_MASK_SECTION, \
158 P80211DID_LSB_SECTION)
159 #define P80211DID_GROUP(a) P80211DID_GET(a, \
160 P80211DID_MASK_GROUP, \
162 #define P80211DID_ITEM(a) P80211DID_GET(a, \
163 P80211DID_MASK_ITEM, \
165 #define P80211DID_INDEX(a) P80211DID_GET(a, \
166 P80211DID_MASK_INDEX, \
168 #define P80211DID_ISTABLE(a) P80211DID_GET(a, \
169 P80211DID_MASK_ISTABLE, \
170 P80211DID_LSB_ISTABLE)
171 #define P80211DID_ACCESS(a) P80211DID_GET(a, \
172 P80211DID_MASK_ACCESS, \
173 P80211DID_LSB_ACCESS)
175 /*----------------------------------------------------------------*/
176 /* The following structure types are used to store data items in */
179 /* Template pascal string */
189 /* Maximum pascal string */
190 struct p80211pstr255 {
192 u8 data[MAXLEN_PSTR255];
195 /* pascal string for macaddress and bssid */
198 u8 data[MAXLEN_PSTR6];
201 /* pascal string for channel list */
202 struct p80211pstr14 {
204 u8 data[MAXLEN_PSTR14];
207 /* pascal string for ssid */
208 struct p80211pstr32 {
210 u8 data[MAXLEN_PSTR32];
213 /* prototype template */
220 /* prototype template w/ data item */
228 /* message data item for int, BOUNDEDINT, ENUMINT */
229 struct p80211item_uint32 {
236 /* message data item for OCTETSTR, DISPLAYSTR */
237 struct p80211item_pstr6 {
241 struct p80211pstr6 data;
244 /* message data item for OCTETSTR, DISPLAYSTR */
245 struct p80211item_pstr14 {
249 struct p80211pstr14 data;
252 /* message data item for OCTETSTR, DISPLAYSTR */
253 struct p80211item_pstr32 {
257 struct p80211pstr32 data;
260 /* message data item for OCTETSTR, DISPLAYSTR */
261 struct p80211item_pstr255 {
265 struct p80211pstr255 data;
268 /* message data item for UNK 392, namely mib items */
269 struct p80211item_unk392 {
273 u8 data[MAXLEN_MIBATTRIBUTE];
276 /* message data item for UNK 1025, namely p2 pdas */
277 struct p80211item_unk1024 {
284 /* message data item for UNK 4096, namely p2 download chunks */
285 struct p80211item_unk4096 {
292 #endif /* _P80211TYPES_H */