2017-12-11 02:55:06 +00:00
enum masterprotocol_e
{
MP_UNSPECIFIED ,
MP_QUAKEWORLD ,
# if defined(Q2CLIENT) || defined(Q2SERVER)
MP_QUAKE2 ,
# endif
# if defined(Q3CLIENT) || defined(Q3SERVER)
MP_QUAKE3 ,
# endif
# ifdef NQPROT
MP_NETQUAKE ,
# endif
MP_DPMASTER
} ;
2004-08-23 00:15:46 +00:00
2017-12-11 02:55:06 +00:00
# if defined(CL_MASTER) && !defined(SERVERONLY)
2014-12-23 15:26:42 +00:00
# define SS_PROTOCOLMASK 0xf
# define SS_UNKNOWN 0
# define SS_QUAKEWORLD 1
# define SS_NETQUAKE 2
# define SS_DARKPLACES 3
# define SS_QUAKE2 4
# define SS_QUAKE3 5
//#define SS_UNUSED 6
//#define SS_UNUSED 7
# define SS_LOCAL (1<<3u) //local servers are ones we detected without being listed on a master server (masters will report public ips, so these may appear as dupes if they're also public)
# define SS_FTESERVER (1<<4u) //hehehe...
# define SS_FAVORITE (1<<5u) //filter all others.
# define SS_KEEPINFO (1<<6u)
# define SS_PROXY (1<<7u)
2004-08-23 00:15:46 +00:00
//despite not supporting nq or q2, we still load them. We just filter them. This is to make sure we properly write the listing files.
2013-10-29 17:38:22 +00:00
enum mastertype_e
{
2005-05-17 02:36:54 +00:00
MT_BAD , //this would be an error
2013-10-29 17:38:22 +00:00
MT_MASTERHTTPJSON ,
MT_MASTERHTTP ,
MT_MASTERUDP ,
MT_BCAST ,
MT_SINGLE ,
} ;
2004-08-23 00:15:46 +00:00
2013-10-29 17:38:22 +00:00
typedef enum
{
2005-05-13 10:42:48 +00:00
SLKEY_PING ,
SLKEY_MAP ,
SLKEY_NAME ,
SLKEY_ADDRESS ,
SLKEY_NUMPLAYERS ,
SLKEY_MAXPLAYERS ,
SLKEY_GAMEDIR ,
2006-02-28 00:46:04 +00:00
SLKEY_FREEPLAYERS ,
SLKEY_BASEGAME ,
2014-12-23 15:26:42 +00:00
SLKEY_FLAGS ,
2006-03-14 01:18:47 +00:00
SLKEY_TIMELIMIT ,
SLKEY_FRAGLIMIT ,
2006-02-28 00:46:04 +00:00
2008-11-09 22:29:28 +00:00
SLKEY_MOD ,
SLKEY_PROTOCOL ,
2015-06-22 11:49:15 +00:00
SLKEY_NUMBOTS , //uninteresting bots that will presumably get kicked if people join.
SLKEY_NUMSPECTATORS , //spectators
SLKEY_NUMHUMANS , //actual players
2008-11-09 22:29:28 +00:00
SLKEY_QCSTATUS ,
// SLKEY_PLAYERS, //eep!
SLKEY_ISFAVORITE , //eep!
2014-12-23 15:26:42 +00:00
SLKEY_ISLOCAL ,
SLKEY_ISPROXY ,
2015-04-27 06:19:33 +00:00
SLKEY_SERVERINFO ,
2008-11-09 22:29:28 +00:00
2005-05-13 10:42:48 +00:00
SLKEY_TOOMANY ,
2015-04-27 06:19:33 +00:00
SLKEY_PLAYER0 ,
SLKEY_CUSTOM = SLKEY_PLAYER0 + MAX_CLIENTS
2005-05-13 10:42:48 +00:00
} hostcachekey_t ;
2013-10-29 17:38:22 +00:00
typedef enum
{
2005-05-13 10:42:48 +00:00
SLIST_TEST_CONTAINS ,
SLIST_TEST_NOTCONTAIN ,
SLIST_TEST_LESSEQUAL ,
SLIST_TEST_LESS ,
SLIST_TEST_EQUAL ,
SLIST_TEST_GREATER ,
SLIST_TEST_GREATEREQUAL ,
2013-03-12 22:35:33 +00:00
SLIST_TEST_NOTEQUAL ,
SLIST_TEST_STARTSWITH ,
SLIST_TEST_NOTSTARTSWITH
2005-05-13 10:42:48 +00:00
} slist_test_t ;
2004-08-23 00:15:46 +00:00
//contains info about a server in greater detail. Could be too mem intensive.
2013-10-29 17:38:22 +00:00
typedef struct serverdetailedinfo_s
{
2004-08-23 00:15:46 +00:00
char info [ MAX_SERVERINFO_STRING ] ;
int numplayers ;
2015-06-22 11:49:15 +00:00
struct serverdetailedplayerinfo_s
2013-10-29 17:38:22 +00:00
{
2004-08-23 00:15:46 +00:00
int userid ;
int frags ;
float time ;
int ping ;
char name [ 64 ] ;
2015-06-22 11:49:15 +00:00
char skin [ 16 ] ; //is this even useful?
2015-06-18 22:11:30 +00:00
char team [ 16 ] ;
2004-08-23 00:15:46 +00:00
char topc ;
2015-06-18 22:11:30 +00:00
char botc ;
2015-06-22 11:49:15 +00:00
qbyte isspec ;
2004-08-23 00:15:46 +00:00
} players [ MAX_CLIENTS ] ;
} serverdetailedinfo_t ;
//hold minimum info.
2013-10-29 17:38:22 +00:00
typedef struct serverinfo_s
{
2004-08-23 00:15:46 +00:00
char name [ 64 ] ; //hostname.
netadr_t adr ;
2015-05-03 19:57:46 +00:00
short special ; //flags
short protocol ;
2015-06-22 11:49:15 +00:00
qbyte players ;
qbyte maxplayers ;
2005-05-13 10:42:48 +00:00
qbyte sends ;
2016-07-12 00:40:13 +00:00
qbyte status ; //1=alive, 2=displayed
2005-05-13 10:42:48 +00:00
2015-06-22 11:49:15 +00:00
qbyte numspectators ;
2008-11-09 22:29:28 +00:00
qbyte numhumans ;
qbyte numbots ;
qbyte freeslots ;
char modname [ 8 + 1 ] ;
char qcstatus [ 8 + 1 ] ;
char gamedir [ 8 + 1 ] ;
char map [ 16 ] ;
unsigned short gameversion ;
2005-05-13 10:42:48 +00:00
unsigned short ping ;
2004-08-23 00:15:46 +00:00
short tl ;
short fl ;
float refreshtime ;
serverdetailedinfo_t * moreinfo ;
2015-07-07 02:03:31 +00:00
struct serverinfo_s * prevpeer ;
unsigned short cost ;
unsigned short numpeers ;
struct peers_s
{
struct serverinfo_s * peer ;
unsigned short ping ;
} * peers ;
2004-08-23 00:15:46 +00:00
struct serverinfo_s * next ;
} serverinfo_t ;
2013-10-29 17:38:22 +00:00
typedef struct master_s
{
2004-08-23 00:15:46 +00:00
struct master_s * next ;
netadr_t adr ;
2012-11-27 03:23:19 +00:00
char * address ; //text based address (http servers)
struct dl_download * dl ;
2014-12-23 15:26:42 +00:00
qbyte nosave ;
2013-10-29 17:38:22 +00:00
qbyte mastertype ;
qbyte protocoltype ;
2011-06-16 02:03:57 +00:00
int sends ; /*needs to resend?*/
2004-08-23 00:15:46 +00:00
char name [ 1 ] ;
} master_t ;
2013-10-29 17:38:22 +00:00
extern struct selectedserver_s
{
2004-08-23 00:15:46 +00:00
qboolean inuse ;
netadr_t adr ;
2015-06-28 03:43:10 +00:00
float refreshtime ;
2016-09-08 19:04:35 +00:00
int lastplayer ;
char lastrule [ 64 ] ;
2004-08-23 00:15:46 +00:00
serverdetailedinfo_t * detail ;
int linenum ;
} selectedserver ;
2013-10-29 17:38:22 +00:00
typedef struct player_s
{
2004-08-23 00:15:46 +00:00
char name [ 16 ] ;
int frags ;
int colour ;
char skin [ 8 ] ;
2015-06-18 22:11:30 +00:00
char team [ 8 ] ;
2004-08-23 00:15:46 +00:00
netadr_t adr ;
struct player_s * next ;
} player_t ;
void SListOptionChanged ( serverinfo_t * newserver ) ;
extern serverinfo_t * firstserver ;
extern master_t * master ;
extern player_t * mplayers ;
2017-12-09 21:22:46 +00:00
extern qboolean sb_favouriteschanged ;
2004-08-23 00:15:46 +00:00
2006-02-11 14:51:36 +00:00
void Master_SetupSockets ( void ) ;
2015-06-18 22:11:30 +00:00
qboolean CL_QueryServers ( void ) ;
2012-04-09 19:12:12 +00:00
int Master_CheckPollSockets ( void ) ;
2012-11-27 03:23:19 +00:00
void MasterInfo_Shutdown ( void ) ;
2017-12-09 21:22:46 +00:00
void MasterInfo_WriteServers ( void ) ;
2013-10-29 17:38:22 +00:00
void MasterInfo_Request ( master_t * mast ) ;
2013-05-03 04:28:08 +00:00
serverinfo_t * Master_InfoForServer ( netadr_t * addr ) ;
2004-08-23 00:15:46 +00:00
serverinfo_t * Master_InfoForNum ( int num ) ;
2011-06-16 02:03:57 +00:00
unsigned int Master_TotalCount ( void ) ;
2016-07-12 00:40:13 +00:00
unsigned int Master_NumPolled ( void ) ; //progress indicator
unsigned int Master_NumAlive ( void ) ;
2005-10-07 16:27:20 +00:00
void Master_SetupSockets ( void ) ;
2014-09-02 02:44:43 +00:00
void MasterInfo_Refresh ( void ) ;
2004-08-23 00:15:46 +00:00
void Master_QueryServer ( serverinfo_t * server ) ;
2004-08-31 09:15:24 +00:00
void MasterInfo_WriteServers ( void ) ;
2005-05-13 10:42:48 +00:00
2014-03-30 08:55:06 +00:00
int Master_KeyForName ( const char * keyname ) ;
2005-05-13 10:42:48 +00:00
float Master_ReadKeyFloat ( serverinfo_t * server , int keynum ) ;
char * Master_ReadKeyString ( serverinfo_t * server , int keynum ) ;
2008-11-09 22:29:28 +00:00
void Master_SortServers ( void ) ;
2005-05-13 10:42:48 +00:00
void Master_SetSortField ( hostcachekey_t field , qboolean descending ) ;
hostcachekey_t Master_GetSortField ( void ) ;
qboolean Master_GetSortDescending ( void ) ;
int Master_NumSorted ( void ) ;
void Master_ClearMasks ( void ) ;
serverinfo_t * Master_SortedServer ( int idx ) ;
2014-03-30 08:55:06 +00:00
void Master_SetMaskString ( qboolean or , hostcachekey_t field , const char * param , slist_test_t testop ) ;
2005-06-14 04:52:10 +00:00
void Master_SetMaskInteger ( qboolean or , hostcachekey_t field , int param , slist_test_t testop ) ;
2015-07-07 02:03:31 +00:00
serverinfo_t * Master_FindRoute ( netadr_t target ) ;
2017-12-11 02:55:06 +00:00
# else
# define MasterInfo_WriteServers()
# endif