Documentation ¶
Index ¶
- Constants
- Variables
- func MsgFmt(content string) uint8
- func MsgSlices(fmt uint8, content string) (slices [][]byte)
- func NewDelivery(phone string, msg string, dest string, serviceId string) codec.RequestPdu
- func NewSubmit(phones []string, content string, opts ...Option) (messages []codec.RequestPdu)
- func NewTerminate() codec.IHead
- func NewTerminateResp(seq uint32) codec.IHead
- func TrimStr(bts []byte) string
- func V3() bool
- type ActiveTest
- type ActiveTestResp
- type Connect
- type ConnectResp
- type Delivery
- type DeliveryResp
- type MessageHeader
- type MtOptions
- type Option
- func MtAtTime(t time.Time) Option
- func MtAtTimeStr(s string) Option
- func MtFeeCode(s string) Option
- func MtFeeTerminalId(id string) Option
- func MtFeeTerminalType(t uint8) Option
- func MtFeeType(s string) Option
- func MtFeeUsertype(t uint8) Option
- func MtLinkID(s string) Option
- func MtMsgLevel(l uint8) Option
- func MtRegisteredDel(tf uint8) Option
- func MtServiceId(id string) Option
- func MtSrcId(s string) Option
- func MtValidTime(s string) Option
- func WithOptions(opt *MtOptions) Option
- type Report
- type Submit
- type SubmitResp
Constants ¶
View Source
const ( HeadLength = 12 // 报文头长度 CMPP_CONNECT = uint32(0x00000001) // 请求连接 CMPP_CONNECT_RESP = uint32(0x80000001) // 请求连接应答 CMPP_TERMINATE = uint32(0x00000002) // 终止连接 CMPP_TERMINATE_RESP = uint32(0x80000002) // 终止连接应答 CMPP_SUBMIT = uint32(0x00000004) // 提交短信 CMPP_SUBMIT_RESP = uint32(0x80000004) // 提交短信应答 CMPP_DELIVER = uint32(0x00000005) // 短信下发 CMPP_DELIVER_RESP = uint32(0x80000005) // 下发短信应答 CMPP_ACTIVE_TEST = uint32(0x00000008) // 激活测试 CMPP_ACTIVE_TEST_RESP = uint32(0x80000008) // 激活测试应答 )
Variables ¶
View Source
var CommandMap = make(map[uint32]string)
View Source
var Conf yaml_config.YmlConfig
View Source
var ConnectStatusMap = map[uint32]string{
0: "成功",
1: "消息结构错",
2: "非法源地址",
3: "认证错",
4: "版本太高",
5: "其他错误",
}
View Source
var DeliveryResultMap = map[uint32]string{
0: "正确",
1: "消息结构错",
2: "命令字错",
3: "消息序号重复",
4: "消息长度错",
5: "资费代码错",
6: "超过最大信息长",
7: "业务代码错",
8: "流量控制错",
9: "未知错误",
}
View Source
var ErrorPacket = errors.New("error packet")
View Source
var ReportSeq codec.Sequence32
View Source
var Seq32 codec.Sequence32
View Source
var Seq64 codec.Sequence64
View Source
var SubmitResultMap = map[uint32]string{
0: "正确",
1: "消息结构错",
2: "命令字错",
3: "消息序号重复",
4: "消息长度错",
5: "资费代码错",
6: "超过最大信息长",
7: "业务代码错",
8: "流量控制错",
9: "本网关不负责服务此计费号码",
10: "Src_Id 错误",
11: "Msg_src 错误",
12: "Fee_terminal_Id 错误",
13: "Dest_terminal_Id 错误",
}
Functions ¶
func NewDelivery ¶
func NewSubmit ¶
func NewSubmit(phones []string, content string, opts ...Option) (messages []codec.RequestPdu)
func NewTerminate ¶
func NewTerminateResp ¶
Types ¶
type ActiveTest ¶
type ActiveTest struct {
*MessageHeader
}
func NewActiveTest ¶
func NewActiveTest() *ActiveTest
func (*ActiveTest) Encode ¶
func (at *ActiveTest) Encode() []byte
func (*ActiveTest) String ¶
func (at *ActiveTest) String() string
func (*ActiveTest) ToResponse ¶
func (at *ActiveTest) ToResponse(_ uint32) interface{}
type ActiveTestResp ¶
type ActiveTestResp struct { *MessageHeader // contains filtered or unexported fields }
func (*ActiveTestResp) Decode ¶
func (at *ActiveTestResp) Decode(header codec.IHead, frame []byte) error
func (*ActiveTestResp) Encode ¶
func (at *ActiveTestResp) Encode() []byte
func (*ActiveTestResp) String ¶
func (at *ActiveTestResp) String() string
type Connect ¶
type Connect struct { *MessageHeader // +12 = 12:消息头 // contains filtered or unexported fields }
func NewConnect ¶
func NewConnect() *Connect
func (*Connect) ToResponse ¶
type ConnectResp ¶
type ConnectResp struct { *MessageHeader // 协议头, 12字节 // contains filtered or unexported fields }
func (*ConnectResp) Decode ¶
func (resp *ConnectResp) Decode(header codec.IHead, frame []byte) error
func (*ConnectResp) Encode ¶
func (resp *ConnectResp) Encode() []byte
func (*ConnectResp) Status ¶
func (resp *ConnectResp) Status() uint32
func (*ConnectResp) String ¶
func (resp *ConnectResp) String() string
type Delivery ¶
type Delivery struct { *MessageHeader // contains filtered or unexported fields }
Delivery 上行短信或状态报告,不支持长短信
func (*Delivery) RegisteredDelivery ¶
func (*Delivery) ToResponse ¶
type DeliveryResp ¶
type DeliveryResp struct { *MessageHeader // contains filtered or unexported fields }
func (*DeliveryResp) Encode ¶
func (r *DeliveryResp) Encode() []byte
func (*DeliveryResp) SetResult ¶
func (r *DeliveryResp) SetResult(result uint32)
func (*DeliveryResp) String ¶
func (r *DeliveryResp) String() string
type MessageHeader ¶
func (*MessageHeader) Decode ¶
func (header *MessageHeader) Decode(frame []byte) error
func (*MessageHeader) Encode ¶
func (header *MessageHeader) Encode() []byte
func (*MessageHeader) String ¶
func (header *MessageHeader) String() string
type Option ¶
type Option func(mtOps *MtOptions)
func MtFeeTerminalId ¶
MtFeeTerminalId 计费号码与FeeTerminalType配合使用
func MtFeeTerminalType ¶
MtFeeTerminalType 被计费用户的号码类型,0:真实号码;1:伪码
func MtFeeType ¶
MtFeeType 资费类别 01:对“计费用户号码”免费 02:对“计费用户号码”按条计信息费 03:对“计费用户号码”按包月收取信息费 04:对“计费用户号码”的信息费封顶 05:对“计费用户号码”的收费是由SP实现
func MtFeeUsertype ¶
MtFeeUsertype 计费用户类型字段 0:对目的终端MSISDN计费; 1:对源终端MSISDN计费; 2:对SP计费; 3:表示本字段无效,对谁计费参见Fee_terminal_Id 字段。
type Submit ¶
type Submit struct { *MessageHeader // 消息头,【12字节】 // contains filtered or unexported fields }
func (*Submit) ToDeliveryReport ¶
func (*Submit) ToResponse ¶
type SubmitResp ¶
type SubmitResp struct { *MessageHeader // contains filtered or unexported fields }
func (*SubmitResp) Encode ¶
func (resp *SubmitResp) Encode() []byte
func (*SubmitResp) MsgId ¶
func (resp *SubmitResp) MsgId() uint64
func (*SubmitResp) Result ¶
func (resp *SubmitResp) Result() uint32
func (*SubmitResp) String ¶
func (resp *SubmitResp) String() string
Click to show internal directories.
Click to hide internal directories.