Commit 27202319 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

Make winsock.h and winsock2.h independent from the Unix headers.

Make them compatible with both the Unix C headers and the MSVCRT headers. Ensure compatibility with the Unix headers via the USE_WS_PREFIX macro. Add WINE_NOWINSOCK: prevents winsock.h from being included from windows.h when defined. Add ws2tcpip.h, move definitions to the right header.
parent c3daf422
EXTRADEFS = -DUSE_WS_PREFIX
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
......
......@@ -167,10 +167,10 @@ static int WS_copy_he(char *p_to,char *p_base,int t_size,struct hostent* p_he, i
{
char* p_name,*p_aliases,*p_addr,*p;
struct ws_hostent16 *p_to16 = (struct ws_hostent16*)p_to;
struct ws_hostent32 *p_to32 = (struct ws_hostent32*)p_to;
struct WS_hostent *p_to32 = (struct WS_hostent*)p_to;
int size = hostent_size(p_he) +
(
(flag & AQ_WIN16) ? sizeof(struct ws_hostent16) : sizeof(struct ws_hostent32)
(flag & AQ_WIN16) ? sizeof(struct ws_hostent16) : sizeof(struct WS_hostent)
- sizeof(struct hostent)
);
......@@ -178,7 +178,7 @@ static int WS_copy_he(char *p_to,char *p_base,int t_size,struct hostent* p_he, i
return -size;
p = p_to;
p += (flag & AQ_WIN16) ?
sizeof(struct ws_hostent16) : sizeof(struct ws_hostent32);
sizeof(struct ws_hostent16) : sizeof(struct WS_hostent);
p_name = p;
strcpy(p, p_he->h_name); p += strlen(p) + 1;
p_aliases = p;
......@@ -225,10 +225,10 @@ static int WS_copy_pe(char *p_to,char *p_base,int t_size,struct protoent* p_pe,
{
char* p_name,*p_aliases,*p;
struct ws_protoent16 *p_to16 = (struct ws_protoent16*)p_to;
struct ws_protoent32 *p_to32 = (struct ws_protoent32*)p_to;
struct WS_protoent *p_to32 = (struct WS_protoent*)p_to;
int size = protoent_size(p_pe) +
(
(flag & AQ_WIN16) ? sizeof(struct ws_protoent16) : sizeof(struct ws_protoent32)
(flag & AQ_WIN16) ? sizeof(struct ws_protoent16) : sizeof(struct WS_protoent)
- sizeof(struct protoent)
);
......@@ -236,7 +236,7 @@ static int WS_copy_pe(char *p_to,char *p_base,int t_size,struct protoent* p_pe,
return -size;
p = p_to;
p += (flag & AQ_WIN16) ?
sizeof(struct ws_protoent16) : sizeof(struct ws_protoent32);
sizeof(struct ws_protoent16) : sizeof(struct WS_protoent);
p_name = p;
strcpy(p, p_pe->p_name); p += strlen(p) + 1;
p_aliases = p;
......@@ -279,10 +279,10 @@ static int WS_copy_se(char *p_to,char *p_base,int t_size,struct servent* p_se, i
{
char* p_name,*p_aliases,*p_proto,*p;
struct ws_servent16 *p_to16 = (struct ws_servent16*)p_to;
struct ws_servent32 *p_to32 = (struct ws_servent32*)p_to;
struct WS_servent *p_to32 = (struct WS_servent*)p_to;
int size = servent_size(p_se) +
(
(flag & AQ_WIN16) ? sizeof(struct ws_servent16) : sizeof(struct ws_servent32)
(flag & AQ_WIN16) ? sizeof(struct ws_servent16) : sizeof(struct WS_servent)
- sizeof(struct servent)
);
......@@ -290,7 +290,7 @@ static int WS_copy_se(char *p_to,char *p_base,int t_size,struct servent* p_se, i
return -size;
p = p_to;
p += (flag & AQ_WIN16) ?
sizeof(struct ws_servent16) : sizeof(struct ws_servent32);
sizeof(struct ws_servent16) : sizeof(struct WS_servent);
p_name = p;
strcpy(p, p_se->s_name); p += strlen(p) + 1;
p_proto = p;
......
......@@ -7,14 +7,8 @@
* NOTE: If you make any changes to fix a particular app, make sure
* they don't break something else like Netscape or telnet and ftp
* clients and servers (www.winsite.com got a lot of those).
*
* NOTE 2: Many winsock structs such as servent, hostent, protoent, ...
* are used with 1-byte alignment for Win16 programs and 4-byte alignment
* for Win32 programs in winsock.h. winsock2.h uses forced 4-byte alignment.
* So we have non-forced (just as MSDN) ws_XXXXent (winsock.h), 4-byte forced
* ws_XXXXent32 (winsock2.h) and 1-byte forced ws_XXXXent16 (winsock16.h).
*/
#include "config.h"
#include "wine/port.h"
......@@ -92,6 +86,7 @@
#include "wingdi.h"
#include "winuser.h"
#include "winsock2.h"
#include "ws2tcpip.h"
#include "wsipx.h"
#include "wine/winsock16.h"
#include "winnt.h"
......@@ -154,7 +149,6 @@ static FARPROC blocking_hook;
int WS_dup_he(struct hostent* p_he, int flag);
int WS_dup_pe(struct protoent* p_pe, int flag);
int WS_dup_se(struct servent* p_se, int flag);
int WINAPI WSOCK32_getpeername(SOCKET s, ws_sockaddr *name, int *namelen);
typedef void WIN_hostent;
typedef void WIN_protoent;
......@@ -317,9 +311,9 @@ static void WINSOCK_DeleteIData(void)
}
/***********************************************************************
* WSOCK32_LibMain (WS2_32.init)
* WS_LibMain (WS2_32.init)
*/
BOOL WINAPI WSOCK32_LibMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID fImpLoad)
BOOL WINAPI WS_LibMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID fImpLoad)
{
TRACE("0x%x 0x%lx %p\n", hInstDLL, fdwReason, fImpLoad);
switch (fdwReason) {
......@@ -391,7 +385,7 @@ static fd_set* fd_set_import( fd_set* fds, void* wsfds, int* highfd, int lfd[],
if( wsfds )
{
#define wsfds16 ((ws_fd_set16*)wsfds)
#define wsfds32 ((ws_fd_set32*)wsfds)
#define wsfds32 ((WS_fd_set*)wsfds)
int i, count;
FD_ZERO(fds);
......@@ -437,7 +431,7 @@ static int fd_set_export( fd_set* fds, fd_set* exceptfds, void* wsfds, int lfd[]
if( wsfds )
{
#define wsfds16 ((ws_fd_set16*)wsfds)
#define wsfds32 ((ws_fd_set32*)wsfds)
#define wsfds32 ((WS_fd_set*)wsfds)
int i, j, count = (b32) ? wsfds32->fd_count : wsfds16->fd_count;
for( i = 0, j = 0; i < count; i++ )
......@@ -477,7 +471,7 @@ static void fd_set_unimport( void* wsfds, int lfd[], BOOL b32 )
if ( wsfds )
{
#define wsfds16 ((ws_fd_set16*)wsfds)
#define wsfds32 ((ws_fd_set32*)wsfds)
#define wsfds32 ((WS_fd_set*)wsfds)
int i, count = (b32) ? wsfds32->fd_count : wsfds16->fd_count;
for( i = 0; i < count; i++ )
......@@ -765,17 +759,17 @@ static void ws2_async_accept(SOCKET s, SOCKET as)
* start with. Note that the returned pointer may be the original pointer
* if no conversion is necessary.
*/
const struct sockaddr* ws_sockaddr_ws2u(const ws_sockaddr* wsaddr, int wsaddrlen, int *uaddrlen)
const struct sockaddr* ws_sockaddr_ws2u(const struct WS_sockaddr* wsaddr, int wsaddrlen, int *uaddrlen)
{
switch (wsaddr->sa_family)
{
#ifdef HAVE_IPX
case WS_AF_IPX:
{
struct ws_sockaddr_ipx* wsipx=(struct ws_sockaddr_ipx*)wsaddr;
struct WS_sockaddr_ipx* wsipx=(struct WS_sockaddr_ipx*)wsaddr;
struct sockaddr_ipx* uipx;
if (wsaddrlen<sizeof(struct ws_sockaddr_ipx))
if (wsaddrlen<sizeof(struct WS_sockaddr_ipx))
return NULL;
*uaddrlen=sizeof(struct sockaddr_ipx);
......@@ -793,7 +787,7 @@ const struct sockaddr* ws_sockaddr_ws2u(const ws_sockaddr* wsaddr, int wsaddrlen
#endif
default:
if (wsaddrlen<sizeof(ws_sockaddr))
if (wsaddrlen<sizeof(struct WS_sockaddr))
return NULL;
/* No conversion needed, just return the original address */
......@@ -804,7 +798,7 @@ const struct sockaddr* ws_sockaddr_ws2u(const ws_sockaddr* wsaddr, int wsaddrlen
}
/* allocates a Unix sockaddr structure to receive the data */
inline struct sockaddr* ws_sockaddr_alloc(const ws_sockaddr* wsaddr, int* wsaddrlen, int* uaddrlen)
inline struct sockaddr* ws_sockaddr_alloc(const struct WS_sockaddr* wsaddr, int* wsaddrlen, int* uaddrlen)
{
if (*wsaddrlen==0)
*uaddrlen=0;
......@@ -817,7 +811,7 @@ inline struct sockaddr* ws_sockaddr_alloc(const ws_sockaddr* wsaddr, int* wsaddr
}
/* Returns 0 if successful, -1 if the buffer is too small */
int ws_sockaddr_u2ws(const struct sockaddr* uaddr, int uaddrlen, ws_sockaddr* wsaddr, int* wsaddrlen)
int ws_sockaddr_u2ws(const struct sockaddr* uaddr, int uaddrlen, struct WS_sockaddr* wsaddr, int* wsaddrlen)
{
int res;
......@@ -827,7 +821,7 @@ int ws_sockaddr_u2ws(const struct sockaddr* uaddr, int uaddrlen, ws_sockaddr* ws
case AF_IPX:
{
struct sockaddr_ipx* uipx=(struct sockaddr_ipx*)uaddr;
struct ws_sockaddr_ipx* wsipx=(struct ws_sockaddr_ipx*)wsaddr;
struct WS_sockaddr_ipx* wsipx=(struct WS_sockaddr_ipx*)wsaddr;
res=-1;
switch (*wsaddrlen) /* how much can we copy? */
......@@ -873,7 +867,7 @@ int ws_sockaddr_u2ws(const struct sockaddr* uaddr, int uaddrlen, ws_sockaddr* ws
/* to be called to free the memory allocated by ws_sockaddr_ws2u or
* ws_sockaddr_alloc
*/
inline void ws_sockaddr_free(const struct sockaddr* uaddr, const ws_sockaddr* wsaddr)
inline void ws_sockaddr_free(const struct sockaddr* uaddr, const struct WS_sockaddr* wsaddr)
{
if (uaddr!=NULL && uaddr!=(const struct sockaddr*)wsaddr)
free((void*)uaddr);
......@@ -882,7 +876,7 @@ inline void ws_sockaddr_free(const struct sockaddr* uaddr, const ws_sockaddr* ws
/***********************************************************************
* accept (WS2_32.1)
*/
SOCKET WINAPI WSOCK32_accept(SOCKET s, ws_sockaddr *addr,
SOCKET WINAPI WS_accept(SOCKET s, struct WS_sockaddr *addr,
int *addrlen32)
{
int fd = _get_sock_fd(s);
......@@ -913,7 +907,7 @@ SOCKET WINAPI WSOCK32_accept(SOCKET s, ws_sockaddr *addr,
if (as)
{
unsigned omask = _get_sock_mask( s );
WSOCK32_getpeername(fd, addr, addrlen32);
WS_getpeername(fd, addr, addrlen32);
if (omask & FD_WINE_SERVEVENT)
ws2_async_accept(s, as);
return as;
......@@ -929,11 +923,11 @@ SOCKET WINAPI WSOCK32_accept(SOCKET s, ws_sockaddr *addr,
/***********************************************************************
* accept (WINSOCK.1)
*/
SOCKET16 WINAPI WINSOCK_accept16(SOCKET16 s, ws_sockaddr* addr,
SOCKET16 WINAPI WINSOCK_accept16(SOCKET16 s, struct WS_sockaddr* addr,
INT16* addrlen16 )
{
INT addrlen32 = addrlen16 ? *addrlen16 : 0;
SOCKET retSocket = WSOCK32_accept( s, addr, &addrlen32 );
SOCKET retSocket = WS_accept( s, addr, &addrlen32 );
if( addrlen16 ) *addrlen16 = (INT16)addrlen32;
return (SOCKET16)retSocket;
}
......@@ -941,7 +935,7 @@ SOCKET16 WINAPI WINSOCK_accept16(SOCKET16 s, ws_sockaddr* addr,
/***********************************************************************
* bind (WS2_32.2)
*/
int WINAPI WSOCK32_bind(SOCKET s, const ws_sockaddr* name, int namelen)
int WINAPI WS_bind(SOCKET s, const struct WS_sockaddr* name, int namelen)
{
int fd = _get_sock_fd(s);
int res;
......@@ -1007,15 +1001,15 @@ int WINAPI WSOCK32_bind(SOCKET s, const ws_sockaddr* name, int namelen)
/***********************************************************************
* bind (WINSOCK.2)
*/
INT16 WINAPI WINSOCK_bind16(SOCKET16 s, ws_sockaddr *name, INT16 namelen)
INT16 WINAPI WINSOCK_bind16(SOCKET16 s, struct WS_sockaddr *name, INT16 namelen)
{
return (INT16)WSOCK32_bind( s, name, namelen );
return (INT16)WS_bind( s, name, namelen );
}
/***********************************************************************
* closesocket (WS2_32.3)
*/
INT WINAPI WSOCK32_closesocket(SOCKET s)
int WINAPI WS_closesocket(SOCKET s)
{
TRACE("socket %08x\n", s);
if (CloseHandle(s)) return 0;
......@@ -1027,13 +1021,13 @@ INT WINAPI WSOCK32_closesocket(SOCKET s)
*/
INT16 WINAPI WINSOCK_closesocket16(SOCKET16 s)
{
return (INT16)WSOCK32_closesocket(s);
return (INT16)WS_closesocket(s);
}
/***********************************************************************
* connect (WS2_32.4)
*/
int WINAPI WSOCK32_connect(SOCKET s, const ws_sockaddr* name, int namelen)
int WINAPI WS_connect(SOCKET s, const struct WS_sockaddr* name, int namelen)
{
int fd = _get_sock_fd(s);
......@@ -1111,15 +1105,15 @@ connect_success:
/***********************************************************************
* connect (WINSOCK.4)
*/
INT16 WINAPI WINSOCK_connect16(SOCKET16 s, ws_sockaddr *name, INT16 namelen)
INT16 WINAPI WINSOCK_connect16(SOCKET16 s, struct WS_sockaddr *name, INT16 namelen)
{
return (INT16)WSOCK32_connect( s, name, namelen );
return (INT16)WS_connect( s, name, namelen );
}
/***********************************************************************
* getpeername (WS2_32.5)
*/
int WINAPI WSOCK32_getpeername(SOCKET s, ws_sockaddr *name, int *namelen)
int WINAPI WS_getpeername(SOCKET s, struct WS_sockaddr *name, int *namelen)
{
int fd = _get_sock_fd(s);
int res;
......@@ -1159,11 +1153,11 @@ int WINAPI WSOCK32_getpeername(SOCKET s, ws_sockaddr *name, int *namelen)
/***********************************************************************
* getpeername (WINSOCK.5)
*/
INT16 WINAPI WINSOCK_getpeername16(SOCKET16 s, ws_sockaddr *name,
INT16 WINAPI WINSOCK_getpeername16(SOCKET16 s, struct WS_sockaddr *name,
INT16 *namelen16)
{
INT namelen32 = *namelen16;
INT retVal = WSOCK32_getpeername( s, name, &namelen32 );
INT retVal = WS_getpeername( s, name, &namelen32 );
#if DEBUG_SOCKADDR
dump_sockaddr(name);
......@@ -1176,7 +1170,7 @@ INT16 WINAPI WINSOCK_getpeername16(SOCKET16 s, ws_sockaddr *name,
/***********************************************************************
* getsockname (WS2_32.6)
*/
int WINAPI WSOCK32_getsockname(SOCKET s, ws_sockaddr *name, int *namelen)
int WINAPI WS_getsockname(SOCKET s, struct WS_sockaddr *name, int *namelen)
{
int fd = _get_sock_fd(s);
int res;
......@@ -1215,7 +1209,7 @@ int WINAPI WSOCK32_getsockname(SOCKET s, ws_sockaddr *name, int *namelen)
/***********************************************************************
* getsockname (WINSOCK.6)
*/
INT16 WINAPI WINSOCK_getsockname16(SOCKET16 s, ws_sockaddr *name,
INT16 WINAPI WINSOCK_getsockname16(SOCKET16 s, struct WS_sockaddr *name,
INT16 *namelen16)
{
INT retVal;
......@@ -1223,7 +1217,7 @@ INT16 WINAPI WINSOCK_getsockname16(SOCKET16 s, ws_sockaddr *name,
if( namelen16 )
{
INT namelen32 = *namelen16;
retVal = WSOCK32_getsockname( s, name, &namelen32 );
retVal = WS_getsockname( s, name, &namelen32 );
*namelen16 = namelen32;
#if DEBUG_SOCKADDR
......@@ -1239,7 +1233,7 @@ INT16 WINAPI WINSOCK_getsockname16(SOCKET16 s, ws_sockaddr *name,
/***********************************************************************
* getsockopt (WS2_32.7)
*/
INT WINAPI WSOCK32_getsockopt(SOCKET s, INT level,
INT WINAPI WS_getsockopt(SOCKET s, INT level,
INT optname, char *optval, INT *optlen)
{
int fd = _get_sock_fd(s);
......@@ -1262,6 +1256,7 @@ INT WINAPI WSOCK32_getsockopt(SOCKET s, INT level,
return SOCKET_ERROR;
}
/***********************************************************************
* getsockopt (WINSOCK.7)
*/
......@@ -1272,47 +1267,72 @@ INT16 WINAPI WINSOCK_getsockopt16(SOCKET16 s, INT16 level,
INT *p = &optlen32;
INT retVal;
if( optlen ) optlen32 = *optlen; else p = NULL;
retVal = WSOCK32_getsockopt( s, (UINT16)level, optname, optval, p );
retVal = WS_getsockopt( s, (UINT16)level, optname, optval, p );
if( optlen ) *optlen = optlen32;
return (INT16)retVal;
}
/***********************************************************************
* htonl (WINSOCK.8)
* htonl (WS2_32.8)
*/
u_long WINAPI WINSOCK_htonl(u_long hostlong) { return( htonl(hostlong) ); }
u_long WINAPI WS_htonl(u_long hostlong)
{
return htonl(hostlong);
}
/***********************************************************************
* htons (WINSOCK.9)
* htons (WS2_32.9)
*/
u_short WINAPI WINSOCK_htons(u_short hostshort) { return( htons(hostshort) ); }
u_short WINAPI WS_htons(u_short hostshort)
{
return htons(hostshort);
}
/***********************************************************************
* inet_addr (WINSOCK.10)
* inet_addr (WS2_32.11)
*/
u_long WINAPI WINSOCK_inet_addr(char *cp) { return( inet_addr(cp) ); }
u_long WINAPI WS_inet_addr(const char *cp)
{
return inet_addr(cp);
}
/***********************************************************************
* ntohl (WINSOCK.14)
* ntohl (WS2_32.14)
*/
u_long WINAPI WINSOCK_ntohl(u_long netlong) { return( ntohl(netlong) ); }
u_long WINAPI WS_ntohl(u_long netlong)
{
return ntohl(netlong);
}
/***********************************************************************
* ntohs (WINSOCK.15)
* ntohs (WS2_32.15)
*/
u_short WINAPI WINSOCK_ntohs(u_short netshort) { return( ntohs(netshort) ); }
u_short WINAPI WS_ntohs(u_short netshort)
{
return ntohs(netshort);
}
/***********************************************************************
* inet_ntoa (WS2_32.12)
*/
char* WINAPI WSOCK32_inet_ntoa(struct in_addr in)
char* WINAPI WS_inet_ntoa(struct WS_in_addr in)
{
/* use "buffer for dummies" here because some applications have
* propensity to decode addresses in ws_hostent structure without
* saving them first...
*/
char* s = inet_ntoa(in);
char* s = inet_ntoa(*((struct in_addr*)&in));
if( s )
{
if( dbuffer == NULL ) {
......@@ -1335,7 +1355,7 @@ char* WINAPI WSOCK32_inet_ntoa(struct in_addr in)
*/
SEGPTR WINAPI WINSOCK_inet_ntoa16(struct in_addr in)
{
char* retVal = WSOCK32_inet_ntoa(in);
char* retVal = WS_inet_ntoa(*((struct WS_in_addr*)&in));
return SEGPTR_GET(retVal);
}
......@@ -1404,11 +1424,11 @@ INT WINAPI WSAIoctl (SOCKET s,
}
else
{
struct ws_sockaddr_in *ipTemp = (struct ws_sockaddr_in *)&ifInfo.ifr_addr;
struct WS_sockaddr_in *ipTemp = (struct WS_sockaddr_in *)&ifInfo.ifr_addr;
intArray->iiAddress.AddressIn.sin_family = AF_INET;
intArray->iiAddress.AddressIn.sin_port = ipTemp->sin_port;
intArray->iiAddress.AddressIn.sin_addr.ws_addr = ipTemp->sin_addr.S_un.S_addr;
intArray->iiAddress.AddressIn.sin_addr.WS_s_addr = ipTemp->sin_addr.S_un.S_addr;
}
/* Broadcast Address */
......@@ -1422,11 +1442,11 @@ INT WINAPI WSAIoctl (SOCKET s,
}
else
{
struct ws_sockaddr_in *ipTemp = (struct ws_sockaddr_in *)&ifInfo.ifr_broadaddr;
struct WS_sockaddr_in *ipTemp = (struct WS_sockaddr_in *)&ifInfo.ifr_broadaddr;
intArray->iiBroadcastAddress.AddressIn.sin_family = AF_INET;
intArray->iiBroadcastAddress.AddressIn.sin_port = ipTemp->sin_port;
intArray->iiBroadcastAddress.AddressIn.sin_addr.ws_addr = ipTemp->sin_addr.S_un.S_addr;
intArray->iiBroadcastAddress.AddressIn.sin_addr.WS_s_addr = ipTemp->sin_addr.S_un.S_addr;
}
/* Subnet Mask */
......@@ -1446,21 +1466,21 @@ INT WINAPI WSAIoctl (SOCKET s,
#ifndef ifr_addr
intArray->iiNetmask.AddressIn.sin_family = AF_INET;
intArray->iiNetmask.AddressIn.sin_port = 0;
intArray->iiNetmask.AddressIn.sin_addr.ws_addr = 0;
intArray->iiNetmask.AddressIn.sin_addr.WS_s_addr = 0;
ERR ("Unable to determine Netmask on your platform!\n");
#else
struct ws_sockaddr_in *ipTemp = (struct ws_sockaddr_in *)&ifInfo.ifr_addr;
struct WS_sockaddr_in *ipTemp = (struct WS_sockaddr_in *)&ifInfo.ifr_addr;
intArray->iiNetmask.AddressIn.sin_family = AF_INET;
intArray->iiNetmask.AddressIn.sin_port = ipTemp->sin_port;
intArray->iiNetmask.AddressIn.sin_addr.ws_addr = ipTemp->sin_addr.S_un.S_addr;
intArray->iiNetmask.AddressIn.sin_addr.WS_s_addr = ipTemp->sin_addr.S_un.S_addr;
#endif
#else
struct ws_sockaddr_in *ipTemp = (struct ws_sockaddr_in *)&ifInfo.ifr_netmask;
struct WS_sockaddr_in *ipTemp = (struct WS_sockaddr_in *)&ifInfo.ifr_netmask;
intArray->iiNetmask.AddressIn.sin_family = AF_INET;
intArray->iiNetmask.AddressIn.sin_port = ipTemp->sin_port;
intArray->iiNetmask.AddressIn.sin_addr.ws_addr = ipTemp->sin_addr.S_un.S_addr;
intArray->iiNetmask.AddressIn.sin_addr.WS_s_addr = ipTemp->sin_addr.S_un.S_addr;
#endif
}
......@@ -1631,7 +1651,7 @@ int WSAIOCTL_GetInterfaceName(int intNumber, char *intName)
/***********************************************************************
* ioctlsocket (WS2_32.10)
*/
INT WINAPI WSOCK32_ioctlsocket(SOCKET s, LONG cmd, ULONG *argp)
int WINAPI WS_ioctlsocket(SOCKET s, long cmd, u_long *argp)
{
int fd = _get_sock_fd(s);
......@@ -1670,7 +1690,7 @@ INT WINAPI WSOCK32_ioctlsocket(SOCKET s, LONG cmd, ULONG *argp)
newcmd=SIOCATMARK;
break;
case WS_IOW('f',125,u_long):
case WS__IOW('f',125,u_long):
WARN("Warning: WS1.1 shouldn't be using async I/O\n");
SetLastError(WSAEINVAL);
return SOCKET_ERROR;
......@@ -1703,14 +1723,14 @@ INT WINAPI WSOCK32_ioctlsocket(SOCKET s, LONG cmd, ULONG *argp)
*/
INT16 WINAPI WINSOCK_ioctlsocket16(SOCKET16 s, LONG cmd, ULONG *argp)
{
return (INT16)WSOCK32_ioctlsocket( s, cmd, argp );
return (INT16)WS_ioctlsocket( s, cmd, argp );
}
/***********************************************************************
* listen (WS2_32.13)
*/
INT WINAPI WSOCK32_listen(SOCKET s, INT backlog)
int WINAPI WS_listen(SOCKET s, int backlog)
{
int fd = _get_sock_fd(s);
......@@ -1736,14 +1756,14 @@ INT WINAPI WSOCK32_listen(SOCKET s, INT backlog)
*/
INT16 WINAPI WINSOCK_listen16(SOCKET16 s, INT16 backlog)
{
return (INT16)WSOCK32_listen( s, backlog );
return (INT16)WS_listen( s, backlog );
}
/***********************************************************************
* recv (WS2_32.16)
*/
INT WINAPI WSOCK32_recv(SOCKET s, char *buf, INT len, INT flags)
int WINAPI WS_recv(SOCKET s, char *buf, int len, int flags)
{
int fd = _get_sock_fd(s);
......@@ -1780,15 +1800,15 @@ INT WINAPI WSOCK32_recv(SOCKET s, char *buf, INT len, INT flags)
*/
INT16 WINAPI WINSOCK_recv16(SOCKET16 s, char *buf, INT16 len, INT16 flags)
{
return (INT16)WSOCK32_recv( s, buf, len, flags );
return (INT16)WS_recv( s, buf, len, flags );
}
/***********************************************************************
* recvfrom (WS2_32.17)
*/
int WINAPI WSOCK32_recvfrom(SOCKET s, char *buf, INT len, int flags,
ws_sockaddr *from, int *fromlen)
int WINAPI WS_recvfrom(SOCKET s, char *buf, INT len, int flags,
struct WS_sockaddr *from, int *fromlen)
{
int fd = _get_sock_fd(s);
int res;
......@@ -1850,14 +1870,14 @@ int WINAPI WSOCK32_recvfrom(SOCKET s, char *buf, INT len, int flags,
* recvfrom (WINSOCK.17)
*/
INT16 WINAPI WINSOCK_recvfrom16(SOCKET16 s, char *buf, INT16 len, INT16 flags,
ws_sockaddr *from, INT16 *fromlen16)
struct WS_sockaddr *from, INT16 *fromlen16)
{
INT fromlen32;
INT *p = &fromlen32;
INT retVal;
if( fromlen16 ) fromlen32 = *fromlen16; else p = NULL;
retVal = WSOCK32_recvfrom( s, buf, len, flags, from, p );
retVal = WS_recvfrom( s, buf, len, flags, from, p );
if( fromlen16 ) *fromlen16 = fromlen32;
return (INT16)retVal;
}
......@@ -1865,9 +1885,9 @@ INT16 WINAPI WINSOCK_recvfrom16(SOCKET16 s, char *buf, INT16 len, INT16 flags,
/***********************************************************************
* __ws_select
*/
static INT __ws_select(BOOL b32,
static int __ws_select(BOOL b32,
void *ws_readfds, void *ws_writefds, void *ws_exceptfds,
const struct timeval* ws_timeout)
const struct WS_timeval *ws_timeout)
{
int highfd = 0;
fd_set readfds, writefds, exceptfds;
......@@ -1875,8 +1895,8 @@ static INT __ws_select(BOOL b32,
int readfd[FD_SETSIZE], writefd[FD_SETSIZE], exceptfd[FD_SETSIZE];
struct timeval timeout, *timeoutaddr = NULL;
TRACE("read %p, write %p, excp %p timeout %p\n",
ws_readfds, ws_writefds, ws_exceptfds, ws_timeout);
TRACE("read %p, write %p, excp %p timeout %p\n",
ws_readfds, ws_writefds, ws_exceptfds, ws_timeout);
p_read = fd_set_import(&readfds, ws_readfds, &highfd, readfd, b32);
p_write = fd_set_import(&writefds, ws_writefds, &highfd, writefd, b32);
......@@ -1896,7 +1916,7 @@ static INT __ws_select(BOOL b32,
if (p_except && ws_exceptfds)
{
#define wsfds16 ((ws_fd_set16*)ws_exceptfds)
#define wsfds32 ((ws_fd_set32*)ws_exceptfds)
#define wsfds32 ((WS_fd_set*)ws_exceptfds)
int i, j, count = (b32) ? wsfds32->fd_count : wsfds16->fd_count;
for (i = j = 0; i < count; i++)
......@@ -1924,9 +1944,9 @@ static INT __ws_select(BOOL b32,
fd_set_unimport(ws_readfds, readfd, b32);
fd_set_unimport(ws_writefds, writefd, b32);
fd_set_unimport(ws_exceptfds, exceptfd, b32);
if( ws_readfds ) ((ws_fd_set32*)ws_readfds)->fd_count = 0;
if( ws_writefds ) ((ws_fd_set32*)ws_writefds)->fd_count = 0;
if( ws_exceptfds ) ((ws_fd_set32*)ws_exceptfds)->fd_count = 0;
if( ws_readfds ) ((WS_fd_set*)ws_readfds)->fd_count = 0;
if( ws_writefds ) ((WS_fd_set*)ws_writefds)->fd_count = 0;
if( ws_exceptfds ) ((WS_fd_set*)ws_exceptfds)->fd_count = 0;
if( highfd == 0 ) return 0;
SetLastError(wsaErrno());
......@@ -1938,7 +1958,7 @@ static INT __ws_select(BOOL b32,
*/
INT16 WINAPI WINSOCK_select16(INT16 nfds, ws_fd_set16 *ws_readfds,
ws_fd_set16 *ws_writefds, ws_fd_set16 *ws_exceptfds,
struct timeval *timeout)
struct WS_timeval* timeout)
{
return (INT16)__ws_select( FALSE, ws_readfds, ws_writefds, ws_exceptfds, timeout );
}
......@@ -1946,9 +1966,9 @@ INT16 WINAPI WINSOCK_select16(INT16 nfds, ws_fd_set16 *ws_readfds,
/***********************************************************************
* select (WS2_32.18)
*/
INT WINAPI WSOCK32_select(INT nfds, ws_fd_set32 *ws_readfds,
ws_fd_set32 *ws_writefds, ws_fd_set32 *ws_exceptfds,
const struct timeval *timeout)
int WINAPI WS_select(int nfds, WS_fd_set *ws_readfds,
WS_fd_set *ws_writefds, WS_fd_set *ws_exceptfds,
const struct WS_timeval* timeout)
{
/* struct timeval is the same for both 32- and 16-bit code */
return (INT)__ws_select( TRUE, ws_readfds, ws_writefds, ws_exceptfds, timeout );
......@@ -1958,7 +1978,7 @@ INT WINAPI WSOCK32_select(INT nfds, ws_fd_set32 *ws_readfds,
/***********************************************************************
* send (WS2_32.19)
*/
INT WINAPI WSOCK32_send(SOCKET s, char *buf, INT len, INT flags)
int WINAPI WS_send(SOCKET s, const char *buf, int len, int flags)
{
int fd = _get_sock_fd(s);
......@@ -2024,7 +2044,7 @@ INT WINAPI WSASend( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
/* Send all buffers with the same flags */
for(dwCount = 0; dwCount < dwBufferCount; dwCount++ )
{
if( ( rc = WSOCK32_send( s, lpBuffers[ dwCount ].buf,
if( ( rc = WS_send( s, lpBuffers[ dwCount ].buf,
lpBuffers[ dwCount ].len, iFlags ) ) != 0 )
{
break;
......@@ -2042,14 +2062,14 @@ INT WINAPI WSASend( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
*/
INT16 WINAPI WINSOCK_send16(SOCKET16 s, char *buf, INT16 len, INT16 flags)
{
return WSOCK32_send( s, buf, len, flags );
return WS_send( s, buf, len, flags );
}
/***********************************************************************
* sendto (WS2_32.20)
*/
int WINAPI WSOCK32_sendto(SOCKET s, const char *buf, int len, int flags,
const ws_sockaddr *to, int tolen)
int WINAPI WS_sendto(SOCKET s, const char *buf, int len, int flags,
const struct WS_sockaddr *to, int tolen)
{
int fd = _get_sock_fd(s);
int res;
......@@ -2097,16 +2117,16 @@ int WINAPI WSOCK32_sendto(SOCKET s, const char *buf, int len, int flags,
* sendto (WINSOCK.20)
*/
INT16 WINAPI WINSOCK_sendto16(SOCKET16 s, char *buf, INT16 len, INT16 flags,
ws_sockaddr *to, INT16 tolen)
struct WS_sockaddr *to, INT16 tolen)
{
return (INT16)WSOCK32_sendto( s, buf, len, flags, to, tolen );
return (INT16)WS_sendto( s, buf, len, flags, to, tolen );
}
/***********************************************************************
* setsockopt (WS2_32.21)
*/
INT WINAPI WSOCK32_setsockopt(SOCKET16 s, INT level, INT optname,
char *optval, INT optlen)
int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
const char *optval, int optlen)
{
int fd = _get_sock_fd(s);
......@@ -2144,7 +2164,7 @@ INT WINAPI WSOCK32_setsockopt(SOCKET16 s, INT level, INT optname,
/* FIXME: what is documented behavior if SO_LINGER optval
is null?? */
optval = (char*)&linger;
optlen = sizeof(struct linger);
optlen = sizeof(struct WS_linger);
} else if (optlen < sizeof(int)){
woptval= *((INT16 *) optval);
optval= (char*) &woptval;
......@@ -2176,14 +2196,14 @@ INT16 WINAPI WINSOCK_setsockopt16(SOCKET16 s, INT16 level, INT16 optname,
char *optval, INT16 optlen)
{
if( !optval ) return SOCKET_ERROR;
return (INT16)WSOCK32_setsockopt( s, (UINT16)level, optname, optval, optlen );
return (INT16)WS_setsockopt( s, (UINT16)level, optname, optval, optlen );
}
/***********************************************************************
* shutdown (WS2_32.22)
*/
INT WINAPI WSOCK32_shutdown(SOCKET s, INT how)
int WINAPI WS_shutdown(SOCKET s, int how)
{
int fd = _get_sock_fd(s);
......@@ -2236,14 +2256,14 @@ INT WINAPI WSOCK32_shutdown(SOCKET s, INT how)
*/
INT16 WINAPI WINSOCK_shutdown16(SOCKET16 s, INT16 how)
{
return (INT16)WSOCK32_shutdown( s, how );
return (INT16)WS_shutdown( s, how );
}
/***********************************************************************
* socket (WS2_32.23)
*/
SOCKET WINAPI WSOCK32_socket(INT af, INT type, INT protocol)
SOCKET WINAPI WS_socket(int af, int type, int protocol)
{
SOCKET ret;
......@@ -2326,7 +2346,7 @@ SOCKET WINAPI WSOCK32_socket(INT af, INT type, INT protocol)
*/
SOCKET16 WINAPI WINSOCK_socket16(INT16 af, INT16 type, INT16 protocol)
{
return (SOCKET16)WSOCK32_socket( af, type, protocol );
return (SOCKET16)WS_socket( af, type, protocol );
}
......@@ -2398,8 +2418,8 @@ SEGPTR WINAPI WINSOCK_gethostbyaddr16(const char *addr, INT16 len, INT16 type)
/***********************************************************************
* gethostbyaddr (WS2_32.51)
*/
WIN_hostent* WINAPI WSOCK32_gethostbyaddr(const char *addr, INT len,
INT type)
struct WS_hostent* WINAPI WS_gethostbyaddr(const char *addr, int len,
int type)
{
TRACE("ptr %08x, len %d, type %d\n",
(unsigned) addr, len, type);
......@@ -2460,7 +2480,7 @@ SEGPTR WINAPI WINSOCK_gethostbyname16(const char *name)
/***********************************************************************
* gethostbyname (WS2_32.52)
*/
WIN_hostent* WINAPI WSOCK32_gethostbyname(const char* name)
struct WS_hostent* WINAPI WS_gethostbyname(const char* name)
{
TRACE("%s\n", (name)?name:NULL_STRING);
return __ws_gethostbyname( name, WS_DUP_LINEAR );
......@@ -2505,7 +2525,7 @@ SEGPTR WINAPI WINSOCK_getprotobyname16(const char *name)
/***********************************************************************
* getprotobyname (WS2_32.53)
*/
WIN_protoent* WINAPI WSOCK32_getprotobyname(const char* name)
struct WS_protoent* WINAPI WS_getprotobyname(const char* name)
{
TRACE("%s\n", (name)?name:NULL_STRING);
return __ws_getprotobyname(name, WS_DUP_LINEAR);
......@@ -2549,7 +2569,7 @@ SEGPTR WINAPI WINSOCK_getprotobynumber16(INT16 number)
/***********************************************************************
* getprotobynumber (WS2_32.54)
*/
WIN_protoent* WINAPI WSOCK32_getprotobynumber(INT number)
struct WS_protoent* WINAPI WS_getprotobynumber(int number)
{
TRACE("%i\n", number);
return __ws_getprotobynumber(number, WS_DUP_LINEAR);
......@@ -2602,7 +2622,7 @@ SEGPTR WINAPI WINSOCK_getservbyname16(const char *name, const char *proto)
/***********************************************************************
* getservbyname (WS2_32.55)
*/
WIN_servent* WINAPI WSOCK32_getservbyname(const char *name, const char *proto)
struct WS_servent* WINAPI WS_getservbyname(const char *name, const char *proto)
{
TRACE("'%s', '%s'\n",
(name)?name:NULL_STRING, (proto)?proto:NULL_STRING);
......@@ -2651,7 +2671,7 @@ SEGPTR WINAPI WINSOCK_getservbyport16(INT16 port, const char *proto)
/***********************************************************************
* getservbyport (WS2_32.56)
*/
WIN_servent* WINAPI WSOCK32_getservbyport(INT port, const char *proto)
struct WS_servent* WINAPI WS_getservbyport(int port, const char *proto)
{
TRACE("%d (i.e. port %d), '%s'\n",
(int)port, (int)ntohl(port), (proto)?proto:NULL_STRING);
......@@ -2662,7 +2682,7 @@ WIN_servent* WINAPI WSOCK32_getservbyport(INT port, const char *proto)
/***********************************************************************
* gethostname (WS2_32.57)
*/
INT WINAPI WSOCK32_gethostname(char *name, INT namelen)
int WINAPI WS_gethostname(char *name, int namelen)
{
TRACE("name %p, len %d\n", name, namelen);
......@@ -2681,7 +2701,7 @@ INT WINAPI WSOCK32_gethostname(char *name, INT namelen)
*/
INT16 WINAPI WINSOCK_gethostname16(char *name, INT16 namelen)
{
return (INT16)WSOCK32_gethostname(name, namelen);
return (INT16)WS_gethostname(name, namelen);
}
......@@ -2861,7 +2881,8 @@ INT16 WINAPI WSAAsyncSelect16(SOCKET16 s, HWND16 hWnd, UINT16 wMsg, LONG lEvent)
*
* See description for WSARecvEx()
*/
INT16 WINAPI WSARecvEx16(SOCKET16 s, char *buf, INT16 len, INT16 *flags) {
INT16 WINAPI WSARecvEx16(SOCKET16 s, char *buf, INT16 len, INT16 *flags)
{
FIXME("(WSARecvEx16) partial packet return value not set \n");
return WINSOCK_recv16(s, buf, len, *flags);
......@@ -2907,7 +2928,7 @@ SOCKET WINAPI WSASocketA(int af, int type, int protocol,
TRACE("af=%d type=%d protocol=%d protocol_info=%p group=%d flags=0x%lx\n",
af, type, protocol, lpProtocolInfo, g, dwFlags );
return ( WSOCK32_socket (af, type, protocol) );
return ( WS_socket (af, type, protocol) );
}
......@@ -2928,7 +2949,7 @@ INT16 WINAPI __WSAFDIsSet16(SOCKET16 s, ws_fd_set16 *set)
/***********************************************************************
* __WSAFDIsSet (WS2_32.151)
*/
INT WINAPI __WSAFDIsSet(SOCKET s, ws_fd_set32 *set)
int WINAPI __WSAFDIsSet(SOCKET s, WS_fd_set *set)
{
int i = set->fd_count;
......@@ -3080,7 +3101,7 @@ int WS_dup_he(struct hostent* p_he, int flag)
char *p_name,*p_aliases,*p_addr,*p_base,*p;
char *p_to;
struct ws_hostent16 *p_to16;
struct ws_hostent32 *p_to32;
struct WS_hostent *p_to32;
check_buffer_he(size);
p_to = he_buffer;
......@@ -3091,7 +3112,7 @@ int WS_dup_he(struct hostent* p_he, int flag)
p_base = (flag & WS_DUP_OFFSET) ? NULL
: ((flag & WS_DUP_SEGPTR) ? (char*)SEGPTR_GET(p) : p);
p += (flag & WS_DUP_SEGPTR) ?
sizeof(struct ws_hostent16) : sizeof(struct ws_hostent32);
sizeof(struct ws_hostent16) : sizeof(struct WS_hostent);
p_name = p;
strcpy(p, p_he->h_name); p += strlen(p) + 1;
p_aliases = p;
......@@ -3115,7 +3136,7 @@ int WS_dup_he(struct hostent* p_he, int flag)
p_to32->h_name = (p_base + (p_name - p_to));
p_to32->h_aliases = (char **)(p_base + (p_aliases - p_to));
p_to32->h_addr_list = (char **)(p_base + (p_addr - p_to));
size += (sizeof(struct ws_hostent32) - sizeof(struct hostent));
size += (sizeof(struct WS_hostent) - sizeof(struct hostent));
}
}
return size;
......@@ -3140,7 +3161,7 @@ int WS_dup_pe(struct protoent* p_pe, int flag)
{
char *p_to;
struct ws_protoent16 *p_to16;
struct ws_protoent32 *p_to32;
struct WS_protoent *p_to32;
char *p_name,*p_aliases,*p_base,*p;
check_buffer_pe(size);
......@@ -3151,7 +3172,7 @@ int WS_dup_pe(struct protoent* p_pe, int flag)
p_base = (flag & WS_DUP_OFFSET) ? NULL
: ((flag & WS_DUP_SEGPTR) ? (char*)SEGPTR_GET(p) : p);
p += (flag & WS_DUP_SEGPTR) ?
sizeof(struct ws_protoent16) : sizeof(struct ws_protoent32);
sizeof(struct ws_protoent16) : sizeof(struct WS_protoent);
p_name = p;
strcpy(p, p_pe->p_name); p += strlen(p) + 1;
p_aliases = p;
......@@ -3169,7 +3190,7 @@ int WS_dup_pe(struct protoent* p_pe, int flag)
p_to32->p_proto = p_pe->p_proto;
p_to32->p_name = (p_base) + (p_name - p_to);
p_to32->p_aliases = (char **)((p_base) + (p_aliases - p_to));
size += (sizeof(struct ws_protoent32) - sizeof(struct protoent));
size += (sizeof(struct WS_protoent) - sizeof(struct protoent));
}
}
return size;
......@@ -3195,7 +3216,7 @@ int WS_dup_se(struct servent* p_se, int flag)
char *p_name,*p_aliases,*p_proto,*p_base,*p;
char *p_to;
struct ws_servent16 *p_to16;
struct ws_servent32 *p_to32;
struct WS_servent *p_to32;
check_buffer_se(size);
p_to = se_buffer;
......@@ -3205,7 +3226,7 @@ int WS_dup_se(struct servent* p_se, int flag)
p_base = (flag & WS_DUP_OFFSET) ? NULL
: ((flag & WS_DUP_SEGPTR) ? (char*)SEGPTR_GET(p) : p);
p += (flag & WS_DUP_SEGPTR) ?
sizeof(struct ws_servent16) : sizeof(struct ws_servent32);
sizeof(struct ws_servent16) : sizeof(struct WS_servent);
p_name = p;
strcpy(p, p_se->s_name); p += strlen(p) + 1;
p_proto = p;
......@@ -3227,7 +3248,7 @@ int WS_dup_se(struct servent* p_se, int flag)
p_to32->s_name = (p_base + (p_name - p_to));
p_to32->s_proto = (p_base + (p_proto - p_to));
p_to32->s_aliases = (char **)(p_base + (p_aliases - p_to));
size += (sizeof(struct ws_servent32) - sizeof(struct servent));
size += (sizeof(struct WS_servent) - sizeof(struct servent));
}
}
return size;
......@@ -3331,7 +3352,7 @@ UINT16 wsaHerrno(int loc_errno)
* WSARecvFrom (WS2_32.69)
*/
INT WINAPI WSARecvFrom( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
LPDWORD lpNumberOfBytesRecvd, LPDWORD lpFlags, struct sockaddr *lpFrom,
LPDWORD lpNumberOfBytesRecvd, LPDWORD lpFlags, struct WS_sockaddr *lpFrom,
LPINT lpFromlen, LPWSAOVERLAPPED lpOverlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine )
{
......@@ -3345,7 +3366,7 @@ INT WINAPI WSARecvFrom( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
for( dwCount = 0, rc = 0; dwCount < dwBufferCount; dwCount++ )
{
if( ( rc = WSOCK32_recvfrom(s, lpBuffers[ dwCount ].buf, (INT)lpBuffers[ dwCount ].len,
if( ( rc = WS_recvfrom(s, lpBuffers[ dwCount ].buf, (INT)lpBuffers[ dwCount ].len,
(INT)*lpFlags, lpFrom, lpFromlen ) ) != 0 )
{
break;
......
......@@ -14,14 +14,14 @@ owner ws2_32
5 pascal16 getpeername(word ptr ptr) WINSOCK_getpeername16
6 pascal16 getsockname(word ptr ptr) WINSOCK_getsockname16
7 pascal16 getsockopt(word word word ptr ptr) WINSOCK_getsockopt16
8 pascal htonl(long) WINSOCK_htonl
9 pascal16 htons(word) WINSOCK_htons
10 pascal inet_addr(ptr) WINSOCK_inet_addr
8 pascal htonl(long) WS_htonl
9 pascal16 htons(word) WS_htons
10 pascal inet_addr(ptr) WS_inet_addr
11 pascal inet_ntoa(long) WINSOCK_inet_ntoa16
12 pascal16 ioctlsocket(word long ptr) WINSOCK_ioctlsocket16
13 pascal16 listen(word word) WINSOCK_listen16
14 pascal ntohl(long) WINSOCK_ntohl
15 pascal16 ntohs(word) WINSOCK_ntohs
14 pascal ntohl(long) WS_ntohl
15 pascal16 ntohs(word) WS_ntohs
16 pascal16 recv(word ptr word word) WINSOCK_recv16
17 pascal16 recvfrom(word ptr word word ptr ptr) WINSOCK_recvfrom16
18 pascal16 select(word ptr ptr ptr ptr) WINSOCK_select16
......
......@@ -4,7 +4,7 @@
name ws2_32
type win32
init WSOCK32_LibMain
init WS_LibMain
import user32.dll
import kernel32.dll
......@@ -13,29 +13,29 @@ import ntdll.dll
debug_channels (winsock)
# EXPORTS ***********
1 stdcall accept(long ptr ptr) WSOCK32_accept
2 stdcall bind(long ptr long) WSOCK32_bind
3 stdcall closesocket(long) WSOCK32_closesocket
4 stdcall connect(long ptr long) WSOCK32_connect
5 stdcall getpeername(long ptr ptr) WSOCK32_getpeername
6 stdcall getsockname(long ptr ptr) WSOCK32_getsockname
7 stdcall getsockopt(long long long ptr ptr) WSOCK32_getsockopt
8 stdcall htonl(long) WINSOCK_htonl
9 stdcall htons(long) WINSOCK_htons
10 stdcall ioctlsocket(long long ptr) WSOCK32_ioctlsocket
11 stdcall inet_addr(str) WINSOCK_inet_addr
12 stdcall inet_ntoa(ptr) WSOCK32_inet_ntoa
13 stdcall listen(long long) WSOCK32_listen
14 stdcall ntohl(long) WINSOCK_ntohl
15 stdcall ntohs(long) WINSOCK_ntohs
16 stdcall recv(long ptr long long) WSOCK32_recv
17 stdcall recvfrom(long ptr long long ptr ptr) WSOCK32_recvfrom
18 stdcall select(long ptr ptr ptr ptr) WSOCK32_select
19 stdcall send(long ptr long long) WSOCK32_send
20 stdcall sendto(long ptr long long ptr long) WSOCK32_sendto
21 stdcall setsockopt(long long long ptr long) WSOCK32_setsockopt
22 stdcall shutdown(long long) WSOCK32_shutdown
23 stdcall socket(long long long) WSOCK32_socket
1 stdcall accept(long ptr ptr) WS_accept
2 stdcall bind(long ptr long) WS_bind
3 stdcall closesocket(long) WS_closesocket
4 stdcall connect(long ptr long) WS_connect
5 stdcall getpeername(long ptr ptr) WS_getpeername
6 stdcall getsockname(long ptr ptr) WS_getsockname
7 stdcall getsockopt(long long long ptr ptr) WS_getsockopt
8 stdcall htonl(long) WS_htonl
9 stdcall htons(long) WS_htons
10 stdcall ioctlsocket(long long ptr) WS_ioctlsocket
11 stdcall inet_addr(str) WS_inet_addr
12 stdcall inet_ntoa(ptr) WS_inet_ntoa
13 stdcall listen(long long) WS_listen
14 stdcall ntohl(long) WS_ntohl
15 stdcall ntohs(long) WS_ntohs
16 stdcall recv(long ptr long long) WS_recv
17 stdcall recvfrom(long ptr long long ptr ptr) WS_recvfrom
18 stdcall select(long ptr ptr ptr ptr) WS_select
19 stdcall send(long ptr long long) WS_send
20 stdcall sendto(long ptr long long ptr long) WS_sendto
21 stdcall setsockopt(long long long ptr long) WS_setsockopt
22 stdcall shutdown(long long) WS_shutdown
23 stdcall socket(long long long) WS_socket
24 stdcall WSApSetPostRoutine(ptr) WSApSetPostRoutine
25 stub WPUCompleteOverlappedRequest
26 stub WSAAccept
......@@ -63,13 +63,13 @@ debug_channels (winsock)
48 stub WSAInstallServiceClassA
49 stub WSAInstallServiceClassW
50 stdcall WSAIoctl(long long ptr long ptr long ptr ptr ptr) WSAIoctl
51 stdcall gethostbyaddr(ptr long long) WSOCK32_gethostbyaddr
52 stdcall gethostbyname(str) WSOCK32_gethostbyname
53 stdcall getprotobyname(str) WSOCK32_getprotobyname
54 stdcall getprotobynumber(long) WSOCK32_getprotobynumber
55 stdcall getservbyname(str str) WSOCK32_getservbyname
56 stdcall getservbyport(long str) WSOCK32_getservbyport
57 stdcall gethostname(ptr long) WSOCK32_gethostname
51 stdcall gethostbyaddr(ptr long long) WS_gethostbyaddr
52 stdcall gethostbyname(str) WS_gethostbyname
53 stdcall getprotobyname(str) WS_getprotobyname
54 stdcall getprotobynumber(long) WS_getprotobynumber
55 stdcall getservbyname(str str) WS_getservbyname
56 stdcall getservbyport(long str) WS_getservbyport
57 stdcall gethostname(ptr long) WS_gethostname
58 stub WSAJoinLeaf
59 stub WSALookupServiceBeginA
60 stub WSALookupServiceBeginW
......
......@@ -4,10 +4,20 @@
* Copyright (C) 2001 Stefan Leichter
*/
/* All we need are a couple constants for EnumProtocols. Once it is
* moved to ws2_32 we may no longer need it
*/
#define USE_WS_PREFIX
#include "config.h"
#include <arpa/inet.h>
#include <netdb.h>
#include <netinet/in.h>
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include "winbase.h"
#include "winnls.h"
#include "wine/unicode.h"
......@@ -52,12 +62,12 @@ static INT WSOCK32_EnterSingleProtocol( INT iProtocol,
*lpSize = sizeof( PROTOCOL_INFOA);
switch (iProtocol) {
case IPPROTO_TCP :
case WS_IPPROTO_TCP :
dwLength = (unicode) ? sizeof(WCHAR) * (strlenW(NameTcp)+1) :
WideCharToMultiByte( CP_ACP, 0, NameTcp, -1,
NULL, 0, NULL, NULL);
break;
case IPPROTO_UDP :
case WS_IPPROTO_UDP :
dwLength = (unicode) ? sizeof(WCHAR) * (strlenW(NameUdp)+1) :
WideCharToMultiByte( CP_ACP, 0, NameUdp, -1,
NULL, 0, NULL, NULL);
......@@ -97,7 +107,7 @@ static INT WSOCK32_EnterSingleProtocol( INT iProtocol,
lpBuffer->iProtocol = iProtocol;
switch (iProtocol) {
case IPPROTO_TCP :
case WS_IPPROTO_TCP :
lpBuffer->dwServiceFlags = XP_FRAGMENTATION | XP_EXPEDITED_DATA |
XP_GRACEFUL_CLOSE | XP_GUARANTEED_ORDER |
XP_GUARANTEED_DELIVERY;
......@@ -108,7 +118,7 @@ static INT WSOCK32_EnterSingleProtocol( INT iProtocol,
lpBuffer->dwMessageSize = 0;
lpProtName = NameTcp;
break;
case IPPROTO_UDP :
case WS_IPPROTO_UDP :
lpBuffer->dwServiceFlags = XP_FRAGMENTATION | XP_SUPPORTS_BROADCAST |
XP_SUPPORTS_MULTICAST | XP_MESSAGE_ORIENTED |
XP_CONNECTIONLESS;
......@@ -162,6 +172,10 @@ static INT WSOCK32_EnterSingleProtocol( INT iProtocol,
return iAnz;
}
/* FIXME: EnumProtocols should be moved to winsock2, and this should be
* implemented by calling out to WSAEnumProtocols. See:
* http://support.microsoft.com/support/kb/articles/Q129/3/15.asp
*/
/*****************************************************************************
* WSOCK32_EnumProtocol [internal]
*
......@@ -194,7 +208,7 @@ static INT WSOCK32_EnumProtocol( LPINT lpiProtocols, PROTOCOL_INFOA* lpBuffer,
LPDWORD lpdwLength, BOOL unicode)
{ DWORD dwCurSize, dwOldSize = *lpdwLength, dwTemp;
INT anz = 0, i;
INT iLocal[] = { IPPROTO_TCP, IPPROTO_UDP, NSPROTO_IPX, NSPROTO_SPXII, 0};
INT iLocal[] = { WS_IPPROTO_TCP, WS_IPPROTO_UDP, NSPROTO_IPX, NSPROTO_SPXII, 0};
if (!lpiProtocols) lpiProtocols = iLocal;
......
......@@ -5,17 +5,23 @@
*/
/*
FIXME: This hack is fixing a problem in WsControl. When we call socket(),
it is supposed to call into ws2_32's WSOCK32_socket.
The problem is that socket() is predefined in a linux system header that
we are including, which is different from the WINE definition.
(cdecl vs. stdapi) The result is stack corruption.
The correct answer to this problem is to make winsock.h not dependent
on system headers, that way all of our functions are defined consistently.
Until that happens we need this hack.
*/
/* FIXME: This hack is fixing a problem in WsControl. When we call socket(),
* it will call into ws2_32's WSOCK32_socket (because of the redirection in
* our own .spec file).
* The problem is that socket() is predefined in a linux system header that
* we are including, which is different from the WINE definition.
* (cdecl vs. stdapi). The result is stack corruption.
* Furthermore WsControl uses Unix macros and types. This forces us to include
* the Unix headers which then conflict with the winsock headers. This forces
* us to use USE_WS_PREFIX but then ioctlsocket is called WS_ioctlsocket,
* which causes link problems. The correct solution is to implement
* WsControl using calls to WSAIoctl. Then we should no longer need to use the
* Unix headers. This would also have the advantage of reducing code
* duplication.
* Until that happens we need this ugly hack.
*/
#define USE_WS_PREFIX
#define socket linux_socket
#define recv linux_recv
/* */
......@@ -31,6 +37,7 @@
#include "winnt.h"
#include "wscontrol.h"
#include <ctype.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -48,11 +55,15 @@
#endif
/* FIXME: The rest of the socket() cdecl<->stdapi stack corruption problem
discussed above. */
* discussed above.
*/
#undef socket
#undef recv
extern SOCKET WINAPI socket(INT af, INT type, INT protocol);
extern SOCKET WINAPI recv(SOCKET,char*,int,int);
/* Plus some missing prototypes, due to the WS_ prefixing */
extern int WINAPI closesocket(SOCKET);
extern int WINAPI ioctlsocket(SOCKET,long,u_long*);
/* */
......@@ -199,7 +210,7 @@ DWORD WINAPI WsControl(DWORD protocoll,
}
/* Get a socket so that we can use ioctl */
if ( (sock = socket (AF_INET, SOCK_DGRAM, 0)) == INVALID_SOCKET)
if ( (sock = socket(AF_INET, SOCK_DGRAM, 0)) == INVALID_SOCKET)
{
ERR ("Error creating socket!\n");
return (-1);
......@@ -365,7 +376,7 @@ DWORD WINAPI WsControl(DWORD protocoll,
/* Get a socket so we can use ioctl */
if ( (sock = socket (AF_INET, SOCK_DGRAM, 0)) == INVALID_SOCKET)
if ( (sock = socket(AF_INET, SOCK_DGRAM, 0)) == INVALID_SOCKET)
{
ERR ("Error creating socket!\n");
return (-1);
......@@ -380,13 +391,13 @@ DWORD WINAPI WsControl(DWORD protocoll,
/* IP Address */
strcpy (ifInfo.ifr_name, ifName);
ifInfo.ifr_addr.sa_family = AF_INET;
if (ioctlsocket(sock, SIOCGIFADDR, (ULONG*)&ifInfo) < 0)
if (ioctlsocket(sock, SIOCGIFADDR, (ULONG*)&ifInfo) < 0)
{
baseIPInfo->iae_addr = 0x0;
}
else
{
struct ws_sockaddr_in *ipTemp = (struct ws_sockaddr_in *)&ifInfo.ifr_addr;
struct WS_sockaddr_in* ipTemp = (struct WS_sockaddr_in*)&ifInfo.ifr_addr;
baseIPInfo->iae_addr = ipTemp->sin_addr.S_un.S_addr;
}
......@@ -398,8 +409,8 @@ DWORD WINAPI WsControl(DWORD protocoll,
}
else
{
struct ws_sockaddr_in *ipTemp = (struct ws_sockaddr_in *)&ifInfo.ifr_broadaddr;
baseIPInfo->iae_bcastaddr = ipTemp->sin_addr.S_un.S_addr;
struct WS_sockaddr_in* ipTemp = (struct WS_sockaddr_in*)&ifInfo.ifr_broadaddr;
baseIPInfo->iae_bcastaddr = ipTemp->sin_addr.S_un.S_addr;
}
/* Subnet Mask */
......@@ -417,12 +428,12 @@ DWORD WINAPI WsControl(DWORD protocoll,
baseIPInfo->iae_mask = 0;
ERR ("Unable to determine Netmask on your platform!\n");
#else
struct ws_sockaddr_in *ipTemp = (struct ws_sockaddr_in *)&ifInfo.ifr_addr;
baseIPInfo->iae_mask = ipTemp->sin_addr.S_un.S_addr;
struct WS_sockaddr_in* ipTemp = (struct WS_sockaddr_in*)&ifInfo.ifr_addr;
baseIPInfo->iae_mask = ipTemp->sin_addr.S_un.S_addr;
#endif
#else
struct ws_sockaddr_in *ipTemp = (struct ws_sockaddr_in *)&ifInfo.ifr_netmask;
baseIPInfo->iae_mask = ipTemp->sin_addr.S_un.S_addr;
#else
struct WS_sockaddr_in* ipTemp = (struct WS_sockaddr_in*)&ifInfo.ifr_netmask;
baseIPInfo->iae_mask = ipTemp->sin_addr.S_un.S_addr;
#endif
}
......@@ -959,7 +970,7 @@ INT WINAPI WSARecvEx(SOCKET s, char *buf, INT len, INT *flags)
/***********************************************************************
* s_perror (WSOCK32.1108)
*/
void WINAPI WS_s_perror(LPCSTR message)
void WINAPI s_perror(LPCSTR message)
{
FIXME("(%s): stub\n",message);
return;
......
......@@ -68,7 +68,7 @@ debug_channels (winsock)
#1105 stub sethostname
#1106 stub dn_expand
1107 stdcall WSARecvEx(long ptr long ptr) WSARecvEx
1108 stdcall s_perror(str) WS_s_perror
1108 stdcall s_perror(str) s_perror
1109 stub GetAddressByNameA
1110 stub GetAddressByNameW
1111 stdcall EnumProtocolsA(ptr ptr ptr) EnumProtocolsA
......
......@@ -188,6 +188,7 @@ INSTALLED_INCLUDES = \
wnaspi32.h \
wownt32.h \
ws2spi.h \
ws2tcpip.h \
wshisotp.h \
wsipx.h \
wtypes.h \
......
......@@ -35,8 +35,10 @@
#include "shellapi.h"
/* #include "winperf.h" */
#ifndef WINE_NOWINSOCK
#include "winsock2.h"
/* #include "mswsock.h" */
#endif /* WINE_NOWINSOCK */
#ifndef NOCRYPT
#include "wincrypt.h"
......
......@@ -60,7 +60,7 @@ typedef struct WSAData16
#include "poppack.h"
#define WS_FD_CLR16(fd, set) __WS_FD_CLR((fd),(set), ws_fd_set16)
#define WS_FD_SET16(fd, set) __WS_FD_SET((fd),(set), ws_fd_set16)
#define WS_FD_SET16(fd, set) __WS_FD_SET1((fd),(set), ws_fd_set16)
#define WS_FD_ZERO16(set) (((ws_fd_set16*)(set))->fd_count=0)
#define WS_FD_ISSET16(fd, set) __WSAFDIsSet16((SOCKET16)(fd), (ws_fd_set16*)(set))
......
......@@ -4,113 +4,415 @@
* specification.
*/
#ifdef __WINE__
# ifndef __WINE_WINSOCK2__
# error Please use Winsock2 in Wine
# endif
#endif
#ifndef _WINSOCKAPI_
#define _WINSOCKAPI_
#ifndef RC_INVOKED
#include <sys/types.h>
#ifndef __WINE__
#if defined(__svr4__) || defined(__NetBSD__) || defined(__FreeBSD__)
#ifndef HAVE_SYS_SOCKET_H
#define HAVE_SYS_SOCKET_H
#endif /* HAVE_SYS_SOCKET_H */
#endif /* __svr4__ || __NetBSD__ || __FreeBSD__ */
#endif /* __WINE__ */
/* Solaris uses these macro names */
#undef FSHIFT
#undef TRANSPARENT
#include <netinet/in.h>
/* Restore the Windows values */
#ifdef _WINUSER_
#undef FSHIFT
#define FSHIFT 0x04
# include "windows.h"
#else
# include "windef.h"
#endif
#ifdef _WINGDI_
#undef TRANSPARENT
#define TRANSPARENT 1
/*
* Setup phase
*/
#ifdef USE_WS_PREFIX
# define WS(x) WS_##x
#else
# define WS(x) x
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif /* HAVE_ARPA_INET_H */
#include <sys/time.h>
#include <fcntl.h>
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif /* HAVE_NETDB_H */
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif /* HAVE_SYS_SOCKET_H */
#include <sys/ioctl.h>
#endif /* RC_INVOKED */
#include "windef.h"
#ifdef __cplusplus
extern "C" {
#endif /* defined(__cplusplus) */
/* no "forced" alignment of ws_XXXXent here ! */
typedef struct ws_hostent
/* proper 4-byte packing */
#include "pshpack4.h"
/*
* This section defines the items that conflict with the Unix headers.
*/
#ifndef __WINE_USE_MSVCRT
/* Get the u_xxx types from the Unix headers. They will do and
* doing it this way will avoid redefinitions.
*/
# include <sys/types.h>
#else
/* Since we are using the MSVCRT headers, we must define the u_xxx
* types ourselves.
*/
typedef unsigned char u_char;
typedef unsigned char u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
#endif /* __WINE_USE_MSVCRT */
/*
* Address families
*/
#ifndef USE_WS_PREFIX
#define AF_UNSPEC 0
#define AF_UNIX 1
#define AF_INET 2
#define AF_IMPLINK 3
#define AF_PUP 4
#define AF_CHAOS 5
#define AF_NS 6
#define AF_IPX AF_NS
#define AF_ISO 7
#define AF_OSI AF_ISO
#define AF_ECMA 8
#define AF_DATAKIT 9
#define AF_CCITT 10
#define AF_SNA 11
#define AF_DECnet 12
#define AF_DLI 13
#define AF_LAT 14
#define AF_HYLINK 15
#define AF_APPLETALK 16
#define AF_NETBIOS 17
#define AF_VOICEVIEW 18
#define AF_FIREFOX 19
#define AF_UNKNOWN1 20
#define AF_BAN 21
#define AF_ATM 22
#define AF_INET6 23
#define AF_CLUSTER 24
#define AF_12844 25
#define AF_IRDA 26
#define AF_MAX 27
#define PF_UNSPEC AF_UNSPEC
#define PF_UNIX AF_UNIX
#define PF_INET AF_INET
#define PF_IMPLINK AF_IMPLINK
#define PF_PUP AF_PUP
#define PF_CHAOS AF_CHAOS
#define PF_NS AF_NS
#define PF_IPX AF_IPX
#define PF_ISO AF_ISO
#define PF_OSI AF_OSI
#define PF_ECMA AF_ECMA
#define PF_DATAKIT AF_DATAKIT
#define PF_CCITT AF_CCITT
#define PF_SNA AF_SNA
#define PF_DECnet AF_DECnet
#define PF_DLI AF_DLI
#define PF_LAT AF_LAT
#define PF_HYLINK AF_HYLINK
#define PF_APPLETALK AF_APPLETALK
#define PF_VOICEVIEW AF_VOICEVIEW
#define PF_FIREFOX AF_FIREFOX
#define PF_UNKNOWN1 AF_UNKNOWN1
#define PF_BAN AF_BAN
#define PF_MAX AF_MAX
#else /* USE_WS_PREFIX */
#define WS_AF_UNSPEC 0
#define WS_AF_UNIX 1
#define WS_AF_INET 2
#define WS_AF_IMPLINK 3
#define WS_AF_PUP 4
#define WS_AF_CHAOS 5
#define WS_AF_NS 6
#define WS_AF_IPX WS_AF_NS
#define WS_AF_ISO 7
#define WS_AF_OSI AF_ISO
#define WS_AF_ECMA 8
#define WS_AF_DATAKIT 9
#define WS_AF_CCITT 10
#define WS_AF_SNA 11
#define WS_AF_DECnet 12
#define WS_AF_DLI 13
#define WS_AF_LAT 14
#define WS_AF_HYLINK 15
#define WS_AF_APPLETALK 16
#define WS_AF_NETBIOS 17
#define WS_AF_VOICEVIEW 18
#define WS_AF_FIREFOX 19
#define WS_AF_UNKNOWN1 20
#define WS_AF_BAN 21
#define WS_AF_ATM 22
#define WS_AF_INET6 23
#define WS_AF_CLUSTER 24
#define WS_AF_12844 25
#define WS_AF_IRDA 26
#define WS_AF_MAX 27
#endif /* USE_WS_PREFIX */
/*
* Types
*/
#ifndef USE_WS_PREFIX
#define SOCK_STREAM 1
#define SOCK_DGRAM 2
#define SOCK_RAW 3
#define SOCK_RDM 4
#define SOCK_SEQPACKET 5
#else /* USE_WS_PREFIX */
#define WS_SOCK_STREAM 1
#define WS_SOCK_DGRAM 2
#define WS_SOCK_RAW 3
#define WS_SOCK_RDM 4
#define WS_SOCK_SEQPACKET 5
#endif /* USE_WS_PREFIX */
/*
* Protocols
*/
#ifndef USE_WS_PREFIX
#define IPPROTO_IP 0
#define IPPROTO_ICMP 1
#define IPPROTO_IGMP 2
#define IPPROTO_GGP 3
#define IPPROTO_TCP 6
#define IPPROTO_UDP 17
#define IPPROTO_IDP 22
#define IPPROTO_ND 77
#define IPPROTO_RAW 255
#define IPPROTO_MAX 256
#else /* USE_WS_PREFIX */
#define WS_IPPROTO_IP 0
#define WS_IPPROTO_ICMP 1
#define WS_IPPROTO_IGMP 2
#define WS_IPPROTO_GGP 3
#define WS_IPPROTO_TCP 6
#define WS_IPPROTO_UDP 17
#define WS_IPPROTO_IDP 22
#define WS_IPPROTO_ND 77
#define WS_IPPROTO_RAW 255
#define WS_IPPROTO_MAX 256
#endif /* USE_WS_PREFIX */
typedef struct WS(protoent)
{
char *h_name; /* official name of host */
char **h_aliases; /* alias list */
short h_addrtype; /* host address type */
short h_length; /* length of address */
char **h_addr_list; /* list of addresses from name server */
} _ws_hostent;
typedef struct ws_protoent
char* p_name;
char** p_aliases;
short p_proto;
} PROTOENT, *PPROTOENT, *LPPROTOENT;
/*
* Networks
*/
struct WS(netent)
{
char *p_name; /* official protocol name */
char **p_aliases; /* alias list */
short p_proto; /* protocol # */
} _ws_protoent;
char* n_name; /* official name of net */
char** n_aliases; /* alias list */
short n_addrtype; /* net address type */
u_long n_net; /* network # */
};
typedef struct ws_servent
/*
* Services
*/
#ifndef USE_WS_PREFIX
#define IPPORT_ECHO 7
#define IPPORT_DISCARD 9
#define IPPORT_SYSTAT 11
#define IPPORT_DAYTIME 13
#define IPPORT_NETSTAT 15
#define IPPORT_FTP 21
#define IPPORT_TELNET 23
#define IPPORT_SMTP 25
#define IPPORT_TIMESERVER 37
#define IPPORT_NAMESERVER 42
#define IPPORT_WHOIS 43
#define IPPORT_MTP 57
#define IPPORT_TFTP 69
#define IPPORT_RJE 77
#define IPPORT_FINGER 79
#define IPPORT_TTYLINK 87
#define IPPORT_SUPDUP 95
#define IPPORT_EXECSERVER 512
#define IPPORT_LOGINSERVER 513
#define IPPORT_CMDSERVER 514
#define IPPORT_EFSSERVER 520
#define IPPORT_BIFFUDP 512
#define IPPORT_WHOSERVER 513
#define IPPORT_ROUTESERVER 520
#define IPPORT_RESERVED 1024
#else /* USE_WS_PREFIX */
#define WS_IPPORT_ECHO 7
#define WS_IPPORT_DISCARD 9
#define WS_IPPORT_SYSTAT 11
#define WS_IPPORT_DAYTIME 13
#define WS_IPPORT_NETSTAT 15
#define WS_IPPORT_FTP 21
#define WS_IPPORT_TELNET 23
#define WS_IPPORT_SMTP 25
#define WS_IPPORT_TIMESERVER 37
#define WS_IPPORT_NAMESERVER 42
#define WS_IPPORT_WHOIS 43
#define WS_IPPORT_MTP 57
#define WS_IPPORT_TFTP 69
#define WS_IPPORT_RJE 77
#define WS_IPPORT_FINGER 79
#define WS_IPPORT_TTYLINK 87
#define WS_IPPORT_SUPDUP 95
#define WS_IPPORT_EXECSERVER 512
#define WS_IPPORT_LOGINSERVER 513
#define WS_IPPORT_CMDSERVER 514
#define WS_IPPORT_EFSSERVER 520
#define WS_IPPORT_BIFFUDP 512
#define WS_IPPORT_WHOSERVER 513
#define WS_IPPORT_ROUTESERVER 520
#define WS_IPPORT_RESERVED 1024
#endif /* USE_WS_PREFIX */
typedef struct WS(servent)
{
char *s_name; /* official service name */
char **s_aliases; /* alias list */
short s_port; /* port # */
char *s_proto; /* protocol to use */
} _ws_servent;
char* s_name; /* official service name */
char** s_aliases; /* alias list */
short s_port; /* port # */
char* s_proto; /* protocol to use */
} SERVENT, *PSERVENT, *LPSERVENT;
typedef struct ws_netent
/*
* Hosts
*/
typedef struct WS(hostent)
{
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
short n_addrtype; /* net address type */
u_long n_net; /* network # */
} _ws_netent;
char* h_name; /* official name of host */
char** h_aliases; /* alias list */
short h_addrtype; /* host address type */
short h_length; /* length of address */
char** h_addr_list; /* list of addresses from name server */
#define h_addr h_addr_list[0] /* address, for backward compat */
} HOSTENT, *PHOSTENT, *LPHOSTENT;
#include "pshpack1.h"
typedef UINT SOCKET;
/*
* Sockets
*/
typedef struct sockaddr ws_sockaddr;
typedef u_int SOCKET;
typedef struct ws_fd_set32_struct
/*
* This is used instead of -1, since the
* SOCKET type is unsigned.
*/
#define INVALID_SOCKET (~0)
#define SOCKET_ERROR (-1)
typedef struct WS(sockaddr)
{
UINT fd_count; /* how many are SET? */
SOCKET fd_array[FD_SETSIZE]; /* an array of SOCKETs */
} ws_fd_set32;
u_short sa_family;
char sa_data[14];
} SOCKADDR, *PSOCKADDR, *LPSOCKADDR;
typedef struct WS(linger)
{
u_short l_onoff; /* option on/off */
u_short l_linger; /* linger time */
} LINGER, *PLINGER, *LPLINGER;
/* ws_fd_set operations */
/*
* Select
*/
INT WINAPI __WSAFDIsSet( SOCKET, ws_fd_set32 * );
#if !defined(USE_WS_PREFIX) && !defined(__WINE_USE_MSVCRT)
/* We are not using the WS_ prefix and not using the MSVCRT either so we
* risk getting conflicts for everything related to select.
*/
# ifdef FD_CLR
/* Too late, the Unix version of stdlib.h was included before winsock.h.
* This means select and all the related stuff is already defined and we
* cannot override types and function prototypes.
* All we can do is disable all these symbols so that they are not used
* inadvertantly.
*/
# undef FD_SETSIZE
# undef FD_CLR
# undef FD_SET
# undef FD_ZERO
# undef FD_ISSET
# define FD_SETSIZE Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
# define FD_CLR Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
# define FD_SET Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
# define FD_ZERO Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
# define FD_ISSET Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
# define fd_set Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
# define select Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
# else
/* stdlib.h has not been included yet so it's not too late. Include it now
* making sure that none of the select symbols is affected. Then we can
* define them with our own values.
*/
# define fd_set unix_fd_set
# define timeval unix_timeval
# define select unix_select
# include <stdlib.h>
# undef fd_set
# undef timeval
# undef select
# undef FD_SETSIZE
# undef FD_CLR
# undef FD_SET
# undef FD_ZERO
# undef FD_ISSET
# define WS_DEFINE_SELECT
# endif /* FD_CLR */
#else
# define WS_DEFINE_SELECT
#endif /* !USE_WS_PREFIX && !__WINE_USE_MSVCRT */
#ifdef WS_DEFINE_SELECT
# undef WS_DEFINE_SELECT
/* Define our own version of select and the associated types and macros */
# ifndef USE_WS_PREFIX
# ifndef FD_SETSIZE
# define FD_SETSIZE 64
# endif
# else
# ifndef WS_FD_SETSIZE
# define WS_FD_SETSIZE 64
# endif
# endif
typedef struct WS(fd_set)
{
u_int fd_count; /* how many are SET? */
# ifndef USE_WS_PREFIX
SOCKET fd_array[FD_SETSIZE]; /* an array of SOCKETs */
# else
SOCKET fd_array[WS_FD_SETSIZE];/* an array of SOCKETs */
# endif
} WS(fd_set), FD_SET, *PFD_SET, *LPFD_SET;
typedef struct WS(timeval)
{
long tv_sec; /* seconds */
long tv_usec; /* and microseconds */
} TIMEVAL, *PTIMEVAL, *LPTIMEVAL;
#define __WS_FD_CLR(fd, set, cast) do { \
UINT __i; \
#define WINE_FD_CLR(fd, set, cast) do { \
u_int __i; \
for (__i = 0; __i < ((cast*)(set))->fd_count ; __i++) \
{ \
if (((cast*)(set))->fd_array[__i] == fd) \
{ \
{ \
while (__i < ((cast*)(set))->fd_count-1) \
{ \
{ \
((cast*)(set))->fd_array[__i] = \
((cast*)(set))->fd_array[__i+1]; \
__i++; \
......@@ -120,146 +422,269 @@ INT WINAPI __WSAFDIsSet( SOCKET, ws_fd_set32 * );
} \
} \
} while(0)
#define WS_FD_CLR(fd, set) __WS_FD_CLR((fd),(set), ws_fd_set32)
#define __WS_FD_SET(fd, set, cast) do { \
#define __WS_FD_SET1(fd, set, cast) do { \
if (((cast*)(set))->fd_count < FD_SETSIZE) \
((cast*)(set))->fd_array[((cast*)(set))->fd_count++]=(fd);\
((cast*)(set))->fd_array[((cast*)(set))->fd_count++]=(fd); \
} while(0)
#define WS_FD_SET(fd, set) __WS_FD_SET((fd),(set), ws_fd_set32)
#define WS_FD_ZERO(set) (((ws_fd_set32*)(set))->fd_count=0)
#define WS_FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (ws_fd_set32*)(set))
/* This version checks if the filedesc is already in the list, and appends it
* only if it's not the case
*/
#define __WS_FD_SET2(fd, set, cast) do { \
u_int __i; \
for (__i = 0; __i < ((cast*)(set))->fd_count ; __i++) \
{ \
if ((cast*)(set))->fd_array[__i]=(fd) \
break; \
} \
if (__i == ((cast*)(set))->fd_count && ((cast*)(set))->fd_count < FD_SETSIZE) \
{ \
((cast*)(set))->fd_count++; \
((cast*)(set))->fd_array[__i]=(fd);\
} \
} while(0)
#ifndef __WINE_WINSOCK2__
#define __WS_FD_SET(fd, set, cast) __WS_FD_SET1((fd),(set), (cast))
#else
#define __WS_FD_SET(fd, set, cast) __WS_FD_SET2((fd),(set), (cast))
#endif
#ifndef USE_WS_PREFIX
#define FD_CLR(fd, set) __WS_FD_CLR((fd),(set), WS(fd_set))
#define FD_SET(fd, set) __WS_FD_SET((fd),(set), WS(fd_set))
#define FD_ZERO(set) (((WS(fd_set)*)(set))->fd_count=0)
#define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (WS(fd_set)*)(set))
#else
#define WS_FD_CLR(fd, set) WINE_FD_CLR((fd),(set), WS(fd_set))
#define WS_FD_SET(fd, set) WINE_FD_SET((fd),(set), WS(fd_set))
#define WS_FD_ZERO(set) (((WS(fd_set)*)(set))->fd_count=0)
#define WS_FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (WS(fd_set)*)(set))
#endif
#endif /* WS_DEFINE_SELECT */
/*
* Internet address (old style... should be updated)
*/
struct ws_in_addr
#ifndef USE_WS_PREFIX
#define IN_CLASSA_NSHIFT 24
#define IN_CLASSA_MAX 128
#define IN_CLASSA_NET 0xff000000
#define IN_CLASSA_HOST 0x00ffffff
#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0)
#define IN_CLASSB_NSHIFT 16
#define IN_CLASSB_MAX 65536
#define IN_CLASSB_NET 0xffff0000
#define IN_CLASSB_HOST 0x0000ffff
#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000)
#define IN_CLASSC_NSHIFT 8
#define IN_CLASSC_NET 0xffffff00
#define IN_CLASSC_HOST 0x000000ff
#define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000)
#else
#define WS_IN_CLASSA_NSHIFT 24
#define WS_IN_CLASSA_MAX 128
#define WS_IN_CLASSA_NET 0xff000000
#define WS_IN_CLASSA_HOST 0x00ffffff
#define WS_IN_CLASSA(i) (((long)(i) & 0x80000000) == 0)
#define WS_IN_CLASSB_NSHIFT 16
#define WS_IN_CLASSB_MAX 65536
#define WS_IN_CLASSB_NET 0xffff0000
#define WS_IN_CLASSB_HOST 0x0000ffff
#define WS_IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000)
#define WS_IN_CLASSC_NSHIFT 8
#define WS_IN_CLASSC_NET 0xffffff00
#define WS_IN_CLASSC_HOST 0x000000ff
#define WS_IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000)
#endif /* USE_WS_PREFIX */
#ifndef USE_WS_PREFIX
#define INADDR_ANY (u_long)0x00000000
#define INADDR_LOOPBACK 0x7f000001
#define INADDR_BROADCAST (u_long)0xffffffff
#define INADDR_NONE 0xffffffff
#else
#define WS_INADDR_ANY (u_long)0x00000000
#define WS_INADDR_LOOPBACK 0x7f000001
#define WS_INADDR_BROADCAST (u_long)0xffffffff
#define WS_INADDR_NONE 0xffffffff
#endif /* USE_WS_PREFIX */
typedef struct WS(in_addr)
{
union {
struct { BYTE s_b1,s_b2,s_b3,s_b4; } S_un_b;
struct { WORD s_w1,s_w2; } S_un_w;
UINT S_addr;
} S_un;
#define ws_addr S_un.S_addr /* can be used for most tcp & ip code */
#define ws_host S_un.S_un_b.s_b2 /* host on imp */
#define ws_net S_un.S_un_b.s_b1 /* network */
#define ws_imp S_un.S_un_w.s_w2 /* imp */
#define ws_impno S_un.S_un_b.s_b4 /* imp # */
#define ws_lh S_un.S_un_b.s_b3 /* logical host */
};
struct ws_sockaddr_in
union {
struct {
u_char s_b1,s_b2,s_b3,s_b4;
} S_un_b;
struct {
u_short s_w1,s_w2;
} S_un_w;
u_long S_addr;
} S_un;
#ifndef USE_WS_PREFIX
#define s_addr S_un.S_addr
#define s_host S_un.S_un_b.s_b2
#define s_net S_un.S_un_b.s_b1
#define s_imp S_un.S_un_w.s_w2
#define s_impno S_un.S_un_b.s_b4
#define s_lh S_un.S_un_b.s_b3
#else
#define WS_s_addr S_un.S_addr
#define WS_s_host S_un.S_un_b.s_b2
#define WS_s_net S_un.S_un_b.s_b1
#define WS_s_imp S_un.S_un_w.s_w2
#define WS_s_impno S_un.S_un_b.s_b4
#define WS_s_lh S_un.S_un_b.s_b3
#endif /* USE_WS_PREFIX */
} IN_ADDR, *PIN_ADDR, *LPIN_ADDR;
typedef struct WS(sockaddr_in)
{
SHORT sin_family;
WORD sin_port;
struct ws_in_addr sin_addr;
BYTE sin_zero[8];
};
short sin_family;
u_short sin_port;
struct WS(in_addr) sin_addr;
char sin_zero[8];
} SOCKADDR_IN, *PSOCKADDR_IN, *LPSOCKADDR_IN;
#define WSADESCRIPTION_LEN 256
#define WSASYS_STATUS_LEN 128
typedef struct WSAData {
WORD wVersion;
WORD wHighVersion;
char szDescription[WSADESCRIPTION_LEN+1];
char szSystemStatus[WSASYS_STATUS_LEN+1];
WORD iMaxSockets;
WORD iMaxUdpDg;
char *lpVendorInfo;
} WSADATA, *LPWSADATA;
#include "poppack.h"
/*
* This is used instead of -1, since the
* SOCKET type is unsigned.
* WSAStartup
*/
#define INVALID_SOCKET (~0)
#define SOCKET_ERROR (-1)
#define WSADESCRIPTION_LEN 256
#define WSASYS_STATUS_LEN 128
typedef struct WS(WSAData)
{
WORD wVersion;
WORD wHighVersion;
char szDescription[WSADESCRIPTION_LEN+1];
char szSystemStatus[WSASYS_STATUS_LEN+1];
WORD iMaxSockets;
WORD iMaxUdpDg;
char *lpVendorInfo;
} WSADATA, *LPWSADATA;
/*
* Types
*/
#define WS_SOCK_STREAM 1 /* stream socket */
#define WS_SOCK_DGRAM 2 /* datagram socket */
#define WS_SOCK_RAW 3 /* raw-protocol interface */
#define WS_SOCK_RDM 4 /* reliably-delivered message */
#define WS_SOCK_SEQPACKET 5 /* sequenced packet stream */
#define WS_SOL_SOCKET 0xffff
#define WS_IPPROTO_TCP 6
/*
* Option flags per-socket.
* {get,set}sockopt
*/
#define WS_SO_DEBUG 0x0001 /* turn on debugging info recording */
#define WS_SO_ACCEPTCONN 0x0002 /* socket has had listen() */
#define WS_SO_REUSEADDR 0x0004 /* allow local address reuse */
#define WS_SO_KEEPALIVE 0x0008 /* keep connections alive */
#define WS_SO_DONTROUTE 0x0010 /* just use interface addresses */
#define WS_SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */
#define WS_SO_USELOOPBACK 0x0040 /* bypass hardware when possible */
#define WS_SO_LINGER 0x0080 /* linger on close if data present */
#define WS_SO_OOBINLINE 0x0100 /* leave received OOB data in line */
#ifndef USE_WS_PREFIX
#define SOL_SOCKET 0xffff
#define SO_DEBUG 0x0001
#define SO_ACCEPTCONN 0x0002
#define SO_REUSEADDR 0x0004
#define SO_KEEPALIVE 0x0008
#define SO_DONTROUTE 0x0010
#define SO_BROADCAST 0x0020
#define SO_USELOOPBACK 0x0040
#define SO_LINGER 0x0080
#define SO_OOBINLINE 0x0100
#define SO_DONTLINGER (u_int)(~SO_LINGER)
#define SO_SNDBUF 0x1001
#define SO_RCVBUF 0x1002
#define SO_SNDLOWAT 0x1003
#define SO_RCVLOWAT 0x1004
#define SO_SNDTIMEO 0x1005
#define SO_RCVTIMEO 0x1006
#define SO_ERROR 0x1007
#define SO_TYPE 0x1008
#define IOCPARM_MASK 0x7f
#define IOC_VOID 0x20000000
#define IOC_OUT 0x40000000
#define IOC_IN 0x80000000
#define IOC_INOUT (IOC_IN|IOC_OUT)
#define _IO(x,y) (IOC_VOID|((x)<<8)|(y))
#define _IOR(x,y,t) (IOC_OUT|(((UINT)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
#define _IOW(x,y,t) (IOC_IN|(((UINT)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
#else
#define WS_SOL_SOCKET 0xffff
#define WS_SO_DEBUG 0x0001
#define WS_SO_ACCEPTCONN 0x0002
#define WS_SO_REUSEADDR 0x0004
#define WS_SO_KEEPALIVE 0x0008
#define WS_SO_DONTROUTE 0x0010
#define WS_SO_BROADCAST 0x0020
#define WS_SO_USELOOPBACK 0x0040
#define WS_SO_LINGER 0x0080
#define WS_SO_OOBINLINE 0x0100
#define WS_SO_DONTLINGER (u_int)(~WS_SO_LINGER)
#define WS_SO_SNDBUF 0x1001
#define WS_SO_RCVBUF 0x1002
#define WS_SO_SNDLOWAT 0x1003
#define WS_SO_RCVLOWAT 0x1004
#define WS_SO_SNDTIMEO 0x1005
#define WS_SO_RCVTIMEO 0x1006
#define WS_SO_ERROR 0x1007
#define WS_SO_TYPE 0x1008
#define WS_IOCPARM_MASK 0x7f
#define WS_IOC_VOID 0x20000000
#define WS_IOC_OUT 0x40000000
#define WS_IOC_IN 0x80000000
#define WS_IOC_INOUT (WS_IOC_IN|WS_IOC_OUT)
#define WS__IO(x,y) (WS_IOC_VOID|((x)<<8)|(y))
#define WS__IOR(x,y,t) (WS_IOC_OUT|(((long)sizeof(t)&WS_IOCPARM_MASK)<<16)|((x)<<8)|(y))
#define WS__IOW(x,y,t) (WS_IOC_IN|(((long)sizeof(t)&WS_IOCPARM_MASK)<<16)|((x)<<8)|(y))
#define WS_SO_DONTLINGER (UINT)(~WS_SO_LINGER)
/*
* Additional options.
*/
#define WS_SO_SNDBUF 0x1001 /* send buffer size */
#define WS_SO_RCVBUF 0x1002 /* receive buffer size */
#define WS_SO_SNDLOWAT 0x1003 /* send low-water mark */
#define WS_SO_RCVLOWAT 0x1004 /* receive low-water mark */
#define WS_SO_SNDTIMEO 0x1005 /* send timeout */
#define WS_SO_RCVTIMEO 0x1006 /* receive timeout */
#define WS_SO_ERROR 0x1007 /* get error status and clear */
#define WS_SO_TYPE 0x1008 /* get socket type */
#define WS_IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */
#define WS_IOC_VOID 0x20000000 /* no parameters */
#define WS_IOC_OUT 0x40000000 /* copy out parameters */
#define WS_IOC_IN 0x80000000 /* copy in parameters */
#define WS_IOC_INOUT (WS_IOC_IN|WS_IOC_OUT)
#define WS_IOR(x,y,t) (WS_IOC_OUT|(((UINT)sizeof(t)&WS_IOCPARM_MASK)<<16)|((x)<<8)|(y))
#define WS_IOW(x,y,t) (WS_IOC_IN|(((UINT)sizeof(t)&WS_IOCPARM_MASK)<<16)|((x)<<8)|(y))
#endif
/* IPPROTO_TCP options */
#define WS_TCP_NODELAY 1 /* do not apply nagle algorithm */
#ifndef USE_WS_PREFIX
#define TCP_NODELAY 1
#else
#define WS_TCP_NODELAY 1
#endif
/*
* Socket I/O flags (supported by spec 1.1)
*/
#define WS_FIONREAD WS_IOR('f', 127, u_long)
#define WS_FIONBIO WS_IOW('f', 126, u_long)
#define WS_SIOCATMARK WS_IOR('s', 7, u_long)
#ifndef USE_WS_PREFIX
#define FIONREAD _IOR('f', 127, u_long)
#define FIONBIO _IOW('f', 126, u_long)
#define SIOCATMARK _IOR('s', 7, u_long)
#else
#define WS_FIONREAD WS__IOR('f', 127, u_long)
#define WS_FIONBIO WS__IOW('f', 126, u_long)
#define WS_SIOCATMARK WS__IOR('s', 7, u_long)
#endif
/*
* Maximum queue length specifiable by listen.
*/
#ifdef SOMAXCONN
#undef SOMAXCONN
#endif
#define SOMAXCONN 5
#ifndef MSG_DONTROUTE
#define MSG_DONTROUTE 0x4 /* send without using routing tables */
#endif
#define MSG_MAXIOVLEN 16
#ifndef MSG_PARTIAL
#define MSG_PARTIAL 0x8000 /* partial send or recv (WSARecvEx) */
#endif
#ifndef USE_WS_PREFIX
#define SOMAXCONN 5
#define MSG_OOB 0x0001
#define MSG_PEEK 0x0002
#define MSG_DONTROUTE 0x0004
#define MSG_MAXIOVLEN 0x000a
#define MSG_PARTIAL 0x8000
#else /* USE_WS_PREFIX */
#define WS_SOMAXCONN 5
#define WS_MSG_OOB 0x0001
#define WS_MSG_PEEK 0x0002
#define WS_MSG_DONTROUTE 0x0004
#define WS_MSG_MAXIOVLEN 0x000a
#define WS_MSG_PARTIAL 0x8000
#endif /* USE_WS_PREFIX */
/*
* Define constant based on rfc883, used by gethostbyxxxx() calls.
*/
#define MAXGETHOSTSTRUCT 1024
#ifndef USE_WS_PREFIX
#define MAXGETHOSTSTRUCT 1024
#else
#define MAXGETHOSTSTRUCT 1024
#endif
/*
* Define flags to be used with the WSAAsyncSelect() call.
......@@ -285,64 +710,64 @@ typedef struct WSAData {
* All Windows Sockets error constants are biased by WSABASEERR from
* the "normal"
*/
#define WSABASEERR 10000
#define WSABASEERR 10000
/*
* Windows Sockets definitions of regular Microsoft C error constants
*/
#define WSAEINTR (WSABASEERR+4)
#define WSAEBADF (WSABASEERR+9)
#define WSAEACCES (WSABASEERR+13)
#define WSAEFAULT (WSABASEERR+14)
#define WSAEINVAL (WSABASEERR+22)
#define WSAEMFILE (WSABASEERR+24)
#define WSAEINTR (WSABASEERR+4)
#define WSAEBADF (WSABASEERR+9)
#define WSAEACCES (WSABASEERR+13)
#define WSAEFAULT (WSABASEERR+14)
#define WSAEINVAL (WSABASEERR+22)
#define WSAEMFILE (WSABASEERR+24)
/*
* Windows Sockets definitions of regular Berkeley error constants
*/
#define WSAEWOULDBLOCK (WSABASEERR+35)
#define WSAEINPROGRESS (WSABASEERR+36)
#define WSAEALREADY (WSABASEERR+37)
#define WSAENOTSOCK (WSABASEERR+38)
#define WSAEDESTADDRREQ (WSABASEERR+39)
#define WSAEMSGSIZE (WSABASEERR+40)
#define WSAEPROTOTYPE (WSABASEERR+41)
#define WSAENOPROTOOPT (WSABASEERR+42)
#define WSAEPROTONOSUPPORT (WSABASEERR+43)
#define WSAESOCKTNOSUPPORT (WSABASEERR+44)
#define WSAEOPNOTSUPP (WSABASEERR+45)
#define WSAEPFNOSUPPORT (WSABASEERR+46)
#define WSAEAFNOSUPPORT (WSABASEERR+47)
#define WSAEADDRINUSE (WSABASEERR+48)
#define WSAEADDRNOTAVAIL (WSABASEERR+49)
#define WSAENETDOWN (WSABASEERR+50)
#define WSAENETUNREACH (WSABASEERR+51)
#define WSAENETRESET (WSABASEERR+52)
#define WSAECONNABORTED (WSABASEERR+53)
#define WSAECONNRESET (WSABASEERR+54)
#define WSAENOBUFS (WSABASEERR+55)
#define WSAEISCONN (WSABASEERR+56)
#define WSAENOTCONN (WSABASEERR+57)
#define WSAESHUTDOWN (WSABASEERR+58)
#define WSAETOOMANYREFS (WSABASEERR+59)
#define WSAETIMEDOUT (WSABASEERR+60)
#define WSAECONNREFUSED (WSABASEERR+61)
#define WSAELOOP (WSABASEERR+62)
#define WSAENAMETOOLONG (WSABASEERR+63)
#define WSAEHOSTDOWN (WSABASEERR+64)
#define WSAEHOSTUNREACH (WSABASEERR+65)
#define WSAENOTEMPTY (WSABASEERR+66)
#define WSAEPROCLIM (WSABASEERR+67)
#define WSAEUSERS (WSABASEERR+68)
#define WSAEDQUOT (WSABASEERR+69)
#define WSAESTALE (WSABASEERR+70)
#define WSAEREMOTE (WSABASEERR+71)
#define WSAEWOULDBLOCK (WSABASEERR+35)
#define WSAEINPROGRESS (WSABASEERR+36)
#define WSAEALREADY (WSABASEERR+37)
#define WSAENOTSOCK (WSABASEERR+38)
#define WSAEDESTADDRREQ (WSABASEERR+39)
#define WSAEMSGSIZE (WSABASEERR+40)
#define WSAEPROTOTYPE (WSABASEERR+41)
#define WSAENOPROTOOPT (WSABASEERR+42)
#define WSAEPROTONOSUPPORT (WSABASEERR+43)
#define WSAESOCKTNOSUPPORT (WSABASEERR+44)
#define WSAEOPNOTSUPP (WSABASEERR+45)
#define WSAEPFNOSUPPORT (WSABASEERR+46)
#define WSAEAFNOSUPPORT (WSABASEERR+47)
#define WSAEADDRINUSE (WSABASEERR+48)
#define WSAEADDRNOTAVAIL (WSABASEERR+49)
#define WSAENETDOWN (WSABASEERR+50)
#define WSAENETUNREACH (WSABASEERR+51)
#define WSAENETRESET (WSABASEERR+52)
#define WSAECONNABORTED (WSABASEERR+53)
#define WSAECONNRESET (WSABASEERR+54)
#define WSAENOBUFS (WSABASEERR+55)
#define WSAEISCONN (WSABASEERR+56)
#define WSAENOTCONN (WSABASEERR+57)
#define WSAESHUTDOWN (WSABASEERR+58)
#define WSAETOOMANYREFS (WSABASEERR+59)
#define WSAETIMEDOUT (WSABASEERR+60)
#define WSAECONNREFUSED (WSABASEERR+61)
#define WSAELOOP (WSABASEERR+62)
#define WSAENAMETOOLONG (WSABASEERR+63)
#define WSAEHOSTDOWN (WSABASEERR+64)
#define WSAEHOSTUNREACH (WSABASEERR+65)
#define WSAENOTEMPTY (WSABASEERR+66)
#define WSAEPROCLIM (WSABASEERR+67)
#define WSAEUSERS (WSABASEERR+68)
#define WSAEDQUOT (WSABASEERR+69)
#define WSAESTALE (WSABASEERR+70)
#define WSAEREMOTE (WSABASEERR+71)
/*
* Extended Windows Sockets error constant definitions
*/
#define WSASYSNOTREADY (WSABASEERR+91)
#define WSAVERNOTSUPPORTED (WSABASEERR+92)
#define WSANOTINITIALISED (WSABASEERR+93)
#define WSASYSNOTREADY (WSABASEERR+91)
#define WSAVERNOTSUPPORTED (WSABASEERR+92)
#define WSANOTINITIALISED (WSABASEERR+93)
/*
* Error return codes from gethostbyname() and gethostbyaddr()
......@@ -355,112 +780,43 @@ typedef struct WSAData {
* compatibility purposes.
*/
/* #define h_errno WSAGetLastError() */
#ifndef USE_WS_PREFIX
#define h_errno WSAGetLastError()
#else
#define WS_h_errno WSAGetLastError()
#endif
/* Authoritative Answer: Host not found */
#define WSAHOST_NOT_FOUND (WSABASEERR+1001)
#define WSAHOST_NOT_FOUND (WSABASEERR+1001)
/* Non-Authoritative: Host not found, or SERVERFAIL */
#define WSATRY_AGAIN (WSABASEERR+1002)
#define WSATRY_AGAIN (WSABASEERR+1002)
/* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
#define WSANO_RECOVERY (WSABASEERR+1003)
#define WSANO_RECOVERY (WSABASEERR+1003)
/* Valid name, no data record of requested type */
#define WSANO_DATA (WSABASEERR+1004)
#define WSANO_DATA (WSABASEERR+1004)
/* no address, look for MX record */
#define WSANO_ADDRESS WSANO_DATA
#define WSANO_ADDRESS WSANO_DATA
/* Socket function prototypes */
#ifndef USE_WS_PREFIX
#define HOST_NOT_FOUND WSAHOST_NOT_FOUND
#define TRY_AGAIN WSATRY_AGAIN
#define NO_RECOVERY WSANO_RECOVERY
#define NO_DATA WSANO_DATA
#define NO_ADDRESS WSANO_ADDRESS
#endif /* USE_WS_PREFIX */
#ifdef __cplusplus
extern "C" {
#endif
/* Microsoft Windows Extension function prototypes */
int WINAPI closesocket(SOCKET s);
int WINAPI WSAStartup(WORD wVersionRequired, LPWSADATA lpWSAData);
void WINAPI WSASetLastError(INT iError);
INT WINAPI WSACleanup(void);
INT WINAPI WSAGetLastError(void);
BOOL WINAPI WSAIsBlocking(void);
INT WINAPI WSACancelBlockingCall(void);
INT WINAPI WSAUnhookBlockingHook(void);
FARPROC WINAPI WSASetBlockingHook(FARPROC lpBlockFunc);
HANDLE WINAPI WSAAsyncGetServByName(HWND hWnd, UINT uMsg, LPCSTR name, LPCSTR proto,
LPSTR sbuf, INT buflen);
HANDLE WINAPI WSAAsyncGetServByPort(HWND hWnd, UINT uMsg, INT port,
LPCSTR proto, LPSTR sbuf, INT buflen);
HANDLE WINAPI WSAAsyncGetProtoByName(HWND hWnd, UINT uMsg,
LPCSTR name, LPSTR sbuf, INT buflen);
HANDLE WINAPI WSAAsyncGetProtoByNumber(HWND hWnd, UINT uMsg,
INT number, LPSTR sbuf, INT buflen);
HANDLE WINAPI WSAAsyncGetHostByName(HWND hWnd, UINT uMsg,
LPCSTR name, LPSTR sbuf, INT buflen);
HANDLE WINAPI WSAAsyncGetHostByAddr(HWND hWnd, UINT uMsg, LPCSTR addr,
INT len, INT type, LPSTR sbuf, INT buflen);
INT WINAPI WSACancelAsyncRequest(HANDLE hAsyncTaskHandle);
INT WINAPI WSAAsyncSelect(SOCKET s, HWND hWnd, UINT uMsg, LONG lEvent);
INT WINAPI WSARecvEx(SOCKET s, char *buf, INT len, INT *flags);
/*
* Address families
* Windows message parameter composition and decomposition
* macros.
*/
#define WS_AF_UNSPEC 0 /* unspecified */
#define WS_AF_UNIX 1 /* local to host (pipes, portals) */
#define WS_AF_INET 2 /* internetwork: UDP, TCP, etc. */
#define WS_AF_IMPLINK 3 /* arpanet imp addresses */
#define WS_AF_PUP 4 /* pup protocols: e.g. BSP */
#define WS_AF_CHAOS 5 /* mit CHAOS protocols */
#define WS_AF_NS 6 /* XEROX NS protocols */
#define WS_AF_IPX WS_AF_NS /* IPX protocols: IPX, SPX, etc. */
#define WS_AF_ISO 7 /* ISO protocols */
#define WS_AF_OSI AF_ISO /* OSI is ISO */
#define WS_AF_ECMA 8 /* european computer manufacturers */
#define WS_AF_DATAKIT 9 /* datakit protocols */
#define WS_AF_CCITT 10 /* CCITT protocols, X.25 etc */
#define WS_AF_SNA 11 /* IBM SNA */
#define WS_AF_DECnet 12 /* DECnet */
#define WS_AF_DLI 13 /* Direct data link interface */
#define WS_AF_LAT 14 /* LAT */
#define WS_AF_HYLINK 15 /* NSC Hyperchannel */
#define WS_AF_APPLETALK 16 /* AppleTalk */
#define WS_AF_NETBIOS 17 /* NetBios-style addresses */
#define WS_AF_VOICEVIEW 18 /* VoiceView */
#define WS_AF_FIREFOX 19 /* Protocols from Firefox */
#define WS_AF_UNKNOWN1 20 /* Somebody is using this! */
#define WS_AF_BAN 21 /* Banyan */
#define WS_AF_ATM 22 /* Native ATM Services */
#define WS_AF_INET6 23 /* Internetwork Version 6 */
#define WS_AF_CLUSTER 24 /* Microsoft Wolfpack */
#define WS_AF_12844 25 /* IEEE 1284.4 WG AF */
#define WS_AF_IRDA 26 /* IrDA */
#define WS_AF_MAX 27
#ifdef __cplusplus
}
#endif
/* Microsoft Windows Extended data types */
typedef struct sockaddr SOCKADDR, *PSOCKADDR, *LPSOCKADDR;
typedef struct sockaddr_in SOCKADDR_IN, *PSOCKADDR_IN, *LPSOCKADDR_IN;
typedef struct linger LINGER, *PLINGER, *LPLINGER;
typedef struct in_addr IN_ADDR, *PIN_ADDR, *LPIN_ADDR;
typedef struct ws_fd_set32_struct FD_SET, *PFD_SET, *LPFD_SET;
typedef struct hostent HOSTENT, *PHOSTENT, *LPHOSTENT;
typedef struct servent SERVENT, *PSERVENT, *LPSERVENT;
typedef struct protoent PROTOENT, *PPROTOENT, *LPPROTOENT;
typedef struct timeval TIMEVAL, *PTIMEVAL, *LPTIMEVAL;
/*
* Windows message parameter composition and decomposition
* macros.
*
* WSAMAKEASYNCREPLY is intended for use by the Windows Sockets implementation
* when constructing the response to a WSAAsyncGetXByY() routine.
*/
......@@ -495,9 +851,85 @@ typedef struct timeval TIMEVAL, *PTIMEVAL, *LPTIMEVAL;
*/
#define WSAGETSELECTERROR(lParam) HIWORD(lParam)
/*
* Prototypes
*
* Remember to keep this section in sync with the
* "Winsock Function Typedefs" section in winsock2.h.
*/
#if !defined(__WINE_WINSOCK2__) || WS_API_PROTOTYPES
HANDLE WINAPI WSAAsyncGetHostByAddr(HWND,u_int,const char*,int,int,char*,int);
HANDLE WINAPI WSAAsyncGetHostByName(HWND,u_int,const char*,char*,int);
HANDLE WINAPI WSAAsyncGetProtoByName(HWND,u_int,const char*,char*,int);
HANDLE WINAPI WSAAsyncGetProtoByNumber(HWND,u_int,int,char*,int);
HANDLE WINAPI WSAAsyncGetServByName(HWND,u_int,const char*,const char*,char*,int);
HANDLE WINAPI WSAAsyncGetServByPort(HWND,u_int,int,const char*,char*,int);
int WINAPI WSAAsyncSelect(SOCKET,HWND,u_int,long);
int WINAPI WSACancelAsyncRequest(HANDLE);
int WINAPI WSACancelBlockingCall(void);
int WINAPI WSACleanup(void);
int WINAPI WSAGetLastError(void);
BOOL WINAPI WSAIsBlocking(void);
FARPROC WINAPI WSASetBlockingHook(FARPROC);
void WINAPI WSASetLastError(int);
int WINAPI WSAStartup(WORD,LPWSADATA);
int WINAPI WSAUnhookBlockingHook(void);
SOCKET WINAPI WS(accept)(SOCKET,struct WS(sockaddr)*,int*);
int WINAPI WS(bind)(SOCKET,const struct WS(sockaddr)*,int);
int WINAPI WS(closesocket)(SOCKET);
int WINAPI WS(connect)(SOCKET,const struct WS(sockaddr)*,int);
struct WS(hostent)* WINAPI WS(gethostbyaddr)(const char*,int,int);
struct WS(hostent)* WINAPI WS(gethostbyname)(const char*);
int WINAPI WS(gethostname)(char*,int);
int WINAPI WS(getpeername)(SOCKET,struct WS(sockaddr)*,int*);
struct WS(protoent)* WINAPI WS(getprotobyname)(const char*);
struct WS(protoent)* WINAPI WS(getprotobynumber)(int);
#ifdef WS_DEFINE_SELECT
int WS(select)(int,WS(fd_set)*,WS(fd_set)*,WS(fd_set)*,const struct WS(timeval)*);
#endif
struct WS(servent)* WINAPI WS(getservbyname)(const char*,const char*);
struct WS(servent)* WINAPI WS(getservbyport)(int,const char*);
int WINAPI WS(getsockname)(SOCKET,struct WS(sockaddr)*,int*);
int WINAPI WS(getsockopt)(SOCKET,int,int,char*,int*);
u_long WINAPI WS(htonl)(u_long);
u_short WINAPI WS(htons)(u_short);
unsigned long WINAPI WS(inet_addr)(const char*);
char* WINAPI WS(inet_ntoa)(struct WS(in_addr));
int WINAPI WS(ioctlsocket)(SOCKET,long,u_long*);
int WINAPI WS(listen)(SOCKET,int);
u_long WINAPI WS(ntohl)(u_long);
u_short WINAPI WS(ntohs)(u_short);
int WINAPI WS(recv)(SOCKET,char*,int,int);
int WINAPI WS(recvfrom)(SOCKET,char*,int,int,struct WS(sockaddr)*,int*);
int WINAPI WS(send)(SOCKET,const char*,int,int);
int WINAPI WS(sendto)(SOCKET,const char*,int,int,const struct WS(sockaddr)*,int);
int WINAPI WS(setsockopt)(SOCKET,int,int,const char*,int);
int WINAPI WS(shutdown)(SOCKET,int);
SOCKET WINAPI WS(socket)(int,int,int);
#if defined(__WINE__) || !defined(__WINE_WINSOCK2__)
/* Stuff specific to winsock.h */
int WINAPI WSARecvEx(SOCKET,char*,int,int*);
#endif /* __WINE_WINSOCK2__ */
#endif /* !defined(__WINE_WINSOCK2__) || WS_API_PROTOTYPES */
#include "poppack.h"
#ifdef __cplusplus
} /* extern "C" */
#endif /* defined(__cplusplus) */
}
#endif
#endif /* _WINSOCKAPI_ */
#ifndef __WINE_WINSOCK2__
#undef WS
#undef WS_API_PROTOTYPES
#undef WS_API_TYPEDEFS
#endif
#endif /* _WINSOCKAPI_ */
......@@ -3,166 +3,143 @@
*
* FIXME: Still missing required Winsock 2 definitions.
*/
#ifndef __WINSOCK2API__
#define __WINSOCK2API__
#ifndef _WINSOCK2API_
#define _WINSOCK2API_
/*
* Setup phase
*/
/* Everything common between winsock.h and winsock2.h */
#ifndef INCL_WINSOCK_API_PROTOTYPES
#define INCL_WINSOCK_API_PROTOTYPES 1
#define WS_API_PROTOTYPES 1
#else
#define WS_API_PROTOTYPES INCL_WINSOCK_API_PROTOTYPES
#endif
#ifndef INCL_WINSOCK_API_TYPEDEFS
#define INCL_WINSOCK_API_TYPEDEFS 0
#define WS_API_TYPEDEFS 0
#else
#define WS_API_TYPEDEFS INCL_WINSOCK_API_TYPEDEFS
#endif
#define __WINE_WINSOCK2__
#include "winsock.h"
#undef __WINE_WINSOCK2__
#ifdef __cplusplus
extern "C" {
#endif /* defined(__cplusplus) */
/* proper 4-byte packing */
#include "pshpack4.h"
#define WS_SO_GROUP_ID 0x2001
#define WS_SO_GROUP_PRIORITY 0x2002
#define WS_SO_MAX_MSG_SIZE 0x2003
#define WS_SO_PROTOCOL_INFOA 0x2004
#define WS_SO_PROTOCOL_INFOW 0x2005
#define WS_SO_PROTOCOL_INFO WINELIB_NAME_AW(WS_SO_PROTOCOL_INFO)
#define PVD_CONFIG 0x3001
#define SO_CONDITIONAL_ACCEPT 0x3002
#ifndef USE_WS_PREFIX
#define SO_GROUP_ID 0x2001
#define SO_GROUP_PRIORITY 0x2002
#define SO_MAX_MSG_SIZE 0x2003
#define SO_PROTOCOL_INFOA 0x2004
#define SO_PROTOCOL_INFOW 0x2005
#define SO_PROTOCOL_INFO WINELIB_NAME_AW(WS_SO_PROTOCOL_INFO)
#define PVD_CONFIG 0x3001
#define SO_CONDITIONAL_ACCEPT 0x3002
#else
#define WS_SO_GROUP_ID 0x2001
#define WS_SO_GROUP_PRIORITY 0x2002
#define WS_SO_MAX_MSG_SIZE 0x2003
#define WS_SO_PROTOCOL_INFOA 0x2004
#define WS_SO_PROTOCOL_INFOW 0x2005
#define WS_SO_PROTOCOL_INFO WINELIB_NAME_AW(WS_SO_PROTOCOL_INFO)
#define WS_PVD_CONFIG 0x3001
#define WS_SO_CONDITIONAL_ACCEPT 0x3002
#endif
/* option flags per socket */
#define FD_MAX_EVENTS 10
#define FD_READ_BIT 0
#define FD_WRITE_BIT 1
#define FD_OOB_BIT 2
#define FD_ACCEPT_BIT 3
#define FD_CONNECT_BIT 4
#define FD_CLOSE_BIT 5
/*
* Constants for WSAIoctl()
*/
#define IOC_UNIX 0x00000000
#define IOC_WS2 0x08000000
#define IOC_PROTOCOL 0x10000000
#define IOC_VENDOR 0x18000000
#define _WSAIO(x,y) (IOC_VOID|(x)|(y))
#define _WSAIOR(x,y) (IOC_OUT|(x)|(y))
#define _WSAIOW(x,y) (IOC_IN|(x)|(y))
#define _WSAIORW(x,y) (IOC_INOUT|(x)|(y))
#define SIO_ASSOCIATE_HANDLE _WSAIOW(IOC_WS2,1)
#define SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(IOC_WS2,2)
#define SIO_FIND_ROUTE _WSAIOR(IOC_WS2,3)
#define SIO_FLUSH _WSAIO(IOC_WS2,4)
#define SIO_GET_BROADCAST_ADDRESS _WSAIOR(IOC_WS2,5)
#define FD_MAX_EVENTS 10
#define FD_READ_BIT 0
#define FD_WRITE_BIT 1
#define FD_OOB_BIT 2
#define FD_ACCEPT_BIT 3
#define FD_CONNECT_BIT 4
#define FD_CLOSE_BIT 5
/* Constants for LPCONDITIONPROC */
#define CF_ACCEPT 0x0000
#define CF_REJECT 0x0001
#define CF_DEFER 0x0002
/* Constants for shutdown() */
#define SD_RECEIVE 0x00
#define SD_SEND 0x01
#define SD_BOTH 0x02
/* Constants for WSAIoctl() */
#define IOC_UNIX 0x00000000
#define IOC_WS2 0x08000000
#define IOC_PROTOCOL 0x10000000
#define IOC_VENDOR 0x18000000
#define _WSAIO(x,y) (IOC_VOID|(x)|(y))
#define _WSAIOR(x,y) (IOC_OUT|(x)|(y))
#define _WSAIOW(x,y) (IOC_IN|(x)|(y))
#define _WSAIORW(x,y) (IOC_INOUT|(x)|(y))
#define SIO_ASSOCIATE_HANDLE _WSAIOW(IOC_WS2,1)
#define SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(IOC_WS2,2)
#define SIO_FIND_ROUTE _WSAIOR(IOC_WS2,3)
#define SIO_FLUSH _WSAIO(IOC_WS2,4)
#define SIO_GET_BROADCAST_ADDRESS _WSAIOR(IOC_WS2,5)
#define SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(IOC_WS2,6)
#define SIO_GET_QOS _WSAIORW(IOC_WS2,7)
#define SIO_GET_GROUP_QOS _WSAIORW(IOC_WS2,8)
#define SIO_MULTIPOINT_LOOPBACK _WSAIOW(IOC_WS2,9)
#define SIO_MULTICAST_SCOPE _WSAIOW(IOC_WS2,10)
#define SIO_SET_QOS _WSAIOW(IOC_WS2,11)
#define SIO_SET_GROUP_QOS _WSAIOW(IOC_WS2,12)
#define SIO_TRANSLATE_HANDLE _WSAIORW(IOC_WS2,13)
#define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20)
#define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21)
#define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22)
#define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23)
#define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_W32,24)
#define SIO_GET_INTERFACE_LIST WS_IOR ('t', 127, u_long)
/* Unfortunately the sockaddr_in6 structure doesn't
seem to be defined in a standard place, even across
different Linux distributions. Until IPv6 support settles
down, let's do our own here so the sockaddr_gen
union is the correct size.*/
#ifdef s6_addr
#undef s6_addr
#define SIO_GET_QOS _WSAIORW(IOC_WS2,7)
#define SIO_GET_GROUP_QOS _WSAIORW(IOC_WS2,8)
#define SIO_MULTIPOINT_LOOPBACK _WSAIOW(IOC_WS2,9)
#define SIO_MULTICAST_SCOPE _WSAIOW(IOC_WS2,10)
#define SIO_SET_QOS _WSAIOW(IOC_WS2,11)
#define SIO_SET_GROUP_QOS _WSAIOW(IOC_WS2,12)
#define SIO_TRANSLATE_HANDLE _WSAIORW(IOC_WS2,13)
#define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20)
#define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21)
#define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22)
#define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23)
#define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_W32,24)
#ifndef USE_WS_PREFIX
#define SIO_GET_INTERFACE_LIST _IOR ('t', 127, u_long)
#else
#define SIO_GET_INTERFACE_LIST WS__IOR ('t', 127, u_long)
#endif
struct ws_in_addr6
{
unsigned char s6_addr[16]; /* IPv6 address */
};
struct ws_sockaddr_in6
{
short sin6_family; /* AF_INET6 */
u_short sin6_port; /* Transport level port number */
u_long sin6_flowinfo; /* IPv6 flow information */
struct ws_in_addr6 sin6_addr; /* IPv6 address */
};
typedef union sockaddr_gen
{
struct sockaddr Address;
struct ws_sockaddr_in AddressIn;
struct ws_sockaddr_in6 AddressIn6;
} sockaddr_gen;
/* Constants for WSAIoctl() */
#define WSA_FLAG_OVERLAPPED 0x01
#define WSA_FLAG_MULTIPOINT_C_ROOT 0x02
#define WSA_FLAG_MULTIPOINT_C_LEAF 0x04
#define WSA_FLAG_MULTIPOINT_D_ROOT 0x08
#define WSA_FLAG_MULTIPOINT_D_LEAF 0x10
/* ws_hostent, ws_protoent, ws_servent, ws_netent are 4-byte aligned here ! */
typedef struct ws_hostent32
{
char *h_name; /* official name of host */
char **h_aliases; /* alias list */
short h_addrtype; /* host address type */
short h_length; /* length of address */
char **h_addr_list; /* list of addresses from name server */
} _ws_hostent32;
typedef struct ws_protoent32
{
char *p_name; /* official protocol name */
char **p_aliases; /* alias list */
short p_proto; /* protocol # */
} _ws_protoent32;
typedef struct ws_servent32
{
char *s_name; /* official service name */
char **s_aliases; /* alias list */
short s_port; /* port # */
char *s_proto; /* protocol to use */
} _ws_servent32;
typedef struct ws_netent32
{
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
short n_addrtype; /* net address type */
u_long n_net; /* network # */
} _ws_netent32;
/* Structure to keep interface specific information */
typedef struct _INTERFACE_INFO
{
u_long iiFlags; /* Interface flags */
sockaddr_gen iiAddress; /* Interface address */
sockaddr_gen iiBroadcastAddress; /* Broadcast address */
sockaddr_gen iiNetmask; /* Network mask */
} INTERFACE_INFO, * LPINTERFACE_INFO;
/* Possible flags for the iiFlags - bitmask */
#ifndef HAVE_NET_IF_H
# define IFF_UP 0x00000001 /* Interface is up */
# define IFF_BROADCAST 0x00000002 /* Broadcast is supported */
# define IFF_LOOPBACK 0x00000004 /* this is loopback interface */
# define IFF_POINTTOPOINT 0x00000008 /* this is point-to-point interface */
# define IFF_MULTICAST 0x00000010 /* multicast is supported */
#endif
#ifndef GUID_DEFINED
#include "guiddef.h"
#endif
#define MAX_PROTOCOL_CHAIN 7
#define BASE_PROTOCOL 1
#define LAYERED_PROTOCOL 0
#define MAX_PROTOCOL_CHAIN 7
#define BASE_PROTOCOL 1
#define LAYERED_PROTOCOL 0
typedef struct _WSAPROTOCOLCHAIN
typedef struct _WSAPROTOCOLCHAIN
{
int ChainLen; /* the length of the chain, */
/* length = 0 means layered protocol, */
/* length = 1 means base protocol, */
/* length > 1 means protocol chain */
DWORD ChainEntries[MAX_PROTOCOL_CHAIN]; /* a list of dwCatalogEntryIds */
int ChainLen; /* the length of the chain, */
/* length = 0 means layered protocol, */
/* length = 1 means base protocol, */
/* length > 1 means protocol chain */
DWORD ChainEntries[MAX_PROTOCOL_CHAIN]; /* a list of dwCatalogEntryIds */
} WSAPROTOCOLCHAIN, * LPWSAPROTOCOLCHAIN;
#define WSAPROTOCOL_LEN 255
typedef struct _WSAPROTOCOL_INFOA
#define WSAPROTOCOL_LEN 255
typedef struct _WSAPROTOCOL_INFOA
{
DWORD dwServiceFlags1;
DWORD dwServiceFlags2;
......@@ -183,7 +160,7 @@ typedef struct _WSAPROTOCOL_INFOA
int iSecurityScheme;
DWORD dwMessageSize;
DWORD dwProviderReserved;
CHAR szProtocol[WSAPROTOCOL_LEN+1];
CHAR szProtocol[WSAPROTOCOL_LEN+1];
} WSAPROTOCOL_INFOA, * LPWSAPROTOCOL_INFOA;
typedef struct _WSAPROTOCOL_INFOW
......@@ -207,51 +184,270 @@ typedef struct _WSAPROTOCOL_INFOW
int iSecurityScheme;
DWORD dwMessageSize;
DWORD dwProviderReserved;
WCHAR szProtocol[WSAPROTOCOL_LEN+1];
} WSAPROTOCOL_INFOW, * LPWSAPROTOCOL_INFOW;
WCHAR szProtocol[WSAPROTOCOL_LEN+1];
} WSAPROTOCOL_INFOW, *LPWSAPROTOCOL_INFOW;
DECL_WINELIB_TYPE_AW(WSAPROTOCOL_INFO)
DECL_WINELIB_TYPE_AW(LPWSAPROTOCOL_INFO)
typedef struct _WSANETWORKEVENTS
typedef struct _WSANETWORKEVENTS
{
long lNetworkEvents;
int iErrorCode[FD_MAX_EVENTS];
long lNetworkEvents;
int iErrorCode[FD_MAX_EVENTS];
} WSANETWORKEVENTS, *LPWSANETWORKEVENTS;
typedef struct _WSABUF
typedef struct _WSABUF
{
ULONG len;
CHAR* buf;
} WSABUF, *LPWSABUF;
typedef struct _OVERLAPPED * LPWSAOVERLAPPED;
typedef HANDLE WSAEVENT;
#define WSAEVENT HANDLE
#define LPWSAEVENT LPHANDLE
#define WSAOVERLAPPED OVERLAPPED
typedef struct _OVERLAPPED* LPWSAOVERLAPPED;
#define WSA_IO_PENDING (ERROR_IO_PENDING)
#define WSA_IO_INCOMPLETE (ERROR_IO_INCOMPLETE)
#define WSA_INVALID_HANDLE (ERROR_INVALID_HANDLE)
#define WSA_INVALID_PARAMETER (ERROR_INVALID_PARAMETER)
#define WSA_NOT_ENOUGH_MEMORY (ERROR_NOT_ENOUGH_MEMORY)
#define WSA_OPERATION_ABORTED (ERROR_OPERATION_ABORTED)
#define WSA_INVALID_EVENT ((WSAEVENT)NULL)
#define WSA_MAXIMUM_WAIT_EVENTS (MAXIMUM_WAIT_OBJECTS)
#define WSA_WAIT_FAILED ((DWORD)-1L)
#define WSA_WAIT_EVENT_0 (WAIT_OBJECT_0)
#define WSA_WAIT_IO_COMPLETION (WAIT_IO_COMPLETION)
#define WSA_WAIT_TIMEOUT (WAIT_TIMEOUT)
#define WSA_INFINITE (INFINITE)
typedef unsigned int GROUP;
#define SG_UNCONSTRAINED_GROUP 0x01
#define SG_CONSTRAINED_GROUP 0x02
/* FIXME: We don't yet have qos.h */
typedef DWORD QOS, *LPQOS;
typedef int CALLBACK (*LPCONDITIONPROC)
(
LPWSABUF lpCallerId,
LPWSABUF lpCallerData,
LPQOS lpSQOS,
LPQOS lpGQOS,
LPWSABUF lpCalleeId,
LPWSABUF lpCalleeData,
GROUP *g,
DWORD dwCallbackData
);
typedef void CALLBACK (*LPWSAOVERLAPPED_COMPLETION_ROUTINE)
(
DWORD dwError,
DWORD cbTransferred,
LPWSAOVERLAPPED lpOverlapped,
DWORD dwFlags
DWORD dwError,
DWORD cbTransferred,
LPWSAOVERLAPPED lpOverlapped,
DWORD dwFlags
);
/* Function declarations */
int WINAPI WSAEnumNetworkEvents(SOCKET s, WSAEVENT hEventObject, LPWSANETWORKEVENTS lpNetworkEvents);
int WINAPI WSAEventSelect(SOCKET s, WSAEVENT hEventObject, long lNetworkEvents);
/*
* Winsock Function Typedefs
*
* Remember to keep this section in sync with the
* "Prototypes" section in winsock.h.
*/
#if WS_API_TYPEDEFS
typedef HANDLE (WINAPI *LPFN_WSAASYNCGETHOSTBYADDR)(HWND,u_int,const char*,int,int,char*,int));
typedef HANDLE (WINAPI *LPFN_WSAASYNCGETHOSTBYNAME)(HWND,u_int,const char*,char*,int));
typedef HANDLE (WINAPI *LPFN_WSAASYNCGETPROTOBYNAME)(HWND,u_int,const char*,char*,int));
typedef HANDLE (WINAPI *LPFN_WSAASYNCGETPROTOBYNUMBER)(HWND,u_int,int,char*,int));
typedef HANDLE (WINAPI *LPFN_WSAASYNCGETSERVBYNAME)(HWND,u_int,const char*,const char*,char*,int));
typedef HANDLE (WINAPI *LPFN_WSAASYNCGETSERVBYPORT)(HWND,u_int,int,const char*,char*,int));
typedef int (WINAPI *LPFN_WSAASYNCSELECT)(SOCKET,HWND,u_int,long));
typedef int (WINAPI *LPFN_WSACANCELASYNCREQUEST)(HANDLE));
typedef int (WINAPI *LPFN_WSACANCELBLOCKINGCALL)(void));
typedef int (WINAPI *LPFN_WSACLEANUP)(void));
typedef int (WINAPI *LPFN_WSAGETLASTERROR)(void));
typedef BOOL (WINAPI *LPFN_WSAISBLOCKING)(void));
typedef FARPROC (WINAPI *LPFN_WSASETBLOCKINGHOOK)(FARPROC));
typedef void (WINAPI *LPFN_WSASETLASTERROR)(int));
typedef int (WINAPI *LPFN_WSASTARTUP)(WORD,LPWSADATA));
typedef int (WINAPI *LPFN_WSAUNHOOKBLOCKINGHOOK)(void));
typedef SOCKET (WINAPI *LPFN_ACCEPT)(SOCKET,struct WS(sockaddr)*,int*));
typedef int (WINAPI *LPFN_BIND)(SOCKET,const struct WS(sockaddr)*,int));
typedef int (WINAPI *LPFN_CLOSESOCKET)(SOCKET));
typedef int (WINAPI *LPFN_CONNECT)(SOCKET,const struct WS(sockaddr)*,int));
typedef struct WS(hostent)* (WINAPI *LPFN_GETHOSTBYADDR)(const char*,int,int));
typedef struct WS(hostent)* (WINAPI *LPFN_GETHOSTBYNAME)(const char*));
typedef int (WINAPI *LPFN_GETHOSTNAME)(char*,int));
typedef int (WINAPI *LPFN_GETPEERNAME)(SOCKET,struct WS(sockaddr)*,int*));
typedef struct WS(protoent)* (WINAPI *LPFN_GETPROTOBYNAME)(const char*));
typedef struct WS(protoent)* (WINAPI *LPFN_GETPROTOBYNUMBER)(int));
#ifdef WS_DEFINE_SELECT
typedef int (WINAPI* LPFN_SELECT)(int,WS(fd_set)*,WS(fd_set)*,WS(fd_set)*,const struct WS(timeval)*);
#endif
typedef struct WS(servent)* (WINAPI *LPFN_GETSERVBYNAME)(const char*,const char*));
typedef struct WS(servent)* (WINAPI *LPFN_GETSERVBYPORT)(int,const char*));
typedef int (WINAPI *LPFN_GETSOCKNAME)(SOCKET,struct WS(sockaddr)*,int*));
typedef int (WINAPI *LPFN_GETSOCKOPT)(SOCKET,int,int,char*,int*));
typedef u_long (WINAPI *LPFN_HTONL)(u_long));
typedef u_short (WINAPI *LPFN_HTONS)(u_short));
typedef unsigned long (WINAPI *LPFN_INET_ADDR)(const char*);
typedef char* (WINAPI *LPFN_INET_NTOA)(struct WS(in_addr));
typedef int (WINAPI *LPFN_IOCTLSOCKET)(SOCKET,long,u_long*));
typedef int (WINAPI *LPFN_LISTEN)(SOCKET,int));
typedef u_long (WINAPI *LPFN_NTOHL)(u_long));
typedef u_short (WINAPI *LPFN_NTOHS)(u_short));
typedef int (WINAPI *LPFN_RECV)(SOCKET,char*,int,int));
typedef int (WINAPI *LPFN_RECVFROM)(SOCKET,char*,int,int,struct WS(sockaddr)*,int*));
typedef int (WINAPI *LPFN_SEND)(SOCKET,const char*,int,int));
typedef int (WINAPI *LPFN_SENDTO)(SOCKET,const char*,int,int,const struct WS(sockaddr)*,int));
typedef int (WINAPI *LPFN_SETSOCKOPT)(SOCKET,int,int,const char*,int));
typedef int (WINAPI *LPFN_SHUTDOWN)(SOCKET,int));
typedef SOCKET (WINAPI *LPFN_SOCKET)(int,int,int));
#endif /* WS_API_TYPEDEFS */
/*
* Winsock2 Prototypes
*
* Remember to keep this section in sync with the
* "Winsock2 Function Typedefs" section below.
*/
#if WS_API_PROTOTYPES
SOCKET WINAPI WSAAccept(SOCKET,struct WS(sockaddr)*,LPINT,LPCONDITIONPROC,DWORD);
INT WINAPI WSAAddressToStringA(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOA,LPSTR,LPDWORD);
INT WINAPI WSAAddressToStringW(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOW,LPWSTR,LPDWORD);
#define WSAAddressToString WINELIB_NAME_AW(WSAAddressToString)
BOOL WINAPI WSACloseEvent(WSAEVENT);
int WINAPI WSAConnect(SOCKET,const struct WS(sockaddr)*,int,LPWSABUF,LPWSABUF,LPQOS,LPQOS);
WSAEVENT WINAPI WSACreateEvent(void);
BOOL WINAPI WSACloseEvent(WSAEVENT event);
INT WINAPI WSARecvFrom(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,struct sockaddr*,LPINT,
LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
INT WINAPI WSASend(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,LPWSAOVERLAPPED,
LPWSAOVERLAPPED_COMPLETION_ROUTINE);
SOCKET WINAPI WSASocketA(int af, int type, int protocol,
LPWSAPROTOCOL_INFOA lpProtocolInfo,
GROUP g, DWORD dwFlags);
INT WINAPI ioctlsocket(SOCKET s, LONG cmd, ULONG *argp);
/* WSADuplicateSocketA */
/* WSADuplicateSocketW */
/* WSAEnumNameSpaceProvidersA */
/* WSAEnumNameSpaceProvidersW */
int WINAPI WSAEnumNetworkEvents(SOCKET,WSAEVENT,LPWSANETWORKEVENTS);
int WINAPI WSAEnumProtocolsA(LPINT,LPWSAPROTOCOL_INFOA,LPDWORD);
int WINAPI WSAEnumProtocolsW(LPINT,LPWSAPROTOCOL_INFOW,LPDWORD);
#define WSAEnumProtocols WINELIB_NAME_AW(WSAEnumProtocols)
int WINAPI WSAEventSelect(SOCKET,WSAEVENT,long);
BOOL WINAPI WSAGetOverlappedResult(SOCKET,LPWSAOVERLAPPED,LPDWORD,BOOL,LPDWORD);
/* WSAGetQOSByName */
/* WSAGetServiceClassInfoA */
/* WSAGetServiceClassInfoW */
/* WSAGetServiceClassNameByClassIdA */
/* WSAGetServiceClassNameByClassIdW */
int WINAPI WSAHtonl(SOCKET,u_long,u_long*);
int WINAPI WSAHtons(SOCKET,u_short,u_short*);
/* WSAInstallServiceClassA */
/* WSAInstallServiceClassW */
int WINAPI WSAIoctl(SOCKET,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
/* WSAJoinLeaf */
/* WSALookupServiceBeginA */
/* WSALookupServiceBeginW */
/* WSALookupServiceEnd */
/* WSALookupServiceNextA */
/* WSALookupServiceNextW */
int WINAPI WSANtohl(SOCKET,u_long,u_long*);
int WINAPI WSANtohs(SOCKET,u_short,u_short*);
/* WSAProviderConfigChange */
int WINAPI WSARecv(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
int WINAPI WSARecvDisconnect(SOCKET,LPWSABUF);
int WINAPI WSARecvFrom(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,struct WS(sockaddr)*,LPINT,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
/* WSARemoveServiceClass */
BOOL WINAPI WSAResetEvent(WSAEVENT);
int WINAPI WSASend(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
int WINAPI WSASendDisconnect(SOCKET,LPWSABUF);
int WINAPI WSASendTo(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,const struct WS(sockaddr)*,int,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
BOOL WINAPI WSASetEvent(WSAEVENT);
/* WSASetServiceA */
/* WSASetServiceW */
SOCKET WINAPI WSASocketA(int,int,int,LPWSAPROTOCOL_INFOA,GROUP,DWORD);
SOCKET WINAPI WSASocketW(int,int,int,LPWSAPROTOCOL_INFOW,GROUP,DWORD);
INT WINAPI WSAStringToAddressA(LPSTR,INT,LPWSAPROTOCOL_INFOA,LPSOCKADDR,LPINT);
INT WINAPI WSAStringToAddressW(LPSTR,INT,LPWSAPROTOCOL_INFOA,LPSOCKADDR,LPINT);
#define WSASocket WINELIB_NAME_AW(WSASocket)
#define WSAStringToAddress WINELIB_NAME_AW(WSAStringToAddress)
DWORD WINAPI WSAWaitForMultipleEvents(DWORD,const WSAEVENT*,BOOL,DWORD,BOOL);
#endif /* WS_API_PROTOTYPES */
/*
* Winsock2 Function Typedefs
*
* Remember to keep this section in sync with the
* "Winsock2 Prototypes" section above.
*/
#if WS_API_TYPEDEFS
typedef SOCKET (WINAPI *LPFN_WSAACCEPT)(SOCKET,WS(sockaddr)*,LPINT,LPCONDITIONPROC,DWORD);
typedef INT (WINAPI *LPFN_WSAADRESSTOSTRINGA)(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOA,LPSTR,LPDWORD);
typedef INT (WINAPI *LPFN_WSAADRESSTOSTRINGW)(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOW,LPWSTR,LPDWORD);
#define LPFN_WSAADDRESSTOSTRING WINELIB_NAME_AW(LPFN_WSAADDRESSTOSTRING)
typedef BOOL (WINAPI *LPFN_WSACLOSEEVENT)(WSAEVENT);
typedef int (WINAPI *LPFN_WSACONNECT)(SOCKET,const struct WS(sockaddr)*,int,LPWSABUF,LPWSABUF,LPQOS,LPQOS);
typedef WSAEVENT (WINAPI *LPFN_WSACREATEEVENT)(void);
/* WSADuplicateSocketA */
/* WSADuplicateSocketW */
/* WSAEnumNameSpaceProvidersA */
/* WSAEnumNameSpaceProvidersW */
typedef int (WINAPI *LPFN_WSAENUMNETWORKEVENT)(SOCKET,WSAEVENT,LPWSANETWORKEVENTS);
typedef int (WINAPI *LPFN_WSAENUMPROTOCOLSA)(LPINT,LPWSAPROTOCOL_INFOA,LPDWORD);
typedef int (WINAPI *LPFN_WSAENUMPROTOCOLSW)(LPINT,LPWSAPROTOCOL_INFOW,LPDWORD);
#define LPFN_WSAENUMPROTOCOLS WINELIB_NAME_AW(LPFN_WSAENUMPROTOCOLS)
typedef int (WINAPI *LPFN_WSAEVENTSELECT)(SOCKET,WSAEVENT,long);
typedef BOOL (WINAPI *LPFN_WSAGETOVERLAPPEDRESULT)(SOCKET,LPWSAOVERLAPPED,LPDWORD,BOOL,LPDWORD);
/* WSAGetQOSByName */
/* WSAGetServiceClassInfoA */
/* WSAGetServiceClassInfoW */
/* WSAGetServiceClassNameByClassIdA */
/* WSAGetServiceClassNameByClassIdW */
typedef int (WINAPI *LPFN_WSAHTONL)(SOCKET,u_long,u_long*);
typedef int (WINAPI *LPFN_WSAHTONS)(SOCKET,u_short,u_short*);
/* WSAInstallServiceClassA */
/* WSAInstallServiceClassW */
typedef int (WINAPI *LPFN_WSAIOCTL)(SOCKET,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
/* WSAJoinLeaf */
/* WSALookupServiceBeginA */
/* WSALookupServiceBeginW */
/* WSALookupServiceEnd */
/* WSALookupServiceNextA */
/* WSALookupServiceNextW */
typedef int (WINAPI *LPFN_WSANTOHL)(SOCKET,u_long,u_long*);
typedef int (WINAPI *LPFN_WSANTOHS)(SOCKET,u_short,u_short*);
/* WSAProviderConfigChange */
typedef int (WINAPI *LPFN_WSARECV)(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
typedef int (WINAPI *LPFN_WSARECVDISCONNECT)(SOCKET,LPWSABUF);
typedef int (WINAPI *LPFN_WSARECVFROM)(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,struct WS(sockaddr)*,LPINT,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
/* WSARemoveServiceClass */
typedef BOOL (WINAPI *LPFN_WSARESETEVENT)(WSAEVENT);
typedef int (WINAPI *LPFN_WSASEND)(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
typedef int (WINAPI *LPFN_WSASENDDISCONNECT)(SOCKET,LPWSABUF);
typedef int (WINAPI *LPFN_WSASENDTO)(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,const struct WS(sockaddr)*,int,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
typedef BOOL (WINAPI *LPFN_WSASETEVENT)(WSAEVENT);
/* WSASetServiceA */
/* WSASetServiceW */
typedef SOCKET (WINAPI *LPFN_WSASOCKETA)(int,int,int,LPWSAPROTOCOL_INFOA,GROUP,DWORD);
typedef SOCKET (WINAPI *LPFN_WSASOCKETW)(int,int,int,LPWSAPROTOCOL_INFOW,GROUP,DWORD);
typedef INT (WINAPI *LPFN_WSASTRINGTOADDRESSA)(LPSTR,INT,LPWSAPROTOCOL_INFOA,LPSOCKADDR,LPINT);
typedef INT (WINAPI *LPFN_WSASTRINGTOADDRESSW)(LPSTR,INT,LPWSAPROTOCOL_INFOA,LPSOCKADDR,LPINT);
#define LPFN_WSASOCKET WINELIB_NAME_AW(LPFN_WSASOCKET)
#define LPFN_WSASTRINGTOADDRESS WINELIB_NAME_AW(LPFN_WSASTRINGTOADDRESS)
typedef DWORD (WINAPI *LPFN_WSAWAITFORMULTIPLEEVENTS)(DWORD,const WSAEVENT*,BOOL,DWORD,BOOL);
#endif /* WS_API_TYPEDEFS */
#include "poppack.h"
#ifdef __cplusplus
}
#endif
#undef WS
#undef WS_API_PROTOTYPES
#undef WS_API_TYPEDEFS
#endif /* __WINSOCK2API__ */
#ifndef __WS2TCPIP__
#define __WS2TCPIP__
#ifdef USE_WS_PREFIX
#define WS(x) WS_##x
#else
#define WS(x) x
#endif
/* FIXME: This gets defined by some Unix (Linux) header and messes things */
#undef s6_addr
typedef struct WS(in_addr6)
{
u_char s6_addr[16]; /* IPv6 address */
} IN6_ADDR, *PIN6_ADDR, *LPIN6_ADDR;
typedef struct WS(sockaddr_in6)
{
short sin6_family; /* AF_INET6 */
u_short sin6_port; /* Transport level port number */
u_long sin6_flowinfo; /* IPv6 flow information */
struct WS(in_addr6) sin6_addr; /* IPv6 address */
} SOCKADDR_IN6,*PSOCKADDR_IN6, *LPSOCKADDR_IN6;
typedef union sockaddr_gen
{
struct WS(sockaddr) Address;
struct WS(sockaddr_in) AddressIn;
struct WS(sockaddr_in6) AddressIn6;
} WS(sockaddr_gen);
/* Structure to keep interface specific information */
typedef struct _INTERFACE_INFO
{
u_long iiFlags; /* Interface flags */
WS(sockaddr_gen) iiAddress; /* Interface address */
WS(sockaddr_gen) iiBroadcastAddress; /* Broadcast address */
WS(sockaddr_gen) iiNetmask; /* Network mask */
} INTERFACE_INFO, * LPINTERFACE_INFO;
/* Possible flags for the iiFlags - bitmask */
#ifndef USE_WS_PREFIX
#define IFF_UP 0x00000001 /* Interface is up */
#define IFF_BROADCAST 0x00000002 /* Broadcast is supported */
#define IFF_LOOPBACK 0x00000004 /* this is loopback interface */
#define IFF_POINTTOPOINT 0x00000008 /* this is point-to-point interface */
#define IFF_MULTICAST 0x00000010 /* multicast is supported */
#else
#define WS_IFF_UP 0x00000001 /* Interface is up */
#define WS_IFF_BROADCAST 0x00000002 /* Broadcast is supported */
#define WS_IFF_LOOPBACK 0x00000004 /* this is loopback interface */
#define WS_IFF_POINTTOPOINT 0x00000008 /* this is point-to-point interface */
#define WS_IFF_MULTICAST 0x00000010 /* multicast is supported */
#endif /* USE_WS_PREFIX */
#endif /* __WS2TCPIP__ */
/* WCIPX.H
/* WSIPX.H
*/
#ifndef _WINE_WSIPX_
#define _WINE_WSIPX_
#ifdef __cplusplus
extern "C" {
#endif /* defined(__cplusplus) */
#ifdef USE_WS_PREFIX
# define WS(x) WS_##x
#else
# define WS(x) x
#endif
typedef struct ws_sockaddr_ipx
typedef struct WS_sockaddr_ipx
{
short sa_family;
char sa_netnum[4];
......@@ -19,13 +21,9 @@ typedef struct ws_sockaddr_ipx
/*
* constants
*/
#define NSPROTO_IPX 1000
#define NSPROTO_SPX 1256
#define NSPROTO_SPXII 1257
#ifdef __cplusplus
} /* extern "C" */
#endif /* defined(__cplusplus) */
#define NSPROTO_IPX 1000
#define NSPROTO_SPX 1256
#define NSPROTO_SPXII 1257
#undef WS
#endif /* _WINE_WSIPX_ */
......@@ -32,12 +32,17 @@
#include "winerror.h"
#include "winbase.h"
#include "winsock2.h"
#include "process.h"
#include "handle.h"
#include "thread.h"
#include "request.h"
/* To avoid conflicts with the Unix socket headers. Plus we only need a few
* macros anyway.
*/
#define USE_WS_PREFIX
#include "winsock2.h"
struct sock
{
struct object obj; /* object header */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment