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

Andrei Otcheretianski andrei.otcheretianski at intel.com
Wed Dec 28 05:06:43 PST 2016


From: Avraham Stern <avraham.stern at intel.com>

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 at intel.com>
---
 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




More information about the Hostap mailing list