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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
|
/* -----------------------------------------------------------------------------
* $Id: HsNet.h,v 1.18 2003/07/25 13:46:04 ross Exp $
*
* Definitions for package `net' which are visible in Haskell land.
*
* ---------------------------------------------------------------------------*/
#ifndef HSNET_H
#define HSNET_H
#include "config.h"
#ifndef INLINE
#ifdef _MSC_VER
#define INLINE __inline
#else
#define INLINE extern inline
#endif
#endif
#if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__)
#include <winsock.h>
extern void shutdownWinSock();
extern int initWinSock ();
extern const char* getWSErrorDescr(int err);
# if !defined(__HUGS__)
extern void* newAcceptParams(int sock,
int sz,
void* sockaddr);
extern int acceptNewSock(void* d);
extern int acceptDoProc(void* param);
# endif
#else
#ifdef HAVE_LIMITS_H
# include <limits.h>
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#ifdef HAVE_SYS_UIO_H
# include <sys/uio.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_TCP_H
# include <netinet/tcp.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_SYS_UN_H
# include <sys/un.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifndef HAVE_IN_ADDR_T
typedef u_int32_t in_addr_t;
#endif
#ifdef HAVE_BSD_SENDFILE
#include <sys/uio.h>
#endif
#ifdef HAVE_LINUX_SENDFILE
#if !defined(__USE_FILE_OFFSET64)
#include <sys/sendfile.h>
#endif
#endif
extern int
sendFd(int sock, int outfd);
extern int
recvFd(int sock);
/* The next two are scheduled for deletion */
extern int
sendAncillary(int sock,
int level,
int type,
int flags,
void* data,
int len);
extern int
recvAncillary(int sock,
int* pLevel,
int* pType,
int flags,
void** pData,
int* pLen);
#endif /* HAVE_WINSOCK_H && !__CYGWIN */
INLINE char *
my_inet_ntoa(
#if defined(HAVE_WINSOCK_H)
u_long addr
#else
in_addr_t addr
#endif
)
{
struct in_addr a;
a.s_addr = addr;
return inet_ntoa(a);
}
#endif
|