diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2014-05-12 09:38:53 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2014-05-12 10:03:23 +0200 |
commit | 5ec92351f5918da95e04d2ee11d4899a282a3b81 (patch) | |
tree | a3d823b08a1fdc750c4410d9ffbc5bac534c6fa3 /codec/attributes/SMPPOctetString.st | |
parent | a2a6bbc690e087dfe1ee8070307084076ad1c8e2 (diff) |
body: Implement parsing of the body
Diffstat (limited to 'codec/attributes/SMPPOctetString.st')
-rw-r--r-- | codec/attributes/SMPPOctetString.st | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/codec/attributes/SMPPOctetString.st b/codec/attributes/SMPPOctetString.st new file mode 100644 index 0000000..cd76502 --- /dev/null +++ b/codec/attributes/SMPPOctetString.st @@ -0,0 +1,41 @@ +" + (C) 2014 by Holger Hans Peter Freyther + All Rights Reserved + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +" + +Object subclass: SMPPOctetString [ + <comment: 'I represent a variable string as used in SMPP'> + + SMPPOctetString class >> tlvDescription [ + ^Osmo.TLVDescription new + instVarName: #string; parseClass: self; + typeKind: Osmo.TLVDescription valueOnly; + yourself + ] + + SMPPOctetString class >> readFrom: aStream with: anAttribute [ + | str | + str := WriteStream on: String new. + [aStream peek = 0] whileFalse: [ + str nextPut: aStream next asCharacter]. + + "Skip the $0 now" + aStream next. + + "anAttribute... verify the max size" + ^str contents + ] +] |