3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

knownnetworks: add roam frequency getter

Gets a newly created scan_freq_set containing the most recent
frequencies for the network. The currently connected BSS frequency
(passed as a parameters) will not be included in the set.
This commit is contained in:
James Prestwood 2019-09-16 13:14:13 -07:00 committed by Denis Kenzior
parent d9e6b2263f
commit 07e6876ef5
2 changed files with 34 additions and 0 deletions

View File

@ -271,6 +271,36 @@ void network_info_set_uuid(struct network_info *info, const uint8_t *uuid)
info->has_uuid = true;
}
struct scan_freq_set *network_info_get_roam_frequencies(
const struct network_info *info,
uint32_t current_freq,
uint8_t max)
{
struct scan_freq_set *freqs;
const struct l_queue_entry *entry;
freqs = scan_freq_set_new();
for (entry = l_queue_get_entries(info->known_frequencies); entry && max;
entry = entry->next) {
struct known_frequency *kn = entry->data;
if (kn->frequency == current_freq)
continue;
scan_freq_set_add(freqs, kn->frequency);
max--;
}
if (scan_freq_set_isempty(freqs)) {
scan_freq_set_free(freqs);
return NULL;
}
return freqs;
}
bool network_info_match_hessid(const struct network_info *info,
const uint8_t *hessid)
{

View File

@ -108,6 +108,10 @@ const struct iovec *network_info_get_extra_ies(const struct network_info *info,
/* Gets the UUID, or generates one if not yet created */
const uint8_t *network_info_get_uuid(struct network_info *info);
void network_info_set_uuid(struct network_info *info, const uint8_t *uuid);
struct scan_freq_set *network_info_get_roam_frequencies(
const struct network_info *info,
uint32_t current_freq,
uint8_t max);
bool network_info_match_hessid(const struct network_info *info,
const uint8_t *hessid);