Commit a43c000a authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ntdll: Introduce IOCTL_WINE_AFD_KEEPALIVE_VALS.

parent 2afb4356
...@@ -41,6 +41,9 @@ ...@@ -41,6 +41,9 @@
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> #include <netinet/in.h>
#endif #endif
#ifdef HAVE_NETINET_TCP_H
# include <netinet/tcp.h>
#endif
#ifdef HAVE_NETIPX_IPX_H #ifdef HAVE_NETIPX_IPX_H
# include <netipx/ipx.h> # include <netipx/ipx.h>
...@@ -72,6 +75,7 @@ ...@@ -72,6 +75,7 @@
#define USE_WS_PREFIX #define USE_WS_PREFIX
#include "winsock2.h" #include "winsock2.h"
#include "mswsock.h" #include "mswsock.h"
#include "mstcpip.h"
#include "ws2tcpip.h" #include "ws2tcpip.h"
#include "wsipx.h" #include "wsipx.h"
#include "af_irda.h" #include "af_irda.h"
...@@ -79,6 +83,11 @@ ...@@ -79,6 +83,11 @@
#include "unix_private.h" #include "unix_private.h"
#if !defined(TCP_KEEPIDLE) && defined(TCP_KEEPALIVE)
/* TCP_KEEPALIVE is the Mac OS name for TCP_KEEPIDLE */
#define TCP_KEEPIDLE TCP_KEEPALIVE
#endif
WINE_DEFAULT_DEBUG_CHANNEL(winsock); WINE_DEFAULT_DEBUG_CHANNEL(winsock);
#define FILE_USE_FILE_POINTER_POSITION ((LONGLONG)-2) #define FILE_USE_FILE_POINTER_POSITION ((LONGLONG)-2)
...@@ -1448,6 +1457,56 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc ...@@ -1448,6 +1457,56 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc
break; break;
} }
case IOCTL_AFD_WINE_KEEPALIVE_VALS:
{
struct tcp_keepalive *k = in_buffer;
int keepalive;
if (!in_buffer || in_size < sizeof(struct tcp_keepalive))
return STATUS_BUFFER_TOO_SMALL;
keepalive = !!k->onoff;
if ((status = server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, NULL )))
return status;
if (setsockopt( fd, SOL_SOCKET, SO_KEEPALIVE, &keepalive, sizeof(int) ) < 0)
{
status = STATUS_INVALID_PARAMETER;
break;
}
if (keepalive)
{
#ifdef TCP_KEEPIDLE
int idle = max( 1, (k->keepalivetime + 500) / 1000 );
if (setsockopt( fd, IPPROTO_TCP, TCP_KEEPIDLE, &idle, sizeof(int) ) < 0)
{
status = STATUS_INVALID_PARAMETER;
break;
}
#else
FIXME("ignoring keepalive timeout\n");
#endif
}
if (keepalive)
{
#ifdef TCP_KEEPINTVL
int interval = max( 1, (k->keepaliveinterval + 500) / 1000 );
if (setsockopt( fd, IPPROTO_TCP, TCP_KEEPINTVL, &interval, sizeof(int) ) < 0)
status = STATUS_INVALID_PARAMETER;
#else
FIXME("ignoring keepalive interval\n");
#endif
}
status = STATUS_SUCCESS;
complete_async( handle, event, apc, apc_user, io, status, 0 );
break;
}
default: default:
{ {
if ((code >> 16) == FILE_DEVICE_NETWORK) if ((code >> 16) == FILE_DEVICE_NETWORK)
......
...@@ -101,6 +101,7 @@ struct afd_poll_params ...@@ -101,6 +101,7 @@ struct afd_poll_params
#define IOCTL_AFD_WINE_FIONREAD CTL_CODE(FILE_DEVICE_NETWORK, 211, METHOD_BUFFERED, FILE_ANY_ACCESS) #define IOCTL_AFD_WINE_FIONREAD CTL_CODE(FILE_DEVICE_NETWORK, 211, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFD_WINE_SIOCATMARK CTL_CODE(FILE_DEVICE_NETWORK, 212, METHOD_BUFFERED, FILE_ANY_ACCESS) #define IOCTL_AFD_WINE_SIOCATMARK CTL_CODE(FILE_DEVICE_NETWORK, 212, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFD_WINE_GET_INTERFACE_LIST CTL_CODE(FILE_DEVICE_NETWORK, 213, METHOD_BUFFERED, FILE_ANY_ACCESS) #define IOCTL_AFD_WINE_GET_INTERFACE_LIST CTL_CODE(FILE_DEVICE_NETWORK, 213, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFD_WINE_KEEPALIVE_VALS CTL_CODE(FILE_DEVICE_NETWORK, 214, METHOD_BUFFERED, FILE_ANY_ACCESS)
struct afd_create_params struct afd_create_params
{ {
......
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