diff options
-rw-r--r-- | src/wpa.h | 1 | ||||
-rw-r--r-- | src/wpa_parser.c | 14 |
2 files changed, 15 insertions, 0 deletions
@@ -135,6 +135,7 @@ struct owfd_wpa_event { void owfd_wpa_event_init(struct owfd_wpa_event *ev); void owfd_wpa_event_reset(struct owfd_wpa_event *ev); int owfd_wpa_event_parse(struct owfd_wpa_event *ev, const char *event); +const char *owfd_wpa_event_name(unsigned int type); #ifdef __cplusplus } diff --git a/src/wpa_parser.c b/src/wpa_parser.c index 02f91e4..0ba935b 100644 --- a/src/wpa_parser.c +++ b/src/wpa_parser.c @@ -89,6 +89,20 @@ static const struct event_type { #undef EVENT }; +const char *owfd_wpa_event_name(unsigned int type) +{ + size_t i, max; + + max = sizeof(event_list) / sizeof(*event_list); + + for (i = 0; i < max; ++i) { + if (event_list[i].code == type) + return event_list[i].name; + } + + return "UNKNOWN"; +} + static int event_comp(const void *key, const void *type) { const struct event_type *t; |