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
35 #define MAGIC_CODE 0x3142
36 #define IOCTL_CMD_TEST (SIOCDEVPRIVATE + 0)
37 #define IOCTL_CMD_SET (SIOCDEVPRIVATE + 1)
38 #define IOCTL_CMD_HOSTAPD (SIOCDEVPRIVATE + 2)
39 #define IOCTL_CMD_WPA (SIOCDEVPRIVATE + 3)
41 typedef enum tagWMAC_CMD {
55 WLAN_CMD_SET_HOSTAPD_STA,
57 WLAN_CMD_SET_HOST_WEP,
59 WLAN_CMD_GET_NODE_CNT,
60 WLAN_CMD_ZONETYPE_SET,
61 WLAN_CMD_GET_NODE_LIST
62 } WMAC_CMD, *PWMAC_CMD;
64 typedef enum tagWZONETYPE {
75 #define ADHOC_STARTED 1
76 #define ADHOC_JOINTED 2
83 #define SSID_MAXLEN 32
86 #define WEP_KEYMAXLEN 29
87 #define WEP_40BIT_LEN 5
88 #define WEP_104BIT_LEN 13
89 #define WEP_232BIT_LEN 16
91 // Ioctl interface structure
95 typedef struct tagSCmdRequest {
100 } SCmdRequest, *PSCmdRequest;
106 typedef struct tagSCmdScan {
107 u8 ssid[SSID_MAXLEN + 2];
108 } SCmdScan, *PSCmdScan;
114 typedef struct tagSCmdBSSJoin {
117 u8 ssid[SSID_MAXLEN + 2];
121 } SCmdBSSJoin, *PSCmdBSSJoin;
127 typedef struct tagSCmdZoneTypeSet {
130 } SCmdZoneTypeSet, *PSCmdZoneTypeSet;
132 #ifdef WPA_SM_Transtatus
133 typedef struct tagSWPAResult {
139 } SWPAResult, *PSWPAResult;
142 typedef struct tagSCmdStartAP {
145 u8 ssid[SSID_MAXLEN + 2];
150 } SCmdStartAP, *PSCmdStartAP;
152 typedef struct tagSCmdSetWEP {
155 u8 abyWepKey[WEP_NKEYS][WEP_KEYMAXLEN];
156 bool bWepKeyAvailable[WEP_NKEYS];
157 u32 auWepKeyLength[WEP_NKEYS];
158 } SCmdSetWEP, *PSCmdSetWEP;
160 typedef struct tagSBSSIDItem {
162 u8 abyBSSID[BSSID_LEN];
163 u8 abySSID[SSID_MAXLEN + 1];
166 u16 wCapInfo; // for address of byNetType at align 4
172 typedef struct tagSBSSIDList {
174 SBSSIDItem sBSSIDList[0];
175 } SBSSIDList, *PSBSSIDList;
177 typedef struct tagSCmdLinkStatus {
181 u8 abyBSSID[BSSID_LEN];
182 u8 abySSID[SSID_MAXLEN + 2];
185 } SCmdLinkStatus, *PSCmdLinkStatus;
190 typedef struct tagSDot11MIBCount {
191 u32 TransmittedFragmentCount;
192 u32 MulticastTransmittedFrameCount;
195 u32 MultipleRetryCount;
199 u32 FrameDuplicateCount;
200 u32 ReceivedFragmentCount;
201 u32 MulticastReceivedFrameCount;
203 } SDot11MIBCount, *PSDot11MIBCount;
208 typedef struct tagSStatMIBCount {
218 u32 dwIsrUnrecoverableError;
219 u32 dwIsrSoftInterrupt;
233 u32 dwNewRsrShortPreamble;
249 // for some optional OIDs (64 bits) and DMI support
250 u32 ullRxBroadcastBytes;
251 u32 ullRxMulticastBytes;
252 u32 ullRxDirectedBytes;
253 u32 ullRxBroadcastFrames;
254 u32 ullRxMulticastFrames;
255 u32 ullRxDirectedFrames;
259 u32 dwRsrRxFrmLen65_127;
260 u32 dwRsrRxFrmLen128_255;
261 u32 dwRsrRxFrmLen256_511;
262 u32 dwRsrRxFrmLen512_1023;
263 u32 dwRsrRxFrmLen1024_1518;
265 // TSR0,1 status count
267 u32 dwTsrTotalRetry[2]; // total collision retry count
268 u32 dwTsrOnceRetry[2]; // this packet only occur one collision
269 u32 dwTsrMoreThanOnceRetry[2]; // this packet occur more than one collision
270 u32 dwTsrRetry[2]; // this packet has ever occur collision,
271 // that is (dwTsrOnceCollision0 + dwTsrMoreThanOnceCollision0)
275 u32 dwTsrRetryTimeout[2];
276 u32 dwTsrTransmitTimeout[2];
278 u32 dwTsrTxPacket[2];
280 u32 dwTsrBroadcast[2];
281 u32 dwTsrMulticast[2];
282 u32 dwTsrDirected[2];
285 u32 dwCntRxFrmLength;
286 u32 dwCntTxBufLength;
288 u8 abyCntRxPattern[16];
289 u8 abyCntTxPattern[16];
291 // Software check....
292 u32 dwCntRxDataErr; // rx buffer data software compare CRC err count
293 u32 dwCntDecryptErr; // rx buffer data software compare CRC err count
294 u32 dwCntRxICVErr; // rx buffer data software compare CRC err count
295 u32 idxRxErrorDesc; // index for rx data error RD
300 // for some optional OIDs (64 bits) and DMI support
301 u32 ullTxBroadcastFrames[2];
302 u32 ullTxMulticastFrames[2];
303 u32 ullTxDirectedFrames[2];
304 u32 ullTxBroadcastBytes[2];
305 u32 ullTxMulticastBytes[2];
306 u32 ullTxDirectedBytes[2];
307 } SStatMIBCount, *PSStatMIBCount;
309 typedef struct tagSNodeItem {
320 u8 abyWepKey[WEP_KEYMAXLEN];
321 // Auto rate fallback vars
328 typedef struct tagSNodeList {
330 SNodeItem sNodeList[0];
331 } SNodeList, *PSNodeList;
333 typedef struct tagSCmdValue {
335 } SCmdValue, *PSCmdValue;
338 // hostapd & viawget ioctl related
342 VIAWGET_HOSTAPD_FLUSH = 1,
343 VIAWGET_HOSTAPD_ADD_STA = 2,
344 VIAWGET_HOSTAPD_REMOVE_STA = 3,
345 VIAWGET_HOSTAPD_GET_INFO_STA = 4,
346 VIAWGET_HOSTAPD_SET_ENCRYPTION = 5,
347 VIAWGET_HOSTAPD_GET_ENCRYPTION = 6,
348 VIAWGET_HOSTAPD_SET_FLAGS_STA = 7,
349 VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR = 8,
350 VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT = 9,
351 VIAWGET_HOSTAPD_MLME = 10,
352 VIAWGET_HOSTAPD_SCAN_REQ = 11,
353 VIAWGET_HOSTAPD_STA_CLEAR_STATS = 12,
356 #define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
357 ((int)(&((struct viawget_hostapd_param *)0)->u.generic_elem.data))
359 // Maximum length for algorithm names (-1 for nul termination) used in ioctl()
361 struct viawget_hostapd_param {