mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-02-21 12:20:43 +01:00
scan: Implement scan_freq_set_foreach
This commit is contained in:
parent
c4941a82a4
commit
859dcf0d59
21
src/scan.c
21
src/scan.c
@ -1189,6 +1189,27 @@ uint32_t scan_freq_set_get_bands(struct scan_freq_set *freqs)
|
||||
return bands;
|
||||
}
|
||||
|
||||
void scan_freq_set_foreach(struct scan_freq_set *freqs,
|
||||
scan_freq_set_func_t func, void *user_data)
|
||||
{
|
||||
uint8_t channel;
|
||||
uint32_t freq;
|
||||
|
||||
for (channel = 1; channel <= 14; channel++)
|
||||
if (freqs->channels_2ghz & (1 << (channel - 1))) {
|
||||
freq = scan_channel_to_freq(channel, SCAN_BAND_2_4_GHZ);
|
||||
|
||||
func(freq, user_data);
|
||||
}
|
||||
|
||||
for (channel = 1; channel <= 200; channel++)
|
||||
if (l_uintset_contains(freqs->channels_5ghz, channel)) {
|
||||
freq = scan_channel_to_freq(channel, SCAN_BAND_5_GHZ);
|
||||
|
||||
func(freq, user_data);
|
||||
}
|
||||
}
|
||||
|
||||
bool scan_init(struct l_genl_family *in)
|
||||
{
|
||||
nl80211 = in;
|
||||
|
@ -37,6 +37,7 @@ typedef bool (*scan_notify_func_t)(uint32_t wiphy, uint32_t ifindex,
|
||||
struct l_queue *bss_list,
|
||||
void *userdata);
|
||||
typedef void (*scan_destroy_func_t)(void *userdata);
|
||||
typedef void (*scan_freq_set_func_t)(uint32_t freq, void *userdata);
|
||||
|
||||
struct scan_freq_set;
|
||||
struct ie_rsn_info;
|
||||
@ -93,6 +94,8 @@ void scan_freq_set_free(struct scan_freq_set *freqs);
|
||||
bool scan_freq_set_add(struct scan_freq_set *freqs, uint32_t freq);
|
||||
bool scan_freq_set_contains(struct scan_freq_set *freqs, uint32_t freq);
|
||||
uint32_t scan_freq_set_get_bands(struct scan_freq_set *freqs);
|
||||
void scan_freq_set_foreach(struct scan_freq_set *freqs,
|
||||
scan_freq_set_func_t func, void *user_data);
|
||||
|
||||
bool scan_ifindex_add(uint32_t ifindex);
|
||||
bool scan_ifindex_remove(uint32_t ifindex);
|
||||
|
Loading…
x
Reference in New Issue
Block a user