Documentation
¶
Index ¶
- Constants
- Variables
- func NewDelivery(ac *codec.AuthConf, phone, msg, dest, serviceId string, seq uint32) codec.RequestPdu
- func NewSubmit(ac *codec.AuthConf, phones []string, content string, seq uint32, ...) (messages []codec.RequestPdu)
- type ActiveTest
- type ActiveTestRsp
- type CommandId
- type ConnStatus
- type Connect
- func (c *Connect) AuthenticatorSource() []byte
- func (c *Connect) Check(ac *codec.AuthConf) ConnStatus
- func (c *Connect) Decode(seq uint32, frame []byte) error
- func (c *Connect) Encode() []byte
- func (c *Connect) Log() []log.Field
- func (c *Connect) SetSecret(secret string)
- func (c *Connect) SourceAddr() string
- func (c *Connect) Timestamp() uint32
- func (c *Connect) ToResponse(code uint32) codec.Pdu
- type ConnectResp
- type Delivery
- func (d *Delivery) Decode(seq uint32, frame []byte) error
- func (d *Delivery) DestId() string
- func (d *Delivery) Encode() []byte
- func (d *Delivery) IsReport() bool
- func (d *Delivery) LinkID() string
- func (d *Delivery) Log() []log.Field
- func (d *Delivery) MsgContent() string
- func (d *Delivery) MsgFmt() uint8
- func (d *Delivery) MsgId() uint64
- func (d *Delivery) MsgLength() uint8
- func (d *Delivery) Report() *Report
- func (d *Delivery) ServiceId() string
- func (d *Delivery) SrcTerminalId() string
- func (d *Delivery) SrcTerminalType() uint8
- func (d *Delivery) ToResponse(code uint32) codec.Pdu
- func (d *Delivery) TpPid() uint8
- func (d *Delivery) TpUdhi() uint8
- type DeliveryRsp
- type DlyResult
- type MessageHeader
- type MtResult
- type Report
- func (rt *Report) Decode(frame []byte) error
- func (rt *Report) DestTerminalId() string
- func (rt *Report) DoneTime() string
- func (rt *Report) Encode() []byte
- func (rt *Report) MsgId() uint64
- func (rt *Report) SmscSequence() uint32
- func (rt *Report) Stat() string
- func (rt *Report) String() string
- func (rt *Report) SubmitTime() string
- type Submit
- func (s *Submit) AtTime() string
- func (s *Submit) Decode(seq uint32, frame []byte) error
- func (s *Submit) DestTerminalId() string
- func (s *Submit) DestTerminalType() uint8
- func (s *Submit) DestUsrTl() uint8
- func (s *Submit) Encode() []byte
- func (s *Submit) FeeCode() string
- func (s *Submit) FeeTerminalId() string
- func (s *Submit) FeeTerminalType() uint8
- func (s *Submit) FeeType() string
- func (s *Submit) FeeUsertype() uint8
- func (s *Submit) LinkID() string
- func (s *Submit) Log() []log.Field
- func (s *Submit) MsgContent() []byte
- func (s *Submit) MsgFmt() uint8
- func (s *Submit) MsgId() uint64
- func (s *Submit) MsgLength() uint8
- func (s *Submit) MsgLevel() uint8
- func (s *Submit) MsgSrc() string
- func (s *Submit) PkNumber() uint8
- func (s *Submit) PkTotal() uint8
- func (s *Submit) RegisteredDel() uint8
- func (s *Submit) ServiceId() string
- func (s *Submit) SrcId() string
- func (s *Submit) TermIds() []byte
- func (s *Submit) ToDeliveryReport(msgId uint64) *Delivery
- func (s *Submit) ToResponse(result uint32) codec.Pdu
- func (s *Submit) TpPid() uint8
- func (s *Submit) TpUdhi() uint8
- func (s *Submit) ValidTime() string
- type SubmitRsp
- type Terminate
- type TerminateRsp
- type Version
Constants ¶
View Source
const ConnectPktLen = 12 + 6 + 16 + 1 + 4
View Source
const ConnectRspPktLenV2 = 12 + 1 + 16 + 1
View Source
const ConnectRspPktLenV3 = 12 + 4 + 16 + 1
Variables ¶
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 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 ¶
Types ¶
type ActiveTest ¶
type ActiveTest MessageHeader
func NewActiveTest ¶
func NewActiveTest(seq uint32) *ActiveTest
func (*ActiveTest) Encode ¶
func (at *ActiveTest) Encode() []byte
func (*ActiveTest) Log ¶
func (at *ActiveTest) Log() []log.Field
func (*ActiveTest) ToResponse ¶
func (at *ActiveTest) ToResponse(_ uint32) codec.Pdu
type ActiveTestRsp ¶
type ActiveTestRsp MessageHeader
func (*ActiveTestRsp) Encode ¶
func (at *ActiveTestRsp) Encode() []byte
func (*ActiveTestRsp) Log ¶
func (at *ActiveTestRsp) Log() []log.Field
type CommandId ¶
type CommandId uint32
CommandId 命令定义
const (
CMPP_REQUEST_MIN, CMPP_RESPONSE_MIN CommandId = iota, 0x80000000 + iota
CMPP_CONNECT, CMPP_CONNECT_RESP
CMPP_TERMINATE, CMPP_TERMINATE_RESP
CMPP_SUBMIT, CMPP_SUBMIT_RESP
CMPP_DELIVER, CMPP_DELIVER_RESP
CMPP_QUERY, CMPP_QUERY_RESP
CMPP_CANCEL, CMPP_CANCEL_RESP
CMPP_ACTIVE_TEST, CMPP_ACTIVE_TEST_RESP
CMPP_FWD, CMPP_FWD_RESP
CMPP_REQUEST_MAX, CMPP_RESPONSE_MAX
)
type ConnStatus ¶
type ConnStatus byte
const ( ConnStatusOK ConnStatus = iota ConnStatusInvalidStruct ConnStatusInvalidSrcAddr ConnStatusAuthFailed ConnStatusVerTooHigh ConnStatusOthers )
func (ConnStatus) String ¶
func (i ConnStatus) String() string
type Connect ¶
type Connect struct {
MessageHeader // +12 = 12:消息头
Version Version // +1 = 35:双方协商的版本号(高位 4bit 表示主 版本号,低位 4bit 表示次版本号),对 于3.0的版本,高4bit为3,低4位为 0
// contains filtered or unexported fields
}
func (*Connect) AuthenticatorSource ¶
func (*Connect) SourceAddr ¶
type ConnectResp ¶
type ConnectResp struct {
MessageHeader // 协议头, 12字节
Version Version // 版本,1字节
// contains filtered or unexported fields
}
func (*ConnectResp) AuthenticatorISMG ¶
func (r *ConnectResp) AuthenticatorISMG() []byte
func (*ConnectResp) Encode ¶
func (r *ConnectResp) Encode() []byte
func (*ConnectResp) Log ¶
func (r *ConnectResp) Log() []log.Field
func (*ConnectResp) Status ¶
func (r *ConnectResp) Status() ConnStatus
type Delivery ¶
type Delivery struct {
MessageHeader
// 协议版本,不是报文内容,但在调用encode方法前需要设置此值
Version Version
// contains filtered or unexported fields
}
Delivery 上行短信或状态报告,不支持长短信
func (*Delivery) MsgContent ¶
func (*Delivery) SrcTerminalId ¶
func (*Delivery) SrcTerminalType ¶
type DeliveryRsp ¶
type DeliveryRsp struct {
MessageHeader
// 协议版本,不是报文内容,ToResponse 会设置此值
Version Version
// contains filtered or unexported fields
}
func (*DeliveryRsp) Encode ¶
func (r *DeliveryRsp) Encode() []byte
func (*DeliveryRsp) Log ¶
func (r *DeliveryRsp) Log() (rt []log.Field)
func (*DeliveryRsp) SetResult ¶
func (r *DeliveryRsp) SetResult(result DlyResult)
type MessageHeader ¶
func (*MessageHeader) Decode ¶
func (header *MessageHeader) Decode(frame []byte) error
func (*MessageHeader) Encode ¶
func (header *MessageHeader) Encode() []byte
func (*MessageHeader) Log ¶
func (header *MessageHeader) Log() []log.Field
type Report ¶
type Report struct {
// contains filtered or unexported fields
}
func (*Report) DestTerminalId ¶
func (*Report) SmscSequence ¶
func (*Report) SubmitTime ¶
type Submit ¶
type Submit struct {
MessageHeader // 消息头,【12字节】
// 协议版本,不是报文内容,但在调用encode方法前需要设置此值
Version Version
// contains filtered or unexported fields
}
func (*Submit) DestTerminalId ¶
func (*Submit) DestTerminalType ¶
func (*Submit) FeeTerminalId ¶
func (*Submit) FeeTerminalType ¶
func (*Submit) FeeUsertype ¶
func (*Submit) MsgContent ¶
func (*Submit) RegisteredDel ¶
func (*Submit) ToDeliveryReport ¶
type SubmitRsp ¶
type SubmitRsp struct {
MessageHeader
// 协议版本,不是报文内容,但在调用encode方法前需要设置此值
Version Version
// contains filtered or unexported fields
}
type TerminateRsp ¶
type TerminateRsp MessageHeader
func (*TerminateRsp) Encode ¶
func (r *TerminateRsp) Encode() []byte
func (*TerminateRsp) Log ¶
func (r *TerminateRsp) Log() []log.Field
Click to show internal directories.
Click to hide internal directories.