17#include "../common/gsCommon.h"
30 GP_RECV_BUDDY_REQUEST,
32 GP_RECV_BUDDY_MESSAGE,
41 GP_INFO_CACHING = 0x0100,
43 GP_INFO_CACHING_BUDDY_AND_BLOCK_ONLY,
58 GP_DONT_CHECK_CACHE = 0,
124 GP_NOT_CONNECTED = 0,
128 GP_MASK_NONE = 0x00000000,
129 GP_MASK_HOMEPAGE = 0x00000001,
130 GP_MASK_ZIPCODE = 0x00000002,
131 GP_MASK_COUNTRYCODE = 0x00000004,
132 GP_MASK_BIRTHDAY = 0x00000008,
133 GP_MASK_SEX = 0x00000010,
134 GP_MASK_EMAIL = 0x00000020,
135 GP_MASK_ALL = 0xFFFFFFFF,
148 GP_SESS_IS_CLOSED = 0x00000001,
149 GP_SESS_IS_OPEN = 0x00000002,
150 GP_SESS_HAS_PASSWORD = 0x00000004,
151 GP_SESS_IS_BEHIND_NAT = 0x00000008,
152 GP_SESS_IS_RANKED = 0x000000010,
176 GP_TRANSFER_SEND_REQUEST = 0x800,
177 GP_TRANSFER_ACCEPTED,
178 GP_TRANSFER_REJECTED,
179 GP_TRANSFER_NOT_ACCEPTING,
180 GP_TRANSFER_NO_CONNECTION,
182 GP_TRANSFER_CANCELLED,
183 GP_TRANSFER_LOST_CONNECTION,
185 GP_TRANSFER_THROTTLE,
195 GP_FILE_READ_ERROR = 0x900,
201 GP_TRANSFER_SENDER = 0xA00,
202 GP_TRANSFER_RECEIVER,
206 GP_DONT_ROUTE = 0xB00,
210 GP_SILENCE_NONE = 0x00000000,
211 GP_SILENCE_MESSAGES = 0x00000001,
212 GP_SILENCE_UTMS = 0x00000002,
213 GP_SILENCE_LIST = 0x00000004,
214 GP_SILENCE_ALL = 0xFFFFFFFF,
217 GP_NEW_STATUS_INFO_SUPPORTED = 0xC00,
218 GP_NEW_STATUS_INFO_NOT_SUPPORTED = 0xC01
223typedef enum _GPResult
237typedef enum _GPErrorCode
247 GP_FORCED_DISCONNECT,
248 GP_CONNECTION_CLOSED,
258 GP_LOGIN_BAD_PASSWORD,
259 GP_LOGIN_BAD_PROFILE,
260 GP_LOGIN_PROFILE_DELETED,
261 GP_LOGIN_CONNECTION_FAILED,
262 GP_LOGIN_SERVER_AUTH_FAILED,
263 GP_LOGIN_BAD_UNIQUENICK,
264 GP_LOGIN_BAD_PREAUTH,
270 GP_NEWUSER_BAD_PASSWORD,
271 GP_NEWUSER_UNIQUENICK_INVALID,
272 GP_NEWUSER_UNIQUENICK_INUSE,
276 GP_UPDATEUI = 0x0300,
277 GP_UPDATEUI_BAD_EMAIL,
281 GP_NEWPROFILE = 0x0400,
282 GP_NEWPROFILE_BAD_NICK,
283 GP_NEWPROFILE_BAD_OLD_NICK,
287 GP_UPDATEPRO = 0x0500,
288 GP_UPDATEPRO_BAD_NICK,
292 GP_ADDBUDDY = 0x0600,
293 GP_ADDBUDDY_BAD_FROM,
295 GP_ADDBUDDY_ALREADY_BUDDY,
311 GP_BM_EXT_INFO_NOT_SUPPORTED,
316 GP_GETPROFILE = 0x0A00,
317 GP_GETPROFILE_BAD_PROFILE,
321 GP_DELBUDDY = 0x0B00,
322 GP_DELBUDDY_NOT_BUDDY,
326 GP_DELPROFILE = 0x0C00,
327 GP_DELPROFILE_LAST_PROFILE,
332 GP_SEARCH_CONNECTION_FAILED,
340 GP_CHECK_BAD_PASSWORD,
349 GP_REGISTERUNIQUENICK = 0x1000,
350 GP_REGISTERUNIQUENICK_TAKEN,
351 GP_REGISTERUNIQUENICK_RESERVED,
352 GP_REGISTERUNIQUENICK_BAD_NAMESPACE,
356 GP_REGISTERCDKEY = 0x1100,
357 GP_REGISTERCDKEY_BAD_KEY,
358 GP_REGISTERCDKEY_ALREADY_SET,
359 GP_REGISTERCDKEY_ALREADY_TAKEN,
363 GP_ADDBLOCK = 0x1200,
364 GP_ADDBLOCK_ALREADY_BLOCKED,
368 GP_REMOVEBLOCK = 0x1300,
369 GP_REMOVEBLOCK_NOT_BLOCKED
375#define GP_NICK_LEN 31
376#define GP_UNIQUENICK_LEN 21
377#define GP_FIRSTNAME_LEN 31
378#define GP_LASTNAME_LEN 31
379#define GP_EMAIL_LEN 51
380#define GP_PASSWORD_LEN 31
381#define GP_PASSWORDENC_LEN ((((GP_PASSWORD_LEN+2)*4)/3)+1)
382#define GP_HOMEPAGE_LEN 76
383#define GP_ZIPCODE_LEN 11
384#define GP_COUNTRYCODE_LEN 3
385#define GP_PLACE_LEN 128
386#define GP_AIMNAME_LEN 51
387#define GP_REASON_LEN 1025
388#define GP_STATUS_STRING_LEN 256
389#define GP_LOCATION_STRING_LEN 256
390#define GP_ERROR_STRING_LEN 256
391#define GP_AUTHTOKEN_LEN 256
392#define GP_PARTNERCHALLENGE_LEN 256
393#define GP_CDKEY_LEN 65
394#define GP_CDKEYENC_LEN ((((GP_CDKEY_LEN+2)*4)/3)+1)
395#define GP_LOGIN_TICKET_LEN 25
397#define GP_RICH_STATUS_LEN 256
398#define GP_STATUS_BASIC_STR_LEN 33
403#define GP_XOR_SEED 0x79707367
406#define GP_PARTNERID_GAMESPY 0
407#define GP_PARTNERID_IGN 10
410#define GP_MAX_NAMESPACEIDS 16
416typedef void * GPConnection;
420typedef int GPProfile;
424typedef int GPTransfer;
428typedef void (* GPCallback)(
429 GPConnection * connection,
441 GPErrorCode errorCode;
442 gsi_char * errorString;
452 gsi_char uniquenick[GP_UNIQUENICK_LEN];
476 int numSuggestedNicks;
477 gsi_char ** suggestedNicks;
516 gsi_char nick[GP_NICK_LEN];
517 gsi_char uniquenick[GP_UNIQUENICK_LEN];
519 gsi_char firstname[GP_FIRSTNAME_LEN];
520 gsi_char lastname[GP_LASTNAME_LEN];
521 gsi_char email[GP_EMAIL_LEN];
540 gsi_char nick[GP_NICK_LEN];
541 gsi_char uniquenick[GP_UNIQUENICK_LEN];
542 gsi_char email[GP_EMAIL_LEN];
543 gsi_char firstname[GP_FIRSTNAME_LEN];
544 gsi_char lastname[GP_LASTNAME_LEN];
545 gsi_char homepage[GP_HOMEPAGE_LEN];
547 gsi_char zipcode[GP_ZIPCODE_LEN];
548 gsi_char countrycode[GP_COUNTRYCODE_LEN];
551 gsi_char place[GP_PLACE_LEN];
557 gsi_char aimname[GP_AIMNAME_LEN];
575 gsi_char reason[GP_REASON_LEN];
584 gsi_char statusString[GP_STATUS_STRING_LEN];
585 gsi_char locationString[GP_LOCATION_STRING_LEN];
588 GPEnum quietModeFlags;
599 unsigned int buddyIp;
600 unsigned short buddyPort;
602 unsigned int hostPrivateIp;
603 unsigned short queryPort;
604 unsigned short hostPort;
605 unsigned int sessionFlags;
606 gsi_char richStatus[GP_RICH_STATUS_LEN];
607 gsi_char gameType[GP_STATUS_BASIC_STR_LEN];
608 gsi_char gameVariant[GP_STATUS_BASIC_STR_LEN];
609 gsi_char gameMapName[GP_STATUS_BASIC_STR_LEN];
610 GPEnum quietModeFlags;
611 GPEnum newStatusInfoFlag;
679 gsi_char email[GP_EMAIL_LEN];
688 gsi_char email[GP_EMAIL_LEN];
691 gsi_char ** uniquenicks;
700 gsi_char location[GP_LOCATION_STRING_LEN];
708 gsi_char nick[GP_NICK_LEN];
710 gsi_char statusString[GP_STATUS_STRING_LEN];
735 gsi_char uniqueNick[GP_UNIQUENICK_LEN];
741 int numOfUniqueMatchs;
753extern char GPConnectionManagerHostname[64];
754extern char GPSearchManagerHostname[64];
760#define gpConnect gpConnectA
761#define gpConnectNewUser gpConnectNewUserA
762#define gpConnectUniqueNick gpConnectUniqueNickA
763#define gpConnectPreAuthenticated gpConnectPreAuthenticatedA
764#define gpCheckUser gpCheckUserA
765#define gpNewUser gpNewUserA
766#define gpSuggestUniqueNick gpSuggestUniqueNickA
767#define gpRegisterUniqueNick gpRegisterUniqueNickA
768#define gpRegisterCdKey gpRegisterCdKeyA
769#define gpGetErrorString gpGetErrorStringA
770#define gpNewProfile gpNewProfileA
771#define gpProfileSearch gpProfileSearchA
772#define gpProfileSearchUniquenick gpProfileSearchUniquenickA
773#define gpSetInfos gpSetInfosA
774#define gpSendBuddyRequest gpSendBuddyRequestA
775#ifndef GP_NEW_STATUS_INFO
776#define gpSetStatus gpSetStatusA
778#ifdef GP_NEW_STATUS_INFO
780#define gpSetStatusInfo gpSetStatusInfoA
782#define gpSendBuddyMessage gpSendBuddyMessageA
783#define gpSendBuddyUTM gpSendBuddyUTMA
784#define gpIsValidEmail gpIsValidEmailA
785#define gpGetUserNicks gpGetUserNicksA
786#define gpSetInfoCacheFilename gpSetInfoCacheFilenameA
787#define gpSendFiles gpSendFilesA
788#define gpAcceptTransfer gpAcceptTransferA
789#define gpRejectTransfer gpRejectTransferA
790#define gpSetTransferDirectory gpSetTransferDirectoryA
791#define gpGetFileName gpGetFileNameA
792#define gpGetFilePath gpGetFilePathA
793#define gpInvitePlayer gpInvitePlayerA
794#ifdef GP_NEW_STATUS_INFO
796#define gpAddStatusInfoKey gpAddStatusInfoKeyA
797#define gpSetStatusInfoKey gpSetStatusInfoKeyA
798#define gpGetStatusInfoKeyVal gpGetStatusInfoKeyValA
799#define gpDelStatusInfoKey gpDelStatusInfoKeyA
802#define gpConnect gpConnectW
803#define gpConnectNewUser gpConnectNewUserW
804#define gpConnectUniqueNick gpConnectUniqueNickW
805#define gpConnectPreAuthenticated gpConnectPreAuthenticatedW
806#define gpCheckUser gpCheckUserW
807#define gpNewUser gpNewUserW
808#define gpSuggestUniqueNick gpSuggestUniqueNickW
809#define gpRegisterUniqueNick gpRegisterUniqueNickW
810#define gpRegisterCdKey gpRegisterCdKeyW
811#define gpGetErrorString gpGetErrorStringW
812#define gpNewProfile gpNewProfileW
813#define gpProfileSearch gpProfileSearchW
814#define gpProfileSearchUniquenick gpProfileSearchUniquenickW
815#define gpSetInfos gpSetInfosW
816#define gpSendBuddyRequest gpSendBuddyRequestW
817#ifndef GP_NEW_STATUS_INFO
818#define gpSetStatus gpSetStatusW
820#ifdef GP_NEW_STATUS_INFO
822#define gpSetStatusInfo gpSetStatusInfoW
824#define gpSendBuddyMessage gpSendBuddyMessageW
825#define gpSendBuddyUTM gpSendBuddyUTMW
826#define gpIsValidEmail gpIsValidEmailW
827#define gpGetUserNicks gpGetUserNicksW
828#define gpSetInfoCacheFilename gpSetInfoCacheFilenameW
829#define gpSendFiles gpSendFilesW
830#define gpAcceptTransfer gpAcceptTransferW
831#define gpRejectTransfer gpRejectTransferW
832#define gpSetTransferDirectory gpSetTransferDirectoryW
833#define gpGetFileName gpGetFileNameW
834#define gpGetFilePath gpGetFilePathW
835#define gpInvitePlayer gpInvitePlayerW
849 GPConnection * connection,
861 GPConnection * connection
868 GPConnection * connection,
876 GPConnection * connection,
884 GPConnection * connection
889GPResult gpSetCallback
891 GPConnection * connection,
901 GPConnection * connection,
902 const gsi_char nick[GP_NICK_LEN],
903 const gsi_char email[GP_EMAIL_LEN],
904 const gsi_char password[GP_PASSWORD_LEN],
913GPResult gpConnectNewUser
915 GPConnection * connection,
916 const gsi_char nick[GP_NICK_LEN],
917 const gsi_char uniquenick[GP_UNIQUENICK_LEN],
918 const gsi_char email[GP_EMAIL_LEN],
919 const gsi_char password[GP_PASSWORD_LEN],
920 const gsi_char cdkey[GP_CDKEY_LEN],
929GPResult gpConnectUniqueNick
931 GPConnection * connection,
932 const gsi_char uniquenick[GP_UNIQUENICK_LEN],
933 const gsi_char password[GP_PASSWORD_LEN],
942GPResult gpConnectPreAuthenticated
944 GPConnection * connection,
945 const gsi_char authtoken[GP_AUTHTOKEN_LEN],
946 const gsi_char partnerchallenge[GP_PARTNERCHALLENGE_LEN],
957 GPConnection * connection
962GPResult gpIsConnected
964 GPConnection * connection,
972 GPConnection * connection,
973 const gsi_char nick[GP_NICK_LEN],
974 const gsi_char email[GP_EMAIL_LEN],
975 const gsi_char password[GP_PASSWORD_LEN],
985 GPConnection * connection,
986 const gsi_char nick[GP_NICK_LEN],
987 const gsi_char uniquenick[GP_UNIQUENICK_LEN],
988 const gsi_char email[GP_EMAIL_LEN],
989 const gsi_char password[GP_PASSWORD_LEN],
990 const gsi_char cdkey[GP_CDKEY_LEN],
998GPResult gpSuggestUniqueNick
1000 GPConnection * connection,
1001 const gsi_char desirednick[GP_UNIQUENICK_LEN],
1003 GPCallback callback,
1009GPResult gpRegisterUniqueNick
1011 GPConnection * connection,
1012 const gsi_char uniquenick[GP_UNIQUENICK_LEN],
1013 const gsi_char cdkey[GP_CDKEY_LEN],
1015 GPCallback callback,
1021GPResult gpRegisterCdKey
1023 GPConnection * connection,
1024 const gsi_char cdkey[GP_CDKEY_LEN],
1026 GPCallback callback,
1032GPResult gpGetErrorCode(
1033 GPConnection * connection,
1034 GPErrorCode * errorCode
1039GPResult gpGetErrorString(
1040 GPConnection * connection,
1041 gsi_char errorString[GP_ERROR_STRING_LEN]
1046GPResult gpNewProfile(
1047 GPConnection * connection,
1048 const gsi_char nick[GP_NICK_LEN],
1051 GPCallback callback,
1057GPResult gpDeleteProfile(
1058 GPConnection * connection,
1059 GPCallback callback,
1068GPResult gpProfileFromID(
1069 GPConnection * connection,
1070 GPProfile * profile,
1079GPResult gpIDFromProfile(
1080 GPConnection * connection,
1087GPResult gpUserIDFromProfile(
1088 GPConnection * connection,
1095GPResult gpProfileSearch(
1096 GPConnection * connection,
1097 const gsi_char nick[GP_NICK_LEN],
1098 const gsi_char uniquenick[GP_UNIQUENICK_LEN],
1099 const gsi_char email[GP_EMAIL_LEN],
1100 const gsi_char firstname[GP_FIRSTNAME_LEN],
1101 const gsi_char lastname[GP_LASTNAME_LEN],
1104 GPCallback callback,
1110GPResult gpProfileSearchUniquenick(
1111 GPConnection * connection,
1112 const gsi_char uniquenick[GP_UNIQUENICK_LEN],
1113 const int namespaceIDs[GP_MAX_NAMESPACEIDS],
1116 GPCallback callback,
1123 GPConnection * connection,
1127 GPCallback callback,
1133GPResult gpGetInfoNoWait(
1134 GPConnection * connection,
1142 GPConnection * connection,
1150 GPConnection * connection,
1152 const gsi_char * value
1158 GPConnection * connection,
1167GPResult gpSetInfoMask(
1168 GPConnection * connection,
1174GPResult gpSendBuddyRequest(
1175 GPConnection * connection,
1177 const gsi_char reason[GP_REASON_LEN]
1182GPResult gpAuthBuddyRequest(
1183 GPConnection * connection,
1190GPResult gpDenyBuddyRequest(
1191 GPConnection * connection,
1197GPResult gpDeleteBuddy(
1198 GPConnection * connection,
1204GPResult gpAddToBlockedList(
1205 GPConnection * connection,
1211GPResult gpRemoveFromBlockedList(
1212 GPConnection * connection,
1218GPResult gpGetNumBlocked(
1219 GPConnection * connection,
1225GPResult gpGetBlockedProfile(
1226 GPConnection * connection,
1234gsi_bool gpIsBlocked(
1235 GPConnection * connection,
1241GPResult gpGetNumBuddies(
1242 GPConnection * connection,
1248#ifndef GP_NEW_STATUS_INFO
1249GPResult gpGetBuddyStatus(
1250 GPConnection * connection,
1256#ifdef GP_NEW_STATUS_INFO
1259GPResult gpGetBuddyStatusInfo(
1260 GPConnection * connection,
1265GPResult gpSetBuddyAddr(
1266 GPConnection *connection,
1268 unsigned int buddyIp,
1269 unsigned short buddyPort
1274GPResult gpGetBuddyIndex(
1275 GPConnection * connection,
1284 GPConnection * connection,
1288int gpIsBuddyConnectionOpen(
1289 GPConnection * connection,
1295#ifndef GP_NEW_STATUS_INFO
1296GPResult gpSetStatus(
1297 GPConnection * connection,
1299 const gsi_char statusString[GP_STATUS_STRING_LEN],
1300 const gsi_char locationString[GP_LOCATION_STRING_LEN]
1304#ifdef GP_NEW_STATUS_INFO
1305GPResult gpSetStatusInfo(
1306 GPConnection *connection,
1308 unsigned int hostIp,
1309 unsigned int hostPrivateIp,
1310 unsigned short queryPort,
1311 unsigned short hostPort,
1312 unsigned int sessionFlags,
1313 const gsi_char *richStatus,
1315 const gsi_char *gameType,
1317 const gsi_char *gameVariant,
1319 const gsi_char *gameMapName,
1323GPResult gpAddStatusInfoKey(GPConnection *connection,
const gsi_char *keyName,
const gsi_char *keyValue);
1324GPResult gpSetStatusInfoKey(GPConnection *connection,
const gsi_char *keyName,
const gsi_char *keyValue);
1325GPResult gpGetStatusInfoKeyVal(GPConnection *connection,
const gsi_char *keyName, gsi_char **keyValue);
1326GPResult gpDelStatusInfoKey(GPConnection *connection,
const gsi_char *keyName);
1328GPResult gpGetBuddyStatusInfoKeys(GPConnection *connection,
int index, GPCallback callback,
void *userData);
1332GPResult gpSendBuddyMessage(
1333 GPConnection * connection,
1335 const gsi_char * message
1340GPResult gpSendBuddyUTM(
1341 GPConnection * connection,
1343 const gsi_char * message,
1354GPResult gpIsValidEmail(
1355 GPConnection * connection,
1356 const gsi_char email[GP_EMAIL_LEN],
1358 GPCallback callback,
1364GPResult gpGetUserNicks(
1365 GPConnection * connection,
1366 const gsi_char email[GP_EMAIL_LEN],
1367 const gsi_char password[GP_PASSWORD_LEN],
1369 GPCallback callback,
1376GPResult gpSetInvitableGames(
1377 GPConnection * connection,
1379 const int * productIDs
1385GPResult gpFindPlayers(
1386 GPConnection * connection,
1389 GPCallback callback,
1395GPResult gpInvitePlayer(
1396 GPConnection * connection,
1399 const gsi_char location[GP_LOCATION_STRING_LEN]
1405GPResult gpGetReverseBuddies(
1406 GPConnection * connection,
1408 GPCallback callback,
1416GPResult gpGetReversBuddiesList( GPConnection * connection,
1417 GPProfile *targets,
int numOfTargets,
1419 GPCallback callback,
1425GPResult gpRevokeBuddyAuthorization(
1426 GPConnection * connection,
1432 GPConnection * connection,
1433 const gsi_char cdkeyhash,
1439GPResult gpGetLoginTicket(
1440 GPConnection * connection,
1441 char loginTicket[GP_LOGIN_TICKET_LEN]
1446GPResult gpSetQuietMode(
1447 GPConnection * connection,
1456void gpSetInfoCacheFilename(
1457 const gsi_char * filename
1463typedef void (* gpSendFilesCallback)(
1464 GPConnection * connection,
1466 const gsi_char ** path,
1467 const gsi_char ** name,
1471GPResult gpSendFiles(
1472 GPConnection * connection,
1473 GPTransfer * transfer,
1475 const gsi_char * message,
1476 gpSendFilesCallback callback,
1480GPResult gpAcceptTransfer(
1481 GPConnection * connection,
1482 GPTransfer transfer,
1483 const gsi_char * message
1486GPResult gpRejectTransfer(
1487 GPConnection * connection,
1488 GPTransfer transfer,
1489 const gsi_char * message
1492GPResult gpFreeTransfer(
1493 GPConnection * connection,
1497GPResult gpSetTransferData(
1498 GPConnection * connection,
1499 GPTransfer transfer,
1503void * gpGetTransferData(
1504 GPConnection * connection,
1508GPResult gpSetTransferDirectory(
1509 GPConnection * connection,
1510 GPTransfer transfer,
1511 const gsi_char * directory
1515GPResult gpSetTransferThrottle(
1516 GPConnection * connection,
1517 GPTransfer transfer,
1522GPResult gpGetTransferThrottle(
1523 GPConnection * connection,
1524 GPTransfer transfer,
1528GPResult gpGetTransferProfile(
1529 GPConnection * connection,
1530 GPTransfer transfer,
1534GPResult gpGetTransferSide(
1535 GPConnection * connection,
1536 GPTransfer transfer,
1540GPResult gpGetTransferSize(
1541 GPConnection * connection,
1542 GPTransfer transfer,
1546GPResult gpGetTransferProgress(
1547 GPConnection * connection,
1548 GPTransfer transfer,
1552GPResult gpGetNumFiles(
1553 GPConnection * connection,
1554 GPTransfer transfer,
1558GPResult gpGetCurrentFile(
1559 GPConnection * connection,
1560 GPTransfer transfer,
1565 GPConnection * connection,
1566 GPTransfer transfer,
1570GPResult gpGetFileName(
1571 GPConnection * connection,
1572 GPTransfer transfer,
1577GPResult gpGetFilePath(
1578 GPConnection * connection,
1579 GPTransfer transfer,
1584GPResult gpGetFileSize(
1585 GPConnection * connection,
1586 GPTransfer transfer,
1591GPResult gpGetFileProgress(
1592 GPConnection * connection,
1593 GPTransfer transfer,
1598GPResult gpGetFileModificationTime(
1599 GPConnection * connection,
1600 GPTransfer transfer,
1605GPResult gpGetNumTransfers(
1606 GPConnection * connection,
1610GPResult gpGetTransfer(
1611 GPConnection * connection,
1613 GPTransfer * transfer
1621void gpProfilesReport(
1622 GPConnection * connection,
1623 void (* report)(
const char * output)