2004-08-23 00:15:46 +00:00
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 ,
} ;
enum masterprotocol_e
{
MP_UNSPECIFIED ,
2014-12-23 15:26:42 +00:00
MP_QUAKEWORLD ,
MP_QUAKE2 ,
MP_QUAKE3 ,
MP_NETQUAKE ,
MP_DPMASTER
2005-05-17 02:36:54 +00:00
} ;
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 ,
SLKEY_NUMBOTS ,
SLKEY_NUMHUMANS ,
SLKEY_QCSTATUS ,
// SLKEY_PLAYERS, //eep!
SLKEY_ISFAVORITE , //eep!
2014-12-23 15:26:42 +00:00
SLKEY_ISLOCAL ,
SLKEY_ISPROXY ,
2008-11-09 22:29:28 +00:00
2005-05-13 10:42:48 +00:00
SLKEY_TOOMANY ,
SLKEY_CUSTOM
} 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 ;
2013-10-29 17:38:22 +00:00
struct
{
2004-08-23 00:15:46 +00:00
int userid ;
int frags ;
float time ;
int ping ;
char name [ 64 ] ;
char skin [ 64 ] ;
char topc ;
char botc ;
} 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 ;
2005-05-13 10:42:48 +00:00
unsigned char players ;
unsigned char maxplayers ;
qbyte special ; //flags
qbyte sends ;
qbyte insortedlist ;
2008-11-09 22:29:28 +00:00
qbyte numhumans ;
qbyte numbots ;
qbyte freeslots ;
qbyte protocol ;
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 ;
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 ;
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 ] ;
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 ;
2006-02-11 14:51:36 +00:00
void Master_SetupSockets ( void ) ;
2004-08-23 00:15:46 +00:00
void 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 ) ;
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 ) ;
unsigned int Master_NumPolled ( 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 ) ;