diff --git a/SCCPHandler.st b/SCCPHandler.st index 4e0e905..477e8c5 100644 --- a/SCCPHandler.st +++ b/SCCPHandler.st @@ -62,7 +62,7 @@ Object subclass: MSGParser [ ] -Object subclass: SCCPHadler [ +Object subclass: SCCPHandler [ | connections last_ref | @@ -72,7 +72,19 @@ Object subclass: SCCPHadler [ ] handleMsg: aMsg [ - 'Got a new SCCP message' printNl. + | sccp | + + 'Got a new SCCP message here.' printNl. + + [ + sccp := MSGParser parse: (aMsg asByteArray). + sccp inspect. + sccp printNl. + sccp class printNl. + ] on: Exception do: [ + self logError: 'Failed to parse message' area: #sccp. + aMsg asByteArray printNl. + ] ] createConnection: aData [ diff --git a/TestPhone.st b/TestPhone.st index 5266329..432efd5 100644 --- a/TestPhone.st +++ b/TestPhone.st @@ -23,7 +23,7 @@ Object subclass: IPAConnection [ dispatcher := Osmo.IPADispatcher new. dispatcher initialize. - sccp := SCCPHadler new. + sccp := SCCPHandler new. sccp registerOn: dispatcher. ipa := Osmo.IPAProtoHandler new. @@ -58,6 +58,10 @@ Object subclass: IPAConnection [ muxer nextPut: aMsg with: aType. self drainSendQueue. ] + + sccpHandler [ + ^ sccp + ] ] Object subclass: IPAConfig [ @@ -90,6 +94,12 @@ Object subclass: IPAConfig [ ] semaphore [ ^ sem ] + + sendLU [ + | msg | + msg := MessageTests createLU: (connection sccpHandler). + connection send: msg with: Osmo.IPAConstants protocolSCCP. + ] ] Object subclass: MessageTests [ @@ -106,6 +116,6 @@ Object subclass: MessageTests [ bssap := BSSAPManagement initWith: msg. sccp := aHandler createConnection: bssap. - ^ sccp toMessage asByteArray. + ^ sccp toMessage. ] ] diff --git a/Tests.st b/Tests.st index e0f3584..fd773ca 100644 --- a/Tests.st +++ b/Tests.st @@ -181,9 +181,9 @@ TestCase subclass: TestMessages [ testLU [ | sccp handler | - handler := SCCPHadler new. + handler := SCCPHandler 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. + self assert: sccp asByteArray = #(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. ] testMsgParser [