aboutsummaryrefslogtreecommitdiffstats
path: root/code/qcommon/net_ip.c
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-08-09 19:12:30 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-08-09 19:12:30 +0000
commit6de20d7f8a60ca52aa7c0ac5e0651e8dd6b03765 (patch)
tree1e3bb8b4a05f8420b51daa6afc566fb14dbb6768 /code/qcommon/net_ip.c
parent9d938fe40af32b1a9860b5d814e963834c327047 (diff)
downloadioquake3-aero-6de20d7f8a60ca52aa7c0ac5e0651e8dd6b03765.tar.gz
ioquake3-aero-6de20d7f8a60ca52aa7c0ac5e0651e8dd6b03765.zip
* Use IPv6 header qcommon/wspiapi.h if it has been added by the end user
* Update README to explain the Windows XP requirement git-svn-id: svn://svn.icculus.org/quake3/trunk@1444 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/qcommon/net_ip.c')
-rw-r--r--code/qcommon/net_ip.c93
1 files changed, 50 insertions, 43 deletions
diff --git a/code/qcommon/net_ip.c b/code/qcommon/net_ip.c
index dd59320..e93ee23 100644
--- a/code/qcommon/net_ip.c
+++ b/code/qcommon/net_ip.c
@@ -24,61 +24,68 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../qcommon/qcommon.h"
#ifdef _WIN32
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#if WINVER < 0x501
-#include <wspiapi.h>
-#else
-#include <ws2spi.h>
-#endif
+# include <winsock2.h>
+# include <ws2tcpip.h>
+# if WINVER < 0x501
+# ifdef __MINGW32__
+ // wspiapi.h isn't available on MinGW, so if it's
+ // present it's because the end user has added it
+ // and we should look for it in our tree
+# include "wspiapi.h"
+# else
+# include <wspiapi.h>
+# endif
+# else
+# include <ws2spi.h>
+# endif
typedef int socklen_t;
-#ifdef ADDRESS_FAMILY
-#define sa_family_t ADDRESS_FAMILY
-#else
+# ifdef ADDRESS_FAMILY
+# define sa_family_t ADDRESS_FAMILY
+# else
typedef unsigned short sa_family_t;
-#endif
+# endif
-#define EAGAIN WSAEWOULDBLOCK
-#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
-#define EAFNOSUPPORT WSAEAFNOSUPPORT
-#define ECONNRESET WSAECONNRESET
-#define socketError WSAGetLastError( )
+# define EAGAIN WSAEWOULDBLOCK
+# define EADDRNOTAVAIL WSAEADDRNOTAVAIL
+# define EAFNOSUPPORT WSAEAFNOSUPPORT
+# define ECONNRESET WSAECONNRESET
+# define socketError WSAGetLastError( )
static WSADATA winsockdata;
static qboolean winsockInitialized = qfalse;
#else
-#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
- // needed for socklen_t on OSX 10.2
-# define _BSD_SOCKLEN_T_
-#endif
-
-#include <arpa/inet.h>
-#include <errno.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <unistd.h>
-#if !defined(__sun) && !defined(__sgi)
-#include <ifaddrs.h>
-#endif
-
-#ifdef __sun
-#include <sys/filio.h>
-#endif
+# if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
+ // needed for socklen_t on OSX 10.2
+# define _BSD_SOCKLEN_T_
+# endif
+
+# include <arpa/inet.h>
+# include <errno.h>
+# include <netdb.h>
+# include <netinet/in.h>
+# include <sys/socket.h>
+# include <net/if.h>
+# include <sys/ioctl.h>
+# include <sys/types.h>
+# include <sys/time.h>
+# include <unistd.h>
+# if !defined(__sun) && !defined(__sgi)
+# include <ifaddrs.h>
+# endif
+
+# ifdef __sun
+# include <sys/filio.h>
+# endif
typedef int SOCKET;
-#define INVALID_SOCKET -1
-#define SOCKET_ERROR -1
-#define closesocket close
-#define ioctlsocket ioctl
-#define socketError errno
+# define INVALID_SOCKET -1
+# define SOCKET_ERROR -1
+# define closesocket close
+# define ioctlsocket ioctl
+# define socketError errno
#endif