⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smgp.h

📁 短信防伪系统服务器端
💻 H
字号:
// Smgp.h: interface for the CSmgp class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SMGP_H__148F767A_0ADA_4874_9C59_D14485C3189A__INCLUDED_)
#define AFX_SMGP_H__148F767A_0ADA_4874_9C59_D14485C3189A__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "CommonSms.h"


#define nSMGP_LOGIN						0x00000001
#define nSMGP_LOGIN_RESP				0x80000001
#define nSMGP_SUBMIT					0x00000002
#define nSMGP_SUBMIT_RESP				0x80000002
#define nSMGP_DELIVER					0x00000003
#define nSMGP_DELIVER_RESP				0x80000003
#define nSMGP_ACTIVE_TEST				0x00000004
#define nSMGP_ACTIVE_TEST_RESP			0x80000004
#define nSMGP_EXIT						0x00000006
#define nSMGP_EXIT_RESP					0x80000006
#define nSMGP_QUERY						0x00000007
#define nSMGP_QUERY_RESP				0x80000007


#pragma pack(push,1)
typedef struct
{
	int size;					//	数据报的长度
	int	cmdid;					//	命令码
	int	seqid;			        /* 4 bytes */
}SMGP_HEAD;

typedef struct
{	
	char			sUser[8];				/* 11 bytes */
	char			sAuthenMD5[16];			/* 16 bytes */
	char			nLoginMode;				/* 1 bytes */
	unsigned int	nTimeStamp;				/* 4 bytes */
	char			nVersion;				/* 1 bytes */
}SMGP_LOGIN;
typedef struct
{
	unsigned int	nResult;				/* 4 bytes */
}SMGP_LOGIN_RESP;
typedef struct
{
	char	nMsgType;				/* 1 bytes */
	char	nNeedReport;			/* 1 bytes */
	char	nPriority;				/* 1 bytes */
	char	sServerId[10];			/* 10 bytes */
	char	sFeeType[2];			/* 2 bytes */
	char	sFeeCode[6];			/* 6 bytes */
	char	sFixedFee[6];			/* 6 bytes */
	char	nMsgFormat;				/* 1 bytes */
	char	sValidTime[17];			/* 17 bytes */
	char	sAtTime[17];			/* 17 bytes */
	char	sReplyPath[21];			/* 21 bytes */
	char	sChargeTermId[21];		/* 21 bytes */
	char	nDestTermIdCount;		/* 1 bytes */
	char	sDestTermId[21];		/* 21 * 100 bytes */
	char	nMsgLength;				/* 1 bytes */
	char	sMsgContent[256];		/* MAX_SM_LEN bytes */
	char    reverse[8];
}SMGP_SUBMIT;
typedef struct
{
	char			sMsgId[10];				/* 10 bytes */
	unsigned int	nResult;				/* 4 bytes */
}SMGP_SUBMIT_RESP;
typedef struct
{	
	char	sMsgId[10];				/* 10 bytes */
	char	nIsReport;				/* 1 bytes */
	char	nMsgFormat;				/* 1 bytes */
	char	sRecvTime[14];			/* 14 bytes */
	char	sSrcTermId[21];			/* 21 bytes */
	char	sDestTermId[21];		/* 21 bytes */
	unsigned char nMsgLength;		/* 1 bytes */
	char	sMsgContent[256];		/* MAX_SM_LEN bytes */
	char    reverse[8];
}SMGP_DELIVER;
typedef struct
{
	char			sMsgId[10];				/* 10 bytes */
	unsigned int	nResult;				/* 4 bytes */
}SMGP_DELIVER_RESP;
#pragma pack(pop)


void PK_SMGP(SMGP_SUBMIT * pSubmit,
               int*  pk_len,
               char* srcTermid,
               char* destTermid,
               char* chargeTermid,
               int   subType,
               char* feeType,
               char* feecode,
               char* serviceid,
               int   msgFormat,
               int   msgLength,
               char* msgContent);

class CSmgp : public CCommonSMS  
{
public:
	CSmgp();
	virtual ~CSmgp();
protected:
    char *BCDToString(char *src,int len, char *dest);
public:
   int Startup(char *szIp,int port,  int login_mode,
                char *szUser,char *szPwd,
                char *szCorpId,char *szSeverNumber,char *szSpNode,
                int  threadpool ,int  wndsize,
                int  timeout,int trys,
                void (*OnDeliverSMS)(DELIVER_SMS   *pDeliver),
                void (*OnMTReportSMS)(MTREPORT_SMS *pReport),
                void (*OnSubmitedSMS)(SUBMIT_SMS   *pSubmited));
    int Cleanup();
    virtual int  SubmitSMS(SUBMIT_SMS *p ,int len,int seqid);  //发送函数
    virtual void OnRecv();
    virtual void OnActive();
    virtual void OnSocketError();
    virtual int  Login();
    virtual int  Logout();


};

#endif // !defined(AFX_SMGP_H__148F767A_0ADA_4874_9C59_D14485C3189A__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -