blob: f043090ef86ddad5ba108b3ae049d3e4dcc97480 [file] [log] [blame]
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -07001/* 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
57#ifndef _P80211TYPES_H
58#define _P80211TYPES_H
59
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -070060/*----------------------------------------------------------------*/
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -070061/* The following constants are indexes into the Mib Category List */
62/* and the Message Category List */
63
64/* Mib Category List */
65#define P80211_MIB_CAT_DOT11SMT 1
66#define P80211_MIB_CAT_DOT11MAC 2
67#define P80211_MIB_CAT_DOT11PHY 3
68
69#define P80211SEC_DOT11SMT P80211_MIB_CAT_DOT11SMT
70#define P80211SEC_DOT11MAC P80211_MIB_CAT_DOT11MAC
71#define P80211SEC_DOT11PHY P80211_MIB_CAT_DOT11PHY
72
73/* Message Category List */
74#define P80211_MSG_CAT_DOT11REQ 1
75#define P80211_MSG_CAT_DOT11IND 2
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -070076
77/*----------------------------------------------------------------*/
78/* p80211 enumeration constants. The value to text mappings for */
79/* these is in p80211types.c. These defines were generated */
80/* from the mappings. */
81
82/* error codes for lookups */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -070083
84#define P80211ENUM_truth_false 0
85#define P80211ENUM_truth_true 1
86#define P80211ENUM_ifstate_disable 0
87#define P80211ENUM_ifstate_fwload 1
88#define P80211ENUM_ifstate_enable 2
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -070089#define P80211ENUM_bsstype_infrastructure 1
90#define P80211ENUM_bsstype_independent 2
91#define P80211ENUM_bsstype_any 3
92#define P80211ENUM_authalg_opensystem 1
93#define P80211ENUM_authalg_sharedkey 2
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -070094#define P80211ENUM_scantype_active 1
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -070095#define P80211ENUM_resultcode_success 1
96#define P80211ENUM_resultcode_invalid_parameters 2
97#define P80211ENUM_resultcode_not_supported 3
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -070098#define P80211ENUM_resultcode_refused 6
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -070099#define P80211ENUM_resultcode_cant_set_readonly_mib 10
100#define P80211ENUM_resultcode_implementation_failure 11
101#define P80211ENUM_resultcode_cant_get_writeonly_mib 12
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700102#define P80211ENUM_status_successful 0
103#define P80211ENUM_status_unspec_failure 1
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700104#define P80211ENUM_status_ap_full 17
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700105#define P80211ENUM_msgitem_status_data_ok 0
106#define P80211ENUM_msgitem_status_no_value 1
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700107
108/*----------------------------------------------------------------*/
109/* p80211 max length constants for the different pascal strings. */
110
111#define MAXLEN_PSTR6 (6) /* pascal array of 6 bytes */
112#define MAXLEN_PSTR14 (14) /* pascal array of 14 bytes */
113#define MAXLEN_PSTR32 (32) /* pascal array of 32 bytes */
114#define MAXLEN_PSTR255 (255) /* pascal array of 255 bytes */
115#define MAXLEN_MIBATTRIBUTE (392) /* maximum mibattribute */
116 /* where the size of the DATA itself */
117 /* is a DID-LEN-DATA triple */
118 /* with a max size of 4+4+384 */
119
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700120/*----------------------------------------------------------------*/
121/* The following macro creates a name for an enum */
122
123#define MKENUMNAME(name) p80211enum_ ## name
124
125/*----------------------------------------------------------------
126* The following constants and macros are used to construct and
127* deconstruct the Data ID codes. The coding is as follows:
128*
129* ...rwtnnnnnnnniiiiiiggggggssssss s - Section
130* g - Group
131* i - Item
132* n - Index
133* t - Table flag
134* w - Write flag
135* r - Read flag
136* . - Unused
137*/
138
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700139#define P80211DID_LSB_SECTION (0)
140#define P80211DID_LSB_GROUP (6)
141#define P80211DID_LSB_ITEM (12)
142#define P80211DID_LSB_INDEX (18)
143#define P80211DID_LSB_ISTABLE (26)
Johan Meiringc5de2152010-11-06 18:23:09 +0200144#define P80211DID_LSB_ACCESS (27)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700145
146#define P80211DID_MASK_SECTION (0x0000003fUL)
147#define P80211DID_MASK_GROUP (0x0000003fUL)
148#define P80211DID_MASK_ITEM (0x0000003fUL)
149#define P80211DID_MASK_INDEX (0x000000ffUL)
150#define P80211DID_MASK_ISTABLE (0x00000001UL)
Johan Meiringc5de2152010-11-06 18:23:09 +0200151#define P80211DID_MASK_ACCESS (0x00000003UL)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700152
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100153#define P80211DID_MK(a, m, l) ((((u32)(a)) & (m)) << (l))
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700154
155#define P80211DID_MKSECTION(a) P80211DID_MK(a, \
156 P80211DID_MASK_SECTION, \
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100157 P80211DID_LSB_SECTION)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700158#define P80211DID_MKGROUP(a) P80211DID_MK(a, \
159 P80211DID_MASK_GROUP, \
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100160 P80211DID_LSB_GROUP)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700161#define P80211DID_MKITEM(a) P80211DID_MK(a, \
162 P80211DID_MASK_ITEM, \
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100163 P80211DID_LSB_ITEM)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700164#define P80211DID_MKINDEX(a) P80211DID_MK(a, \
165 P80211DID_MASK_INDEX, \
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100166 P80211DID_LSB_INDEX)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700167#define P80211DID_MKISTABLE(a) P80211DID_MK(a, \
168 P80211DID_MASK_ISTABLE, \
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100169 P80211DID_LSB_ISTABLE)
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700170
Svenne Krap5dd8acc2010-02-14 18:59:00 +0100171#define P80211DID_MKID(s, g, i, n, t, a) (P80211DID_MKSECTION(s) | \
172 P80211DID_MKGROUP(g) | \
173 P80211DID_MKITEM(i) | \
174 P80211DID_MKINDEX(n) | \
175 P80211DID_MKISTABLE(t) | \
176 (a))
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700177
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100178#define P80211DID_GET(a, m, l) ((((u32)(a)) >> (l)) & (m))
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700179
180#define P80211DID_SECTION(a) P80211DID_GET(a, \
181 P80211DID_MASK_SECTION, \
182 P80211DID_LSB_SECTION)
183#define P80211DID_GROUP(a) P80211DID_GET(a, \
184 P80211DID_MASK_GROUP, \
185 P80211DID_LSB_GROUP)
186#define P80211DID_ITEM(a) P80211DID_GET(a, \
187 P80211DID_MASK_ITEM, \
188 P80211DID_LSB_ITEM)
189#define P80211DID_INDEX(a) P80211DID_GET(a, \
190 P80211DID_MASK_INDEX, \
191 P80211DID_LSB_INDEX)
192#define P80211DID_ISTABLE(a) P80211DID_GET(a, \
193 P80211DID_MASK_ISTABLE, \
194 P80211DID_LSB_ISTABLE)
195#define P80211DID_ACCESS(a) P80211DID_GET(a, \
196 P80211DID_MASK_ACCESS, \
197 P80211DID_LSB_ACCESS)
198
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700199/*----------------------------------------------------------------*/
200/* The following structure types are used for the represenation */
Solomon Peachyaaad4302008-10-29 10:42:53 -0400201/* of ENUMint type metadata. */
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700202
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100203typedef struct p80211enumpair {
204 u32 val;
205 char *name;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700206} p80211enumpair_t;
207
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100208typedef struct p80211enum {
209 int nitems;
210 p80211enumpair_t *list;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700211} p80211enum_t;
212
213/*----------------------------------------------------------------*/
214/* The following structure types are used to store data items in */
215/* messages. */
216
217/* Template pascal string */
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100218typedef struct p80211pstr {
219 u8 len;
Bas van den Berg7d3864d2011-02-03 21:37:16 +0100220} __packed p80211pstr_t;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700221
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100222typedef struct p80211pstrd {
223 u8 len;
224 u8 data[0];
Bas van den Berg7d3864d2011-02-03 21:37:16 +0100225} __packed p80211pstrd_t;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700226
227/* Maximum pascal string */
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100228typedef struct p80211pstr255 {
229 u8 len;
230 u8 data[MAXLEN_PSTR255];
Bas van den Berg7d3864d2011-02-03 21:37:16 +0100231} __packed p80211pstr255_t;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700232
233/* pascal string for macaddress and bssid */
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100234typedef struct p80211pstr6 {
235 u8 len;
236 u8 data[MAXLEN_PSTR6];
Bas van den Berg7d3864d2011-02-03 21:37:16 +0100237} __packed p80211pstr6_t;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700238
239/* pascal string for channel list */
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100240typedef struct p80211pstr14 {
241 u8 len;
242 u8 data[MAXLEN_PSTR14];
Bas van den Berg7d3864d2011-02-03 21:37:16 +0100243} __packed p80211pstr14_t;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700244
245/* pascal string for ssid */
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100246typedef struct p80211pstr32 {
247 u8 len;
248 u8 data[MAXLEN_PSTR32];
Bas van den Berg7d3864d2011-02-03 21:37:16 +0100249} __packed p80211pstr32_t;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700250
251/* MAC address array */
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100252typedef struct p80211macarray {
253 u32 cnt;
254 u8 data[1][MAXLEN_PSTR6];
Bas van den Berg7d3864d2011-02-03 21:37:16 +0100255} __packed p80211macarray_t;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700256
257/* prototype template */
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100258typedef struct p80211item {
259 u32 did;
260 u16 status;
261 u16 len;
Bas van den Berg7d3864d2011-02-03 21:37:16 +0100262} __packed p80211item_t;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700263
264/* prototype template w/ data item */
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100265typedef struct p80211itemd {
266 u32 did;
267 u16 status;
268 u16 len;
269 u8 data[0];
Bas van den Berg7d3864d2011-02-03 21:37:16 +0100270} __packed p80211itemd_t;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700271
Solomon Peachyaaad4302008-10-29 10:42:53 -0400272/* message data item for int, BOUNDEDINT, ENUMINT */
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100273typedef struct p80211item_uint32 {
274 u32 did;
275 u16 status;
276 u16 len;
277 u32 data;
Bas van den Berg7d3864d2011-02-03 21:37:16 +0100278} __packed p80211item_uint32_t;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700279
280/* message data item for OCTETSTR, DISPLAYSTR */
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100281typedef struct p80211item_pstr6 {
282 u32 did;
283 u16 status;
284 u16 len;
285 p80211pstr6_t data;
Bas van den Berg7d3864d2011-02-03 21:37:16 +0100286} __packed p80211item_pstr6_t;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700287
288/* message data item for OCTETSTR, DISPLAYSTR */
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100289typedef struct p80211item_pstr14 {
290 u32 did;
291 u16 status;
292 u16 len;
293 p80211pstr14_t data;
Bas van den Berg7d3864d2011-02-03 21:37:16 +0100294} __packed p80211item_pstr14_t;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700295
296/* message data item for OCTETSTR, DISPLAYSTR */
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100297typedef struct p80211item_pstr32 {
298 u32 did;
299 u16 status;
300 u16 len;
301 p80211pstr32_t data;
Bas van den Berg7d3864d2011-02-03 21:37:16 +0100302} __packed p80211item_pstr32_t;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700303
304/* message data item for OCTETSTR, DISPLAYSTR */
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100305typedef struct p80211item_pstr255 {
306 u32 did;
307 u16 status;
308 u16 len;
309 p80211pstr255_t data;
Bas van den Berg7d3864d2011-02-03 21:37:16 +0100310} __packed p80211item_pstr255_t;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700311
312/* message data item for UNK 392, namely mib items */
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100313typedef struct p80211item_unk392 {
314 u32 did;
315 u16 status;
316 u16 len;
317 u8 data[MAXLEN_MIBATTRIBUTE];
Bas van den Berg7d3864d2011-02-03 21:37:16 +0100318} __packed p80211item_unk392_t;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700319
320/* message data item for UNK 1025, namely p2 pdas */
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100321typedef struct p80211item_unk1024 {
322 u32 did;
323 u16 status;
324 u16 len;
325 u8 data[1024];
Bas van den Berg7d3864d2011-02-03 21:37:16 +0100326} __packed p80211item_unk1024_t;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700327
328/* message data item for UNK 4096, namely p2 download chunks */
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100329typedef struct p80211item_unk4096 {
330 u32 did;
331 u16 status;
332 u16 len;
333 u8 data[4096];
Bas van den Berg7d3864d2011-02-03 21:37:16 +0100334} __packed p80211item_unk4096_t;
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700335
336struct catlistitem;
337
338/*----------------------------------------------------------------*/
339/* The following structure type is used to represent all of the */
340/* metadata items. Some components may choose to use more, */
341/* less or different metadata items. */
342
Svenne Krap5dd8acc2010-02-14 18:59:00 +0100343typedef void (*p80211_totext_t) (struct catlistitem *, u32 did, u8 *itembuf,
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100344 char *textbuf);
Svenne Krap5dd8acc2010-02-14 18:59:00 +0100345typedef void (*p80211_fromtext_t) (struct catlistitem *, u32 did, u8 *itembuf,
Moritz Muehlenhoff356925c2009-02-08 02:20:57 +0100346 char *textbuf);
Svenne Krap5dd8acc2010-02-14 18:59:00 +0100347typedef u32(*p80211_valid_t) (struct catlistitem *, u32 did, u8 *itembuf);
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700348
349/*----------------------------------------------------------------*/
350/* Enumeration Lists */
351/* The following are the external declarations */
352/* for all enumerations */
353
354extern p80211enum_t MKENUMNAME(truth);
355extern p80211enum_t MKENUMNAME(ifstate);
356extern p80211enum_t MKENUMNAME(powermgmt);
357extern p80211enum_t MKENUMNAME(bsstype);
358extern p80211enum_t MKENUMNAME(authalg);
359extern p80211enum_t MKENUMNAME(phytype);
360extern p80211enum_t MKENUMNAME(temptype);
361extern p80211enum_t MKENUMNAME(regdomain);
362extern p80211enum_t MKENUMNAME(ccamode);
363extern p80211enum_t MKENUMNAME(diversity);
364extern p80211enum_t MKENUMNAME(scantype);
365extern p80211enum_t MKENUMNAME(resultcode);
366extern p80211enum_t MKENUMNAME(reason);
367extern p80211enum_t MKENUMNAME(status);
368extern p80211enum_t MKENUMNAME(msgcode);
369extern p80211enum_t MKENUMNAME(msgitem_status);
370
371extern p80211enum_t MKENUMNAME(lnxroam_reason);
372
373extern p80211enum_t MKENUMNAME(p2preamble);
374
Greg Kroah-Hartman00b3ed12008-10-02 11:29:28 -0700375#endif /* _P80211TYPES_H */