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

📄 api.h

📁 移动短信API-v1.1,短信接入源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
 * 参数:cmpp30_icp_trans *trans 连接描述符结构 *      dpl_uint32_t status active应答包中的状态值 *      dpl_uint32_t seq 收到的active包的包头中seq值  * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_active_rsp(cmpp30_icp_trans *trans, dpl_uint32_t status, dpl_uint32_t seq);/*** * 功能:向网关发送login包 * 参数:cmpp30_icp_trans *trans 连接描述符结构 *      cmpp30icp_submit *pk submit消息包结构 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_send(cmpp30_icp_trans *trans, cmpp30icp_submit *pk);/*** * 功能:初始化submit消息包结构 * 参数:cmpp30icp_submit *msg submit消息包结构 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_init(cmpp30icp_submit *msg);/*** * 功能:设置submit消息包结构的pk_total字段 * 参数:cmpp30icp_submit *msg submit消息包结构 *      dpl_uint8_t pk_total 要设置的pk_total值 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_set_pk_total(cmpp30icp_submit *msg, dpl_uint8_t pk_total);/*** * 功能:设置submit消息包结构的pk_number字段 * 参数:cmpp30icp_submit *msg submit消息包结构 *      dpl_uint8_t pk_number 要设置的pk_number值 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_set_pk_number(cmpp30icp_submit *msg, dpl_uint8_t pk_number);/*** * 功能:设置submit消息包结构的registered_delivery字段 * 参数:cmpp30icp_submit *msg submit消息包结构 *      dpl_uint8_t registered_delivery 要设置的registered_delivery值 *         0 不需要状态报告 *         1 需要状态报告 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_set_registered_delivery(cmpp30icp_submit *msg, dpl_uint8_t registered_delivery);/*** * 功能:设置submit消息包结构的msg_level字段 * 参数:cmpp30icp_submit *msg submit消息包结构 *      dpl_uint8_t msg_level 要设置的msg_level值 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_set_msg_level(cmpp30icp_submit *msg, dpl_uint8_t msg_level);/*** * 功能:设置submit消息包结构的svc_type字段 * 参数:cmpp30icp_submit *msg submit消息包结构 *      const char *svc_type 要设置的业务标识值 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_set_svc_type(cmpp30icp_submit *msg, const char *svc_type);/*** * 功能:设置submit消息包结构的fee_utype字段 * 参数:cmpp30icp_submit *msg submit消息包结构 *      dpl_uint8_t fee_utype 要设置的计费用户类型字段值 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_set_fee_utype(cmpp30icp_submit *msg, dpl_uint8_t fee_utype);/*** * 功能:设置submit消息包结构的fee_user和fee_user_type字段 * 参数:cmpp30icp_submit *msg submit消息包结构 *      const char *fee_user 要设置的被计费用户的号码值  *      dpl_uint8_t fee_user_type 要设置的被计费用户的号码类型值 *         0 真实号码 *         1 伪码 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_set_fee_user(cmpp30icp_submit *msg, const char *fee_user, dpl_uint8_t fee_user_type);/*** * 功能:设置submit消息包结构的tp_pid字段 * 参数:cmpp30icp_submit *msg submit消息包结构 *      dpl_uint8_t tp_pid 要设置tp_pid值 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_set_tp_pid(cmpp30icp_submit *msg, dpl_uint8_t tp_pid);/*** * 功能:设置submit消息包结构的tp_udhi字段 * 参数:cmpp30icp_submit *msg submit消息包结构 *      dpl_uint8_t tp_udhi 要设置tp_udhi值 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_set_tp_udhi(cmpp30icp_submit *msg, dpl_uint8_t tp_udhi);/*** * 功能:设置submit消息包结构的data_coding字段 * 参数:cmpp30icp_submit *msg submit消息包结构 *      dpl_uint8_t data_coding 要设置的信息格式值 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_set_data_coding(cmpp30icp_submit *msg, dpl_uint8_t data_coding);/*** * 功能:设置submit消息包结构的icp_id字段 * 参数:cmpp30icp_submit *msg submit消息包结构 *      const char *icp_id 要设置的信息内容来源值 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_set_icp_id(cmpp30icp_submit *msg, const char *icp_id);/*** * 功能:设置submit消息包结构的fee_type字段 * 参数:cmpp30icp_submit *msg submit消息包结构 *      const char *fee_type 要设置的资费类别值 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_set_fee_type(cmpp30icp_submit *msg, const char *fee_type);/*** * 功能:设置submit消息包结构的fee_code字段 * 参数:cmpp30icp_submit *msg submit消息包结构 *      const char *fee_code 要设置的资费代码值 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_set_fee_code(cmpp30icp_submit *msg, const char *fee_code);/*** * 功能:设置submit消息包结构的validate字段 * 参数:cmpp30icp_submit *msg submit消息包结构 *      const char *validate 要设置的存活有效期值 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_set_validate(cmpp30icp_submit *msg, const char *validate);/*** * 功能:设置submit消息包结构的schedule字段 * 参数:cmpp30icp_submit *msg submit消息包结构 *      const char *schedule 要设置的定时发送时间值 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_set_schedule(cmpp30icp_submit *msg, const char *schedule);/*** * 功能:设置submit消息包结构的src_term_id字段 * 参数:cmpp30icp_submit *msg submit消息包结构 *      const char *src_term_id  要设置的源号码值 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_set_src_term_id(cmpp30icp_submit *msg, const char *src_term_id);/*** * 功能:设置submit消息包结构的du_count字段 * 参数:cmpp30icp_submit *msg submit消息包结构 *      dpl_uint8_t du_count 要设置的接收信息的用户数量值 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_set_du_count(cmpp30icp_submit *msg, dpl_uint8_t du_count);/*** * 功能:设置submit消息包结构的dst_addr和dst_user_type字段 * 参数:cmpp30icp_submit *msg submit消息包结构 *      const char *dst_addr 要设置的接收短信的MSISDN号码值 *      int i 要设置的第几个目的用户 *      dpl_uint8_t dst_user_type 要设置的接收短信的用户的号码类型值 *          0 真实号码 *          1 伪码 *          注意:对于群发消息要么全是真实号码,要么全是伪码 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_set_dst_addr(cmpp30icp_submit *msg, const char *dst_addr, int i, \                                                                                        dpl_uint8_t dst_user_type);/*** * 功能:设置submit消息包结构的short_msg和sm_len字段 * 参数:cmpp30icp_submit *msg submit消息包结构 *      const char *short_msg 要设置的短信息内容 *      dpl_uint8_t size 要设置的短信息内容长度 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_set_short_msg(cmpp30icp_submit *msg, void *short_msg, dpl_uint8_t size);/*** * 功能:设置submit消息包结构的link_id字段 * 参数:cmpp30icp_submit *msg submit消息包结构 *      const char *link_id 要设置的link_id值 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_submit_set_link_id(cmpp30icp_submit *msg, char *link_id);/*** * 功能:读取来自网关的各种消息 * 参数:cmpp30_icp_trans *trans 连接描述符结构 *      cmpp30_icp_packet *pk 来自网关各种消息结构的联合 *      dpl_uint32_t *status 如果读取消息失败,该参数填充状态值 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_read_packet(cmpp30_icp_trans *trans, cmpp30_icp_packet *pk, \                                                                        dpl_uint32_t *status);/*** * 功能:接收到网关deliver消息后,调用此函数发送deliver应答包 * 参数:cmpp30_icp_trans *trans 连接描述符结构 *      cmpp30icp_deliver_rsp *pk deliver应答包结构 *      dpl_uint32_t seq 接收到的deliver包的包头中的seq * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI  cmpp30icp_deliver_resp_send(cmpp30_icp_trans *trans, cmpp30icp_deliver_rsp *pk, dpl_uint32_t seq);/*** * 功能:如果deliver消息包中的源用户是伪码,可以调用此函数把源用户的伪吗转换成base64编码格式 * 参数:char *out 源用户伪码的base64编码格式输出,out指向的缓冲区长度有50个字节长度即可 *      char *src_addr 源用户 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_convert_src_addr_to_base64(char *out, char *src_addr);/*** * 功能:向网关发送logout包  * 参数:cmpp30_icp_trans *conn 连接描述符结构 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30icp_logout_send(cmpp30_icp_trans *conn);/*** * 功能:关闭和网关通讯的socket连接 * 参数:cmpp30_icp_trans *conn 连接描述符结构 * 返回值:0 成功 *        其它 失败 ***/CMPP_API dpl_status_t WINAPI cmpp30_disconnect_from_ismg(cmpp30_icp_trans *conn);


/***
 * 功能:转换网络字节顺序为主机字节顺序(8字节数据)
 ***/
CMPP_API dpl_uint64_t WINAPI ntohll(dpl_uint64_t number);
/************************************************************************************//* 3:end *//*****************************************************************************************//********************************************************************************//* 4:sp与网关通讯的错误码表,sp可以根据此表查看网关拒绝掉消息的原因 *//*******************************************************************************/#define CMPP30_IS_NACK_ERR(errcode)     ( ((errcode) > CMPP30_RSP_OTHER_ERR)&&((errcode) < 0X10 ))#define CMPP30_RSP_SUCCESS              0x00000000L#define CMPP30_RSP_INVAL_STRUCT         0x00000001L     /*不合法的消息结构*/#define CMPP30_RSP_UNKNOWN_CMD          0x00000002L     /*不能识别的命令*/#define CMPP30_RSP_PK_SEQ_REPEAT        0x00000003L     /*包序号重复*/#define CMPP30_RSP_INVAL_MSG_LEN        0x00000004L     /*不合法的消息长度*/#define CMPP30_RSP_INFO_FEE_EXCEED      0x00000005L     /*信息费过大*/#define CMPP30_RSP_SMLEN_EXCEED         0x00000006L     /*短消息过长*/#define CMPP30_RSP_INVAL_SVC_ID         0x00000007L     /*不合法的服务ID*/#define CMPP30_RSP_INVAL_SVC_TYPE       0x00000007L     /*不合法的服务类型*/#define CMPP30_RSP_MQ_FULL              0x00000008L     /*发送队列满*/#define CMPP30_RSP_MSG_NOT_FOUND        0x00000001L     /*找不到对应msgid的短消息*/#define CMPP30_RSP_INVAL_MSGID          0x00000001L     /*不合法的消息标识*/#define CMPP30_RSP_INVAL_ICP            0x00000002L     /* 不合法的ICP_ID */#define CMPP30_RSP_INVAL_AUTH           0x00000003L     /* 不合法的ICP授权 */#define CMPP30_RSP_INVAL_VERSION        0x00000004L     /* 不正确的版本 */#define CMPP30_RSP_INVAL_BIND_TYPE      0x00000005L     /* 不合法的绑定类型 */#define CMPP30_RSP_BINDED               0x00000005L     /* 已经正确BIND */#define CMPP30_RSP_BIND_EXCEED          0x00000005L     /* 超过最大允许连接数*//******以下是新增加的错误代码*******/#define CMPP30_RSP_NO_RIGHT             0x00000009L     /*没有权限*/#define CMPP30_RSP_FEEUSR_NORIGHT       0x00000009L     /*计费用户无权限*/#define CMPP30_RSP_SRC_ADDR_UNKNOWN     0x0000000aL     /*不合法的源地址 */#define CMPP30_RSP_ICP_ID_UNKNOWN       0x0000000bL     /*未知ICP */#define CMPP30_RSP_INVAL_FEEUSR         0x0000000cL     /*不合法的计费用户*/#define CMPP30_RSP_DST_ADDR_UNKNOWN     0x0000000dL     /*没有目的地址,目的地址不合法*//**** 以下是自定义错误代码 ****/#define CMPP30_RSP_SYNC_ERR             0x00000064L     /*同步错误*/#define CMPP30_RSP_NOT_BIND             0x00000065L     /* 尚未正确Bind */#define CMPP30_RSP_INVAL_MSG_MODE       0x00000066L     /*不合法的消息模式*/#define CMPP30_RSP_INVAL_DATA_CODING    0x00000067L     /*不合法的数据编码*/#define CMPP30_RSP_INVAL_FEE_TYPE       0x00000068L     /*不合法的计费类型*/#define CMPP30_RSP_INVAL_DATETIME       0x00000069L     /*不合法的日期格式*/#define CMPP30_RSP_DSTS_EXCEED          0x0000006aL     /*目标地址数量过多*/#define CMPP30_RSP_INVAL_MSISDN         0x0000006bL     /*不合法的msisdn*/#define CMPP30_RSP_INVAL_PARA           0x0000006cL     /*不合法的参数*/#define CMPP30_RSP_NO_ROUTE             0x0000006dL     /*找不到路由*/#define CMPP30_RSP_SCHEDULE_EXCEED      0x0000006eL     /*定时发送时间太大*/#define CMPP30_RSP_EXP_TIME             0x00000070L     /* 过期时间非法 */#define CMPP30_RSP_INVAL_FUTYPE         0x00000080L     /*不合法的计费用户类型*/#define CMPP30_RSP_PK_SEQ_EXCEED        0x00000081L     /*包序号越界*/#define CMPP30_RSP_INVAL_ISMG           0x00000082L     /*不合法的ISMG标识*/#define CMPP30_RSP_INVAL_DEST_GATEWAY   0x00000083L     /*不合法的目的网关*/#define CMPP30_RSP_INVAL_STATUS_RPT     0x00000084L     /*不合法的状态报告*/#define CMPP30_RSP_SMSC_UNKNOWN         0x00000085L     /*未知SMSC */#define CMPP30_RSP_INVAL_LOCALE         0x00000086L     /*未知LOCALE */#define CMPP30_RSP_INVAL_INFO_FEE       0x00000090L     /* 信息费非法 */#define CMPP30_RSP_TOO_FAST             0x00000091L     /* 发送速度过快 */#define CMPP30_RSP_DSTUSR_REPT          0x00000092L     /* 目的用户重复 */#define CMPP30_RSP_INVAL_PK_NUM         0x00000093L     /* pk_number > pk_total error*//*****************************************************************************//* 4:end *//*****************************************************************************/#ifdef __cplusplus}#endif#endif

⌨️ 快捷键说明

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