xref: /freebsd/contrib/wpa/wpa_supplicant/bgscan.h (revision a90b9d0159070121c221b966469c3e36d912bf82)
1e28a4053SRui Paulo /*
2e28a4053SRui Paulo  * WPA Supplicant - background scan and roaming interface
3e28a4053SRui Paulo  * Copyright (c) 2009-2010, Jouni Malinen <j@w1.fi>
4e28a4053SRui Paulo  *
5f05cddf9SRui Paulo  * This software may be distributed under the terms of the BSD license.
6f05cddf9SRui Paulo  * See README for more details.
7e28a4053SRui Paulo  */
8e28a4053SRui Paulo 
9e28a4053SRui Paulo #ifndef BGSCAN_H
10e28a4053SRui Paulo #define BGSCAN_H
11e28a4053SRui Paulo 
12e28a4053SRui Paulo struct wpa_supplicant;
13e28a4053SRui Paulo struct wpa_ssid;
14e28a4053SRui Paulo 
15e28a4053SRui Paulo struct bgscan_ops {
16e28a4053SRui Paulo 	const char *name;
17e28a4053SRui Paulo 
18e28a4053SRui Paulo 	void * (*init)(struct wpa_supplicant *wpa_s, const char *params,
19e28a4053SRui Paulo 		       const struct wpa_ssid *ssid);
20e28a4053SRui Paulo 	void (*deinit)(void *priv);
21e28a4053SRui Paulo 
22f05cddf9SRui Paulo 	int (*notify_scan)(void *priv, struct wpa_scan_results *scan_res);
23e28a4053SRui Paulo 	void (*notify_beacon_loss)(void *priv);
24f05cddf9SRui Paulo 	void (*notify_signal_change)(void *priv, int above,
25f05cddf9SRui Paulo 				     int current_signal,
26f05cddf9SRui Paulo 				     int current_noise,
27f05cddf9SRui Paulo 				     int current_txrate);
28e28a4053SRui Paulo };
29e28a4053SRui Paulo 
30e28a4053SRui Paulo #ifdef CONFIG_BGSCAN
31e28a4053SRui Paulo 
325b9c547cSRui Paulo int bgscan_init(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
335b9c547cSRui Paulo 		const char *name);
34e28a4053SRui Paulo void bgscan_deinit(struct wpa_supplicant *wpa_s);
35f05cddf9SRui Paulo int bgscan_notify_scan(struct wpa_supplicant *wpa_s,
36f05cddf9SRui Paulo 		       struct wpa_scan_results *scan_res);
37e28a4053SRui Paulo void bgscan_notify_beacon_loss(struct wpa_supplicant *wpa_s);
38f05cddf9SRui Paulo void bgscan_notify_signal_change(struct wpa_supplicant *wpa_s, int above,
39f05cddf9SRui Paulo 				 int current_signal, int current_noise,
40f05cddf9SRui Paulo 				 int current_txrate);
41e28a4053SRui Paulo 
42780fb4a2SCy Schubert /* Available bgscan modules */
43780fb4a2SCy Schubert 
44780fb4a2SCy Schubert #ifdef CONFIG_BGSCAN_SIMPLE
45780fb4a2SCy Schubert extern const struct bgscan_ops bgscan_simple_ops;
46780fb4a2SCy Schubert #endif /* CONFIG_BGSCAN_SIMPLE */
47780fb4a2SCy Schubert #ifdef CONFIG_BGSCAN_LEARN
48780fb4a2SCy Schubert extern const struct bgscan_ops bgscan_learn_ops;
49780fb4a2SCy Schubert #endif /* CONFIG_BGSCAN_LEARN */
50780fb4a2SCy Schubert 
51e28a4053SRui Paulo #else /* CONFIG_BGSCAN */
52e28a4053SRui Paulo 
bgscan_init(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid,const char * name)53e28a4053SRui Paulo static inline int bgscan_init(struct wpa_supplicant *wpa_s,
54*a90b9d01SCy Schubert 			      struct wpa_ssid *ssid, const char *name)
55e28a4053SRui Paulo {
56e28a4053SRui Paulo 	return 0;
57e28a4053SRui Paulo }
58e28a4053SRui Paulo 
bgscan_deinit(struct wpa_supplicant * wpa_s)59e28a4053SRui Paulo static inline void bgscan_deinit(struct wpa_supplicant *wpa_s)
60e28a4053SRui Paulo {
61e28a4053SRui Paulo }
62e28a4053SRui Paulo 
bgscan_notify_scan(struct wpa_supplicant * wpa_s,struct wpa_scan_results * scan_res)63f05cddf9SRui Paulo static inline int bgscan_notify_scan(struct wpa_supplicant *wpa_s,
64f05cddf9SRui Paulo 				     struct wpa_scan_results *scan_res)
65e28a4053SRui Paulo {
66e28a4053SRui Paulo 	return 0;
67e28a4053SRui Paulo }
68e28a4053SRui Paulo 
bgscan_notify_beacon_loss(struct wpa_supplicant * wpa_s)69e28a4053SRui Paulo static inline void bgscan_notify_beacon_loss(struct wpa_supplicant *wpa_s)
70e28a4053SRui Paulo {
71e28a4053SRui Paulo }
72e28a4053SRui Paulo 
bgscan_notify_signal_change(struct wpa_supplicant * wpa_s,int above,int current_signal,int current_noise,int current_txrate)73e28a4053SRui Paulo static inline void bgscan_notify_signal_change(struct wpa_supplicant *wpa_s,
74f05cddf9SRui Paulo 					       int above, int current_signal,
75f05cddf9SRui Paulo 					       int current_noise,
76f05cddf9SRui Paulo 					       int current_txrate)
77e28a4053SRui Paulo {
78e28a4053SRui Paulo }
79e28a4053SRui Paulo 
80e28a4053SRui Paulo #endif /* CONFIG_BGSCAN */
81e28a4053SRui Paulo 
82e28a4053SRui Paulo #endif /* BGSCAN_H */
83