pdu

package
v0.0.0-...-d7f2c32 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SizeByte is size of byte.
	SizeByte = 1

	// SizeShort is size of short.
	SizeShort = 2

	// SizeInt is size of int.
	SizeInt = 4

	// SizeLong is size of long.
	SizeLong = 8
)

Variables

View Source
var (
	// ErrBufferNotEnoughByteToRead indicates not enough byte(s) to read from buffer.
	ErrBufferNotEnoughByteToRead = fmt.Errorf("Not enough byte to read from buffer")
)

Functions

This section is empty.

Types

type Address

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

Address smpp address of src and dst.

func NewAddress

func NewAddress() Address

NewAddress returns new address with default max length.

func NewAddressWithAddr

func NewAddressWithAddr(addr string) (a Address, err error)

NewAddressWithAddr returns new address.

func NewAddressWithTonNpi

func NewAddressWithTonNpi(ton, npi byte) Address

NewAddressWithTonNpi returns new address with ton, npi.

func NewAddressWithTonNpiAddr

func NewAddressWithTonNpiAddr(ton, npi byte, addr string) (a Address, err error)

NewAddressWithTonNpiAddr returns new address with ton, npi, addr string.

func (Address) Address

func (c Address) Address() string

Address returns assigned address (in string).

func (*Address) Marshal

func (c *Address) Marshal(b *ByteBuffer)

Marshal to buffer.

func (Address) Npi

func (c Address) Npi() byte

Npi returns assigned npi.

func (*Address) SetAddress

func (c *Address) SetAddress(addr string) (err error)

SetAddress sets address.

func (*Address) SetNpi

func (c *Address) SetNpi(npi byte)

SetNpi sets npi.

func (*Address) SetTon

func (c *Address) SetTon(ton byte)

SetTon sets ton.

func (Address) String

func (c Address) String() string

String implement stringer interface

func (Address) Ton

func (c Address) Ton() byte

Ton returns assigned ton.

func (*Address) Unmarshal

func (c *Address) Unmarshal(b *ByteBuffer) (err error)

Unmarshal from buffer.

type AddressRange

type AddressRange struct {
	Ton          byte
	Npi          byte
	AddressRange string
}

AddressRange smpp address range of src and dst.

func NewAddressRange

func NewAddressRange() AddressRange

NewAddressRange create new AddressRange with default max length.

func NewAddressRangeWithAddr

func NewAddressRangeWithAddr(addr string) AddressRange

NewAddressRangeWithAddr create new AddressRange.

func NewAddressRangeWithTonNpi

func NewAddressRangeWithTonNpi(ton, npi byte) AddressRange

NewAddressRangeWithTonNpi create new AddressRange with ton, npi.

func NewAddressRangeWithTonNpiAddr

func NewAddressRangeWithTonNpiAddr(ton, npi byte, addr string) AddressRange

NewAddressRangeWithTonNpiAddr returns new address with ton, npi, addr string.

func (*AddressRange) Marshal

func (c *AddressRange) Marshal(b *ByteBuffer)

Marshal to buffer.

func (*AddressRange) Unmarshal

func (c *AddressRange) Unmarshal(b *ByteBuffer) (err error)

Unmarshal from buffer.

type AlertNotification

type AlertNotification struct {
	SourceAddr Address
	EsmeAddr   Address
	// contains filtered or unexported fields
}

AlertNotification PDU is sent by the SMSC to the ESME, when the SMSC has detected that a particular mobile subscriber has become available and a delivery pending flag had been set for that subscriber from a previous data_sm operation.

func (*AlertNotification) CanResponse

func (a *AlertNotification) CanResponse() bool

CanResponse implements PDU interface.

func (*AlertNotification) GetHeader

func (c *AlertNotification) GetHeader() Header

GetHeader returns pdu header.

func (*AlertNotification) GetResponse

func (a *AlertNotification) GetResponse() PDU

GetResponse implements PDU interface.

func (*AlertNotification) IsGNack

func (c *AlertNotification) IsGNack() bool

IsGNack is generic n-ack.

func (*AlertNotification) IsOk

func (c *AlertNotification) IsOk() bool

IsOk is status ok.

func (*AlertNotification) Marshal

func (a *AlertNotification) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*AlertNotification) RegisterOptionalParam

func (c *AlertNotification) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*AlertNotification) Unmarshal

func (a *AlertNotification) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type BindRequest

type BindRequest struct {
	SystemID         string
	Password         string
	SystemType       string
	InterfaceVersion byte
	AddressRange     AddressRange
	BindingType      BindingType
	// contains filtered or unexported fields
}

BindRequest represents a bind request.

func NewBindRequest

func NewBindRequest(t BindingType) (b *BindRequest)

NewBindRequest returns new bind request.

func (*BindRequest) CanResponse

func (b *BindRequest) CanResponse() bool

CanResponse implements PDU interface.

func (*BindRequest) GetHeader

func (c *BindRequest) GetHeader() Header

GetHeader returns pdu header.

func (*BindRequest) GetResponse

func (b *BindRequest) GetResponse() PDU

GetResponse implements PDU interface.

func (*BindRequest) IsGNack

func (c *BindRequest) IsGNack() bool

IsGNack is generic n-ack.

func (*BindRequest) IsOk

func (c *BindRequest) IsOk() bool

IsOk is status ok.

func (*BindRequest) Marshal

func (b *BindRequest) Marshal(w *ByteBuffer)

Marshal implements PDU interface.

func (*BindRequest) RegisterOptionalParam

func (c *BindRequest) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*BindRequest) Unmarshal

func (b *BindRequest) Unmarshal(w *ByteBuffer) error

Unmarshal implements PDU interface.

type BindResp

type BindResp struct {
	SystemID string
	// contains filtered or unexported fields
}

BindResp PDU.

func NewBindResp

func NewBindResp(req BindRequest) (c *BindResp)

NewBindResp returns BindResp.

func (*BindResp) CanResponse

func (c *BindResp) CanResponse() bool

CanResponse implements PDU interface.

func (*BindResp) GetHeader

func (c *BindResp) GetHeader() Header

GetHeader returns pdu header.

func (*BindResp) GetResponse

func (c *BindResp) GetResponse() PDU

GetResponse implements PDU interface.

func (*BindResp) IsGNack

func (c *BindResp) IsGNack() bool

IsGNack is generic n-ack.

func (*BindResp) IsOk

func (c *BindResp) IsOk() bool

IsOk is status ok.

func (*BindResp) Marshal

func (c *BindResp) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*BindResp) RegisterOptionalParam

func (c *BindResp) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*BindResp) Unmarshal

func (c *BindResp) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type BindingType

type BindingType byte

BindingType indicates type of binding.

const (
	// Receiver indicates Receiver binding.
	Receiver BindingType = iota
	// Transceiver indicates Transceiver binding.
	Transceiver
	// Transmitter indicate Transmitter binding.
	Transmitter
)

type ByteBuffer

type ByteBuffer struct {
	*bytes.Buffer
}

ByteBuffer wraps over bytes.Buffer with additional features.

func NewBuffer

func NewBuffer(inp []byte) *ByteBuffer

NewBuffer create new buffer from preallocated buffer array.

func (*ByteBuffer) HexDump

func (c *ByteBuffer) HexDump() string

HexDump returns hex dump.

func (*ByteBuffer) ReadCString

func (c *ByteBuffer) ReadCString() (st string, err error)

ReadCString read c-string.

func (*ByteBuffer) ReadInt

func (c *ByteBuffer) ReadInt() (r int32, err error)

ReadInt reads int from buffer.

func (*ByteBuffer) ReadN

func (c *ByteBuffer) ReadN(n int) (r []byte, err error)

ReadN read n-bytes from buffer.

func (*ByteBuffer) ReadShort

func (c *ByteBuffer) ReadShort() (r int16, err error)

ReadShort reads short from buffer.

func (*ByteBuffer) WriteBuffer

func (c *ByteBuffer) WriteBuffer(d *ByteBuffer)

WriteBuffer appends buffer.

func (*ByteBuffer) WriteCString

func (c *ByteBuffer) WriteCString(s string) error

WriteCString writes c-string.

func (*ByteBuffer) WriteCStringWithEnc

func (c *ByteBuffer) WriteCStringWithEnc(s string, enc data.Encoding) error

WriteCStringWithEnc write c-string with encoding.

func (*ByteBuffer) WriteInt

func (c *ByteBuffer) WriteInt(v int32)

WriteInt writes int to buffer.

func (*ByteBuffer) WriteShort

func (c *ByteBuffer) WriteShort(v int16)

WriteShort writes short to buffer.

type CancelSM

type CancelSM struct {
	ServiceType string
	MessageID   string
	SourceAddr  Address
	DestAddr    Address
	// contains filtered or unexported fields
}

CancelSM PDU is issued by the ESME to cancel one or more previously submitted short messages that are still pending delivery. The command may specify a particular message to cancel, or all messages for a particular source, destination and service_type are to be cancelled.

func (*CancelSM) CanResponse

func (c *CancelSM) CanResponse() bool

CanResponse implements PDU interface.

func (*CancelSM) GetHeader

func (c *CancelSM) GetHeader() Header

GetHeader returns pdu header.

func (*CancelSM) GetResponse

func (c *CancelSM) GetResponse() PDU

GetResponse implements PDU interface.

func (*CancelSM) IsGNack

func (c *CancelSM) IsGNack() bool

IsGNack is generic n-ack.

func (*CancelSM) IsOk

func (c *CancelSM) IsOk() bool

IsOk is status ok.

func (*CancelSM) Marshal

func (c *CancelSM) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*CancelSM) RegisterOptionalParam

func (c *CancelSM) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*CancelSM) Unmarshal

func (c *CancelSM) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type CancelSMResp

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

CancelSMResp PDU.

func (*CancelSMResp) CanResponse

func (c *CancelSMResp) CanResponse() bool

CanResponse implements PDU interface.

func (*CancelSMResp) GetHeader

func (c *CancelSMResp) GetHeader() Header

GetHeader returns pdu header.

func (*CancelSMResp) GetResponse

func (c *CancelSMResp) GetResponse() PDU

GetResponse implements PDU interface.

func (*CancelSMResp) IsGNack

func (c *CancelSMResp) IsGNack() bool

IsGNack is generic n-ack.

func (*CancelSMResp) IsOk

func (c *CancelSMResp) IsOk() bool

IsOk is status ok.

func (*CancelSMResp) Marshal

func (c *CancelSMResp) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*CancelSMResp) RegisterOptionalParam

func (c *CancelSMResp) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*CancelSMResp) Unmarshal

func (c *CancelSMResp) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type DataSM

type DataSM struct {
	ServiceType        string
	SourceAddr         Address
	DestAddr           Address
	EsmClass           byte
	RegisteredDelivery byte
	DataCoding         byte
	// contains filtered or unexported fields
}

DataSM PDU is used to transfer data between the SMSC and the ESME. It may be used by both the ESME and SMSC.

func (*DataSM) CanResponse

func (c *DataSM) CanResponse() bool

CanResponse implements PDU interface.

func (*DataSM) GetHeader

func (c *DataSM) GetHeader() Header

GetHeader returns pdu header.

func (*DataSM) GetResponse

func (c *DataSM) GetResponse() PDU

GetResponse implements PDU interface.

func (*DataSM) IsGNack

func (c *DataSM) IsGNack() bool

IsGNack is generic n-ack.

func (*DataSM) IsOk

func (c *DataSM) IsOk() bool

IsOk is status ok.

func (*DataSM) Marshal

func (c *DataSM) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*DataSM) RegisterOptionalParam

func (c *DataSM) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*DataSM) Unmarshal

func (c *DataSM) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type DataSMResp

type DataSMResp struct {
	MessageID string
	// contains filtered or unexported fields
}

DataSMResp PDU.

func (*DataSMResp) CanResponse

func (c *DataSMResp) CanResponse() bool

CanResponse implements PDU interface.

func (*DataSMResp) GetHeader

func (c *DataSMResp) GetHeader() Header

GetHeader returns pdu header.

func (*DataSMResp) GetResponse

func (c *DataSMResp) GetResponse() PDU

GetResponse implements PDU interface.

func (*DataSMResp) IsGNack

func (c *DataSMResp) IsGNack() bool

IsGNack is generic n-ack.

func (*DataSMResp) IsOk

func (c *DataSMResp) IsOk() bool

IsOk is status ok.

func (*DataSMResp) Marshal

func (c *DataSMResp) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*DataSMResp) RegisterOptionalParam

func (c *DataSMResp) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*DataSMResp) Unmarshal

func (c *DataSMResp) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type DeliverSM

type DeliverSM struct {
	ServiceType          string
	SourceAddr           Address
	DestAddr             Address
	EsmClass             byte
	ProtocolID           byte
	PriorityFlag         byte
	ScheduleDeliveryTime string // not used
	ValidityPeriod       string // not used
	RegisteredDelivery   byte
	ReplaceIfPresentFlag byte // not used
	Message              ShortMessage
	// contains filtered or unexported fields
}

DeliverSM PDU is issued by the SMSC to send a message to an ESME. Using this command, the SMSC may route a short message to the ESME for delivery.

func (*DeliverSM) CanResponse

func (c *DeliverSM) CanResponse() bool

CanResponse implements PDU interface.

func (*DeliverSM) GetHeader

func (c *DeliverSM) GetHeader() Header

GetHeader returns pdu header.

func (*DeliverSM) GetResponse

func (c *DeliverSM) GetResponse() PDU

GetResponse implements PDU interface.

func (*DeliverSM) IsGNack

func (c *DeliverSM) IsGNack() bool

IsGNack is generic n-ack.

func (*DeliverSM) IsOk

func (c *DeliverSM) IsOk() bool

IsOk is status ok.

func (*DeliverSM) Marshal

func (c *DeliverSM) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*DeliverSM) RegisterOptionalParam

func (c *DeliverSM) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*DeliverSM) Unmarshal

func (c *DeliverSM) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type DeliverSMResp

type DeliverSMResp struct {
	MessageID string
	// contains filtered or unexported fields
}

DeliverSMResp PDU.

func (*DeliverSMResp) CanResponse

func (c *DeliverSMResp) CanResponse() bool

CanResponse implements PDU interface.

func (*DeliverSMResp) GetHeader

func (c *DeliverSMResp) GetHeader() Header

GetHeader returns pdu header.

func (*DeliverSMResp) GetResponse

func (c *DeliverSMResp) GetResponse() PDU

GetResponse implements PDU interface.

func (*DeliverSMResp) IsGNack

func (c *DeliverSMResp) IsGNack() bool

IsGNack is generic n-ack.

func (*DeliverSMResp) IsOk

func (c *DeliverSMResp) IsOk() bool

IsOk is status ok.

func (*DeliverSMResp) Marshal

func (c *DeliverSMResp) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*DeliverSMResp) RegisterOptionalParam

func (c *DeliverSMResp) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*DeliverSMResp) Unmarshal

func (c *DeliverSMResp) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type DestinationAddress

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

DestinationAddress represents Address or Distribution List based on destination flag.

func NewDestinationAddress

func NewDestinationAddress() (c DestinationAddress)

NewDestinationAddress returns new DestinationAddress.

func (*DestinationAddress) Address

func (c *DestinationAddress) Address() Address

Address returns underlying Address.

func (*DestinationAddress) DistributionList

func (c *DestinationAddress) DistributionList() DistributionList

DistributionList returns underlying DistributionList.

func (*DestinationAddress) HasValue

func (c *DestinationAddress) HasValue() bool

HasValue returns true if underlying DistributionList/Address is assigned.

func (*DestinationAddress) IsAddress

func (c *DestinationAddress) IsAddress() bool

IsAddress returns true if DestinationAddress is a SME Address.

func (*DestinationAddress) IsDistributionList

func (c *DestinationAddress) IsDistributionList() bool

IsDistributionList returns true if DestinationAddress is a DistributionList.

func (*DestinationAddress) Marshal

func (c *DestinationAddress) Marshal(b *ByteBuffer)

Marshal to buffer.

func (*DestinationAddress) SetAddress

func (c *DestinationAddress) SetAddress(addr Address)

SetAddress marks DistributionAddress as a SME Address and assign.

func (*DestinationAddress) SetDistributionList

func (c *DestinationAddress) SetDistributionList(list DistributionList)

SetDistributionList marks DistributionAddress as a DistributionList and assign.

func (*DestinationAddress) Unmarshal

func (c *DestinationAddress) Unmarshal(b *ByteBuffer) (err error)

Unmarshal from buffer.

type DestinationAddresses

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

DestinationAddresses represents list of DestinationAddress.

func NewDestinationAddresses

func NewDestinationAddresses() (u DestinationAddresses)

NewDestinationAddresses returns list of DestinationAddress.

func (*DestinationAddresses) Add

func (c *DestinationAddresses) Add(addresses ...DestinationAddress)

Add to list.

func (*DestinationAddresses) Get

Get list.

func (*DestinationAddresses) Marshal

func (c *DestinationAddresses) Marshal(b *ByteBuffer)

Marshal to buffer.

func (*DestinationAddresses) Unmarshal

func (c *DestinationAddresses) Unmarshal(b *ByteBuffer) (err error)

Unmarshal from buffer.

type DistributionList

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

DistributionList represents group of contacts.

func NewDistributionList

func NewDistributionList(name string) (c DistributionList, err error)

NewDistributionList returns a new DistributionList.

func (*DistributionList) Marshal

func (c *DistributionList) Marshal(b *ByteBuffer)

Marshal to buffer.

func (DistributionList) Name

func (c DistributionList) Name() string

Name returns name of DistributionList

func (*DistributionList) SetName

func (c *DistributionList) SetName(name string) (err error)

SetName sets DistributionList name.

func (*DistributionList) Unmarshal

func (c *DistributionList) Unmarshal(b *ByteBuffer) (err error)

Unmarshal from buffer.

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

EnquireLink PDU. This message can be sent by either the ESME or SMSC and is used to provide a confidence- check of the communication path between an ESME and an SMSC. On receipt of this request the receiving party should respond with an enquire_link_resp, thus verifying that the application level connection between the SMSC and the ESME is functioning. The ESME may also respond by sending any valid SMPP primitive.

func (*EnquireLink) CanResponse

func (c *EnquireLink) CanResponse() bool

CanResponse implements PDU interface.

func (*EnquireLink) GetHeader

func (c *EnquireLink) GetHeader() Header

GetHeader returns pdu header.

func (*EnquireLink) GetResponse

func (c *EnquireLink) GetResponse() PDU

GetResponse implements PDU interface.

func (*EnquireLink) IsGNack

func (c *EnquireLink) IsGNack() bool

IsGNack is generic n-ack.

func (*EnquireLink) IsOk

func (c *EnquireLink) IsOk() bool

IsOk is status ok.

func (*EnquireLink) Marshal

func (c *EnquireLink) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*EnquireLink) RegisterOptionalParam

func (c *EnquireLink) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*EnquireLink) Unmarshal

func (c *EnquireLink) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type EnquireLinkResp

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

EnquireLinkResp PDU.

func (*EnquireLinkResp) CanResponse

func (c *EnquireLinkResp) CanResponse() bool

CanResponse implements PDU interface.

func (*EnquireLinkResp) GetHeader

func (c *EnquireLinkResp) GetHeader() Header

GetHeader returns pdu header.

func (*EnquireLinkResp) GetResponse

func (c *EnquireLinkResp) GetResponse() PDU

GetResponse implements PDU interface.

func (*EnquireLinkResp) IsGNack

func (c *EnquireLinkResp) IsGNack() bool

IsGNack is generic n-ack.

func (*EnquireLinkResp) IsOk

func (c *EnquireLinkResp) IsOk() bool

IsOk is status ok.

func (*EnquireLinkResp) Marshal

func (c *EnquireLinkResp) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*EnquireLinkResp) RegisterOptionalParam

func (c *EnquireLinkResp) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*EnquireLinkResp) Unmarshal

func (c *EnquireLinkResp) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type Field

type Field struct {
	Tag  Tag
	Data []byte
}

Field is a PDU Tag-Length-Value (TLV) field

func (*Field) Marshal

func (t *Field) Marshal(w *ByteBuffer)

Marshal to writer.

func (*Field) String

func (t *Field) String() string

String implements the Data interface.

func (*Field) Unmarshal

func (t *Field) Unmarshal(b *ByteBuffer) (err error)

Unmarshal from reader.

type GenericNack

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

GenericNack PDU is a generic negative acknowledgement to an SMPP PDU submitted with an invalid message header. A generic_nack response is returned in the following cases:

  • Invalid command_length If the receiving SMPP entity, on decoding an SMPP PDU, detects an invalid command_length (either too short or too long), it should assume that the data is corrupt. In such cases a generic_nack PDU must be returned to the message originator.
  • Unknown command_id If an unknown or invalid command_id is received, a generic_nack PDU must also be returned to the originator.

func (*GenericNack) CanResponse

func (c *GenericNack) CanResponse() bool

CanResponse implements PDU interface.

func (*GenericNack) GetHeader

func (c *GenericNack) GetHeader() Header

GetHeader returns pdu header.

func (*GenericNack) GetResponse

func (c *GenericNack) GetResponse() PDU

GetResponse implements PDU interface.

func (*GenericNack) IsGNack

func (c *GenericNack) IsGNack() bool

IsGNack is generic n-ack.

func (*GenericNack) IsOk

func (c *GenericNack) IsOk() bool

IsOk is status ok.

func (*GenericNack) Marshal

func (c *GenericNack) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*GenericNack) RegisterOptionalParam

func (c *GenericNack) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*GenericNack) Unmarshal

func (c *GenericNack) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type Header struct {
	CommandLength  int32
	CommandID      data.CommandIDType
	CommandStatus  data.CommandStatusType
	SequenceNumber int32
}

Header represents PDU header.

func ParseHeader

func ParseHeader(v [16]byte) (h Header)

ParseHeader parses PDU header.

func (*Header) AssignSequenceNumber

func (c *Header) AssignSequenceNumber()

AssignSequenceNumber assigns sequence number auto-incrementally.

func (*Header) GetSequenceNumber

func (c *Header) GetSequenceNumber() int32

GetSequenceNumber returns assigned sequence number.

func (*Header) Marshal

func (c *Header) Marshal(b *ByteBuffer)

Marshal to buffer.

func (*Header) ResetSequenceNumber

func (c *Header) ResetSequenceNumber()

ResetSequenceNumber resets sequence number.

func (*Header) SetSequenceNumber

func (c *Header) SetSequenceNumber(v int32)

SetSequenceNumber manually sets sequence number.

func (*Header) Unmarshal

func (c *Header) Unmarshal(b *ByteBuffer) (err error)

Unmarshal from buffer.

type InfoElement

type InfoElement struct {
	ID   byte
	Data []byte
}

InfoElement represent a 3 parts Information-Element as defined in 3GPP TS 23.040 Section 9.2.3.24 Each InfoElement is comprised of it's identifier and data

func NewIEConcatMessage

func NewIEConcatMessage(totalParts, partNum, mref byte) InfoElement

NewIEConcatMessage turn a new IE element for concat message info IE.Data is populated at time of object creation

func (*InfoElement) UnmarshalBinary

func (ie *InfoElement) UnmarshalBinary(src []byte) (int, error)

UnmarshalBinary unmarshal IE from binary in src, only read a single IE, expect src at least of length 2 with correct IE format:

[ ID_1, LENGTH_1, DATA_N ]

type Outbind

type Outbind struct {
	SystemID string
	Password string
	// contains filtered or unexported fields
}

Outbind PDU is used by the SMSC to signal an ESME to originate a bind_receiver request to the SMSC.

func (*Outbind) CanResponse

func (c *Outbind) CanResponse() bool

CanResponse implements PDU interface.

func (*Outbind) GetHeader

func (c *Outbind) GetHeader() Header

GetHeader returns pdu header.

func (*Outbind) GetResponse

func (c *Outbind) GetResponse() PDU

GetResponse implements PDU interface.

func (*Outbind) IsGNack

func (c *Outbind) IsGNack() bool

IsGNack is generic n-ack.

func (*Outbind) IsOk

func (c *Outbind) IsOk() bool

IsOk is status ok.

func (*Outbind) Marshal

func (c *Outbind) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*Outbind) RegisterOptionalParam

func (c *Outbind) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*Outbind) Unmarshal

func (c *Outbind) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type PDU

type PDU interface {
	// Marshal PDU to buffer.
	Marshal(*ByteBuffer)

	// Unmarshal PDU from buffer.
	Unmarshal(*ByteBuffer) error

	// CanResponse indicates that PDU could response to SMSC.
	CanResponse() bool

	// GetResponse PDU.
	GetResponse() PDU

	// RegisterOptionalParam assigns an optional param.
	RegisterOptionalParam(Field)

	// GetHeader returns PDU header.
	GetHeader() Header

	// IsOk returns true if command status is OK.
	IsOk() bool

	// IsGNack returns true if PDU is GNack.
	IsGNack() bool

	// AssignSequenceNumber assigns sequence number auto-incrementally.
	AssignSequenceNumber()

	// ResetSequenceNumber resets sequence number.
	ResetSequenceNumber()

	// GetSequenceNumber returns assigned sequence number.
	GetSequenceNumber() int32

	// SetSequenceNumber manually sets sequence number.
	SetSequenceNumber(int32)
}

PDU represents PDU interface.

func CreatePDUFromCmdID

func CreatePDUFromCmdID(cmdID data.CommandIDType) (PDU, error)

CreatePDUFromCmdID creates PDU from cmd id.

func NewAlertNotification

func NewAlertNotification() PDU

NewAlertNotification create new alert notification pdu.

func NewBindReceiver

func NewBindReceiver() PDU

NewBindReceiver returns new bind receiver pdu.

func NewBindReceiverResp

func NewBindReceiverResp() PDU

NewBindReceiverResp returns new bind receiver resp.

func NewBindTransceiver

func NewBindTransceiver() PDU

NewBindTransceiver returns new bind transceiver pdu.

func NewBindTransceiverResp

func NewBindTransceiverResp() PDU

NewBindTransceiverResp returns new bind transceiver resp.

func NewBindTransmitter

func NewBindTransmitter() PDU

NewBindTransmitter returns new bind transmitter pdu.

func NewBindTransmitterResp

func NewBindTransmitterResp() PDU

NewBindTransmitterResp returns new bind transmitter resp.

func NewCancelSM

func NewCancelSM() PDU

NewCancelSM returns CancelSM PDU.

func NewCancelSMResp

func NewCancelSMResp() PDU

NewCancelSMResp returns CancelSMResp.

func NewCancelSMRespFromReq

func NewCancelSMRespFromReq(req *CancelSM) PDU

NewCancelSMRespFromReq returns CancelSMResp.

func NewDataSM

func NewDataSM() PDU

NewDataSM returns new data sm pdu.

func NewDataSMResp

func NewDataSMResp() PDU

NewDataSMResp returns DataSMResp.

func NewDataSMRespFromReq

func NewDataSMRespFromReq(req *DataSM) PDU

NewDataSMRespFromReq returns DataSMResp.

func NewDeliverSM

func NewDeliverSM() PDU

NewDeliverSM returns DeliverSM PDU.

func NewDeliverSMResp

func NewDeliverSMResp() PDU

NewDeliverSMResp returns new DeliverSMResp.

func NewDeliverSMRespFromReq

func NewDeliverSMRespFromReq(req *DeliverSM) PDU

NewDeliverSMRespFromReq returns new DeliverSMResp.

func NewEnquireLink() PDU

NewEnquireLink returns new EnquireLink PDU.

func NewEnquireLinkResp

func NewEnquireLinkResp() PDU

NewEnquireLinkResp returns EnquireLinkResp.

func NewEnquireLinkRespFromReq

func NewEnquireLinkRespFromReq(req *EnquireLink) PDU

NewEnquireLinkRespFromReq returns EnquireLinkResp.

func NewGenericNack

func NewGenericNack() PDU

NewGenericNack returns new GenericNack PDU.

func NewOutbind

func NewOutbind() PDU

NewOutbind returns Outbind PDU.

func NewQuerySM

func NewQuerySM() PDU

NewQuerySM returns new QuerySM PDU.

func NewQuerySMResp

func NewQuerySMResp() PDU

NewQuerySMResp returns new QuerySM PDU.

func NewQuerySMRespFromReq

func NewQuerySMRespFromReq(req *QuerySM) PDU

NewQuerySMRespFromReq returns new QuerySM PDU.

func NewReplaceSM

func NewReplaceSM() PDU

NewReplaceSM returns ReplaceSM PDU.

func NewReplaceSMResp

func NewReplaceSMResp() PDU

NewReplaceSMResp returns ReplaceSMResp.

func NewReplaceSMRespFromReq

func NewReplaceSMRespFromReq(req *ReplaceSM) PDU

NewReplaceSMRespFromReq returns ReplaceSMResp.

func NewSubmitMulti

func NewSubmitMulti() PDU

NewSubmitMulti returns NewSubmitMulti PDU.

func NewSubmitMultiResp

func NewSubmitMultiResp() PDU

NewSubmitMultiResp returns new SubmitMultiResp.

func NewSubmitMultiRespFromReq

func NewSubmitMultiRespFromReq(req *SubmitMulti) PDU

NewSubmitMultiRespFromReq returns new SubmitMultiResp.

func NewSubmitSM

func NewSubmitSM() PDU

NewSubmitSM returns SubmitSM PDU.

func NewSubmitSMResp

func NewSubmitSMResp() PDU

NewSubmitSMResp returns new SubmitSMResp.

func NewSubmitSMRespFromReq

func NewSubmitSMRespFromReq(req *SubmitSM) PDU

NewSubmitSMRespFromReq returns new SubmitSMResp.

func NewUnbind

func NewUnbind() PDU

NewUnbind returns Unbind PDU.

func NewUnbindResp

func NewUnbindResp() PDU

NewUnbindResp returns UnbindResp.

func NewUnbindRespFromReq

func NewUnbindRespFromReq(req *Unbind) PDU

NewUnbindRespFromReq returns UnbindResp.

func Parse

func Parse(r io.Reader) (pdu PDU, err error)

Parse PDU from reader.

type QuerySM

type QuerySM struct {
	MessageID  string
	SourceAddr Address
	// contains filtered or unexported fields
}

QuerySM PDU is issued by the ESME to query the status of a previously submitted short message. The matching mechanism is based on the SMSC assigned message_id and source address. Where the original submit_sm, data_sm or submit_multi ‘source address’ was defaulted to NULL, then the source address in the query_sm command should also be set to NULL.

func (*QuerySM) CanResponse

func (c *QuerySM) CanResponse() bool

CanResponse implements PDU interface.

func (*QuerySM) GetHeader

func (c *QuerySM) GetHeader() Header

GetHeader returns pdu header.

func (*QuerySM) GetResponse

func (c *QuerySM) GetResponse() PDU

GetResponse implements PDU interface.

func (*QuerySM) IsGNack

func (c *QuerySM) IsGNack() bool

IsGNack is generic n-ack.

func (*QuerySM) IsOk

func (c *QuerySM) IsOk() bool

IsOk is status ok.

func (*QuerySM) Marshal

func (c *QuerySM) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*QuerySM) RegisterOptionalParam

func (c *QuerySM) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*QuerySM) Unmarshal

func (c *QuerySM) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type QuerySMResp

type QuerySMResp struct {
	MessageID    string
	FinalDate    string
	MessageState byte
	ErrorCode    byte
	// contains filtered or unexported fields
}

QuerySMResp PDU.

func (*QuerySMResp) CanResponse

func (c *QuerySMResp) CanResponse() bool

CanResponse implements PDU interface.

func (*QuerySMResp) GetHeader

func (c *QuerySMResp) GetHeader() Header

GetHeader returns pdu header.

func (*QuerySMResp) GetResponse

func (c *QuerySMResp) GetResponse() PDU

GetResponse implements PDU interface.

func (*QuerySMResp) IsGNack

func (c *QuerySMResp) IsGNack() bool

IsGNack is generic n-ack.

func (*QuerySMResp) IsOk

func (c *QuerySMResp) IsOk() bool

IsOk is status ok.

func (*QuerySMResp) Marshal

func (c *QuerySMResp) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*QuerySMResp) RegisterOptionalParam

func (c *QuerySMResp) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*QuerySMResp) Unmarshal

func (c *QuerySMResp) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type ReplaceSM

type ReplaceSM struct {
	MessageID            string
	SourceAddr           Address
	ScheduleDeliveryTime string
	ValidityPeriod       string
	RegisteredDelivery   byte
	Message              ShortMessage
	// contains filtered or unexported fields
}

ReplaceSM PDU is issued by the ESME to replace a previously submitted short message that is still pending delivery. The matching mechanism is based on the message_id and source address of the original message. Where the original submit_sm ‘source address’ was defaulted to NULL, then the source address in the replace_sm command should also be NULL.

func (*ReplaceSM) CanResponse

func (c *ReplaceSM) CanResponse() bool

CanResponse implements PDU interface.

func (*ReplaceSM) GetHeader

func (c *ReplaceSM) GetHeader() Header

GetHeader returns pdu header.

func (*ReplaceSM) GetResponse

func (c *ReplaceSM) GetResponse() PDU

GetResponse implements PDU interface.

func (*ReplaceSM) IsGNack

func (c *ReplaceSM) IsGNack() bool

IsGNack is generic n-ack.

func (*ReplaceSM) IsOk

func (c *ReplaceSM) IsOk() bool

IsOk is status ok.

func (*ReplaceSM) Marshal

func (c *ReplaceSM) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*ReplaceSM) RegisterOptionalParam

func (c *ReplaceSM) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*ReplaceSM) Unmarshal

func (c *ReplaceSM) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type ReplaceSMResp

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

ReplaceSMResp PDU.

func (*ReplaceSMResp) CanResponse

func (c *ReplaceSMResp) CanResponse() bool

CanResponse implements PDU interface.

func (*ReplaceSMResp) GetHeader

func (c *ReplaceSMResp) GetHeader() Header

GetHeader returns pdu header.

func (*ReplaceSMResp) GetResponse

func (c *ReplaceSMResp) GetResponse() PDU

GetResponse implements PDU interface.

func (*ReplaceSMResp) IsGNack

func (c *ReplaceSMResp) IsGNack() bool

IsGNack is generic n-ack.

func (*ReplaceSMResp) IsOk

func (c *ReplaceSMResp) IsOk() bool

IsOk is status ok.

func (*ReplaceSMResp) Marshal

func (c *ReplaceSMResp) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*ReplaceSMResp) RegisterOptionalParam

func (c *ReplaceSMResp) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*ReplaceSMResp) Unmarshal

func (c *ReplaceSMResp) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type ShortMessage

type ShortMessage struct {
	SmDefaultMsgID byte
	// contains filtered or unexported fields
}

ShortMessage message.

func NewBinaryShortMessage

func NewBinaryShortMessage(messageData []byte) (s ShortMessage, err error)

NewBinaryShortMessage returns new ShortMessage.

func NewBinaryShortMessageWithEncoding

func NewBinaryShortMessageWithEncoding(messageData []byte, enc data.Encoding) (s ShortMessage, err error)

NewBinaryShortMessageWithEncoding returns new ShortMessage with predefined encoding.

func NewLongMessage

func NewLongMessage(message string) (s []*ShortMessage, err error)

NewLongMessage returns long message splitted into multiple short message

func NewLongMessageWithEncoding

func NewLongMessageWithEncoding(message string, enc data.Encoding) (s []*ShortMessage, err error)

NewLongMessageWithEncoding returns long message splitted into multiple short message with encoding of choice

func NewShortMessage

func NewShortMessage(message string) (s ShortMessage, err error)

NewShortMessage returns new ShortMessage.

func NewShortMessageWithEncoding

func NewShortMessageWithEncoding(message string, enc data.Encoding) (s ShortMessage, err error)

NewShortMessageWithEncoding returns new ShortMessage with predefined encoding.

func (*ShortMessage) Encoding

func (c *ShortMessage) Encoding() data.Encoding

Encoding returns message encoding.

func (*ShortMessage) GetMessage

func (c *ShortMessage) GetMessage() (st string, err error)

GetMessage returns underlying message.

func (*ShortMessage) GetMessageData

func (c *ShortMessage) GetMessageData() (d []byte, err error)

GetMessageData returns underlying binary message.

func (*ShortMessage) GetMessageWithEncoding

func (c *ShortMessage) GetMessageWithEncoding(enc data.Encoding) (st string, err error)

GetMessageWithEncoding returns (decoded) underlying message.

func (*ShortMessage) Marshal

func (c *ShortMessage) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*ShortMessage) SetLongMessageWithEnc

func (c *ShortMessage) SetLongMessageWithEnc(message string, enc data.Encoding) (err error)

SetLongMessageWithEnc sets ShortMessage with message longer than 256 bytes callers are expected to call Split() after this

func (*ShortMessage) SetMessageDataWithEncoding

func (c *ShortMessage) SetMessageDataWithEncoding(d []byte, enc data.Encoding) (err error)

SetMessageDataWithEncoding sets underlying raw data which is used for pdu marshalling.

func (*ShortMessage) SetMessageWithEncoding

func (c *ShortMessage) SetMessageWithEncoding(message string, enc data.Encoding) (err error)

SetMessageWithEncoding sets message with encoding.

func (*ShortMessage) SetMessageWithEncodingBasic

func (c *ShortMessage) SetMessageWithEncodingBasic(ud []byte, udh UDH) (err error)

func (*ShortMessage) SetUDH

func (c *ShortMessage) SetUDH(udh UDH)

SetUDH sets user data header for short message also appends udh to the beginning of messageData

func (*ShortMessage) UDH

func (c *ShortMessage) UDH() UDH

UDH gets user data header for short message

func (*ShortMessage) Unmarshal

func (c *ShortMessage) Unmarshal(b *ByteBuffer, udhi bool) (err error)

Unmarshal implements PDU interface.

type SubmitMulti

type SubmitMulti struct {
	ServiceType          string
	SourceAddr           Address
	DestAddrs            DestinationAddresses
	EsmClass             byte
	ProtocolID           byte
	PriorityFlag         byte
	ScheduleDeliveryTime string
	ValidityPeriod       string // not used
	RegisteredDelivery   byte
	ReplaceIfPresentFlag byte // not used
	Message              ShortMessage
	// contains filtered or unexported fields
}

SubmitMulti PDU is used to submit an SMPP message for delivery to multiple recipients or to one or more Distribution Lists. The submit_multi PDU does not support the transaction message mode.

func (*SubmitMulti) CanResponse

func (c *SubmitMulti) CanResponse() bool

CanResponse implements PDU interface.

func (*SubmitMulti) GetHeader

func (c *SubmitMulti) GetHeader() Header

GetHeader returns pdu header.

func (*SubmitMulti) GetResponse

func (c *SubmitMulti) GetResponse() PDU

GetResponse implements PDU interface.

func (*SubmitMulti) IsGNack

func (c *SubmitMulti) IsGNack() bool

IsGNack is generic n-ack.

func (*SubmitMulti) IsOk

func (c *SubmitMulti) IsOk() bool

IsOk is status ok.

func (*SubmitMulti) Marshal

func (c *SubmitMulti) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*SubmitMulti) RegisterOptionalParam

func (c *SubmitMulti) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*SubmitMulti) Unmarshal

func (c *SubmitMulti) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type SubmitMultiResp

type SubmitMultiResp struct {
	MessageID     string
	UnsuccessSMEs UnsuccessSMEs
	// contains filtered or unexported fields
}

SubmitMultiResp PDU.

func (*SubmitMultiResp) CanResponse

func (c *SubmitMultiResp) CanResponse() bool

CanResponse implements PDU interface.

func (*SubmitMultiResp) GetHeader

func (c *SubmitMultiResp) GetHeader() Header

GetHeader returns pdu header.

func (*SubmitMultiResp) GetResponse

func (c *SubmitMultiResp) GetResponse() PDU

GetResponse implements PDU interface.

func (*SubmitMultiResp) IsGNack

func (c *SubmitMultiResp) IsGNack() bool

IsGNack is generic n-ack.

func (*SubmitMultiResp) IsOk

func (c *SubmitMultiResp) IsOk() bool

IsOk is status ok.

func (*SubmitMultiResp) Marshal

func (c *SubmitMultiResp) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*SubmitMultiResp) RegisterOptionalParam

func (c *SubmitMultiResp) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*SubmitMultiResp) Unmarshal

func (c *SubmitMultiResp) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type SubmitSM

type SubmitSM struct {
	ServiceType          string
	SourceAddr           Address
	DestAddr             Address
	EsmClass             byte
	ProtocolID           byte
	PriorityFlag         byte
	ScheduleDeliveryTime string // not used
	ValidityPeriod       string // not used
	RegisteredDelivery   byte
	ReplaceIfPresentFlag byte // not used
	Message              ShortMessage
	// contains filtered or unexported fields
}

SubmitSM PDU is used by an ESME to submit a short message to the SMSC for onward transmission to a specified short message entity (SME). The submit_sm PDU does not support the transaction message mode.

func (*SubmitSM) CanResponse

func (c *SubmitSM) CanResponse() bool

CanResponse implements PDU interface.

func (*SubmitSM) GetHeader

func (c *SubmitSM) GetHeader() Header

GetHeader returns pdu header.

func (*SubmitSM) GetResponse

func (c *SubmitSM) GetResponse() PDU

GetResponse implements PDU interface.

func (*SubmitSM) IsGNack

func (c *SubmitSM) IsGNack() bool

IsGNack is generic n-ack.

func (*SubmitSM) IsOk

func (c *SubmitSM) IsOk() bool

IsOk is status ok.

func (*SubmitSM) Marshal

func (c *SubmitSM) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*SubmitSM) RegisterOptionalParam

func (c *SubmitSM) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*SubmitSM) ShouldSplit

func (c *SubmitSM) ShouldSplit() bool

ShouldSplit check if this the user data of submitSM PDU

func (*SubmitSM) Split

func (c *SubmitSM) Split() (multiSubSM []*SubmitSM, err error)

Split split a single long text message into multiple SubmitSM PDU, Each have the TPUD within the GSM's User Data limit of 140 octet If the message is short enough and doesn't need splitting, Split() returns an array of length 1

func (*SubmitSM) Unmarshal

func (c *SubmitSM) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type SubmitSMResp

type SubmitSMResp struct {
	MessageID string
	// contains filtered or unexported fields
}

SubmitSMResp PDU.

func (*SubmitSMResp) CanResponse

func (c *SubmitSMResp) CanResponse() bool

CanResponse implements PDU interface.

func (*SubmitSMResp) GetHeader

func (c *SubmitSMResp) GetHeader() Header

GetHeader returns pdu header.

func (*SubmitSMResp) GetResponse

func (c *SubmitSMResp) GetResponse() PDU

GetResponse implements PDU interface.

func (*SubmitSMResp) IsGNack

func (c *SubmitSMResp) IsGNack() bool

IsGNack is generic n-ack.

func (*SubmitSMResp) IsOk

func (c *SubmitSMResp) IsOk() bool

IsOk is status ok.

func (*SubmitSMResp) Marshal

func (c *SubmitSMResp) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*SubmitSMResp) RegisterOptionalParam

func (c *SubmitSMResp) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*SubmitSMResp) Unmarshal

func (c *SubmitSMResp) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type Tag

type Tag uint16

Tag is the tag of a Tag-Length-Value (TLV) field.

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

Common Tag-Length-Value (TLV) tags.

func (Tag) Hex

func (t Tag) Hex() string

Hex returns hexadecimal representation of tag

type UDH

type UDH []InfoElement

UDH represent User Data Header as defined in 3GPP TS 23.040 Section 9.2.3.24.

func (UDH) FindInfoElement

func (u UDH) FindInfoElement(id byte) (ie *InfoElement, found bool)

FindInfoElement find the first occurrence of the Information Element with id

func (UDH) GetConcatInfo

func (u UDH) GetConcatInfo() (totalParts, partNum, mref byte, found bool)

GetConcatInfo return the FIRST concatenated message IE,

func (UDH) MarshalBinary

func (u UDH) MarshalBinary() (b []byte, err error)

MarshalBinary marshal UDH into bytes array The first byte is UDHL MarshalBinary preserve InformationElement order as they appears in the UDH

If the total UDHL is larger than what length(byte) can specified, this will truncate IE until total length fit within 256, if you want to check if any IE has been truncated, see if UDHL() < -1, notes on UDHL()

func (UDH) UDHL

func (u UDH) UDHL() (l int)

UDHL returns length (octets) of encoded UDH, including the UDHL byte.

If there is no InfoElement (IE), returns 0. If total length exceed 255, return -1.

func (*UDH) UnmarshalBinary

func (u *UDH) UnmarshalBinary(src []byte) (int, error)

UnmarshalBinary reads the InformationElements from raw binary UDH. Unmarshal preserve InfoElement order as they appears in the raw data The src contains the complete UDH, including the UDHL and all IEs. Returns the number of bytes read from src, and the first error detected while unmarshalling.

Since UDHL can only represented in 1 byte, UnmarshalBinary will only read up to a maximum of 256 byte regardless of src length

type Unbind

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

Unbind PDU is to deregister an instance of an ESME from the SMSC and inform the SMSC that the ESME no longer wishes to use this network connection for the submission or delivery of messages.

func (*Unbind) CanResponse

func (c *Unbind) CanResponse() bool

CanResponse implements PDU interface.

func (*Unbind) GetHeader

func (c *Unbind) GetHeader() Header

GetHeader returns pdu header.

func (*Unbind) GetResponse

func (c *Unbind) GetResponse() PDU

GetResponse implements PDU interface.

func (*Unbind) IsGNack

func (c *Unbind) IsGNack() bool

IsGNack is generic n-ack.

func (*Unbind) IsOk

func (c *Unbind) IsOk() bool

IsOk is status ok.

func (*Unbind) Marshal

func (c *Unbind) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*Unbind) RegisterOptionalParam

func (c *Unbind) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*Unbind) Unmarshal

func (c *Unbind) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type UnbindResp

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

UnbindResp PDU.

func (*UnbindResp) CanResponse

func (c *UnbindResp) CanResponse() bool

CanResponse implements PDU interface.

func (*UnbindResp) GetHeader

func (c *UnbindResp) GetHeader() Header

GetHeader returns pdu header.

func (*UnbindResp) GetResponse

func (c *UnbindResp) GetResponse() PDU

GetResponse implements PDU interface.

func (*UnbindResp) IsGNack

func (c *UnbindResp) IsGNack() bool

IsGNack is generic n-ack.

func (*UnbindResp) IsOk

func (c *UnbindResp) IsOk() bool

IsOk is status ok.

func (*UnbindResp) Marshal

func (c *UnbindResp) Marshal(b *ByteBuffer)

Marshal implements PDU interface.

func (*UnbindResp) RegisterOptionalParam

func (c *UnbindResp) RegisterOptionalParam(tlv Field)

RegisterOptionalParam register optional param.

func (*UnbindResp) Unmarshal

func (c *UnbindResp) Unmarshal(b *ByteBuffer) error

Unmarshal implements PDU interface.

type UnsuccessSME

type UnsuccessSME struct {
	Address
	// contains filtered or unexported fields
}

UnsuccessSME indicates submission was unsuccessful and the respective errors.

func NewUnsuccessSME

func NewUnsuccessSME() (c UnsuccessSME)

NewUnsuccessSME returns new UnsuccessSME

func NewUnsuccessSMEWithAddr

func NewUnsuccessSMEWithAddr(addr string, status data.CommandStatusType) (c UnsuccessSME, err error)

NewUnsuccessSMEWithAddr returns new UnsuccessSME with address.

func NewUnsuccessSMEWithTonNpi

func NewUnsuccessSMEWithTonNpi(ton, npi byte, status data.CommandStatusType) UnsuccessSME

NewUnsuccessSMEWithTonNpi create new address with ton, npi and error code.

func (*UnsuccessSME) ErrorStatusCode

func (c *UnsuccessSME) ErrorStatusCode() data.CommandStatusType

ErrorStatusCode returns assigned status code.

func (*UnsuccessSME) Marshal

func (c *UnsuccessSME) Marshal(b *ByteBuffer)

Marshal to buffer.

func (*UnsuccessSME) SetErrorStatusCode

func (c *UnsuccessSME) SetErrorStatusCode(v data.CommandStatusType)

SetErrorStatusCode sets error status code.

func (*UnsuccessSME) Unmarshal

func (c *UnsuccessSME) Unmarshal(b *ByteBuffer) (err error)

Unmarshal from buffer.

type UnsuccessSMEs

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

UnsuccessSMEs represents list of UnsuccessSME.

func NewUnsuccessSMEs

func NewUnsuccessSMEs() (u UnsuccessSMEs)

NewUnsuccessSMEs returns list of UnsuccessSME.

func (*UnsuccessSMEs) Add

func (c *UnsuccessSMEs) Add(us ...UnsuccessSME)

Add to list.

func (*UnsuccessSMEs) Get

func (c *UnsuccessSMEs) Get() []UnsuccessSME

Get list.

func (*UnsuccessSMEs) Marshal

func (c *UnsuccessSMEs) Marshal(b *ByteBuffer)

Marshal to buffer.

func (*UnsuccessSMEs) Unmarshal

func (c *UnsuccessSMEs) Unmarshal(b *ByteBuffer) (err error)

Unmarshal from buffer.

Jump to

Keyboard shortcuts

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