qr2_init

GameSpy SDK

qr2_init

Initialize the Query and Reporting 2 SDK.

qr2_error_t qr2_init(
qr2_t * qrec,
const gsi_char * ip,
int baseport,
const gsi_char * gamename,
const gsi_char * secret_key,
int ispublic,
int natnegotiate,
qr2_serverkeycallback_t server_key_callback,
qr2_playerteamkeycallback_t player_key_callback,
qr2_playerteamkeycallback_t team_key_callback,
qr2_keylistcallback_t key_list_callback,
qr2_countcallback_t playerteam_count_callback,
qr2_adderrorcallback_t adderror_callback,
void * userdata );
RoutineRequired HeaderDistribution
qr2_init<qr2.h>SDKZIP

Return Value

This function returns e_qrnoerrorfor a sucessful result.  Otherwise a valid qr2_error_t is returned.

Parameters

qrec
[out] The intialized QR2 SDK object.
ip
[in] Optional IP address to bind to; useful for multi-homed machines.  Usually pass NULL.
baseport
[in] Port to accept queries on.  See remarks.
gamename
[in] The gamename, assigned by GameSpy.
secret_key
[in] The secret key for the specified gamename, also assigned by GameSpy.
ispublic
[in] Set to 1 for an Internet listed server, 0 for a LAN only server.
natnegotiate
[in] Set to 1 to allow NAT-negotiated connections.
server_key_callback
[in] Callback that is triggered when server keys are requested.
player_key_callback
[in] Callback that is triggered when player keys are requested.
team_key_callback
[in] Callback that is triggered when team keys are requested.
key_list_callback
[in] Callback that is triggered when the key list is requested.
playerteam_count_callback
[in] Callback that is triggered when the number of teams is requested.
adderror_callback
[in] Callback that is triggerred when there has been an error adding it to the list.
userdata
[in] Pointer to user data. This is optional and will be passed unmodified to the callback functions.

Remarks

The qr2_init function initializes the qr2 SDK. The baseport parameter specifies which local port should be used to accept queries on.  If this port is in use, the next port value will be tried.  The qr2 sdk will try up to NUM_PORTS_TO_TRYports.  (Currently set at 100.).

Unicode Mappings

RoutineGSI_UNICODE Not DefinedGSI_UNICODE Defined
qr2_initqr2_initAqr2_initW

qr2_initW and qr2_initA are UNICODE and ANSI mapped versions of qr2_init. The arguments of qr2_initA are ANSI strings; those of qr2_initW are wide-character strings.