forked from metin2/client
86 lines
2.3 KiB
C
86 lines
2.3 KiB
C
|
#pragma
|
|||
|
|
|||
|
#include "../EterLib/NetStream.h"
|
|||
|
#include "../EterLib/FuncObject.h"
|
|||
|
|
|||
|
class CAccountConnector : public CNetworkStream, public CSingleton<CAccountConnector>
|
|||
|
{
|
|||
|
public:
|
|||
|
enum
|
|||
|
{
|
|||
|
STATE_OFFLINE,
|
|||
|
STATE_HANDSHAKE,
|
|||
|
STATE_AUTH,
|
|||
|
};
|
|||
|
|
|||
|
public:
|
|||
|
CAccountConnector();
|
|||
|
virtual ~CAccountConnector();
|
|||
|
|
|||
|
void SetHandler(PyObject* poHandler);
|
|||
|
void SetLoginInfo(const char * c_szName, const char * c_szPwd);
|
|||
|
void ClearLoginInfo( void );
|
|||
|
|
|||
|
bool SendChinaMatrixCardPacket(const char * c_szMatrixCardString);
|
|||
|
bool SendRunupMatrixCardPacket(const char * c_szMatrixCardString);
|
|||
|
bool SendNEWCIBNPasspodAnswerPacket(const char * answer);
|
|||
|
|
|||
|
bool Connect(const char * c_szAddr, int iPort, const char * c_szAccountAddr, int iAccountPort);
|
|||
|
void Disconnect();
|
|||
|
void Process();
|
|||
|
|
|||
|
protected:
|
|||
|
void OnConnectFailure();
|
|||
|
void OnConnectSuccess();
|
|||
|
void OnRemoteDisconnect();
|
|||
|
void OnDisconnect();
|
|||
|
|
|||
|
protected:
|
|||
|
void __Inialize();
|
|||
|
bool __StateProcess();
|
|||
|
|
|||
|
void __OfflineState_Set();
|
|||
|
void __HandshakeState_Set();
|
|||
|
void __AuthState_Set();
|
|||
|
|
|||
|
bool __HandshakeState_Process();
|
|||
|
bool __AuthState_Process();
|
|||
|
|
|||
|
bool __AuthState_RecvEmpty();
|
|||
|
bool __AuthState_RecvPhase();
|
|||
|
bool __AuthState_RecvHandshake();
|
|||
|
bool __AuthState_RecvPing();
|
|||
|
bool __AuthState_SendPong();
|
|||
|
bool __AuthState_RecvAuthSuccess();
|
|||
|
#ifdef USE_OPENID
|
|||
|
bool __AuthState_RecvAuthSuccess_OpenID();
|
|||
|
#endif /* USE_OPENID */
|
|||
|
bool __AuthState_RecvAuthFailure();
|
|||
|
bool __AuthState_RecvChinaMatrixCard();
|
|||
|
bool __AuthState_RecvRunupMatrixQuiz();
|
|||
|
bool __AuthState_RecvNEWCIBNPasspodRequest();
|
|||
|
bool __AuthState_RecvPanamaPack();
|
|||
|
bool __AuthState_RecvHybridCryptKeys(int VarSize);
|
|||
|
bool __AuthState_RecvHybridCryptSDB(int VarSize);
|
|||
|
|
|||
|
bool __AnalyzePacket(UINT uHeader, UINT uPacketSize, bool (CAccountConnector::*pfnDispatchPacket)());
|
|||
|
// TODO: <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ӽô<D3BD>. header<65>ڿ<EFBFBD> size 4byte<74><65> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>´ٴ<C2B4> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ϸ<EFBFBD><CFB7><EFBFBD> Packet System Refactoring<6E>ؾ<EFBFBD> <20>Ѵ<EFBFBD>.
|
|||
|
bool __AnalyzeVarSizePacket(UINT uHeader, bool (CAccountConnector::*pfnDispatchPacket)(int));
|
|||
|
|
|||
|
protected:
|
|||
|
UINT m_eState;
|
|||
|
std::string m_strID;
|
|||
|
std::string m_strPassword;
|
|||
|
|
|||
|
std::string m_strAddr;
|
|||
|
int m_iPort;
|
|||
|
BOOL m_isWaitKey;
|
|||
|
|
|||
|
PyObject * m_poHandler;
|
|||
|
|
|||
|
// CHINA_CRYPT_KEY
|
|||
|
void __BuildClientKey_20050304Myevan();
|
|||
|
// END_OF_CHINA_CRYPT_KEY
|
|||
|
};
|