1*a399b765Szf162725 /* 2*a399b765Szf162725 * CDDL HEADER START 3*a399b765Szf162725 * 4*a399b765Szf162725 * The contents of this file are subject to the terms of the 5*a399b765Szf162725 * Common Development and Distribution License (the "License"). 6*a399b765Szf162725 * You may not use this file except in compliance with the License. 7*a399b765Szf162725 * 8*a399b765Szf162725 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*a399b765Szf162725 * or http://www.opensolaris.org/os/licensing. 10*a399b765Szf162725 * See the License for the specific language governing permissions 11*a399b765Szf162725 * and limitations under the License. 12*a399b765Szf162725 * 13*a399b765Szf162725 * When distributing Covered Code, include this CDDL HEADER in each 14*a399b765Szf162725 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*a399b765Szf162725 * If applicable, add the following below this CDDL HEADER, with the 16*a399b765Szf162725 * fields enclosed by brackets "[]" replaced with your own identifying 17*a399b765Szf162725 * information: Portions Copyright [yyyy] [name of copyright owner] 18*a399b765Szf162725 * 19*a399b765Szf162725 * CDDL HEADER END 20*a399b765Szf162725 */ 21*a399b765Szf162725 /* 22*a399b765Szf162725 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23*a399b765Szf162725 * Use is subject to license terms. 24*a399b765Szf162725 */ 25*a399b765Szf162725 26*a399b765Szf162725 /* 27*a399b765Szf162725 * Macro and data structures defined for 802.11i. 28*a399b765Szf162725 */ 29*a399b765Szf162725 30*a399b765Szf162725 #ifndef __WPA_H 31*a399b765Szf162725 #define __WPA_H 32*a399b765Szf162725 33*a399b765Szf162725 #pragma ident "%Z%%M% %I% %E% SMI" 34*a399b765Szf162725 35*a399b765Szf162725 #include <sys/types.h> 36*a399b765Szf162725 #include <inet/wifi_ioctl.h> 37*a399b765Szf162725 38*a399b765Szf162725 #ifdef __cplusplus 39*a399b765Szf162725 extern "C" { 40*a399b765Szf162725 #endif 41*a399b765Szf162725 42*a399b765Szf162725 #define SERVICE_NAME "network/wpa" 43*a399b765Szf162725 #define WPA_DOOR "/var/run/wpa_door" 44*a399b765Szf162725 #define SVC_METHOD "/usr/lib/inet/wpad" 45*a399b765Szf162725 46*a399b765Szf162725 #define IEEE80211_ADDR_LEN 6 47*a399b765Szf162725 #define IEEE80211_MAX_WPA_IE 40 /* IEEE802.11i */ 48*a399b765Szf162725 #define WPA_STRSIZE 256 49*a399b765Szf162725 /* 50*a399b765Szf162725 * Max size of optional information elements. We artificially 51*a399b765Szf162725 * constrain this; it's limited only by the max frame size (and 52*a399b765Szf162725 * the max parameter size of the wireless extensions). 53*a399b765Szf162725 */ 54*a399b765Szf162725 #define IEEE80211_MAX_OPT_IE 256 55*a399b765Szf162725 56*a399b765Szf162725 /* 57*a399b765Szf162725 * Parameters. 58*a399b765Szf162725 * WL_WPA_BASE + 0x1, 5, 6 reserved to be compatible with FreeBSD. 59*a399b765Szf162725 */ 60*a399b765Szf162725 #define WL_WPA_BASE (WL_PARAMETERS_BASE + 0x500) 61*a399b765Szf162725 #define WL_SETOPTIE (WL_WPA_BASE + 0x0) 62*a399b765Szf162725 #define WL_WPA (WL_WPA_BASE + 0x2) 63*a399b765Szf162725 #define WL_KEY (WL_WPA_BASE + 0x3) 64*a399b765Szf162725 #define WL_DELKEY (WL_WPA_BASE + 0x4) 65*a399b765Szf162725 #define WL_SCANRESULTS (WL_WPA_BASE + 0x7) 66*a399b765Szf162725 #define WL_MLME (WL_WPA_BASE + 0x8) 67*a399b765Szf162725 #define WL_CAPABILITY (WL_WPA_BASE + 0x9) 68*a399b765Szf162725 69*a399b765Szf162725 typedef struct wl_wpa_ie { 70*a399b765Szf162725 uint32_t wpa_ie_len; 71*a399b765Szf162725 char wpa_ie[1]; /* it's the head of wpa_ie */ 72*a399b765Szf162725 } wl_wpa_ie_t; 73*a399b765Szf162725 74*a399b765Szf162725 typedef struct wl_wpa { 75*a399b765Szf162725 uint32_t wpa_flag; 76*a399b765Szf162725 } wl_wpa_t; 77*a399b765Szf162725 78*a399b765Szf162725 typedef struct wl_capability { 79*a399b765Szf162725 uint32_t caps; 80*a399b765Szf162725 } wl_capability_t; 81*a399b765Szf162725 82*a399b765Szf162725 #define IEEE80211_KEYBUF_SIZE 16 /* 128-bit TKIP & CCMP key */ 83*a399b765Szf162725 #define IEEE80211_MICBUF_SIZE (8+8) /* 8 byte tx, 8 byte rx */ 84*a399b765Szf162725 85*a399b765Szf162725 /* 86*a399b765Szf162725 * NB: these values are ordered carefully; there are lots of 87*a399b765Szf162725 * of implications in any reordering. In particular beware 88*a399b765Szf162725 * that 4 is not used to avoid conflicting with IEEE80211_F_PRIVACY. 89*a399b765Szf162725 */ 90*a399b765Szf162725 #define IEEE80211_CIPHER_WEP 0 91*a399b765Szf162725 #define IEEE80211_CIPHER_TKIP 1 92*a399b765Szf162725 #define IEEE80211_CIPHER_AES_OCB 2 93*a399b765Szf162725 #define IEEE80211_CIPHER_AES_CCM 3 94*a399b765Szf162725 #define IEEE80211_CIPHER_CKIP 4 95*a399b765Szf162725 #define IEEE80211_CIPHER_NONE 5 /* pseudo value */ 96*a399b765Szf162725 97*a399b765Szf162725 #define IEEE80211_CIPHER_MAX (IEEE80211_CIPHER_NONE+1) 98*a399b765Szf162725 99*a399b765Szf162725 /* Key Flags */ 100*a399b765Szf162725 #define IEEE80211_KEY_XMIT 0x01 /* key used for xmit */ 101*a399b765Szf162725 #define IEEE80211_KEY_RECV 0x02 /* key used for recv */ 102*a399b765Szf162725 103*a399b765Szf162725 #define IEEE80211_KEY_DEFAULT 0x80 /* default xmit key */ 104*a399b765Szf162725 105*a399b765Szf162725 /* 106*a399b765Szf162725 * WPA/RSN get/set key request. Specify the key/cipher 107*a399b765Szf162725 * type and whether the key is to be used for sending and/or 108*a399b765Szf162725 * receiving. The key index should be set only when working 109*a399b765Szf162725 * with global keys (use IEEE80211_KEYIX_NONE for ``no index''). 110*a399b765Szf162725 * Otherwise a unicast/pairwise key is specified by the bssid 111*a399b765Szf162725 * (on a station) or mac address (on an ap). They key length 112*a399b765Szf162725 * must include any MIC key data; otherwise it should be no 113*a399b765Szf162725 * more than IEEE80211_KEYBUF_SIZE. 114*a399b765Szf162725 */ 115*a399b765Szf162725 #pragma pack(1) 116*a399b765Szf162725 typedef struct wl_key { 117*a399b765Szf162725 uint8_t ik_type; /* key/cipher type */ 118*a399b765Szf162725 uint8_t ik_pad; 119*a399b765Szf162725 120*a399b765Szf162725 uint16_t ik_keyix; /* key index */ 121*a399b765Szf162725 uint8_t ik_keylen; /* key length in bytes */ 122*a399b765Szf162725 uint8_t ik_flags; 123*a399b765Szf162725 124*a399b765Szf162725 uint8_t ik_macaddr[IEEE80211_ADDR_LEN]; 125*a399b765Szf162725 uint64_t ik_keyrsc; /* key receive sequence counter */ 126*a399b765Szf162725 uint64_t ik_keytsc; /* key transmit sequence counter */ 127*a399b765Szf162725 128*a399b765Szf162725 uint8_t ik_keydata[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE]; 129*a399b765Szf162725 } wl_key_t; 130*a399b765Szf162725 #pragma pack() 131*a399b765Szf162725 132*a399b765Szf162725 struct wpa_ess { 133*a399b765Szf162725 uint8_t bssid[IEEE80211_ADDR_LEN]; 134*a399b765Szf162725 uint8_t ssid[MAX_ESSID_LENGTH]; 135*a399b765Szf162725 uint32_t ssid_len; 136*a399b765Szf162725 137*a399b765Szf162725 uint8_t wpa_ie[IEEE80211_MAX_WPA_IE]; 138*a399b765Szf162725 uint32_t wpa_ie_len; 139*a399b765Szf162725 int freq; 140*a399b765Szf162725 }; 141*a399b765Szf162725 142*a399b765Szf162725 typedef struct wl_del_key { 143*a399b765Szf162725 uint8_t idk_keyix; /* key index */ 144*a399b765Szf162725 uint8_t idk_macaddr[IEEE80211_ADDR_LEN]; 145*a399b765Szf162725 }wl_del_key_t; 146*a399b765Szf162725 147*a399b765Szf162725 typedef struct wl_countermeasures { 148*a399b765Szf162725 uint32_t cm_flag; 149*a399b765Szf162725 } wl_countermeasures_t; 150*a399b765Szf162725 151*a399b765Szf162725 typedef struct wl_drop_unenc { 152*a399b765Szf162725 uint32_t drop_flag; 153*a399b765Szf162725 } wl_drop_unenc_t; 154*a399b765Szf162725 155*a399b765Szf162725 typedef struct wl_wpa_ess { 156*a399b765Szf162725 uint32_t count; 157*a399b765Szf162725 struct wpa_ess ess[1]; 158*a399b765Szf162725 } wl_wpa_ess_t; 159*a399b765Szf162725 160*a399b765Szf162725 #define IEEE80211_MLME_ASSOC 1 /* associate station */ 161*a399b765Szf162725 #define IEEE80211_MLME_DISASSOC 2 /* disassociate station */ 162*a399b765Szf162725 #define IEEE80211_MLME_DEAUTH 3 /* deauthenticate station */ 163*a399b765Szf162725 #define IEEE80211_MLME_AUTHORIZE 4 /* authorize station */ 164*a399b765Szf162725 #define IEEE80211_MLME_UNAUTHORIZE 5 /* unauthorize station */ 165*a399b765Szf162725 166*a399b765Szf162725 /* 167*a399b765Szf162725 * * MLME state manipulation request. IEEE80211_MLME_ASSOC 168*a399b765Szf162725 * * only makes sense when operating as a station. The other 169*a399b765Szf162725 * * requests can be used when operating as a station or an 170*a399b765Szf162725 * * ap (to effect a station). 171*a399b765Szf162725 */ 172*a399b765Szf162725 typedef struct wl_mlme { 173*a399b765Szf162725 uint8_t im_op; /* operation to perform */ 174*a399b765Szf162725 uint16_t im_reason; /* 802.11 reason code */ 175*a399b765Szf162725 uint8_t im_macaddr[IEEE80211_ADDR_LEN]; 176*a399b765Szf162725 } wl_mlme_t; 177*a399b765Szf162725 178*a399b765Szf162725 /* 179*a399b765Szf162725 * State machine events 180*a399b765Szf162725 */ 181*a399b765Szf162725 typedef enum { 182*a399b765Szf162725 EVENT_ASSOC, 183*a399b765Szf162725 EVENT_DISASSOC, 184*a399b765Szf162725 EVENT_SCAN_RESULTS 185*a399b765Szf162725 } wpa_event_type; 186*a399b765Szf162725 187*a399b765Szf162725 typedef struct wl_events { 188*a399b765Szf162725 wpa_event_type event; 189*a399b765Szf162725 } wl_events_t; 190*a399b765Szf162725 191*a399b765Szf162725 #ifdef __cplusplus 192*a399b765Szf162725 } 193*a399b765Szf162725 #endif 194*a399b765Szf162725 195*a399b765Szf162725 #endif /* __WPA_H */ 196