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;
41 #define MAGIC_CODE 0x3142
42 #define IOCTL_CMD_TEST (SIOCDEVPRIVATE + 0)
43 #define IOCTL_CMD_SET (SIOCDEVPRIVATE + 1)
44 #define IOCTL_CMD_HOSTAPD (SIOCDEVPRIVATE + 2)
45 #define IOCTL_CMD_WPA (SIOCDEVPRIVATE + 3)
47 typedef enum tagWMAC_CMD
{
61 WLAN_CMD_SET_HOSTAPD_STA
,
63 WLAN_CMD_SET_HOST_WEP
,
65 WLAN_CMD_GET_NODE_CNT
,
66 WLAN_CMD_ZONETYPE_SET
,
67 WLAN_CMD_GET_NODE_LIST
68 } WMAC_CMD
, *PWMAC_CMD
;
70 typedef enum tagWZONETYPE
{
81 #define ADHOC_STARTED 1
82 #define ADHOC_JOINTED 2
89 #define SSID_MAXLEN 32
92 #define WEP_KEYMAXLEN 29
93 #define WEP_40BIT_LEN 5
94 #define WEP_104BIT_LEN 13
95 #define WEP_232BIT_LEN 16
97 // Ioctl interface structure
101 typedef struct tagSCmdRequest
{
106 } SCmdRequest
, *PSCmdRequest
;
112 typedef struct tagSCmdScan
{
113 u8 ssid
[SSID_MAXLEN
+ 2];
114 } SCmdScan
, *PSCmdScan
;
120 typedef struct tagSCmdBSSJoin
{
123 u8 ssid
[SSID_MAXLEN
+ 2];
127 } SCmdBSSJoin
, *PSCmdBSSJoin
;
133 typedef struct tagSCmdZoneTypeSet
{
136 } SCmdZoneTypeSet
, *PSCmdZoneTypeSet
;
138 #ifdef WPA_SM_Transtatus
139 typedef struct tagSWPAResult
{
145 } SWPAResult
, *PSWPAResult
;
148 typedef struct tagSCmdStartAP
{
151 u8 ssid
[SSID_MAXLEN
+ 2];
156 } SCmdStartAP
, *PSCmdStartAP
;
158 typedef struct tagSCmdSetWEP
{
161 u8 abyWepKey
[WEP_NKEYS
][WEP_KEYMAXLEN
];
162 bool bWepKeyAvailable
[WEP_NKEYS
];
163 u32 auWepKeyLength
[WEP_NKEYS
];
164 } SCmdSetWEP
, *PSCmdSetWEP
;
166 typedef struct tagSBSSIDItem
{
168 u8 abyBSSID
[BSSID_LEN
];
169 u8 abySSID
[SSID_MAXLEN
+ 1];
170 //2006-1116-01,<Modify> by NomadZhao
171 //u16 wBeaconInterval;
176 u16 wCapInfo
; // for address of byNetType at align 4
182 typedef struct tagSBSSIDList
{
184 SBSSIDItem sBSSIDList
[0];
185 } SBSSIDList
, *PSBSSIDList
;
187 typedef struct tagSCmdLinkStatus
{
191 u8 abyBSSID
[BSSID_LEN
];
192 u8 abySSID
[SSID_MAXLEN
+ 2];
195 } SCmdLinkStatus
, *PSCmdLinkStatus
;
200 typedef struct tagSDot11MIBCount
{
201 u32 TransmittedFragmentCount
;
202 u32 MulticastTransmittedFrameCount
;
205 u32 MultipleRetryCount
;
209 u32 FrameDuplicateCount
;
210 u32 ReceivedFragmentCount
;
211 u32 MulticastReceivedFrameCount
;
213 } SDot11MIBCount
, *PSDot11MIBCount
;
218 typedef struct tagSStatMIBCount
{
228 u32 dwIsrUnrecoverableError
;
229 u32 dwIsrSoftInterrupt
;
231 /////////////////////////////////////
233 u32 dwIsrUnknown
; // unknown interrupt count
244 u32 dwNewRsrShortPreamble
;
260 // for some optional OIDs (64 bits) and DMI support
261 u32 ullRxBroadcastBytes
;
262 u32 ullRxMulticastBytes
;
263 u32 ullRxDirectedBytes
;
264 u32 ullRxBroadcastFrames
;
265 u32 ullRxMulticastFrames
;
266 u32 ullRxDirectedFrames
;
270 u32 dwRsrRxFrmLen65_127
;
271 u32 dwRsrRxFrmLen128_255
;
272 u32 dwRsrRxFrmLen256_511
;
273 u32 dwRsrRxFrmLen512_1023
;
274 u32 dwRsrRxFrmLen1024_1518
;
276 // TSR0,1 status count
278 u32 dwTsrTotalRetry
[2]; // total collision retry count
279 u32 dwTsrOnceRetry
[2]; // this packet only occur one collision
280 u32 dwTsrMoreThanOnceRetry
[2]; // this packet occur more than one collision
281 u32 dwTsrRetry
[2]; // this packet has ever occur collision,
282 // that is (dwTsrOnceCollision0 + dwTsrMoreThanOnceCollision0)
286 u32 dwTsrRetryTimeout
[2];
287 u32 dwTsrTransmitTimeout
[2];
289 u32 dwTsrTxPacket
[2];
291 u32 dwTsrBroadcast
[2];
292 u32 dwTsrMulticast
[2];
293 u32 dwTsrDirected
[2];
296 u32 dwCntRxFrmLength
;
297 u32 dwCntTxBufLength
;
299 u8 abyCntRxPattern
[16];
300 u8 abyCntTxPattern
[16];
302 // Software check....
303 u32 dwCntRxDataErr
; // rx buffer data software compare CRC err count
304 u32 dwCntDecryptErr
; // rx buffer data software compare CRC err count
305 u32 dwCntRxICVErr
; // rx buffer data software compare CRC err count
306 u32 idxRxErrorDesc
; // index for rx data error RD
311 // for some optional OIDs (64 bits) and DMI support
312 u32 ullTxBroadcastFrames
[2];
313 u32 ullTxMulticastFrames
[2];
314 u32 ullTxDirectedFrames
[2];
315 u32 ullTxBroadcastBytes
[2];
316 u32 ullTxMulticastBytes
[2];
317 u32 ullTxDirectedBytes
[2];
318 } SStatMIBCount
, *PSStatMIBCount
;
320 typedef struct tagSNodeItem
{
331 u8 abyWepKey
[WEP_KEYMAXLEN
];
332 // Auto rate fallback vars
339 typedef struct tagSNodeList
{
341 SNodeItem sNodeList
[0];
342 } SNodeList
, *PSNodeList
;
344 typedef struct tagSCmdValue
{
346 } SCmdValue
, *PSCmdValue
;
349 // hostapd & viawget ioctl related
352 // VIAGWET_IOCTL_HOSTAPD ioctl() cmd:
354 VIAWGET_HOSTAPD_FLUSH
= 1,
355 VIAWGET_HOSTAPD_ADD_STA
= 2,
356 VIAWGET_HOSTAPD_REMOVE_STA
= 3,
357 VIAWGET_HOSTAPD_GET_INFO_STA
= 4,
358 VIAWGET_HOSTAPD_SET_ENCRYPTION
= 5,
359 VIAWGET_HOSTAPD_GET_ENCRYPTION
= 6,
360 VIAWGET_HOSTAPD_SET_FLAGS_STA
= 7,
361 VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR
= 8,
362 VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT
= 9,
363 VIAWGET_HOSTAPD_MLME
= 10,
364 VIAWGET_HOSTAPD_SCAN_REQ
= 11,
365 VIAWGET_HOSTAPD_STA_CLEAR_STATS
= 12,
368 #define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
369 ((int)(&((struct viawget_hostapd_param *)0)->u.generic_elem.data))
371 // Maximum length for algorithm names (-1 for nul termination) used in ioctl()
373 struct viawget_hostapd_param
{
418 //2006-1116-01,<Add> by NomadZhao
421 /*--------------------- Export Classes ----------------------------*/
423 /*--------------------- Export Variables --------------------------*/
425 /*--------------------- Export Types ------------------------------*/
427 /*--------------------- Export Functions --------------------------*/