[PATCH] make softmac depend on IEEE80211 and EXPERIMENTAL
[deliverable/linux.git] / net / ieee80211 / softmac / ieee80211softmac_priv.h
CommitLineData
370121e5
JB
1#ifndef IEEE80211SOFTMAC_PRIV_H_
2#define IEEE80211SOFTMAC_PRIV_H_
3
4#include <net/ieee80211softmac.h>
5#include <net/ieee80211softmac_wx.h>
6#include <linux/kernel.h>
7#include <linux/stringify.h>
8
9
10#define PFX "SoftMAC: "
11
12#ifdef assert
13# undef assert
14#endif
15#ifdef CONFIG_IEEE80211_SOFTMAC_DEBUG
16#define assert(expr) \
17 do { \
18 if (unlikely(!(expr))) { \
19 printkl(KERN_ERR PFX "ASSERTION FAILED (%s) at: %s:%d:%s()\n", #expr, \
20 __FILE__, __LINE__, __FUNCTION__); \
21 } \
22 } while (0)
23#else
24#define assert(expr) do {} while (0)
25#endif
26
27/* rate limited printk(). */
28#ifdef printkl
29# undef printkl
30#endif
31#define printkl(f, x...) do { if (printk_ratelimit()) printk(f ,##x); } while (0)
32/* rate limited printk() for debugging */
33#ifdef dprintkl
34# undef dprintkl
35#endif
36#ifdef CONFIG_IEEE80211_SOFTMAC_DEBUG
37# define dprintkl printkl
38#else
39# define dprintkl(f, x...) do { /* nothing */ } while (0)
40#endif
41
42/* debugging printk() */
43#ifdef dprintk
44# undef dprintk
45#endif
46#ifdef CONFIG_IEEE80211_SOFTMAC_DEBUG
47# define dprintk(f, x...) do { printk(f ,##x); } while (0)
48#else
49# define dprintk(f, x...) do { /* nothing */ } while (0)
50#endif
51
52#ifdef function_enter
53# undef function_enter
54#endif
55#ifdef CONFIG_IEEE80211_SOFTMAC_DEBUG
56# define function_enter() do { printk(KERN_DEBUG PFX "%s:%d:%s()\n", __FILE__, __LINE__, __FUNCTION__); } while (0)
57#else
58# define function_enter() do { /* nothing */ } while (0)
59#endif
60
61/* private definitions and prototypes */
62
63/*** prototypes from _scan.c */
64void ieee80211softmac_scan(void *sm);
65/* for internal use if scanning is needed */
66int ieee80211softmac_start_scan(struct ieee80211softmac_device *mac);
67void ieee80211softmac_stop_scan(struct ieee80211softmac_device *mac);
68void ieee80211softmac_wait_for_scan(struct ieee80211softmac_device *mac);
69
70/* for use by _module.c to assign to the callbacks */
71int ieee80211softmac_start_scan_implementation(struct net_device *dev);
72void ieee80211softmac_stop_scan_implementation(struct net_device *dev);
73void ieee80211softmac_wait_for_scan_implementation(struct net_device *dev);
74
75/*** Network prototypes from _module.c */
76struct ieee80211softmac_network * ieee80211softmac_create_network(
77 struct ieee80211softmac_device *mac, struct ieee80211_network *net);
78void ieee80211softmac_add_network_locked(struct ieee80211softmac_device *mac,
79 struct ieee80211softmac_network *net);
80void ieee80211softmac_add_network(struct ieee80211softmac_device *mac,
81 struct ieee80211softmac_network *net);
82void ieee80211softmac_del_network_locked(struct ieee80211softmac_device *mac,
83 struct ieee80211softmac_network *net);
84void ieee80211softmac_del_network(struct ieee80211softmac_device *mac,
85 struct ieee80211softmac_network *net);
86struct ieee80211softmac_network * ieee80211softmac_get_network_by_bssid_locked(
87 struct ieee80211softmac_device *mac, u8 *ea);
88struct ieee80211softmac_network * ieee80211softmac_get_network_by_bssid(
89 struct ieee80211softmac_device *mac, u8 *ea);
90struct ieee80211softmac_network * ieee80211softmac_get_network_by_ssid_locked(
91 struct ieee80211softmac_device *mac, u8 *ssid, u8 ssid_len);
92struct ieee80211softmac_network * ieee80211softmac_get_network_by_ssid(
93 struct ieee80211softmac_device *mac, u8 *ssid, u8 ssid_len);
94
95
96/* Rates related */
97u8 ieee80211softmac_lower_rate_delta(struct ieee80211softmac_device *mac, u8 rate, int delta);
98static inline u8 lower_rate(struct ieee80211softmac_device *mac, u8 rate) {
99 return ieee80211softmac_lower_rate_delta(mac, rate, 1);
100}
101
102static inline u8 get_fallback_rate(struct ieee80211softmac_device *mac, u8 rate)
103{
104 return ieee80211softmac_lower_rate_delta(mac, rate, 2);
105}
106
107
108/*** prototypes from _io.c */
109int ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac,
110 void* ptrarg, u32 type, u32 arg);
111
112/*** prototypes from _auth.c */
113/* do these have to go into the public header? */
114int ieee80211softmac_auth_req(struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net);
115int ieee80211softmac_deauth_req(struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net, int reason);
116
117/* for use by _module.c to assign to the callbacks */
118int ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth);
119int ieee80211softmac_deauth_resp(struct net_device *dev, struct ieee80211_auth *auth);
120
121/*** prototypes from _assoc.c */
122void ieee80211softmac_assoc_work(void *d);
123int ieee80211softmac_handle_assoc_response(struct net_device * dev,
124 struct ieee80211_assoc_response * resp,
125 struct ieee80211_network * network);
126int ieee80211softmac_handle_disassoc(struct net_device * dev,
127 struct ieee80211_disassoc * disassoc);
128void ieee80211softmac_assoc_timeout(void *d);
129
130/* some helper functions */
131static inline int ieee80211softmac_scan_handlers_check_self(struct ieee80211softmac_device *sm)
132{
133 return (sm->start_scan == ieee80211softmac_start_scan_implementation) &&
134 (sm->stop_scan == ieee80211softmac_stop_scan_implementation) &&
135 (sm->wait_for_scan == ieee80211softmac_wait_for_scan_implementation);
136}
137
138static inline int ieee80211softmac_scan_sanity_check(struct ieee80211softmac_device *sm)
139{
140 return ((sm->start_scan != ieee80211softmac_start_scan_implementation) &&
141 (sm->stop_scan != ieee80211softmac_stop_scan_implementation) &&
142 (sm->wait_for_scan != ieee80211softmac_wait_for_scan_implementation)
143 ) || ieee80211softmac_scan_handlers_check_self(sm);
144}
145
146#define IEEE80211SOFTMAC_PROBE_DELAY HZ/2
147#define IEEE80211SOFTMAC_WORKQUEUE_NAME_LEN (17 + IFNAMSIZ)
148
149struct ieee80211softmac_network {
150 struct list_head list; /* List */
151 /* Network information copied from ieee80211_network */
152 u8 bssid[ETH_ALEN];
153 u8 channel;
154 struct ieee80211softmac_essid essid;
155
156 struct ieee80211softmac_ratesinfo supported_rates;
157
158 /* SoftMAC specific */
159 u16 authenticating:1, /* Status Flags */
160 authenticated:1,
161 auth_desynced_once:1;
162
163 u16 capabilities; /* Capabilities bitfield */
164 u8 challenge_len; /* Auth Challenge length */
165 char *challenge; /* Challenge Text */
166};
167
168/* structure used to keep track of networks we're auth'ing to */
169struct ieee80211softmac_auth_queue_item {
170 struct list_head list; /* List head */
171 struct ieee80211softmac_network *net; /* Network to auth */
172 struct ieee80211softmac_device *mac; /* SoftMAC device */
173 u8 retry; /* Retry limit */
174 u8 state; /* Auth State */
175 struct work_struct work; /* Work queue */
176};
177
178/* scanning information */
179struct ieee80211softmac_scaninfo {
180 u8 current_channel_idx,
181 number_channels;
182 struct ieee80211_channel *channels;
183 u8 started:1,
184 stop:1;
185 u8 skip_flags;
186 struct completion finished;
187 struct work_struct softmac_scan;
188};
189
190/* private event struct */
191struct ieee80211softmac_event {
192 struct list_head list;
193 int event_type;
194 void *event_context;
195 struct work_struct work;
196 notify_function_ptr fun;
197 void *context;
198 struct ieee80211softmac_device *mac;
199};
200
201void ieee80211softmac_call_events(struct ieee80211softmac_device *mac, int event, void *event_context);
202void ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int event, void *event_context);
203int ieee80211softmac_notify_internal(struct ieee80211softmac_device *mac,
204 int event, void *event_context, notify_function_ptr fun, void *context, gfp_t gfp_mask);
205
206#endif /* IEEE80211SOFTMAC_PRIV_H_ */
This page took 0.030746 seconds and 5 git commands to generate.