OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
gcdkeys.h
1/******
2gcdkeys.h
3GameSpy CDKey SDK Server Header
4
5Copyright 1999-2007 GameSpy Industries, Inc
6
7devsupport@gamespy.com
8
9******
10
11 Please see the GameSpy CDKey SDK documentation for more
12 information
13
14******/
15
16
17#ifndef _GOACDKEYS_H_
18#define _GOACDKEYS_H_
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#define GUSE_ASSERTS
25
26/*****
27QR2CDKEY_INTEGRATION: This define controls where the functions needed to integrate
28the networking of the Query & Reporting 2 SDK and CDKey SDKs are available.
29If you intend to use the integration option for these SDKs, you must uncomment the
30define below, or provide it as an option to your compiler.
31*******/
32#define QR2CDKEY_INTEGRATION
33
34typedef void (*AuthCallBackFn)(int gameid, int localid, int authenticated, char *errmsg, void *instance);
35typedef void (*RefreshAuthCallBackFn)(int gameid, int localid, int hint, char *challenge, void *instance);
36
37/* The hostname of the validation server.
38If the app resolves the hostname, an
39IP can be stored here before calling
40gcd_init */
41extern char gcd_hostname[64];
42
43/********
44gcd_init
45Initializes the Server API and creates the socket
46Should only be called once (unless gcd_shutdown has been called)
47*********/
48int gcd_init(int gameid);
49
50/********
51gcd_init_qr2
52Initializes the Server API and integrates the networking of the CDKey SDK
53with the Query & Reporting 2 SDK.
54You must initialize the Query & Reporting 2 SDK with qr2_init or qr2_init_socket
55prior to calling this. If you are using multiple instances of the QR2 SDK, you
56can pass the specific instance information in via the "qrec" argument. Otherwise
57you can simply pass in NULL.
58*********/
59#ifdef QR2CDKEY_INTEGRATION
60
61#include "../qr2/qr2.h"
62int gcd_init_qr2(qr2_t qrec, int gameid);
63
64#endif
65
66/********
67gcd_shutdown
68Frees the socket and client structures
69Also calls gcd_disconnect_all to make sure all users are signaled as offline
70*********/
71void gcd_shutdown(void);
72
73/********
74gcd_authenticate_user
75Creates a new client and sends a request for authorization to the
76validation server.
77*********/
78void gcd_authenticate_user(int gameid, int localid, unsigned int userip, const char *challenge,
79 const char *response, AuthCallBackFn authfn, RefreshAuthCallBackFn refreshfn, void *instance);
80
81/********
82gcd_authenticate_user
83Creates a new client and sends a request for authorization to the
84validation server.
85*********/
86void gcd_process_reauth(int gameid, int localid, int hint, const char *response);
87
88
89/********
90gcd_disconnect_user
91Notify the validation server that a user has disconnected
92*********/
93void gcd_disconnect_user(int gameid, int localid);
94
95
96/********
97gcd_disconnect_all
98Calls gcd_disconnect_user for each user still online (shortcut)
99*********/
100void gcd_disconnect_all(int gameid);
101
102/********
103gcd_think
104Processes any pending data from the validation server
105and calls the callback to indicate whether a client was
106authorized or not
107*********/
108void gcd_think(void);
109
110/********
111gcd_getkeyhash
112Returns the key hash for the given user. This hash will always
113be the same for that users, which makes it good for banning or
114tracking of users (used with the Tracking/Stats SDK). Returns
115an empty string if that user isn't connected.
116*********/
117char *gcd_getkeyhash(int gameid, int localid);
118
119#ifdef __cplusplus
120}
121#endif
122
123#endif
124