1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Copyright (C) 2003 Herbert Valerio Riedel <hvr@gnu.org> 4 * Copyright (C) 2004 Luis R. Rodriguez <mcgrof@ruslug.rutgers.edu> 5 * Copyright (C) 2004 Aurelien Alleaume <slts@free.fr> 6 */ 7 8#if !defined(_ISL_OID_H) 9#define _ISL_OID_H 10 11/* 12 * MIB related constant and structure definitions for communicating 13 * with the device firmware 14 */ 15 16struct obj_ssid { 17 u8 length; 18 char octets[33]; 19} __packed; 20 21struct obj_key { 22 u8 type; /* dot11_priv_t */ 23 u8 length; 24 char key[32]; 25} __packed; 26 27struct obj_mlme { 28 u8 address[6]; 29 u16 id; 30 u16 state; 31 u16 code; 32} __packed; 33 34struct obj_mlmeex { 35 u8 address[6]; 36 u16 id; 37 u16 state; 38 u16 code; 39 u16 size; 40 u8 data[]; 41} __packed; 42 43struct obj_buffer { 44 u32 size; 45 u32 addr; /* 32bit bus address */ 46} __packed; 47 48struct obj_bss { 49 u8 address[6]; 50 int:16; /* padding */ 51 52 char state; 53 char reserved; 54 short age; 55 56 char quality; 57 char rssi; 58 59 struct obj_ssid ssid; 60 short channel; 61 char beacon_period; 62 char dtim_period; 63 short capinfo; 64 short rates; 65 short basic_rates; 66 int:16; /* padding */ 67} __packed; 68 69struct obj_bsslist { 70 u32 nr; 71 struct obj_bss bsslist[]; 72} __packed; 73 74struct obj_frequencies { 75 u16 nr; 76 u16 mhz[]; 77} __packed; 78 79struct obj_attachment { 80 char type; 81 char reserved; 82 short id; 83 short size; 84 char data[]; 85} __packed; 86 87/* 88 * in case everything's ok, the inlined function below will be 89 * optimized away by the compiler... 90 */ 91static inline void 92__bug_on_wrong_struct_sizes(void) 93{ 94 BUILD_BUG_ON(sizeof (struct obj_ssid) != 34); 95 BUILD_BUG_ON(sizeof (struct obj_key) != 34); 96 BUILD_BUG_ON(sizeof (struct obj_mlme) != 12); 97 BUILD_BUG_ON(sizeof (struct obj_mlmeex) != 14); 98 BUILD_BUG_ON(sizeof (struct obj_buffer) != 8); 99 BUILD_BUG_ON(sizeof (struct obj_bss) != 60); 100 BUILD_BUG_ON(sizeof (struct obj_bsslist) != 4); 101 BUILD_BUG_ON(sizeof (struct obj_frequencies) != 2); 102} 103 104enum dot11_state_t { 105 DOT11_STATE_NONE = 0, 106 DOT11_STATE_AUTHING = 1, 107 DOT11_STATE_AUTH = 2, 108 DOT11_STATE_ASSOCING = 3, 109 110 DOT11_STATE_ASSOC = 5, 111 DOT11_STATE_IBSS = 6, 112 DOT11_STATE_WDS = 7 113}; 114 115enum dot11_bsstype_t { 116 DOT11_BSSTYPE_NONE = 0, 117 DOT11_BSSTYPE_INFRA = 1, 118 DOT11_BSSTYPE_IBSS = 2, 119 DOT11_BSSTYPE_ANY = 3 120}; 121 122enum dot11_auth_t { 123 DOT11_AUTH_NONE = 0, 124 DOT11_AUTH_OS = 1, 125 DOT11_AUTH_SK = 2, 126 DOT11_AUTH_BOTH = 3 127}; 128 129enum dot11_mlme_t { 130 DOT11_MLME_AUTO = 0, 131 DOT11_MLME_INTERMEDIATE = 1, 132 DOT11_MLME_EXTENDED = 2 133}; 134 135enum dot11_priv_t { 136 DOT11_PRIV_WEP = 0, 137 DOT11_PRIV_TKIP = 1 138}; 139 140/* Prism "Nitro" / Frameburst / "Packet Frame Grouping" 141 * Value is in microseconds. Represents the # microseconds 142 * the firmware will take to group frames before sending out then out 143 * together with a CSMA contention. Without this all frames are 144 * sent with a CSMA contention. 145 * Bibliography: 146 * https://www.hpl.hp.com/personal/Jean_Tourrilhes/Papers/Packet.Frame.Grouping.html 147 */ 148enum dot11_maxframeburst_t { 149 /* Values for DOT11_OID_MAXFRAMEBURST */ 150 DOT11_MAXFRAMEBURST_OFF = 0, /* Card firmware default */ 151 DOT11_MAXFRAMEBURST_MIXED_SAFE = 650, /* 802.11 a,b,g safe */ 152 DOT11_MAXFRAMEBURST_IDEAL = 1300, /* Theoretical ideal level */ 153 DOT11_MAXFRAMEBURST_MAX = 5000, /* Use this as max, 154 * Note: firmware allows for greater values. This is a 155 * recommended max. I'll update this as I find 156 * out what the real MAX is. Also note that you don't necessarily 157 * get better results with a greater value here. 158 */ 159}; 160 161/* Support for 802.11 long and short frame preambles. 162 * Long preamble uses 128-bit sync field, 8-bit CRC 163 * Short preamble uses 56-bit sync field, 16-bit CRC 164 * 165 * 802.11a -- not sure, both optionally ? 166 * 802.11b supports long and optionally short 167 * 802.11g supports both */ 168enum dot11_preamblesettings_t { 169 DOT11_PREAMBLESETTING_LONG = 0, 170 /* Allows *only* long 802.11 preambles */ 171 DOT11_PREAMBLESETTING_SHORT = 1, 172 /* Allows *only* short 802.11 preambles */ 173 DOT11_PREAMBLESETTING_DYNAMIC = 2 174 /* AutomatiGically set */ 175}; 176 177/* Support for 802.11 slot timing (time between packets). 178 * 179 * Long uses 802.11a slot timing (9 usec ?) 180 * Short uses 802.11b slot timing (20 use ?) */ 181enum dot11_slotsettings_t { 182 DOT11_SLOTSETTINGS_LONG = 0, 183 /* Allows *only* long 802.11b slot timing */ 184 DOT11_SLOTSETTINGS_SHORT = 1, 185 /* Allows *only* long 802.11a slot timing */ 186 DOT11_SLOTSETTINGS_DYNAMIC = 2 187 /* AutomatiGically set */ 188}; 189 190/* All you need to know, ERP is "Extended Rate PHY". 191 * An Extended Rate PHY (ERP) STA or AP shall support three different 192 * preamble and header formats: 193 * Long preamble (refer to above) 194 * Short preamble (refer to above) 195 * OFDM preamble ( ? ) 196 * 197 * I'm assuming here Protection tells the AP 198 * to be careful, a STA which cannot handle the long pre-amble 199 * has joined. 200 */ 201enum do11_nonerpstatus_t { 202 DOT11_ERPSTAT_NONEPRESENT = 0, 203 DOT11_ERPSTAT_USEPROTECTION = 1 204}; 205 206/* (ERP is "Extended Rate PHY") Way to read NONERP is NON-ERP-* 207 * The key here is DOT11 NON ERP NEVER protects against 208 * NON ERP STA's. You *don't* want this unless 209 * you know what you are doing. It means you will only 210 * get Extended Rate capabilities */ 211enum dot11_nonerpprotection_t { 212 DOT11_NONERP_NEVER = 0, 213 DOT11_NONERP_ALWAYS = 1, 214 DOT11_NONERP_DYNAMIC = 2 215}; 216 217/* Preset OID configuration for 802.11 modes 218 * Note: DOT11_OID_CW[MIN|MAX] hold the values of the 219 * DCS MIN|MAX backoff used */ 220enum dot11_profile_t { /* And set/allowed values */ 221 /* Allowed values for DOT11_OID_PROFILES */ 222 DOT11_PROFILE_B_ONLY = 0, 223 /* DOT11_OID_RATES: 1, 2, 5.5, 11Mbps 224 * DOT11_OID_PREAMBLESETTINGS: DOT11_PREAMBLESETTING_DYNAMIC 225 * DOT11_OID_CWMIN: 31 226 * DOT11_OID_NONEPROTECTION: DOT11_NOERP_DYNAMIC 227 * DOT11_OID_SLOTSETTINGS: DOT11_SLOTSETTINGS_LONG 228 */ 229 DOT11_PROFILE_MIXED_G_WIFI = 1, 230 /* DOT11_OID_RATES: 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54Mbs 231 * DOT11_OID_PREAMBLESETTINGS: DOT11_PREAMBLESETTING_DYNAMIC 232 * DOT11_OID_CWMIN: 15 233 * DOT11_OID_NONEPROTECTION: DOT11_NOERP_DYNAMIC 234 * DOT11_OID_SLOTSETTINGS: DOT11_SLOTSETTINGS_DYNAMIC 235 */ 236 DOT11_PROFILE_MIXED_LONG = 2, /* "Long range" */ 237 /* Same as Profile MIXED_G_WIFI */ 238 DOT11_PROFILE_G_ONLY = 3, 239 /* Same as Profile MIXED_G_WIFI */ 240 DOT11_PROFILE_TEST = 4, 241 /* Same as Profile MIXED_G_WIFI except: 242 * DOT11_OID_PREAMBLESETTINGS: DOT11_PREAMBLESETTING_SHORT 243 * DOT11_OID_NONEPROTECTION: DOT11_NOERP_NEVER 244 * DOT11_OID_SLOTSETTINGS: DOT11_SLOTSETTINGS_SHORT 245 */ 246 DOT11_PROFILE_B_WIFI = 5, 247 /* Same as Profile B_ONLY */ 248 DOT11_PROFILE_A_ONLY = 6, 249 /* Same as Profile MIXED_G_WIFI except: 250 * DOT11_OID_RATES: 6, 9, 12, 18, 24, 36, 48, 54Mbs 251 */ 252 DOT11_PROFILE_MIXED_SHORT = 7 253 /* Same as MIXED_G_WIFI */ 254}; 255 256 257/* The dot11d conformance level configures the 802.11d conformance levels. 258 * The following conformance levels exist:*/ 259enum oid_inl_conformance_t { 260 OID_INL_CONFORMANCE_NONE = 0, /* Perform active scanning */ 261 OID_INL_CONFORMANCE_STRICT = 1, /* Strictly adhere to 802.11d */ 262 OID_INL_CONFORMANCE_FLEXIBLE = 2, /* Use passed 802.11d info to 263 * determine channel AND/OR just make assumption that active 264 * channels are valid channels */ 265}; 266 267enum oid_inl_mode_t { 268 INL_MODE_NONE = -1, 269 INL_MODE_PROMISCUOUS = 0, 270 INL_MODE_CLIENT = 1, 271 INL_MODE_AP = 2, 272 INL_MODE_SNIFFER = 3 273}; 274 275enum oid_inl_config_t { 276 INL_CONFIG_NOTHING = 0x00, 277 INL_CONFIG_MANUALRUN = 0x01, 278 INL_CONFIG_FRAMETRAP = 0x02, 279 INL_CONFIG_RXANNEX = 0x04, 280 INL_CONFIG_TXANNEX = 0x08, 281 INL_CONFIG_WDS = 0x10 282}; 283 284enum oid_inl_phycap_t { 285 INL_PHYCAP_2400MHZ = 1, 286 INL_PHYCAP_5000MHZ = 2, 287 INL_PHYCAP_FAA = 0x80000000, /* Means card supports the FAA switch */ 288}; 289 290 291enum oid_num_t { 292 GEN_OID_MACADDRESS = 0, 293 GEN_OID_LINKSTATE, 294 GEN_OID_WATCHDOG, 295 GEN_OID_MIBOP, 296 GEN_OID_OPTIONS, 297 GEN_OID_LEDCONFIG, 298 299 /* 802.11 */ 300 DOT11_OID_BSSTYPE, 301 DOT11_OID_BSSID, 302 DOT11_OID_SSID, 303 DOT11_OID_STATE, 304 DOT11_OID_AID, 305 DOT11_OID_COUNTRYSTRING, 306 DOT11_OID_SSIDOVERRIDE, 307 308 DOT11_OID_MEDIUMLIMIT, 309 DOT11_OID_BEACONPERIOD, 310 DOT11_OID_DTIMPERIOD, 311 DOT11_OID_ATIMWINDOW, 312 DOT11_OID_LISTENINTERVAL, 313 DOT11_OID_CFPPERIOD, 314 DOT11_OID_CFPDURATION, 315 316 DOT11_OID_AUTHENABLE, 317 DOT11_OID_PRIVACYINVOKED, 318 DOT11_OID_EXUNENCRYPTED, 319 DOT11_OID_DEFKEYID, 320 DOT11_OID_DEFKEYX, /* DOT11_OID_DEFKEY1,...DOT11_OID_DEFKEY4 */ 321 DOT11_OID_STAKEY, 322 DOT11_OID_REKEYTHRESHOLD, 323 DOT11_OID_STASC, 324 325 DOT11_OID_PRIVTXREJECTED, 326 DOT11_OID_PRIVRXPLAIN, 327 DOT11_OID_PRIVRXFAILED, 328 DOT11_OID_PRIVRXNOKEY, 329 330 DOT11_OID_RTSTHRESH, 331 DOT11_OID_FRAGTHRESH, 332 DOT11_OID_SHORTRETRIES, 333 DOT11_OID_LONGRETRIES, 334 DOT11_OID_MAXTXLIFETIME, 335 DOT11_OID_MAXRXLIFETIME, 336 DOT11_OID_AUTHRESPTIMEOUT, 337 DOT11_OID_ASSOCRESPTIMEOUT, 338 339 DOT11_OID_ALOFT_TABLE, 340 DOT11_OID_ALOFT_CTRL_TABLE, 341 DOT11_OID_ALOFT_RETREAT, 342 DOT11_OID_ALOFT_PROGRESS, 343 DOT11_OID_ALOFT_FIXEDRATE, 344 DOT11_OID_ALOFT_RSSIGRAPH, 345 DOT11_OID_ALOFT_CONFIG, 346 347 DOT11_OID_VDCFX, 348 DOT11_OID_MAXFRAMEBURST, 349 350 DOT11_OID_PSM, 351 DOT11_OID_CAMTIMEOUT, 352 DOT11_OID_RECEIVEDTIMS, 353 DOT11_OID_ROAMPREFERENCE, 354 355 DOT11_OID_BRIDGELOCAL, 356 DOT11_OID_CLIENTS, 357 DOT11_OID_CLIENTSASSOCIATED, 358 DOT11_OID_CLIENTX, /* DOT11_OID_CLIENTX,...DOT11_OID_CLIENT2007 */ 359 360 DOT11_OID_CLIENTFIND, 361 DOT11_OID_WDSLINKADD, 362 DOT11_OID_WDSLINKREMOVE, 363 DOT11_OID_EAPAUTHSTA, 364 DOT11_OID_EAPUNAUTHSTA, 365 DOT11_OID_DOT1XENABLE, 366 DOT11_OID_MICFAILURE, 367 DOT11_OID_REKEYINDICATE, 368 369 DOT11_OID_MPDUTXSUCCESSFUL, 370 DOT11_OID_MPDUTXONERETRY, 371 DOT11_OID_MPDUTXMULTIPLERETRIES, 372 DOT11_OID_MPDUTXFAILED, 373 DOT11_OID_MPDURXSUCCESSFUL, 374 DOT11_OID_MPDURXDUPS, 375 DOT11_OID_RTSSUCCESSFUL, 376 DOT11_OID_RTSFAILED, 377 DOT11_OID_ACKFAILED, 378 DOT11_OID_FRAMERECEIVES, 379 DOT11_OID_FRAMEERRORS, 380 DOT11_OID_FRAMEABORTS, 381 DOT11_OID_FRAMEABORTSPHY, 382 383 DOT11_OID_SLOTTIME, 384 DOT11_OID_CWMIN, /* MIN DCS backoff */ 385 DOT11_OID_CWMAX, /* MAX DCS backoff */ 386 DOT11_OID_ACKWINDOW, 387 DOT11_OID_ANTENNARX, 388 DOT11_OID_ANTENNATX, 389 DOT11_OID_ANTENNADIVERSITY, 390 DOT11_OID_CHANNEL, 391 DOT11_OID_EDTHRESHOLD, 392 DOT11_OID_PREAMBLESETTINGS, 393 DOT11_OID_RATES, 394 DOT11_OID_CCAMODESUPPORTED, 395 DOT11_OID_CCAMODE, 396 DOT11_OID_RSSIVECTOR, 397 DOT11_OID_OUTPUTPOWERTABLE, 398 DOT11_OID_OUTPUTPOWER, 399 DOT11_OID_SUPPORTEDRATES, 400 DOT11_OID_FREQUENCY, 401 DOT11_OID_SUPPORTEDFREQUENCIES, 402 DOT11_OID_NOISEFLOOR, 403 DOT11_OID_FREQUENCYACTIVITY, 404 DOT11_OID_IQCALIBRATIONTABLE, 405 DOT11_OID_NONERPPROTECTION, 406 DOT11_OID_SLOTSETTINGS, 407 DOT11_OID_NONERPTIMEOUT, 408 DOT11_OID_PROFILES, 409 DOT11_OID_EXTENDEDRATES, 410 411 DOT11_OID_DEAUTHENTICATE, 412 DOT11_OID_AUTHENTICATE, 413 DOT11_OID_DISASSOCIATE, 414 DOT11_OID_ASSOCIATE, 415 DOT11_OID_SCAN, 416 DOT11_OID_BEACON, 417 DOT11_OID_PROBE, 418 DOT11_OID_DEAUTHENTICATEEX, 419 DOT11_OID_AUTHENTICATEEX, 420 DOT11_OID_DISASSOCIATEEX, 421 DOT11_OID_ASSOCIATEEX, 422 DOT11_OID_REASSOCIATE, 423 DOT11_OID_REASSOCIATEEX, 424 425 DOT11_OID_NONERPSTATUS, 426 427 DOT11_OID_STATIMEOUT, 428 DOT11_OID_MLMEAUTOLEVEL, 429 DOT11_OID_BSSTIMEOUT, 430 DOT11_OID_ATTACHMENT, 431 DOT11_OID_PSMBUFFER, 432 433 DOT11_OID_BSSS, 434 DOT11_OID_BSSX, /*DOT11_OID_BSS1,...,DOT11_OID_BSS64 */ 435 DOT11_OID_BSSFIND, 436 DOT11_OID_BSSLIST, 437 438 OID_INL_TUNNEL, 439 OID_INL_MEMADDR, 440 OID_INL_MEMORY, 441 OID_INL_MODE, 442 OID_INL_COMPONENT_NR, 443 OID_INL_VERSION, 444 OID_INL_INTERFACE_ID, 445 OID_INL_COMPONENT_ID, 446 OID_INL_CONFIG, 447 OID_INL_DOT11D_CONFORMANCE, 448 OID_INL_PHYCAPABILITIES, 449 OID_INL_OUTPUTPOWER, 450 451 OID_NUM_LAST 452}; 453 454#define OID_FLAG_CACHED 0x80 455#define OID_FLAG_TYPE 0x7f 456 457#define OID_TYPE_U32 0x01 458#define OID_TYPE_SSID 0x02 459#define OID_TYPE_KEY 0x03 460#define OID_TYPE_BUFFER 0x04 461#define OID_TYPE_BSS 0x05 462#define OID_TYPE_BSSLIST 0x06 463#define OID_TYPE_FREQUENCIES 0x07 464#define OID_TYPE_MLME 0x08 465#define OID_TYPE_MLMEEX 0x09 466#define OID_TYPE_ADDR 0x0A 467#define OID_TYPE_RAW 0x0B 468#define OID_TYPE_ATTACH 0x0C 469 470/* OID_TYPE_MLMEEX is special because of a variable size field when sending. 471 * Not yet implemented (not used in driver anyway). 472 */ 473 474struct oid_t { 475 enum oid_num_t oid; 476 short range; /* to define a range of oid */ 477 short size; /* max size of the associated data */ 478 char flags; 479}; 480 481union oid_res_t { 482 void *ptr; 483 u32 u; 484}; 485 486#define IWMAX_BITRATES 20 487#define IWMAX_BSS 24 488#define IWMAX_FREQ 30 489#define PRIV_STR_SIZE 1024 490 491#endif /* !defined(_ISL_OID_H) */ 492/* EOF */ 493