235 lines
12 KiB
Smalltalk
235 lines
12 KiB
Smalltalk
"
|
||
(C) 2011 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: ISUPConstants [
|
||
<comment: 'Constants for the ISDN User Part (ISUP) protocol'>
|
||
|
||
ISUPConstants class [
|
||
msgAPT [ ^ 2r01000001 ] " Application transport"
|
||
msgACM [ ^ 2r00000110 ] " Address complete"
|
||
msgAMN [ ^ 2r00001001 ] " Answer"
|
||
msgBLA [ ^ 2r00010101 ] " Blocking acknowledgement"
|
||
msgBLO [ ^ 2r00010011 ] " Blocking"
|
||
msgCCR [ ^ 2r00010001 ] " Continuity check request"
|
||
msgCFN [ ^ 2r00101111 ] " Confusion"
|
||
msgCGB [ ^ 2r00011000 ] " Circuit group blocking"
|
||
msgCGBA [ ^ 2r00011010 ] " Circuit group blocking acknowledgement"
|
||
msgCGU [ ^ 2r00011001 ] " Circuit group unblocking"
|
||
msgCGUA [ ^ 2r00011011 ] " Circuit group unblocking acknowledgement"
|
||
msgCON [ ^ 2r00000111 ] " Connect"
|
||
msgCOT [ ^ 2r00000101 ] " Continuity"
|
||
msgCPG [ ^ 2r00101100 ] " Call progress"
|
||
msgCRG [ ^ 2r00110001 ] " Charge information"
|
||
msgCQM [ ^ 2r00101010 ] " Circuit group query"
|
||
msgCQR [ ^ 2r00101011 ] " Circuit group query response"
|
||
msgDRS [ ^ 2r00100111 ] " Delayed release (reserved – used in 1988 version)"
|
||
msgFAC [ ^ 2r00110011 ] " Facility"
|
||
msgFAA [ ^ 2r00100000 ] " Facility accepted"
|
||
msgFAR [ ^ 2r00011111 ] " Facility request"
|
||
msgFOT [ ^ 2r00001000 ] " Forward transfer"
|
||
msgFRJ [ ^ 2r00100001 ] " Facility reject"
|
||
msgGRA [ ^ 2r00101001 ] " Circuit group reset acknowledgement"
|
||
msgGRS [ ^ 2r00010111 ] " Circuit group reset"
|
||
msgIDR [ ^ 2r00110110 ] " Identification request"
|
||
msgIDS [ ^ 2r00110111 ] " Identification response"
|
||
msgIAM [ ^ 2r00000001 ] " Initial address"
|
||
msgINF [ ^ 2r00000100 ] " Information"
|
||
msgINR [ ^ 2r00000011 ] " Information request"
|
||
msgLPA [ ^ 2r00100100 ] " Loop back acknowledgement"
|
||
msgLPR [ ^ 2r01000000 ] " Loop prevention"
|
||
msgOLM [ ^ 2r00110000 ] " Overload"
|
||
msgPAM [ ^ 2r00101000 ] " Pass-along"
|
||
msgREL [ ^ 2r00001100 ] " Release"
|
||
msgRES [ ^ 2r00001110 ] " Resume"
|
||
msgRLC [ ^ 2r00010000 ] " Release complete"
|
||
msgRSC [ ^ 2r00010010 ] " Reset circuit"
|
||
msgSAM [ ^ 2r00000010 ] " Subsequent address"
|
||
msgSUS [ ^ 2r00001101 ] " Suspend"
|
||
msgUBL [ ^ 2r00010100 ] " Unblocking"
|
||
msgUBA [ ^ 2r00010110 ] " Unblocking acknowledgement"
|
||
msgUCIC [ ^ 2r00101110 ] " Unequipped circuit identification code"
|
||
msgUSR [ ^ 2r00101101 ] " User-to-user information"
|
||
msgNRM [ ^ 2r00110010 ] " Network resource management"
|
||
msgPRI [ ^ 2r01000010 ] " Pre-release information"
|
||
msgSAN [ ^ 2r01000011 ] " Subsequent Directory Number"
|
||
msgSEG [ ^ 2r00111000 ] " Segmentation"
|
||
msgUPA [ ^ 2r00110100 ] " User Part available"
|
||
msgUPT [ ^ 2r00110100 ] " User Part test"
|
||
|
||
"TABLE C-4/Q.767" "This requires a review...."
|
||
parAccessDeliveryInformation [ ^ 2r00101110 ]
|
||
parAccessTransport [ ^ 2r00000011 ]
|
||
parApplicationTransportParameter [ ^ 2r01111000 ]
|
||
parAutomaticCongestionLevel [ ^ 2r00100111 ]
|
||
parBackwardCallIndicators [ ^ 2r00010001 ]
|
||
parBackwardGVNS [ ^ 2r01001101 ]
|
||
parCallDiversionInformation [ ^ 2r00110110 ]
|
||
parCallDiversionTreatmentIndicators [ ^ 2r01101110 ]
|
||
parCallHistoryInformation [ ^ 2r00101101 ]
|
||
parCallOfferingTreatmentIndicators [ ^ 2r01110000 ]
|
||
parCallReference [ ^ 2r00000001 ]
|
||
parCallTransferNumber [ ^ 2r01000101 ]
|
||
parCallTransferReference [ ^ 2r01000011 ]
|
||
parCalledINNumber [ ^ 2r01101111 ]
|
||
parCalledDirectoryNumber [ ^ 2r01111101 ]
|
||
parCalledPartyNumber [ ^ 2r00000100 ]
|
||
parCallingGeodeticLocation [ ^ 2r10000001 ]
|
||
parCallingPartyNumber [ ^ 2r00001010 ]
|
||
parCallingPartysCategory [ ^ 2r00001001 ]
|
||
parCauseIndicators [ ^ 2r00010010 ]
|
||
parCCNRPossibleIndicator [ ^ 2r01111010 ]
|
||
parCCSS [ ^ 2r01001011 ]
|
||
parChargedPartyIdentification [ ^ 2r01110001 ]
|
||
parCircuitAssignmentMap [ ^ 2r00100101 ]
|
||
parCircuitGroupSupervisionMessageType [ ^ 2r00010101 ]
|
||
parCircuitStateIndicator [ ^ 2r00100110 ]
|
||
parClosedUserGroupInterlockCode [ ^ 2r00011010 ]
|
||
parCollectCallRequest [ ^ 2r01111001 ]
|
||
parConferenceTreatmentIndicators [ ^ 2r01110010 ]
|
||
parConnectedNumber [ ^ 2r00100001 ]
|
||
parConnectionRequest [ ^ 2r00001101 ]
|
||
parContinuityIndicators [ ^ 2r00010000 ]
|
||
parCorrelationId [ ^ 2r01100101 ]
|
||
parDisplayInformation [ ^ 2r01110011 ]
|
||
parEchoControlInformation [ ^ 2r00110111 ]
|
||
parEndOfOptionalParameters [ ^ 2r00000000 ]
|
||
parEventInformation [ ^ 2r00100100 ]
|
||
parFacilityIndicator [ ^ 2r00011000 ]
|
||
parForwardCallIndicators [ ^ 2r00000111 ]
|
||
parForwardGVNS [ ^ 2r01001100 ]
|
||
parGenericDigits [ ^ 2r11000001 ]
|
||
parGenericNotificationIndicator [ ^ 2r00101100 ]
|
||
parGenericNumber [ ^ 2r11000000 ]
|
||
parGenericReference [ ^ 2r10000010 ]
|
||
parHTRInformation [ ^ 2r10000010 ]
|
||
parHopCounter [ ^ 2r00111101 ]
|
||
parInformationIndicators [ ^ 2r00001111 ]
|
||
parInformationRequestIndicators [ ^ 2r00001110 ]
|
||
parLocationNumber [ ^ 2r00111111 ]
|
||
parLoopPreventionIndicators [ ^ 2r01000100 ]
|
||
parMCIDRequestIndicators [ ^ 2r00111011 ]
|
||
parMCIDResponseIndicators [ ^ 2r00111100 ]
|
||
parMessageCompatibilityInformation [ ^ 2r00111000 ]
|
||
parMLPPPrecedence [ ^ 2r00111010 ]
|
||
parNatureOfConnectionIndicators [ ^ 2r00000110 ]
|
||
parNetworkManagementControls [ ^ 2r01011011 ]
|
||
parNetworkRoutingNumber [ ^ 2r10000100 ]
|
||
parNetworkSpecificFacility [ ^ 2r00101111 ]
|
||
parNumberPortabilityForwardInformation [ ^ 2r10001101 ]
|
||
parOptionalBackwardCallIndicators [ ^ 2r00101001 ]
|
||
parOptionalForwardCallIndicators [ ^ 2r00001000 ]
|
||
parOriginalCalledNumber [ ^ 2r00101000 ]
|
||
parOriginalCalledINNumber [ ^ 2r01111111 ]
|
||
parOriginationISCPointCode [ ^ 2r00101011 ]
|
||
parParameterCompatibilityInformation [ ^ 2r00111001 ]
|
||
parPivotCapability [ ^ 2r01111011 ]
|
||
parPivotCounter [ ^ 2r10000111 ]
|
||
parPivotRoutingBackwardInformation [ ^ 2r10001001 ]
|
||
parPivotRoutingForwardInformation [ ^ 2r10001000 ]
|
||
parPivotRoutingIndicators [ ^ 2r01111100 ]
|
||
parPivotStatus [ ^ 2r10000110 ]
|
||
parPropagationDelayCounter [ ^ 2r00110001 ]
|
||
parQoRCapability [ ^ 2r10000101 ]
|
||
parRange [ ^ 2r00010110 ]
|
||
parRangeAndStatus [ ^ 2r00010110 ]
|
||
parRedirectBackwardInformation [ ^ 2r10001100 ]
|
||
parRedirectCapability [ ^ 2r01001110 ]
|
||
parRedirectCounter [ ^ 2r01110111 ]
|
||
parRedirectForwardInformation [ ^ 2r10001011 ]
|
||
parRedirectStatus [ ^ 2r10001010 ]
|
||
parRedirectingNumber [ ^ 2r00001011 ]
|
||
parRedirectionInformation [ ^ 2r00010011 ]
|
||
parRedirectionNumber [ ^ 2r00001100 ]
|
||
parRedirectionNumberRestriction [ ^ 2r01000000 ]
|
||
parRemoteOperations [ ^ 2r00110010 ]
|
||
parSCFId [ ^ 2r01100110 ]
|
||
parServiceActivation [ ^ 2r00110011 ]
|
||
parSignallingPointCode [ ^ 2r00011110 ]
|
||
parSubsequentNumber [ ^ 2r00000101 ]
|
||
parSuspendResumeIndicators [ ^ 2r00100010 ]
|
||
parTransitNetworkSelection [ ^ 2r00100011 ]
|
||
parTransmissionMediumRequirement [ ^ 2r00000010 ]
|
||
parTransmissionMediumRequirementPrime [ ^ 2r00111110 ]
|
||
parTransmissionMediumUsed [ ^ 2r00110101 ]
|
||
parUIDActionIndicators [ ^ 2r01110100 ]
|
||
parUIDCapabilityIndicators [ ^ 2r01110101 ]
|
||
parUserServiceInformation [ ^ 2r00011101 ]
|
||
parUserServiceInformationPrime [ ^ 2r00110000 ]
|
||
parUserTeleserviceInformation [ ^ 2r00110100 ]
|
||
parUserToUserIndicators [ ^ 2r00101010 ]
|
||
parUserToUserInformation [ ^ 2r00100000 ]
|
||
|
||
addrNAT_NATIONAL [ ^ 2r0000011 ] " National (significant) number"
|
||
addrNAT_INTERNATIONAL [ ^ 2r0000100 ] " International number"
|
||
]
|
||
]
|
||
|
||
MSGStructure subclass: ISUPMessage [
|
||
<comment: 'I am the base class for the ISUP messages'>
|
||
|
||
ISUPMessage class >> decodeByteStream: aStream [
|
||
<category: 'parsing'>
|
||
| col cic type |
|
||
cic := (aStream next: 2) shortAt: 1.
|
||
type := (aStream next: 1) at: 1.
|
||
col := self decodeByteStream: aStream type: type.
|
||
|
||
^ OrderedCollection with: cic with: type with: col.
|
||
]
|
||
|
||
ISUPMessage class >> encodeCollection: aCollection [
|
||
| msg type |
|
||
msg := Osmo.MessageBuffer new.
|
||
type := aCollection at: 2.
|
||
|
||
msg put16: (aCollection at: 1).
|
||
msg putByte: type.
|
||
|
||
msg putByteArray: (self encodeCollection: (aCollection at: 3) type: type).
|
||
^ msg
|
||
]
|
||
|
||
parseVariable: aStream with: aClass into: decoded [
|
||
| pos ptr res |
|
||
pos := aStream position.
|
||
ptr := aStream next.
|
||
|
||
aStream skip: ptr - 1.
|
||
res := super parseVariable: aStream with: aClass into: decoded.
|
||
aStream position: pos + 1.
|
||
|
||
^ res
|
||
]
|
||
|
||
prepareOptional: aStream [
|
||
"We are done with the variable section and now get the pointer
|
||
to the optional part and will move the stream there."
|
||
|
||
| pos ptr |
|
||
pos := aStream position.
|
||
ptr := aStream next.
|
||
aStream skip: ptr - 1.
|
||
]
|
||
|
||
prepareWrite: aStream [
|
||
| len |
|
||
len := self variable size.
|
||
]
|
||
]
|
||
|