Documentation ¶
Index ¶
- Constants
- Variables
- func NewDeliver(cli *auth.Client, phone string, destNo string, txt string, seq uint32) codec.RequestPdu
- func NewSubmit(cli *auth.Client, phones []string, content string, seq uint32, ...) (messages []codec.RequestPdu)
- type ActiveTest
- type ActiveTestRsp
- type CommandId
- type DeliverRsp
- type Delivery
- func (d *Delivery) Decode(seq uint32, frame []byte) error
- func (d *Delivery) DestTermID() string
- func (d *Delivery) Encode() []byte
- func (d *Delivery) IsReport() bool
- func (d *Delivery) Log() []log.Field
- func (d *Delivery) MsgBytes() []byte
- func (d *Delivery) MsgContent() string
- func (d *Delivery) MsgFormat() byte
- func (d *Delivery) MsgId() []byte
- func (d *Delivery) MsgLength() byte
- func (d *Delivery) RecvTime() string
- func (d *Delivery) Report() *Report
- func (d *Delivery) Reserve() string
- func (d *Delivery) SrcTermID() string
- func (d *Delivery) String() string
- func (d *Delivery) TlvList() *utils.TlvList
- func (d *Delivery) ToResponse(code uint32) codec.Pdu
- type Exit
- type ExitRsp
- type Login
- func (l *Login) AuthenticatorClient() []byte
- func (l *Login) Check(cli *auth.Client) Status
- func (l *Login) ClientID() string
- func (l *Login) Decode(seq uint32, frame []byte) error
- func (l *Login) Encode() []byte
- func (l *Login) Log() []log.Field
- func (l *Login) LoginMode() byte
- func (l *Login) SetSecret(secret string)
- func (l *Login) String() string
- func (l *Login) Timestamp() uint32
- func (l *Login) ToResponse(code uint32) codec.Pdu
- type LoginRsp
- type MessageHeader
- type MtOptions
- type Report
- func (rt *Report) Decode(frame []byte) error
- func (rt *Report) Dlvrd() string
- func (rt *Report) DoneDate() string
- func (rt *Report) Encode() []byte
- func (rt *Report) Id() []byte
- func (rt *Report) Stat() string
- func (rt *Report) String() string
- func (rt *Report) Sub() string
- func (rt *Report) SubmitDate() string
- type Status
- type Submit
- func (s *Submit) AtTime() string
- func (s *Submit) ChargeTermID() string
- func (s *Submit) Decode(seq uint32, frame []byte) error
- func (s *Submit) DestTermID() []string
- func (s *Submit) DestTermIDCount() byte
- func (s *Submit) Encode() []byte
- func (s *Submit) FeeCode() string
- func (s *Submit) FeeType() string
- func (s *Submit) FixedFee() string
- func (s *Submit) Log() []log.Field
- func (s *Submit) MsgBytes() []byte
- func (s *Submit) MsgContent() string
- func (s *Submit) MsgFormat() byte
- func (s *Submit) MsgLength() byte
- func (s *Submit) MsgType() byte
- func (s *Submit) NeedReport() byte
- func (s *Submit) Priority() byte
- func (s *Submit) Reserve() string
- func (s *Submit) ServiceID() string
- func (s *Submit) SetOptions(cli *auth.Client, options MtOptions)
- func (s *Submit) SrcTermID() string
- func (s *Submit) String() string
- func (s *Submit) TlvList() *utils.TlvList
- func (s *Submit) ToResponse(code uint32) codec.Pdu
- func (s *Submit) ValidTime() string
- type SubmitRsp
- type Version
Constants ¶
View Source
const ( LoginLen = 42 LoginRespLen = 33 )
View Source
const ( V30 Version = 0x30 V20 Version = 0x20 V13 Version = 0x13 TP_pid = uint16(0x0001) TP_udhi = uint16(0x0002) PkTotal = uint16(0x0009) PkNumber = uint16(0x000A) LinkID = uint16(0x0003) ChargeUserType = uint16(0x0004) ChargeTermType = uint16(0x0005) ChargeTermPseudo = uint16(0x0006) DestTermType = uint16(0x0007) DestTermPseudo = uint16(0x0008) SubmitMsgType = uint16(0x000B) SPDealReslt = uint16(0x000C) SrcTermType = uint16(0x000D) SrcTermPseudo = uint16(0x000E) NodesCount = uint16(0x000F) MsgSrc = uint16(0x0010) SrcType = uint16(0x0011) MServiceID = uint16(0x0012) )
View Source
const MtBaseLen = 126
View Source
const RptLen = 10 + 3 + 3 + 10 + 10 + 7 + 3 + 20 + len("id: sub: dlvrd: submit date: done date: stat: err: text:")
Variables ¶
View Source
var ( GbEncoder = simplifiedchinese.GB18030.NewEncoder() GbDecoder = simplifiedchinese.GB18030.NewDecoder() )
View Source
var StatMap = map[uint32]string{
0: "成功",
1: "系统忙",
2: "超过最大连接数",
10: "消息结构错",
11: "命令字错",
12: "序列号重复",
20: "IP地址错",
21: "认证错",
22: "版本太高",
30: "非法消息类型(MsgType)",
31: "非法优先级(LruPriority)",
32: "非法资费类型(FeeType)",
33: "非法资费代码(FeeCode)",
34: "非法短消息格式(MsgFormat)",
35: "非法时间格式",
36: "非法短消息长度(MsgLength)",
37: "有效期已过",
38: "非法查询类别(QueryType)",
39: "路由错误",
40: "非法包月费/封顶费(FixedFee)",
41: "非法更新类型(UpdateType)",
42: "非法路由编号(RouteId)",
43: "非法服务代码(ServiceId)",
44: "非法有效期(ValidTime)",
45: "非法定时发送时间(AtTime)",
46: "非法发送用户号码(SrcTermId)",
47: "非法接收用户号码(DestTermId)",
48: "非法计费用户号码(ChargeTermId)",
49: "非法SP服务代码(SPCode)",
56: "非法源网关代码(SrcGatewayID)",
57: "非法查询号码(QueryTermID)",
58: "没有匹配路由",
59: "非法SP类型(SPType)",
60: "非法上一条路由编号(LastRouteID)",
61: "非法路由类型(RouteType)",
62: "非法目标网关代码(DestGatewayID)",
63: "非法目标网关IP(DestGatewayIP)",
64: "非法目标网关端口(DestGatewayPort)",
65: "非法路由号码段(TermRangeID)",
66: "非法终端所属省代码(ProvinceCode)",
67: "非法用户类型(UserType)",
68: "本节点不支持路由更新",
69: "非法SP企业代码(SPID)",
70: "非法SP接入类型(SPAccessType)",
71: "路由信息更新失败",
72: "非法时间戳(Time)",
73: "非法业务代码(MServiceID)",
74: "SP禁止下发时段",
75: "SP发送超过日流量",
76: "SP帐号过有效期",
}
Functions ¶
func NewDeliver ¶
Types ¶
type ActiveTest ¶
type ActiveTest MessageHeader
func NewActiveTest ¶
func NewActiveTest(seq uint32) *ActiveTest
func (*ActiveTest) Encode ¶
func (t *ActiveTest) Encode() []byte
func (*ActiveTest) Log ¶
func (t *ActiveTest) Log() []log.Field
func (*ActiveTest) String ¶
func (t *ActiveTest) String() string
func (*ActiveTest) ToResponse ¶
func (t *ActiveTest) ToResponse(_ uint32) codec.Pdu
type ActiveTestRsp ¶
type ActiveTestRsp MessageHeader
func (*ActiveTestRsp) Encode ¶
func (r *ActiveTestRsp) Encode() []byte
func (*ActiveTestRsp) Log ¶
func (r *ActiveTestRsp) Log() []log.Field
func (*ActiveTestRsp) String ¶
func (r *ActiveTestRsp) String() string
type DeliverRsp ¶
type DeliverRsp struct { MessageHeader // 协议版本,不是报文内容,但在调用encode方法前需要设置此值 Version Version // contains filtered or unexported fields }
func (*DeliverRsp) Encode ¶
func (r *DeliverRsp) Encode() []byte
func (*DeliverRsp) Log ¶
func (r *DeliverRsp) Log() (rt []log.Field)
func (*DeliverRsp) MsgId ¶
func (r *DeliverRsp) MsgId() string
func (*DeliverRsp) Status ¶
func (r *DeliverRsp) Status() Status
func (*DeliverRsp) String ¶
func (r *DeliverRsp) String() string
type Delivery ¶ added in v0.4.0
type Delivery struct { MessageHeader // 协议版本,不是报文内容,但在调用encode方法前需要设置此值 Version Version // contains filtered or unexported fields }
func NewDeliveryReport ¶
func (*Delivery) DestTermID ¶ added in v0.4.0
func (*Delivery) MsgContent ¶ added in v0.4.0
type Exit ¶
type Exit MessageHeader
type ExitRsp ¶
type ExitRsp MessageHeader
type Login ¶
type Login struct { MessageHeader // 【12字节】消息头 Version Version // 【1字节】客户端支持的协议版本号 // contains filtered or unexported fields }
func (*Login) AuthenticatorClient ¶
type LoginRsp ¶
type LoginRsp struct { MessageHeader // 协议头, 12字节 Version Version // 版本,1字节 // contains filtered or unexported fields }
func (*LoginRsp) AuthenticatorServer ¶
type MessageHeader ¶
func (*MessageHeader) Decode ¶
func (h *MessageHeader) Decode(frame []byte) error
func (*MessageHeader) Encode ¶
func (h *MessageHeader) Encode() []byte
func (*MessageHeader) Log ¶
func (h *MessageHeader) Log() []log.Field
func (*MessageHeader) String ¶
func (h *MessageHeader) String() string
type Report ¶
type Report struct {
// contains filtered or unexported fields
}
func (*Report) SubmitDate ¶ added in v0.4.0
type Submit ¶
type Submit struct { MessageHeader // 协议版本,不是报文内容,但在调用encode方法前需要设置此值 Version Version // contains filtered or unexported fields }
func (*Submit) ChargeTermID ¶
func (*Submit) DestTermID ¶
func (*Submit) DestTermIDCount ¶
func (*Submit) MsgContent ¶
func (*Submit) NeedReport ¶
type SubmitRsp ¶
type SubmitRsp struct { MessageHeader // 协议版本,不是报文内容,但在调用encode方法前需要设置此值 Version Version // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.