summaryrefslogtreecommitdiff
path: root/iwinfo_utils.c
diff options
context:
space:
mode:
authorAndre Heider <a.heider@gmail.com>2022-11-21 17:50:09 +0100
committerJo-Philipp Wich <jo@mein.io>2022-12-16 00:09:07 +0100
commitd09a77a3695b9e684c74fbe66809449ad92b0e96 (patch)
tree92b38760edf0016ceb83b72954a818e0892a5a49 /iwinfo_utils.c
parent87529770f6494189f3f21252c3a83d708f1faacf (diff)
downloadiwinfo-d09a77a3695b9e684c74fbe66809449ad92b0e96.tar.gz
utils: add iwinfo_htmode_is_{ht|vht|he} helpers
Small and useful functions which allow to clear up some consumers. Signed-off-by: Andre Heider <a.heider@gmail.com>
Diffstat (limited to 'iwinfo_utils.c')
-rw-r--r--iwinfo_utils.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/iwinfo_utils.c b/iwinfo_utils.c
index 63ae78c..c7713ed 100644
--- a/iwinfo_utils.c
+++ b/iwinfo_utils.c
@@ -102,6 +102,48 @@ size_t iwinfo_format_hwmodes(int modes, char *buf, size_t len)
return res;
}
+int iwinfo_htmode_is_ht(int htmode)
+{
+ switch (htmode)
+ {
+ case IWINFO_HTMODE_HT20:
+ case IWINFO_HTMODE_HT40:
+ return 1;
+ }
+
+ return 0;
+}
+
+int iwinfo_htmode_is_vht(int htmode)
+{
+ switch (htmode)
+ {
+ case IWINFO_HTMODE_VHT20:
+ case IWINFO_HTMODE_VHT40:
+ case IWINFO_HTMODE_VHT80:
+ case IWINFO_HTMODE_VHT80_80:
+ case IWINFO_HTMODE_VHT160:
+ return 1;
+ }
+
+ return 0;
+}
+
+int iwinfo_htmode_is_he(int htmode)
+{
+ switch (htmode)
+ {
+ case IWINFO_HTMODE_HE20:
+ case IWINFO_HTMODE_HE40:
+ case IWINFO_HTMODE_HE80:
+ case IWINFO_HTMODE_HE80_80:
+ case IWINFO_HTMODE_HE160:
+ return 1;
+ }
+
+ return 0;
+}
+
int iwinfo_ifup(const char *ifname)
{
struct ifreq ifr;