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];
195 //2006-1116-01,<Modify> by NomadZhao
196 //U16 wBeaconInterval;
201 U16 wCapInfo
; // for address of byNetType at align 4
209 typedef struct tagSBSSIDList
{
212 SBSSIDItem sBSSIDList
[0];
213 } SBSSIDList
, *PSBSSIDList
;
216 typedef struct tagSCmdLinkStatus
{
221 U8 abyBSSID
[BSSID_LEN
];
222 U8 abySSID
[SSID_MAXLEN
+ 2];
226 } SCmdLinkStatus
, *PSCmdLinkStatus
;
231 typedef struct tagSDot11MIBCount
{
232 U32 TransmittedFragmentCount
;
233 U32 MulticastTransmittedFrameCount
;
236 U32 MultipleRetryCount
;
240 U32 FrameDuplicateCount
;
241 U32 ReceivedFragmentCount
;
242 U32 MulticastReceivedFrameCount
;
244 } SDot11MIBCount
, *PSDot11MIBCount
;
251 typedef struct tagSStatMIBCount
{
261 U32 dwIsrUnrecoverableError
;
262 U32 dwIsrSoftInterrupt
;
264 /////////////////////////////////////
266 U32 dwIsrUnknown
; // unknown interrupt count
277 U32 dwNewRsrShortPreamble
;
293 // for some optional OIDs (64 bits) and DMI support
294 U32 ullRxBroadcastBytes
;
295 U32 ullRxMulticastBytes
;
296 U32 ullRxDirectedBytes
;
297 U32 ullRxBroadcastFrames
;
298 U32 ullRxMulticastFrames
;
299 U32 ullRxDirectedFrames
;
303 U32 dwRsrRxFrmLen65_127
;
304 U32 dwRsrRxFrmLen128_255
;
305 U32 dwRsrRxFrmLen256_511
;
306 U32 dwRsrRxFrmLen512_1023
;
307 U32 dwRsrRxFrmLen1024_1518
;
309 // TSR0,1 status count
311 U32 dwTsrTotalRetry
[2]; // total collision retry count
312 U32 dwTsrOnceRetry
[2]; // this packet only occur one collision
313 U32 dwTsrMoreThanOnceRetry
[2]; // this packet occur more than one collision
314 U32 dwTsrRetry
[2]; // this packet has ever occur collision,
315 // that is (dwTsrOnceCollision0 + dwTsrMoreThanOnceCollision0)
319 U32 dwTsrRetryTimeout
[2];
320 U32 dwTsrTransmitTimeout
[2];
322 U32 dwTsrTxPacket
[2];
324 U32 dwTsrBroadcast
[2];
325 U32 dwTsrMulticast
[2];
326 U32 dwTsrDirected
[2];
329 U32 dwCntRxFrmLength
;
330 U32 dwCntTxBufLength
;
332 U8 abyCntRxPattern
[16];
333 U8 abyCntTxPattern
[16];
335 // Software check....
336 U32 dwCntRxDataErr
; // rx buffer data software compare CRC err count
337 U32 dwCntDecryptErr
; // rx buffer data software compare CRC err count
338 U32 dwCntRxICVErr
; // rx buffer data software compare CRC err count
339 U32 idxRxErrorDesc
; // index for rx data error RD
344 // for some optional OIDs (64 bits) and DMI support
345 U32 ullTxBroadcastFrames
[2];
346 U32 ullTxMulticastFrames
[2];
347 U32 ullTxDirectedFrames
[2];
348 U32 ullTxBroadcastBytes
[2];
349 U32 ullTxMulticastBytes
[2];
350 U32 ullTxDirectedBytes
[2];
351 } SStatMIBCount
, *PSStatMIBCount
;
354 typedef struct tagSNodeItem
{
365 U8 abyWepKey
[WEP_KEYMAXLEN
];
366 // Auto rate fallback vars
375 typedef struct tagSNodeList
{
378 SNodeItem sNodeList
[0];
380 } SNodeList
, *PSNodeList
;
384 typedef struct tagSCmdValue
{
388 } SCmdValue
, *PSCmdValue
;
392 // hostapd & viawget ioctl related
396 // VIAGWET_IOCTL_HOSTAPD ioctl() cmd:
398 VIAWGET_HOSTAPD_FLUSH
= 1,
399 VIAWGET_HOSTAPD_ADD_STA
= 2,
400 VIAWGET_HOSTAPD_REMOVE_STA
= 3,
401 VIAWGET_HOSTAPD_GET_INFO_STA
= 4,
402 VIAWGET_HOSTAPD_SET_ENCRYPTION
= 5,
403 VIAWGET_HOSTAPD_GET_ENCRYPTION
= 6,
404 VIAWGET_HOSTAPD_SET_FLAGS_STA
= 7,
405 VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR
= 8,
406 VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT
= 9,
407 VIAWGET_HOSTAPD_MLME
= 10,
408 VIAWGET_HOSTAPD_SCAN_REQ
= 11,
409 VIAWGET_HOSTAPD_STA_CLEAR_STATS
= 12,
413 #define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
414 ((int) (&((struct viawget_hostapd_param *) 0)->u.generic_elem.data))
416 // Maximum length for algorithm names (-1 for nul termination) used in ioctl()
420 struct viawget_hostapd_param
{
465 //2006-1116-01,<Add> by NomadZhao
468 /*--------------------- Export Classes ----------------------------*/
470 /*--------------------- Export Variables --------------------------*/
473 /*--------------------- Export Types ------------------------------*/
476 /*--------------------- Export Functions --------------------------*/