sccp: Implement connection refused parsing and handling
The code can not parse the optional elements yet.
This commit is contained in:
parent
cb55eb5dcf
commit
fc6e258ac0
14
Tests.st
14
Tests.st
|
@ -105,6 +105,20 @@ TestCase subclass: SCCPTests [
|
|||
self assert: cc toMessage asByteArray = target.
|
||||
]
|
||||
|
||||
testCREF [
|
||||
| target cref |
|
||||
|
||||
target := #[16r03 16r1A 16r00 16r03 16r00 16r01 16r00].
|
||||
|
||||
cref := SCCPConnectionRefused
|
||||
initWithDst: 16r03001A cause: 16r00.
|
||||
self assert: cref toMessage asByteArray = target.
|
||||
|
||||
cref := SCCPMessage decode: target.
|
||||
self assert: (cref isKindOf: SCCPConnectionRefused).
|
||||
self assert: cref dst = 16r03001A.
|
||||
]
|
||||
|
||||
testRlsd [
|
||||
| target rlsd |
|
||||
|
||||
|
|
56
sccp/SCCP.st
56
sccp/SCCP.st
|
@ -364,6 +364,62 @@ SCCPMessage subclass: SCCPConnectionConfirm [
|
|||
]
|
||||
]
|
||||
|
||||
SCCPMessage subclass: SCCPConnectionRefused [
|
||||
| dst cause |
|
||||
|
||||
<category: 'OsmoNetwork-SCCP'>
|
||||
<comment: 'I hold the data of a connection refused.'>
|
||||
|
||||
SCCPConnectionRefused class >> msgType [
|
||||
<category: 'factory'>
|
||||
^SCCPHelper msgCref
|
||||
]
|
||||
|
||||
SCCPConnectionRefused class >> initWithDst: aDst cause: aCause [
|
||||
<category: 'creation'>
|
||||
^self new
|
||||
dst: aDst;
|
||||
cause: aCause;
|
||||
yourself
|
||||
]
|
||||
|
||||
SCCPConnectionRefused class >> parseFrom: aMsg [
|
||||
| dst cause |
|
||||
<category: 'parsing'>
|
||||
|
||||
dst := SCCPAddrReference fromByteArray: (aMsg copyFrom: 2 to: 4).
|
||||
cause := aMsg at: 5.
|
||||
^self initWithDst: dst cause: cause.
|
||||
]
|
||||
|
||||
dst: aDst [
|
||||
dst := aDst
|
||||
]
|
||||
|
||||
dst [
|
||||
^dst
|
||||
]
|
||||
|
||||
cause: aCause [
|
||||
cause := aCause
|
||||
]
|
||||
|
||||
cause [
|
||||
^cause
|
||||
]
|
||||
|
||||
writeOn: aMsg [
|
||||
<category: 'encoding'>
|
||||
|
||||
aMsg putByte: self class msgType.
|
||||
SCCPAddrReference store: dst on: aMsg.
|
||||
aMsg putByte: cause.
|
||||
|
||||
"End of optional?"
|
||||
aMsg putByte: 1; putByte: 0.
|
||||
]
|
||||
]
|
||||
|
||||
SCCPMessage subclass: SCCPConnectionData [
|
||||
| dst data |
|
||||
|
||||
|
|
Reference in New Issue