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 -------------------------*/
40 //typedef uint32_t u32;
41 //typedef uint16_t u16;
46 #define MAGIC_CODE 0x3142
47 #define IOCTL_CMD_TEST (SIOCDEVPRIVATE + 0)
48 #define IOCTL_CMD_SET (SIOCDEVPRIVATE + 1)
49 #define IOCTL_CMD_HOSTAPD (SIOCDEVPRIVATE + 2)
50 #define IOCTL_CMD_WPA (SIOCDEVPRIVATE + 3)
53 typedef enum tagWMAC_CMD
{
68 WLAN_CMD_SET_HOSTAPD_STA
,
70 WLAN_CMD_SET_HOST_WEP
,
72 WLAN_CMD_GET_NODE_CNT
,
73 WLAN_CMD_ZONETYPE_SET
,
74 WLAN_CMD_GET_NODE_LIST
76 } WMAC_CMD
, *PWMAC_CMD
;
78 typedef enum tagWZONETYPE
{
89 #define ADHOC_STARTED 1
90 #define ADHOC_JOINTED 2
98 #define SSID_MAXLEN 32
101 #define WEP_KEYMAXLEN 29
102 #define WEP_40BIT_LEN 5
103 #define WEP_104BIT_LEN 13
104 #define WEP_232BIT_LEN 16
106 // Ioctl interface structure
110 typedef struct tagSCmdRequest
{
115 } SCmdRequest
, *PSCmdRequest
;
121 typedef struct tagSCmdScan
{
123 u8 ssid
[SSID_MAXLEN
+ 2];
125 } SCmdScan
, *PSCmdScan
;
132 typedef struct tagSCmdBSSJoin
{
136 u8 ssid
[SSID_MAXLEN
+ 2];
141 } SCmdBSSJoin
, *PSCmdBSSJoin
;
147 typedef struct tagSCmdZoneTypeSet
{
152 } SCmdZoneTypeSet
, *PSCmdZoneTypeSet
;
154 #ifdef WPA_SM_Transtatus
155 typedef struct tagSWPAResult
{
161 } SWPAResult
, *PSWPAResult
;
164 typedef struct tagSCmdStartAP
{
168 u8 ssid
[SSID_MAXLEN
+ 2];
174 } SCmdStartAP
, *PSCmdStartAP
;
177 typedef struct tagSCmdSetWEP
{
181 u8 abyWepKey
[WEP_NKEYS
][WEP_KEYMAXLEN
];
182 bool bWepKeyAvailable
[WEP_NKEYS
];
183 u32 auWepKeyLength
[WEP_NKEYS
];
185 } SCmdSetWEP
, *PSCmdSetWEP
;
189 typedef struct tagSBSSIDItem
{
192 u8 abyBSSID
[BSSID_LEN
];
193 u8 abySSID
[SSID_MAXLEN
+ 1];
194 //2006-1116-01,<Modify> by NomadZhao
195 //u16 wBeaconInterval;
200 u16 wCapInfo
; // for address of byNetType at align 4
208 typedef struct tagSBSSIDList
{
211 SBSSIDItem sBSSIDList
[0];
212 } SBSSIDList
, *PSBSSIDList
;
215 typedef struct tagSCmdLinkStatus
{
220 u8 abyBSSID
[BSSID_LEN
];
221 u8 abySSID
[SSID_MAXLEN
+ 2];
225 } SCmdLinkStatus
, *PSCmdLinkStatus
;
230 typedef struct tagSDot11MIBCount
{
231 u32 TransmittedFragmentCount
;
232 u32 MulticastTransmittedFrameCount
;
235 u32 MultipleRetryCount
;
239 u32 FrameDuplicateCount
;
240 u32 ReceivedFragmentCount
;
241 u32 MulticastReceivedFrameCount
;
243 } SDot11MIBCount
, *PSDot11MIBCount
;
250 typedef struct tagSStatMIBCount
{
260 u32 dwIsrUnrecoverableError
;
261 u32 dwIsrSoftInterrupt
;
263 /////////////////////////////////////
265 u32 dwIsrUnknown
; // unknown interrupt count
276 u32 dwNewRsrShortPreamble
;
292 // for some optional OIDs (64 bits) and DMI support
293 u32 ullRxBroadcastBytes
;
294 u32 ullRxMulticastBytes
;
295 u32 ullRxDirectedBytes
;
296 u32 ullRxBroadcastFrames
;
297 u32 ullRxMulticastFrames
;
298 u32 ullRxDirectedFrames
;
302 u32 dwRsrRxFrmLen65_127
;
303 u32 dwRsrRxFrmLen128_255
;
304 u32 dwRsrRxFrmLen256_511
;
305 u32 dwRsrRxFrmLen512_1023
;
306 u32 dwRsrRxFrmLen1024_1518
;
308 // TSR0,1 status count
310 u32 dwTsrTotalRetry
[2]; // total collision retry count
311 u32 dwTsrOnceRetry
[2]; // this packet only occur one collision
312 u32 dwTsrMoreThanOnceRetry
[2]; // this packet occur more than one collision
313 u32 dwTsrRetry
[2]; // this packet has ever occur collision,
314 // that is (dwTsrOnceCollision0 + dwTsrMoreThanOnceCollision0)
318 u32 dwTsrRetryTimeout
[2];
319 u32 dwTsrTransmitTimeout
[2];
321 u32 dwTsrTxPacket
[2];
323 u32 dwTsrBroadcast
[2];
324 u32 dwTsrMulticast
[2];
325 u32 dwTsrDirected
[2];
328 u32 dwCntRxFrmLength
;
329 u32 dwCntTxBufLength
;
331 u8 abyCntRxPattern
[16];
332 u8 abyCntTxPattern
[16];
334 // Software check....
335 u32 dwCntRxDataErr
; // rx buffer data software compare CRC err count
336 u32 dwCntDecryptErr
; // rx buffer data software compare CRC err count
337 u32 dwCntRxICVErr
; // rx buffer data software compare CRC err count
338 u32 idxRxErrorDesc
; // index for rx data error RD
343 // for some optional OIDs (64 bits) and DMI support
344 u32 ullTxBroadcastFrames
[2];
345 u32 ullTxMulticastFrames
[2];
346 u32 ullTxDirectedFrames
[2];
347 u32 ullTxBroadcastBytes
[2];
348 u32 ullTxMulticastBytes
[2];
349 u32 ullTxDirectedBytes
[2];
350 } SStatMIBCount
, *PSStatMIBCount
;
353 typedef struct tagSNodeItem
{
364 u8 abyWepKey
[WEP_KEYMAXLEN
];
365 // Auto rate fallback vars
374 typedef struct tagSNodeList
{
377 SNodeItem sNodeList
[0];
379 } SNodeList
, *PSNodeList
;
383 typedef struct tagSCmdValue
{
387 } SCmdValue
, *PSCmdValue
;
391 // hostapd & viawget ioctl related
395 // VIAGWET_IOCTL_HOSTAPD ioctl() cmd:
397 VIAWGET_HOSTAPD_FLUSH
= 1,
398 VIAWGET_HOSTAPD_ADD_STA
= 2,
399 VIAWGET_HOSTAPD_REMOVE_STA
= 3,
400 VIAWGET_HOSTAPD_GET_INFO_STA
= 4,
401 VIAWGET_HOSTAPD_SET_ENCRYPTION
= 5,
402 VIAWGET_HOSTAPD_GET_ENCRYPTION
= 6,
403 VIAWGET_HOSTAPD_SET_FLAGS_STA
= 7,
404 VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR
= 8,
405 VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT
= 9,
406 VIAWGET_HOSTAPD_MLME
= 10,
407 VIAWGET_HOSTAPD_SCAN_REQ
= 11,
408 VIAWGET_HOSTAPD_STA_CLEAR_STATS
= 12,
412 #define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
413 ((int) (&((struct viawget_hostapd_param *) 0)->u.generic_elem.data))
415 // Maximum length for algorithm names (-1 for nul termination) used in ioctl()
419 struct viawget_hostapd_param
{
464 //2006-1116-01,<Add> by NomadZhao
467 /*--------------------- Export Classes ----------------------------*/
469 /*--------------------- Export Variables --------------------------*/
472 /*--------------------- Export Types ------------------------------*/
475 /*--------------------- Export Functions --------------------------*/