Commit 79dcdd0a authored by Alexandre Julliard's avatar Alexandre Julliard

Authors: Roderick Colenbrander <thunderbird2k@gmx.net>, Gerald Pfeifer <gerald@pfeifer.com>

Make WS2_send(), WS_getsockopt(), and WS_setsockopt() IPX support work on FreeBSD.
parent 9f53add8
...@@ -1109,6 +1109,7 @@ static int WS2_send ( int fd, struct iovec* iov, int count, ...@@ -1109,6 +1109,7 @@ static int WS2_send ( int fd, struct iovec* iov, int count,
#ifdef HAVE_IPX #ifdef HAVE_IPX
if(to->sa_family == WS_AF_IPX) if(to->sa_family == WS_AF_IPX)
{ {
#ifdef SOL_IPX
struct sockaddr_ipx* uipx = (struct sockaddr_ipx*)hdr.msg_name; struct sockaddr_ipx* uipx = (struct sockaddr_ipx*)hdr.msg_name;
int val=0; int val=0;
int len=sizeof(int); int len=sizeof(int);
...@@ -1123,6 +1124,7 @@ static int WS2_send ( int fd, struct iovec* iov, int count, ...@@ -1123,6 +1124,7 @@ static int WS2_send ( int fd, struct iovec* iov, int count,
TRACE("ptype: %d (fd:%d)\n", val, fd); TRACE("ptype: %d (fd:%d)\n", val, fd);
uipx->sipx_type = val; uipx->sipx_type = val;
} }
#endif
} }
#endif #endif
...@@ -1582,16 +1584,25 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level, ...@@ -1582,16 +1584,25 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level,
{ {
case IPX_PTYPE: case IPX_PTYPE:
fd = get_sock_fd( s, 0, NULL ); fd = get_sock_fd( s, 0, NULL );
#ifdef SOL_IPX
if(getsockopt(fd, SOL_IPX, IPX_TYPE, optval, optlen) == -1) if(getsockopt(fd, SOL_IPX, IPX_TYPE, optval, optlen) == -1)
{ {
return SOCKET_ERROR; return SOCKET_ERROR;
} }
#else
{
struct ipx val;
socklen_t len=sizeof(struct ipx);
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); TRACE("ptype: %d (fd: %d)\n", *(int*)optval, fd);
release_sock_fd( s, fd ); release_sock_fd( s, fd );
return 0; return 0;
break;
case IPX_ADDRESS: 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. * On a Win2000 system with one network card there are useally three ipx devices one with a speed of 28.8kbps, 10Mbps and 100Mbps.
...@@ -1612,13 +1623,11 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level, ...@@ -1612,13 +1623,11 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level,
data->maxpkt = 1467; /* This value is the default one on atleast Win2k/WinXP */ data->maxpkt = 1467; /* This value is the default one on atleast Win2k/WinXP */
data->linkspeed = 100000; /* Set the line speed in 100bit/s to 10 Mbit; note 1MB = 1000kB in this case */ data->linkspeed = 100000; /* Set the line speed in 100bit/s to 10 Mbit; note 1MB = 1000kB in this case */
return 0; return 0;
break;
case IPX_MAX_ADAPTER_NUM: case IPX_MAX_ADAPTER_NUM:
FIXME("IPX_MAX_ADAPTER_NUM\n"); FIXME("IPX_MAX_ADAPTER_NUM\n");
*(int*)optval = 1; /* As noted under IPX_ADDRESS we have just one card. */ *(int*)optval = 1; /* As noted under IPX_ADDRESS we have just one card. */
return 0; return 0;
break;
default: default:
FIXME("IPX optname:%x\n", optname); FIXME("IPX optname:%x\n", optname);
return SOCKET_ERROR; return SOCKET_ERROR;
...@@ -2329,14 +2338,23 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname, ...@@ -2329,14 +2338,23 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
TRACE("trying to set IPX_PTYPE: %d (fd: %d)\n", *(int*)optval, fd); TRACE("trying to set IPX_PTYPE: %d (fd: %d)\n", *(int*)optval, fd);
/* We try to set the ipx type on ipx socket level. */ /* We try to set the ipx type on ipx socket level. */
#ifdef SOL_IPX
if(setsockopt(fd, SOL_IPX, IPX_TYPE, optval, optlen) == -1) if(setsockopt(fd, SOL_IPX, IPX_TYPE, optval, optlen) == -1)
{ {
ERR("IPX: could not set ipx option type; expect weird behaviour\n"); ERR("IPX: could not set ipx option type; expect weird behaviour\n");
return SOCKET_ERROR; return SOCKET_ERROR;
} }
#else
{
struct ipx val;
/* 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 ); release_sock_fd( s, fd );
return 0; return 0;
break;
case IPX_FILTERPTYPE: case IPX_FILTERPTYPE:
/* Sets the receive filter packet type, at the moment we don't support it */ /* Sets the receive filter packet type, at the moment we don't support it */
FIXME("IPX_FILTERPTYPE: %x\n", *optval); FIXME("IPX_FILTERPTYPE: %x\n", *optval);
......
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