OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
sb_ascii.h
1/******
2GameSpy Server Browsing SDK
3
4Copyright 1999-2007 GameSpy Industries, Inc
5
6devsupport@gamespy.com
7
8******
9
10 Please see the GameSpy Server Browsing SDK documentation for more
11 information
12
13******/
14
15// PROTOTYPES FOR ASCII VERSIONS
16// This is required to silence CodeWarrior warnings about functions not having a prototype
17
18
19#ifndef _SB_ASCII_H
20#define _SB_ASCII_H
21
22#include "../common/gsCommon.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/*
29ServerBrowserNew
30----------------
31Creates and returns a new (empty) ServerBrowser object.
32Returns NULL if an allocation error occurs.
33
34queryForGamename - The gamename you are querying for
35queryFromGamename - The gamename you are querying from - generally the same as queryForGamename
36queryFromKey - Secret key that corresponds to the queryFromGamename
37queryFromVersion - A game-specific version identifier (pass 0 unless told otherwise)
38maxConcUpdates - Max number of concurent updates (10-15 for modem users, 20-30 for high-bandwidth)
39queryVersion - Query protocol to use. Use QVERSION_GOA for DeveloperSpec/Query&Reporting1 games, and QVERSION_QR2 for games that use Query & Reporting 2
40callback - The function that will be called with list updates
41instance - User-defined instance data (e.g. structure or object pointer) */
42ServerBrowser ServerBrowserNewA(const char *queryForGamename, const char *queryFromGamename, const char *queryFromKey, int queryFromVersion, int maxConcUpdates, int queryVersion, SBBool lanBrowse, ServerBrowserCallback callback, void *instance);
43
44
45/* ServerBrowserUpdate
46-------------------
47Starts an update by downloading a list of servers from the master server, then querying them.
48
49sb - The server browser object to update
50async - If SBTrue, the update will be initiated, and ServerListThink must be called for processing and querying to occur
51 If SBFalse, the function will not return until the initial list of servers has been completely updated
52disconnectOnComplete - If SBTrue, the connection to the master server will be disconnected immediately after the list is downloaded.
53 If SBFalse, the connection will be left open for additional data queries, and can be closed via ServerBrowserDisconnect
54basicFields - This array of registered QR2 keys is used to determine the fields requested from servers during the initial "basic" update.
55 Only server keys listed in this array will be returned for servers.
56numBasicFields - The number of fields in the basicFields array
57serverFilter - SQL Filter string that will be applied on the master server to limit the list of servers returned.
58 All server keys are available for filtering on the master server, as well as the master-defined "country" and "region" keys.
59 Standard SQL syntax should be used.
60
61ServerBrowserLimitUpdate
62------------------------
63Identical to ServerBrowserUpdate, except that the number of servers returned can be limited
64maxServers - Maximum number of servers to be returned
65*/
66SBError ServerBrowserUpdateA(ServerBrowser sb, SBBool async, SBBool disconnectOnComplete, const unsigned char *basicFields, int numBasicFields, const char *serverFilter);
67SBError ServerBrowserLimitUpdateA(ServerBrowser sb, SBBool async, SBBool disconnectOnComplete, const unsigned char *basicFields, int numBasicFields, const char *serverFilter, int maxServers);
68
69
70/* ServerBrowserAuxUpdateIP
71-------------------
72Manually updates a server given an IP address and query port. Use to manually add servers to the list when you just
73have an IP and port for them.
74
75sb - The server browser object to add the server to
76ip - The dotted IP address of the server e.g. "1.2.3.4"
77port - The query port of the server
78viaMaster - If SBTrue, information about the server will be retrieved from the master server instead of attempting to query the server directly.
79 If a connection to the master server does not exist, it will be made to kept open afterwards.
80 If SBFalse, the server will be contacted directly for information.
81async - If SBTrue, the update will be initiated, and ServerListThink must be called for processing and querying to occur
82 If SBFalse, the function will not return until the server has been successfully or unsuccessfully updated
83fullUpdate - If SBTrue, all server keys/rules/player/team information will be retrieved
84 If SBFalse, only the keys specified in the basicFields array of the ServerBrowserUpdate function will be retrieved */
85SBError ServerBrowserAuxUpdateIPA(ServerBrowser sb, const char *ip, unsigned short port, SBBool viaMaster, SBBool async, SBBool fullUpdate);
86
87/* ServerBrowserRemoveIP
88-------------------
89Removes a server from the list given an IP and query port */
90void ServerBrowserRemoveIPA(ServerBrowser sb, const char *ip, unsigned short port);
91
92/* ServerBrowserErrorDesc
93-------------------
94Returns a human-readable error string for the given error code. */
95const char *ServerBrowserErrorDescA(ServerBrowser sb, SBError error);
96
97/* ServerBrowserListQueryError
98-------------------
99When a list query error occurs, as indicated by the sbc_queryerror callback, this function allows you to
100obtain the human-readable error string for the error (generally these errors are caused by errors in the
101filter string) */
102const char *ServerBrowserListQueryErrorA(ServerBrowser sb);
103
104
105/* ServerBrowserSendNatNegotiateCookieToServer
106------------------
107Sends a cookie value to the server for use with NAT Negotiation */
108SBError ServerBrowserSendNatNegotiateCookieToServerA(ServerBrowser sb, const char *ip, unsigned short port, int cookie);
109
110
111/* ServerBrowserSendMessageToServer
112------------------
113Sends a game-specific message to a server */
114SBError ServerBrowserSendMessageToServerA(ServerBrowser sb, const char *ip, unsigned short port, const char *data, int len);
115
116
117/* ServerBrowserSort
118-----------------
119Sort the server list in either ascending or descending order using the
120specified comparemode.
121sortkey can be a normal server key, or "ping" or "hostaddr" */
122void ServerBrowserSortA(ServerBrowser sb, SBBool ascending, const char *sortkey, SBCompareMode comparemode);
123
124/*******************
125SBServer Object Functions
126********************/
127
128
129/* SBServerGetPublicAddress/SBServerGetPrivateAddress
130-------------------
131Returns the string, dotted IP address for the specified server
132The "private" version is only valid when the server has a private address available */
133char *SBServerGetPublicAddress(SBServer server);
134char *SBServerGetPrivateAddress(SBServer server);
135
136
137/* SBServerGet[]Value
138------------------
139Returns the value for the specified key. If the key does not exist for the
140given server, the default value is returned */
141const char *SBServerGetStringValueA(SBServer server, const char *keyname, const char *def);
142int SBServerGetIntValueA(SBServer server, const char *key, int idefault);
143double SBServerGetFloatValueA(SBServer server, const char *key, double fdefault);
144SBBool SBServerGetBoolValueA(SBServer server, const char *key, SBBool bdefault);
145
146
147/* SBServerGetPlayer[]Value / SBServerGetTeam[]Value
148------------------
149Returns the value for the specified key on the specified player or team. If the key does not exist for the
150given server, the default value is returned
151Player keys take the form keyname_N where N is the player index, and team keys take the form
152keyname_tN where N is the team index. You should only specify the keyname for the key in the below functions.
153*/
154const char *SBServerGetPlayerStringValueA(SBServer server, int playernum, const char *key, const char *sdefault);
155int SBServerGetPlayerIntValueA(SBServer server, int playernum, const char *key, int idefault);
156double SBServerGetPlayerFloatValueA(SBServer server, int playernum, const char *key, double fdefault);
157
158const char *SBServerGetTeamStringValueA(SBServer server, int teamnum, const char *key, const char *sdefault);
159int SBServerGetTeamIntValueA(SBServer server, int teamnum, const char *key, int idefault);
160double SBServerGetTeamFloatValueA(SBServer server, int teamnum, const char *key, double fdefault);
161
162
163#ifdef __cplusplus
164}
165#endif
166
167#endif