diff --git a/include/iwinfo.h b/include/iwinfo.h index 68d459b..38120e6 100644 --- a/include/iwinfo.h +++ b/include/iwinfo.h @@ -182,6 +182,7 @@ struct iwinfo_ops { const char * iwinfo_type(const char *ifname); const struct iwinfo_ops * iwinfo_backend(const char *ifname); +const struct iwinfo_ops * iwinfo_backend_by_name(const char *name); void iwinfo_finish(void); extern const struct iwinfo_ops wext_ops; diff --git a/iwinfo_lib.c b/iwinfo_lib.c index 4ae8f59..c30d834 100644 --- a/iwinfo_lib.c +++ b/iwinfo_lib.c @@ -350,6 +350,17 @@ const struct iwinfo_ops * iwinfo_backend(const char *ifname) return NULL; } +const struct iwinfo_ops * iwinfo_backend_by_name(const char *name) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(backends); i++) + if (!strcmp(backends[i]->name, name)) + return backends[i]; + + return NULL; +} + void iwinfo_finish(void) { int i;