aboutsummaryrefslogtreecommitdiffstats
path: root/src/drivers/driver_common.c
diff options
context:
space:
mode:
authorMathy Vanhoef <Mathy.Vanhoef@cs.kuleuven.be>2018-08-06 19:46:23 (GMT)
committerJouni Malinen <j@w1.fi>2018-12-16 16:35:30 (GMT)
commitd706e0d7a335edbdf9a8d7012318f27d24a9b971 (patch)
treef400cec3fbf8b58e6c1c94a4d4e706ac06a8a9b7 /src/drivers/driver_common.c
parentdbe473fd22777ec349b28d16ef5d8b9a48176a2a (diff)
downloadhostap-d706e0d7a335edbdf9a8d7012318f27d24a9b971.zip
hostap-d706e0d7a335edbdf9a8d7012318f27d24a9b971.tar.gz
hostap-d706e0d7a335edbdf9a8d7012318f27d24a9b971.tar.bz2
Add functions to convert channel bandwidth to an integer
This adds two utility functions to convert both operating classes and and the chan_width enum to an integer representing the channel bandwidth. This can then be used to compare bandwidth parameters in an uniform manner. Signed-off-by: Mathy Vanhoef <Mathy.Vanhoef@cs.kuleuven.be>
Diffstat (limited to 'src/drivers/driver_common.c')
-rw-r--r--src/drivers/driver_common.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/drivers/driver_common.c b/src/drivers/driver_common.c
index ac0916e..1b92e86 100644
--- a/src/drivers/driver_common.c
+++ b/src/drivers/driver_common.c
@@ -115,6 +115,25 @@ const char * channel_width_to_string(enum chan_width width)
}
+int channel_width_to_int(enum chan_width width)
+{
+ switch (width) {
+ case CHAN_WIDTH_20_NOHT:
+ case CHAN_WIDTH_20:
+ return 20;
+ case CHAN_WIDTH_40:
+ return 40;
+ case CHAN_WIDTH_80:
+ return 80;
+ case CHAN_WIDTH_80P80:
+ case CHAN_WIDTH_160:
+ return 160;
+ default:
+ return 0;
+ }
+}
+
+
int ht_supported(const struct hostapd_hw_modes *mode)
{
if (!(mode->flags & HOSTAPD_MODE_FLAG_HT_INFO_KNOWN)) {