update rx (mobile builds).
[mono-project.git] / mono / io-layer / sockets.h
blob45490b01e46c8cb3e9328db18b5fa4c42d4020c7
1 /*
2 * sockets.h: Socket handles
4 * Author:
5 * Dick Porter (dick@ximian.com)
7 * (C) 2002 Ximian, Inc.
8 */
10 #ifndef _WAPI_SOCKETS_H_
11 #define _WAPI_SOCKETS_H_
13 #include "mono/io-layer/wapi.h"
15 G_BEGIN_DECLS
17 #define WSADESCRIPTION_LEN 256
18 #define WSASYS_STATUS_LEN 128
20 typedef struct
22 guint16 wVersion;
23 guint16 wHighVersion;
24 char szDescription[WSADESCRIPTION_LEN+1];
25 char szSystemStatus[WSASYS_STATUS_LEN+1];
26 guint16 iMaxSockets;
27 guint16 iMaxUdpDg;
28 guchar *lpVendorInfo;
29 } WapiWSAData;
31 #define INVALID_SOCKET (guint32)(~0)
32 #define SOCKET_ERROR -1
34 #define WSAID_DISCONNECTEX {0x7fda2e11,0x8630,0x436f,{0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}}
35 #define WSAID_TRANSMITFILE {0xb5367df0,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}}
37 typedef struct
39 guint32 Data1;
40 guint16 Data2;
41 guint16 Data3;
42 guint8 Data4[8];
43 } WapiGuid;
45 typedef struct
47 gpointer Head;
48 guint32 HeadLength;
49 gpointer Tail;
50 guint32 TailLength;
51 } WapiTransmitFileBuffers;
53 typedef enum {
54 TF_USE_DEFAULT_WORKER = 0,
55 TF_DISCONNECT = 0x01,
56 TF_REUSE_SOCKET = 0x02,
57 TF_WRITE_BEHIND = 0x04,
58 TF_USE_SYSTEM_THREAD = 0x10,
59 TF_USE_KERNEL_APC = 0x20
60 } WapiTransmitFileFlags;
62 typedef struct
64 guint32 len;
65 gpointer buf;
66 } WapiWSABuf;
68 /* If we need to support more WSAIoctl commands then define these
69 * using the bitfield flags method
71 #define SIO_GET_EXTENSION_FUNCTION_POINTER 0xC8000006
72 #define SIO_KEEPALIVE_VALS 0x98000004
74 typedef gboolean (*WapiDisconnectExFn)(guint32, WapiOverlapped *, guint32,
75 WapiTransmitFileFlags);
76 typedef gboolean (*WapiTransmitFileFn)(guint32, gpointer, guint32, guint32,
77 WapiOverlapped *,
78 WapiTransmitFileBuffers *,
79 WapiTransmitFileFlags);
82 extern int WSAStartup(guint32 requested, WapiWSAData *data);
83 extern int WSACleanup(void);
84 extern void WSASetLastError(int error);
85 extern int WSAGetLastError(void);
86 extern int closesocket(guint32 handle);
88 extern int ioctlsocket(guint32 handle, gint32 command, gpointer arg);
89 extern int WSAIoctl (guint32 handle, gint32 command,
90 gchar *input, gint i_len,
91 gchar *output, gint o_len, glong *written,
92 void *unused1, void *unused2);
93 extern int WSARecv (guint32 handle, WapiWSABuf *buffers, guint32 count,
94 guint32 *received, guint32 *flags,
95 WapiOverlapped *overlapped, WapiOverlappedCB *complete);
96 extern int WSASend (guint32 handle, WapiWSABuf *buffers, guint32 count,
97 guint32 *sent, guint32 flags,
98 WapiOverlapped *overlapped, WapiOverlappedCB *complete);
100 gboolean TransmitFile (guint32 socket, gpointer file, guint32 bytes_to_write, guint32 bytes_per_send, WapiOverlapped *ol,
101 WapiTransmitFileBuffers *tb, guint32 flags);
102 G_END_DECLS
103 #endif /* _WAPI_SOCKETS_H_ */