Main Page | Modules | File List | File Members

MSClientClass.h

00001 #ifndef _MSCLIENTCLASS_H_
00002 #define _MSCLIENTCLASS_H_
00003 
00004 #include "GSTypes.h"
00005 #include "GSClientClass.h"
00006 //#include "GSLobbyCB.h"
00007 //#include "GSLoginCB.h"
00008 #include "define.h"
00009 
00010 class LobbyInfo;
00011 class GameServerMap;
00012 class LobbyInfoList;
00013 
00014 #define NOSTATE 0
00015 #define LOGIN_MASK (1L<<0)
00016 #define LOBBY_MASK (1L<<1)
00017 #define JOIN_MASK (1L<<2)
00018 #define REFRESH_MASK (1L<<3)
00019 #define ALTINFO_MASK (1L<<4)
00020 
00021 class clMSClientClass : private clGLClient
00022 {
00023         public:
00024                 clMSClientClass();
00025                 ~clMSClientClass();
00026 
00027                 GSbool Initialize(const GSchar *szMasterServerIP,
00028                                 GSushort usMasterServerPort,const GSchar *szUserName,
00029                                 const GSchar *szPassword, const GSchar *szVersion);
00030                 GSbool Uninitialize();
00031                 GSbool RequestGameServers(const GSchar *szGameName);
00032                 GSbool RefreshGameServer(GSint iLobbyID,GSint iRoomID);
00033                 GSbool RequestAlternateInfo(GSint iLobbyID,GSint iRoomID);
00034                 GSbool JoinGameServer(GSint iLobbyID,GSint iRoomID,const GSchar *szPassword,
00035                                 const GSchar *szVersion, const GSchar *szGameName,
00036                                 const GSvoid *pvPlayerInfo, GSint iPlayerInfoSize);
00037                 GSbool LeaveGameServer(GSint iLobbyID,GSint iRoomID);
00038                 GSbool GameServerConnected(GSint iLobbyID,GSint iRoomID);
00039                 
00040                 GSbool CreateAccount(const GSchar *szMasterServerIP,
00041                                 GSushort usMasterServerPort,const GSchar* szVersion,
00042                                 const GSchar* szNickName,const GSchar* szPassword,
00043                                 const GSchar* szFirstName,const GSchar* szLastName,
00044                                 const GSchar* szEmail,const GSchar* szCountry);
00045                 GSbool ModifyAccount(const GSchar* szPassword, const GSchar* szFirstName,
00046                                 const GSchar* szLastName, const GSchar* szEmail,
00047                                 const GSchar* szCountry);
00048 
00049                 GSbool InitMatchResult(GSuint uiMatchID);
00050                 GSbool SetMatchResult(GSchar* szAlias,GSuint uiFieldID,GSint iFieldValue);
00051                 GSbool SubmitMatchResult(GSint iLobbyID,GSint iRoomID);
00052                 GSbool UninitMatchResult();
00053                 GSbool MatchStarted(GSint iLobbyID,GSint iRoomID);
00054                 GSbool MatchFinished(GSint iLobbyID,GSint iRoomID);
00055 
00056                 GSbool RequestMOTD(const GSchar* szLanguage);
00057 
00058                 GSbool Engine(GSuint uiMaxPostingDelay = 500,
00059                                 GSuint uiMaxsOperationalDelay = 800);
00060 
00061                 //Callbacks
00062                 virtual GSvoid GameServerCB(GSint iLobbyID,GSint iRoomID,GSshort siGroupType,
00063                                 GSchar *szGroupName,GSint iConfig,GSchar *szMaster,GSchar *szAllowedGames,
00064                                 GSchar *szGames,GSchar *szGameVersion,GSchar *szGSVersion,GSvoid *vpInfo,
00065                                 GSint iSize,GSuint uiMaxPlayer,GSuint uiNbrPlayer,GSuint uiMaxVisitor,
00066                                 GSuint uiNbrVisitor,GSchar *szIPAddress,GSchar *szAltIPAddress,
00067                                 GSint iEventID) = 0;
00068                 virtual GSvoid ErrorCB(GSint iReason,GSint iLobbyID,GSint iRoomID) = 0;
00069                 virtual GSvoid InitFinishedCB(GSubyte ucType,GSint iError,GSchar *szUserName) = 0;
00070                 virtual GSvoid LoginDisconnectCB() = 0;
00071                 virtual GSvoid LobbyDisconnectCB() = 0;
00072                 virtual GSvoid RequestFinishedCB() = 0;
00073                 virtual GSvoid JoinFinishedCB(GSint iLobbyID,GSint iRoomID,
00074                                 GSvoid *vpGameData,GSint iSize,GSchar *szIPAddress,
00075                                 GSchar *szAltIPAddress,GSushort usPort) = 0;
00076                 virtual GSvoid AlternateInfoCB(GSint iLobbyID,GSint iRoomID,
00077                                 const GSvoid* pcAltGroupInfo,GSint iAltGroupInfoSize) = 0;
00078 
00079                 
00080                 virtual GSvoid AccountCreationCB(GSubyte ucType, GSint iReason) = 0;
00081                 virtual GSvoid ModifyAccountCB(GSubyte ucType, GSint iReason) = 0;
00082 
00083                 virtual GSvoid MatchStartedCB(GSint iLobbyID,GSint iRoomID,GSuint uiMatchID) = 0;
00084                 virtual GSvoid SubmitMatchCB(GSubyte ucType,GSint iReason,
00085                                 GSuint uiMatchID) = 0;
00086 
00087                 virtual GSvoid RequestMOTDCB(GSubyte ubType, GSchar *szUbiMOTD,
00088                         GSchar *szGameMOTD, GSint iReason)=0;
00089 
00090         //Ignore the rest of these functions
00091         public:
00092                 GSvoid LobbyRcv_LoginReply(GSubyte ucType, GSint iReason);
00093                 GSvoid LobbyRcv_LobbyDisconnection(GSint iLobbySrvID);
00094                 GSvoid LobbyRcv_LobbyDisconnectAll();
00095                 GSvoid LobbyRcv_CreateRoomReply(GSubyte ucType, GSint iReason,
00096                                 GSchar *pszRoom, GSint iGroupID,GSint iLobbySrvID){};
00097                 GSvoid LobbyRcv_JoinLobbyReply(GSubyte ucType, GSint iReason,
00098                                 GSchar *szReason,GSint iGroupID,GSint iLobbySrvID);
00099                 GSvoid LobbyRcv_JoinRoomReply(GSubyte ucType, GSint iReason,
00100                                 GSchar *szReason,GSint iGroupID,GSint iLobbySrvID);
00101                 GSvoid LobbyRcv_NewRoom(GSshort siGroupType,GSchar *pszGroupName,
00102                                                 GSint iGroupID,GSint iLobbySrvID,GSint iParentID,
00103                                                 GSint iConfig, GSshort siGroupLevel,
00104                                                 GSchar *pszMaster, GSchar *pszAllowedGames,
00105                                                 GSchar *pszGames,GSchar *pszGameVersion,GSchar *pszGSVersion,
00106                                                 GSvoid *vpInfo,GSint iSize,
00107                                                 GSuint usMaxPlayer, GSuint usNbrPlayer,
00108                                                 GSuint usMaxVisitor, GSuint usNbrVisitor,
00109                                                 GSchar *szIPAddress,GSchar *szAltIPAddress,GSint iEventID);
00110                 GSvoid LobbyRcv_NewLobby(GSshort siGroupType,GSchar *pszGroupName,
00111                                                 GSint iGroupID,GSint iLobbySrvID,GSint iParentID,
00112                                                 GSint iConfig, GSshort siGroupLevel,
00113                                                 GSchar *pszMaster, GSchar *pszAllowedGames,
00114                                                 GSchar *pszGames,GSvoid *vpInfo,GSint iSize,
00115                                                 GSuint usMaxMember, GSuint usNbrMember,GSint iEventID);
00116                 GSvoid LobbyRcv_RoomInfo(GSshort siGroupType,GSchar *pszGroupName,
00117                                                 GSint iGroupID,GSint iLobbySrvID,GSint iParentID,
00118                                                 GSint iConfig, GSshort siGroupLevel,
00119                                                 GSchar *pszMaster, GSchar *pszAllowedGames,
00120                                                 GSchar *pszGames,GSchar *pszGameVersion,GSchar *pszGSVersion,
00121                                                 GSvoid *vpInfo,GSint iSize,
00122                                                 GSuint usMaxPlayer, GSuint usNbrPlayer,
00123                                                 GSuint usMaxVisitor, GSuint usNbrVisitor,
00124                                                 GSchar *szIPAddress,GSchar *szAltIPAddress,GSint iEventID);
00125                 GSvoid LobbyRcv_LobbyInfo(GSshort siGroupType,GSchar *pszGroupName,
00126                                                 GSint iGroupID,GSint iLobbySrvID,GSint iParentID,
00127                                                 GSint iConfig, GSshort siGroupLevel,
00128                                                 GSchar *pszMaster, GSchar *pszAllowedGames,
00129                                                 GSchar *pszGames,GSvoid *vpInfo,GSint iSize,
00130                                                 GSuint usMaxMember, GSuint usNbrMember,GSint iEventID);
00131                 GSvoid LobbyRcv_GroupInfoGet(GSubyte ucType, GSint iLobbyID,
00132                                 GSint iRoomID);
00133 
00134                 GSvoid LobbyRcv_GroupRemove(GSint iGroupID,GSint iLobbySrvID){};
00135 
00136                 GSvoid LobbyRcv_MemberJoined(GSchar *szAlias,GSbool bVisitor,
00137                                 GSint* iGroupID,GSushort usNbGroup,GSint iLobbySrvID,
00138                                 GSchar *szIPAddress,GSchar *szAltIPAddress,GSushort usPing,
00139                                 GSvoid *vpPlayerData,GSint iDataSize,GSbool bJoin,
00140                                 GSushort usPlayerStatus){};
00141                 GSvoid LobbyRcv_MemberLeave(GSchar *szAlias,GSint iGroupID,
00142                                 GSint iLobbySrvID){};
00143 
00144                 GSvoid LobbyRcv_StartMatchReply(GSubyte ucType, GSint iReason,
00145                                 GSint iGroupID,GSint iLobbySrvID){};
00146 
00147                 GSvoid LobbyRcv_MasterNewReply(GSubyte ucType, GSint iReason,
00148                                 GSchar *szAlias,GSint iGroupID,GSint iLobbyServerID){};
00149                 GSvoid LobbyRcv_MasterChanged(GSint iGroupID,GSint iLobbySrvID ,
00150                                 GSchar *szAlias,GSchar *szIPAddress,GSchar *szAltIPAddress){};
00151 
00152                 GSvoid LobbyRcv_MatchFinishReply(GSubyte ucType, GSint iReason,
00153                                 GSint iGroupID,GSint iLobbySrvID){};
00154 
00155     GSvoid LobbyRcv_KickOut(GSint iGroupID,GSint iLobbySrvID,GSchar *szReason){};
00156                 GSvoid LobbyRcv_PlayerKickReply(GSubyte ucType, GSint iReason,
00157                                 GSchar *szAlias,GSint iGroupID,GSint iLobbyServerID){};
00158                 GSvoid LobbyRcv_ParentGroupIDReply(GSubyte ucType, GSint iReason,
00159                         GSint iGroupID,GSint iLobbySrvID, GSint iParentGroupID){};
00160                 GSvoid LobbyRcv_GroupLeaveReply(GSubyte ucType, GSint iReason,
00161                                 GSint iGroupID,GSint iLobbySrvID){};
00162                 GSvoid LobbyRcv_GroupConfigUpdate(GSint iGroupID,GSint iLobbySrvID,
00163                                 GSint iFlags){};
00164                 GSvoid LobbyRcv_MatchStarted(GSint iGroupID,GSint iLobbyServerID,
00165                                 GSuint uiMatchID);
00166                 GSvoid LobbyRcv_GroupConfigUpdateReply(GSubyte ucType, GSint iReason,
00167                                 GSint iGroupID,GSint iLobbySrvID){};
00168                 GSvoid LobbyRcv_SubmitMatchResultReply(GSubyte ucType, GSint iReason,
00169                                 GSint iMatchID);
00170                 GSvoid LobbyRcv_UpdatePing(GSint iGroupID,GSint iLobbySrvID,GSchar *szAlias,
00171                                 GSushort usPing){};
00172 
00173                 GSvoid LobbyRcv_StartGameReply(GSubyte ucType, GSint iReason,GSint iGroupID,
00174                                 GSint iLobbySrvID){};
00175                 GSvoid LobbyRcv_GameReadyReply(GSubyte ucType, GSint iReason,GSint iGroupID,
00176                                 GSint iLobbySrvID){};
00177                 GSvoid LobbyRcv_GameStarted(GSint iGroupID,GSint iLobbyServerID,
00178                                                                                    GSvoid *vpGameData,GSint iSize,GSchar *szIPAddress,
00179                                                                                    GSchar *szAltIPAddress,GSushort usPort);
00180                 GSvoid LobbyRcv_NewGameMember(GSint iGroupID,GSint iLobbyServerID,
00181                                 GSchar *szAlias,GSbool bVisitor){};
00182 
00183                 GSvoid LobbyRcv_UpdateGameInfoReply(GSubyte ucType, GSint iReason,
00184                                 GSint iGroupID,GSint iLobbySrvID){};
00185                 GSvoid LobbyRcv_PlayerBanReply(GSubyte ucType, GSint iReason,
00186                                 GSint iGroupID,GSint iLobbySrvID,GSchar *szAlias){};
00187                 GSvoid LobbyRcv_PlayerUnBanReply(GSubyte ucType, GSint iReason,
00188                                 GSint iGroupID,GSint iLobbySrvID,GSchar *szAlias){};
00189                 GSvoid LobbyRcv_PlayerBanList(GSint iGroupID,GSint iLobbySrvID,
00190                                 GSchar *szAlias){};
00191                 GSvoid LobbyRcv_PlayerBanned(GSint iGroupID,GSint iLobbySrvID,
00192                                 GSchar *szReason){};
00193                 GSvoid LobbyRcv_MatchReady(GSint iGroupID,GSint iLobbySrvID){};
00194                 GSvoid LobbyRcv_InfoRefresh(GSint iLobbySrvID){};
00195 
00196                 GSvoid LobbyRcv_SetPlayerInfoReply(GSubyte ucType, GSint iReason){};
00197                 GSvoid LobbyRcv_PlayerInfoUpdate(GSchar *szAlias,GSvoid *vpPlayerData,
00198                                 GSint iPlayerDataSize){};
00199                 GSvoid LobbyRcv_PlayerGroupList(GSchar *szAlias,GSint iGroupID,
00200                                 GSint iLobbySrvID){};
00201                 GSvoid LobbyRcv_PlayerUpdateStatus(GSchar* szMember,
00202                                 GSushort usPlayerStatus){};
00203                 GSvoid LobbyRcv_FinalMatchResults(GSuint uiMatchId, GSubyte ucType, GSint iReason, const LADDER_ROW *pResults, GSuint uiNumResult){};
00204                 
00205                 GSvoid LobbyRcv_GetAlternateGroupInfoReply(GSubyte ucType, GSint iReason,
00206                                 const GSvoid* pcAltGroupInfo,GSint iAltGroupInfoSize, GSint iGroupID,
00207                                 GSint iLobbyServerID );
00208 
00209         public:
00210 
00211                 GSvoid LoginRcv_PlayerInfo(GSubyte ucType, GSchar * pszNickName,
00212                         GSchar * pszSurName, GSchar * pszFirstName, GSchar * pszCountry,
00213                         GSchar * pszEmail, GSchar * szIRCID, GSchar * szIPAddress,GSint lReason );
00214                 GSvoid LoginRcv_JoinWaitModuleResult(GSubyte ucType, GSchar * pszAddress,
00215                                 GSushort lPort, GSint lReason);
00216                 GSvoid LoginRcv_LoginRouterResult(GSubyte ucType, GSint lReason);
00217                 GSvoid LoginRcv_LoginWaitModuleResult(GSubyte ucType, GSint lReason);
00218                 GSvoid LoginRcv_SystemPage(GSint lSubType, GSchar * pszText);
00219                 GSvoid LoginRcv_LoginDisconnection();
00220                 GSvoid LoginRcv_AccountCreationResult(GSubyte ucType, GSint lReason);
00221                 GSvoid LoginRcv_ModifyUserResult(GSubyte ucType, GSint lReason);
00222                 
00223                 GSvoid LoginRcv_RequestMOTD(GSubyte ubType, GSchar *szUbiMOTD,GSchar *szGameMOTD, GSint iReason);
00224                 
00225         public:
00226                 GSvoid FriendsRcv_LoginResult(GSubyte ucType, GSint lReason){};
00227                 GSvoid FriendsRcv_AddFriend(GSubyte ucType, GSint lReason,
00228                                 GSchar* pszFriend){};
00229                 GSvoid FriendsRcv_DelFriend(GSubyte ucType, GSint lReason,
00230                                 GSchar* pszFriend){};
00231                 GSvoid FriendsRcv_GetSession(GSubyte ucType, GSint lReason,
00232                                 GSchar* pszPlayer,GSchar* pszSession, GSint lGroupID, GSint lParentID,
00233                                 GSint lMaxPlayers, GSint lMaxVisitors,GSint lNbPlayers,
00234                                 GSint lNbVisitors,GSchar* szMaster, GSint lConfig, GSchar* szInfo,
00235                                 GSchar* szGame){};
00236                 GSvoid FriendsRcv_GetWebBased(GSchar* pszPlayer,
00237                                 GSchar* pszWebBasedURL){};
00238                 GSvoid FriendsRcv_Page(GSchar* pszAlias, GSchar* pszMessage,
00239                                 GSchar* pszTimeStamp){};
00240                 GSvoid FriendsRcv_PagePlayer(GSubyte ucType, GSint lReason,
00241                                 GSchar* pszReceiver){};
00242                 GSvoid FriendsRcv_PeerMsg(GSchar* pszAlias, GSvoid* p_Buffer,
00243                                 GSuint uiLength){};
00244                 GSvoid FriendsRcv_PeerPlayer(GSubyte ucType, GSint lReason,
00245                                 GSchar* pszReceiver){};
00246                 GSvoid FriendsRcv_ChangeFriend(GSubyte ucType, GSint lReason){};
00247                 GSvoid FriendsRcv_StatusChange(GSubyte ucType, GSint lReason){};
00248                 GSvoid FriendsRcv_UpdateFriend(GSchar* pszFriend, GSint lStatus,
00249                                 GSchar* pszGroup, GSint lMood, GSint lOptions, GSchar *szGameName){};
00250                 GSvoid FriendsRcv_SearchPlayer(GSubyte ucType, GSint lReason,
00251                                 GSchar* pszAlias, GSint lStatus, GSchar *szGameName){};
00252                 GSvoid FriendsRcv_ScoreCard(GSubyte ucType, GSint lReason,
00253                                 GSchar* pszPlayer,GSchar* pszGame, GSchar* pszScore){};
00254                 GSvoid FriendsRcv_IgnorePlayer(GSRESULT rCode,const GSchar * szPlayer){};
00255                 GSvoid FriendsRcv_UnignorePlayer(GSRESULT rCode,const GSchar * szPlayer){};
00256                 GSvoid FriendsRcv_IgnoredPlayer( const GSchar * szPlayer ){};
00257                 GSvoid FriendsRcv_ListIgnoredPlayers( GSRESULT rCode ){};
00258                 
00259         public:
00260         GSvoid PSRcv_LoginResult(GSubyte, GSint) {}
00261         GSvoid PSRcv_Disconnection() {}
00262         GSvoid PSRcv_GetDataReply(GSubyte, GSint, GSuint, GSvoid *, GSint) {}
00263         GSvoid PSRcv_SetDataReply(GSubyte, GSint, GSuint) {}
00264         
00265                 public:
00266                 GSvoid LadderQueryRcv_RequestReply(GSubyte ucType, GSint  iReason,
00267                                 GSuint uiRequestId){};
00268                 
00269         private:
00270 
00271                 GSbool StartLogin();
00272                 GSbool LobbyDisconnect();
00273                 GSbool LobbyConnect();
00274 
00275                 GSchar m_szUsername[NICKNAMELENGTH];
00276                 GSchar m_szPassword[PASSWORDLENGTH];
00277                 GSchar m_szVersion[VERSIONLENGTH];
00278                 GSchar m_szRouterIP[IPADDRESSLENGTH];
00279                 GSushort m_usPort;
00280 
00281                 GSchar m_szGameType[GAMELENGTH];
00282 
00283                 //GSint m_iState;
00284                 GSsize_t m_uiTimeOut;
00285 
00286                 LobbyInfo *m_pstTargetLobby;
00287                 GSvoid *m_pvPlayerInfo;
00288                 GSint m_iPlayerInfoSize;
00289 
00290                 //LobbyInfoList *m_pstRequestedRefresh;
00291                 //LobbyInfoList *m_pstRefreshList;
00292 
00293                 //LobbyInfoList *m_pstRequestedAltInfo;
00294                 //LobbyInfoList *m_pstAltInfoList;
00295                 
00296                 LobbyInfoList *m_pstBasicGroups;
00297 
00298                 //GameServerMap *m_pstGameServers;
00299                 //GSuint m_uiUniqueID;
00300 
00301                 //GSbool m_bJoinLobbyOnce;
00302                 //GSbool m_bJoinRoomOnce;
00303                 
00304                 GSbool m_bReqestingServers;
00305                 //GSbool m_bRefreshingServers;
00306                 GSbool m_bJoinedServer;
00307                 GSbool m_bJoiningServer;
00308                 
00309                 GSbool m_bLobbyConnected;
00310 };
00311 #endif //_MSCLIENTCLASS_H_

Ubi.com GameService SDK - ©UbiSoft Entertainment 2002
GameService development team