winsock: Implement getnameinfo.

This commit is contained in:
Hans Leidekker 2006-02-20 14:16:38 +01:00 committed by Alexandre Julliard
parent 3a0b40fffb
commit c0e6bb2df7
6 changed files with 35 additions and 2 deletions

2
configure vendored
View File

@ -14711,6 +14711,7 @@ fi
for ac_func in \
@ -14737,6 +14738,7 @@ for ac_func in \
futimes \
futimesat \
getaddrinfo \
getnameinfo \
getnetbyname \
getopt_long \
getpagesize \

View File

@ -1156,6 +1156,7 @@ AC_CHECK_FUNCS(\
futimes \
futimesat \
getaddrinfo \
getnameinfo \
getnetbyname \
getopt_long \
getpagesize \

View File

@ -3235,6 +3235,33 @@ int WINAPI GetAddrInfoW(LPCWSTR nodename, LPCWSTR servname, const ADDRINFOW *hin
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)
*/

View File

@ -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

View File

@ -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

View File

@ -215,7 +215,7 @@ int WINAPI WS(getaddrinfo)(const char*,const char*,const struct WS(addrinfo)*,s
#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)