Documentation ¶
Index ¶
- Constants
- Variables
- type Connection
- func (c *Connection) GetAddress() string
- func (c *Connection) GetReceiveTimeout() int64
- func (c *Connection) GetSendTimeout() int64
- func (c *Connection) SetAddress(addr string)
- func (c *Connection) SetDefault()
- func (c *Connection) SetReceiveTimeout(t int64)
- func (c *Connection) SetSendTimeout(t int64)
- type IConnection
- type IReceiver
- type IRoutineProcess
- type OutbindEvent
- type OutbindEventListener
- type OutbindReceiver
- type ReceivedPDUEvent
- type Receiver
- func (c *Receiver) ReceiveAsync()
- func (c *Receiver) ReceiveSyncWTimeout(timeout int64) (PDU.IPDU, *Exception.Exception)
- func (c *Receiver) ReceiveSyncWithExpectedPDU(pdu PDU.IPDU) (PDU.IPDU, *Exception.Exception)
- func (c *Receiver) SetServerPDUEventListener(listener ServerPDUEventListener)
- func (c *Receiver) Start()
- func (c *Receiver) Stop()
- func (c *Receiver) StopByException(e *Exception.Exception)
- func (c *Receiver) TryReceivePDU(conn IConnection, expected PDU.IPDU) (pduResult PDU.IPDU, expc *Exception.Exception)
- type ReceiverBase
- func (c *ReceiverBase) Construct()
- func (c *ReceiverBase) GetReceiveTimeout() int64
- func (c *ReceiverBase) Process()
- func (c *ReceiverBase) ReceivePDUFromConnection(conn IConnection, unprocessed *Utils.Unprocessed) (PDU.IPDU, *Exception.Exception)
- func (c *ReceiverBase) RegisterReceiver(rec IReceiver)
- func (c *ReceiverBase) SetReceiveTimeout(timeout int64)
- type RoutineProcess
- type ServerPDUEvent
- type ServerPDUEventListener
- type Session
- func (c *Session) AlertNotification(req *PDU.AlertNotification) (err *Exception.Exception)
- func (c *Session) Bind(req PDU.IBindRequest) (PDU.IResponse, *Exception.Exception)
- func (c *Session) BindWithListener(req PDU.IBindRequest, pduListener ServerPDUEventListener) (bindResp PDU.IResponse, err *Exception.Exception)
- func (c *Session) Cancel(req *PDU.CancelSM) (resp *PDU.CancelSMResp, err *Exception.Exception)
- func (c *Session) CheckPDUState(pdu PDU.IPDU) *Exception.Exception
- func (c *Session) CheckState(requestedState int32) *Exception.Exception
- func (c *Session) Close() *Exception.Exception
- func (c *Session) Data(req *PDU.DataSM) (resp *PDU.DataSMResp, err *Exception.Exception)
- func (c *Session) Deliver(req *PDU.DeliverSM) (resp *PDU.DeliverSMResp, err *Exception.Exception)
- func (c *Session) DisableStateChecking()
- func (c *Session) DoEnquireLink() (resp *PDU.EnquireLinkResp, err *Exception.Exception)
- func (c *Session) EnableStateChecking()
- func (c *Session) EnquireLink(req *PDU.EnquireLink) (resp *PDU.EnquireLinkResp, err *Exception.Exception)
- func (c *Session) GenericNack(resp *PDU.GenericNack) *Exception.Exception
- func (c *Session) GenericNackWithCmStatusSeqNum(commandStatus, sequenceNumber int32) *Exception.Exception
- func (c *Session) GetConnection() IConnection
- func (c *Session) GetReceiver() *Receiver
- func (c *Session) GetState() int32
- func (c *Session) GetTransmitter() *Transmitter
- func (c *Session) GetType() int32
- func (c *Session) IsBound() bool
- func (c *Session) IsOpened() bool
- func (c *Session) IsPDUAllowed(pdu PDU.IPDU) bool
- func (c *Session) IsStateAllowed(requestedState int32) bool
- func (c *Session) Open() *Exception.Exception
- func (c *Session) Query(req *PDU.QuerySM) (resp *PDU.QuerySMResp, err *Exception.Exception)
- func (c *Session) Receive() (pdu PDU.IPDU, err *Exception.Exception)
- func (c *Session) ReceiveWTimeout(timeout int64) (pdu PDU.IPDU, err *Exception.Exception)
- func (c *Session) Replace(req *PDU.ReplaceSM) (resp *PDU.ReplaceSMResp, err *Exception.Exception)
- func (c *Session) Respond(resp PDU.IResponse) (err *Exception.Exception)
- func (c *Session) Send(req PDU.IRequest) (resp PDU.IResponse, err *Exception.Exception)
- func (c *Session) SendWithAsyncStyle(req PDU.IRequest, isAsync bool) (resp PDU.IResponse, err *Exception.Exception)
- func (c *Session) SetType(t int32)
- func (c *Session) Submit(req *PDU.SubmitSM) (resp *PDU.SubmitSMResp, err *Exception.Exception)
- func (c *Session) SubmitMulti(req *PDU.SubmitMultiSM) (resp *PDU.SubmitMultiSMResp, err *Exception.Exception)
- func (c *Session) Unbind() (unbindResp *PDU.UnbindResp, err *Exception.Exception)
- type SocketFactory
- type TCPIPConnection
- func (c *TCPIPConnection) Close() *Exception.Exception
- func (c *TCPIPConnection) IsOpened() bool
- func (c *TCPIPConnection) Open() *Exception.Exception
- func (c *TCPIPConnection) Receive() (result *Utils.ByteBuffer, err *Exception.Exception)
- func (c *TCPIPConnection) Send(data *Utils.ByteBuffer) (err *Exception.Exception)
- func (c *TCPIPConnection) SetIOBufferSize(size int)
- func (c *TCPIPConnection) SetMaxReceiveSize(size int)
- func (c *TCPIPConnection) SetReceiveBufferSize(size int)
- type Transmitter
- type UnbindServerPDUEventListener
- func (c *UnbindServerPDUEventListener) CloseWaitChan()
- func (c *UnbindServerPDUEventListener) GetUnbindResp() *PDU.UnbindResp
- func (c *UnbindServerPDUEventListener) GetWaitChan() chan bool
- func (c *UnbindServerPDUEventListener) HandleEvent(event *ServerPDUEvent) *Exception.Exception
- func (c *UnbindServerPDUEventListener) StartWait(miliSecond int64)
Constants ¶
const ( RECEIVER_THREAD_NAME = "Receiver" RECEIVE_CHAN_SIZE = 10000 )
const ( PROC_INITIALISING byte = 0 PROC_RECEIVING byte = 1 PROC_FINISHED byte = 2 )
const ( STATE_NOT_ALLOWED int32 = 0x00 STATE_CLOSED int32 = 0x01 STATE_OPENED int32 = 0x02 STATE_TRANSMITTER int32 = 0x04 STATE_RECEIVER int32 = 0x08 STATE_TRANSCEIVER int32 = 0x10 STATE_ALWAYS int32 = STATE_OPENED | STATE_TRANSMITTER | STATE_RECEIVER | STATE_TRANSCEIVER TYPE_ESME int32 = 1 TYPE_MC int32 = 2 )
const ( // CONN_SERVER byte = 2 CONN_NONE byte = 0 CONN_CLIENT byte = 1 DFLT_IO_BUF_SIZE int = 2 * 1024 DFLT_RECEIVE_BUFFER_SIZE int = 4 * 1024 DFLT_MAX_RECEIVE_SIZE int = 128 * 1024 )
const (
OUTBIND_RECEIVER_THREAD_NAME string = "OutbindRcv"
)
Variables ¶
var GoSmppConfig = struct { Trace bool }{ Trace: false, }
GoSmppConfig global configuration
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func (*Connection) GetAddress ¶
func (c *Connection) GetAddress() string
func (*Connection) GetReceiveTimeout ¶
func (c *Connection) GetReceiveTimeout() int64
func (*Connection) GetSendTimeout ¶
func (c *Connection) GetSendTimeout() int64
func (*Connection) SetAddress ¶
func (c *Connection) SetAddress(addr string)
func (*Connection) SetDefault ¶
func (c *Connection) SetDefault()
func (*Connection) SetReceiveTimeout ¶
func (c *Connection) SetReceiveTimeout(t int64)
func (*Connection) SetSendTimeout ¶
func (c *Connection) SetSendTimeout(t int64)
type IConnection ¶
type IConnection interface { SetReceiveTimeout(t int64) GetReceiveTimeout() int64 SetSendTimeout(t int64) GetSendTimeout() int64 SetAddress(addr string) GetAddress() string Open() *Exception.Exception IsOpened() bool Close() *Exception.Exception Send(data *Utils.ByteBuffer) *Exception.Exception Receive() (*Utils.ByteBuffer, *Exception.Exception) }
IConnection smpp connection interface
type IReceiver ¶
type IReceiver interface { IRoutineProcess ReceiveAsync() TryReceivePDU(IConnection, PDU.IPDU) (PDU.IPDU, *Exception.Exception) }
type IRoutineProcess ¶
type IRoutineProcess interface { Process() GetProcessStatus() byte }
type OutbindEvent ¶
type OutbindEvent struct { ReceivedPDUEvent // contains filtered or unexported fields }
func NewOutbindEvent ¶
func NewOutbindEvent(source *OutbindReceiver, con IConnection, pdu *PDU.Outbind) *OutbindEvent
func (*OutbindEvent) GetOutbindPDU ¶
func (c *OutbindEvent) GetOutbindPDU() *PDU.Outbind
func (*OutbindEvent) GetReceiver ¶
func (c *OutbindEvent) GetReceiver() *OutbindReceiver
type OutbindEventListener ¶
type OutbindEventListener interface {
HandleOutbind(outbind *OutbindEvent) *Exception.Exception
}
type OutbindReceiver ¶
type OutbindReceiver struct {
ReceiverBase
}
Since Outbind is for server, we won't support it at the moment
type ReceivedPDUEvent ¶
type ReceivedPDUEvent struct { Connection IConnection Pdu PDU.IPDU Source interface{} // contains filtered or unexported fields }
func NewReceivedPDUEvent ¶
func NewReceivedPDUEvent(source *ReceiverBase, con IConnection, pdu PDU.IPDU) *ReceivedPDUEvent
func (*ReceivedPDUEvent) GetConnection ¶
func (c *ReceivedPDUEvent) GetConnection() IConnection
func (*ReceivedPDUEvent) GetPDU ¶
func (c *ReceivedPDUEvent) GetPDU() PDU.IPDU
type Receiver ¶
type Receiver struct { ReceiverBase // contains filtered or unexported fields }
func NewReceiver ¶
func NewReceiver() *Receiver
func NewReceiverWithConnection ¶
func NewReceiverWithConnection(con IConnection) *Receiver
func NewReceiverWithTransmitterCon ¶
func NewReceiverWithTransmitterCon(trans *Transmitter, con IConnection) *Receiver
func (*Receiver) ReceiveAsync ¶
func (c *Receiver) ReceiveAsync()
*
- This method receives a PDU from connection and stores it into
- <code>pduQueue</code>. It's called from the <code>ReceiverBase</code>'s
- p<code>process</code> method which is called in loop from
- <code>ProcessingThread</code>'s <code>run</code> method.
- <p>
- If an exception occurs during receiving, depending on type
- of the exception this method either just reports the exception to
- debug & event objects or stops processing to indicate
- that it isn't able to process the exception. The function
- <code>setTermException</code> is then called with the caught exception. *
- @see ReceiverBase#run()
func (*Receiver) ReceiveSyncWTimeout ¶
*
- This method receives a PDU or returns PDU received on background,
- if there is any. It tries to receive a PDU for the specified timeout.
- If the receiver is asynchronous, then no attempt to receive a PDU
- and <code>null</code> is returned.
- The function calls are nested as follows:<br>
- <ul>
- <li>No background receiver thread<br><code>
- Receiver.receive(long)<br>
- ReceiverBase.tryReceivePDUWithTimeout(Connection,PDU,long)<br>
- Receiver.tryReceivePDU(Connection,PDU)<br>
- ReceiverBase.receivePDUFromConnection<br>
- Connection.receive()</code>
- <li>Has background receiver thread<br><code>
- Receiver.receive(long)<br>
- ReceiverBase.tryReceivePDUWithTimeout(Connection,PDU,long)<br>
- Receiver.tryReceivePDU(Connection,PDU)<br>
- Queue.dequeue(PDU)</code><br>
- and the ReceiverBase.run() function which actually receives the
- PDUs and stores them to a queue looks as follows:<br><code>
- ReceiverBase.run()<br>
- Receiver.receiveAsync()<br>
- ReceiverBase.receivePDUFromConnection<br>
- Connection.receive()</code> *
- @param timeout for how long is tried to receive a PDU
- @return the received PDU or null if none received for the spec. timeout *
- @exception IOException exception during communication
- @exception PDUException incorrect format of PDU
- @exception TimeoutException rest of PDU not received for too long time
- @exception UnknownCommandIdException PDU with unknown id was received
- @see ReceiverBase#tryReceivePDUWithTimeout(Connection,PDU,long)
func (*Receiver) ReceiveSyncWithExpectedPDU ¶
*
- Called from session to receive a response for previously sent request. *
- @param expectedPDU the template for expected PDU; the PDU returned
- must have the same sequence number
- @return the received PDU or null if none
- @see ReceiverBase#tryReceivePDUWithTimeout(Connection,PDU,long)
func (*Receiver) SetServerPDUEventListener ¶
func (c *Receiver) SetServerPDUEventListener(listener ServerPDUEventListener)
func (*Receiver) Start ¶
func (c *Receiver) Start()
*
- Resets unprocessed data and starts receiving on the background. *
- @see ReceiverBase#start()
func (*Receiver) StopByException ¶
func (*Receiver) TryReceivePDU ¶
type ReceiverBase ¶
type ReceiverBase struct { RoutineProcess // contains filtered or unexported fields }
func NewReceiverBase ¶
func NewReceiverBase() *ReceiverBase
func (*ReceiverBase) Construct ¶
func (c *ReceiverBase) Construct()
func (*ReceiverBase) GetReceiveTimeout ¶
func (c *ReceiverBase) GetReceiveTimeout() int64
func (*ReceiverBase) Process ¶
func (c *ReceiverBase) Process()
*
- This is an implementation of <code>ProcessingThread</code>'s
- <code>process</code> method, which is method called in loop from
- the <code>run</code> method.<br>
- This simply calls <code>receiveAsync</code>.
func (*ReceiverBase) ReceivePDUFromConnection ¶
func (c *ReceiverBase) ReceivePDUFromConnection(conn IConnection, unprocessed *Utils.Unprocessed) (PDU.IPDU, *Exception.Exception)
func (*ReceiverBase) RegisterReceiver ¶
func (c *ReceiverBase) RegisterReceiver(rec IReceiver)
func (*ReceiverBase) SetReceiveTimeout ¶
func (c *ReceiverBase) SetReceiveTimeout(timeout int64)
type RoutineProcess ¶
type RoutineProcess struct { KeepProcessing bool ProcessStatus byte ProcessLock sync.RWMutex ProcessUnit IRoutineProcess }
func (*RoutineProcess) GetProcessStatus ¶
func (c *RoutineProcess) GetProcessStatus() byte
func (*RoutineProcess) IsKeepProcessing ¶
func (c *RoutineProcess) IsKeepProcessing() bool
func (*RoutineProcess) RegisterProcessUnit ¶
func (c *RoutineProcess) RegisterProcessUnit(proc IRoutineProcess)
func (*RoutineProcess) Run ¶
func (c *RoutineProcess) Run()
func (*RoutineProcess) StartProcess ¶
func (c *RoutineProcess) StartProcess()
func (*RoutineProcess) StopProcess ¶
func (c *RoutineProcess) StopProcess()
type ServerPDUEvent ¶
type ServerPDUEvent struct {
ReceivedPDUEvent
}
func NewServerPDUEvent ¶
func NewServerPDUEvent(source *Receiver, con IConnection, pdu PDU.IPDU) *ServerPDUEvent
func (*ServerPDUEvent) GetReceiver ¶
func (c *ServerPDUEvent) GetReceiver() *Receiver
type ServerPDUEventListener ¶
type ServerPDUEventListener interface {
HandleEvent(event *ServerPDUEvent) *Exception.Exception
}
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func NewSessionWithConnection ¶
func NewSessionWithConnection(conn IConnection) *Session
func (*Session) AlertNotification ¶
func (c *Session) AlertNotification(req *PDU.AlertNotification) (err *Exception.Exception)
func (*Session) BindWithListener ¶
func (c *Session) BindWithListener(req PDU.IBindRequest, pduListener ServerPDUEventListener) (bindResp PDU.IResponse, err *Exception.Exception)
func (*Session) CheckState ¶
func (*Session) DisableStateChecking ¶
func (c *Session) DisableStateChecking()
func (*Session) DoEnquireLink ¶
func (c *Session) DoEnquireLink() (resp *PDU.EnquireLinkResp, err *Exception.Exception)
func (*Session) EnableStateChecking ¶
func (c *Session) EnableStateChecking()
func (*Session) EnquireLink ¶
func (c *Session) EnquireLink(req *PDU.EnquireLink) (resp *PDU.EnquireLinkResp, err *Exception.Exception)
func (*Session) GenericNack ¶
func (c *Session) GenericNack(resp *PDU.GenericNack) *Exception.Exception
func (*Session) GenericNackWithCmStatusSeqNum ¶
func (*Session) GetConnection ¶
func (c *Session) GetConnection() IConnection
func (*Session) GetReceiver ¶
func (*Session) GetTransmitter ¶
func (c *Session) GetTransmitter() *Transmitter
func (*Session) IsStateAllowed ¶
func (*Session) ReceiveWTimeout ¶
func (*Session) SendWithAsyncStyle ¶
func (*Session) SubmitMulti ¶
func (c *Session) SubmitMulti(req *PDU.SubmitMultiSM) (resp *PDU.SubmitMultiSMResp, err *Exception.Exception)
type SocketFactory ¶
type SocketFactory struct { }
type TCPIPConnection ¶
type TCPIPConnection struct { Connection // contains filtered or unexported fields }
func NewTCPIPConnection ¶
func NewTCPIPConnection() *TCPIPConnection
NewTCPIPConnection new tcp ip connection
func NewTCPIPConnectionWithAddrPort ¶
func NewTCPIPConnectionWithAddrPort(addr string, port int) (*TCPIPConnection, error)
NewTCPIPConnectionWithAddrPort new tcp/ip connection with addr and port
func NewTCPIPConnectionWithSocket ¶
func NewTCPIPConnectionWithSocket(soc *net.TCPConn) (*TCPIPConnection, error)
NewTCPIPConnectionWithSocket new tcp/ip connection with preallocated socket. Useful for tls enabled connection.
func (*TCPIPConnection) Close ¶
func (c *TCPIPConnection) Close() *Exception.Exception
Close connection
func (*TCPIPConnection) IsOpened ¶
func (c *TCPIPConnection) IsOpened() bool
IsOpened check if connection is opened
func (*TCPIPConnection) Open ¶
func (c *TCPIPConnection) Open() *Exception.Exception
Open connection
func (*TCPIPConnection) Receive ¶
func (c *TCPIPConnection) Receive() (result *Utils.ByteBuffer, err *Exception.Exception)
Receive message from connection in form of buffer
func (*TCPIPConnection) Send ¶
func (c *TCPIPConnection) Send(data *Utils.ByteBuffer) (err *Exception.Exception)
Send buffered data
func (*TCPIPConnection) SetIOBufferSize ¶
func (c *TCPIPConnection) SetIOBufferSize(size int)
SetIOBufferSize set io buffer size
func (*TCPIPConnection) SetMaxReceiveSize ¶
func (c *TCPIPConnection) SetMaxReceiveSize(size int)
SetMaxReceiveSize set max length of message allowed to receive over socket
func (*TCPIPConnection) SetReceiveBufferSize ¶
func (c *TCPIPConnection) SetReceiveBufferSize(size int)
SetReceiveBufferSize set buffer size for receiving message over socket
type Transmitter ¶
type Transmitter struct {
// contains filtered or unexported fields
}
func NewTransmitter ¶
func NewTransmitter() *Transmitter
func NewTransmitterWithConnection ¶
func NewTransmitterWithConnection(con IConnection) *Transmitter
type UnbindServerPDUEventListener ¶
type UnbindServerPDUEventListener struct {
// contains filtered or unexported fields
}
func NewUnbindServerPDUEventListener ¶
func NewUnbindServerPDUEventListener(sess *Session, origListener ServerPDUEventListener, unbindReq *PDU.Unbind) *UnbindServerPDUEventListener
func (*UnbindServerPDUEventListener) CloseWaitChan ¶
func (c *UnbindServerPDUEventListener) CloseWaitChan()
func (*UnbindServerPDUEventListener) GetUnbindResp ¶
func (c *UnbindServerPDUEventListener) GetUnbindResp() *PDU.UnbindResp
func (*UnbindServerPDUEventListener) GetWaitChan ¶
func (c *UnbindServerPDUEventListener) GetWaitChan() chan bool
func (*UnbindServerPDUEventListener) HandleEvent ¶
func (c *UnbindServerPDUEventListener) HandleEvent(event *ServerPDUEvent) *Exception.Exception
func (*UnbindServerPDUEventListener) StartWait ¶
func (c *UnbindServerPDUEventListener) StartWait(miliSecond int64)