Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / drivers / staging / otus / athr_common.h
1 /*
2  * Copyright (c) 2007-2008 Atheros Communications Inc.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 /*  Module Name : athr_common.h                                         */
17 /*                                                                      */
18 /*  Abstract                                                            */
19 /*      WPA related function and data structure definitions.            */
20 /*                                                                      */
21 /*  NOTES                                                               */
22 /*      Platform dependent.                                             */
23 /*                                                                      */
24 /************************************************************************/
25
26 #ifndef _ATHR_COMMON_H
27 #define _ATHR_COMMON_H
28
29 #define ZD_IOCTL_WPA                    (SIOCDEVPRIVATE + 1)
30 #define ZD_IOCTL_PARAM                  (SIOCDEVPRIVATE + 2)
31 #define ZD_IOCTL_GETWPAIE               (SIOCDEVPRIVATE + 3)
32 #define ZD_PARAM_ROAMING                0x0001
33 #define ZD_PARAM_PRIVACY                0x0002
34 #define ZD_PARAM_WPA                    0x0003
35 #define ZD_PARAM_COUNTERMEASURES        0x0004
36 #define ZD_PARAM_DROPUNENCRYPTED        0x0005
37 #define ZD_PARAM_AUTH_ALGS              0x0006
38
39 #define ZD_CMD_SET_ENCRYPT_KEY          0x0001
40 #define ZD_CMD_SET_MLME                 0x0002
41 #define ZD_CMD_SCAN_REQ                 0x0003
42 #define ZD_CMD_SET_GENERIC_ELEMENT      0x0004
43 #define ZD_CMD_GET_TSC                  0x0005
44
45 #define ZD_FLAG_SET_TX_KEY              0x0001
46
47 #define ZD_GENERIC_ELEMENT_HDR_LEN \
48 ((int) (&((struct athr_wlan_param *) 0)->u.generic_elem.data))
49
50 #define ZD_CRYPT_ALG_NAME_LEN           16
51 #define ZD_MAX_KEY_SIZE                 32
52 #define ZD_MAX_GENERIC_SIZE             64
53
54 #define IEEE80211_ADDR_LEN              6
55 #define IEEE80211_MAX_IE_SIZE           256
56
57 #ifdef ZM_ENALBE_WAPI
58 #define ZM_CMD_WAPI_SETWAPI             0x0001
59 #define ZM_CMD_WAPI_GETWAPI             0x0002
60 #define ZM_CMD_WAPI_SETKEY              0x0003
61 #define ZM_CMD_WAPI_GETKEY              0x0004
62 #define ZM_CMD_WAPI_REKEY               0x0005
63
64 #define ZM_WAPI_WAI_REQUEST             0x00f1
65 #define ZM_WAPI_UNICAST_REKEY           0x00f2
66 #define ZM_WAPI_STA_AGING               0x00f3
67 #define ZM_WAPI_MULTI_REKEY             0x00f4
68
69 #define ZM_WAPI_KEY_SIZE                32
70 #define ZM_WAPI_IV_LEN                  16
71 #endif /* ZM_ENALBE_WAPI */
72 /* structure definition */
73
74 struct athr_wlan_param {
75         u32 cmd;
76         u8 sta_addr[ETH_ALEN];
77         union {
78                 struct {
79                         u8 alg[ZD_CRYPT_ALG_NAME_LEN];
80                         u32 flags;
81                         u32 err;
82                         u8 idx;
83                         u8 seq[8]; /* sequence counter (set: RX, get: TX) */
84                         u16 key_len;
85                         u8 key[ZD_MAX_KEY_SIZE];
86                 } crypt;
87                 struct {
88                         u32 flags_and;
89                         u32 flags_or;
90                 } set_flags_sta;
91                 struct {
92                         u8 len;
93                         u8 data[ZD_MAX_GENERIC_SIZE];
94                 } generic_elem;
95                 struct {
96 #define MLME_STA_DEAUTH 0
97 #define MLME_STA_DISASSOC 1
98                         u16 cmd;
99                         u16 reason_code;
100                 } mlme;
101                 struct {
102                         u8 ssid_len;
103                         u8 ssid[32];
104                 } scan_req;
105         } u;
106 };
107
108 struct ieee80211req_wpaie {
109         u8 wpa_macaddr[IEEE80211_ADDR_LEN];
110         u8 wpa_ie[IEEE80211_MAX_IE_SIZE];
111 };
112
113 #ifdef ZM_ENALBE_WAPI
114 struct athr_wapi_param {
115         u16 cmd;
116         u16 len;
117
118         union {
119                 struct {
120                         u8 sta_addr[ETH_ALEN];
121                         u8 reserved;
122                         u8 keyid;
123                         u8 key[ZM_WAPI_KEY_SIZE];
124                 } crypt;
125                 struct {
126                         u8 wapi_policy;
127                 } info;
128         } u;
129 };
130
131 struct athr_wapi_sta_info
132 {
133         u16     msg_type;
134         u16     datalen;
135         u8      sta_mac[ETH_ALEN];
136         u8      reserve_data[2];
137         u8      gsn[ZM_WAPI_IV_LEN];
138         u8      wie[256];
139 };
140 #endif /* ZM_ENALBE_WAPI */
141 #endif