1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53#ifndef _LINUX_P80211NETDEV_H
54#define _LINUX_P80211NETDEV_H
55
56#include <linux/interrupt.h>
57#include <linux/wireless.h>
58#include <linux/netdevice.h>
59
60#undef netdevice_t
61typedef struct net_device netdevice_t;
62
63#define WLAN_RELEASE "0.3.0-staging"
64
65#define WLAN_DEVICE_CLOSED 0
66#define WLAN_DEVICE_OPEN 1
67
68#define WLAN_MACMODE_NONE 0
69#define WLAN_MACMODE_IBSS_STA 1
70#define WLAN_MACMODE_ESS_STA 2
71#define WLAN_MACMODE_ESS_AP 3
72
73
74#define WLAN_MSD_HWPRESENT_PENDING 1
75#define WLAN_MSD_HWFAIL 2
76#define WLAN_MSD_HWPRESENT 3
77#define WLAN_MSD_FWLOAD_PENDING 4
78#define WLAN_MSD_FWLOAD 5
79#define WLAN_MSD_RUNNING_PENDING 6
80#define WLAN_MSD_RUNNING 7
81
82#ifndef ETH_P_ECONET
83#define ETH_P_ECONET 0x0018
84#endif
85
86#define ETH_P_80211_RAW (ETH_P_ECONET + 1)
87
88#ifndef ARPHRD_IEEE80211
89#define ARPHRD_IEEE80211 801
90#endif
91
92#ifndef ARPHRD_IEEE80211_PRISM
93#define ARPHRD_IEEE80211_PRISM 802
94#endif
95
96
97#define P80211_NSDCAP_HARDWAREWEP 0x01
98#define P80211_NSDCAP_SHORT_PREAMBLE 0x10
99#define P80211_NSDCAP_HWFRAGMENT 0x80
100#define P80211_NSDCAP_AUTOJOIN 0x100
101#define P80211_NSDCAP_NOSCAN 0x200
102
103
104typedef struct p80211_frmrx_t {
105 u32 mgmt;
106 u32 assocreq;
107 u32 assocresp;
108 u32 reassocreq;
109 u32 reassocresp;
110 u32 probereq;
111 u32 proberesp;
112 u32 beacon;
113 u32 atim;
114 u32 disassoc;
115 u32 authen;
116 u32 deauthen;
117 u32 mgmt_unknown;
118 u32 ctl;
119 u32 pspoll;
120 u32 rts;
121 u32 cts;
122 u32 ack;
123 u32 cfend;
124 u32 cfendcfack;
125 u32 ctl_unknown;
126 u32 data;
127 u32 dataonly;
128 u32 data_cfack;
129 u32 data_cfpoll;
130 u32 data__cfack_cfpoll;
131 u32 null;
132 u32 cfack;
133 u32 cfpoll;
134 u32 cfack_cfpoll;
135 u32 data_unknown;
136 u32 decrypt;
137 u32 decrypt_err;
138} p80211_frmrx_t;
139
140
141struct iw_statistics *p80211wext_get_wireless_stats(netdevice_t *dev);
142
143extern struct iw_handler_def p80211wext_handler_def;
144
145
146#define NUM_WEPKEYS 4
147#define MAX_KEYLEN 32
148
149#define HOSTWEP_DEFAULTKEY_MASK (BIT(1)|BIT(0))
150#define HOSTWEP_SHAREDKEY BIT(3)
151#define HOSTWEP_DECRYPT BIT(4)
152#define HOSTWEP_ENCRYPT BIT(5)
153#define HOSTWEP_PRIVACYINVOKED BIT(6)
154#define HOSTWEP_EXCLUDEUNENCRYPTED BIT(7)
155
156extern int wlan_watchdog;
157extern int wlan_wext_write;
158
159
160typedef struct wlandevice {
161 void *priv;
162
163
164 char name[WLAN_DEVNAMELEN_MAX];
165 char *nsdname;
166
167 u32 state;
168 u32 msdstate;
169 u32 hwremoved;
170
171
172 unsigned int irq;
173 unsigned int iobase;
174 unsigned int membase;
175 u32 nsdcaps;
176
177
178 unsigned int ethconv;
179
180
181 int (*open)(struct wlandevice *wlandev);
182 int (*close)(struct wlandevice *wlandev);
183 void (*reset)(struct wlandevice *wlandev);
184 int (*txframe)(struct wlandevice *wlandev, struct sk_buff *skb,
185 union p80211_hdr *p80211_hdr,
186 struct p80211_metawep *p80211_wep);
187 int (*mlmerequest)(struct wlandevice *wlandev, struct p80211msg *msg);
188 int (*set_multicast_list)(struct wlandevice *wlandev,
189 netdevice_t *dev);
190 void (*tx_timeout)(struct wlandevice *wlandev);
191
192
193 u8 bssid[WLAN_BSSID_LEN];
194 p80211pstr32_t ssid;
195 u32 macmode;
196 int linkstatus;
197
198
199 u8 wep_keys[NUM_WEPKEYS][MAX_KEYLEN];
200 u8 wep_keylens[NUM_WEPKEYS];
201 int hostwep;
202
203
204 unsigned long request_pending;
205
206
207
208
209 netdevice_t *netdev;
210
211
212 struct tasklet_struct rx_bh;
213
214 struct sk_buff_head nsd_rxq;
215
216
217 struct p80211_frmrx_t rx;
218
219 struct iw_statistics wstats;
220
221
222 u8 spy_number;
223 char spy_address[IW_MAX_SPY][ETH_ALEN];
224 struct iw_quality spy_stat[IW_MAX_SPY];
225} wlandevice_t;
226
227
228int wep_change_key(wlandevice_t *wlandev, int keynum, u8 *key, int keylen);
229int wep_decrypt(wlandevice_t *wlandev, u8 *buf, u32 len, int key_override,
230 u8 *iv, u8 *icv);
231int wep_encrypt(wlandevice_t *wlandev, u8 *buf, u8 *dst, u32 len, int keynum,
232 u8 *iv, u8 *icv);
233
234int wlan_setup(wlandevice_t *wlandev, struct device *physdev);
235void wlan_unsetup(wlandevice_t *wlandev);
236int register_wlandev(wlandevice_t *wlandev);
237int unregister_wlandev(wlandevice_t *wlandev);
238void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff *skb);
239void p80211netdev_hwremoved(wlandevice_t *wlandev);
240#endif
241