osmo-ttcn3-hacks/SCCP_CNL113341/src/SCCP_Mapping.ttcnpp

130 lines
3.8 KiB
Plaintext

///////////////////////////////////////////////////////////////////////////////
// //
// Copyright Test Competence Center (TCC) ETH 2012 //
// //
// The copyright to the computer program(s) herein is the property of TCC. //
// The program(s) may be used and/or copied only with the written permission //
// of TCC or in accordance with the terms and conditions stipulated in the //
// agreement/contract under which the program(s) have been supplied //
// //
///////////////////////////////////////////////////////////////////////////////
// File: SCCP_Mapping.ttcnpp
// Description: SCCP <-> MTP3 dual faced port definition
// Rev: R6A05
// Prodnr: CNL 113 341
// Updated: 2012-11-05
// Contact: http://ttcn.ericsson.se
module SCCP_Mapping
{
import from MTP3asp_Types all;
import from MTP3asp_PortType all;
import from SCCP_Types all;
import from SCCPasp_Types all;
// *************************************************************************
// *************************************************************************
//SCCP Component related declarations
// *************************************************************************
// *************************************************************************
type integer UnhandledProtocol;
// SCCPasp_SP_PT SCCP_SP_PORT
//+-----------------+-----------------+
//| SCCP_CT /
//| /
//+-----------------+-----------------+
//MTP3asp_SCCP_PT MTP3_SCCP_PORT
// |
//
//#ifdef USE_MTP3_DISTRIBUTOR
//Version to internal port
type port MTP3asp_SCCP_PT message
{
in PDU_SCCP;
out ASP_MTP3_TRANSFERreq_sccp;
}
with
{ extension
"internal user MTP3asp_PT
out(ASP_MTP3_TRANSFERreq_sccp
-> ASP_MTP3_TRANSFERreq: function(f_enc_SCCP_to_MTP))
in( ASP_MTP3_TRANSFERind
-> PDU_SCCP: function(f_dec_MTP_to_SCCP),
- : discard;
ASP_MTP3_PAUSE -> -: discard;
ASP_MTP3_RESUME -> -: discard;
ASP_MTP3_STATUS -> -: discard)
"
}
/*#else
//Version to external port
type port MTP3asp_SCCP_PT message
{
in PDU_SCCP;
in UnhandledProtocol;
out ASP_MTP3_TRANSFERreq_sccp;
}
with
{ extension
"user MTP3asp_PT
out(ASP_MTP3_TRANSFERreq_sccp
-> ASP_MTP3_TRANSFERreq: function(f_enc_SCCP_to_MTP))
in( ASP_MTP3_TRANSFERind ->
PDU_SCCP: function(f_dec_MTP_to_SCCP),
UnhandledProtocol: function(f_dec_MTP_to_UnhandledProtocol);
ASP_MTP3_PAUSE -> -: discard;
ASP_MTP3_RESUME -> -: discard;
ASP_MTP3_STATUS -> -: discard)
"
}
function f_dec_MTP_to_UnhandledProtocol(in ASP_MTP3_TRANSFERind pl_in, out UnhandledProtocol pl_out) return integer
{
pl_out := 1;
return 0;
} with {extension "prototype(backtrack)" }
#endif
*/
function f_enc_SCCP_to_MTP
(in ASP_MTP3_TRANSFERreq_sccp pl_in,
out ASP_MTP3_TRANSFERreq pl_out) return integer
{
var bitstring vl_sio_bit := oct2bit(pl_in.sio);
var MTP3_Field_sio vl_sio_struct;
vl_sio_struct.ni := substr(vl_sio_bit,0,2);
vl_sio_struct.prio := substr(vl_sio_bit,2,2);
vl_sio_struct.si := substr(vl_sio_bit,4,4);
pl_out :=
{
sio := vl_sio_struct,
opc := pl_in.opc,
dpc := pl_in.dpc,
sls := pl_in.sls,
data:= enc_PDU_SCCP(pl_in.data)
}
return 0;
} with {extension "prototype(backtrack)" }
function f_dec_MTP_to_SCCP
(in ASP_MTP3_TRANSFERind pl_in,
out PDU_SCCP pl_out) return integer
{
if (pl_in.sio.si != '0011'B)
{
log("The received message is not SCCP. Ignored.");
return 1;
}
pl_out := dec_PDU_SCCP(pl_in.data);
return 0;
} with {extension "prototype(backtrack)" }
}