]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
common: Add function to get an operating class by its number and country
authorAvraham Stern <avraham.stern@intel.com>
Wed, 28 Dec 2016 13:06:43 +0000 (15:06 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 3 Jan 2017 13:18:29 +0000 (15:18 +0200)
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@intel.com>
src/common/ieee802_11_common.c
src/common/ieee802_11_common.h

index ac64f99398cd01d7f143d21635361f0dc024cc09..a8d68e5e68bbb25801460f4c0666ccaa13366b46 100644 (file)
@@ -1576,3 +1576,21 @@ u8 country_to_global_op_class(const char *country, u8 op_class)
         */
        return g_op_class ? g_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;
+}
index bfe6bd4f1bdc3ee046c8436e5b0a43e6bb774304..966eeac841b24980f8bc84c61879d324cd090cf4 100644 (file)
@@ -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 */