blob: 0de496b72c1a0d4614445f9a6cd8259e643af39c [file] [log] [blame]
Harald Welteac359802017-04-12 12:13:44 +02001///////////////////////////////////////////////////////////////////////////////
2// //
3// Copyright Test Competence Center (TCC) ETH 2012 //
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_Mapping.ttcnpp
12// Description: SCCP <-> MTP3 dual faced port definition
13// Rev: R6A05
14// Prodnr: CNL 113 341
15// Updated: 2012-11-05
16// Contact: http://ttcn.ericsson.se
17module SCCP_Mapping
18{
19import from MTP3asp_Types all;
20import from MTP3asp_PortType all;
21import from SCCP_Types all;
22import from SCCPasp_Types all;
23
24// *************************************************************************
25// *************************************************************************
26//SCCP Component related declarations
27// *************************************************************************
28// *************************************************************************
29
30type integer UnhandledProtocol;
31
32// SCCPasp_SP_PT SCCP_SP_PORT
33//+-----------------+-----------------+
34//| SCCP_CT /
35//| /
36//+-----------------+-----------------+
37//MTP3asp_SCCP_PT MTP3_SCCP_PORT
38// |
39//
40
41//#ifdef USE_MTP3_DISTRIBUTOR
42//Version to internal port
43type port MTP3asp_SCCP_PT message
44{
45 in PDU_SCCP;
46 out ASP_MTP3_TRANSFERreq_sccp;
47}
48with
49{ extension
50 "internal user MTP3asp_PT
51 out(ASP_MTP3_TRANSFERreq_sccp
52 -> ASP_MTP3_TRANSFERreq: function(f_enc_SCCP_to_MTP))
53 in( ASP_MTP3_TRANSFERind
54 -> PDU_SCCP: function(f_dec_MTP_to_SCCP),
55 - : discard;
56 ASP_MTP3_PAUSE -> -: discard;
57 ASP_MTP3_RESUME -> -: discard;
58 ASP_MTP3_STATUS -> -: discard)
59 "
60}
61/*#else
62//Version to external port
63type port MTP3asp_SCCP_PT message
64{
65 in PDU_SCCP;
66 in UnhandledProtocol;
67 out ASP_MTP3_TRANSFERreq_sccp;
68}
69with
70{ extension
71 "user MTP3asp_PT
72 out(ASP_MTP3_TRANSFERreq_sccp
73 -> ASP_MTP3_TRANSFERreq: function(f_enc_SCCP_to_MTP))
74 in( ASP_MTP3_TRANSFERind ->
75 PDU_SCCP: function(f_dec_MTP_to_SCCP),
76 UnhandledProtocol: function(f_dec_MTP_to_UnhandledProtocol);
77 ASP_MTP3_PAUSE -> -: discard;
78 ASP_MTP3_RESUME -> -: discard;
79 ASP_MTP3_STATUS -> -: discard)
80 "
81}
82
83function f_dec_MTP_to_UnhandledProtocol(in ASP_MTP3_TRANSFERind pl_in, out UnhandledProtocol pl_out) return integer
84{
85 pl_out := 1;
86 return 0;
87} with {extension "prototype(backtrack)" }
88
89#endif
90*/
91
92function f_enc_SCCP_to_MTP
93 (in ASP_MTP3_TRANSFERreq_sccp pl_in,
94 out ASP_MTP3_TRANSFERreq pl_out) return integer
95{
96 var bitstring vl_sio_bit := oct2bit(pl_in.sio);
97 var MTP3_Field_sio vl_sio_struct;
98 vl_sio_struct.ni := substr(vl_sio_bit,0,2);
99 vl_sio_struct.prio := substr(vl_sio_bit,2,2);
100 vl_sio_struct.si := substr(vl_sio_bit,4,4);
101
102 pl_out :=
103 {
104 sio := vl_sio_struct,
105 opc := pl_in.opc,
106 dpc := pl_in.dpc,
107 sls := pl_in.sls,
108 data:= enc_PDU_SCCP(pl_in.data)
109 }
110 return 0;
111} with {extension "prototype(backtrack)" }
112
113function f_dec_MTP_to_SCCP
114 (in ASP_MTP3_TRANSFERind pl_in,
115 out PDU_SCCP pl_out) return integer
116{
117 if (pl_in.sio.si != '0011'B)
118 {
119 log("The received message is not SCCP. Ignored.");
120 return 1;
121 }
122 pl_out := dec_PDU_SCCP(pl_in.data);
123
124 return 0;
125} with {extension "prototype(backtrack)" }
126
127
128
129}