2 * sockets.h: Socket handles
5 * Dick Porter (dick@ximian.com)
7 * (C) 2002 Ximian, Inc.
10 #ifndef _WAPI_SOCKETS_H_
11 #define _WAPI_SOCKETS_H_
13 #include <sys/types.h>
14 #include <sys/socket.h>
15 #include <sys/ioctl.h>
16 #include <netinet/in.h>
17 #include <netinet/tcp.h>
19 #include <arpa/inet.h>
21 #include "mono/io-layer/wapi.h"
23 #define WSADESCRIPTION_LEN 256
24 #define WSASYS_STATUS_LEN 128
30 char szDescription[WSADESCRIPTION_LEN+1];
31 char szSystemStatus[WSASYS_STATUS_LEN+1];
37 #define INVALID_SOCKET (guint32)(~0)
38 #define SOCKET_ERROR -1
40 extern int WSAStartup(guint32 requested, WapiWSAData *data);
41 extern int WSACleanup(void);
42 extern void WSASetLastError(int error);
43 extern int WSAGetLastError(void);
44 extern int closesocket(guint32 handle);
46 extern int ioctlsocket(guint32 handle, gint32 command, gpointer arg);
47 extern int WSAIoctl (guint32 handle, gint32 command,
48 gchar *input, gint i_len,
49 gchar *output, gint o_len, glong *written,
50 void *unused1, void *unused2);
52 #ifndef PLATFORM_WIN32
53 typedef void (*SocketAsyncCB) (guint32 error, guint32 numbytes, gpointer ares);
55 gboolean _wapi_socket_async_read (gpointer handle, gpointer buffer,
57 guint32 *bytesread, gpointer ares,
58 SocketAsyncCB callback);
60 gboolean _wapi_socket_async_write (gpointer handle, gpointer buffer,
62 guint32 *bytesread, gpointer ares,
63 SocketAsyncCB callback);
66 #endif /* _WAPI_SOCKETS_H_ */