[w32handle] Remove use of w32handle for File, Console, Pipe and Socket (#5319)
[mono.git] / mono / metadata / w32socket-internals.h
index dd4c61129d0ad726c1f7b7e07b3159017ed48852..cf9fb28e466950607f2eee6c681d9ce86c009f40 100644 (file)
@@ -1,9 +1,9 @@
-/*
-* w32socket-internals.h
-*
-* Copyright 2016 Microsoft
-* Licensed under the MIT license. See LICENSE file in the project root for full license information.
-*/
+/**
+ * \file
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
 #ifndef __MONO_METADATA_W32SOCKET_INTERNALS_H__
 #define __MONO_METADATA_W32SOCKET_INTERNALS_H__
 
@@ -17,7 +17,7 @@
 #include <sys/socket.h>
 #endif
 
-#include <mono/io-layer/io-layer.h>
+#include <mono/utils/w32api.h>
 
 #ifndef HAVE_SOCKLEN_T
 #define socklen_t int
 typedef struct {
        guint32 len;
        gpointer buf;
-} WSABUF;
-
-typedef struct {
-       guint32 Internal;
-       guint32 InternalHigh;
-       guint32 Offset;
-       guint32 OffsetHigh;
-       gpointer hEvent;
-       gpointer handle1;
-       gpointer handle2;
-} OVERLAPPED;
+} WSABUF, *LPWSABUF;
 
 typedef struct {
        gpointer Head;
        guint32 HeadLength;
        gpointer Tail;
        guint32 TailLength;
-} TRANSMIT_FILE_BUFFERS;
+} TRANSMIT_FILE_BUFFERS, *LPTRANSMIT_FILE_BUFFERS;
 
 typedef struct {
        guint32 Data1;
@@ -57,8 +47,15 @@ typedef struct {
        guint8 Data4[8];
 } GUID;
 
-typedef BOOL (WINAPI *LPFN_DISCONNECTEX)(SOCKET, OVERLAPPED*, guint32, guint32);
-typedef BOOL (WINAPI *LPFN_TRANSMITFILE)(SOCKET, HANDLE, guint32, guint32, OVERLAPPED*, TRANSMIT_FILE_BUFFERS*, guint32);
+typedef struct {
+       guint32 Internal;
+       guint32 InternalHigh;
+       guint32 Offset;
+       guint32 OffsetHigh;
+       gpointer hEvent;
+       gpointer handle1;
+       gpointer handle2;
+} OVERLAPPED;
 
 #endif
 
@@ -81,7 +78,7 @@ int
 mono_w32socket_recvfrom (SOCKET s, char *buf, int len, int flags, struct sockaddr *from, socklen_t *fromlen, gboolean blocking);
 
 int
-mono_w32socket_recvbuffers (SOCKET s, WSABUF *lpBuffers, guint32 dwBufferCount, guint32 *lpNumberOfBytesRecvd, guint32 *lpFlags, gpointer lpOverlapped, gpointer lpCompletionRoutine, gboolean blocking);
+mono_w32socket_recvbuffers (SOCKET s, LPWSABUF lpBuffers, guint32 dwBufferCount, guint32 *lpNumberOfBytesRecvd, guint32 *lpFlags, gpointer lpOverlapped, gpointer lpCompletionRoutine, gboolean blocking);
 
 int
 mono_w32socket_send (SOCKET s, char *buf, int len, int flags, gboolean blocking);
@@ -90,12 +87,12 @@ int
 mono_w32socket_sendto (SOCKET s, const char *buf, int len, int flags, const struct sockaddr *to, int tolen, gboolean blocking);
 
 int
-mono_w32socket_sendbuffers (SOCKET s, WSABUF *lpBuffers, guint32 dwBufferCount, guint32 *lpNumberOfBytesRecvd, guint32 lpFlags, gpointer lpOverlapped, gpointer lpCompletionRoutine, gboolean blocking);
+mono_w32socket_sendbuffers (SOCKET s, LPWSABUF lpBuffers, guint32 dwBufferCount, guint32 *lpNumberOfBytesRecvd, guint32 lpFlags, gpointer lpOverlapped, gpointer lpCompletionRoutine, gboolean blocking);
 
 #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT)
 
 BOOL
-mono_w32socket_transmit_file (SOCKET hSocket, gpointer hFile, TRANSMIT_FILE_BUFFERS *lpTransmitBuffers, guint32 dwReserved, gboolean blocking);
+mono_w32socket_transmit_file (SOCKET hSocket, gpointer hFile, LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers, guint32 dwReserved, gboolean blocking);
 
 #endif
 
@@ -128,6 +125,9 @@ mono_w32socket_shutdown (SOCKET sock, gint how);
 gint
 mono_w32socket_ioctl (SOCKET sock, gint32 command, gchar *input, gint inputlen, gchar *output, gint outputlen, glong *written);
 
+gboolean
+mono_w32socket_close (SOCKET sock);
+
 #endif /* HOST_WIN32 */
 
 gint
@@ -148,4 +148,7 @@ mono_w32socket_get_last_error (void);
 gint32
 mono_w32socket_convert_error (gint error);
 
+gboolean
+mono_w32socket_duplicate (gpointer handle, gint32 targetProcessId, gpointer *duplicate_handle);
+
 #endif // __MONO_METADATA_W32SOCKET_INTERNALS_H__