utils: add iwinfo_htmode_is_{ht|vht|he} helpers
[project/iwinfo.git] / iwinfo_utils.c
index 63ae78c4715d875613da417c928347044c37d237..c7713edb25715c8d6d5a65425c2d0bdedb2c7cef 100644 (file)
@@ -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;