aboutsummaryrefslogtreecommitdiffstats
path: root/GSM48.st
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2012-08-24 14:57:00 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2012-08-24 14:57:00 +0200
commit26b62de9098f5e133f8c140c85d5984976363bdc (patch)
tree0a0d26f80aa1141542ef5a558e51060bde89bc0a /GSM48.st
parent6673d85b4d9a154afbd89ec175956459434be35e (diff)
gsm48: Use the fixed size IE class and kill >>#length
Diffstat (limited to 'GSM48.st')
-rw-r--r--GSM48.st76
1 files changed, 29 insertions, 47 deletions
diff --git a/GSM48.st b/GSM48.st
index 74b6f11..daed841 100644
--- a/GSM48.st
+++ b/GSM48.st
@@ -77,32 +77,43 @@ GSM48IE subclass: GSM48FixedSizeIE [
length: aStream [
<category: 'parsing'>
- ^ gsmValueLength
+ ^ self gsmValueLength
]
length [
- ^ gsmValueLength
+ <category: 'parsing'>
+ "TODO: deprecate and remove"
+ ^ self gsmValueLength
+ ]
+
+ gsmValueLength [
+ <category: 'parsing'>
+ ^ gsmValueLength ifNil: [self superclass gsmValueLength]
+ ]
+
+ asTLVDescription [
+ <category: 'parsing'>
+ ^ super asTLVDescription
+ beTV; valueSize: gsmValueLength; yourself
]
]
]
-GSM48IE subclass: GSM48SimpleTag [
+GSM48FixedSizeIE subclass: GSM48SimpleTag [
| value |
<category: 'OsmoGSM'>
<comment: 'I am a simple Tag. Some TAGs even share the value in there'>
<gsmIeMask: 16rF0>
+ <gsmValueLength: 0>
+
GSM48SimpleTag class >> initWithData: aData [
^ self new
value: aData;
yourself
]
- GSM48SimpleTag class >> length: aStream [
- ^ 0
- ]
-
GSM48SimpleTag class >> asTLVDescription [
<category: 'parsing'>
^ super asTLVDescription beTagOnly; valueSize: 0; yourself
@@ -202,22 +213,12 @@ GSM48FixedSizeIE subclass: GSM48SimpleData [
<category: 'OsmoGSM'>
<comment: 'I am the base for some simple data encapsulated'>
- GSM48SimpleData class >> asTLVDescription [
- <category: 'parsing'>
- ^ super asTLVDescription
- valueSize: self length; beTV; yourself
- ]
-
GSM48SimpleData class >> initWithData: aData [
^ self new
data: aData;
yourself.
]
- GSM48SimpleData class >> length: aStream [
- ^ self length
- ]
-
GSM48SimpleData class >> defaultValue [
^ ByteArray new: self length
]
@@ -352,6 +353,7 @@ GSM48SimpleData subclass: GSM48KeySeqLuType [
<comment: 'This byte is shared for two things'>
<gsmName: 'luType'>
+ <gsmValueLength: 1>
GSM48KeySeqLuType class >> createDefault [
<category: 'creation'>
@@ -360,11 +362,6 @@ GSM48SimpleData subclass: GSM48KeySeqLuType [
yourself
]
- GSM48KeySeqLuType class >> length [
- "We always need a byte"
- ^ 1
- ]
-
val [
^ self data at: 1
]
@@ -603,6 +600,7 @@ GSM48SimpleData subclass: GSM48RejectCause [
<category: 'OsmoGSM'>
<gsmName: 'prio'>
+ <gsmValueLength: 1>
GSM48RejectCause class >> createDefault [
<category: 'creation'>
@@ -611,10 +609,6 @@ GSM48SimpleData subclass: GSM48RejectCause [
yourself.
]
- GSM48RejectCause class >> length [
- ^ 1
- ]
-
cause [
^ self data at: 1
]
@@ -629,8 +623,7 @@ GSM48SimpleData subclass: GSM48AuthRand [
<comment: 'I represent the 10.5.3.1 Authentication parameter RAND'>
<gsmName: 'auth'>
-
- GSM48AuthRand class >> length [ ^ 16 ]
+ <gsmValueLength: 16>
]
GSM48SimpleData subclass: GSM48AuthSRES [
@@ -638,8 +631,7 @@ GSM48SimpleData subclass: GSM48AuthSRES [
<comment: 'I represent the 10.5.3.2 Auth. parameter SRES'>
<gsmName: 'sres'>
-
- GSM48AuthSRES class >> length [ ^ 4 ]
+ <gsmValueLength: 4>
]
GSM48SimpleTag subclass: GSM48FollowOn [
@@ -666,6 +658,7 @@ GSM48SimpleData subclass: GSM48IdentityType [
"Ignore the spare values"
<gsmName: 'idType'>
+ <gsmValueLength: 1>
GSM48IdentityType class >> typeIMSI [ ^ 1 ]
GSM48IdentityType class >> typeIMEI [ ^ 2 ]
@@ -676,8 +669,6 @@ GSM48SimpleData subclass: GSM48IdentityType [
^ ByteArray with: self typeIMSI
]
- GSM48IdentityType class >> length [ ^ 1 ]
-
type: aType [
self data: (ByteArray with: aType)
]
@@ -1047,8 +1038,7 @@ GSM48SimpleData subclass: GSMSignal [
<gsmElementId: 16r34>
<gsmName: 'signal'>
-
- GSMSignal class >> length [ ^ 1 ]
+ <gsmValueLength: 1>
]
Object subclass: GSMNumberingPlan [
@@ -1401,8 +1391,7 @@ GSM48SimpleData subclass: GSM48Callstate [
<comment: '10.5.4.6'>
<gsmName: 'callState'>
-
- GSM48Callstate class >> length [ <category: 'length'> ^ 1]
+ <gsmValueLength: 1>
]
GSM48DataHolder subclass: GSM48AuxillaryStates [
@@ -1420,6 +1409,7 @@ GSM48SimpleData subclass: GSMRRCause [
<comment: '10.5.2.31'>
<gsmName: 'cause'>
+ <gsmValueLength: 1>
GSMRRCause class >> causeNormalEvent [ <category: 'cause'> ^ 2r00000000 ]
GSMRRCause class >> causeAbnormalRelUnspec [ <category: 'cause'> ^ 2r00000001 ]
@@ -1443,11 +1433,6 @@ GSM48SimpleData subclass: GSMRRCause [
<category: 'default'>
^ 0
]
-
- GSMRRCause class >> length [
- <category: 'fixed length'>
- ^ 1
- ]
]
GSM48SimpleData subclass: GSMStreamIdentifier [
@@ -1456,8 +1441,7 @@ GSM48SimpleData subclass: GSMStreamIdentifier [
<gsmElementId: 16r19>
<gsmName: 'streamIdentifier'>
-
- GSMStreamIdentifier class >> length [ ^ 1 ]
+ <gsmValueLength: 1>
]
GSM48DataHolder subclass: GSMSupportedCodecs [
@@ -1485,8 +1469,7 @@ GSM48SimpleData subclass: GSMNetworkCallControlCap [
<gsmElementId: 16r2F>
<gsmName: 'networkCallControlCaps'>
-
- GSMNetworkCallControlCap class >> length [ ^ 1 ]
+ <gsmValueLength: 1>
]
GSM48SimpleData subclass: GSMCauseNoCLI [
@@ -1495,8 +1478,7 @@ GSM48SimpleData subclass: GSMCauseNoCLI [
<gsmElementId: 16r3A>
<gsmName: 'causeNoCLI'>
-
- GSMCauseNoCLI class >> length [ ^ 1 ]
+ <gsmValueLength: 1>
]
GSM48DataHolder subclass: GSMBackupBearerCapability [