📄 smgpdef.h
字号:
/********************************************************************
ModuleName: SMGW Client API
FileName: smgpdef.h
DESCRIPTION: SMGP Protocol Message Definition
History:
Date Version Modifier Activies
2002/02/27 1.0 Zhang Jiebin Create
2002/10/18 3.5 Li Jianfu Modify
********************************************************************/
#ifndef _SMGP_DEFINE_H_
#define _SMGP_DEFINE_H_
#ifdef _WIN32
#pragma pack(push,1)
#elif defined _HPUX
#pragma pack 1
#else
#pragma pack (1)
#endif
/********************************************************************
The Macro Definition
********************************************************************/
/* The SMGW Client Version */
#define SMGP_CLIENT_VERSION 0x13
/*#define SMGP_CLIENT_VERSION10_OK*/
/* The Maximal Length Of Short Message */
#define MAX_SM_LEN 252
#define MAX_SM_CUT_NUM 100
/*The Maximal number of DestTermID*/
#define MAX_DEST_TERM_NUM 100
/* The Short Message Request ID */
#define REQUEST_ID_LOGIN 0x00000001
#define REQUEST_ID_LOGIN_RESP 0x80000001
#define REQUEST_ID_SUBMIT 0x00000002
#define REQUEST_ID_SUBMIT_RESP 0x80000002
#define REQUEST_ID_DELIVER 0x00000003
#define REQUEST_ID_DELIVER_RESP 0x80000003
#define REQUEST_ID_ACTIVE_TEST 0x00000004
#define REQUEST_ID_ACTIVE_TEST_RESP 0x80000004
#define REQUEST_ID_EXIT 0x00000006
#define REQUEST_ID_EXIT_RESP 0x80000006
#define REQUEST_ID_QUERY 0x00000007
#define REQUEST_ID_QUERY_RESP 0x80000007
/* Need Reply Yes Or No */
#define NEED_REPLY_YES 1
#define NEED_REPLY_NO 0
/* Need Report Yes Or No */
#define NEED_REPORT_YES 1
#define NEED_REPORT_NO 0
/* nMsgFormat Macro */
#define MSG_FORMAT_ASCII 0
#define MSG_FORMAT_WRITE_CARD 3
#define MSG_FORMAT_BINARY 4
#define MSG_FORMAT_UCS2 8
#define MSG_FORMAT_GB 15
#define MSG_FORMAT_PASSWORD 100
/* Fee Type Macro */
#define FEE_FREE "0"
#define FEE_BY_ITEM "1"
#define FEE_BY_MONTH "2"
#define FEE_BY_MAXINUM "3"
/* Login Mode */
#define LOGIN_SEND_MODE 0
#define LOGIN_RECV_MODE 1
#define LOGIN_TRANSMIT_MODE 2
/* Submit Priority */
#define SUBMIT_PRIORITY_LOWEST 0
#define SUBMIT_PRIORITY_NORMAL 1
#define SUBMIT_PRIORITY_ABOVE_NORMAL 2
#define SUBMIT_PRIORITY_HIGHEST 9
/* Message Status */
#define MESSAGE_STATUS_DELIVERED 0
#define MESSAGE_STATUS_EXPIRED 1
#define MESSAGE_STATUS_DELITED 2
#define MESSAGE_STATUS_UNDELIVERABLE 3
#define MESSAGE_STATUS_ACCEPTED 4
#define MESSAGE_STATUS_UNKNOW 5
/* SMGP Error Code */
#define SMGP_ERROR_CODE_OK 0
#define SMGP_ERROR_CODE_INVALIDE_PACKET 1
#define SMGP_ERROR_CODE_LOGIN_FAIL 2
#define SMGP_ERROR_CODE_INVALID_PRIORITY 3
#define SMGP_ERROR_CODE_INVALID_FEETYPE 4
#define SMGP_ERROR_CODE_INVALID_FEECODE 5
#define SMGP_ERROR_CODE_INVALID_MSGFORMAT 6
#define SMGP_ERROR_CODE_INVALID_VALIDTIME 7
#define SMGP_ERROR_CODE_INVALID_ATTIME 8
#define SMGP_ERROR_CODE_INVALID_SRCTERMID 9
#define SMGP_ERROR_CODE_INVALID_DESTTERMID 10
#define SMGP_ERROR_CODE_INVALID_LEN 11
#define SMGP_ERROR_CODE_INVALID_DESTSMGW 12
#define SMGP_ERROR_CODE_INVALID_DESTSRCSMGW 13
#define SMGP_ERROR_CODE_INVALID_FWDDESTTERMID 14
#define SMGP_ERROR_CODE_CHANGEPASSWORD_FAIL 15
#define SMGP_ERROR_CODE_RESERVERD 16
/* API Error Code */
#define SMGP_API_OK 0
#define SMGP_API_ERROR_MSG_FORMAT 3
#define SMGP_API_ERROR_MSG_LENGTH 4
#define SMGP_API_ERROR_MSG_FEECODE 5
#define SMGP_API_ERROR_SERVICE_ID 7
#define SMGP_API_ERROR_SYSTEM_BUSY 8
#define SMGP_API_ERROR_CP_NUMBER 10
#define SMGP_API_ERROR_CONTENT_FORMAT 11
#define SMGP_API_ERROR_FEE_TYPE 12
#define SMGP_API_ERROR_VALID_TIME 13
#define SMGP_API_ERROR_AT_TIME 14
#define SMGP_API_ERROR_CHARGE_TERM_ID 15
#define SMGP_API_ERROR_DEST_TERM_ID 16
#define SMGP_API_ERROR_DEST_TERM_ID_FILE 17
#define SMGP_API_ERROR_MSG_FILE 18
#define SMGP_API_ERROR_CONNECT_GW 20
#define SMGP_API_ERROR_AUTHID 21
#define SMGP_API_ERROR_SEND_QUEUE_OVER 23
#define SMGP_API_ERROR_COMMAND_ID 25
#define SMGP_API_ERROR_SEQUENSE_ID 26
#define SMGP_API_ERROR_VERSION 29
#define SMGP_API_ERROR_MSG_TYPE 30
#define SMGP_API_ERROR_PRIORITY 31
#define SMGP_API_ERROR_TIME_TYPE 35
#define SMGP_API_ERROR_QUERY_TYPE 38
#define SMGP_API_ERROR_ROUTE 39
#define SMGP_API_ERROR_FIXED_FEE 40
#define SMGP_API_ERROR_SRC_TERM_ID 46
#define SMGP_API_ERROR_SYSTEM 99
/* SMGP Length */
#define SMGP_MSG_HEAD_LENGTH (UINT32)(sizeof(SMGP_Head))
#define SMGP_LOGIN_MSG_LENGTH (UINT32)(sizeof(SMGP_Login))
#define SMGP_SUBMIT_MSG_LENGTH (UINT32)(sizeof(SMGP_Submit))
#define SMGP_SUBMIT_BATCH_MSG_LENGTH (UINT32)(sizeof(SMGP_Submit_Batch))
#define SMGP_EXIT_MSG_LENGTH (UINT32)(sizeof(SMGP_Head))
#define SMGP_DELIVER_RSP_MSG_LENGTH (UINT32)(sizeof(SMGP_DeliverResp))
/* SMGP Submit Message Type */
#define SMGP_SUBMIT_CANCEL_SUBSCRIBE 1
#define SMGP_SUBMIT_SUBSCRIBE_REQUEST 2
#define SMGP_SUBMIT_REQUEST 3
#define SMGP_SUBMIT_SUBSCRIBE 4
#define SMGP_SUBMIT_EXCHANGE 5
#define SMGP_SUBMIT_QUERY 6
/********************************************************************
The Struct Definition
********************************************************************/
/* SMGP Message Head */
typedef struct
{
unsigned int nPacketLength; /* 4 bytes */
unsigned int nRequestId; /* 4 bytes */
unsigned int nSequenceId; /* 4 bytes */
}SMGP_Head;
/* SMGP Message Login */
typedef struct
{
SMGP_Head msgHead; /* 12 bytes */
char sUser[8]; /* 11 bytes */
char sAuthenMD5[16]; /* 16 bytes */
unsigned char nLoginMode; /* 1 bytes */
unsigned int nTimeStamp; /* 4 bytes */
unsigned char nVersion; /* 1 bytes */
}SMGP_Login;
/* SMGP Message Login Resp*/
typedef struct
{
SMGP_Head msgHead; /* 12 bytes */
unsigned int nResult; /* 4 bytes */
}SMGP_LoginResp;
/* SMGP Message Submit*/
typedef struct
{
SMGP_Head msgHead; /* 12 bytes */
unsigned char nMsgType; /* 1 bytes */
unsigned char nNeedReport; /* 1 bytes */
unsigned char nPriority; /* 1 bytes */
char sServerId[10]; /* 10 bytes */
char sFeeType[2]; /* 2 bytes */
char sFeeCode[6]; /* 6 bytes */
char sFixedFee[6]; /* 6 bytes */
unsigned char nMsgFormat; /* 1 bytes */
char sValidTime[17]; /* 17 bytes */
char sAtTime[17]; /* 17 bytes */
char sReplyPath[21]; /* 21 bytes */
char sChargeTermId[21]; /* 21 bytes */
unsigned char nDestTermIdCount; /* 1 bytes */
char sDestTermId[21]; /* 21 * 100 bytes */
unsigned char nMsgLength; /* 1 bytes */
char sMsgContent[MAX_SM_LEN]; /* MAX_SM_LEN bytes */
}SMGP_Submit;
/* SMGP Message Submit*/
typedef struct
{
SMGP_Head msgHead; /* 12 bytes */
unsigned char nMsgType; /* 1 bytes */
unsigned char nNeedReport; /* 1 bytes */
unsigned char nPriority; /* 1 bytes */
char sServerId[10]; /* 10 bytes */
char sFeeType[2]; /* 2 bytes */
char sFeeCode[6]; /* 6 bytes */
char sFixedFee[6]; /* 6 bytes */
unsigned char nMsgFormat; /* 1 bytes */
char sValidTime[17]; /* 17 bytes */
char sAtTime[17]; /* 17 bytes */
char sReplyPath[21]; /* 21 bytes */
char sChargeTermId[21]; /* 21 bytes */
unsigned char nDestTermIdCount; /* 1 bytes */
char sDestTermId[21*MAX_DEST_TERM_NUM]; /* 21 * 100 bytes */
unsigned char nMsgLength; /* 1 bytes */
char sMsgContent[MAX_SM_LEN]; /* MAX_SM_LEN bytes */
}SMGP_Submit_Batch;
/* SMGP Message Submit Resp*/
typedef struct
{
SMGP_Head msgHead; /* 12 bytes */
char sMsgId[10]; /* 10 bytes */
unsigned int nResult; /* 4 bytes */
}SMGP_SubmitResp;
/* SMGP Message Deliver*/
typedef struct
{
SMGP_Head msgHead; /* 12 bytes */
char sMsgId[10]; /* 10 bytes */
unsigned char nIsReport; /* 1 bytes */
unsigned 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[MAX_SM_LEN]; /* MAX_SM_LEN bytes */
}SMGP_Deliver;
/* SMGP Message Deliver Resp*/
typedef struct
{
SMGP_Head msgHead; /* 12 bytes */
char sMsgId[10]; /* 10 bytes */
unsigned int nResult; /* 4 bytes */
}SMGP_DeliverResp;
/* SMGP Message Active Test*/
/* Empty Body */
/* SMGP Message Active Test Resp */
/* Empty Body */
/* SMGP Message Forward*/
typedef struct
{
SMGP_Head msgHead; /* 12 bytes */
char sDestSMGWNo[6]; /* 6 bytes */
char sSrcSMGWNo[6]; /* 6 bytes */
unsigned char nSMType; /* 1 bytes */
unsigned char nNeedReport; /* 1 bytes */
unsigned char nPriority; /* 1 bytes */
char sMsgSrc[6]; /* 6 bytes */
char sServerId[10]; /* 10 bytes */
char sFeeType[2]; /* 2 bytes */
char sFeeCode[6]; /* 6 bytes */
unsigned char nMsgFormat; /* 1 bytes */
char sValidTime[17]; /* 17 bytes */
char sAtTime[17]; /* 17 bytes */
char sReplyPath[21]; /* 21 bytes */
char sDestTermId[21]; /* 21 bytes */
unsigned char nMsgLength; /* 1 bytes */
char sMsgContent[MAX_SM_LEN]; /* MAX_SM_LEN bytes */
}SMGP_Forward;
/* SMGP Message Forward Resp*/
typedef struct
{
SMGP_Head msgHead; /* 12 bytes */
char sMsgId[10]; /* 10 bytes */
unsigned int nResult; /* 4 bytes */
}SMGP_ForwardResp;
/* SMGP Message Exit*/
/* Empty Body */
/* SMGP Message Exit Resp*/
/* Empty Body */
/* SMGP Message Status Report */
typedef struct
{
SMGP_Head msgHead; /* 12 bytes */
char sMsgId[10]; /* 10 bytes */
char sSubmitDate[14]; /* 14 bytes */
char sDoneDate[14]; /* 14 bytes */
char sStatus[7]; /* 7 bytes */
char sErr[3]; /* 3 bytes */
}SMGP_StatusReport;
/* SMGP Message Change Passward */
typedef struct
{
char sOldPassward[15]; /* 15 bytes */
char sNewPassward[15]; /* 15 bytes */
}SMGP_ChangePassward;
/*SMGP MSGID*/
typedef struct
{
char sGwCode[30];
char sTime[30];
char sSequenceNo[30];
}SMGP_MsgID;
/********************************************************************
The Function Definition
********************************************************************/
int SMGPPackHeadMsg(unsigned int nPacketLength,
unsigned int nRequestId,
SMGP_Head *pSMGPHead);
int SMGPPackLoginMsg(char nLoginMode,SMGP_Login *pLoginMsg);
#ifdef SMGP_CLIENT_VERSION10_OK
int SMGPPackSubmitMsg( const int nNeedReply, const int nMsgLevel,
const char *sServiceID, const int nMsgFormat,
const char *sFeeType, const char *sFeeCode,
const char *sValidTime, const char *sAtTime,
const char *sChargeTermID, const char *sDestTermID,
const char *sReplyPath, const int nMsgLen,
const char *sMsgContent, SMGP_Submit *pSubmit);
#else
int SMGPPackSubmitMsg( const int nNeedReply, const int nMsgLevel,
const char *sServiceID, const int nMsgFormat,
const char *sFeeType, const char *sFeeCode,
const char *sValidTime, const char *sAtTime,
const char *sChargeTermID, const char *sDestTermID,
const char *sReplyPath, const int nMsgLen,
const char *sMsgContent, const int nMsgType,
const char *sFixCode, SMGP_Submit *pSubmit);
#endif
#ifdef SMGP_CLIENT_VERSION10_OK
int SMGPPackSubmitBatchMsg( const int nNeedReply, const int nMsgLevel,
const char *sServiceID, const int nMsgFormat,
const char *sFeeType, const char *sFeeCode,
const char *sValidTime, const char *sAtTime,
const char *sChargeTermID,
const int nDestTermIDCount, const char *sDestTermID,
const char *sReplyPath, const int nMsgLen,
const char *sMsgContent, SMGP_Submit_Batch *pSubmit);
#else
int SMGPPackSubmitBatchMsg( const int nNeedReply, const int nMsgLevel,
const char *sServiceID, const int nMsgFormat,
const char *sFeeType, const char *sFeeCode,
const char *sValidTime, const char *sAtTime,
const char *sChargeTermID,
const int nDestTermIDCount, const char *sDestTermID,
const char *sReplyPath, const int nMsgLen,
const char *sMsgContent, const int nMsgType,
const char *sFixCode, SMGP_Submit_Batch *pSubmit);
#endif
int SMGPPackExitMsg(SMGP_Head *pSMGPExit);
int SMGPPackDeliverRspMsg( SMGP_DeliverResp *pDeliverRsp,
unsigned int nSequense,
char *sMsgId,
unsigned int nResult);
int SMGPPackActiveTestMsg(SMGP_Head *pActiveTest);
#ifdef _WIN32
#pragma pack(pop)
#elif defined _HPUX
#pragma pack 4
#else
#pragma pack ()
#endif
#endif /* #define _SMGP_DEFINE_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -