summaryrefslogtreecommitdiff
path: root/ghc/lib/misc/cbits/ghcSockets.h
blob: f2f636a11fd8f9d8e275f5236b8d14e76e11c88a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#ifndef GHC_SOCKETS_H
#define GHC_SOCKETS_H

#if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__)
#include <winsock.h>
#else

#include <ctype.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <limits.h>

#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_TCP_H
# include <netinet/tcp.h>
#endif
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
#  include <sys/time.h>
# else
#  include <time.h>
# endif
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/uio.h>

/* ToDo: featurise this */
#if  !defined(cygwin32_TARGET_OS) && !defined(mingw32_TARGET_OS)
#include <sys/un.h>
#endif

#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif

#endif /* !HAVE_WINSOCK_H */

/* acceptSocket.lc */
StgInt	acceptSocket (StgInt, StgAddr, StgAddr);

/* bindSocket.lc */
StgInt	bindSocket (StgInt, StgAddr, StgInt, StgInt);

/* connectSocket.lc */
StgInt	connectSocket (StgInt, StgAddr, StgInt, StgInt);

/* createSocket.lc */
StgInt	createSocket (StgInt, StgInt, StgInt);

/* getSockName.lc */
StgInt	getSockName (StgInt, StgAddr, StgAddr);

/* getPeerName.lc */
StgInt	getPeerName (StgInt, StgAddr, StgAddr);

/* listenSocket.lc */
StgInt	listenSocket (StgInt, StgInt);

/* shutdownSocket.lc */
StgInt	shutdownSocket (StgInt, StgInt);

/* readDescriptor.lc */
StgInt	readDescriptor (StgInt, StgAddr, StgInt);

/* recvFrom.c */
StgInt	recvFrom__ (StgInt, StgAddr, StgInt, StgAddr);

/* sendTo.c */
StgInt	sendTo__ (StgInt, StgAddr, StgInt, StgAddr, StgInt);

/* socketOpt.c */
StgInt	getSocketOption__ (StgInt, StgInt);
StgInt	setSocketOption__ (StgInt, StgInt, StgInt);

/* writeDescriptor.lc */
StgInt	writeDescriptor (StgInt, StgAddr, StgInt);

/* initWinSock.c */
#if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__)
StgInt  initWinSock();
void    shutdownWinSock();
#endif

#endif /* !GHC_SOCKETS_H */