net_bsd.c, net_dgrm.h, net_loop.c, net_loop.h, net_sdl.c, net_win.c: more trivialities.

git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@217 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
sezero 2010-06-21 12:20:25 +00:00
parent 63c98a9576
commit c8bdc511d8
6 changed files with 190 additions and 189 deletions

View file

@ -23,43 +23,43 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h" #include "quakedef.h"
#include "net_defs.h" #include "net_defs.h"
#include "net_loop.h"
#include "net_dgrm.h" #include "net_dgrm.h"
#include "net_loop.h"
net_driver_t net_drivers[MAX_NET_DRIVERS] = net_driver_t net_drivers[MAX_NET_DRIVERS] =
{ {
{ {
"Loopback", "Loopback",
false, false,
Loop_Init, Loop_Init,
Loop_Listen, Loop_Listen,
Loop_SearchForHosts, Loop_SearchForHosts,
Loop_Connect, Loop_Connect,
Loop_CheckNewConnections, Loop_CheckNewConnections,
Loop_GetMessage, Loop_GetMessage,
Loop_SendMessage, Loop_SendMessage,
Loop_SendUnreliableMessage, Loop_SendUnreliableMessage,
Loop_CanSendMessage, Loop_CanSendMessage,
Loop_CanSendUnreliableMessage, Loop_CanSendUnreliableMessage,
Loop_Close, Loop_Close,
Loop_Shutdown Loop_Shutdown
} },
,
{ {
"Datagram", "Datagram",
false, false,
Datagram_Init, Datagram_Init,
Datagram_Listen, Datagram_Listen,
Datagram_SearchForHosts, Datagram_SearchForHosts,
Datagram_Connect, Datagram_Connect,
Datagram_CheckNewConnections, Datagram_CheckNewConnections,
Datagram_GetMessage, Datagram_GetMessage,
Datagram_SendMessage, Datagram_SendMessage,
Datagram_SendUnreliableMessage, Datagram_SendUnreliableMessage,
Datagram_CanSendMessage, Datagram_CanSendMessage,
Datagram_CanSendUnreliableMessage, Datagram_CanSendUnreliableMessage,
Datagram_Close, Datagram_Close,
Datagram_Shutdown Datagram_Shutdown
} }
}; };
@ -70,27 +70,27 @@ int net_numdrivers = 2;
net_landriver_t net_landrivers[MAX_NET_DRIVERS] = net_landriver_t net_landrivers[MAX_NET_DRIVERS] =
{ {
{ {
"UDP", "UDP",
false, false,
0, 0,
UDP_Init, UDP_Init,
UDP_Shutdown, UDP_Shutdown,
UDP_Listen, UDP_Listen,
UDP_OpenSocket, UDP_OpenSocket,
UDP_CloseSocket, UDP_CloseSocket,
UDP_Connect, UDP_Connect,
UDP_CheckNewConnections, UDP_CheckNewConnections,
UDP_Read, UDP_Read,
UDP_Write, UDP_Write,
UDP_Broadcast, UDP_Broadcast,
UDP_AddrToString, UDP_AddrToString,
UDP_StringToAddr, UDP_StringToAddr,
UDP_GetSocketAddr, UDP_GetSocketAddr,
UDP_GetNameFromAddr, UDP_GetNameFromAddr,
UDP_GetAddrFromName, UDP_GetAddrFromName,
UDP_AddrCompare, UDP_AddrCompare,
UDP_GetSocketPort, UDP_GetSocketPort,
UDP_SetSocketPort UDP_SetSocketPort
} }
}; };

View file

@ -24,12 +24,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// net_dgrm.h // net_dgrm.h
int Datagram_Init (void); int Datagram_Init (void);
void Datagram_Listen (qboolean state); void Datagram_Listen (qboolean state);
void Datagram_SearchForHosts (qboolean xmit); void Datagram_SearchForHosts (qboolean xmit);
qsocket_t *Datagram_Connect (char *host); qsocket_t *Datagram_Connect (char *host);
qsocket_t *Datagram_CheckNewConnections (void); qsocket_t *Datagram_CheckNewConnections (void);
int Datagram_GetMessage (qsocket_t *sock); int Datagram_GetMessage (qsocket_t *sock);
int Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data); int Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data);
int Datagram_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data); int Datagram_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data);

View file

@ -18,6 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
// net_loop.c // net_loop.c
#include "arch_def.h" #include "arch_def.h"
@ -26,9 +27,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "net_defs.h" #include "net_defs.h"
#include "net_loop.h" #include "net_loop.h"
qboolean localconnectpending = false; static qboolean localconnectpending = false;
qsocket_t *loop_client = NULL; static qsocket_t *loop_client = NULL;
qsocket_t *loop_server = NULL; static qsocket_t *loop_server = NULL;
int Loop_Init (void) int Loop_Init (void)
{ {
@ -146,7 +147,7 @@ int Loop_GetMessage (qsocket_t *sock)
sock->receiveMessageLength -= length; sock->receiveMessageLength -= length;
if (sock->receiveMessageLength) if (sock->receiveMessageLength)
memmove(sock->receiveMessage, &sock->receiveMessage[length], sock->receiveMessageLength); memmove (sock->receiveMessage, &sock->receiveMessage[length], sock->receiveMessageLength);
if (sock->driverdata && ret == 1) if (sock->driverdata && ret == 1)
((qsocket_t *)sock->driverdata)->canSend = true; ((qsocket_t *)sock->driverdata)->canSend = true;
@ -166,7 +167,7 @@ int Loop_SendMessage (qsocket_t *sock, sizebuf_t *data)
bufferLength = &((qsocket_t *)sock->driverdata)->receiveMessageLength; bufferLength = &((qsocket_t *)sock->driverdata)->receiveMessageLength;
if ((*bufferLength + data->cursize + 4) > NET_MAXMESSAGE) if ((*bufferLength + data->cursize + 4) > NET_MAXMESSAGE)
Sys_Error("Loop_SendMessage: overflow\n"); Sys_Error("Loop_SendMessage: overflow");
buffer = ((qsocket_t *)sock->driverdata)->receiveMessage + *bufferLength; buffer = ((qsocket_t *)sock->driverdata)->receiveMessage + *bufferLength;
@ -247,3 +248,4 @@ void Loop_Close (qsocket_t *sock)
else else
loop_server = NULL; loop_server = NULL;
} }

View file

@ -27,8 +27,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int Loop_Init (void); int Loop_Init (void);
void Loop_Listen (qboolean state); void Loop_Listen (qboolean state);
void Loop_SearchForHosts (qboolean xmit); void Loop_SearchForHosts (qboolean xmit);
qsocket_t *Loop_Connect (char *host); qsocket_t *Loop_Connect (char *host);
qsocket_t *Loop_CheckNewConnections (void); qsocket_t *Loop_CheckNewConnections (void);
int Loop_GetMessage (qsocket_t *sock); int Loop_GetMessage (qsocket_t *sock);
int Loop_SendMessage (qsocket_t *sock, sizebuf_t *data); int Loop_SendMessage (qsocket_t *sock, sizebuf_t *data);
int Loop_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data); int Loop_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data);

View file

@ -25,74 +25,74 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h" #include "quakedef.h"
#include "net_defs.h" #include "net_defs.h"
#include "net_loop.h"
#include "net_dgrm.h" #include "net_dgrm.h"
#include "net_sdlnet.h" #include "net_loop.h"
net_driver_t net_drivers[MAX_NET_DRIVERS] = net_driver_t net_drivers[MAX_NET_DRIVERS] =
{ {
{ {
"Loopback", "Loopback",
false, false,
Loop_Init, Loop_Init,
Loop_Listen, Loop_Listen,
Loop_SearchForHosts, Loop_SearchForHosts,
Loop_Connect, Loop_Connect,
Loop_CheckNewConnections, Loop_CheckNewConnections,
Loop_GetMessage, Loop_GetMessage,
Loop_SendMessage, Loop_SendMessage,
Loop_SendUnreliableMessage, Loop_SendUnreliableMessage,
Loop_CanSendMessage, Loop_CanSendMessage,
Loop_CanSendUnreliableMessage, Loop_CanSendUnreliableMessage,
Loop_Close, Loop_Close,
Loop_Shutdown Loop_Shutdown
} },
,
{ {
"Datagram", "Datagram",
false, false,
Datagram_Init, Datagram_Init,
Datagram_Listen, Datagram_Listen,
Datagram_SearchForHosts, Datagram_SearchForHosts,
Datagram_Connect, Datagram_Connect,
Datagram_CheckNewConnections, Datagram_CheckNewConnections,
Datagram_GetMessage, Datagram_GetMessage,
Datagram_SendMessage, Datagram_SendMessage,
Datagram_SendUnreliableMessage, Datagram_SendUnreliableMessage,
Datagram_CanSendMessage, Datagram_CanSendMessage,
Datagram_CanSendUnreliableMessage, Datagram_CanSendUnreliableMessage,
Datagram_Close, Datagram_Close,
Datagram_Shutdown Datagram_Shutdown
} }
}; };
int net_numdrivers = 2; int net_numdrivers = 2;
#include "net_sdlnet.h"
net_landriver_t net_landrivers[MAX_NET_DRIVERS] = net_landriver_t net_landrivers[MAX_NET_DRIVERS] =
{ {
{ {
"UDP", "UDP",
false, false,
0, 0,
SDLN_Init, SDLN_Init,
SDLN_Shutdown, SDLN_Shutdown,
SDLN_Listen, SDLN_Listen,
SDLN_OpenSocket, SDLN_OpenSocket,
SDLN_CloseSocket, SDLN_CloseSocket,
SDLN_Connect, SDLN_Connect,
SDLN_CheckNewConnections, SDLN_CheckNewConnections,
SDLN_Read, SDLN_Read,
SDLN_Write, SDLN_Write,
SDLN_Broadcast, SDLN_Broadcast,
SDLN_AddrToString, SDLN_AddrToString,
SDLN_StringToAddr, SDLN_StringToAddr,
SDLN_GetSocketAddr, SDLN_GetSocketAddr,
SDLN_GetNameFromAddr, SDLN_GetNameFromAddr,
SDLN_GetAddrFromName, SDLN_GetAddrFromName,
SDLN_AddrCompare, SDLN_AddrCompare,
SDLN_GetSocketPort, SDLN_GetSocketPort,
SDLN_SetSocketPort SDLN_SetSocketPort
} }
}; };

View file

@ -24,43 +24,43 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h" #include "quakedef.h"
#include "net_defs.h" #include "net_defs.h"
#include "net_loop.h"
#include "net_dgrm.h" #include "net_dgrm.h"
#include "net_loop.h"
net_driver_t net_drivers[MAX_NET_DRIVERS] = net_driver_t net_drivers[MAX_NET_DRIVERS] =
{ {
{ {
"Loopback", "Loopback",
false, false,
Loop_Init, Loop_Init,
Loop_Listen, Loop_Listen,
Loop_SearchForHosts, Loop_SearchForHosts,
Loop_Connect, Loop_Connect,
Loop_CheckNewConnections, Loop_CheckNewConnections,
Loop_GetMessage, Loop_GetMessage,
Loop_SendMessage, Loop_SendMessage,
Loop_SendUnreliableMessage, Loop_SendUnreliableMessage,
Loop_CanSendMessage, Loop_CanSendMessage,
Loop_CanSendUnreliableMessage, Loop_CanSendUnreliableMessage,
Loop_Close, Loop_Close,
Loop_Shutdown Loop_Shutdown
} },
,
{ {
"Datagram", "Datagram",
false, false,
Datagram_Init, Datagram_Init,
Datagram_Listen, Datagram_Listen,
Datagram_SearchForHosts, Datagram_SearchForHosts,
Datagram_Connect, Datagram_Connect,
Datagram_CheckNewConnections, Datagram_CheckNewConnections,
Datagram_GetMessage, Datagram_GetMessage,
Datagram_SendMessage, Datagram_SendMessage,
Datagram_SendUnreliableMessage, Datagram_SendUnreliableMessage,
Datagram_CanSendMessage, Datagram_CanSendMessage,
Datagram_CanSendUnreliableMessage, Datagram_CanSendUnreliableMessage,
Datagram_Close, Datagram_Close,
Datagram_Shutdown Datagram_Shutdown
} }
}; };
@ -73,52 +73,52 @@ int net_numdrivers = 2;
net_landriver_t net_landrivers[MAX_NET_DRIVERS] = net_landriver_t net_landrivers[MAX_NET_DRIVERS] =
{ {
{ {
"Winsock TCPIP", "Winsock TCPIP",
false, false,
0, 0,
WINS_Init, WINS_Init,
WINS_Shutdown, WINS_Shutdown,
WINS_Listen, WINS_Listen,
WINS_OpenSocket, WINS_OpenSocket,
WINS_CloseSocket, WINS_CloseSocket,
WINS_Connect, WINS_Connect,
WINS_CheckNewConnections, WINS_CheckNewConnections,
WINS_Read, WINS_Read,
WINS_Write, WINS_Write,
WINS_Broadcast, WINS_Broadcast,
WINS_AddrToString, WINS_AddrToString,
WINS_StringToAddr, WINS_StringToAddr,
WINS_GetSocketAddr, WINS_GetSocketAddr,
WINS_GetNameFromAddr, WINS_GetNameFromAddr,
WINS_GetAddrFromName, WINS_GetAddrFromName,
WINS_AddrCompare, WINS_AddrCompare,
WINS_GetSocketPort, WINS_GetSocketPort,
WINS_SetSocketPort WINS_SetSocketPort
}, },
{
"Winsock IPX",
false,
0,
WIPX_Init,
WIPX_Shutdown,
WIPX_Listen,
WIPX_OpenSocket,
WIPX_CloseSocket,
WIPX_Connect,
WIPX_CheckNewConnections,
WIPX_Read,
WIPX_Write,
WIPX_Broadcast,
WIPX_AddrToString,
WIPX_StringToAddr,
WIPX_GetSocketAddr,
WIPX_GetNameFromAddr,
WIPX_GetAddrFromName,
WIPX_AddrCompare,
WIPX_GetSocketPort,
WIPX_SetSocketPort
}
{
"Winsock IPX",
false,
0,
WIPX_Init,
WIPX_Shutdown,
WIPX_Listen,
WIPX_OpenSocket,
WIPX_CloseSocket,
WIPX_Connect,
WIPX_CheckNewConnections,
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 = 2;