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 -------------------------*/
36 //typedef uint32_t u32;
37 //typedef uint16_t u16;
42 #define MAGIC_CODE 0x3142
43 #define IOCTL_CMD_TEST (SIOCDEVPRIVATE + 0)
44 #define IOCTL_CMD_SET (SIOCDEVPRIVATE + 1)
45 #define IOCTL_CMD_HOSTAPD (SIOCDEVPRIVATE + 2)
46 #define IOCTL_CMD_WPA (SIOCDEVPRIVATE + 3)
49 typedef enum tagWMAC_CMD
{
64 WLAN_CMD_SET_HOSTAPD_STA
,
66 WLAN_CMD_SET_HOST_WEP
,
68 WLAN_CMD_GET_NODE_CNT
,
69 WLAN_CMD_ZONETYPE_SET
,
70 WLAN_CMD_GET_NODE_LIST
72 } WMAC_CMD
, *PWMAC_CMD
;
74 typedef enum tagWZONETYPE
{
85 #define ADHOC_STARTED 1
86 #define ADHOC_JOINTED 2
94 #define SSID_MAXLEN 32
97 #define WEP_KEYMAXLEN 29
98 #define WEP_40BIT_LEN 5
99 #define WEP_104BIT_LEN 13
100 #define WEP_232BIT_LEN 16
102 // Ioctl interface structure
106 typedef struct tagSCmdRequest
{
111 } SCmdRequest
, *PSCmdRequest
;
117 typedef struct tagSCmdScan
{
119 u8 ssid
[SSID_MAXLEN
+ 2];
121 } SCmdScan
, *PSCmdScan
;
128 typedef struct tagSCmdBSSJoin
{
132 u8 ssid
[SSID_MAXLEN
+ 2];
137 } SCmdBSSJoin
, *PSCmdBSSJoin
;
143 typedef struct tagSCmdZoneTypeSet
{
148 } SCmdZoneTypeSet
, *PSCmdZoneTypeSet
;
150 #ifdef WPA_SM_Transtatus
151 typedef struct tagSWPAResult
{
157 } SWPAResult
, *PSWPAResult
;
160 typedef struct tagSCmdStartAP
{
164 u8 ssid
[SSID_MAXLEN
+ 2];
170 } SCmdStartAP
, *PSCmdStartAP
;
173 typedef struct tagSCmdSetWEP
{
177 u8 abyWepKey
[WEP_NKEYS
][WEP_KEYMAXLEN
];
178 bool bWepKeyAvailable
[WEP_NKEYS
];
179 u32 auWepKeyLength
[WEP_NKEYS
];
181 } SCmdSetWEP
, *PSCmdSetWEP
;
185 typedef struct tagSBSSIDItem
{
188 u8 abyBSSID
[BSSID_LEN
];
189 u8 abySSID
[SSID_MAXLEN
+ 1];
190 //2006-1116-01,<Modify> by NomadZhao
191 //u16 wBeaconInterval;
196 u16 wCapInfo
; // for address of byNetType at align 4
204 typedef struct tagSBSSIDList
{
207 SBSSIDItem sBSSIDList
[0];
208 } SBSSIDList
, *PSBSSIDList
;
211 typedef struct tagSCmdLinkStatus
{
216 u8 abyBSSID
[BSSID_LEN
];
217 u8 abySSID
[SSID_MAXLEN
+ 2];
221 } SCmdLinkStatus
, *PSCmdLinkStatus
;
226 typedef struct tagSDot11MIBCount
{
227 u32 TransmittedFragmentCount
;
228 u32 MulticastTransmittedFrameCount
;
231 u32 MultipleRetryCount
;
235 u32 FrameDuplicateCount
;
236 u32 ReceivedFragmentCount
;
237 u32 MulticastReceivedFrameCount
;
239 } SDot11MIBCount
, *PSDot11MIBCount
;
246 typedef struct tagSStatMIBCount
{
256 u32 dwIsrUnrecoverableError
;
257 u32 dwIsrSoftInterrupt
;
259 /////////////////////////////////////
261 u32 dwIsrUnknown
; // unknown interrupt count
272 u32 dwNewRsrShortPreamble
;
288 // for some optional OIDs (64 bits) and DMI support
289 u32 ullRxBroadcastBytes
;
290 u32 ullRxMulticastBytes
;
291 u32 ullRxDirectedBytes
;
292 u32 ullRxBroadcastFrames
;
293 u32 ullRxMulticastFrames
;
294 u32 ullRxDirectedFrames
;
298 u32 dwRsrRxFrmLen65_127
;
299 u32 dwRsrRxFrmLen128_255
;
300 u32 dwRsrRxFrmLen256_511
;
301 u32 dwRsrRxFrmLen512_1023
;
302 u32 dwRsrRxFrmLen1024_1518
;
304 // TSR0,1 status count
306 u32 dwTsrTotalRetry
[2]; // total collision retry count
307 u32 dwTsrOnceRetry
[2]; // this packet only occur one collision
308 u32 dwTsrMoreThanOnceRetry
[2]; // this packet occur more than one collision
309 u32 dwTsrRetry
[2]; // this packet has ever occur collision,
310 // that is (dwTsrOnceCollision0 + dwTsrMoreThanOnceCollision0)
314 u32 dwTsrRetryTimeout
[2];
315 u32 dwTsrTransmitTimeout
[2];
317 u32 dwTsrTxPacket
[2];
319 u32 dwTsrBroadcast
[2];
320 u32 dwTsrMulticast
[2];
321 u32 dwTsrDirected
[2];
324 u32 dwCntRxFrmLength
;
325 u32 dwCntTxBufLength
;
327 u8 abyCntRxPattern
[16];
328 u8 abyCntTxPattern
[16];
330 // Software check....
331 u32 dwCntRxDataErr
; // rx buffer data software compare CRC err count
332 u32 dwCntDecryptErr
; // rx buffer data software compare CRC err count
333 u32 dwCntRxICVErr
; // rx buffer data software compare CRC err count
334 u32 idxRxErrorDesc
; // index for rx data error RD
339 // for some optional OIDs (64 bits) and DMI support
340 u32 ullTxBroadcastFrames
[2];
341 u32 ullTxMulticastFrames
[2];
342 u32 ullTxDirectedFrames
[2];
343 u32 ullTxBroadcastBytes
[2];
344 u32 ullTxMulticastBytes
[2];
345 u32 ullTxDirectedBytes
[2];
346 } SStatMIBCount
, *PSStatMIBCount
;
349 typedef struct tagSNodeItem
{
360 u8 abyWepKey
[WEP_KEYMAXLEN
];
361 // Auto rate fallback vars
370 typedef struct tagSNodeList
{
373 SNodeItem sNodeList
[0];
375 } SNodeList
, *PSNodeList
;
379 typedef struct tagSCmdValue
{
383 } SCmdValue
, *PSCmdValue
;
387 // hostapd & viawget ioctl related
391 // VIAGWET_IOCTL_HOSTAPD ioctl() cmd:
393 VIAWGET_HOSTAPD_FLUSH
= 1,
394 VIAWGET_HOSTAPD_ADD_STA
= 2,
395 VIAWGET_HOSTAPD_REMOVE_STA
= 3,
396 VIAWGET_HOSTAPD_GET_INFO_STA
= 4,
397 VIAWGET_HOSTAPD_SET_ENCRYPTION
= 5,
398 VIAWGET_HOSTAPD_GET_ENCRYPTION
= 6,
399 VIAWGET_HOSTAPD_SET_FLAGS_STA
= 7,
400 VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR
= 8,
401 VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT
= 9,
402 VIAWGET_HOSTAPD_MLME
= 10,
403 VIAWGET_HOSTAPD_SCAN_REQ
= 11,
404 VIAWGET_HOSTAPD_STA_CLEAR_STATS
= 12,
408 #define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
409 ((int) (&((struct viawget_hostapd_param *) 0)->u.generic_elem.data))
411 // Maximum length for algorithm names (-1 for nul termination) used in ioctl()
415 struct viawget_hostapd_param
{
460 //2006-1116-01,<Add> by NomadZhao
463 /*--------------------- Export Classes ----------------------------*/
465 /*--------------------- Export Variables --------------------------*/
468 /*--------------------- Export Types ------------------------------*/
471 /*--------------------- Export Functions --------------------------*/