1/* SPDX-License-Identifier: (GPL-2.0 OR MPL-1.1) */ 2/* 3 * 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 * -------------------------------------------------------------------- 13 * 14 * Inquiries regarding the linux-wlan Open Source project can be 15 * made directly to: 16 * 17 * AbsoluteValue Systems Inc. 18 * info@linux-wlan.com 19 * http://www.linux-wlan.com 20 * 21 * -------------------------------------------------------------------- 22 * 23 * Portions of the development of this software were funded by 24 * Intersil Corporation as part of PRISM(R) chipset product development. 25 * 26 * -------------------------------------------------------------------- 27 * 28 * This file declares some of the constants and types used in various 29 * parts of the linux-wlan system. 30 * 31 * Notes: 32 * - Constant values are always in HOST byte order. 33 * 34 * All functions and statics declared here are implemented in p80211types.c 35 * -------------------------------------------------------------------- 36 */ 37 38#ifndef _P80211TYPES_H 39#define _P80211TYPES_H 40 41/*----------------------------------------------------------------*/ 42/* The following constants are indexes into the Mib Category List */ 43/* and the Message Category List */ 44 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 49 50#define P80211SEC_DOT11SMT P80211_MIB_CAT_DOT11SMT 51#define P80211SEC_DOT11MAC P80211_MIB_CAT_DOT11MAC 52#define P80211SEC_DOT11PHY P80211_MIB_CAT_DOT11PHY 53 54/* Message Category List */ 55#define P80211_MSG_CAT_DOT11REQ 1 56#define P80211_MSG_CAT_DOT11IND 2 57 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. */ 62 63/* error codes for lookups */ 64 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 88 89/*----------------------------------------------------------------*/ 90/* p80211 max length constants for the different pascal strings. */ 91 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 */ 100 101/*---------------------------------------------------------------- 102 * The following constants and macros are used to construct and 103 * deconstruct the Data ID codes. The coding is as follows: 104 * 105 * ...rwtnnnnnnnniiiiiiggggggssssss s - Section 106 * g - Group 107 * i - Item 108 * n - Index 109 * t - Table flag 110 * w - Write flag 111 * r - Read flag 112 * . - Unused 113 */ 114 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) 121 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) 128 129#define P80211DID_MK(a, m, l) ((((u32)(a)) & (m)) << (l)) 130 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, \ 136 P80211DID_LSB_GROUP) 137#define P80211DID_MKITEM(a) P80211DID_MK(a, \ 138 P80211DID_MASK_ITEM, \ 139 P80211DID_LSB_ITEM) 140#define P80211DID_MKINDEX(a) P80211DID_MK(a, \ 141 P80211DID_MASK_INDEX, \ 142 P80211DID_LSB_INDEX) 143#define P80211DID_MKISTABLE(a) P80211DID_MK(a, \ 144 P80211DID_MASK_ISTABLE, \ 145 P80211DID_LSB_ISTABLE) 146 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) | \ 152 (a)) 153 154#define P80211DID_GET(a, m, l) ((((u32)(a)) >> (l)) & (m)) 155 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, \ 161 P80211DID_LSB_GROUP) 162#define P80211DID_ITEM(a) P80211DID_GET(a, \ 163 P80211DID_MASK_ITEM, \ 164 P80211DID_LSB_ITEM) 165#define P80211DID_INDEX(a) P80211DID_GET(a, \ 166 P80211DID_MASK_INDEX, \ 167 P80211DID_LSB_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) 174 175/*----------------------------------------------------------------*/ 176/* The following structure types are used to store data items in */ 177/* messages. */ 178 179/* Template pascal string */ 180struct p80211pstr { 181 u8 len; 182} __packed; 183 184struct p80211pstrd { 185 u8 len; 186 u8 data[]; 187} __packed; 188 189/* Maximum pascal string */ 190struct p80211pstr255 { 191 u8 len; 192 u8 data[MAXLEN_PSTR255]; 193} __packed; 194 195/* pascal string for macaddress and bssid */ 196struct p80211pstr6 { 197 u8 len; 198 u8 data[MAXLEN_PSTR6]; 199} __packed; 200 201/* pascal string for channel list */ 202struct p80211pstr14 { 203 u8 len; 204 u8 data[MAXLEN_PSTR14]; 205} __packed; 206 207/* pascal string for ssid */ 208struct p80211pstr32 { 209 u8 len; 210 u8 data[MAXLEN_PSTR32]; 211} __packed; 212 213/* prototype template */ 214struct p80211item { 215 u32 did; 216 u16 status; 217 u16 len; 218} __packed; 219 220/* prototype template w/ data item */ 221struct p80211itemd { 222 u32 did; 223 u16 status; 224 u16 len; 225 u8 data[]; 226} __packed; 227 228/* message data item for int, BOUNDEDINT, ENUMINT */ 229struct p80211item_uint32 { 230 u32 did; 231 u16 status; 232 u16 len; 233 u32 data; 234} __packed; 235 236/* message data item for OCTETSTR, DISPLAYSTR */ 237struct p80211item_pstr6 { 238 u32 did; 239 u16 status; 240 u16 len; 241 struct p80211pstr6 data; 242} __packed; 243 244/* message data item for OCTETSTR, DISPLAYSTR */ 245struct p80211item_pstr14 { 246 u32 did; 247 u16 status; 248 u16 len; 249 struct p80211pstr14 data; 250} __packed; 251 252/* message data item for OCTETSTR, DISPLAYSTR */ 253struct p80211item_pstr32 { 254 u32 did; 255 u16 status; 256 u16 len; 257 struct p80211pstr32 data; 258} __packed; 259 260/* message data item for OCTETSTR, DISPLAYSTR */ 261struct p80211item_pstr255 { 262 u32 did; 263 u16 status; 264 u16 len; 265 struct p80211pstr255 data; 266} __packed; 267 268/* message data item for UNK 392, namely mib items */ 269struct p80211item_unk392 { 270 u32 did; 271 u16 status; 272 u16 len; 273 u8 data[MAXLEN_MIBATTRIBUTE]; 274} __packed; 275 276/* message data item for UNK 1025, namely p2 pdas */ 277struct p80211item_unk1024 { 278 u32 did; 279 u16 status; 280 u16 len; 281 u8 data[1024]; 282} __packed; 283 284/* message data item for UNK 4096, namely p2 download chunks */ 285struct p80211item_unk4096 { 286 u32 did; 287 u16 status; 288 u16 len; 289 u8 data[4096]; 290} __packed; 291 292#endif /* _P80211TYPES_H */ 293