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>
This commit is contained in:
Andre Heider 2022-11-21 17:50:09 +01:00 committed by Jo-Philipp Wich
parent 87529770f6
commit d09a77a369
2 changed files with 45 additions and 0 deletions

View file

@ -44,6 +44,9 @@ static inline int iwinfo_mbm2dbm(int gain)
}
size_t iwinfo_format_hwmodes(int modes, char *buf, size_t len);
int iwinfo_htmode_is_ht(int htmode);
int iwinfo_htmode_is_vht(int htmode);
int iwinfo_htmode_is_he(int htmode);
int iwinfo_ifup(const char *ifname);
int iwinfo_ifdown(const char *ifname);

View 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;