OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
gpiUtility.h
1/*
2gpiUtility.h
3GameSpy Presence SDK
4Dan "Mr. Pants" Schoenblum
5
6Copyright 1999-2007 GameSpy Industries, Inc
7
8devsupport@gamespy.com
9
10***********************************************************************
11Please see the GameSpy Presence SDK documentation for more information
12**********************************************************************/
13
14#ifndef _GPIUTILITY_H_
15#define _GPIUTILITY_H_
16
17//INCLUDES
19#include "gpi.h"
20
21//DEFINES
23// Buffer read size.
25#define GPI_READ_SIZE (16 * 1024)
26
27//MACROS
29#define freeclear(mem) { gsifree(mem); (mem) = NULL; }
30
31#define Error(connection, result, string) { gpiSetErrorString(connection, string);\
32 return (result);}
33
34#define CallbackError(connection, result, code, string) { gpiSetError(connection, code, string);\
35 gpiCallErrorCallback(connection, result, GP_NON_FATAL);\
36 return result;}
37
38#define CallbackFatalError(connection, result, code, string) { gpiSetError(connection, code, string);\
39 gpiCallErrorCallback(connection, result, GP_FATAL);\
40 return result;}
41
42#define CHECK_RESULT(result) { GPResult __result__ = (result);\
43 if(__result__ != GP_NO_ERROR){\
44 return __result__;}}
45
46//FUNCTIONS
48void
49strzcpy(
50 char * dest,
51 const char * src,
52 size_t len // length of buffer, including space for '\0'
53);
54
55void
56gpiDebug(
57 GPConnection * connection,
58 const char * fmt,
59 ...
60);
61
62GPIBool
63gpiValueForKeyWithIndex(
64 const char * command,
65 const char * key,
66 int * index,
67 char * value,
68 int len
69);
70
71GPIBool
72gpiValueForKey(
73 const char * command,
74 const char * key,
75 char * value,
76 int len
77);
78
79char *
80gpiValueForKeyAlloc(
81 const char * command,
82 const char * key
83);
84
85GPResult
86gpiCheckSocketConnect(
87 GPConnection * connection,
88 SOCKET sock,
89 int * state
90);
91
92GPResult
93gpiReadKeyAndValue(
94 GPConnection * connection,
95 const char * buffer,
96 int * index,
97 char key[512],
98 char value[512]
99);
100
101GPIBool
102gpiCheckForError(
103 GPConnection * connection,
104 const char * input,
105 GPIBool callErrorCallback
106);
107
108void
109gpiSetError(
110 GPConnection * connection,
111 GPErrorCode errorCode,
112 const char * errorString
113);
114
115void
116gpiSetErrorString(
117 GPConnection * connection,
118 const char * errorString
119);
120
121void
122gpiEncodeString(
123 const char * unencodedString,
124 char * encodedString
125);
126
127#endif
Definition puff.c:88