diff --git a/src/framework/ow_constants.h b/src/framework/ow_constants.h index 0d87d11..a27f409 100644 --- a/src/framework/ow_constants.h +++ b/src/framework/ow_constants.h @@ -5,6 +5,7 @@ #pragma once #include +#include #include "Poco/String.h" #if defined(__GNUC__) @@ -428,6 +429,7 @@ namespace OpenWifi::uCentralProtocol { static const char *RADIUSACCT = "acct"; static const char *RADIUSAUTH = "auth"; static const char *RADIUSDST = "dst"; + static const char *IES = "ies"; } namespace OpenWifi::uCentralProtocol::Events { @@ -458,7 +460,7 @@ namespace OpenWifi::uCentralProtocol::Events { }; inline static EVENT_MSG EventFromString(const std::string & Method) { - static std::vector> Values{ + static std::vector> EventValues{ { CFGPENDING , ET_CFGPENDING }, { CONNECT, ET_CONNECT }, { CRASHLOG, ET_CRASHLOG }, @@ -471,11 +473,12 @@ namespace OpenWifi::uCentralProtocol::Events { { TELEMETRY, ET_TELEMETRY } }; - std::string L = Poco::toLower(Method); - auto hint = std::find_if(cbegin(Values),cend(Values),[&](const std::pair &v) ->bool { return strcmp(v.first,L.c_str())==0; }); - if(hint == cend(Values)) - return ET_UNKNOWN; - return hint->second; + const auto l_method = Poco::toLower(Method); + for(const auto &[event_name,event_type]:EventValues) { + if(std::strcmp(event_name,Method.c_str())==0) + return event_type; + } + return ET_UNKNOWN; }; }