2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
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.
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.
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.
21 * Purpose: Handles the viawget ioctl private interface functions
34 /*--------------------- Export Definitions -------------------------*/
41 //typedef uint32_t u32;
42 //typedef uint16_t u16;
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)
54 typedef enum tagWMAC_CMD {
69 WLAN_CMD_SET_HOSTAPD_STA,
71 WLAN_CMD_SET_HOST_WEP,
73 WLAN_CMD_GET_NODE_CNT,
74 WLAN_CMD_ZONETYPE_SET,
75 WLAN_CMD_GET_NODE_LIST
77 } WMAC_CMD, *PWMAC_CMD;
79 typedef enum tagWZONETYPE {
90 #define ADHOC_STARTED 1
91 #define ADHOC_JOINTED 2
99 #define SSID_MAXLEN 32
102 #define WEP_KEYMAXLEN 29
103 #define WEP_40BIT_LEN 5
104 #define WEP_104BIT_LEN 13
105 #define WEP_232BIT_LEN 16
107 // Ioctl interface structure
111 typedef struct tagSCmdRequest {
116 } SCmdRequest, *PSCmdRequest;
122 typedef struct tagSCmdScan {
124 U8 ssid[SSID_MAXLEN + 2];
126 } SCmdScan, *PSCmdScan;
133 typedef struct tagSCmdBSSJoin {
137 U8 ssid[SSID_MAXLEN + 2];
142 } SCmdBSSJoin, *PSCmdBSSJoin;
148 typedef struct tagSCmdZoneTypeSet {
153 } SCmdZoneTypeSet, *PSCmdZoneTypeSet;
155 #ifdef WPA_SM_Transtatus
156 typedef struct tagSWPAResult {
162 } SWPAResult, *PSWPAResult;
165 typedef struct tagSCmdStartAP {
169 U8 ssid[SSID_MAXLEN + 2];
175 } SCmdStartAP, *PSCmdStartAP;
178 typedef struct tagSCmdSetWEP {
182 U8 abyWepKey[WEP_NKEYS][WEP_KEYMAXLEN];
183 BOOL bWepKeyAvailable[WEP_NKEYS];
184 U32 auWepKeyLength[WEP_NKEYS];
186 } SCmdSetWEP, *PSCmdSetWEP;
190 typedef struct tagSBSSIDItem {
193 U8 abyBSSID[BSSID_LEN];
194 U8 abySSID[SSID_MAXLEN + 1];
204 typedef struct tagSBSSIDList {
207 SBSSIDItem sBSSIDList[0];
208 } SBSSIDList, *PSBSSIDList;
211 typedef struct tagSNodeItem {
222 U8 abyWepKey[WEP_KEYMAXLEN];
223 // Auto rate fallback vars
232 typedef struct tagSNodeList {
235 SNodeItem sNodeList[0];
237 } SNodeList, *PSNodeList;
240 typedef struct tagSCmdLinkStatus {
245 U8 abyBSSID[BSSID_LEN];
246 U8 abySSID[SSID_MAXLEN + 2];
250 } SCmdLinkStatus, *PSCmdLinkStatus;
255 typedef struct tagSDot11MIBCount {
256 U32 TransmittedFragmentCount;
257 U32 MulticastTransmittedFrameCount;
260 U32 MultipleRetryCount;
264 U32 FrameDuplicateCount;
265 U32 ReceivedFragmentCount;
266 U32 MulticastReceivedFrameCount;
268 } SDot11MIBCount, *PSDot11MIBCount;
275 typedef struct tagSStatMIBCount {
285 U32 dwIsrUnrecoverableError;
286 U32 dwIsrSoftInterrupt;
288 /////////////////////////////////////
290 U32 dwIsrUnknown; // unknown interrupt count
301 U32 dwNewRsrShortPreamble;
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;
327 U32 dwRsrRxFrmLen65_127;
328 U32 dwRsrRxFrmLen128_255;
329 U32 dwRsrRxFrmLen256_511;
330 U32 dwRsrRxFrmLen512_1023;
331 U32 dwRsrRxFrmLen1024_1518;
333 // TSR0,1 status count
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)
343 U32 dwTsrRetryTimeout[2];
344 U32 dwTsrTransmitTimeout[2];
346 U32 dwTsrTxPacket[2];
348 U32 dwTsrBroadcast[2];
349 U32 dwTsrMulticast[2];
350 U32 dwTsrDirected[2];
353 U32 dwCntRxFrmLength;
354 U32 dwCntTxBufLength;
356 U8 abyCntRxPattern[16];
357 U8 abyCntTxPattern[16];
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
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];
375 } SStatMIBCount, *PSStatMIBCount;
380 typedef struct tagSCmdValue {
384 } SCmdValue, *PSCmdValue;
388 // hostapd & viawget ioctl related
392 // VIAGWET_IOCTL_HOSTAPD ioctl() cmd:
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,
409 #define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
410 ((int) (&((struct viawget_hostapd_param *) 0)->u.generic_elem.data))
412 // Maximum length for algorithm names (-1 for nul termination) used in ioctl()
416 struct viawget_hostapd_param {
463 /*--------------------- Export Classes ----------------------------*/
465 /*--------------------- Export Variables --------------------------*/
468 /*--------------------- Export Types ------------------------------*/
471 /*--------------------- Export Functions --------------------------*/