Documentation ¶
Index ¶
- Constants
- Variables
- func NewDeliver(srcNo string, destNo string, txt string) codec.RequestPdu
- func NewSubmit(phones []string, content string, options MtOptions) (messages []codec.RequestPdu)
- type ActiveTest
- type ActiveTestResp
- type Deliver
- type DeliverResp
- type Exit
- type ExitResp
- type Login
- type LoginResp
- type MessageHeader
- type MtOptions
- type Report
- type Submit
- type SubmitResp
Constants ¶
View Source
const ( 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 ( HeadLength = 12 // 报文头长度 CmdLogin = uint32(0x00000001) // 客户端登录 CmdLoginResp = uint32(0x80000001) // 客户端登录应答 CmdSubmit = uint32(0x00000002) // 提交短消息 CmdSubmitResp = uint32(0x80000002) // 提交短消息应答 CmdDeliver = uint32(0x00000003) // 下发短消息 CmdDeliverResp = uint32(0x80000003) // 下发短消息应答 CmdActiveTest = uint32(0x00000004) // 链路检测 CmdActiveTestResp = uint32(0x80000004) // 链路检测应答 CmdExit = uint32(0x00000006) // 退出请求 CmdExitResp = uint32(0x80000006) // 退出应答 )
View Source
const ( LoginLen = 42 LoginRespLen = 33 )
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 CommandMap = make(map[uint32]string)
View Source
var Conf yaml_config.YmlConfig
View Source
var ConnectStatusMap = map[uint32]string{
0: "成功",
1: "系统忙",
2: "超过最大连接数",
10: "消息结构错",
11: "命令字错",
12: "序列号重复",
20: "IP地址错",
21: "认证错",
22: "版本太高",
30: "非法消息类型(MsgType)",
31: "非法优先级(Priority)",
32: "非法资费类型(FeeType)",
33: "非法资费代码(FeeCode)",
}
View Source
var ErrorPacket = errors.New("error packet")
View Source
var GbDecoder = simplifiedchinese.GB18030.NewDecoder()
View Source
var GbEncoder = simplifiedchinese.GB18030.NewEncoder()
View Source
var Seq32 codec.Sequence32
View Source
var Seq80 codec.SequenceBCD
View Source
var StatMap = map[uint32]string{
0: "成功",
1: "系统忙",
2: "超过最大连接数",
10: "消息结构错",
11: "命令字错",
12: "序列号重复",
20: "IP地址错",
21: "认证错",
22: "版本太高",
30: "非法消息类型(MsgType)",
31: "非法优先级(Priority)",
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 ¶
func NewDeliver(srcNo string, destNo string, txt string) codec.RequestPdu
Types ¶
type ActiveTest ¶
type ActiveTest 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 ¶ added in v1.0.0
type ActiveTestResp MessageHeader
func NewActiveTestResp ¶ added in v1.0.0
func NewActiveTestResp(seq uint32) *ActiveTestResp
func (*ActiveTestResp) Decode ¶ added in v1.0.0
func (resp *ActiveTestResp) Decode(header codec.IHead, _ []byte) error
func (*ActiveTestResp) Encode ¶ added in v1.0.0
func (resp *ActiveTestResp) Encode() []byte
func (*ActiveTestResp) String ¶ added in v1.0.0
func (resp *ActiveTestResp) String() string
type Deliver ¶ added in v1.0.0
type Deliver struct { *MessageHeader // contains filtered or unexported fields }
func NewDeliveryReport ¶
func (*Deliver) ToResponse ¶ added in v1.0.0
type DeliverResp ¶ added in v1.0.0
type DeliverResp struct { *MessageHeader // contains filtered or unexported fields }
func (*DeliverResp) Decode ¶ added in v1.0.0
func (r *DeliverResp) Decode(header codec.IHead, frame []byte) error
func (*DeliverResp) Encode ¶ added in v1.0.0
func (r *DeliverResp) Encode() []byte
func (*DeliverResp) MsgId ¶ added in v1.0.0
func (r *DeliverResp) MsgId() string
func (*DeliverResp) String ¶ added in v1.0.0
func (r *DeliverResp) String() string
type ExitResp ¶ added in v1.0.0
type ExitResp MessageHeader
func NewExitResp ¶ added in v1.0.0
type Login ¶
type Login struct { *MessageHeader // 【12字节】消息头 // contains filtered or unexported fields }
func (*Login) ToResponse ¶
type LoginResp ¶ added in v1.0.0
type LoginResp struct { *MessageHeader // 协议头, 12字节 // contains filtered or unexported fields }
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 Submit ¶
type Submit struct { *MessageHeader // contains filtered or unexported fields }
func (*Submit) SetOptions ¶
func (*Submit) ToResponse ¶
type SubmitResp ¶ added in v1.0.0
type SubmitResp struct { *MessageHeader // contains filtered or unexported fields }
func (*SubmitResp) Decode ¶ added in v1.0.0
func (r *SubmitResp) Decode(header codec.IHead, frame []byte) error
func (*SubmitResp) Encode ¶ added in v1.0.0
func (r *SubmitResp) Encode() []byte
func (*SubmitResp) MsgId ¶ added in v1.0.0
func (r *SubmitResp) MsgId() []byte
func (*SubmitResp) Status ¶ added in v1.0.0
func (r *SubmitResp) Status() uint32
func (*SubmitResp) String ¶ added in v1.0.0
func (r *SubmitResp) String() string
Click to show internal directories.
Click to hide internal directories.