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