Fri Jan 23 21:07:02 CET 2004 Paolo Molaro <lupus@ximian.com>
[mono.git] / mono / io-layer / sockets.h
1 /*
2  * sockets.h:  Socket handles
3  *
4  * Author:
5  *      Dick Porter (dick@ximian.com)
6  *
7  * (C) 2002 Ximian, Inc.
8  */
9
10 #ifndef _WAPI_SOCKETS_H_
11 #define _WAPI_SOCKETS_H_
12
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>
18 #include <netdb.h>
19 #include <arpa/inet.h>
20
21 #include "mono/io-layer/wapi.h"
22
23 #define WSADESCRIPTION_LEN 256
24 #define WSASYS_STATUS_LEN 128
25
26 #ifdef __APPLE__
27 typedef unsigned int socklen_t;
28 #endif
29
30 typedef struct 
31 {
32         guint16 wVersion;
33         guint16 wHighVersion;
34         char szDescription[WSADESCRIPTION_LEN+1];
35         char szSystemStatus[WSASYS_STATUS_LEN+1];
36         guint16 iMaxSockets;
37         guint16 iMaxUdpDg;
38         guchar *lpVendorInfo;
39 } WapiWSAData;
40
41 #define INVALID_SOCKET (guint32)(~0)
42 #define SOCKET_ERROR -1
43
44 extern int WSAStartup(guint32 requested, WapiWSAData *data);
45 extern int WSACleanup(void);
46 extern void WSASetLastError(int error);
47 extern int WSAGetLastError(void);
48 extern int closesocket(guint32 handle);
49
50 extern int ioctlsocket(guint32 handle, gint32 command, gpointer arg);
51
52 #endif /* _WAPI_SOCKETS_H_ */