connection: Dispatch on the message body we have received
This commit is contained in:
parent
c9cb3d5cab
commit
244f9b682b
|
@ -0,0 +1,29 @@
|
||||||
|
"
|
||||||
|
(C) 2014 by Holger Hans Peter Freyther
|
||||||
|
All Rights Reserved
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
"
|
||||||
|
|
||||||
|
SMPPEnquireLink extend [
|
||||||
|
connectionDispatchOn: aConnection with: aMessage [
|
||||||
|
aConnection respondToEnquire: aMessage
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
SMPPBindTransceiverResponse extend [
|
||||||
|
connectionDispatchOn: aConnection with: aMessage [
|
||||||
|
aConnection receviedResponse: aMessage
|
||||||
|
]
|
||||||
|
]
|
|
@ -38,15 +38,11 @@ Osmo.OsmoStreamSocketBase subclass: SMPPConnection [
|
||||||
]
|
]
|
||||||
|
|
||||||
scheduleBindTrx [
|
scheduleBindTrx [
|
||||||
| header body seq data |
|
| header body |
|
||||||
|
|
||||||
seq := nextSeq.
|
|
||||||
nextSeq := nextSeq + 1.
|
|
||||||
|
|
||||||
header := SMPPPDUHeader new
|
header := SMPPPDUHeader new
|
||||||
commandId: SMPPBindTransceiver messageType;
|
commandId: SMPPBindTransceiver messageType;
|
||||||
commandStatus: 0;
|
commandStatus: 0;
|
||||||
sequenceNumber: seq;
|
|
||||||
yourself.
|
yourself.
|
||||||
body := SMPPBindTransceiver new
|
body := SMPPBindTransceiver new
|
||||||
systemId: systemId;
|
systemId: systemId;
|
||||||
|
@ -58,11 +54,18 @@ Osmo.OsmoStreamSocketBase subclass: SMPPConnection [
|
||||||
addressRange: #[];
|
addressRange: #[];
|
||||||
yourself.
|
yourself.
|
||||||
|
|
||||||
data := (SMPPMessage new
|
self send: (SMPPMessage new
|
||||||
header: header;
|
header: header;
|
||||||
body: body;
|
body: body)
|
||||||
toMessage) asByteArray.
|
]
|
||||||
writeQueue nextPut: data.
|
|
||||||
|
send: aMessage [
|
||||||
|
| seq |
|
||||||
|
seq := nextSeq.
|
||||||
|
nextSeq := nextSeq + 1.
|
||||||
|
|
||||||
|
aMessage header sequenceNumber: seq.
|
||||||
|
writeQueue nextPut: aMessage toMessage asByteArray
|
||||||
]
|
]
|
||||||
|
|
||||||
connect [
|
connect [
|
||||||
|
@ -84,11 +87,26 @@ Osmo.OsmoStreamSocketBase subclass: SMPPConnection [
|
||||||
|
|
||||||
[
|
[
|
||||||
msg := SMPPMessage readFrom: socket.
|
msg := SMPPMessage readFrom: socket.
|
||||||
msg inspect.
|
msg body connectionDispatchOn: self with: msg
|
||||||
] on: Error do: [:e |
|
] on: Error do: [:e |
|
||||||
e
|
e
|
||||||
inspect;
|
inspect;
|
||||||
pass
|
pass
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
respondToEnquire: aMessage [
|
||||||
|
| msg |
|
||||||
|
msg := SMPPMessage new
|
||||||
|
header: (SMPPPDUHeader new
|
||||||
|
commandId: SMPPBodyBase enquireLinkResp;
|
||||||
|
commandStatus: 0;
|
||||||
|
sequenceNumber: aMessage header sequenceNumber;
|
||||||
|
yourself);
|
||||||
|
body: #[].
|
||||||
|
self send: msg
|
||||||
|
]
|
||||||
|
|
||||||
|
receviedResponse: aMessage [
|
||||||
|
]
|
||||||
]
|
]
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
<filein>codec/SMPPMessage.st</filein>
|
<filein>codec/SMPPMessage.st</filein>
|
||||||
|
|
||||||
<filein>connection/SMPPConnection.st</filein>
|
<filein>connection/SMPPConnection.st</filein>
|
||||||
|
<filein>connection/Extensions.st</filein>
|
||||||
|
|
||||||
<test>
|
<test>
|
||||||
<sunit>Osmo.SMPPPDUHeaderTest</sunit>
|
<sunit>Osmo.SMPPPDUHeaderTest</sunit>
|
||||||
|
|
Reference in New Issue