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 -------------------------*/
37 #define MAGIC_CODE 0x3142
38 #define IOCTL_CMD_TEST (SIOCDEVPRIVATE + 0)
39 #define IOCTL_CMD_SET (SIOCDEVPRIVATE + 1)
40 #define IOCTL_CMD_HOSTAPD (SIOCDEVPRIVATE + 2)
41 #define IOCTL_CMD_WPA (SIOCDEVPRIVATE + 3)
43 typedef enum tagWMAC_CMD
{
58 WLAN_CMD_SET_HOSTAPD_STA
,
60 WLAN_CMD_SET_HOST_WEP
,
62 WLAN_CMD_GET_NODE_CNT
,
63 WLAN_CMD_ZONETYPE_SET
,
64 WLAN_CMD_GET_NODE_LIST
66 } WMAC_CMD
, *PWMAC_CMD
;
68 typedef enum tagWZONETYPE
{
79 #define ADHOC_STARTED 1
80 #define ADHOC_JOINTED 2
87 #define SSID_MAXLEN 32
90 #define WEP_KEYMAXLEN 29
91 #define WEP_40BIT_LEN 5
92 #define WEP_104BIT_LEN 13
93 #define WEP_232BIT_LEN 16
95 // Ioctl interface structure
98 typedef struct tagSCmdRequest
{
103 } __packed SCmdRequest
, *PSCmdRequest
;
109 typedef struct tagSCmdScan
{
111 u8 ssid
[SSID_MAXLEN
+ 2];
113 } __packed SCmdScan
, *PSCmdScan
;
119 typedef struct tagSCmdBSSJoin
{
123 u8 ssid
[SSID_MAXLEN
+ 2];
128 } __packed SCmdBSSJoin
, *PSCmdBSSJoin
;
134 typedef struct tagSCmdZoneTypeSet
{
139 } __packed SCmdZoneTypeSet
, *PSCmdZoneTypeSet
;
141 typedef struct tagSWPAResult
{
147 } __packed SWPAResult
, *PSWPAResult
;
149 typedef struct tagSCmdStartAP
{
153 u8 ssid
[SSID_MAXLEN
+ 2];
159 } __packed SCmdStartAP
, *PSCmdStartAP
;
161 typedef struct tagSCmdSetWEP
{
165 u8 abyWepKey
[WEP_NKEYS
][WEP_KEYMAXLEN
];
166 bool bWepKeyAvailable
[WEP_NKEYS
];
167 u32 auWepKeyLength
[WEP_NKEYS
];
169 } __packed SCmdSetWEP
, *PSCmdSetWEP
;
171 typedef struct tagSBSSIDItem
{
174 u8 abyBSSID
[BSSID_LEN
];
175 u8 abySSID
[SSID_MAXLEN
+ 1];
182 } __packed SBSSIDItem
;
185 typedef struct tagSBSSIDList
{
188 SBSSIDItem sBSSIDList
[0];
189 } __packed SBSSIDList
, *PSBSSIDList
;
192 typedef struct tagSNodeItem
{
203 u8 abyWepKey
[WEP_KEYMAXLEN
];
204 // Auto rate fallback vars
210 } __packed SNodeItem
;
213 typedef struct tagSNodeList
{
216 SNodeItem sNodeList
[0];
218 } __packed SNodeList
, *PSNodeList
;
221 typedef struct tagSCmdLinkStatus
{
226 u8 abyBSSID
[BSSID_LEN
];
227 u8 abySSID
[SSID_MAXLEN
+ 2];
231 } __packed SCmdLinkStatus
, *PSCmdLinkStatus
;
236 typedef struct tagSDot11MIBCount
{
237 u32 TransmittedFragmentCount
;
238 u32 MulticastTransmittedFrameCount
;
241 u32 MultipleRetryCount
;
245 u32 FrameDuplicateCount
;
246 u32 ReceivedFragmentCount
;
247 u32 MulticastReceivedFrameCount
;
249 } __packed SDot11MIBCount
, *PSDot11MIBCount
;
256 typedef struct tagSStatMIBCount
{
266 u32 dwIsrUnrecoverableError
;
267 u32 dwIsrSoftInterrupt
;
269 /////////////////////////////////////
271 u32 dwIsrUnknown
; /* unknown interrupt count */
282 u32 dwNewRsrShortPreamble
;
298 // for some optional OIDs (64 bits) and DMI support
299 u32 ullRxBroadcastBytes
;
300 u32 ullRxMulticastBytes
;
301 u32 ullRxDirectedBytes
;
302 u32 ullRxBroadcastFrames
;
303 u32 ullRxMulticastFrames
;
304 u32 ullRxDirectedFrames
;
308 u32 dwRsrRxFrmLen65_127
;
309 u32 dwRsrRxFrmLen128_255
;
310 u32 dwRsrRxFrmLen256_511
;
311 u32 dwRsrRxFrmLen512_1023
;
312 u32 dwRsrRxFrmLen1024_1518
;
314 // TSR0,1 status count
316 u32 dwTsrTotalRetry
[2]; /* total collision retry count */
317 u32 dwTsrOnceRetry
[2]; /* this packet had one collision */
318 u32 dwTsrMoreThanOnceRetry
[2]; /* this packet had many collisions */
319 u32 dwTsrRetry
[2]; /* this packet has ever occur collision,
320 * that is (dwTsrOnceCollision0 plus
321 * dwTsrMoreThanOnceCollision0) */
325 u32 dwTsrRetryTimeout
[2];
326 u32 dwTsrTransmitTimeout
[2];
328 u32 dwTsrTxPacket
[2];
330 u32 dwTsrBroadcast
[2];
331 u32 dwTsrMulticast
[2];
332 u32 dwTsrDirected
[2];
335 u32 dwCntRxFrmLength
;
336 u32 dwCntTxBufLength
;
338 u8 abyCntRxPattern
[16];
339 u8 abyCntTxPattern
[16];
341 /* Software check.... */
342 u32 dwCntRxDataErr
; /* rx buffer data CRC err count */
343 u32 dwCntDecryptErr
; /* rx buffer data CRC err count */
344 u32 dwCntRxICVErr
; /* rx buffer data CRC err count */
345 u32 idxRxErrorDesc
; /* index for rx data error RD */
350 // for some optional OIDs (64 bits) and DMI support
351 u32 ullTxBroadcastFrames
[2];
352 u32 ullTxMulticastFrames
[2];
353 u32 ullTxDirectedFrames
[2];
354 u32 ullTxBroadcastBytes
[2];
355 u32 ullTxMulticastBytes
[2];
356 u32 ullTxDirectedBytes
[2];
357 } __packed SStatMIBCount
, *PSStatMIBCount
;
359 typedef struct tagSCmdValue
{
363 } __packed SCmdValue
, *PSCmdValue
;
366 // hostapd & viawget ioctl related
369 // VIAGWET_IOCTL_HOSTAPD ioctl() cmd:
371 VIAWGET_HOSTAPD_FLUSH
= 1,
372 VIAWGET_HOSTAPD_ADD_STA
= 2,
373 VIAWGET_HOSTAPD_REMOVE_STA
= 3,
374 VIAWGET_HOSTAPD_GET_INFO_STA
= 4,
375 VIAWGET_HOSTAPD_SET_ENCRYPTION
= 5,
376 VIAWGET_HOSTAPD_GET_ENCRYPTION
= 6,
377 VIAWGET_HOSTAPD_SET_FLAGS_STA
= 7,
378 VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR
= 8,
379 VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT
= 9,
380 VIAWGET_HOSTAPD_MLME
= 10,
381 VIAWGET_HOSTAPD_SCAN_REQ
= 11,
382 VIAWGET_HOSTAPD_STA_CLEAR_STATS
= 12,
385 #define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
386 ((int) (&((struct viawget_hostapd_param *) 0)->u.generic_elem.data))
388 // Maximum length for algorithm names (-1 for nul termination) used in ioctl()
390 struct viawget_hostapd_param
{
435 /*--------------------- Export Classes ----------------------------*/
437 /*--------------------- Export Variables --------------------------*/
439 /*--------------------- Export Types ------------------------------*/
441 /*--------------------- Export Functions --------------------------*/
443 #endif /* __IOCMD_H__ */