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 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
|
/*
gpi.h
GameSpy Presence SDK
Dan "Mr. Pants" Schoenblum
Copyright 1999-2007 GameSpy Industries, Inc
devsupport@gamespy.com
***********************************************************************
Please see the GameSpy Presence SDK documentation for more information
**********************************************************************/
#ifndef _GPI_H_
#define _GPI_H_
//INCLUDES
//////////
#include "../common/gsCommon.h"
#include "../common/gsAvailable.h"
#include "../common/gsUdpEngine.h"
#include "../hashtable.h"
#include "../darray.h"
#include "../md5.h"
#include "gp.h"
// Extended message support
#define GPI_NEW_AUTH_NOTIFICATION (1<<0)
#define GPI_NEW_REVOKE_NOTIFICATION (1<<1)
// New Status Info support
#define GPI_NEW_STATUS_NOTIFICATION (1<<2)
// Buddy List + Block List retrieval on login
#define GPI_NEW_LIST_RETRIEVAL_ON_LOGIN (1<<3)
// Extended SDK features
#ifndef GPI_SDKREV
#ifdef GP_NEW_STATUS_INFO
#define GPI_SDKREV (GPI_NEW_AUTH_NOTIFICATION | GPI_NEW_REVOKE_NOTIFICATION | GPI_NEW_STATUS_NOTIFICATION | GPI_NEW_LIST_RETRIEVAL_ON_LOGIN)
#else
#define GPI_SDKREV (GPI_NEW_AUTH_NOTIFICATION | GPI_NEW_REVOKE_NOTIFICATION | GPI_NEW_LIST_RETRIEVAL_ON_LOGIN)
#endif
#endif
// New UDP Layer port
#define GPI_PEER_PORT 6500
//TYPES
///////
// Boolean.
///////////
typedef enum _GPIBool
{
GPIFalse,
GPITrue
} GPIBool;
#include "gpiUtility.h"
#include "gpiCallback.h"
#include "gpiOperation.h"
#include "gpiConnect.h"
#include "gpiBuffer.h"
#include "gpiInfo.h"
#include "gpiProfile.h"
#include "gpiPeer.h"
#include "gpiSearch.h"
#include "gpiBuddy.h"
#include "gpiTransfer.h"
#include "gpiUnique.h"
#include "gpiKeys.h"
// For PS3 NP Sync functionality
#ifdef _PS3
#include "gpiPS3.h"
#endif
// Connection data.
///////////////////
typedef struct
{
char errorString[GP_ERROR_STRING_LEN];
GPIBool infoCaching;
GPIBool infoCachingBuddyAndBlockOnly;
GPIBool simulation;
GPIBool firewall;
char nick[GP_NICK_LEN];
char uniquenick[GP_UNIQUENICK_LEN];
char email[GP_EMAIL_LEN];
char password[GP_PASSWORD_LEN];
int sessKey;
int userid;
int profileid;
int partnerID;
GPICallback callbacks[GPI_NUM_CALLBACKS];
SOCKET cmSocket;
int connectState;
GPIBuffer socketBuffer;
char * inputBuffer;
int inputBufferSize;
GPIBuffer outputBuffer;
// Replaced by UDP Layer
//SOCKET peerSocket;
char mHeader[GS_UDP_MSG_HEADER_LEN];
unsigned short peerPort;
int nextOperationID;
int numSearches;
// new style status info
GPEnum lastStatusState;
unsigned int hostIp;
unsigned int hostPrivateIp;
unsigned short queryPort;
unsigned short hostPort;
unsigned int sessionFlags;
char richStatus[GP_RICH_STATUS_LEN];
char gameType[GP_STATUS_BASIC_STR_LEN];
char gameVariant[GP_STATUS_BASIC_STR_LEN];
char gameMapName[GP_STATUS_BASIC_STR_LEN];
// New Status Info extended info Keys
DArray extendedInfoKeys;
// Deprecated
char lastStatusString[GP_STATUS_STRING_LEN];
char lastLocationString[GP_LOCATION_STRING_LEN];
GPErrorCode errorCode;
GPIBool fatalError;
FILE * diskCache;
GPIOperation * operationList;
GPIProfileList profileList;
GPIPeer * peerList;
GPICallbackData * callbackList;
GPICallbackData * lastCallback;
GPIBuffer updateproBuffer;
GPIBuffer updateuiBuffer;
DArray transfers;
unsigned int nextTransferID;
int productID;
int namespaceID;
char loginTicket[GP_LOGIN_TICKET_LEN];
GPEnum quietModeFlags;
gsi_time kaTransmit;
#ifdef GSI_UNICODE
unsigned short errorString_W[GP_ERROR_STRING_LEN];
unsigned short nick_W[GP_NICK_LEN];
unsigned short uniquenick_W[GP_UNIQUENICK_LEN];
unsigned short email_W[GP_EMAIL_LEN];
unsigned short password_W[GP_PASSWORD_LEN];
// Deprecated
unsigned short lastStatusString_W[GP_STATUS_STRING_LEN];
unsigned short lastLocationString_W[GP_LOCATION_STRING_LEN];
unsigned short richStatus_W[GP_RICH_STATUS_LEN];
unsigned short gameType_W[GP_STATUS_BASIC_STR_LEN];
unsigned short gameVariant_W[GP_STATUS_BASIC_STR_LEN];
unsigned short gameMapName_W[GP_STATUS_BASIC_STR_LEN];
#endif
#ifdef _PS3
// NP sync info
gsi_bool npInitialized;
gsi_bool npStatusRetrieved;
gsi_bool npBasicGameInitialized;
gsi_bool npLookupGameInitialized;
gsi_bool npPerformBuddySync;
gsi_bool npPerformBlockSync;
gsi_bool npSyncLock;
int npLookupTitleCtxId;
DArray npTransactionList;
gsi_time loginTime;
#endif
} GPIConnection;
//FUNCTIONS
///////////
GPResult
gpiInitialize(
GPConnection * connection,
int productID,
int namespaceID,
int partnerID
);
void
gpiDestroy(
GPConnection * connection
);
GPResult
gpiReset(
GPConnection * connection
);
GPResult
gpiProcessConnectionManager(
GPConnection * connection
);
GPResult
gpiProcess(
GPConnection * connection,
int blockingOperationID
);
GPResult
gpiEnable(
GPConnection * connection,
GPEnum state
);
GPResult
gpiDisable(
GPConnection * connection,
GPEnum state
);
#ifdef _DEBUG
void
gpiReport(
GPConnection * connection,
void (* report)(const char * output)
);
#endif
#endif
|