///************************************************************************/ /* Copyright (C), 2016-2020, [IT], 保留所有权利; /* 模 块 名:; /* 描 述:; /* /* 版 本:[V]; /* 作 者:[IT]; /* 日 期:[2/23/2016]; /* /* /* 注 意:; /* /* 修改记录:[IT]; /* 修改日期:; /* 修改版本:; /* 修改内容:; /************************************************************************/ #ifndef __CLIENT_PROCESS_20151021__ #define __CLIENT_PROCESS_20151021__ #pragma once #include #include "SocketHandle.h" #include "Client2SrvType.h" #include "CritSection.h" typedef struct _MSG_INFO_ { TString strMessage; TString strIPAddress; SOCKET nSocket; INT wMessageLen; DWORD dwUserId; BYTE *pData; // work9使用; _MSG_INFO_& operator=(const _MSG_INFO_& another) { if ( &another == this ) { return *this; } strIPAddress = another.strIPAddress; strMessage = another.strMessage; nSocket = another.nSocket; wMessageLen = another.wMessageLen; dwUserId = another.dwUserId; pData = another.pData; return *this; } _MSG_INFO_() { strIPAddress = _T(""); strMessage = _T(""); nSocket = -1; wMessageLen = 0; dwUserId = 0; pData = NULL; } }MsgInfo, *pMsgInfo; typedef struct __MAC_ADDRESS__ { //INT nNICKind; TCHAR szNICKind[16]; TCHAR szMacAddress[MAX_PATH]; //TCHAR szDevicePath[MAX_PATH]; }MacAddress, *pMacAddress; typedef struct __STANTI_THEFT__ { CString strDetail; CString strStudioVer; // 软件版本; CString strStudioName; // 影楼名称; CString strStudioPhone; // 影楼电话; CString strStudioAddress; // 影楼地址; CString strStudioWebSite; // 影楼网站; CString strStudioManager; // 影楼店长; CString strStudioDomain; // 影楼域名; DWORD dwStudioOrderCount; // 影楼订单数; DWORD dwStudioHistoryOrderCount; // 影楼历史订单数; std::vector vtMacAddress; std::vector vtHardDiskID; }STAntiTheft, *pSTAntiTheft; typedef struct __SQLOPT__ { TString strStatement; TString strExecTime; }SQLOpt, *pSQLOpt; typedef struct __DataOpt__ { DWORD dwCount; TString strExecTime; }DataOpt, *pDataOpt; typedef struct __AntiTheftOpt__ { BOOL bSQL_Opt; BOOL bData_Opt; std::vector vtSQLOpt; }STAntiTheftOpt, *pSTAntiTheftOpt; class CClientProcess { CClientProcess(void); public: ~CClientProcess(void); static CClientProcess* GetInstance() { static CClientProcess* pInstance = NULL; if ( pInstance == NULL ) { pInstance = new CClientProcess; } return pInstance; } static DWORD net_Send(IN CSocketHandle* pSH, IN void *pHeader, IN void *pMessage, IN unsigned long ulDataLen); void ClientProcess( IN const SOCKET sClient, IN const BYTE* pbData, IN DWORD dwCount, IN LPCTSTR lpaddr, IN BYTE** PendingBuf, IN UINT &nPendingSize, IN UINT &nCurSize); DWORD m_dwOverBuffer; DWORD m_dwOverIndex; BYTE *m_pOverBuffer; public: // case 6; static BOOL Work_No6(IN TString& strContent, IN LPCTSTR lpIPAddress); static BOOL Work_No7(OUT TString& strBranchId); static BOOL Work_No8(IN TString& strContent, OUT INT& ArySize, OUT BYTE** pAryData, OUT DWORD& dwAryDataSize); static BOOL Work_No9(OUT TString& strContent, IN BYTE* pData, IN CONST INT &nMessageLen); static BOOL Work_No10(IN LPCTSTR lpIPAddress, IN TString& strContent); static BOOL Work_No11(IN TString& strContent); static BOOL Work_No12(IN TString& strContent); static BOOL Work_No13(IN TString& strContent); static BOOL Work_No14(IN TString& strContent); static BOOL Work_No15(IN TString& strContent); static BOOL Work_No16(IN LPCTSTR lpIPAddress, IN TString& strContent); static BOOL Work_No17(IN LPCTSTR lpIPAddress, IN BYTE* pData, IN const DWORD& dwLen, OUT BYTE** pSendData, OUT DWORD& dwSendSize); static INT Work_No18(IN LPCTSTR lpIPAddress, IN TString& strContent); // -1:表示失败; 0:表示新增; 其他>0表示自增列id; static DWORD WorkSendInfo( IN CONST SOCKET& nSock, IN TString &strIPAddr, IN const DWORD& dwUserId, IN CONST INT& wMessageLen, IN TString &strInfo, OUT INT& ArySize, OUT BYTE** pAryData, OUT DWORD& dwAryDataSize ); public: static list m_listMsgInfo; // 保护连接池的临界区; static CRITICAL_SECTION m_csMsgInfo; // 从尾部插入一条信息; static void InsertMsgInfo(IN MsgInfo& msgInfo); // 从头部取出一条信息; static BOOL PopMsgInfo(IN MsgInfo& msgInfo); HANDLE m_hThread; HANDLE m_hEvent; static DWORD WINAPI MsgThread(LPVOID lpParam); HANDLE m_hThread2; HANDLE m_hEvent2; void StartMsgWork(); void EndOfMsgWork(); }; #endif