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