blob: 0b2a4c03686df03d3d3873cef2538057d1e74171 [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000-2019 Ericsson Telecom AB
//
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v2.0
// which accompanies this distribution, and is available at
// https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
///////////////////////////////////////////////////////////////////////////////
// File: SUA_Emulation.ttcn
// Description: SUA definitions and dynamic part according to
// specification RFC 3868
// References: RFC 3868
// Rev: R2A01
// Prodnr: CNL 113 517
// Updated: 2006-11-31
// Contact: http://ttcn.ericsson.se
module SUA_Emulation
{//startmodule
modulepar
{
float tsp_maxLocalReference := 16777216.0; //loc ref= 0...tsp_maxLocalReference-1
float tsp_max_ConnectionId := 16777216.0; //max connection id = 0..tsp_max_ConnectionId -1
integer tsp_SUA_data_maxlen := 261;
integer tsp_SSN := 0;
//------------------Protocol Timer Values----------------------------------
//Waiting for connection confirm message -1 to 2 minutes
float tspc_timer_T_conn_est:=120.0;
//Delay to send a message on a conn IT on a
//connection section when there are no
//messages to send
//5 to 10 minutes
float tspc_timer_T_ias:=600.0;
//Waiting to receive a message on a connection
//section
//11 to 21 minutes
float tspc_timer_T_iar:=1260.0;
//Waiting for release complete message -10 to 20 seconds
float tspc_timer_T_rel:=20.0;
//Waiting for release complete message; or to
//repeat sending released message after the
//initial T(rel) expiry
//10 to 20 seconds
float tspc_timer_T_repeat_rel:=20.0;
//Waiting for release complete message; or to
//release connection resources, freeze the LRN
//and alert a maintenance function after the
//initial T(rel) expiry
//extending to 1 minute
float tspc_timer_T_int:=60.0;
//Waiting to resume normal procedure for
//temporary connection sections during the
//restart procedure
//23 to 25 minutes
float tspc_timer_T_guard:=1500.0;
//Waiting to release temporary connection
//section or alert maintenance function after
//reset request message is sent
//10 to 20 seconds
float tspc_timer_T_reset:=20.0;
//Waiting to receive all the segments of the
//remaining segments single segmented
//message after receiving the first segment
//10 to 20 seconds
// float tspc_timer_T_reasssembly;
float tspc_timer_T_internal_reset:=0.0;
//zero-only for sending internal signals!!
float tspc_timer_guard :=120.0
//the same as tspc_timer_T_conn_est:1 or 2 minutes
}//end parameters
import from General_Types all;
import from SUAasp_PortType all;
import from SCCPasp_Types all;
import from SUA_Types all;
group SCCPConstants
{//startgroup SCCPConstants
// constants taken from SCCP_Emulation
//------------------------------------------------------------------------------
// Subsystem Numbers
//------------------------------------------------------------------------------
const integer cg_SSN_notKnown:=0;
const integer cg_SSN_sCCPmanagement:=1;
const integer cg_SSN_reservedForITU:=2;
const integer cg_SSN_iSUP:=3;
const integer cg_SSN_oMAP:=4;
const integer cg_SSN_mAP:=5;
const integer cg_SSN_hLR:=6;
const integer cg_SSN_vLR:=7;
const integer cg_SSN_mSC:=8;
const integer cg_SSN_eIC:=9;
const integer cg_SSN_aUC:=10;
const integer cg_SSN_isdnSS:=11;
const integer cg_SSN_reservedForIntUse:=12;
const integer cg_SSN_bISDNe2e:=13;
const integer cg_SSN_tCtestResponder:=14;
const integer cg_SSN_rANAP:=142;
const integer cg_SSN_bSSAP:=254;
// TCAP has not SSN
//------------------------------------------------------------------------------
// Routing Indicator values ITU: 3.4.1/Q713.
//------------------------------------------------------------------------------
const BIT1n cg_route_on_SSN := '1'B;
const BIT1n cg_route_on_GT := '0'B;
//------------------------------------------------------------------------------
// Release Cause
//------------------------------------------------------------------------------
const integer cg_Rel_endUserOrig:=0;
const integer cg_Rel_endUserCong:=1;
const integer cg_Rel_endUserFailure:=2;
const integer cg_Rel_sCCPUserOrig:=3;
const integer cg_Rel_remProcError:=4;
const integer cg_Rel_inconsConnData:=5;
const integer cg_Rel_accessFailure:=6;
const integer cg_Rel_accessCongestion:=7;
const integer cg_Rel_subsystFailure:=8;
const integer cg_Rel_subsystCongest:=9;
const integer cg_Rel_mTPFailure:=10;
const integer cg_Rel_networkCongest:=11;
const integer cg_Rel_expResetTimer:=12;
const integer cg_Rel_expRecInacTimer:=13;
const integer cg_Rel_reserved:=14;
const integer cg_Rel_unqualified:=15;
const integer cg_Rel_sCCPFailure:=16;
//------------------------------------------------------------------------------
// Return Cause
//------------------------------------------------------------------------------
const integer cg_Ret_noTransl4AddrNature:=0;
const integer cg_Ret_noTransl4SpecifAddr:=1;
const integer cg_Ret_subsystemCongestion:=2;
const integer cg_Ret_subsystemFailure:=3;
const integer cg_Ret_unequippedUser:=4;
const integer cg_Ret_mTPFailure:=5;
const integer cg_Ret_networkCongestion:=6;
const integer cg_Ret_unqualified:=7;
const integer cg_Ret_errorMessageTransport:=8;
const integer cg_Ret_errorLocalProcessing:=9;
const integer cg_Ret_destNoReassembly:=10;
const integer cg_Ret_sCCPFailure:=11;
const integer cg_Ret_hopCounterViolation:=12;
const integer cg_Ret_segmeNotSupported:=13;
const integer cg_Ret_segmentationFailure:=14;
//------------------------------------------------------------------------------
// Reset Cause
//------------------------------------------------------------------------------
const integer cg_Res_endUserOrig:=0;
const integer cg_Res_sCCPUserOrig:=1;
const integer cg_Res_messOutOfOrder_incPs:=2;
const integer cg_Res_messOutOfOrder_incPr:=3;
const integer cg_Res_remProcErr_messOutOfWindow:=4;
const integer cg_Res_remProcErr_IncPsAfterReinit:=5;
const integer cg_Res_remProcErr_general:=6;
const integer cg_Res_remEndUserOperational:=7;
const integer cg_Res_networkOperational:=8;
const integer cg_Res_accessOperational:=9;
const integer cg_Res_networkCongestion:=10;
const integer cg_Res_reserved:=11;
const integer cg_Res_unqualified:=12;
//------------------------------------------------------------------------------
//Error Cause
//------------------------------------------------------------------------------
const integer cg_Err_unassignedDestinationLRN:=0 ;
const integer cg_Err_inconsistentSourceLRN:=1 ;
const integer cg_Err_pointCodeMismatch:=2 ;
const integer cg_Err_serviceClassMismatch:=3 ;
const integer cg_Err_unqualified:=4 ;
//------------------------------------------------------------------------------
//Refusal Cause
//------------------------------------------------------------------------------
const integer cg_Ref_endUserOrigin:=0;
const integer cg_Ref_endUserConges:=1;
const integer cg_Ref_endUserFailure:=2;
const integer cg_Ref_sCCPUserOrigin:=3;
const integer cg_Ref_destAddrUnkn:=4;
const integer cg_Ref_destInaccess:=5;
const integer cg_Ref_qOSNotAvail_nonTransient:=6;
const integer cg_Ref_qOSNotAvail_transient:=7;
const integer cg_Ref_accessFailure:=8;
const integer cg_Ref_accessCongestion:=9;
const integer cg_Ref_subsystemFailure:=10;
const integer cg_Ref_subsystemCongest:=11;
const integer cg_Ref_expConnEstTimer:=12;
const integer cg_Ref_incomUserData:=13;
const integer cg_Ref_reserved:=14;
const integer cg_Ref_unqualified:=15;
const integer cg_Ref_hopCounterViol:=16;
const integer cg_Ref_sCCPFailure:=17;
const integer cg_Ref_noTransl4address:=18;
const integer cg_Ref_unequippedUser:=19;
//------------------------------------------------------------------------------
// Originator
//------------------------------------------------------------------------------
const integer cg_Undefined:=0;
const integer cg_NSU:=1;
const integer cg_NSP:=2;
//------------------------------------------------------------------------------
// CREF Reason
//------------------------------------------------------------------------------
const integer cg_CREF_endUserOrig:=0;
const integer cg_CREF_endUserCong:=1;
const integer cg_CREF_endUserFailure:=2;
const integer cg_CREF_SCCPUserOrig:=3;
const integer cg_CREF_destAddrUnknwn_NT:=4;
const integer cg_CREF_destInaccg_T:=5;
const integer cg_CREF_QOSUnavail_NT:=6;
const integer cg_CREF_QOSUnavail_T:=7;
const integer cg_CREF_accessFailure:=8;
const integer cg_CREF_accessCong:=9;
const integer cg_CREF_destInaccg_NT:=10;
const integer cg_CREF_subsystCong:=11;
const integer cg_CREF_unspec_T:=12;
const integer cg_CREF_incompInfo:=13;
const integer cg_CREF_unspec_NT:=15;
const integer cg_CREF_undef:=16;
const integer cg_CREF_hopCntrViolation:=18;
//------------------------------------------------------------------------------
// DISC Reason
//------------------------------------------------------------------------------
const integer cg_DISC_normal:=20;
const integer cg_DISC_endUserCong:=21;
const integer cg_DISC_endUserFailure:=22;
const integer cg_DISC_SCCPUserOrig:=23;
const integer cg_DISC_abnormal_T:=24;
const integer cg_DISC_accessFailure:=28;
const integer cg_DISC_accessCong:=29;
const integer cg_DISC_abnormal_NT:=30;
const integer cg_DISC_subsystCong:=31;
const integer cg_DISC_undef:=32;
const integer cg_DISC_incompInfo:=33;
const integer cg_DISC_abnormal:=35;
//------------------------------------------------------------------------------
// RESET Reason
//------------------------------------------------------------------------------
const integer cg_RESET_userSynch:= 40 ;
const integer cg_RESET_unspec:= 41 ;
const integer cg_RESET_netCong:= 42 ;
const integer cg_RESET_undef:= 43 ;
//------------------------------------------------------------------------------
//Mapping Refusal Cause to Reason and Originator A.1/Q.713
//------------------------------------------------------------------------------
const integer cg_Mapping_RefCause_Orig[19]:=
{
cg_NSU,
cg_NSU,
cg_NSU,
cg_NSU,
cg_NSP,
cg_NSP,
cg_NSP,
cg_NSP,
cg_NSU,
cg_NSU,
cg_NSP,
cg_NSU,
cg_NSP,
cg_NSU,
cg_NSP,
cg_Undefined,
cg_NSP,
cg_NSP,
cg_NSP
};
const integer cg_Mapping_RefCause_Reason[19]:=
{
cg_CREF_endUserOrig,
cg_CREF_endUserCong,
cg_CREF_endUserFailure,
cg_CREF_SCCPUserOrig,
cg_CREF_destAddrUnknwn_NT,
cg_CREF_destInaccg_T,
cg_CREF_QOSUnavail_NT,
cg_CREF_QOSUnavail_T,
cg_CREF_accessFailure,
cg_CREF_accessCong,
cg_CREF_destInaccg_NT,
cg_CREF_subsystCong,
cg_CREF_unspec_T,
cg_CREF_incompInfo,
cg_CREF_unspec_T,
cg_CREF_undef,
cg_CREF_hopCntrViolation,
cg_CREF_destAddrUnknwn_NT,
cg_CREF_destInaccg_NT
};
//------------------------------------------------------------------------------
//Mapping Release Cause to Reason and Originator A.2/Q.713
//------------------------------------------------------------------------------
const integer cg_Mapping_RelCause_Orig[17]:=
{
cg_NSU,
cg_NSU,
cg_NSU,
cg_NSU,
cg_NSP,
cg_NSP,
cg_NSU,
cg_NSU,
cg_NSP,
cg_NSU,
cg_NSP,
cg_NSP,
cg_NSP,
cg_NSP,
cg_Undefined,
cg_Undefined,
cg_NSP
};
const integer cg_Mapping_RelCause_Reason[17]:= {
cg_DISC_normal,
cg_DISC_endUserCong,
cg_DISC_endUserFailure,
cg_DISC_SCCPUserOrig,
cg_DISC_abnormal_T,
cg_DISC_abnormal_T,
cg_DISC_accessFailure,
cg_DISC_accessCong,
cg_DISC_abnormal_NT,
cg_DISC_subsystCong,
cg_DISC_abnormal_NT,
cg_DISC_abnormal_T,
cg_DISC_abnormal_T,
cg_DISC_abnormal_T,
cg_DISC_undef,
cg_DISC_undef,
cg_DISC_abnormal_NT
};
//------------------------------------------------------------------------------
//Mapping Reset Cause to Reason and Originator A.2/Q.713
//------------------------------------------------------------------------------
const integer cg_Mapping_ResCause_Orig[12]:= {
cg_NSU,
cg_NSU,
cg_NSP,
cg_NSP,
cg_NSP,
cg_NSP,
cg_NSP,
cg_NSU,
cg_NSP,
cg_NSU,
cg_NSP,
cg_Undefined
};
const integer cg_Mapping_ResCause_Reason[12]:= {
cg_RESET_userSynch,
cg_RESET_userSynch,
cg_RESET_unspec,
cg_RESET_unspec,
cg_RESET_unspec,
cg_RESET_unspec,
cg_RESET_unspec,
cg_RESET_userSynch,
cg_RESET_unspec,
cg_RESET_userSynch,
cg_RESET_netCong,
cg_RESET_undef
};
}//endgroup SCCPConstants
//******************************************************************************
// types for SUA emulation component
//******************************************************************************
group OtherTypedefinitions
{//startgroup OtherTypedefinitions
// template for sending SUA PDUs
template PDU_SUA tr_PDU_SUA := ?;
// enum replaced with this solution:
type integer states;
const states
idle:=0,
connection_pending_OG:=1,
connection_pending_IC:=2,
active:=3, // ==data transfer, see 6.1.1.2.1/Q.711.
disconnect_pending:=4, // ==
//reset_OG,- as N_RESET_req and N_RESET_resp will not be received, this state should never occur
reset_bothway:=5,
reset_IC:=5,
//frozen_reference,
wait_conn_confirm:=6;
type record sccp_buffer
{
octetstring buffer,
integer actlen,
integer maxlen
}
// === Connection Oriented Data: ===
// record holding all data of a connection
type record ConnectionData
{
LIN4_BO_LAST localReference,
LIN4_BO_LAST remoteReference,
states state,
integer connectionId,
sccp_buffer reassembler_buffer // data collected here before sending up to the User
}
// === Connectionless Data: =======================
// == sending:==
// Segmentation Local Reference
type integer segmLocRef_states;
const segmLocRef_states segmLocRef_idle :=0, segmLocRef_busy:=1;
type record segmLocRef
{
OCT3 val,
segmLocRef_states state
}
// == receiving: ==
type record ClessRcvBuff
{
OCT3 segmRemoteRef,
segmLocRef_states state,
sccp_buffer reassembler_buffer
}
}//endgroup OtherTypedefinitions
//******************************************************************************
// SUA emulation component
//******************************************************************************
type component SUA_CT
{ //startcomponent SUA_CT
//Component variables
//***************************************************************
var ConnectionData ConnectionTable[16]; //16 connections 0 to 15
var integer v_session; // actual conn. oriented session index
var SUA_RoutingContext v_routingContext;
var ClessRcvBuff ClessRcvBuffTable[16];
var integer v_SSN := tsp_SSN;
var integer v_sccp_data_maxlen := tsp_SUA_data_maxlen;
//***************************************************************
port SCCPasp_SP_PT SCCP_SP_PORT; //port type defined in SCCP_ASPs, towards the user layer
port SUAasp_PT SUA_PORT; // SUA test port
//component timers
timer T_T_conn_est[16]:= { tspc_timer_T_conn_est,tspc_timer_T_conn_est,
tspc_timer_T_conn_est,tspc_timer_T_conn_est,
tspc_timer_T_conn_est,tspc_timer_T_conn_est,
tspc_timer_T_conn_est,tspc_timer_T_conn_est,
tspc_timer_T_conn_est,tspc_timer_T_conn_est,
tspc_timer_T_conn_est,tspc_timer_T_conn_est,
tspc_timer_T_conn_est,tspc_timer_T_conn_est,
tspc_timer_T_conn_est,tspc_timer_T_conn_est };
timer T_T_ias[16]:= { tspc_timer_T_ias,tspc_timer_T_ias,
tspc_timer_T_ias,tspc_timer_T_ias,
tspc_timer_T_ias,tspc_timer_T_ias,
tspc_timer_T_ias,tspc_timer_T_ias,
tspc_timer_T_ias,tspc_timer_T_ias,
tspc_timer_T_ias,tspc_timer_T_ias,
tspc_timer_T_ias,tspc_timer_T_ias,
tspc_timer_T_ias,tspc_timer_T_ias };
timer T_T_iar[16]:= { tspc_timer_T_iar,tspc_timer_T_iar,
tspc_timer_T_iar,tspc_timer_T_iar,
tspc_timer_T_iar,tspc_timer_T_iar,
tspc_timer_T_iar,tspc_timer_T_iar,
tspc_timer_T_iar,tspc_timer_T_iar,
tspc_timer_T_iar,tspc_timer_T_iar,
tspc_timer_T_iar,tspc_timer_T_iar,
tspc_timer_T_iar,tspc_timer_T_iar };
timer T_T_rel[16]:= { tspc_timer_T_rel,tspc_timer_T_rel,
tspc_timer_T_rel,tspc_timer_T_rel,
tspc_timer_T_rel,tspc_timer_T_rel,
tspc_timer_T_rel,tspc_timer_T_rel,
tspc_timer_T_rel,tspc_timer_T_rel,
tspc_timer_T_rel,tspc_timer_T_rel,
tspc_timer_T_rel,tspc_timer_T_rel,
tspc_timer_T_rel,tspc_timer_T_rel };
timer T_T_repeat_rel[16]:= { tspc_timer_T_repeat_rel,tspc_timer_T_repeat_rel,
tspc_timer_T_repeat_rel,tspc_timer_T_repeat_rel,
tspc_timer_T_repeat_rel,tspc_timer_T_repeat_rel,
tspc_timer_T_repeat_rel,tspc_timer_T_repeat_rel,
tspc_timer_T_repeat_rel,tspc_timer_T_repeat_rel,
tspc_timer_T_repeat_rel,tspc_timer_T_repeat_rel,
tspc_timer_T_repeat_rel,tspc_timer_T_repeat_rel,
tspc_timer_T_repeat_rel,tspc_timer_T_repeat_rel };
timer T_T_int[16]:= { tspc_timer_T_int,tspc_timer_T_int,
tspc_timer_T_int,tspc_timer_T_int,
tspc_timer_T_int,tspc_timer_T_int,
tspc_timer_T_int,tspc_timer_T_int,
tspc_timer_T_int,tspc_timer_T_int,
tspc_timer_T_int,tspc_timer_T_int,
tspc_timer_T_int,tspc_timer_T_int,
tspc_timer_T_int,tspc_timer_T_int };
timer T_T_guard[16]:= { tspc_timer_T_guard,tspc_timer_T_guard,
tspc_timer_T_guard,tspc_timer_T_guard,
tspc_timer_T_guard,tspc_timer_T_guard,
tspc_timer_T_guard,tspc_timer_T_guard,
tspc_timer_T_guard,tspc_timer_T_guard,
tspc_timer_T_guard,tspc_timer_T_guard,
tspc_timer_T_guard,tspc_timer_T_guard,
tspc_timer_T_guard,tspc_timer_T_guard };
timer T_T_reset[16]:= { tspc_timer_T_reset,tspc_timer_T_reset,
tspc_timer_T_reset,tspc_timer_T_reset,
tspc_timer_T_reset,tspc_timer_T_reset,
tspc_timer_T_reset,tspc_timer_T_reset,
tspc_timer_T_reset,tspc_timer_T_reset,
tspc_timer_T_reset,tspc_timer_T_reset,
tspc_timer_T_reset,tspc_timer_T_reset,
tspc_timer_T_reset,tspc_timer_T_reset };
timer T_T_internal_reset[16]:= { tspc_timer_T_internal_reset,tspc_timer_T_internal_reset,
tspc_timer_T_internal_reset,tspc_timer_T_internal_reset,
tspc_timer_T_internal_reset,tspc_timer_T_internal_reset,
tspc_timer_T_internal_reset,tspc_timer_T_internal_reset,
tspc_timer_T_internal_reset,tspc_timer_T_internal_reset,
tspc_timer_T_internal_reset,tspc_timer_T_internal_reset,
tspc_timer_T_internal_reset,tspc_timer_T_internal_reset,
tspc_timer_T_internal_reset,tspc_timer_T_internal_reset };
timer T_guard[16]:= { tspc_timer_guard,tspc_timer_guard,
tspc_timer_guard,tspc_timer_guard,
tspc_timer_guard,tspc_timer_guard,
tspc_timer_guard,tspc_timer_guard,
tspc_timer_guard,tspc_timer_guard,
tspc_timer_guard,tspc_timer_guard,
tspc_timer_guard,tspc_timer_guard,
tspc_timer_guard,tspc_timer_guard };
}//endcomponent SUA_EMU_CT
group SCCPFunctions
{//startgroup SCCPFunctions
//****************************************************************
// Function for starting the emulation component
//****************************************************************
function SUAStart() runs on SUA_CT
{
//local declarations
var integer vl_j;
//initializes variables with 'SUA_CT' visibility/scope
for (vl_j:=0;vl_j<16;vl_j:=vl_j+1)
{
ConnectionTable[vl_j].localReference :=0;
ConnectionTable[vl_j].remoteReference:=0;
ConnectionTable[vl_j].state :=idle;
ConnectionTable[vl_j].connectionId :=0;
ConnectionTable[vl_j].reassembler_buffer.buffer :=''O;
ConnectionTable[vl_j].reassembler_buffer.actlen := 0;
ConnectionTable[vl_j].reassembler_buffer.maxlen := 16*v_sccp_data_maxlen;
reallocate_ClessRcvBuff(vl_j);
}//endfor
// gather routing context info. from the test port.
// the first message sent by the SUA test port after mapping
// should contain the routing context information
alt
{
[] SUA_PORT.receive(SUA_RoutingContext:?) -> value v_routingContext
{
log("Routing Context initialized:");
log(v_routingContext);
}
[] SUA_PORT.receive { log("ERROR: Routing context was not received after map operation!"); stop; }
}
//
//starts SUA execution
ScanEvents();
}//endfunction of SUAStart
//****************************************************************
// Auxiliary functions
//****************************************************************
function ReleaseResources(in integer pl_session) runs on SUA_CT
{//startfunction
ConnectionTable[pl_session].remoteReference := 0;
ConnectionTable[pl_session].localReference := 0;
ConnectionTable[pl_session].connectionId := 0;
Stop_sessionTimers(pl_session);
ConnectionTable[pl_session].state := idle;
ConnectionTable[pl_session].reassembler_buffer.buffer := ''O;
ConnectionTable[pl_session].reassembler_buffer.actlen := 0;
}//endfunction ReleaseResources
function GuardTimer_Expired(in integer pl_session) runs on SUA_CT
//no answer to ASP_SCCP_N_CONNECT_ind received
{//startfunction
//local declarations
var PDU_SUA vl_PDU_SUA;
//Action Table follows
if (ConnectionTable[pl_session].state == connection_pending_IC)
{//startif
//send Released-this should disconnect the other end
vl_PDU_SUA.sUA_RELRE.version := '01'O;
vl_PDU_SUA.sUA_RELRE.reserved := '00'O;
vl_PDU_SUA.sUA_RELRE.messageClassAndType := '0804'O;
vl_PDU_SUA.sUA_RELRE.messageLength := 0; // calculated by SUA_EncDec
vl_PDU_SUA.sUA_RELRE.messageParameters.routingContext := v_routingContext;
vl_PDU_SUA.sUA_RELRE.messageParameters.destinationReferenceNumber.tag := '0105'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.destinationReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELRE.messageParameters.destinationReferenceNumber.destinationReferenceNumber := ConnectionTable[pl_session].remoteReference;
vl_PDU_SUA.sUA_RELRE.messageParameters.sourceReferenceNumber.tag := '0104'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.sourceReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELRE.messageParameters.sourceReferenceNumber.sourceReferenceNumber := ConnectionTable[pl_session].localReference;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.tag := '0106'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.lengthInd := 8;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.reserved := '0000'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.causeType := releaseCause;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.causeValue := cg_Rel_endUserOrig;
vl_PDU_SUA.sUA_RELRE.messageParameters.importance := omit;
vl_PDU_SUA.sUA_RELRE.messageParameters.data := omit;
//send Released
SUA_PORT.send( vl_PDU_SUA );
//release resources, return to idle
ReleaseResources(pl_session);
}//endif
}//endfunction GuardTimer_Expired
function InternalResetTimer_Expired(integer pl_session) runs on SUA_CT
{//startfunction
//local declarations
var PDU_SUA vl_PDU_SUA;
var ASP_SCCP_N_RESET_ind vl_N_RESET_ind;
//Action Table follows
if (ConnectionTable[pl_session].state==active)
{//startif
//send ASP_SCCP_N_RESET_ind
vl_N_RESET_ind.originator:=cg_NSP;
vl_N_RESET_ind.reason:=cg_DISC_abnormal_T;
vl_N_RESET_ind.connectionId:=ConnectionTable[pl_session].connectionId;
SCCP_SP_PORT.send( vl_N_RESET_ind ); //send ASP_SCCP_N_RESET_ind
//send Reset Request
vl_PDU_SUA.sUA_RESRE.version := '01'O;
vl_PDU_SUA.sUA_RESRE.reserved := '00'O;
vl_PDU_SUA.sUA_RESRE.messageClassAndType := '0807'O;
vl_PDU_SUA.sUA_RESRE.messageLength := 0; // calculated by SUA_EncDec
vl_PDU_SUA.sUA_RESRE.messageParameters.routingContext := v_routingContext;
vl_PDU_SUA.sUA_RESRE.messageParameters.destinationReferenceNumber.tag := '0105'O;
vl_PDU_SUA.sUA_RESRE.messageParameters.destinationReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RESRE.messageParameters.destinationReferenceNumber.destinationReferenceNumber := ConnectionTable[pl_session].remoteReference;
vl_PDU_SUA.sUA_RESRE.messageParameters.sourceReferenceNumber.tag := '0104'O;
vl_PDU_SUA.sUA_RESRE.messageParameters.sourceReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RESRE.messageParameters.sourceReferenceNumber.sourceReferenceNumber := ConnectionTable[pl_session].localReference;
vl_PDU_SUA.sUA_RESRE.messageParameters.sCCPCause.tag := '0106'O;
vl_PDU_SUA.sUA_RESRE.messageParameters.sCCPCause.lengthInd := 8;
vl_PDU_SUA.sUA_RESRE.messageParameters.sCCPCause.reserved := '0000'O;
vl_PDU_SUA.sUA_RESRE.messageParameters.sCCPCause.causeType := resetCause;
vl_PDU_SUA.sUA_RESRE.messageParameters.sCCPCause.causeValue := cg_Res_endUserOrig;
//send Reset Request
SUA_PORT.send( vl_PDU_SUA );
//start reset timer
T_T_reset[pl_session].start;
//restart send inactivity timer
T_T_ias[pl_session].stop;//to avoid warnings
T_T_ias[pl_session].start;
//reset variables etc.
//change state
ConnectionTable[pl_session].state:=reset_bothway;
}//endif
}//InternalResetTimer_Expired
function Reset_Timer_Expired(integer pl_session) runs on SUA_CT
{//startfunction
//local declarations
var ASP_SCCP_N_DISCONNECT_ind vl_N_DISCONNECT_ind;
//Action Table follows
if (ConnectionTable[pl_session].state==reset_bothway)
{//startif
//assemble ASP_SCCP
vl_N_DISCONNECT_ind.originator := cg_NSP;
vl_N_DISCONNECT_ind.respondingAddress := omit;
vl_N_DISCONNECT_ind.reason := cg_DISC_abnormal_T;
vl_N_DISCONNECT_ind.userData := omit;
vl_N_DISCONNECT_ind.connectionId := ConnectionTable[pl_session].connectionId;
vl_N_DISCONNECT_ind.importance := omit;
SCCP_SP_PORT.send( vl_N_DISCONNECT_ind ); //send ASP_SCCP_N_DISCONNECT_ind
//release resources, stop inactivity timers, change state to idle
ReleaseResources(pl_session);
}//endif
}//Reset_Timer_Expired
function Interval_Timer_Expired(integer pl_session) runs on SUA_CT
{//startfunction
//Action Table follows
if (ConnectionTable[pl_session].state==disconnect_pending)
{
log ("Interval timer expired");
//release resources
ReleaseResources(pl_session);
}
}//Interval_Timer_Expired
function RepeatRelease_Timer_Expired(integer pl_session) runs on SUA_CT
{
//local declarations
var PDU_SUA vl_PDU_SUA;
//Action Table follows
if (ConnectionTable[pl_session].state==disconnect_pending)
{
vl_PDU_SUA.sUA_RELRE.version := '01'O;
vl_PDU_SUA.sUA_RELRE.reserved := '00'O;
vl_PDU_SUA.sUA_RELRE.messageClassAndType := '0804'O;
vl_PDU_SUA.sUA_RELRE.messageLength := 0; // calculated by SUA_EncDec
vl_PDU_SUA.sUA_RELRE.messageParameters.routingContext := v_routingContext;
vl_PDU_SUA.sUA_RELRE.messageParameters.destinationReferenceNumber.tag := '0105'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.destinationReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELRE.messageParameters.destinationReferenceNumber.destinationReferenceNumber := ConnectionTable[pl_session].remoteReference;
vl_PDU_SUA.sUA_RELRE.messageParameters.sourceReferenceNumber.tag := '0104'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.sourceReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELRE.messageParameters.sourceReferenceNumber.sourceReferenceNumber := ConnectionTable[pl_session].localReference;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.tag := '0106'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.lengthInd := 8;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.reserved := '0000'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.causeType := releaseCause;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.causeValue := cg_Rel_endUserOrig;
vl_PDU_SUA.sUA_RELRE.messageParameters.importance := omit;
vl_PDU_SUA.sUA_RELRE.messageParameters.data := omit;
//send Released
SUA_PORT.send( vl_PDU_SUA );
//restart repeat release timer
T_T_repeat_rel[pl_session].stop;//to avoid warnings
T_T_repeat_rel[pl_session].start;
//no state change, return
}
}//RepeatRelease_Timer_Expired
function Release_Timer_Expired(integer pl_session) runs on SUA_CT
{
//local declarations
var PDU_SUA vl_PDU_SUA;
//Action Table follows
if (ConnectionTable[pl_session].state==disconnect_pending)
{
vl_PDU_SUA.sUA_RELRE.version := '01'O;
vl_PDU_SUA.sUA_RELRE.reserved := '00'O;
vl_PDU_SUA.sUA_RELRE.messageClassAndType := '0804'O;
vl_PDU_SUA.sUA_RELRE.messageLength := 0; // calculated by SUA_EncDec
vl_PDU_SUA.sUA_RELRE.messageParameters.routingContext := v_routingContext;
vl_PDU_SUA.sUA_RELRE.messageParameters.destinationReferenceNumber.tag := '0105'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.destinationReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELRE.messageParameters.destinationReferenceNumber.destinationReferenceNumber := ConnectionTable[pl_session].remoteReference;
vl_PDU_SUA.sUA_RELRE.messageParameters.sourceReferenceNumber.tag := '0104'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.sourceReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELRE.messageParameters.sourceReferenceNumber.sourceReferenceNumber := ConnectionTable[pl_session].localReference;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.tag := '0106'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.lengthInd := 8;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.reserved := '0000'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.causeType := releaseCause;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.causeValue := cg_Rel_endUserOrig;
vl_PDU_SUA.sUA_RELRE.messageParameters.importance := omit;
vl_PDU_SUA.sUA_RELRE.messageParameters.data := omit;
//send Released
SUA_PORT.send( vl_PDU_SUA );
T_T_repeat_rel[pl_session].start;
T_T_int[pl_session].start;
//no state change, return
}//endif
}//Release_Timer_Expired
function ReceiveInactivity_Timer_Expired(integer pl_session) runs on SUA_CT
{
//local declarations
var PDU_SUA vl_PDU_SUA;
var ASP_SCCP_N_DISCONNECT_ind vl_N_DISCONNECT_ind;
//Action Table follows
if (ConnectionTable[pl_session].state==idle){}
else if (ConnectionTable[pl_session].state==active)
{
//assemble ASP_SCCP
vl_N_DISCONNECT_ind.originator := cg_NSP;
vl_N_DISCONNECT_ind.respondingAddress := omit;
vl_N_DISCONNECT_ind.reason := cg_DISC_endUserFailure;
vl_N_DISCONNECT_ind.userData := omit;
vl_N_DISCONNECT_ind.connectionId := ConnectionTable[pl_session].connectionId;
vl_N_DISCONNECT_ind.importance := omit;
SCCP_SP_PORT.send( vl_N_DISCONNECT_ind ); //send ASP_SCCP_N_DISCONNECT_ind
//stop inactivity timers
T_T_ias[pl_session].stop;
T_T_iar[pl_session].stop;
// header
vl_PDU_SUA.sUA_RELRE.version := '01'O;
vl_PDU_SUA.sUA_RELRE.reserved := '00'O;
vl_PDU_SUA.sUA_RELRE.messageClassAndType := '0804'O;
vl_PDU_SUA.sUA_RELRE.messageLength := 0; // calculated by SUA_EncDec
// routing context
vl_PDU_SUA.sUA_RELRE.messageParameters.routingContext := v_routingContext;
// destination reference num.
vl_PDU_SUA.sUA_RELRE.messageParameters.destinationReferenceNumber.tag := '0105'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.destinationReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELRE.messageParameters.destinationReferenceNumber.destinationReferenceNumber := ConnectionTable[pl_session].remoteReference;
// source reference num.
vl_PDU_SUA.sUA_RELRE.messageParameters.sourceReferenceNumber.tag := '0104'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.sourceReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELRE.messageParameters.sourceReferenceNumber.sourceReferenceNumber := ConnectionTable[pl_session].localReference;
// sccp cause
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.tag := '0106'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.lengthInd := 8;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.reserved := '0000'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.causeType := releaseCause;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.causeValue := cg_Rel_expRecInacTimer;
// optional params.
vl_PDU_SUA.sUA_RELRE.messageParameters.importance := omit;
vl_PDU_SUA.sUA_RELRE.messageParameters.data := omit;
//send Released
SUA_PORT.send( vl_PDU_SUA );
//start release timer
T_T_rel[pl_session].start;
ConnectionTable[pl_session].state:=disconnect_pending;
}//endif
}//ReceiveInactivity_Timer_Expired
function SendInactivity_Timer_Expired(integer pl_session) runs on SUA_CT
{
//local declarations
var PDU_SUA vl_PDU_SUA;
//Action Table follows
if (ConnectionTable[pl_session].state==active)
{
// general header
vl_PDU_SUA.sUA_COIT.version := '01'O;
vl_PDU_SUA.sUA_COIT.reserved := '00'O;
vl_PDU_SUA.sUA_COIT.messageClassAndType := '080B'O;
vl_PDU_SUA.sUA_COIT.messageLength := 0; // calculated by SUA_EncDec
// routing context
vl_PDU_SUA.sUA_COIT.messageParameters.routingContext := v_routingContext;
// protocol class
vl_PDU_SUA.sUA_COIT.messageParameters.protocolClass.tag := '0115'O;
vl_PDU_SUA.sUA_COIT.messageParameters.protocolClass.lengthInd := 8;
vl_PDU_SUA.sUA_COIT.messageParameters.protocolClass.reserved := '000000'O;
vl_PDU_SUA.sUA_COIT.messageParameters.protocolClass.returnMessageOnError := '0'B;
vl_PDU_SUA.sUA_COIT.messageParameters.protocolClass.reserved5 := '00000'B;
vl_PDU_SUA.sUA_COIT.messageParameters.protocolClass.protocolClass := '10'B;
// vl_PDU_SCCP.inacttest.protClass:={
// class:='0010'B,
// messageHandling:='0000'B
// };//protocol class 2
// destination reference number
vl_PDU_SUA.sUA_COIT.messageParameters.destinationReferenceNumber.tag := '0105'O;
vl_PDU_SUA.sUA_COIT.messageParameters.destinationReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_COIT.messageParameters.destinationReferenceNumber.destinationReferenceNumber := ConnectionTable[pl_session].remoteReference;
// source reference number
vl_PDU_SUA.sUA_COIT.messageParameters.sourceReferenceNumber.tag := '0104'O;
vl_PDU_SUA.sUA_COIT.messageParameters.sourceReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_COIT.messageParameters.sourceReferenceNumber.sourceReferenceNumber := ConnectionTable[pl_session].localReference;
// sequence number
vl_PDU_SUA.sUA_COIT.messageParameters.sequenceNumber.tag := '0107'O;
vl_PDU_SUA.sUA_COIT.messageParameters.sequenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_COIT.messageParameters.sequenceNumber.reserved := '0000'O;
vl_PDU_SUA.sUA_COIT.messageParameters.sequenceNumber.recSeqNum := 0;
vl_PDU_SUA.sUA_COIT.messageParameters.sequenceNumber.m := '0'B;
vl_PDU_SUA.sUA_COIT.messageParameters.sequenceNumber.sentSeqNum := 0;
vl_PDU_SUA.sUA_COIT.messageParameters.sequenceNumber.spare := '0'B;
// credit
vl_PDU_SUA.sUA_COIT.messageParameters.credit.tag := '010A'O;
vl_PDU_SUA.sUA_COIT.messageParameters.credit.lengthInd := 8;
vl_PDU_SUA.sUA_COIT.messageParameters.credit.reserved := '000000'O;
vl_PDU_SUA.sUA_COIT.messageParameters.credit.credit := 0;
//Param name credit(9), length 1, credit 0 -it will be mercifully ignored anyhow
//send Inact. Test
SUA_PORT.send( vl_PDU_SUA );
//restart send inactivity timer
T_T_ias[pl_session].stop;//to avoid warnings
T_T_ias[pl_session].start;
}//endif
}//endfunction
function Conn_Timer_Expired(integer pl_session) runs on SUA_CT
{
//local declarations
var ASP_SCCP_N_DISCONNECT_ind vl_N_DISCONNECT_ind;
if (ConnectionTable[pl_session].state==connection_pending_OG)
{
//assemble ASP_SCCP
vl_N_DISCONNECT_ind.originator := cg_NSP;
vl_N_DISCONNECT_ind.respondingAddress := omit;
vl_N_DISCONNECT_ind.reason := cg_DISC_abnormal_T;
vl_N_DISCONNECT_ind.userData := omit;
vl_N_DISCONNECT_ind.connectionId := ConnectionTable[pl_session].connectionId;
vl_N_DISCONNECT_ind.importance := omit;
SCCP_SP_PORT.send( vl_N_DISCONNECT_ind ); //send ASP_SCCP_N_DISCONNECT_ind
//release resources
ReleaseResources(pl_session);
}
else if (ConnectionTable[pl_session].state==wait_conn_confirm)
{
ReleaseResources(pl_session);
}
}//Conn_Timer_Expired
function GenerateLocalReference() runs on SUA_CT return LIN4_BO_LAST
{
var LIN4_BO_LAST vl_LocalReference;
do
{
vl_LocalReference := float2int(rnd()*tsp_maxLocalReference);
}
while ( Retrieve_session( vl_LocalReference ) != -1 );
return vl_LocalReference;
}//GenerateLocalReference
function GenerateConnectionId() runs on SUA_CT return integer
{
var integer vl_ConnectionId;
do { vl_ConnectionId := float2int(rnd()*tsp_max_ConnectionId); }
while ( Retrieve_session_connectionId( vl_ConnectionId ) != -1 );
return vl_ConnectionId;
}//GenerateConnectionId
function Stop_sessionTimers ( integer pl_session) runs on SUA_CT
{
if (T_T_conn_est[pl_session].running)
{ T_T_conn_est[pl_session].stop;}
if (T_T_ias[pl_session].running)
{ T_T_ias[pl_session].stop;}
if (T_T_iar[pl_session].running)
{ T_T_iar[pl_session].stop;}
if (T_T_rel[pl_session].running)
{ T_T_rel[pl_session].stop;}
if (T_T_repeat_rel[pl_session].running)
{ T_T_repeat_rel[pl_session].stop;}
if (T_T_int[pl_session].running)
{ T_T_int[pl_session].stop;}
if (T_T_guard[pl_session].running)
{ T_T_guard[pl_session].stop;}
if (T_T_reset[pl_session].running)
{ T_T_reset[pl_session].stop;}
//T_T_reassembly[pl_session].stop;
}//Stop_sessionTimers
function CheckIdleIndividuals() runs on SUA_CT return integer
{
var integer vl_j;
for (vl_j:=0;vl_j<16;vl_j:=vl_j+1)
{
if (ConnectionTable[vl_j].state==idle)
{
log("First idle individual index:",vl_j);
return vl_j;
}
}
return -1;
}//CheckIdleIndividuals
function ConnectionAlreadyEstablished( LIN4_BO_LAST pl_LocRef) runs on SUA_CT return boolean
{
var integer vl_j;
for (vl_j:=0;vl_j<16;vl_j:=vl_j+1)
{
if (ConnectionTable[vl_j].localReference==pl_LocRef)
{
return true;
}
}
return false;
} //ConnectionAlreadyEstablished
function ConnectionAlreadyEstablished_remote( LIN4_BO_LAST pl_LocRef) runs on SUA_CT return boolean
{
var integer vl_j;
for (vl_j:=0;vl_j<16;vl_j:=vl_j+1)
{
if (ConnectionTable[vl_j].remoteReference==pl_LocRef)
{
return true;
}
}
return false;
} //ConnectionAlreadyEstablished_remote
function ConnectionAlreadyEstablished_connectionId(integer pl_ConnId) runs on SUA_CT return boolean
{
var integer vl_j;
for (vl_j:=0;vl_j<16;vl_j:=vl_j+1)
{
if (ConnectionTable[vl_j].connectionId==pl_ConnId)
{
return true;
}
}
return false;
} //ConnectionAlreadyEstablished_connectionId
function Retrieve_session( LIN4_BO_LAST pl_LocRef ) runs on SUA_CT return integer
{
var integer vl_j;
for (vl_j:=0;vl_j<16;vl_j:=vl_j+1)
{
if (ConnectionTable[vl_j].localReference==pl_LocRef)
{
log("Session index based on local reference:",vl_j);
return vl_j;
}
}
return -1;
} //Retrieve_session
function Retrieve_session_remote( LIN4_BO_LAST pl_LocRef ) runs on SUA_CT return integer
{
var integer vl_j;
for (vl_j:=0;vl_j<16;vl_j:=vl_j+1)
{
if (ConnectionTable[vl_j].remoteReference==pl_LocRef)
{
log("Session index based on remote reference:",vl_j);
return vl_j;
}
}
return -1;
} //Retrieve_session_remote
function Retrieve_session_connectionId( integer pl_ConnId ) runs on SUA_CT return integer
{
var integer vl_j;
for (vl_j:=0;vl_j<16;vl_j:=vl_j+1)
{
if (ConnectionTable[vl_j].connectionId==pl_ConnId)
{
log("Session index based on connection ID:",vl_j);
return vl_j;
}
}
return -1;
} //Retrieve_session_connectionId
//******************************************************************
//function reallocate_ClessRcvBuff
//******************************************************************
function reallocate_ClessRcvBuff(in integer pl_index ) runs on SUA_CT
{
ClessRcvBuffTable[pl_index].state := segmLocRef_idle;
// maybe unnecessaryy
ClessRcvBuffTable[pl_index].segmRemoteRef := '000000'O;
ClessRcvBuffTable[pl_index].reassembler_buffer.buffer:=''O;
ClessRcvBuffTable[pl_index].reassembler_buffer.actlen:=0;
return;
}
//******************************************************************
//function send_ClessRcvBuff_in_N_UNITDATAind
//******************************************************************
function send_ClessRcvBuff_in_N_UNITDATAind (
in integer pl_index,
in PDU_SUA pl_PDU_SUA) runs on SUA_CT
{
var ASP_SCCP_N_UNITDATA_ind vl_N_UNITDATA_ind;
vl_N_UNITDATA_ind.calledAddress :=
ConvertPDUEncodedAddressToASPAddress_destinationAddr( pl_PDU_SUA.sUA_CLDT.messageParameters.destinationAddress );
vl_N_UNITDATA_ind.callingAddress :=
ConvertPDUEncodedAddressToASPAddress_sourceAddr( pl_PDU_SUA.sUA_CLDT.messageParameters.sourceAddress );
vl_N_UNITDATA_ind.sequenceControl := '0000000'B &
pl_PDU_SUA.sUA_CLDT.messageParameters.protocolClass.protocolClass[1];
if( pl_PDU_SUA.sUA_CLDT.messageParameters.protocolClass.returnMessageOnError == '1'B )
{ vl_N_UNITDATA_ind.returnOption := '00000001'B; }
else
{ vl_N_UNITDATA_ind.returnOption := '00000000'B; }
vl_N_UNITDATA_ind.userData := ClessRcvBuffTable[pl_index].reassembler_buffer.buffer;
vl_N_UNITDATA_ind.importance := omit;
SCCP_SP_PORT.send( vl_N_UNITDATA_ind );
return;
}//send_ClessRcvBuff_in_N_UNITDATAind
//******************************************************************
// CONN.ORIENTED SEGMENTING/REASSEMBLING
//******************************************************************
//******************************************************************
// SEGMENTING
//******************************************************************
//******************************************************************
// function sending_dataform1s_in_SUA_CODT
// segmentates data and sends segments in dataform1 messages
// == segmentation - connection oriented case ==
// counterpair: buffered_sending_ASP_N_DATA_ind
//******************************************************************
function sending_dataform1s_in_SUA_CODT( in ASP_SCCP_N_DATA_req pl_N_DATA_req ) runs on SUA_CT
{
var PDU_SUA vl_PDU_SUA;
var integer vl_actdatalen, vl_len, vl_from;
var SCCP_PAR_UserData vl_data;
// general header
vl_PDU_SUA.sUA_CODT.version := '01'O;
vl_PDU_SUA.sUA_CODT.reserved := '00'O;
vl_PDU_SUA.sUA_CODT.messageClassAndType := '0808'O;
vl_PDU_SUA.sUA_CODT.messageLength := 0;
// routing context
vl_PDU_SUA.sUA_CODT.messageParameters.routingContext := v_routingContext;
// sequence number
vl_PDU_SUA.sUA_CODT.messageParameters.sequenceNumber.tag := '0107'O;
vl_PDU_SUA.sUA_CODT.messageParameters.sequenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_CODT.messageParameters.sequenceNumber.reserved := '0000'O;
vl_PDU_SUA.sUA_CODT.messageParameters.sequenceNumber.recSeqNum := 0; // not used
vl_PDU_SUA.sUA_CODT.messageParameters.sequenceNumber.m := '0'B;
vl_PDU_SUA.sUA_CODT.messageParameters.sequenceNumber.sentSeqNum := 0; // not used
vl_PDU_SUA.sUA_CODT.messageParameters.sequenceNumber.spare := '0'B;
// destination ref num.
vl_PDU_SUA.sUA_CODT.messageParameters.destinationReferenceNumber.tag := '0105'O;
vl_PDU_SUA.sUA_CODT.messageParameters.destinationReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_CODT.messageParameters.destinationReferenceNumber.destinationReferenceNumber := ConnectionTable[v_session].remoteReference;
// message priority
if (ispresent(pl_N_DATA_req.importance))
{
vl_PDU_SUA.sUA_CODT.messageParameters.messagePriority.tag := '0114'O;
vl_PDU_SUA.sUA_CODT.messageParameters.messagePriority.lengthInd := 8;
vl_PDU_SUA.sUA_CODT.messageParameters.messagePriority.reserved := '000000'O;
vl_PDU_SUA.sUA_CODT.messageParameters.messagePriority.msgPriority := pl_N_DATA_req.importance;
}
else
{ vl_PDU_SUA.sUA_CODT.messageParameters.messagePriority := omit; }
// correlation Id
// FIXME!!! what to do with the correlationID???
vl_PDU_SUA.sUA_CODT.messageParameters.correlationID := omit;
// user data
// segmenting starts here
vl_data := pl_N_DATA_req.userData;
vl_len := lengthof(vl_data);
vl_from := 0;
// constant part
vl_PDU_SUA.sUA_CODT.messageParameters.data.tag := '010B'O;
vl_PDU_SUA.sUA_CODT.messageParameters.data.lengthInd := 0;
// sending data in a loop
while ( vl_len > 0 )
{
log("vl_len:",vl_len);
log("vl_from",vl_from);
if(vl_len > v_sccp_data_maxlen)
{
vl_actdatalen := v_sccp_data_maxlen;
vl_PDU_SUA.sUA_CODT.messageParameters.sequenceNumber.m := '1'B; // more data to follow in subsequent messages
}
else
{
vl_actdatalen := vl_len;
vl_PDU_SUA.sUA_CODT.messageParameters.sequenceNumber.m := '0'B;
};
vl_PDU_SUA.sUA_CODT.messageParameters.data.data := substr( vl_data, vl_from, vl_actdatalen);
SUA_PORT.send( vl_PDU_SUA );
log( "Data sent on SUA_PORT: ", vl_PDU_SUA.sUA_CODT.messageParameters.data.data);
//restart send inactivity timer
T_T_ias[v_session].stop;//to avoid warnings
T_T_ias[v_session].start;
vl_from := vl_from + vl_actdatalen;
vl_len := vl_len - vl_actdatalen;
}//while
} //sending_dataform1s_in_SUA_CODT
//******************************************************************
// REASSEMBLING
//******************************************************************
//******************************************************************
// function buffered_sending_ASP_N_DATA_ind
// counterpair of sending_dataform1s_in_SUA_CODT
//******************************************************************
function buffered_sending_ASP_N_DATA_ind( in PDU_SUA pl_pdu ) runs on SUA_CT
{
var PDU_SUA vl_PDU_SUA;
// DT1 should be put to the reassembly buffer
var integer vl_newbufflen;
log("CODT will be put to the reassembly buffer");
//log( ConnectionTable[v_session].connectionId );
vl_newbufflen :=
ConnectionTable[v_session].reassembler_buffer.actlen + pl_pdu.sUA_CODT.messageParameters.data.lengthInd;
if( vl_newbufflen <= ConnectionTable[v_session].reassembler_buffer.maxlen)
{
ConnectionTable[v_session].reassembler_buffer.buffer :=
ConnectionTable[v_session].reassembler_buffer.buffer & pl_pdu.sUA_CODT.messageParameters.data.data;
ConnectionTable[v_session].reassembler_buffer.actlen := vl_newbufflen;
log("DT1 data has been put to the reassembly buffer");
}
else
{
log("WARNING: maximum allowed buffer length exceeded!");
//stop inactivity timers
T_T_iar[v_session].stop;
T_T_ias[v_session].stop;
//assemble PDU SUA RELRE
// header
vl_PDU_SUA.sUA_RELRE.version := '01'O;
vl_PDU_SUA.sUA_RELRE.reserved := '00'O;
vl_PDU_SUA.sUA_RELRE.messageClassAndType := '0804'O;
vl_PDU_SUA.sUA_RELRE.messageLength := 0; // calculated by SUA_EncDec
// routing context
vl_PDU_SUA.sUA_RELRE.messageParameters.routingContext := v_routingContext;
// destination reference num.
vl_PDU_SUA.sUA_RELRE.messageParameters.destinationReferenceNumber.tag := '0105'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.destinationReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELRE.messageParameters.destinationReferenceNumber.destinationReferenceNumber := ConnectionTable[v_session].remoteReference;
// source reference num.
vl_PDU_SUA.sUA_RELRE.messageParameters.sourceReferenceNumber.tag := '0104'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.sourceReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELRE.messageParameters.sourceReferenceNumber.sourceReferenceNumber := ConnectionTable[v_session].localReference;
// sccp cause
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.tag := '0106'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.lengthInd := 8;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.reserved := '0000'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.causeType := releaseCause;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.causeValue := cg_Rel_remProcError;
// optional params.
vl_PDU_SUA.sUA_RELRE.messageParameters.importance := omit;
vl_PDU_SUA.sUA_RELRE.messageParameters.data := omit;
SUA_PORT.send( vl_PDU_SUA ); //send released
//start release timer
T_T_rel[v_session].start;
//change state to diconnect pending
ConnectionTable[v_session].state:=disconnect_pending;
}
if ( ispresent(pl_pdu.sUA_CODT.messageParameters.sequenceNumber) )
{
// sending:
if( pl_pdu.sUA_CODT.messageParameters.sequenceNumber.m == '0'B )
{
log("DT1/segmentingReassembl/more==0 received=> send ASP_SCCP_N_DATA comes");
//send:
SCCP_SP_PORT.send( t_ASP_N_DATA_ind(
ConnectionTable[v_session].reassembler_buffer.buffer,
ConnectionTable[v_session].connectionId,
omit));
//restart send inactivity timer
T_T_ias[v_session].stop;//to avoid warnings
T_T_ias[v_session].start;
// clear the buffer:
ConnectionTable[v_session].reassembler_buffer.buffer := ''O;
ConnectionTable[v_session].reassembler_buffer.actlen := 0;
}
else
{
log("CODT/segmentingReassembl/more==1 received=> sent to buffer only");
}
}
else
{ // sequenceNumber absent,
// no fragmentation, sending CODT data directly
SCCP_SP_PORT.send( t_ASP_N_DATA_ind(
ConnectionTable[v_session].reassembler_buffer.buffer,
ConnectionTable[v_session].connectionId,
omit));
//restart send inactivity timer
T_T_ias[v_session].stop;//to avoid warnings
T_T_ias[v_session].start;
// clear the buffer:
ConnectionTable[v_session].reassembler_buffer.buffer := ''O;
ConnectionTable[v_session].reassembler_buffer.actlen := 0;
}
}//buffered_sending_ASP_N_DATA_ind
//******************************************************************
// CONVERSIONS
//******************************************************************
//******************************************************************
// Functions coding ASP address into octetstream
//******************************************************************
function ConvertASPAddressToEncodedAddress_sourceAddr(in SCCP_PAR_Address pl_ASPAddress) runs on SUA_CT return SUA_SourceAddress
{
var SUA_SourceAddress vl_PDUAddressEncoded;
vl_PDUAddressEncoded.tag := '0102'O;
vl_PDUAddressEncoded.lengthInd := 0;
if (pl_ASPAddress.addressIndicator.routingIndicator == '0'B) // 3.4.1. of Q.713
{ vl_PDUAddressEncoded.routingIndicator := routeOnGlobalTitle }
else
{ vl_PDUAddressEncoded.routingIndicator := routeOnSSNandPC }
vl_PDUAddressEncoded.addressIndicator.spare := '0000000000000'B;
if(pl_ASPAddress.addressIndicator.globalTitleIndic == '0000'B){
vl_PDUAddressEncoded.addressIndicator.globalTitleIncluded := '0'B;
} else {
vl_PDUAddressEncoded.addressIndicator.globalTitleIncluded := '1'B;
}
vl_PDUAddressEncoded.addressIndicator.pointCodeIncluded := pl_ASPAddress.addressIndicator.pointCodeIndic;
vl_PDUAddressEncoded.addressIndicator.subSystemNumberIncluded := pl_ASPAddress.addressIndicator.ssnIndicator;
if ( ispresent(pl_ASPAddress.globalTitle) )
{
vl_PDUAddressEncoded.addressParameters.globalTitle.tag := '8001'O;
vl_PDUAddressEncoded.addressParameters.globalTitle.lengthInd := 0;
vl_PDUAddressEncoded.addressParameters.globalTitle.reserved := '000000'O;
if ( ischosen(pl_ASPAddress.globalTitle.gti0001) )
{
vl_PDUAddressEncoded.addressParameters.globalTitle.globalTitleIndicator := '00000001'B;
vl_PDUAddressEncoded.addressParameters.globalTitle.numberOfDigits := lengthof(pl_ASPAddress.globalTitle.gti0001.globalTitleAddress);
// hardcoded stuff here
vl_PDUAddressEncoded.addressParameters.globalTitle.translationType := 0; // unknown
vl_PDUAddressEncoded.addressParameters.globalTitle.numberingPlan := 0; // unknown
// hardcoded stuff here
vl_PDUAddressEncoded.addressParameters.globalTitle.natureOfAddress := bit2int(pl_ASPAddress.globalTitle.gti0001.natureOfAddress);
vl_PDUAddressEncoded.addressParameters.globalTitle.globalTitle := pl_ASPAddress.globalTitle.gti0001.globalTitleAddress;
}
else if ( ischosen(pl_ASPAddress.globalTitle.gti0010) )
{
vl_PDUAddressEncoded.addressParameters.globalTitle.globalTitleIndicator := '00000010'B;
vl_PDUAddressEncoded.addressParameters.globalTitle.numberOfDigits := lengthof(pl_ASPAddress.globalTitle.gti0010.globalTitleAddress);
vl_PDUAddressEncoded.addressParameters.globalTitle.translationType := oct2int(pl_ASPAddress.globalTitle.gti0010.translationType);
// hardcoded stuff here
vl_PDUAddressEncoded.addressParameters.globalTitle.numberingPlan := 0; // unknown
vl_PDUAddressEncoded.addressParameters.globalTitle.natureOfAddress := 0; // unknown
// hardcoded stuff here
vl_PDUAddressEncoded.addressParameters.globalTitle.globalTitle := pl_ASPAddress.globalTitle.gti0010.globalTitleAddress;
}
else if ( ischosen(pl_ASPAddress.globalTitle.gti0011) )
{
vl_PDUAddressEncoded.addressParameters.globalTitle.globalTitleIndicator := '00000011'B;
vl_PDUAddressEncoded.addressParameters.globalTitle.numberOfDigits := lengthof(pl_ASPAddress.globalTitle.gti0011.globalTitleAddress);
vl_PDUAddressEncoded.addressParameters.globalTitle.translationType := oct2int(pl_ASPAddress.globalTitle.gti0011.translationType);
vl_PDUAddressEncoded.addressParameters.globalTitle.numberingPlan := bit2int(pl_ASPAddress.globalTitle.gti0011.numberingPlan);
// hardcoded stuff here
vl_PDUAddressEncoded.addressParameters.globalTitle.natureOfAddress := 0; // unknown
// hardcoded stuff here
vl_PDUAddressEncoded.addressParameters.globalTitle.globalTitle := pl_ASPAddress.globalTitle.gti0011.globalTitleAddress;
}
else if ( ischosen(pl_ASPAddress.globalTitle.gti0100) )
{
vl_PDUAddressEncoded.addressParameters.globalTitle.globalTitleIndicator := '00000100'B;
vl_PDUAddressEncoded.addressParameters.globalTitle.numberOfDigits := lengthof(pl_ASPAddress.globalTitle.gti0100.globalTitleAddress);
vl_PDUAddressEncoded.addressParameters.globalTitle.translationType := oct2int(pl_ASPAddress.globalTitle.gti0100.translationType);
vl_PDUAddressEncoded.addressParameters.globalTitle.numberingPlan := bit2int(pl_ASPAddress.globalTitle.gti0100.numberingPlan);
vl_PDUAddressEncoded.addressParameters.globalTitle.natureOfAddress := bit2int(pl_ASPAddress.globalTitle.gti0100.natureOfAddress);
vl_PDUAddressEncoded.addressParameters.globalTitle.globalTitle := pl_ASPAddress.globalTitle.gti0100.globalTitleAddress;
}
}
else
{
vl_PDUAddressEncoded.addressParameters.globalTitle := omit;
}
if ( ispresent(pl_ASPAddress.signPointCode) )
{
vl_PDUAddressEncoded.addressParameters.pointCode.tag := '8002'O;
vl_PDUAddressEncoded.addressParameters.pointCode.lengthInd := 8;
vl_PDUAddressEncoded.addressParameters.pointCode.pointCode := int2oct(bit2int(pl_ASPAddress.signPointCode), 4);
}
else
{
vl_PDUAddressEncoded.addressParameters.pointCode := omit;
}
if ( ispresent(pl_ASPAddress.subsystemNumber) )
{
vl_PDUAddressEncoded.addressParameters.subsystemNumber.tag := '8003'O;
vl_PDUAddressEncoded.addressParameters.subsystemNumber.lengthInd := 8;
vl_PDUAddressEncoded.addressParameters.subsystemNumber.reserved := '000000'O;
vl_PDUAddressEncoded.addressParameters.subsystemNumber.sS7NValue := pl_ASPAddress.subsystemNumber;
}
else
{
vl_PDUAddressEncoded.addressParameters.subsystemNumber := omit;
}
vl_PDUAddressEncoded.addressParameters.iPv4Address := omit;
vl_PDUAddressEncoded.addressParameters.hostname := omit;
vl_PDUAddressEncoded.addressParameters.iPv6Address := omit;
return vl_PDUAddressEncoded;
} //ConvertASPAddressToEncodedAddress_sourceAddr
function ConvertASPAddressToEncodedAddress_destinationAddr(in SCCP_PAR_Address pl_ASPAddress) runs on SUA_CT return SUA_DestinationAddress
{
var SUA_DestinationAddress vl_PDUAddressEncoded;
vl_PDUAddressEncoded.tag := '0103'O;
vl_PDUAddressEncoded.lengthInd := 0;
if (pl_ASPAddress.addressIndicator.routingIndicator == '0'B) // 3.4.1. of Q.713
{ vl_PDUAddressEncoded.routingIndicator := routeOnGlobalTitle }
else
{ vl_PDUAddressEncoded.routingIndicator := routeOnSSNandPC }
vl_PDUAddressEncoded.addressIndicator.spare := '0000000000000'B;
if(pl_ASPAddress.addressIndicator.globalTitleIndic == '0000'B){
vl_PDUAddressEncoded.addressIndicator.globalTitleIncluded := '0'B;
} else {
vl_PDUAddressEncoded.addressIndicator.globalTitleIncluded := '1'B;
}
vl_PDUAddressEncoded.addressIndicator.pointCodeIncluded := pl_ASPAddress.addressIndicator.pointCodeIndic;
vl_PDUAddressEncoded.addressIndicator.subSystemNumberIncluded := pl_ASPAddress.addressIndicator.ssnIndicator;
if ( ispresent(pl_ASPAddress.globalTitle) )
{
vl_PDUAddressEncoded.addressParameters.globalTitle.tag := '8001'O;
vl_PDUAddressEncoded.addressParameters.globalTitle.lengthInd := 0;
vl_PDUAddressEncoded.addressParameters.globalTitle.reserved := '000000'O;
if ( ischosen(pl_ASPAddress.globalTitle.gti0001) )
{
vl_PDUAddressEncoded.addressParameters.globalTitle.globalTitleIndicator := '00000001'B;
vl_PDUAddressEncoded.addressParameters.globalTitle.numberOfDigits := lengthof(pl_ASPAddress.globalTitle.gti0001.globalTitleAddress);
// hardcoded stuff here
vl_PDUAddressEncoded.addressParameters.globalTitle.translationType := 0; // unknown
vl_PDUAddressEncoded.addressParameters.globalTitle.numberingPlan := 0; // unknown
// hardcoded stuff here
vl_PDUAddressEncoded.addressParameters.globalTitle.natureOfAddress := bit2int(pl_ASPAddress.globalTitle.gti0001.natureOfAddress);
vl_PDUAddressEncoded.addressParameters.globalTitle.globalTitle := pl_ASPAddress.globalTitle.gti0001.globalTitleAddress;
}
else if ( ischosen(pl_ASPAddress.globalTitle.gti0010) )
{
vl_PDUAddressEncoded.addressParameters.globalTitle.globalTitleIndicator := '00000010'B;
vl_PDUAddressEncoded.addressParameters.globalTitle.numberOfDigits := lengthof(pl_ASPAddress.globalTitle.gti0010.globalTitleAddress);
vl_PDUAddressEncoded.addressParameters.globalTitle.translationType := oct2int(pl_ASPAddress.globalTitle.gti0010.translationType);
// hardcoded stuff here
vl_PDUAddressEncoded.addressParameters.globalTitle.numberingPlan := 0; // unknown
vl_PDUAddressEncoded.addressParameters.globalTitle.natureOfAddress := 0; // unknown
// hardcoded stuff here
vl_PDUAddressEncoded.addressParameters.globalTitle.globalTitle := pl_ASPAddress.globalTitle.gti0010.globalTitleAddress;
}
else if ( ischosen(pl_ASPAddress.globalTitle.gti0011) )
{
vl_PDUAddressEncoded.addressParameters.globalTitle.globalTitleIndicator := '00000011'B;
vl_PDUAddressEncoded.addressParameters.globalTitle.numberOfDigits := lengthof(pl_ASPAddress.globalTitle.gti0011.globalTitleAddress);
vl_PDUAddressEncoded.addressParameters.globalTitle.translationType := oct2int(pl_ASPAddress.globalTitle.gti0011.translationType);
vl_PDUAddressEncoded.addressParameters.globalTitle.numberingPlan := bit2int(pl_ASPAddress.globalTitle.gti0011.numberingPlan);
// hardcoded stuff here
vl_PDUAddressEncoded.addressParameters.globalTitle.natureOfAddress := 0; // unknown
// hardcoded stuff here
vl_PDUAddressEncoded.addressParameters.globalTitle.globalTitle := pl_ASPAddress.globalTitle.gti0011.globalTitleAddress;
}
else if ( ischosen(pl_ASPAddress.globalTitle.gti0100) )
{
vl_PDUAddressEncoded.addressParameters.globalTitle.globalTitleIndicator := '00000100'B;
vl_PDUAddressEncoded.addressParameters.globalTitle.numberOfDigits := lengthof(pl_ASPAddress.globalTitle.gti0100.globalTitleAddress);
vl_PDUAddressEncoded.addressParameters.globalTitle.translationType := oct2int(pl_ASPAddress.globalTitle.gti0100.translationType);
vl_PDUAddressEncoded.addressParameters.globalTitle.numberingPlan := bit2int(pl_ASPAddress.globalTitle.gti0100.numberingPlan);
vl_PDUAddressEncoded.addressParameters.globalTitle.natureOfAddress := bit2int(pl_ASPAddress.globalTitle.gti0100.natureOfAddress);
vl_PDUAddressEncoded.addressParameters.globalTitle.globalTitle := pl_ASPAddress.globalTitle.gti0100.globalTitleAddress;
}
}
else
{
vl_PDUAddressEncoded.addressParameters.globalTitle := omit;
}
if ( ispresent(pl_ASPAddress.signPointCode) )
{
vl_PDUAddressEncoded.addressParameters.pointCode.tag := '8002'O;
vl_PDUAddressEncoded.addressParameters.pointCode.lengthInd := 8;
vl_PDUAddressEncoded.addressParameters.pointCode.pointCode := int2oct(bit2int(pl_ASPAddress.signPointCode), 4);
}
else
{
vl_PDUAddressEncoded.addressParameters.pointCode := omit;
}
if ( ispresent(pl_ASPAddress.subsystemNumber) )
{
vl_PDUAddressEncoded.addressParameters.subsystemNumber.tag := '8003'O;
vl_PDUAddressEncoded.addressParameters.subsystemNumber.lengthInd := 8;
vl_PDUAddressEncoded.addressParameters.subsystemNumber.reserved := '000000'O;
vl_PDUAddressEncoded.addressParameters.subsystemNumber.sS7NValue := pl_ASPAddress.subsystemNumber;
}
else
{
vl_PDUAddressEncoded.addressParameters.subsystemNumber := omit;
}
vl_PDUAddressEncoded.addressParameters.iPv4Address := omit;
vl_PDUAddressEncoded.addressParameters.hostname := omit;
vl_PDUAddressEncoded.addressParameters.iPv6Address := omit;
return vl_PDUAddressEncoded;
} //ConvertASPAddressToEncodedAddress_destinationAddr
//******************************************************************
// CONVERSION / DECODING
//******************************************************************
//******************************************************************
// function ConvertPDUEncodedAddressToASPAddress
// converts Encoded PDU Address into sturctured ASP Address
// THIS IS THE MAIN DECODE FUNCTION (coordinator)
//******************************************************************
function ConvertPDUEncodedAddressToASPAddress_destinationAddr(in SUA_DestinationAddress pl_PDUAddress) runs on SUA_CT return SCCP_PAR_Address
{
var SCCP_PAR_Address vl_ASPAddress;
if (pl_PDUAddress.routingIndicator == routeOnGlobalTitle)
{ vl_ASPAddress.addressIndicator.routingIndicator := '0'B; }
else if (pl_PDUAddress.routingIndicator == routeOnSSNandPC)
{ vl_ASPAddress.addressIndicator.routingIndicator := '1'B; }
else
{ log("Unsupported Routing Indicator in SUA_DestinationAddress!"); stop; }
vl_ASPAddress.addressIndicator.pointCodeIndic := pl_PDUAddress.addressIndicator.pointCodeIncluded;
vl_ASPAddress.addressIndicator.ssnIndicator := pl_PDUAddress.addressIndicator.subSystemNumberIncluded;
if ( (pl_PDUAddress.addressIndicator.globalTitleIncluded == '1'B) and (ispresent(pl_PDUAddress.addressParameters.globalTitle)) )
{
if ( bit2int(pl_PDUAddress.addressParameters.globalTitle.globalTitleIndicator) == 1 )
{
vl_ASPAddress.addressIndicator.globalTitleIndic := '0001'B;
vl_ASPAddress.globalTitle.gti0001.natureOfAddress := int2bit(pl_PDUAddress.addressParameters.globalTitle.natureOfAddress, 7);
if ((pl_PDUAddress.addressParameters.globalTitle.numberOfDigits mod 2) == 1)
{ vl_ASPAddress.globalTitle.gti0001.oddeven := '1'B; }
else
{ vl_ASPAddress.globalTitle.gti0001.oddeven := '0'B; }
vl_ASPAddress.globalTitle.gti0001.globalTitleAddress := pl_PDUAddress.addressParameters.globalTitle.globalTitle;
}
else if ( bit2int(pl_PDUAddress.addressParameters.globalTitle.globalTitleIndicator) == 2 )
{
vl_ASPAddress.addressIndicator.globalTitleIndic := '0010'B;
vl_ASPAddress.globalTitle.gti0010.translationType := int2oct(pl_PDUAddress.addressParameters.globalTitle.translationType, 1);
vl_ASPAddress.globalTitle.gti0010.globalTitleAddress := pl_PDUAddress.addressParameters.globalTitle.globalTitle;
}
else if ( bit2int(pl_PDUAddress.addressParameters.globalTitle.globalTitleIndicator) == 3 )
{
vl_ASPAddress.addressIndicator.globalTitleIndic := '0011'B;
vl_ASPAddress.globalTitle.gti0011.translationType := int2oct(pl_PDUAddress.addressParameters.globalTitle.translationType, 1);
if ((pl_PDUAddress.addressParameters.globalTitle.numberOfDigits mod 2) == 1)
{ vl_ASPAddress.globalTitle.gti0011.encodingScheme := '0001'B }
else
{ vl_ASPAddress.globalTitle.gti0011.encodingScheme := '0010'B }
vl_ASPAddress.globalTitle.gti0011.numberingPlan := int2bit(pl_PDUAddress.addressParameters.globalTitle.numberingPlan, 4);
vl_ASPAddress.globalTitle.gti0011.globalTitleAddress := pl_PDUAddress.addressParameters.globalTitle.globalTitle;
}
else if ( bit2int(pl_PDUAddress.addressParameters.globalTitle.globalTitleIndicator) == 4 )
{
vl_ASPAddress.addressIndicator.globalTitleIndic := '0100'B;
vl_ASPAddress.globalTitle.gti0100.translationType := int2oct(pl_PDUAddress.addressParameters.globalTitle.translationType, 1);
if ((pl_PDUAddress.addressParameters.globalTitle.numberOfDigits mod 2) == 1)
{ vl_ASPAddress.globalTitle.gti0100.encodingScheme := '0001'B }
else
{ vl_ASPAddress.globalTitle.gti0100.encodingScheme := '0010'B }
vl_ASPAddress.globalTitle.gti0100.numberingPlan := int2bit(pl_PDUAddress.addressParameters.globalTitle.numberingPlan, 4);
vl_ASPAddress.globalTitle.gti0100.natureOfAddress := int2bit(pl_PDUAddress.addressParameters.globalTitle.natureOfAddress, 7);
vl_ASPAddress.globalTitle.gti0100.globalTitleAddress := pl_PDUAddress.addressParameters.globalTitle.globalTitle;
}
else
{
vl_ASPAddress.addressIndicator.globalTitleIndic := '0000'B;
vl_ASPAddress.globalTitle := omit;
}
}
else
{
vl_ASPAddress.addressIndicator.globalTitleIndic := '0000'B;
vl_ASPAddress.globalTitle := omit;
}
if ( ispresent(pl_PDUAddress.addressParameters.pointCode) )
{ vl_ASPAddress.signPointCode := oct2bit(pl_PDUAddress.addressParameters.pointCode.pointCode); }
else
{ vl_ASPAddress.signPointCode := omit; }
if ( ispresent(pl_PDUAddress.addressParameters.subsystemNumber) )
{ vl_ASPAddress.subsystemNumber := pl_PDUAddress.addressParameters.subsystemNumber.sS7NValue; }
else
{ vl_ASPAddress.subsystemNumber := omit; }
return vl_ASPAddress;
}//ConvertPDUEncodedAddressToASPAddress_destinationAddr
function ConvertPDUEncodedAddressToASPAddress_sourceAddr(in SUA_SourceAddress pl_PDUAddress) runs on SUA_CT return SCCP_PAR_Address
{
var SCCP_PAR_Address vl_ASPAddress;
if (pl_PDUAddress.routingIndicator == routeOnGlobalTitle)
{ vl_ASPAddress.addressIndicator.routingIndicator := '0'B; }
else if (pl_PDUAddress.routingIndicator == routeOnSSNandPC)
{ vl_ASPAddress.addressIndicator.routingIndicator := '1'B; }
else
{ log("Unsupported Routing Indicator in SUA_DestinationAddress!"); stop; }
vl_ASPAddress.addressIndicator.pointCodeIndic := pl_PDUAddress.addressIndicator.pointCodeIncluded;
vl_ASPAddress.addressIndicator.ssnIndicator := pl_PDUAddress.addressIndicator.subSystemNumberIncluded;
if ( (pl_PDUAddress.addressIndicator.globalTitleIncluded == '1'B) and (ispresent(pl_PDUAddress.addressParameters.globalTitle)) )
{
if ( bit2int(pl_PDUAddress.addressParameters.globalTitle.globalTitleIndicator) == 1 )
{
vl_ASPAddress.addressIndicator.globalTitleIndic := '0001'B;
vl_ASPAddress.globalTitle.gti0001.natureOfAddress := int2bit(pl_PDUAddress.addressParameters.globalTitle.natureOfAddress, 7);
if ((pl_PDUAddress.addressParameters.globalTitle.numberOfDigits mod 2) == 1)
{ vl_ASPAddress.globalTitle.gti0001.oddeven := '1'B; }
else
{ vl_ASPAddress.globalTitle.gti0001.oddeven := '0'B; }
vl_ASPAddress.globalTitle.gti0001.globalTitleAddress := pl_PDUAddress.addressParameters.globalTitle.globalTitle;
}
else if ( bit2int(pl_PDUAddress.addressParameters.globalTitle.globalTitleIndicator) == 2 )
{
vl_ASPAddress.addressIndicator.globalTitleIndic := '0010'B;
vl_ASPAddress.globalTitle.gti0010.translationType := int2oct(pl_PDUAddress.addressParameters.globalTitle.translationType, 1);
vl_ASPAddress.globalTitle.gti0010.globalTitleAddress := pl_PDUAddress.addressParameters.globalTitle.globalTitle;
}
else if ( bit2int(pl_PDUAddress.addressParameters.globalTitle.globalTitleIndicator) == 3 )
{
vl_ASPAddress.addressIndicator.globalTitleIndic := '0011'B;
vl_ASPAddress.globalTitle.gti0011.translationType := int2oct(pl_PDUAddress.addressParameters.globalTitle.translationType, 1);
if ((pl_PDUAddress.addressParameters.globalTitle.numberOfDigits mod 2) == 1)
{ vl_ASPAddress.globalTitle.gti0011.encodingScheme := '0001'B }
else
{ vl_ASPAddress.globalTitle.gti0011.encodingScheme := '0010'B }
vl_ASPAddress.globalTitle.gti0011.numberingPlan := int2bit(pl_PDUAddress.addressParameters.globalTitle.numberingPlan, 4);
vl_ASPAddress.globalTitle.gti0011.globalTitleAddress := pl_PDUAddress.addressParameters.globalTitle.globalTitle;
}
else if ( bit2int(pl_PDUAddress.addressParameters.globalTitle.globalTitleIndicator) == 4 )
{
vl_ASPAddress.addressIndicator.globalTitleIndic := '0100'B;
vl_ASPAddress.globalTitle.gti0100.translationType := int2oct(pl_PDUAddress.addressParameters.globalTitle.translationType, 1);
if ((pl_PDUAddress.addressParameters.globalTitle.numberOfDigits mod 2) == 1)
{ vl_ASPAddress.globalTitle.gti0100.encodingScheme := '0001'B }
else
{ vl_ASPAddress.globalTitle.gti0100.encodingScheme := '0010'B }
vl_ASPAddress.globalTitle.gti0100.numberingPlan := int2bit(pl_PDUAddress.addressParameters.globalTitle.numberingPlan, 4);
vl_ASPAddress.globalTitle.gti0100.natureOfAddress := int2bit(pl_PDUAddress.addressParameters.globalTitle.natureOfAddress, 7);
vl_ASPAddress.globalTitle.gti0100.globalTitleAddress := pl_PDUAddress.addressParameters.globalTitle.globalTitle;
}
else
{
vl_ASPAddress.addressIndicator.globalTitleIndic := '0000'B;
vl_ASPAddress.globalTitle := omit;
}
}
else
{
vl_ASPAddress.addressIndicator.globalTitleIndic := '0000'B;
vl_ASPAddress.globalTitle := omit;
}
if ( ispresent(pl_PDUAddress.addressParameters.pointCode) )
{ vl_ASPAddress.signPointCode := oct2bit(pl_PDUAddress.addressParameters.pointCode.pointCode); }
else
{ vl_ASPAddress.signPointCode := omit; }
if ( ispresent(pl_PDUAddress.addressParameters.subsystemNumber) )
{ vl_ASPAddress.subsystemNumber := pl_PDUAddress.addressParameters.subsystemNumber.sS7NValue; }
else
{ vl_ASPAddress.subsystemNumber := omit; }
return vl_ASPAddress;
}//ConvertPDUEncodedAddressToASPAddress_sourceAddr
//******************************************************************
//
// working functions for ScanEvents
//
//******************************************************************
//******************************************************************
// Part 1 : Functions for handling incoming SUA PDUs
//******************************************************************
//******************************************************************
// processing_PDU_SUA_CLDT
//******************************************************************
function processing_PDU_SUA_CLDT(PDU_SUA pl_pdu) runs on SUA_CT
{
var ASP_SCCP_N_UNITDATA_ind vl_N_UNITDATA_ind;
var octetstring vl_data;
var PDU_SUA vl_PDU_SUA;
// called address
vl_N_UNITDATA_ind.calledAddress :=
ConvertPDUEncodedAddressToASPAddress_destinationAddr(pl_pdu.sUA_CLDT.messageParameters.destinationAddress);
if ( ispresent(vl_N_UNITDATA_ind.calledAddress.subsystemNumber) and
vl_N_UNITDATA_ind.calledAddress.subsystemNumber != cg_SSN_sCCPmanagement)
// not a SCCP mgmt message
{//startif1
// calling address
vl_N_UNITDATA_ind.callingAddress:=
ConvertPDUEncodedAddressToASPAddress_sourceAddr(pl_pdu.sUA_CLDT.messageParameters.sourceAddress);
// sequence control
vl_N_UNITDATA_ind.sequenceControl:=
'000000'B&pl_pdu.sUA_CLDT.messageParameters.protocolClass.protocolClass;// pl_PDU_SCCP_Unitdata.protClass.class[3];
// return option
if(pl_pdu.sUA_CLDT.messageParameters.protocolClass.returnMessageOnError == '1'B) //( pl_PDU_SCCP_Unitdata.protClass.messageHandling == '1000'B )
{ vl_N_UNITDATA_ind.returnOption := '00000001'B; }
else
{ vl_N_UNITDATA_ind.returnOption := '00000000'B; }
// user data
vl_N_UNITDATA_ind.userData := pl_pdu.sUA_CLDT.messageParameters.data.data;
// importance
if( ispresent(pl_pdu.sUA_CLDT.messageParameters.importance) )
{ vl_N_UNITDATA_ind.importance := pl_pdu.sUA_CLDT.messageParameters.importance.importance; }
else
{ vl_N_UNITDATA_ind.importance := omit; }
// all the other fields in pl_pdu.sUA_CLDT are ignored
SCCP_SP_PORT.send( vl_N_UNITDATA_ind );
}//endif1
else
{ //startelse1-SCCPmanagement message
log ("SCCP management message received.");
// assemble a sua CLDT answer
// constant header
vl_PDU_SUA.sUA_CLDT.version := '01'O;
vl_PDU_SUA.sUA_CLDT.reserved := '00'O;
vl_PDU_SUA.sUA_CLDT.messageClassAndType := '0701'O;
vl_PDU_SUA.sUA_CLDT.messageLength := 0; // calculated in test port
// routing context
vl_PDU_SUA.sUA_CLDT.messageParameters.routingContext := v_routingContext;
// protocol class
vl_PDU_SUA.sUA_CLDT.messageParameters.protocolClass := pl_pdu.sUA_CLDT.messageParameters.protocolClass;
// flip the addresses
// source address
vl_PDU_SUA.sUA_CLDT.messageParameters.sourceAddress.tag := '0102'O;
vl_PDU_SUA.sUA_CLDT.messageParameters.sourceAddress.lengthInd := 0;
vl_PDU_SUA.sUA_CLDT.messageParameters.sourceAddress.routingIndicator := pl_pdu.sUA_CLDT.messageParameters.destinationAddress.routingIndicator;
vl_PDU_SUA.sUA_CLDT.messageParameters.sourceAddress.addressIndicator := pl_pdu.sUA_CLDT.messageParameters.destinationAddress.addressIndicator;
vl_PDU_SUA.sUA_CLDT.messageParameters.sourceAddress.addressParameters := pl_pdu.sUA_CLDT.messageParameters.destinationAddress.addressParameters;
// destination address
vl_PDU_SUA.sUA_CLDT.messageParameters.destinationAddress.tag := '0103'O;
vl_PDU_SUA.sUA_CLDT.messageParameters.destinationAddress.lengthInd := 0;
vl_PDU_SUA.sUA_CLDT.messageParameters.destinationAddress.routingIndicator := pl_pdu.sUA_CLDT.messageParameters.sourceAddress.routingIndicator;
vl_PDU_SUA.sUA_CLDT.messageParameters.destinationAddress.addressIndicator := pl_pdu.sUA_CLDT.messageParameters.sourceAddress.addressIndicator;
vl_PDU_SUA.sUA_CLDT.messageParameters.destinationAddress.addressParameters := pl_pdu.sUA_CLDT.messageParameters.sourceAddress.addressParameters;
// sequence control
vl_PDU_SUA.sUA_CLDT.messageParameters.sequenceControl := pl_pdu.sUA_CLDT.messageParameters.sequenceControl;
// optional fields
vl_PDU_SUA.sUA_CLDT.messageParameters.sS7HopCounter := omit;
vl_PDU_SUA.sUA_CLDT.messageParameters.importance := omit;
vl_PDU_SUA.sUA_CLDT.messageParameters.messagePriority := omit;
vl_PDU_SUA.sUA_CLDT.messageParameters.correlationID := omit;
vl_PDU_SUA.sUA_CLDT.messageParameters.segmentation := omit;
// payload
vl_PDU_SUA.sUA_CLDT.messageParameters.data.tag := '010B'O;
vl_PDU_SUA.sUA_CLDT.messageParameters.data.lengthInd := 0;
vl_data := pl_pdu.sUA_CLDT.messageParameters.data.data;
if ((vl_data[0]=='03'O) and //SST message
((v_SSN==0) or (oct2int(vl_data[1])==v_SSN))) //right SSN
{//startif2
//send Unitdata with SSA
vl_PDU_SUA.sUA_CLDT.messageParameters.data.data:='01'O;//Change to SSA
SUA_PORT.send( vl_PDU_SUA );//send Unitdata_SSA
}//endif2
else if ((vl_data[0]=='02'O) and //SSP message
((v_SSN==0) or (oct2int(vl_data[1])==v_SSN))) //right SSN
{//startif2
//send Unitdata with SST
vl_PDU_SUA.sUA_CLDT.messageParameters.data.data:='03'O;//Change to SST
SUA_PORT.send( vl_PDU_SUA );//send Unitdata_SST
}//endif2
else if ((vl_data[0]=='01'O) and //SSA message
((v_SSN==0) or (oct2int(vl_data[1])==v_SSN))) //right SSN
{//startif2
vl_PDU_SUA.sUA_CLDT.messageParameters.data.data:='00'O; // ??
//send Unitdata with SS
SUA_PORT.send( vl_PDU_SUA );//send Unitdata_SSA
}//endif2
else
{
log("Unsupported (or containing an inconsistent SSN) SCCP management message received and discarded")
}
}//endelse1
return;
}
//******************************************************************
// processing_PDU_SUA_CLDR
//******************************************************************
function processing_PDU_SUA_CLDR(PDU_SUA pl_pdu) runs on SUA_CT
{
var ASP_SCCP_N_NOTICE_ind vl_N_NOTICE_ind;
vl_N_NOTICE_ind.calledAddress :=ConvertPDUEncodedAddressToASPAddress_destinationAddr(pl_pdu.sUA_CLDR.messageParameters.destinationAddress);
vl_N_NOTICE_ind.callingAddress:=ConvertPDUEncodedAddressToASPAddress_sourceAddr(pl_pdu.sUA_CLDR.messageParameters.sourceAddress);
vl_N_NOTICE_ind.reasonForReturn := pl_pdu.sUA_CLDR.messageParameters.sCCPCause.causeValue;
if ( ispresent(pl_pdu.sUA_CLDR.messageParameters.data) )
{ vl_N_NOTICE_ind.userData := pl_pdu.sUA_CLDR.messageParameters.data.data; }
else
{ vl_N_NOTICE_ind.userData := ''O; }
if ( ispresent(pl_pdu.sUA_CLDR.messageParameters.importance) )
{ vl_N_NOTICE_ind.importance := pl_pdu.sUA_CLDR.messageParameters.importance.importance; }
else
{ vl_N_NOTICE_ind.importance := omit; }
SCCP_SP_PORT.send( vl_N_NOTICE_ind );
}
//******************************************************************
// processing_PDU_SUA_CORE
//******************************************************************
function processing_PDU_SUA_CORE(PDU_SUA pl_pdu) runs on SUA_CT
{
//no SCCP or node congestion assumed
//we assume that routing is done on SSN; we are in the dest.node
//check if connection already established
//local reference not assigned yet; search has to be done based on remote reference,
// to prevent erroneous situations
if (ConnectionAlreadyEstablished_remote(pl_pdu.sUA_CORE.messageParameters.sourceReferenceNumber.sourceReferenceNumber))
{//startif3
v_session :=Retrieve_session_remote(pl_pdu.sUA_CORE.messageParameters.sourceReferenceNumber.sourceReferenceNumber);
//Action Table follows
if (ConnectionTable[v_session].state==idle)
{ log("CR received with reference for an already established conn. in state:idle");}//no source ref known
else if (ConnectionTable[v_session].state==active)
{ log("CR received with reference for an already established conn. in state:active");}
else if (ConnectionTable[v_session].state==reset_bothway)
{ log("CR received with reference for an already established conn. in state:reset_bothway");}
else if (ConnectionTable[v_session].state==connection_pending_IC)
{ log("CR received with reference for an already established conn. in state:connection_pending_IC");}
//discard message, return
else if (ConnectionTable[v_session].state==disconnect_pending)
{ log("CR received with reference for an already established conn. in state:disconnect_pending");}//discard message, return
else if (ConnectionTable[v_session].state==reset_IC) {//startif4
//discard received message
T_T_internal_reset[v_session].start(0.0);//the dummy timer times out immediately
//state changed to active
ConnectionTable[v_session].state:=active;
}//endif4
else if (ConnectionTable[v_session].state==wait_conn_confirm)
{//startif4
//stop connection timer
T_T_conn_est[v_session].stop;
//release resources
ReleaseResources(v_session);
}//endif4
}//endif3
else {//startelse
//connection not yet established - new v_session
//check if resources available
v_session:=CheckIdleIndividuals()
//idle individual found , resources available, 0<=v_session<=15
if ( v_session!=-1 )
{//startif3
//
ConnectionTable[v_session].localReference := GenerateLocalReference();
ConnectionTable[v_session].remoteReference := pl_pdu.sUA_CORE.messageParameters.sourceReferenceNumber.sourceReferenceNumber;
//local reference assigned here!!(see Fig. C.3/Q714)
ConnectionTable[v_session].connectionId := GenerateConnectionId();
//once local reference is assigned , a session is considered established
//determine protocol class
//start guard timer T_guard ;if no answer to ASP_SCCP_N_CONNECT_ind is received, timer will release
var ASP_SCCP_N_CONNECT_ind vl_N_CONNECT_ind;
T_guard[v_session].start;
vl_N_CONNECT_ind.calledAddress:=ConvertPDUEncodedAddressToASPAddress_destinationAddr(pl_pdu.sUA_CORE.messageParameters.destinationAddress);
if (ispresent(pl_pdu.sUA_CORE.messageParameters.sourceAddress))
{//startif4
vl_N_CONNECT_ind.callingAddress := ConvertPDUEncodedAddressToASPAddress_sourceAddr(pl_pdu.sUA_CORE.messageParameters.sourceAddress);
}//endif4
else { vl_N_CONNECT_ind.callingAddress := omit; }
vl_N_CONNECT_ind.qualityOfService := omit;
if (ispresent(pl_pdu.sUA_CORE.messageParameters.data))
{//startif4
vl_N_CONNECT_ind.userData := pl_pdu.sUA_CORE.messageParameters.data.data;
}//endif4
else { vl_N_CONNECT_ind.userData := omit; }
vl_N_CONNECT_ind.connectionId := ConnectionTable[v_session].connectionId;
vl_N_CONNECT_ind.importance := omit;
SCCP_SP_PORT.send( vl_N_CONNECT_ind ); //send ASP_SCCP_N_CONNECT_ind
//restart send inactivity timer (baat)
T_T_ias[v_session].stop;//to avoid warnings
T_T_ias[v_session].start;
ConnectionTable[v_session].state := connection_pending_IC;
}//endif3
//no idle individual found , no resources available , v_session=-1
if (v_session==-1)
{//startif3
var PDU_SUA vl_PDU_SUA;
//assemble sua COREF
vl_PDU_SUA.sUA_COREF.version := '01'O;
vl_PDU_SUA.sUA_COREF.reserved := '00'O;
vl_PDU_SUA.sUA_COREF.messageClassAndType := '0803'O;
vl_PDU_SUA.sUA_COREF.messageLength := 0;
// routing context
vl_PDU_SUA.sUA_COREF.messageParameters.routingContext := v_routingContext;
// destination ref num.
vl_PDU_SUA.sUA_COREF.messageParameters.destinationReferenceNumber.tag := '0105'O;
vl_PDU_SUA.sUA_COREF.messageParameters.destinationReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_COREF.messageParameters.destinationReferenceNumber.destinationReferenceNumber := ConnectionTable[v_session].remoteReference;
// sccp cause
vl_PDU_SUA.sUA_COREF.messageParameters.sCCPCause.tag := '0106'O;
vl_PDU_SUA.sUA_COREF.messageParameters.sCCPCause.lengthInd := 8;
vl_PDU_SUA.sUA_COREF.messageParameters.sCCPCause.reserved := '0000'O;
vl_PDU_SUA.sUA_COREF.messageParameters.sCCPCause.causeType := refusalCause;
vl_PDU_SUA.sUA_COREF.messageParameters.sCCPCause.causeValue := cg_Ref_endUserConges;
// optional params.
vl_PDU_SUA.sUA_COREF.messageParameters.importance := omit;
vl_PDU_SUA.sUA_COREF.messageParameters.data := omit;
SUA_PORT.send ( vl_PDU_SUA ); //Connection refused, no idle individuals
//return to idle
}//endif3
}//endelse
}
//******************************************************************
// processing_PDU_SUA_COAK
//******************************************************************
function processing_PDU_SUA_COAK(PDU_SUA pl_pdu) runs on SUA_CT
{
var PDU_SUA vl_PDU_SUA;
var ASP_SCCP_N_CONNECT_cfm vl_N_CONNECT_cfm;
log(pl_pdu.sUA_COAK)
//check if connection already established
if (ConnectionAlreadyEstablished_remote(pl_pdu.sUA_COAK.messageParameters.sourceReferenceNumber.sourceReferenceNumber))
{//startif2
v_session := Retrieve_session_remote(pl_pdu.sUA_COAK.messageParameters.sourceReferenceNumber.sourceReferenceNumber);
//Action Table follows
if (ConnectionTable[v_session].state==idle)
{
//assemble sua COERR
vl_PDU_SUA.sUA_COERR.version := '01'O;
vl_PDU_SUA.sUA_COERR.reserved := '00'O;
vl_PDU_SUA.sUA_COERR.messageClassAndType := '080A'O;
vl_PDU_SUA.sUA_COERR.messageLength := 0;
// routing context
vl_PDU_SUA.sUA_COERR.messageParameters.routingContext := v_routingContext;
// destination ref num.
vl_PDU_SUA.sUA_COERR.messageParameters.destinationReferenceNumber.tag := '0105'O;
vl_PDU_SUA.sUA_COERR.messageParameters.destinationReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_COERR.messageParameters.destinationReferenceNumber.destinationReferenceNumber := ConnectionTable[v_session].remoteReference;
// sccp cause
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.tag := '0106'O;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.lengthInd := 8;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.reserved := '0000'O;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.causeType := errorCause;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.causeValue := cg_Err_unassignedDestinationLRN;
SUA_PORT.send( vl_PDU_SUA ); //Send Error
//then return to idle
}
else if (ConnectionTable[v_session].state==connection_pending_IC)
{ log("CC received in state:connection_pending_IC"); }//discard message, return
else if (ConnectionTable[v_session].state==disconnect_pending)
{ log("CC received in state:disconnect_pending"); }//discard message, return
else if (ConnectionTable[v_session].state==active)
{ log("CC received in state:active"); }//do nothing, return
else if (ConnectionTable[v_session].state==reset_bothway)
{ log("CC received in state:reset_bothway"); }//
else if (ConnectionTable[v_session].state==connection_pending_OG)
{//startif3
//stop connection timer
T_T_conn_est[v_session].stop;
//start inactivity timers
T_T_ias[v_session].start;
T_T_iar[v_session].start;
//assign protocol class:=2, associate remote reference
ConnectionTable[v_session].remoteReference := pl_pdu.sUA_COAK.messageParameters.sourceReferenceNumber.sourceReferenceNumber;
//assemble ASP_SCCP
vl_N_CONNECT_cfm.respondingAddress := omit;
vl_N_CONNECT_cfm.qualityOfService := omit;
vl_N_CONNECT_cfm.userData := omit;
vl_N_CONNECT_cfm.connectionId := ConnectionTable[v_session].connectionId;
vl_N_CONNECT_cfm.importance := omit;
SCCP_SP_PORT.send( vl_N_CONNECT_cfm ); //send ASP_SCCP_N_CONNECT_confirm
ConnectionTable[v_session].state := active;
}//endif3
else if (ConnectionTable[v_session].state==wait_conn_confirm)//connection is confirmed ,
// but it has meanwhile been disconnected by the user
{//startif3
//stop connection timer
T_T_conn_est[v_session].stop;
//associate remote reference to connection
ConnectionTable[v_session].remoteReference := pl_pdu.sUA_COAK.messageParameters.sourceReferenceNumber.sourceReferenceNumber;
//assemble sua RELRE
// header
vl_PDU_SUA.sUA_RELRE.version := '01'O;
vl_PDU_SUA.sUA_RELRE.reserved := '00'O;
vl_PDU_SUA.sUA_RELRE.messageClassAndType := '0804'O;
vl_PDU_SUA.sUA_RELRE.messageLength := 0; // calculated by SUA_EncDec
// routing context
vl_PDU_SUA.sUA_RELRE.messageParameters.routingContext := v_routingContext;
// destination reference num.
vl_PDU_SUA.sUA_RELRE.messageParameters.destinationReferenceNumber.tag := '0105'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.destinationReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELRE.messageParameters.destinationReferenceNumber.destinationReferenceNumber := ConnectionTable[v_session].remoteReference;
// source reference num.
vl_PDU_SUA.sUA_RELRE.messageParameters.sourceReferenceNumber.tag := '0104'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.sourceReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELRE.messageParameters.sourceReferenceNumber.sourceReferenceNumber := ConnectionTable[v_session].localReference;
// sccp cause
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.tag := '0106'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.lengthInd := 8;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.reserved := '0000'O;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.causeType := releaseCause;
vl_PDU_SUA.sUA_RELRE.messageParameters.sCCPCause.causeValue := cg_DISC_normal;
// optional params.
vl_PDU_SUA.sUA_RELRE.messageParameters.importance := omit;
vl_PDU_SUA.sUA_RELRE.messageParameters.data := omit;
SUA_PORT.send( vl_PDU_SUA ); //send Released
//start release timer
T_T_rel[v_session].start;
ConnectionTable[v_session].state:=disconnect_pending;
}//endif3
else if (ConnectionTable[v_session].state==reset_IC)
{//startif3
//discard received message
T_T_internal_reset[v_session].start(0.0);//the timer times out immediately
//state changed to active
ConnectionTable[v_session].state:=active;
}//endif3
else { log("CC received in an unexpected state"); }
}//endif2
else {//startelse -Connection confirm received with destLocRef not in ConnectionTable
//send COERR
vl_PDU_SUA.sUA_COERR.version := '01'O;
vl_PDU_SUA.sUA_COERR.reserved := '00'O;
vl_PDU_SUA.sUA_COERR.messageClassAndType := '080A'O;
vl_PDU_SUA.sUA_COERR.messageLength := 0;
// routing context
vl_PDU_SUA.sUA_COERR.messageParameters.routingContext := v_routingContext;
// destination ref num.
vl_PDU_SUA.sUA_COERR.messageParameters.destinationReferenceNumber.tag := '0105'O;
vl_PDU_SUA.sUA_COERR.messageParameters.destinationReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_COERR.messageParameters.destinationReferenceNumber.destinationReferenceNumber := pl_pdu.sUA_COAK.messageParameters.sourceReferenceNumber.sourceReferenceNumber;
// sccp cause
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.tag := '0106'O;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.lengthInd := 8;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.reserved := '0000'O;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.causeType := errorCause;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.causeValue := cg_Err_unassignedDestinationLRN;
SUA_PORT.send( vl_PDU_SUA ); //Send Error
}//endelse
}
//******************************************************************
// processing_PDU_SUA_COREF
//******************************************************************
function processing_PDU_SUA_COREF(PDU_SUA pl_pdu) runs on SUA_CT
{
//check if connection already established
if (ConnectionAlreadyEstablished(pl_pdu.sUA_COREF.messageParameters.destinationReferenceNumber.destinationReferenceNumber))
{//startif2
v_session := Retrieve_session(pl_pdu.sUA_COREF.messageParameters.destinationReferenceNumber.destinationReferenceNumber);
//Action Table follows
if (ConnectionTable[v_session].state==idle)
{ log ("CREF received in state:idle");} //do nothing , return to idle, source ref unknown
else if (ConnectionTable[v_session].state==connection_pending_IC)
{ log ("CREF received in state:connection_pending_IC");}
else if (ConnectionTable[v_session].state==active)
{ log ("CREF received in state:active");}//do nothing, return
else if (ConnectionTable[v_session].state==disconnect_pending)
{ log ("CREF received in state:disconnect_pending");}//discard message, return
else if (ConnectionTable[v_session].state==reset_bothway)
{ log ("CREF received in state:reset_bothway");}//
else if (ConnectionTable[v_session].state==connection_pending_OG)
{//startif3
var ASP_SCCP_N_DISCONNECT_ind vl_N_DISCONNECT_ind;
//stop connection timer
T_T_conn_est[v_session].stop;
//assemble ASP_SCCP
vl_N_DISCONNECT_ind.originator := cg_Mapping_RefCause_Orig[pl_pdu.sUA_COREF.messageParameters.sCCPCause.causeValue];
vl_N_DISCONNECT_ind.respondingAddress := omit;
vl_N_DISCONNECT_ind.reason := cg_Mapping_RefCause_Reason[pl_pdu.sUA_COREF.messageParameters.sCCPCause.causeValue];
vl_N_DISCONNECT_ind.userData := omit;
vl_N_DISCONNECT_ind.connectionId := ConnectionTable[v_session].connectionId;
vl_N_DISCONNECT_ind.importance := omit;
SCCP_SP_PORT.send( vl_N_DISCONNECT_ind ); //send ASP_SCCP_N_DISCONNECT_ind
//release resources
ReleaseResources(v_session);
}//endif3
else if (ConnectionTable[v_session].state==wait_conn_confirm)
{//startif3
//stop connection timer
T_T_conn_est[v_session].stop;
//release resources
ReleaseResources(v_session);
}//endif3
else if (ConnectionTable[v_session].state==reset_IC)
{//startif3
//discard received message
T_T_internal_reset[v_session].start(0.0);//the timer times out immediately
//state changed to active
ConnectionTable[v_session].state:=active;
}//endif3
else { log("CREF received in an unexpected state"); }
}//endif2
else { log("CREF received with destLocRef not in state table"); }
//Connection refused with destLocRef not in ConnectionTable
//discard
}
//******************************************************************
// processing_PDU_SUA_RELRE
//******************************************************************
function processing_PDU_SUA_RELRE(PDU_SUA pl_pdu) runs on SUA_CT
{
var PDU_SUA vl_PDU_SUA;
var ASP_SCCP_N_DISCONNECT_ind vl_N_DISCONNECT_ind;
//check if connection already established
if (ConnectionAlreadyEstablished(pl_pdu.sUA_RELRE.messageParameters.destinationReferenceNumber.destinationReferenceNumber))
{//startif1
v_session := Retrieve_session(pl_pdu.sUA_RELRE.messageParameters.destinationReferenceNumber.destinationReferenceNumber);
//check if remote reference is correct
if (ConnectionTable[v_session].remoteReference==pl_pdu.sUA_RELRE.messageParameters.sourceReferenceNumber.sourceReferenceNumber)
{//startif2
//Action Table follows
if (ConnectionTable[v_session].state==idle)//C.3- 1/6
{//startif3
//send RELCO
vl_PDU_SUA.sUA_RELCO.version := '01'O;
vl_PDU_SUA.sUA_RELCO.reserved := '00'O;
vl_PDU_SUA.sUA_RELCO.messageClassAndType := '0805'O;
vl_PDU_SUA.sUA_RELCO.messageLength := 0;
// routing context
vl_PDU_SUA.sUA_RELCO.messageParameters.routingContext := v_routingContext;
// destination ref num.
vl_PDU_SUA.sUA_RELCO.messageParameters.destinationReferenceNumber.tag := '0105'O;
vl_PDU_SUA.sUA_RELCO.messageParameters.destinationReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELCO.messageParameters.destinationReferenceNumber.destinationReferenceNumber := ConnectionTable[v_session].remoteReference;
// source ref num.
vl_PDU_SUA.sUA_RELCO.messageParameters.sourceReferenceNumber.tag := '0104'O;
vl_PDU_SUA.sUA_RELCO.messageParameters.sourceReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELCO.messageParameters.sourceReferenceNumber.sourceReferenceNumber := ConnectionTable[v_session].localReference;
// importance
vl_PDU_SUA.sUA_RELCO.messageParameters.importance := omit;
SUA_PORT.send( vl_PDU_SUA ); //Send relcomp
//then return to idle
}//endif3
else if (ConnectionTable[v_session].state==connection_pending_IC)
{ log("RLSD received in state:connection_pending_IC");}//discard message, return
else if (ConnectionTable[v_session].state==disconnect_pending)
{ log("RLSD received in state:disconnect_pending");}//discard message, return
else if (ConnectionTable[v_session].state==active)
{//startif3
//assemble ASP_SCCP
vl_N_DISCONNECT_ind.originator := cg_Mapping_RelCause_Orig[pl_pdu.sUA_RELRE.messageParameters.sCCPCause.causeValue];
vl_N_DISCONNECT_ind.respondingAddress := omit;
vl_N_DISCONNECT_ind.reason := cg_Mapping_RelCause_Reason[pl_pdu.sUA_RELRE.messageParameters.sCCPCause.causeValue];
vl_N_DISCONNECT_ind.userData := omit;
vl_N_DISCONNECT_ind.connectionId := ConnectionTable[v_session].connectionId;
vl_N_DISCONNECT_ind.importance := omit;
SCCP_SP_PORT.send( vl_N_DISCONNECT_ind ); //send ASP_SCCP_N_DISCONNECT_ind
//send RELCO
vl_PDU_SUA.sUA_RELCO.version := '01'O;
vl_PDU_SUA.sUA_RELCO.reserved := '00'O;
vl_PDU_SUA.sUA_RELCO.messageClassAndType := '0805'O;
vl_PDU_SUA.sUA_RELCO.messageLength := 0;
// routing context
vl_PDU_SUA.sUA_RELCO.messageParameters.routingContext := v_routingContext;
// destination ref num.
vl_PDU_SUA.sUA_RELCO.messageParameters.destinationReferenceNumber.tag := '0105'O;
vl_PDU_SUA.sUA_RELCO.messageParameters.destinationReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELCO.messageParameters.destinationReferenceNumber.destinationReferenceNumber := pl_pdu.sUA_RELRE.messageParameters.sourceReferenceNumber.sourceReferenceNumber;
// source ref num.
vl_PDU_SUA.sUA_RELCO.messageParameters.sourceReferenceNumber.tag := '0104'O;
vl_PDU_SUA.sUA_RELCO.messageParameters.sourceReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELCO.messageParameters.sourceReferenceNumber.sourceReferenceNumber := pl_pdu.sUA_RELRE.messageParameters.destinationReferenceNumber.destinationReferenceNumber;
// importance
vl_PDU_SUA.sUA_RELCO.messageParameters.importance := omit;
SUA_PORT.send( vl_PDU_SUA ); //Send relcomp
//release resources
ReleaseResources(v_session);
}//endif3
else if (ConnectionTable[v_session].state==connection_pending_OG)
{//startif3
//send RELCO
vl_PDU_SUA.sUA_RELCO.version := '01'O;
vl_PDU_SUA.sUA_RELCO.reserved := '00'O;
vl_PDU_SUA.sUA_RELCO.messageClassAndType := '0805'O;
vl_PDU_SUA.sUA_RELCO.messageLength := 0;
// routing context
vl_PDU_SUA.sUA_RELCO.messageParameters.routingContext := v_routingContext;
// destination ref num.
vl_PDU_SUA.sUA_RELCO.messageParameters.destinationReferenceNumber.tag := '0105'O;
vl_PDU_SUA.sUA_RELCO.messageParameters.destinationReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELCO.messageParameters.destinationReferenceNumber.destinationReferenceNumber := pl_pdu.sUA_RELRE.messageParameters.sourceReferenceNumber.sourceReferenceNumber;
// source ref num.
vl_PDU_SUA.sUA_RELCO.messageParameters.sourceReferenceNumber.tag := '0104'O;
vl_PDU_SUA.sUA_RELCO.messageParameters.sourceReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELCO.messageParameters.sourceReferenceNumber.sourceReferenceNumber := pl_pdu.sUA_RELRE.messageParameters.destinationReferenceNumber.destinationReferenceNumber;
// importance
vl_PDU_SUA.sUA_RELCO.messageParameters.importance := omit;
SUA_PORT.send( vl_PDU_SUA ); //Send relcomp
//stop connection timer
T_T_conn_est[v_session].stop;
//assemble ASP_SCCP
vl_N_DISCONNECT_ind.originator := cg_Mapping_RelCause_Orig[pl_pdu.sUA_RELRE.messageParameters.sCCPCause.causeValue];
vl_N_DISCONNECT_ind.respondingAddress := omit;
vl_N_DISCONNECT_ind.reason := cg_Mapping_RelCause_Reason[pl_pdu.sUA_RELRE.messageParameters.sCCPCause.causeValue];
vl_N_DISCONNECT_ind.userData := omit;
vl_N_DISCONNECT_ind.connectionId := ConnectionTable[v_session].connectionId;
vl_N_DISCONNECT_ind.importance := omit;
SCCP_SP_PORT.send( vl_N_DISCONNECT_ind ); //send ASP_SCCP_N_DISCONNECT_ind
//release resources
ReleaseResources(v_session);
}//endif3
else if (ConnectionTable[v_session].state==wait_conn_confirm)
{//startif3
//send RELCO
vl_PDU_SUA.sUA_RELCO.version := '01'O;
vl_PDU_SUA.sUA_RELCO.reserved := '00'O;
vl_PDU_SUA.sUA_RELCO.messageClassAndType := '0805'O;
vl_PDU_SUA.sUA_RELCO.messageLength := 0;
// routing context
vl_PDU_SUA.sUA_RELCO.messageParameters.routingContext := v_routingContext;
// destination ref num.
vl_PDU_SUA.sUA_RELCO.messageParameters.destinationReferenceNumber.tag := '0105'O;
vl_PDU_SUA.sUA_RELCO.messageParameters.destinationReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELCO.messageParameters.destinationReferenceNumber.destinationReferenceNumber := pl_pdu.sUA_RELRE.messageParameters.sourceReferenceNumber.sourceReferenceNumber;
// source ref num.
vl_PDU_SUA.sUA_RELCO.messageParameters.sourceReferenceNumber.tag := '0104'O;
vl_PDU_SUA.sUA_RELCO.messageParameters.sourceReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELCO.messageParameters.sourceReferenceNumber.sourceReferenceNumber := pl_pdu.sUA_RELRE.messageParameters.destinationReferenceNumber.destinationReferenceNumber;
// importance
vl_PDU_SUA.sUA_RELCO.messageParameters.importance := omit;
SUA_PORT.send( vl_PDU_SUA ); //Send relcomp
//stop connection timer
T_T_conn_est[v_session].stop;
//release resources
ReleaseResources(v_session);
}//endif3
else if (ConnectionTable[v_session].state==reset_IC)
{//startif3
//assemble ASP_SCCP
vl_N_DISCONNECT_ind.originator := cg_Mapping_RelCause_Orig[pl_pdu.sUA_RELRE.messageParameters.sCCPCause.causeValue];
vl_N_DISCONNECT_ind.respondingAddress := omit;
vl_N_DISCONNECT_ind.reason := cg_Mapping_RelCause_Reason[pl_pdu.sUA_RELRE.messageParameters.sCCPCause.causeValue];
vl_N_DISCONNECT_ind.userData := omit;
vl_N_DISCONNECT_ind.connectionId := ConnectionTable[v_session].connectionId;
vl_N_DISCONNECT_ind.importance := omit;
SCCP_SP_PORT.send( vl_N_DISCONNECT_ind ); //send ASP_SCCP_N_DISCONNECT_ind
//release resources, stop inactivity timers, change state to idle
ReleaseResources(v_session);
}//endif3
else if (ConnectionTable[v_session].state==reset_bothway)
{//startif3
//assemble ASP_SCCP
vl_N_DISCONNECT_ind.originator := cg_Mapping_RelCause_Orig[pl_pdu.sUA_RELRE.messageParameters.sCCPCause.causeValue];
vl_N_DISCONNECT_ind.respondingAddress := omit;
vl_N_DISCONNECT_ind.reason := cg_Mapping_RelCause_Reason[pl_pdu.sUA_RELRE.messageParameters.sCCPCause.causeValue];
vl_N_DISCONNECT_ind.userData := omit;
vl_N_DISCONNECT_ind.connectionId := ConnectionTable[v_session].connectionId;
vl_N_DISCONNECT_ind.importance := omit;
SCCP_SP_PORT.send( vl_N_DISCONNECT_ind ); //send ASP_SCCP_N_DISCONNECT_ind
//release resources, stop inactivity timers, change state to idle
ReleaseResources(v_session);
}//endif3
else { log("RLSD received in an unexpected state"); }
}//endif2
else {//remote reference inconsistent, error action follows
//send COERR
vl_PDU_SUA.sUA_COERR.version := '01'O;
vl_PDU_SUA.sUA_COERR.reserved := '00'O;
vl_PDU_SUA.sUA_COERR.messageClassAndType := '080A'O;
vl_PDU_SUA.sUA_COERR.messageLength := 0;
// routing context
vl_PDU_SUA.sUA_COERR.messageParameters.routingContext := v_routingContext;
// destination ref num.
vl_PDU_SUA.sUA_COERR.messageParameters.destinationReferenceNumber.tag := '0105'O;
vl_PDU_SUA.sUA_COERR.messageParameters.destinationReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_COERR.messageParameters.destinationReferenceNumber.destinationReferenceNumber := pl_pdu.sUA_RELRE.messageParameters.sourceReferenceNumber.sourceReferenceNumber;
// sccp cause
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.tag := '0106'O;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.lengthInd := 8;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.reserved := '0000'O;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.causeType := errorCause;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.causeValue := cg_Err_inconsistentSourceLRN;
SUA_PORT.send( vl_PDU_SUA ); //Send Error
}//endelse
}//endif1
else {//Released(Y,X) received with destLocRef not in ConnectionTable
//send RLC(X,Y)
vl_PDU_SUA.sUA_RELCO.version := '01'O;
vl_PDU_SUA.sUA_RELCO.reserved := '00'O;
vl_PDU_SUA.sUA_RELCO.messageClassAndType := '0805'O;
vl_PDU_SUA.sUA_RELCO.messageLength := 0;
// routing context
vl_PDU_SUA.sUA_RELCO.messageParameters.routingContext := v_routingContext;
// destination ref num.
vl_PDU_SUA.sUA_RELCO.messageParameters.destinationReferenceNumber.tag := '0105'O;
vl_PDU_SUA.sUA_RELCO.messageParameters.destinationReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELCO.messageParameters.destinationReferenceNumber.destinationReferenceNumber := pl_pdu.sUA_RELRE.messageParameters.sourceReferenceNumber.sourceReferenceNumber;
// source ref num.
vl_PDU_SUA.sUA_RELCO.messageParameters.sourceReferenceNumber.tag := '0104'O;
vl_PDU_SUA.sUA_RELCO.messageParameters.sourceReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_RELCO.messageParameters.sourceReferenceNumber.sourceReferenceNumber := pl_pdu.sUA_RELRE.messageParameters.destinationReferenceNumber.destinationReferenceNumber;
// importance
vl_PDU_SUA.sUA_RELCO.messageParameters.importance := omit;
SUA_PORT.send( vl_PDU_SUA ); //Send relcomp
}//endelse
}
//******************************************************************
// processing_PDU_SUA_RELCO
//******************************************************************
function processing_PDU_SUA_RELCO(PDU_SUA pl_pdu) runs on SUA_CT
{
var ASP_SCCP_N_DISCONNECT_ind vl_N_DISCONNECT_ind;
//check if connection already established
if (ConnectionAlreadyEstablished(pl_pdu.sUA_RELCO.messageParameters.destinationReferenceNumber.destinationReferenceNumber))
{//startif1
v_session := Retrieve_session(pl_pdu.sUA_RELCO.messageParameters.destinationReferenceNumber.destinationReferenceNumber);
//check if remote reference is correct -Table B.2 /Q.714
if (ConnectionTable[v_session].remoteReference==pl_pdu.sUA_RELCO.messageParameters.sourceReferenceNumber.sourceReferenceNumber)
{//startif2
//Action Table follows
if (ConnectionTable[v_session].state==idle)
{ log("RLC received in state: idle"); }//C.3 1/6-do nothing-return to idle state
else if (ConnectionTable[v_session].state==connection_pending_IC)
{ log("RLC received in state: connection_pending_IC"); }//discard message, return
else if (ConnectionTable[v_session].state==active)
{ log("RLC received in state: active"); }//do nothing, return
else if (ConnectionTable[v_session].state==reset_bothway)
{ log("RLC received in state:reset_bothway "); }//
else if (ConnectionTable[v_session].state==disconnect_pending)
{//startif3
log("RLC received in state:disconnect_pending ");
//log("release resources");
ReleaseResources(v_session);
}//endif3
else if (ConnectionTable[v_session].state==connection_pending_OG)
{//startif3
T_T_conn_est[v_session].stop;
//assemble ASP_SCCP
vl_N_DISCONNECT_ind.originator := cg_NSU;
vl_N_DISCONNECT_ind.respondingAddress := omit;
vl_N_DISCONNECT_ind.reason := cg_DISC_normal;
vl_N_DISCONNECT_ind.userData := omit;
vl_N_DISCONNECT_ind.connectionId := ConnectionTable[v_session].connectionId;
vl_N_DISCONNECT_ind.importance := omit;
SCCP_SP_PORT.send( vl_N_DISCONNECT_ind ); //send ASP_SCCP_N_DISCONNECT_ind
//release resources
ReleaseResources(v_session);
}//endif3
else if (ConnectionTable[v_session].state==wait_conn_confirm)
{//startif3
log("RLC received in state:wait_conn_confirm");
//stop connection timer
T_T_conn_est[v_session].stop;
//release resources
ReleaseResources(v_session);
}//endif3
else if (ConnectionTable[v_session].state==reset_IC)
{//startif3
log("RLC received in state:reset_IC");
//discard received message
T_T_internal_reset[v_session].start(0.0);//the timer times out immediately
//state changed to active
ConnectionTable[v_session].state:=active;
}//endif3
else { log("RLC received in an unexpected state"); }
}//endif2
else {}//remote reference inconsistent, discard
}//endif1
else {}//Release complete received with destLocRef not in ConnectionTable
//discard
}
//******************************************************************
// processing_PDU_SUA_RESCO
//******************************************************************
function processing_PDU_SUA_RESCO(PDU_SUA pl_pdu) runs on SUA_CT
{
var PDU_SUA vl_PDU_SUA;
var ASP_SCCP_N_DISCONNECT_ind vl_N_DISCONNECT_ind;
//check if connection already established
if (ConnectionAlreadyEstablished(pl_pdu.sUA_RESCO.messageParameters.destinationReferenceNumber.destinationReferenceNumber))
{//startif1
v_session := Retrieve_session(pl_pdu.sUA_RESCO.messageParameters.destinationReferenceNumber.destinationReferenceNumber);
//check if remote reference is correct -Table B.2 /Q.714
if (ConnectionTable[v_session].remoteReference==pl_pdu.sUA_RESCO.messageParameters.sourceReferenceNumber.sourceReferenceNumber)
{//startif2
//Action Table follows
if (ConnectionTable[v_session].state==idle)
{ log("RSC received in state:idle ");}//do nothing-return to idle state, no source ref known
else if (ConnectionTable[v_session].state==connection_pending_IC)
{ log("RSC received in state:connection_pending_IC ");}//discard message, return
else if (ConnectionTable[v_session].state==connection_pending_OG)
{//startif3
//stop connection timer
T_T_conn_est[v_session].stop;
//assemble ASP_SCCP
vl_N_DISCONNECT_ind.originator := cg_NSU;
vl_N_DISCONNECT_ind.respondingAddress := omit;
vl_N_DISCONNECT_ind.reason := cg_DISC_normal;
vl_N_DISCONNECT_ind.userData := omit;
vl_N_DISCONNECT_ind.connectionId := ConnectionTable[v_session].connectionId;
vl_N_DISCONNECT_ind.importance := omit;
SCCP_SP_PORT.send( vl_N_DISCONNECT_ind ); //send ASP_SCCP_N_DISCONNECT_ind
//release resources
ReleaseResources(v_session);
}//endif3
else if (ConnectionTable[v_session].state==disconnect_pending)
{ log("RSC received in state:disconnect_pending");}
else if (ConnectionTable[v_session].state==reset_bothway)
{//startif3
//assemble ASP_SCCP
var ASP_SCCP_N_RESET_cfm vl_N_RESET_cfm;
vl_N_RESET_cfm.connectionId:=ConnectionTable[v_session].connectionId;
SCCP_SP_PORT.send( vl_N_RESET_cfm );//send ASP_SCCP_N_RESET_cfm
//stop reset timer
T_T_reset[v_session].stop;
//restart receive inactivity timer
T_T_iar[v_session].stop;//to avoid warnings
T_T_iar[v_session].start;
//change state
ConnectionTable[v_session].state:=reset_IC;
}//endif3
else if (ConnectionTable[v_session].state==active)
{//startif3
//do nothing-return to idle state
log("RSC received in state:active");
}//endif3
else if (ConnectionTable[v_session].state==reset_IC)
{//startif3
//discard received message
T_T_internal_reset[v_session].start(0.0);//the timer times out immediately
//state changed to active
ConnectionTable[v_session].state:=active;
}//endif3
else if (ConnectionTable[v_session].state==wait_conn_confirm)
{//startif3
//stop connection timer
T_T_conn_est[v_session].stop;
//release resources
ReleaseResources(v_session);
}//endif3
else { log("ResConf received in an unexpected state"); }
}//endif2
else {//remote reference inconsistent, error action follows
//send COERR
vl_PDU_SUA.sUA_COERR.version := '01'O;
vl_PDU_SUA.sUA_COERR.reserved := '00'O;
vl_PDU_SUA.sUA_COERR.messageClassAndType := '080A'O;
vl_PDU_SUA.sUA_COERR.messageLength := 0;
// routing context
vl_PDU_SUA.sUA_COERR.messageParameters.routingContext := v_routingContext;
// destination ref num.
vl_PDU_SUA.sUA_COERR.messageParameters.destinationReferenceNumber.tag := '0105'O;
vl_PDU_SUA.sUA_COERR.messageParameters.destinationReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_COERR.messageParameters.destinationReferenceNumber.destinationReferenceNumber := pl_pdu.sUA_RESCO.messageParameters.sourceReferenceNumber.sourceReferenceNumber;
// sccp cause
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.tag := '0106'O;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.lengthInd := 8;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.reserved := '0000'O;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.causeType := errorCause;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.causeValue := cg_Err_inconsistentSourceLRN;
SUA_PORT.send( vl_PDU_SUA ); //Send Error
}//endelse
}//endif1
else { //startelse-Reset confirm received with destLocRef not in ConnectionTable
//send COERR
vl_PDU_SUA.sUA_COERR.version := '01'O;
vl_PDU_SUA.sUA_COERR.reserved := '00'O;
vl_PDU_SUA.sUA_COERR.messageClassAndType := '080A'O;
vl_PDU_SUA.sUA_COERR.messageLength := 0;
// routing context
vl_PDU_SUA.sUA_COERR.messageParameters.routingContext := v_routingContext;
// destination ref num.
vl_PDU_SUA.sUA_COERR.messageParameters.destinationReferenceNumber.tag := '0105'O;
vl_PDU_SUA.sUA_COERR.messageParameters.destinationReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_COERR.messageParameters.destinationReferenceNumber.destinationReferenceNumber := pl_pdu.sUA_RESCO.messageParameters.sourceReferenceNumber.sourceReferenceNumber;
// sccp cause
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.tag := '0106'O;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.lengthInd := 8;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.reserved := '0000'O;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.causeType := errorCause;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.causeValue := cg_Err_unassignedDestinationLRN;
SUA_PORT.send( vl_PDU_SUA ); //Send Error
}//endelse
}
//******************************************************************
// processing_PDU_SUA_RESRE
//******************************************************************
function processing_PDU_SUA_RESRE(PDU_SUA pl_pdu) runs on SUA_CT
{
var PDU_SUA vl_PDU_SUA;
//check if connection already established
if (ConnectionAlreadyEstablished(pl_pdu.sUA_RESRE.messageParameters.destinationReferenceNumber.destinationReferenceNumber))
{//startif1
v_session := Retrieve_session(pl_pdu.sUA_RESRE.messageParameters.destinationReferenceNumber.destinationReferenceNumber);
//check if remote reference is correct -Table B.2 /Q.714
if (ConnectionTable[v_session].remoteReference==pl_pdu.sUA_RESRE.messageParameters.sourceReferenceNumber.sourceReferenceNumber)
{//startif2
//Action Table follows
if (ConnectionTable[v_session].state==idle)
{//startif3
//send COERR
vl_PDU_SUA.sUA_COERR.version := '01'O;
vl_PDU_SUA.sUA_COERR.reserved := '00'O;
vl_PDU_SUA.sUA_COERR.messageClassAndType := '080A'O;
vl_PDU_SUA.sUA_COERR.messageLength := 0;
// routing context
vl_PDU_SUA.sUA_COERR.messageParameters.routingContext := v_routingContext;
// destination ref num.
vl_PDU_SUA.sUA_COERR.messageParameters.destinationReferenceNumber.tag := '0105'O;
vl_PDU_SUA.sUA_COERR.messageParameters.destinationReferenceNumber.lengthInd := 8;
vl_PDU_SUA.sUA_COERR.messageParameters.destinationReferenceNumber.destinationReferenceNumber := ConnectionTable[v_session].remoteReference;
// sccp cause
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.tag := '0106'O;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.lengthInd := 8;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.reserved := '0000'O;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.causeType := errorCause;
vl_PDU_SUA.sUA_COERR.messageParameters.sCCPCause.causeValue := cg_Err_unassignedDestinationLRN;
SUA_PORT.send( vl_PDU_SUA ); //Send Error
//then return to idle
}//endif3
else if (ConnectionTable[v_session].state==connection_pending_IC) {}//discard message, return
else if (ConnectionTable[v_session].state==connection_pending_OG)
{//startif3
//stop connection timer
T_T_conn_est[v_session].stop;
var ASP_SCCP_N_DISCONNECT_ind vl_N_DISCONNECT_ind;
//assemble ASP_SCCP
vl_N_DISCONNECT_ind.originator := cg_NSU;
vl_N_DISCONNECT_ind.respondingAddress := omit;
vl_N_DISCONNECT_ind.reason := cg_DISC_normal;
vl_N_DISCONNECT_ind.userData := omit;
vl_N_DISCONNECT_ind.connectionId := ConnectionTable[v_session].connectionId;
vl_N_DISCONNECT_ind.importance := omit;
SCCP_SP_PORT.send( vl_N_DISCONNECT_ind ); //send ASP_SCCP_N_DISCONNECT_ind
//release resources
ReleaseResources(v_session);
}//endif3
else if (ConnectionTable[v_session].state==disconnect_pending) {}
else if (ConnectionTable[v_session].state==reset_bothway)
{//startif3
//assemble ASP_SCCP
var ASP_SCCP_N_RESET_cfm vl_N_RESET_cfm;
vl_N_RESET_cfm.connectionId:=ConnectionTable[v_session].connectionId;
SCCP_SP_PORT.send( vl_N_RESET_cfm ); //send ASP_SCCP_N_RESET_cfm
//stop reset timer
T_T_reset[v_session].stop;
//restart receive inactivity timer
T_T_iar[v_session].stop;//to avoid warnings
T_T_iar[v_session].start;</