On Mon, 13 Sep 2004, Alexandre Julliard wrote:
You shouldn't use #ifdef __FreeBSD__ for that, you should check for the actual features (for instance #ifdef SOL_IPX etc.), possibly adding configure checks if needed.
You're right. Tested on FreeBSD 4.10 as well as SUSE Linux 9.1.
Gerald
ChangeLog: Roderick Colenbrander thunderbird2k@gmx.net Gerald Pfeifer gerald@pfeifer.com Make WS2_Send(), WS_getsockopt(), and WS_setsockopt() work on FreeBSD. Index: socket.c =================================================================== RCS file: /home/wine/wine/dlls/winsock/socket.c,v retrieving revision 1.155 diff -u -3 -p -r1.155 socket.c --- socket.c 7 Sep 2004 20:47:03 -0000 1.155 +++ socket.c 13 Sep 2004 19:02:20 -0000 @@ -1108,6 +1108,7 @@ static int WS2_send ( int fd, struct iov #ifdef HAVE_IPX if(to->sa_family == WS_AF_IPX) { +#ifdef SOL_IPX struct sockaddr_ipx* uipx = (struct sockaddr_ipx*)hdr.msg_name; int val=0; int len=sizeof(int); @@ -1122,6 +1123,7 @@ static int WS2_send ( int fd, struct iov TRACE("ptype: %d (fd:%d)\n", val, fd); uipx->sipx_type = val; } +#endif } #endif
@@ -1580,17 +1582,33 @@ INT WINAPI WS_getsockopt(SOCKET s, INT l switch(optname) { case IPX_PTYPE: + { +#ifndef SOL_IPX + struct ipx val; + socklen_t len=sizeof(struct ipx); +#endif fd = get_sock_fd( s, 0, NULL ); - + +#ifdef SOL_IPX if(getsockopt(fd, SOL_IPX, IPX_TYPE, optval, optlen) == -1) { return SOCKET_ERROR; } +#else + if(getsockopt(fd, 0, SO_DEFAULT_HEADERS, &val, &len) + == -1 ) + { + return SOCKET_ERROR; + } + *optval = (int)val.ipx_pt; +#endif + TRACE("ptype: %d (fd: %d)\n", *(int*)optval, fd); release_sock_fd( s, fd );
return 0; break; + } case IPX_ADDRESS: /* * On a Win2000 system with one network card there are useally three ipx devices one with a speed of 28.8kbps, 10Mbps and 100Mbps. @@ -2305,18 +2323,31 @@ int WINAPI WS_setsockopt(SOCKET s, int l switch(optname) { case IPX_PTYPE: + { +#ifndef SOL_IPX + struct ipx val; +#endif fd = get_sock_fd( s, 0, NULL ); TRACE("trying to set IPX_PTYPE: %d (fd: %d)\n", *(int*)optval, fd);
/* We try to set the ipx type on ipx socket level. */ +#ifdef SOL_IPX if(setsockopt(fd, SOL_IPX, IPX_TYPE, optval, optlen) == -1) { ERR("IPX: could not set ipx option type; expect weird behaviour\n"); return SOCKET_ERROR; } +#else + /* Should we retrieve val using a getsockopt call and then + * set the modified one? */ + val.ipx_pt = *optval; + setsockopt(fd, 0, SO_DEFAULT_HEADERS, &val, sizeof(struct ipx)); +#endif + release_sock_fd( s, fd ); return 0; break; + } case IPX_FILTERPTYPE: /* Sets the receive filter packet type, at the moment we don't support it */ FIXME("IPX_FILTERPTYPE: %x\n", *optval);