aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-03-22 22:55:57 -0500
committerJeff Garzik <jeff@garzik.org>2006-03-22 22:55:57 -0500
commitfa4fa40a990f8f4eff65476bef32007c154bbac0 (patch)
treec6e15822d1da2811ed004d3f8a4c72864adb5250 /include/net
parentb7ad6d75028d021362221d9b2db19fcff995c3f8 (diff)
parentfe0b06b123762ab620b5bee3dab1576ddddd0a7f (diff)
Merge branch 'upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6
Diffstat (limited to 'include/net')
-rw-r--r--include/net/ieee80211softmac.h292
-rw-r--r--include/net/ieee80211softmac_wx.h94
2 files changed, 386 insertions, 0 deletions
diff --git a/include/net/ieee80211softmac.h b/include/net/ieee80211softmac.h
new file mode 100644
index 000000000000..b971d8c82bdd
--- /dev/null
+++ b/include/net/ieee80211softmac.h
@@ -0,0 +1,292 @@
1/*
2 * ieee80211softmac.h - public interface to the softmac
3 *
4 * Copyright (c) 2005 Johannes Berg <johannes@sipsolutions.net>
5 * Joseph Jezak <josejx@gentoo.org>
6 * Larry Finger <Larry.Finger@lwfinger.net>
7 * Danny van Dyk <kugelfang@gentoo.org>
8 * Michael Buesch <mbuesch@freenet.de>
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 *
23 * The full GNU General Public License is included in this distribution in the
24 * file called COPYING.
25 */
26
27#ifndef IEEE80211SOFTMAC_H_
28#define IEEE80211SOFTMAC_H_
29
30#include <linux/kernel.h>
31#include <linux/spinlock.h>
32#include <linux/workqueue.h>
33#include <linux/list.h>
34#include <net/ieee80211.h>
35
36/* Once the API is considered more or less stable,
37 * this should be incremented on API incompatible changes.
38 */
39#define IEEE80211SOFTMAC_API 0
40
41#define IEEE80211SOFTMAC_MAX_RATES_LEN 8
42#define IEEE80211SOFTMAC_MAX_EX_RATES_LEN 255
43
44struct ieee80211softmac_ratesinfo {
45 u8 count;
46 u8 rates[IEEE80211SOFTMAC_MAX_RATES_LEN + IEEE80211SOFTMAC_MAX_EX_RATES_LEN];
47};
48
49/* internal structures */
50struct ieee80211softmac_network;
51struct ieee80211softmac_scaninfo;
52
53struct ieee80211softmac_essid {
54 u8 len;
55 char data[IW_ESSID_MAX_SIZE+1];
56};
57
58struct ieee80211softmac_wpa {
59 char *IE;
60 int IElen;
61 int IEbuflen;
62};
63
64/*
65 * Information about association
66 *
67 * Do we need a lock for this?
68 * We only ever use this structure inlined
69 * into our global struct. I've used its lock,
70 * but maybe we need a local one here?
71 */
72struct ieee80211softmac_assoc_info {
73 /*
74 * This is the requested ESSID. It is written
75 * only by the WX handlers.
76 *
77 */
78 struct ieee80211softmac_essid req_essid;
79 /*
80 * the ESSID of the network we're currently
81 * associated (or trying) to. This is
82 * updated to the network's actual ESSID
83 * even if the requested ESSID was 'ANY'
84 */
85 struct ieee80211softmac_essid associate_essid;
86
87 /* BSSID we're trying to associate to */
88 char bssid[ETH_ALEN];
89
90 /* some flags.
91 * static_essid is valid if the essid is constant,
92 * this is for use by the wx handlers only.
93 *
94 * associating is true, if the network has been
95 * auth'ed on and we are in the process of associating.
96 *
97 * bssvalid is true if we found a matching network
98 * and saved it's BSSID into the bssid above.
99 */
100 u8 static_essid:1,
101 associating:1,
102 bssvalid:1;
103
104 /* Scan retries remaining */
105 int scan_retry;
106
107 struct work_struct work;
108 struct work_struct timeout;
109};
110
111enum {
112 IEEE80211SOFTMAC_AUTH_OPEN_REQUEST = 1,
113 IEEE80211SOFTMAC_AUTH_OPEN_RESPONSE = 2,
114};
115
116enum {
117 IEEE80211SOFTMAC_AUTH_SHARED_REQUEST = 1,
118 IEEE80211SOFTMAC_AUTH_SHARED_CHALLENGE = 2,
119 IEEE80211SOFTMAC_AUTH_SHARED_RESPONSE = 3,
120 IEEE80211SOFTMAC_AUTH_SHARED_PASS = 4,
121};
122
123/* We should make these tunable
124 * AUTH_TIMEOUT seems really long, but that's what it is in BSD */
125#define IEEE80211SOFTMAC_AUTH_TIMEOUT (12 * HZ)
126#define IEEE80211SOFTMAC_AUTH_RETRY_LIMIT 5
127#define IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT 3
128
129struct ieee80211softmac_txrates {
130 /* The Bit-Rate to be used for multicast frames. */
131 u8 mcast_rate;
132 /* The Bit-Rate to be used for multicast fallback
133 * (If the device supports fallback and hardware-retry)
134 */
135 u8 mcast_fallback;
136 /* The Bit-Rate to be used for any other (normal) data packet. */
137 u8 default_rate;
138 /* The Bit-Rate to be used for default fallback
139 * (If the device supports fallback and hardware-retry)
140 */
141 u8 default_fallback;
142};
143
144/* Bits for txrates_change callback. */
145#define IEEE80211SOFTMAC_TXRATECHG_DEFAULT (1 << 0) /* default_rate */
146#define IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK (1 << 1) /* default_fallback */
147#define IEEE80211SOFTMAC_TXRATECHG_MCAST (1 << 2) /* mcast_rate */
148#define IEEE80211SOFTMAC_TXRATECHG_MCAST_FBACK (1 << 3) /* mcast_fallback */
149
150struct ieee80211softmac_device {
151 /* 802.11 structure for data stuff */
152 struct ieee80211_device *ieee;
153 struct net_device *dev;
154
155 /* only valid if associated, then holds the Association ID */
156 u16 association_id;
157
158 /* the following methods are callbacks that the driver
159 * using this framework has to assign
160 */
161
162 /* always assign these */
163 void (*set_bssid_filter)(struct net_device *dev, const u8 *bssid);
164 void (*set_channel)(struct net_device *dev, u8 channel);
165
166 /* assign if you need it, informational only */
167 void (*link_change)(struct net_device *dev);
168
169 /* If the hardware can do scanning, assign _all_ three of these callbacks.
170 * When the scan finishes, call ieee80211softmac_scan_finished().
171 */
172
173 /* when called, start_scan is guaranteed to not be called again
174 * until you call ieee80211softmac_scan_finished.
175 * Return 0 if scanning could start, error otherwise.
176 * SOFTMAC AUTHORS: don't call this, use ieee80211softmac_start_scan */
177 int (*start_scan)(struct net_device *dev);
178 /* this should block until after ieee80211softmac_scan_finished was called
179 * SOFTMAC AUTHORS: don't call this, use ieee80211softmac_wait_for_scan */
180 void (*wait_for_scan)(struct net_device *dev);
181 /* stop_scan aborts a scan, but is asynchronous.
182 * if you want to wait for it too, use wait_for_scan
183 * SOFTMAC AUTHORS: don't call this, use ieee80211softmac_stop_scan */
184 void (*stop_scan)(struct net_device *dev);
185
186 /* we'll need something about beacons here too, for AP or ad-hoc modes */
187
188 /* Transmission rates to be used by the driver.
189 * The SoftMAC figures out the best possible rates.
190 * The driver just needs to read them.
191 */
192 struct ieee80211softmac_txrates txrates;
193 /* If the driver needs to do stuff on TX rate changes, assign this callback. */
194 void (*txrates_change)(struct net_device *dev,
195 u32 changes, /* see IEEE80211SOFTMAC_TXRATECHG flags */
196 const struct ieee80211softmac_txrates *rates_before_change);
197
198 /* private stuff follows */
199 /* this lock protects this structure */
200 spinlock_t lock;
201
202 /* couple of flags */
203 u8 scanning:1, /* protects scanning from being done multiple times at once */
204 associated:1;
205
206 struct ieee80211softmac_scaninfo *scaninfo;
207 struct ieee80211softmac_assoc_info associnfo;
208
209 struct list_head auth_queue;
210 struct list_head events;
211
212 struct ieee80211softmac_ratesinfo ratesinfo;
213 int txrate_badness;
214
215 /* WPA stuff */
216 struct ieee80211softmac_wpa wpa;
217
218 /* we need to keep a list of network structs we copied */
219 struct list_head network_list;
220
221 /* This must be the last item so that it points to the data
222 * allocated beyond this structure by alloc_ieee80211 */
223 u8 priv[0];
224};
225
226extern void ieee80211softmac_scan_finished(struct ieee80211softmac_device *sm);
227
228static inline void * ieee80211softmac_priv(struct net_device *dev)
229{
230 return ((struct ieee80211softmac_device *)ieee80211_priv(dev))->priv;
231}
232
233extern struct net_device * alloc_ieee80211softmac(int sizeof_priv);
234extern void free_ieee80211softmac(struct net_device *dev);
235
236/* Call this function if you detect a lost TX fragment.
237 * (If the device indicates failure of ACK RX, for example.)
238 * It is wise to call this function if you are able to detect lost packets,
239 * because it contributes to the TX Rates auto adjustment.
240 */
241extern void ieee80211softmac_fragment_lost(struct net_device *dev,
242 u16 wireless_sequence_number);
243/* Call this function before _start to tell the softmac what rates
244 * the hw supports. The rates parameter is copied, so you can
245 * free it right after calling this function.
246 * Note that the rates need to be sorted. */
247extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates);
248
249/* Start the SoftMAC. Call this after you initialized the device
250 * and it is ready to run.
251 */
252extern void ieee80211softmac_start(struct net_device *dev);
253/* Stop the SoftMAC. Call this before you shutdown the device. */
254extern void ieee80211softmac_stop(struct net_device *dev);
255
256/*
257 * Event system
258 */
259
260/* valid event types */
261#define IEEE80211SOFTMAC_EVENT_ANY -1 /*private use only*/
262#define IEEE80211SOFTMAC_EVENT_SCAN_FINISHED 0
263#define IEEE80211SOFTMAC_EVENT_ASSOCIATED 1
264#define IEEE80211SOFTMAC_EVENT_ASSOCIATE_FAILED 2
265#define IEEE80211SOFTMAC_EVENT_ASSOCIATE_TIMEOUT 3
266#define IEEE80211SOFTMAC_EVENT_AUTHENTICATED 4
267#define IEEE80211SOFTMAC_EVENT_AUTH_FAILED 5
268#define IEEE80211SOFTMAC_EVENT_AUTH_TIMEOUT 6
269#define IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND 7
270/* keep this updated! */
271#define IEEE80211SOFTMAC_EVENT_LAST 7
272/*
273 * If you want to be notified of certain events, you can call
274 * ieee80211softmac_notify[_atomic] with
275 * - event set to one of the constants below
276 * - fun set to a function pointer of the appropriate type
277 * - context set to the context data you want passed
278 * The return value is 0, or an error.
279 */
280typedef void (*notify_function_ptr)(struct net_device *dev, void *context);
281
282#define ieee80211softmac_notify(dev, event, fun, context) ieee80211softmac_notify_gfp(dev, event, fun, context, GFP_KERNEL);
283#define ieee80211softmac_notify_atomic(dev, event, fun, context) ieee80211softmac_notify_gfp(dev, event, fun, context, GFP_ATOMIC);
284
285extern int ieee80211softmac_notify_gfp(struct net_device *dev,
286 int event, notify_function_ptr fun, void *context, gfp_t gfp_mask);
287
288/* To clear pending work (for ifconfig down, etc.) */
289extern void
290ieee80211softmac_clear_pending_work(struct ieee80211softmac_device *sm);
291
292#endif /* IEEE80211SOFTMAC_H_ */
diff --git a/include/net/ieee80211softmac_wx.h b/include/net/ieee80211softmac_wx.h
new file mode 100644
index 000000000000..3e0be453ecea
--- /dev/null
+++ b/include/net/ieee80211softmac_wx.h
@@ -0,0 +1,94 @@
1/*
2 * This file contains the prototypes for the wireless extension
3 * handlers that the softmac API provides. Include this file to
4 * use the wx handlers, you can assign these directly.
5 *
6 * Copyright (c) 2005 Johannes Berg <johannes@sipsolutions.net>
7 * Joseph Jezak <josejx@gentoo.org>
8 * Larry Finger <Larry.Finger@lwfinger.net>
9 * Danny van Dyk <kugelfang@gentoo.org>
10 * Michael Buesch <mbuesch@freenet.de>
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of version 2 of the GNU General Public License as
14 * published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 * more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 *
25 * The full GNU General Public License is included in this distribution in the
26 * file called COPYING.
27 */
28
29#ifndef _IEEE80211SOFTMAC_WX_H
30#define _IEEE80211SOFTMAC_WX_H
31
32#include <net/ieee80211softmac.h>
33#include <net/iw_handler.h>
34
35extern int
36ieee80211softmac_wx_trigger_scan(struct net_device *net_dev,
37 struct iw_request_info *info,
38 union iwreq_data *data,
39 char *extra);
40
41extern int
42ieee80211softmac_wx_get_scan_results(struct net_device *net_dev,
43 struct iw_request_info *info,
44 union iwreq_data *data,
45 char *extra);
46
47extern int
48ieee80211softmac_wx_set_essid(struct net_device *net_dev,
49 struct iw_request_info *info,
50 union iwreq_data *data,
51 char *extra);
52
53extern int
54ieee80211softmac_wx_get_essid(struct net_device *net_dev,
55 struct iw_request_info *info,
56 union iwreq_data *data,
57 char *extra);
58
59extern int
60ieee80211softmac_wx_set_rate(struct net_device *net_dev,
61 struct iw_request_info *info,
62 union iwreq_data *data,
63 char *extra);
64
65extern int
66ieee80211softmac_wx_get_rate(struct net_device *net_dev,
67 struct iw_request_info *info,
68 union iwreq_data *data,
69 char *extra);
70
71extern int
72ieee80211softmac_wx_get_wap(struct net_device *net_dev,
73 struct iw_request_info *info,
74 union iwreq_data *data,
75 char *extra);
76
77extern int
78ieee80211softmac_wx_set_wap(struct net_device *net_dev,
79 struct iw_request_info *info,
80 union iwreq_data *data,
81 char *extra);
82
83extern int
84ieee80211softmac_wx_set_genie(struct net_device *dev,
85 struct iw_request_info *info,
86 union iwreq_data *wrqu,
87 char *extra);
88
89extern int
90ieee80211softmac_wx_get_genie(struct net_device *dev,
91 struct iw_request_info *info,
92 union iwreq_data *wrqu,
93 char *extra);
94#endif /* _IEEE80211SOFTMAC_WX */