00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __CS_CSSYS_SOCKETS_H__
00019 #define __CS_CSSYS_SOCKETS_H__
00020
00035 #include <sys/types.h>
00036
00037 #if defined(OS_WIN32) && !defined(__CYGWIN__)
00038 # include <winsock.h>
00039 # ifndef socklen_t
00040 typedef int socklen_t;
00041 # endif
00042 # define CS_NET_SOCKET_INVALID INVALID_SOCKET
00043 # define CS_IOCTLSOCKET ioctlsocket
00044 # define CS_CLOSESOCKET closesocket
00045 # if defined(__CYGWIN__) && defined(EWOULDBLOCK)
00046 # undef EWOULDBLOCK
00047 # endif
00048 # define EWOULDBLOCK WSAEWOULDBLOCK
00049 # define CS_GETSOCKETERROR ::WSAGetLastError()
00050 # undef CS_SYSDEF_PROVIDE_SOCKETS
00051 #elif defined(OS_UNIX) || defined(__CYGWIN__)
00052 # include <sys/socket.h>
00053 # include <unistd.h>
00054 # define BSD_COMP 1
00055 # include <sys/ioctl.h>
00056 # include <arpa/inet.h>
00057 # include <sys/time.h>
00058 # include <netinet/in.h>
00059 # include <netdb.h>
00060 #endif
00061 #if !defined (CS_IOCTLSOCKET)
00062 # define CS_IOCTLSOCKET ioctl
00063 #endif
00064 #if !defined (CS_CLOSESOCKET)
00065 # define CS_CLOSESOCKET close
00066 #endif
00067 #if !defined (CS_GETSOCKETERROR)
00068 # define CS_GETSOCKETERROR errno
00069 #endif
00070
00071 typedef unsigned int csNetworkSocket;
00072
00073 #if !defined (CS_NET_SOCKET_INVALID)
00074 # define CS_NET_SOCKET_INVALID ((csNetworkSocket)~0)
00075 #endif
00076
00077 #endif // __CS_CSSYS_SOCKETS_H__
00078