00001
00002
00004
00010 #ifndef _CUPDATECORE_H
00011 #define _CUPDATECORE_H
00012
00013 #include "common/PHSocket.h"
00014 #include "PHGlobal.h"
00015
00017
00019 class CUpdateBase
00020 {
00021 public:
00023 CUpdateBase()
00024 {
00025 bNeed_connect = true;
00026 tmLastSend = 0;
00027 }
00028
00030 PHGlobal phglobal;
00031
00033 int step();
00034
00036 void stop();
00037 protected:
00039
00072 virtual void OnStatusChanged(int status, long data) = 0;
00074 virtual void OnDomainRegistered(std::string domain){}
00076 virtual void OnUserInfo(std::string userInfo){}
00078 virtual void OnAccountDomainInfo(std::string domainInfo){}
00079 private:
00081 CPHSocket m_tcpsocket,m_udpsocket;
00083 bool InitializeSockets();
00085 bool DestroySockets();
00087 int ExecuteUpdate();
00089 bool BeginKeepAlive();
00091 bool SendKeepAlive(int opCode);
00093 int RecvKeepaliveResponse();
00095 bool bNeed_connect;
00097 long tmLastSend;
00098 };
00099 #endif