📄 cmpp_proto.h
字号:
/**
* 文件: cmpp_proto.h
* 作者: PrinceToad,princetoad@tom.com,http://gmm.nease.net
* 说明: 中国移动CMPP2.0短消息网关开发接口库消息包定义文件
* 版本: 1.3
*/
#ifndef CMPP_PROTO_2_H
#define CMPP_PROTO_2_H
#include "cmpp_types.h"
#pragma pack(1)
#define CMPP_CONNECT 0x00000001
#define CMPP_CONNECT_RESP 0x80000001
#define CMPP_TERMINATE 0x00000002
#define CMPP_TERMINATE_RESP 0x80000002
#define CMPP_SUBMIT 0x00000004
#define CMPP_SUBMIT_RESP 0x80000004
#define CMPP_DELIVER 0x00000005
#define CMPP_DELIVER_RESP 0x80000005
#define CMPP_QUERY 0x00000006
#define CMPP_QUERY_RESP 0x80000006
#define CMPP_CANCEL 0x00000007
#define CMPP_CANCEL_RESP 0x80000007
#define CMPP_ACTIVE_TEST 0x00000008
#define CMPP_ACTIVE_TEST_RESP 0x80000008
#define CMPP_SPID_LEN 6
#define CMPP_AUTH_LEN 16
#define CMPP_SERVICEID_LEN 10
#define CMPP_FEETERMINAL_LEN 21
#define CMPP_MSGID_LEN 8
#define CMPP_MSGSRC_LEN 6
#define CMPP_FEETYPE_LEN 2
#define CMPP_FEECODE_LEN 6
#define CMPP_VALIDTIME_LEN 17
#define CMPP_ATTIME_LEN 17
#define CMPP_MSISDN_LEN 21
#define CMPP_MSGCONTENT_LEN 140
#define CMPP_RESERVE_LEN 8
#define CMPP_QUERYTIME_LEN 8
#define CMPP_QUERYCODE_LEN 10
#define CMPP_REPORT_STAT_LEN 7
#define CMPP_REPORT_TIME_LEN 10
#define CMPP_VERSION 0x20
#define NO_STATUSREPORT 0x00
#define NEED_STATUSREPORT 0x01
#define CTRL_TYPE 0x02
#define MSG_FORMAT_ASCII 0x00
#define MSG_FORMAT_WRITE_CARD 0x03
#define MSG_FORMAT_BINARY 0x04
#define MSG_FORMAT_UCS2 0x08
#define MSG_FORMAT_GB 0x0F
#define MSG_FORMAT_OTA 0xF6
#define TPPROTO_SMS 0X00
#define TPPROTO_WRITE_CARD 0X7F
struct cmppg_head {
cmpp_uint32_t nTotalLength;
cmpp_uint32_t nCommandId;
cmpp_uint32_t nSequenceId;
};
typedef struct cmppg_head CMPPG_HEAD;
struct cmppg_connect {
char sSourceAddr[CMPP_SPID_LEN];
char sAuthSource[CMPP_AUTH_LEN];
cmpp_uint8_t cVersion;
cmpp_uint32_t nTimeStamp;
};
typedef struct cmppg_connect CMPPG_CONNECT;
struct cmppg_connect_resp {
cmpp_uint8_t cStatus;
char sAuthIsmg[CMPP_AUTH_LEN];
cmpp_uint8_t cVersion;
};
typedef struct cmppg_connect_resp CMPPG_CONNECT_RESP;
//cmpp_terminate
//cmpp_terminate_resp
struct cmppg_submit {
cmpp_uint8_t nMsgId[CMPP_MSGID_LEN];
cmpp_uint8_t cPkTotal;
cmpp_uint8_t cPkNumber;
cmpp_uint8_t cRegisteredDelivery;
cmpp_uint8_t cMsgLevel;
char sServiceId[CMPP_SERVICEID_LEN];
cmpp_uint8_t cFeeUserType;
cmpp_uint8_t nFeeTerminaleId[CMPP_FEETERMINAL_LEN];
cmpp_uint8_t cTpPid;
cmpp_uint8_t cTpUdhi;
cmpp_uint8_t cMsgFmt;
char sMsgSrc[CMPP_MSGSRC_LEN];
char sFeeType[CMPP_FEETYPE_LEN];
char sFeeCode[CMPP_FEECODE_LEN];
char sValidTime[CMPP_VALIDTIME_LEN];
char sAtTime[CMPP_ATTIME_LEN];
char sSrcId[CMPP_MSISDN_LEN];
cmpp_uint8_t cDestUsrTl;
char sDestTerminalId[CMPP_MSISDN_LEN];
cmpp_uint8_t cMsgLen;
char sMsgContent[CMPP_MSGCONTENT_LEN];
char sReserve[CMPP_RESERVE_LEN];
};
typedef struct cmppg_submit CMPPG_SUBMIT;
struct cmppg_submit_resp {
cmpp_uint8_t nMsgId[CMPP_MSGID_LEN];
cmpp_uint8_t cResult;
};
typedef struct cmppg_submit_resp CMPPG_SUBMIT_RESP;
struct cmppg_query {
char sTime[CMPP_QUERYTIME_LEN];
cmpp_uint8_t cQueryType;
char sQueryCode[CMPP_QUERYCODE_LEN];
char sReserve[CMPP_RESERVE_LEN];
};
typedef struct cmppg_query CMPPG_QUERY;
struct cmppg_query_resp {
char sTime[CMPP_QUERYTIME_LEN];
cmpp_uint8_t cQueryType;
char sQueryCode[CMPP_QUERYCODE_LEN];
cmpp_uint32_t nMTTLMsg;
cmpp_uint32_t nMTTlusr;
cmpp_uint32_t nMTScs;
cmpp_uint32_t nMTWT;
cmpp_uint32_t nMTFL;
cmpp_uint32_t nMOScs;
cmpp_uint32_t nMOWT;
cmpp_uint32_t nMOFL;
};
typedef struct cmppg_query_resp CMPPG_QUERY_RESP;
struct cmppg_deliver_report {
cmpp_uint8_t nMsgId[CMPP_MSGID_LEN];
char sStat[CMPP_REPORT_STAT_LEN];
char sSubmitTime[CMPP_REPORT_TIME_LEN];
char sDoneTime[CMPP_REPORT_TIME_LEN];
char sDestTermId[CMPP_MSISDN_LEN];
cmpp_uint32_t nSMSCSeq;
};
typedef struct cmppg_deliver_report CMPPG_DELIVER_REPORT;
struct cmppg_deliver {
cmpp_uint8_t nMsgId[CMPP_MSGID_LEN];
char sDestId[CMPP_MSISDN_LEN];
char sServiceId[CMPP_SERVICEID_LEN];
cmpp_uint8_t cTpPid;
cmpp_uint8_t cTpUdhi;
cmpp_uint8_t cMsgFmt;
char sSrcTermId[CMPP_MSISDN_LEN];
cmpp_uint8_t cRegisteredDelivery;
cmpp_uint8_t cMsgLen;
union
{
char sMsgContent[CMPP_MSGCONTENT_LEN];
cmppg_deliver_report sReport;
}pk_sm;
char sReserve[CMPP_RESERVE_LEN];
};
typedef struct cmppg_deliver CMPPG_DELIVER;
struct cmppg_deliver_resp {
cmpp_uint8_t nMsgId[CMPP_MSGID_LEN];
cmpp_uint8_t cResult;
};
typedef struct cmppg_deliver_resp CMPPG_DELIVER_RESP;
struct cmppg_cancel {
cmpp_uint8_t nMsgId[CMPP_MSGID_LEN];
};
typedef struct cmppg_cancel CMPPG_CANCEL;
struct cmppg_cancel_resp {
cmpp_uint8_t cSuccessId;
};
typedef struct cmppg_cancel_resp CMPPG_CANCEL_RESP;
//cmpp_active_test
struct cmppg_active_test_resp {
char cReserved;
};
typedef struct cmppg_active_test CMPPG_ACTIVE_TEST;
struct cmppg_icp_packet {
cmppg_head pk_head;
union{
cmppg_connect pk_login;
cmppg_submit pk_submit;
cmppg_deliver_resp pk_deliver_resp;
cmppg_cancel pk_cancel;
cmppg_active_test_resp pk_active_test_resp;
}pk_data;
};
typedef struct cmppg_icp_packet CMPPG_ICP_PACKET;
struct cmppg_ismg_packet {
cmppg_head pk_head;
// cmpp_uint32_t result;
union{
cmppg_deliver pk_deliver;
cmppg_connect_resp pk_connect_resp;
cmppg_submit_resp pk_submit_resp;
cmppg_active_test_resp pk_active_test_resp;
}pk_data;
};
typedef struct cmppg_ismg_packet CMPPG_ISMG_PACKET;
struct cmpp_conn {
cmpp_socket_t hSocket;
volatile cmpp_uint32_t nSeq;
};
typedef struct cmpp_conn CMPP_CONN;
#define CMPP_HEADLEN sizeof(cmppg_head)
#define CMPP_LOGINLEN sizeof(cmppg_connect)
#define CMPP_LOGINRESPLEN sizeof(cmppg_connect_resp)
#define CMPP_SUBMITLEN sizeof(cmppg_submit)
#define CMPP_SUBMITRESPLEN sizeof(cmppg_submit_resp)
#define CMPP_DELIVERRESPLEN sizeof(cmppg_deliver_resp)
#define CMPP_DELIVERLEN sizeof(cmppg_deliver)
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -