Permalink
Browse files

Remove the old-style out of band network functions

  • Loading branch information...
mbasaglia committed Feb 17, 2016
1 parent 00c9701 commit de44b1d09e2c85d3ddc4900a45a29e9891a8c763
@@ -1233,7 +1233,7 @@ void CL_RequestMotd()
Info_SetValueForKey( info, "challenge", cls.updateChallenge, false );
Info_SetValueForKey( info, "version", com_version->string, false );
NET_OutOfBandPrint( netsrc_t::NS_CLIENT, cls.updateServer, "getmotd%s", info );
Net::OutOfBandPrint( netsrc_t::NS_CLIENT, cls.updateServer, "getmotd%s", info );
}
/*
@@ -2757,7 +2757,7 @@ void CL_ConnectionlessPacket( netadr_t from, msg_t *msg )
// echo request from server
if ( args.Argv(0) == "echo" && args.Argc() >= 2)
{
NET_OutOfBandPrint( netsrc_t::NS_CLIENT, from, "%s", args.Argv(1).c_str() );
Net::OutOfBandPrint( netsrc_t::NS_CLIENT, from, "%s", args.Argv(1) );
return;
}
@@ -3924,7 +3924,7 @@ int CL_ServerStatus( const char *serverAddress, char *serverStatusString, int ma
serverStatus->retrieved = false;
serverStatus->time = 0;
serverStatus->startTime = Sys_Milliseconds();
NET_OutOfBandPrint( netsrc_t::NS_CLIENT, to, "getstatus" );
Net::OutOfBandPrint( netsrc_t::NS_CLIENT, to, "getstatus" );
return false;
}
}
@@ -3937,7 +3937,7 @@ int CL_ServerStatus( const char *serverAddress, char *serverStatusString, int ma
serverStatus->retrieved = false;
serverStatus->startTime = Sys_Milliseconds();
serverStatus->time = 0;
NET_OutOfBandPrint( netsrc_t::NS_CLIENT, to, "getstatus" );
Net::OutOfBandPrint( netsrc_t::NS_CLIENT, to, "getstatus" );
return false;
}
@@ -4188,7 +4188,7 @@ void CL_GlobalServers_f()
Q_strcat( command, sizeof( command ), Cmd_Argv( i ) );
}
NET_OutOfBandPrint( netsrc_t::NS_SERVER, to, "%s", command );
Net::OutOfBandPrint( netsrc_t::NS_SERVER, to, "%s", command );
CL_RequestMotd();
}
@@ -4397,7 +4397,7 @@ void CL_Ping_f()
CL_SetServerInfoByAddress( pingptr->adr, nullptr, 0 );
NET_OutOfBandPrint( netsrc_t::NS_CLIENT, to, "getinfo xxx" );
Net::OutOfBandPrint( netsrc_t::NS_CLIENT, to, "getinfo xxx" );
}
/*
@@ -4486,7 +4486,7 @@ bool CL_UpdateVisiblePings_f( int source )
memcpy( &cl_pinglist[ j ].adr, &server[ i ].adr, sizeof( netadr_t ) );
cl_pinglist[ j ].start = Sys_Milliseconds();
cl_pinglist[ j ].time = 0;
NET_OutOfBandPrint( netsrc_t::NS_CLIENT, cl_pinglist[ j ].adr, "getinfo xxx" );
Net::OutOfBandPrint( netsrc_t::NS_CLIENT, cl_pinglist[ j ].adr, "getinfo xxx" );
slots++;
break;
}
@@ -4599,7 +4599,7 @@ void CL_ServerStatus_f()
}
}
NET_OutOfBandPrint( netsrc_t::NS_CLIENT, *toptr, "getstatus" );
Net::OutOfBandPrint( netsrc_t::NS_CLIENT, *toptr, "getstatus" );
serverStatus = CL_GetServerStatus( *toptr );
serverStatus->address = *toptr;
@@ -606,65 +606,6 @@ void NET_SendPacket( netsrc_t sock, int length, const void *data, netadr_t to )
}
}
static INLINE void NET_SetOOBHeader( char *s )
{
byte i;
for ( i = 0; i < 4; ++i )
{
s[ i ] = -1;
}
}
/*
===============
NET_OutOfBandPrint
Sends a text message in an out-of-band datagram
================
*/
void QDECL PRINTF_LIKE(3) NET_OutOfBandPrint( netsrc_t sock, netadr_t adr, const char *format, ... )
{
va_list argptr;
char string[ MAX_MSGLEN ];
NET_SetOOBHeader( string );
va_start( argptr, format );
Q_vsnprintf( string + 4, sizeof( string ) - 4, format, argptr );
va_end( argptr );
// send the datagram
NET_SendPacket( sock, strlen( string ), string, adr );
}
/*
===============
NET_OutOfBandData
Sends a data message in an out-of-band datagram (only used for "connect")
================
*/
void QDECL NET_OutOfBandData( netsrc_t sock, netadr_t adr, byte *format, int len )
{
byte string[ MAX_MSGLEN * 2 ];
int i;
msg_t mbuf;
NET_SetOOBHeader( ( char * ) string );
for ( i = 0; i < len; i++ )
{
string[ i + 4 ] = format[ i ];
}
mbuf.data = string;
mbuf.cursize = len + 4;
Huff_Compress( &mbuf, 12 );
// send the datagram
NET_SendPacket( sock, mbuf.cursize, mbuf.data, adr );
}
/*
=============
NET_StringToAdr
@@ -200,10 +200,6 @@ void NET_Restart_f();
void NET_Config( bool enableNetworking );
void NET_SendPacket( netsrc_t sock, int length, const void *data, netadr_t to );
// DEPRECATED: use Net::OutOfBandPrint
void QDECL NET_OutOfBandPrint( netsrc_t net_socket, netadr_t adr, const char *format, ... ) PRINTF_LIKE(3);
// DEPRECATED: use Net::OutOfBandData
void QDECL NET_OutOfBandData( netsrc_t sock, netadr_t adr, byte *format, int len );
bool NET_CompareAdr( netadr_t a, netadr_t b );
bool NET_CompareBaseAdr( netadr_t a, netadr_t b );
@@ -48,7 +48,7 @@ void SV_GetChallenge( netadr_t from )
}
auto challenge = ChallengeManager::Get().GenerateChallenge( from );
Net::OutOfBandPrint( netsrc_t::NS_SERVER, from, "challengeResponse %s\n", challenge.c_str() );
Net::OutOfBandPrint( netsrc_t::NS_SERVER, from, "challengeResponse %s\n", challenge );
}
/*
@@ -75,7 +75,7 @@ void SV_DirectConnect( netadr_t from, const Cmd::Args& args )
if ( version != PROTOCOL_VERSION )
{
NET_OutOfBandPrint( netsrc_t::NS_SERVER, from, "print\nServer uses protocol version %i (yours is %i).", PROTOCOL_VERSION, version );
Net::OutOfBandPrint( netsrc_t::NS_SERVER, from, "print\nServer uses protocol version %i (yours is %i).", PROTOCOL_VERSION, version );
Log::Debug( " rejected connect from version %i", version );
return;
}
@@ -173,7 +173,7 @@ void SV_DirectConnect( netadr_t from, const Cmd::Args& args )
}
else
{
NET_OutOfBandPrint( netsrc_t::NS_SERVER, from, "print\n%s", sv_fullmsg->string );
Net::OutOfBandPrint( netsrc_t::NS_SERVER, from, "print\n%s", sv_fullmsg->string );
Log::Debug( "Rejected a connection." );
return;
}
@@ -220,15 +220,15 @@ void SV_DirectConnect( netadr_t from, const Cmd::Args& args )
char reason[ MAX_STRING_CHARS ];
if ( gvm.GameClientConnect( reason, sizeof( reason ), clientNum, true, false ) )
{
NET_OutOfBandPrint( netsrc_t::NS_SERVER, from, "print\n[err_dialog]%s", reason );
Net::OutOfBandPrint( netsrc_t::NS_SERVER, from, "print\n[err_dialog]%s", reason );
Log::Debug( "Game rejected a connection: %s.", reason );
return;
}
SV_UserinfoChanged( new_client );
// send the connect packet to the client
NET_OutOfBandPrint( netsrc_t::NS_SERVER, from, "connectResponse" );
Net::OutOfBandPrint( netsrc_t::NS_SERVER, from, "connectResponse" );
Log::Debug( "Going from CS_FREE to CS_CONNECTED for %s", new_client->name );
@@ -412,12 +412,12 @@ void SV_MasterHeartbeat( const char *hbname )
if ( masterServerAddr[ i ].ipv4.type != netadrtype_t::NA_BAD )
{
NET_OutOfBandPrint( netsrc_t::NS_SERVER, masterServerAddr[ i ].ipv4, "heartbeat %s\n", hbname );
Net::OutOfBandPrint( netsrc_t::NS_SERVER, masterServerAddr[ i ].ipv4, "heartbeat %s\n", hbname );
}
if ( masterServerAddr[ i ].ipv6.type != netadrtype_t::NA_BAD )
{
NET_OutOfBandPrint( netsrc_t::NS_SERVER, masterServerAddr[ i ].ipv6, "heartbeat %s\n", hbname );
Net::OutOfBandPrint( netsrc_t::NS_SERVER, masterServerAddr[ i ].ipv6, "heartbeat %s\n", hbname );
}
}
}
@@ -476,7 +476,7 @@ void SV_MasterGameStat( const char *data )
NET_AdrToStringwPort( adr ) );
Log::Notice( "Sending gamestat to %s", MASTER_SERVER_NAME );
NET_OutOfBandPrint( netsrc_t::NS_SERVER, adr, "gamestat %s", data );
Net::OutOfBandPrint( netsrc_t::NS_SERVER, adr, "gamestat %s", data );
}
/*
@@ -1031,7 +1031,7 @@ void SV_PacketEvent( netadr_t from, msg_t *msg )
// if we received a sequenced packet from an address we don't recognize,
// send an out of band disconnect packet to it
NET_OutOfBandPrint( netsrc_t::NS_SERVER, from, "disconnect" );
Net::OutOfBandPrint( netsrc_t::NS_SERVER, from, "disconnect" );
}
/*

0 comments on commit de44b1d

Please sign in to comment.