Hans Leidekker : winsock: Implement getnameinfo.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Feb 20 14:18:26 CST 2006


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

Author: Hans Leidekker <hans at it.vu.nl>
Date:   Mon Feb 20 14:16:38 2006 +0100

winsock: Implement getnameinfo.

---

 configure                |    2 ++
 configure.ac             |    1 +
 dlls/winsock/socket.c    |   27 +++++++++++++++++++++++++++
 dlls/winsock/ws2_32.spec |    2 +-
 include/config.h.in      |    3 +++
 include/ws2tcpip.h       |    2 +-
 6 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 66335f0..30aff74 100755
--- a/configure
+++ b/configure
@@ -14713,6 +14713,7 @@ fi
 
 
 
+
 for ac_func in \
 	_lwp_create \
 	_lwp_self \
@@ -14737,6 +14738,7 @@ for ac_func in \
 	futimes \
 	futimesat \
 	getaddrinfo \
+	getnameinfo \
 	getnetbyname \
 	getopt_long \
 	getpagesize \
diff --git a/configure.ac b/configure.ac
index 8fc5519..652de1a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1156,6 +1156,7 @@ AC_CHECK_FUNCS(\
 	futimes \
 	futimesat \
 	getaddrinfo \
+	getnameinfo \
 	getnetbyname \
 	getopt_long \
 	getpagesize \
diff --git a/dlls/winsock/socket.c b/dlls/winsock/socket.c
index a86249d..a07c5b4 100644
--- a/dlls/winsock/socket.c
+++ b/dlls/winsock/socket.c
@@ -3235,6 +3235,33 @@ int WINAPI GetAddrInfoW(LPCWSTR nodename
     return EAI_FAIL;
 }
 
+int WINAPI WS_getnameinfo(const struct WS_sockaddr *sa, socklen_t salen, char *host,
+                          DWORD hostlen, char *serv, DWORD servlen, int flags)
+{
+#if HAVE_GETNAMEINFO
+    int ret;
+    const struct sockaddr* sa_u;
+    unsigned int size;
+
+    TRACE("%s %d %p %ld %p %ld %d\n", debugstr_sockaddr(sa), salen, host, hostlen,
+          serv, servlen, flags);
+
+    sa_u = ws_sockaddr_ws2u(sa, salen, &size);
+    if (!sa_u)
+    {
+        WSASetLastError(WSAEFAULT);
+        return WSA_NOT_ENOUGH_MEMORY;
+    }
+    ret = getnameinfo(sa_u, size, host, hostlen, serv, servlen, flags);
+
+    ws_sockaddr_free(sa_u, sa);
+    return convert_eai_u2w(ret);
+#else
+    FIXME("getnameinfo() failed, not found during buildtime.\n");
+    return EAI_FAIL;
+#endif
+}
+
 /***********************************************************************
  *		getservbyport		(WS2_32.56)
  */
diff --git a/dlls/winsock/ws2_32.spec b/dlls/winsock/ws2_32.spec
index b36b854..bbcafc0 100644
--- a/dlls/winsock/ws2_32.spec
+++ b/dlls/winsock/ws2_32.spec
@@ -116,4 +116,4 @@
 @ stdcall WSCWriteProviderOrder(ptr long)
 @ stdcall freeaddrinfo(ptr) WS_freeaddrinfo
 @ stdcall getaddrinfo(str str ptr ptr) WS_getaddrinfo
-@ stub    getnameinfo
+@ stdcall getnameinfo(ptr long ptr long ptr long long) WS_getnameinfo
diff --git a/include/config.h.in b/include/config.h.in
index c057314..8d25021 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -161,6 +161,9 @@
 /* Define to 1 if you have the `gethostbyname' function. */
 #undef HAVE_GETHOSTBYNAME
 
+/* Define to 1 if you have the `getnameinfo' function. */
+#undef HAVE_GETNAMEINFO
+
 /* Define to 1 if you have the `getnetbyname' function. */
 #undef HAVE_GETNETBYNAME
 
diff --git a/include/ws2tcpip.h b/include/ws2tcpip.h
index 90a224b..16efab6 100644
--- a/include/ws2tcpip.h
+++ b/include/ws2tcpip.h
@@ -215,7 +215,7 @@ int WINAPI  WS(getaddrinfo)(const char*,
 #define     GetAddrInfoA WS(getaddrinfo)
 int WINAPI  GetAddrInfoW(PCWSTR,PCWSTR,const ADDRINFOW*,PADDRINFOW*);
 #define     GetAddrInfo WINELIB_NAME_AW(GetAddrInfo)
-int WINAPI  WS(getnameinfo)(const struct sockaddr*,socklen_t,char*,DWORD,char*,DWORD,int);
+int WINAPI  WS(getnameinfo)(const struct WS(sockaddr)*,socklen_t,char*,DWORD,char*,DWORD,int);
 #define     GetNameInfoA WS(getnameinfo)
 INT WINAPI  GetNameInfoW(const SOCKADDR*,socklen_t,PWCHAR,DWORD,PWCHAR,DWORD,INT);
 #define     GetNameInfo WINELIB_NAME_AW(GetNameInfo)




More information about the wine-cvs mailing list