1
0
Fork 0

BSSAP: Test the new BSSAP code to prepend the messages.

This commit is contained in:
Holger Hans Peter Freyther 2010-11-17 16:57:09 +01:00
parent f8b0fa8e82
commit 512da52c99
3 changed files with 47 additions and 0 deletions

24
BSSAP.st Normal file
View File

@ -0,0 +1,24 @@
Object subclass: BSSAPHelper [
BSSAPHelper class >> msgManagemnt [ ^ 0 ]
BSSAPHelper class >> msgDtap [ ^ 1 ]
BSSAPHelper class >> prependManagement: aMsg [
"Prepent the BSSAP Management header"
| tmp |
tmp := OrderedCollection new.
tmp add: self msgManagemnt.
tmp add: aMsg size.
aMsg prependByteArray: tmp asByteArray.
]
BSSAPHelper class >> prependDTAP: aMsg dlci: sapi [
"Prepend the DTAP header"
| tmp |
tmp := OrderedCollection new.
tmp add: self msgDtap.
tmp add: sapi.
tmp add: aMsg size.
aMsg prependByteArray: tmp asByteArray.
]
]

View File

@ -45,3 +45,23 @@ TestCase subclass: GSM0808Test [
self assert: buf toByteArray = res
]
]
TestCase subclass: BSSAPTest [
testPrependManagment [
| msg |
msg := Osmo.MessageBuffer new.
msg putByteArray: #(1 2 3) asByteArray.
BSSAPHelper prependManagement: msg.
self assert: msg toByteArray = #(0 3 1 2 3) asByteArray.
]
testPrependDTAP [
| msg |
msg := Osmo.MessageBuffer new.
msg putByteArray: #(1 2 3) asByteArray.
BSSAPHelper prependDTAP: msg dlci: 0.
self assert: msg toByteArray = #(1 0 3 1 2 3) asByteArray.
]
]

View File

@ -4,6 +4,7 @@
<prereq>OsmoNetwork</prereq>
<prereq>OsmoLogging</prereq>
<filein>BSSAP.st</filein>
<filein>BSSMAP.st</filein>
<filein>GSM48.st</filein>
<filein>Messages.st</filein>
@ -12,9 +13,11 @@
<test>
<sunit>OsmoTestPhone.GSM0808Test</sunit>
<sunit>OsmoTestPhone.BSSAPTest</sunit>
<filein>Tests.st</filein>
</test>
<file>BSSAP.st</file>
<file>BSSMAP.st</file>
<file>Messages.st</file>
<file>SCCPHandler.st</file>