aboutsummaryrefslogtreecommitdiffstats
path: root/Messages.st
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-11-27 13:59:16 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-11-27 14:00:26 +0100
commita57c26261c051a3211887b8bbb9a640182090366 (patch)
treecdfd4cdef8975a4c9b8643ebfb0efbc449ea644d /Messages.st
parent6389190fb64acba85bf92870c3b0162093d8d93e (diff)
Messages: Prepare to parse TV and TLV messages
Ask the BSSMAP type for the size of the payload. This does not include the Tag and the Length field. BSSMAP and GSM48 behave a bit differently here. The support for T might still be a bit broken.
Diffstat (limited to 'Messages.st')
-rw-r--r--Messages.st20
1 files changed, 11 insertions, 9 deletions
diff --git a/Messages.st b/Messages.st
index 05b985d..37e09c3 100644
--- a/Messages.st
+++ b/Messages.st
@@ -30,14 +30,20 @@ Object subclass: IEMessage [
yourself
]
- IEMessage class >> findIE: type with: data from: aIEBase [
+ IEMessage class >> findIE: data from: aIEBase on: aMsg [
"TODO: This needs to move some basic dispatch class"
"Find the IE that handles the type specified"
+ | type |
+ type := data at: 1.
aIEBase allSubclassesDo: [:each |
each elementId = type
ifTrue: [
- ^ each parseFrom: data.
+ | enc size |
+ size := each length: data.
+ enc := data copyFrom: 1 to: 2 + size.
+ aMsg addIe: (each parseFrom: enc).
+ ^ 2 + size
].
].
@@ -50,13 +56,9 @@ Object subclass: IEMessage [
dat := aByteArray copyFrom: 2.
[dat isEmpty not] whileTrue: [
- | type size data |
- type := dat at: 1.
- size := dat at: 2.
- data := dat copyFrom: 1 to: 2 + size.
- dat := dat copyFrom: 3 + size.
-
- msg addIe: (self findIE: type with: data from: aIEBase).
+ | consumed |
+ consumed := self findIE: dat from: aIEBase on: msg.
+ dat := dat copyFrom: consumed + 1.
].
^ msg