f2f636a11fd8f9d8e275f5236b8d14e76e11c88a
[ghc-hetmet.git] / ghc / lib / misc / cbits / ghcSockets.h
1 #ifndef GHC_SOCKETS_H
2 #define GHC_SOCKETS_H
3
4 #if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__)
5 #include <winsock.h>
6 #else
7
8 #include <ctype.h>
9 #include <netdb.h>
10 #include <netinet/in.h>
11 #include <arpa/inet.h>
12 #include <stdio.h>
13 #include <limits.h>
14
15 #ifdef HAVE_STDLIB_H
16 # include <stdlib.h>
17 #endif
18 #ifdef HAVE_STRING_H
19 # include <string.h>
20 #endif
21 #ifdef HAVE_FCNTL_H
22 # include <fcntl.h>
23 #endif
24 #ifdef HAVE_SYS_SOCKET_H
25 # include <sys/socket.h>
26 #endif
27 #ifdef HAVE_NETINET_TCP_H
28 # include <netinet/tcp.h>
29 #endif
30 #if TIME_WITH_SYS_TIME
31 # include <sys/time.h>
32 # include <time.h>
33 #else
34 # if HAVE_SYS_TIME_H
35 #  include <sys/time.h>
36 # else
37 #  include <time.h>
38 # endif
39 #endif
40 #ifdef HAVE_SYS_TYPES_H
41 # include <sys/types.h>
42 #endif
43 #include <sys/uio.h>
44
45 /* ToDo: featurise this */
46 #if  !defined(cygwin32_TARGET_OS) && !defined(mingw32_TARGET_OS)
47 #include <sys/un.h>
48 #endif
49
50 #ifdef HAVE_UNISTD_H
51 # include <unistd.h>
52 #endif
53
54 #endif /* !HAVE_WINSOCK_H */
55
56 /* acceptSocket.lc */
57 StgInt  acceptSocket (StgInt, StgAddr, StgAddr);
58
59 /* bindSocket.lc */
60 StgInt  bindSocket (StgInt, StgAddr, StgInt, StgInt);
61
62 /* connectSocket.lc */
63 StgInt  connectSocket (StgInt, StgAddr, StgInt, StgInt);
64
65 /* createSocket.lc */
66 StgInt  createSocket (StgInt, StgInt, StgInt);
67
68 /* getSockName.lc */
69 StgInt  getSockName (StgInt, StgAddr, StgAddr);
70
71 /* getPeerName.lc */
72 StgInt  getPeerName (StgInt, StgAddr, StgAddr);
73
74 /* listenSocket.lc */
75 StgInt  listenSocket (StgInt, StgInt);
76
77 /* shutdownSocket.lc */
78 StgInt  shutdownSocket (StgInt, StgInt);
79
80 /* readDescriptor.lc */
81 StgInt  readDescriptor (StgInt, StgAddr, StgInt);
82
83 /* recvFrom.c */
84 StgInt  recvFrom__ (StgInt, StgAddr, StgInt, StgAddr);
85
86 /* sendTo.c */
87 StgInt  sendTo__ (StgInt, StgAddr, StgInt, StgAddr, StgInt);
88
89 /* socketOpt.c */
90 StgInt  getSocketOption__ (StgInt, StgInt);
91 StgInt  setSocketOption__ (StgInt, StgInt, StgInt);
92
93 /* writeDescriptor.lc */
94 StgInt  writeDescriptor (StgInt, StgAddr, StgInt);
95
96 /* initWinSock.c */
97 #if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__)
98 StgInt  initWinSock();
99 void    shutdownWinSock();
100 #endif
101
102 #endif /* !GHC_SOCKETS_H */