diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2013-03-27 19:12:46 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2013-03-27 19:14:55 +0100 |
commit | 3746f7ad985f5d139094d5b9abfccd1c7475042e (patch) | |
tree | 5aa119a334875caef3597b7001f91e390e6e7819 /osmo | |
parent | db413d1d0fca2cecfd5491ae74a96b2843b0ee25 (diff) |
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.
Diffstat (limited to 'osmo')
-rw-r--r-- | osmo/OsmoAppConnection.st | 15 | ||||
-rw-r--r-- | osmo/OsmoCtrlConnection.st | 2 |
2 files changed, 15 insertions, 2 deletions
diff --git a/osmo/OsmoAppConnection.st b/osmo/OsmoAppConnection.st index 886a3aa..92993a8 100644 --- a/osmo/OsmoAppConnection.st +++ b/osmo/OsmoAppConnection.st @@ -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. diff --git a/osmo/OsmoCtrlConnection.st b/osmo/OsmoCtrlConnection.st index d395c45..cd74053 100644 --- a/osmo/OsmoCtrlConnection.st +++ b/osmo/OsmoCtrlConnection.st @@ -38,6 +38,6 @@ OsmoAppConnection subclass: OsmoCtrlConnection [ ] sendCtrlData: aData [ - muxer nextPut: aData with: IPAConstants protocolOsmoCTRL. + self nextPut: aData with: IPAConstants protocolOsmoCTRL ] ] |