smpp34

package module
v0.0.0-...-13613d4 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: MIT Imports: 12 Imported by: 17

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 = 4096 // 4KB

	// Sequence number start/end
	SEQUENCE_NUM_START = 0x00000001
	SEQUENCE_NUM_END   = 0x7FFFFFFF
)
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"
	SOURCE_ADDR_NPI         = "source_addr_npi"
	SOURCE_ADDR             = "source_addr"
	DEST_ADDR_TON           = "dest_addr_ton"
	DEST_ADDR_NPI           = "dest_addr_npi"
	DESTINATION_ADDR        = "destination_addr"
	ESM_CLASS               = "esm_class"
	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 (
	// Optional Field Tags
	DEST_ADDR_SUBUNIT           = 0x0005
	DEST_NETWORK_TYPE           = 0x0006
	DEST_BEARER_TYPE            = 0x0007
	DEST_TELEMATICS_ID          = 0x0008
	SOURCE_ADDR_SUBUNIT         = 0x000D
	SOURCE_NETWORK_TYPE         = 0x000E
	SOURCE_BEARER_TYPE          = 0x000F
	SOURCE_TELEMATICS_ID        = 0x0010
	QOS_TIME_TO_LIVE            = 0x0017
	PAYLOAD_TYPE                = 0x0019
	ADDITIONAL_STATUS_INFO_TEXT = 0x001D
	RECEIPTED_MESSAGE_ID        = 0x001E
	MS_MSG_WAIT_FACILITIES      = 0x0030
	PRIVACY_INDICATOR           = 0x0201
	SOURCE_SUBADDRESS           = 0x0202
	DEST_SUBADDRESS             = 0x0203
	USER_MESSAGE_REFERENCE      = 0x0204
	USER_RESPONSE_CODE          = 0x0205
	SOURCE_PORT                 = 0x020A
	DESTINATION_PORT            = 0x020B
	SAR_MSG_REF_NUM             = 0x020C
	LANGUAGE_INDICATOR          = 0x020D
	SAR_TOTAL_SEGMENTS          = 0x020E
	SAR_SEGMENT_SEQNUM          = 0x020F
	SC_INTERFACE_VERSION        = 0x0210
	CALLBACK_NUM_PRES_IND       = 0x0302
	CALLBACK_NUM_ATAG           = 0x0303
	NUMBER_OF_MESSAGES          = 0x0304
	CALLBACK_NUM                = 0x0381
	DPF_RESULT                  = 0x0420
	SET_DPF                     = 0x0421
	MS_AVAILABILITY_STATUS      = 0x0422
	NETWORK_ERROR_CODE          = 0x0423
	MESSAGE_PAYLOAD             = 0x0424
	DELIVERY_FAILURE_REASON     = 0x0425
	MORE_MESSAGES_TO_SEND       = 0x0426
	DR_MESSAGE_STATE            = 0x0427
	USSD_SERVICE_OP             = 0x0501
	DISPLAY_TIME                = 0x1201
	SMS_SIGNAL                  = 0x1203
	MS_VALIDITY                 = 0x1204
	ALERT_ON_MESSAGE_DELIVERY   = 0x130C
	ITS_REPLY_TYPE              = 0x1380
	ITS_SESSION_INFO            = 0x1383
)
View Source
const (
	// Encoding Types
	ENCODING_DEFAULT   = 0x00 // SMSC Default
	ENCODING_IA5       = 0x01 // IA5 (CCITT T.50)/ASCII (ANSI X3.4)
	ENCODING_BINARY    = 0x02 // Octet unspecified (8-bit binary)
	ENCODING_ISO88591  = 0x03 // Latin 1 (ISO-8859-1)
	ENCODING_BINARY2   = 0x04 // Octet unspecified (8-bit binary)
	ENCODING_JIS       = 0x05 // JIS (X 0208-1990)
	ENCODING_ISO88595  = 0x06 // Cyrillic (ISO-8859-5)
	ENCODING_ISO88598  = 0x07 // Latin/Hebrew (ISO-8859-8)
	ENCODING_ISO10646  = 0x08 // UCS2 (ISO/IEC-10646)
	ENCODING_PICTOGRAM = 0x09 // Pictogram Encoding
	ENCODING_ISO2022JP = 0x0A // ISO-2022-JP (Music Codes)
	ENCODING_EXTJIS    = 0x0D // Extended Kanji JIS (X 0212-1990)
	ENCODING_KSC5601   = 0x0E // KS C 5601
)
View Source
const (
	// ESM_CLASS Types
	ESM_CLASS_MSGMODE_DEFAULT      = 0x00 // Default SMSC mode (e.g. Store and Forward)
	ESM_CLASS_MSGMODE_DATAGRAM     = 0x01 // Datagram mode
	ESM_CLASS_MSGMODE_FORWARD      = 0x02 // Forward (i.e. Transaction) mode
	ESM_CLASS_MSGMODE_STOREFORWARD = 0x03 // Store and Forward mode (use this to select Store and Forward mode if Default mode is not Store and Forward)

	ESM_CLASS_MSGTYPE_DEFAULT     = 0x00 // Default message type (i.e. normal message)
	ESM_CLASS_MSGTYPE_DELIVERYACK = 0x08 // Message containts ESME Delivery Acknowledgement
	ESM_CLASS_MSGTYPE_USERACK     = 0x10 // Message containts ESME Manual/User Acknowledgement

	ESM_CLASS_GSMFEAT_NONE          = 0x00 // No specific features selected
	ESM_CLASS_GSMFEAT_UDHI          = 0x40 // UDHI Indicator (only relevant for MT msgs)
	ESM_CLASS_GSMFEAT_REPLYPATH     = 0x80 // Set Reply Path (only relevant for GSM net)
	ESM_CLASS_GSMFEAT_UDHIREPLYPATH = 0xC0 // Set UDHI and Reply Path (for GSM net)
)

Variables

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 NewSeqNumFunc

type NewSeqNumFunc func() uint32

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)

func SmppReadFrom

func SmppReadFrom(conn net.Conn) (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) error

func (*Receiver) Read

func (t *Receiver) Read() (Pdu, error)

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 {
	Mu sync.Mutex

	Sequence      uint32
	Bound         bool
	NewSeqNumFunc NewSeqNumFunc
	// contains filtered or unexported fields
}

func NewSmppConnect

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

func NewSmppConnectTLS

func NewSmppConnectTLS(host string, port int, config *tls.Config) (*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) ConnectTLS

func (s *Smpp) ConnectTLS(host string, port int, config *tls.Config) error

func (*Smpp) DeliverSmResp

func (s *Smpp) DeliverSmResp(seq uint32, status CMDStatus) (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) SubmitSm

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

func (*Smpp) SubmitSmEncoded

func (s *Smpp) SubmitSmEncoded(source_addr, destination_addr string, short_message []byte, 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)

NewTransceiver creates and initializes a new Transceiver. The eli parameter is for EnquireLink interval, in seconds.

func NewTransceiverTLS

func NewTransceiverTLS(host string, port int, eli int, bindParams Params, config *tls.Config) (*Transceiver, error)

NewTransceiver creates and initializes a new Transceiver using TLS. The eli parameter is for 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) DeliverSmResp

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

func (*Transceiver) ELDuration

func (t *Transceiver) ELDuration(v int)

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) SubmitSmEncoded

func (t *Transceiver) SubmitSmEncoded(source_addr, destination_addr string, short_message []byte, 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)

NewTransmitter creates and initializes a new Transmitter. The eli parameter is for EnquireLink interval, in seconds.

func NewTransmitterTLS

func NewTransmitterTLS(host string, port int, eli int, bindParams Params, config *tls.Config) (*Transmitter, error)

NewTransmitterTLs creates and initializes a new Transmitter using TLS. The eli parameter is for 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 (*Transmitter) SubmitSm

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

func (*Transmitter) SubmitSmEncoded

func (t *Transmitter) SubmitSmEncoded(source_addr, destination_addr string, short_message []byte, 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{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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