sms

package
v0.0.0-...-648c0fa Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(w io.Writer, packet interface{}) (n int64, err error)

func Unmarshal

func Unmarshal(r io.Reader) (packet interface{}, err error)

Types

type Address

type Address struct {
	NPI, TON byte
	No       string
}

func (Address) MarshalBinary

func (p Address) MarshalBinary() (data []byte, err error)

func (*Address) ReadFrom

func (p *Address) ReadFrom(r io.Reader) (n int64, err error)

func (*Address) WriteTo

func (p *Address) WriteTo(w io.Writer) (n int64, err error)

type Command

type Command struct {
	SCAddress           SCAddress `TP:"SC"`
	Flags               Flags     `DIR:"MO"`
	MessageReference    byte      `TP:"MR"`
	StatusReportRequest bool      `TP:"SRR"`
	ProtocolIdentifier  byte      `TP:"PID"`
	CommandType         byte      `TP:"CT"`
	MessageNumber       byte      `TP:"MN"`
	DestinationAddress  Address   `TP:"DA"`
	CommandData         []byte    `TP:"CD"`
}

Command see GSM 03.40, section 9.2.2.4 (45p)

type Deliver

type Deliver struct {
	SCAddress              SCAddress    `TP:"SC"`
	Flags                  DeliverFlags `DIR:"MT"`
	OriginatingAddress     Address      `TP:"OA"`
	ProtocolIdentifier     byte         `TP:"PID"`
	DataCoding             byte         `TP:"DCS"`
	ServiceCentreTimestamp Time         `TP:"SCTS"`
	UserData               []byte       `TP:"UD"`
}

Deliver see GSM 03.40, section 9.2.2.1 (35p)

type DeliverFlags

type DeliverFlags struct {
	MessageType            MessageType
	MoreMessagesToSend     bool
	ReplyPath              bool
	UDHIndicator           bool
	StatusReportIndication bool
}

func (*DeliverFlags) ReadByte

func (p *DeliverFlags) ReadByte() (byte, error)

func (*DeliverFlags) WriteByte

func (p *DeliverFlags) WriteByte(c byte) error

type DeliverReport

type DeliverReport struct {
	SCAddress          SCAddress          `TP:"SC"`
	Flags              Flags              `DIR:"MO"`
	ParameterIndicator ParameterIndicator `TP:"PI"`
	ProtocolIdentifier byte               `TP:"PID"`
	DataCoding         byte               `TP:"DCS"`
	UserData           []byte             `TP:"UD"`
}

DeliverReport see GSM 03.40, section 9.2.2.1a (37p)

type DeliverReportError

type DeliverReportError struct {
	SCAddress    SCAddress    `TP:"SC"`
	Flags        Flags        `DIR:"MO"`
	FailureCause FailureCause `TP:"FCS"`
}

type Direction

type Direction int
const (
	MT Direction = iota
	MO
)

type Duration

type Duration struct{ time.Duration }

func (*Duration) ReadFrom

func (d *Duration) ReadFrom(r io.Reader) (n int64, err error)

func (*Duration) WriteTo

func (d *Duration) WriteTo(w io.Writer) (n int64, err error)

type EnhancedDuration

type EnhancedDuration struct {
	time.Duration
	Indicator byte
}

func (*EnhancedDuration) ReadFrom

func (d *EnhancedDuration) ReadFrom(r io.Reader) (n int64, err error)

func (*EnhancedDuration) WriteTo

func (d *EnhancedDuration) WriteTo(w io.Writer) (n int64, err error)

type FailureCause

type FailureCause byte

FailureCause see GSM 03.40, section 9.2.3.22 (54p)

func (FailureCause) Error

func (f FailureCause) Error() string

type Flags

type Flags struct {
	MessageType MessageType
}

func (*Flags) ReadByte

func (p *Flags) ReadByte() (byte, error)

func (*Flags) WriteByte

func (p *Flags) WriteByte(c byte) error

type MessageType

type MessageType byte
const (
	MessageTypeDeliver       MessageType = iota // 00 0 MT
	MessageTypeDeliverReport                    // 00 1 MO
	MessageTypeSubmitReport                     // 01 0 MT
	MessageTypeSubmit                           // 01 1 MO
	MessageTypeStatusReport                     // 10 0 MT
	MessageTypeCommand                          // 10 1 MO
)

func (MessageType) Direction

func (t MessageType) Direction() Direction

func (*MessageType) Set

func (t *MessageType) Set(kind byte, dir Direction)

func (MessageType) String

func (t MessageType) String() string

func (MessageType) Type

func (t MessageType) Type() byte

type ParameterIndicator

type ParameterIndicator struct {
	ProtocolIdentifier bool
	DataCoding         bool
	UserData           bool
}

func (*ParameterIndicator) Has

func (p *ParameterIndicator) Has(abbr string) bool

func (*ParameterIndicator) ReadByte

func (p *ParameterIndicator) ReadByte() (byte, error)

func (*ParameterIndicator) Set

func (p *ParameterIndicator) Set(abbr string)

func (*ParameterIndicator) WriteByte

func (p *ParameterIndicator) WriteByte(c byte) error

type SCAddress

type SCAddress Address

func (*SCAddress) ReadFrom

func (p *SCAddress) ReadFrom(r io.Reader) (n int64, err error)

func (SCAddress) WriteTo

func (p SCAddress) WriteTo(w io.Writer) (n int64, err error)

type SMPPMarshaler

type SMPPMarshaler interface {
	MarshalSMPP() (interface{}, error)
}

type SMPPUnmarshaler

type SMPPUnmarshaler interface {
	UnmarshalSMPP(interface{}) error
}

type StatusReport

type StatusReport struct {
	SCAddress              SCAddress `TP:"SC"`
	Flags                  Flags     `DIR:"MT"`
	MessageReference       byte      `TP:"MR"`
	MoreMessagesToSend     bool      `TP:"MMS"`
	RecipientAddress       Address   `TP:"RA"`
	ServiceCentreTimestamp Time      `TP:"SCTS"`
	DischargeTime          Time      `TP:"DT"`
	Status                 byte      `TP:"ST"`
}

StatusReport see GSM 03.40, section 9.2.2.3 (43p)

type Submit

type Submit struct {
	SCAddress          SCAddress   `TP:"SC"`
	Flags              SubmitFlags `DIR:"MO"`
	MessageReference   byte        `TP:"MR"`
	DestinationAddress Address     `TP:"DA"`
	ProtocolIdentifier byte        `TP:"PID"`
	DataCoding         byte        `TP:"DCS"`
	ValidityPeriod     interface{} `TP:"VP"`
	UserData           []byte      `TP:"UD"`
}

Submit see GSM 03.40, section 9.2.2.2 (39p)

type SubmitFlags

type SubmitFlags struct {
	MessageType             MessageType
	RejectDuplicates        bool
	ValidityPeriodFormat    byte
	ReplyPath               bool
	UserDataHeaderIndicator bool
	StatusReportRequest     bool
}

func (*SubmitFlags) ReadByte

func (p *SubmitFlags) ReadByte() (byte, error)

func (*SubmitFlags) WriteByte

func (p *SubmitFlags) WriteByte(c byte) error

type SubmitReport

type SubmitReport struct {
	SCAddress              SCAddress          `TP:"SC"`
	Flags                  SubmitFlags        `DIR:"MT"`
	ParameterIndicator     ParameterIndicator `TP:"PI"`
	ServiceCentreTimestamp Time               `TP:"SCTS"`
	ProtocolIdentifier     byte               `TP:"PID"`
	DataCoding             byte               `TP:"DCS"`
	UserData               []byte             `TP:"UD"`
}

SubmitReport see GSM 03.40, section 9.2.2.2a (41p)

type SubmitReportError

type SubmitReportError DeliverReportError

type Time

type Time struct{ time.Time }

func (*Time) ReadFrom

func (t *Time) ReadFrom(r io.Reader) (n int64, err error)

func (*Time) WriteTo

func (t *Time) WriteTo(w io.Writer) (n int64, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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