aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee80211/softmac/ieee80211softmac_priv.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/ieee80211/softmac/ieee80211softmac_priv.h')
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_priv.h239
1 files changed, 239 insertions, 0 deletions
diff --git a/net/ieee80211/softmac/ieee80211softmac_priv.h b/net/ieee80211/softmac/ieee80211softmac_priv.h
new file mode 100644
index 000000000000..258da14937be
--- /dev/null
+++ b/net/ieee80211/softmac/ieee80211softmac_priv.h
@@ -0,0 +1,239 @@
1/*
2 * Internal softmac API definitions.
3 *
4 * Copyright (c) 2005, 2006 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_PRIV_H_
28#define IEEE80211SOFTMAC_PRIV_H_
29
30#include <net/ieee80211softmac.h>
31#include <net/ieee80211softmac_wx.h>
32#include <linux/kernel.h>
33#include <linux/stringify.h>
34
35
36#define PFX "SoftMAC: "
37
38#ifdef assert
39# undef assert
40#endif
41#ifdef CONFIG_IEEE80211_SOFTMAC_DEBUG
42#define assert(expr) \
43 do { \
44 if (unlikely(!(expr))) { \
45 printkl(KERN_ERR PFX "ASSERTION FAILED (%s) at: %s:%d:%s()\n", #expr, \
46 __FILE__, __LINE__, __FUNCTION__); \
47 } \
48 } while (0)
49#else
50#define assert(expr) do {} while (0)
51#endif
52
53/* rate limited printk(). */
54#ifdef printkl
55# undef printkl
56#endif
57#define printkl(f, x...) do { if (printk_ratelimit()) printk(f ,##x); } while (0)
58/* rate limited printk() for debugging */
59#ifdef dprintkl
60# undef dprintkl
61#endif
62#ifdef CONFIG_IEEE80211_SOFTMAC_DEBUG
63# define dprintkl printkl
64#else
65# define dprintkl(f, x...) do { /* nothing */ } while (0)
66#endif
67
68/* debugging printk() */
69#ifdef dprintk
70# undef dprintk
71#endif
72#ifdef CONFIG_IEEE80211_SOFTMAC_DEBUG
73# define dprintk(f, x...) do { printk(f ,##x); } while (0)
74#else
75# define dprintk(f, x...) do { /* nothing */ } while (0)
76#endif
77
78#ifdef function_enter
79# undef function_enter
80#endif
81#ifdef CONFIG_IEEE80211_SOFTMAC_DEBUG
82# define function_enter() do { printk(KERN_DEBUG PFX "%s:%d:%s()\n", __FILE__, __LINE__, __FUNCTION__); } while (0)
83#else
84# define function_enter() do { /* nothing */ } while (0)
85#endif
86
87/* private definitions and prototypes */
88
89/*** prototypes from _scan.c */
90void ieee80211softmac_scan(void *sm);
91/* for internal use if scanning is needed */
92int ieee80211softmac_start_scan(struct ieee80211softmac_device *mac);
93void ieee80211softmac_stop_scan(struct ieee80211softmac_device *mac);
94void ieee80211softmac_wait_for_scan(struct ieee80211softmac_device *mac);
95
96/* for use by _module.c to assign to the callbacks */
97int ieee80211softmac_start_scan_implementation(struct net_device *dev);
98void ieee80211softmac_stop_scan_implementation(struct net_device *dev);
99void ieee80211softmac_wait_for_scan_implementation(struct net_device *dev);
100
101/*** Network prototypes from _module.c */
102struct ieee80211softmac_network * ieee80211softmac_create_network(
103 struct ieee80211softmac_device *mac, struct ieee80211_network *net);
104void ieee80211softmac_add_network_locked(struct ieee80211softmac_device *mac,
105 struct ieee80211softmac_network *net);
106void ieee80211softmac_add_network(struct ieee80211softmac_device *mac,
107 struct ieee80211softmac_network *net);
108void ieee80211softmac_del_network_locked(struct ieee80211softmac_device *mac,
109 struct ieee80211softmac_network *net);
110void ieee80211softmac_del_network(struct ieee80211softmac_device *mac,
111 struct ieee80211softmac_network *net);
112struct ieee80211softmac_network * ieee80211softmac_get_network_by_bssid_locked(
113 struct ieee80211softmac_device *mac, u8 *ea);
114struct ieee80211softmac_network * ieee80211softmac_get_network_by_bssid(
115 struct ieee80211softmac_device *mac, u8 *ea);
116struct ieee80211softmac_network * ieee80211softmac_get_network_by_ssid_locked(
117 struct ieee80211softmac_device *mac, u8 *ssid, u8 ssid_len);
118struct ieee80211softmac_network * ieee80211softmac_get_network_by_ssid(
119 struct ieee80211softmac_device *mac, u8 *ssid, u8 ssid_len);
120struct ieee80211softmac_network *
121ieee80211softmac_get_network_by_essid_locked(struct ieee80211softmac_device *mac,
122 struct ieee80211softmac_essid *essid);
123struct ieee80211softmac_network *
124ieee80211softmac_get_network_by_essid(struct ieee80211softmac_device *mac,
125 struct ieee80211softmac_essid *essid);
126
127/* Rates related */
128u8 ieee80211softmac_lower_rate_delta(struct ieee80211softmac_device *mac, u8 rate, int delta);
129static inline u8 lower_rate(struct ieee80211softmac_device *mac, u8 rate) {
130 return ieee80211softmac_lower_rate_delta(mac, rate, 1);
131}
132
133static inline u8 get_fallback_rate(struct ieee80211softmac_device *mac, u8 rate)
134{
135 return ieee80211softmac_lower_rate_delta(mac, rate, 2);
136}
137
138
139/*** prototypes from _io.c */
140int ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac,
141 void* ptrarg, u32 type, u32 arg);
142
143/*** prototypes from _auth.c */
144/* do these have to go into the public header? */
145int ieee80211softmac_auth_req(struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net);
146int ieee80211softmac_deauth_req(struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net, int reason);
147
148/* for use by _module.c to assign to the callbacks */
149int ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth);
150int ieee80211softmac_deauth_resp(struct net_device *dev, struct ieee80211_deauth *deauth);
151
152/*** prototypes from _assoc.c */
153void ieee80211softmac_assoc_work(void *d);
154int ieee80211softmac_handle_assoc_response(struct net_device * dev,
155 struct ieee80211_assoc_response * resp,
156 struct ieee80211_network * network);
157int ieee80211softmac_handle_disassoc(struct net_device * dev,
158 struct ieee80211_disassoc * disassoc);
159int ieee80211softmac_handle_reassoc_req(struct net_device * dev,
160 struct ieee80211_reassoc_request * reassoc);
161void ieee80211softmac_assoc_timeout(void *d);
162
163/* some helper functions */
164static inline int ieee80211softmac_scan_handlers_check_self(struct ieee80211softmac_device *sm)
165{
166 return (sm->start_scan == ieee80211softmac_start_scan_implementation) &&
167 (sm->stop_scan == ieee80211softmac_stop_scan_implementation) &&
168 (sm->wait_for_scan == ieee80211softmac_wait_for_scan_implementation);
169}
170
171static inline int ieee80211softmac_scan_sanity_check(struct ieee80211softmac_device *sm)
172{
173 return ((sm->start_scan != ieee80211softmac_start_scan_implementation) &&
174 (sm->stop_scan != ieee80211softmac_stop_scan_implementation) &&
175 (sm->wait_for_scan != ieee80211softmac_wait_for_scan_implementation)
176 ) || ieee80211softmac_scan_handlers_check_self(sm);
177}
178
179#define IEEE80211SOFTMAC_PROBE_DELAY HZ/2
180#define IEEE80211SOFTMAC_WORKQUEUE_NAME_LEN (17 + IFNAMSIZ)
181
182struct ieee80211softmac_network {
183 struct list_head list; /* List */
184 /* Network information copied from ieee80211_network */
185 u8 bssid[ETH_ALEN];
186 u8 channel;
187 struct ieee80211softmac_essid essid;
188
189 struct ieee80211softmac_ratesinfo supported_rates;
190
191 /* SoftMAC specific */
192 u16 authenticating:1, /* Status Flags */
193 authenticated:1,
194 auth_desynced_once:1;
195
196 u16 capabilities; /* Capabilities bitfield */
197 u8 challenge_len; /* Auth Challenge length */
198 char *challenge; /* Challenge Text */
199};
200
201/* structure used to keep track of networks we're auth'ing to */
202struct ieee80211softmac_auth_queue_item {
203 struct list_head list; /* List head */
204 struct ieee80211softmac_network *net; /* Network to auth */
205 struct ieee80211softmac_device *mac; /* SoftMAC device */
206 u8 retry; /* Retry limit */
207 u8 state; /* Auth State */
208 struct work_struct work; /* Work queue */
209};
210
211/* scanning information */
212struct ieee80211softmac_scaninfo {
213 u8 current_channel_idx,
214 number_channels;
215 struct ieee80211_channel *channels;
216 u8 started:1,
217 stop:1;
218 u8 skip_flags;
219 struct completion finished;
220 struct work_struct softmac_scan;
221};
222
223/* private event struct */
224struct ieee80211softmac_event {
225 struct list_head list;
226 int event_type;
227 void *event_context;
228 struct work_struct work;
229 notify_function_ptr fun;
230 void *context;
231 struct ieee80211softmac_device *mac;
232};
233
234void ieee80211softmac_call_events(struct ieee80211softmac_device *mac, int event, void *event_context);
235void ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int event, void *event_context);
236int ieee80211softmac_notify_internal(struct ieee80211softmac_device *mac,
237 int event, void *event_context, notify_function_ptr fun, void *context, gfp_t gfp_mask);
238
239#endif /* IEEE80211SOFTMAC_PRIV_H_ */