summaryrefslogtreecommitdiff
path: root/src/qcommon/net_chan.c
diff options
context:
space:
mode:
author/dev/humancontroller <devhc@example.com>2015-02-08 13:55:15 +0100
committer/dev/humancontroller <devhc@example.com>2017-03-09 13:51:18 +0100
commitb392b0d97f3ea048478059873ed6dec8afd9634b (patch)
treee3fb4a9ef70d89bfb70676fe33f9b493da7051ec /src/qcommon/net_chan.c
parent65bcf419d4b612b7d626447924fa0fe2079c18c2 (diff)
implement part 1 of the multi-protocol functionality: protocols
this contains support for connecting via, and serving simultaneously via, any of the three protocols: latest, GPP and 1.1 alternate-1 means protocol 70 (GPP), alternate-2 means protocol 69 (1.1) relevant cvars: - net_alternateProtocols - net_alt{1|2}port[6] - sv_alt{1|2}master{1|...|5} - sv_clAltProto{0|..|63}
Diffstat (limited to 'src/qcommon/net_chan.c')
-rw-r--r--src/qcommon/net_chan.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/qcommon/net_chan.c b/src/qcommon/net_chan.c
index 58a45b50..422f64fc 100644
--- a/src/qcommon/net_chan.c
+++ b/src/qcommon/net_chan.c
@@ -84,7 +84,7 @@ Netchan_Setup
called to open a channel to a remote system
==============
*/
-void Netchan_Setup(netsrc_t sock, netchan_t *chan, netadr_t adr, int qport, int challenge)
+void Netchan_Setup(int alternateProtocol, netsrc_t sock, netchan_t *chan, netadr_t adr, int qport, int challenge)
{
Com_Memset (chan, 0, sizeof(*chan));
@@ -94,6 +94,7 @@ void Netchan_Setup(netsrc_t sock, netchan_t *chan, netadr_t adr, int qport, int
chan->incomingSequence = 0;
chan->outgoingSequence = 1;
chan->challenge = challenge;
+ chan->alternateProtocol = alternateProtocol;
}
/*
@@ -120,7 +121,8 @@ void Netchan_TransmitNextFragment( netchan_t *chan ) {
MSG_WriteShort( &send, qport->integer );
}
- MSG_WriteLong(&send, NETCHAN_GENCHECKSUM(chan->challenge, chan->outgoingSequence));
+ if ( chan->alternateProtocol == 0 )
+ MSG_WriteLong(&send, NETCHAN_GENCHECKSUM(chan->challenge, chan->outgoingSequence));
// copy the reliable message to the packet first
fragmentLength = FRAGMENT_SIZE;
@@ -198,7 +200,8 @@ void Netchan_Transmit( netchan_t *chan, int length, const byte *data ) {
if(chan->sock == NS_CLIENT)
MSG_WriteShort(&send, qport->integer);
- MSG_WriteLong(&send, NETCHAN_GENCHECKSUM(chan->challenge, chan->outgoingSequence));
+ if ( chan->alternateProtocol == 0 )
+ MSG_WriteLong(&send, NETCHAN_GENCHECKSUM(chan->challenge, chan->outgoingSequence));
chan->outgoingSequence++;
@@ -258,11 +261,14 @@ qboolean Netchan_Process( netchan_t *chan, msg_t *msg ) {
MSG_ReadShort( msg );
}
- checksum = MSG_ReadLong(msg);
+ if ( chan->alternateProtocol == 0 )
+ {
+ checksum = MSG_ReadLong(msg);
- // UDP spoofing protection
- if(NETCHAN_GENCHECKSUM(chan->challenge, sequence) != checksum)
- return qfalse;
+ // UDP spoofing protection
+ if(NETCHAN_GENCHECKSUM(chan->challenge, sequence) != checksum)
+ return qfalse;
+ }
// read the fragment information
if ( fragmented ) {
@@ -656,6 +662,8 @@ int NET_StringToAdr( const char *s, netadr_t *a, netadrtype_t family )
search = base;
}
+ a->alternateProtocol = 0;
+
if(!Sys_StringToAdr(search, a, family))
{
a->type = NA_BAD;