SCCPHandler: Start handling SCCP connections.
This commit is contained in:
parent
181fc048cf
commit
5ed751c24e
|
@ -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. ]
|
||||
]
|
||||
]
|
||||
|
||||
|
|
|
@ -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.
|
||||
]
|
||||
]
|
||||
|
|
5
Tests.st
5
Tests.st
|
@ -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.
|
||||
]
|
||||
]
|
||||
|
|
Reference in New Issue