Alexandre Julliard : ws2_32: Added implementation for inet_ntop.

Alexandre Julliard julliard at winehq.org
Tue Dec 23 13:40:38 CST 2008


Module: wine
Branch: master
Commit: bc85fb4cd3b091678b79e8416dfe573e98aee1f3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bc85fb4cd3b091678b79e8416dfe573e98aee1f3

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Dec 22 19:40:08 2008 +0100

ws2_32: Added implementation for inet_ntop.

---

 configure               |    2 ++
 configure.ac            |    1 +
 dlls/ws2_32/socket.c    |   24 ++++++++++++++++++++++++
 dlls/ws2_32/ws2_32.spec |    1 +
 include/config.h.in     |    3 +++
 5 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index 43ea106..2cc3711 100755
--- a/configure
+++ b/configure
@@ -17792,6 +17792,7 @@ esac
 
 
 
+
 for ac_func in \
 	_pclose \
 	_popen \
@@ -17824,6 +17825,7 @@ for ac_func in \
 	gettid \
 	gettimeofday \
 	getuid \
+	inet_ntop \
 	inet_pton \
 	kqueue \
 	lstat \
diff --git a/configure.ac b/configure.ac
index 400011c..8ace1cb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1387,6 +1387,7 @@ AC_CHECK_FUNCS(\
 	gettid \
 	gettimeofday \
 	getuid \
+	inet_ntop \
 	inet_pton \
 	kqueue \
 	lstat \
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 14f357f..5b748c8 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -4555,6 +4555,30 @@ int WINAPI WSARemoveServiceClass(LPGUID info)
 }
 
 /***********************************************************************
+ *              inet_ntop                      (WS2_32.@)
+ */
+PCSTR WINAPI WS_inet_ntop( INT family, PVOID addr, PSTR buffer, size_t len )
+{
+#ifdef HAVE_INET_NTOP
+    union generic_unix_sockaddr unix_addr;
+
+    switch (family)
+    {
+    case WS_AF_INET:
+        ws_sockaddr_ws2u( addr, sizeof(struct WS_sockaddr_in), &unix_addr );
+        return inet_ntop( AF_INET, &unix_addr, buffer, len );
+    case WS_AF_INET6:
+        ws_sockaddr_ws2u( addr, sizeof(struct WS_sockaddr_in6), &unix_addr );
+        return inet_ntop( AF_INET6, &unix_addr, buffer, len );
+    }
+#else
+    FIXME( "not supported on this platform\n" );
+#endif
+    WSASetLastError( WSAEAFNOSUPPORT );
+    return NULL;
+}
+
+/***********************************************************************
  *              WSAStringToAddressA                      (WS2_32.80)
  */
 INT WINAPI WSAStringToAddressA(LPSTR AddressString,
diff --git a/dlls/ws2_32/ws2_32.spec b/dlls/ws2_32/ws2_32.spec
index bbcafc0..74e71be 100644
--- a/dlls/ws2_32/ws2_32.spec
+++ b/dlls/ws2_32/ws2_32.spec
@@ -117,3 +117,4 @@
 @ stdcall freeaddrinfo(ptr) WS_freeaddrinfo
 @ stdcall getaddrinfo(str str ptr ptr) WS_getaddrinfo
 @ stdcall getnameinfo(ptr long ptr long ptr long long) WS_getnameinfo
+@ stdcall inet_ntop(long ptr ptr long) WS_inet_ntop
diff --git a/include/config.h.in b/include/config.h.in
index 4aafaed..1753e41 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -249,6 +249,9 @@
 /* Define to 1 if you have the `inet_network' function. */
 #undef HAVE_INET_NETWORK
 
+/* Define to 1 if you have the `inet_ntop' function. */
+#undef HAVE_INET_NTOP
+
 /* Define to 1 if you have the `inet_pton' function. */
 #undef HAVE_INET_PTON
 




More information about the wine-cvs mailing list