[amd64] Remove the callee saved registers from MonoLMF, save/restore them normally...
[mono-project.git] / mono / metadata / socket-io.h
blob26944839442d94cde85e01d0b32b118b1c0c946b
1 /*
2 * socket-io.h: Socket IO internal calls
4 * Author:
5 * Dick Porter (dick@ximian.com)
7 * (C) 2001 Ximian, Inc.
8 */
10 #ifndef _MONO_METADATA_SOCKET_H_
11 #define _MONO_METADATA_SOCKET_H_
13 #include <config.h>
14 #include <glib.h>
16 #include <mono/metadata/object-internals.h>
17 #include <mono/io-layer/io-layer.h>
19 /* This is a copy of System.Net.Sockets.SocketType */
20 typedef enum {
21 SocketType_Stream=1,
22 SocketType_Dgram=2,
23 SocketType_Raw=3,
24 SocketType_Rdm=4,
25 SocketType_Seqpacket=5,
26 SocketType_Unknown=-1
27 } MonoSocketType;
29 /* This is a copy of System.Net.Sockets.AddressFamily */
30 typedef enum {
31 AddressFamily_Unknown=-1,
32 AddressFamily_Unspecified=0,
33 AddressFamily_Unix=1,
34 AddressFamily_InterNetwork=2,
35 AddressFamily_ImpLink=3,
36 AddressFamily_Pup=4,
37 AddressFamily_Chaos=5,
38 AddressFamily_NS=6,
39 AddressFamily_Ipx=6,
40 AddressFamily_Iso=7,
41 AddressFamily_Osi=7,
42 AddressFamily_Ecma=8,
43 AddressFamily_DataKit=9,
44 AddressFamily_Ccitt=10,
45 AddressFamily_Sna=11,
46 AddressFamily_DecNet=12,
47 AddressFamily_DataLink=13,
48 AddressFamily_Lat=14,
49 AddressFamily_HyperChannel=15,
50 AddressFamily_AppleTalk=16,
51 AddressFamily_NetBios=17,
52 AddressFamily_VoiceView=18,
53 AddressFamily_FireFox=19,
54 AddressFamily_Banyan=21,
55 AddressFamily_Atm=22,
56 AddressFamily_InterNetworkV6=23,
57 AddressFamily_Cluster=24,
58 AddressFamily_Ieee12844=25,
59 AddressFamily_Irda=26,
60 AddressFamily_NetworkDesigners=28
61 } MonoAddressFamily;
63 /* This is a copy of System.Net.Sockets.ProtocolType */
64 typedef enum {
65 ProtocolType_IP=0,
66 ProtocolType_Icmp=1,
67 ProtocolType_Igmp=2,
68 ProtocolType_Ggp=3,
69 ProtocolType_Tcp=6,
70 ProtocolType_Pup=12,
71 ProtocolType_Udp=17,
72 ProtocolType_Idp=22,
73 ProtocolType_IPv6=41,
74 ProtocolType_ND=77,
75 ProtocolType_Raw=255,
76 ProtocolType_Unspecified=0,
77 ProtocolType_Ipx=1000,
78 ProtocolType_Spx=1256,
79 ProtocolType_SpxII=1257,
80 ProtocolType_Unknown=-1
81 } MonoProtocolType;
83 /* This is a copy of System.Net.Sockets.SocketOptionLevel */
84 typedef enum {
85 SocketOptionLevel_Socket=65535,
86 SocketOptionLevel_IP=0,
87 SocketOptionLevel_IPv6=41,
88 SocketOptionLevel_Tcp=6,
89 SocketOptionLevel_Udp=17
90 } MonoSocketOptionLevel;
92 /* This is a copy of System.Net.Sockets.SocketOptionName */
93 typedef enum {
94 SocketOptionName_Debug=1,
95 SocketOptionName_AcceptConnection=2,
96 SocketOptionName_ReuseAddress=4,
97 SocketOptionName_KeepAlive=8,
98 SocketOptionName_DontRoute=16,
99 SocketOptionName_Broadcast=32,
100 SocketOptionName_UseLoopback=64,
101 SocketOptionName_Linger=128,
102 SocketOptionName_OutOfBandInline=256,
103 SocketOptionName_DontLinger= -129,
104 SocketOptionName_ExclusiveAddressUse= -5,
105 SocketOptionName_SendBuffer= 4097,
106 SocketOptionName_ReceiveBuffer=4098,
107 SocketOptionName_SendLowWater=4099,
108 SocketOptionName_ReceiveLowWater=4100,
109 SocketOptionName_SendTimeout=4101,
110 SocketOptionName_ReceiveTimeout=4102,
111 SocketOptionName_Error=4103,
112 SocketOptionName_Type=4104,
113 SocketOptionName_MaxConnections=2147483647,
114 SocketOptionName_IPOptions=1,
115 SocketOptionName_HeaderIncluded=2,
116 SocketOptionName_TypeOfService=3,
117 SocketOptionName_IpTimeToLive=4,
118 SocketOptionName_MulticastInterface=9,
119 SocketOptionName_MulticastTimeToLive=10,
120 SocketOptionName_MulticastLoopback=11,
121 SocketOptionName_AddMembership=12,
122 SocketOptionName_DropMembership=13,
123 SocketOptionName_DontFragment=14,
124 SocketOptionName_AddSourceMembership=15,
125 SocketOptionName_DropSourceMembership=16,
126 SocketOptionName_BlockSource=17,
127 SocketOptionName_UnblockSource=18,
128 SocketOptionName_PacketInformation=19,
129 SocketOptionName_NoDelay=1,
130 SocketOptionName_BsdUrgent=2,
131 SocketOptionName_Expedited=2,
132 SocketOptionName_NoChecksum=1,
133 SocketOptionName_ChecksumCoverage=20,
134 SocketOptionName_HopLimit=21,
136 /* This is Mono-specific, keep it in sync with
137 * Mono.Posix/PeerCred.cs
139 SocketOptionName_PeerCred=10001
140 } MonoSocketOptionName;
142 /* This is a copy of System.Net.Sockets.SocketFlags */
143 typedef enum {
144 SocketFlags_None = 0x0000,
145 SocketFlags_OutOfBand = 0x0001,
146 SocketFlags_MaxIOVectorLength = 0x0010,
147 SocketFlags_Peek = 0x0002,
148 SocketFlags_DontRoute = 0x0004,
149 SocketFlags_Partial = 0x8000
150 } MonoSocketFlags;
153 Keep this in sync with SocketAsyncResult in
154 ./System.Net.Sockets/Socket.cs and ProcessAsyncReader
155 in System.Diagnostics/Process.cs.
157 typedef struct _MonoSocketAsyncResult {
158 MonoObject obj;
159 MonoObject *socket;
160 HANDLE handle;
161 MonoObject *state;
162 MonoDelegate *callback;
163 MonoWaitHandle *wait_handle;
164 MonoException *delayed_exc;
165 MonoObject *ep;
166 MonoArray *buffer;
167 gint offset;
168 gint size;
169 gint socket_flags;
170 MonoObject *accept_reuse_socket;
171 MonoArray *addresses;
172 gint port;
173 MonoObject *buffers;
174 MonoBoolean reusesocket;
175 MonoObject *acc_socket;
176 gint total;
177 MonoBoolean completed_synch;
178 MonoBoolean completed;
179 MonoBoolean blocking;
180 gint error;
181 gint operation;
182 MonoAsyncResult *ares;
183 gint32 end_called;
184 } MonoSocketAsyncResult;
186 typedef struct
188 MonoObject obj;
189 gint pid;
190 gint uid;
191 gint gid;
192 } MonoPeerCredData;
194 extern gpointer ves_icall_System_Net_Sockets_Socket_Socket_internal(MonoObject *this_obj, gint32 family, gint32 type, gint32 proto, gint32 *error) MONO_INTERNAL;
195 extern void ves_icall_System_Net_Sockets_Socket_Close_internal(SOCKET sock, gint32 *error) MONO_INTERNAL;
196 extern gint32 ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal(void) MONO_INTERNAL;
197 extern gint32 ves_icall_System_Net_Sockets_Socket_Available_internal(SOCKET sock, gint32 *error) MONO_INTERNAL;
198 extern void ves_icall_System_Net_Sockets_Socket_Blocking_internal(SOCKET sock, gboolean block, gint32 *error) MONO_INTERNAL;
199 extern gpointer ves_icall_System_Net_Sockets_Socket_Accept_internal(SOCKET sock, gint32 *error, gboolean blocking) MONO_INTERNAL;
200 extern void ves_icall_System_Net_Sockets_Socket_Listen_internal(SOCKET sock, guint32 backlog, gint32 *error) MONO_INTERNAL;
201 extern MonoObject *ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal(SOCKET sock, gint32 af, gint32 *error) MONO_INTERNAL;
202 extern MonoObject *ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal(SOCKET sock, gint32 af, gint32 *error) MONO_INTERNAL;
203 extern void ves_icall_System_Net_Sockets_Socket_Bind_internal(SOCKET sock, MonoObject *sockaddr, gint32 *error) MONO_INTERNAL;
204 extern void ves_icall_System_Net_Sockets_Socket_Connect_internal(SOCKET sock, MonoObject *sockaddr, gint32 *error) MONO_INTERNAL;
205 extern gint32 ves_icall_System_Net_Sockets_Socket_Receive_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, gint32 *error) MONO_INTERNAL;
206 extern gint32 ves_icall_System_Net_Sockets_Socket_Receive_array_internal(SOCKET sock, MonoArray *buffers, gint32 flags, gint32 *error) MONO_INTERNAL;
207 extern gint32 ves_icall_System_Net_Sockets_Socket_RecvFrom_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject **sockaddr, gint32 *error) MONO_INTERNAL;
208 extern gint32 ves_icall_System_Net_Sockets_Socket_Send_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, gint32 *error) MONO_INTERNAL;
209 extern gint32 ves_icall_System_Net_Sockets_Socket_Send_array_internal(SOCKET sock, MonoArray *buffers, gint32 flags, gint32 *error) MONO_INTERNAL;
210 extern gint32 ves_icall_System_Net_Sockets_Socket_SendTo_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject *sockaddr, gint32 *error) MONO_INTERNAL;
211 extern void ves_icall_System_Net_Sockets_Socket_Select_internal(MonoArray **sockets, gint32 timeout, gint32 *error) MONO_INTERNAL;
212 extern void ves_icall_System_Net_Sockets_Socket_Shutdown_internal(SOCKET sock, gint32 how, gint32 *error) MONO_INTERNAL;
213 extern void ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal(SOCKET sock, gint32 level, gint32 name, MonoObject **obj_val, gint32 *error) MONO_INTERNAL;
214 extern void ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal(SOCKET sock, gint32 level, gint32 name, MonoArray **byte_val, gint32 *error) MONO_INTERNAL;
215 extern void ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal(SOCKET sock, gint32 level, gint32 name, MonoObject *obj_val, MonoArray *byte_val, gint32 int_val, gint32 *error) MONO_INTERNAL;
216 extern int ves_icall_System_Net_Sockets_Socket_WSAIoctl (SOCKET sock, gint32 code, MonoArray *input, MonoArray *output, gint32 *error) MONO_INTERNAL;
217 extern MonoBoolean ves_icall_System_Net_Dns_GetHostByName_internal(MonoString *host, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list) MONO_INTERNAL;
218 extern MonoBoolean ves_icall_System_Net_Dns_GetHostByAddr_internal(MonoString *addr, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list) MONO_INTERNAL;
219 extern MonoBoolean ves_icall_System_Net_Dns_GetHostName_internal(MonoString **h_name) MONO_INTERNAL;
220 extern MonoBoolean ves_icall_System_Net_Sockets_Socket_Poll_internal (SOCKET sock, gint mode, gint timeout, gint32 *error) MONO_INTERNAL;
221 extern void ves_icall_System_Net_Sockets_Socket_Disconnect_internal(SOCKET sock, MonoBoolean reuse, gint32 *error) MONO_INTERNAL;
222 extern gboolean ves_icall_System_Net_Sockets_Socket_SendFile (SOCKET sock, MonoString *filename, MonoArray *pre_buffer, MonoArray *post_buffer, gint flags) MONO_INTERNAL;
223 void icall_cancel_blocking_socket_operation (MonoThread *thread) MONO_INTERNAL;
225 extern void mono_network_init(void) MONO_INTERNAL;
226 extern void mono_network_cleanup(void) MONO_INTERNAL;
228 #endif /* _MONO_METADATA_SOCKET_H_ */