X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/fad2dd8911abd78eaf95005e68c32796650a091a..ce4f87b0803d81e413699ffe65d5dbf4eec9d64c:/projects/stargazer/plugins/other/radius/config.cpp diff --git a/projects/stargazer/plugins/other/radius/config.cpp b/projects/stargazer/plugins/other/radius/config.cpp index 6a29f002..68b8760f 100644 --- a/projects/stargazer/plugins/other/radius/config.cpp +++ b/projects/stargazer/plugins/other/radius/config.cpp @@ -167,6 +167,16 @@ T toInt(const std::vector& values) return 0; } +uint16_t toPort(const std::string& value) +{ + if (value.empty()) + return 0; + uint16_t res = 0; + if (str2x(value, res) == 0) + return res; + throw ParserError(0, "'" + value + "' is not a valid port number."); +} + typedef std::map Codes; // One-time call to initialize the list of codes. @@ -229,11 +239,31 @@ std::string parseString(const std::string& paramName, const std::vector