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 * 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/
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.
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.
33 * --------------------------------------------------------------------
35 * Inquiries regarding the linux-wlan Open Source project can be
38 * AbsoluteValue Systems Inc.
40 * http://www.linux-wlan.com
42 * --------------------------------------------------------------------
44 * Portions of the development of this software were funded by
45 * Intersil Corporation as part of PRISM(R) chipset product development.
47 * --------------------------------------------------------------------
49 * This file declares some of the constants and types used in various
50 * parts of the linux-wlan system.
53 * - Constant values are always in HOST byte order.
55 * All functions and statics declared here are implemented in p80211types.c
56 * --------------------------------------------------------------------
59 #ifndef _P80211TYPES_H
60 #define _P80211TYPES_H
62 /*----------------------------------------------------------------*/
63 /* The following constants are indexes into the Mib Category List */
64 /* and the Message Category List */
66 /* Mib Category List */
67 #define P80211_MIB_CAT_DOT11SMT 1
68 #define P80211_MIB_CAT_DOT11MAC 2
69 #define P80211_MIB_CAT_DOT11PHY 3
71 #define P80211SEC_DOT11SMT P80211_MIB_CAT_DOT11SMT
72 #define P80211SEC_DOT11MAC P80211_MIB_CAT_DOT11MAC
73 #define P80211SEC_DOT11PHY P80211_MIB_CAT_DOT11PHY
75 /* Message Category List */
76 #define P80211_MSG_CAT_DOT11REQ 1
77 #define P80211_MSG_CAT_DOT11IND 2
79 /*----------------------------------------------------------------*/
80 /* p80211 enumeration constants. The value to text mappings for */
81 /* these is in p80211types.c. These defines were generated */
82 /* from the mappings. */
84 /* error codes for lookups */
86 #define P80211ENUM_truth_false 0
87 #define P80211ENUM_truth_true 1
88 #define P80211ENUM_ifstate_disable 0
89 #define P80211ENUM_ifstate_fwload 1
90 #define P80211ENUM_ifstate_enable 2
91 #define P80211ENUM_bsstype_infrastructure 1
92 #define P80211ENUM_bsstype_independent 2
93 #define P80211ENUM_bsstype_any 3
94 #define P80211ENUM_authalg_opensystem 1
95 #define P80211ENUM_authalg_sharedkey 2
96 #define P80211ENUM_scantype_active 1
97 #define P80211ENUM_resultcode_success 1
98 #define P80211ENUM_resultcode_invalid_parameters 2
99 #define P80211ENUM_resultcode_not_supported 3
100 #define P80211ENUM_resultcode_refused 6
101 #define P80211ENUM_resultcode_cant_set_readonly_mib 10
102 #define P80211ENUM_resultcode_implementation_failure 11
103 #define P80211ENUM_resultcode_cant_get_writeonly_mib 12
104 #define P80211ENUM_status_successful 0
105 #define P80211ENUM_status_unspec_failure 1
106 #define P80211ENUM_status_ap_full 17
107 #define P80211ENUM_msgitem_status_data_ok 0
108 #define P80211ENUM_msgitem_status_no_value 1
110 /*----------------------------------------------------------------*/
111 /* p80211 max length constants for the different pascal strings. */
113 #define MAXLEN_PSTR6 (6) /* pascal array of 6 bytes */
114 #define MAXLEN_PSTR14 (14) /* pascal array of 14 bytes */
115 #define MAXLEN_PSTR32 (32) /* pascal array of 32 bytes */
116 #define MAXLEN_PSTR255 (255) /* pascal array of 255 bytes */
117 #define MAXLEN_MIBATTRIBUTE (392) /* maximum mibattribute */
118 /* where the size of the DATA itself */
119 /* is a DID-LEN-DATA triple */
120 /* with a max size of 4+4+384 */
122 /*----------------------------------------------------------------
123 * The following constants and macros are used to construct and
124 * deconstruct the Data ID codes. The coding is as follows:
126 * ...rwtnnnnnnnniiiiiiggggggssssss s - Section
136 #define P80211DID_LSB_SECTION (0)
137 #define P80211DID_LSB_GROUP (6)
138 #define P80211DID_LSB_ITEM (12)
139 #define P80211DID_LSB_INDEX (18)
140 #define P80211DID_LSB_ISTABLE (26)
141 #define P80211DID_LSB_ACCESS (27)
143 #define P80211DID_MASK_SECTION (0x0000003fUL)
144 #define P80211DID_MASK_GROUP (0x0000003fUL)
145 #define P80211DID_MASK_ITEM (0x0000003fUL)
146 #define P80211DID_MASK_INDEX (0x000000ffUL)
147 #define P80211DID_MASK_ISTABLE (0x00000001UL)
148 #define P80211DID_MASK_ACCESS (0x00000003UL)
150 #define P80211DID_MK(a, m, l) ((((u32)(a)) & (m)) << (l))
152 #define P80211DID_MKSECTION(a) P80211DID_MK(a, \
153 P80211DID_MASK_SECTION, \
154 P80211DID_LSB_SECTION)
155 #define P80211DID_MKGROUP(a) P80211DID_MK(a, \
156 P80211DID_MASK_GROUP, \
158 #define P80211DID_MKITEM(a) P80211DID_MK(a, \
159 P80211DID_MASK_ITEM, \
161 #define P80211DID_MKINDEX(a) P80211DID_MK(a, \
162 P80211DID_MASK_INDEX, \
164 #define P80211DID_MKISTABLE(a) P80211DID_MK(a, \
165 P80211DID_MASK_ISTABLE, \
166 P80211DID_LSB_ISTABLE)
168 #define P80211DID_MKID(s, g, i, n, t, a) (P80211DID_MKSECTION(s) | \
169 P80211DID_MKGROUP(g) | \
170 P80211DID_MKITEM(i) | \
171 P80211DID_MKINDEX(n) | \
172 P80211DID_MKISTABLE(t) | \
175 #define P80211DID_GET(a, m, l) ((((u32)(a)) >> (l)) & (m))
177 #define P80211DID_SECTION(a) P80211DID_GET(a, \
178 P80211DID_MASK_SECTION, \
179 P80211DID_LSB_SECTION)
180 #define P80211DID_GROUP(a) P80211DID_GET(a, \
181 P80211DID_MASK_GROUP, \
183 #define P80211DID_ITEM(a) P80211DID_GET(a, \
184 P80211DID_MASK_ITEM, \
186 #define P80211DID_INDEX(a) P80211DID_GET(a, \
187 P80211DID_MASK_INDEX, \
189 #define P80211DID_ISTABLE(a) P80211DID_GET(a, \
190 P80211DID_MASK_ISTABLE, \
191 P80211DID_LSB_ISTABLE)
192 #define P80211DID_ACCESS(a) P80211DID_GET(a, \
193 P80211DID_MASK_ACCESS, \
194 P80211DID_LSB_ACCESS)
196 /*----------------------------------------------------------------*/
197 /* The following structure types are used to store data items in */
200 /* Template pascal string */
210 /* Maximum pascal string */
211 struct p80211pstr255 {
213 u8 data[MAXLEN_PSTR255];
216 /* pascal string for macaddress and bssid */
219 u8 data[MAXLEN_PSTR6];
222 /* pascal string for channel list */
223 struct p80211pstr14 {
225 u8 data[MAXLEN_PSTR14];
228 /* pascal string for ssid */
229 struct p80211pstr32 {
231 u8 data[MAXLEN_PSTR32];
234 /* MAC address array */
235 struct p80211macarray {
237 u8 data[1][MAXLEN_PSTR6];
240 /* prototype template */
247 /* prototype template w/ data item */
255 /* message data item for int, BOUNDEDINT, ENUMINT */
256 struct p80211item_uint32 {
263 /* message data item for OCTETSTR, DISPLAYSTR */
264 struct p80211item_pstr6 {
268 struct p80211pstr6 data;
271 /* message data item for OCTETSTR, DISPLAYSTR */
272 struct p80211item_pstr14 {
276 struct p80211pstr14 data;
279 /* message data item for OCTETSTR, DISPLAYSTR */
280 struct p80211item_pstr32 {
284 struct p80211pstr32 data;
287 /* message data item for OCTETSTR, DISPLAYSTR */
288 struct p80211item_pstr255 {
292 struct p80211pstr255 data;
295 /* message data item for UNK 392, namely mib items */
296 struct p80211item_unk392 {
300 u8 data[MAXLEN_MIBATTRIBUTE];
303 /* message data item for UNK 1025, namely p2 pdas */
304 struct p80211item_unk1024 {
311 /* message data item for UNK 4096, namely p2 download chunks */
312 struct p80211item_unk4096 {
319 #endif /* _P80211TYPES_H */