1
0
Fork 0

osmo: Make it possible to register on the OsmoAppConnection IPADispatcher

OsmoAppConnection now can call a block registered with >>#onConnect:
to allow modifying the dispatcher. This can be used to register for
the SCCP protocol. Use >>#nextPut:with: to send information through
the muxer.
This commit is contained in:
Holger Hans Peter Freyther 2013-03-27 19:12:46 +01:00
parent db413d1d0f
commit 3746f7ad98
2 changed files with 15 additions and 2 deletions

View File

@ -17,7 +17,8 @@
"
Object subclass: OsmoAppConnection [
| socket writeQueue demuxer muxer dispatcher token hostname port tx_proc rx_proc started |
| socket writeQueue demuxer muxer dispatcher token hostname port
tx_proc rx_proc started connect_block |
<category: 'OsmoNetwork-Socket'>
<comment: 'I connect to a OpenBSC App on the Control Port and wait for
TRAPS coming from the server and will act on these.
@ -83,6 +84,11 @@ TODO: re-use the IPADispatcher across connections.'>
initializeDispatcher [
"Allow another class to register handlers"
connect_block ifNotNil: [connect_block value: dispatcher].
]
nextPut: aData [
muxer nextPut: aData with: IPAConstants protocolOsmoCTRL
]
token: aToken [
@ -99,6 +105,13 @@ TODO: re-use the IPADispatcher across connections.'>
port := aPort
]
onConnect: aBlock [
<category: 'creation'>
"Call the block when the socket is being connected and the dispatcher
is set-up. The callback will have the dispatcher as parameter."
connect_block := aBlock.
]
createConnection: aHostname port: aPort [
<category: 'socket'>
^ Sockets.Socket remote: aHostname port: aPort.

View File

@ -38,6 +38,6 @@ OsmoAppConnection subclass: OsmoCtrlConnection [
]
sendCtrlData: aData [
muxer nextPut: aData with: IPAConstants protocolOsmoCTRL.
self nextPut: aData with: IPAConstants protocolOsmoCTRL
]
]