[pulseaudio-discuss] [PATCH 1/2] parseaddr: Add new call pa_is_ip6_address()

Hajime Fujita crisp.fujita at nifty.com
Sat Nov 8 21:40:21 PST 2014


---
 src/pulsecore/parseaddr.c | 11 +++++++++++
 src/pulsecore/parseaddr.h |  2 ++
 2 files changed, 13 insertions(+)

diff --git a/src/pulsecore/parseaddr.c b/src/pulsecore/parseaddr.c
index d31e68c..f49c81c 100644
--- a/src/pulsecore/parseaddr.c
+++ b/src/pulsecore/parseaddr.c
@@ -145,3 +145,14 @@ bool pa_is_ip_address(const char *a) {
 
     return false;
 }
+
+bool pa_is_ip6_address(const char *a) {
+    char buf[INET6_ADDRSTRLEN];
+
+    pa_assert(a);
+
+    if (inet_pton(AF_INET6, a, buf) >= 1)
+        return true;
+
+    return false;
+}
diff --git a/src/pulsecore/parseaddr.h b/src/pulsecore/parseaddr.h
index 9c9745b..57be7a6 100644
--- a/src/pulsecore/parseaddr.h
+++ b/src/pulsecore/parseaddr.h
@@ -43,4 +43,6 @@ int pa_parse_address(const char *a, pa_parsed_address *ret_p);
 
 bool pa_is_ip_address(const char *a);
 
+bool pa_is_ip6_address(const char *a);
+
 #endif
-- 
1.9.1



More information about the pulseaudio-discuss mailing list