]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
removed winsock ipx support
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 28 Mar 2003 03:04:44 +0000 (03:04 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 28 Mar 2003 03:04:44 +0000 (03:04 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2860 d7cf8633-e32d-0410-b094-e92efae38249

darkplaces.dsp
makefile.mingw
makefile.mingwcross
net_win.c
net_wipx.c [deleted file]
net_wipx.h [deleted file]

index 27e0f1d68612939c10b0db6b12fc8685d1123c2d..df293b488595a8b042dbb0cd8522741d17d52a50 100644 (file)
@@ -7,19 +7,19 @@
 CFG=darkplaces - Win32 Debug\r
 !MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
 !MESSAGE use the Export Makefile command and run\r
-!MESSAGE \r
+!MESSAGE\r
 !MESSAGE NMAKE /f "darkplaces.mak".\r
-!MESSAGE \r
+!MESSAGE\r
 !MESSAGE You can specify a configuration when running NMAKE\r
 !MESSAGE by defining the macro CFG on the command line. For example:\r
-!MESSAGE \r
+!MESSAGE\r
 !MESSAGE NMAKE /f "darkplaces.mak" CFG="darkplaces - Win32 Debug"\r
-!MESSAGE \r
+!MESSAGE\r
 !MESSAGE Possible choices for configuration are:\r
 !MESSAGE\r
 !MESSAGE "darkplaces - Win32 Release" (based on "Win32 (x86) Application")\r
 !MESSAGE "darkplaces - Win32 Debug" (based on "Win32 (x86) Application")\r
-!MESSAGE \r
+!MESSAGE\r
 \r
 # Begin Project\r
 # PROP AllowPerConfigDependencies 0\r
@@ -81,7 +81,7 @@ LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept\r
 # ADD LINK32 user32.lib gdi32.lib opengl32.lib wsock32.lib winmm.lib comctl32.lib dxguid.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept\r
 \r
-!ENDIF \r
+!ENDIF\r
 \r
 # Begin Target\r
 \r
@@ -284,10 +284,6 @@ SOURCE=.\net_wins.c
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=.\net_wipx.c\r
-# End Source File\r
-# Begin Source File\r
-\r
 SOURCE=.\palette.c\r
 # End Source File\r
 # Begin Source File\r
@@ -588,10 +584,6 @@ SOURCE=.\net_wins.h
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=.\net_wipx.h\r
-# End Source File\r
-# Begin Source File\r
-\r
 SOURCE=.\palette.h\r
 # End Source File\r
 # Begin Source File\r
index c895758579b873c5ddca5664cb852a31f1d5316b..63889847c52818ce4d0d61e0c850eba5a951188c 100644 (file)
@@ -40,7 +40,7 @@ builddate:
 .c.o:
        gcc $(CFLAGS) -c $*.c
 
-darkplaces: $(OBJECTS) vid_wgl.o sys_win.o snd_win.o net_win.o net_wins.o net_wipx.o cd_win.o conproc.o
+darkplaces: $(OBJECTS) vid_wgl.o sys_win.o snd_win.o net_win.o net_wins.o cd_win.o conproc.o
        gcc -o $@ $^ $(LDFLAGS)
 
 
index ce0d610591156a6adb9e5346ea005aa9cb716e01..f4276542697ff13ab2da7afd7bfbb36083341a6c 100644 (file)
@@ -42,8 +42,8 @@ SHAREDOBJECTS=        builddate.o cmd.o collision.o common.o crc.o cvar.o \
 
 
 OBJ_COMMON= $(CLIENTOBJECTS) $(SERVEROBJECTS) $(SHAREDOBJECTS)
-OBJ_WGL= vid_wgl.o $(OBJ_CD) $(OBJ_SND) net_win.o net_wins.o net_wipx.o sys_win.o
-OBJ_DED= vid_null.o cd_null.o snd_null.o net_win.o net_wins.o net_wipx.o sys_win.o
+OBJ_WGL= vid_wgl.o $(OBJ_CD) $(OBJ_SND) net_win.o net_wins.o sys_win.o
+OBJ_DED= vid_null.o cd_null.o snd_null.o net_win.o net_wins.o sys_win.o
 
 
 # Compilation
index 4b43b5c9b1177e2bd18f5a30638aa8016f2e62a3..85c08a113a35818aac2e9dcf1257750214976a9b 100644 (file)
--- a/net_win.c
+++ b/net_win.c
@@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 See the GNU General Public License for more details.
 
@@ -95,34 +95,8 @@ net_landriver_t      net_landrivers[MAX_NET_DRIVERS] =
        WINS_AddrCompare,
        WINS_GetSocketPort,
        WINS_SetSocketPort
-       },
-       {
-       "Winsock IPX",
-       false,
-       0,
-       WIPX_Init,
-       WIPX_Shutdown,
-       WIPX_Listen,
-       WIPX_OpenSocket,
-       WIPX_CloseSocket,
-       WIPX_Connect,
-       WIPX_CheckNewConnections,
-       WIPX_Recv,
-       WIPX_Send,
-       WIPX_Read,
-       WIPX_Write,
-       WIPX_Broadcast,
-       WIPX_AddrToString,
-       WIPX_StringToAddr,
-       WIPX_GetSocketAddr,
-       WIPX_GetNameFromAddr,
-       WIPX_GetAddrFromName,
-       WIPX_AddrCompare,
-       WIPX_GetSocketPort,
-       WIPX_SetSocketPort
        }
-
 };
 
-int net_numlandrivers = 2;
+int net_numlandrivers = 1;
 
diff --git a/net_wipx.c b/net_wipx.c
deleted file mode 100644 (file)
index 7bed13c..0000000
+++ /dev/null
@@ -1,444 +0,0 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// net_wipx.c
-
-#include "quakedef.h"
-#include "winquake.h"
-#include <wsipx.h>
-#include "net_wipx.h"
-
-#define MAXHOSTNAMELEN         256
-
-static int net_acceptsocket = -1;              // socket for fielding new connections
-static int net_controlsocket;
-static struct qsockaddr broadcastaddr;
-
-extern qboolean winsock_initialized;
-extern WSADATA         winsockdata;
-
-#define IPXSOCKETS 18
-static int ipxsocket[IPXSOCKETS];
-static int sequence[IPXSOCKETS];
-
-//=============================================================================
-
-int WIPX_Init (void)
-{
-       int             i;
-       char    buff[MAXHOSTNAMELEN];
-       struct qsockaddr addr;
-       char    *p;
-       int             r;
-       WORD    wVersionRequested; 
-
-       if (!COM_CheckParm ("-ipx")) // LordHavoc: changed -noipx to -ipx at Dabb's request, apparently crashs on computers without MS clients installed
-               return -1;
-
-// make sure LoadLibrary has happened successfully
-       if (!winsock_lib_initialized)
-               return -1;
-
-       if (winsock_initialized == 0)
-       {
-               wVersionRequested = MAKEWORD(1, 1); 
-
-               r = pWSAStartup (MAKEWORD(1, 1), &winsockdata);
-
-               if (r)
-               {
-                       Con_Printf ("Winsock initialization failed.\n");
-                       return -1;
-               }
-       }
-       winsock_initialized++;
-
-       for (i = 0; i < IPXSOCKETS; i++)
-               ipxsocket[i] = 0;
-
-       // determine my name & address
-       if (pgethostname(buff, MAXHOSTNAMELEN) == 0)
-       {
-               // if the quake hostname isn't set, set it to the machine name
-               if (strcmp(hostname.string, "UNNAMED") == 0)
-               {
-                       // see if it's a text IP address (well, close enough)
-                       for (p = buff; *p; p++)
-                               if ((*p < '0' || *p > '9') && *p != '.')
-                                       break;
-
-                       // if it is a real name, strip off the domain; we only want the host
-                       if (*p)
-                       {
-                               for (i = 0; i < 15; i++)
-                                       if (buff[i] == '.')
-                                               break;
-                               buff[i] = 0;
-                       }
-                       Cvar_Set ("hostname", buff);
-               }
-       }
-
-       if ((net_controlsocket = WIPX_OpenSocket (0)) == -1)
-       {
-               Con_Printf("WIPX_Init: Unable to open control socket\n");
-               if (--winsock_initialized == 0)
-                       pWSACleanup ();
-               return -1;
-       }
-
-       ((struct sockaddr_ipx *)&broadcastaddr)->sa_family = AF_IPX;
-       memset(((struct sockaddr_ipx *)&broadcastaddr)->sa_netnum, 0, 4);
-       memset(((struct sockaddr_ipx *)&broadcastaddr)->sa_nodenum, 0xff, 6);
-       ((struct sockaddr_ipx *)&broadcastaddr)->sa_socket = htons((unsigned short)net_hostport);
-
-       WIPX_GetSocketAddr (net_controlsocket, &addr);
-       strcpy(my_ipx_address,  WIPX_AddrToString (&addr));
-       p = strrchr (my_ipx_address, ':');
-       if (p)
-               *p = 0;
-
-       Con_Printf("Winsock IPX Initialized\n");
-       ipxAvailable = true;
-
-       return net_controlsocket;
-}
-
-//=============================================================================
-
-void WIPX_Shutdown (void)
-{
-       WIPX_Listen (false);
-       WIPX_CloseSocket (net_controlsocket);
-       if (--winsock_initialized == 0)
-               pWSACleanup ();
-}
-
-//=============================================================================
-
-void WIPX_Listen (qboolean state)
-{
-       // enable listening
-       if (state)
-       {
-               if (net_acceptsocket != -1)
-                       return;
-               if ((net_acceptsocket = WIPX_OpenSocket (net_hostport)) == -1)
-                       Sys_Error ("WIPX_Listen: Unable to open accept socket\n");
-               return;
-       }
-
-       // disable listening
-       if (net_acceptsocket == -1)
-               return;
-       WIPX_CloseSocket (net_acceptsocket);
-       net_acceptsocket = -1;
-}
-
-//=============================================================================
-
-int WIPX_OpenSocket (int port)
-{
-       int handle;
-       int newsocket;
-       struct sockaddr_ipx address;
-       u_long _true = 1;
-
-       for (handle = 0; handle < IPXSOCKETS; handle++)
-               if (ipxsocket[handle] == 0)
-                       break;
-       if (handle == IPXSOCKETS)
-               return -1;
-
-       if ((newsocket = psocket (AF_IPX, SOCK_DGRAM, NSPROTO_IPX)) == INVALID_SOCKET)
-               return -1;
-
-       if (pioctlsocket (newsocket, FIONBIO, &_true) == -1)
-               goto ErrorReturn;
-
-       if (psetsockopt(newsocket, SOL_SOCKET, SO_BROADCAST, (char *)&_true, sizeof(_true)) < 0)
-               goto ErrorReturn;
-
-       address.sa_family = AF_IPX;
-       memset(address.sa_netnum, 0, 4);
-       memset(address.sa_nodenum, 0, 6);;
-       address.sa_socket = htons((unsigned short)port);
-       if( bind (newsocket, (void *)&address, sizeof(address)) == 0)
-       {
-               ipxsocket[handle] = newsocket;
-               sequence[handle] = 0;
-               return handle;
-       }
-
-       Sys_Error ("Winsock IPX bind failed\n");
-ErrorReturn:
-       pclosesocket (newsocket);
-       return -1;
-}
-
-//=============================================================================
-
-int WIPX_CloseSocket (int handle)
-{
-       int socket = ipxsocket[handle];
-       int ret;
-
-       ret =  pclosesocket (socket);
-       ipxsocket[handle] = 0;
-       return ret;
-}
-
-
-//=============================================================================
-
-int WIPX_Connect (int handle, struct qsockaddr *addr)
-{
-       return 0;
-}
-
-//=============================================================================
-
-int WIPX_CheckNewConnections (void)
-{
-       unsigned long   available;
-
-       if (net_acceptsocket == -1)
-               return -1;
-
-       if (pioctlsocket (ipxsocket[net_acceptsocket], FIONREAD, &available) == -1)
-               Sys_Error ("WIPX: ioctlsocket (FIONREAD) failed\n");
-       if (available)
-               return net_acceptsocket;
-       return -1;
-}
-
-//=============================================================================
-
-int WIPX_Recv (qbyte *buf, int len, struct qsockaddr *addr)
-{
-       return WIPX_Read (net_acceptsocket, buf, len, addr);
-}
-
-//=============================================================================
-
-int WIPX_Send (qbyte *buf, int len, struct qsockaddr *addr)
-{
-       return WIPX_Write (net_acceptsocket, buf, len, addr);
-}
-
-//=============================================================================
-
-static qbyte packetBuffer[NET_DATAGRAMSIZE + 4];
-
-int WIPX_Read (int handle, qbyte *buf, int len, struct qsockaddr *addr)
-{
-       int addrlen = sizeof (struct qsockaddr);
-       int socket = ipxsocket[handle];
-       int ret;
-       int errno;
-
-       ret = precvfrom (socket, packetBuffer, len+4, 0, (struct sockaddr *)addr, &addrlen);
-       if (ret == -1)
-       {
-               errno = pWSAGetLastError();
-
-               if (errno == WSAEWOULDBLOCK || errno == WSAECONNREFUSED)
-                       return 0;
-
-       }
-
-       if (ret < 4)
-               return 0;
-       
-       // remove sequence number, it's only needed for DOS IPX
-       ret -= 4;
-       memcpy(buf, packetBuffer+4, ret);
-
-       return ret;
-}
-
-//=============================================================================
-
-int WIPX_Broadcast (int handle, qbyte *buf, int len)
-{
-       return WIPX_Write (handle, buf, len, &broadcastaddr);
-}
-
-//=============================================================================
-
-int WIPX_Write (int handle, qbyte *buf, int len, struct qsockaddr *addr)
-{
-       int socket = ipxsocket[handle];
-       int ret;
-
-       // build packet with sequence number
-       *(int *)(&packetBuffer[0]) = sequence[handle];
-       sequence[handle]++;
-       memcpy(&packetBuffer[4], buf, len);
-       len += 4;
-
-       ret = psendto (socket, packetBuffer, len, 0, (struct sockaddr *)addr, sizeof(struct qsockaddr));
-       if (ret == -1)
-               if (pWSAGetLastError() == WSAEWOULDBLOCK)
-                       return 0;
-
-       return ret;
-}
-
-//=============================================================================
-
-char *WIPX_AddrToString (const struct qsockaddr *addr)
-{
-       static char buf[28];
-
-       sprintf(buf, "%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x:%u",
-               ((struct sockaddr_ipx *)addr)->sa_netnum[0] & 0xff,
-               ((struct sockaddr_ipx *)addr)->sa_netnum[1] & 0xff,
-               ((struct sockaddr_ipx *)addr)->sa_netnum[2] & 0xff,
-               ((struct sockaddr_ipx *)addr)->sa_netnum[3] & 0xff,
-               ((struct sockaddr_ipx *)addr)->sa_nodenum[0] & 0xff,
-               ((struct sockaddr_ipx *)addr)->sa_nodenum[1] & 0xff,
-               ((struct sockaddr_ipx *)addr)->sa_nodenum[2] & 0xff,
-               ((struct sockaddr_ipx *)addr)->sa_nodenum[3] & 0xff,
-               ((struct sockaddr_ipx *)addr)->sa_nodenum[4] & 0xff,
-               ((struct sockaddr_ipx *)addr)->sa_nodenum[5] & 0xff,
-               ntohs(((struct sockaddr_ipx *)addr)->sa_socket)
-               );
-       return buf;
-}
-
-//=============================================================================
-
-int WIPX_StringToAddr (const char *string, struct qsockaddr *addr)
-{
-       int  val;
-       char buf[3];
-
-       buf[2] = 0;
-       memset(addr, 0, sizeof(struct qsockaddr));
-       addr->sa_family = AF_IPX;
-
-#define DO(src,dest)   \
-       buf[0] = string[src];   \
-       buf[1] = string[src + 1];       \
-       if (sscanf (buf, "%x", &val) != 1)      \
-               return -1;      \
-       ((struct sockaddr_ipx *)addr)->dest = val
-
-       DO(0, sa_netnum[0]);
-       DO(2, sa_netnum[1]);
-       DO(4, sa_netnum[2]);
-       DO(6, sa_netnum[3]);
-       DO(9, sa_nodenum[0]);
-       DO(11, sa_nodenum[1]);
-       DO(13, sa_nodenum[2]);
-       DO(15, sa_nodenum[3]);
-       DO(17, sa_nodenum[4]);
-       DO(19, sa_nodenum[5]);
-#undef DO
-
-       sscanf (&string[22], "%u", &val);
-       ((struct sockaddr_ipx *)addr)->sa_socket = htons((unsigned short)val);
-
-       return 0;
-}
-
-//=============================================================================
-
-int WIPX_GetSocketAddr (int handle, struct qsockaddr *addr)
-{
-       int errno;
-       int socket = ipxsocket[handle];
-       int addrlen = sizeof(struct qsockaddr);
-
-       memset(addr, 0, sizeof(struct qsockaddr));
-       if(pgetsockname(socket, (struct sockaddr *)addr, &addrlen) != 0)
-       {
-               errno = pWSAGetLastError();
-       }
-
-       return 0;
-}
-
-//=============================================================================
-
-int WIPX_GetNameFromAddr (const struct qsockaddr *addr, char *name)
-{
-       strcpy(name, WIPX_AddrToString(addr));
-       return 0;
-}
-
-//=============================================================================
-
-int WIPX_GetAddrFromName(const char *name, struct qsockaddr *addr)
-{
-       int n;
-       char buf[32];
-
-       n = strlen(name);
-
-       if (n == 12)
-       {
-               sprintf(buf, "00000000:%s:%u", name, net_hostport);
-               return WIPX_StringToAddr (buf, addr);
-       }
-       if (n == 21)
-       {
-               sprintf(buf, "%s:%u", name, net_hostport);
-               return WIPX_StringToAddr (buf, addr);
-       }
-       if (n > 21 && n <= 27)
-               return WIPX_StringToAddr (name, addr);
-
-       return -1;
-}
-
-//=============================================================================
-
-int WIPX_AddrCompare (const struct qsockaddr *addr1, const struct qsockaddr *addr2)
-{
-       if (addr1->sa_family != addr2->sa_family)
-               return -1;
-
-       if (*((struct sockaddr_ipx *)addr1)->sa_netnum && *((struct sockaddr_ipx *)addr2)->sa_netnum)
-               if (memcmp(((struct sockaddr_ipx *)addr1)->sa_netnum, ((struct sockaddr_ipx *)addr2)->sa_netnum, 4) != 0)
-                       return -1;
-       if (memcmp(((struct sockaddr_ipx *)addr1)->sa_nodenum, ((struct sockaddr_ipx *)addr2)->sa_nodenum, 6) != 0)
-               return -1;
-
-       if (((struct sockaddr_ipx *)addr1)->sa_socket != ((struct sockaddr_ipx *)addr2)->sa_socket)
-               return 1;
-
-       return 0;
-}
-
-//=============================================================================
-
-int WIPX_GetSocketPort (struct qsockaddr *addr)
-{
-       return ntohs(((struct sockaddr_ipx *)addr)->sa_socket);
-}
-
-
-int WIPX_SetSocketPort (struct qsockaddr *addr, int port)
-{
-       ((struct sockaddr_ipx *)addr)->sa_socket = htons((unsigned short)port);
-       return 0;
-}
-
diff --git a/net_wipx.h b/net_wipx.h
deleted file mode 100644 (file)
index 82bb49b..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// net_wipx.h
-
-#ifndef NET_WIPX_H
-#define NET_WIPX_H
-
-int  WIPX_Init (void);
-void WIPX_Shutdown (void);
-void WIPX_Listen (qboolean state);
-int  WIPX_OpenSocket (int port);
-int  WIPX_CloseSocket (int socket);
-int  WIPX_Connect (int socket, struct qsockaddr *addr);
-int  WIPX_CheckNewConnections (void);
-int  WIPX_Recv (qbyte *buf, int len, struct qsockaddr *addr);
-int  WIPX_Send (qbyte *buf, int len, struct qsockaddr *addr);
-int  WIPX_Read (int socket, qbyte *buf, int len, struct qsockaddr *addr);
-int  WIPX_Write (int socket, qbyte *buf, int len, struct qsockaddr *addr);
-int  WIPX_Broadcast (int socket, qbyte *buf, int len);
-char *WIPX_AddrToString (const struct qsockaddr *addr);
-int  WIPX_StringToAddr (const char *string, struct qsockaddr *addr);
-int  WIPX_GetSocketAddr (int socket, struct qsockaddr *addr);
-int  WIPX_GetNameFromAddr (const struct qsockaddr *addr, char *name);
-int  WIPX_GetAddrFromName (const char *name, struct qsockaddr *addr);
-int  WIPX_AddrCompare (const struct qsockaddr *addr1, const struct qsockaddr *addr2);
-int  WIPX_GetSocketPort (struct qsockaddr *addr);
-int  WIPX_SetSocketPort (struct qsockaddr *addr, int port);
-
-#endif
-