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
33 #define MAGIC_CODE 0x3142
34 #define IOCTL_CMD_TEST (SIOCDEVPRIVATE + 0)
35 #define IOCTL_CMD_SET (SIOCDEVPRIVATE + 1)
36 #define IOCTL_CMD_HOSTAPD (SIOCDEVPRIVATE + 2)
37 #define IOCTL_CMD_WPA (SIOCDEVPRIVATE + 3)
39 typedef enum tagWMAC_CMD
{
54 WLAN_CMD_SET_HOSTAPD_STA
,
56 WLAN_CMD_SET_HOST_WEP
,
58 WLAN_CMD_GET_NODE_CNT
,
59 WLAN_CMD_ZONETYPE_SET
,
60 WLAN_CMD_GET_NODE_LIST
62 } WMAC_CMD
, *PWMAC_CMD
;
64 typedef enum tagWZONETYPE
{
75 #define ADHOC_STARTED 1
76 #define ADHOC_JOINTED 2
83 #define SSID_MAXLEN 32
86 #define WEP_KEYMAXLEN 29
87 #define WEP_40BIT_LEN 5
88 #define WEP_104BIT_LEN 13
89 #define WEP_232BIT_LEN 16
91 // Ioctl interface structure
94 typedef struct tagSCmdRequest
{
99 } __packed SCmdRequest
, *PSCmdRequest
;
105 typedef struct tagSCmdScan
{
107 u8 ssid
[SSID_MAXLEN
+ 2];
109 } __packed SCmdScan
, *PSCmdScan
;
115 typedef struct tagSCmdBSSJoin
{
119 u8 ssid
[SSID_MAXLEN
+ 2];
124 } __packed SCmdBSSJoin
, *PSCmdBSSJoin
;
130 typedef struct tagSCmdZoneTypeSet
{
135 } __packed SCmdZoneTypeSet
, *PSCmdZoneTypeSet
;
137 typedef struct tagSWPAResult
{
143 } __packed SWPAResult
, *PSWPAResult
;
145 typedef struct tagSCmdStartAP
{
149 u8 ssid
[SSID_MAXLEN
+ 2];
155 } __packed SCmdStartAP
, *PSCmdStartAP
;
157 typedef struct tagSCmdSetWEP
{
161 u8 abyWepKey
[WEP_NKEYS
][WEP_KEYMAXLEN
];
162 bool bWepKeyAvailable
[WEP_NKEYS
];
163 u32 auWepKeyLength
[WEP_NKEYS
];
165 } __packed SCmdSetWEP
, *PSCmdSetWEP
;
167 typedef struct tagSBSSIDItem
{
170 u8 abyBSSID
[BSSID_LEN
];
171 u8 abySSID
[SSID_MAXLEN
+ 1];
178 } __packed SBSSIDItem
;
180 typedef struct tagSBSSIDList
{
183 SBSSIDItem sBSSIDList
[0];
184 } __packed SBSSIDList
, *PSBSSIDList
;
186 typedef struct tagSNodeItem
{
197 u8 abyWepKey
[WEP_KEYMAXLEN
];
198 // Auto rate fallback vars
204 } __packed SNodeItem
;
206 typedef struct tagSNodeList
{
209 SNodeItem sNodeList
[0];
211 } __packed SNodeList
, *PSNodeList
;
213 typedef struct tagSCmdLinkStatus
{
218 u8 abyBSSID
[BSSID_LEN
];
219 u8 abySSID
[SSID_MAXLEN
+ 2];
223 } __packed SCmdLinkStatus
, *PSCmdLinkStatus
;
228 typedef struct tagSDot11MIBCount
{
229 u32 TransmittedFragmentCount
;
230 u32 MulticastTransmittedFrameCount
;
233 u32 MultipleRetryCount
;
237 u32 FrameDuplicateCount
;
238 u32 ReceivedFragmentCount
;
239 u32 MulticastReceivedFrameCount
;
241 } __packed 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 had one collision */
308 u32 dwTsrMoreThanOnceRetry
[2]; /* this packet had many collisions */
309 u32 dwTsrRetry
[2]; /* this packet has ever occur collision,
310 * that is (dwTsrOnceCollision0 plus
311 * dwTsrMoreThanOnceCollision0) */
315 u32 dwTsrRetryTimeout
[2];
316 u32 dwTsrTransmitTimeout
[2];
318 u32 dwTsrTxPacket
[2];
320 u32 dwTsrBroadcast
[2];
321 u32 dwTsrMulticast
[2];
322 u32 dwTsrDirected
[2];
325 u32 dwCntRxFrmLength
;
326 u32 dwCntTxBufLength
;
328 u8 abyCntRxPattern
[16];
329 u8 abyCntTxPattern
[16];
331 /* Software check.... */
332 u32 dwCntRxDataErr
; /* rx buffer data CRC err count */
333 u32 dwCntDecryptErr
; /* rx buffer data CRC err count */
334 u32 dwCntRxICVErr
; /* rx buffer data CRC err count */
335 u32 idxRxErrorDesc
; /* index for rx data error RD */
340 // for some optional OIDs (64 bits) and DMI support
341 u32 ullTxBroadcastFrames
[2];
342 u32 ullTxMulticastFrames
[2];
343 u32 ullTxDirectedFrames
[2];
344 u32 ullTxBroadcastBytes
[2];
345 u32 ullTxMulticastBytes
[2];
346 u32 ullTxDirectedBytes
[2];
347 } __packed SStatMIBCount
, *PSStatMIBCount
;
349 typedef struct tagSCmdValue
{
353 } __packed SCmdValue
, *PSCmdValue
;
356 // hostapd & viawget ioctl related
359 // VIAGWET_IOCTL_HOSTAPD ioctl() cmd:
361 VIAWGET_HOSTAPD_FLUSH
= 1,
362 VIAWGET_HOSTAPD_ADD_STA
= 2,
363 VIAWGET_HOSTAPD_REMOVE_STA
= 3,
364 VIAWGET_HOSTAPD_GET_INFO_STA
= 4,
365 VIAWGET_HOSTAPD_SET_ENCRYPTION
= 5,
366 VIAWGET_HOSTAPD_GET_ENCRYPTION
= 6,
367 VIAWGET_HOSTAPD_SET_FLAGS_STA
= 7,
368 VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR
= 8,
369 VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT
= 9,
370 VIAWGET_HOSTAPD_MLME
= 10,
371 VIAWGET_HOSTAPD_SCAN_REQ
= 11,
372 VIAWGET_HOSTAPD_STA_CLEAR_STATS
= 12,
375 #define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
376 ((int) (&((struct viawget_hostapd_param *) 0)->u.generic_elem.data))
378 // Maximum length for algorithm names (-1 for nul termination) used in ioctl()
380 struct viawget_hostapd_param
{
425 #endif /* __IOCMD_H__ */