smalltalk
/
osmo-st-gsm
Archived
1
0
Fork 0

SCCPHandler: Start handling SCCP connections.

This commit is contained in:
Holger Hans Peter Freyther 2010-11-20 09:35:12 +01:00
parent 181fc048cf
commit 5ed751c24e
3 changed files with 42 additions and 7 deletions

View File

@ -1,7 +1,22 @@
PackageLoader fileInPackage: 'OsmoNetwork'.
Object subclass: SCCPConnection [
| src dst |
srcRef [
^ src
]
srcRef: aRef [
src := aRef
]
dstRef: aRef [
dst := aRef
]
]
Object subclass: SCCPHadler [
| connections |
| connections last_ref |
<comment: 'I handle SCCP messages'>
registerOn: aDispatcher [
@ -12,5 +27,25 @@ Object subclass: SCCPHadler [
handleMsg: aMsg [
'Got a new SCCP message' printNl.
]
createConnection: aData [
| con res|
con := SCCPConnection new.
con srcRef: self assignSrcRef.
res := Osmo.SCCPConnectionRequest
initWith: (con srcRef) dest: (Osmo.SCCPAddress createWith: 254) data: aData.
self connections add: res.
^ res
]
assignSrcRef [
^ 666
]
connections [
^ connections ifNil: [ connections := OrderedCollection new. ]
]
]

View File

@ -93,7 +93,7 @@ Object subclass: IPAConfig [
]
Object subclass: MessageTests [
MessageTests class >> createLU [
MessageTests class >> createLU: aHandler [
| lu bssap msg sccp |
lu := LocationUpdatingRequest new.
@ -105,8 +105,7 @@ Object subclass: MessageTests [
bssap := BSSAPManagement initWith: msg.
sccp := Osmo.SCCPHelper createCR: 666 dest: (Osmo.SCCPAddress createWith: 254) data: bssap.
sccp asByteArray printNl.
^ sccp asByteArray.
sccp := aHandler createConnection: bssap.
^ sccp toMessage asByteArray.
]
]

View File

@ -127,9 +127,10 @@ TestCase subclass: GSM48Test [
TestCase subclass: TestMessages [
testLU [
| sccp |
| sccp handler |
sccp := MessageTests createLU.
handler := SCCPHadler new.
sccp := MessageTests createLU: handler.
self assert: sccp = #(1 154 2 0 2 2 4 2 66 254 15 32 0 30 87 5 8 0 114 244 128 16 3 156 64 23 17 5 8 112 0 240 0 0 0 51 7 97 102 102 102 102 102 246 0 ) asByteArray.
]
]