smpp34

package module
Version: v0.0.0-...-92f573c Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2018 License: MIT Imports: 14 Imported by: 0

README

SMPP34

Check examples folder for usage details

Supported/Unsupported PDUs
  • bind_transmitter
  • bind_transmitter_resp
  • bind_receiver
  • bind_receiver_resp
  • bind_transceiver
  • bind_transceiver_resp
  • outbind
  • unbind
  • unbind_resp
  • submit_sm
  • submit_sm_resp
  • submit_sm_multi
  • submit_sm_multi_resp
  • data_sm
  • data_sm_resp
  • deliver_sm
  • deliver_sm_resp
  • query_sm
  • query_sm_resp
  • cancel_sm
  • cancel_sm_resp
  • replace_sm
  • replace_sm_resp
  • enquire_link
  • enquire_link_resp
  • alert_notification
  • generic_nack

License

This repository is Copyright (c) 2013 Kevin Patel. All rights reserved. It is licensed under the MIT license. Please see the LICENSE file for applicable license terms.

Author

Kevin Patel

Documentation

Index

Constants

View Source
const (
	// SMPP Protocol Version
	SMPP_VERSION = 0x34

	// Max PDU size to minimize some attack vectors
	MAX_PDU_SIZE = 1024 * 4 // 4KB

	// Sequence number start/end
	SEQUENCE_NUM_START = 0x00000001
	SEQUENCE_NUM_END   = 0x7FFFFFFF
)
View Source
const (

	// SMSC Available Messaging Modes (bits 1-0)
	ESM_MESSAGING_MODE_DEFAULT       = "smsc_mode_default"       // xxxxxx00
	ESM_MESSAGING_MODE_DATAGRAM      = "smsc_mode_datagram"      // xxxxxx01
	ESM_MESSAGING_MODE_FORWARD       = "smsc_mode_forward"       // xxxxxx10
	ESM_MESSAGING_MDOE_STORE_FORWARD = "smsc_mode_store_forward" // xxxxxx11

	// SMSC Supported Message Type (bits 5-2)
	ESM_MESSAGE_TYPE_DEFAULT      = "smsc_message_type_default"    // xx0000xx
	ESM_MESSAGE_TYPE_DELIVERY_ACK = "smsc_message_type_auto_ack"   // xx0010xx
	ESM_MESSAGE_TYPE_MANUAL_ACK   = "smsc_message_type_manual_ack" // xx0100xx

	// SMSC GSM Network Specific Features (bits 7-6)
	ESM_GSM_FEATURE_DEFAULT    = "smsc_gsm_feature_default"    // 00xxxxxx
	ESM_GSM_FEATURE_UDHI       = "smsc_gsm_feature_udhi"       // 01xxxxxx
	ESM_GSM_FEATURE_REPLY      = "smsc_gsm_feature_reply"      // 10xxxxxx
	ESM_GSM_FEATURE_UDHI_REPLY = "smsc_gsm_feature_udhi_reply" // 11xxxxxx

)
View Source
const (
	// FIELDS
	SYSTEM_ID               = "system_id"
	PASSWORD                = "password"
	SYSTEM_TYPE             = "system_type"
	INTERFACE_VERSION       = "interface_version"
	ADDR_TON                = "addr_ton"
	ADDR_NPI                = "addr_npi"
	ADDRESS_RANGE           = "address_range"
	SERVICE_TYPE            = "service_type"
	SOURCE_ADDR_TON         = "source_addr_ton" // type of number (originator)
	SOURCE_ADDR_NPI         = "source_addr_npi" // number plan indicator (originator)
	SOURCE_ADDR             = "source_addr"
	DEST_ADDR_TON           = "dest_addr_ton"
	DEST_ADDR_NPI           = "dest_addr_npi"
	DESTINATION_ADDR        = "destination_addr"
	ESM_CLASS               = "esm_class"
	ESM_MESSAGE_MODE        = "esm_message_mode"
	ESM_MESSAGE_TYPE        = "esm_message_type"
	ESM_GSM_NETWORK_TYPE    = "esm_gsm_network_type"
	PROTOCOL_ID             = "protocol_id"
	PRIORITY_FLAG           = "priority_flag"
	SCHEDULE_DELIVERY_TIME  = "schedule_delivery_time"
	VALIDITY_PERIOD         = "validity_period"
	REGISTERED_DELIVERY     = "registered_delivery"
	REPLACE_IF_PRESENT_FLAG = "replace_if_present_flag"
	DATA_CODING             = "data_coding"
	SM_DEFAULT_MSG_ID       = "sm_default_msg_id"
	SM_LENGTH               = "sm_length"
	SHORT_MESSAGE           = "short_message"
	MESSAGE_ID              = "message_id"
	FINAL_DATE              = "final_date"
	MESSAGE_STATE           = "message_state"
	ERROR_CODE              = "error_code"
)
View Source
const (
	// Used for source/destination type of number
	TON_UNKNOWN           = 0 // 00000000
	TON_INTERNATIONAL     = 1 // 00000001
	TON_NATIONAL          = 2 // 00000010
	TON_NETWORK_SPECIFIC  = 3 // 00000011
	TON_SUBSCRIBER_NUMBER = 4 // 00000100
	TON_ALPHANUMERIC      = 5 // 00000101
	TON_ABBREVIATED       = 6 // 00000110

	// Used for source/destination numeric plan indicator NPI
	NPI_UNKNOWN     = 0  // 00000000
	NPI_ISDN        = 1  // 00000001 - E.163 - E.164
	NPI_DATA        = 3  // 00000011 - X.121
	NPI_TELEX       = 4  // 00000100 - F.69
	NPI_LAND_MOBILE = 6  // 00000110 - E.212
	NPI_NATIONAL    = 8  // 00001000
	NPI_PRIVATE     = 9  // 00001001
	NPI_ERMES       = 10 // 00001010
	NPI_IP          = 14 // 00001110
	NPI_WAP         = 18 // 00010010
)

Variables

View Source
var (

	// ESM_MESSAGING_MODES List of available messaging modes
	ESM_MESSAGING_MODES = map[string]string{
		ESM_MESSAGING_MODE_DEFAULT:       "00",
		ESM_MESSAGING_MODE_DATAGRAM:      "01",
		ESM_MESSAGING_MODE_FORWARD:       "10",
		ESM_MESSAGING_MDOE_STORE_FORWARD: "11",
	}

	// ESM_MESSAGE_TYPES List of available message types
	ESM_MESSAGE_TYPES = map[string]string{
		ESM_MESSAGE_TYPE_DEFAULT:      "0000",
		ESM_MESSAGE_TYPE_DELIVERY_ACK: "0010",
		ESM_MESSAGE_TYPE_MANUAL_ACK:   "0100",
	}

	ESM_GSM_FEATURES = map[string]byte{
		ESM_GSM_FEATURE_DEFAULT:    0x00,
		ESM_GSM_FEATURE_UDHI:       0x40,
		ESM_GSM_FEATURE_REPLY:      0x80,
		ESM_GSM_FEATURE_UDHI_REPLY: 0xc0,
	}
)
View Source
var Debug bool

Functions

This section is empty.

Types

type Bind

type Bind struct {
	*Header
	// contains filtered or unexported fields
}

func NewBind

func NewBind(hdr *Header, b []byte) (*Bind, error)

func (*Bind) Fields

func (s *Bind) Fields() map[string]Field

func (*Bind) GetField

func (s *Bind) GetField(f string) Field

func (*Bind) GetHeader

func (s *Bind) GetHeader() *Header

func (*Bind) MandatoryFieldsList

func (s *Bind) MandatoryFieldsList() []string

func (*Bind) Ok

func (s *Bind) Ok() bool

func (*Bind) SetField

func (s *Bind) SetField(f string, v interface{}) error

func (*Bind) SetSeqNum

func (s *Bind) SetSeqNum(i uint32)

func (*Bind) SetTLVField

func (s *Bind) SetTLVField(t, l int, v []byte) error

func (*Bind) TLVFields

func (s *Bind) TLVFields() map[uint16]*TLVField

func (*Bind) Writer

func (s *Bind) Writer() []byte

type BindResp

type BindResp struct {
	*Header
	// contains filtered or unexported fields
}

func NewBindResp

func NewBindResp(hdr *Header, b []byte) (*BindResp, error)

func (*BindResp) Fields

func (s *BindResp) Fields() map[string]Field

func (*BindResp) GetField

func (s *BindResp) GetField(f string) Field

func (*BindResp) GetHeader

func (s *BindResp) GetHeader() *Header

func (*BindResp) MandatoryFieldsList

func (s *BindResp) MandatoryFieldsList() []string

func (*BindResp) Ok

func (s *BindResp) Ok() bool

func (*BindResp) SetField

func (s *BindResp) SetField(f string, v interface{}) error

func (*BindResp) SetSeqNum

func (s *BindResp) SetSeqNum(i uint32)

func (*BindResp) SetTLVField

func (s *BindResp) SetTLVField(t, l int, v []byte) error

func (*BindResp) TLVFields

func (s *BindResp) TLVFields() map[uint16]*TLVField

func (*BindResp) Writer

func (s *BindResp) Writer() []byte

type CMDId

type CMDId uint32
const (
	// PDU Types
	GENERIC_NACK          CMDId = 0x80000000
	BIND_RECEIVER         CMDId = 0x00000001
	BIND_RECEIVER_RESP    CMDId = 0x80000001
	BIND_TRANSMITTER      CMDId = 0x00000002
	BIND_TRANSMITTER_RESP CMDId = 0x80000002
	QUERY_SM              CMDId = 0x00000003
	QUERY_SM_RESP         CMDId = 0x80000003
	SUBMIT_SM             CMDId = 0x00000004
	SUBMIT_SM_RESP        CMDId = 0x80000004
	DELIVER_SM            CMDId = 0x00000005
	DELIVER_SM_RESP       CMDId = 0x80000005
	UNBIND                CMDId = 0x00000006
	UNBIND_RESP           CMDId = 0x80000006
	REPLACE_SM            CMDId = 0x00000007
	REPLACE_SM_RESP       CMDId = 0x80000007
	CANCEL_SM             CMDId = 0x00000008
	CANCEL_SM_RESP        CMDId = 0x80000008
	BIND_TRANSCEIVER      CMDId = 0x00000009
	BIND_TRANSCEIVER_RESP CMDId = 0x80000009
	OUTBIND               CMDId = 0x0000000B
	ENQUIRE_LINK          CMDId = 0x00000015
	ENQUIRE_LINK_RESP     CMDId = 0x80000015
	SUBMIT_MULTI          CMDId = 0x00000021
	SUBMIT_MULTI_RESP     CMDId = 0x80000021
	ALERT_NOTIFICATION    CMDId = 0x00000102
	DATA_SM               CMDId = 0x00000103
	DATA_SM_RESP          CMDId = 0x80000103
)

func (CMDId) Error

func (s CMDId) Error() string

type CMDStatus

type CMDStatus uint32
const (
	// ESME Error Constants
	ESME_ROK              CMDStatus = 0x00000000 // OK!
	ESME_RINVMSGLEN       CMDStatus = 0x00000001 // Message Length is invalid
	ESME_RINVCMDLEN       CMDStatus = 0x00000002 // Command Length is invalid
	ESME_RINVCMDID        CMDStatus = 0x00000003 // Invalid Command ID
	ESME_RINVBNDSTS       CMDStatus = 0x00000004 // Incorrect BIND Status for given command
	ESME_RALYBND          CMDStatus = 0x00000005 // ESME Already in Bound State
	ESME_RINVPRTFLG       CMDStatus = 0x00000006 // Invalid Priority Flag
	ESME_RINVREGDLVFLG    CMDStatus = 0x00000007 // Invalid Registered Delivery Flag
	ESME_RSYSERR          CMDStatus = 0x00000008 // System Error
	ESME_RINVSRCADR       CMDStatus = 0x0000000A // Invalid Source Address
	ESME_RINVDSTADR       CMDStatus = 0x0000000B // Invalid Dest Addr
	ESME_RINVMSGID        CMDStatus = 0x0000000C // Message ID is invalid
	ESME_RBINDFAIL        CMDStatus = 0x0000000D // Bind Failed
	ESME_RINVPASWD        CMDStatus = 0x0000000E // Invalid Password
	ESME_RINVSYSID        CMDStatus = 0x0000000F // Invalid System ID
	ESME_RCANCELFAIL      CMDStatus = 0x00000011 // Cancel SM Failed
	ESME_RREPLACEFAIL     CMDStatus = 0x00000013 // Replace SM Failed
	ESME_RMSGQFUL         CMDStatus = 0x00000014 // Message Queue Full
	ESME_RINVSERTYP       CMDStatus = 0x00000015 // Invalid Service Type
	ESME_RINVNUMDESTS     CMDStatus = 0x00000033 // Invalid number of destinations
	ESME_RINVDLNAME       CMDStatus = 0x00000034 // Invalid Distribution List name
	ESME_RINVDESTFLAG     CMDStatus = 0x00000040 // Destination flag is invalid
	ESME_RINVSUBREP       CMDStatus = 0x00000042 // Invalid 'submit with replace' request
	ESME_RINVESMCLASS     CMDStatus = 0x00000043 // Invalid esm_class field data
	ESME_RCNTSUBDL        CMDStatus = 0x00000044 // Cannot Submit to Distribution List
	ESME_RSUBMITFAIL      CMDStatus = 0x00000045 // submit_sm or submit_multi failed
	ESME_RINVSRCTON       CMDStatus = 0x00000048 // Invalid Source address TON
	ESME_RINVSRCNPI       CMDStatus = 0x00000049 // Invalid Source address NPI
	ESME_RINVDSTTON       CMDStatus = 0x00000050 // Invalid Destination address TON
	ESME_RINVDSTNPI       CMDStatus = 0x00000051 // Invalid Destination address NPI
	ESME_RINVSYSTYP       CMDStatus = 0x00000053 // Invalid system_type field
	ESME_RINVREPFLAG      CMDStatus = 0x00000054 // Invalid replace_if_present flag
	ESME_RINVNUMMSGS      CMDStatus = 0x00000055 // Invalid number of messages
	ESME_RTHROTTLED       CMDStatus = 0x00000058 // Throttling error
	ESME_RINVSCHED        CMDStatus = 0x00000061 // Invalid Scheduled Delivery Time
	ESME_RINVEXPIRY       CMDStatus = 0x00000062 // Invalid message validity period (Expiry time)
	ESME_RINVDFTMSGID     CMDStatus = 0x00000063 // Predefined Message Invalid or Not Found
	ESME_RX_T_APPN        CMDStatus = 0x00000064 // ESME Receiver Temporary App Error Code
	ESME_RX_P_APPN        CMDStatus = 0x00000065 // ESME Receiver Permanent App Error Code
	ESME_RX_R_APPN        CMDStatus = 0x00000066 // ESME Receiver Reject Message Error Code
	ESME_RQUERYFAIL       CMDStatus = 0x00000067 // Query_sm request failed
	ESME_RINVOPTPARSTREAM CMDStatus = 0x000000C0 // Error in the optional part of the PDU Body
	ESME_ROPTPARNOTALLWD  CMDStatus = 0x000000C1 // Optional Parameter not allowed
	ESME_RINVPARLEN       CMDStatus = 0x000000C2 // Invalid Parameter Length
	ESME_RMISSINGOPTPARAM CMDStatus = 0x000000C3 // Expected Optional Parameter missing
	ESME_RINVOPTPARAMVAL  CMDStatus = 0x000000C4 // Invalid Optional Parameter Value
	ESME_RDELIVERYFAILURE CMDStatus = 0x000000FE // Delivery Failure (used for data_sm_resp)
	ESME_RUNKNOWNERR      CMDStatus = 0x000000FF // Unknown Error
)

func (CMDStatus) Error

func (s CMDStatus) Error() string

type DeliverSm

type DeliverSm struct {
	*Header
	// contains filtered or unexported fields
}

func NewDeliverSm

func NewDeliverSm(hdr *Header, b []byte) (*DeliverSm, error)

func (*DeliverSm) Fields

func (d *DeliverSm) Fields() map[string]Field

func (*DeliverSm) GetField

func (d *DeliverSm) GetField(f string) Field

func (*DeliverSm) GetHeader

func (d *DeliverSm) GetHeader() *Header

func (*DeliverSm) MandatoryFieldsList

func (d *DeliverSm) MandatoryFieldsList() []string

func (*DeliverSm) Ok

func (d *DeliverSm) Ok() bool

func (*DeliverSm) SetField

func (d *DeliverSm) SetField(f string, v interface{}) error

func (*DeliverSm) SetSeqNum

func (d *DeliverSm) SetSeqNum(i uint32)

func (*DeliverSm) SetTLVField

func (d *DeliverSm) SetTLVField(t, l int, v []byte) error

func (*DeliverSm) TLVFields

func (d *DeliverSm) TLVFields() map[uint16]*TLVField

func (*DeliverSm) Writer

func (d *DeliverSm) Writer() []byte

type DeliverSmResp

type DeliverSmResp struct {
	*Header
	// contains filtered or unexported fields
}

func NewDeliverSmResp

func NewDeliverSmResp(hdr *Header, b []byte) (*DeliverSmResp, error)

func (*DeliverSmResp) Fields

func (s *DeliverSmResp) Fields() map[string]Field

func (*DeliverSmResp) GetField

func (s *DeliverSmResp) GetField(f string) Field

func (*DeliverSmResp) GetHeader

func (s *DeliverSmResp) GetHeader() *Header

func (*DeliverSmResp) MandatoryFieldsList

func (s *DeliverSmResp) MandatoryFieldsList() []string

func (*DeliverSmResp) Ok

func (s *DeliverSmResp) Ok() bool

func (*DeliverSmResp) SetField

func (s *DeliverSmResp) SetField(f string, v interface{}) error

func (*DeliverSmResp) SetSeqNum

func (s *DeliverSmResp) SetSeqNum(i uint32)

func (*DeliverSmResp) SetTLVField

func (s *DeliverSmResp) SetTLVField(t, l int, v []byte) error

func (*DeliverSmResp) TLVFields

func (s *DeliverSmResp) TLVFields() map[uint16]*TLVField

func (*DeliverSmResp) Writer

func (s *DeliverSmResp) Writer() []byte
type EnquireLink struct {
	*Header
	// contains filtered or unexported fields
}
func NewEnquireLink(hdr *Header) (*EnquireLink, error)

func (*EnquireLink) Fields

func (s *EnquireLink) Fields() map[string]Field

func (*EnquireLink) GetField

func (s *EnquireLink) GetField(f string) Field

func (*EnquireLink) GetHeader

func (s *EnquireLink) GetHeader() *Header

func (*EnquireLink) MandatoryFieldsList

func (s *EnquireLink) MandatoryFieldsList() []string

func (*EnquireLink) Ok

func (s *EnquireLink) Ok() bool

func (*EnquireLink) SetField

func (s *EnquireLink) SetField(f string, v interface{}) error

func (*EnquireLink) SetSeqNum

func (s *EnquireLink) SetSeqNum(i uint32)

func (*EnquireLink) SetTLVField

func (s *EnquireLink) SetTLVField(t, l int, v []byte) error

func (*EnquireLink) TLVFields

func (s *EnquireLink) TLVFields() map[uint16]*TLVField

func (*EnquireLink) Writer

func (s *EnquireLink) Writer() []byte

type EnquireLinkResp

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

func NewEnquireLinkResp

func NewEnquireLinkResp(hdr *Header) (*EnquireLinkResp, error)

func (*EnquireLinkResp) Fields

func (s *EnquireLinkResp) Fields() map[string]Field

func (*EnquireLinkResp) GetField

func (s *EnquireLinkResp) GetField(f string) Field

func (*EnquireLinkResp) GetHeader

func (s *EnquireLinkResp) GetHeader() *Header

func (*EnquireLinkResp) MandatoryFieldsList

func (s *EnquireLinkResp) MandatoryFieldsList() []string

func (*EnquireLinkResp) Ok

func (s *EnquireLinkResp) Ok() bool

func (*EnquireLinkResp) SetField

func (s *EnquireLinkResp) SetField(f string, v interface{}) error

func (*EnquireLinkResp) SetSeqNum

func (s *EnquireLinkResp) SetSeqNum(i uint32)

func (*EnquireLinkResp) SetTLVField

func (s *EnquireLinkResp) SetTLVField(t, l int, v []byte) error

func (*EnquireLinkResp) TLVFields

func (s *EnquireLinkResp) TLVFields() map[uint16]*TLVField

func (*EnquireLinkResp) Writer

func (s *EnquireLinkResp) Writer() []byte

type Field

type Field interface {
	Length() interface{}
	Value() interface{}
	String() string
	ByteArray() []byte
}

func NewField

func NewField(f string, v interface{}) Field

func NewFixedField

func NewFixedField(v uint8) Field

func NewSMField

func NewSMField(v []byte) Field

func NewVariableField

func NewVariableField(v []byte) Field

type FieldErr

type FieldErr string
const FieldValueErr FieldErr = "Invalid field value"

func (FieldErr) Error

func (f FieldErr) Error() string

type FixedField

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

func (*FixedField) ByteArray

func (f *FixedField) ByteArray() []byte

func (*FixedField) Length

func (f *FixedField) Length() interface{}

func (*FixedField) String

func (f *FixedField) String() string

func (*FixedField) Value

func (f *FixedField) Value() interface{}

type GenericNack

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

func NewGenericNack

func NewGenericNack(hdr *Header) (*GenericNack, error)

func (*GenericNack) Fields

func (s *GenericNack) Fields() map[string]Field

func (*GenericNack) GetField

func (s *GenericNack) GetField(f string) Field

func (*GenericNack) GetHeader

func (s *GenericNack) GetHeader() *Header

func (*GenericNack) MandatoryFieldsList

func (s *GenericNack) MandatoryFieldsList() []string

func (*GenericNack) Ok

func (s *GenericNack) Ok() bool

func (*GenericNack) SetField

func (s *GenericNack) SetField(f string, v interface{}) error

func (*GenericNack) SetSeqNum

func (s *GenericNack) SetSeqNum(i uint32)

func (*GenericNack) SetTLVField

func (s *GenericNack) SetTLVField(t, l int, v []byte) error

func (*GenericNack) TLVFields

func (s *GenericNack) TLVFields() map[uint16]*TLVField

func (*GenericNack) Writer

func (s *GenericNack) Writer() []byte
type Header struct {
	Length   uint32
	Id       CMDId
	Status   CMDStatus
	Sequence uint32
}

func NewPduHeader

func NewPduHeader(l uint32, id CMDId, status CMDStatus, seq uint32) *Header

func ParsePduHeader

func ParsePduHeader(data []byte) *Header

type Params

type Params map[string]interface{}

type Pdu

type Pdu interface {
	Fields() map[string]Field
	MandatoryFieldsList() []string
	GetField(string) Field
	GetHeader() *Header
	TLVFields() map[uint16]*TLVField
	Writer() []byte
	SetField(f string, v interface{}) error
	SetTLVField(t, l int, v []byte) error
	SetSeqNum(uint32)
	Ok() bool
}

func ParsePdu

func ParsePdu(data []byte) (Pdu, error)

type PduCmdIdErr

type PduCmdIdErr string

func (PduCmdIdErr) Error

func (p PduCmdIdErr) Error() string

type PduReadErr

type PduReadErr string
const (
	PduLenErr PduReadErr = "Invalid PDU length"
)

func (PduReadErr) Error

func (p PduReadErr) Error() string

type QuerySm

type QuerySm struct {
	*Header
	// contains filtered or unexported fields
}

func NewQuerySm

func NewQuerySm(hdr *Header, b []byte) (*QuerySm, error)

func (*QuerySm) Fields

func (s *QuerySm) Fields() map[string]Field

func (*QuerySm) GetField

func (s *QuerySm) GetField(f string) Field

func (*QuerySm) GetHeader

func (s *QuerySm) GetHeader() *Header

func (*QuerySm) MandatoryFieldsList

func (s *QuerySm) MandatoryFieldsList() []string

func (*QuerySm) Ok

func (s *QuerySm) Ok() bool

func (*QuerySm) SetField

func (s *QuerySm) SetField(f string, v interface{}) error

func (*QuerySm) SetSeqNum

func (s *QuerySm) SetSeqNum(i uint32)

func (*QuerySm) SetTLVField

func (s *QuerySm) SetTLVField(t, l int, v []byte) error

func (*QuerySm) TLVFields

func (s *QuerySm) TLVFields() map[uint16]*TLVField

func (*QuerySm) Writer

func (s *QuerySm) Writer() []byte

type QuerySmResp

type QuerySmResp struct {
	*Header
	// contains filtered or unexported fields
}

func NewQuerySmResp

func NewQuerySmResp(hdr *Header, b []byte) (*QuerySmResp, error)

func (*QuerySmResp) Fields

func (s *QuerySmResp) Fields() map[string]Field

func (*QuerySmResp) GetField

func (s *QuerySmResp) GetField(f string) Field

func (*QuerySmResp) GetHeader

func (s *QuerySmResp) GetHeader() *Header

func (*QuerySmResp) MandatoryFieldsList

func (s *QuerySmResp) MandatoryFieldsList() []string

func (*QuerySmResp) Ok

func (s *QuerySmResp) Ok() bool

func (*QuerySmResp) SetField

func (s *QuerySmResp) SetField(f string, v interface{}) error

func (*QuerySmResp) SetSeqNum

func (s *QuerySmResp) SetSeqNum(i uint32)

func (*QuerySmResp) SetTLVField

func (s *QuerySmResp) SetTLVField(t, l int, v []byte) error

func (*QuerySmResp) TLVFields

func (s *QuerySmResp) TLVFields() map[uint16]*TLVField

func (*QuerySmResp) Writer

func (s *QuerySmResp) Writer() []byte

type Receiver

type Receiver struct {
	Smpp

	Err error // Errors generated in go routines that lead to conn close
	// contains filtered or unexported fields
}

func NewReceiver

func NewReceiver(host string, port int, eli int, bindParams Params) (*Receiver, error)

eli = EnquireLink Interval in Seconds

func (*Receiver) Bind

func (t *Receiver) Bind(system_id string, password string, params *Params) error

func (*Receiver) Close

func (t *Receiver) Close()

func (*Receiver) DeliverSmResp

func (t *Receiver) DeliverSmResp(seq uint32, status CMDStatus, params *Params) error

func (*Receiver) Read

func (t *Receiver) Read() (Pdu, error)
func (t *Receiver) StartEnquireLink(eli int)

func (*Receiver) SubmitSm

func (t *Receiver) SubmitSm(source_addr, destination_addr, short_message string, params *Params) (seq uint32, err error)

func (*Receiver) Unbind

func (t *Receiver) Unbind() error

func (*Receiver) UnbindResp

func (t *Receiver) UnbindResp(seq uint32) error

func (*Receiver) Write

func (t *Receiver) Write(p Pdu) error

type SMField

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

func (*SMField) ByteArray

func (v *SMField) ByteArray() []byte

func (*SMField) Length

func (v *SMField) Length() interface{}

func (*SMField) String

func (v *SMField) String() string

func (*SMField) Value

func (v *SMField) Value() interface{}

type Smpp

type Smpp struct {
	Sequence uint32
	Bound    bool
	// contains filtered or unexported fields
}

func NewSmppConnect

func NewSmppConnect(host string, port int) (*Smpp, error)

func (*Smpp) Bind

func (s *Smpp) Bind(cmdId CMDId, system_id string, password string, params *Params) (Pdu, error)

func (*Smpp) BindResp

func (s *Smpp) BindResp(cmdId CMDId, seq uint32, status CMDStatus, sysId string) (Pdu, error)

func (*Smpp) Close

func (s *Smpp) Close()

func (*Smpp) Connect

func (s *Smpp) Connect(host string, port int) (err error)

func (*Smpp) DeliverSm

func (s *Smpp) DeliverSm(source_addr, destination_addr, short_message string, params *Params) (Pdu, error)

func (*Smpp) DeliverSmResp

func (s *Smpp) DeliverSmResp(seq uint32, status CMDStatus, params *Params) (Pdu, error)
func (s *Smpp) EnquireLink() (Pdu, error)

func (*Smpp) EnquireLinkResp

func (s *Smpp) EnquireLinkResp(seq uint32) (Pdu, error)

func (*Smpp) GenericNack

func (s *Smpp) GenericNack(seq uint32, status CMDStatus) (Pdu, error)

func (*Smpp) NewSeqNum

func (s *Smpp) NewSeqNum() uint32

func (*Smpp) QuerySm

func (s *Smpp) QuerySm(message_id, source_addr string, params *Params) (Pdu, error)

func (*Smpp) Read

func (s *Smpp) Read() (Pdu, error)

func (*Smpp) SetConn

func (s *Smpp) SetConn(conn net.Conn)

func (*Smpp) SubmitSm

func (s *Smpp) SubmitSm(source_addr, destination_addr, short_message string, params *Params) (Pdu, error)

func (*Smpp) SubmitSmResp

func (s *Smpp) SubmitSmResp(seq uint32, status CMDStatus, messageId string) (Pdu, error)

func (*Smpp) Unbind

func (s *Smpp) Unbind() (Pdu, error)

func (*Smpp) UnbindResp

func (s *Smpp) UnbindResp(seq uint32) (Pdu, error)

func (*Smpp) Write

func (s *Smpp) Write(p Pdu) error

type SmppBindAuthErr

type SmppBindAuthErr string

func (SmppBindAuthErr) Error

func (p SmppBindAuthErr) Error() string

type SmppErr

type SmppErr string
const (
	SmppBindRespErr SmppErr = "BIND Resp not received"
	SmppPduErr      SmppErr = "PDU out of spec for this connection type"
	SmppPduSizeErr  SmppErr = "PDU Len larger than MAX_PDU_SIZE"
	SmppPduLenErr   SmppErr = "PDU Len different than read bytes"
	SmppELWriteErr  SmppErr = "Error writing ELR PDU"
	SmppELRespErr   SmppErr = "No enquire link response"
)

func (SmppErr) Error

func (p SmppErr) Error() string

type SubmitSm

type SubmitSm struct {
	*Header
	// contains filtered or unexported fields
}

func NewSubmitSm

func NewSubmitSm(hdr *Header, b []byte) (*SubmitSm, error)

func (*SubmitSm) Fields

func (s *SubmitSm) Fields() map[string]Field

func (*SubmitSm) GetField

func (s *SubmitSm) GetField(f string) Field

func (*SubmitSm) GetHeader

func (s *SubmitSm) GetHeader() *Header

func (*SubmitSm) MandatoryFieldsList

func (s *SubmitSm) MandatoryFieldsList() []string

func (*SubmitSm) Ok

func (s *SubmitSm) Ok() bool

func (*SubmitSm) SetField

func (s *SubmitSm) SetField(f string, v interface{}) error

func (*SubmitSm) SetSeqNum

func (s *SubmitSm) SetSeqNum(i uint32)

func (*SubmitSm) SetTLVField

func (s *SubmitSm) SetTLVField(t, l int, v []byte) error

func (*SubmitSm) TLVFields

func (s *SubmitSm) TLVFields() map[uint16]*TLVField

func (*SubmitSm) Writer

func (s *SubmitSm) Writer() []byte

type SubmitSmResp

type SubmitSmResp struct {
	*Header
	// contains filtered or unexported fields
}

func NewSubmitSmResp

func NewSubmitSmResp(hdr *Header, b []byte) (*SubmitSmResp, error)

func (*SubmitSmResp) Fields

func (s *SubmitSmResp) Fields() map[string]Field

func (*SubmitSmResp) GetField

func (s *SubmitSmResp) GetField(f string) Field

func (*SubmitSmResp) GetHeader

func (s *SubmitSmResp) GetHeader() *Header

func (*SubmitSmResp) MandatoryFieldsList

func (s *SubmitSmResp) MandatoryFieldsList() []string

func (*SubmitSmResp) Ok

func (s *SubmitSmResp) Ok() bool

func (*SubmitSmResp) SetField

func (s *SubmitSmResp) SetField(f string, v interface{}) error

func (*SubmitSmResp) SetSeqNum

func (s *SubmitSmResp) SetSeqNum(i uint32)

func (*SubmitSmResp) SetTLVField

func (s *SubmitSmResp) SetTLVField(t, l int, v []byte) error

func (*SubmitSmResp) TLVFields

func (s *SubmitSmResp) TLVFields() map[uint16]*TLVField

func (*SubmitSmResp) Writer

func (s *SubmitSmResp) Writer() []byte

type TLVField

type TLVField struct {
	Tag    uint16
	Length uint16
	// contains filtered or unexported fields
}

func (*TLVField) String

func (t *TLVField) String() string

func (*TLVField) Value

func (t *TLVField) Value() []byte

func (*TLVField) Writer

func (t *TLVField) Writer() []byte

type TLVFieldErr

type TLVFieldErr string
const (
	TLVFieldLenErr TLVFieldErr = "Invalid TLV value lenght"
	TLVFieldPduErr TLVFieldErr = "PDU Type does not support TLV"
)

func (TLVFieldErr) Error

func (t TLVFieldErr) Error() string

type Transceiver

type Transceiver struct {
	Smpp

	Err error // Errors generated in go routines that lead to conn close
	// contains filtered or unexported fields
}

func NewTransceiver

func NewTransceiver(host string, port int, eli int, bindParams Params) (*Transceiver, error)

eli = EnquireLink Interval in Seconds

func (*Transceiver) Bind

func (t *Transceiver) Bind(system_id string, password string, params *Params) error

func (*Transceiver) Close

func (t *Transceiver) Close()

func (*Transceiver) DeliverSm

func (t *Transceiver) DeliverSm(source_addr, destination_addr, short_message string, params *Params) (seq uint32, err error)

func (*Transceiver) DeliverSmResp

func (t *Transceiver) DeliverSmResp(seq uint32, status CMDStatus, params *Params) error

func (*Transceiver) GenericNack

func (t *Transceiver) GenericNack(seq uint32, status CMDStatus) error

func (*Transceiver) Read

func (t *Transceiver) Read() (Pdu, error)
func (t *Transceiver) StartEnquireLink(eli int)

func (*Transceiver) SubmitSm

func (t *Transceiver) SubmitSm(source_addr, destination_addr, short_message string, params *Params) (seq uint32, err error)

func (*Transceiver) Unbind

func (t *Transceiver) Unbind() error

func (*Transceiver) UnbindResp

func (t *Transceiver) UnbindResp(seq uint32) error

func (*Transceiver) Write

func (t *Transceiver) Write(p Pdu) error

type Transmitter

type Transmitter struct {
	Smpp

	Err error // Errors generated in go routines that lead to conn close
	// contains filtered or unexported fields
}

func NewTransmitter

func NewTransmitter(host string, port int, eli int, bindParams Params) (*Transmitter, error)

eli = EnquireLink Interval in Seconds

func (*Transmitter) Bind

func (t *Transmitter) Bind(system_id string, password string, params *Params) error

func (*Transmitter) Close

func (t *Transmitter) Close()

func (*Transmitter) DeliverSmResp

func (t *Transmitter) DeliverSmResp(seq, status uint32) error

func (*Transmitter) QuerySm

func (t *Transmitter) QuerySm(message_id, source_addr string, params *Params) (seq uint32, err error)

func (*Transmitter) Read

func (t *Transmitter) Read() (Pdu, error)
func (t *Transmitter) StartEnquireLink(eli int)

func (*Transmitter) SubmitSm

func (t *Transmitter) SubmitSm(source_addr, destination_addr, short_message string, params *Params) (seq uint32, err error)

func (*Transmitter) Unbind

func (t *Transmitter) Unbind() error

func (*Transmitter) UnbindResp

func (t *Transmitter) UnbindResp(seq uint32) error

func (*Transmitter) Write

func (t *Transmitter) Write(p Pdu) error

type Unbind

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

func NewUnbind

func NewUnbind(hdr *Header) (*Unbind, error)

func (*Unbind) Fields

func (s *Unbind) Fields() map[string]Field

func (*Unbind) GetField

func (s *Unbind) GetField(f string) Field

func (*Unbind) GetHeader

func (s *Unbind) GetHeader() *Header

func (*Unbind) MandatoryFieldsList

func (s *Unbind) MandatoryFieldsList() []string

func (*Unbind) Ok

func (s *Unbind) Ok() bool

func (*Unbind) SetField

func (s *Unbind) SetField(f string, v interface{}) error

func (*Unbind) SetSeqNum

func (s *Unbind) SetSeqNum(i uint32)

func (*Unbind) SetTLVField

func (s *Unbind) SetTLVField(t, l int, v []byte) error

func (*Unbind) TLVFields

func (s *Unbind) TLVFields() map[uint16]*TLVField

func (*Unbind) Writer

func (s *Unbind) Writer() []byte

type UnbindResp

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

func NewUnbindResp

func NewUnbindResp(hdr *Header) (*UnbindResp, error)

func (*UnbindResp) Fields

func (s *UnbindResp) Fields() map[string]Field

func (*UnbindResp) GetField

func (s *UnbindResp) GetField(f string) Field

func (*UnbindResp) GetHeader

func (s *UnbindResp) GetHeader() *Header

func (*UnbindResp) MandatoryFieldsList

func (s *UnbindResp) MandatoryFieldsList() []string

func (*UnbindResp) Ok

func (s *UnbindResp) Ok() bool

func (*UnbindResp) SetField

func (s *UnbindResp) SetField(f string, v interface{}) error

func (*UnbindResp) SetSeqNum

func (s *UnbindResp) SetSeqNum(i uint32)

func (*UnbindResp) SetTLVField

func (s *UnbindResp) SetTLVField(t, l int, v []byte) error

func (*UnbindResp) TLVFields

func (s *UnbindResp) TLVFields() map[uint16]*TLVField

func (*UnbindResp) Writer

func (s *UnbindResp) Writer() []byte

type VariableField

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

func (*VariableField) ByteArray

func (v *VariableField) ByteArray() []byte

func (*VariableField) Length

func (v *VariableField) Length() interface{}

func (*VariableField) String

func (v *VariableField) String() string

func (*VariableField) Value

func (v *VariableField) Value() interface{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL