From a957b652bae5d1a5320eb01c349437bc7197b91a Mon Sep 17 00:00:00 2001 From: thilo Date: Fri, 11 Apr 2008 18:39:03 +0000 Subject: - Revamp in-game server browser: you can now scan for games on multiple master servers, while retaining compatibility with old QVMs. - Make Master server reporting/server queries ipv6 capable. git-svn-id: svn://svn.icculus.org/quake3/trunk@1311 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/qcommon/net_chan.c | 31 +++++++++++++++++-------------- code/qcommon/qcommon.h | 2 +- 2 files changed, 18 insertions(+), 15 deletions(-) (limited to 'code/qcommon') diff --git a/code/qcommon/net_chan.c b/code/qcommon/net_chan.c index e4b1739..8869c01 100644 --- a/code/qcommon/net_chan.c +++ b/code/qcommon/net_chan.c @@ -673,17 +673,19 @@ void QDECL NET_OutOfBandData( netsrc_t sock, netadr_t adr, byte *format, int len NET_StringToAdr Traps "localhost" for loopback, passes everything else to system +return 0 on address not found, 1 on address found with port, 2 on address found without port. ============= */ -qboolean NET_StringToAdr( const char *s, netadr_t *a, netadrtype_t family ) { - qboolean r; +int NET_StringToAdr( const char *s, netadr_t *a, netadrtype_t family ) +{ char base[MAX_STRING_CHARS], *search; char *port = NULL; if (!strcmp (s, "localhost")) { Com_Memset (a, 0, sizeof(*a)); a->type = NA_LOOPBACK; - return qtrue; +// as NA_LOOPBACK doesn't require ports report port was given. + return 1; } Q_strncpyz( base, s, sizeof( base ) ); @@ -719,19 +721,20 @@ qboolean NET_StringToAdr( const char *s, netadr_t *a, netadrtype_t family ) { search = base; } - r = Sys_StringToAdr( search, a, family ); - - if ( !r ) { + if(!Sys_StringToAdr(search, a, family)) + { a->type = NA_BAD; - return qfalse; + return 0; } - if ( port ) { - a->port = BigShort( (short)atoi( port ) ); - } else { - a->port = BigShort( PORT_SERVER ); + if(port) + { + a->port = BigShort((short) atoi(port)); + return 1; + } + else + { + a->port = BigShort(PORT_SERVER); + return 2; } - - return qtrue; } - diff --git a/code/qcommon/qcommon.h b/code/qcommon/qcommon.h index 0fe6a47..8746f3b 100644 --- a/code/qcommon/qcommon.h +++ b/code/qcommon/qcommon.h @@ -171,7 +171,7 @@ qboolean NET_CompareBaseAdr (netadr_t a, netadr_t b); qboolean NET_IsLocalAddress (netadr_t adr); const char *NET_AdrToString (netadr_t a); const char *NET_AdrToStringwPort (netadr_t a); -qboolean NET_StringToAdr ( const char *s, netadr_t *a, netadrtype_t family); +int NET_StringToAdr ( const char *s, netadr_t *a, netadrtype_t family); qboolean NET_GetLoopPacket (netsrc_t sock, netadr_t *net_from, msg_t *net_message); void NET_JoinMulticast6(void); void NET_LeaveMulticast6(void); -- cgit v1.2.3