📄 ~const.~h
字号:
/**
* const.h
*
* Short Message Abstractive Library.(SMAL)
*
* Copyright 2003-2006 北京风起水流软件工作室
*
* http://www.zealware.com
*
* princetoad@gmail.com
*
*/
#ifndef _SMAL_CONST_H
#define _SMAL_CONST_H
/** Version definition
*/
static const unsigned char CMPP2_VERSION = 0x20; ///< CMPP2.0协议版本号
static const unsigned char CMPP3_VERSION = 0x30; ///< CMPP3.0协议版本号
static const unsigned char CNGP2_VERSION = 0x20; ///《CNGP2.0协议版本号
static const unsigned char SMGP138_VERSION = 0x13; ///< SMGP1.38
static const unsigned char SMGP20_VERSION = 0x20; ///< SMGP2.0
static const unsigned char SMGP30_VERSION = 0x30; ///< SMGP3.0
static const unsigned char IMPP_VERSION = 0x10; ///< IMPP1.0
static const unsigned char SMPP34_VERSION = 0x34; ///< SMPP3.4版本号
/** Protocol advice value defination
*/
static const int SMGP_ACTIVETEST_RETRYINTERVAL = 180; ///< 重发时间间隔
static const int SMGP_ATTIVETEST_RESPTIMEOUT = 60; ///< Response超时时间
static const int SMGP_ACTIVETEST_RETRYCOUNT = 3; ///< 重发次数
static const int SMGP_SUBMIT_RETRYINTERVAL = 60; ///< SUBMIT消息重发时间间隔
static const int SMGP_SUBMIT_RETRYCOUNT = 3; ///< SUBMIT重发次数
static const int SMGP_SUBMIT_RESPTIMEOUT = 60; ///< SUBMITResponse超时时间
static const int SMGP_SUBMIT_SLIDINGWINDOW_SIZE = 16; ///< 滑动窗口大小
/** Socket error
*/
static const int SOCKET_TIMEOUT = 5; ///< socket超时(收发)
static const int SOCKET_CLOSED = -1; ///< socket关闭(连接)
/** Application error
*/
static const int SMS_UNLOGOIN = 16001; ///< 客户端没有登录.
static const int SMS_ALREADY_STARTED = 16002; ///< 网关已经启动
static const int SMS_UNSTARTED = 16003; ///< 网关没有启动
static const int SMS_EXPIRED = 16004; ///< 超过试用期
enum SMAL_ERROR_CODE {
e_ERROR_NOAVAILABLECONNECTION = 16005,
e_ERROR_FAILEDONSUBMITING = 16006, ///< OnSubmiting返回FALSE
// 没有可用连接
e_ERROR_NONOFUSEABLECONNECTION = 16008,
// 客户端没有登录
e_ERROR_CLIENTNOTLOGINED = 16010
};
/** AsiaInfo ISMG Definition
*/
static const unsigned char ASIA_MT = 0x00; ///< 亚信网关MT连接版本号
static const unsigned char ASIA_MO = 0x01; ///< 亚信网关MO连接版本号
/** StatusReport
*/
static const unsigned char NEED_SREPORT = 1; ///< 要求返回状态报告
static const unsigned char NO_SREPORT = 0; ///< 不要求返回状态报告
static const unsigned char IS_SREPORT = 1; ///< 是状态报告消息
static const unsigned char NOT_SREPORT = 0; ///< 不是状态报告消息
/** cmpp3 about
*/
static const int MAX_QUEUESIZE = 100000; ///< 堆栈的最大长度
static const int TERMINALTYPE_TRUENUMBER = 0; ///< 终端类型 - 真实号码
static const int TERMINALTYPE_FALSENUMBER = 1; ///< 终端类型 - 伪码
static const int DEFAULT_DESTTERMINALCOUNT = 1; ///< 默认的目标号码数
static const int DEFAULT_TPPID = 0; ///< 默认的TPPID值
static const int DEFAULT_TPUDHI = 0; ///< 默认的TPUDHI值
static const int DEFAULT_FEETERMINALTYPE = 0; ///< 默认的付费用户类型
static const int MAX_LINE = 4192;
#ifdef CMPP3_MSISDN24_RESULT1
typedef unsigned char PINTResult;
static const int LENGTH_OF_RESULT_IN_RESPONSE = 1; ///< Result长度1
static const int LENGTH_OF_MSISDN_IN_MOMT = 24; ///< MSISDN长度24
static const int LENGTH_OF_CONNECT_RESPONSE = 18;
static const int LENGTH_OF_MOMT_RESPONSE = 9;
static const int LENGTH_OF_CANCEL_RESPONSE = 1;
static const int LENGTH_OF_STATUSREPORT = /*71-11*/60;
static const int LENGTH_OF_PADDING_IN_SUBMIT = 0;
#else
typedef unsigned long PINTResult;
static const int LENGTH_OF_RESULT_IN_RESPONSE = 4; ///< Result长度4
static const int LENGTH_OF_MSISDN_IN_MOMT = 32; ///< MSISDN长度32
static const int LENGTH_OF_CONNECT_RESPONSE = 21;
static const int LENGTH_OF_MOMT_RESPONSE = 12;
static const int LENGTH_OF_CANCEL_RESPONSE = 4;
static const int LENGTH_OF_STATUSREPORT = 71;
static const int LENGTH_OF_PADDING_IN_SUBMIT = 0;
#endif
/** SMGP
*/
static const unsigned char DEFAULT_MTMSGTYPE = 6;
static const char SMGP138_PREFIX[] = "SMGP138TOKEN:"; ///< SMGP1.38协议标识
static const char SMGP20_PREFIX[] = "SMGP20TOKEN:"; ///< SMGP2.0协议标识
static const char SMGP30_PREFIX[] = "SMGP30TOKEN:"; ///< SMGP3.0协议标识
static const char CNGP20_PREFIX[] = "CNGP20TOKEN:"; ///< CNGP2.0协议标识
static const char IMPP_PREFIX[] = "IMPPTOKEN:"; ///< IMPP协议标识
static const char SMPP3_PREFIX[] = "SMPP3TOKEN:"; ///< SMPP协议标识
static const char CMPP2_PREFIX[] = "CMPP2TOKEN:"; ///< CMPP2.0协议标识
static const char CMPP3_PREFIX[] = "CMPP3TOKEN:"; ///< CMPP3.0协议标识
static const int MAXINITWORKTHREADS = 256; ///< 线程池设定的初始线程数允许的最大值
static const int MAXWORKTHREADS = 1024; ///< 线程池设定的最大线程数允许的最大值
static const int MINACTIVETESTTIMER = 3; ///< 活动测试时间最小值
static const int MAXACTIVETESTTIMER = 180; ///< 活动测试时间最大值
static const int LENGTH_OF_CNGP_HEAD = 16; ///< CNGP消息头长度
static const int LENGTH_OF_CNGP_LOGIN = 32; ///< CNGP_LOGIN消息长度
static const int LENGTH_OF_CNGP_LOGINRESP = 17; ///< CNGP_LOGIN_RESP消息长度
static const int LENGTH_OF_CNGP_MSGID = 10; ///< CNGP中MSGID得长度
static const int LENGTH_OF_CNGP_TLV221 = 5;
static const int LENGTH_OF_CNGP_SUBMITDELIVER_RESP = 15; ///< Submit_Deliver_Resp消息的长度
/** 辅助线程参数索引
*/
enum ThreadIndex
{
LOG_INDEX,
MT_INDEX,
MONITER_INDEX
};
enum ConnectionType {
e_SendOnly,
e_RecvOnly,
e_SendAndRecv,
NumOfConnectionType
};
enum JobType {
e_JOB_SendSubmit,
e_JOB_OnMTFailed,
e_JOB_OnMTSucceed,
e_JOB_OnDeliver,
e_JOB_OnActiveTestResponse,
e_JOB_OnActiveTest,
e_JOB_OnStatusReport,
e_JOB_OnTerminate,
e_JOB_OnSubmitResponse,
e_JOB_OnSubmiting,
// Server
e_JOB_OnSPMsg,
NumOfJobs
};
enum CMPP_COMMAND {
e_CMPP_CONNECT = 0x00000001,
e_CMPP_TERMINATE = 0x00000002,
e_CMPP_SUBMIT = 0x00000004,
e_CMPP_DELIVER = 0x00000005,
e_CMPP_ACTIVE_TEST = 0x00000008,
e_CMPP_CONNECT_RESP = 0x80000001,
e_CMPP_TERMINATE_RESP = 0x80000002,
e_CMPP_SUBMIT_RESP = 0x80000004,
e_CMPP_DELIVER_RESP = 0x80000005,
e_CMPP_ACTIVE_TEST_RESP = 0x80000008,
NumOfCMPPCommand
};
enum CNGP_COMMAND {
e_CNGP_CONNECT = 0x00000001,
e_CNGP_SUBMIT = 0x00000002,
e_CNGP_DELIVER = 0x00000003,
e_CNGP_ACTIVE_TEST = 0x00000004,
e_CNGP_TERMINATE = 0x00000006,
e_CNGP_CONNECT_RESP = 0x80000001,
e_CNGP_SUBMIT_RESP = 0x80000002,
e_CNGP_DELIVER_RESP = 0x80000003,
e_CNGP_ACTIVE_TEST_RESP = 0x80000004,
e_CNGP_TERMINATE_RESP = 0x80000006,
};
enum SMGP_COMMAND {
/**
客户端登录请求
*/
e_SMGP_LOGIN = 0x00000001,
/**
提交短消息
*/
e_SMGP_SUBMIT = 0x00000002,
/**
下发短消息
*/
e_SMGP_DELIVER = 0x00000003,
/**
链路检测
*/
e_SMGP_ACTIVE_TEST = 0x00000004,
/**
退出请求
*/
e_SMGP_EXIT = 0x00000006,
/**
SP统计查询请求
*/
e_SMGP_QUERY = 0x00000007,
/**
客户端登录应答
*/
e_SMGP_LOGIN_RESP = 0x80000001,
/**
提交短消息应答
*/
e_SMGP_SUBMIT_RESP = 0x80000002,
/**
下发短消息应答
*/
e_SMGP_DELIVER_RESP = 0x80000003,
/**
链路检测应答
*/
e_SMGP_ACTIVE_TEST_RESP = 0x80000004,
/**
退出应答
*/
e_SMGP_EXIT_RESP = 0x80000006,
/**
SP统计查询应答
*/
e_SMGP_QUERY_RESP = 0x80000007
};
enum SMGP_TLV_TAG {
e_SMGP_TP_pid = 0x001,
e_SMGP_TP_udhi = 0x0002,
e_SMGP_LinkID = 0x0003,
e_SMGP_ChargeUserType = 0x0004,
e_SMGP_ChargeTermType = 0x0005,
e_SMGP_ChargeTermPseudo = 0x0006,
e_SMGP_DestTermType = 0x0007,
e_SMGP_DestTermPseudo = 0x0008,
e_SMGP_PkTotal = 0x0009,
e_SMGP_PkNumber = 0x000A,
e_SMGP_SubmitMsgType = 0x000B,
e_SMGP_SPDealResult = 0x000C,
e_SMGP_SrcTermType = 0x000D,
e_SMGP_SrcTermPseudo = 0x000E,
e_SMGP_NodesCount = 0x000F,
e_SMGP_MsgSrc = 0x0010,
e_SMGP_SrcType = 0x0011,
e_SMGP_MServiceID = 0x0012
};
enum CNGP_TLV_TAG {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -