1/*
2 * Copyright (c) 2004-2005 Atheros Communications Inc.
3 * All rights reserved.
4 *
5 *
6 *  This program is free software; you can redistribute it and/or modify
7 *  it under the terms of the GNU General Public License version 2 as
8 *  published by the Free Software Foundation;
9 *
10 *  Software distributed under the License is distributed on an "AS
11 *  IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
12 *  implied. See the License for the specific language governing
13 *  rights and limitations under the License.
14 *
15 *
16 *
17 *
18 * $Id: //depot/sw/releases/olca2.0-GPL/host/os/linux/include/ieee80211_ioctl.h#1 $
19 */
20
21#ifndef _IEEE80211_IOCTL_H_
22#define _IEEE80211_IOCTL_H_
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/*
29 * Extracted from the MADWIFI net80211/ieee80211_ioctl.h
30 */
31
32/*
33 * WPA/RSN get/set key request.  Specify the key/cipher
34 * type and whether the key is to be used for sending and/or
35 * receiving.  The key index should be set only when working
36 * with global keys (use IEEE80211_KEYIX_NONE for ``no index'').
37 * Otherwise a unicast/pairwise key is specified by the bssid
38 * (on a station) or mac address (on an ap).  They key length
39 * must include any MIC key data; otherwise it should be no
40 more than IEEE80211_KEYBUF_SIZE.
41 */
42struct ieee80211req_key {
43	u_int8_t	ik_type;	/* key/cipher type */
44	u_int8_t	ik_pad;
45	u_int16_t	ik_keyix;	/* key index */
46	u_int8_t	ik_keylen;	/* key length in bytes */
47	u_int8_t	ik_flags;
48#define IEEE80211_KEY_XMIT  0x01
49#define IEEE80211_KEY_RECV  0x02
50#define	IEEE80211_KEY_DEFAULT	0x80	/* default xmit key */
51	u_int8_t	ik_macaddr[IEEE80211_ADDR_LEN];
52	u_int64_t	ik_keyrsc;	/* key receive sequence counter */
53	u_int64_t	ik_keytsc;	/* key transmit sequence counter */
54	u_int8_t	ik_keydata[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE];
55};
56/*
57 * Delete a key either by index or address.  Set the index
58 * to IEEE80211_KEYIX_NONE when deleting a unicast key.
59 */
60struct ieee80211req_del_key {
61	u_int8_t	idk_keyix;	/* key index */
62	u_int8_t	idk_macaddr[IEEE80211_ADDR_LEN];
63};
64/*
65 * MLME state manipulation request.  IEEE80211_MLME_ASSOC
66 * only makes sense when operating as a station.  The other
67 * requests can be used when operating as a station or an
68 * ap (to effect a station).
69 */
70struct ieee80211req_mlme {
71	u_int8_t	im_op;		/* operation to perform */
72#define	IEEE80211_MLME_ASSOC		1	/* associate station */
73#define	IEEE80211_MLME_DISASSOC		2	/* disassociate station */
74#define	IEEE80211_MLME_DEAUTH		3	/* deauthenticate station */
75#define	IEEE80211_MLME_AUTHORIZE	4	/* authorize station */
76#define	IEEE80211_MLME_UNAUTHORIZE	5	/* unauthorize station */
77	u_int16_t	im_reason;	/* 802.11 reason code */
78	u_int8_t	im_macaddr[IEEE80211_ADDR_LEN];
79};
80
81struct ieee80211req_addpmkid {
82    u_int8_t    pi_bssid[IEEE80211_ADDR_LEN];
83    u_int8_t    pi_enable;
84    u_int8_t    pi_pmkid[16];
85};
86
87#define AUTH_ALG_OPEN_SYSTEM	0x01
88#define AUTH_ALG_SHARED_KEY	0x02
89#define AUTH_ALG_LEAP		0x04
90
91struct ieee80211req_authalg {
92   u_int8_t auth_alg;
93};
94
95/*
96 * Request to add an IE to a Management Frame
97 */
98enum{
99    IEEE80211_APPIE_FRAME_BEACON     = 0,
100    IEEE80211_APPIE_FRAME_PROBE_REQ  = 1,
101    IEEE80211_APPIE_FRAME_PROBE_RESP = 2,
102    IEEE80211_APPIE_FRAME_ASSOC_REQ  = 3,
103    IEEE80211_APPIE_FRAME_ASSOC_RESP = 4,
104    IEEE80211_APPIE_NUM_OF_FRAME     = 5
105};
106
107/*
108 * The Maximum length of the IE that can be added to a Management frame
109 */
110#define IEEE80211_APPIE_FRAME_MAX_LEN  78
111
112struct ieee80211req_getset_appiebuf {
113    u_int32_t app_frmtype; /* management frame type for which buffer is added */
114    u_int32_t app_buflen;  /*application supplied buffer length */
115    u_int8_t  app_buf[];
116};
117
118/*
119 * The following definitions are used by an application to set filter
120 * for receiving management frames
121 */
122enum {
123     IEEE80211_FILTER_TYPE_BEACON      =   0x1,
124     IEEE80211_FILTER_TYPE_PROBE_REQ   =   0x2,
125     IEEE80211_FILTER_TYPE_PROBE_RESP  =   0x4,
126     IEEE80211_FILTER_TYPE_ASSOC_REQ   =   0x8,
127     IEEE80211_FILTER_TYPE_ASSOC_RESP  =   0x10,
128     IEEE80211_FILTER_TYPE_AUTH        =   0x20,
129     IEEE80211_FILTER_TYPE_DEAUTH      =   0x40,
130     IEEE80211_FILTER_TYPE_DISASSOC    =   0x80,
131     IEEE80211_FILTER_TYPE_ALL         =   0xFF  /* used to check the valid filter bits */
132};
133
134struct ieee80211req_set_filter {
135      u_int32_t app_filterype; /* management frame filter type */
136};
137
138enum {
139    IEEE80211_PARAM_AUTHMODE = 3,   /* Authentication Mode */
140    IEEE80211_PARAM_MCASTCIPHER = 5,
141    IEEE80211_PARAM_MCASTKEYLEN = 6,    /* multicast key length */
142    IEEE80211_PARAM_UCASTCIPHER = 8,
143    IEEE80211_PARAM_UCASTKEYLEN = 9,    /* unicast key length */
144	IEEE80211_PARAM_WPA		= 10,	/* WPA mode (0,1,2) */
145	IEEE80211_PARAM_ROAMING		= 12,	/* roaming mode */
146	IEEE80211_PARAM_PRIVACY		= 13,	/* privacy invoked */
147	IEEE80211_PARAM_COUNTERMEASURES	= 14,	/* WPA/TKIP countermeasures */
148	IEEE80211_PARAM_DROPUNENCRYPTED	= 15,	/* discard unencrypted frames */
149};
150
151/*
152 * Values for IEEE80211_PARAM_WPA
153 */
154#define WPA_MODE_WPA1   1
155#define WPA_MODE_WPA2   2
156#define WPA_MODE_AUTO   3
157#define WPA_MODE_NONE   4
158
159#ifdef __cplusplus
160}
161#endif
162
163#endif /* _IEEE80211_IOCTL_H_ */
164