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

📄 cngp.h

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

#if !defined(AFX_CNGP_H__41363D84_8C68_4321_8809_B9B3EAB20C1B__INCLUDED_)
#define AFX_CNGP_H__41363D84_8C68_4321_8809_B9B3EAB20C1B__INCLUDED_

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

#include "CommonSms.h"


#define nCNGP_LOGIN						0x00000001
#define nCNGP_LOGIN_RESP				0x80000001
#define nCNGP_SUBMIT					0x00000002
#define nCNGP_SUBMIT_RESP				0x80000002
#define nCNGP_DELIVER					0x00000003
#define nCNGP_DELIVER_RESP				0x80000003
#define nCNGP_ACTIVE_TEST				0x00000004
#define nCNGP_ACTIVE_TEST_RESP			0x80000004
#define nCNGP_EXIT						0x00000006
#define nCNGP_EXIT_RESP					0x80000006
#define nCNGP_QUERY						0x00000007
#define nCNGP_QUERY_RESP				0x80000007

#pragma pack(push,1)
struct CNGP_HEAD
{
	int size;									
	int	cmdid;
	int command_status;
	int seqid;
};
struct CNGP_LOGIN
{
	char clientID[10];
	char authenticatorClient[16];
	char loginMode;
    int  timeStamp;
	char version;
};
struct CNGP_LOGIN_RESP
{
	char authenticatorServer[16];
	char version;
};
struct TLV
{
	short parameter;
	short length;
	char value;
};
struct CNGP_SUBMIT
{
	char	spid[10];
	char	nMsgType;				/* 1 bytes */
	char	nNeedReport;			/* 1 bytes */
	char	nPriority;				/* 1 bytes */
	char	sServerId[10];			/* 10 bytes */
	char	sFeeType[2];			/* 2 bytes */
	char	sFeeuUserType;			/* 1 bytes */
	char	sFeeCode[6];			/* 6 bytes */
	char	nMsgFormat;				/* 1 bytes */
	char	sValidTime[17];			/* 17 bytes */
	char	sAtTime[17];			/* 17 bytes */
	char	sSrcTermid[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 */
	//TLV     protocolid;
	/*
	parameter=x0100
	length=1;
	value=0;
	*/
};
struct CNGP_SUBMIT_RESP
{
	char  msgid[10];
	short ParameterTag; //0x0100
	short length;
	char  value;
	//TLV congestionState;
	/*
	parameter=0x0428;
	length=1;
	value=0;
	*/
};
struct CNGP_DELIVER
{
	char msgid[10];
	char isReport;
	char msgFormat;
	char recvTime[14];
	char srcTermID[21];
	char destTermID[21];
	unsigned char msgLength;
	char msgContent[256];
	//TLV  protocolID;
};

struct CNGP_DELIVER_RESP
{
	char msgid[10];
	short ParameterTag; //0x0100
	short length;
	char  value;
	//TLV congestionState;
};
#pragma pack(pop)


void PK_CNGP(CNGP_SUBMIT * pSubmit,
               int*  pk_len,
               char *corpId,
               char* srcTermid,
               char* destTermid,
               char* chargeTermid,
               int   subType,
               int   feeuserType,
               char* feeType,
               char* feecode,
               char* serviceid,
               int   msgFormat,
               int   msgLength,
               char* msgContent);
class CCngp : public CCommonSMS  
{

public:
	CCngp();
	virtual ~CCngp();
public:
    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  wndsize,int  threadpool,
                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_CNGP_H__41363D84_8C68_4321_8809_B9B3EAB20C1B__INCLUDED_)

⌨️ 快捷键说明

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