1 /*
2  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3  * All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * File: iowpa.h
20  *
21  * Purpose: Handles wpa supplicant ioctl interface
22  *
23  * Author: Lyndon Chen
24  *
25  * Date: May 8, 2002
26  *
27  */
28 
29 #ifndef __IOWPA_H__
30 #define __IOWPA_H__
31 
32 /*---------------------  Export Definitions -------------------------*/
33 
34 #define WPA_IE_LEN 64
35 
36 //WPA related
37 /*
38 typedef enum { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP } wpa_alg;
39 typedef enum { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP,
40 	       CIPHER_WEP104 } wpa_cipher;
41 typedef enum { KEY_MGMT_802_1X, KEY_MGMT_PSK, KEY_MGMT_NONE,
42 	       KEY_MGMT_802_1X_NO_WPA, KEY_MGMT_WPA_NONE } wpa_key_mgmt;
43 */
44 
45 enum {
46 	VIAWGET_SET_WPA = 1,
47 	VIAWGET_SET_KEY = 2,
48 	VIAWGET_SET_SCAN = 3,
49 	VIAWGET_GET_SCAN = 4,
50 	VIAWGET_GET_SSID = 5,
51 	VIAWGET_GET_BSSID = 6,
52 	VIAWGET_SET_DROP_UNENCRYPT = 7,
53 	VIAWGET_SET_DEAUTHENTICATE = 8,
54 	VIAWGET_SET_ASSOCIATE = 9,
55 	VIAWGET_SET_DISASSOCIATE = 10
56 };
57 
58 
59 enum {
60 	VIAWGET_ASSOC_MSG = 1,
61 	VIAWGET_DISASSOC_MSG = 2,
62 	VIAWGET_PTK_MIC_MSG = 3,
63 	VIAWGET_GTK_MIC_MSG = 4,
64 	VIAWGET_CCKM_ROAM_MSG = 5,
65 	VIAWGET_DEVICECLOSE_MSG = 6
66 };
67 
68 
69 
70 #pragma pack(1)
71 typedef struct viawget_wpa_header {
72 	u8 type;
73 	u16 req_ie_len;
74 	u16 resp_ie_len;
75 } viawget_wpa_header;
76 
77 struct viawget_wpa_param {
78 	u32 cmd;
79 	u8 addr[6];
80 	union {
81 		struct {
82 			u8 len;
83 			u8 data[0];
84 		} generic_elem;
85 		struct {
86 			u8 bssid[6];
87 			u8 ssid[32];
88 			u8 ssid_len;
89 			u8 *wpa_ie;
90 			u16 wpa_ie_len;
91 			int pairwise_suite;
92 			int group_suite;
93 			int key_mgmt_suite;
94 			int auth_alg;
95 			int mode;
96 			u8 roam_dbm;
97 		} wpa_associate;
98 		struct {
99 			int alg_name;
100 			u16 key_index;
101 			u16 set_tx;
102 			u8 *seq;
103 			u16 seq_len;
104 			u8 *key;
105 			u16 key_len;
106 		} wpa_key;
107 		struct {
108 			u8 ssid_len;
109 			u8 ssid[32];
110 		} scan_req;
111 		struct {
112 			u16 scan_count;
113 			u8 *buf;
114 		} scan_results;
115 	} u;
116 };
117 
118 #pragma pack(1)
119 struct viawget_scan_result {
120 	u8 bssid[6];
121 	u8 ssid[32];
122 	u16 ssid_len;
123 	u8 wpa_ie[WPA_IE_LEN];
124 	u16 wpa_ie_len;
125 	u8 rsn_ie[WPA_IE_LEN];
126 	u16 rsn_ie_len;
127 	int freq; // MHz
128 	int caps; // e.g. privacy
129 	int qual; // signal quality
130 	int noise;
131 	int level;
132 	int maxrate;
133 };
134 
135 /*---------------------  Export Classes  ----------------------------*/
136 
137 /*---------------------  Export Variables  --------------------------*/
138 
139 /*---------------------  Export Types  ------------------------------*/
140 
141 /*---------------------  Export Functions  --------------------------*/
142 
143 #endif /* __IOWPA_H__ */
144