[PATCH 11/15] common: Add function to get an operating class by its number and country

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Avraham Stern <avraham.stern@xxxxxxxxx>

Add a function to get operating class definition (including bandwidth,
channel numbers etc.) from the operating class number and country.

Signed-off-by: Avraham Stern <avraham.stern@xxxxxxxxx>
---
 src/common/ieee802_11_common.c | 18 ++++++++++++++++++
 src/common/ieee802_11_common.h |  2 ++
 2 files changed, 20 insertions(+)

diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
index 1334870..1742bb5 100644
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -1573,3 +1573,21 @@ u8 country_to_global_op_class(const char *country, u8 op_class)
 	 */
 	return global_op_class ? global_op_class : op_class;
 }
+
+
+const struct oper_class_map *get_oper_class(const char* country, u8 op_class)
+{
+	const struct oper_class_map *op;
+
+	if (country)
+		op_class = country_to_global_op_class(country, op_class);
+
+	op = &global_op_class[0];
+	while (op->op_class && op->op_class != op_class)
+		op++;
+
+	if (!op->op_class)
+		return NULL;
+
+	return op;
+}
diff --git a/src/common/ieee802_11_common.h b/src/common/ieee802_11_common.h
index bfe6bd4..10f3fe8 100644
--- a/src/common/ieee802_11_common.h
+++ b/src/common/ieee802_11_common.h
@@ -184,4 +184,6 @@ struct country_op_class {
 
 u8 country_to_global_op_class(const char *country, u8 op_class);
 
+const struct oper_class_map *get_oper_class(const char *country, u8 op_class);
+
 #endif /* IEEE802_11_COMMON_H */
-- 
1.9.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux