File: gcdkeys.h

package info (click to toggle)
openmohaa 0.81.1%2Bdfsg-2
  • links: PTS, VCS
  • area: contrib
  • in suites: trixie
  • size: 29,124 kB
  • sloc: ansic: 270,865; cpp: 250,173; sh: 234; asm: 141; xml: 64; makefile: 7
file content (124 lines) | stat: -rw-r--r-- 3,278 bytes parent folder | download | duplicates (2)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/******
gcdkeys.h
GameSpy CDKey SDK Server Header
  
Copyright 1999-2007 GameSpy Industries, Inc

devsupport@gamespy.com

******

 Please see the GameSpy CDKey SDK documentation for more 
 information

******/


#ifndef _GOACDKEYS_H_
#define _GOACDKEYS_H_

#ifdef __cplusplus
extern "C" {
#endif

#define GUSE_ASSERTS

/*****
QR2CDKEY_INTEGRATION: This define controls where the functions needed to integrate
the networking of the Query & Reporting 2 SDK and CDKey SDKs are available.
If you intend to use the integration option for these SDKs, you must uncomment the 
define below, or provide it as an option to your compiler.
*******/
#define QR2CDKEY_INTEGRATION

typedef void (*AuthCallBackFn)(int gameid, int localid, int authenticated, char *errmsg, void *instance);
typedef void (*RefreshAuthCallBackFn)(int gameid, int localid, int hint, char *challenge, void *instance);

/* The hostname of the validation server.
If the app resolves the hostname, an
IP can be stored here before calling
gcd_init */
extern char gcd_hostname[64];

/********
gcd_init
Initializes the Server API and creates the socket
Should only be called once (unless gcd_shutdown has been called)
*********/
int gcd_init(int gameid);

/********
gcd_init_qr2
Initializes the Server API and integrates the networking of the CDKey SDK
with the Query & Reporting 2 SDK.
You must initialize the Query & Reporting 2 SDK with qr2_init or qr2_init_socket
prior to calling this. If you are using multiple instances of the QR2 SDK, you
can pass the specific instance information in via the "qrec" argument. Otherwise
you can simply pass in NULL.
*********/
#ifdef QR2CDKEY_INTEGRATION

#include "../qr2/qr2.h"
int gcd_init_qr2(qr2_t qrec, int gameid);

#endif

/********
gcd_shutdown
Frees the socket and client structures
Also calls gcd_disconnect_all to make sure all users are signaled as offline
*********/
void gcd_shutdown(void);

/********
gcd_authenticate_user
Creates a new client and sends a request for authorization to the
validation server.
*********/
void gcd_authenticate_user(int gameid, int localid, unsigned int userip, const char *challenge, 
						   const char *response, AuthCallBackFn authfn, RefreshAuthCallBackFn refreshfn, void *instance);

/********
gcd_authenticate_user
Creates a new client and sends a request for authorization to the
validation server.
*********/
void gcd_process_reauth(int gameid, int localid, int hint, const char *response);


/********
gcd_disconnect_user
Notify the validation server that a user has disconnected
*********/
void gcd_disconnect_user(int gameid, int localid);


/********
gcd_disconnect_all
Calls gcd_disconnect_user for each user still online (shortcut)
*********/
void gcd_disconnect_all(int gameid);

/********
gcd_think
Processes any pending data from the validation server
and calls the callback to indicate whether a client was 
authorized or not
*********/
void gcd_think(void);

/********
gcd_getkeyhash
Returns the key hash for the given user. This hash will always
be the same for that users, which makes it good for banning or
tracking of users (used with the Tracking/Stats SDK). Returns
an empty string if that user isn't connected.
*********/
char *gcd_getkeyhash(int gameid, int localid);

#ifdef __cplusplus
}
#endif

#endif