[polypaudio-commits] r1013 - /trunk/src/polypcore/socket-util.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Tue Jun 13 02:33:05 PDT 2006


Author: ossman
Date: Tue Jun 13 11:33:04 2006
New Revision: 1013

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1013&root=polypaudio&view=rev
Log:
Handle pretty printing of IPv6 socket names.

Modified:
    trunk/src/polypcore/socket-util.c

Modified: trunk/src/polypcore/socket-util.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/socket-util.c?rev=1013&root=polypaudio&r1=1012&r2=1013&view=diff
==============================================================================
--- trunk/src/polypcore/socket-util.c (original)
+++ trunk/src/polypcore/socket-util.c Tue Jun 13 11:33:04 2006
@@ -56,6 +56,13 @@
 #ifdef HAVE_NETDB_H
 #include <netdb.h>
 #endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#ifndef HAVE_INET_NTOP
+#include "inet_ntop.h"
+#endif
 
 #include "winsock.h"
 
@@ -85,6 +92,7 @@
         union {
             struct sockaddr sa;
             struct sockaddr_in in;
+            struct sockaddr_in6 in6;
 #ifdef HAVE_SYS_UN_H
             struct sockaddr_un un;
 #endif
@@ -103,6 +111,15 @@
                          ip & 0xFF,
                          ntohs(sa.in.sin_port));
                 return;
+            } else if (sa.sa.sa_family == AF_INET6) {
+                char buf[INET6_ADDRSTRLEN];
+                const char *res;
+
+                res = inet_ntop(AF_INET6, &sa.in6.sin6_addr, buf, sizeof(buf));
+                if (res) {
+                    snprintf(c, l, "TCP/IP client from [%s]:%u", buf, ntohs(sa.in6.sin6_port));
+                    return;
+                }
 #ifdef HAVE_SYS_UN_H
             } else if (sa.sa.sa_family == AF_UNIX) {
                 snprintf(c, l, "UNIX socket client");




More information about the pulseaudio-commits mailing list