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