aboutsummaryrefslogtreecommitdiffstats
path: root/osmo
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-03-27 08:27:13 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-03-27 16:23:05 +0100
commita47c76fc1bce5bd9ea80133624826ce24a14ece6 (patch)
tree4e47aba40940ef65b789ed7a5c672897de5acc14 /osmo
parent3ae32dfb73baed07097475612918c089cdea64d8 (diff)
osmo: Introduce a subclass for the CTRL handling
Diffstat (limited to 'osmo')
-rw-r--r--osmo/OsmoAppConnection.st20
-rw-r--r--osmo/OsmoCtrlConnection.st43
2 files changed, 47 insertions, 16 deletions
diff --git a/osmo/OsmoAppConnection.st b/osmo/OsmoAppConnection.st
index 47e8f5c..75fd214 100644
--- a/osmo/OsmoAppConnection.st
+++ b/osmo/OsmoAppConnection.st
@@ -17,19 +17,13 @@
"
Object subclass: OsmoAppConnection [
- | socket writeQueue demuxer muxer dispatcher ctrlBlock |
+ | socket writeQueue demuxer muxer dispatcher |
<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.'>
- onCtrlData: aBlock [
- <category: 'ctrl-dispatch'>
- ctrlBlock := aBlock
- ]
-
- handleCTRL: aCtrl [
- <category: 'ctrl-dispatch'>
- ctrlBlock value: aCtrl.
+ initializeDispatcher [
+ "Allow another class to register handlers"
]
createConnection: aHostname port: aPort [
@@ -56,9 +50,7 @@ TRAPS coming from the server and will act on these.'>
dispatcher := IPADispatcher new.
dispatcher initialize.
- dispatcher
- addHandler: IPAConstants protocolOsmoCTRL
- on: self with: #handleCTRL:.
+ self initializeDispatcher.
ipa := IPAProtoHandler new.
ipa registerOn: dispatcher.
@@ -70,10 +62,6 @@ TRAPS coming from the server and will act on these.'>
^ self connect: 4250.
]
- sendCtrlData: aData [
- muxer nextPut: aData with: IPAConstants protocolOsmoCTRL.
- ]
-
sendOne [
| msg |
<category: 'dispatch'>
diff --git a/osmo/OsmoCtrlConnection.st b/osmo/OsmoCtrlConnection.st
new file mode 100644
index 0000000..d395c45
--- /dev/null
+++ b/osmo/OsmoCtrlConnection.st
@@ -0,0 +1,43 @@
+"
+ (C) 2011-2013 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/>.
+"
+
+OsmoAppConnection subclass: OsmoCtrlConnection [
+ | ctrlBlock |
+ <category: 'OsmoNetwork-Socket'>
+
+ onCtrlData: aBlock [
+ <category: 'ctrl-dispatch'>
+ ctrlBlock := aBlock
+ ]
+
+ handleCTRL: aCtrl [
+ <category: 'ctrl-dispatch'>
+ ctrlBlock value: aCtrl.
+ ]
+
+ initializeDispatcher [
+ super dispatcher.
+ dispatcher
+ addHandler: IPAConstants protocolOsmoCTRL
+ on: self with: #handleCTRL:.
+ ]
+
+ sendCtrlData: aData [
+ muxer nextPut: aData with: IPAConstants protocolOsmoCTRL.
+ ]
+]