csutil/sockets.h
Go to the documentation of this file.00001 /* 00002 Copyright (C) 2002 by Matze Braun 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 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
Generated for Crystal Space by doxygen 1.2.18