" (C) 2011-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 . " Object subclass: ISUPConstants [ ISUPConstants class [ msgAPT [ "Application transport" ^ 2r01000001 ] msgACM [ "Address complete" ^ 2r00000110 ] msgAMN [ "Answer" ^ 2r00001001 ] msgBLA [ "Blocking acknowledgement" ^ 2r00010101 ] msgBLO [ "Blocking" ^ 2r00010011 ] msgCCR [ "Continuity check request" ^ 2r00010001 ] msgCFN [ "Confusion" ^ 2r00101111 ] msgCGB [ "Circuit group blocking" ^ 2r00011000 ] msgCGBA [ "Circuit group blocking acknowledgement" ^ 2r00011010 ] msgCGU [ "Circuit group unblocking" ^ 2r00011001 ] msgCGUA [ "Circuit group unblocking acknowledgement" ^ 2r00011011 ] msgCON [ "Connect" ^ 2r00000111 ] msgCOT [ "Continuity" ^ 2r00000101 ] msgCPG [ "Call progress" ^ 2r00101100 ] msgCRG [ "Charge information" ^ 2r00110001 ] msgCQM [ "Circuit group query" ^ 2r00101010 ] msgCQR [ "Circuit group query response" ^ 2r00101011 ] msgDRS [ "Delayed release (reserved – used in 1988 version)" ^ 2r00100111 ] msgFAC [ "Facility" ^ 2r00110011 ] msgFAA [ "Facility accepted" ^ 2r00100000 ] msgFAR [ "Facility request" ^ 2r00011111 ] msgFOT [ "Forward transfer" ^ 2r00001000 ] msgFRJ [ "Facility reject" ^ 2r00100001 ] msgGRA [ "Circuit group reset acknowledgement" ^ 2r00101001 ] msgGRS [ "Circuit group reset" ^ 2r00010111 ] msgIDR [ "Identification request" ^ 2r00110110 ] msgIDS [ "Identification response" ^ 2r00110111 ] msgIAM [ "Initial address" ^ 2r00000001 ] msgINF [ "Information" ^ 2r00000100 ] msgINR [ "Information request" ^ 2r00000011 ] msgLPA [ "Loop back acknowledgement" ^ 2r00100100 ] msgLPR [ "Loop prevention" ^ 2r01000000 ] msgOLM [ "Overload" ^ 2r00110000 ] msgPAM [ "Pass-along" ^ 2r00101000 ] msgREL [ "Release" ^ 2r00001100 ] msgRES [ "Resume" ^ 2r00001110 ] msgRLC [ "Release complete" ^ 2r00010000 ] msgRSC [ "Reset circuit" ^ 2r00010010 ] msgSAM [ "Subsequent address" ^ 2r00000010 ] msgSUS [ "Suspend" ^ 2r00001101 ] msgUBL [ "Unblocking" ^ 2r00010100 ] msgUBA [ "Unblocking acknowledgement" ^ 2r00010110 ] msgUCIC [ "Unequipped circuit identification code" ^ 2r00101110 ] msgUSR [ "User-to-user information" ^ 2r00101101 ] msgNRM [ "Network resource management" ^ 2r00110010 ] msgPRI [ "Pre-release information" ^ 2r01000010 ] msgSAN [ "Subsequent Directory Number" ^ 2r01000011 ] msgSEG [ "Segmentation" ^ 2r00111000 ] msgUPA [ "User Part available" ^ 2r00110100 ] msgUPT [ "User Part test" ^ 2r00110100 ] 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 [ "National (significant) number" ^ 2r0000011 ] addrNAT_INTERNATIONAL [ "International number" ^ 2r0000100 ] ] ] TLVDescriptionContainer subclass: ISUPMessage [ ISUPMessage class >> decodeByteStream: aStream [ | 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. ] writeVariableEnd: aStream state: aState [ "Write the optional pointer. TODO: In case of no optional this should be 0" aStream nextPut: (aState at: 'data') size + 1. aStream nextPutAll: (aState at: 'data') contents. ] writeVariable: msg with: clazz from: field state: aState [ | var_len | "We will write a pointer and then store the data in the state" "Write the pointer of where the data will be" var_len := self variable size. msg nextPut: (aState at: 'data') size + var_len + 1. "Store the data for later" super writeVariable: (aState at: 'data') with: clazz from: field state: nil. ] createState [ "Our parsing state. We need to queue the variable fields until all of them have been written." ^ Dictionary from: {'data' -> (WriteStream on: (ByteArray new: 3))}. ] ]