1 /*
2  *	Copyright (c) 2004, 2005 Jeroen Vreeken (pe1rxq@amsat.org)
3  *
4  *	This program is free software; you can redistribute it and/or
5  *	modify it under the terms of the GNU General Public License
6  *	version 2 as published by the Free Software Foundation.
7  *
8  *	Parts of this driver have been derived from a wlan-ng version
9  *	modified by ZyDAS.
10  *	Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.
11  */
12 
13 #ifndef _INCLUDE_ZD1201_H_
14 #define _INCLUDE_ZD1201_H_
15 
16 #define ZD1201_NUMKEYS		4
17 #define ZD1201_MAXKEYLEN	13
18 #define ZD1201_MAXMULTI		16
19 #define ZD1201_FRAGMAX		2500
20 #define ZD1201_FRAGMIN		256
21 #define ZD1201_RTSMAX		2500
22 
23 #define ZD1201_RXSIZE		3000
24 
25 struct zd1201 {
26 	struct usb_device	*usb;
27 	int			removed;
28 	struct net_device	*dev;
29 	struct iw_statistics	iwstats;
30 
31 	int			endp_in;
32 	int			endp_out;
33 	int			endp_out2;
34 	struct urb		*rx_urb;
35 	struct urb		*tx_urb;
36 
37 	unsigned char 		rxdata[ZD1201_RXSIZE];
38 	int			rxlen;
39 	wait_queue_head_t	rxdataq;
40 	int			rxdatas;
41 	struct hlist_head	fraglist;
42 	unsigned char		txdata[ZD1201_RXSIZE];
43 
44 	int			ap;
45 	char			essid[IW_ESSID_MAX_SIZE+1];
46 	int			essidlen;
47 	int			mac_enabled;
48 	int			was_enabled;
49 	int			monitor;
50 	int			encode_enabled;
51 	int			encode_restricted;
52 	unsigned char		encode_keys[ZD1201_NUMKEYS][ZD1201_MAXKEYLEN];
53 	int			encode_keylen[ZD1201_NUMKEYS];
54 };
55 
56 struct zd1201_frag {
57 	struct hlist_node	fnode;
58 	int			seq;
59 	struct sk_buff		*skb;
60 };
61 
62 #define ZD1201SIWHOSTAUTH SIOCIWFIRSTPRIV
63 #define ZD1201GIWHOSTAUTH ZD1201SIWHOSTAUTH+1
64 #define ZD1201SIWAUTHSTA SIOCIWFIRSTPRIV+2
65 #define ZD1201SIWMAXASSOC SIOCIWFIRSTPRIV+4
66 #define ZD1201GIWMAXASSOC ZD1201SIWMAXASSOC+1
67 
68 #define ZD1201_FW_TIMEOUT	(1000)
69 
70 #define ZD1201_TX_TIMEOUT	(2000)
71 
72 #define ZD1201_USB_CMDREQ	0
73 #define ZD1201_USB_RESREQ	1
74 
75 #define	ZD1201_CMDCODE_INIT	0x00
76 #define ZD1201_CMDCODE_ENABLE	0x01
77 #define ZD1201_CMDCODE_DISABLE	0x02
78 #define ZD1201_CMDCODE_ALLOC	0x0a
79 #define ZD1201_CMDCODE_INQUIRE	0x11
80 #define ZD1201_CMDCODE_SETRXRID	0x17
81 #define ZD1201_CMDCODE_ACCESS	0x21
82 
83 #define ZD1201_PACKET_EVENTSTAT	0x0
84 #define ZD1201_PACKET_RXDATA	0x1
85 #define ZD1201_PACKET_INQUIRE	0x2
86 #define ZD1201_PACKET_RESOURCE	0x3
87 
88 #define ZD1201_ACCESSBIT	0x0100
89 
90 #define ZD1201_RID_CNFPORTTYPE		0xfc00
91 #define ZD1201_RID_CNFOWNMACADDR	0xfc01
92 #define ZD1201_RID_CNFDESIREDSSID	0xfc02
93 #define ZD1201_RID_CNFOWNCHANNEL	0xfc03
94 #define ZD1201_RID_CNFOWNSSID		0xfc04
95 #define ZD1201_RID_CNFMAXDATALEN	0xfc07
96 #define ZD1201_RID_CNFPMENABLED		0xfc09
97 #define ZD1201_RID_CNFPMEPS		0xfc0a
98 #define ZD1201_RID_CNFMAXSLEEPDURATION	0xfc0c
99 #define ZD1201_RID_CNFDEFAULTKEYID	0xfc23
100 #define ZD1201_RID_CNFDEFAULTKEY0	0xfc24
101 #define ZD1201_RID_CNFDEFAULTKEY1	0xfc25
102 #define ZD1201_RID_CNFDEFAULTKEY2	0xfc26
103 #define ZD1201_RID_CNFDEFAULTKEY3	0xfc27
104 #define ZD1201_RID_CNFWEBFLAGS		0xfc28
105 #define ZD1201_RID_CNFAUTHENTICATION	0xfc2a
106 #define ZD1201_RID_CNFMAXASSOCSTATIONS	0xfc2b
107 #define ZD1201_RID_CNFHOSTAUTH		0xfc2e
108 #define ZD1201_RID_CNFGROUPADDRESS	0xfc80
109 #define ZD1201_RID_CNFFRAGTHRESHOLD	0xfc82
110 #define ZD1201_RID_CNFRTSTHRESHOLD	0xfc83
111 #define ZD1201_RID_TXRATECNTL		0xfc84
112 #define ZD1201_RID_PROMISCUOUSMODE	0xfc85
113 #define ZD1201_RID_CNFBASICRATES	0xfcb3
114 #define ZD1201_RID_AUTHENTICATESTA	0xfce3
115 #define ZD1201_RID_CURRENTBSSID		0xfd42
116 #define ZD1201_RID_COMMSQUALITY		0xfd43
117 #define ZD1201_RID_CURRENTTXRATE	0xfd44
118 #define ZD1201_RID_CNFMAXTXBUFFERNUMBER	0xfda0
119 #define ZD1201_RID_CURRENTCHANNEL	0xfdc1
120 
121 #define ZD1201_INQ_SCANRESULTS		0xf101
122 
123 #define ZD1201_INF_LINKSTATUS		0xf200
124 #define ZD1201_INF_ASSOCSTATUS		0xf201
125 #define ZD1201_INF_AUTHREQ		0xf202
126 
127 #define ZD1201_ASSOCSTATUS_STAASSOC	0x1
128 #define ZD1201_ASSOCSTATUS_REASSOC	0x2
129 #define ZD1201_ASSOCSTATUS_DISASSOC	0x3
130 #define ZD1201_ASSOCSTATUS_ASSOCFAIL	0x4
131 #define ZD1201_ASSOCSTATUS_AUTHFAIL	0x5
132 
133 #define ZD1201_PORTTYPE_IBSS		0
134 #define ZD1201_PORTTYPE_BSS		1
135 #define ZD1201_PORTTYPE_WDS		2
136 #define ZD1201_PORTTYPE_PSEUDOIBSS	3
137 #define ZD1201_PORTTYPE_AP		6
138 
139 #define ZD1201_RATEB1	1
140 #define ZD1201_RATEB2	2
141 #define ZD1201_RATEB5	4	/* 5.5 really, but 5 is shorter :) */
142 #define ZD1201_RATEB11	8
143 
144 #define ZD1201_CNFAUTHENTICATION_OPENSYSTEM	0x0001
145 #define ZD1201_CNFAUTHENTICATION_SHAREDKEY	0x0002
146 
147 #endif /* _INCLUDE_ZD1201_H_ */
148