• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6.36/drivers/staging/vt6656/
1/*
2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3 * All rights reserved.
4 *
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.
9 *
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.
14 *
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.
18 *
19 * File: iocmd.h
20 *
21 * Purpose: Handles the viawget ioctl private interface functions
22 *
23 * Author: Lyndon Chen
24 *
25 * Date: May 8, 2002
26 *
27 */
28
29#ifndef __IOCMD_H__
30#define __IOCMD_H__
31
32#include "ttype.h"
33
34/*---------------------  Export Definitions -------------------------*/
35
36#if !defined(DEF)
37#define DEF
38#endif
39
40// ioctl Command code
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)
46
47typedef enum tagWMAC_CMD {
48
49    WLAN_CMD_BSS_SCAN,
50    WLAN_CMD_BSS_JOIN,
51    WLAN_CMD_DISASSOC,
52    WLAN_CMD_SET_WEP,
53    WLAN_CMD_GET_LINK,
54    WLAN_CMD_GET_LISTLEN,
55    WLAN_CMD_GET_LIST,
56    WLAN_CMD_GET_MIB,
57    WLAN_CMD_GET_STAT,
58    WLAN_CMD_STOP_MAC,
59    WLAN_CMD_START_MAC,
60    WLAN_CMD_AP_START,
61    WLAN_CMD_SET_HOSTAPD,
62    WLAN_CMD_SET_HOSTAPD_STA,
63    WLAN_CMD_SET_802_1X,
64    WLAN_CMD_SET_HOST_WEP,
65    WLAN_CMD_SET_WPA,
66    WLAN_CMD_GET_NODE_CNT,
67    WLAN_CMD_ZONETYPE_SET,
68    WLAN_CMD_GET_NODE_LIST
69
70} WMAC_CMD, *PWMAC_CMD;
71
72typedef enum tagWZONETYPE {
73  ZoneType_USA = 0,
74  ZoneType_Japan = 1,
75  ZoneType_Europe = 2
76} WZONETYPE;
77
78#define ADHOC	0
79#define INFRA	1
80#define BOTH	2
81#define AP	    3
82
83#define ADHOC_STARTED	   1
84#define ADHOC_JOINTED	   2
85
86#define PHY80211a 0
87#define PHY80211b 1
88#define PHY80211g 2
89
90#define SSID_ID                0
91#define SSID_MAXLEN            32
92#define BSSID_LEN              6
93#define WEP_NKEYS              4
94#define WEP_KEYMAXLEN          29
95#define WEP_40BIT_LEN          5
96#define WEP_104BIT_LEN         13
97#define WEP_232BIT_LEN         16
98
99// Ioctl interface structure
100// Command structure
101//
102#pragma pack(1)
103typedef struct tagSCmdRequest {
104	u8 name[16];
105	void	*data;
106	u16	    wResult;
107	u16     wCmdCode;
108} SCmdRequest, *PSCmdRequest;
109
110//
111// Scan
112//
113
114typedef struct tagSCmdScan {
115
116    u8	    ssid[SSID_MAXLEN + 2];
117
118} SCmdScan, *PSCmdScan;
119
120//
121// BSS Join
122//
123
124typedef struct tagSCmdBSSJoin {
125
126    u16	    wBSSType;
127    u16     wBBPType;
128    u8	    ssid[SSID_MAXLEN + 2];
129    u32	    uChannel;
130    BOOL    bPSEnable;
131    BOOL    bShareKeyAuth;
132
133} SCmdBSSJoin, *PSCmdBSSJoin;
134
135//
136// Zonetype Setting
137//
138
139typedef struct tagSCmdZoneTypeSet {
140
141 BOOL       bWrite;
142 WZONETYPE  ZoneType;
143
144} SCmdZoneTypeSet, *PSCmdZoneTypeSet;
145
146typedef struct tagSWPAResult {
147         char	ifname[100];
148	u8 proto;
149	u8 key_mgmt;
150	u8 eap_type;
151         BOOL authenticated;
152} SWPAResult, *PSWPAResult;
153
154typedef struct tagSCmdStartAP {
155
156    u16	    wBSSType;
157    u16     wBBPType;
158    u8	    ssid[SSID_MAXLEN + 2];
159	u32 uChannel;
160	u32 uBeaconInt;
161    BOOL    bShareKeyAuth;
162    u8      byBasicRate;
163
164} SCmdStartAP, *PSCmdStartAP;
165
166typedef struct tagSCmdSetWEP {
167
168    BOOL    bEnableWep;
169    u8      byKeyIndex;
170    u8      abyWepKey[WEP_NKEYS][WEP_KEYMAXLEN];
171    BOOL    bWepKeyAvailable[WEP_NKEYS];
172    u32     auWepKeyLength[WEP_NKEYS];
173
174} SCmdSetWEP, *PSCmdSetWEP;
175
176typedef struct tagSBSSIDItem {
177
178	u32	    uChannel;
179    u8      abyBSSID[BSSID_LEN];
180    u8      abySSID[SSID_MAXLEN + 1];
181    u16	    wBeaconInterval;
182    u16	    wCapInfo;
183    u8      byNetType;
184    BOOL    bWEPOn;
185    u32     uRSSI;
186
187} SBSSIDItem;
188
189
190typedef struct tagSBSSIDList {
191
192	u32		    uItem;
193	SBSSIDItem	sBSSIDList[0];
194} SBSSIDList, *PSBSSIDList;
195
196
197typedef struct tagSNodeItem {
198    // STA info
199    u16            wAID;
200    u8             abyMACAddr[6];
201    u16            wTxDataRate;
202    u16            wInActiveCount;
203    u16            wEnQueueCnt;
204    u16            wFlags;
205    BOOL           bPWBitOn;
206    u8             byKeyIndex;
207    u16            wWepKeyLength;
208    u8            abyWepKey[WEP_KEYMAXLEN];
209    // Auto rate fallback vars
210    BOOL           bIsInFallback;
211    u32            uTxFailures;
212    u32            uTxAttempts;
213    u16            wFailureRatio;
214
215} SNodeItem;
216
217
218typedef struct tagSNodeList {
219
220	u32		    uItem;
221	SNodeItem	sNodeList[0];
222
223} SNodeList, *PSNodeList;
224
225
226typedef struct tagSCmdLinkStatus {
227
228    BOOL    bLink;
229	u16	    wBSSType;
230	u8      byState;
231    u8      abyBSSID[BSSID_LEN];
232    u8      abySSID[SSID_MAXLEN + 2];
233    u32     uChannel;
234    u32     uLinkRate;
235
236} SCmdLinkStatus, *PSCmdLinkStatus;
237
238//
239// 802.11 counter
240//
241typedef struct tagSDot11MIBCount {
242    u32 TransmittedFragmentCount;
243    u32 MulticastTransmittedFrameCount;
244    u32 FailedCount;
245    u32 RetryCount;
246    u32 MultipleRetryCount;
247    u32 RTSSuccessCount;
248    u32 RTSFailureCount;
249    u32 ACKFailureCount;
250    u32 FrameDuplicateCount;
251    u32 ReceivedFragmentCount;
252    u32 MulticastReceivedFrameCount;
253    u32 FCSErrorCount;
254} SDot11MIBCount, *PSDot11MIBCount;
255
256
257
258//
259// statistic counter
260//
261typedef struct tagSStatMIBCount {
262    //
263    // ISR status count
264    //
265    u32   dwIsrTx0OK;
266    u32   dwIsrTx1OK;
267    u32   dwIsrBeaconTxOK;
268    u32   dwIsrRxOK;
269    u32   dwIsrTBTTInt;
270    u32   dwIsrSTIMERInt;
271    u32   dwIsrUnrecoverableError;
272    u32   dwIsrSoftInterrupt;
273    u32   dwIsrRxNoBuf;
274    /////////////////////////////////////
275
276	u32 dwIsrUnknown; /* unknown interrupt count */
277
278    // RSR status count
279    //
280    u32   dwRsrFrmAlgnErr;
281    u32   dwRsrErr;
282    u32   dwRsrCRCErr;
283    u32   dwRsrCRCOk;
284    u32   dwRsrBSSIDOk;
285    u32   dwRsrADDROk;
286    u32   dwRsrICVOk;
287    u32   dwNewRsrShortPreamble;
288    u32   dwRsrLong;
289    u32   dwRsrRunt;
290
291    u32   dwRsrRxControl;
292    u32   dwRsrRxData;
293    u32   dwRsrRxManage;
294
295    u32   dwRsrRxPacket;
296    u32   dwRsrRxOctet;
297    u32   dwRsrBroadcast;
298    u32   dwRsrMulticast;
299    u32   dwRsrDirected;
300    // 64-bit OID
301    u32   ullRsrOK;
302
303    // for some optional OIDs (64 bits) and DMI support
304    u32   ullRxBroadcastBytes;
305    u32   ullRxMulticastBytes;
306    u32   ullRxDirectedBytes;
307    u32   ullRxBroadcastFrames;
308    u32   ullRxMulticastFrames;
309    u32   ullRxDirectedFrames;
310
311    u32   dwRsrRxFragment;
312    u32   dwRsrRxFrmLen64;
313    u32   dwRsrRxFrmLen65_127;
314    u32   dwRsrRxFrmLen128_255;
315    u32   dwRsrRxFrmLen256_511;
316    u32   dwRsrRxFrmLen512_1023;
317    u32   dwRsrRxFrmLen1024_1518;
318
319    // TSR0,1 status count
320    //
321	u32 dwTsrTotalRetry[2];        /* total collision retry count */
322	u32 dwTsrOnceRetry[2];         /* this packet had one collision */
323	u32 dwTsrMoreThanOnceRetry[2]; /* this packet had many collisions */
324	u32 dwTsrRetry[2];             /* this packet has ever occur collision,
325					* that is (dwTsrOnceCollision0 plus
326					* dwTsrMoreThanOnceCollision0) */
327    u32   dwTsrACKData[2];
328    u32   dwTsrErr[2];
329    u32   dwAllTsrOK[2];
330    u32   dwTsrRetryTimeout[2];
331    u32   dwTsrTransmitTimeout[2];
332
333    u32   dwTsrTxPacket[2];
334    u32   dwTsrTxOctet[2];
335    u32   dwTsrBroadcast[2];
336    u32   dwTsrMulticast[2];
337    u32   dwTsrDirected[2];
338
339    // RD/TD count
340    u32   dwCntRxFrmLength;
341    u32   dwCntTxBufLength;
342
343    u8    abyCntRxPattern[16];
344    u8    abyCntTxPattern[16];
345
346	/* Software check.... */
347	u32 dwCntRxDataErr;  /* rx buffer data CRC err count */
348	u32 dwCntDecryptErr; /* rx buffer data CRC err count */
349	u32 dwCntRxICVErr;   /* rx buffer data CRC err count */
350	u32 idxRxErrorDesc;  /* index for rx data error RD */
351
352	/* 64-bit OID */
353	u32   ullTsrOK[2];
354
355    // for some optional OIDs (64 bits) and DMI support
356    u32   ullTxBroadcastFrames[2];
357    u32   ullTxMulticastFrames[2];
358    u32   ullTxDirectedFrames[2];
359    u32   ullTxBroadcastBytes[2];
360    u32   ullTxMulticastBytes[2];
361    u32   ullTxDirectedBytes[2];
362} SStatMIBCount, *PSStatMIBCount;
363
364typedef struct tagSCmdValue {
365
366    u32     dwValue;
367
368} SCmdValue,  *PSCmdValue;
369
370//
371// hostapd & viawget ioctl related
372//
373
374// VIAGWET_IOCTL_HOSTAPD ioctl() cmd:
375enum {
376	VIAWGET_HOSTAPD_FLUSH = 1,
377	VIAWGET_HOSTAPD_ADD_STA = 2,
378	VIAWGET_HOSTAPD_REMOVE_STA = 3,
379	VIAWGET_HOSTAPD_GET_INFO_STA = 4,
380	VIAWGET_HOSTAPD_SET_ENCRYPTION = 5,
381	VIAWGET_HOSTAPD_GET_ENCRYPTION = 6,
382	VIAWGET_HOSTAPD_SET_FLAGS_STA = 7,
383	VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR = 8,
384	VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT = 9,
385	VIAWGET_HOSTAPD_MLME = 10,
386	VIAWGET_HOSTAPD_SCAN_REQ = 11,
387	VIAWGET_HOSTAPD_STA_CLEAR_STATS = 12,
388};
389
390#define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
391((int) (&((struct viawget_hostapd_param *) 0)->u.generic_elem.data))
392
393// Maximum length for algorithm names (-1 for nul termination) used in ioctl()
394
395struct viawget_hostapd_param {
396	u32 cmd;
397	u8 sta_addr[6];
398	union {
399		struct {
400			u16 aid;
401			u16 capability;
402			u8 tx_supp_rates;
403		} add_sta;
404		struct {
405			u32 inactive_sec;
406		} get_info_sta;
407		struct {
408			u8 alg;
409			u32 flags;
410			u32 err;
411			u8 idx;
412			u8 seq[8];
413			u16 key_len;
414			u8 key[0];
415		} crypt;
416		struct {
417			u32 flags_and;
418			u32 flags_or;
419		} set_flags_sta;
420		struct {
421			u16 rid;
422			u16 len;
423			u8 data[0];
424		} rid;
425		struct {
426			u8 len;
427			u8 data[0];
428		} generic_elem;
429		struct {
430			u16 cmd;
431			u16 reason_code;
432		} mlme;
433		struct {
434			u8 ssid_len;
435			u8 ssid[32];
436		} scan_req;
437	} u;
438};
439
440/*---------------------  Export Classes  ----------------------------*/
441
442/*---------------------  Export Variables  --------------------------*/
443
444/*---------------------  Export Types  ------------------------------*/
445
446/*---------------------  Export Functions  --------------------------*/
447
448#endif /* __IOCMD_H__ */
449