aboutsummaryrefslogtreecommitdiff
path: root/src/parsec/include/net_serv.h
blob: f2c260d5312bcdd069811ea796b550572aa449a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
 * PARSEC HEADER: net_serv.h
 */

#ifndef _NET_SERV_H_
#define _NET_SERV_H_


//NOTE:
// these functions are only needed by the GMSV protocol
// they are implemented by NET_SERV.C.


// server access functions

int		NET_ResolveServerNode();
int		NET_ServerConnect();
int		NET_ServerDisconnect();
void	NET_ServerDisconnectReset();
int 	NET_ServerJump();
void	NET_ServerMessages();
int 	NET_ServerUpdateName();
int 	NET_ServerParseMessage( char* msg );
void	NET_ServerProcessPingPacket( NetPacket_GMSV* gamepacket );
int		NET_ServerList_Get( char* masterhostname, int serverid = -1 );
int		NET_ServerList_AddServer( RE_IPv4ServerInfo* pServerInfo );
int		NET_ServerList_UpdateServer( RE_IPv4ServerInfo* pServerInfo );
int		NET_ServerList_AddLinkInfo( RE_ServerLinkInfo* pServerLinkInfo );
int		NET_ServerList_AddMapObject( RE_MapObject* pMapObject );
int		NET_ServerList_SetPONG( int serverid, refframe_t sendframe, int curplayers, int maxplayers );
int		NET_ServerList_SetINFO( int serverid, refframe_t framediff, int curplayers, int maxplayers, int srv_version_minor, int srv_version_major, char* srv_name );
int		NET_ServerPing( node_t* node, int anon, int fullinfo = FALSE );

// defaults for "SERVRLIST" command -------------------------------------------
//
#define DEFAULT_SERVERLIST_MIN_PING			0
#define DEFAULT_SERVERLIST_MAX_PING			9999
#define DEFAULT_SERVERLIST_MIN_PLAYERS		0
#define DEFAULT_SERVERLIST_MAX_PLAYERS		MAX_NET_ALLOC_SLOTS
#define DEFAULT_SERVERLIST_LOCALE			1

// all info about a "SERVERLIST" command --------------------------------------
//
struct serverlist_info_s {

	int			m_ListRequested;
	int			m_nMinPing;
	int			m_nMaxPing;
	int			m_nMinPlayers;
	int			m_nMaxPlayers;
	int			m_nLocale;

	word		m_RequestedServerIDs[ MAX_NUM_LINKS ];
	int			m_nNumRequestedServerIDs;

	serverlist_info_s()
	{
		Reset();
	}

	void Reset()
	{
		m_ListRequested = FALSE;
		m_nMinPing		= DEFAULT_SERVERLIST_MIN_PING;
		m_nMaxPing		= DEFAULT_SERVERLIST_MAX_PING;
		m_nMinPlayers	= DEFAULT_SERVERLIST_MIN_PLAYERS;
		m_nMaxPlayers	= DEFAULT_SERVERLIST_MAX_PLAYERS;
		m_nLocale		= DEFAULT_SERVERLIST_LOCALE;
		m_nNumRequestedServerIDs = 0;
	}
};

extern serverlist_info_s serverlist_info;

#endif // _NET_SERV_H_