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