smalltalk
/
osmo-st-gsm
Archived
1
0
Fork 0

gsm04.11: Beging with message handling for GSM 04.11 (SMS)

It is not clear of how much parsing/handling code can be shared with
the GSM04.08 code. There are also a lot less IEs to handle for SMS so
we might not need the fixed size/data holder classes.
This commit is contained in:
Holger Hans Peter Freyther 2012-10-28 13:44:56 +01:00
parent c7bd5a49d2
commit 1c95d092e6
3 changed files with 248 additions and 0 deletions

200
GSM411.st Normal file
View File

@ -0,0 +1,200 @@
"
(C) 2012 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/>.
"
"Message for GSM04.11"
GSM48DataHolder subclass: GSM411CpUserData [
<comment: '8.1.4.1'>
<gsmElementId: 2r01>
<gsmMinValueSize: 0 max: 248>
<gsmName: 'userData'>
]
GSM48SimpleTag subclass: GSM411CpCause [
<comment: '8.1.4.2'>
<gsmElementId: 2r10>
<gsmName: 'cause'>
GSM411CpCause class [
causeNetworkFailure [ <category: 'cause'> ^ 17 ]
causeCongestion [ <category: 'cause'> ^ 22 ]
causeInvalidTransaction [ <category: 'cause'> ^ 81 ]
causeSemanticallyIncorrectMessage [ <category: 'cause'> ^ 95 ]
causeInvalidatMandatoryInformation [ <category: 'cause'> ^ 96 ]
causeMessageTypeNonExistent [ <category: 'cause'> ^ 97 ]
causeMessageNotCompatible [ <category: 'cause'> ^ 98 ]
causeInformationElementNonExistent [ <category: 'cause'> ^ 99 ]
causeProtocolError [ <category: 'cause'> ^ 111 ]
]
]
GSM48SimpleTag subclass: GSM411RpMessageType [
<comment: '8.2.2'>
]
GSM48FixedSizeIE subclass: GSM411RpMessageReference [
<comment: '8.2.3'>
<gsmValueLength: 1>
]
GSM48DataHolder subclass: GSM411RpOriginatorAddress [
<comment: '8.2.5.1'>
]
GSM48DataHolder subclass: GSM411RpDestinationAddress [
<comment: '8.2.5.2'>
]
GSM48DataHolder subclass: GSM411RpUserData [
<comment: '8.2.5.3'>
<gsmElementId: 2r1000001>
]
GSM48DataHolder subclass: GSM411RpCause [
<comment: '8.2.5.4'>
<gsmElementId: 2r1000010>
GSM411RpCause class [
"MO Causes"
causeUnassignedNumber [ <category: 'cause'> ^ 1 ]
causeOperatorDeterminedBar [ <category: 'cause-mo'> ^ 8 ]
causeCallBarred [ <category: 'cause-mo'> ^ 10 ]
causeReserved [ <category: 'cause-mo'> ^ 11 ]
causeShortMessageTransferRejected [ <category: 'cause-mo'> ^ 21 ]
causeDestinationOutOfOrder [ <category: 'cause-mo'> ^ 27 ]
causeUnidentifiedSubscriber [ <category: 'cause-mo'> ^ 28 ]
causeFacilityRejected [ <category: 'cause-mo'> ^ 29 ]
causeUnknownSubscriber [ <category: 'cause-mo'> ^ 30 ]
causeNetworkOutOfOrder [ <category: 'cause-mo'> ^ 38 ]
causeTemporaryFailure [ <category: 'cause-mo'> ^ 41 ]
causeCongestion [ <category: 'cause-mo'> ^ 42 ]
causeResourcesUnavilable [ <category: 'cause-mo'> ^ 47 ]
causeRequestedFacilityNotSubscribed [ <category: 'cause-mo'> ^ 50 ]
causeRequestedFacilityNotImplemented [ <category: 'cause-mo'> ^ 69 ]
causeInterworkingUnspecified [ <category: 'cause-mo'> ^ 127 ]
"MT causes"
causeMemoryCapacityExceeded [ <category: 'cause-mt'> ^ 22 ]
"Common code"
causeInvalidShortMessageTransferReference [ <category: 'cause'> ^ 81 ]
causeSemanticallyIncorrectMessage [ <category: 'cause'> ^ 95 ]
causeInvalidatMandatoryInformation [ <category: 'cause'> ^ 96 ]
causeMessageTypeNonExistent [ <category: 'cause'> ^ 97 ]
causeMessageNotCompatible [ <category: 'cause'> ^ 98 ]
causeInformationElementNonExistent [ <category: 'cause'> ^ 99 ]
causeProtocolError [ <category: 'cause'> ^ 111 ]
memoryAvailableMessages [
"Cause names and type for memory available notification"
^ OrderedCollection new
add: #causeUnknownSubscriber -> #Permanent;
add: #causeNetworkOutOfOrder -> #Temporary;
add: #causeTemporaryFailure -> #Temporary;
add: #causeCongestion -> #Temporary;
add: #causeResourcesUnavilable -> #Temporary;
add: #causeRequestedFacilityNotImplemented -> #Permanent;
add: #causeSemanticallyIncorrectMessage -> #Permanent;
add: #causeInvalidatMandatoryInformation -> #Permanent;
add: #causeMessageTypeNonExistent -> #Permanent;
add: #causeMessageNotCompatible -> #Permanent;
add: #causeInformationElementNonExistent -> #Permanent;
add: #causeProtocolError -> #Permanent;
add: #causeInterworkingUnspecified -> #Permanent;
yourself
]
]
]
GSM48MSG subclass: GSMCpMessage [
<category: 'OsmoGSM-04.11'>
GSMCpMessage class >> msgCpData [ <category: 'type'> ^ 2r00000001 ]
GSMCpMessage class >> msgCpAck [ <category: 'type'> ^ 2r00000100 ]
GSMCpMessage class >> msgCpError[ <category: 'type'> ^ 2r00010000 ]
GSMCpMessage class >> isGSMBaseclass [ <category: 'gsm'> ^ self = GSMCpMessage ]
GSMCpMessage class >> classType [ <category: 'gsm'> ^ 16r9 ]
ti [
^ ti ifNil: [ 0 ]
]
]
GSMCpMessage subclass: GSMCpData [
<comment: '7.2.1'>
GSMCpData class >> messageType [ <category: 'gsm'> ^ self msgCpData ]
GSMCpData class >> tlvDescription [
<category: 'parsing'>
^ OrderedCollection new
add: GSM411CpUserData asTLVDescription;
yourself
]
]
GSMCpMessage subclass: GSMCpAck [
<comment: '7.2.2'>
GSMCpAck class >> messageType [ <category: 'gsm'> ^ self msgCpAck ]
GSMCpAck class >> tlvDescription [
<category: 'parsing'>
^ OrderedCollection new
]
]
GSMCpMessage subclass: GSMCpError [
<comment: '7.2.3'>
GSMCpError class >> messageType [ <category: 'gsm'> ^ self msgCpError ]
GSMCpError class >> tlvDescription [
<category: 'parsing'>
^ OrderedCollection new
add: GSM411CpCause asTLVDescription;
yourself
]
]
Osmo.TLVParserBase subclass: GSMRpMessage [
<category: 'OsmoGSM-04.11'>
]
GSMRpMessage subclass: GSMRpData [
<comment: '7.3.1'>
"Depending on the direction the Originator address is short."
]
GSMRpMessage subclass: GSMRpSmma [
<comment: '7.3.2'>
]
GSMRpMessage subclass: GSMRpAck [
<comment: '7.3.3'>
]
GSMRpMessage subclass: GSMRpError [
<comment: '7.3.4'>
]
Eval [
GSMCpData initialize.
GSMCpAck initialize.
GSMCpError initialize.
]

45
SMSTests.st Normal file
View File

@ -0,0 +1,45 @@
"
(C) 2012 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/>.
"
TestCase subclass: GSM411Test [
testCPData [
| inp dec |
inp := #(16r09 16r01 16r35 16r01 16r2A 16r07 16r91 16r44
16r77 16r58 16r10 16r06 16r50 16r00 16r2B 16r04
16r04 16r81 16r32 16r24 16r00 16r00 16r80 16r21
16r03 16r41 16r24 16r32 16r40 16r1F 16r41 16r26
16r03 16r94 16r7D 16r56 16rA5 16r20 16r28 16rF2
16rE9 16r2C 16r82 16r82 16rD2 16r22 16r48 16r58
16r64 16r3E 16r9D 16r47 16r10 16rF5 16r09 16rAA) asByteArray.
dec := GSM48MSG decode: inp readStream.
self
assert: dec type = GSMCpData messageType;
assert: dec toMessage asByteArray = inp.
]
testCPData2 [
| inp dec |
inp := #(16r89 16r01 16r02 16r02 16r2A) asByteArray.
dec := GSM48MSG decode: inp readStream.
self
assert: dec type = GSMCpData messageType;
assert: dec toMessage asByteArray = inp.
]
]

View File

@ -10,6 +10,7 @@
<filein>BSSAP.st</filein>
<filein>BSSMAP.st</filein>
<filein>GSM48.st</filein>
<filein>GSM411.st</filein>
<filein>GSMEncoding.st</filein>
<filein>SCCPHandler.st</filein>
@ -22,7 +23,9 @@
<sunit>OsmoGSM.GSMEncodingTest</sunit>
<sunit>OsmoGSM.BitfieldTest</sunit>
<sunit>OsmoGSM.TestGSM48ProgressIE</sunit>
<sunit>OsmoGSM.GSM411Test</sunit>
<filein>Tests.st</filein>
<filein>SMSTests.st</filein>
</test>
<file>A3A8.st</file>