attr: Introduce a 'int' base class for SMPP
In SMPPv3.4 there are integers with different amounts of bytes. Let's create a base class that helps with reading them right. Right now only one byte numbers are supported but that can be changed in the future.
This commit is contained in:
parent
07319cd1aa
commit
1e181e67e6
|
@ -16,7 +16,7 @@
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"
|
"
|
||||||
|
|
||||||
Object subclass: SMPPAddressNumberingPlanIndicator [
|
SMPPInteger subclass: SMPPAddressNumberingPlanIndicator [
|
||||||
<comment: 'I re-present 5.2.6 of SMPPv3.4'>
|
<comment: 'I re-present 5.2.6 of SMPPv3.4'>
|
||||||
|
|
||||||
SMPPAddressNumberingPlanIndicator class [
|
SMPPAddressNumberingPlanIndicator class [
|
||||||
|
@ -72,13 +72,9 @@ Object subclass: SMPPAddressNumberingPlanIndicator [
|
||||||
]
|
]
|
||||||
|
|
||||||
SMPPAddressNumberingPlanIndicator class >> tlvDescription [
|
SMPPAddressNumberingPlanIndicator class >> tlvDescription [
|
||||||
^Osmo.TLVDescription new
|
^super tlvDescription
|
||||||
typeKind: Osmo.TLVDescription valueOnly;
|
instVarName: #addr_npi;
|
||||||
instVarName: #addr_npi; parseClass: self;
|
valueSize: 1;
|
||||||
yourself
|
yourself
|
||||||
]
|
]
|
||||||
|
|
||||||
SMPPAddressNumberingPlanIndicator class >> readFrom: aStream with: anAttr [
|
|
||||||
^aStream next
|
|
||||||
]
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"
|
"
|
||||||
|
|
||||||
Object subclass: SMPPAddressTypeOfNumber [
|
SMPPInteger subclass: SMPPAddressTypeOfNumber [
|
||||||
<comment: 'I re-present 5.2.5 of SMPPv3.4'>
|
<comment: 'I re-present 5.2.5 of SMPPv3.4'>
|
||||||
|
|
||||||
SMPPAddressTypeOfNumber class [
|
SMPPAddressTypeOfNumber class [
|
||||||
|
@ -58,13 +58,9 @@ Object subclass: SMPPAddressTypeOfNumber [
|
||||||
]
|
]
|
||||||
|
|
||||||
SMPPAddressTypeOfNumber class >> tlvDescription [
|
SMPPAddressTypeOfNumber class >> tlvDescription [
|
||||||
^Osmo.TLVDescription new
|
^super tlvDescription
|
||||||
instVarName: #addr_ton; parseClass: self;
|
instVarName: #addr_ton;
|
||||||
typeKind: Osmo.TLVDescription valueOnly;
|
valueSize: 1;
|
||||||
yourself
|
yourself
|
||||||
]
|
]
|
||||||
|
|
||||||
SMPPAddressTypeOfNumber class >> readFrom: aStream with: anAttribute [
|
|
||||||
^aStream next
|
|
||||||
]
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
"
|
||||||
|
(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: SMPPInteger [
|
||||||
|
<comment: 'I help with the various kind of numbers'>
|
||||||
|
|
||||||
|
SMPPInteger class >> tlvDescription [
|
||||||
|
^Osmo.TLVDescription new
|
||||||
|
parseClass: self;
|
||||||
|
typeKind: Osmo.TLVDescription valueOnly;
|
||||||
|
yourself
|
||||||
|
]
|
||||||
|
|
||||||
|
SMPPInteger class >> readFrom: aStream with: anAttribute [
|
||||||
|
anAttribute valueSize = 1
|
||||||
|
ifTrue: [^aStream next].
|
||||||
|
|
||||||
|
"This is not implemented yet"
|
||||||
|
^self error: 'The base class does not support other value sizes'.
|
||||||
|
]
|
||||||
|
]
|
|
@ -16,7 +16,7 @@
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"
|
"
|
||||||
|
|
||||||
Object subclass: SMPPInterfaceVersion [
|
SMPPInteger subclass: SMPPInterfaceVersion [
|
||||||
<comment: 'I re-present 5.2.4 of SMPPv3.4'>
|
<comment: 'I re-present 5.2.4 of SMPPv3.4'>
|
||||||
|
|
||||||
SMPPInterfaceVersion class >> attrVersion34 [
|
SMPPInterfaceVersion class >> attrVersion34 [
|
||||||
|
@ -24,16 +24,10 @@ Object subclass: SMPPInterfaceVersion [
|
||||||
^16r34
|
^16r34
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
SMPPInterfaceVersion class >> tlvDescription [
|
SMPPInterfaceVersion class >> tlvDescription [
|
||||||
^Osmo.TLVDescription new
|
^super tlvDescription
|
||||||
instVarName: #version; parseClass: self;
|
instVarName: #version;
|
||||||
typeKind: Osmo.TLVDescription valueOnly;
|
|
||||||
valueSize: 1;
|
valueSize: 1;
|
||||||
yourself
|
yourself
|
||||||
]
|
]
|
||||||
|
|
||||||
SMPPInterfaceVersion class >> readFrom: aStream with: anAttribute [
|
|
||||||
^aStream next
|
|
||||||
]
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<filein>codec/SMPPBindTransmitterBody.st</filein>
|
<filein>codec/SMPPBindTransmitterBody.st</filein>
|
||||||
|
|
||||||
<filein>codec/attributes/SMPPOctetString.st</filein>
|
<filein>codec/attributes/SMPPOctetString.st</filein>
|
||||||
|
<filein>codec/attributes/SMPPInteger.st</filein>
|
||||||
<filein>codec/attributes/SMPPSystemId.st</filein>
|
<filein>codec/attributes/SMPPSystemId.st</filein>
|
||||||
<filein>codec/attributes/SMPPPassword.st</filein>
|
<filein>codec/attributes/SMPPPassword.st</filein>
|
||||||
<filein>codec/attributes/SMPPSystemType.st</filein>
|
<filein>codec/attributes/SMPPSystemType.st</filein>
|
||||||
|
|
Reference in New Issue