Home | History | Annotate | Download | only in wpa_supplicant

Lines Matching full:data

89 	struct bgscan_learn_data *data, const u8 *bssid)
93 dl_list_for_each(bss, &data->bss, struct bgscan_learn_bss, list) {
101 static int bgscan_learn_load(struct bgscan_learn_data *data)
107 if (data->fname == NULL)
110 f = fopen(data->fname, "r");
114 wpa_printf(MSG_DEBUG, "bgscan learn: Loading data from %s",
115 data->fname);
119 wpa_printf(MSG_INFO, "bgscan learn: Invalid data file %s",
120 data->fname);
135 dl_list_add(&data->bss, &bss->list);
146 bss = bgscan_learn_get_bss(data, addr);
161 static void bgscan_learn_save(struct bgscan_learn_data *data)
166 if (data->fname == NULL)
169 wpa_printf(MSG_DEBUG, "bgscan learn: Saving data to %s",
170 data->fname);
172 f = fopen(data->fname, "w");
177 dl_list_for_each(bss, &data->bss, struct bgscan_learn_bss, list) {
182 dl_list_for_each(bss, &data->bss, struct bgscan_learn_bss, list) {
211 static int * bgscan_learn_get_freqs(struct bgscan_learn_data *data,
219 dl_list_for_each(bss, &data->bss, struct bgscan_learn_bss, list) {
235 static int * bgscan_learn_get_probe_freq(struct bgscan_learn_data *data,
240 if (data->supp_freqs == NULL)
243 idx = data->probe_idx + 1;
244 while (idx != data->probe_idx) {
245 if (data->supp_freqs[idx] == 0) {
246 if (data->probe_idx == 0)
250 if (!in_array(freqs, data->supp_freqs[idx])) {
252 "%u", data->supp_freqs[idx]);
253 data->probe_idx = idx;
258 freqs[count] = data->supp_freqs[idx];
273 struct bgscan_learn_data *data = eloop_ctx;
274 struct wpa_supplicant *wpa_s = data->wpa_s;
282 params.ssids[0].ssid = data->ssid->ssid;
283 params.ssids[0].ssid_len = data->ssid->ssid_len;
284 if (data->ssid->scan_freq)
285 params.freqs = data->ssid->scan_freq;
287 freqs = bgscan_learn_get_freqs(data, &count);
290 freqs = bgscan_learn_get_probe_freq(data, freqs, count);
311 eloop_register_timeout(data->scan_interval, 0,
312 bgscan_learn_timeout, data, NULL);
314 os_get_time(&data->last_bgscan);
319 static int bgscan_learn_get_params(struct bgscan_learn_data *data,
327 data->short_interval = atoi(params);
333 data->signal_threshold = atoi(pos);
341 data->long_interval = atoi(pos);
345 data->fname = os_strdup(pos);
385 struct bgscan_learn_data *data;
387 data = os_zalloc(sizeof(*data));
388 if (data == NULL)
390 dl_list_init(&data->bss);
391 data->wpa_s = wpa_s;
392 data->ssid = ssid;
393 if (bgscan_learn_get_params(data, params) < 0) {
394 os_free(data->fname);
395 os_free(data);
398 if (data->short_interval <= 0)
399 data->short_interval = 30;
400 if (data->long_interval <= 0)
401 data->long_interval = 30;
403 if (bgscan_learn_load(data) < 0) {
404 os_free(data->fname);
405 os_free(data);
411 data->signal_threshold, data->short_interval,
412 data->long_interval);
414 if (data->signal_threshold &&
415 wpa_drv_signal_monitor(wpa_s, data->signal_threshold, 4) < 0) {
420 data->supp_freqs = bgscan_learn_get_supp_freqs(wpa_s);
421 data->scan_interval = data->short_interval;
422 eloop_register_timeout(data->scan_interval, 0, bgscan_learn_timeout,
423 data, NULL);
431 os_get_time(&data->last_bgscan);
433 return data;
439 struct bgscan_learn_data *data = priv;
442 bgscan_learn_save(data);
443 eloop_cancel_timeout(bgscan_learn_timeout, data, NULL);
444 if (data->signal_threshold)
445 wpa_drv_signal_monitor(data->wpa_s, 0, 0);
446 os_free(data->fname);
447 dl_list_for_each_safe(bss, n, &data->bss, struct bgscan_learn_bss,
452 os_free(data->supp_freqs);
453 os_free(data);
457 static int bgscan_learn_bss_match(struct bgscan_learn_data *data,
466 if (data->ssid->ssid_len != ie[1] ||
467 os_memcmp(data->ssid->ssid, ie + 2, ie[1]) != 0)
477 struct bgscan_learn_data *data = priv;
485 eloop_cancel_timeout(bgscan_learn_timeout, data, NULL);
486 eloop_register_timeout(data->scan_interval, 0, bgscan_learn_timeout,
487 data, NULL);
491 if (!bgscan_learn_bss_match(data, res))
507 if (!bgscan_learn_bss_match(data, res))
510 bss = bgscan_learn_get_bss(data, res->bssid);
524 dl_list_add(&data->bss, &bss->list);
556 struct bgscan_learn_data *data = priv;
560 if (data->short_interval == data->long_interval ||
561 data->signal_threshold == 0)
568 if (data->scan_interval == data->long_interval && !above) {
571 data->scan_interval = data->short_interval;
573 if (now.sec > data->last_bgscan.sec + 1)
575 } else if (data->scan_interval == data->short_interval && above) {
578 data->scan_interval = data->long_interval;
579 eloop_cancel_timeout(bgscan_learn_timeout, data, NULL);
580 eloop_register_timeout(data->scan_interval, 0,
581 bgscan_learn_timeout, data, NULL);
588 if (now.sec > data->last_bgscan.sec + 10)
594 eloop_cancel_timeout(bgscan_learn_timeout, data, NULL);
595 eloop_register_timeout(0, 0, bgscan_learn_timeout, data, NULL);