Skip to content
Snippets Groups Projects
Commit d7bc923d authored by Benny Baumann's avatar Benny Baumann
Browse files

add: Allow to fall back to runtime conversion for IP address conversion

parent 9917c0c0
No related branches found
No related tags found
1 merge request!1First unit tests
......@@ -479,6 +479,20 @@ static constexpr bool is_valid_ip6addr(const char (&str)[N])
return details::inet6_aton(str, in6) != -1;
}
static bool is_valid_ip4addr(const std::string& str)
{
struct in_addr in = {};
return ::inet_pton(AF_INET, str.c_str(), &in) != -1;
}
static bool is_valid_ip6addr(const std::string& str)
{
struct in6_addr in = {};
return ::inet_pton(AF_INET6, str.c_str(), &in) != -1;
}
}
// Work around use of non-standard feature (not part of ISO-C++)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment