2 * WPA Supplicant - background scan and roaming interface
3 * Copyright (c) 2009-2010, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
12 #include "wpa_supplicant_i.h"
13 #include "config_ssid.h"
16 #ifdef CONFIG_BGSCAN_SIMPLE
17 extern const struct bgscan_ops bgscan_simple_ops
;
18 #endif /* CONFIG_BGSCAN_SIMPLE */
19 #ifdef CONFIG_BGSCAN_LEARN
20 extern const struct bgscan_ops bgscan_learn_ops
;
21 #endif /* CONFIG_BGSCAN_LEARN */
23 static const struct bgscan_ops
* bgscan_modules
[] = {
24 #ifdef CONFIG_BGSCAN_SIMPLE
26 #endif /* CONFIG_BGSCAN_SIMPLE */
27 #ifdef CONFIG_BGSCAN_LEARN
29 #endif /* CONFIG_BGSCAN_LEARN */
34 int bgscan_init(struct wpa_supplicant
*wpa_s
, struct wpa_ssid
*ssid
,
40 const struct bgscan_ops
*ops
= NULL
;
46 params
= os_strchr(name
, ':');
49 nlen
= os_strlen(name
);
55 for (i
= 0; bgscan_modules
[i
]; i
++) {
56 if (os_strncmp(name
, bgscan_modules
[i
]->name
, nlen
) == 0) {
57 ops
= bgscan_modules
[i
];
63 wpa_printf(MSG_ERROR
, "bgscan: Could not find module "
64 "matching the parameter '%s'", name
);
68 wpa_s
->bgscan_priv
= ops
->init(wpa_s
, params
, ssid
);
69 if (wpa_s
->bgscan_priv
== NULL
)
72 wpa_printf(MSG_DEBUG
, "bgscan: Initialized module '%s' with "
73 "parameters '%s'", ops
->name
, params
);
79 void bgscan_deinit(struct wpa_supplicant
*wpa_s
)
81 if (wpa_s
->bgscan
&& wpa_s
->bgscan_priv
) {
82 wpa_printf(MSG_DEBUG
, "bgscan: Deinitializing module '%s'",
84 wpa_s
->bgscan
->deinit(wpa_s
->bgscan_priv
);
86 wpa_s
->bgscan_priv
= NULL
;
91 int bgscan_notify_scan(struct wpa_supplicant
*wpa_s
,
92 struct wpa_scan_results
*scan_res
)
94 if (wpa_s
->bgscan
&& wpa_s
->bgscan_priv
)
95 return wpa_s
->bgscan
->notify_scan(wpa_s
->bgscan_priv
,
101 void bgscan_notify_beacon_loss(struct wpa_supplicant
*wpa_s
)
103 if (wpa_s
->bgscan
&& wpa_s
->bgscan_priv
)
104 wpa_s
->bgscan
->notify_beacon_loss(wpa_s
->bgscan_priv
);
108 void bgscan_notify_signal_change(struct wpa_supplicant
*wpa_s
, int above
,
109 int current_signal
, int current_noise
,
112 if (wpa_s
->bgscan
&& wpa_s
->bgscan_priv
)
113 wpa_s
->bgscan
->notify_signal_change(wpa_s
->bgscan_priv
, above
,