pdu

package
v0.0.0-...-1db5038 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2019 License: MIT Imports: 12 Imported by: 6

Documentation

Index

Constants

View Source
const (
	SystemIDFld             string = "system_id"
	PasswordFld             string = "password"
	SystemTypeFld           string = "system_type"
	InterfaceVersionFld     string = "interface_version"
	AddrTonFld              string = "addr_ton"
	AddrNpiFld              string = "addr_npi"
	AddressRangeFld         string = "address_range"
	ServiceTypeFld          string = "service_type"
	SourceAddrTonFld        string = "source_addr_ton"
	SourceAddrNpiFld        string = "source_addr_npi"
	SourceAddrFld           string = "source_addr"
	DestAddrTonFld          string = "dest_addr_ton"
	DestAddrNpiFld          string = "dest_addr_npi"
	NumberOfDestsFld        string = "number_of_dests"
	DestFlagFld             string = "dest_flag"
	DlNameFld               string = "dl_name"
	DestinationAddrFld      string = "destination_addr"
	NoUnsuccessFld          string = "no_unsuccess"
	EsmClassFld             string = "esm_class"
	ProtocolIDFld           string = "protocol_id"
	PriorityFlagFld         string = "priority_flag"
	ScheduleDeliveryTimeFld string = "schedule_delivery_time"
	ValidityPeriodFld       string = "validity_period"
	RegisteredDeliveryFld   string = "registered_delivery"
	ReplaceIfPresentFlagFld string = "replace_if_present_flag"
	DataCodingFld           string = "data_coding"
	SmDefaultMsgIDFld       string = "sm_default_msg_id"
	SmLengthFld             string = "sm_length"
	ShortMessageFld         string = "short_message"
	MessageIDFld            string = "message_id"
	FinalDateFld            string = "final_date"
	MessageStateFld         string = "message_state"
	ErrorCodeFld            string = "error_code"
	EsmeAddrTonFld          string = "esme_addr_ton"
	EsmeAddrNpiFld          string = "esme_addr_npi"
	EsmeAddrFld             string = "esme_addr"
)

SMPP mandatory fields set.

View Source
const (
	DefaultEsmMode         = 0x0
	DatagramEsmMode        = 0x1
	ForwardEsmMode         = 0x2
	StoreAndForwardEsmMode = 0x3
	NotApplicableEsmMode   = 0x7
)
View Source
const (
	DefaultEsmType = 0x0
	DelRecEsmType  = 0x1
	DelAckEsmType  = 0x2
	UsrAckEsmType  = 0x4
	ConAbtEsmType  = 0x6
	IDNEsmType     = 0x8
)
View Source
const (
	NoEsmFeat          = 0x0
	UDHIEsmFeat        = 0x1
	RepPathEsmFeat     = 0x2
	UDHIRepPathEsmFeat = 0x3
)
View Source
const (
	NoDeliveryReceipt   = 0x0
	YesDeliveryReceipt  = 0x1
	FailDeliveryReceipt = 0x2
)
View Source
const (
	NoSMEAck     = 0x0
	YesSMEAck    = 0x1
	ManualSMEAck = 0x2
	AllSMEAck    = 0x3
)
View Source
const (
	NoInterNotification  = 0x0
	YesInterNotification = 0x1
)
View Source
const (
	// MaxPDUSize is maximal size of the PDU in bytes.
	MaxPDUSize = 4096 // 4KB
)

Variables

Functions

func IsRequest

func IsRequest(id CommandID) bool

IsRequest returns true if command is request.

func SeparateUDH

func SeparateUDH(c []byte) ([]byte, []byte, error)

SeparateUDH takes input bytes and separates them into UDH header and content.

func SystemID

func SystemID(p PDU) string

SystemID extracts system id value from PDU if it has one.

Types

type AlertNotification

type AlertNotification struct {
}

AlertNotification Not supported yet.

func (AlertNotification) CommandID

func (p AlertNotification) CommandID() CommandID

func (AlertNotification) MarshalBinary

func (p AlertNotification) MarshalBinary() ([]byte, error)

func (*AlertNotification) UnmarshalBinary

func (p *AlertNotification) UnmarshalBinary(body []byte) error

type BindRx

type BindRx struct {
	SystemID         string
	Password         string
	SystemType       string
	InterfaceVersion int
	AddrTon          int
	AddrNpi          int
	AddressRange     string
}

BindRx binding pdu in receiver mode.

func (BindRx) CommandID

func (p BindRx) CommandID() CommandID

CommandID implements pdu.PDU interface.

func (BindRx) MarshalBinary

func (p BindRx) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface.

func (BindRx) Response

func (p BindRx) Response(sysID string) *BindRxResp

Response creates new BindRxResp.

func (*BindRx) UnmarshalBinary

func (p *BindRx) UnmarshalBinary(body []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface.

type BindRxResp

type BindRxResp struct {
	SystemID string
	Options  *Options
}

BindRxResp bind response.

func (BindRxResp) CommandID

func (p BindRxResp) CommandID() CommandID

CommandID implements pdu.PDU interface.

func (BindRxResp) MarshalBinary

func (p BindRxResp) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface.

func (*BindRxResp) UnmarshalBinary

func (p *BindRxResp) UnmarshalBinary(body []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface.

type BindTRx

type BindTRx struct {
	SystemID         string
	Password         string
	SystemType       string
	InterfaceVersion int
	AddrTon          int
	AddrNpi          int
	AddressRange     string
}

BindTRx binding PDU in receiver mode.

func (BindTRx) CommandID

func (p BindTRx) CommandID() CommandID

CommandID implements pdu.PDU interface.

func (BindTRx) MarshalBinary

func (p BindTRx) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface.

func (BindTRx) Response

func (p BindTRx) Response(sysID string) *BindTRxResp

Response creates new BindTRxResp.

func (*BindTRx) UnmarshalBinary

func (p *BindTRx) UnmarshalBinary(body []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface.

type BindTRxResp

type BindTRxResp struct {
	SystemID string
	Options  *Options
}

BindTRxResp bind response.

func (BindTRxResp) CommandID

func (p BindTRxResp) CommandID() CommandID

CommandID implements pdu.PDU interface.

func (BindTRxResp) MarshalBinary

func (p BindTRxResp) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface.

func (*BindTRxResp) UnmarshalBinary

func (p *BindTRxResp) UnmarshalBinary(body []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface.

type BindTx

type BindTx struct {
	SystemID         string
	Password         string
	SystemType       string
	InterfaceVersion int
	AddrTon          int
	AddrNpi          int
	AddressRange     string
}

BindTx binding pdu in transmitter mode.

func (BindTx) CommandID

func (p BindTx) CommandID() CommandID

CommandID implements pdu.PDU interface.

func (BindTx) MarshalBinary

func (p BindTx) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface.

func (BindTx) Response

func (p BindTx) Response(sysID string) *BindTxResp

Response creates new BindTxResp.

func (*BindTx) UnmarshalBinary

func (p *BindTx) UnmarshalBinary(body []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface.

type BindTxResp

type BindTxResp struct {
	SystemID string
	Options  *Options
}

BindTxResp bind response.

func (BindTxResp) CommandID

func (p BindTxResp) CommandID() CommandID

CommandID implements pdu.PDU interface.

func (BindTxResp) MarshalBinary

func (p BindTxResp) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface.

func (*BindTxResp) UnmarshalBinary

func (p *BindTxResp) UnmarshalBinary(body []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface.

type CancelSm

type CancelSm struct {
}

CancelSm Not supported yet.

func (CancelSm) CommandID

func (p CancelSm) CommandID() CommandID

func (CancelSm) MarshalBinary

func (p CancelSm) MarshalBinary() ([]byte, error)

func (*CancelSm) UnmarshalBinary

func (p *CancelSm) UnmarshalBinary(body []byte) error

type CancelSmResp

type CancelSmResp struct {
}

CancelSmResp Not supported yet.

func (CancelSmResp) CommandID

func (p CancelSmResp) CommandID() CommandID

func (CancelSmResp) MarshalBinary

func (p CancelSmResp) MarshalBinary() ([]byte, error)

func (*CancelSmResp) UnmarshalBinary

func (p *CancelSmResp) UnmarshalBinary(body []byte) error

type CommandID

type CommandID uint32

CommandID is four byte PDU command identifier.

const (
	GenericNackID         CommandID = 0x80000000
	BindReceiverID        CommandID = 0x00000001
	BindReceiverRespID    CommandID = 0x80000001
	BindTransmitterID     CommandID = 0x00000002
	BindTransmitterRespID CommandID = 0x80000002
	QuerySmID             CommandID = 0x00000003
	QuerySmRespID         CommandID = 0x80000003
	SubmitSmID            CommandID = 0x00000004
	SubmitSmRespID        CommandID = 0x80000004
	DeliverSmID           CommandID = 0x00000005
	DeliverSmRespID       CommandID = 0x80000005
	UnbindID              CommandID = 0x00000006
	UnbindRespID          CommandID = 0x80000006
	ReplaceSmID           CommandID = 0x00000007
	ReplaceSmRespID       CommandID = 0x80000007
	CancelSmID            CommandID = 0x00000008
	CancelSmRespID        CommandID = 0x80000008
	BindTransceiverID     CommandID = 0x00000009
	BindTransceiverRespID CommandID = 0x80000009
	OutbindID             CommandID = 0x0000000B
	EnquireLinkID         CommandID = 0x00000015
	EnquireLinkRespID     CommandID = 0x80000015
	SubmitMultiID         CommandID = 0x00000021
	SubmitMultiRespID     CommandID = 0x80000021
	AlertNotificationID   CommandID = 0x00000102
	DataSmID              CommandID = 0x00000103
	DataSmRespID          CommandID = 0x80000103
)

SMPP command set.

func (CommandID) String

func (i CommandID) String() string

type DataSm

type DataSm struct {
}

DataSm Not supported yet.

func (DataSm) CommandID

func (p DataSm) CommandID() CommandID

func (DataSm) MarshalBinary

func (p DataSm) MarshalBinary() ([]byte, error)

func (*DataSm) UnmarshalBinary

func (p *DataSm) UnmarshalBinary(body []byte) error

type DataSmResp

type DataSmResp struct {
}

DataSmResp Not supported yet.

func (DataSmResp) CommandID

func (p DataSmResp) CommandID() CommandID

func (DataSmResp) MarshalBinary

func (p DataSmResp) MarshalBinary() ([]byte, error)

func (*DataSmResp) UnmarshalBinary

func (p *DataSmResp) UnmarshalBinary(body []byte) error

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder reads input from reader and marshals it into PDU.

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

NewDecoder initializes new PDU decoder.

func (*Decoder) Decode

func (d *Decoder) Decode() (Header, PDU, error)

Decode reads data from reader and populates PDU.

type DelStat

type DelStat string
const (
	DelStatEnRoute       DelStat = "ENROUTE"
	DelStatDelivered     DelStat = "DELIVRD"
	DelStatExpired       DelStat = "EXPIRED"
	DelStatDeleted       DelStat = "DELETED"
	DelStatUndeliverable DelStat = "UNDELIV"
	DelStatAccepted      DelStat = "ACCEPTD"
	DelStatUnknown       DelStat = "UNKNOWN"
	DelStatRejected      DelStat = "REJECTD"
)

type DeliverSm

type DeliverSm struct {
	ServiceType          string
	SourceAddrTon        int
	SourceAddrNpi        int
	SourceAddr           string
	DestAddrTon          int
	DestAddrNpi          int
	DestinationAddr      string
	EsmClass             EsmClass
	ProtocolID           int
	PriorityFlag         int
	ScheduleDeliveryTime time.Time
	ValidityPeriod       time.Time
	RegisteredDelivery   RegisteredDelivery
	ReplaceIfPresentFlag int
	DataCoding           int
	SmDefaultMsgID       int
	ShortMessage         string
	Options              *Options
}

DeliverSm contains mandatory fields for delivering short message. There is no need to set SmLength it will be automatically set when encoding pdu to binary representation.

func (DeliverSm) CommandID

func (p DeliverSm) CommandID() CommandID

CommandID implements pdu.PDU interface.

func (DeliverSm) MarshalBinary

func (p DeliverSm) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface.

func (DeliverSm) Response

func (p DeliverSm) Response(msgID string) *DeliverSmResp

Response creates new DeliverSmResp.

func (*DeliverSm) UnmarshalBinary

func (p *DeliverSm) UnmarshalBinary(body []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface.

type DeliverSmResp

type DeliverSmResp struct {
	MessageID string
}

DeliverSmResp contains mandatory fields for deliver_sm response.

func (DeliverSmResp) CommandID

func (p DeliverSmResp) CommandID() CommandID

CommandID implements pdu.PDU interface.

func (DeliverSmResp) MarshalBinary

func (p DeliverSmResp) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface.

func (*DeliverSmResp) UnmarshalBinary

func (p *DeliverSmResp) UnmarshalBinary(body []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface.

type DeliveryReceipt

type DeliveryReceipt struct {
	Id         string
	Sub        string
	Dlvrd      string
	SubmitDate time.Time
	DoneDate   time.Time
	Stat       DelStat
	Err        string
	Text       string
}

DeliveryReceipt in format “id:IIIIIIIIII sub:SSS dlvrd:DDD submit date:YYMMDDhhmm done date:YYMMDDhhmm stat:DDDDDDD err:E Text: ...”

func ParseDeliveryReceipt

func ParseDeliveryReceipt(sm string) (*DeliveryReceipt, error)

ParseDeliveryReceipt parses delivery receipt format defined in smpp 3.4 specification

func (*DeliveryReceipt) String

func (dr *DeliveryReceipt) String() string

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

Encoder is responsible for encoding PDU structure to writer.

func NewEncoder

func NewEncoder(w io.Writer, seq Sequencer) *Encoder

NewEncoder instantiates pdu encoder.

func (*Encoder) Encode

func (en *Encoder) Encode(p PDU, opts ...EncoderOption) (uint32, error)

Encode PDU structure and write it to the assigned writer.

type EncoderOption

type EncoderOption func(*encoderOpts)

func EncodeSeq

func EncodeSeq(seq uint32) EncoderOption

func EncodeStatus

func EncodeStatus(status Status) EncoderOption
type EnquireLink struct{}

EnquireLink PDU.

func (EnquireLink) CommandID

func (p EnquireLink) CommandID() CommandID

CommandID implements pdu.PDU interface.

func (EnquireLink) MarshalBinary

func (p EnquireLink) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface.

func (EnquireLink) Response

func (p EnquireLink) Response() *EnquireLinkResp

Response creates new EnquireLinkResp.

func (EnquireLink) UnmarshalBinary

func (p EnquireLink) UnmarshalBinary(body []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface.

type EnquireLinkResp

type EnquireLinkResp struct{}

EnquireLinkResp PDU response.

func (EnquireLinkResp) CommandID

func (p EnquireLinkResp) CommandID() CommandID

CommandID implements pdu.PDU interface.

func (EnquireLinkResp) MarshalBinary

func (p EnquireLinkResp) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface.

func (EnquireLinkResp) UnmarshalBinary

func (p EnquireLinkResp) UnmarshalBinary(body []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface.

type EsmClass

type EsmClass struct {
	Mode    int
	Type    int
	Feature int
}

EsmClass is used to indicate special message attributes associated with the short message.

func ParseEsmClass

func ParseEsmClass(b byte) EsmClass

ParseEsmClass parses esm class from pdu.

func (EsmClass) Byte

func (ec EsmClass) Byte() byte

Byte converts EsmClass into a single byte for pdu encoding.

type GenericNack

type GenericNack struct{}

GenericNack PDU.

func (GenericNack) CommandID

func (p GenericNack) CommandID() CommandID

CommandID implements pdu.PDU interface.

func (GenericNack) MarshalBinary

func (p GenericNack) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface.

func (GenericNack) UnmarshalBinary

func (p GenericNack) UnmarshalBinary(body []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface.

type Header interface {
	encoding.BinaryUnmarshaler
	Length() uint32
	CommandID() CommandID
	Status() Status
	Sequence() uint32
}

Header represents PDU header.

type Options

type Options struct {
	// contains filtered or unexported fields
}

Options maps all optional values and provides simple API for access. Only comonly used parameters have helpers, others have to be created by the users.

func NewOptions

func NewOptions() *Options

NewOptions creates new options map.

func (*Options) Get

func (o *Options) Get(tag TagID) ([]byte, bool)

Get tries to get byte value out of TLV field if present. If it's not it returns ok as false.

func (*Options) GetCString

func (o *Options) GetCString(tag TagID) (string, bool)

GetCString returns tag value as string.

func (*Options) GetDouble

func (o *Options) GetDouble(tag TagID) (int, bool)

GetDouble returns tag value as two byte integer.

func (*Options) GetSingle

func (o *Options) GetSingle(tag TagID) (int, bool)

GetSingle returns tag value as one byte integer.

func (*Options) GetString

func (o *Options) GetString(tag TagID) (string, bool)

GetString returns tag value as string.

func (*Options) MarshalBinary

func (o *Options) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface.

func (*Options) MessagePayload

func (o *Options) MessagePayload() string

MessagePayload is helper function for getting this option.

func (*Options) MessageState

func (o *Options) MessageState() int

MessageState is helper function for getting this option.

func (*Options) ReceiptedMessageID

func (o *Options) ReceiptedMessageID() string

ReceiptedMessageID is helper function for getting this option.

func (*Options) SarMsgRefNum

func (o *Options) SarMsgRefNum() int

SarMsgRefNum is helper function for getting this option.

func (*Options) SarSegmentSeqnum

func (o *Options) SarSegmentSeqnum() int

SarSegmentSeqnum is helper function for getting this option.

func (*Options) SarTotalSegments

func (o *Options) SarTotalSegments() int

SarTotalSegments is helper function for getting this option.

func (*Options) ScInterfaceVersion

func (o *Options) ScInterfaceVersion() int

ScInterfaceVersion is helper function for getting this option.

func (*Options) Set

func (o *Options) Set(tag TagID, val []byte) *Options

Set assigns new TLV field.

func (*Options) SetCString

func (o *Options) SetCString(tag TagID, val string) *Options

SetCString assigns new TLV field with string value.

func (*Options) SetDouble

func (o *Options) SetDouble(tag TagID, val int) *Options

SetDouble assigns new TLV field with two bytes value.

func (*Options) SetMessagePayload

func (o *Options) SetMessagePayload(val string) *Options

SetMessagePayload is helper function for setting this option.

func (*Options) SetMessageState

func (o *Options) SetMessageState(val int) *Options

SetMessageState is helper function for setting this option.

func (*Options) SetReceiptedMessageID

func (o *Options) SetReceiptedMessageID(val string) *Options

SetReceiptedMessageID is helper function for setting this option.

func (*Options) SetSarMsgRefNum

func (o *Options) SetSarMsgRefNum(val int) *Options

SetSarMsgRefNum is helper function for setting this option.

func (*Options) SetSarSegmentSeqnum

func (o *Options) SetSarSegmentSeqnum(val int) *Options

SetSarSegmentSeqnum is helper function for setting this option.

func (*Options) SetSarTotalSegments

func (o *Options) SetSarTotalSegments(val int) *Options

SetSarTotalSegments is helper function for setting this option.

func (*Options) SetScInterfaceVersion

func (o *Options) SetScInterfaceVersion(val int) *Options

SetScInterfaceVersion is helper function for setting this option.

func (*Options) SetSingle

func (o *Options) SetSingle(tag TagID, val int) *Options

SetSingle assigns new TLV field with one byte value.

func (*Options) SetString

func (o *Options) SetString(tag TagID, val string) *Options

SetString assigns new TLV field with string value.

func (*Options) SetUserMessageReference

func (o *Options) SetUserMessageReference(val int) *Options

SetUserMessageReference is helper function for setting this option.

func (*Options) UnmarshalBinary

func (o *Options) UnmarshalBinary(buf []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface.

func (*Options) UserMessageReference

func (o *Options) UserMessageReference() int

UserMessageReference is helper function for getting this option.

type Outbind

type Outbind struct {
}

Outbind Not supported yet.

func (Outbind) CommandID

func (p Outbind) CommandID() CommandID

func (Outbind) MarshalBinary

func (p Outbind) MarshalBinary() ([]byte, error)

func (*Outbind) UnmarshalBinary

func (p *Outbind) UnmarshalBinary(body []byte) error

type PDU

type PDU interface {
	CommandID() CommandID
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
}

PDU defines interface for PDU structures

func NewPDU

func NewPDU(commandID CommandID) PDU

NewPDU creates new PDU from CommandID.

type QuerySm

type QuerySm struct {
	MessageID     string
	SourceAddrTon int
	SourceAddrNpi int
	SourceAddr    string
}

QuerySm represents quering PDU.

func (QuerySm) CommandID

func (p QuerySm) CommandID() CommandID

CommandID implements pdu.PDU interface.

func (QuerySm) MarshalBinary

func (p QuerySm) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface.

func (QuerySm) Response

func (p QuerySm) Response(date time.Time, state, err int) *QuerySmResp

Response creates new QuerySmResp.

func (*QuerySm) UnmarshalBinary

func (p *QuerySm) UnmarshalBinary(body []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface.

type QuerySmResp

type QuerySmResp struct {
	MessageID    string
	FinalDate    time.Time
	MessageState int
	ErrorCode    int
}

QuerySmResp holds response to query_sm PDU.

func (QuerySmResp) CommandID

func (p QuerySmResp) CommandID() CommandID

CommandID implements pdu.PDU interface.

func (QuerySmResp) MarshalBinary

func (p QuerySmResp) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface.

func (*QuerySmResp) UnmarshalBinary

func (p *QuerySmResp) UnmarshalBinary(body []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface.

type RegisteredDelivery

type RegisteredDelivery struct {
	Receipt           int
	SMEAck            int
	InterNotification int
}

RegisteredDelivery is used to request an SMSC delivery receipt and/or SME originated acknowledgements.

func ParseRegisteredDelivery

func ParseRegisteredDelivery(b byte) RegisteredDelivery

ParseRegisteredDelivery parses registered_delivery from pdu.

func (RegisteredDelivery) Byte

func (rd RegisteredDelivery) Byte() byte

Byte converts RegisteredDelivery into a single byte for pdu encoding.

type ReplaceSm

type ReplaceSm struct {
}

ReplaceSm Not supported yet.

func (ReplaceSm) CommandID

func (p ReplaceSm) CommandID() CommandID

func (ReplaceSm) MarshalBinary

func (p ReplaceSm) MarshalBinary() ([]byte, error)

func (*ReplaceSm) UnmarshalBinary

func (p *ReplaceSm) UnmarshalBinary(body []byte) error

type ReplaceSmResp

type ReplaceSmResp struct {
}

ReplaceSmResp Not supported yet.

func (ReplaceSmResp) CommandID

func (p ReplaceSmResp) CommandID() CommandID

func (ReplaceSmResp) MarshalBinary

func (p ReplaceSmResp) MarshalBinary() ([]byte, error)

func (*ReplaceSmResp) UnmarshalBinary

func (p *ReplaceSmResp) UnmarshalBinary(body []byte) error

type Sequencer

type Sequencer interface {
	Next() uint32
}

Sequencer provides way of altering default PDU sequencing. This can be useful for load balancing requests.

func NewSequencer

func NewSequencer(n uint32) Sequencer

NewSequencer creates new sequencer with starting value set to n. Allowed range is 0x00000001 to 0x7FFFFFFF.

type Status

type Status uint32

Status represents four byte command status.

const (
	StatusOK              Status = 0x00000000
	StatusInvMsgLen       Status = 0x00000001
	StatusInvCmdLen       Status = 0x00000002
	StatusInvCmdID        Status = 0x00000003
	StatusInvBnd          Status = 0x00000004
	StatusAlyBnd          Status = 0x00000005
	StatusInvPrtFlg       Status = 0x00000006
	StatusInvRegDlvFlg    Status = 0x00000007
	StatusSysErr          Status = 0x00000008
	StatusInvSrcAdr       Status = 0x0000000A
	StatusInvDstAdr       Status = 0x0000000B
	StatusInvMsgID        Status = 0x0000000C
	StatusBindFail        Status = 0x0000000D
	StatusInvPaswd        Status = 0x0000000E
	StatusInvSysID        Status = 0x0000000F
	StatusCancelFail      Status = 0x00000011
	StatusReplaceFail     Status = 0x00000013
	StatusMsgQFul         Status = 0x00000014
	StatusInvSerTyp       Status = 0x00000015
	StatusInvNumDe        Status = 0x00000033
	StatusInvDLName       Status = 0x00000034
	StatusInvDestFlag     Status = 0x00000040
	StatusInvSubRep       Status = 0x00000042
	StatusInvEsmClass     Status = 0x00000043
	StatusCntSubDL        Status = 0x00000044
	StatusSubmitFail      Status = 0x00000045
	StatusInvSrcTON       Status = 0x00000048
	StatusInvSrcNPI       Status = 0x00000049
	StatusInvDstTON       Status = 0x00000050
	StatusInvDstNPI       Status = 0x00000051
	StatusInvSysTyp       Status = 0x00000053
	StatusInvRepFlag      Status = 0x00000054
	StatusInvNumMsgs      Status = 0x00000055
	StatusThrottled       Status = 0x00000058
	StatusInvSched        Status = 0x00000061
	StatusInvExpiry       Status = 0x00000062
	StatusInvDftMsgID     Status = 0x00000063
	StatusTempAppErr      Status = 0x00000064
	StatusPermAppErr      Status = 0x00000065
	StatusRejeAppErr      Status = 0x00000066
	StatusQueryFail       Status = 0x00000067
	StatusInvOptParStream Status = 0x000000C0
	StatusOptParNotAllwd  Status = 0x000000C1
	StatusInvParLen       Status = 0x000000C2
	StatusMissingOptParam Status = 0x000000C3
	StatusInvOptParamVal  Status = 0x000000C4
	StatusDeliveryFailure Status = 0x000000FE
	StatusUnknownErr      Status = 0x000000FF
)

PDU Command Status set.

func (Status) String

func (i Status) String() string

type SubmitMulti

type SubmitMulti struct {
}

SubmitMulti Not supported yet.

func (SubmitMulti) CommandID

func (p SubmitMulti) CommandID() CommandID

func (SubmitMulti) MarshalBinary

func (p SubmitMulti) MarshalBinary() ([]byte, error)

func (*SubmitMulti) UnmarshalBinary

func (p *SubmitMulti) UnmarshalBinary(body []byte) error

type SubmitMultiResp

type SubmitMultiResp struct {
}

SubmitMultiResp Not supported yet.

func (SubmitMultiResp) CommandID

func (p SubmitMultiResp) CommandID() CommandID

func (SubmitMultiResp) MarshalBinary

func (p SubmitMultiResp) MarshalBinary() ([]byte, error)

func (*SubmitMultiResp) UnmarshalBinary

func (p *SubmitMultiResp) UnmarshalBinary(body []byte) error

type SubmitSm

type SubmitSm struct {
	ServiceType          string
	SourceAddrTon        int
	SourceAddrNpi        int
	SourceAddr           string
	DestAddrTon          int
	DestAddrNpi          int
	DestinationAddr      string
	EsmClass             EsmClass
	ProtocolID           int
	PriorityFlag         int
	ScheduleDeliveryTime time.Time
	ValidityPeriod       time.Time
	RegisteredDelivery   RegisteredDelivery
	ReplaceIfPresentFlag int
	DataCoding           int
	SmDefaultMsgID       int
	ShortMessage         string
	Options              *Options
}

SubmitSm contains mandatory fields for submiting short message. There is no need to set SmLength it will be automatically set when encoding pdu to binary representation. Also long ShortMessages will be marshaled as payload in options.

func (SubmitSm) CommandID

func (p SubmitSm) CommandID() CommandID

CommandID implements pdu.PDU interface.

func (SubmitSm) MarshalBinary

func (p SubmitSm) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface.

func (SubmitSm) Response

func (p SubmitSm) Response(msgID string) *SubmitSmResp

Response creates new SubmitSmResp.

func (*SubmitSm) UnmarshalBinary

func (p *SubmitSm) UnmarshalBinary(body []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface.

type SubmitSmResp

type SubmitSmResp struct {
	MessageID string
	Options   *Options
}

SubmitSmResp contains mandatory fields for submit_sm response.

func (SubmitSmResp) CommandID

func (p SubmitSmResp) CommandID() CommandID

CommandID implements pdu.PDU interface.

func (SubmitSmResp) MarshalBinary

func (p SubmitSmResp) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface.

func (*SubmitSmResp) UnmarshalBinary

func (p *SubmitSmResp) UnmarshalBinary(body []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface.

type TagID

type TagID uint16

TagID represents two byte optional tag identifier.

const (
	TagDestAddrSubUnit        TagID = 0x0005
	TagDestNetworkType        TagID = 0x0006
	TagDestBearerType         TagID = 0x0007
	TagDestTelematicsID       TagID = 0x0008
	TagSourceAddrSubunit      TagID = 0x000D
	TagSourceNetworkType      TagID = 0x000E
	TagSourceBearerType       TagID = 0x000F
	TagSourceTelematicsID     TagID = 0x0010
	TagQosTimeToLive          TagID = 0x0017
	TagPayloadType            TagID = 0x0019
	TagAdditionalStatusInfoTe TagID = 0x001D
	TagReceiptedMessageID     TagID = 0x001E
	TagMsMsgWaitFacilities    TagID = 0x0030
	TagPrivacyIndicator       TagID = 0x0201
	TagSourceSubaddress       TagID = 0x0202
	TagDestSubaddress         TagID = 0x0203
	TagUserMessageReference   TagID = 0x0204
	TagUserResponseCode       TagID = 0x0205
	TagSourcePort             TagID = 0x020A
	TagDestinationPort        TagID = 0x020B
	TagSarMsgRefNum           TagID = 0x020C
	TagLanguageIndicator      TagID = 0x020D
	TagSarTotalSegments       TagID = 0x020E
	TagSarSegmentSeqnum       TagID = 0x020F
	TagScInterfaceVersion     TagID = 0x0210
	TagCallbackNumPresInd     TagID = 0x0302
	TagCallbackNumA           TagID = 0x0303
	TagNumberOfMessages       TagID = 0x0304
	TagCallbackNum            TagID = 0x0381
	TagDpfResult              TagID = 0x0420
	TagSetDPF                 TagID = 0x0421
	TagMsAvailabilityStatus   TagID = 0x0422
	TagNetworkErrorCode       TagID = 0x0423
	TagMessagePayload         TagID = 0x0424
	TagDeliveryFailureReason  TagID = 0x0425
	TagMoreMessagesToSend     TagID = 0x0426
	TagMessageState           TagID = 0x0427
	TagUssdServiceOp          TagID = 0x0501
	TagDisplayTime            TagID = 0x1201
	TagSmsSignal              TagID = 0x1203
	TagMsValidity             TagID = 0x1204
	TagAlertOnMessageDeliv    TagID = 0x130C
	TagItsReplyType           TagID = 0x1380
	TagItsSessionInfo         TagID = 0x1383
)

PDU tags for optional fields.

func (TagID) String

func (i TagID) String() string

type Unbind

type Unbind struct{}

Unbind defines unbind PDU.

func (Unbind) CommandID

func (p Unbind) CommandID() CommandID

CommandID implements pdu.PDU interface.

func (Unbind) MarshalBinary

func (p Unbind) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface.

func (Unbind) Response

func (p Unbind) Response() *UnbindResp

Response creates new UnbindResp.

func (Unbind) UnmarshalBinary

func (p Unbind) UnmarshalBinary(body []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface.

type UnbindResp

type UnbindResp struct{}

UnbindResp defines unbind_resp PDU.

func (UnbindResp) CommandID

func (p UnbindResp) CommandID() CommandID

CommandID implements pdu.PDU interface.

func (UnbindResp) MarshalBinary

func (p UnbindResp) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler interface.

func (UnbindResp) UnmarshalBinary

func (p UnbindResp) UnmarshalBinary(body []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL