?? data.h
字號:
#if !defined(__GWcom_Inc_IOD_Service_Global_Include_h_20011203__)
#define __GWcom_Inc_IOD_Service_Global_Include_h_20011203__
#include "stdafx.h"
#include "log.h"
// cofiguration information
#define IOD_Cfg_File "TYDZ.ini"
// monitor file
#define MONITOR_File "STA.log"
typedef struct _tag_Config_Info
{
// Router
UINT nRouterPort;
TCHAR szRouterIP[20];
// Service
TCHAR szServiceID[7];
UINT nServicePort;
TCHAR szServiceIP[20];
// Dispatcher
UINT nDispatcherPort;
TCHAR szDispatcherIP[20];
// thread's count
UINT nRecThread;
UINT nWorkThread;
UINT nSendThread;
// max retry send time
UINT nMaxRetryTime;
UINT nRetryInterval;
// Log
TCHAR szLogFolder[MAX_PATH];
TCHAR szLogModule[64];
TCHAR szLogServer[64];
}Config_Info;
typedef struct tag_CommonInfo
{
CString szMobile;
int nProvince;
int nArea;
CString szHotline;
CString szEntryno;
CString szGWID;
}COMMONINFO, *LPCOMMONINFO;
// IOD information struction
#define MAX_CONTENT_LEN 1024
typedef struct _tag_IOD_Info
{
// decode from gateway
TCHAR szDestMobile[20];
ULONG lMsgLevel;
TCHAR szSubID[11];
TCHAR szSrcTermID[22];
TCHAR szSrcGWID[7];
ULONG lMsgFmt;
ULONG lMsgLen;
TCHAR szContent[MAX_CONTENT_LEN + 1];
ULONG lMsgType;
// send fee
TCHAR szFeeMP[20]; // 計費手機號,原ICPSConn的pszAtTime字段
TCHAR szFeeType[3];
TCHAR szFeeCode[7];
// process life & time
USHORT nLife;
ULONG lTime;
// service's info
TCHAR szServiceIP[20];
UINT nServicePort;
}IOD_Info, *LPIOD_Info;
// 產品信息
typedef struct tag_ProductInfo
{
int nOperate;
int nType;
CString szName;
CString szSQL;
CString szPushType;
CString szTime1;
CString szTime2;
CString szParam1;
CString szParam2;
int nChannel;
int nSedFlag;
}PRODUCTINFO, *LPPRODUCTINFO;
// MISC信息
typedef struct tag_MISCMsg
{
CString szFeeType;
CString szSubID;
CString szContent;
}MISCMSG, *LPMISCMSG;
typedef list<MISCMSG> MISCMSGLIST, *LPMISCMSGLIST;
// 返回語
typedef struct tag_OutputMsg
{
int nType;
CString szMsg;
CString szSendNo;
CString szFeeType;
CString szFeeCode;
CString szSubID;
int nMsgType;
}OUTPUTMSG, *LPOUTPUTMSG;
typedef list<OUTPUTMSG> OUTPUTMSGLIST, *LPOUTPUTMSGLIST;
// 轉發服務信息
typedef struct tag_ServiceInfo
{
CString szNum; // 長號碼
CString szIP;
int nPort;
}SERVICEINFO, *LPSERVICEINFO;
typedef struct tagSubscribeItem{
ULONG lIndex;
TCHAR pszColName[_MAX_PATH];
ULONG lCustomNo;
TCHAR pszPushType[_MAX_PATH];
TCHAR pszTypeCode[_MAX_PATH];
ULONG lType;
}SUBSCRIBEITEM;
enum MSGTYPE
{
MT_REG_OK=1,
MT_UNREG_OK,
MT_REG_FAIL,
MT_UNREG_FAIL,
MT_REG_EXISTS,
MT_UNREG_NOTEXISTS,
MT_REG_2ND,
MT_MISC_08,
MT_MISC_09
};
#include "Usercustoms.h"
// 公共數據
class CData
{
public:
CData();
~CData();
void GetCfgInfo();
// dispatcher
void RegisterDispatcher();
// log
BOOL InitLog();
void WriteLog(LPCTSTR pszLog, LPCTSTR pszErrCode = _T("0"));
void WriteLog(int nLogType, LPCTSTR pszMobile, LPCTSTR pszSubID, int nMsgFmt, int nMsgLen, LPCTSTR pszContent,
LPCTSTR pszFeeMP, LPCTSTR pszSrcGWID, LPCTSTR pszSrcMobile, int nMsgLevel, LPCTSTR pszMSGID,
LPCTSTR pszFeeType = NULL, LPCTSTR pszFeeCode = NULL, int nErrorCode = 0, LPCTSTR pszAttached = _TEXT(""));
void CloseLog();
BOOL m_bServiceExit;
// socket
SOCKET m_socket;
BOOL CreateSocket();
void CloseSocket();
CLog theLog;
Config_Info theCfgInfo;
// msg
void SetMsg(LPIOD_Info pIOD, LPCTSTR pszMsg, LPCTSTR pszSendNo, LPCTSTR pszSubID, LPCTSTR pszFeeCode, LPCTSTR pszFeeType, int nMsgType, LPCOMMONINFO pInfo);
void SetMsg2(LPVOID pDB, LPIOD_Info pIOD, LPCTSTR pszCmd,list<pair<CString,CString> >* ReplacePair, LPCOMMONINFO pInfo);
// Recv/Send
void AddOneRecMsg(LPCTSTR pszFrom, LPCTSTR lpBuf, UINT nLen);
BOOL GetOneRecMsg(LPIOD_Info pInfo);
void AddOneSendMsg(LPIOD_Info pInfo);
BOOL GetOneSendMsg(LPIOD_Info pInfo);
list<IOD_Info> m_RecMsgList;
list<IOD_Info> m_SendMsgList;
CCriticalSection m_RecLocker;
CCriticalSection m_SendLocker;
// Transfer
void AddTransferMsg(LPIOD_Info pInfo);
BOOL GetTransferMsg(LPIOD_Info pInfo);
list<IOD_Info> m_TransMsgList;
CCriticalSection m_TransLocker;
// 0000
void Add0000Msg(LPIOD_Info pInfo);
BOOL Get0000Msg(LPIOD_Info pInfo);
list<IOD_Info> m_0000MsgList;
CCriticalSection m_0000Locker;
CUserCustoms m_UserCustoms ;
};
extern CData theData;
#endif // __GWcom_Inc_IOD_Service_Global_Include_h_20011203__
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -