// QLCommander.h: interface for the CQLCommander class.
|
//
|
//////////////////////////////////////////////////////////////////////
|
|
#if _MSC_VER > 1000
|
#pragma once
|
#endif // _MSC_VER > 1000
|
|
class CQLRequest;
|
class CQLResponse;
|
class CQLClientSocket;
|
class CQLClient;
|
class CQLConnect;
|
class CQLSession;
|
class CQLSysMsg;
|
|
#include "Event.h"
|
|
#define CMDER_TYPE_CMDER ( 0 )
|
#define CMDER_TYPE_PROGRESS ( 1 )
|
|
#define BUFFSIZE (1024 ) // ( 65536 )
|
|
class AFX_EXT_CLASS CQLCommander
|
{
|
public:
|
friend class CQLClient;
|
|
CQLCommander();
|
virtual ~CQLCommander();
|
|
// Attributers
|
public:
|
CQLManualResetEvent m_Event;
|
CQLManualResetEvent m_EventClose;
|
|
CString m_strMethod;
|
long m_nTrID;
|
|
CString m_strServerName;
|
long m_nServerPort;
|
int m_nType;
|
|
CQLClient *m_pClient;
|
CQLConnect *m_pConnect;
|
CQLSession *m_pSession;
|
CQLSysMsg *m_pSysMsg;
|
|
CPtrList m_listSocket; // CQLClientSocket Á´±í
|
|
BOOL m_bIsCancel; // Is Canceled
|
|
protected:
|
#ifdef _UNICODE
|
BYTE m_bTrunc; // Lineת»»ºóÁôϵÄ(ÔÚLinedÖ®ºó£©
|
BOOL m_bHaveTrunc;
|
#endif
|
|
// Operations
|
public:
|
void SetOIClient( CQLClient *pClient );
|
void SetOIConnect( CQLConnect *pConnect );
|
void SetOISession( CQLSession *pSession );
|
void SetOISysMsg( CQLSysMsg *pSysMsg );
|
void SetMethod( CString strMethod );
|
|
virtual void OnConnected( CQLClientSocket *pSocket ); // Á¬½Ó
|
virtual BOOL OnResponse( CQLResponse *pResponse, CQLClientSocket *pSocket ); // ½ÓÊÕ
|
virtual BOOL RecvBuf( CQLRequest *pRequest ); // ·¢ËÍÊý¾Ý£¬È總¼þ
|
|
virtual void OnConnectionErr( CQLClientSocket *pSocket, int nErrorCode ); // Á¬½Ó³ö´í
|
virtual void OnValidateErr( CQLClientSocket *pSocket, int nErrCode ); // ¼ìÑé³ö´í
|
virtual void OnConnectedClosed( CQLClientSocket *pSocket ); // Á¬½Ó¹Ø±Õ
|
virtual void OnSndCmdComplete(CQLRequest *pRequest); // ·¢ËÍÃüÁî³É¹¦
|
|
void SetCancel( BOOL bCancel = true ) { m_bIsCancel = bCancel; }
|
BOOL IsCancel() { return m_bIsCancel; }
|
bool CreateRequestBySysMsg( CQLClientSocket *pSocket );
|
BOOL OnValidateResponse( CQLResponse *pResponse, CQLClientSocket *pSocket );
|
|
void FreeAllSocket();
|
|
protected:
|
CString ResponseBody( CQLResponse *pResponse );
|
|
private:
|
// void FreeAllSocket();
|
void RemoveSocket( CQLClientSocket *pSocket );
|
void AddSocket( CQLClientSocket *pSocket );
|
};
|