Commit | Line | Data |
---|---|---|
66252c3a FB |
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: iocmd.h | |
20 | * | |
21 | * Purpose: Handles the viawget ioctl private interface functions | |
22 | * | |
23 | * Author: Lyndon Chen | |
24 | * | |
25 | * Date: May 8, 2002 | |
26 | * | |
27 | */ | |
28 | ||
29 | #ifndef __IOCMD_H__ | |
30 | #define __IOCMD_H__ | |
31 | ||
66252c3a | 32 | #include "ttype.h" |
66252c3a FB |
33 | |
34 | /*--------------------- Export Definitions -------------------------*/ | |
35 | ||
66252c3a FB |
36 | // ioctl Command code |
37 | #define MAGIC_CODE 0x3142 | |
38 | #define IOCTL_CMD_TEST (SIOCDEVPRIVATE + 0) | |
39 | #define IOCTL_CMD_SET (SIOCDEVPRIVATE + 1) | |
40 | #define IOCTL_CMD_HOSTAPD (SIOCDEVPRIVATE + 2) | |
41 | #define IOCTL_CMD_WPA (SIOCDEVPRIVATE + 3) | |
42 | ||
66252c3a FB |
43 | typedef enum tagWMAC_CMD { |
44 | ||
45 | WLAN_CMD_BSS_SCAN, | |
46 | WLAN_CMD_BSS_JOIN, | |
47 | WLAN_CMD_DISASSOC, | |
48 | WLAN_CMD_SET_WEP, | |
49 | WLAN_CMD_GET_LINK, | |
50 | WLAN_CMD_GET_LISTLEN, | |
51 | WLAN_CMD_GET_LIST, | |
52 | WLAN_CMD_GET_MIB, | |
53 | WLAN_CMD_GET_STAT, | |
54 | WLAN_CMD_STOP_MAC, | |
55 | WLAN_CMD_START_MAC, | |
56 | WLAN_CMD_AP_START, | |
57 | WLAN_CMD_SET_HOSTAPD, | |
58 | WLAN_CMD_SET_HOSTAPD_STA, | |
59 | WLAN_CMD_SET_802_1X, | |
60 | WLAN_CMD_SET_HOST_WEP, | |
61 | WLAN_CMD_SET_WPA, | |
62 | WLAN_CMD_GET_NODE_CNT, | |
63 | WLAN_CMD_ZONETYPE_SET, | |
64 | WLAN_CMD_GET_NODE_LIST | |
65 | ||
193a823c | 66 | } WMAC_CMD, *PWMAC_CMD; |
66252c3a FB |
67 | |
68 | typedef enum tagWZONETYPE { | |
d9d1ccb5 AM |
69 | ZoneType_USA = 0, |
70 | ZoneType_Japan = 1, | |
71 | ZoneType_Europe = 2 | |
72 | } WZONETYPE; | |
66252c3a FB |
73 | |
74 | #define ADHOC 0 | |
75 | #define INFRA 1 | |
76 | #define BOTH 2 | |
77 | #define AP 3 | |
78 | ||
79 | #define ADHOC_STARTED 1 | |
80 | #define ADHOC_JOINTED 2 | |
81 | ||
d9d1ccb5 AM |
82 | #define PHY80211a 0 |
83 | #define PHY80211b 1 | |
84 | #define PHY80211g 2 | |
66252c3a FB |
85 | |
86 | #define SSID_ID 0 | |
87 | #define SSID_MAXLEN 32 | |
88 | #define BSSID_LEN 6 | |
89 | #define WEP_NKEYS 4 | |
90 | #define WEP_KEYMAXLEN 29 | |
91 | #define WEP_40BIT_LEN 5 | |
92 | #define WEP_104BIT_LEN 13 | |
93 | #define WEP_232BIT_LEN 16 | |
94 | ||
95 | // Ioctl interface structure | |
96 | // Command structure | |
97 | // | |
98 | #pragma pack(1) | |
99 | typedef struct tagSCmdRequest { | |
442f9cb5 | 100 | u8 name[16]; |
66252c3a | 101 | void *data; |
26233e6e AM |
102 | u16 wResult; |
103 | u16 wCmdCode; | |
66252c3a FB |
104 | } SCmdRequest, *PSCmdRequest; |
105 | ||
106 | // | |
107 | // Scan | |
108 | // | |
109 | ||
110 | typedef struct tagSCmdScan { | |
111 | ||
442f9cb5 | 112 | u8 ssid[SSID_MAXLEN + 2]; |
66252c3a FB |
113 | |
114 | } SCmdScan, *PSCmdScan; | |
115 | ||
66252c3a FB |
116 | // |
117 | // BSS Join | |
118 | // | |
119 | ||
120 | typedef struct tagSCmdBSSJoin { | |
121 | ||
26233e6e AM |
122 | u16 wBSSType; |
123 | u16 wBBPType; | |
442f9cb5 | 124 | u8 ssid[SSID_MAXLEN + 2]; |
659770d4 | 125 | u32 uChannel; |
66252c3a FB |
126 | BOOL bPSEnable; |
127 | BOOL bShareKeyAuth; | |
128 | ||
129 | } SCmdBSSJoin, *PSCmdBSSJoin; | |
130 | ||
131 | // | |
132 | // Zonetype Setting | |
133 | // | |
134 | ||
135 | typedef struct tagSCmdZoneTypeSet { | |
136 | ||
137 | BOOL bWrite; | |
138 | WZONETYPE ZoneType; | |
139 | ||
140 | } SCmdZoneTypeSet, *PSCmdZoneTypeSet; | |
141 | ||
66252c3a FB |
142 | typedef struct tagSWPAResult { |
143 | char ifname[100]; | |
442f9cb5 AM |
144 | u8 proto; |
145 | u8 key_mgmt; | |
146 | u8 eap_type; | |
66252c3a FB |
147 | BOOL authenticated; |
148 | } SWPAResult, *PSWPAResult; | |
66252c3a FB |
149 | |
150 | typedef struct tagSCmdStartAP { | |
151 | ||
26233e6e AM |
152 | u16 wBSSType; |
153 | u16 wBBPType; | |
442f9cb5 | 154 | u8 ssid[SSID_MAXLEN + 2]; |
659770d4 AM |
155 | u32 uChannel; |
156 | u32 uBeaconInt; | |
66252c3a | 157 | BOOL bShareKeyAuth; |
442f9cb5 | 158 | u8 byBasicRate; |
66252c3a FB |
159 | |
160 | } SCmdStartAP, *PSCmdStartAP; | |
161 | ||
66252c3a FB |
162 | typedef struct tagSCmdSetWEP { |
163 | ||
164 | BOOL bEnableWep; | |
442f9cb5 AM |
165 | u8 byKeyIndex; |
166 | u8 abyWepKey[WEP_NKEYS][WEP_KEYMAXLEN]; | |
66252c3a | 167 | BOOL bWepKeyAvailable[WEP_NKEYS]; |
659770d4 | 168 | u32 auWepKeyLength[WEP_NKEYS]; |
66252c3a FB |
169 | |
170 | } SCmdSetWEP, *PSCmdSetWEP; | |
171 | ||
66252c3a FB |
172 | typedef struct tagSBSSIDItem { |
173 | ||
659770d4 | 174 | u32 uChannel; |
442f9cb5 AM |
175 | u8 abyBSSID[BSSID_LEN]; |
176 | u8 abySSID[SSID_MAXLEN + 1]; | |
26233e6e AM |
177 | u16 wBeaconInterval; |
178 | u16 wCapInfo; | |
442f9cb5 | 179 | u8 byNetType; |
66252c3a | 180 | BOOL bWEPOn; |
659770d4 | 181 | u32 uRSSI; |
66252c3a FB |
182 | |
183 | } SBSSIDItem; | |
184 | ||
185 | ||
186 | typedef struct tagSBSSIDList { | |
187 | ||
659770d4 | 188 | u32 uItem; |
66252c3a FB |
189 | SBSSIDItem sBSSIDList[0]; |
190 | } SBSSIDList, *PSBSSIDList; | |
191 | ||
192 | ||
193 | typedef struct tagSNodeItem { | |
194 | // STA info | |
26233e6e | 195 | u16 wAID; |
442f9cb5 | 196 | u8 abyMACAddr[6]; |
26233e6e AM |
197 | u16 wTxDataRate; |
198 | u16 wInActiveCount; | |
199 | u16 wEnQueueCnt; | |
200 | u16 wFlags; | |
66252c3a | 201 | BOOL bPWBitOn; |
442f9cb5 | 202 | u8 byKeyIndex; |
26233e6e | 203 | u16 wWepKeyLength; |
442f9cb5 | 204 | u8 abyWepKey[WEP_KEYMAXLEN]; |
66252c3a FB |
205 | // Auto rate fallback vars |
206 | BOOL bIsInFallback; | |
659770d4 AM |
207 | u32 uTxFailures; |
208 | u32 uTxAttempts; | |
26233e6e | 209 | u16 wFailureRatio; |
66252c3a FB |
210 | |
211 | } SNodeItem; | |
212 | ||
213 | ||
214 | typedef struct tagSNodeList { | |
215 | ||
659770d4 | 216 | u32 uItem; |
66252c3a FB |
217 | SNodeItem sNodeList[0]; |
218 | ||
219 | } SNodeList, *PSNodeList; | |
220 | ||
221 | ||
222 | typedef struct tagSCmdLinkStatus { | |
223 | ||
224 | BOOL bLink; | |
26233e6e | 225 | u16 wBSSType; |
442f9cb5 AM |
226 | u8 byState; |
227 | u8 abyBSSID[BSSID_LEN]; | |
228 | u8 abySSID[SSID_MAXLEN + 2]; | |
659770d4 AM |
229 | u32 uChannel; |
230 | u32 uLinkRate; | |
66252c3a FB |
231 | |
232 | } SCmdLinkStatus, *PSCmdLinkStatus; | |
233 | ||
234 | // | |
235 | // 802.11 counter | |
236 | // | |
237 | typedef struct tagSDot11MIBCount { | |
659770d4 AM |
238 | u32 TransmittedFragmentCount; |
239 | u32 MulticastTransmittedFrameCount; | |
240 | u32 FailedCount; | |
241 | u32 RetryCount; | |
242 | u32 MultipleRetryCount; | |
243 | u32 RTSSuccessCount; | |
244 | u32 RTSFailureCount; | |
245 | u32 ACKFailureCount; | |
246 | u32 FrameDuplicateCount; | |
247 | u32 ReceivedFragmentCount; | |
248 | u32 MulticastReceivedFrameCount; | |
249 | u32 FCSErrorCount; | |
193a823c | 250 | } SDot11MIBCount, *PSDot11MIBCount; |
66252c3a FB |
251 | |
252 | ||
253 | ||
254 | // | |
255 | // statistic counter | |
256 | // | |
257 | typedef struct tagSStatMIBCount { | |
258 | // | |
259 | // ISR status count | |
260 | // | |
659770d4 AM |
261 | u32 dwIsrTx0OK; |
262 | u32 dwIsrTx1OK; | |
263 | u32 dwIsrBeaconTxOK; | |
264 | u32 dwIsrRxOK; | |
265 | u32 dwIsrTBTTInt; | |
266 | u32 dwIsrSTIMERInt; | |
267 | u32 dwIsrUnrecoverableError; | |
268 | u32 dwIsrSoftInterrupt; | |
269 | u32 dwIsrRxNoBuf; | |
66252c3a FB |
270 | ///////////////////////////////////// |
271 | ||
659770d4 | 272 | u32 dwIsrUnknown; /* unknown interrupt count */ |
66252c3a FB |
273 | |
274 | // RSR status count | |
275 | // | |
659770d4 AM |
276 | u32 dwRsrFrmAlgnErr; |
277 | u32 dwRsrErr; | |
278 | u32 dwRsrCRCErr; | |
279 | u32 dwRsrCRCOk; | |
280 | u32 dwRsrBSSIDOk; | |
281 | u32 dwRsrADDROk; | |
282 | u32 dwRsrICVOk; | |
283 | u32 dwNewRsrShortPreamble; | |
284 | u32 dwRsrLong; | |
285 | u32 dwRsrRunt; | |
286 | ||
287 | u32 dwRsrRxControl; | |
288 | u32 dwRsrRxData; | |
289 | u32 dwRsrRxManage; | |
290 | ||
291 | u32 dwRsrRxPacket; | |
292 | u32 dwRsrRxOctet; | |
293 | u32 dwRsrBroadcast; | |
294 | u32 dwRsrMulticast; | |
295 | u32 dwRsrDirected; | |
66252c3a | 296 | // 64-bit OID |
659770d4 | 297 | u32 ullRsrOK; |
66252c3a FB |
298 | |
299 | // for some optional OIDs (64 bits) and DMI support | |
659770d4 AM |
300 | u32 ullRxBroadcastBytes; |
301 | u32 ullRxMulticastBytes; | |
302 | u32 ullRxDirectedBytes; | |
303 | u32 ullRxBroadcastFrames; | |
304 | u32 ullRxMulticastFrames; | |
305 | u32 ullRxDirectedFrames; | |
306 | ||
307 | u32 dwRsrRxFragment; | |
308 | u32 dwRsrRxFrmLen64; | |
309 | u32 dwRsrRxFrmLen65_127; | |
310 | u32 dwRsrRxFrmLen128_255; | |
311 | u32 dwRsrRxFrmLen256_511; | |
312 | u32 dwRsrRxFrmLen512_1023; | |
313 | u32 dwRsrRxFrmLen1024_1518; | |
66252c3a FB |
314 | |
315 | // TSR0,1 status count | |
316 | // | |
659770d4 AM |
317 | u32 dwTsrTotalRetry[2]; /* total collision retry count */ |
318 | u32 dwTsrOnceRetry[2]; /* this packet had one collision */ | |
319 | u32 dwTsrMoreThanOnceRetry[2]; /* this packet had many collisions */ | |
320 | u32 dwTsrRetry[2]; /* this packet has ever occur collision, | |
321 | * that is (dwTsrOnceCollision0 plus | |
322 | * dwTsrMoreThanOnceCollision0) */ | |
323 | u32 dwTsrACKData[2]; | |
324 | u32 dwTsrErr[2]; | |
325 | u32 dwAllTsrOK[2]; | |
326 | u32 dwTsrRetryTimeout[2]; | |
327 | u32 dwTsrTransmitTimeout[2]; | |
328 | ||
329 | u32 dwTsrTxPacket[2]; | |
330 | u32 dwTsrTxOctet[2]; | |
331 | u32 dwTsrBroadcast[2]; | |
332 | u32 dwTsrMulticast[2]; | |
333 | u32 dwTsrDirected[2]; | |
66252c3a FB |
334 | |
335 | // RD/TD count | |
659770d4 AM |
336 | u32 dwCntRxFrmLength; |
337 | u32 dwCntTxBufLength; | |
66252c3a | 338 | |
442f9cb5 AM |
339 | u8 abyCntRxPattern[16]; |
340 | u8 abyCntTxPattern[16]; | |
66252c3a | 341 | |
659770d4 AM |
342 | /* Software check.... */ |
343 | u32 dwCntRxDataErr; /* rx buffer data CRC err count */ | |
344 | u32 dwCntDecryptErr; /* rx buffer data CRC err count */ | |
345 | u32 dwCntRxICVErr; /* rx buffer data CRC err count */ | |
346 | u32 idxRxErrorDesc; /* index for rx data error RD */ | |
66252c3a | 347 | |
659770d4 AM |
348 | /* 64-bit OID */ |
349 | u32 ullTsrOK[2]; | |
66252c3a FB |
350 | |
351 | // for some optional OIDs (64 bits) and DMI support | |
659770d4 AM |
352 | u32 ullTxBroadcastFrames[2]; |
353 | u32 ullTxMulticastFrames[2]; | |
354 | u32 ullTxDirectedFrames[2]; | |
355 | u32 ullTxBroadcastBytes[2]; | |
356 | u32 ullTxMulticastBytes[2]; | |
357 | u32 ullTxDirectedBytes[2]; | |
193a823c | 358 | } SStatMIBCount, *PSStatMIBCount; |
66252c3a | 359 | |
66252c3a FB |
360 | typedef struct tagSCmdValue { |
361 | ||
659770d4 | 362 | u32 dwValue; |
66252c3a FB |
363 | |
364 | } SCmdValue, *PSCmdValue; | |
365 | ||
66252c3a FB |
366 | // |
367 | // hostapd & viawget ioctl related | |
368 | // | |
369 | ||
66252c3a FB |
370 | // VIAGWET_IOCTL_HOSTAPD ioctl() cmd: |
371 | enum { | |
372 | VIAWGET_HOSTAPD_FLUSH = 1, | |
373 | VIAWGET_HOSTAPD_ADD_STA = 2, | |
374 | VIAWGET_HOSTAPD_REMOVE_STA = 3, | |
375 | VIAWGET_HOSTAPD_GET_INFO_STA = 4, | |
376 | VIAWGET_HOSTAPD_SET_ENCRYPTION = 5, | |
377 | VIAWGET_HOSTAPD_GET_ENCRYPTION = 6, | |
378 | VIAWGET_HOSTAPD_SET_FLAGS_STA = 7, | |
379 | VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR = 8, | |
380 | VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT = 9, | |
381 | VIAWGET_HOSTAPD_MLME = 10, | |
382 | VIAWGET_HOSTAPD_SCAN_REQ = 11, | |
383 | VIAWGET_HOSTAPD_STA_CLEAR_STATS = 12, | |
384 | }; | |
385 | ||
66252c3a FB |
386 | #define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \ |
387 | ((int) (&((struct viawget_hostapd_param *) 0)->u.generic_elem.data)) | |
388 | ||
389 | // Maximum length for algorithm names (-1 for nul termination) used in ioctl() | |
390 | ||
66252c3a | 391 | struct viawget_hostapd_param { |
659770d4 | 392 | u32 cmd; |
442f9cb5 | 393 | u8 sta_addr[6]; |
66252c3a FB |
394 | union { |
395 | struct { | |
26233e6e AM |
396 | u16 aid; |
397 | u16 capability; | |
442f9cb5 | 398 | u8 tx_supp_rates; |
66252c3a FB |
399 | } add_sta; |
400 | struct { | |
659770d4 | 401 | u32 inactive_sec; |
66252c3a FB |
402 | } get_info_sta; |
403 | struct { | |
442f9cb5 | 404 | u8 alg; |
659770d4 AM |
405 | u32 flags; |
406 | u32 err; | |
442f9cb5 AM |
407 | u8 idx; |
408 | u8 seq[8]; | |
26233e6e | 409 | u16 key_len; |
442f9cb5 | 410 | u8 key[0]; |
66252c3a FB |
411 | } crypt; |
412 | struct { | |
659770d4 AM |
413 | u32 flags_and; |
414 | u32 flags_or; | |
66252c3a FB |
415 | } set_flags_sta; |
416 | struct { | |
26233e6e AM |
417 | u16 rid; |
418 | u16 len; | |
442f9cb5 | 419 | u8 data[0]; |
66252c3a FB |
420 | } rid; |
421 | struct { | |
442f9cb5 AM |
422 | u8 len; |
423 | u8 data[0]; | |
66252c3a FB |
424 | } generic_elem; |
425 | struct { | |
26233e6e AM |
426 | u16 cmd; |
427 | u16 reason_code; | |
66252c3a FB |
428 | } mlme; |
429 | struct { | |
442f9cb5 AM |
430 | u8 ssid_len; |
431 | u8 ssid[32]; | |
66252c3a FB |
432 | } scan_req; |
433 | } u; | |
434 | }; | |
435 | ||
66252c3a FB |
436 | /*--------------------- Export Classes ----------------------------*/ |
437 | ||
438 | /*--------------------- Export Variables --------------------------*/ | |
439 | ||
66252c3a FB |
440 | /*--------------------- Export Types ------------------------------*/ |
441 | ||
66252c3a FB |
442 | /*--------------------- Export Functions --------------------------*/ |
443 | ||
e7b07d1d | 444 | #endif /* __IOCMD_H__ */ |