blob: af423a57fa724ad7f76c9ba6ee05b6d50c88e7b1 [file] [log] [blame]
Harald Welteac359802017-04-12 12:13:44 +02001///////////////////////////////////////////////////////////////////////////////
2// //
3// Copyright Test Competence Center (TCC) ETH 2008 //
4// //
5// The copyright to the computer program(s) herein is the property of TCC. //
6// The program(s) may be used and/or copied only with the written permission //
7// of TCC or in accordance with the terms and conditions stipulated in the //
8// agreement/contract under which the program(s) have been supplied //
9// //
10///////////////////////////////////////////////////////////////////////////////
11// File: SCCP_Emulation.ttcn
12// Description: SS7 SCCP definitions and dynamic part according to
13// specification ITU-T SS7 SCCP, ANSI ..., ttc ...
14// References: ITU-T: Recommendation Q.711-Q.714,
15// ANSI : T1.111-2001 (MTP) and T1.112-2001 (SCCP)
16// TTC : JT-Q711
17// Rev: R6A05
18// Prodnr: CNL 113 341
19// Updated: 2009-01-26
20// Contact: http://ttcn.ericsson.se
21
22module SCCP_Emulation
23{//startmodule
24
25modulepar
26{
27 float tsp_maxLocalReference := 16777216.0; //loc ref= 0...tsp_maxLocalReference-1
28 float tsp_max_ConnectionId := 16777216.0; //max connection id = 0..tsp_max_ConnectionId -1
29 integer tsp_force_xudt := 0;
30 integer tsp_SIF_MaxLength := 272
31}
32
33import from General_Types all;
34import from MTP3asp_Types all;
35import from MTP3asp_PortType all;
36import from SCCP_Types all;
37import from SCCPasp_Types all;
38import from SCCP_Mapping all;
39
40group SCCPConstants
41{//startgroup SCCPConstants
42
43//------------------------------------------------------------------------------
44// Subsystem Numbers
45//------------------------------------------------------------------------------
46
47const integer cg_SSN_notKnown:=0;
48const integer cg_SSN_sCCPmanagement:=1;
49const integer cg_SSN_reservedForITU:=2;
50const integer cg_SSN_iSUP:=3;
51const integer cg_SSN_oMAP:=4;
52const integer cg_SSN_mAP:=5;
53const integer cg_SSN_hLR:=6;
54const integer cg_SSN_vLR:=7;
55const integer cg_SSN_mSC:=8;
56const integer cg_SSN_eIC:=9;
57const integer cg_SSN_aUC:=10;
58const integer cg_SSN_isdnSS:=11;
59const integer cg_SSN_reservedForIntUse:=12;
60const integer cg_SSN_bISDNe2e:=13;
61const integer cg_SSN_tCtestResponder:=14;
62const integer cg_SSN_rANAP:=142;
63const integer cg_SSN_bSSAP:=254;
64// TCAP has not SSN
65
66//------------------------------------------------------------------------------
67// Routing Indicator values ITU: 3.4.1/Q713.
68//------------------------------------------------------------------------------
69const BIT1n cg_route_on_SSN := '1'B;
70const BIT1n cg_route_on_GT := '0'B;
71
72//------------------------------------------------------------------------------
73// Release Cause
74//------------------------------------------------------------------------------
75
76
77const integer cg_Rel_endUserOrig:=0;
78const integer cg_Rel_endUserCong:=1;
79const integer cg_Rel_endUserFailure:=2;
80const integer cg_Rel_sCCPUserOrig:=3;
81const integer cg_Rel_remProcError:=4;
82const integer cg_Rel_inconsConnData:=5;
83const integer cg_Rel_accessFailure:=6;
84const integer cg_Rel_accessCongestion:=7;
85const integer cg_Rel_subsystFailure:=8;
86const integer cg_Rel_subsystCongest:=9;
87const integer cg_Rel_mTPFailure:=10;
88const integer cg_Rel_networkCongest:=11;
89const integer cg_Rel_expResetTimer:=12;
90const integer cg_Rel_expRecInacTimer:=13;
91const integer cg_Rel_reserved:=14;
92const integer cg_Rel_unqualified:=15;
93const integer cg_Rel_sCCPFailure:=16;
94
95//------------------------------------------------------------------------------
96// Return Cause
97//------------------------------------------------------------------------------
98
99const integer cg_Ret_noTransl4AddrNature:=0;
100const integer cg_Ret_noTransl4SpecifAddr:=1;
101const integer cg_Ret_subsystemCongestion:=2;
102const integer cg_Ret_subsystemFailure:=3;
103const integer cg_Ret_unequippedUser:=4;
104const integer cg_Ret_mTPFailure:=5;
105const integer cg_Ret_networkCongestion:=6;
106const integer cg_Ret_unqualified:=7;
107const integer cg_Ret_errorMessageTransport:=8;
108const integer cg_Ret_errorLocalProcessing:=9;
109const integer cg_Ret_destNoReassembly:=10;
110const integer cg_Ret_sCCPFailure:=11;
111const integer cg_Ret_hopCounterViolation:=12;
112const integer cg_Ret_segmeNotSupported:=13;
113const integer cg_Ret_segmentationFailure:=14;
114
115//------------------------------------------------------------------------------
116// Reset Cause
117//------------------------------------------------------------------------------
118
119
120const integer cg_Res_endUserOrig:=0;
121const integer cg_Res_sCCPUserOrig:=1;
122const integer cg_Res_messOutOfOrder_incPs:=2;
123const integer cg_Res_messOutOfOrder_incPr:=3;
124const integer cg_Res_remProcErr_messOutOfWindow:=4;
125const integer cg_Res_remProcErr_IncPsAfterReinit:=5;
126const integer cg_Res_remProcErr_general:=6;
127const integer cg_Res_remEndUserOperational:=7;
128const integer cg_Res_networkOperational:=8;
129const integer cg_Res_accessOperational:=9;
130const integer cg_Res_networkCongestion:=10;
131const integer cg_Res_reserved:=11;
132const integer cg_Res_unqualified:=12;
133
134//------------------------------------------------------------------------------
135//Error Cause
136//------------------------------------------------------------------------------
137
138const integer cg_Err_unassignedDestinationLRN:=0 ;
139const integer cg_Err_inconsistentSourceLRN:=1 ;
140const integer cg_Err_pointCodeMismatch:=2 ;
141const integer cg_Err_serviceClassMismatch:=3 ;
142const integer cg_Err_unqualified:=4 ;
143
144//------------------------------------------------------------------------------
145//Refusal Cause
146//------------------------------------------------------------------------------
147
148const integer cg_Ref_endUserOrigin:=0;
149const integer cg_Ref_endUserConges:=1;
150const integer cg_Ref_endUserFailure:=2;
151const integer cg_Ref_sCCPUserOrigin:=3;
152const integer cg_Ref_destAddrUnkn:=4;
153const integer cg_Ref_destInaccess:=5;
154const integer cg_Ref_qOSNotAvail_nonTransient:=6;
155const integer cg_Ref_qOSNotAvail_transient:=7;
156const integer cg_Ref_accessFailure:=8;
157const integer cg_Ref_accessCongestion:=9;
158const integer cg_Ref_subsystemFailure:=10;
159const integer cg_Ref_subsystemCongest:=11;
160const integer cg_Ref_expConnEstTimer:=12;
161const integer cg_Ref_incomUserData:=13;
162const integer cg_Ref_reserved:=14;
163const integer cg_Ref_unqualified:=15;
164const integer cg_Ref_hopCounterViol:=16;
165const integer cg_Ref_sCCPFailure:=17;
166const integer cg_Ref_noTransl4address:=18;
167const integer cg_Ref_unequippedUser:=19;
168
169//------------------------------------------------------------------------------
170// Originator
171//------------------------------------------------------------------------------
172
173const integer cg_Undefined:=0;
174const integer cg_NSU:=1;
175const integer cg_NSP:=2;
176
177
178//------------------------------------------------------------------------------
179// CREF Reason
180//------------------------------------------------------------------------------
181
182const integer cg_CREF_endUserOrig:=0;
183const integer cg_CREF_endUserCong:=1;
184const integer cg_CREF_endUserFailure:=2;
185const integer cg_CREF_SCCPUserOrig:=3;
186const integer cg_CREF_destAddrUnknwn_NT:=4;
187const integer cg_CREF_destInaccg_T:=5;
188const integer cg_CREF_QOSUnavail_NT:=6;
189const integer cg_CREF_QOSUnavail_T:=7;
190const integer cg_CREF_accessFailure:=8;
191const integer cg_CREF_accessCong:=9;
192const integer cg_CREF_destInaccg_NT:=10;
193const integer cg_CREF_subsystCong:=11;
194const integer cg_CREF_unspec_T:=12;
195const integer cg_CREF_incompInfo:=13;
196const integer cg_CREF_unspec_NT:=15;
197const integer cg_CREF_undef:=16;
198const integer cg_CREF_hopCntrViolation:=18;
199
200//------------------------------------------------------------------------------
201// DISC Reason
202//------------------------------------------------------------------------------
203
204const integer cg_DISC_normal:=20;
205const integer cg_DISC_endUserCong:=21;
206const integer cg_DISC_endUserFailure:=22;
207const integer cg_DISC_SCCPUserOrig:=23;
208const integer cg_DISC_abnormal_T:=24;
209const integer cg_DISC_accessFailure:=28;
210const integer cg_DISC_accessCong:=29;
211const integer cg_DISC_abnormal_NT:=30;
212const integer cg_DISC_subsystCong:=31;
213const integer cg_DISC_undef:=32;
214const integer cg_DISC_incompInfo:=33;
215const integer cg_DISC_abnormal:=35;
216
217//------------------------------------------------------------------------------
218// RESET Reason
219//------------------------------------------------------------------------------
220const integer cg_RESET_userSynch:= 40 ;
221const integer cg_RESET_unspec:= 41 ;
222const integer cg_RESET_netCong:= 42 ;
223const integer cg_RESET_undef:= 43 ;
224
225//------------------------------------------------------------------------------
226//Mapping Refusal Cause to Reason and Originator A.1/Q.713
227//------------------------------------------------------------------------------
228
229const integer cg_Mapping_RefCause_Orig[19]:=
230{
231 cg_NSU,
232 cg_NSU,
233 cg_NSU,
234 cg_NSU,
235 cg_NSP,
236 cg_NSP,
237 cg_NSP,
238 cg_NSP,
239 cg_NSU,
240 cg_NSU,
241 cg_NSP,
242 cg_NSU,
243 cg_NSP,
244 cg_NSU,
245 cg_NSP,
246 cg_Undefined,
247 cg_NSP,
248 cg_NSP,
249 cg_NSP
250};
251
252
253const integer cg_Mapping_RefCause_Reason[19]:=
254{
255 cg_CREF_endUserOrig,
256 cg_CREF_endUserCong,
257 cg_CREF_endUserFailure,
258 cg_CREF_SCCPUserOrig,
259 cg_CREF_destAddrUnknwn_NT,
260 cg_CREF_destInaccg_T,
261 cg_CREF_QOSUnavail_NT,
262 cg_CREF_QOSUnavail_T,
263 cg_CREF_accessFailure,
264 cg_CREF_accessCong,
265 cg_CREF_destInaccg_NT,
266 cg_CREF_subsystCong,
267 cg_CREF_unspec_T,
268 cg_CREF_incompInfo,
269 cg_CREF_unspec_T,
270 cg_CREF_undef,
271 cg_CREF_hopCntrViolation,
272 cg_CREF_destAddrUnknwn_NT,
273 cg_CREF_destInaccg_NT
274};
275
276//------------------------------------------------------------------------------
277//Mapping Release Cause to Reason and Originator A.2/Q.713
278//------------------------------------------------------------------------------
279
280const integer cg_Mapping_RelCause_Orig[17]:=
281{
282 cg_NSU,
283 cg_NSU,
284 cg_NSU,
285 cg_NSU,
286 cg_NSP,
287 cg_NSP,
288 cg_NSU,
289 cg_NSU,
290 cg_NSP,
291 cg_NSU,
292 cg_NSP,
293 cg_NSP,
294 cg_NSP,
295 cg_NSP,
296 cg_Undefined,
297 cg_Undefined,
298 cg_NSP
299};
300
301//mapping CREF-> ASP_SCCP_N_DISCONNECT_ind:
302//Reason:=cg_Mapping_RefCause_Reason[RefCause];
303//Originator:=cg_Mapping_RefCause_Orig[RefCause];
304
305
306//mapping ASP_SCCP_N_DISCONNECT_req-> CREF:
307//
308
309const integer cg_Mapping_RelCause_Reason[17]:= {
310 cg_DISC_normal,
311 cg_DISC_endUserCong,
312 cg_DISC_endUserFailure,
313 cg_DISC_SCCPUserOrig,
314 cg_DISC_abnormal_T,
315 cg_DISC_abnormal_T,
316 cg_DISC_accessFailure,
317 cg_DISC_accessCong,
318 cg_DISC_abnormal_NT,
319 cg_DISC_subsystCong,
320 cg_DISC_abnormal_NT,
321 cg_DISC_abnormal_T,
322 cg_DISC_abnormal_T,
323 cg_DISC_abnormal_T,
324 cg_DISC_undef,
325 cg_DISC_undef,
326 cg_DISC_abnormal_NT
327};
328
329
330
331//mapping RLSD-> ASP_SCCP_N_DISCONNECT_ind:
332//Reason:=cg_Mapping_RelCause_Reason[RelCause];
333//Originator:=cg_Mapping_RelCause_Orig[RelCause];
334
335//mapping ASP_SCCP_N_DISCONNECT_req-> RLSD:
336//
337
338
339//------------------------------------------------------------------------------
340//Mapping Reset Cause to Reason and Originator A.2/Q.713
341//------------------------------------------------------------------------------
342
343
344const integer cg_Mapping_ResCause_Orig[12]:= {
345 cg_NSU,
346 cg_NSU,
347 cg_NSP,
348 cg_NSP,
349 cg_NSP,
350 cg_NSP,
351 cg_NSP,
352 cg_NSU,
353 cg_NSP,
354 cg_NSU,
355 cg_NSP,
356 cg_Undefined
357};
358
359
360const integer cg_Mapping_ResCause_Reason[12]:= {
361 cg_RESET_userSynch,
362 cg_RESET_userSynch,
363 cg_RESET_unspec,
364 cg_RESET_unspec,
365 cg_RESET_unspec,
366 cg_RESET_unspec,
367 cg_RESET_unspec,
368 cg_RESET_userSynch,
369 cg_RESET_unspec,
370 cg_RESET_userSynch,
371 cg_RESET_netCong,
372 cg_RESET_undef
373};
374
375//mapping RSR-> ASP_SCCP_N_DISCONNECT_ind:
376//Reason:=cg_Mapping_ResCause_Reason[ResCause];
377//Originator:=cg_Mapping_ResCause_Orig[ResCause];
378
379//mapping ASP_SCCP_N_DISCONNECT_req-> RSR:
380//
381
382const integer cg_TimerArraySize := 16;
383
384}//endgroup SCCPConstants
385
386//******************************************************************************
387// PDU templates
388//******************************************************************************
389
390
391group PDUTemplateDefinitionsSending
392{
393
394
395
396//******************************************************************************
397// Message Connection Request (CR) (Q713 $4.2)
398//******************************************************************************
399
400//------------------------------------------------------------------------------
401// Message definition
402//------------------------------------------------------------------------------
403template PDU_SCCP_ConnectionRequest t_PDU_SCCP_ConnectionRequest
404(
405 SCCP_param_SourceLocalReference pl_SLR,
406 SCCP_param_ProtocolClass pl_Proto_Class,
407 SCCP_param_CPartyAddressEnc pl_CalledAddress,
408template SCCP_param_Credit_opt pl_credit,
409template SCCP_param_CPartyAddressEnc_opt pl_CallingAddress ,
410template SCCP_param_Data_opt pl_Data,
411template SCCP_param_HopCounter_opt pl_HopCntr,
412template SCCP_param_Importance_opt pl_Imp,
413template SCCP_param_EndOfOptionalParams pl_eop
414
415):=
416 {
417 messageType:=cr,
418 sourceLocRef:=pl_SLR,
419 protClass:=pl_Proto_Class,
420 pointer1:=2,
421 pointer2:=0,
422 calledPAddress:=pl_CalledAddress,
423 optionalPart:= {
424 credit:=pl_credit,
425 callingPAddress:=pl_CallingAddress,
426 data:=pl_Data,
427 hopCounter:=pl_HopCntr,
428 importance:=pl_Imp
429 },
430 eop:=pl_eop
431 }
432
433
434
435//******************************************************************************
436// Message Connection Confirm (CC) (Q713 $4.3)
437//******************************************************************************
438
439//------------------------------------------------------------------------------
440// Message definition
441//------------------------------------------------------------------------------
442template PDU_SCCP_ConnectionConfirm t_PDU_SCCP_ConnectionConfirm
443(
444 SCCP_param_DestLocalReference pl_DLR,
445 SCCP_param_SourceLocalReference pl_SLR,
446 SCCP_param_ProtocolClass pl_Proto_Class,
447template SCCP_param_Credit_opt pl_credit,
448template SCCP_param_CPartyAddressEnc_opt pl_CalledAddress,
449template SCCP_param_Data_opt pl_Data,
450template SCCP_param_Importance_opt pl_Imp,
451template SCCP_param_EndOfOptionalParams pl_eop
452):=
453 {
454 messageType:=cc,
455 destLocRef:=pl_DLR,
456 sourceLocRef:=pl_SLR,
457 protClass:=pl_Proto_Class,
458 pointer1:=1,
459 optionalPart:= {
460 credit:=pl_credit,
461 calledPAddress:=pl_CalledAddress,
462 data:=pl_Data,
463 importance:=pl_Imp
464 },
465 eop:=pl_eop
466 }
467
468
469//******************************************************************************
470// Message Connection Refused (CREF) (Q713 $4.4)
471//******************************************************************************
472
473//------------------------------------------------------------------------------
474// Message definition
475//------------------------------------------------------------------------------
476template PDU_SCCP_ConnectionRefused t_PDU_SCCP_ConnectionRefused
477(
478 SCCP_param_DestLocalReference pl_DLR,
479 SCCP_param_RefusalCause pl_RefCause,
480template SCCP_param_CPartyAddressEnc_opt pl_CalledAddress,
481template SCCP_param_Data_opt pl_Data,
482template SCCP_param_Importance_opt pl_Imp,
483template SCCP_param_EndOfOptionalParams pl_eop
484):=
485 {
486 messageType:=cref,
487 destLocRef:=pl_DLR,
488 refusalCause:=pl_RefCause,
489 pointer1:=1,
490 optionalPart:= {
491 calledPAddress:=pl_CalledAddress,
492 data:=pl_Data,
493 importance:=pl_Imp
494 },
495 eop:=pl_eop
496 }
497
498
499//******************************************************************************
500// Message Released (RLSD) (Q713 $4.5)
501//******************************************************************************
502
503
504//------------------------------------------------------------------------------
505// Message definition
506//------------------------------------------------------------------------------
507template PDU_SCCP_Released t_PDU_SCCP_Released
508(
509 OCT3 pl_DLR,
510 OCT3 pl_SLR,
511 SCCP_param_ReleaseCause pl_RelCause,
512template SCCP_param_Data_opt pl_Data,
513template SCCP_param_Importance_opt pl_Imp,
514template SCCP_param_EndOfOptionalParams pl_eop
515):=
516 {
517 messageType:=rlsd,
518 destLocRef:=pl_DLR,
519 sourceLocRef:=pl_SLR,
520 releaseCause:=pl_RelCause,
521 pointer1:=1,
522 optionalPart:= {
523 data:=pl_Data,
524 importance:=pl_Imp
525 },
526 eop:=pl_eop
527 }
528
529//******************************************************************************
530// Message Release Complete (RLC) (Q713 $4.6)
531//******************************************************************************
532//------------------------------------------------------------------------------
533// Message definition
534//------------------------------------------------------------------------------
535template PDU_SCCP_ReleaseComplete t_PDU_SCCP_ReleaseComplete
536(
537 OCT3 pl_DLR,
538 OCT3 pl_SLR
539):=
540 {
541 messageType:=rlc,
542 destLocRef:=pl_DLR,
543 sourceLocRef:=pl_SLR
544 }
545
546
547
548//******************************************************************************
549// Message Data form 1 (DT1) (Q713 $4.7)
550//******************************************************************************
551//------------------------------------------------------------------------------
552// Message definition
553//------------------------------------------------------------------------------
554template PDU_SCCP_DataForm1 t_PDU_SCCP_DataForm1
555(
556 OCT3 pl_DLR,
557 SCCP_param_SegmentingReassembl pl_SegmReasm,
558 SCCP_param_Data pl_Data
559):=
560 {
561 messageType:=dt1,
562 destLocRef:=pl_DLR,
563 segmentingReassembl:=pl_SegmReasm,
564 pointer1:=1,
565 data:=pl_Data
566 }
567
568
569
570//******************************************************************************
571// Message Data form 2 (DT2) (Q713 $4.8)
572//******************************************************************************
573//------------------------------------------------------------------------------
574// Not supported
575//------------------------------------------------------------------------------
576
577//******************************************************************************
578// Message Data Acknowledgement (AK) (Q713 $4.9)
579//******************************************************************************
580//------------------------------------------------------------------------------
581// Not supported
582//------------------------------------------------------------------------------
583
584
585//******************************************************************************
586// Message Unitdata (UDT) (Q713 $4.10)
587//******************************************************************************
588//------------------------------------------------------------------------------
589// Message definition
590//------------------------------------------------------------------------------
591template PDU_SCCP_Unitdata t_PDU_SCCP_Unitdata
592(
593 SCCP_param_ProtocolClass pl_Proto_Class,
594 SCCP_param_CPartyAddressEnc pl_CalledAddress,
595 SCCP_param_CPartyAddressEnc pl_CallingAddress,
596 SCCP_param_Data pl_Data
597):=
598 {
599 messageType :=udt,
600 protClass :=pl_Proto_Class,
601 pointer1:=3,
602 pointer2:=0,
603 pointer3:=0,
604 calledPAddress := pl_CalledAddress,
605 callingPAddress := pl_CallingAddress,
606 data:=pl_Data
607 }
608
609
610
611//******************************************************************************
612// Message Unitdata service (UDTS) (Q713 $4.11)
613//******************************************************************************
614//------------------------------------------------------------------------------
615// Message definition
616//------------------------------------------------------------------------------
617template PDU_SCCP_UnitdataService t_PDU_SCCP_UnitdataService
618(
619 SCCP_param_ReturnCause pl_RetCause,
620 SCCP_param_CPartyAddressEnc pl_CalledAddress,
621 SCCP_param_CPartyAddressEnc pl_CallingAddress,
622 SCCP_param_Data pl_Data
623):=
624 {
625 messageType:=udts,
626 returnCause:=pl_RetCause,
627 pointer1:=3,
628 pointer2:=0,
629 pointer3:=0,
630 calledPAddress:=pl_CalledAddress,
631 callingPAddress:=pl_CallingAddress,
632 data:=pl_Data
633 }
634
635//******************************************************************************
636// Message Expedited Data (ED) (Q713 $4.12)
637//******************************************************************************
638//------------------------------------------------------------------------------
639// Not supported
640//------------------------------------------------------------------------------
641
642
643//******************************************************************************
644// Message Expedited Data Acknowledgement (EA) (Q713 $4.13)
645//******************************************************************************
646//------------------------------------------------------------------------------
647// Not supported
648//------------------------------------------------------------------------------
649
650//******************************************************************************
651// Message Reset Request (RSR) (Q713 $4.14)
652//******************************************************************************
653//------------------------------------------------------------------------------
654// Message definition
655//------------------------------------------------------------------------------
656template PDU_SCCP_ResetRequest t_PDU_SCCP_ResetRequest
657(
658 SCCP_param_DestLocalReference pl_DLR,
659 SCCP_param_SourceLocalReference pl_SLR,
660 SCCP_param_ResetCause pl_ResCause
661):=
662 {
663 messageType:=rsr,
664 destLocRef:=pl_DLR,
665 sourceLocRef:=pl_SLR,
666 resetCause:=pl_ResCause
667 }
668
669
670//******************************************************************************
671// Message Reset Confirmation (RSC) (Q713 $4.15)
672//******************************************************************************
673//------------------------------------------------------------------------------
674// Message definition
675//------------------------------------------------------------------------------
676 template PDU_SCCP_ResetConfirm t_PDU_SCCP_ResetConfirm
677 (
678 SCCP_param_DestLocalReference pl_DLR,
679 SCCP_param_SourceLocalReference pl_SLR
680 ):=
681 {
682 messageType:=rsr,
683 destLocRef:=pl_DLR,
684 sourceLocRef:=pl_SLR
685 }
686
687//******************************************************************************
688// Message Protocol data unit error (ERR) (Q713 $4.16)
689//******************************************************************************
690//------------------------------------------------------------------------------
691// Message definition
692//------------------------------------------------------------------------------
693template PDU_SCCP_ProtDataUnitError t_PDU_SCCP_ProtDataUnitError
694(
695 SCCP_param_DestLocalReference pl_DLR,
696 SCCP_param_ErrorCause pl_ErrCause
697):=
698 {
699 messageType:=rsr,
700 destLocRef:=pl_DLR,
701 errorCause:=pl_ErrCause
702 }
703
704
705//******************************************************************************
706// Message Inactivity test (IT) (Q713 $4.17)
707//******************************************************************************
708//------------------------------------------------------------------------------
709// Message definition
710//------------------------------------------------------------------------------
711template PDU_SCCP_InactivityTest t_PDU_SCCP_InactivityTest
712(
713 SCCP_param_DestLocalReference pl_DLR,
714 SCCP_param_SourceLocalReference pl_SLR,
715 SCCP_param_ProtocolClass pl_Proto_Class,
716 SCCP_param_SequencingSegmenting pl_SeqSegm,
717 SCCP_param_Credit pl_credit
718):=
719 {
720 messageType:=it,
721 destLocRef:=pl_DLR,
722 sourceLocRef:=pl_SLR,
723 protClass:=pl_Proto_Class,
724 sequencingSegmenting:=pl_SeqSegm,
725 credit:=pl_credit
726 }
727
728
729//******************************************************************************
730// Message Extended Unitdata (XUDT) (Q713 $4.18)
731//******************************************************************************
732//------------------------------------------------------------------------------
733
734template PDU_SCCP_ExtUnitdata t_PDU_SCCP_ExtUnitdata
735(
736 SCCP_param_ProtocolClass pl_Proto_Class,
737 SCCP_param_HopCounter pl_hopCounter,
738 SCCP_param_CPartyAddressEnc pl_calledPAddress,
739 SCCP_param_CPartyAddressEnc pl_callingPAddress,
740 SCCP_param_Data pl_data,
741template SCCP_param_Segmentation_opt pl_segm,
742template SCCP_param_Importance_opt pl_imp
743):=
744 {
745 messageType:= xudt,
746 protClass:=pl_Proto_Class,
747 hopCounter:=pl_hopCounter,
748 pointer1:=0,
749 pointer2:=0,
750 pointer3:=0,
751 pointer4:=0,
752 calledPAddress:=pl_calledPAddress,
753 callingPAddress:=pl_callingPAddress,
754 data := pl_data,
755 optionalPart:= {
756 segmentation:=pl_segm,
757 importance := pl_imp
758 },
759 eop:= { paramName:=con_SCCP_eop }
760 }
761
762
763//******************************************************************************
764// Message Extended Unitdata Service(XUDTS) (Q713 $4.19)
765//******************************************************************************
766//------------------------------------------------------------------------------
767
768//------------------------------------------------------------------------------
769// Not supported
770//------------------------------------------------------------------------------
771
772
773
774//******************************************************************************
775// Message Long Unitdata (LUDT) (Q713 $4.20)
776//******************************************************************************
777//------------------------------------------------------------------------------
778
779//------------------------------------------------------------------------------
780// Not supported
781//------------------------------------------------------------------------------
782
783
784//******************************************************************************
785// Message Long Unitdata Service (LUDTS) (Q713 $4.21)
786//******************************************************************************
787
788//------------------------------------------------------------------------------
789// Not supported
790//------------------------------------------------------------------------------
791
792
793//******************************************************************************
794// SCCP management messages (Q713 $5.3)
795//******************************************************************************
796//------------------------------------------------------------------------------
797// Not supported
798//------------------------------------------------------------------------------
799
800
801
802}//endgroup PDUTemplateDefinitionsSending
803
804//******************************************************************************
805
806group PDUTemplateDefinitionsReceiving
807{
808
809
810
811//******************************************************************************
812// Message Connection Request (CR) (Q713 $4.2)
813//******************************************************************************
814
815//------------------------------------------------------------------------------
816// Message definition
817//------------------------------------------------------------------------------
818 template PDU_SCCP_ConnectionRequest tr_PDU_SCCP_ConnectionRequest:=
819 {
820 messageType:=cr,
821 sourceLocRef:=?,
822 protClass:=?,
823 pointer1:=?,
824 pointer2:=?,
825 calledPAddress:=?,
826 optionalPart:= {
827 credit:=*,
828 callingPAddress:=*,
829 data:=*,
830 hopCounter:=*,
831 importance:=*
832 },
833 eop:=*
834 }
835
836
837
838//******************************************************************************
839// Message Connection Confirm (CC) (Q713 $4.3)
840//******************************************************************************
841
842
843
844//------------------------------------------------------------------------------
845// Message definition
846//------------------------------------------------------------------------------
847template PDU_SCCP_ConnectionConfirm tr_PDU_SCCP_ConnectionConfirm:=
848{
849 messageType:=cc,
850 destLocRef:=?,
851 sourceLocRef:=?,
852 protClass:=?,
853 pointer1:=?,
854 optionalPart:= {
855 credit:=*,
856 calledPAddress:=*,
857 data:=*,
858 importance:=*
859 },
860 eop:=*
861}
862
863
864//******************************************************************************
865// Message Connection Refused (CREF) (Q713 $4.4)
866//******************************************************************************
867
868//------------------------------------------------------------------------------
869// Message definition
870//------------------------------------------------------------------------------
871template PDU_SCCP_ConnectionRefused tr_PDU_SCCP_ConnectionRefused:=
872{
873 messageType:=cref,
874 destLocRef:=?,
875 refusalCause:=?,
876 pointer1:=?,
877 optionalPart:= {
878 calledPAddress:=*,
879 data:=*,
880 importance:=*
881 },
882 eop:=*
883}
884
885
886//******************************************************************************
887// Message Released (RLSD) (Q713 $4.5)
888//******************************************************************************
889
890//------------------------------------------------------------------------------
891// Message definition
892//------------------------------------------------------------------------------
893template PDU_SCCP_Released tr_PDU_SCCP_Released:=
894{
895 messageType:=rlsd,
896 destLocRef:=?,
897 sourceLocRef:=?,
898 releaseCause:=?,
899 pointer1:=?,
900 optionalPart:= {
901 data:=*,
902 importance:=*
903 },
904 eop:=*
905}
906
907
908
909//******************************************************************************
910// Message Release Complete (RLC) (Q713 $4.6)
911//******************************************************************************
912//------------------------------------------------------------------------------
913// Message definition
914//------------------------------------------------------------------------------
915
916template PDU_SCCP_ReleaseComplete tr_PDU_SCCP_ReleaseComplete:=
917{
918 messageType:=rlc,
919 destLocRef:=?,
920 sourceLocRef:=?
921}
922
923
924
925//******************************************************************************
926// Message Data form 1 (DT1) (Q713 $4.7)
927//******************************************************************************
928//------------------------------------------------------------------------------
929// Message definition
930//------------------------------------------------------------------------------
931template PDU_SCCP_DataForm1 tr_PDU_SCCP_DataForm1:=
932{
933 messageType:=dt1,
934 destLocRef:=?,
935 segmentingReassembl:=?,
936 pointer1:=?,
937 data:=?
938}
939
940//******************************************************************************
941// Message Data form 2 (DT2) (Q713 $4.8)
942//******************************************************************************
943//------------------------------------------------------------------------------
944// Not supported
945//------------------------------------------------------------------------------
946
947//******************************************************************************
948// Message Data Acknowledgement (AK) (Q713 $4.9)
949//******************************************************************************
950//------------------------------------------------------------------------------
951// Not supported
952//------------------------------------------------------------------------------
953
954
955//******************************************************************************
956// Message Unitdata (UDT) (Q713 $4.10)
957//******************************************************************************
958//------------------------------------------------------------------------------
959// Message definition
960//------------------------------------------------------------------------------
961
962template PDU_SCCP_Unitdata tr_PDU_SCCP_Unitdata:=
963{
964 messageType:=udt,
965 protClass:=?,
966 pointer1:=?,
967 pointer2:=?,
968 pointer3:=?,
969 calledPAddress:=?,
970 callingPAddress:=?,
971 data:=?
972}
973
974//******************************************************************************
975// Message Unitdata service (UDTS) (Q713 $4.11)
976//******************************************************************************
977//------------------------------------------------------------------------------
978// Message definition
979//------------------------------------------------------------------------------
980
981template PDU_SCCP_UnitdataService tr_PDU_SCCP_UnitdataService:=
982{
983 messageType:=udts,
984 returnCause:=?,
985 pointer1:=?,
986 pointer2:=?,
987 pointer3:=?,
988 calledPAddress:=?,
989 callingPAddress:=?,
990 data:=?
991}
992
993//******************************************************************************
994// Message Expedited Data (ED) (Q713 $4.12)
995//******************************************************************************
996//------------------------------------------------------------------------------
997// Not supported
998//------------------------------------------------------------------------------
999
1000
1001//******************************************************************************
1002// Message Expedited Data Acknowledgement (EA) (Q713 $4.13)
1003//******************************************************************************
1004//------------------------------------------------------------------------------
1005// Not supported
1006//------------------------------------------------------------------------------
1007
1008//******************************************************************************
1009// Message Reset Request (RSR) (Q713 $4.14)
1010//******************************************************************************
1011
1012template PDU_SCCP_ResetRequest tr_PDU_SCCP_ResetRequest:=
1013{
1014 messageType:=rsr,
1015 destLocRef:=?,
1016 sourceLocRef:=?,
1017 resetCause:=?
1018}
1019
1020//******************************************************************************
1021// Message Reset Confirmation (RSC) (Q713 $4.15)
1022//******************************************************************************
1023
1024template PDU_SCCP_ResetConfirm tr_PDU_SCCP_ResetConfirm:=
1025{
1026 messageType:=rsr,
1027 destLocRef:=?,
1028 sourceLocRef:=?
1029}
1030
1031//******************************************************************************
1032// Message Protocol data unit error (ERR) (Q713 $4.16)
1033//******************************************************************************
1034
1035template PDU_SCCP_ProtDataUnitError tr_PDU_SCCP_ProtDataUnitError:=
1036{
1037 messageType:=rsr,
1038 destLocRef:=?,
1039 errorCause:=?
1040}
1041
1042//******************************************************************************
1043// Message Inactivity test (IT) (Q713 $4.17)
1044//******************************************************************************
1045
1046template PDU_SCCP_InactivityTest tr_PDU_SCCP_InactivityTest:=
1047{
1048 messageType:=it,
1049 destLocRef:=?,
1050 sourceLocRef:=?,
1051 protClass:=?,
1052 sequencingSegmenting:=?,
1053 credit:=?
1054}
1055
1056//******************************************************************************
1057// Message Extended Unitdata (XUDT) (Q713 $4.18)
1058//******************************************************************************
1059
1060
1061template PDU_SCCP_ExtUnitdata tr_PDU_SCCP_ExtUnitdata :=
1062{
1063 messageType:=xudt,
1064 protClass:= ?, //connection oriented but no flow control
1065 hopCounter:=?,
1066 pointer1:=?,
1067 pointer2:=?,
1068 pointer3:=?,
1069 pointer4:=?,
1070 calledPAddress:=?,
1071 callingPAddress:=?,
1072 data := ?,
1073 optionalPart:= {
1074 segmentation:=*,
1075 importance := *
1076 },
1077 eop:= *
1078}
1079
1080//------------------------------------------------------------------------------
1081
1082//******************************************************************************
1083// Message Extended Unitdata Service(XUDTS) (Q713 $4.19)
1084//******************************************************************************
1085//------------------------------------------------------------------------------
1086
1087//------------------------------------------------------------------------------
1088// Not supported
1089//------------------------------------------------------------------------------
1090
1091//******************************************************************************
1092// Message Long Unitdata (LUDT) (Q713 $4.20)
1093//******************************************************************************
1094//------------------------------------------------------------------------------
1095
1096//------------------------------------------------------------------------------
1097// Not supported
1098//------------------------------------------------------------------------------
1099
1100
1101//******************************************************************************
1102// Message Long Unitdata Service (LUDTS) (Q713 $4.21)
1103//******************************************************************************
1104
1105//------------------------------------------------------------------------------
1106// Not supported
1107//------------------------------------------------------------------------------
1108
1109
1110//******************************************************************************
1111// SCCP management messages (Q713 $5.3)
1112//******************************************************************************
1113//------------------------------------------------------------------------------
1114// Not supported
1115//------------------------------------------------------------------------------
1116
1117
1118
1119}//endgroup PDUTemplateDefinitionsReceiving
1120
1121type record of boolean Timer_Snapshot;
1122type enumerated TimerIdentifierType {conn_est, ias, iar, rel, repeat_rel, int, reset,internal_reset, t_guard};
1123
1124
1125type component SCCP_CT
1126{ //startcomponent SCCP_CT
1127
1128 //Component variables
1129 //***************************************************************
1130 // Connection Oriented Signalling:
1131 // StateTransition-> ConnectionData;
1132 var ConnectionData ConnectionTable[16]; //16 connections 0 to 15
1133 var integer v_session; // actual conn. oriented session index
1134
1135 // Connectioenless Signalling:
1136 //== sending ==
1137 var OCT3 segmLocRefTable[16];
1138 var integer v_segmLocRefIndex; // last index in segmLocRefTable, cyclical incremented
1139 //==receiving==
1140 var ClessRcvBuff ClessRcvBuffTable[16];
1141
1142 var integer v_reference; // not used ???
1143
1144 var hexstring v_own_GT;
1145 var hexstring v_remote_GT;
1146 var integer v_SSN;
1147 var OCT1 v_SIO;
1148 var integer v_NI; //network indicator, if NI<2 => international
1149 var integer v_own_SPC;
1150 var integer v_remote_SPC;
1151 var integer v_SLS;
1152
1153 var SCCP_ServiceType v_SCCPServiceType; //enum: itu, ansi, ttc or mpt
1154 //var v_maxLocalReference; // Local Reference max. value, see in SCCP.ttcn
1155 var integer v_PC_length; //length of point code, calculated at start! NOT USED
1156 var integer v_RoutingLabelLen; //in bytes
1157 var integer v_sccp_data_maxlen; // dt1 payload length upper limit
1158 var integer v_sccp_pdu_maxlen; // SIF len -routing label len
1159
1160 var Timer_Snapshot v_T_conn_est;
1161 var Timer_Snapshot v_T_ias;
1162 var Timer_Snapshot v_T_iar;
1163 var Timer_Snapshot v_T_rel;
1164 var Timer_Snapshot v_T_repeat_rel;
1165 var Timer_Snapshot v_T_int;
1166 var Timer_Snapshot v_T_reset;
1167 var Timer_Snapshot v_T_internal_reset;
1168 var Timer_Snapshot v_T_guard;
1169 //var Timer_Snapshot v_T_T_guard;
1170 //***************************************************************
1171
1172 port SCCPasp_SP_PT SCCP_SP_PORT;//port type defined in SCCP_ASPs
1173 port MTP3asp_SCCP_PT MTP3_SCCP_PORT;
1174
1175 //component timers
1176
1177 timer T_conn_est[cg_TimerArraySize]:= { tspc_timer_T_conn_est,tspc_timer_T_conn_est,
1178 tspc_timer_T_conn_est,tspc_timer_T_conn_est,
1179 tspc_timer_T_conn_est,tspc_timer_T_conn_est,
1180 tspc_timer_T_conn_est,tspc_timer_T_conn_est,
1181 tspc_timer_T_conn_est,tspc_timer_T_conn_est,
1182 tspc_timer_T_conn_est,tspc_timer_T_conn_est,
1183 tspc_timer_T_conn_est,tspc_timer_T_conn_est,
1184 tspc_timer_T_conn_est,tspc_timer_T_conn_est };
1185
1186 timer T_ias[cg_TimerArraySize]:= { tspc_timer_T_ias,tspc_timer_T_ias,
1187 tspc_timer_T_ias,tspc_timer_T_ias,
1188 tspc_timer_T_ias,tspc_timer_T_ias,
1189 tspc_timer_T_ias,tspc_timer_T_ias,
1190 tspc_timer_T_ias,tspc_timer_T_ias,
1191 tspc_timer_T_ias,tspc_timer_T_ias,
1192 tspc_timer_T_ias,tspc_timer_T_ias,
1193 tspc_timer_T_ias,tspc_timer_T_ias };
1194
1195 timer T_iar[cg_TimerArraySize]:= { tspc_timer_T_iar,tspc_timer_T_iar,
1196 tspc_timer_T_iar,tspc_timer_T_iar,
1197 tspc_timer_T_iar,tspc_timer_T_iar,
1198 tspc_timer_T_iar,tspc_timer_T_iar,
1199 tspc_timer_T_iar,tspc_timer_T_iar,
1200 tspc_timer_T_iar,tspc_timer_T_iar,
1201 tspc_timer_T_iar,tspc_timer_T_iar,
1202 tspc_timer_T_iar,tspc_timer_T_iar };
1203
1204 timer T_rel[cg_TimerArraySize]:= { tspc_timer_T_rel,tspc_timer_T_rel,
1205 tspc_timer_T_rel,tspc_timer_T_rel,
1206 tspc_timer_T_rel,tspc_timer_T_rel,
1207 tspc_timer_T_rel,tspc_timer_T_rel,
1208 tspc_timer_T_rel,tspc_timer_T_rel,
1209 tspc_timer_T_rel,tspc_timer_T_rel,
1210 tspc_timer_T_rel,tspc_timer_T_rel,
1211 tspc_timer_T_rel,tspc_timer_T_rel };
1212
1213 timer T_repeat_rel[cg_TimerArraySize]:= { tspc_timer_T_repeat_rel,tspc_timer_T_repeat_rel,
1214 tspc_timer_T_repeat_rel,tspc_timer_T_repeat_rel,
1215 tspc_timer_T_repeat_rel,tspc_timer_T_repeat_rel,
1216 tspc_timer_T_repeat_rel,tspc_timer_T_repeat_rel,
1217 tspc_timer_T_repeat_rel,tspc_timer_T_repeat_rel,
1218 tspc_timer_T_repeat_rel,tspc_timer_T_repeat_rel,
1219 tspc_timer_T_repeat_rel,tspc_timer_T_repeat_rel,
1220 tspc_timer_T_repeat_rel,tspc_timer_T_repeat_rel };
1221
1222 timer T_int[cg_TimerArraySize]:= { tspc_timer_T_int,tspc_timer_T_int,
1223 tspc_timer_T_int,tspc_timer_T_int,
1224 tspc_timer_T_int,tspc_timer_T_int,
1225 tspc_timer_T_int,tspc_timer_T_int,
1226 tspc_timer_T_int,tspc_timer_T_int,
1227 tspc_timer_T_int,tspc_timer_T_int,
1228 tspc_timer_T_int,tspc_timer_T_int,
1229 tspc_timer_T_int,tspc_timer_T_int };
1230
1231
1232/* timer T_T_guard[cg_TimerArraySize]:= { tspc_timer_T_guard,tspc_timer_T_guard,
1233 tspc_timer_T_guard,tspc_timer_T_guard,
1234 tspc_timer_T_guard,tspc_timer_T_guard,
1235 tspc_timer_T_guard,tspc_timer_T_guard,
1236 tspc_timer_T_guard,tspc_timer_T_guard,
1237 tspc_timer_T_guard,tspc_timer_T_guard,
1238 tspc_timer_T_guard,tspc_timer_T_guard,
1239 tspc_timer_T_guard,tspc_timer_T_guard };
1240*/
1241
1242 timer T_reset[cg_TimerArraySize]:= { tspc_timer_T_reset,tspc_timer_T_reset,
1243 tspc_timer_T_reset,tspc_timer_T_reset,
1244 tspc_timer_T_reset,tspc_timer_T_reset,
1245 tspc_timer_T_reset,tspc_timer_T_reset,
1246 tspc_timer_T_reset,tspc_timer_T_reset,
1247 tspc_timer_T_reset,tspc_timer_T_reset,
1248 tspc_timer_T_reset,tspc_timer_T_reset,
1249 tspc_timer_T_reset,tspc_timer_T_reset };
1250
1251
1252 timer T_internal_reset[cg_TimerArraySize]:= { tspc_timer_T_internal_reset,tspc_timer_T_internal_reset,
1253 tspc_timer_T_internal_reset,tspc_timer_T_internal_reset,
1254 tspc_timer_T_internal_reset,tspc_timer_T_internal_reset,
1255 tspc_timer_T_internal_reset,tspc_timer_T_internal_reset,
1256 tspc_timer_T_internal_reset,tspc_timer_T_internal_reset,
1257 tspc_timer_T_internal_reset,tspc_timer_T_internal_reset,
1258 tspc_timer_T_internal_reset,tspc_timer_T_internal_reset,
1259 tspc_timer_T_internal_reset,tspc_timer_T_internal_reset };
1260
1261
1262 timer T_guard[cg_TimerArraySize]:= { tspc_timer_guard,tspc_timer_guard,
1263 tspc_timer_guard,tspc_timer_guard,
1264 tspc_timer_guard,tspc_timer_guard,
1265 tspc_timer_guard,tspc_timer_guard,
1266 tspc_timer_guard,tspc_timer_guard,
1267 tspc_timer_guard,tspc_timer_guard,
1268 tspc_timer_guard,tspc_timer_guard,
1269 tspc_timer_guard,tspc_timer_guard };
1270
1271}//endcomponent SCCP_CT
1272
1273
1274group SCCPFunctions
1275{//startgroup SCCPFunctions
1276 //******************************************************************
1277 function f_StartTimer(TimerIdentifierType pl_TimerIdentifier,integer pl_TimerIndex,float pl_duration := -1.0) runs on SCCP_CT
1278 //******************************************************************
1279 {
1280 select (pl_TimerIdentifier)
1281 {
1282 case(conn_est)
1283 {
1284 if(pl_duration < 0.0){
1285 T_conn_est[pl_TimerIndex].start;
1286 v_T_conn_est[pl_TimerIndex] := true;
1287 }
1288 else{
1289 T_conn_est[pl_TimerIndex].start(pl_duration);
1290 v_T_conn_est[pl_TimerIndex] := true;
1291 }
1292 }
1293 case(ias)
1294 {
1295 if(pl_duration < 0.0){
1296 T_ias[pl_TimerIndex].start;
1297 v_T_ias[pl_TimerIndex] := true;
1298 }
1299 else{
1300 T_ias[pl_TimerIndex].start(pl_duration);
1301 v_T_ias[pl_TimerIndex] := true;
1302 }
1303 }
1304 case(iar)
1305 {
1306 if(pl_duration < 0.0){
1307 T_iar[pl_TimerIndex].start;
1308 v_T_iar[pl_TimerIndex] := true;
1309 }
1310 else{
1311 T_iar[pl_TimerIndex].start(pl_duration);
1312 v_T_iar[pl_TimerIndex] := true;
1313 }
1314 }
1315 case(rel)
1316 {
1317 if(pl_duration < 0.0){
1318 T_rel[pl_TimerIndex].start;
1319 v_T_rel[pl_TimerIndex] := true;
1320 }
1321 else{
1322 T_rel[pl_TimerIndex].start(pl_duration);
1323 v_T_rel[pl_TimerIndex] := true;
1324 }
1325 }
1326 case(repeat_rel)
1327 {
1328 if(pl_duration < 0.0){
1329 T_repeat_rel[pl_TimerIndex].start;
1330 v_T_repeat_rel[pl_TimerIndex] := true;
1331 }
1332 else{
1333 T_repeat_rel[pl_TimerIndex].start(pl_duration);
1334 v_T_repeat_rel[pl_TimerIndex] := true;
1335 }
1336 }
1337 case(int)
1338 {
1339 if(pl_duration < 0.0){
1340 T_int[pl_TimerIndex].start;
1341 v_T_int[pl_TimerIndex] := true;
1342 }
1343 else{
1344 T_int[pl_TimerIndex].start(pl_duration);
1345 v_T_int[pl_TimerIndex] := true;
1346 }
1347 }
1348 case(reset)
1349 {
1350 if(pl_duration < 0.0){
1351 T_reset[pl_TimerIndex].start;
1352 v_T_reset[pl_TimerIndex] := true;
1353 }
1354 else{
1355 T_reset[pl_TimerIndex].start(pl_duration);
1356 v_T_reset[pl_TimerIndex] := true;
1357 }
1358 }
1359 case(internal_reset)
1360 {
1361 if(pl_duration < 0.0){
1362 T_internal_reset[pl_TimerIndex].start;
1363 v_T_internal_reset[pl_TimerIndex] := true;
1364 }
1365 else{
1366 T_internal_reset[pl_TimerIndex].start(pl_duration);
1367 v_T_internal_reset[pl_TimerIndex] := true;
1368 }
1369 }
1370 case(t_guard)
1371 {
1372 if(pl_duration < 0.0){
1373 T_guard[pl_TimerIndex].start;
1374 v_T_guard[pl_TimerIndex] := true;
1375 }
1376 else{
1377 T_guard[pl_TimerIndex].start(pl_duration);
1378 v_T_guard[pl_TimerIndex] := true;
1379 }
1380 }
1381 case else
1382 {log("Warning: Incorrect Timer!")}
1383 }
1384 }
1385 //******************************************************************
1386 function f_StopTimer(TimerIdentifierType pl_TimerIdentifier,integer pl_TimerIndex) runs on SCCP_CT
1387 //******************************************************************
1388 {
1389 select (pl_TimerIdentifier)
1390 {
1391 case(conn_est)
1392 {
1393 T_conn_est[pl_TimerIndex].stop;
1394 v_T_conn_est[pl_TimerIndex] := false;
1395 }
1396 case(ias)
1397 {
1398 T_ias[pl_TimerIndex].stop;
1399 v_T_ias[pl_TimerIndex] := false;
1400 }
1401 case(iar)
1402 {
1403 T_iar[pl_TimerIndex].stop;
1404 v_T_iar[pl_TimerIndex] := false;
1405 }
1406 case(rel)
1407 {
1408 T_rel[pl_TimerIndex].stop;
1409 v_T_rel[pl_TimerIndex] := false;
1410 }
1411 case(repeat_rel)
1412 {
1413 T_repeat_rel[pl_TimerIndex].stop;
1414 v_T_repeat_rel[pl_TimerIndex] := false;
1415 }
1416 case(int)
1417 {
1418 T_int[pl_TimerIndex].stop;
1419 v_T_int[pl_TimerIndex] := false;
1420 }
1421 case(reset)
1422 {
1423 T_reset[pl_TimerIndex].stop;
1424 v_T_reset[pl_TimerIndex] := false;
1425 }
1426 case(internal_reset)
1427 {
1428 T_internal_reset[pl_TimerIndex].stop;
1429 v_T_internal_reset[pl_TimerIndex] := false;
1430 }
1431 case(t_guard)
1432 {
1433 T_guard[pl_TimerIndex].stop;
1434 v_T_guard[pl_TimerIndex] := false;
1435 }
1436 case else
1437 {log("Warning: Incorrect Timer!")}
1438 }
1439 }
1440
1441 //******************************************************************
1442 function f_initialize_timer_states() runs on SCCP_CT
1443 //******************************************************************
1444 {
1445 var integer i;
1446 for (i:=0; i<cg_TimerArraySize;i:=i+1) {
1447 v_T_conn_est[i] := false;
1448 v_T_ias[i] := false;
1449 v_T_iar[i] := false;
1450 v_T_rel[i] := false;
1451 v_T_repeat_rel[i] := false;
1452 v_T_int[i] := false;
1453 v_T_reset[i] := false;
1454 v_T_internal_reset[i] := false;
1455 v_T_guard[i] := false;
1456 }
1457 }
1458
1459 //******************************************************************
1460 function SCCPStart(MSC_SCCP_MTP3_parameters pl_Boot) runs on SCCP_CT
1461 //******************************************************************
1462 {
1463 //local declarations
1464 var integer vl_j;
1465
1466 //initializes variables with 'SCCP_CT' visibility/scope
1467 v_segmLocRefIndex := 0;
1468 v_reference:=0;
1469 v_SIO:= bit2oct(pl_Boot.sio.ni & pl_Boot.sio.prio & pl_Boot.sio.si);
1470 v_NI := oct2int(v_SIO)/64;
1471 v_own_SPC:=pl_Boot.opc;
1472 v_remote_SPC:=pl_Boot.dpc;
1473 v_SLS:=pl_Boot.sls;
1474 v_SCCPServiceType := pl_Boot.sccp_serviceType;
1475
1476 if (ispresent(pl_Boot.ssn))
1477 {
1478 v_SSN:=pl_Boot.ssn;
1479 }
1480 else
1481 {
1482 v_SSN:=0;
1483 }
1484 if( (v_SCCPServiceType == mtp3_itu) or
1485 (v_SCCPServiceType == mtp3b_itu) )
1486 {
1487 v_RoutingLabelLen := 4;
1488 }
1489 else if( (v_SCCPServiceType == mtp3_ansi) or
1490 (v_SCCPServiceType == mtp3b_ansi) )
1491 {
1492 v_RoutingLabelLen := 7;
1493 }
1494 else if ( (v_SCCPServiceType == mtp3_ttc) or
1495 (v_SCCPServiceType == mtp3b_ttc) )
1496 {
1497 if(v_NI>= 2) { v_RoutingLabelLen := 5; }
1498 else { v_RoutingLabelLen := 4; }
1499 }
1500 else if( v_SCCPServiceType == m3ua )
1501 {
1502 v_RoutingLabelLen := 4; // not really...
1503 //v_sccp_data_maxlen := 261;
1504 }
1505 else if ( (v_SCCPServiceType == mtp3_mpt))
1506 {
1507 if(v_NI== 2) { v_RoutingLabelLen := 7; }
1508 else { v_RoutingLabelLen := 4; }
1509 }
1510 else
1511 {
1512 log( "Wrong SCCPServiceType value was selected in the config file");
1513 log("Modified for default value 'mtp3_itu'.");
1514 v_SCCPServiceType := mtp3_itu;
1515 v_RoutingLabelLen := 4; //itu
1516
1517 }
1518
1519 // mtp3_itu_b i.e. itu mtp3b
1520 // SCCP_ansi_b i.e ansi mtp3b settings ???
1521 //272= max length of SIF, see Fig3-3B/T1.111.4-2001
1522 //temp for test: 10 ?
1523 //tsp_SIF_MaxLength = 272
1524 v_sccp_pdu_maxlen := tsp_SIF_MaxLength - v_RoutingLabelLen; // -; //7: msg_type+locref+ptr+len
1525 log("v_sccp_pdu_maxlen:",v_sccp_pdu_maxlen);
1526 v_sccp_data_maxlen := v_sccp_pdu_maxlen-7; // dt1 payload // -7: msg_type+locref+ptr+len
1527
1528 for (vl_j:=0;vl_j<16;vl_j:=vl_j+1)
1529 {
1530 ConnectionTable[vl_j].localReference :='000000'O;
1531 ConnectionTable[vl_j].remoteReference:='000000'O;
1532 ConnectionTable[vl_j].state :=idle;
1533 ConnectionTable[vl_j].connectionId :=0;
1534 ConnectionTable[vl_j].reassembler_buffer.buffer :=''O;
1535 ConnectionTable[vl_j].reassembler_buffer.actlen := 0;
1536 ConnectionTable[vl_j].reassembler_buffer.maxlen := 16*v_sccp_data_maxlen; //????
1537 segmLocRefTable[vl_j] := '000000'O;
1538 reallocate_ClessRcvBuff(vl_j);
1539
1540 }//endfor
1541
1542 //starts SCCP execution
1543 ScanEvents();
1544 }//endfunction of SCCPStart
1545
1546
1547 //******************************************************************
1548 function ReleaseResources(in integer pl_session) runs on SCCP_CT
1549 //******************************************************************
1550 {//startfunction
1551
1552 //release resources
1553 ConnectionTable[pl_session].remoteReference:='000000'O;
1554 ConnectionTable[pl_session].localReference:='000000'O;
1555 ConnectionTable[pl_session].connectionId:=0;
1556 Stop_sessionTimers(pl_session);
1557 ConnectionTable[pl_session].state:=idle;
1558 ConnectionTable[pl_session].reassembler_buffer.buffer:=''O;
1559 ConnectionTable[pl_session].reassembler_buffer.actlen:=0;
1560 }//endfunction ReleaseResources
1561
1562 //******************************************************************
1563 function GuardTimer_Expired(in integer pl_session) runs on SCCP_CT
1564 //no answer to ASP_SCCP_N_CONNECT_ind received
1565 //******************************************************************
1566 {//startfunction
1567
1568 //local declarations
1569 var PDU_SCCP vl_PDU_SCCP;
1570
1571 //Action Table follows
1572
1573 if (ConnectionTable[pl_session].state==connection_pending_IC)
1574 {//startif
1575
1576 //send Released-this should disconnect the other end
1577 vl_PDU_SCCP.released.messageType:=rlsd;
1578 vl_PDU_SCCP.released.destLocRef:=ConnectionTable[pl_session].remoteReference;
1579 vl_PDU_SCCP.released.sourceLocRef:=ConnectionTable[pl_session].localReference;
1580 vl_PDU_SCCP.released.releaseCause:=cg_Rel_endUserOrig;
1581 vl_PDU_SCCP.released.pointer1:=0;
1582 vl_PDU_SCCP.released.optionalPart:=omit;
1583 vl_PDU_SCCP.released.eop:=omit;
1584
1585 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
1586 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP));//send Released
1587
1588 //release resources, return to idle
1589 ReleaseResources(pl_session);
1590
1591 }//endif
1592
1593 }//endfunction GuardTimer_Expired
1594
1595
1596 //******************************************************************
1597 function InternalResetTimer_Expired(integer pl_session) runs on SCCP_CT
1598 //******************************************************************
1599 {//startfunction
1600
1601 //local declarations
1602 var PDU_SCCP vl_PDU_SCCP;
1603 var ASP_SCCP_N_RESET_ind vl_N_RESET_ind;
1604
1605 //Action Table follows
1606
1607 if (ConnectionTable[pl_session].state==active)
1608 {//startif
1609 //send ASP_SCCP_N_RESET_ind
1610 //assemble ASP_SCCP_N_ASP
1611 vl_N_RESET_ind.originator:=cg_NSP;
1612 vl_N_RESET_ind.reason:=cg_DISC_abnormal_T;
1613 vl_N_RESET_ind.connectionId:=ConnectionTable[pl_session].connectionId;
1614
1615 SCCP_SP_PORT.send( t_ASP_N_RESET_ind(
1616 vl_N_RESET_ind.originator,
1617 vl_N_RESET_ind.reason,
1618 vl_N_RESET_ind.connectionId
1619 ));//send ASP_SCCP_N_RESET_ind
1620 //send Reset Request
1621
1622 vl_PDU_SCCP.resetreq.messageType:=rsr;
1623 vl_PDU_SCCP.resetreq.destLocRef:=ConnectionTable[pl_session].remoteReference;
1624 vl_PDU_SCCP.resetreq.sourceLocRef:=ConnectionTable[pl_session].localReference;
1625 vl_PDU_SCCP.resetreq.resetCause:=cg_Res_endUserOrig;
1626
1627 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
1628 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP));//send Reset Request
1629
1630 //start reset timer
1631
1632 f_StartTimer(reset,pl_session);
1633 //restart send inactivity timer
1634 f_StopTimer(ias,pl_session);//to avoid warnings
1635 f_StartTimer(ias,pl_session);
1636 //reset variables etc.
1637 //change state
1638 ConnectionTable[pl_session].state:=reset_bothway;
1639
1640 }//endif
1641 }//InternalResetTimer_Expired
1642
1643 //******************************************************************
1644 function Reset_Timer_Expired(integer pl_session) runs on SCCP_CT
1645 //******************************************************************
1646 {//startfunction
1647
1648 //local declarations
1649 var ASP_SCCP_N_DISCONNECT_ind vl_N_DISCONNECT_ind;
1650
1651 //Action Table follows
1652 if (ConnectionTable[pl_session].state==reset_bothway)
1653 {//startif
1654
1655 //assemble ASP_SCCP_N_
1656 vl_N_DISCONNECT_ind.originator:=cg_NSP;
1657 vl_N_DISCONNECT_ind.reason:=cg_DISC_abnormal_T;
1658 vl_N_DISCONNECT_ind.connectionId:=ConnectionTable[pl_session].connectionId;
1659
1660 SCCP_SP_PORT.send( t_ASP_N_DISCONNECT_ind(
1661 vl_N_DISCONNECT_ind.originator,
1662 omit,
1663 vl_N_DISCONNECT_ind.reason,
1664 omit,
1665 vl_N_DISCONNECT_ind.connectionId,
1666 omit
1667 ));//send ASP_SCCP_N_DISCONNECT_ind
1668
1669 //release resources, stop inactivity timers, change state to idle
1670 ReleaseResources(pl_session);
1671 }//endif
1672
1673 }//Reset_Timer_Expired
1674
1675 //******************************************************************
1676 function Interval_Timer_Expired(integer pl_session) runs on SCCP_CT
1677 //******************************************************************
1678 {//startfunction
1679
1680 //Action Table follows
1681 if (ConnectionTable[pl_session].state==disconnect_pending)
1682 {
1683 log ("Interval timer expired");
1684 //release resources
1685 ReleaseResources(pl_session);
1686 }
1687
1688 }//Interval_Timer_Expired
1689
1690
1691
1692 //******************************************************************
1693 function RepeatRelease_Timer_Expired(integer pl_session) runs on SCCP_CT
1694 //******************************************************************
1695 {
1696
1697 //local declarations
1698 var PDU_SCCP vl_PDU_SCCP;
1699
1700 //Action Table follows
1701 if (ConnectionTable[pl_session].state==disconnect_pending)
1702 {
1703 //assemble and route MTP3_ASP
1704 vl_PDU_SCCP.released.messageType:=rlsd;
1705 vl_PDU_SCCP.released.destLocRef:=ConnectionTable[pl_session].remoteReference;
1706 vl_PDU_SCCP.released.sourceLocRef:=ConnectionTable[pl_session].localReference;
1707 vl_PDU_SCCP.released.releaseCause:=cg_Res_endUserOrig;
1708 vl_PDU_SCCP.released.pointer1:=0;
1709 vl_PDU_SCCP.released.optionalPart:=omit;
1710 vl_PDU_SCCP.released.eop:=omit;
1711
1712 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
1713 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP));//send Released
1714
1715 //restart repeat release timer
1716 f_StopTimer(repeat_rel,pl_session);//to avoid warnings
1717 f_StartTimer(repeat_rel,pl_session);
1718 //no state change, return
1719 }
1720
1721 }//RepeatRelease_Timer_Expired
1722
1723
1724 //******************************************************************
1725 function Release_Timer_Expired(integer pl_session) runs on SCCP_CT
1726 //******************************************************************
1727 {
1728
1729 //local declarations
1730 var PDU_SCCP vl_PDU_SCCP;
1731
1732 //Action Table follows
1733 if (ConnectionTable[pl_session].state==disconnect_pending)
1734 {
1735 //assemble and route MTP3_ASP
1736 vl_PDU_SCCP.released.messageType:=rlsd;
1737 vl_PDU_SCCP.released.destLocRef:=ConnectionTable[pl_session].remoteReference;
1738 vl_PDU_SCCP.released.sourceLocRef:=ConnectionTable[pl_session].localReference;
1739 vl_PDU_SCCP.released.releaseCause:=cg_Res_endUserOrig;//?
1740 vl_PDU_SCCP.released.pointer1:=0;
1741 vl_PDU_SCCP.released.optionalPart:=omit;
1742 vl_PDU_SCCP.released.eop:=omit;
1743
1744 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
1745 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP));//send Released
1746
1747 f_StartTimer(repeat_rel,pl_session);
1748 f_StartTimer(int,pl_session);
1749 //no state change, return
1750
1751 }//endif
1752
1753 }//Release_Timer_Expired
1754
1755
1756 //******************************************************************
1757 function ReceiveInactivity_Timer_Expired(integer pl_session) runs on SCCP_CT
1758 //******************************************************************
1759 {
1760 //local declarations
1761 var PDU_SCCP vl_PDU_SCCP;
1762 var ASP_SCCP_N_DISCONNECT_ind vl_N_DISCONNECT_ind;
1763
1764 //Action Table follows
1765 if (ConnectionTable[pl_session].state==idle){}
1766 else if (ConnectionTable[pl_session].state==active)
1767 {
1768 //assemble ASP_SCCP_N_
1769 vl_N_DISCONNECT_ind.originator:=cg_NSP;
1770 vl_N_DISCONNECT_ind.reason:=cg_DISC_endUserFailure;//?
1771 vl_N_DISCONNECT_ind.connectionId:=ConnectionTable[pl_session].connectionId;
1772
1773 SCCP_SP_PORT.send( t_ASP_N_DISCONNECT_ind(
1774 vl_N_DISCONNECT_ind.originator,
1775 omit,
1776 vl_N_DISCONNECT_ind.reason,
1777 omit,
1778 vl_N_DISCONNECT_ind.connectionId,
1779 omit
1780 ));//send ASP_SCCP_N_DISCONNECT_ind
1781
1782 //stop inactivity timers
1783 f_StopTimer(ias,pl_session);
1784 f_StopTimer(iar,pl_session);
1785
1786 //assemble and route MTP3_ASP
1787
1788 vl_PDU_SCCP.released.messageType:=rlsd;
1789 vl_PDU_SCCP.released.destLocRef:=ConnectionTable[pl_session].remoteReference;
1790 vl_PDU_SCCP.released.sourceLocRef:=ConnectionTable[pl_session].localReference;
1791 vl_PDU_SCCP.released.releaseCause:=cg_Rel_expRecInacTimer;
1792 vl_PDU_SCCP.released.pointer1:=0;// No options
1793 vl_PDU_SCCP.released.optionalPart:=omit;
1794 vl_PDU_SCCP.released.eop:=omit;
1795
1796 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
1797 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP));//send Released
1798
1799 //start release timer
1800 f_StartTimer(rel,pl_session);
1801 ConnectionTable[pl_session].state:=disconnect_pending;
1802
1803 }//endif
1804
1805 }//ReceiveInactivity_Timer_Expired
1806
1807
1808 //******************************************************************
1809 function SendInactivity_Timer_Expired(integer pl_session) runs on SCCP_CT
1810 //******************************************************************
1811 {
1812
1813 //local declarations
1814 var PDU_SCCP vl_PDU_SCCP;
1815
1816 //Action Table follows
1817
1818 if (ConnectionTable[pl_session].state==active)
1819 {
1820
1821 //assemble and route MTP3_ASP
1822 vl_PDU_SCCP.inacttest.messageType :=it;
1823 vl_PDU_SCCP.inacttest.destLocRef :=ConnectionTable[pl_session].remoteReference;
1824 vl_PDU_SCCP.inacttest.sourceLocRef:=ConnectionTable[pl_session].localReference;
1825
1826 vl_PDU_SCCP.inacttest.protClass:={
1827 class:='0010'B,
1828 messageHandling:='0000'B
1829 };//protocol class 2
1830
1831 vl_PDU_SCCP.inacttest.sequencingSegmenting:={
1832 reserved:='0'B,
1833 p_s:='0000000'B,
1834 more:='0'B,
1835 pr:='0000000'B
1836 };//it will be ignored
1837
1838 vl_PDU_SCCP.inacttest.credit:='00'O;
1839 //Param name credit(9), length 1, credit 0 -it will be mercifully ignored anyhow
1840
1841 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
1842 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP));//send inactivity test
1843
1844 //restart send inactivity timer
1845 f_StopTimer(ias,pl_session);//to avoid warnings
1846 f_StartTimer(ias,pl_session);
1847
1848 }//endif
1849
1850 }//endfunction
1851
1852 //******************************************************************
1853 function Conn_Timer_Expired(integer pl_session) runs on SCCP_CT
1854 //******************************************************************
1855 {
1856
1857 //local declarations
1858 var ASP_SCCP_N_DISCONNECT_ind vl_N_DISCONNECT_ind;
1859
1860 if (ConnectionTable[pl_session].state==connection_pending_OG)
1861 {
1862 //assemble ASP_SCCP_N_
1863 vl_N_DISCONNECT_ind.originator:=cg_NSP;
1864 vl_N_DISCONNECT_ind.reason:=cg_DISC_abnormal_T;
1865 vl_N_DISCONNECT_ind.connectionId:=ConnectionTable[pl_session].connectionId;
1866
1867 SCCP_SP_PORT.send( t_ASP_N_DISCONNECT_ind(
1868 vl_N_DISCONNECT_ind.originator,
1869 omit,
1870 vl_N_DISCONNECT_ind.reason,
1871 omit,
1872 vl_N_DISCONNECT_ind.connectionId,
1873 omit
1874 ));//send ASP_SCCP_N_DISCONNECT_ind
1875
1876 //release resources
1877 ReleaseResources(pl_session);
1878 }
1879 else if (ConnectionTable[pl_session].state==wait_conn_confirm)
1880 {
1881 ReleaseResources(pl_session);
1882 }
1883
1884 }//Conn_Timer_Expired
1885
1886 //******************************************************************
1887 function GenerateLocalReference() runs on SCCP_CT return OCT3
1888 //******************************************************************
1889 {
1890 var OCT3 vl_LocalReference;
1891
1892 do
1893 {
1894 vl_LocalReference := int2oct(float2int(rnd()*tsp_maxLocalReference), 3 );
1895 }
1896 while ( Retrieve_session( vl_LocalReference ) != -1 );
1897 return vl_LocalReference;
1898
1899 }//GenerateLocalReference
1900
1901 //******************************************************************
1902 function GenerateConnectionId() runs on SCCP_CT return integer
1903 //******************************************************************
1904 {
1905 var integer vl_ConnectionId;
1906
1907 do { vl_ConnectionId := float2int(rnd()*tsp_max_ConnectionId); }
1908 while ( Retrieve_session_connectionId( vl_ConnectionId ) != -1 );
1909
1910 return vl_ConnectionId;
1911 }//GenerateConnectionId
1912
1913 //******************************************************************
1914 function Stop_sessionTimers ( integer pl_session) runs on SCCP_CT
1915 //******************************************************************
1916 {
1917 if (T_conn_est[pl_session].running)
1918 { f_StopTimer(conn_est,pl_session);}
1919 if (T_ias[pl_session].running)
1920 { f_StopTimer(ias,pl_session);}
1921 if (T_iar[pl_session].running)
1922 { f_StopTimer(iar,pl_session);}
1923 if (T_rel[pl_session].running)
1924 { f_StopTimer(rel,pl_session);}
1925 if (T_repeat_rel[pl_session].running)
1926 { f_StopTimer(repeat_rel,pl_session);}
1927 if (T_int[pl_session].running)
1928 { f_StopTimer(int,pl_session);}
1929 // if (T_T_guard[pl_session].running)
1930 // { f_StopTimer(t_t_guard,pl_session);}
1931 if (T_reset[pl_session].running)
1932 { f_StopTimer(reset,pl_session);}
1933 //T_reassembly[pl_session].stop;
1934
1935 }//Stop_sessionTimers
1936
1937 //******************************************************************
1938 function CheckIdleIndividuals() runs on SCCP_CT return integer
1939 //******************************************************************
1940 {
1941 var integer vl_j;
1942 for (vl_j:=0;vl_j<16;vl_j:=vl_j+1)
1943 {
1944 if (ConnectionTable[vl_j].state==idle)
1945 {
1946 log("First idle individual index:",vl_j);
1947 return vl_j;
1948 }
1949 }
1950
1951 return -1;
1952
1953 }//CheckIdleIndividuals
1954
1955 //******************************************************************
1956 function ConnectionAlreadyEstablished( OCT3 pl_LocRef) runs on SCCP_CT return boolean
1957 //******************************************************************
1958 {
1959 var integer vl_j;
1960 for (vl_j:=0;vl_j<16;vl_j:=vl_j+1)
1961 {
1962 if (ConnectionTable[vl_j].localReference==pl_LocRef)
1963 {
1964 return true;
1965 }
1966 }
1967 return false;
1968
1969 } //ConnectionAlreadyEstablished
1970
1971 //******************************************************************
1972 function ConnectionAlreadyEstablished_remote( OCT3 pl_LocRef) runs on SCCP_CT return boolean
1973 //******************************************************************
1974 {
1975 var integer vl_j;
1976
1977 for (vl_j:=0;vl_j<16;vl_j:=vl_j+1)
1978 {
1979 if (ConnectionTable[vl_j].remoteReference==pl_LocRef)
1980 {
1981 return true;
1982 }
1983 }
1984 return false;
1985
1986 } //ConnectionAlreadyEstablished_remote
1987
1988 //******************************************************************
1989 function ConnectionAlreadyEstablished_connectionId(integer pl_ConnId) runs on SCCP_CT return boolean
1990 //******************************************************************
1991 {
1992 var integer vl_j;
1993 for (vl_j:=0;vl_j<16;vl_j:=vl_j+1)
1994 {
1995 if (ConnectionTable[vl_j].connectionId==pl_ConnId)
1996 {
1997 return true;
1998 }
1999 }
2000
2001 return false;
2002
2003 } //ConnectionAlreadyEstablished_connectionId
2004
2005 //******************************************************************
2006 function Retrieve_session( OCT3 pl_LocRef ) runs on SCCP_CT return integer
2007 //******************************************************************
2008 {
2009 var integer vl_j;
2010 for (vl_j:=0;vl_j<16;vl_j:=vl_j+1)
2011 {
2012
2013 if (ConnectionTable[vl_j].localReference==pl_LocRef)
2014 {
2015 log("Session index based on local reference:",vl_j);
2016 return vl_j;
2017 }
2018 }
2019
2020 return -1;
2021
2022 } //Retrieve_session
2023
2024 //******************************************************************
2025 function Retrieve_session_remote( OCT3 pl_LocRef )
2026 runs on SCCP_CT return integer
2027 //******************************************************************
2028 {
2029 var integer vl_j;
2030 for (vl_j:=0;vl_j<16;vl_j:=vl_j+1)
2031 {
2032 if (ConnectionTable[vl_j].remoteReference==pl_LocRef)
2033 {
2034 log("Session index based on remote reference:",vl_j);
2035 return vl_j;
2036 }
2037 }
2038 return -1;
2039
2040 } //Retrieve_session_remote
2041
2042 //******************************************************************
2043 function Retrieve_session_connectionId( integer pl_ConnId )
2044 runs on SCCP_CT return integer
2045 //******************************************************************
2046 {
2047 var integer vl_j;
2048 for (vl_j:=0;vl_j<16;vl_j:=vl_j+1)
2049 {
2050 if (ConnectionTable[vl_j].connectionId==pl_ConnId)
2051 {
2052 log("Session index based on connection ID:",vl_j);
2053 return vl_j;
2054 }
2055 }
2056 return -1;
2057
2058 } //Retrieve_session_connectionId
2059
2060 //==================================================================
2061 // Connectionless Segmented Data Handling/
2062 //==================================================================
2063 //==================================================================
2064 // SENDING: SCCP->MTP3 Segmentation Local Reference Handling
2065 // Handles segmLocRefTable,v_segmLocRefIndex,
2066 // which are defined in SCCP_typedefs.ttcn
2067 //==================================================================
2068
2069 //******************************************************************
2070 //function exist_segmLocalRef
2071 //******************************************************************
2072
2073 function exist_segmLocalRef( in OCT3 pl_segLocRef)
2074 runs on SCCP_CT return boolean
2075 {
2076 if( get_segmLocalRefIndex(pl_segLocRef) == -1 ) { return false;}
2077 else { return true; };
2078 } //exist_segmLocalRef
2079
2080 //******************************************************************
2081 //function get_segLocalRefIndex
2082 //******************************************************************
2083
2084 function get_segmLocalRefIndex(in OCT3 pl_segmLocRef)
2085 runs on SCCP_CT return integer
2086 {
2087 var integer vl_j;
2088 for (vl_j:=0;vl_j<16;vl_j:=vl_j+1)
2089 {
2090 if( segmLocRefTable[vl_j] == pl_segmLocRef ) { return vl_j;}
2091 }
2092 return -1;
2093 }//get_segLocalRefIndex
2094
2095 //******************************************************************
2096 //function reset_segmLocalRef
2097 //******************************************************************
2098 function reset_segmLocalRef(in OCT3 pl_segmLocRef)
2099 runs on SCCP_CT
2100 {
2101 var integer vl_j;
2102 vl_j:= get_segmLocalRefIndex( pl_segmLocRef )
2103 segmLocRefTable[vl_j] := '000000'O;
2104 }
2105
2106 //******************************************************************
2107 // function create_segmLocalRef
2108 //******************************************************************
2109
2110 function create_segmLocalRef()
2111 runs on SCCP_CT return OCT3
2112 {
2113 var OCT3 vl_segmLocRef;
2114 v_segmLocRefIndex := (v_segmLocRefIndex +1) mod 16;
2115 do
2116 {
2117 vl_segmLocRef := int2oct(float2int( rnd() *tsp_maxLocalReference), 3 );
2118 }
2119 while ( exist_segmLocalRef( vl_segmLocRef ) );
2120
2121 return vl_segmLocRef;
2122 }//create_segmLocalRef
2123
2124 //==================================================================
2125 // RECEIVING CONNECTIONLESS PDUs BY SCCP
2126 //==================================================================
2127
2128 //******************************************************************
2129 //function exist_ClessRcvBuff
2130 //******************************************************************
2131 function exist_ClessRcvBuff( in OCT3 pl_segmRemRef)
2132 runs on SCCP_CT return boolean
2133 {
2134 if( get_ClessRcvBuffIndex(pl_segmRemRef) == -1 ) { return false;}
2135 else { return true; };
2136 } //exist_ClessRcvBuff
2137
2138 //******************************************************************
2139 //function get_segRemoteRefIndex
2140 //******************************************************************
2141 function get_ClessRcvBuffIndex(in OCT3 pl_segmRemRef)
2142 runs on SCCP_CT return integer
2143 {
2144 var integer vl_j;
2145 for (vl_j:=0;vl_j<16;vl_j:=vl_j+1)
2146 {
2147 if( ClessRcvBuffTable[vl_j].segmRemoteRef == pl_segmRemRef )
2148 { return vl_j;}
2149 }
2150 return -1;
2151 }//get_ClessRcvBuffIndex
2152
2153 //******************************************************************
2154 //function get_idle_ClessRcvBuffIndex
2155 //******************************************************************
2156 function get_idle_ClessRcvBuffIndex( )
2157 runs on SCCP_CT return integer
2158 {
2159 var integer vl_j;
2160 for (vl_j:=0;vl_j<16;vl_j:=vl_j+1)
2161 {
2162 if( ClessRcvBuffTable[vl_j].state == segmLocRef_idle ) { return vl_j;}
2163 }
2164 return -1;
2165 }//get_idle_ClessRcvBuffIndex
2166
2167 //******************************************************************
2168 //function allocate_ClessRcvBuff
2169 //******************************************************************
2170 function allocate_ClessRcvBuff(in OCT3 pl_segmRemRef)
2171 runs on SCCP_CT return integer
2172 {
2173 var OCT3 vl_segmRemRef;
2174 var integer vl_j;
2175
2176 if( exist_ClessRcvBuff(pl_segmRemRef) ){ return -1;};
2177
2178 vl_j := get_idle_ClessRcvBuffIndex();
2179 ClessRcvBuffTable[vl_j].state := segmLocRef_busy;
2180 ClessRcvBuffTable[vl_j].segmRemoteRef := pl_segmRemRef;
2181 ClessRcvBuffTable[vl_j].reassembler_buffer.buffer:=''O;
2182 ClessRcvBuffTable[vl_j].reassembler_buffer.actlen:=0;
2183 return vl_j;
2184
2185 }//allocate_ClessRcvBuff
2186 //******************************************************************
2187 //function reallocate_ClessRcvBuff
2188 //******************************************************************
2189 function reallocate_ClessRcvBuff(in integer pl_index )
2190 runs on SCCP_CT
2191 {
2192 ClessRcvBuffTable[pl_index].state := segmLocRef_idle;
2193 // maybe unnecessaryy
2194 ClessRcvBuffTable[pl_index].segmRemoteRef := '000000'O;
2195 ClessRcvBuffTable[pl_index].reassembler_buffer.buffer:=''O;
2196 ClessRcvBuffTable[pl_index].reassembler_buffer.actlen:=0;
2197 return;
2198 }
2199
2200 //******************************************************************
2201 //function store_segmData
2202 //******************************************************************
2203 function store_segmData(in integer pl_index, in PDU_SCCP_ExtUnitdata pl_PDU_SCCP_ExtUnitdata)
2204 runs on SCCP_CT
2205 {
2206 ClessRcvBuffTable[pl_index].reassembler_buffer.buffer:=
2207 ClessRcvBuffTable[pl_index].reassembler_buffer.buffer&
2208 pl_PDU_SCCP_ExtUnitdata.data.data;
2209 ClessRcvBuffTable[pl_index].reassembler_buffer.actlen:=
2210 ClessRcvBuffTable[pl_index].reassembler_buffer.actlen+
2211 pl_PDU_SCCP_ExtUnitdata.data.paramLength;
2212 } //store_segmData
2213
2214 //******************************************************************
2215 //function send_ClessRcvBuff_in_N_UNITDATAind
2216 //******************************************************************
2217 function send_ClessRcvBuff_in_N_UNITDATAind (
2218 in integer pl_index,
2219 in PDU_SCCP_ExtUnitdata pl_PDU_SCCP_ExtUnitdata)
2220 runs on SCCP_CT
2221 {
2222 var ASP_SCCP_N_UNITDATA_ind vl_N_UNITDATA_ind;
2223
2224 vl_N_UNITDATA_ind.calledAddress :=
2225 ConvertPDUEncodedAddressToASPAddress( pl_PDU_SCCP_ExtUnitdata.calledPAddress );
2226
2227 vl_N_UNITDATA_ind.callingAddress :=
2228 ConvertPDUEncodedAddressToASPAddress( pl_PDU_SCCP_ExtUnitdata.callingPAddress );
2229
2230 vl_N_UNITDATA_ind.sequenceControl:=
2231 '0000000'B&pl_PDU_SCCP_ExtUnitdata.protClass.class[3];
2232 if( pl_PDU_SCCP_ExtUnitdata.protClass.messageHandling == '1000'B )
2233 { vl_N_UNITDATA_ind.returnOption := '00000001'B; }
2234 else
2235 { vl_N_UNITDATA_ind.returnOption := '00000000'B; }
2236
2237 vl_N_UNITDATA_ind.userData := ClessRcvBuffTable[pl_index].reassembler_buffer.buffer;
2238
2239 vl_N_UNITDATA_ind.importance := omit;
2240
2241 SCCP_SP_PORT.send( vl_N_UNITDATA_ind );
2242
2243 return;
2244 }//send_ClessRcvBuff_in_N_UNITDATAind
2245
2246 //******************************************************************
2247 //function send_ClessData_in_N_UNITDATAind
2248 // unbuffered data sending
2249 //******************************************************************
2250
2251 function send_ClessData_in_N_UNITDATAind (
2252 in PDU_SCCP_ExtUnitdata pl_PDU_SCCP_ExtUnitdata)
2253 runs on SCCP_CT
2254 {
2255 var ASP_SCCP_N_UNITDATA_ind vl_N_UNITDATA_ind;
2256
2257 vl_N_UNITDATA_ind.calledAddress :=
2258 ConvertPDUEncodedAddressToASPAddress( pl_PDU_SCCP_ExtUnitdata.calledPAddress );
2259
2260 vl_N_UNITDATA_ind.callingAddress :=
2261 ConvertPDUEncodedAddressToASPAddress( pl_PDU_SCCP_ExtUnitdata.callingPAddress );
2262
2263 vl_N_UNITDATA_ind.sequenceControl:=
2264 '0000000'B&pl_PDU_SCCP_ExtUnitdata.protClass.class[3];
2265 if( pl_PDU_SCCP_ExtUnitdata.protClass.messageHandling == '1000'B )
2266 { vl_N_UNITDATA_ind.returnOption := '00000001'B; }
2267 else
2268 { vl_N_UNITDATA_ind.returnOption := '00000000'B; }
2269
2270 vl_N_UNITDATA_ind.userData := pl_PDU_SCCP_ExtUnitdata.data.data;
2271
2272 vl_N_UNITDATA_ind.importance := omit;
2273
2274 SCCP_SP_PORT.send( vl_N_UNITDATA_ind );
2275 return;
2276 }//send_ClessData_in_N_UNITDATAind
2277
2278 //******************************************************************
2279 // CONN.ORIENTED SEGMENTING/REASSEMBLING
2280 //******************************************************************
2281
2282 //******************************************************************
2283 // SEGMENTING
2284 //******************************************************************
2285
2286 //******************************************************************
2287 // function sending_dataform1s_in_ASP_MTP_TRANSFERreqs
2288 // segmentates data and sends segments in dataform1 messages
2289 // included in asp_MTP3_TRANSFERreq PDUs
2290 // == segmentation - connection oriented case ==
2291 // counterpair: buffered_sending_ASP_N_DATA_ind
2292 //******************************************************************
2293 function sending_dataform1s_in_ASP_MTP_TRANSFERreqs( in ASP_SCCP_N_DATA_req pl_N_DATA_req )
2294 runs on SCCP_CT
2295 {
2296 var PDU_SCCP vl_PDU_SCCP;
2297 var integer vl_len;
2298 var integer vl_actdatalen;
2299 var SCCP_PAR_UserData vl_data;
2300 var integer vl_from; // first position in vl_data to be sent
2301 vl_data := pl_N_DATA_req.userData;
2302 vl_from := 0;
2303 // fixed part of messages:
2304 vl_PDU_SCCP.dataform1.messageType:=dt1;
2305 vl_PDU_SCCP.dataform1.destLocRef:=ConnectionTable[v_session].remoteReference;
2306 vl_PDU_SCCP.dataform1.segmentingReassembl:={
2307 more:='1'B,
2308 reserved:='0000000'B
2309 };
2310 vl_PDU_SCCP.dataform1.pointer1:=1;
2311 // variable part of messages:
2312 vl_len := lengthof(vl_data);
2313
2314 while ( vl_len > 0 )
2315 {
2316
2317 log("vl_len:",vl_len);
2318 log("vl_from",vl_from);
2319 if(vl_len > v_sccp_data_maxlen)
2320 {
2321 vl_actdatalen := v_sccp_data_maxlen;
2322 vl_PDU_SCCP.dataform1.segmentingReassembl.more :='1'B;
2323 }
2324 else
2325 {
2326 vl_actdatalen := vl_len;
2327 vl_PDU_SCCP.dataform1.segmentingReassembl.more :='0'B;
2328 };
2329
2330 vl_PDU_SCCP.dataform1.data.data:= substr( vl_data, vl_from, vl_actdatalen);
2331 vl_PDU_SCCP.dataform1.data.paramLength:= vl_actdatalen;
2332
2333 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
2334 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP));//send Data Form1
2335
2336 log( "data sent by MTP3_SCCP_PORT: ",vl_PDU_SCCP.dataform1.data.data);
2337
2338 //restart send inactivity timer
2339 f_StopTimer(ias,v_session);//to avoid warnings
2340 f_StartTimer(ias,v_session);
2341
2342 vl_from := vl_from + vl_actdatalen;
2343 vl_len := vl_len - vl_actdatalen;
2344
2345 }//while
2346 } //sending_dataform1s_in_ASP_MTP_TRANSFERreqs
2347
2348 //******************************************************************
2349 // REASSEMBLING
2350 //******************************************************************
2351
2352 //******************************************************************
2353 // function buffered_sending_ASP_N_DATA_ind
2354 // counterpair of sending_dataform1s_in_ASP_MTP_TRANSFERreqs
2355 //******************************************************************
2356
2357 function buffered_sending_ASP_N_DATA_ind( in PDU_SCCP_DataForm1 pl_PDU_SCCP_DataForm1 )
2358 runs on SCCP_CT
2359 {
2360 // Investigate this shorcut (not implemented):
2361 // if actlen==0 and more==0=> send immediately
2362
2363 // DT1 should be put to the reassembly buffer
2364 var integer vl_newbufflen;
2365 log("DT1 will be put to the reassembly buffer");
2366 //log( ConnectionTable[v_session].connectionId );
2367 vl_newbufflen := ConnectionTable[v_session].reassembler_buffer.actlen +
2368 pl_PDU_SCCP_DataForm1.data.paramLength;
2369
2370 if( vl_newbufflen <= ConnectionTable[v_session].reassembler_buffer.maxlen)
2371 {
2372 ConnectionTable[v_session].reassembler_buffer.buffer :=
2373 ConnectionTable[v_session].reassembler_buffer.buffer &
2374 pl_PDU_SCCP_DataForm1.data.data;
2375 ConnectionTable[v_session].reassembler_buffer.actlen := vl_newbufflen;
2376 log("DT1 data has been put to the reassembly buffer");
2377 }
2378 else
2379 {
2380 //send as much as possible OR error ???? NOT READY YET !!!!
2381 //CONT HERE, ask LAFA
2382 log("Unexpected/unimplemented program branch");
2383 }
2384
2385 // sending:
2386 if( pl_PDU_SCCP_DataForm1.segmentingReassembl.more == '0'B )
2387 {
2388 log("DT1/segmentingReassembl/more==0 received=> send ASP_SCCP_N_DATA comes");
2389 //send:
2390 SCCP_SP_PORT.send( t_ASP_N_DATA_ind(
2391 ConnectionTable[v_session].reassembler_buffer.buffer,
2392 ConnectionTable[v_session].connectionId,
2393 omit));
2394
2395 //restart send inactivity timer
2396 f_StopTimer(ias,v_session);//to avoid warnings
2397 f_StartTimer(ias,v_session);
2398
2399 // clear the buffer:
2400 ConnectionTable[v_session].reassembler_buffer.buffer :=''O;
2401 ConnectionTable[v_session].reassembler_buffer.actlen := 0;
2402 }
2403 else
2404 {
2405 log("DT1/segmentingReassembl/more==1 received=> sent to buffer only");
2406 }
2407 }//buffered_sending_ASP_N_DATA_ind
2408
2409
2410 //******************************************************************
2411 // CONVERSIONS
2412 //******************************************************************
2413 //
2414 // Differences between standards are hidden here !!!!
2415 //
2416 // 3 different functions working on different structures with the
2417 // virtually indentical code
2418
2419 //******************************************************************
2420 // Functions coding ASP address into octetstream
2421 //******************************************************************
2422
2423 // ITU
2424
2425 function ConvertASPAddressToEncodedAddress_itu( in SCCP_PAR_Address pl_ASPAddress)
2426 runs on SCCP_CT
2427 return SCCP_param_CPartyAddressEnc
2428 {
2429
2430 var SCCP_param_CPartyAddress_itu vl_PDUAddress; //structured fit to encoding
2431 var SCCP_param_CPartyAddressEnc vl_PDUAddressEncoded;
2432
2433 vl_PDUAddress.addressIndicator.pointCodeIndic:=
2434 pl_ASPAddress.addressIndicator.pointCodeIndic;
2435
2436 vl_PDUAddress.addressIndicator.ssnIndicator:=
2437 pl_ASPAddress.addressIndicator.ssnIndicator;
2438
2439 vl_PDUAddress.addressIndicator.globalTitleIndic:=
2440 pl_ASPAddress.addressIndicator.globalTitleIndic;
2441
2442 vl_PDUAddress.addressIndicator.routingIndicator:=
2443 pl_ASPAddress.addressIndicator.routingIndicator;
2444
2445 vl_PDUAddress.addressIndicator.reserved:='0'B;
2446 // if (ischosen(pl_ASPAddress.signPointCode) ) not used because it is mandatory field (???)
2447
2448 //----signPointCode handling
2449 if ( ispresent( pl_ASPAddress.signPointCode )) {
2450 vl_PDUAddress.signPointCode :=
2451 '00'B&pl_ASPAddress.signPointCode;
2452 } else {
2453 vl_PDUAddress.signPointCode := omit;
2454 };
2455
2456 //----subsystemNumber handling
2457 if ( ispresent( pl_ASPAddress.subsystemNumber ) ){
2458 vl_PDUAddress.subsystemNumber := pl_ASPAddress.subsystemNumber;
2459 } else {
2460 vl_PDUAddress.subsystemNumber :=omit;
2461 };
2462
2463 // --- globalTitle handling--
2464 if ( ispresent(pl_ASPAddress.globalTitle))
2465 {//startif1
2466
2467 var SCCP_ASPfield_GlobalTitle tmpGT ;
2468 tmpGT := pl_ASPAddress.globalTitle;
2469
2470 if (ischosen(tmpGT.gti0001))
2471 {
2472 vl_PDUAddress.globalTitle.gti0001.natureOfAddress:=tmpGT.gti0001.natureOfAddress;
2473 vl_PDUAddress.globalTitle.gti0001.oddeven:=tmpGT.gti0001.oddeven;
2474 vl_PDUAddress.globalTitle.gti0001.globalTitleAddress:=tmpGT.gti0001.globalTitleAddress;
2475 }
2476 else if (ischosen(tmpGT.gti0010))
2477 {
2478 vl_PDUAddress.globalTitle.gti0010.translationType:=tmpGT.gti0010.translationType;
2479 vl_PDUAddress.globalTitle.gti0010.globalTitleAddress:=tmpGT.gti0010.globalTitleAddress;
2480 }
2481 else if (ischosen(tmpGT.gti0011))
2482 {
2483 vl_PDUAddress.globalTitle.gti0011.translationType:=tmpGT.gti0011.translationType;
2484 vl_PDUAddress.globalTitle.gti0011.encodingScheme:=tmpGT.gti0011.encodingScheme;
2485 vl_PDUAddress.globalTitle.gti0011.numberingPlan:=tmpGT.gti0011.numberingPlan;
2486 vl_PDUAddress.globalTitle.gti0011.globalTitleAddress:=tmpGT.gti0011.globalTitleAddress;
2487 }
2488 else if (ischosen(tmpGT.gti0100))
2489 {
2490 vl_PDUAddress.globalTitle.gti0100.translationType:=tmpGT.gti0100.translationType;
2491 vl_PDUAddress.globalTitle.gti0100.encodingScheme:=tmpGT.gti0100.encodingScheme;
2492 vl_PDUAddress.globalTitle.gti0100.numberingPlan:=tmpGT.gti0100.numberingPlan;
2493 vl_PDUAddress.globalTitle.gti0100.natureOfAddress:=tmpGT.gti0100.natureOfAddress;
2494 vl_PDUAddress.globalTitle.gti0100.reserved:='0'B;
2495 vl_PDUAddress.globalTitle.gti0100.globalTitleAddress:=tmpGT.gti0100.globalTitleAddress;
2496 }
2497 }
2498 else
2499 {
2500 vl_PDUAddress.globalTitle := omit;
2501 };
2502
2503 vl_PDUAddressEncoded.addr:= enc_PDU_SCCP_Address_itu( vl_PDUAddress);
2504 vl_PDUAddressEncoded.paramLength:= lengthof(vl_PDUAddressEncoded.addr);
2505
2506 return vl_PDUAddressEncoded;
2507
2508 } //ConvertASPAddressToEncodedAddress_itu
2509
2510 //******************************************************************
2511
2512 // ANSI
2513 function ConvertASPAddressToEncodedAddress_ansi(in SCCP_PAR_Address pl_ASPAddress)
2514 runs on SCCP_CT return SCCP_param_CPartyAddressEnc
2515 {
2516
2517 var SCCP_param_CPartyAddress_ansi vl_PDUAddress; //structured fit to encoding
2518 var SCCP_param_CPartyAddressEnc vl_PDUAddressEncoded;
2519
2520 vl_PDUAddress.addressIndicator.pointCodeIndic:=
2521 pl_ASPAddress.addressIndicator.pointCodeIndic;
2522
2523 vl_PDUAddress.addressIndicator.ssnIndicator:=
2524 pl_ASPAddress.addressIndicator.ssnIndicator;
2525
2526 vl_PDUAddress.addressIndicator.globalTitleIndic:=
2527 pl_ASPAddress.addressIndicator.globalTitleIndic;
2528
2529 vl_PDUAddress.addressIndicator.routingIndicator:=
2530 pl_ASPAddress.addressIndicator.routingIndicator;
2531
2532 vl_PDUAddress.addressIndicator.reserved:='1'B;
2533
2534 //----signPointCode handling
2535 if ( ispresent( pl_ASPAddress.signPointCode )){
2536 vl_PDUAddress.signPointCode := pl_ASPAddress.signPointCode;
2537 } else {
2538 vl_PDUAddress.signPointCode := omit;
2539 };
2540
2541 //----subsystemNumber handling
2542 if ( ispresent( pl_ASPAddress.subsystemNumber )) {
2543 vl_PDUAddress.subsystemNumber:=pl_ASPAddress.subsystemNumber;
2544 } else {
2545 vl_PDUAddress.subsystemNumber :=omit;
2546 };
2547
2548 if (ispresent(pl_ASPAddress.globalTitle))
2549 {//startif1
2550
2551 var SCCP_ASPfield_GlobalTitle tmpGT := pl_ASPAddress.globalTitle;
2552
2553
2554 if (ischosen(tmpGT.gti0010))
2555 {
2556 vl_PDUAddress.globalTitle.gti0010.translationType:=tmpGT.gti0010.translationType;
2557 vl_PDUAddress.globalTitle.gti0010.globalTitleAddress:=tmpGT.gti0010.globalTitleAddress;
2558 }
2559 else if (ischosen(tmpGT.gti0011)) //ansi gti001, meaning:
2560 //used GT: SCCP_field_GlobalTitle_TT_NP_ES
2561 {
2562 //the left side is ANSI!!!:
2563 vl_PDUAddress.globalTitle.gti0001.translationType:=tmpGT.gti0011.translationType;
2564 vl_PDUAddress.globalTitle.gti0001.encodingScheme:=tmpGT.gti0011.encodingScheme;
2565 vl_PDUAddress.globalTitle.gti0001.numberingPlan:=tmpGT.gti0011.numberingPlan;
2566 vl_PDUAddress.globalTitle.gti0001.globalTitleAddress:=tmpGT.gti0011.globalTitleAddress;
2567 };
2568
2569 }
2570 else
2571 {
2572 vl_PDUAddress.globalTitle := omit;
2573 };
2574
2575 // SCCP_param_CPartyAddress_ansi -> octetstring
2576 vl_PDUAddressEncoded.addr:= enc_PDU_SCCP_Address_ansi( vl_PDUAddress);
2577 vl_PDUAddressEncoded.paramLength:= lengthof(vl_PDUAddressEncoded.addr);
2578
2579 return vl_PDUAddressEncoded
2580
2581 } //ConvertASPAddressToEncodedAddress_ansi
2582
2583 // ttc national:
2584
2585 function ConvertASPAddressToEncodedAddress_ttc( in SCCP_PAR_Address pl_ASPAddress)
2586 runs on SCCP_CT
2587 return SCCP_param_CPartyAddressEnc
2588 {
2589
2590 var SCCP_param_CPartyAddress_ttc vl_PDUAddress; //structured fit to encoding
2591 var SCCP_param_CPartyAddressEnc vl_PDUAddressEncoded;
2592
2593 vl_PDUAddress.addressIndicator.pointCodeIndic:=
2594 pl_ASPAddress.addressIndicator.pointCodeIndic;
2595
2596 vl_PDUAddress.addressIndicator.ssnIndicator:=
2597 pl_ASPAddress.addressIndicator.ssnIndicator;
2598
2599 vl_PDUAddress.addressIndicator.globalTitleIndic:=
2600 pl_ASPAddress.addressIndicator.globalTitleIndic;
2601
2602 vl_PDUAddress.addressIndicator.routingIndicator:=
2603 pl_ASPAddress.addressIndicator.routingIndicator;
2604
2605 vl_PDUAddress.addressIndicator.reserved:='1'B;
2606
2607 //----signPointCode handling
2608 if ( ispresent( pl_ASPAddress.signPointCode )) {
2609 vl_PDUAddress.signPointCode := pl_ASPAddress.signPointCode;
2610 } else {
2611 vl_PDUAddress.signPointCode := omit;
2612 };
2613
2614 //----subsystemNumber handling
2615 if ( ispresent( pl_ASPAddress.subsystemNumber ) ){
2616 vl_PDUAddress.subsystemNumber:= pl_ASPAddress.subsystemNumber;
2617 } else {
2618 vl_PDUAddress.subsystemNumber :=omit;
2619 };
2620
2621 // --- globalTitle handling--
2622 if ( ispresent(pl_ASPAddress.globalTitle))
2623 {//startif1
2624
2625 var SCCP_ASPfield_GlobalTitle tmpGT ;
2626 tmpGT := pl_ASPAddress.globalTitle;
2627
2628 if (ischosen(tmpGT.gti0001))
2629 {
2630 vl_PDUAddress.globalTitle.gti0001.natureOfAddress:=tmpGT.gti0001.natureOfAddress;
2631 vl_PDUAddress.globalTitle.gti0001.oddeven:=tmpGT.gti0001.oddeven;
2632 vl_PDUAddress.globalTitle.gti0001.globalTitleAddress:=tmpGT.gti0001.globalTitleAddress;
2633 }
2634 else if (ischosen(tmpGT.gti0010))
2635 {
2636 vl_PDUAddress.globalTitle.gti0010.translationType:=tmpGT.gti0010.translationType;
2637 vl_PDUAddress.globalTitle.gti0010.globalTitleAddress:=tmpGT.gti0010.globalTitleAddress;
2638 }
2639 else if (ischosen(tmpGT.gti0011))
2640 {
2641 vl_PDUAddress.globalTitle.gti0011.translationType:=tmpGT.gti0011.translationType;
2642 vl_PDUAddress.globalTitle.gti0011.encodingScheme:=tmpGT.gti0011.encodingScheme;
2643 vl_PDUAddress.globalTitle.gti0011.numberingPlan:=tmpGT.gti0011.numberingPlan;
2644 vl_PDUAddress.globalTitle.gti0011.globalTitleAddress:=tmpGT.gti0011.globalTitleAddress;
2645 }
2646 else if (ischosen(tmpGT.gti0100))
2647 {
2648 vl_PDUAddress.globalTitle.gti0100.translationType:=tmpGT.gti0100.translationType;
2649 vl_PDUAddress.globalTitle.gti0100.encodingScheme:=tmpGT.gti0100.encodingScheme;
2650 vl_PDUAddress.globalTitle.gti0100.numberingPlan:=tmpGT.gti0100.numberingPlan;
2651 vl_PDUAddress.globalTitle.gti0100.natureOfAddress:=tmpGT.gti0100.natureOfAddress;
2652 vl_PDUAddress.globalTitle.gti0100.reserved:='0'B;
2653 vl_PDUAddress.globalTitle.gti0100.globalTitleAddress:=tmpGT.gti0100.globalTitleAddress;
2654 };
2655 }
2656 else
2657 {
2658 vl_PDUAddress.globalTitle := omit;
2659 };
2660
2661 vl_PDUAddressEncoded.addr:= enc_PDU_SCCP_Address_ttc( vl_PDUAddress);
2662 vl_PDUAddressEncoded.paramLength:= lengthof(vl_PDUAddressEncoded.addr);
2663
2664 return vl_PDUAddressEncoded;
2665
2666 } //ConvertASPAddressToEncodedAddress_ttc
2667
2668 // mpt national:
2669
2670 function ConvertASPAddressToEncodedAddress_mpt( in SCCP_PAR_Address pl_ASPAddress)
2671 runs on SCCP_CT
2672 return SCCP_param_CPartyAddressEnc
2673 {
2674
2675 var SCCP_param_CPartyAddress_mpt vl_PDUAddress; //structured fit to encoding
2676 var SCCP_param_CPartyAddressEnc vl_PDUAddressEncoded;
2677
2678 vl_PDUAddress.addressIndicator.pointCodeIndic:=
2679 pl_ASPAddress.addressIndicator.pointCodeIndic;
2680
2681 vl_PDUAddress.addressIndicator.ssnIndicator:=
2682 pl_ASPAddress.addressIndicator.ssnIndicator;
2683
2684 vl_PDUAddress.addressIndicator.globalTitleIndic:=
2685 pl_ASPAddress.addressIndicator.globalTitleIndic;
2686
2687 vl_PDUAddress.addressIndicator.routingIndicator:=
2688 pl_ASPAddress.addressIndicator.routingIndicator;
2689
2690 vl_PDUAddress.addressIndicator.reserved:='1'B;
2691
2692 //----signPointCode handling
2693 if ( ispresent( pl_ASPAddress.signPointCode )) {
2694 vl_PDUAddress.signPointCode := pl_ASPAddress.signPointCode;
2695 } else {
2696 vl_PDUAddress.signPointCode := omit;
2697 };
2698
2699 //----subsystemNumber handling
2700 if ( ispresent( pl_ASPAddress.subsystemNumber ) ){
2701 vl_PDUAddress.subsystemNumber:= pl_ASPAddress.subsystemNumber;
2702 } else {
2703 vl_PDUAddress.subsystemNumber :=omit;
2704 };
2705
2706 // --- globalTitle handling--
2707 if ( ispresent(pl_ASPAddress.globalTitle))
2708 {//startif1
2709
2710 var SCCP_ASPfield_GlobalTitle tmpGT ;
2711 tmpGT := pl_ASPAddress.globalTitle;
2712
2713 if (ischosen(tmpGT.gti0001))
2714 {
2715 vl_PDUAddress.globalTitle.gti0001.natureOfAddress:=tmpGT.gti0001.natureOfAddress;
2716 vl_PDUAddress.globalTitle.gti0001.oddeven:=tmpGT.gti0001.oddeven;
2717 vl_PDUAddress.globalTitle.gti0001.globalTitleAddress:=tmpGT.gti0001.globalTitleAddress;
2718 }
2719 else if (ischosen(tmpGT.gti0010))
2720 {
2721 vl_PDUAddress.globalTitle.gti0010.translationType:=tmpGT.gti0010.translationType;
2722 vl_PDUAddress.globalTitle.gti0010.globalTitleAddress:=tmpGT.gti0010.globalTitleAddress;
2723 }
2724 else if (ischosen(tmpGT.gti0011))
2725 {
2726 vl_PDUAddress.globalTitle.gti0011.translationType:=tmpGT.gti0011.translationType;
2727 vl_PDUAddress.globalTitle.gti0011.encodingScheme:=tmpGT.gti0011.encodingScheme;
2728 vl_PDUAddress.globalTitle.gti0011.numberingPlan:=tmpGT.gti0011.numberingPlan;
2729 vl_PDUAddress.globalTitle.gti0011.globalTitleAddress:=tmpGT.gti0011.globalTitleAddress;
2730 }
2731 else if (ischosen(tmpGT.gti0100))
2732 {
2733 vl_PDUAddress.globalTitle.gti0100.translationType:=tmpGT.gti0100.translationType;
2734 vl_PDUAddress.globalTitle.gti0100.encodingScheme:=tmpGT.gti0100.encodingScheme;
2735 vl_PDUAddress.globalTitle.gti0100.numberingPlan:=tmpGT.gti0100.numberingPlan;
2736 vl_PDUAddress.globalTitle.gti0100.natureOfAddress:=tmpGT.gti0100.natureOfAddress;
2737 vl_PDUAddress.globalTitle.gti0100.reserved:='0'B;
2738 vl_PDUAddress.globalTitle.gti0100.globalTitleAddress:=tmpGT.gti0100.globalTitleAddress;
2739 };
2740 }
2741 else
2742 {
2743 vl_PDUAddress.globalTitle := omit;
2744 };
2745
2746 vl_PDUAddressEncoded.addr:= enc_PDU_SCCP_Address_mpt( vl_PDUAddress);
2747 vl_PDUAddressEncoded.paramLength:= lengthof(vl_PDUAddressEncoded.addr);
2748
2749 return vl_PDUAddressEncoded;
2750
2751 } //ConvertASPAddressToEncodedAddress_mpt
2752
2753 //******************************************************************
2754
2755 //******************************************************************
2756 // CONVERSION / DECODING
2757 //******************************************************************
2758
2759 //******************************************************************
2760 // function ConvertPDUEncodedAddressToASPAddress_itu
2761 // converts Encoded PDU Address into sturctured ASP Address
2762 // according to ITU
2763 //******************************************************************
2764 function ConvertPDUEncodedAddressToASPAddress_itu( in SCCP_param_CPartyAddressEnc pl_PDUAddress)
2765 runs on SCCP_CT return SCCP_PAR_Address
2766 {
2767 var SCCP_PAR_Address vl_ASPAddress;
2768 var SCCP_ASPfield_GlobalTitle tmpGT; // the same for itu, ansi and ttc
2769 var SCCP_param_CPartyAddress_itu vl_PDUAddress;
2770
2771 //new code detail (ethbaat 2003.11.04:
2772 // decoding from octetstring to structure "SCCP_param_CPartyAddress_itu":
2773 vl_PDUAddress := dec_PDU_SCCP_Address_itu( pl_PDUAddress.addr );
2774
2775 vl_ASPAddress.addressIndicator.pointCodeIndic :=
2776 vl_PDUAddress.addressIndicator.pointCodeIndic;
2777
2778 vl_ASPAddress.addressIndicator.ssnIndicator :=
2779 vl_PDUAddress.addressIndicator.ssnIndicator;
2780
2781 vl_ASPAddress.addressIndicator.globalTitleIndic :=
2782 vl_PDUAddress.addressIndicator.globalTitleIndic;
2783
2784 vl_ASPAddress.addressIndicator.routingIndicator :=
2785 vl_PDUAddress.addressIndicator.routingIndicator;
2786
2787 if (ispresent ( vl_PDUAddress.signPointCode)) {
2788 vl_ASPAddress.signPointCode:= substr(vl_PDUAddress.signPointCode,2,14);
2789 }
2790 else {
2791 vl_ASPAddress.signPointCode := omit; //ethbaat 2003.11.04
2792 }
2793
2794 if (ispresent (vl_PDUAddress.subsystemNumber )) { //always suggested ...
2795 vl_ASPAddress.subsystemNumber:= vl_PDUAddress.subsystemNumber;
2796 }
2797 else {
2798 vl_ASPAddress.subsystemNumber:=omit; //ethbaat 2003.11.04
2799 }
2800
2801 if( ispresent( vl_PDUAddress.globalTitle ) ){
2802 if (ischosen (vl_PDUAddress.globalTitle.gti0001))
2803 {
2804 tmpGT.gti0001.natureOfAddress:=vl_PDUAddress.globalTitle.gti0001.natureOfAddress;
2805 tmpGT.gti0001.oddeven:=vl_PDUAddress.globalTitle.gti0001.oddeven;
2806 tmpGT.gti0001.globalTitleAddress:=vl_PDUAddress.globalTitle.gti0001.globalTitleAddress;
2807 vl_ASPAddress.globalTitle:=tmpGT;
2808 }
2809 else if (ischosen (vl_PDUAddress.globalTitle.gti0010))
2810 {
2811 tmpGT.gti0010.translationType:=vl_PDUAddress.globalTitle.gti0010.translationType;
2812 tmpGT.gti0010.globalTitleAddress:=vl_PDUAddress.globalTitle.gti0010.globalTitleAddress;
2813 vl_ASPAddress.globalTitle:=tmpGT;
2814 }
2815 else if (ischosen (vl_PDUAddress.globalTitle.gti0011))
2816 {
2817 tmpGT.gti0011.translationType :=vl_PDUAddress.globalTitle.gti0011.translationType;
2818 tmpGT.gti0011.encodingScheme :=vl_PDUAddress.globalTitle.gti0011.encodingScheme;
2819 tmpGT.gti0011.numberingPlan :=vl_PDUAddress.globalTitle.gti0011.numberingPlan;
2820 tmpGT.gti0011.globalTitleAddress:=vl_PDUAddress.globalTitle.gti0011.globalTitleAddress;
2821 vl_ASPAddress.globalTitle :=tmpGT;
2822 }
2823 else if (ischosen (vl_PDUAddress.globalTitle.gti0100))
2824 {
2825 tmpGT.gti0100.translationType :=vl_PDUAddress.globalTitle.gti0100.translationType;
2826 tmpGT.gti0100.encodingScheme :=vl_PDUAddress.globalTitle.gti0100.encodingScheme;
2827 tmpGT.gti0100.numberingPlan :=vl_PDUAddress.globalTitle.gti0100.numberingPlan;
2828 tmpGT.gti0100.natureOfAddress :=vl_PDUAddress.globalTitle.gti0100.natureOfAddress
2829 //tmpGT.gti0100.reserved:='00'B;
2830 tmpGT.gti0100.globalTitleAddress:=vl_PDUAddress.globalTitle.gti0100.globalTitleAddress;
2831 vl_ASPAddress.globalTitle :=tmpGT;
2832 }
2833 }
2834 else
2835 {
2836 vl_ASPAddress.globalTitle:= omit;
2837 };
2838
2839 return vl_ASPAddress;
2840 } //ConvertPDUEncodedAddressToASPAddress_itu
2841
2842 //******************************************************************
2843 // function ConvertPDUEncodedAddressToASPAddress_ansi
2844 // converts Encoded PDU Address into sturctured ASP Address
2845 // according to ANSI
2846 //******************************************************************
2847
2848 function ConvertPDUEncodedAddressToASPAddress_ansi( in SCCP_param_CPartyAddressEnc pl_PDUAddress)
2849 runs on SCCP_CT return SCCP_PAR_Address
2850 {
2851 var SCCP_PAR_Address vl_ASPAddress;
2852 var SCCP_ASPfield_GlobalTitle tmpGT; // the same for itu, ansi and ttc
2853 var SCCP_param_CPartyAddress_ansi vl_PDUAddress;
2854
2855 //new code detail (ethbaat 2003.11.04:
2856 // decoding from octetstring to structure "SCCP_param_CPartyAddress_itu":
2857 vl_PDUAddress := dec_PDU_SCCP_Address_ansi( pl_PDUAddress.addr );
2858
2859 vl_ASPAddress.addressIndicator.pointCodeIndic :=
2860 vl_PDUAddress.addressIndicator.pointCodeIndic;
2861
2862 vl_ASPAddress.addressIndicator.ssnIndicator :=
2863 vl_PDUAddress.addressIndicator.ssnIndicator;
2864
2865 vl_ASPAddress.addressIndicator.globalTitleIndic :=
2866 vl_PDUAddress.addressIndicator.globalTitleIndic;
2867
2868 vl_ASPAddress.addressIndicator.routingIndicator :=
2869 vl_PDUAddress.addressIndicator.routingIndicator;
2870
2871 if (ispresent (vl_PDUAddress.signPointCode )) {
2872 vl_ASPAddress.signPointCode:= vl_PDUAddress.signPointCode;
2873 }
2874 else {
2875 //vl_ASPAddress.signPointCode.pointCode:='0000000000000000'B; //or empty??? ( 16len bitstring
2876 vl_ASPAddress.signPointCode:= omit; //ethbaat 2003.11.11
2877 }
2878
2879 if (ispresent (vl_PDUAddress.subsystemNumber)) { //always suggested ...
2880 vl_ASPAddress.subsystemNumber:= vl_PDUAddress.subsystemNumber;
2881 }
2882 else {
2883 vl_ASPAddress.subsystemNumber:=omit; //ethbaat 2003.11.04
2884 //vl_ASPAddress.subsystemNumber:= 0;
2885 };
2886
2887 if( ispresent( vl_PDUAddress.globalTitle ) ){
2888 if (ischosen (vl_PDUAddress.globalTitle.gti0001))
2889 {
2890 tmpGT.gti0011.translationType :=vl_PDUAddress.globalTitle.gti0001.translationType;
2891 tmpGT.gti0011.encodingScheme :=vl_PDUAddress.globalTitle.gti0001.encodingScheme;
2892 tmpGT.gti0011.numberingPlan :=vl_PDUAddress.globalTitle.gti0001.numberingPlan;
2893 tmpGT.gti0011.globalTitleAddress:=vl_PDUAddress.globalTitle.gti0001.globalTitleAddress;
2894 vl_ASPAddress.globalTitle :=tmpGT;
2895 }
2896 if (ischosen (vl_PDUAddress.globalTitle.gti0010))
2897 {
2898 tmpGT.gti0010.translationType:=vl_PDUAddress.globalTitle.gti0010.translationType;
2899 tmpGT.gti0010.globalTitleAddress:=vl_PDUAddress.globalTitle.gti0010.globalTitleAddress;
2900 vl_ASPAddress.globalTitle:=tmpGT;
2901 };
2902 }
2903 else
2904 {
2905 vl_ASPAddress.globalTitle:= omit;
2906 };
2907
2908 return vl_ASPAddress;
2909 } //ConvertPDUEncodedAddressToASPAddress_ansi
2910
2911 //******************************************************************
2912 // function ConvertPDUEncodedAddressToASPAddress_ttc
2913 // converts Encoded PDU Address into sturctured ASP Address
2914 // according to ttc
2915 //******************************************************************
2916 function ConvertPDUEncodedAddressToASPAddress_ttc( in SCCP_param_CPartyAddressEnc pl_PDUAddress)
2917 runs on SCCP_CT return SCCP_PAR_Address
2918 {
2919 var SCCP_PAR_Address vl_ASPAddress;
2920 var SCCP_ASPfield_GlobalTitle tmpGT; // the same for itu, ansi and ttc
2921 var SCCP_param_CPartyAddress_ttc vl_PDUAddress;
2922
2923 //new code detail (ethbaat 2003.11.04:
2924 // decoding from octetstring to structure "SCCP_param_CPartyAddress_itu":
2925 vl_PDUAddress := dec_PDU_SCCP_Address_ttc( pl_PDUAddress.addr );
2926
2927 vl_ASPAddress.addressIndicator.pointCodeIndic :=
2928 vl_PDUAddress.addressIndicator.pointCodeIndic;
2929
2930 vl_ASPAddress.addressIndicator.ssnIndicator :=
2931 vl_PDUAddress.addressIndicator.ssnIndicator;
2932
2933 vl_ASPAddress.addressIndicator.globalTitleIndic :=
2934 vl_PDUAddress.addressIndicator.globalTitleIndic;
2935
2936 vl_ASPAddress.addressIndicator.routingIndicator :=
2937 vl_PDUAddress.addressIndicator.routingIndicator;
2938
2939 if (ispresent ( vl_PDUAddress.signPointCode)) {
2940 vl_ASPAddress.signPointCode:= vl_PDUAddress.signPointCode; //old:substr(vl_PDUAddress.signPointCode,2,16);
2941 }
2942 else {
2943 vl_ASPAddress.signPointCode := omit; //ethbaat 2003.11.04
2944 }
2945
2946 if (ispresent (vl_PDUAddress.subsystemNumber )) { //always suggested ...
2947 vl_ASPAddress.subsystemNumber:= vl_PDUAddress.subsystemNumber;
2948 }
2949 else {
2950 vl_ASPAddress.subsystemNumber:=omit; //ethbaat 2003.11.04
2951 }
2952
2953 if( ispresent( vl_PDUAddress.globalTitle)){
2954 if (ischosen (vl_PDUAddress.globalTitle.gti0001))
2955 {
2956 tmpGT.gti0001.natureOfAddress:=vl_PDUAddress.globalTitle.gti0001.natureOfAddress;
2957 tmpGT.gti0001.oddeven:=vl_PDUAddress.globalTitle.gti0001.oddeven;
2958 tmpGT.gti0001.globalTitleAddress:=vl_PDUAddress.globalTitle.gti0001.globalTitleAddress;
2959 vl_ASPAddress.globalTitle:=tmpGT;
2960 }
2961 else if (ischosen (vl_PDUAddress.globalTitle.gti0010))
2962 {
2963 tmpGT.gti0010.translationType:=vl_PDUAddress.globalTitle.gti0010.translationType;
2964 tmpGT.gti0010.globalTitleAddress:=vl_PDUAddress.globalTitle.gti0010.globalTitleAddress;
2965 vl_ASPAddress.globalTitle:=tmpGT;
2966 }
2967 else if (ischosen (vl_PDUAddress.globalTitle.gti0011))
2968 {
2969 tmpGT.gti0011.translationType :=vl_PDUAddress.globalTitle.gti0011.translationType;
2970 tmpGT.gti0011.encodingScheme :=vl_PDUAddress.globalTitle.gti0011.encodingScheme;
2971 tmpGT.gti0011.numberingPlan :=vl_PDUAddress.globalTitle.gti0011.numberingPlan;
2972 tmpGT.gti0011.globalTitleAddress:=vl_PDUAddress.globalTitle.gti0011.globalTitleAddress;
2973 vl_ASPAddress.globalTitle :=tmpGT;
2974 }
2975 else if (ischosen (vl_PDUAddress.globalTitle.gti0100))
2976 {
2977 tmpGT.gti0100.translationType :=vl_PDUAddress.globalTitle.gti0100.translationType;
2978 tmpGT.gti0100.encodingScheme :=vl_PDUAddress.globalTitle.gti0100.encodingScheme;
2979 tmpGT.gti0100.numberingPlan :=vl_PDUAddress.globalTitle.gti0100.numberingPlan;
2980 tmpGT.gti0100.natureOfAddress :=vl_PDUAddress.globalTitle.gti0100.natureOfAddress;
2981 //tmpGT.gti0100.reserved:='00'B;
2982 tmpGT.gti0100.globalTitleAddress:=vl_PDUAddress.globalTitle.gti0100.globalTitleAddress;
2983 vl_ASPAddress.globalTitle :=tmpGT;
2984 };
2985 }
2986 else
2987 {
2988 vl_ASPAddress.globalTitle:= omit;
2989 };
2990
2991 return vl_ASPAddress;
2992 } //ConvertPDUEncodedAddressToASPAddress_ttc
2993
2994 //******************************************************************
2995 // function ConvertPDUEncodedAddressToASPAddress_mpt
2996 // converts Encoded PDU Address into sturctured ASP Address
2997 // according to mpt
2998 //******************************************************************
2999 function ConvertPDUEncodedAddressToASPAddress_mpt( in SCCP_param_CPartyAddressEnc pl_PDUAddress)
3000 runs on SCCP_CT return SCCP_PAR_Address
3001 {
3002 var SCCP_PAR_Address vl_ASPAddress;
3003 var SCCP_ASPfield_GlobalTitle tmpGT; // the same for itu, ansi and ttc
3004 var SCCP_param_CPartyAddress_mpt vl_PDUAddress;
3005
3006 vl_PDUAddress := dec_PDU_SCCP_Address_mpt( pl_PDUAddress.addr );
3007
3008 vl_ASPAddress.addressIndicator.pointCodeIndic :=
3009 vl_PDUAddress.addressIndicator.pointCodeIndic;
3010
3011 vl_ASPAddress.addressIndicator.ssnIndicator :=
3012 vl_PDUAddress.addressIndicator.ssnIndicator;
3013
3014 vl_ASPAddress.addressIndicator.globalTitleIndic :=
3015 vl_PDUAddress.addressIndicator.globalTitleIndic;
3016
3017 vl_ASPAddress.addressIndicator.routingIndicator :=
3018 vl_PDUAddress.addressIndicator.routingIndicator;
3019
3020 if (ispresent ( vl_PDUAddress.signPointCode)) {
3021 vl_ASPAddress.signPointCode:= vl_PDUAddress.signPointCode;
3022 }
3023 else {
3024 vl_ASPAddress.signPointCode := omit;
3025 }
3026
3027 if (ispresent (vl_PDUAddress.subsystemNumber )) { //always suggested ...
3028 vl_ASPAddress.subsystemNumber:= vl_PDUAddress.subsystemNumber;
3029 }
3030 else {
3031 vl_ASPAddress.subsystemNumber:=omit;
3032 }
3033
3034 if( ispresent( vl_PDUAddress.globalTitle)){
3035 if (ischosen (vl_PDUAddress.globalTitle.gti0001))
3036 {
3037 tmpGT.gti0001.natureOfAddress:=vl_PDUAddress.globalTitle.gti0001.natureOfAddress;
3038 tmpGT.gti0001.oddeven:=vl_PDUAddress.globalTitle.gti0001.oddeven;
3039 tmpGT.gti0001.globalTitleAddress:=vl_PDUAddress.globalTitle.gti0001.globalTitleAddress;
3040 vl_ASPAddress.globalTitle:=tmpGT;
3041 }
3042 else if (ischosen (vl_PDUAddress.globalTitle.gti0010))
3043 {
3044 tmpGT.gti0010.translationType:=vl_PDUAddress.globalTitle.gti0010.translationType;
3045 tmpGT.gti0010.globalTitleAddress:=vl_PDUAddress.globalTitle.gti0010.globalTitleAddress;
3046 vl_ASPAddress.globalTitle:=tmpGT;
3047 }
3048 else if (ischosen (vl_PDUAddress.globalTitle.gti0011))
3049 {
3050 tmpGT.gti0011.translationType :=vl_PDUAddress.globalTitle.gti0011.translationType;
3051 tmpGT.gti0011.encodingScheme :=vl_PDUAddress.globalTitle.gti0011.encodingScheme;
3052 tmpGT.gti0011.numberingPlan :=vl_PDUAddress.globalTitle.gti0011.numberingPlan;
3053 tmpGT.gti0011.globalTitleAddress:=vl_PDUAddress.globalTitle.gti0011.globalTitleAddress;
3054 vl_ASPAddress.globalTitle :=tmpGT;
3055 }
3056 else if (ischosen (vl_PDUAddress.globalTitle.gti0100))
3057 {
3058 tmpGT.gti0100.translationType :=vl_PDUAddress.globalTitle.gti0100.translationType;
3059 tmpGT.gti0100.encodingScheme :=vl_PDUAddress.globalTitle.gti0100.encodingScheme;
3060 tmpGT.gti0100.numberingPlan :=vl_PDUAddress.globalTitle.gti0100.numberingPlan;
3061 tmpGT.gti0100.natureOfAddress :=vl_PDUAddress.globalTitle.gti0100.natureOfAddress;
3062 //tmpGT.gti0100.reserved:='00'B;
3063 tmpGT.gti0100.globalTitleAddress:=vl_PDUAddress.globalTitle.gti0100.globalTitleAddress;
3064 vl_ASPAddress.globalTitle :=tmpGT;
3065 };
3066 }
3067 else
3068 {
3069 vl_ASPAddress.globalTitle:= omit;
3070 };
3071
3072 return vl_ASPAddress;
3073 } //ConvertPDUEncodedAddressToASPAddress_mpt
3074
3075 //==================================================================
3076 // MAIN CONVERSION FUNCTIONS:
3077 //==================================================================
3078
3079 //******************************************************************
3080 // function ConvertASPAddressToEncodedAddress
3081 // converts ASP address structure to PDU address structure
3082 // THIS IS THE MAIN ENCODE FUNCTION (coordinator)
3083 //******************************************************************
3084
3085 function ConvertASPAddressToEncodedAddress( in SCCP_PAR_Address pl_ASPAddress)
3086 runs on SCCP_CT return SCCP_param_CPartyAddressEnc
3087 {
3088 var SCCP_param_CPartyAddressEnc vl_PDUAddressEncoded;
3089 if( ( v_SCCPServiceType == mtp3_itu) or
3090 ( v_SCCPServiceType == mtp3b_itu))
3091 {
3092 return ConvertASPAddressToEncodedAddress_itu( pl_ASPAddress );
3093 }
3094 else if( (v_SCCPServiceType == mtp3_ansi) or
3095 (v_SCCPServiceType == mtp3b_ansi))
3096 {
3097 return ConvertASPAddressToEncodedAddress_ansi( pl_ASPAddress );
3098 }
3099 else if((v_SCCPServiceType == mtp3_ttc) or
3100 (v_SCCPServiceType == mtp3b_ttc))
3101 {
3102 if( (v_SIO == '83'O) or (v_SIO == '43'O) or (v_SIO == 'C3'O) ) //ttc national
3103 {
3104 return ConvertASPAddressToEncodedAddress_ttc( pl_ASPAddress );
3105 }
3106 else
3107 { //international == itu
3108 return ConvertASPAddressToEncodedAddress_itu( pl_ASPAddress );
3109 }
3110 }//if1
3111 else if((v_SCCPServiceType == mtp3_mpt))
3112 {
3113 if( v_NI == 2 ) //mpt national
3114 {
3115 return ConvertASPAddressToEncodedAddress_mpt( pl_ASPAddress );
3116 }
3117 else
3118 { //international == itu
3119 return ConvertASPAddressToEncodedAddress_itu( pl_ASPAddress );
3120 }
3121 }//if1
3122 else {
3123 log("Error in ConvertASPAddressToEncodedAddress: Unknown SCCPServiceType");
3124 stop;
3125 }
3126 return vl_PDUAddressEncoded; // error!!!
3127 }
3128
3129 //******************************************************************
3130 // function ConvertPDUEncodedAddressToASPAddress
3131 // converts Encoded PDU Address into sturctured ASP Address
3132 // THIS IS THE MAIN DECODE FUNCTION (coordinator)
3133 //******************************************************************
3134
3135
3136 function ConvertPDUEncodedAddressToASPAddress( in SCCP_param_CPartyAddressEnc pl_PDUAddress)
3137 runs on SCCP_CT return SCCP_PAR_Address
3138 {
3139 var SCCP_PAR_Address vl_dummyretval;
3140
3141 if( (v_SCCPServiceType == mtp3_itu) or
3142 (v_SCCPServiceType == mtp3b_itu) )
3143 {
3144 return ConvertPDUEncodedAddressToASPAddress_itu( pl_PDUAddress );
3145 }
3146 else if( (v_SCCPServiceType == mtp3_ansi) or
3147 (v_SCCPServiceType == mtp3b_ansi) )
3148 {
3149 return ConvertPDUEncodedAddressToASPAddress_ansi( pl_PDUAddress );
3150 }
3151 else if( (v_SCCPServiceType == mtp3_ttc) or
3152 (v_SCCPServiceType == mtp3b_ttc)){
3153 if( (v_SIO == '83'O) or (v_SIO == '43'O) or (v_SIO == 'C3'O) )
3154 {
3155 //ttc national
3156 return ConvertPDUEncodedAddressToASPAddress_ttc( pl_PDUAddress );
3157 }
3158 else {
3159 return ConvertPDUEncodedAddressToASPAddress_itu( pl_PDUAddress );
3160 }
3161 }
3162 else if((v_SCCPServiceType == mtp3_mpt))
3163 {
3164 if( v_NI == 2 ) //mpt national
3165 {
3166 return ConvertPDUEncodedAddressToASPAddress_mpt( pl_PDUAddress );
3167 }
3168 else
3169 { //international == itu
3170 return ConvertPDUEncodedAddressToASPAddress_itu( pl_PDUAddress );
3171 }
3172 }
3173 else {
3174 log("Error in function ConvertPDUEncodedAddressToASPAddress, Unknown SCCPSCCPType");
3175 stop;
3176 }
3177 return vl_dummyretval;
3178 }//ConvertPDUEncodedAddressToASPAddress
3179/*
3180//*************************************************************************
3181//*************************************************************************
3182//EncDec ComponentBehaviour
3183//*************************************************************************
3184//*************************************************************************
3185
3186 // TO DO:Desk check it! As I see, it's OK, but the meaning has been changed\
3187 // because structure of PDU_SCCP has been changed
3188
3189 //*************************************************************************
3190 function ScanRAWPorts() runs on SCCP_EncDec_CT
3191 //*************************************************************************
3192 {
3193 //local declarations
3194 var ASP_MTP3_TRANSFERind vl_ASP_MTP3_TRANSFERind;
3195 var ASP_MTP3_TRANSFERreq vl_ASP_MTP3_TRANSFERreq;
3196 var ASP_MTP3_TRANSFERreq_sccp vl_ASP_MTP3_TRANSFERreq_sccp
3197
3198 var PDU_SCCP vl_PDU_SCCP;
3199 var integer vl_msg_type;
3200
3201 while (true)
3202 {
3203 alt
3204 {
3205
3206 //********************************************************************
3207 //message received from SCCP , containing a PDU to be encoded
3208 //********************************************************************
3209
3210 []MTP3_SCCP_SP_PORT.receive( tr_ASP_MTP3_TRANSFERreq_sccp) -> value vl_ASP_MTP3_TRANSFERreq_sccp
3211 {
3212 var bitstring vl_sio_bit := oct2bit(vl_ASP_MTP3_TRANSFERreq_sccp.sio);
3213 var MTP3_Field_sio vl_sio_struct;
3214 vl_sio_struct.ni := substr(vl_sio_bit,0,2);
3215 vl_sio_struct.prio := substr(vl_sio_bit,2,2);
3216 vl_sio_struct.si := substr(vl_sio_bit,4,4);
3217
3218 MTP3_PORT.send(t_ASP_MTP3_TRANSFERreq(
3219 vl_sio_struct,
3220 vl_ASP_MTP3_TRANSFERreq_sccp.opc,
3221 vl_ASP_MTP3_TRANSFERreq_sccp.dpc,
3222 vl_ASP_MTP3_TRANSFERreq_sccp.sls,
3223 enc_PDU_SCCP(vl_ASP_MTP3_TRANSFERreq_sccp.data)
3224 ));
3225 }
3226
3227 //********************************************************************
3228 //message received from MTP3 , containing an octetstring to be decoded:
3229 //********************************************************************
3230
3231 []MTP3_PORT.receive(tr_ASP_MTP3_TRANSFERind) -> value vl_ASP_MTP3_TRANSFERind
3232 {//startStatementBlock
3233 if (vl_ASP_MTP3_TRANSFERind.sio.si != '0011'B)
3234 {
3235 log("The received message is not SCCP. Ignored.");
3236 repeat;
3237 }
3238 vl_msg_type:= oct2int( vl_ASP_MTP3_TRANSFERind.data[0] );
3239
3240 select(vl_msg_type)
3241 {
3242 case (xudt) // '11'O
3243 {
3244 vl_PDU_SCCP:=dec_PDU_SCCP(vl_ASP_MTP3_TRANSFERind.data);
3245 MTP3_SCCP_SP_PORT.send( vl_PDU_SCCP.extudata );
3246 }
3247 case (udt) //'09'O
3248 {
3249 //decode octetstring
3250 vl_PDU_SCCP:=dec_PDU_SCCP(vl_ASP_MTP3_TRANSFERind.data);
3251
3252 MTP3_SCCP_SP_PORT.send( t_PDU_SCCP_Unitdata(
3253 vl_PDU_SCCP.unitdata.protClass,
3254 vl_PDU_SCCP.unitdata.calledPAddress,
3255 vl_PDU_SCCP.unitdata.callingPAddress,
3256 vl_PDU_SCCP.unitdata.data));
3257
3258 }//endif
3259 case (dt1)//'06'O
3260 {
3261 vl_PDU_SCCP:=dec_PDU_SCCP(vl_ASP_MTP3_TRANSFERind.data);
3262
3263 MTP3_SCCP_SP_PORT.send( t_PDU_SCCP_DataForm1(
3264 vl_PDU_SCCP.dataform1.destLocRef,
3265 vl_PDU_SCCP.dataform1.segmentingReassembl,
3266 vl_PDU_SCCP.dataform1.data
3267 ));
3268 }
3269 case (cr) //'01'O
3270 {//startif
3271 vl_PDU_SCCP:=dec_PDU_SCCP(vl_ASP_MTP3_TRANSFERind.data);
3272
3273 if (ispresent(vl_PDU_SCCP.connrequest.eop))
3274 {
3275 MTP3_SCCP_SP_PORT.send( t_PDU_SCCP_ConnectionRequest(
3276 vl_PDU_SCCP.connrequest.sourceLocRef,
3277 vl_PDU_SCCP.connrequest.protClass,
3278 vl_PDU_SCCP.connrequest.calledPAddress,
3279 vl_PDU_SCCP.connrequest.optionalPart.credit,
3280 vl_PDU_SCCP.connrequest.optionalPart.callingPAddress,
3281 vl_PDU_SCCP.connrequest.optionalPart.data,
3282 vl_PDU_SCCP.connrequest.optionalPart.hopCounter,
3283 vl_PDU_SCCP.connrequest.optionalPart.importance,
3284 vl_PDU_SCCP.connrequest.eop
3285 ));
3286 }
3287 else
3288 {
3289 MTP3_SCCP_SP_PORT.send( t_PDU_SCCP_ConnectionRequest(
3290 vl_PDU_SCCP.connrequest.sourceLocRef,
3291 vl_PDU_SCCP.connrequest.protClass,
3292 vl_PDU_SCCP.connrequest.calledPAddress,
3293 vl_PDU_SCCP.connrequest.optionalPart.credit,
3294 vl_PDU_SCCP.connrequest.optionalPart.callingPAddress,
3295 vl_PDU_SCCP.connrequest.optionalPart.data,
3296 vl_PDU_SCCP.connrequest.optionalPart.hopCounter,
3297 vl_PDU_SCCP.connrequest.optionalPart.importance,
3298 omit
3299 ));
3300 }
3301
3302 }
3303 case (cc) //'02'O
3304 {
3305 vl_PDU_SCCP:=dec_PDU_SCCP(vl_ASP_MTP3_TRANSFERind.data);
3306
3307 if (ispresent(vl_PDU_SCCP.connconfirm.eop))
3308 {
3309 MTP3_SCCP_SP_PORT.send( t_PDU_SCCP_ConnectionConfirm(
3310 vl_PDU_SCCP.connconfirm.destLocRef,
3311 vl_PDU_SCCP.connconfirm.sourceLocRef,
3312 vl_PDU_SCCP.connconfirm.protClass,
3313 vl_PDU_SCCP.connconfirm.optionalPart.credit,
3314 vl_PDU_SCCP.connconfirm.optionalPart.calledPAddress,
3315 vl_PDU_SCCP.connconfirm.optionalPart.data,
3316 vl_PDU_SCCP.connconfirm.optionalPart.importance,
3317 vl_PDU_SCCP.connconfirm.eop ));
3318 }
3319 else
3320 {
3321 MTP3_SCCP_SP_PORT.send( t_PDU_SCCP_ConnectionConfirm(
3322 vl_PDU_SCCP.connconfirm.destLocRef,
3323 vl_PDU_SCCP.connconfirm.sourceLocRef,
3324 vl_PDU_SCCP.connconfirm.protClass,
3325 vl_PDU_SCCP.connconfirm.optionalPart.credit,
3326 vl_PDU_SCCP.connconfirm.optionalPart.calledPAddress,
3327 vl_PDU_SCCP.connconfirm.optionalPart.data,
3328 vl_PDU_SCCP.connconfirm.optionalPart.importance,
3329 omit));
3330 }
3331
3332 }
3333 case (udts) //'0A'O
3334 {//startif
3335 vl_PDU_SCCP:=dec_PDU_SCCP(vl_ASP_MTP3_TRANSFERind.data);
3336
3337 MTP3_SCCP_SP_PORT.send( t_PDU_SCCP_UnitdataService(
3338 vl_PDU_SCCP.udataserv.returnCause,
3339 vl_PDU_SCCP.udataserv.calledPAddress,
3340 vl_PDU_SCCP.udataserv.callingPAddress,
3341 vl_PDU_SCCP.udataserv.data));
3342
3343 }//endif
3344 case (rlsd) //'04'O
3345 {
3346 vl_PDU_SCCP:=dec_PDU_SCCP(vl_ASP_MTP3_TRANSFERind.data);
3347
3348 if (ispresent(vl_PDU_SCCP.released.eop))
3349 {
3350 MTP3_SCCP_SP_PORT.send( t_PDU_SCCP_Released(
3351 vl_PDU_SCCP.released.destLocRef,
3352 vl_PDU_SCCP.released.sourceLocRef,
3353 vl_PDU_SCCP.released.releaseCause,
3354 vl_PDU_SCCP.released.optionalPart.data,
3355 vl_PDU_SCCP.released.optionalPart.importance,
3356 vl_PDU_SCCP.released.eop
3357 ));
3358 }
3359 else
3360 {
3361 MTP3_SCCP_SP_PORT.send( t_PDU_SCCP_Released(
3362 vl_PDU_SCCP.released.destLocRef,
3363 vl_PDU_SCCP.released.sourceLocRef,
3364 vl_PDU_SCCP.released.releaseCause,
3365 vl_PDU_SCCP.released.optionalPart.data,
3366 vl_PDU_SCCP.released.optionalPart.importance,
3367 omit
3368 ));
3369 }
3370
3371 }
3372 case (err)//'0F'O
3373 {
3374 vl_PDU_SCCP:=dec_PDU_SCCP(vl_ASP_MTP3_TRANSFERind.data);
3375
3376 MTP3_SCCP_SP_PORT.send( t_PDU_SCCP_ProtDataUnitError(
3377 vl_PDU_SCCP.pduerror.destLocRef,
3378 vl_PDU_SCCP.pduerror.errorCause
3379 ));
3380 }
3381 case (rlc)//'05'O
3382 {
3383 vl_PDU_SCCP:=dec_PDU_SCCP(vl_ASP_MTP3_TRANSFERind.data);
3384
3385 MTP3_SCCP_SP_PORT.send( t_PDU_SCCP_ReleaseComplete(
3386 vl_PDU_SCCP.relcomp.destLocRef,
3387 vl_PDU_SCCP.relcomp.sourceLocRef
3388 ));
3389 }
3390 case (it)//'10'O
3391 {
3392 vl_PDU_SCCP:=dec_PDU_SCCP(vl_ASP_MTP3_TRANSFERind.data);
3393
3394 MTP3_SCCP_SP_PORT.send( t_PDU_SCCP_InactivityTest(
3395 vl_PDU_SCCP.inacttest.destLocRef,
3396 vl_PDU_SCCP.inacttest.sourceLocRef,
3397 vl_PDU_SCCP.inacttest.protClass,
3398 vl_PDU_SCCP.inacttest.sequencingSegmenting,
3399 vl_PDU_SCCP.inacttest.credit
3400 ));
3401 }
3402 case (rsr)//'0D'O
3403 {
3404 vl_PDU_SCCP:=dec_PDU_SCCP(vl_ASP_MTP3_TRANSFERind.data);
3405
3406 MTP3_SCCP_SP_PORT.send( t_PDU_SCCP_ResetRequest(
3407 vl_PDU_SCCP.resetreq.destLocRef,
3408 vl_PDU_SCCP.resetreq.sourceLocRef,
3409 vl_PDU_SCCP.resetreq.resetCause
3410 ));
3411 }
3412 case (rsc)//'0E'O
3413 {
3414
3415 vl_PDU_SCCP:=dec_PDU_SCCP(vl_ASP_MTP3_TRANSFERind.data);
3416
3417 MTP3_SCCP_SP_PORT.send( t_PDU_SCCP_ResetConfirm(
3418 vl_PDU_SCCP.resconf.destLocRef,
3419 vl_PDU_SCCP.resconf.sourceLocRef
3420 ));
3421 }//endif
3422 case (cref)//'03'O
3423 {
3424 vl_PDU_SCCP:=dec_PDU_SCCP(vl_ASP_MTP3_TRANSFERind.data);
3425
3426 if (ispresent(vl_PDU_SCCP.connrefused.eop))
3427 {
3428 MTP3_SCCP_SP_PORT.send( t_PDU_SCCP_ConnectionRefused(
3429 vl_PDU_SCCP.connrefused.destLocRef,
3430 vl_PDU_SCCP.connrefused.refusalCause,
3431 vl_PDU_SCCP.connrefused.optionalPart.calledPAddress,
3432 vl_PDU_SCCP.connrefused.optionalPart.data,
3433 vl_PDU_SCCP.connrefused.optionalPart.importance,
3434 vl_PDU_SCCP.connrefused.eop
3435 ));
3436 }
3437 else
3438 {
3439 MTP3_SCCP_SP_PORT.send( t_PDU_SCCP_ConnectionRefused(
3440 vl_PDU_SCCP.connrefused.destLocRef,
3441 vl_PDU_SCCP.connrefused.refusalCause,
3442 vl_PDU_SCCP.connrefused.optionalPart.calledPAddress,
3443 vl_PDU_SCCP.connrefused.optionalPart.data,
3444 vl_PDU_SCCP.connrefused.optionalPart.importance,
3445 omit
3446 ));
3447 }
3448 }
3449 case (xudts,ludt,ludts)
3450 {
3451 log ("Unsupported connectionless message ((-XUDT or)) XUDTS or LUDT or LUDTS - received and discarded");
3452 }
3453 case (dt2,ak,ed,ea )
3454 {
3455 log ("Unsupported connection-oriented message -DT2 or AK or ED or EA - received and discarded");
3456 }
3457 case else { log ("Unrecognized message received and discarded"); }
3458 }
3459 }//endStatementBlock
3460
3461 }//endalt
3462
3463 }//endwhile
3464
3465 }//endfunction
3466*/
3467
3468//******************************************************************
3469//
3470// working functions for ScanEvents
3471//
3472//******************************************************************
3473
3474//******************************************************************
3475// Part 1 : Receiving msg on port "MTP3_SCCP_PORT"
3476//******************************************************************
3477
3478
3479 //******************************************************************
3480 // processing_PDU_SCCP_Unitdata
3481 //******************************************************************
3482 function processing_PDU_SCCP_Unitdata( in PDU_SCCP_Unitdata pl_PDU_SCCP_Unitdata)
3483 runs on SCCP_CT
3484 {
3485 //var PDU_SCCP_Unitdata vl_PDU_SCCP_Unitdata;
3486 var PDU_SCCP vl_PDU_SCCP;
3487 var ASP_SCCP_N_UNITDATA_ind vl_N_UNITDATA_ind;
3488
3489 vl_PDU_SCCP.unitdata:= pl_PDU_SCCP_Unitdata;
3490
3491 // it should be decoded to structure to read if it is a mgmt message or not
3492 vl_N_UNITDATA_ind.calledAddress :=
3493 ConvertPDUEncodedAddressToASPAddress(pl_PDU_SCCP_Unitdata.calledPAddress);
3494
3495 if ( ispresent(vl_N_UNITDATA_ind.calledAddress.subsystemNumber) and
3496 vl_N_UNITDATA_ind.calledAddress.subsystemNumber != cg_SSN_sCCPmanagement)
3497 //SCCP mgmt message
3498 {//startif1
3499
3500 //no SCCP or node congestion assumed
3501 //'route on SSN' assumed
3502
3503 //subsystems are assumed equipped and available
3504 //as the message is received from MTP3 , DPC is assumed to be matching the PC of the own node without
3505 // any further checks
3506
3507 //assemble ASP_SCCP_N_
3508 vl_N_UNITDATA_ind.callingAddress:=
3509 ConvertPDUEncodedAddressToASPAddress(pl_PDU_SCCP_Unitdata.callingPAddress);
3510
3511 // Wrong old:
3512 //vl_N_UNITDATA_ind.sequenceControl:=
3513 // '0000000'B&pl_PDU_SCCP_Unitdata.protClass.class[0]; // Q.713/3.6 0.bit=1=>seq msb???
3514
3515 vl_N_UNITDATA_ind.sequenceControl:=
3516 '0000000'B&pl_PDU_SCCP_Unitdata.protClass.class[3];
3517
3518 if( pl_PDU_SCCP_Unitdata.protClass.messageHandling == '1000'B )
3519 { vl_N_UNITDATA_ind.returnOption := '00000001'B; }
3520 else
3521 { vl_N_UNITDATA_ind.returnOption := '00000000'B; }
3522
3523 //connectionless-class 0 or 1
3524 //protocol class 0- SCCP_sequence_ctrl_off
3525 //protocol class 1- SCCP_sequence_ctrl_on
3526 // wrong: vl_N_UNITDATA_ind.returnOption :='0000000'B&pl_PDU_SCCP_Unitdata.protClass.messageHandling[3];
3527
3528 //only two values( '0000'B -no special options
3529 //and '1000'B -return message on error) assumed
3530 //octetstring vs. length+octetstring
3531 vl_N_UNITDATA_ind.userData :=pl_PDU_SCCP_Unitdata.data.data;
3532 vl_N_UNITDATA_ind.importance := omit;
3533 SCCP_SP_PORT.send( vl_N_UNITDATA_ind );
3534
3535
3536 }//endif1
3537 else { //startelse1-SCCPmanagement message
3538
3539 log ("SCCP management message received");
3540 var octetstring vl_data;
3541 vl_data:=pl_PDU_SCCP_Unitdata.data.data;
3542
3543 vl_PDU_SCCP.unitdata.messageType:=udt ;
3544 vl_PDU_SCCP.unitdata.calledPAddress:=pl_PDU_SCCP_Unitdata.callingPAddress;
3545 vl_PDU_SCCP.unitdata.callingPAddress:=pl_PDU_SCCP_Unitdata.calledPAddress;
3546
3547 if ((vl_data[0]=='03'O) and //SST message
3548 ((v_SSN==0) or (oct2int(vl_data[1])==v_SSN))) //right SSN
3549 {//startif2
3550
3551 //send Unitdata with SSA
3552 vl_PDU_SCCP.unitdata.data.data[0]:='01'O;//Change to SSA
3553 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
3554 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP));//send Unitdata_SSA
3555
3556 }//endif2
3557 else if ((vl_data[0]=='02'O) and //SSP message
3558 ((v_SSN==0) or (oct2int(vl_data[1])==v_SSN))) //right SSN
3559 {//startif2
3560
3561 //send Unitdata with SST
3562 vl_PDU_SCCP.unitdata.data.data[0]:='03'O;//Change to SST
3563 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
3564 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP));//send Unitdata_SST
3565
3566 }//endif2
3567 else if ((vl_data[0]=='01'O) and //SSA message
3568 ((v_SSN==0) or (oct2int(vl_data[1])==v_SSN))) //right SSN
3569 {//startif2
3570
3571 //send Unitdata with SS
3572 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
3573 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP ));//send Unitdata_SSA
3574
3575 }//endif2
3576 else
3577 {
3578 log("Unsupported (or containing inconsistent SSN)SCCP management message received and discarded")
3579 }
3580 }//endelse1
3581 return;
3582 } // processing_PDU_SCCP_Unitdata()
3583
3584 //******************************************************************
3585 // processing_PDU_SCCP_UnitdataService
3586 //******************************************************************
3587 function processing_PDU_SCCP_UnitdataService( in PDU_SCCP_UnitdataService pl_PDU_SCCP_UnitdataService )
3588 runs on SCCP_CT
3589 {
3590
3591 var ASP_SCCP_N_NOTICE_ind vl_N_NOTICE_ind;
3592
3593 //no SCCP or node congestion assumed
3594 //'route on SSN' assumed
3595
3596 //subsystems are assumed equipped and available
3597 //as the message is received from MTP3 , DPC is assumed to be the PC of the own node without
3598 // any further checks
3599
3600 //assemble ASP_SCCP_N_
3601
3602 vl_N_NOTICE_ind.calledAddress :=ConvertPDUEncodedAddressToASPAddress(pl_PDU_SCCP_UnitdataService.calledPAddress );
3603 vl_N_NOTICE_ind.callingAddress:=ConvertPDUEncodedAddressToASPAddress(pl_PDU_SCCP_UnitdataService.callingPAddress);
3604 //one to one mapping between reasonForReturn and returnCause -Q713 A5
3605 vl_N_NOTICE_ind.reasonForReturn := pl_PDU_SCCP_UnitdataService.returnCause ;
3606 vl_N_NOTICE_ind.userData := pl_PDU_SCCP_UnitdataService.data.data ;
3607
3608 SCCP_SP_PORT.send( t_ASP_N_NOTICE_ind(
3609 vl_N_NOTICE_ind.calledAddress ,
3610 vl_N_NOTICE_ind.callingAddress,
3611 vl_N_NOTICE_ind.reasonForReturn,
3612 vl_N_NOTICE_ind.userData ,
3613 omit));
3614
3615 }// processing_PDU_SCCP_UnitdataService
3616
3617
3618 //******************************************************************
3619 // processing_PDU_SCCP_ConnectionRequest
3620 //******************************************************************
3621 function processing_PDU_SCCP_ConnectionRequest( in PDU_SCCP_ConnectionRequest pl_PDU_SCCP_ConnectionRequest)
3622 runs on SCCP_CT
3623 {
3624 //no SCCP or node congestion assumed
3625 //we assume that routing is done on SSN; we are in the dest.node
3626 //SS is equipped and available
3627
3628 //check if connection already established
3629 //local reference not assigned yet; search has to be done based on remote reference,
3630 // to prevent erroneous situations
3631 //for all other MTP3_ASPs, search is done based on destLocRef, containing the local
3632 //reference sent to the neighbouring node
3633
3634 if (ConnectionAlreadyEstablished_remote(pl_PDU_SCCP_ConnectionRequest.sourceLocRef))
3635 {//startif3
3636 v_session :=Retrieve_session_remote(pl_PDU_SCCP_ConnectionRequest.sourceLocRef);
3637 //Action Table follows
3638
3639 if (ConnectionTable[v_session].state==idle)
3640 { log("CR received with reference for an already established conn. in state:idle");}//no source ref known
3641 else if (ConnectionTable[v_session].state==active)
3642 { log("CR received with reference for an already established conn. in state:active");}
3643 else if (ConnectionTable[v_session].state==reset_bothway)
3644 { log("CR received with reference for an already established conn. in state:reset_bothway");}
3645 else if (ConnectionTable[v_session].state==connection_pending_IC)
3646 { log("CR received with reference for an already established conn. in state:connection_pending_IC");}
3647 //discard message, return
3648 else if (ConnectionTable[v_session].state==disconnect_pending)
3649 { log("CR received with reference for an already established conn. in state:disconnect_pending");}//discard message, return
3650 else if (ConnectionTable[v_session].state==reset_IC) {//startif4
3651 //discard received message
3652 f_StartTimer(internal_reset,v_session,0.0);//the dummy timer times out immediately
3653 //state changed to active
3654 ConnectionTable[v_session].state:=active;
3655
3656 }//endif4
3657 else if (ConnectionTable[v_session].state==wait_conn_confirm)
3658 {//startif4
3659 //stop connection timer
3660 f_StopTimer(conn_est,v_session);
3661 //release resources
3662 ReleaseResources(v_session);
3663 }//endif4
3664 }//endif3
3665 else {//startelse
3666
3667 //*************************************************************************
3668 //connection not yet established - new v_session
3669 //check if resources available
3670 v_session:=CheckIdleIndividuals()
3671
3672 //idle individual found , resources available, 0<=v_session<=15
3673 if ( v_session!=-1 )
3674 {//startif3
3675 //
3676 ConnectionTable[v_session].localReference := GenerateLocalReference();
3677 ConnectionTable[v_session].remoteReference:= pl_PDU_SCCP_ConnectionRequest.sourceLocRef;
3678 //local reference assigned here!!(see Fig. C.3/Q714)
3679
3680 ConnectionTable[v_session].connectionId := GenerateConnectionId();
3681
3682 //once local reference is assigned , a session is considered established
3683 //determine protocol class
3684 //assemble ASP_SCCP_N_
3685 //start guard timer T_guard ;if no answer to ASP_SCCP_N_CONNECT_ind is received, timer will release
3686
3687 var ASP_SCCP_N_CONNECT_ind vl_N_CONNECT_ind;
3688 f_StartTimer(t_guard,v_session);
3689
3690 vl_N_CONNECT_ind.calledAddress:=ConvertPDUEncodedAddressToASPAddress(pl_PDU_SCCP_ConnectionRequest.calledPAddress);
3691
3692 if (ispresent(pl_PDU_SCCP_ConnectionRequest.optionalPart))
3693 {
3694 if (ispresent(pl_PDU_SCCP_ConnectionRequest.optionalPart.callingPAddress))
3695 {//startif4
3696
3697 //temporary variable to avoid type conversion problems
3698 var SCCP_param_CPartyAddressEnc vl_PDUAddress;
3699 vl_PDUAddress.addr := pl_PDU_SCCP_ConnectionRequest.optionalPart.callingPAddress.addr;
3700 vl_PDUAddress.paramLength := pl_PDU_SCCP_ConnectionRequest.optionalPart.callingPAddress.paramLength;
3701 vl_N_CONNECT_ind.callingAddress:= ConvertPDUEncodedAddressToASPAddress(vl_PDUAddress);
3702
3703 }//endif4
3704 else {vl_N_CONNECT_ind.callingAddress:=omit}
3705
3706 if (ispresent(pl_PDU_SCCP_ConnectionRequest.optionalPart.data))
3707 {//startif4
3708 //temporary variable to avoid type conversion problems
3709 var SCCP_param_Data_opt vl_SCCP_param_Data_opt;
3710
3711 vl_SCCP_param_Data_opt:=pl_PDU_SCCP_ConnectionRequest.optionalPart.data;
3712 vl_N_CONNECT_ind.userData:=vl_SCCP_param_Data_opt.data;
3713
3714 }//endif4
3715 else {vl_N_CONNECT_ind.userData:=omit}
3716 }
3717 else
3718 {
3719 vl_N_CONNECT_ind.callingAddress:=omit;
3720 vl_N_CONNECT_ind.userData:=omit;
3721 }
3722
3723 vl_N_CONNECT_ind.connectionId:=ConnectionTable[v_session].connectionId;
3724
3725 SCCP_SP_PORT.send( t_ASP_N_CONNECT_ind(
3726 vl_N_CONNECT_ind.calledAddress,
3727 vl_N_CONNECT_ind.callingAddress,
3728 omit,
3729 vl_N_CONNECT_ind.userData, //ethcky
3730 vl_N_CONNECT_ind.connectionId,
3731 omit));//send ASP_SCCP_N_CONNECT_ind
3732
3733 //restart send inactivity timer (baat)
3734 f_StopTimer(ias,v_session);//to avoid warnings
3735 f_StartTimer(ias,v_session);
3736 ConnectionTable[v_session].state:=connection_pending_IC;
3737
3738 }//endif3
3739
3740 //no idle individual found , no resources available , v_session=-1
3741 if (v_session==-1)
3742 {//startif3
3743
3744 var PDU_SCCP vl_PDU_SCCP;
3745 //assemble and route MTP3 ASP
3746 vl_PDU_SCCP.connrefused.messageType:=cref;
3747 vl_PDU_SCCP.connrefused.destLocRef:=pl_PDU_SCCP_ConnectionRequest.sourceLocRef;
3748 vl_PDU_SCCP.connrefused.refusalCause:=1;//End user congestion
3749 vl_PDU_SCCP.connrefused.pointer1:=0;// No options
3750 vl_PDU_SCCP.connrefused.optionalPart:=omit;
3751 vl_PDU_SCCP.connrefused.eop:=omit;
3752 MTP3_SCCP_PORT.send ( t_ASP_MTP3_TRANSFERreq_sccp
3753 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP)); //Connection refused, no idle individuals
3754 //return to idle
3755 }//endif3
3756 }//endelse
3757
3758 }//processing_PDU_SCCP_ConnectionRequest
3759
3760//******************************************************************
3761// processing_PDU_SCCP_ConnectionConfirm
3762//******************************************************************
3763 function processing_PDU_SCCP_ConnectionConfirm( in PDU_SCCP_ConnectionConfirm pl_PDU_SCCP_ConnectionConfirm)
3764 runs on SCCP_CT
3765 {
3766 var PDU_SCCP vl_PDU_SCCP;
3767 var ASP_SCCP_N_CONNECT_cfm vl_N_CONNECT_cfm;
3768
3769 log(pl_PDU_SCCP_ConnectionConfirm);
3770
Harald Welte3eff2c52017-05-16 19:00:29 +02003771 //Store data parameter
3772 var template SCCP_PAR_UserData tl_data := omit;
3773 if (ispresent(pl_PDU_SCCP_ConnectionConfirm.optionalPart))
3774 {
3775 if (ispresent(pl_PDU_SCCP_ConnectionConfirm.optionalPart.data))
3776 {
3777 tl_data := pl_PDU_SCCP_ConnectionConfirm.optionalPart.data.data;
3778 }
3779 }
3780
Harald Welteac359802017-04-12 12:13:44 +02003781 //check if connection already established
3782 if (ConnectionAlreadyEstablished(pl_PDU_SCCP_ConnectionConfirm.destLocRef))
3783 {//startif2
3784 v_session :=Retrieve_session(pl_PDU_SCCP_ConnectionConfirm.destLocRef);
3785 //Action Table follows
3786 if (ConnectionTable[v_session].state==idle)
3787 {
3788 //assemble and route MTP3_ASP
3789
3790 vl_PDU_SCCP.pduerror.messageType:=err;
3791 vl_PDU_SCCP.pduerror.destLocRef:=ConnectionTable[v_session].remoteReference;
3792 vl_PDU_SCCP.pduerror.errorCause:=cg_Err_unassignedDestinationLRN;
3793
3794 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
3795 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP)); //Send Error
3796 //then return to idle
3797 }
3798 else if (ConnectionTable[v_session].state==connection_pending_IC)
3799 { log("CC received in state:connection_pending_IC"); }//discard message, return
3800 else if (ConnectionTable[v_session].state==disconnect_pending)
3801 { log("CC received in state:disconnect_pending"); }//discard message, return
3802 else if (ConnectionTable[v_session].state==active)
3803 { log("CC received in state:active"); }//do nothing, return
3804 else if (ConnectionTable[v_session].state==reset_bothway)
3805 { log("CC received in state:reset_bothway"); }//
3806 else if (ConnectionTable[v_session].state==connection_pending_OG)
3807 {//startif3
3808 //stop connection timer
3809 f_StopTimer(conn_est,v_session);
3810 //start inactivity timers
3811 f_StartTimer(ias,v_session);
3812 f_StartTimer(iar,v_session);
3813 //assign protocol class:=2, associate remote reference
3814 ConnectionTable[v_session].remoteReference:=pl_PDU_SCCP_ConnectionConfirm.sourceLocRef;
3815 //assemble ASP_SCCP_N_
3816 vl_N_CONNECT_cfm.connectionId:=ConnectionTable[v_session].connectionId;
3817
3818 SCCP_SP_PORT.send( t_ASP_N_CONNECT_cfm(
3819 omit,
3820 omit,
Harald Welte3eff2c52017-05-16 19:00:29 +02003821 tl_data,
Harald Welteac359802017-04-12 12:13:44 +02003822 vl_N_CONNECT_cfm.connectionId,
3823 omit
3824 ));//send ASP_SCCP_N_CONNECT_confirm
3825
3826 ConnectionTable[v_session].state:=active;
3827 }//endif3
3828 else if (ConnectionTable[v_session].state==wait_conn_confirm)//connection is confirmed ,
3829 // but it has meanwhile been disconnected by the user
3830 {//startif3
3831 //stop connection timer
3832 f_StopTimer(conn_est,v_session);
3833 //associate remote reference to connection
3834 ConnectionTable[v_session].remoteReference:=pl_PDU_SCCP_ConnectionConfirm.sourceLocRef;
3835 //assemble and route MTP3_ASP
3836 vl_PDU_SCCP.released.messageType:=rlsd;
3837 vl_PDU_SCCP.released.destLocRef:=ConnectionTable[v_session].remoteReference;
3838 vl_PDU_SCCP.released.sourceLocRef:=ConnectionTable[v_session].localReference;
3839 vl_PDU_SCCP.released.releaseCause:=cg_DISC_normal;
3840 vl_PDU_SCCP.released.pointer1:=0;//No options
3841 vl_PDU_SCCP.released.optionalPart:=omit;
3842 vl_PDU_SCCP.released.eop:=omit;
3843
3844 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
3845 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP));//send Released
3846 //start release timer
3847 f_StartTimer(rel,v_session);
3848 ConnectionTable[v_session].state:=disconnect_pending;
3849 }//endif3
3850 else if (ConnectionTable[v_session].state==reset_IC)
3851 {//startif3
3852 //discard received message
3853 f_StartTimer(internal_reset,v_session,0.0);//the timer times out immediately
3854 //state changed to active
3855 ConnectionTable[v_session].state:=active;
3856
3857 }//endif3
3858 else { log("CC received in an unexpected state"); }
3859 }//endif2
3860 else {//startelse -Connection confirm received with destLocRef not in ConnectionTable
3861 //send ERR
3862
3863 vl_PDU_SCCP.pduerror.messageType:=err;
3864 vl_PDU_SCCP.pduerror.destLocRef:=pl_PDU_SCCP_ConnectionConfirm.sourceLocRef;
3865 vl_PDU_SCCP.pduerror.errorCause:=cg_Err_unassignedDestinationLRN;
3866
3867 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
3868 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP)); //Send Error
3869 }//endelse
3870
3871 }//processing_PDU_SCCP_ConnectionConfirm
3872
3873 //******************************************************************
3874 // processing_PDU_SCCP_Released
3875 //******************************************************************
3876 function processing_PDU_SCCP_Released( in PDU_SCCP_Released pl_PDU_SCCP_Released)
3877 runs on SCCP_CT
3878 {
3879 var PDU_SCCP vl_PDU_SCCP;
3880 var ASP_SCCP_N_DISCONNECT_ind vl_N_DISCONNECT_ind;
3881
3882 //Store data parameter
3883 var template SCCP_PAR_UserData tl_data := omit;
3884 if (ispresent(pl_PDU_SCCP_Released.optionalPart))
3885 {
3886 if (ispresent(pl_PDU_SCCP_Released.optionalPart.data))
3887 {
3888 tl_data := pl_PDU_SCCP_Released.optionalPart.data.data;
3889 }
3890 }
3891
3892 //check if connection already established
3893 if (ConnectionAlreadyEstablished(pl_PDU_SCCP_Released.destLocRef))
3894 {//startif1
3895 v_session :=Retrieve_session(pl_PDU_SCCP_Released.destLocRef);
3896 //check if remote reference is correct -Table B.2 /Q.714
3897 if (ConnectionTable[v_session].remoteReference==pl_PDU_SCCP_Released.sourceLocRef)
3898 {//startif2
3899 //Action Table follows
3900 if (ConnectionTable[v_session].state==idle)//C.3- 1/6 ????nem valoszinu hogy ez eloallhat
3901 {//startif3
3902
3903 //assemble and route MTP3_ASP
3904 vl_PDU_SCCP.relcomp.messageType:=rlc;
3905 vl_PDU_SCCP.relcomp.destLocRef:=ConnectionTable[v_session].remoteReference;
3906 vl_PDU_SCCP.relcomp.sourceLocRef:=ConnectionTable[v_session].localReference;
3907
3908 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
3909 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP)); //Send Release complete
3910 //then return to idle
3911 }//endif3
3912 else if (ConnectionTable[v_session].state==connection_pending_IC)
3913 { log("RLSD received in state:connection_pending_IC");}//discard message, return
3914 else if (ConnectionTable[v_session].state==disconnect_pending)
3915 { log("RLSD received in state:disconnect_pending");}//discard message, return
3916 else if (ConnectionTable[v_session].state==active)
3917 {//startif3
3918 //assemble ASP_SCCP_N_
3919 vl_N_DISCONNECT_ind.originator:=cg_Mapping_RelCause_Orig[pl_PDU_SCCP_Released.releaseCause];
3920 vl_N_DISCONNECT_ind.reason:=cg_Mapping_RelCause_Reason[pl_PDU_SCCP_Released.releaseCause];
3921 vl_N_DISCONNECT_ind.connectionId:=ConnectionTable[v_session].connectionId;
3922
3923 SCCP_SP_PORT.send( t_ASP_N_DISCONNECT_ind(
3924 vl_N_DISCONNECT_ind.originator,
3925 omit,
3926 vl_N_DISCONNECT_ind.reason,
3927 tl_data,
3928 vl_N_DISCONNECT_ind.connectionId,
3929 omit
3930 ));//send ASP_SCCP_N_DISCONNECT_ind
3931 //assemble and route MTP3_ASP
3932
3933 vl_PDU_SCCP.relcomp.messageType :=rlc;
3934 vl_PDU_SCCP.relcomp.destLocRef :=pl_PDU_SCCP_Released.sourceLocRef;
3935 vl_PDU_SCCP.relcomp.sourceLocRef:=pl_PDU_SCCP_Released.destLocRef;
3936
3937 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
3938 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP));//send Release complete
3939
3940 //release resources
3941 ReleaseResources(v_session);
3942 }//endif3
3943 else if (ConnectionTable[v_session].state==connection_pending_OG)
3944 {//startif3
3945 //assemble and route MTP3_ASP
3946 vl_PDU_SCCP.relcomp.messageType :=rlc;
3947 vl_PDU_SCCP.relcomp.destLocRef :=pl_PDU_SCCP_Released.sourceLocRef;
3948 vl_PDU_SCCP.relcomp.sourceLocRef:=pl_PDU_SCCP_Released.destLocRef;
3949 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
3950 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP)); //Send Release complete
3951
3952 //stop connection timer
3953 f_StopTimer(conn_est,v_session);
3954 //assemble ASP_SCCP_N_
3955
3956 vl_N_DISCONNECT_ind.originator :=cg_Mapping_RelCause_Orig[pl_PDU_SCCP_Released.releaseCause];
3957 vl_N_DISCONNECT_ind.reason :=cg_Mapping_RelCause_Reason[pl_PDU_SCCP_Released.releaseCause];
3958 vl_N_DISCONNECT_ind.connectionId:=ConnectionTable[v_session].connectionId;
3959
3960 SCCP_SP_PORT.send( t_ASP_N_DISCONNECT_ind(
3961 vl_N_DISCONNECT_ind.originator,
3962 omit,
3963 vl_N_DISCONNECT_ind.reason,
3964 tl_data,
3965 vl_N_DISCONNECT_ind.connectionId,
3966 omit
3967 ));//send ASP_SCCP_N_DISCONNECT_ind
3968 //release resources
3969 ReleaseResources(v_session);
3970
3971 }//endif3
3972 else if (ConnectionTable[v_session].state==wait_conn_confirm)
3973 {//startif3
3974 //assemble and route MTP3_ASP
3975 vl_PDU_SCCP.relcomp.messageType :=rlc;
3976 vl_PDU_SCCP.relcomp.destLocRef :=pl_PDU_SCCP_Released.sourceLocRef;
3977 vl_PDU_SCCP.relcomp.sourceLocRef :=pl_PDU_SCCP_Released.destLocRef;
3978 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
3979 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP)); //Send Release complete
3980 //stop connection timer
3981 f_StopTimer(conn_est,v_session);
3982 //release resources
3983 ReleaseResources(v_session);
3984 }//endif3
3985 else if (ConnectionTable[v_session].state==reset_IC)
3986 {//startif3
3987 //assemble ASP_SCCP_N_
3988 vl_N_DISCONNECT_ind.originator:=cg_Mapping_RelCause_Orig[pl_PDU_SCCP_Released.releaseCause];
3989 vl_N_DISCONNECT_ind.reason :=cg_Mapping_RelCause_Reason[pl_PDU_SCCP_Released.releaseCause];
3990 vl_N_DISCONNECT_ind.connectionId:=ConnectionTable[v_session].connectionId;
3991 SCCP_SP_PORT.send( t_ASP_N_DISCONNECT_ind(
3992 vl_N_DISCONNECT_ind.originator,
3993 omit,
3994 vl_N_DISCONNECT_ind.reason,
3995 tl_data,
3996 vl_N_DISCONNECT_ind.connectionId,
3997 omit
3998 ));//send ASP_SCCP_N_DISCONNECT_ind
3999
4000 //release resources, stop inactivity timers, change state to idle
4001 ReleaseResources(v_session);
4002 }//endif3
4003 else if (ConnectionTable[v_session].state==reset_bothway)
4004 {//startif3
4005 //assemble ASP_SCCP_N_
4006
4007 vl_N_DISCONNECT_ind.originator:=cg_Mapping_RelCause_Orig[pl_PDU_SCCP_Released.releaseCause];
4008 vl_N_DISCONNECT_ind.reason :=cg_Mapping_RelCause_Reason[pl_PDU_SCCP_Released.releaseCause];
4009 vl_N_DISCONNECT_ind.connectionId:=ConnectionTable[v_session].connectionId;
4010
4011 SCCP_SP_PORT.send( t_ASP_N_DISCONNECT_ind(
4012 vl_N_DISCONNECT_ind.originator,
4013 omit,
4014 vl_N_DISCONNECT_ind.reason,
4015 tl_data,
4016 vl_N_DISCONNECT_ind.connectionId,
4017 omit
4018 ));//send ASP_SCCP_N_DISCONNECT_ind
4019
4020 //release resources, stop inactivity timers, change state to idle
4021 ReleaseResources(v_session);
4022
4023 }//endif3
4024 else { log("RLSD received in an unexpected state"); }
4025 }//endif2
4026 else {//remote reference inconsistent, error action follows
4027
4028 vl_PDU_SCCP.pduerror.messageType:=err;
4029 vl_PDU_SCCP.pduerror.destLocRef :=pl_PDU_SCCP_Released.sourceLocRef;
4030 vl_PDU_SCCP.pduerror.errorCause :=cg_Err_inconsistentSourceLRN;
4031
4032 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
4033 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP)); //Send Error
4034 }//endelse
4035 }//endif1
4036 else {//Released(Y,X) received with destLocRef not in ConnectionTable
4037 //send RLC(X,Y)
4038
4039 vl_PDU_SCCP.relcomp.messageType :=rlc;
4040 vl_PDU_SCCP.relcomp.destLocRef :=pl_PDU_SCCP_Released.sourceLocRef;
4041 vl_PDU_SCCP.relcomp.sourceLocRef:=pl_PDU_SCCP_Released.destLocRef;
4042
4043 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
4044 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP)); //Send Release complete
4045
4046 }//endelse
4047 }//processing_PDU_SCCP_Released
4048
4049 //******************************************************************
4050 // processing_PDU_SCCP_ProtDataUnitError
4051 //******************************************************************
4052 function processing_PDU_SCCP_ProtDataUnitError( in PDU_SCCP_ProtDataUnitError pl_PDU_SCCP_ProtDataUnitError)
4053 runs on SCCP_CT
4054 {
4055 var PDU_SCCP vl_PDU_SCCP;
4056 var ASP_SCCP_N_DISCONNECT_ind vl_N_DISCONNECT_ind;
4057
4058 //check if connection already established
4059 if (ConnectionAlreadyEstablished(pl_PDU_SCCP_ProtDataUnitError.destLocRef))
4060 {//startif2
4061 v_session :=Retrieve_session(pl_PDU_SCCP_ProtDataUnitError.destLocRef);
4062 //Action Table follows
4063
4064 if (ConnectionTable[v_session].state==idle)
4065 {//startif3
4066 //assemble and route MTP3_ASP
4067
4068 vl_PDU_SCCP.pduerror.messageType:=err;
4069 vl_PDU_SCCP.pduerror.destLocRef:=ConnectionTable[v_session].remoteReference;
4070 vl_PDU_SCCP.pduerror.errorCause:=cg_Err_unassignedDestinationLRN;
4071 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
4072 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP)); //Send Error
4073 //then return to idle
4074
4075 }//endif3
4076 else if (ConnectionTable[v_session].state==disconnect_pending)
4077 { log("PDUError received in state:disconnect_pending ");}//discard message, return
4078 else if (ConnectionTable[v_session].state==connection_pending_IC)
4079 { log("PDUError received in state:connection_pending_IC ");}//discard message, return
4080 else if (ConnectionTable[v_session].state==reset_bothway)
4081 {//startif3
4082 //assemble ASP_SCCP_N_
4083 vl_N_DISCONNECT_ind.originator :=cg_Undefined;
4084 vl_N_DISCONNECT_ind.reason :=pl_PDU_SCCP_ProtDataUnitError.errorCause;//?
4085 vl_N_DISCONNECT_ind.connectionId:=ConnectionTable[v_session].connectionId;
4086 SCCP_SP_PORT.send( t_ASP_N_DISCONNECT_ind(
4087 vl_N_DISCONNECT_ind.originator,
4088 omit,
4089 vl_N_DISCONNECT_ind.reason,
4090 omit,
4091 vl_N_DISCONNECT_ind.connectionId,
4092 omit
4093 ));//send ASP_SCCP_N_DISCONNECT_ind
4094
4095 //release resources, stop inactivity timers, change state to idle
4096 ReleaseResources(v_session);
4097 }//endif3
4098 else if (ConnectionTable[v_session].state==active)
4099 {//startif3
4100 if (pl_PDU_SCCP_ProtDataUnitError.errorCause!=cg_Err_serviceClassMismatch)
4101 {//startif4
4102
4103 //assemble ASP_SCCP_N_
4104 vl_N_DISCONNECT_ind.originator:=cg_Undefined;
4105 vl_N_DISCONNECT_ind.reason:=pl_PDU_SCCP_ProtDataUnitError.errorCause;//?
4106 vl_N_DISCONNECT_ind.connectionId:=ConnectionTable[v_session].connectionId;
4107
4108 SCCP_SP_PORT.send( t_ASP_N_DISCONNECT_ind(
4109 vl_N_DISCONNECT_ind.originator,
4110 omit,
4111 vl_N_DISCONNECT_ind.reason,
4112 omit,
4113 vl_N_DISCONNECT_ind.connectionId,
4114 omit
4115 ));//send ASP_SCCP_N_DISCONNECT_ind
4116 //release resources
4117 ReleaseResources(v_session);
4118
4119 }//endif4
4120 else {//startelse -Service class mismatch
4121
4122 //assemble ASP_SCCP_N_
4123
4124 vl_N_DISCONNECT_ind.originator :=cg_Undefined;
4125 vl_N_DISCONNECT_ind.reason :=pl_PDU_SCCP_ProtDataUnitError.errorCause;
4126 vl_N_DISCONNECT_ind.connectionId:=ConnectionTable[v_session].connectionId;
4127
4128 SCCP_SP_PORT.send( t_ASP_N_DISCONNECT_ind(
4129 vl_N_DISCONNECT_ind.originator,
4130 omit,
4131 vl_N_DISCONNECT_ind.reason,
4132 omit,
4133 vl_N_DISCONNECT_ind.connectionId,
4134 omit
4135 ));//send ASP_SCCP_N_DISCONNECT_ind
4136
4137 //stop inactivity timers
4138 f_StopTimer(iar,v_session);
4139 f_StopTimer(ias,v_session);
4140 //send Released
4141 //assemble and route MTP3_ASP
4142
4143 vl_PDU_SCCP.released.messageType:=rlsd;
4144 vl_PDU_SCCP.released.destLocRef:=ConnectionTable[v_session].remoteReference;
4145 vl_PDU_SCCP.released.sourceLocRef:=ConnectionTable[v_session].localReference;
4146 vl_PDU_SCCP.released.releaseCause:=cg_Rel_inconsConnData;
4147 vl_PDU_SCCP.released.pointer1:=0;//No optional part
4148 vl_PDU_SCCP.released.optionalPart:=omit;
4149 vl_PDU_SCCP.released.eop:=omit;
4150
4151 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
4152 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP));//send Released
4153
4154 //start release timer
4155 f_StartTimer(rel,v_session);
4156 //change state to diconnect pending
4157 ConnectionTable[v_session].state:=disconnect_pending;
4158
4159 }//endelse
4160
4161 }//endif3
4162 else if (ConnectionTable[v_session].state==connection_pending_OG)
4163 {//startif3
4164 //stop connection timer
4165 f_StopTimer(conn_est,v_session);
4166 //assemble ASP_SCCP_N_
4167
4168 vl_N_DISCONNECT_ind.originator :=cg_Undefined;
4169 vl_N_DISCONNECT_ind.reason :=pl_PDU_SCCP_ProtDataUnitError.errorCause;
4170 vl_N_DISCONNECT_ind.connectionId:=ConnectionTable[v_session].connectionId;
4171
4172 SCCP_SP_PORT.send( t_ASP_N_DISCONNECT_ind(
4173 vl_N_DISCONNECT_ind.originator,
4174 omit,
4175 vl_N_DISCONNECT_ind.reason,
4176 omit,
4177 vl_N_DISCONNECT_ind.connectionId,
4178 omit
4179 ));//send ASP_SCCP_N_DISCONNECT_ind
4180 //release resources
4181 ReleaseResources(v_session);
4182 }//endif3
4183 else if (ConnectionTable[v_session].state==wait_conn_confirm)
4184 {//startif3
4185
4186 //stop connection timer
4187 f_StopTimer(conn_est,v_session);
4188 //release resources
4189 ReleaseResources(v_session);
4190
4191
4192 }//endif3
4193 else if (ConnectionTable[v_session].state==reset_IC)
4194 {//startif3
4195 //assemble ASP_SCCP_N_
4196 vl_N_DISCONNECT_ind.originator:=cg_Undefined;
4197 vl_N_DISCONNECT_ind.reason:=pl_PDU_SCCP_ProtDataUnitError.errorCause;
4198 vl_N_DISCONNECT_ind.connectionId:=ConnectionTable[v_session].connectionId;
4199 SCCP_SP_PORT.send( t_ASP_N_DISCONNECT_ind(
4200 vl_N_DISCONNECT_ind.originator,
4201 omit,
4202 vl_N_DISCONNECT_ind.reason,
4203 omit,
4204 vl_N_DISCONNECT_ind.connectionId,
4205 omit
4206 ));//send ASP_SCCP_N_DISCONNECT_ind
4207
4208 //release resources, stop inactivity timers, change state to idle
4209 ReleaseResources(v_session);
4210
4211 }//endif3
4212 else { log("PDUError received in an unexpected state"); }
4213 }//endif2
4214 else {}//PDU_Error received with destLocRef not in ConnectionTable
4215
4216 }//processing_PDU_SCCP_ProtDataUnitError
4217
4218 //******************************************************************
4219 // processing_PDU_SCCP_ReleaseComplete
4220 //******************************************************************
4221 function processing_PDU_SCCP_ReleaseComplete(in PDU_SCCP_ReleaseComplete pl_PDU_SCCP_ReleaseComplete)
4222 runs on SCCP_CT
4223 {
4224 var ASP_SCCP_N_DISCONNECT_ind vl_N_DISCONNECT_ind;
4225
4226 //check if connection already established
4227 if (ConnectionAlreadyEstablished(pl_PDU_SCCP_ReleaseComplete.destLocRef))
4228 {//startif1
4229
4230 v_session :=Retrieve_session(pl_PDU_SCCP_ReleaseComplete.destLocRef);
4231 //check if remote reference is correct -Table B.2 /Q.714
4232 if (ConnectionTable[v_session].remoteReference==pl_PDU_SCCP_ReleaseComplete.sourceLocRef)
4233 {//startif2
4234
4235 //Action Table follows
4236 if (ConnectionTable[v_session].state==idle)
4237 { log("RLC received in state: idle"); }//C.3 1/6-do nothing-return to idle state
4238 else if (ConnectionTable[v_session].state==connection_pending_IC)
4239 { log("RLC received in state: connection_pending_IC"); }//discard message, return
4240 else if (ConnectionTable[v_session].state==active)
4241 { log("RLC received in state: active"); }//do nothing, return
4242 else if (ConnectionTable[v_session].state==reset_bothway)
4243 { log("RLC received in state:reset_bothway "); }//
4244 else if (ConnectionTable[v_session].state==disconnect_pending)
4245 {//startif3
4246 log("RLC received in state:disconnect_pending ");
4247 //log("release resources");
4248 ReleaseResources(v_session);
4249 }//endif3
4250 else if (ConnectionTable[v_session].state==connection_pending_OG)
4251 {//startif3
4252 f_StopTimer(conn_est,v_session);
4253 //assemble ASP_SCCP_N_
4254 vl_N_DISCONNECT_ind.originator:=cg_NSU;
4255 vl_N_DISCONNECT_ind.reason:=cg_DISC_normal;
4256 vl_N_DISCONNECT_ind.connectionId:=ConnectionTable[v_session].connectionId;
4257
4258 SCCP_SP_PORT.send( t_ASP_N_DISCONNECT_ind(
4259 vl_N_DISCONNECT_ind.originator,
4260 omit,
4261 vl_N_DISCONNECT_ind.reason,
4262 omit,
4263 vl_N_DISCONNECT_ind.connectionId,
4264 omit
4265 ));//send ASP_SCCP_N_DISCONNECT_ind
4266 //release resources
4267 ReleaseResources(v_session);
4268 }//endif3
4269 else if (ConnectionTable[v_session].state==wait_conn_confirm)
4270 {//startif3
4271 log("RLC received in state:wait_conn_confirm");
4272 //stop connection timer
4273 f_StopTimer(conn_est,v_session);
4274 //release resources
4275 ReleaseResources(v_session);
4276 }//endif3
4277 else if (ConnectionTable[v_session].state==reset_IC)
4278 {//startif3
4279 log("RLC received in state:reset_IC");
4280 //discard received message
4281 f_StartTimer(internal_reset,v_session,0.0);//the timer times out immediately
4282 //state changed to active
4283 ConnectionTable[v_session].state:=active;
4284 }//endif3
4285 else { log("RLC received in an unexpected state"); }
4286
4287 }//endif2
4288 else {}//remote reference inconsistent, discard
4289
4290 }//endif1
4291 else {}//Release complete received with destLocRef not in ConnectionTable
4292 //discard
4293
4294 }//processing_PDU_SCCP_ReleaseComplete
4295
4296 //******************************************************************
4297 // processing_PDU_SCCP_InactivityTest
4298 //******************************************************************
4299 function processing_PDU_SCCP_InactivityTest( in PDU_SCCP_InactivityTest pl_PDU_SCCP_InactivityTest)
4300 runs on SCCP_CT
4301 {
4302 var PDU_SCCP vl_PDU_SCCP;
4303 var ASP_SCCP_N_DISCONNECT_ind vl_N_DISCONNECT_ind;
4304
4305 //check if connection already established
4306 if (ConnectionAlreadyEstablished(pl_PDU_SCCP_InactivityTest.destLocRef))
4307 {//startif1
4308 v_session :=Retrieve_session(pl_PDU_SCCP_InactivityTest.destLocRef);
4309
4310 //check if remote reference is correct -Table B.2 /Q.714
4311 if (ConnectionTable[v_session].remoteReference==pl_PDU_SCCP_InactivityTest.sourceLocRef)
4312 {//startif2
4313
4314 //Action Table follows
4315 if (ConnectionTable[v_session].state==idle)
4316 { log("IT received in state :idle "); }//C.3 1/6-do nothing-return to idle state
4317 else if (ConnectionTable[v_session].state==connection_pending_IC)
4318 { log("IT received in state : connection_pending_IC"); }//discard message, return
4319 else if (ConnectionTable[v_session].state==connection_pending_OG)
4320 {//startif3
4321
4322 //stop connection timer
4323 f_StopTimer(conn_est,v_session);
4324 //assemble ASP_SCCP_N_
4325 vl_N_DISCONNECT_ind.originator := cg_NSU;
4326 vl_N_DISCONNECT_ind.reason := cg_DISC_normal;
4327 vl_N_DISCONNECT_ind.connectionId := ConnectionTable[v_session].connectionId;
4328
4329 SCCP_SP_PORT.send( t_ASP_N_DISCONNECT_ind(
4330 vl_N_DISCONNECT_ind.originator,
4331 omit,
4332 vl_N_DISCONNECT_ind.reason,
4333 omit,
4334 vl_N_DISCONNECT_ind.connectionId,
4335 omit
4336 ));//send ASP_SCCP_N_DISCONNECT_ind
4337 //release resources
4338 ReleaseResources(v_session);
4339
4340 }//endif3
4341 else if (ConnectionTable[v_session].state==disconnect_pending) {}
4342 else if (ConnectionTable[v_session].state==reset_bothway) {}//
4343 else if (ConnectionTable[v_session].state==active)
4344 {//startif3
4345 //source reference number assumed OK
4346 //or:
4347 //if (ConnectionTable[v_session].remoteReference!=pl_PDU_SCCP_InactivityTest.sourceLocRef)
4348 // release connection
4349 //protocol class assumed 2
4350 //restart receive inactivity timer
4351 f_StopTimer(iar,v_session);//to avoid warnings
4352 f_StartTimer(iar,v_session);
4353 }//endif3
4354 else if (ConnectionTable[v_session].state==reset_IC)
4355 {//startif3
4356 //discard received message
4357 f_StartTimer(internal_reset,v_session,0.0);//the timer times out immediately
4358 //state changed to active
4359 ConnectionTable[v_session].state:=active;
4360 }//endif3
4361 else if (ConnectionTable[v_session].state==wait_conn_confirm)
4362 {//startif3
4363
4364 //stop connection timer
4365 f_StopTimer(conn_est,v_session);
4366 //release resources
4367 ReleaseResources(v_session);
4368
4369 }//endif3
4370 else { log("IT received in an unexpected state"); }
4371 }//endif2
4372 else {//remote reference inconsistent, error action follows
4373 //message received with remote reference not the same as stored
4374 // two RLSD messages are sent back, one to the sored and to the received remote reference
4375 //sent first RLSD-see B.2/Q.714
4376
4377 vl_PDU_SCCP.released.messageType :=rlsd;
4378 vl_PDU_SCCP.released.destLocRef :=pl_PDU_SCCP_InactivityTest.sourceLocRef;
4379 vl_PDU_SCCP.released.sourceLocRef:=pl_PDU_SCCP_InactivityTest.destLocRef;
4380 vl_PDU_SCCP.released.releaseCause:=cg_Rel_inconsConnData;
4381 vl_PDU_SCCP.released.pointer1:=0;
4382 vl_PDU_SCCP.released.optionalPart:=omit;
4383 vl_PDU_SCCP.released.eop:=omit;
4384
4385 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
4386 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP));//send Released
4387
4388 //sent second RLSD-see B.2/Q.714
4389 vl_PDU_SCCP.released.destLocRef :=ConnectionTable[v_session].remoteReference;
4390
4391 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
4392 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP));//send Released
4393
4394 }//endelse
4395
4396 }//endif1
4397 else {}//Inactivity test received with destLocRef not in ConnectionTable
4398 //discard
4399
4400 }//processing_PDU_SCCP_InactivityTest
4401
4402 //******************************************************************
4403 // processing_PDU_SCCP_ResetRequest
4404 //******************************************************************
4405 function processing_PDU_SCCP_ResetRequest ( in PDU_SCCP_ResetRequest pl_PDU_SCCP_ResetRequest)
4406 runs on SCCP_CT
4407 {
4408 var PDU_SCCP vl_PDU_SCCP;
4409
4410 //check if connection already established
4411 if (ConnectionAlreadyEstablished(pl_PDU_SCCP_ResetRequest.destLocRef))
4412 {//startif1
4413 v_session :=Retrieve_session(pl_PDU_SCCP_ResetRequest.destLocRef);
4414 //check if remote reference is correct -Table B.2 /Q.714
4415
4416 if (ConnectionTable[v_session].remoteReference==pl_PDU_SCCP_ResetRequest.sourceLocRef)
4417 {//startif2
4418 //Action Table follows
4419 if (ConnectionTable[v_session].state==idle)
4420 {//startif3
4421
4422 //assemble and route MTP3_ASP
4423 vl_PDU_SCCP.pduerror.messageType:=err;
4424 vl_PDU_SCCP.pduerror.destLocRef:=ConnectionTable[v_session].remoteReference;
4425 vl_PDU_SCCP.pduerror.errorCause:=cg_Err_unassignedDestinationLRN;
4426 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
4427 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP)); //Send Error
4428 //then return to idle
4429
4430 }//endif3
4431 else if (ConnectionTable[v_session].state==connection_pending_IC) {}//discard message, return
4432 else if (ConnectionTable[v_session].state==connection_pending_OG)
4433 {//startif3
4434 //stop connection timer
4435 f_StopTimer(conn_est,v_session);
4436 //assemble ASP_SCCP_N_
4437 var ASP_SCCP_N_DISCONNECT_ind vl_N_DISCONNECT_ind;
4438 vl_N_DISCONNECT_ind.originator:=cg_NSU;
4439 vl_N_DISCONNECT_ind.reason:=cg_DISC_normal;
4440 vl_N_DISCONNECT_ind.connectionId:=ConnectionTable[v_session].connectionId;
4441 SCCP_SP_PORT.send( t_ASP_N_DISCONNECT_ind(
4442 vl_N_DISCONNECT_ind.originator,
4443 omit,
4444 vl_N_DISCONNECT_ind.reason,
4445 omit,
4446 vl_N_DISCONNECT_ind.connectionId,
4447 omit
4448 ));//send ASP_SCCP_N_DISCONNECT_ind
4449 //release resources
4450 ReleaseResources(v_session);
4451 }//endif3
4452 else if (ConnectionTable[v_session].state==disconnect_pending) {}
4453 else if (ConnectionTable[v_session].state==reset_bothway)
4454 {//startif3
4455
4456 //assemble ASP_SCCP_N_
4457 var ASP_SCCP_N_RESET_cfm vl_N_RESET_cfm;
4458 vl_N_RESET_cfm.connectionId:=ConnectionTable[v_session].connectionId;
4459 SCCP_SP_PORT.send( t_ASP_N_RESET_cfm(vl_N_RESET_cfm.connectionId));//send ASP_SCCP_N_RESET_cfm
4460
4461 //stop reset timer
4462 f_StopTimer(reset,v_session);
4463
4464 //restart receive inactivity timer
4465 f_StopTimer(iar,v_session);//to avoid warnings
4466 f_StartTimer(iar,v_session);
4467 //change state
4468 ConnectionTable[v_session].state:=reset_IC;
4469 }//endif3
4470 else if (ConnectionTable[v_session].state==active)
4471 {//startif3
4472 //restart receive inactivity timer
4473 f_StopTimer(iar,v_session);//to avoid warnings
4474 f_StartTimer(iar,v_session);
4475 //send ASP_SCCP_N_RESET_ind
4476 //assemble ASP_SCCP_N_
4477 var ASP_SCCP_N_RESET_ind vl_N_RESET_ind;
4478 vl_N_RESET_ind.originator:=cg_NSU;
4479 vl_N_RESET_ind.reason:=cg_RESET_unspec;
4480 vl_N_RESET_ind.connectionId:=ConnectionTable[v_session].connectionId;
4481
4482 SCCP_SP_PORT.send( t_ASP_N_RESET_ind(
4483 vl_N_RESET_ind.originator,
4484 vl_N_RESET_ind.reason,
4485 vl_N_RESET_ind.connectionId
4486 ));//send ASP_SCCP_N_RESET_ind
4487
4488 //reset variables
4489 ConnectionTable[v_session].state:=reset_IC;
4490 }//endif3
4491 else if (ConnectionTable[v_session].state==wait_conn_confirm)
4492 {//startif3
4493
4494 //stop connection timer
4495 f_StopTimer(conn_est,v_session);
4496 //release resources
4497 ReleaseResources(v_session);
4498 }//endif3
4499 else { log("RESREQ received in an unexpected state"); }
4500 }//endif2
4501 else {//remote reference inconsistent, error action follows
4502
4503 vl_PDU_SCCP.pduerror.messageType:=err;
4504 vl_PDU_SCCP.pduerror.destLocRef:=pl_PDU_SCCP_ResetRequest.sourceLocRef;
4505 vl_PDU_SCCP.pduerror.errorCause:=cg_Err_inconsistentSourceLRN;
4506 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
4507 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP)); //Send Error
4508
4509 }//endelse
4510 }//endif1
4511 else {//startelse-Reset request received with destLocRef not in ConnectionTable
4512
4513 //send ERR
4514 vl_PDU_SCCP.pduerror.messageType:=err;
4515 vl_PDU_SCCP.pduerror.destLocRef:=pl_PDU_SCCP_ResetRequest.sourceLocRef;
4516 vl_PDU_SCCP.pduerror.errorCause:=cg_Err_unassignedDestinationLRN;
4517
4518 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
4519 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP)); //Send Error
4520
4521 }//endelse
4522
4523 }//processing_PDU_SCCP_ResetRequest
4524
4525 //******************************************************************
4526 // processing_PDU_SCCP_ResetConfirm
4527 //******************************************************************
4528 function processing_PDU_SCCP_ResetConfirm ( in PDU_SCCP_ResetConfirm pl_PDU_SCCP_ResetConfirm)
4529 runs on SCCP_CT
4530 {
4531 var PDU_SCCP vl_PDU_SCCP;
4532
4533 //check if connection already established
4534 if (ConnectionAlreadyEstablished(pl_PDU_SCCP_ResetConfirm.destLocRef))
4535 {//startif1
4536 v_session :=Retrieve_session(pl_PDU_SCCP_ResetConfirm.destLocRef);
4537
4538 //check if remote reference is correct -Table B.2 /Q.714
4539 if (ConnectionTable[v_session].remoteReference==pl_PDU_SCCP_ResetConfirm.sourceLocRef)
4540 {//startif2
4541 //Action Table follows
4542
4543 if (ConnectionTable[v_session].state==idle)
4544 { log("RSC received in state:idle ");}//do nothing-return to idle state, no source ref known
4545 else if (ConnectionTable[v_session].state==connection_pending_IC)
4546 { log("RSC received in state:connection_pending_IC ");}//discard message, return
4547 else if (ConnectionTable[v_session].state==connection_pending_OG)
4548 {//startif3
4549
4550 var ASP_SCCP_N_DISCONNECT_ind vl_N_DISCONNECT_ind;
4551 //stop connection timer
4552 f_StopTimer(conn_est,v_session);
4553 //assemble ASP_SCCP_N_ASP
4554
4555 vl_N_DISCONNECT_ind.originator:=cg_NSU;
4556 vl_N_DISCONNECT_ind.reason:=cg_DISC_normal;
4557 vl_N_DISCONNECT_ind.connectionId:=ConnectionTable[v_session].connectionId;
4558 SCCP_SP_PORT.send( t_ASP_N_DISCONNECT_ind(
4559 vl_N_DISCONNECT_ind.originator,
4560 omit,
4561 vl_N_DISCONNECT_ind.reason,
4562 omit,
4563 vl_N_DISCONNECT_ind.connectionId,
4564 omit
4565 ));//send ASP_SCCP_N_DISCONNECT_ind
4566 //release resources
4567 ReleaseResources(v_session);
4568 }//endif3
4569 else if (ConnectionTable[v_session].state==disconnect_pending)
4570 { log("RSC received in state:disconnect_pending");}
4571 else if (ConnectionTable[v_session].state==reset_bothway)
4572 {//startif3
4573 //assemble ASP_SCCP_N_
4574 var ASP_SCCP_N_RESET_cfm vl_N_RESET_cfm;
4575 vl_N_RESET_cfm.connectionId:=ConnectionTable[v_session].connectionId;
4576 SCCP_SP_PORT.send( t_ASP_N_RESET_cfm(
4577 vl_N_RESET_cfm.connectionId
4578 ));//send ASP_SCCP_N_RESET_cfm
4579
4580 //stop reset timer
4581 f_StopTimer(reset,v_session);
4582
4583 //restart receive inactivity timer
4584 f_StopTimer(iar,v_session);//to avoid warnings
4585 f_StartTimer(iar,v_session);
4586 //change state
4587 ConnectionTable[v_session].state:=reset_IC;
4588 }//endif3
4589 else if (ConnectionTable[v_session].state==active)
4590 {//startif3
4591 //do nothing-return to idle state
4592 log("RSC received in state:active");
4593 }//endif3
4594 else if (ConnectionTable[v_session].state==reset_IC)
4595 {//startif3
4596 //discard received message
4597 f_StartTimer(internal_reset,v_session,0.0);//the timer times out immediately
4598 //state changed to active
4599 ConnectionTable[v_session].state:=active;
4600 }//endif3
4601 else if (ConnectionTable[v_session].state==wait_conn_confirm)
4602 {//startif3
4603 //stop connection timer
4604 f_StopTimer(conn_est,v_session);
4605 //release resources
4606 ReleaseResources(v_session);
4607 }//endif3
4608 else { log("ResConf received in an unexpected state"); }
4609 }//endif2
4610 else {//remote reference inconsistent, error action follows
4611
4612 vl_PDU_SCCP.pduerror.messageType:=err;
4613 vl_PDU_SCCP.pduerror.destLocRef :=pl_PDU_SCCP_ResetConfirm.sourceLocRef;
4614 vl_PDU_SCCP.pduerror.errorCause :=cg_Err_inconsistentSourceLRN;
4615
4616 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
4617 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP)); //Send Error
4618
4619 }//endelse
4620 }//endif1
4621 else {//startelse-Reset confirm received with destLocRef not in ConnectionTable
4622
4623 //send ERR
4624 vl_PDU_SCCP.pduerror.messageType:=err;
4625 vl_PDU_SCCP.pduerror.destLocRef :=pl_PDU_SCCP_ResetConfirm.sourceLocRef;
4626 vl_PDU_SCCP.pduerror.errorCause :=cg_Err_unassignedDestinationLRN;
4627
4628 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
4629 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP)); //Send Error
4630 }//endelse
4631 }//processing_PDU_SCCP_ResetConfirm
4632
4633 //******************************************************************
4634 // processing_PDU_SCCP_ConnectionRefused
4635 //******************************************************************
4636 function processing_PDU_SCCP_ConnectionRefused ( in PDU_SCCP_ConnectionRefused pl_PDU_SCCP_ConnectionRefused)
4637 runs on SCCP_CT
4638 {
4639 //Store data parameter
4640 var template SCCP_PAR_UserData tl_data := omit;
4641 if (ispresent(pl_PDU_SCCP_ConnectionRefused.optionalPart))
4642 {
4643 if (ispresent(pl_PDU_SCCP_ConnectionRefused.optionalPart.data))
4644 {
4645 tl_data := pl_PDU_SCCP_ConnectionRefused.optionalPart.data.data;
4646 }
4647 }
4648
4649 //check if connection already established
4650 if (ConnectionAlreadyEstablished(pl_PDU_SCCP_ConnectionRefused.destLocRef))
4651 {//startif2
4652 v_session :=Retrieve_session(pl_PDU_SCCP_ConnectionRefused.destLocRef);
4653 //Action Table follows
4654
4655 if (ConnectionTable[v_session].state==idle)
4656 { log ("CREF received in state:idle");} //do nothing , return to idle, source ref unknown
4657 else if (ConnectionTable[v_session].state==connection_pending_IC)
4658 { log ("CREF received in state:connection_pending_IC");}
4659 else if (ConnectionTable[v_session].state==active)
4660 { log ("CREF received in state:active");}//do nothing, return
4661 else if (ConnectionTable[v_session].state==disconnect_pending)
4662 { log ("CREF received in state:disconnect_pending");}//discard message, return
4663 else if (ConnectionTable[v_session].state==reset_bothway)
4664 { log ("CREF received in state:reset_bothway");}//
4665 else if (ConnectionTable[v_session].state==connection_pending_OG)
4666 {//startif3
4667 var ASP_SCCP_N_DISCONNECT_ind vl_N_DISCONNECT_ind;
4668 //stop connection timer
4669 f_StopTimer(conn_est,v_session);
4670 //assemble ASP_SCCP_N_
4671 vl_N_DISCONNECT_ind.originator:=cg_Mapping_RefCause_Orig[pl_PDU_SCCP_ConnectionRefused.refusalCause];
4672 vl_N_DISCONNECT_ind.reason:=cg_Mapping_RefCause_Reason[pl_PDU_SCCP_ConnectionRefused.refusalCause];
4673 vl_N_DISCONNECT_ind.connectionId:=ConnectionTable[v_session].connectionId;
4674
4675 SCCP_SP_PORT.send( t_ASP_N_DISCONNECT_ind(
4676 vl_N_DISCONNECT_ind.originator,
4677 omit,
4678 vl_N_DISCONNECT_ind.reason,
4679 tl_data,
4680 vl_N_DISCONNECT_ind.connectionId,
4681 omit
4682 ));//send ASP_SCCP_N_DISCONNECT_ind
4683 //release resources
4684 ReleaseResources(v_session);
4685 }//endif3
4686 else if (ConnectionTable[v_session].state==wait_conn_confirm)
4687 {//startif3
4688
4689 //stop connection timer
4690 f_StopTimer(conn_est,v_session);
4691 //release resources
4692 ReleaseResources(v_session);
4693
4694 }//endif3
4695 else if (ConnectionTable[v_session].state==reset_IC)
4696 {//startif3
4697
4698 //discard received message
4699 f_StartTimer(internal_reset,v_session,0.0);//the timer times out immediately
4700 //state changed to active
4701 ConnectionTable[v_session].state:=active;
4702
4703 }//endif3
4704 else { log("CREF received in an unexpected state"); }
4705
4706 }//endif2
4707 else { log("CREF received with destLocRef not in state table"); }
4708 //Connection refused with destLocRef not in ConnectionTable
4709 //discard
4710
4711 } //processing_PDU_SCCP_ConnectionRefused
4712
4713 //******************************************************************
4714 // processing_PDU_SCCP_DataForm1
4715 //******************************************************************
4716 function processing_PDU_SCCP_DataForm1 ( in PDU_SCCP_DataForm1 pl_PDU_SCCP_DataForm1)
4717 runs on SCCP_CT
4718 {
4719
4720 //check if connection already established
4721 if (ConnectionAlreadyEstablished(pl_PDU_SCCP_DataForm1.destLocRef))
4722 {//startif2
4723 v_session :=Retrieve_session(pl_PDU_SCCP_DataForm1.destLocRef);
4724 //Action Table follows
4725
4726 if (ConnectionTable[v_session].state==idle)
4727 {//startif3
4728 var PDU_SCCP vl_PDU_SCCP;
4729 //assemble and route MTP3_ASP
4730 vl_PDU_SCCP.pduerror.messageType:=err;
4731 vl_PDU_SCCP.pduerror.destLocRef:=ConnectionTable[v_session].remoteReference;
4732 vl_PDU_SCCP.pduerror.errorCause:=cg_Err_unassignedDestinationLRN;
4733
4734 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
4735 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP)); //Send Error
4736
4737 //then return to idle
4738 }//endif3
4739 else if (ConnectionTable[v_session].state==connection_pending_IC)
4740 { log ("DT1 received in state:connection_pending_IC");}//discard message, return
4741 else if (ConnectionTable[v_session].state==disconnect_pending)
4742 { log ("DT1 received in state:disconnect_pending");}//discard message, return
4743 else if (ConnectionTable[v_session].state==reset_bothway)
4744 { log ("DT1 received in state:reset_bothway");}//
4745 else if (ConnectionTable[v_session].state==connection_pending_OG)
4746 {//startif3
4747 var ASP_SCCP_N_DISCONNECT_ind vl_N_DISCONNECT_ind;
4748 f_StopTimer(conn_est,v_session);
4749 //assemble ASP_SCCP_N_
4750 vl_N_DISCONNECT_ind.originator:=cg_NSU;
4751 vl_N_DISCONNECT_ind.reason:=cg_DISC_normal;
4752 vl_N_DISCONNECT_ind.connectionId:=ConnectionTable[v_session].connectionId;
4753
4754 SCCP_SP_PORT.send( t_ASP_N_DISCONNECT_ind(
4755 vl_N_DISCONNECT_ind.originator,
4756 omit,
4757 vl_N_DISCONNECT_ind.reason,
4758 omit,
4759 vl_N_DISCONNECT_ind.connectionId,
4760 omit
4761 ));//send ASP_SCCP_N_DISCONNECT_ind
4762 //release resources
4763 ReleaseResources(v_session);
4764 }//endif3
4765 else if (ConnectionTable[v_session].state==wait_conn_confirm)
4766 {//startif3
4767
4768 //stop connection timer
4769 f_StopTimer(conn_est,v_session);
4770 //release resources
4771 ReleaseResources(v_session);
4772 }//endif3
4773 else if (ConnectionTable[v_session].state==active)
4774 {//startif3
4775
4776 var ASP_SCCP_N_DATA_ind vl_N_DATA_ind;
4777 //restart receive inactivity timer
4778 f_StopTimer(iar,v_session);//to avoid warnings
4779 f_StartTimer(iar,v_session);
4780
4781 buffered_sending_ASP_N_DATA_ind( pl_PDU_SCCP_DataForm1 )
4782 //MODIFY-> protocol class assumed 2; M bit assumed 0 (no segm/reassembly)
4783
4784 }//endif3
4785 else if (ConnectionTable[v_session].state==reset_IC)
4786 {//startif3
4787
4788 //discard received message
4789 f_StartTimer(internal_reset,v_session,0.0);//the timer times out immediately
4790 //state changed to active
4791 ConnectionTable[v_session].state:=active;
4792
4793 }//endif3
4794 else { log("DT1 received in an unexpected state"); }
4795
4796 }//endif2
4797 else { log("DT1 received with destLocRef not in ConnectionTable"); }
4798 //DT1 received with destLocRef not in ConnectionTable
4799 //discard
4800
4801 }//processing_PDU_SCCP_DataForm1
4802
4803
4804 //******************************************************************
4805 // processing_PDU_SCCP_ExtUnitdata
4806 //******************************************************************
4807 function processing_PDU_SCCP_ExtUnitdata ( in PDU_SCCP_ExtUnitdata pl_PDU_SCCP_ExtUnitdata)
4808 runs on SCCP_CT
4809 {
4810 var integer vl_index;
4811 var OCT3 vl_segmRemoteRef;
4812 if( ispresent( pl_PDU_SCCP_ExtUnitdata.optionalPart) and
4813 ispresent( pl_PDU_SCCP_ExtUnitdata.optionalPart.segmentation) )
4814 {
4815 vl_segmRemoteRef:= pl_PDU_SCCP_ExtUnitdata.optionalPart.segmentation.segmLocalRef;
4816 if( pl_PDU_SCCP_ExtUnitdata.optionalPart.segmentation.firstSegm =='1'B )
4817 {
4818 vl_index:=allocate_ClessRcvBuff( vl_segmRemoteRef);
4819 }
4820 else
4821 {
4822 vl_index:=get_ClessRcvBuffIndex( vl_segmRemoteRef );
4823 };
4824 if (vl_index == -1)
4825 {
4826 log("Buffer allocation failed, message ignored.");
4827 return;
4828 }
4829
4830 store_segmData(vl_index,pl_PDU_SCCP_ExtUnitdata);
4831 if( pl_PDU_SCCP_ExtUnitdata.optionalPart.segmentation.remainingSegment == '0000'B )
4832 {
4833 send_ClessRcvBuff_in_N_UNITDATAind( vl_index,pl_PDU_SCCP_ExtUnitdata );
4834 reallocate_ClessRcvBuff( vl_index );
4835 }
4836 }
4837 else
4838 { // not segmented case:
4839 send_ClessData_in_N_UNITDATAind( pl_PDU_SCCP_ExtUnitdata );
4840 }
4841 return;
4842
4843 }//processing_PDU_SCCP_ExtUnitdata
4844
4845//******************************************************************
4846// Part 2 Receiving msg on port "SCCP_PORT" (User Part)
4847//******************************************************************
4848
4849//******************************************************************
4850// processing_ASP_N_CONNECT_req
4851// / ASP_SCCP_N_CONNECT_req , originating node /
4852//******************************************************************
4853 function processing_ASP_N_CONNECT_req( in ASP_SCCP_N_CONNECT_req pl_N_CONNECT_req )
4854 runs on SCCP_CT
4855 {
4856 var PDU_SCCP vl_PDU_SCCP;
4857 var ASP_SCCP_N_DISCONNECT_ind vl_N_DISCONNECT_ind;
4858
4859 if (ConnectionAlreadyEstablished_connectionId(pl_N_CONNECT_req.connectionId))
4860 // assume connectionId present
4861 {//startif1
4862
4863 //something went wrong, we already have a session with the same connection Id
4864 v_session :=Retrieve_session_connectionId(pl_N_CONNECT_req.connectionId);
4865 //table of error actions
4866
4867 }//endif1
4868 else
4869 {//startelse1
4870
4871 //check if resources available
4872 v_session:=CheckIdleIndividuals();
4873 if (v_session==-1) //No idle individual found
4874 {//startif2
4875
4876 //assemble ASP_SCCP_N_ASP
4877 vl_N_DISCONNECT_ind.originator:=cg_NSP; // network service provider
4878 vl_N_DISCONNECT_ind.reason:=cg_CREF_unspec_T;
4879 vl_N_DISCONNECT_ind.connectionId:=pl_N_CONNECT_req.connectionId;
4880
4881 SCCP_SP_PORT.send( t_ASP_N_DISCONNECT_ind(
4882 vl_N_DISCONNECT_ind.originator,
4883 omit,
4884 vl_N_DISCONNECT_ind.reason,
4885 omit,
4886 vl_N_DISCONNECT_ind.connectionId,
4887 omit
4888 ));//send ASP_SCCP_N_DISCONNECT_ind
4889 //return to idle
4890 }//endif2
4891
4892 if ((v_session<=15)and (v_session>=0))
4893 {//startif2
4894
4895 //assign local reference, SLS:=tsp_MTP3_SLS, protocol class:=2
4896 ConnectionTable[v_session].localReference:=int2oct(pl_N_CONNECT_req.connectionId,3);
4897 ConnectionTable[v_session].connectionId :=pl_N_CONNECT_req.connectionId;
4898
4899 //to simplify generation of local reference, connectionID received from user is sent as such
4900 //only local reference is assigned at this point
4901 //send connection request, no coupling
4902 //DPC :remote node
4903 //no coupling reqrd.
4904 //compatibility OK
4905 //no restriction
4906 //assemble and route MTP3_ASP
4907 vl_PDU_SCCP.connrequest.messageType:=cr;
4908 vl_PDU_SCCP.connrequest.sourceLocRef:=ConnectionTable[v_session].localReference;
4909 // send local reference just assigned!
4910 vl_PDU_SCCP.connrequest.protClass:={
4911 class:='0010'B,
4912 messageHandling:='0000'B
4913 };//class 2
4914 vl_PDU_SCCP.connrequest.pointer1:=2;
4915 vl_PDU_SCCP.connrequest.calledPAddress:=ConvertASPAddressToEncodedAddress(pl_N_CONNECT_req.calledAddress); //new!
4916 vl_PDU_SCCP.connrequest.pointer2:=vl_PDU_SCCP.connrequest.calledPAddress.paramLength+2; //automatic?
4917
4918 if(ispresent(pl_N_CONNECT_req.callingAddress))
4919 {//startif3
4920
4921 //temporary variable to avoid type conversion problems
4922 var SCCP_param_CPartyAddressEnc_opt vl_SCCP_param_CPartyAddressEnc_opt;
4923 var SCCP_param_CPartyAddressEnc vl_SCCP_param_CPartyAddressEnc;
4924
4925 vl_SCCP_param_CPartyAddressEnc:=
4926 ConvertASPAddressToEncodedAddress(pl_N_CONNECT_req.callingAddress);
4927
4928 vl_SCCP_param_CPartyAddressEnc_opt.paramName :=con_SCCP_cgPA;
4929 vl_SCCP_param_CPartyAddressEnc_opt.paramLength:=vl_SCCP_param_CPartyAddressEnc.paramLength;
4930 vl_SCCP_param_CPartyAddressEnc_opt.addr :=vl_SCCP_param_CPartyAddressEnc.addr;
4931
4932 vl_PDU_SCCP.connrequest.optionalPart.callingPAddress:=vl_SCCP_param_CPartyAddressEnc_opt;
4933
4934 }//endif3
4935 else { vl_PDU_SCCP.connrequest.optionalPart.callingPAddress:=omit }
4936
4937 if(ispresent(pl_N_CONNECT_req.userData))
4938 {//startif3
4939
4940 //temporary variable to avoid type conversion problems
4941 var SCCP_param_Data_opt vl_SCCP_param_Data_opt;
4942
4943 vl_SCCP_param_Data_opt.paramName:=con_SCCP_data;
4944 vl_SCCP_param_Data_opt.data:=pl_N_CONNECT_req.userData;
4945 vl_SCCP_param_Data_opt.paramLength:=lengthof(vl_SCCP_param_Data_opt.data);
4946 vl_PDU_SCCP.connrequest.optionalPart.data:=vl_SCCP_param_Data_opt;
4947
4948 }//endif3
4949 else { vl_PDU_SCCP.connrequest.optionalPart.data:=omit}
4950
4951 if(ispresent(pl_N_CONNECT_req.callingAddress) or
4952 ispresent(pl_N_CONNECT_req.userData))
4953 {
4954 vl_PDU_SCCP.connrequest.optionalPart.credit:=omit;
4955 vl_PDU_SCCP.connrequest.optionalPart.hopCounter:=omit;
4956 vl_PDU_SCCP.connrequest.optionalPart.importance:=omit;
4957
4958 vl_PDU_SCCP.connrequest.eop:= {paramName:=con_SCCP_eop};
4959 }
4960 else
4961 {
4962 vl_PDU_SCCP.connrequest.optionalPart := omit;
4963 vl_PDU_SCCP.connrequest.eop := omit;
4964 }
4965
4966 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
4967 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP));//send Connection request
4968
4969 //start connection timer
4970 f_StartTimer(conn_est,v_session);
4971 ConnectionTable[v_session].state:=connection_pending_OG;
4972 }//endif2
4973
4974 }//endelse
4975
4976 }//processing_ASP_N_CONNECT_req
4977 //******************************************************************
4978 //End ASP_SCCP_N_CONNECT_req , originating node
4979 //******************************************************************
4980
4981 //******************************************************************
4982 // processing_ASP_N_CONNECT_resp
4983 //******************************************************************
4984 function processing_ASP_N_CONNECT_res( in ASP_SCCP_N_CONNECT_res pl_N_CONNECT_res )
4985 runs on SCCP_CT
4986 {
4987 var PDU_SCCP vl_PDU_SCCP;
4988
4989 // first see if session exists in the ConnectionTable
4990 //search done based on Connection ID
4991
4992 if (ConnectionAlreadyEstablished_connectionId(pl_N_CONNECT_res.connectionId))
4993 //assume connectionId present
4994 {//startif1
4995 //retrieve session
4996 v_session :=Retrieve_session_connectionId(pl_N_CONNECT_res.connectionId);
4997
4998 //Action Table follows
4999
5000 if (ConnectionTable[v_session].state==idle)
5001 {
5002 log("N_CONNECT_resp received in state:idle");
5003 //do nothing-return to idle state
5004 }
5005 else if (ConnectionTable[v_session].state==connection_pending_IC)
5006 {//startif2
5007
5008 //assign SLS:=tsp_MTP3_SLS, assign protocol class=2 (CO, no flow ctrl.)
5009
5010 //assemble and route MTP3_ASP
5011
5012 vl_PDU_SCCP.connconfirm.messageType:=cc;
5013 vl_PDU_SCCP.connconfirm.sourceLocRef:=ConnectionTable[v_session].localReference;
5014 vl_PDU_SCCP.connconfirm.destLocRef:=ConnectionTable[v_session].remoteReference;
5015 vl_PDU_SCCP.connconfirm.protClass.class:='0010'B;//protocol class 2
5016 vl_PDU_SCCP.connconfirm.protClass.messageHandling:='0000'B;//no special treatment
5017
5018 if(ispresent(pl_N_CONNECT_res.respondingAddress))
5019 {//startif3
5020
5021 //temporary variable to avoid type conversion problems
5022 var SCCP_param_CPartyAddressEnc_opt vl_SCCP_param_CPartyAddressEnc_opt;
5023 var SCCP_param_CPartyAddressEnc vl_SCCP_param_CPartyAddressEnc;
5024
5025 vl_SCCP_param_CPartyAddressEnc:=
5026 ConvertASPAddressToEncodedAddress(pl_N_CONNECT_res.respondingAddress);
5027
5028 vl_SCCP_param_CPartyAddressEnc_opt.paramName := con_SCCP_cdPA; // cgPA->cdPA ethbaat, 2003.11.06
5029 vl_SCCP_param_CPartyAddressEnc_opt.paramLength:= vl_SCCP_param_CPartyAddressEnc.paramLength;
5030 vl_SCCP_param_CPartyAddressEnc_opt.addr := vl_SCCP_param_CPartyAddressEnc.addr;
5031
5032 vl_PDU_SCCP.connconfirm.optionalPart.calledPAddress:= vl_SCCP_param_CPartyAddressEnc_opt;
5033 }//endif3
5034 else { vl_PDU_SCCP.connconfirm.optionalPart.calledPAddress:=omit }
5035
5036 if(ispresent(pl_N_CONNECT_res.userData))
5037 {//startif3
5038
5039 //temporary variable to avoid type conversion problems
5040 var SCCP_param_Data_opt vl_SCCP_param_Data_opt;
5041
5042 vl_SCCP_param_Data_opt.paramName:=con_SCCP_data;
5043 vl_SCCP_param_Data_opt.data:=pl_N_CONNECT_res.userData; // corrected by ethbaat 2003.10.16
5044 vl_SCCP_param_Data_opt.paramLength:=lengthof(vl_SCCP_param_Data_opt.data);
5045
5046 vl_PDU_SCCP.connconfirm.optionalPart.data:=vl_SCCP_param_Data_opt;
5047 }//endif3
5048 else {vl_PDU_SCCP.connconfirm.optionalPart.data:=omit}
5049
5050 if(ispresent(pl_N_CONNECT_res.respondingAddress) or
5051 ispresent(pl_N_CONNECT_res.userData))
5052 {
5053 vl_PDU_SCCP.connconfirm.pointer1:=1;
5054 vl_PDU_SCCP.connconfirm.optionalPart.credit:=omit;
5055 vl_PDU_SCCP.connconfirm.optionalPart.importance:=omit;
5056 vl_PDU_SCCP.connconfirm.eop:= {paramName:=con_SCCP_eop};
5057 }
5058 else
5059 {
5060 vl_PDU_SCCP.connconfirm.pointer1:=0;
5061 vl_PDU_SCCP.connconfirm.optionalPart := omit;
5062 vl_PDU_SCCP.connconfirm.eop:=omit;
5063 }
5064
5065 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
5066 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP));//send connection confirm
5067
5068 f_StartTimer(ias,v_session); // ??? check them!!!
5069 f_StartTimer(iar,v_session); //start inactivity timers
5070 ConnectionTable[v_session].state:=active;//state change
5071
5072 }//endif2
5073 else { log("N_CONNECT_resp received in an unexpected state");}
5074
5075 }//endif1
5076
5077 }//processing_ASP_N_CONNECT_resp
5078
5079 //******************************************************************
5080 // processing_ASP_N_DATA_req
5081 //******************************************************************
5082
5083 function processing_ASP_N_DATA_req( in ASP_SCCP_N_DATA_req pl_N_DATA_req )
5084 runs on SCCP_CT
5085 {
5086 var PDU_SCCP vl_PDU_SCCP;
5087
5088 // first see if session exists in the ConnectionTable
5089
5090 if (ConnectionAlreadyEstablished_connectionId(pl_N_DATA_req.connectionId))
5091 //assume connectionId present
5092 {//startif1
5093
5094 //retrieve v_session
5095 v_session :=Retrieve_session_connectionId(pl_N_DATA_req.connectionId);
5096
5097 //Action Table follows
5098 if (ConnectionTable[v_session].state==idle)
5099 { log ("N_DATA_req received in idle state");}
5100 else if (ConnectionTable[v_session].state==reset_bothway)
5101 { log ("N_DATA_req received in reset_bothway state");}
5102 else if (ConnectionTable[v_session].state==active)
5103 {//startif2
5104 sending_dataform1s_in_ASP_MTP_TRANSFERreqs(pl_N_DATA_req);
5105 //no change of state, remains active
5106 }//endif2
5107 else { log ("N_DATA_req received in an unexpected state"); }
5108
5109 }//endif1
5110 else { log("N_DATA_req with Connection ID not in the state table -- illegal request"); }
5111
5112 }//processing_ASP_N_DATA_req
5113
5114 //******************************************************************
5115 // processing_ASP_N_DISCONNECT_req
5116 //******************************************************************
5117
5118 function processing_ASP_N_DISCONNECT_req( in ASP_SCCP_N_DISCONNECT_req pl_N_DISCONNECT_req )
5119 runs on SCCP_CT
5120 {
5121 var PDU_SCCP vl_PDU_SCCP;
5122 var boolean vl_opt_part_present:=false;
5123
5124 // first see if session exists in the ConnectionTable
5125
5126 if (ConnectionAlreadyEstablished_connectionId(pl_N_DISCONNECT_req.connectionId))
5127 //assume connectionId present
5128 {//startif1
5129
5130 //retrieve v_session
5131 v_session :=Retrieve_session_connectionId(pl_N_DISCONNECT_req.connectionId);
5132
5133 //Action Table follows
5134 if (ConnectionTable[v_session].state==idle)
5135 { log ("N_DISCONNECT_req received in state:idle");}
5136 else if (ConnectionTable[v_session].state==connection_pending_IC)
5137 {//startif2
5138
5139 //assemble and route MTP3_ASP
5140 vl_PDU_SCCP.connrefused.messageType:=cref;
5141 vl_PDU_SCCP.connrefused.destLocRef:=ConnectionTable[v_session].remoteReference;
5142 vl_PDU_SCCP.connrefused.refusalCause:=pl_N_DISCONNECT_req.reason;
5143 vl_PDU_SCCP.connrefused.pointer1:=0; //No optional part
5144 vl_PDU_SCCP.connrefused.optionalPart:=omit;
5145 vl_PDU_SCCP.connrefused.eop:=omit;
5146
5147 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
5148 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP));//send connection refused
5149
5150 //release resources
5151 ReleaseResources(v_session);
5152
5153 }//endif2
5154 else if (ConnectionTable[v_session].state==active)
5155 {//startif2
5156
5157 //stop inactivity timers
5158 f_StopTimer(ias,v_session);
5159 f_StopTimer(iar,v_session);
5160
5161 //assemble and route MTP3_ASP
5162
5163 vl_PDU_SCCP.released.messageType:=rlsd;
5164 vl_PDU_SCCP.released.destLocRef:=ConnectionTable[v_session].remoteReference;
5165 vl_PDU_SCCP.released.sourceLocRef:=ConnectionTable[v_session].localReference;
5166 vl_PDU_SCCP.released.releaseCause:=pl_N_DISCONNECT_req.reason;
5167 if(ispresent(pl_N_DISCONNECT_req.userData)){
5168 vl_opt_part_present:=true;
5169 vl_PDU_SCCP.released.optionalPart.data.paramName:=con_SCCP_data;
5170 vl_PDU_SCCP.released.optionalPart.data.paramLength:=lengthof(pl_N_DISCONNECT_req.userData);
5171 vl_PDU_SCCP.released.optionalPart.data.data:=pl_N_DISCONNECT_req.userData;
5172 } else {
5173 vl_PDU_SCCP.released.optionalPart.data:=omit;
5174 }
5175 if(ispresent(pl_N_DISCONNECT_req.importance)){
5176 vl_opt_part_present:=true;
5177 vl_PDU_SCCP.released.optionalPart.importance.paramName:=con_SCCP_imp
5178 vl_PDU_SCCP.released.optionalPart.importance.paramLength:=1
5179 vl_PDU_SCCP.released.optionalPart.importance.importance:=pl_N_DISCONNECT_req.importance
5180 vl_PDU_SCCP.released.optionalPart.importance.reserved:='00000'B
5181 } else {
5182 vl_PDU_SCCP.released.optionalPart.importance:=omit;
5183 }
5184 if(vl_opt_part_present){
5185 vl_PDU_SCCP.released.pointer1:=1;
5186 vl_PDU_SCCP.released.eop.paramName:=con_SCCP_eop;
5187 } else {
5188 vl_PDU_SCCP.released.pointer1:=0;//No optional part
5189 vl_PDU_SCCP.released.optionalPart:=omit;
5190 vl_PDU_SCCP.released.eop:=omit;
5191 }
5192
5193 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
5194 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP));//send released
5195
5196 //start release timer
5197 f_StartTimer(rel,v_session);
5198
5199 ConnectionTable[v_session].state:=disconnect_pending;
5200
5201 }//endif2
5202 else if (ConnectionTable[v_session].state==connection_pending_OG)
5203 {//startif2
5204
5205 //change state to "wait connection confirm "
5206 ConnectionTable[v_session].state:=wait_conn_confirm;
5207 //and return
5208
5209 }//endif2
5210 else { log("N_DISCONNECT_req received in an unexpected state");}
5211
5212 }//endif1
5213
5214 }//processing_ASP_N_DISCONNECT_req
5215
5216
5217 //******************************************************************
5218 // function SCCP_SPC_int2bit - working function to processing_ASP_N_UNITDATA_req
5219 // v_sio is local to SCCP_CT
5220 // SCCPServiceType
5221 //******************************************************************
5222 function SCCP_SPC_int2bit( in integer pl_SPC, in SCCP_ServiceType pl_SCCP_ServiceType, in octetstring pl_SIO )
5223 return SCCP_ASPfield_SignallingPointCode
5224 {
5225 var SCCP_ASPfield_SignallingPointCode vl_SPC; //bitstring
5226 vl_SPC :='0000000000000000'B;
5227
5228 if( (pl_SCCP_ServiceType == mtp3_itu) or (pl_SCCP_ServiceType == mtp3b_itu))
5229 {
5230 //vl_SPC := '00'B&int2bit( pl_SPC, 14);
5231 vl_SPC := int2bit( pl_SPC, 14);
5232 }
5233 else if ( (pl_SCCP_ServiceType == mtp3_ansi) or (pl_SCCP_ServiceType == mtp3b_ansi) )
5234 {
5235 vl_SPC := int2bit( pl_SPC, 24);
5236 }
5237 else if( (pl_SCCP_ServiceType == mtp3_ttc) or (pl_SCCP_ServiceType == mtp3b_ttc) )
5238 {
5239 if( (pl_SIO == '83'O) or (pl_SIO == '43'O) or (pl_SIO == 'C3'O) ) //ttc national
5240 {
5241 vl_SPC := int2bit( pl_SPC, 16);
5242 }
5243 else if( pl_SIO == '03'O ) //ttc international
5244 {
5245 //vl_SPC := '00'B&int2bit( pl_SPC, 14);
5246 vl_SPC := int2bit( pl_SPC, 14);
5247 }
5248 else { log ( "SIO setting error"); }
5249 }
5250 else if( pl_SCCP_ServiceType == mtp3_mpt )
5251 {
5252 var integer vl_NI := oct2int(pl_SIO)/64;
5253 if( vl_NI == 2 ) //mpt national
5254 {
5255 vl_SPC := int2bit( pl_SPC, 24);
5256 }
5257 else //mpt international
5258 {
5259 vl_SPC := int2bit( pl_SPC, 14);
5260 }
5261 }
5262 else
5263 { log ( "ServiceType setting error. Use values",
5264 "mtp3_itu, mtp3b_itu, mtp3_ansi, mtp3b_ansi,",
5265 " mtp3_ttc, mtp3b_ttc, mtp3_mpt or m3ua");
5266 }
5267
5268 return vl_SPC;
5269
5270 }// SCCP_SPC_int2bit
5271
5272 //******************************************************************
5273 // sending_udt_in_ASP_MTP_TRANSFERreqs
5274 // sends data in one step
5275 //******************************************************************
5276 function sending_udt_in_ASP_MTP_TRANSFERreqs( in SCCP_param_ProtocolClass pl_protClass,
5277 in SCCP_param_CPartyAddressEnc pl_CalledPAddress,
5278 in SCCP_param_CPartyAddressEnc pl_CallingPAddress,
5279 in SCCP_param_Data pl_data)
5280 runs on SCCP_CT
5281 {
5282 var PDU_SCCP vl_PDU_SCCP;
5283 vl_PDU_SCCP.unitdata.messageType := udt ;
5284 vl_PDU_SCCP.unitdata.protClass := pl_protClass;
5285 vl_PDU_SCCP.unitdata.calledPAddress := pl_CalledPAddress;
5286 vl_PDU_SCCP.unitdata.callingPAddress:= pl_CallingPAddress;
5287 vl_PDU_SCCP.unitdata.data := pl_data;
5288 vl_PDU_SCCP.unitdata.pointer1 := 0;
5289 vl_PDU_SCCP.unitdata.pointer2 := 0;
5290 vl_PDU_SCCP.unitdata.pointer3 := 0;
5291
5292 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
5293 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP));//send Unitdata
5294 return;
5295
5296 }//sending_udt_in_ASP_MTP_TRANSFERreqs
5297
5298 //******************************************************************
5299 // sending_xudt_in_ASP_MTP_TRANSFERreqs
5300 // segmentates and sends data to the encoder
5301 //******************************************************************
5302 function sending_xudt_in_ASP_MTP_TRANSFERreqs(in SCCP_param_ProtocolClass pl_protClass,
5303 in SCCP_param_CPartyAddressEnc pl_CalledPAddress,
5304 in SCCP_param_CPartyAddressEnc pl_CallingPAddress,
5305 in SCCP_param_Data pl_data)
5306 runs on SCCP_CT
5307 {
5308 var PDU_SCCP vl_PDU_SCCP;
5309 var integer vl_actdatalen; //without length of paramLength field
5310 var integer vl_len; // remaining data length without length of paramLength field
5311 var integer vl_from;
5312 var integer vl_overhead;
5313 var integer vl_maxdatalen;
5314 var integer vl_numberofPDUs; // ... to be sent
5315
5316 vl_PDU_SCCP.extudata.messageType := xudt ; //len:1
5317 vl_PDU_SCCP.extudata.hopCounter := 15; // check it in spec. //len:1
5318 vl_PDU_SCCP.extudata.protClass := pl_protClass; //len:1
5319 vl_PDU_SCCP.extudata.pointer1 := 0; //len:4
5320 vl_PDU_SCCP.extudata.pointer2 := 0;
5321 vl_PDU_SCCP.extudata.pointer3 := 0;
5322 vl_PDU_SCCP.extudata.pointer4 := 0;
5323 vl_PDU_SCCP.extudata.calledPAddress := pl_CalledPAddress;
5324 vl_PDU_SCCP.extudata.callingPAddress := pl_CallingPAddress;
5325
5326 vl_overhead := 15 +
5327 (vl_PDU_SCCP.extudata.calledPAddress.paramLength+1) +
5328 (vl_PDU_SCCP.extudata.callingPAddress.paramLength+1);
5329
5330 vl_len := pl_data.paramLength;
5331 vl_maxdatalen := v_sccp_pdu_maxlen - vl_overhead -1; // -1:paramLength
5332 vl_numberofPDUs := vl_len/vl_maxdatalen; // 0 if 1 PDU exists
5333
5334 // init segmentation:
5335 vl_PDU_SCCP.extudata.optionalPart.segmentation.segmLocalRef:= create_segmLocalRef();
5336 vl_PDU_SCCP.extudata.optionalPart.segmentation.firstSegm := '1'B; //'yes'
5337 vl_PDU_SCCP.extudata.optionalPart.segmentation.paramName := con_SCCP_segm;
5338 vl_PDU_SCCP.extudata.optionalPart.segmentation.paramLength := 4;
5339 vl_PDU_SCCP.extudata.optionalPart.segmentation.remainingSegment := int2bit(vl_numberofPDUs,4);
5340 vl_PDU_SCCP.extudata.optionalPart.segmentation.reserved := '00'B;
5341
5342 if( pl_protClass.class == '0001'B )
5343 { vl_PDU_SCCP.extudata.optionalPart.segmentation.class := '1'B; }
5344 else
5345 { vl_PDU_SCCP.extudata.optionalPart.segmentation.class := '0'B; };
5346
5347 vl_PDU_SCCP.extudata.optionalPart.importance:= omit; //len:0
5348 vl_PDU_SCCP.extudata.eop.paramName := con_SCCP_eop; //len:0
5349
5350 vl_from := 0;
5351
5352 while ( vl_len > 0 )
5353 {
5354 vl_PDU_SCCP.extudata.optionalPart.segmentation.remainingSegment := int2bit(vl_numberofPDUs,4);
5355
5356 if ( vl_len > vl_maxdatalen )
5357 { vl_actdatalen := vl_maxdatalen; }
5358 else
5359 { vl_actdatalen := vl_len; };
5360
5361 vl_PDU_SCCP.extudata.data.data := substr( pl_data.data, vl_from, vl_actdatalen );
5362 vl_PDU_SCCP.extudata.data.paramLength := vl_actdatalen;
5363
5364 MTP3_SCCP_PORT.send( t_ASP_MTP3_TRANSFERreq_sccp
5365 (v_SIO,v_own_SPC,v_remote_SPC,v_SLS,vl_PDU_SCCP)); //send PDU_SCCP_ExtUnitdata
5366
5367 vl_PDU_SCCP.extudata.optionalPart.segmentation.firstSegm := '0'B; //'no'
5368
5369 vl_numberofPDUs := vl_numberofPDUs -1 ;
5370 vl_from := vl_from + vl_actdatalen;
5371 vl_len := vl_len - vl_actdatalen;
5372 }//while
5373
5374 log("Last remaining Segment:", vl_PDU_SCCP.extudata.optionalPart.segmentation.remainingSegment );
5375
5376 // not necessary, remove it:
5377 //reset_segmLocalRef(vl_PDU_SCCP.extudata.optionalPart.segmentation.segmLocalRef);
5378 return;
5379 }//sending_xudt_in_ASP_MTP_TRANSFERreqs
5380
5381 //******************************************************************
5382 // processing_ASP_N_UNITDATA_req
5383 //******************************************************************
5384
5385 function processing_ASP_N_UNITDATA_req( in ASP_SCCP_N_UNITDATA_req pl_N_UNITDATA_req )
5386 runs on SCCP_CT
5387 {
5388 var PDU_SCCP vl_PDU_SCCP;
5389 var SCCP_param_ProtocolClass vl_protClass;
5390 var SCCP_param_CPartyAddressEnc vl_CalledPAddress, vl_CallingPAddress;
5391 var integer vl_overhead_length;
5392 var SCCP_param_Data vl_data;
5393
5394 // Protocol class mapping :
5395 // old: vl_protClass.messageHandling:='0000'B;//no special options
5396
5397 // 3.6/ Q.713: bit1-4
5398 if ( ispresent(pl_N_UNITDATA_req.sequenceControl) and
5399 (substr(pl_N_UNITDATA_req.sequenceControl,7,1) == '1'B) ) //least significant bit!
5400 { vl_protClass.class:='0001'B; }
5401 else
5402 { vl_protClass.class:='0000'B; } //changed to 0000 from 0001 ethbaat 2003-11-13
5403
5404 // 3.6/ Q.713: bit 5-8:
5405 if ( ispresent(pl_N_UNITDATA_req.returnOption) and
5406 (substr(pl_N_UNITDATA_req.returnOption,7,1) == '1'B) ) //least significant bit!
5407 { vl_protClass.messageHandling:='1000'B}
5408 else
5409 { vl_protClass.messageHandling:='0000'B}
5410
5411 //Called Address mapping:
5412 if (pl_N_UNITDATA_req.calledAddress.addressIndicator.pointCodeIndic=='1'B) //DPC included
5413 {//startif1
5414
5415 if (bit2int(pl_N_UNITDATA_req.calledAddress.signPointCode) == v_remote_SPC ) // remote SPC
5416 {//startif2
5417 vl_CalledPAddress:=
5418 ConvertASPAddressToEncodedAddress(pl_N_UNITDATA_req.calledAddress);
5419 }
5420 else
5421 {
5422 log("The remote SPC in ASP_SCCP_N_UNITDATA_req is not the same as the one you called by StartSCCP.ASP dropped")
5423 return;
5424 }
5425
5426 }//endif1
5427 else
5428 { //DPC not present, use values local for component
5429
5430 var SCCP_PAR_Address vl_SCCP_PAR_Address;
5431 vl_SCCP_PAR_Address := pl_N_UNITDATA_req.calledAddress;
5432
5433 if ( v_remote_SPC > 0)
5434 {
5435 vl_SCCP_PAR_Address.addressIndicator.pointCodeIndic :='1'B; // 3.4.1/Q713.
5436 vl_SCCP_PAR_Address.addressIndicator.routingIndicator := cg_route_on_SSN;
5437 // 14,24 or 16 bits:
5438 vl_SCCP_PAR_Address.signPointCode := SCCP_SPC_int2bit( v_remote_SPC, v_SCCPServiceType, v_SIO);
5439 }
5440 // vl_SCCP_PAR_Address.addressIndicator.ssnIndicator unchanged
5441 // vl_SCCP_PAR_Address.addressIndicator.globalTitleIndic unchanged
5442 // vl_SCCP_PAR_Address.subsystemNumber unchanged
5443 // vl_SCCP_PAR_Address.globalTitle unchanged
5444
5445 vl_CalledPAddress :=
5446 ConvertASPAddressToEncodedAddress(vl_SCCP_PAR_Address);
5447
5448 }//endif1
5449
5450 vl_CallingPAddress :=
5451 ConvertASPAddressToEncodedAddress(pl_N_UNITDATA_req.callingAddress);
5452
5453 vl_data.data := pl_N_UNITDATA_req.userData;
5454 vl_data.paramLength:= lengthof( pl_N_UNITDATA_req.userData);
5455
5456 // unitdata overhead calculation:
5457 // msg type: 1; prot class: 2; 3 pointers: 3=> total:6
5458 vl_overhead_length := (vl_CalledPAddress.paramLength+1) +
5459 (vl_CallingPAddress.paramLength +1)+ 6 ;
5460
5461 if( (tsp_force_xudt==0) and
5462 (vl_overhead_length + vl_data.paramLength + 1) <= v_sccp_pdu_maxlen )
5463 {
5464 sending_udt_in_ASP_MTP_TRANSFERreqs(vl_protClass,
5465 vl_CalledPAddress,
5466 vl_CallingPAddress,
5467 vl_data );
5468 }
5469 else
5470 {
5471 sending_xudt_in_ASP_MTP_TRANSFERreqs(vl_protClass,
5472 vl_CalledPAddress,
5473 vl_CallingPAddress,
5474 vl_data );
5475 }
5476
5477 }//processing_ASP_N_UNITDATA_req
5478
5479//******************************************************************
5480//******************************************************************
5481function ScanEvents() runs on SCCP_CT
5482//******************************************************************
5483//******************************************************************
5484{//startfunction
5485
5486 var PDU_SCCP vl_PDU_SCCP;
5487
5488 var ASP_SCCP_N_CONNECT_req vl_N_CONNECT_req;
5489 var ASP_SCCP_N_CONNECT_ind vl_N_CONNECT_ind;
5490 var ASP_SCCP_N_CONNECT_res vl_N_CONNECT_res;
5491 var ASP_SCCP_N_CONNECT_cfm vl_N_CONNECT_cfm;
5492 var ASP_SCCP_N_DATA_req vl_N_DATA_req;
5493 var ASP_SCCP_N_DATA_ind vl_N_DATA_ind;
5494 var ASP_SCCP_N_DISCONNECT_req vl_N_DISCONNECT_req;
5495 var ASP_SCCP_N_DISCONNECT_ind vl_N_DISCONNECT_ind;
5496 var ASP_SCCP_N_UNITDATA_req vl_N_UNITDATA_req;
5497 var ASP_SCCP_N_UNITDATA_ind vl_N_UNITDATA_ind;
5498 var ASP_SCCP_N_NOTICE_ind vl_N_NOTICE_ind;
5499
5500 var integer i;
5501 //this function scans the MTP3 and user port for incoming messages and checks timers for timeout
5502
5503 f_initialize_timer_states();
5504
5505 while (true)
5506 {//startwhile
5507
5508 alt
5509 //******************************************************************
5510 {//startalt0
5511 //******************************************************************
5512 [] MTP3_SCCP_PORT.receive(PDU_SCCP : ? ) -> value vl_PDU_SCCP
5513 {
5514 //******************************************************************
5515 //Unitdata received at destination node
5516 //******************************************************************
5517 if (ischosen(vl_PDU_SCCP.unitdata))
5518 {
5519 // vl_PDU_SCCP.unitdata.pointer1 :=3;
5520 // vl_PDU_SCCP.unitdata.pointer2 :=0;
5521 // vl_PDU_SCCP.unitdata.pointer3 :=0;
5522 processing_PDU_SCCP_Unitdata( vl_PDU_SCCP.unitdata );
5523 }
5524
5525 //******************************************************************
5526 //Data received at destination node
5527 //******************************************************************
5528 else if (ischosen(vl_PDU_SCCP.dataform1))
5529 {
5530 // vl_PDU_SCCP.dataform1.pointer1 :=1;
5531 processing_PDU_SCCP_DataForm1( vl_PDU_SCCP.dataform1 );
5532 }
5533
5534 //******************************************************************
5535 //Extended unitdata received at destination node
5536 //******************************************************************
5537 else if (ischosen(vl_PDU_SCCP.extudata))
5538 {
5539 // vl_PDU_SCCP.extudata.pointer1 :=0;
5540 // vl_PDU_SCCP.extudata.pointer2 :=0;
5541 // vl_PDU_SCCP.extudata.pointer3 :=0;
5542 // vl_PDU_SCCP.extudata.pointer4 :=0;
5543 processing_PDU_SCCP_ExtUnitdata( vl_PDU_SCCP.extudata );
5544 }
5545
5546 //******************************************************************
5547 //Connection request received
5548 //******************************************************************
5549 else if (ischosen(vl_PDU_SCCP.connrequest))
5550 {
5551 // vl_PDU_SCCP.connrequest.pointer1 :=2;
5552 // vl_PDU_SCCP.connrequest.pointer2 :=0;
5553 processing_PDU_SCCP_ConnectionRequest( vl_PDU_SCCP.connrequest );
5554 }
5555
5556 //******************************************************************
5557 //Connection confirm received
5558 //******************************************************************
5559 else if (ischosen(vl_PDU_SCCP.connconfirm))
5560 {
5561 // vl_PDU_SCCP.connconfirm.pointer1 :=1;
5562 processing_PDU_SCCP_ConnectionConfirm( vl_PDU_SCCP.connconfirm );
5563 }
5564
5565 //******************************************************************
5566 //Released received
5567 //******************************************************************
5568 else if (ischosen(vl_PDU_SCCP.released))
5569 {
5570 // vl_PDU_SCCP.released.pointer1 :=1;
5571 processing_PDU_SCCP_Released( vl_PDU_SCCP.released );
5572 }
5573
5574 //******************************************************************
5575 //Release complete received
5576 //******************************************************************
5577 else if (ischosen(vl_PDU_SCCP.relcomp))
5578 {
5579 processing_PDU_SCCP_ReleaseComplete( vl_PDU_SCCP.relcomp );
5580 }
5581
5582 //******************************************************************
5583 //Unitdata service received
5584 //******************************************************************
5585 else if (ischosen(vl_PDU_SCCP.udataserv))
5586 {
5587 // vl_PDU_SCCP.udataserv.pointer1 :=3;
5588 // vl_PDU_SCCP.udataserv.pointer2 :=0;
5589 // vl_PDU_SCCP.udataserv.pointer3 :=0;
5590 processing_PDU_SCCP_UnitdataService( vl_PDU_SCCP.udataserv );
5591 }
5592
5593 //******************************************************************
5594 //PDU_Error received
5595 //******************************************************************
5596 else if (ischosen(vl_PDU_SCCP.pduerror))
5597 {
5598 processing_PDU_SCCP_ProtDataUnitError( vl_PDU_SCCP.pduerror );
5599 }
5600
5601 //******************************************************************
5602 //Inactivity test received
5603 //******************************************************************
5604 else if (ischosen(vl_PDU_SCCP.inacttest))
5605 {
5606 processing_PDU_SCCP_InactivityTest( vl_PDU_SCCP.inacttest );
5607 }
5608
5609 //******************************************************************
5610 //Reset request received
5611 //******************************************************************
5612 else if (ischosen(vl_PDU_SCCP.resetreq))
5613 {
5614 processing_PDU_SCCP_ResetRequest( vl_PDU_SCCP.resetreq );
5615 }
5616
5617 //******************************************************************
5618 //Reset confirm received
5619 //******************************************************************
5620 else if (ischosen(vl_PDU_SCCP.resconf))
5621 {
5622 processing_PDU_SCCP_ResetConfirm( vl_PDU_SCCP.resconf );
5623 }
5624
5625 //******************************************************************
5626 //Connection refused received
5627 //******************************************************************
5628 else if (ischosen(vl_PDU_SCCP.connrefused))
5629 {
5630 // vl_PDU_SCCP.connrefused.pointer1 :=1;
5631 processing_PDU_SCCP_ConnectionRefused( vl_PDU_SCCP.connrefused );
5632 }
5633 else
5634 { log ("Unsupported message received and discarded"); }
5635 }
5636
5637 []MTP3_SCCP_PORT.receive
5638 { log("Unsupported or unrecognized message discarded after reception") }
5639
5640 //******************************************************************
5641 //******************************************************************
5642 ////start second alternative-message received on user port
5643 //******************************************************************
5644 //******************************************************************
5645
5646 [] SCCP_SP_PORT.check
5647 {//start second alternative
5648
5649 alt { //startalt1-subalternatives vill follow
5650
5651 //******************************************************************
5652 //N_DATA_req
5653 //******************************************************************
5654 [] SCCP_SP_PORT.receive( tr_ASP_N_DATA_req)-> value vl_N_DATA_req
5655 { processing_ASP_N_DATA_req(vl_N_DATA_req); }
5656
5657 //******************************************************************
5658 //N_UNITDATA_req at originating node
5659 //******************************************************************
5660 [] SCCP_SP_PORT.receive( tr_ASP_N_UNITDATA_req ) -> value vl_N_UNITDATA_req
5661 { processing_ASP_N_UNITDATA_req(vl_N_UNITDATA_req); }
5662
5663 //******************************************************************
5664 //N_CONNECT_req , originating node
5665 //******************************************************************
5666 [] SCCP_SP_PORT.receive( tr_ASP_N_CONNECT_req) -> value vl_N_CONNECT_req
5667 { processing_ASP_N_CONNECT_req( vl_N_CONNECT_req);}
5668
5669 //******************************************************************
5670 //N_CONNECT_resp
5671 //******************************************************************
5672 [] SCCP_SP_PORT.receive( tr_ASP_N_CONNECT_res)-> value vl_N_CONNECT_res
5673 { processing_ASP_N_CONNECT_res(vl_N_CONNECT_res); }
5674
5675 //******************************************************************
5676 //N_DISCONNECT_req
5677 //******************************************************************
5678 [] SCCP_SP_PORT.receive( tr_ASP_N_DISCONNECT_req)-> value vl_N_DISCONNECT_req
5679 { processing_ASP_N_DISCONNECT_req(vl_N_DISCONNECT_req); }
5680
5681 //******************************************************************
5682 //N_RESET_resp //will not be received!!
5683 //******************************************************************
5684 //[] SCCP_SP_PORT.receive( tr_ASP_N_RESET_resp)-> value vl_N_RESET_resp;
5685
5686 //******************************************************************
5687 //N_RESET_req //will not be received!!
5688 //******************************************************************
5689 //[] SCCP_SP_PORT.receive( tr_ASP_N_RESET_req)-> value vl_N_RESET_req;
5690
5691 //******************************************************************
5692 //If none of the above , then message is removed from the top of the
5693 //stack and discarded
5694 //******************************************************************
5695 [] SCCP_SP_PORT.receive
5696 { }
5697
5698 }//endalt1
5699
5700 }//end second alternative-message received on user port
5701
5702 //******************************************************************
5703 //connection timer expired
5704 //******************************************************************
5705 [v_T_conn_est[0]] T_conn_est[0].timeout {Conn_Timer_Expired(0);
5706 v_T_conn_est[0] := false;}
5707 [v_T_conn_est[1]] T_conn_est[1].timeout {Conn_Timer_Expired(1);
5708 v_T_conn_est[1] := false;}
5709 [v_T_conn_est[2]] T_conn_est[2].timeout {Conn_Timer_Expired(2);
5710 v_T_conn_est[2] := false;}
5711 [v_T_conn_est[3]] T_conn_est[3].timeout {Conn_Timer_Expired(3);
5712 v_T_conn_est[3] := false;}
5713 [v_T_conn_est[4]] T_conn_est[4].timeout {Conn_Timer_Expired(4);
5714 v_T_conn_est[4] := false;}
5715 [v_T_conn_est[5]] T_conn_est[5].timeout {Conn_Timer_Expired(5);
5716 v_T_conn_est[5] := false;}
5717 [v_T_conn_est[6]] T_conn_est[6].timeout {Conn_Timer_Expired(6);
5718 v_T_conn_est[6] := false;}
5719 [v_T_conn_est[7]] T_conn_est[7].timeout {Conn_Timer_Expired(7);
5720 v_T_conn_est[7] := false;}
5721 [v_T_conn_est[8]] T_conn_est[8].timeout {Conn_Timer_Expired(8);
5722 v_T_conn_est[8] := false;}
5723 [v_T_conn_est[9]] T_conn_est[9].timeout {Conn_Timer_Expired(9);
5724 v_T_conn_est[9] := false;}
5725 [v_T_conn_est[10]] T_conn_est[10].timeout {Conn_Timer_Expired(10);
5726 v_T_conn_est[10] := false;}
5727 [v_T_conn_est[11]] T_conn_est[11].timeout {Conn_Timer_Expired(11);
5728 v_T_conn_est[11] := false;}
5729 [v_T_conn_est[12]] T_conn_est[12].timeout {Conn_Timer_Expired(12);
5730 v_T_conn_est[12] := false;}
5731 [v_T_conn_est[13]] T_conn_est[13].timeout {Conn_Timer_Expired(13);
5732 v_T_conn_est[13] := false;}
5733 [v_T_conn_est[14]] T_conn_est[14].timeout {Conn_Timer_Expired(14);
5734 v_T_conn_est[14] := false;}
5735 [v_T_conn_est[15]] T_conn_est[15].timeout {Conn_Timer_Expired(15);
5736 v_T_conn_est[15] := false;}
5737
5738 //******************************************************************
5739 //send inactivity timer expired
5740 //******************************************************************
5741
5742 [v_T_ias[0]] T_ias[0].timeout {SendInactivity_Timer_Expired(0);
5743 v_T_ias[0] := false;}
5744 [v_T_ias[1]] T_ias[1].timeout {SendInactivity_Timer_Expired(1);
5745 v_T_ias[1] := false;}
5746 [v_T_ias[2]] T_ias[2].timeout {SendInactivity_Timer_Expired(2);
5747 v_T_ias[2] := false;}
5748 [v_T_ias[3]] T_ias[3].timeout {SendInactivity_Timer_Expired(3);
5749 v_T_ias[3] := false;}
5750 [v_T_ias[4]] T_ias[4].timeout {SendInactivity_Timer_Expired(4);
5751 v_T_ias[4] := false;}
5752 [v_T_ias[5]] T_ias[5].timeout {SendInactivity_Timer_Expired(5);
5753 v_T_ias[5] := false;}
5754 [v_T_ias[6]] T_ias[6].timeout {SendInactivity_Timer_Expired(6);
5755 v_T_ias[6] := false;}
5756 [v_T_ias[7]] T_ias[7].timeout {SendInactivity_Timer_Expired(7);
5757 v_T_ias[7] := false;}
5758 [v_T_ias[8]] T_ias[8].timeout {SendInactivity_Timer_Expired(8);
5759 v_T_ias[8] := false;}
5760 [v_T_ias[9]] T_ias[9].timeout {SendInactivity_Timer_Expired(9);
5761 v_T_ias[i] := false;}
5762 [v_T_ias[10]] T_ias[10].timeout {SendInactivity_Timer_Expired(10);
5763 v_T_ias[10] := false;}
5764 [v_T_ias[11]] T_ias[11].timeout {SendInactivity_Timer_Expired(11);
5765 v_T_ias[11] := false;}
5766 [v_T_ias[12]] T_ias[12].timeout {SendInactivity_Timer_Expired(12);
5767 v_T_ias[12] := false;}
5768 [v_T_ias[13]] T_ias[13].timeout {SendInactivity_Timer_Expired(13);
5769 v_T_ias[13] := false;}
5770 [v_T_ias[14]] T_ias[14].timeout {SendInactivity_Timer_Expired(14);
5771 v_T_ias[14] := false;}
5772 [v_T_ias[15]] T_ias[15].timeout {SendInactivity_Timer_Expired(15);
5773 v_T_ias[15] := false;}
5774
5775 //******************************************************************
5776 //receive inactivity timer expired
5777 //******************************************************************
5778 [v_T_iar[0]] T_iar[0].timeout {ReceiveInactivity_Timer_Expired(0);
5779 v_T_iar[0] := false;}
5780 [v_T_iar[1]] T_iar[1].timeout {ReceiveInactivity_Timer_Expired(1);
5781 v_T_iar[1] := false;}
5782 [v_T_iar[2]] T_iar[2].timeout {ReceiveInactivity_Timer_Expired(2);
5783 v_T_iar[2] := false;}
5784 [v_T_iar[3]] T_iar[3].timeout {ReceiveInactivity_Timer_Expired(3);
5785 v_T_iar[3] := false;}
5786 [v_T_iar[4]] T_iar[4].timeout {ReceiveInactivity_Timer_Expired(4);
5787 v_T_iar[4] := false;}
5788 [v_T_iar[5]] T_iar[5].timeout {ReceiveInactivity_Timer_Expired(5);
5789 v_T_iar[5] := false;}
5790 [v_T_iar[6]] T_iar[6].timeout {ReceiveInactivity_Timer_Expired(6);
5791 v_T_iar[6] := false;}
5792 [v_T_iar[7]] T_iar[7].timeout {ReceiveInactivity_Timer_Expired(7);
5793 v_T_iar[7] := false;}
5794 [v_T_iar[8]] T_iar[8].timeout {ReceiveInactivity_Timer_Expired(8);
5795 v_T_iar[8] := false;}
5796 [v_T_iar[9]] T_iar[9].timeout {ReceiveInactivity_Timer_Expired(9);
5797 v_T_iar[9] := false;}
5798 [v_T_iar[10]] T_iar[10].timeout {ReceiveInactivity_Timer_Expired(10);
5799 v_T_iar[10] := false;}
5800 [v_T_iar[11]] T_iar[11].timeout {ReceiveInactivity_Timer_Expired(11);
5801 v_T_iar[11] := false;}
5802 [v_T_iar[12]] T_iar[12].timeout {ReceiveInactivity_Timer_Expired(12);
5803 v_T_iar[12] := false;}
5804 [v_T_iar[13]] T_iar[13].timeout {ReceiveInactivity_Timer_Expired(13);
5805 v_T_iar[13] := false;}
5806 [v_T_iar[14]] T_iar[14].timeout {ReceiveInactivity_Timer_Expired(14);
5807 v_T_iar[14] := false;}
5808 [v_T_iar[15]] T_iar[15].timeout {ReceiveInactivity_Timer_Expired(15);
5809 v_T_iar[15] := false;}
5810
5811 //******************************************************************
5812 //release timer expired
5813 //******************************************************************
5814 [v_T_rel[0]] T_rel[0].timeout {Release_Timer_Expired(0);
5815 v_T_rel[0] := false;}
5816 [v_T_rel[1]] T_rel[1].timeout {Release_Timer_Expired(1);
5817 v_T_rel[1] := false;}
5818 [v_T_rel[2]] T_rel[2].timeout {Release_Timer_Expired(2);
5819 v_T_rel[2] := false;}
5820 [v_T_rel[3]] T_rel[3].timeout {Release_Timer_Expired(3);
5821 v_T_rel[3] := false;}
5822 [v_T_rel[4]] T_rel[4].timeout {Release_Timer_Expired(4);
5823 v_T_rel[4] := false;}
5824 [v_T_rel[5]] T_rel[5].timeout {Release_Timer_Expired(5);
5825 v_T_rel[5] := false;}
5826 [v_T_rel[6]] T_rel[6].timeout {Release_Timer_Expired(6);
5827 v_T_rel[6] := false;}
5828 [v_T_rel[7]] T_rel[7].timeout {Release_Timer_Expired(7);
5829 v_T_rel[7] := false;}
5830 [v_T_rel[8]] T_rel[8].timeout {Release_Timer_Expired(8);
5831 v_T_rel[8] := false;}
5832 [v_T_rel[9]] T_rel[9].timeout {Release_Timer_Expired(9);
5833 v_T_rel[9] := false;}
5834 [v_T_rel[10]] T_rel[10].timeout {Release_Timer_Expired(10);
5835 v_T_rel[10] := false;}
5836 [v_T_rel[11]] T_rel[11].timeout {Release_Timer_Expired(11);
5837 v_T_rel[11] := false;}
5838 [v_T_rel[12]] T_rel[12].timeout {Release_Timer_Expired(12);
5839 v_T_rel[12] := false;}
5840 [v_T_rel[13]] T_rel[13].timeout {Release_Timer_Expired(13);
5841 v_T_rel[13] := false;}
5842 [v_T_rel[14]] T_rel[14].timeout {Release_Timer_Expired(14);
5843 v_T_rel[14] := false;}
5844 [v_T_rel[15]] T_rel[15].timeout {Release_Timer_Expired(15);
5845 v_T_rel[15] := false;}
5846
5847 //******************************************************************
5848 //repeat release timer expired
5849 //******************************************************************
5850
5851 [v_T_repeat_rel[0]] T_repeat_rel[0].timeout {RepeatRelease_Timer_Expired(0);
5852 v_T_repeat_rel[0] := false;}
5853 [v_T_repeat_rel[1]] T_repeat_rel[1].timeout {RepeatRelease_Timer_Expired(1);
5854 v_T_repeat_rel[1] := false;}
5855 [v_T_repeat_rel[2]] T_repeat_rel[2].timeout {RepeatRelease_Timer_Expired(2);
5856 v_T_repeat_rel[2] := false;}
5857 [v_T_repeat_rel[3]] T_repeat_rel[3].timeout {RepeatRelease_Timer_Expired(3);
5858 v_T_repeat_rel[3] := false;}
5859 [v_T_repeat_rel[4]] T_repeat_rel[4].timeout {RepeatRelease_Timer_Expired(4);
5860 v_T_repeat_rel[4] := false;}
5861 [v_T_repeat_rel[5]] T_repeat_rel[5].timeout {RepeatRelease_Timer_Expired(5);
5862 v_T_repeat_rel[5] := false;}
5863 [v_T_repeat_rel[6]] T_repeat_rel[6].timeout {RepeatRelease_Timer_Expired(6);
5864 v_T_repeat_rel[6] := false;}
5865 [v_T_repeat_rel[7]] T_repeat_rel[7].timeout {RepeatRelease_Timer_Expired(7);
5866 v_T_repeat_rel[7] := false;}
5867 [v_T_repeat_rel[8]] T_repeat_rel[8].timeout {RepeatRelease_Timer_Expired(8);
5868 v_T_repeat_rel[8] := false;}
5869 [v_T_repeat_rel[9]] T_repeat_rel[9].timeout {RepeatRelease_Timer_Expired(9);
5870 v_T_repeat_rel[9] := false;}
5871 [v_T_repeat_rel[10]] T_repeat_rel[10].timeout {RepeatRelease_Timer_Expired(10);
5872 v_T_repeat_rel[10] := false;}
5873 [v_T_repeat_rel[11]] T_repeat_rel[11].timeout {RepeatRelease_Timer_Expired(11);
5874 v_T_repeat_rel[11] := false;}
5875 [v_T_repeat_rel[12]] T_repeat_rel[12].timeout {RepeatRelease_Timer_Expired(12);
5876 v_T_repeat_rel[12] := false;}
5877 [v_T_repeat_rel[13]] T_repeat_rel[13].timeout {RepeatRelease_Timer_Expired(13);
5878 v_T_repeat_rel[13] := false;}
5879 [v_T_repeat_rel[14]] T_repeat_rel[14].timeout {RepeatRelease_Timer_Expired(14);
5880 v_T_repeat_rel[14] := false;}
5881 [v_T_repeat_rel[15]] T_repeat_rel[15].timeout {RepeatRelease_Timer_Expired(15);
5882 v_T_repeat_rel[15] := false;}
5883
5884 //******************************************************************
5885 //interval timer expired
5886 //******************************************************************
5887 [v_T_int[0]] T_int[0].timeout {Interval_Timer_Expired(0);
5888 v_T_int[0] := false;}
5889 [v_T_int[1]] T_int[1].timeout {Interval_Timer_Expired(1);
5890 v_T_int[1] := false;}
5891 [v_T_int[2]] T_int[2].timeout {Interval_Timer_Expired(2);
5892 v_T_int[2] := false;}
5893 [v_T_int[3]] T_int[3].timeout {Interval_Timer_Expired(3);
5894 v_T_int[3] := false;}
5895 [v_T_int[4]] T_int[4].timeout {Interval_Timer_Expired(4);
5896 v_T_int[4] := false;}
5897 [v_T_int[5]] T_int[5].timeout {Interval_Timer_Expired(5);
5898 v_T_int[5] := false;}
5899 [v_T_int[6]] T_int[6].timeout {Interval_Timer_Expired(6);
5900 v_T_int[6] := false;}
5901 [v_T_int[7]] T_int[7].timeout {Interval_Timer_Expired(7);
5902 v_T_int[7] := false;}
5903 [v_T_int[8]] T_int[8].timeout {Interval_Timer_Expired(8);
5904 v_T_int[8] := false;}
5905 [v_T_int[9]] T_int[9].timeout {Interval_Timer_Expired(9);
5906 v_T_int[9] := false;}
5907 [v_T_int[10]] T_int[10].timeout {Interval_Timer_Expired(10);
5908 v_T_int[10] := false;}
5909 [v_T_int[11]] T_int[11].timeout {Interval_Timer_Expired(11);
5910 v_T_int[11] := false;}
5911 [v_T_int[12]] T_int[12].timeout {Interval_Timer_Expired(12);
5912 v_T_int[12] := false;}
5913 [v_T_int[13]] T_int[13].timeout {Interval_Timer_Expired(13);
5914 v_T_int[13] := false;}
5915 [v_T_int[14]] T_int[14].timeout {Interval_Timer_Expired(14);
5916 v_T_int[14] := false;}
5917 [v_T_int[15]] T_int[15].timeout {Interval_Timer_Expired(15);
5918 v_T_int[15] := false;}
5919
5920 //******************************************************************
5921 //reset timer expired
5922 //******************************************************************
5923 [v_T_reset[0]] T_reset[0].timeout {Reset_Timer_Expired(0);
5924 v_T_reset[0] := false;}
5925 [v_T_reset[1]] T_reset[1].timeout {Reset_Timer_Expired(1);
5926 v_T_reset[1] := false;}
5927 [v_T_reset[2]] T_reset[2].timeout {Reset_Timer_Expired(2);
5928 v_T_reset[2] := false;}
5929 [v_T_reset[3]] T_reset[3].timeout {Reset_Timer_Expired(3);
5930 v_T_reset[3] := false;}
5931 [v_T_reset[4]] T_reset[4].timeout {Reset_Timer_Expired(4);
5932 v_T_reset[4] := false;}
5933 [v_T_reset[5]] T_reset[5].timeout {Reset_Timer_Expired(5);
5934 v_T_reset[5] := false;}
5935 [v_T_reset[6]] T_reset[6].timeout {Reset_Timer_Expired(6);
5936 v_T_reset[6] := false;}
5937 [v_T_reset[7]] T_reset[7].timeout {Reset_Timer_Expired(7);
5938 v_T_reset[7] := false;}
5939 [v_T_reset[8]] T_reset[8].timeout {Reset_Timer_Expired(8);
5940 v_T_reset[8] := false;}
5941 [v_T_reset[9]] T_reset[9].timeout {Reset_Timer_Expired(9);
5942 v_T_reset[9] := false;}
5943 [v_T_reset[10]] T_reset[10].timeout {Reset_Timer_Expired(10);
5944 v_T_reset[10] := false;}
5945 [v_T_reset[11]] T_reset[11].timeout {Reset_Timer_Expired(11);
5946 v_T_reset[11] := false;}
5947 [v_T_reset[12]] T_reset[12].timeout {Reset_Timer_Expired(12);
5948 v_T_reset[12] := false;}
5949 [v_T_reset[13]] T_reset[13].timeout {Reset_Timer_Expired(13);
5950 v_T_reset[13] := false;}
5951 [v_T_reset[14]] T_reset[14].timeout {Reset_Timer_Expired(14);
5952 v_T_reset[14] := false;}
5953 [v_T_reset[15]] T_reset[15].timeout {Reset_Timer_Expired(15);
5954 v_T_reset[15] := false;}
5955
5956 //******************************************************************
5957 //internal_reset timer expired-sending internal signals!
5958 //******************************************************************
5959 [v_T_internal_reset[0]] T_internal_reset[0].timeout {InternalResetTimer_Expired(0);
5960 v_T_internal_reset[0] := false;}
5961 [v_T_internal_reset[1]] T_internal_reset[1].timeout {InternalResetTimer_Expired(1);
5962 v_T_internal_reset[1] := false;}
5963 [v_T_internal_reset[2]] T_internal_reset[2].timeout {InternalResetTimer_Expired(2);
5964 v_T_internal_reset[2] := false;}
5965 [v_T_internal_reset[3]] T_internal_reset[3].timeout {InternalResetTimer_Expired(3);
5966 v_T_internal_reset[3] := false;}
5967 [v_T_internal_reset[4]] T_internal_reset[4].timeout {InternalResetTimer_Expired(4);
5968 v_T_internal_reset[4] := false;}
5969 [v_T_internal_reset[5]] T_internal_reset[5].timeout {InternalResetTimer_Expired(5);
5970 v_T_internal_reset[5] := false;}
5971 [v_T_internal_reset[6]] T_internal_reset[6].timeout {InternalResetTimer_Expired(6);
5972 v_T_internal_reset[6] := false;}
5973 [v_T_internal_reset[7]] T_internal_reset[7].timeout {InternalResetTimer_Expired(7);
5974 v_T_internal_reset[7] := false;}
5975 [v_T_internal_reset[8]] T_internal_reset[8].timeout {InternalResetTimer_Expired(8);
5976 v_T_internal_reset[8] := false;}
5977 [v_T_internal_reset[9]] T_internal_reset[9].timeout {InternalResetTimer_Expired(9);
5978 v_T_internal_reset[9] := false;}
5979 [v_T_internal_reset[10]] T_internal_reset[10].timeout {InternalResetTimer_Expired(10);
5980 v_T_internal_reset[10] := false;}
5981 [v_T_internal_reset[11]] T_internal_reset[11].timeout {InternalResetTimer_Expired(11);
5982 v_T_internal_reset[11] := false;}
5983 [v_T_internal_reset[12]] T_internal_reset[12].timeout {InternalResetTimer_Expired(12);
5984 v_T_internal_reset[12] := false;}
5985 [v_T_internal_reset[13]] T_internal_reset[13].timeout {InternalResetTimer_Expired(13);
5986 v_T_internal_reset[13] := false;}
5987 [v_T_internal_reset[14]] T_internal_reset[14].timeout {InternalResetTimer_Expired(14);
5988 v_T_internal_reset[14] := false;}
5989 [v_T_internal_reset[15]] T_internal_reset[15].timeout {InternalResetTimer_Expired(15);
5990 v_T_internal_reset[15] := false;}
5991
5992 //******************************************************************
5993 //guard timer expired - no answer to ASP_SCCP_N_CONNECT_ind received
5994 //******************************************************************
5995 [v_T_guard[0]] T_guard[0].timeout {GuardTimer_Expired(0);
5996 v_T_guard[0] := false;}
5997 [v_T_guard[1]] T_guard[1].timeout {GuardTimer_Expired(1);
5998 v_T_guard[1] := false;}
5999 [v_T_guard[2]] T_guard[2].timeout {GuardTimer_Expired(2);
6000 v_T_guard[2] := false;}
6001 [v_T_guard[3]] T_guard[3].timeout {GuardTimer_Expired(3);
6002 v_T_guard[3] := false;}
6003 [v_T_guard[4]] T_guard[4].timeout {GuardTimer_Expired(4);
6004 v_T_guard[4] := false;}
6005 [v_T_guard[5]] T_guard[5].timeout {GuardTimer_Expired(5);
6006 v_T_guard[5] := false;}
6007 [v_T_guard[6]] T_guard[6].timeout {GuardTimer_Expired(6);
6008 v_T_guard[6] := false;}
6009 [v_T_guard[7]] T_guard[7].timeout {GuardTimer_Expired(7);
6010 v_T_guard[7] := false;}
6011 [v_T_guard[8]] T_guard[8].timeout {GuardTimer_Expired(8);
6012 v_T_guard[8] := false;}
6013 [v_T_guard[9]] T_guard[9].timeout {GuardTimer_Expired(9);
6014 v_T_guard[9] := false;}
6015 [v_T_guard[10]] T_guard[10].timeout {GuardTimer_Expired(10);
6016 v_T_guard[10] := false;}
6017 [v_T_guard[11]] T_guard[11].timeout {GuardTimer_Expired(11);
6018 v_T_guard[11] := false;}
6019 [v_T_guard[12]] T_guard[12].timeout {GuardTimer_Expired(12);
6020 v_T_guard[12] := false;}
6021 [v_T_guard[13]] T_guard[13].timeout {GuardTimer_Expired(13);
6022 v_T_guard[13] := false;}
6023 [v_T_guard[14]] T_guard[14].timeout {GuardTimer_Expired(14);
6024 v_T_guard[14] := false;}
6025 [v_T_guard[15]] T_guard[15].timeout {GuardTimer_Expired(15);
6026 v_T_guard[15] := false;}
6027
6028
6029 }//endalt0
6030
6031 //******************************************************************
6032 }//endwhile
6033 //******************************************************************
6034
6035}//endfunction ScanEvents
6036
6037//******************************************************************
6038}//endgroup SCCPFunctions
6039//******************************************************************
6040
6041}//endmodule