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