2 * socket-io.h: Socket IO internal calls
5 * Dick Porter (dick@ximian.com)
7 * (C) 2001 Ximian, Inc.
10 #ifndef _MONO_METADATA_SOCKET_H_
11 #define _MONO_METADATA_SOCKET_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 */
25 SocketType_Seqpacket
=5,
29 /* This is a copy of System.Net.Sockets.AddressFamily */
31 AddressFamily_Unknown
=-1,
32 AddressFamily_Unspecified
=0,
34 AddressFamily_InterNetwork
=2,
35 AddressFamily_ImpLink
=3,
37 AddressFamily_Chaos
=5,
43 AddressFamily_DataKit
=9,
44 AddressFamily_Ccitt
=10,
46 AddressFamily_DecNet
=12,
47 AddressFamily_DataLink
=13,
49 AddressFamily_HyperChannel
=15,
50 AddressFamily_AppleTalk
=16,
51 AddressFamily_NetBios
=17,
52 AddressFamily_VoiceView
=18,
53 AddressFamily_FireFox
=19,
54 AddressFamily_Banyan
=21,
56 AddressFamily_InterNetworkV6
=23,
57 AddressFamily_Cluster
=24,
58 AddressFamily_Ieee12844
=25,
59 AddressFamily_Irda
=26,
60 AddressFamily_NetworkDesigners
=28
63 /* This is a copy of System.Net.Sockets.ProtocolType */
76 ProtocolType_Unspecified
=0,
77 ProtocolType_Ipx
=1000,
78 ProtocolType_Spx
=1256,
79 ProtocolType_SpxII
=1257,
80 ProtocolType_Unknown
=-1
83 /* This is a copy of System.Net.Sockets.SocketOptionLevel */
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 */
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 */
144 SocketFlags_None
= 0x0000,
145 SocketFlags_OutOfBand
= 0x0001,
146 SocketFlags_MaxIOVectorLength
= 0x0010,
147 SocketFlags_Peek
= 0x0002,
148 SocketFlags_DontRoute
= 0x0004,
149 SocketFlags_Partial
= 0x8000
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
{
162 MonoDelegate
*callback
;
163 MonoWaitHandle
*wait_handle
;
164 MonoException
*delayed_exc
;
170 MonoObject
*accept_reuse_socket
;
171 MonoArray
*addresses
;
174 MonoBoolean reusesocket
;
175 MonoObject
*acc_socket
;
177 MonoBoolean completed_synch
;
178 MonoBoolean completed
;
179 MonoBoolean blocking
;
182 MonoAsyncResult
*ares
;
184 } MonoSocketAsyncResult
;
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_ */