1 /* $NetBSD: wi_ieee.h,v 1.15 2002/04/18 05:24:29 onoe Exp $ */ 2 3 /* 4 * Copyright (c) 1997, 1998, 1999 5 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. All advertising materials mentioning features or use of this software 16 * must display the following acknowledgement: 17 * This product includes software developed by Bill Paul. 18 * 4. Neither the name of the author nor the names of any co-contributors 19 * may be used to endorse or promote products derived from this software 20 * without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD 26 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 32 * THE POSSIBILITY OF SUCH DAMAGE. 33 * 34 * $FreeBSD: src/sys/i386/include/if_wavelan_ieee.h,v 1.4 1999/12/29 04:33:01 peter Exp $ 35 */ 36 37 #ifndef _IF_WAVELAN_IEEE_H 38 #define _IF_WAVELAN_IEEE_H 39 40 /* 41 * FreeBSD driver ported to NetBSD by Bill Sommerfeld in the back of the 42 * Oslo IETF plenary meeting. 43 * The stuff in here should probably go into a generic extension to the 44 * ifmedia goop. 45 * 46 * Michael Graff brought over the encryption bits. 47 */ 48 49 /* 50 * This header defines a simple command interface to the FreeBSD 51 * WaveLAN/IEEE driver (wi) driver, which is used to set certain 52 * device-specific parameters which can't be easily managed through 53 * ifconfig(8). No, sysctl(2) is not the answer. I said a _simple_ 54 * interface, didn't I. 55 */ 56 57 #ifndef SIOCSWAVELAN 58 #define SIOCSWAVELAN SIOCSIFGENERIC 59 #endif 60 61 #ifndef SIOCGWAVELAN 62 #define SIOCGWAVELAN SIOCGIFGENERIC 63 #endif 64 65 /* 66 * Technically I don't think there's a limit to a record 67 * length. The largest record is the one that contains the CIS 68 * data, which is 240 words long, so 256 should be a safe 69 * value. 70 */ 71 #define WI_MAX_DATALEN 512 72 73 struct wi_req { 74 u_int16_t wi_len; 75 u_int16_t wi_type; 76 u_int16_t wi_val[WI_MAX_DATALEN]; 77 }; 78 79 /* 80 * Private LTV records (interpreted only by the driver). This is 81 * a minor kludge to allow reading the interface statistics from 82 * the driver. 83 */ 84 #define WI_RID_IFACE_STATS 0x0100 85 #define WI_RID_MGMT_XMIT 0x0200 86 #ifdef WICACHE 87 #define WI_RID_ZERO_CACHE 0x0300 88 #define WI_RID_READ_CACHE 0x0400 89 #endif 90 #define WI_RID_MONITOR_MODE 0x0500 91 #define WI_RID_SCAN_APS 0x0600 92 #define WI_RID_READ_APS 0x0700 93 94 struct wi_80211_hdr { 95 u_int16_t frame_ctl; 96 u_int16_t dur_id; 97 u_int8_t addr1[6]; 98 u_int8_t addr2[6]; 99 u_int8_t addr3[6]; 100 u_int16_t seq_ctl; 101 u_int8_t addr4[6]; 102 }; 103 104 #define WI_FCTL_VERS 0x0002 105 #define WI_FCTL_FTYPE 0x000C 106 #define WI_FCTL_STYPE 0x00F0 107 #define WI_FCTL_TODS 0x0100 108 #define WI_FCTL_FROMDS 0x0200 109 #define WI_FCTL_MOREFRAGS 0x0400 110 #define WI_FCTL_RETRY 0x0800 111 #define WI_FCTL_PM 0x1000 112 #define WI_FCTL_MOREDATA 0x2000 113 #define WI_FCTL_WEP 0x4000 114 #define WI_FCTL_ORDER 0x8000 115 116 #define WI_FTYPE_MGMT 0x0000 117 #define WI_FTYPE_CTL 0x0004 118 #define WI_FTYPE_DATA 0x0008 119 120 #define WI_STYPE_MGMT_ASREQ 0x0000 /* association request */ 121 #define WI_STYPE_MGMT_ASRESP 0x0010 /* association response */ 122 #define WI_STYPE_MGMT_REASREQ 0x0020 /* reassociation request */ 123 #define WI_STYPE_MGMT_REASRESP 0x0030 /* reassociation response */ 124 #define WI_STYPE_MGMT_PROBEREQ 0x0040 /* probe request */ 125 #define WI_STYPE_MGMT_PROBERESP 0x0050 /* probe response */ 126 #define WI_STYPE_MGMT_BEACON 0x0080 /* beacon */ 127 #define WI_STYPE_MGMT_ATIM 0x0090 /* announcement traffic ind msg */ 128 #define WI_STYPE_MGMT_DISAS 0x00A0 /* disassociation */ 129 #define WI_STYPE_MGMT_AUTH 0x00B0 /* authentication */ 130 #define WI_STYPE_MGMT_DEAUTH 0x00C0 /* deauthentication */ 131 132 struct wi_mgmt_hdr { 133 u_int16_t frame_ctl; 134 u_int16_t duration; 135 u_int8_t dst_addr[6]; 136 u_int8_t src_addr[6]; 137 u_int8_t bssid[6]; 138 u_int16_t seq_ctl; 139 }; 140 141 /* 142 * Lucent/wavelan IEEE signal strength cache 143 * 144 * driver keeps cache of last 145 * MAXWICACHE packets to arrive including signal strength info. 146 * daemons may read this via ioctl 147 * 148 * Each entry in the wi_sigcache has a unique macsrc. 149 */ 150 #ifdef WICACHE 151 #define MAXWICACHE 10 152 153 struct wi_sigcache { 154 char macsrc[6]; /* unique MAC address for entry */ 155 int ipsrc; /* ip address associated with packet */ 156 int signal; /* signal strength of the packet */ 157 int noise; /* noise value */ 158 int quality; /* quality of the packet */ 159 }; 160 #endif 161 162 struct wi_counters { 163 u_int32_t wi_tx_unicast_frames; 164 u_int32_t wi_tx_multicast_frames; 165 u_int32_t wi_tx_fragments; 166 u_int32_t wi_tx_unicast_octets; 167 u_int32_t wi_tx_multicast_octets; 168 u_int32_t wi_tx_deferred_xmits; 169 u_int32_t wi_tx_single_retries; 170 u_int32_t wi_tx_multi_retries; 171 u_int32_t wi_tx_retry_limit; 172 u_int32_t wi_tx_discards; 173 u_int32_t wi_rx_unicast_frames; 174 u_int32_t wi_rx_multicast_frames; 175 u_int32_t wi_rx_fragments; 176 u_int32_t wi_rx_unicast_octets; 177 u_int32_t wi_rx_multicast_octets; 178 u_int32_t wi_rx_fcs_errors; 179 u_int32_t wi_rx_discards_nobuf; 180 u_int32_t wi_tx_discards_wrong_sa; 181 u_int32_t wi_rx_WEP_cant_decrypt; 182 u_int32_t wi_rx_msg_in_msg_frags; 183 u_int32_t wi_rx_msg_in_bad_msg_frags; 184 }; 185 186 /* 187 * Network parameters, static configuration entities. 188 */ 189 #define WI_RID_PORTTYPE 0xFC00 /* Connection control characteristics */ 190 #define WI_RID_MAC_NODE 0xFC01 /* MAC address of this station */ 191 #define WI_RID_DESIRED_SSID 0xFC02 /* Service Set ID for connection */ 192 #define WI_RID_OWN_CHNL 0xFC03 /* Comm channel for BSS creation */ 193 #define WI_RID_OWN_SSID 0xFC04 /* IBSS creation ID */ 194 #define WI_RID_OWN_ATIM_WIN 0xFC05 /* ATIM window time for IBSS creation */ 195 #define WI_RID_SYSTEM_SCALE 0xFC06 /* scale that specifies AP density */ 196 #define WI_RID_MAX_DATALEN 0xFC07 /* Max len of MAC frame body data */ 197 #define WI_RID_MAC_WDS 0xFC08 /* MAC addr of corresponding WDS node */ 198 #define WI_RID_PM_ENABLED 0xFC09 /* ESS power management enable */ 199 #define WI_RID_PM_EPS 0xFC0A /* PM EPS/PS mode */ 200 #define WI_RID_MCAST_RX 0xFC0B /* ESS PM mcast reception */ 201 #define WI_RID_MAX_SLEEP 0xFC0C /* max sleep time for ESS PM */ 202 #define WI_RID_HOLDOVER 0xFC0D /* holdover time for ESS PM */ 203 #define WI_RID_NODENAME 0xFC0E /* ID name of this node for diag */ 204 #define WI_RID_DTIM_PERIOD 0xFC10 /* beacon interval between DTIMs */ 205 #define WI_RID_WDS_ADDR1 0xFC11 /* port 1 MAC of WDS link node */ 206 #define WI_RID_WDS_ADDR2 0xFC12 /* port 1 MAC of WDS link node */ 207 #define WI_RID_WDS_ADDR3 0xFC13 /* port 1 MAC of WDS link node */ 208 #define WI_RID_WDS_ADDR4 0xFC14 /* port 1 MAC of WDS link node */ 209 #define WI_RID_WDS_ADDR5 0xFC15 /* port 1 MAC of WDS link node */ 210 #define WI_RID_WDS_ADDR6 0xFC16 /* port 1 MAC of WDS link node */ 211 #define WI_RID_MCAST_PM_BUF 0xFC17 /* PM buffering of mcast */ 212 #define WI_RID_ENCRYPTION 0xFC20 /* enable/disable WEP */ 213 #define WI_RID_AUTHTYPE 0xFC21 /* specify authentication type */ 214 #define WI_RID_P2_TX_CRYPT_KEY 0xFC23 215 #define WI_RID_P2_CRYPT_KEY0 0xFC24 216 #define WI_RID_P2_CRYPT_KEY1 0xFC25 217 #define WI_RID_MICROWAVE_OVEN 0xFC25 218 #define WI_RID_P2_CRYPT_KEY2 0xFC26 219 #define WI_RID_P2_CRYPT_KEY3 0xFC27 220 #define WI_RID_P2_ENCRYPTION 0xFC28 221 #define PRIVACY_INVOKED 0x01 222 #define EXCLUDE_UNENCRYPTED 0x02 223 #define HOST_ENCRYPT 0x10 224 #define IV_EVERY_FRAME 0x00 /* IV = Initialization Vector */ 225 #define IV_EVERY10_FRAME 0x20 /* every 10 frame IV reuse */ 226 #define IV_EVERY50_FRAME 0x40 /* every 50 frame IV reuse */ 227 #define IV_EVERY100_FRAME 0x60 /* every 100 frame IV reuse */ 228 #define HOST_DECRYPT 0x80 229 #define WI_RID_WEP_MAPTABLE 0xFC29 230 #define WI_RID_AUTH_CNTL 0xFC2A 231 #define WI_RID_ROAMING_MODE 0xFC2D 232 #define WI_RID_BASIC_RATE 0xFCB3 233 #define WI_RID_SUPPORT_RATE 0xFCB4 234 235 /* 236 * Network parameters, dynamic configuration entities 237 */ 238 #define WI_RID_MCAST_LIST 0xFC80 /* multicast addrs to put in filter */ 239 #define WI_RID_CREATE_IBSS 0xFC81 /* create IBSS */ 240 #define WI_RID_FRAG_THRESH 0xFC82 /* frag len, unicast msg xmit */ 241 #define WI_RID_RTS_THRESH 0xFC83 /* frame len for RTS/CTS handshake */ 242 #define WI_RID_TX_RATE 0xFC84 /* data rate for message xmit 243 * 0 == Fixed 1mbps 244 * 1 == Fixed 2mbps 245 * 2 == auto fallback 246 */ 247 #define WI_RID_PROMISC 0xFC85 /* enable promisc mode */ 248 #define WI_RID_FRAG_THRESH0 0xFC90 249 #define WI_RID_FRAG_THRESH1 0xFC91 250 #define WI_RID_FRAG_THRESH2 0xFC92 251 #define WI_RID_FRAG_THRESH3 0xFC93 252 #define WI_RID_FRAG_THRESH4 0xFC94 253 #define WI_RID_FRAG_THRESH5 0xFC95 254 #define WI_RID_FRAG_THRESH6 0xFC96 255 #define WI_RID_RTS_THRESH0 0xFC97 256 #define WI_RID_RTS_THRESH1 0xFC98 257 #define WI_RID_RTS_THRESH2 0xFC99 258 #define WI_RID_RTS_THRESH3 0xFC9A 259 #define WI_RID_RTS_THRESH4 0xFC9B 260 #define WI_RID_RTS_THRESH5 0xFC9C 261 #define WI_RID_RTS_THRESH6 0xFC9D 262 #define WI_RID_TX_RATE0 0xFC9E 263 #define WI_RID_TX_RATE1 0xFC9F 264 #define WI_RID_TX_RATE2 0xFCA0 265 #define WI_RID_TX_RATE3 0xFCA1 266 #define WI_RID_TX_RATE4 0xFCA2 267 #define WI_RID_TX_RATE5 0xFCA3 268 #define WI_RID_TX_RATE6 0xFCA4 269 #define WI_RID_DEFLT_CRYPT_KEYS 0xFCB0 270 #define WI_RID_TX_CRYPT_KEY 0xFCB1 271 #define WI_RID_TICK_TIME 0xFCE0 /* Auxiliary Timer tick interval */ 272 273 struct wi_key { 274 u_int16_t wi_keylen; 275 u_int8_t wi_keydat[14]; 276 }; 277 278 struct wi_ltv_keys { 279 u_int16_t wi_len; 280 u_int16_t wi_type; 281 struct wi_key wi_keys[4]; 282 }; 283 284 /* 285 * NIC information 286 */ 287 #define WI_RID_DNLD_BUF 0xFD01 288 #define WI_RID_MEMSZ 0xFD02 /* memory size info (XXX Lucent) */ 289 #define WI_RID_PRI_IDENTITY 0xFD02 /* primary funcs firmware ident (PRISM2) */ 290 #define WI_RID_PRI_SUP_RANGE 0xFD03 /* primary supplier compatibility */ 291 #define WI_RID_CIF_ACT_RANGE 0xFD04 /* controller sup. compatibility */ 292 #define WI_RID_SERIALNO 0xFD0A /* card serial number */ 293 #define WI_RID_CARD_ID 0xFD0B /* card identification */ 294 #define WI_RID_MFI_SUP_RANGE 0xFD0C /* modem supplier compatibility */ 295 #define WI_RID_CFI_SUP_RANGE 0xFD0D /* controller sup. compatibility */ 296 #define WI_RID_CHANNEL_LIST 0xFD10 /* allowd comm. frequencies. */ 297 #define WI_RID_REG_DOMAINS 0xFD11 /* list of intendted regulatory doms */ 298 #define WI_RID_TEMP_TYPE 0xFD12 /* hw temp range code */ 299 #define WI_RID_CIS 0xFD13 /* PC card info struct */ 300 #define WI_RID_STA_IDENTITY 0xFD20 /* station funcs firmware ident */ 301 #define WI_RID_STA_SUP_RANGE 0xFD21 /* station supplier compat */ 302 #define WI_RID_MFI_ACT_RANGE 0xFD22 303 #define WI_RID_SYMBOL_IDENTITY 0xFD24 304 #define WI_RID_CFI_ACT_RANGE 0xFD33 305 #define WI_RID_COMMQUAL 0xFD43 306 #define WI_RID_SCALETHRESH 0xFD46 307 #define WI_RID_PCF 0xFD87 308 309 /* 310 * MAC information 311 */ 312 #define WI_RID_PORT_STAT 0xFD40 /* actual MAC port con control stat */ 313 #define WI_RID_CURRENT_SSID 0xFD41 /* ID of actually connected SS */ 314 #define WI_RID_CURRENT_BSSID 0xFD42 /* ID of actually connected BSS */ 315 #define WI_RID_COMMS_QUALITY 0xFD43 /* quality of BSS connection */ 316 #define WI_RID_CUR_TX_RATE 0xFD44 /* current TX rate */ 317 #define WI_RID_OWN_BEACON_INT 0xFD45 /* beacon xmit time for BSS creation */ 318 #define WI_RID_CUR_SCALE_THRESH 0xFD46 /* actual system scane thresh setting */ 319 #define WI_RID_PROT_RESP_TIME 0xFD47 /* time to wait for resp to req msg */ 320 #define WI_RID_SHORT_RTR_LIM 0xFD48 /* max tx attempts for short frames */ 321 #define WI_RID_LONG_RTS_LIM 0xFD49 /* max tx attempts for long frames */ 322 #define WI_RID_MAX_TX_LIFE 0xFD4A /* max tx frame handling duration */ 323 #define WI_RID_MAX_RX_LIFE 0xFD4B /* max rx frame handling duration */ 324 #define WI_RID_CF_POLL 0xFD4C /* contention free pollable ind */ 325 #define WI_RID_AUTH_ALGS 0xFD4D /* auth algorithms available */ 326 #define WI_RID_AUTH_TYPE 0xFD4E /* available auth types */ 327 #define WI_RID_WEP_AVAIL 0xFD4F /* WEP privacy option available */ 328 #define WI_RID_CUR_TX_RATE1 0xFD80 329 #define WI_RID_CUR_TX_RATE2 0xFD81 330 #define WI_RID_CUR_TX_RATE3 0xFD82 331 #define WI_RID_CUR_TX_RATE4 0xFD83 332 #define WI_RID_CUR_TX_RATE5 0xFD84 333 #define WI_RID_CUR_TX_RATE6 0xFD85 334 #define WI_RID_OWN_MAC 0xFD86 /* unique local MAC addr */ 335 #define WI_RID_PCI_INFO 0xFD87 /* point coordination func cap */ 336 337 /* 338 * Scan Information 339 */ 340 #define WI_RID_BCAST_SCAN_REQ 0xFCAB /* Broadcast Scan request (Symbol) */ 341 #define BSCAN_5SEC 0x01 342 #define BSCAN_ONETIME 0x02 343 #define BSCAN_PASSIVE 0x40 344 #define BSCAN_BCAST 0x80 345 #define WI_RID_SCAN_REQ 0xFCE1 /* Scan request (STA only) */ 346 #define WI_RID_JOIN_REQ 0xFCE2 /* Join request (STA only) */ 347 #define WI_RID_AUTH_STATION 0xFCE3 /* Authenticates Station (AP) */ 348 #define WI_RID_CHANNEL_REQ 0xFCE4 /* Channel Information Request (AP) */ 349 #define WI_RID_SCAN_RESULTS 0xFD88 /* Scan Results Table */ 350 351 struct wi_apinfo { 352 int scanreason; /* ScanReason */ 353 char bssid[6]; /* BSSID (mac address) */ 354 int channel; /* Channel */ 355 int signal; /* Signal level */ 356 int noise; /* Average Noise Level*/ 357 int quality; /* Quality */ 358 int namelen; /* Length of SSID string */ 359 char name[32]; /* SSID string */ 360 int capinfo; /* Capability info. */ 361 int interval; /* BSS Beacon Interval */ 362 int rate; /* Data Rate */ 363 }; 364 365 /* 366 * Modem information 367 */ 368 #define WI_RID_PHY_TYPE 0xFDC0 /* phys layer type indication */ 369 #define WI_RID_CURRENT_CHAN 0xFDC1 /* current frequency */ 370 #define WI_RID_PWR_STATE 0xFDC2 /* pwr consumption status */ 371 #define WI_RID_CCA_MODE 0xFDC3 /* clear chan assess mode indication */ 372 #define WI_RID_CCA_TIME 0xFDC4 /* clear chan assess time */ 373 #define WI_RID_MAC_PROC_DELAY 0xFDC5 /* MAC processing delay time */ 374 #define WI_RID_DATA_RATES 0xFDC6 /* supported data rates */ 375 376 #endif 377