eiwd

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

commit 081b0af2d6bcfda7a750c589959199d7e76b2a36
parent 3f1d72e5458ab436e1e57e190f1468eeb00a10ca
Author: James Prestwood <prestwoj@gmail.com>
Date:   Tue, 26 Jul 2022 10:09:17 -0700

util: add scan_freq_set_subtract

Removes any frequencies from one set that are found in the other.

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

diff --git a/src/util.c b/src/util.c @@ -499,6 +499,28 @@ void scan_freq_set_constrain(struct scan_freq_set *set, set->channels_2ghz &= constraint->channels_2ghz; } +void scan_freq_set_subtract(struct scan_freq_set *set, + const struct scan_freq_set *subtract) +{ + struct l_uintset *sub; + + sub = l_uintset_subtract(set->channels_6ghz, subtract->channels_6ghz); + if (L_WARN_ON(!sub)) + return; + + l_uintset_free(set->channels_6ghz); + set->channels_6ghz = sub; + + sub = l_uintset_subtract(set->channels_5ghz, subtract->channels_5ghz); + if (L_WARN_ON(!sub)) + return; + + l_uintset_free(set->channels_5ghz); + set->channels_5ghz = sub; + + set->channels_2ghz &= ~subtract->channels_2ghz; +} + static void add_foreach(uint32_t freq, void *user_data) { uint32_t **list = user_data; diff --git a/src/util.h b/src/util.h @@ -118,6 +118,8 @@ void scan_freq_set_merge(struct scan_freq_set *to, const struct scan_freq_set *from); void scan_freq_set_constrain(struct scan_freq_set *set, const struct scan_freq_set *constraint); +void scan_freq_set_subtract(struct scan_freq_set *set, + const struct scan_freq_set *subtract); 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);