CrystalSpace

Public API Reference

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

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(CS_PLATFORM_WIN32) && !defined(__CYGWIN__)
00038 #  include <winsock.h>
00039 #  define CS_NET_SOCKET_INVALID INVALID_SOCKET
00040 #  define CS_IOCTLSOCKET ioctlsocket
00041 #  define CS_CLOSESOCKET closesocket
00042 #  if defined(__CYGWIN__) && defined(EWOULDBLOCK)
00043 #   undef EWOULDBLOCK
00044 #  endif
00045 #  define EWOULDBLOCK WSAEWOULDBLOCK
00046 #  define CS_GETSOCKETERROR ::WSAGetLastError()
00047 #elif defined(CS_PLATFORM_UNIX) || defined(__CYGWIN__)
00048 #  include <sys/socket.h>
00049 #  include <unistd.h>
00050 #  define BSD_COMP 1
00051 #  include <sys/ioctl.h>
00052 #  include <arpa/inet.h>
00053 #  include <sys/time.h>
00054 #  include <netinet/in.h>
00055 #  include <netdb.h>
00056 #endif
00057 #if !defined (CS_IOCTLSOCKET)
00058 #  define CS_IOCTLSOCKET ioctl
00059 #endif
00060 #if !defined (CS_CLOSESOCKET)
00061 #  define CS_CLOSESOCKET close
00062 #endif
00063 #if !defined (CS_GETSOCKETERROR)
00064 #  define CS_GETSOCKETERROR errno
00065 #endif
00066 
00067 typedef unsigned int csNetworkSocket;
00068 
00069 #if !defined (CS_NET_SOCKET_INVALID)
00070 #  define CS_NET_SOCKET_INVALID ((csNetworkSocket)~0)
00071 #endif
00072 
00073 // Platforms which do not supply a socklen_t type should define
00074 // CS_USE_FAKE_SOCKLEN_TYPE. Note that we invoke the typedef only if some other
00075 // entity has not already #defined socklen_t, since the #define would cause
00076 // problems (i.e. `typedef int int').
00077 #if defined(CS_USE_FAKE_SOCKLEN_TYPE) && !defined(socklen_t)
00078   typedef int socklen_t;
00079 #endif
00080 
00081 #endif // __CS_CSSYS_SOCKETS_H__

Generated for Crystal Space by doxygen 1.3.9.1