forked from linxGnu/gosmpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pkg.go
68 lines (54 loc) · 1.53 KB
/
pkg.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package gosmpp
import (
"io"
"time"
"github.com/linxGnu/gosmpp/pdu"
)
// Transceiver interface.
type Transceiver interface {
io.Closer
Submit(pdu.PDU) error
SystemID() string
}
// Transmitter interface.
type Transmitter interface {
io.Closer
Submit(pdu.PDU) error
SystemID() string
}
// Receiver interface.
type Receiver interface {
io.Closer
SystemID() string
}
// Settings for TX (transmitter), RX (receiver), TRX (transceiver).
type Settings struct {
// ReadTimeout is timeout for reading PDU from SMSC.
// Underlying net.Conn will be stricted with ReadDeadline(now + timeout).
// This setting is very important to detect connection failure.
//
// Must: ReadTimeout > max(0, EnquireLink)
ReadTimeout time.Duration
// WriteTimeout is timeout for submitting PDU.
WriteTimeout time.Duration
// EnquireLink periodically sends EnquireLink to SMSC.
// The duration must not be smaller than 1 minute.
//
// Zero duration disables auto enquire link.
EnquireLink time.Duration
// OnPDU handles received PDU from SMSC.
//
// `Responded` flag indicates this pdu is responded automatically,
// no manual respond needed.
OnPDU PDUCallback
// OnReceivingError notifies happened error while reading PDU
// from SMSC.
OnReceivingError ErrorCallback
// OnSubmitError notifies fail-to-submit PDU with along error.
OnSubmitError PDUErrorCallback
// OnRebindingError notifies error while rebinding.
OnRebindingError ErrorCallback
// OnClosed notifies `closed` event due to State.
OnClosed ClosedCallback
response func(pdu.PDU)
}