1
0
Fork 0

GSM48: Add a GSM48AuthRand class to parse the auth rand.

This commit is contained in:
Holger Hans Peter Freyther 2010-11-24 21:42:58 +01:00
parent 50001c769b
commit 46b476ca14
1 changed files with 36 additions and 0 deletions

View File

@ -248,6 +248,42 @@ Object subclass: GSM48RejectCause [
]
]
Object subclass: GSM48AuthRand [
| rand |
<category: 'osmo-meesage'>
<comment: 'I represent the 10.5.3.1 Authentication parameter RAND'>
GSM48AuthRand class >> length: aByteArray [ ^ 16 ]
GSM48AuthRand class >> initWithData: aData [
^ self new
rand: aData;
yourself.
]
GSM48AuthRand class >> parseFrom: aByteArray [
^ self new
rand: (aByteArray copyFrom: 1 to: 16);
yourself
]
rand: aData [
aData size = 16
ifFalse: [
Error signal: 'Data needs to be 16 byte.'.
].
rand := aData
]
rand [
^ rand
]
writeOnDirect: aMsg [
aMsg putByteArray: rand.
]
]
IEMessage subclass: GSM48MSG [
<category: 'osmo-message'>