eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit 0bc44a038b8cd480b5331256fb3bdf0ebcc71d94
parent 8c01edf74bd7ae27c9faf906528c06b3e4e4d960
Author: James Prestwood <prestwoj@gmail.com>
Date:   Thu,  4 Aug 2022 15:02:47 -0700

util: add scan_freq_set_clone

This creates a new scan_freq_set from an input set which only contains
frequencies from bands included in the mask.

Diffstat:
Msrc/util.c | 21+++++++++++++++++++++
Msrc/util.h | 2++
2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/src/util.c b/src/util.c @@ -554,3 +554,24 @@ uint32_t *scan_freq_set_to_fixed_array(const struct scan_freq_set *set, return freqs; } + +struct scan_freq_set *scan_freq_set_clone(const struct scan_freq_set *set, + uint32_t band_mask) +{ + struct scan_freq_set *new = l_new(struct scan_freq_set, 1); + + if (band_mask & BAND_FREQ_2_4_GHZ) + new->channels_2ghz = set->channels_2ghz; + + if (band_mask & BAND_FREQ_5_GHZ) + new->channels_5ghz = l_uintset_clone(set->channels_5ghz); + else + new->channels_5ghz = l_uintset_new_from_range(1, 200); + + if (band_mask & BAND_FREQ_6_GHZ) + new->channels_6ghz = l_uintset_clone(set->channels_6ghz); + else + new->channels_6ghz = l_uintset_new_from_range(1, 233); + + return new; +} diff --git a/src/util.h b/src/util.h @@ -124,6 +124,8 @@ void scan_freq_set_subtract(struct scan_freq_set *set, bool scan_freq_set_isempty(const struct scan_freq_set *set); uint32_t *scan_freq_set_to_fixed_array(const struct scan_freq_set *set, size_t *len_out); +struct scan_freq_set *scan_freq_set_clone(const struct scan_freq_set *set, + uint32_t band_mask); DEFINE_CLEANUP_FUNC(scan_freq_set_free);