diff options
author | Harald Welte <laforge@gnumonks.org> | 2017-07-25 08:23:52 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-07-25 08:23:52 +0200 |
commit | 9a8f503f9ab85c309de8fc348186ac3b6c58b1d1 (patch) | |
tree | 401c7c4eb4591566b48b5989f9bd0caaeb9e2c65 | |
parent | 96a06c43739f6743e6f1df41e3f0e253c862c6f8 (diff) |
import Ericsson NS, ISUP, ROHC and SNDCP modules for TITAN
21 files changed, 13166 insertions, 0 deletions
diff --git a/ISUP_Q.762_CNL113365_LATEST/ISUP_Q.762_CNL113365.tpd b/ISUP_Q.762_CNL113365_LATEST/ISUP_Q.762_CNL113365.tpd new file mode 100644 index 00000000..7b64c3d0 --- /dev/null +++ b/ISUP_Q.762_CNL113365_LATEST/ISUP_Q.762_CNL113365.tpd @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2017 Ericsson + + The copyright to the computer program(s) herein is the property of Ericsson. + The program(s) may be used and/or copied only with the written permission + of Ericsson or in accordance with the terms and conditions stipulated in the + agreement/contract under which the program(s) has been supplied. + + + File: ISUP_Q.762_CNL113365.tpd + Description: tpd project file + Rev: R7D + Prodnr: CNL 113 365 + + --> +<TITAN_Project_File_Information version="1.0"> + <ProjectName>ISUP_Q.762_CNL113365</ProjectName> + <ReferencedProjects> + <ReferencedProject name="ProtocolModules_Common" projectLocationURI="../COMMON/ProtocolModules_Common.tpd"/> + </ReferencedProjects> + <Folders> + <FolderResource projectRelativePath="src" relativeURI="src"/> + </Folders> + <Files> + <FileResource projectRelativePath="src/ISUP_EncDec.cc" relativeURI="src/ISUP_EncDec.cc"/> + <FileResource projectRelativePath="src/ISUP_Types.ttcn" relativeURI="src/ISUP_Types.ttcn"/> + </Files> + <ActiveConfiguration>Default</ActiveConfiguration> + <Configurations> + <Configuration name="Default"> + <ProjectProperties> + <MakefileSettings> + <generateInternalMakefile>true</generateInternalMakefile> + <GNUMake>true</GNUMake> + <incrementalDependencyRefresh>true</incrementalDependencyRefresh> + <targetExecutable>bin/ISUP_Q.762_CNL113365</targetExecutable> + </MakefileSettings> + <LocalBuildSettings> + <workingDirectory>bin</workingDirectory> + </LocalBuildSettings> + <NamingCoventions> + <moduleParameter>tsp.*</moduleParameter> + </NamingCoventions> + </ProjectProperties> + </Configuration> + </Configurations> +</TITAN_Project_File_Information> diff --git a/ISUP_Q.762_CNL113365_LATEST/demo/ISUP_Mapping.ttcn b/ISUP_Q.762_CNL113365_LATEST/demo/ISUP_Mapping.ttcn new file mode 100644 index 00000000..a29603ed --- /dev/null +++ b/ISUP_Q.762_CNL113365_LATEST/demo/ISUP_Mapping.ttcn @@ -0,0 +1,128 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright Test Competence Center (TCC) ETH 2006 +// // +// 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: ISUP_Mapping.ttcn +// Rev: R7D +// Prodnr: CNL 113 365 +// Updated: 2006-05-10 +// Contact: http://ttcn.ericsson.se +/////////////////////////////////////////////////////////////////////////////// +module ISUP_Mapping +{ + import from MTP3asp_PortType all; + import from MTP3asp_Types all; + import from ISUP_Types all; + +group Types +{ + type record MSC_ISUP_MTP3_parameters + { + MTP3_Field_sio sio, + integer opc, + integer dpc, + integer sls + } + +group PortTypes +{ + //************************************************************************* + //* ISUP port types * + //************************************************************************* + type port MTP3asp_ISUP_PT message + { + inout PDU_ISUP; + } with {extension "internal"} + + type port MTC_ISUP_PT message // Coordination message + { + inout charstring; + inout octetstring; + } with {extension "internal"} +}//end group PortTypes + + +group ComponentTypes +{ + //************************************************************************* + //* ISUP Component types * + //************************************************************************* + type component ISUP_CT + { + //========================Component constants=========================== + + //========================Component variables=========================== + var PDU_ISUP v_PDU_ISUP; + + //========================Component Timers-============================= + + //========================Component Port Declarations==================== + port MTC_ISUP_PT MTC_ISUP_PORT; //up + port MTP3asp_ISUP_PT MTP3_ISUP_PORT; //down + } // end component type definition + + //************************************************************************* + //* ISUP EncDec component * + //************************************************************************* + type component ISUP_EncDec_CT + { + //========================Component Port Declarations==================== + port MTP3asp_ISUP_PT MTP3_ISUP_PORT; //<= SP_PT=_PT + port MTP3asp_PT MTP3_PORT; + } // end component type definition +}//end group ComponentTypes + +}//end group Types + + +//************************************************************************* +//* ISUP EncDec component behaviour * +//************************************************************************* +function f_ISUP_EncDecComp_Behaviour + ( MSC_ISUP_MTP3_parameters pl_address_ISUP ) runs on ISUP_EncDec_CT + { + var ASP_MTP3_TRANSFERind vl_ASP_MTP3_TRANSFERind; + var PDU_ISUP vl_PDU_ISUP; + pl_address_ISUP.sio.si := '0101'B; + + while (true) + { + alt + { + [] MTP3_ISUP_PORT.receive ( PDU_ISUP : ?) -> value vl_PDU_ISUP + { + MTP3_PORT.send (t_ASP_MTP3_TRANSFERreq + (pl_address_ISUP.sio, + pl_address_ISUP.opc, + pl_address_ISUP.dpc, + pl_address_ISUP.sls, + enc_PDU_ISUP(vl_PDU_ISUP))); + repeat; + } + + // receive message from below (to be decoded) + [] MTP3_PORT.receive (tr_ASP_MTP3_TRANSFERind_sio + (pl_address_ISUP.sio.ni, + ?, //priority: no filtering + pl_address_ISUP.sio.si, + ?, + ?, + ?, + ? )) -> value vl_ASP_MTP3_TRANSFERind + { + MTP3_ISUP_PORT.send (dec_PDU_ISUP(vl_ASP_MTP3_TRANSFERind.data)); + repeat; + } + + [] MTP3_PORT.receive (t_ASP_MTP3_TRANSFERind( ?, ?, ?, ?, ? )) + { log("Invalid SIO: MESSAGE dropped!!!"); } + } //end of alt + } // end while + } // end of f_ISUP_EncDecComp_Behaviour +} diff --git a/ISUP_Q.762_CNL113365_LATEST/doc/ISUP_FS.pdf b/ISUP_Q.762_CNL113365_LATEST/doc/ISUP_FS.pdf Binary files differnew file mode 100644 index 00000000..adae9424 --- /dev/null +++ b/ISUP_Q.762_CNL113365_LATEST/doc/ISUP_FS.pdf diff --git a/ISUP_Q.762_CNL113365_LATEST/doc/ISUP_Q_PRI.doc b/ISUP_Q.762_CNL113365_LATEST/doc/ISUP_Q_PRI.doc Binary files differnew file mode 100644 index 00000000..3906228e --- /dev/null +++ b/ISUP_Q.762_CNL113365_LATEST/doc/ISUP_Q_PRI.doc diff --git a/ISUP_Q.762_CNL113365_LATEST/doc/ISUP_Q_UG.doc b/ISUP_Q.762_CNL113365_LATEST/doc/ISUP_Q_UG.doc Binary files differnew file mode 100644 index 00000000..d70488dc --- /dev/null +++ b/ISUP_Q.762_CNL113365_LATEST/doc/ISUP_Q_UG.doc diff --git a/ISUP_Q.762_CNL113365_LATEST/src/ISUP_EncDec.cc b/ISUP_Q.762_CNL113365_LATEST/src/ISUP_EncDec.cc new file mode 100644 index 00000000..ea18af68 --- /dev/null +++ b/ISUP_Q.762_CNL113365_LATEST/src/ISUP_EncDec.cc @@ -0,0 +1,465 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright Test Competence Center (TCC) ETH 2011 +// // +// 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: ISUP_EncDec.cc +// Rev: R7D +// Prodnr: CNL 113 365 +// Updated: 2011-05-10 +// Contact: http://ttcn.ericsson.se +/////////////////////////////////////////////////////////////////////////////// +#include "ISUP_Types.hh" + +namespace ISUP__Types { + +OCTETSTRING enc__PDU__ISUP(const PDU__ISUP& pdu) +{ + if (TTCN_Logger::log_this_event(TTCN_DEBUG)) { + TTCN_Logger::begin_event(TTCN_DEBUG); + TTCN_Logger::log_event("Encoding PDU_ISUP: "); + pdu.log(); + TTCN_Logger::end_event(); + } + + TTCN_Buffer buf; + pdu.encode(PDU__ISUP_descr_, buf, TTCN_EncDec::CT_RAW); + OCTETSTRING ret_val(buf.get_len(), buf.get_data()); + + if (TTCN_Logger::log_this_event(TTCN_DEBUG)) { + TTCN_Logger::begin_event(TTCN_DEBUG); + TTCN_Logger::log_event("PDU_ISUP after encoding: "); + ret_val.log(); + TTCN_Logger::end_event(); + } + return ret_val; +} + +PDU__ISUP dec__PDU__ISUP(const OCTETSTRING& stream) +{ + if (TTCN_Logger::log_this_event(TTCN_DEBUG)) { + TTCN_Logger::begin_event(TTCN_DEBUG); + TTCN_Logger::log_event("Decoding PDU_ISUP: "); + stream.log(); + TTCN_Logger::end_event(); + } + + TTCN_Buffer buf; + buf.put_os(stream); + PDU__ISUP ret_val; + ret_val.decode(PDU__ISUP_descr_, buf, TTCN_EncDec::CT_RAW); + + if (TTCN_Logger::log_this_event(TTCN_DEBUG)) { + TTCN_Logger::begin_event(TTCN_DEBUG); + TTCN_Logger::log_event("Decoded PDU_ISUP: "); + ret_val.log(); + TTCN_Logger::end_event(); + } + return ret_val; +} + +PDU__ISUP dec__PDU__ISUP__noCIC(const OCTETSTRING& stream) +{ + if (TTCN_Logger::log_this_event(TTCN_DEBUG)) { + TTCN_Logger::begin_event(TTCN_DEBUG); + TTCN_Logger::log_event("Decoding PDU_ISUP: "); + stream.log(); + TTCN_Logger::end_event(); + } + + OCTETSTRING mod_stream (int2oct(0,2) + stream); + TTCN_Buffer buf; + buf.put_os(mod_stream); + PDU__ISUP ret_val; + ret_val.decode(PDU__ISUP_descr_, buf, TTCN_EncDec::CT_RAW); + PDU__ISUP::union_selection_type msg_type = ret_val.get_selection(); + switch (msg_type) + { + case PDU__ISUP::ALT_ISUP__ACM: + { + ret_val.ISUP__ACM().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__ANM: + { + ret_val.ISUP__ANM().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__APM: + { + ret_val.ISUP__APM().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__BLO: + { + ret_val.ISUP__BLO().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__BLA: + { + ret_val.ISUP__BLA().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__CPG: + { + ret_val.ISUP__CPG().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__CGB: + { + ret_val.ISUP__CGB().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__CGBA: + { + ret_val.ISUP__CGBA().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__CQM: + { + ret_val.ISUP__CQM().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__CQR: + { + ret_val.ISUP__CQR().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__GRS: + { + ret_val.ISUP__GRS().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__GRA: + { + ret_val.ISUP__GRA().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__CGU: + { + ret_val.ISUP__CGU().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__CGUA: + { + ret_val.ISUP__CGUA().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__CRG: + { + ret_val.ISUP__CRG().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__CFN: + { + ret_val.ISUP__CFN().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__CON: + { + ret_val.ISUP__CON().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__COT: + { + ret_val.ISUP__COT().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__CCR: + { + ret_val.ISUP__CCR().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__FAC: + { + ret_val.ISUP__FAC().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__FAA: + { + ret_val.ISUP__FAA().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__FRJ: + { + ret_val.ISUP__FRJ().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__FAR: + { + ret_val.ISUP__FAR().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__FOT: + { + ret_val.ISUP__FOT().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__IDR: + { + ret_val.ISUP__IDR().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__IRS: + { + ret_val.ISUP__IRS().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__INF: + { + ret_val.ISUP__INF().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__INR: + { + ret_val.ISUP__INR().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__IAM: + { + ret_val.ISUP__IAM().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__LPA: + { + ret_val.ISUP__LPA().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__LOP: + { + ret_val.ISUP__LOP().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__NRM: + { + ret_val.ISUP__NRM().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__OLM: + { + ret_val.ISUP__OLM().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__OPR: + { + ret_val.ISUP__OPR().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__PAM: + { + ret_val.ISUP__PAM().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__PRI: + { + ret_val.ISUP__PRI().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__REL: + { + ret_val.ISUP__REL().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__RLC: + { + ret_val.ISUP__RLC().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__RSC: + { + ret_val.ISUP__RSC().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__RES: + { + ret_val.ISUP__RES().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__SGM: + { + ret_val.ISUP__SGM().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__SAM: + { + ret_val.ISUP__SAM().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__SCB: + { + ret_val.ISUP__SCB().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__SDM: + { + ret_val.ISUP__SDM().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__SUS: + { + ret_val.ISUP__SUS().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__UBL: + { + ret_val.ISUP__UBL().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__UBA: + { + ret_val.ISUP__UBA().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__UCIC: + { + ret_val.ISUP__UCIC().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__UPA: + { + ret_val.ISUP__UPA().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__UPT: + { + ret_val.ISUP__UPT().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__USR: + { + ret_val.ISUP__USR().cic() = OMIT_VALUE; break; + } + default: + break; + } + if (TTCN_Logger::log_this_event(TTCN_DEBUG)) { + TTCN_Logger::begin_event(TTCN_DEBUG); + TTCN_Logger::log_event("Decoded PDU_ISUP: "); + ret_val.log(); + TTCN_Logger::end_event(); + } + return ret_val; +} + +INTEGER dec__PDU__ISUP__backtrack__noCIC(const OCTETSTRING& stream, PDU__ISUP& pdu) +{ + if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) { + TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC); + TTCN_Logger::log_event_str("dec_PDU_ISUP_backtrack(): Stream before decoding: "); + stream.log(); + TTCN_Logger::end_event(); + } + TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING); + TTCN_EncDec::clear_error(); + OCTETSTRING mod_stream (int2oct(0,2) + stream); + TTCN_Buffer ttcn_buffer; + ttcn_buffer.put_os(mod_stream); + pdu.decode(PDU__ISUP_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW); + + + if (TTCN_EncDec::get_last_error_type() == TTCN_EncDec::ET_NONE) { + + PDU__ISUP::union_selection_type msg_type = pdu.get_selection(); + switch (msg_type) + { + case PDU__ISUP::ALT_ISUP__ACM: + { + pdu.ISUP__ACM().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__ANM: + { + pdu.ISUP__ANM().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__BLO: + { + pdu.ISUP__BLO().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__BLA: + { + pdu.ISUP__BLA().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__CPG: + { + pdu.ISUP__CPG().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__CGB: + { + pdu.ISUP__CGB().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__CGBA: + { + pdu.ISUP__CGBA().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__GRS: + { + pdu.ISUP__GRS().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__GRA: + { + pdu.ISUP__GRA().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__CGU: + { + pdu.ISUP__CGU().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__CGUA: + { + pdu.ISUP__CGUA().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__CQM: + { + pdu.ISUP__CQM().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__CQR: + { + pdu.ISUP__CQR().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__CFN: + { + pdu.ISUP__CFN().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__COT: + { + pdu.ISUP__COT().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__CCR: + { + pdu.ISUP__CCR().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__FAC: + { + pdu.ISUP__FAC().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__FOT: + { + pdu.ISUP__FOT().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__INF: + { + pdu.ISUP__INF().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__INR: + { + pdu.ISUP__INR().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__IAM: + { + pdu.ISUP__IAM().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__LPA: + { + pdu.ISUP__LPA().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__REL: + { + pdu.ISUP__REL().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__RLC: + { + pdu.ISUP__RLC().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__RSC: + { + pdu.ISUP__RSC().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__RES: + { + pdu.ISUP__RES().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__SUS: + { + pdu.ISUP__SUS().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__UBL: + { + pdu.ISUP__UBL().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__UBA: + { + pdu.ISUP__UBA().cic() = OMIT_VALUE; break; + } + case PDU__ISUP::ALT_ISUP__UCIC: + { + pdu.ISUP__UCIC().cic() = OMIT_VALUE; break; + } + default: + break; + } + + + if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) { + TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC); + TTCN_Logger::log_event_str("dec_PDU_ISUP_backtrack_noCIC(): Decoded @ISUP_Types.PDU_ISUP: "); + pdu.log(); + TTCN_Logger::end_event(); + } + + if (ttcn_buffer.get_pos() < ttcn_buffer.get_len() && TTCN_Logger::log_this_event(TTCN_WARNING)) { + ttcn_buffer.cut(); + OCTETSTRING remaining_stream; + ttcn_buffer.get_string(remaining_stream); + TTCN_Logger::begin_event(TTCN_WARNING); + TTCN_Logger::log_event_str("dec_PDU_ISUP_backtrack(): Warning: Data remained at the end of the stream after successful decoding: "); + remaining_stream.log(); + TTCN_Logger::end_event(); + } + return 0; + } else return 1; +} + +}//namespace diff --git a/ISUP_Q.762_CNL113365_LATEST/src/ISUP_Q.762_CNL113365.grp b/ISUP_Q.762_CNL113365_LATEST/src/ISUP_Q.762_CNL113365.grp new file mode 100644 index 00000000..828a298f --- /dev/null +++ b/ISUP_Q.762_CNL113365_LATEST/src/ISUP_Q.762_CNL113365.grp @@ -0,0 +1,26 @@ +<!-- +/////////////////////////////////////////////////////////////////////////////// +// +// 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: ISUP_Q.762_CNL113365.grp +// Rev: R7D +// Prodnr: CNL 113 365 +// Updated: 2012-11-08 +// Contact: http://ttcn.ericsson.se +/////////////////////////////////////////////////////////////////////////////// +--> + +<!DOCTYPE TITAN_GUI_FileGroup_file> +<FileGroup TITAN_version="2.2.pl0" > + <File_Group name="ISUP_Q.762_CNL113365" > + <File path="ISUP_EncDec.cc" /> + <File path="ISUP_Types.ttcn" /> + </File_Group> +</FileGroup> diff --git a/ISUP_Q.762_CNL113365_LATEST/src/ISUP_Types.ttcn b/ISUP_Q.762_CNL113365_LATEST/src/ISUP_Types.ttcn new file mode 100644 index 00000000..26f794bc --- /dev/null +++ b/ISUP_Q.762_CNL113365_LATEST/src/ISUP_Types.ttcn @@ -0,0 +1,4092 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright Test Competence Center (TCC) ETH 2011 +// // +// 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: ISUP_Types.ttcn +// Rev: R7D +// Prodnr: CNL 113 365 +// Updated: 2011-05-10 +// Contact: http://ttcn.ericsson.se +/////////////////////////////////////////////////////////////////////////////// +// +// This product is based on the following documents: +//************************************************************************ +// Ericsson Reference for ITU-T : 2/155 17-FAY 112 020/4 Uen, ITU-T ISDN User +// Part, Section A:Formats and Codes +// Standard ITU-T Reference ISUP : Q.763, Signaling System No. 7 - ISDN User +// Part formats and codes +//************************************************************************ +// EED/X 1056-174 Uen - Global Call reference for ISUP and BICC, MSC R12 + +/////////////////////////////////////////////////////////////////////////////// +// ! ! ! ! ! ! ! W A R N I N G ! ! ! ! ! ! ! // +// From R2A02 the parameters are in 'set' and not in 'set of'. It has the // +// consequence, that the parameters will be sent out in fix order (as defined// +// in set) so the tester cannot modify the order of the parameters with // +// modification the order in the template. If the order is important, then // +// the previous version of this protocol module should be used. // +/////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------- +//---------------------------------------------------------- +//The following modification were done from R1A03 to R2A02: +//---------------------------------------------------------- +//---------------------------------------------------------- +// New parameter: +//Calling_name_identity +//Global_call_reference +//------------------------------------------------- +// Modified parameter: +//Calling_geodetic_location: Polygon updated +//CCSS_parameter : replaces CCBS_parameter +//Charged_party_identification : converted into record +//Forward_GVNS: TNRN_Spare->BIT1, lengths->INT4b, RAW coding attributes +//Loop_prevention_indicators : field splitted +//Message_compatibility_information: field name updated +//Network_routing_number: incorrect fields +//Network_specific_facility : was not possible to decode +//Optional_backward_call_indicators: field name updated +//Pivot_counter: PivCount->BIT5 +//Pivot_routing_backward_information : converted into record +//Pivot_routing_forward_information : converted into record +//Redirect_backward_information : converted into record +//Redirect_forward_information : converted into record +//Redirecting_number : field name updated +//Redirection_information : optional keywords added +//Tariff_indicator : optional keywords added +//User_service_information: redesigned +//User_service_information_prime: redesigned +//User_teleservice_information : optional keywords added +//------------------------------------------------- +// Hexorder modified in parameter: +//Call_transfer_number +//Called_IN_number +//Called_directory_number +//Called_party_number +//Calling_party_number +//Connected_number +//Forward_GVNS +//Generic_number +//HTR_information +//Location_number +//Network_routing_number +//Original_called_number +//Original_called_IN_number +//Redirecting_number +//Redirection_number +//Subsequent_number +//------------------------------------------------- +// Parameter, which should be modified, but due to backward compatibility +// it is not modified: +//Parameter_compatibility_information +//------------------------------------------------- +//"set of" was changed to "set" with the following consequence in parameter: +//-Every optional parameter is extended the id and length. +//-The multiple parameters are put into a set with name <parameter_name>_set +//-The optional parameters of the messages are put into set where every field +// is optional. +//-For mandatory fix long parameters new type is created via removing id and +// length +//-For mandatory variable long parameters new type is created via removing id +//-For parameters which can be also mandatory and optional, the end of name of +// the optional version is extended with an _OPT + +module ISUP_Types +{ + import from General_Types all; + + external function enc_PDU_ISUP(in PDU_ISUP pdu) return octetstring; + external function dec_PDU_ISUP(in octetstring stream) return PDU_ISUP; + external function dec_PDU_ISUP_noCIC(in octetstring stream) return PDU_ISUP; + external function enc_PDU_ISUP_fast(in PDU_ISUP pdu, out octetstring stream) + with { extension "prototype(fast) encode(RAW)" }; + external function dec_PDU_ISUP_backtrack(in octetstring stream, out PDU_ISUP pdu) return integer + with { extension "prototype(backtrack) decode(RAW)" }; + external function dec_PDU_ISUP_backtrack_noCIC(in octetstring stream, out PDU_ISUP pdu) return integer; + +//************************************************************************ +// ISUP parameters +//************************************************************************ +group ISUP_parameters +{ + +//************************************************************************ +// Circuit Identification Code +// Ericsson Specification Reference: Chapter 2.1.3 +// Standard Reference ISUP : Chapter 1.2 +//************************************************************************ + type record Circuit_identification_code + { + BIT12 CIC, // Circuit identification code + BIT4 Spare // Spare + } with { variant "" }; + + +//************************************************************************ +// Message Type +// Ericsson Specification Reference: Chapter 2.1.3 +// Standard Reference ISUP : Chapter 1.3 +//************************************************************************ + type bitstring ISUP_Message_type length(8) + with { variant "FIELDLENGTH(8)" }; + + +//************************************************************************ +// Pointer +// Ericsson Specification Reference: Chapter 2.1.7 +// Standard Reference ISUP : Chapter 1.9 +//************************************************************************ + type integer Pointer (0..255) + with { variant "FIELDLENGTH(8)" }; + + +//************************************************************************ +// End Of Optional Parameters Indicator +// Ericsson Specification Reference: Chapter 2.3.3.30 +// Standard Reference ISUP : Chapter 3.20 +//************************************************************************ + type octetstring End_of_optional_parameters_indicator length(1) + with { variant "FIELDLENGTH(1)" }; + + +//************************************************************************ +// Access Delivery Information +// Ericsson Specification Reference: Chapter 2.3.3.1 +// Standard Reference ISUP : Chapter 3.2 +//************************************************************************ + type record Access_delivery_information // 3.2 / Q.763 + { + BIT8 id, + INT1 lengthField, + + BIT1 AccessDel, // Access delivery indicator + BIT7 Spare // Spare + } with { variant "PRESENCE( id = '00101110'B)"; + variant (lengthField)"LENGTHTO(AccessDel,Spare)"; + }; + + +//************************************************************************ +// Access Transport +// Ericsson Specification Reference: Chapter 2.3.3.2 +// Standard Reference ISUP : Chapter 3.3 +//************************************************************************ + type record Access_transport + { + BIT8 id, + INT1 lengthField, + + OCTN ATP_field + } with { variant "PRESENCE( id = '00000011'B)"; + variant (lengthField)"LENGTHTO(ATP_field)"; + }; + + +//************************************************************************ +// Additional Charging Information +// Ericsson Specification Reference: Chapter 2.3.3.3 +//************************************************************************ + type record Additional_charging_information + { + BIT8 id, + INT1 lengthField, + + BIT8 AddChargeInfo // Additional charging information + } with { variant "PRESENCE( id = '11111010'B)"; + variant (lengthField)"LENGTHTO(AddChargeInfo)"; + }; + + +//************************************************************************ +// Additional Routing Information +// Ericsson Specification Reference: Chapter 2.3.3.4 +//************************************************************************ + type record Additional_routing_information + { + BIT8 id, + INT1 lengthField, + + OCT2 AddRoutInfo // Additional routing information + } with { variant "PRESENCE( id = '11111011'B)"; + variant (lengthField)"LENGTHTO(AddRoutInfo)"; + }; + + +//************************************************************************ +// Application Transport Parameter +// Standard Reference ISUP : Chapter 3.82 +//************************************************************************ + type record Application_transport_parameter + { + BIT8 id, + INT1 lengthField, + + BIT7 applicationContextIdOct1, // Application context identifier + BIT1 extInd1, // Extension indicator + BIT7 applicationContextIdOct1a optional, // Application context identifier + BIT1 extInd1a optional, // Extension indicator + BIT1 releaseCallInd, // Release call indicator + BIT1 sendNotificationInd, // Send notification indicator + BIT5 spare, // Spare + BIT1 extInd2, // Extension indicator + BIT6 aPMSegmentationInd, // APM segmentation indicator + BIT1 sequenceInd, // Sequence indicator + BIT1 extInd3, // Extension indicator + BIT7 segmentationLocalRef optional, // Segmentation local reference + BIT1 extInd3a optional, // Extension indicator + OCTN aPMUserInfo // Encapsulated application information + } with { variant "EXTENSION_BIT_GROUP (yes, applicationContextIdOct1, + extInd1a)"; + variant "EXTENSION_BIT_GROUP (yes, aPMSegmentationInd, + extInd3a)"; + variant "PRESENCE( id = '01111000'B)"; + variant (lengthField)"LENGTHTO(applicationContextIdOct1,extInd1, + applicationContextIdOct1a,extInd1a, + releaseCallInd,sendNotificationInd, + spare,extInd2,aPMSegmentationInd, + sequenceInd,extInd3, + segmentationLocalRef,extInd3a, + aPMUserInfo)"; + }; + + type set of Application_transport_parameter + Application_transport_parameter_set + with { variant "" }; + + +//************************************************************************ +// Automatic Congestion Level +// Ericsson Specification Reference: Chapter 2.3.3.5 +// Standard Reference ISUP : Chapter 3.4 +//************************************************************************ + type record Automatic_congestion_level + { + BIT8 id, + INT1 lengthField, + + BIT8 CongLevel + } with { variant "PRESENCE( id = '00100111'B)"; + variant (lengthField)"LENGTHTO(CongLevel)"; + }; + + +//************************************************************************ +// Backward Call Indicators +// Ericsson Specification Reference: Chapter 2.3.3.6 +// Standard Reference ISUP : Chapter 3.5 +//************************************************************************ + type record Backward_call_indicators_OPT + { + BIT8 id, + INT1 lengthField, + + BIT2 ChargeInd, // Charge indicator + BIT2 CalledPartyStatusInd, // Called party's status indicator + BIT2 CalledPartyCatInd, // Called party's category indicator + BIT2 EndToEndInd, // End-to-end method indicator + BIT1 InterworkingInd, // Interworking indicator + BIT1 EndToEndInfoInd, // End-to-end INFormation indicator + BIT1 ISUPInd, // ISDN User Part indicator + BIT1 HoldingInd, // Holding indicator + BIT1 ISDNAccessInd, // ISDN access indicator + BIT1 EchoControlDevInd, // Echo CONtrol device indicator + BIT2 SCCPMethodInd // SCCP method indicator + } with { variant "PRESENCE( id = '00010001'B)"; + variant (lengthField)"LENGTHTO(ChargeInd,CalledPartyStatusInd, + CalledPartyCatInd,EndToEndInd, + InterworkingInd,EndToEndInfoInd, + ISUPInd,HoldingInd,ISDNAccessInd, + EchoControlDevInd,SCCPMethodInd)"; + }; + + type record Backward_call_indicators + { + BIT2 ChargeInd, // Charge indicator + BIT2 CalledPartyStatusInd, // Called party's status indicator + BIT2 CalledPartyCatInd, // Called party's category indicator + BIT2 EndToEndInd, // End-to-end method indicator + BIT1 InterworkingInd, // Interworking indicator + BIT1 EndToEndInfoInd, // End-to-end INFormation indicator + BIT1 ISUPInd, // ISDN User Part indicator + BIT1 HoldingInd, // Holding indicator + BIT1 ISDNAccessInd, // ISDN access indicator + BIT1 EchoControlDevInd, // Echo CONtrol device indicator + BIT2 SCCPMethodInd // SCCP method indicator + } with { variant ""}; + +//************************************************************************ +// Backward GVNS +// Ericsson Specification Reference: Chapter 2.3.3.7 +// Standard Reference ISUP : Chapter 3.62 +//************************************************************************ + type record Backward_GVNS + { + BIT8 id, + INT1 lengthField, + + BIT2 TerminatingAccessInd, // Terminating access indicator + BIT5 Spare, // Spare + BIT1 ExtensionInd // Extension indicator + } with { variant "PRESENCE( id = '01001101'B)"; + variant (lengthField)"LENGTHTO(TerminatingAccessInd,Spare, + ExtensionInd)"; + }; + + +//************************************************************************ +// Call Diversion Information +// Ericsson Specification Reference: Chapter 2.3.3.8 +// Standard Reference ISUP : Chapter 3.6 +//************************************************************************ + type record Call_diversion_information + { + BIT8 id, + INT1 lengthField, + + BIT3 NotificationSubscriptionOptions, // Notification subscription options + BIT4 RedirectionReason, // Redirecting reason + BIT1 Spare // Spare + } with { variant "PRESENCE( id = '00110110'B)"; + variant (lengthField)"LENGTHTO(NotificationSubscriptionOptions, + RedirectionReason,Spare)"; + }; + + +//************************************************************************ +// Call Diversion Treatment Information +// Ericsson Specification Reference: Chapter 2.3.3.9 +// Standard Reference ISUP : Chapter 3.72 +//************************************************************************ + type record Call_diversion_treatment_indicators + { + BIT8 id, + INT1 lengthField, + + BIT2 CallDivertedInd, // Call to be diverted indicator + BIT5 Spare, // Spare + BIT1 ExtensionInd // Extension indicator + } with { variant "PRESENCE( id = '01101110'B)"; + variant(lengthField)"LENGTHTO(CallDivertedInd,Spare,ExtensionInd)"; + }; + + +//************************************************************************ +// Call History Information +// Ericsson Specification Reference: Chapter 2.3.3.10 +// Standard Reference ISUP : Chapter 3.7 +//************************************************************************ + type record Call_history_information + { + BIT8 id, + INT1 lengthField, + + OCT2 PropagatDelayValue + } with { variant "PRESENCE( id = '00101101'B)"; + variant (lengthField)"LENGTHTO(PropagatDelayValue)"; + }; + + +//************************************************************************ +// Call Offering Treatment Indicators +// Ericsson Specification Reference: Chapter 2.3.3.11 +// Standard Reference ISUP : Chapter 3.74 +//************************************************************************ + type record Call_offering_treatment_indicators + { + BIT8 id, + INT1 lengthField, + + BIT2 CallOfferedInd, // Call to be offered indicator + BIT5 Spare, // Spare + BIT1 ExtensionInd // Extension indicator + } with { variant "PRESENCE( id = '01110000'B)"; + variant (lengthField)"LENGTHTO(CallOfferedInd,Spare,ExtensionInd)"; + }; + + +//************************************************************************ +// Call Reference +// Standard Reference ISUP : Chapter 3.8 +//************************************************************************ + type record Call_reference + { + BIT8 id, + INT1 lengthField, + + OCT5 CRef_contents // Call identity + } with { variant "PRESENCE( id = '00000001'B)"; + variant (lengthField)"LENGTHTO(CRef_contents)"; + }; + + +//************************************************************************ +// Call Transfer Number +// Ericsson Specification Reference: Chapter 2.3.3.12 +// Standard Reference ISUP : Chapter 3.64 +//************************************************************************ + type record Call_transfer_number + { + BIT8 id, + INT1 lengthField, + + BIT7 NatureOfAddrInd, // Nature of address indicator + BIT1 OddEven, // Odd/even indicator + BIT2 ScreeningInd, // Screening indicator + BIT2 AddrPresentRestInd, // Address presentation REStricted indicator + BIT3 NumberingPlanInd, // Numbering plan indicator + BIT1 Spare, // Spare + HEX1_32 AddrSignals optional, // Address signals and Filler if odd addr.signals + HEX1 Filler optional + } with { variant (AddrSignals) "HEXORDER(low)"; + variant "PRESENCE( id = '01000101'B)"; + variant (lengthField)"LENGTHTO(NatureOfAddrInd,OddEven, + ScreeningInd,AddrPresentRestInd, + NumberingPlanInd,Spare, + AddrSignals,Filler)"; + }; + + +//************************************************************************ +// Call Transfer Reference +// Ericsson Specification Reference: Chapter 2.3.3.13 +// Standard Reference ISUP : Chapter 3.65 +//************************************************************************ + type record Call_transfer_reference + { + BIT8 id, + INT1 lengthField, + + BIT8 CallTransferId // Call transfer identity + } with { variant "PRESENCE( id = '01000011'B)"; + variant (lengthField)"LENGTHTO(CallTransferId)"; + }; + + +//************************************************************************ +// Call Transfer Treatment Indicators +// Ericsson Specification Reference: Chapter 2.3.3.14 +//************************************************************************ + type record Call_transfer_treatment_indicators + { + BIT8 id, + INT1 lengthField, + + BIT2 CallTransferredInd, // Call to be transferred indicator + BIT5 Spare, // Spare + BIT1 ExtensionInd // Extension indicator + } with { variant "PRESENCE( id = '11110011'B)"; + variant (lengthField)"LENGTHTO(CallTransferredInd,Spare, + ExtensionInd)"; + }; + + +//************************************************************************ +// Called IN Number +// Standard Reference ISUP : Chapter 3.73 +//************************************************************************ + type record Called_IN_number + { + BIT8 id, + INT1 lengthField, + + BIT7 NatureOfAddrInd, // Nature of address indicator + BIT1 OddEven, // Odd/even indicator + BIT2 spare_1, + BIT2 AddrPresentRestInd, // Address presentation REStricted indicator + BIT3 NumberingPlanInd, // Numbering plan indicator + BIT1 spare_2, // Numbering plan indicator + HEX1_32 AddrSignals optional, // Address signals and Filler if odd addr.signals + HEX1 Filler optional + } with { variant (AddrSignals) "HEXORDER(low)"; + variant "PRESENCE( id = '01101111'B)"; + variant (lengthField)"LENGTHTO(NatureOfAddrInd,OddEven, + spare_1,AddrPresentRestInd, + NumberingPlanInd,spare_2, + AddrSignals,Filler)"; + }; + +//************************************************************************ +// Called Directory Number +// Standard Reference ISUP : Chapter 3.86 +//************************************************************************ + type record Called_directory_number + { + BIT8 id, + INT1 lengthField, + + BIT7 NatureOfAddrInd, // Nature of address indicator + BIT1 OddEven, // Odd/even indicator + BIT4 spare, // spare + BIT3 NumberingPlanInd, // Numbering plan indicator + BIT1 INNInd, // Internal network number indicator + HEX1_32 AddrSignals, // Address signals and Filler if odd addr.signals + HEX1 Filler optional + } with { variant (AddrSignals) "HEXORDER(low)"; + variant "PRESENCE( id = '01111101'B)"; + variant (lengthField)"LENGTHTO(NatureOfAddrInd,OddEven, + spare,NumberingPlanInd, + INNInd,AddrSignals,Filler)"; + }; + + + +//************************************************************************ +// Called Party Number +// Ericsson Specification Reference: Chapter 2.3.3.15 +// Standard Reference ISUP : Chapter 3.9 +//************************************************************************ + type record Called_party_number + { + INT1 lengthField, + + BIT7 NatureOfAddrInd, // Nature of address indicator + BIT1 OddEven, // Odd/even indicator + BIT4 Spare, // spare + BIT3 NumberingPlanInd, // Numbering plan indicator + BIT1 INNInd, // Internal network number indicator + HEX1_32 AddrSignals, // Address signals and Filler if odd addr.signals + HEX1 Filler optional + } with { variant (AddrSignals) "HEXORDER(low)"; + variant (lengthField)"LENGTHTO(NatureOfAddrInd,OddEven, + Spare,NumberingPlanInd, + INNInd,AddrSignals,Filler)"; + }; + + +//************************************************************************ +// Calling Geodetic Location +// Standard Reference ISUP : Chapter 3.88 +//************************************************************************ + type record Ellipsoid_point + { + OCT3 DgrLat, // Degrees of latitude with sign + OCT3 DgrLong // Degrees of longitude + } with { variant "" }; + + type record Ellipsoid_point_with_uncertainty + { + OCT3 DgrLat, // Degrees of latitude with sign + OCT3 DgrLong, // Degrees of longitude + BIT7 UncCode, // Uncertainty code + BIT1 spare_1, // Spare + BIT7 Conf, // Confidence + BIT1 spare_2 // Spare + } with { variant "" }; + + type record Point_with_altitude_and_uncertainty + { + OCT3 DgrLat, // Degrees of latitude with sign + OCT3 DgrLong, // Degrees of longitude + BIT7 UncCode_1, // Uncertainty code + BIT1 spare_1, // Spare + OCT2 Alt, // Altitude with sign + BIT7 UncCode_2, // Uncertainty code + BIT1 spare_2, // Spare + BIT7 Conf, // Confidence + BIT1 spare_3 // Spare + } with { variant "" }; + + type record Ellipse_on_the_ellipsoid + { + OCT3 DgrLat, // Degrees of latitude with sign + OCT3 DgrLong, // Degrees of longitude + BIT7 MajRad, // Major radius + BIT1 spare_1, // Spare + BIT7 MinRad, // Minor radius + BIT1 spare_2, // Spare + OCT1 orient, // Orientation + BIT7 Conf, // Confidence + BIT1 spare_3 // Spare + } with { variant "" }; + + type record Ellipsoid_circle_sector + { + OCT3 DgrLat, // Degrees of latitude with sign + OCT3 DgrLong, // Degrees of longitude + BIT7 Rad, // Radius + BIT1 spare_1, // Spare + OCT1 Offset, // Offset + OCT1 IncAng, // Included angle + BIT7 Conf, // Confidence + BIT1 spare_2 // Spare + } with { variant "" }; + + type record Polygon + { + integer NumPoints, // Number of points + BIT4 spare_1, // Spare + DgrLat_longs DgrLat_Longs, // Degrees of latitude / logitude + BIT7 Conf, // Confidence + BIT1 spare_2 // Spare + } with { variant (NumPoints)"LENGTHTO(DgrLat_Longs)"; + variant (NumPoints)"UNIT(elements)"; + variant (NumPoints) "FIELDLENGTH(4)"; + }; + + type record of DgrLat_long DgrLat_longs// Degrees of latitude / logitude + + type record DgrLat_long + { + OCT3 DgrLat, // Degrees of latitude with sign + OCT3 DgrLong // Degrees of longitude + } with { variant "" }; + + type union Shape_description_union + { + Ellipsoid_point EP, + Ellipsoid_point_with_uncertainty EPU, + Point_with_altitude_and_uncertainty PAU, + Ellipse_on_the_ellipsoid EonE, + Ellipsoid_circle_sector ECS, + Polygon Pol + } with { variant "" }; + + type record Calling_geodetic_location + { + BIT8 id, + INT1 lengthField, + + BIT2 Scr, // Screening + BIT2 LPRI, // Location presentation REStricted indicator + BIT4 Spare, // Spare + BIT7 typeSh, // Type of shape + BIT1 ExtI, // Extension indicator + Shape_description_union ShapeDes + } with { variant (ShapeDes) "CROSSTAG( + EP, typeSh = '0000000'B; + EPU, typeSh = '0000001'B; + PAU, typeSh = '0000010'B; + EonE, typeSh = '0000011'B; + ECS, typeSh = '0000100'B; + Pol, typeSh = '0000101'B + )"; + variant "PRESENCE( id = '10000001'B)"; + variant (lengthField)"LENGTHTO(Scr,LPRI,Spare,typeSh,ExtI, + ShapeDes)"; + }; + +//************************************************************************ +// Calling name identity +// Ericsson Specification Reference: Chapter 2.3.3.16 +//************************************************************************ + type record Calling_name_identity + { + BIT8 id, + INT1 lengthField, + + BIT2 namePresentationRestrictedInd, // Name presentation restricted ind. + BIT2 screeningIndicator, // Screening indicator + BIT1 availabilityInd, // Availability indicator + BIT3 typeOfName, // Type of name + BIT8 encodingInd, // Encoding identification + OCT1_50 characterSubfield // Character + } with { variant "PRESENCE( id = '11110010'B)"; + variant (lengthField)"LENGTHTO(namePresentationRestrictedInd, + screeningIndicator,availabilityInd, + typeOfName,encodingInd, + characterSubfield)"; + }; + + +//************************************************************************ +// Calling Party Number +// Ericsson Specification Reference: Chapter 2.3.3.17 +// Standard Reference ISUP : Chapter 3.10 +//************************************************************************ + type record Calling_party_number + { + BIT8 id, + INT1 lengthField, + + BIT7 NatureOfAddrInd, // Nature of address indicator + BIT1 OddEven, // Odd/even indicator + BIT2 ScreeningInd, // Screening indicator + BIT2 AddrPresentRestInd, // Address presentation REStricted indicator + BIT3 NumberingPlanInd, // Numbering plan indicator + BIT1 NIInd, // Calling party number incomplete indicator + HEX1_32 AddrSignals optional, // Address signals and Filler if odd addr.signals + HEX1 Filler optional + } with { variant (AddrSignals) "HEXORDER(low)"; + variant "PRESENCE( id = '00001010'B)"; + variant (lengthField)"LENGTHTO(NatureOfAddrInd,OddEven, + ScreeningInd,AddrPresentRestInd, + NumberingPlanInd,NIInd, + AddrSignals,Filler)"; + }; + +//************************************************************************ +// Calling Party Number +// Ericsson Specification Reference: Chapter 2.3.3.18 +// Standard Reference ISUP : Chapter 3.11 +//************************************************************************ + type record Calling_partys_category_OPT + { + BIT8 id, + INT1 lengthField, + + BIT8 CallingPartysCategory // Calling party's category + } with { variant "PRESENCE( id = '00001001'B)"; + variant (lengthField)"LENGTHTO(CallingPartysCategory)"; + }; + + type record Calling_partys_category + { + BIT8 CallingPartysCategory // Calling party's category + } with { variant "" }; + +//************************************************************************ +// Cause Indicators +// Ericsson Specification Reference: Chapter 2.3.3.19 +// Standard Reference ISUP : Chapter 3.12 +//************************************************************************ + type record Cause_indicators_OPT + { + BIT8 id, + INT1 lengthField, + + BIT4 Location, // Location + BIT1 Spare, // Spare + BIT2 CodingStandard, // Coding standard + BIT1 Ext1, // Extension indicator + BIT7 CauseValue, // Vause value + BIT1 Ext2, // Extension indicator + OCTN Diagnostics optional // Diagnostic(s) (if any) + } with { variant "PRESENCE( id = '00010010'B)"; + variant (lengthField)"LENGTHTO(Location,Spare,CodingStandard, + Ext1,CauseValue, + Ext2,Diagnostics)"; + }; + + type record Cause_indicators + { + INT1 lengthField, + + BIT4 Location, // Location + BIT1 Spare, // Spare + BIT2 CodingStandard, // Coding standard + BIT1 Ext1, // Extension indicator + BIT7 Reserved optional, // National Recommendation + BIT1 Ext1a optional, // Present when Reserved field is present + BIT7 CauseValue, // Vause value + BIT1 Ext2, // Extension indicator + OCTN Diagnostics optional // Diagnostic(s) (if any) + } with { variant (Reserved) "PRESENCE (Ext1='0'B)"; + variant (Ext1a) "PRESENCE (Ext1='0'B)"; + variant (lengthField)"LENGTHTO(Location,Spare,CodingStandard, + Ext1,Reserved,Ext1a,CauseValue, + Ext2,Diagnostics)"; + }; + + +//************************************************************************ +// CCNR Possible Indicator +// Standard Reference ISUP : Chapter 3.83 +//************************************************************************ + type record CCNR_possible_indicator + { + BIT8 id, + INT1 lengthField, + + BIT1 CCNRPInd, // CCNR possible indicator + BIT7 spare // Spare + } with { variant "PRESENCE( id = '01111010'B)"; + variant (lengthField)"LENGTHTO(CCNRPInd,spare)"; + }; + + +//************************************************************************ +// CCSS +// Ericsson Specification Reference: Chapter 2.3.3.20 +// Standard Reference ISUP : Chapter 3.63 +//************************************************************************ + type record CCSS_parameter + { + BIT8 id, + INT1 lengthField, + + BIT1 CCSSCallInd, // CCSS call indicator + BIT7 Spare + } with { variant "PRESENCE( id = '01001011'B)"; + variant (lengthField)"LENGTHTO(CCSSCallInd,Spare)"; + }; + + +//************************************************************************ +// Charged Party Identification +// Standard Reference ISUP : Chapter 3.75 +//************************************************************************ + type record Charged_party_identification + { + BIT8 id, + INT1 lengthField, + + OCTN ChargedPartyId + } with { variant "PRESENCE( id = '01110001'B)"; + variant (lengthField)"LENGTHTO(ChargedPartyId)"; + }; + + +//************************************************************************ +// Circuit Assignment Map +// Standard Reference ISUP : Chapter 3.69 +//************************************************************************ + type record Circuit_assignment_map + { + BIT8 id, + INT1 lengthField, + + BIT6 MapType, // Map type + BIT2 spare_1, // Spare + BIT31 MapFormat, // Map format + BIT1 spare_2 // spare + } with { variant "PRESENCE( id = '00100101'B)"; + variant (lengthField)"LENGTHTO(MapType,spare_1,MapFormat,spare_2)"; + }; + + +//************************************************************************ +// Circuit Group Supervision Message Type Indicator +// Ericsson Specification Reference: Chapter 2.3.3.21 +// Standard Reference ISUP : Chapter 3.13 +//************************************************************************ + type record Circuit_group_supervision_message_type_indicator + { + BIT2 Type, // Type indicator + BIT6 Spare // Spare + } with { variant "" }; + + +//************************************************************************ +// Circuit State Indicator +// Ericsson Specification Reference: Chapter 2.3.3.22 +// Standard Reference ISUP : Chapter 3.14 +//************************************************************************ + type record Circuit_state_indicator + { + INT1 lengthField, + + OCTN CircuitStateIndicator + } with { variant (lengthField)"LENGTHTO(CircuitStateIndicator)"; + }; + + +//************************************************************************ +// Closed User Group Interlock Code +// Ericsson Specification Reference: Chapter 2.3.3.23 +// Standard Reference ISUP : Chapter 3.15 +//************************************************************************ +// The contents of this parameter are not subdivided because values +//are easy to give as hexnumbers. + type record Closed_user_group_interlock_code + { + BIT8 id, + INT1 lengthField, + + OCT4 CUGIC_contents // CUGIC + } with { variant "PRESENCE( id = '00011010'B)"; + variant (lengthField)"LENGTHTO(CUGIC_contents)"; + }; + + +//************************************************************************ +// Collect Call Request +// Standard Reference ISUP : Chapter 3.81 +//************************************************************************ + type record Collect_call_request + { + BIT8 id, + INT1 lengthField, + + BIT1 CCReqInd, // Collect call request indicator + BIT7 spare // Spare + } with { variant "PRESENCE( id = '01111001'B)"; + variant (lengthField)"LENGTHTO(CCReqInd,spare)"; + }; + + +//************************************************************************ +// Conference Treatment Indicators +// Ericsson Specification Reference: Chapter 2.3.3.24 +// Standard Reference ISUP : Chapter 3.76 +//************************************************************************ + type record Conference_treatment_indicators + { + BIT8 id, + INT1 lengthField, + + BIT2 ConfAcceptanceInd, // Conference acceptance indicator + BIT5 Spare, // Spare + BIT1 ExtensionInd // Extension indicator + } with { variant "PRESENCE( id = '01110010'B)"; + variant (lengthField)"LENGTHTO(ConfAcceptanceInd,Spare, + ExtensionInd)"; + }; + + +//************************************************************************ +// Connected Number +// Ericsson Specification Reference: Chapter 2.3.3.25 +// Standard Reference ISUP : Chapter 3.16 +//************************************************************************ + type record Connected_number + { + BIT8 id, + INT1 lengthField, + + BIT7 NatureOfAddrInd, // Nature of address indicators + BIT1 OddEven, // Odd/even indicator + BIT2 ScreeningInd, // Screening indicator + BIT2 AddrPresentRestInd, // Address presentation REStriction indicator + BIT3 NumberingPlanInd, // Numbering plan indicator + BIT1 Spare, // Spare + HEX1_32 AddrSignals optional, // Address signals and Filler if odd addr.signals + HEX1 Filler optional + } with { variant (AddrSignals) "HEXORDER(low)"; + variant "PRESENCE( id = '00100001'B)"; + variant (lengthField)"LENGTHTO(NatureOfAddrInd,OddEven, + ScreeningInd,AddrPresentRestInd, + NumberingPlanInd,Spare, + AddrSignals,Filler)"; + }; + +//************************************************************************ +// Connection Request +// Standard Reference ISUP : Chapter 3.17 +//************************************************************************ + type record Connection_request + { + BIT8 id, + INT1 lengthField, + + OCT3 LocRef, // Local reference + OCT2 SPC_contents, // Signalling point code + BIT8 PC, // Protocol class + BIT8 credit // Credit + } with { variant "PRESENCE( id = '00001101'B)"; + variant (lengthField)"LENGTHTO(LocRef,SPC_contents,PC,credit)"; + }; + + +//************************************************************************ +// Continuity Indicators +// Ericsson Specification Reference: Chapter 2.3.3.26 +// Standard Reference ISUP : Chapter 3.18 +//************************************************************************ + type record Continuity_indicators + { + BIT1 ContInd_field, // Continuity indicator + BIT7 Spare // Spare + } with { variant "" }; + + +//************************************************************************ +// Correlation Id +// Ericsson Specification Reference: Chapter 2.3.3.27 +// Standard Reference ISUP : Chapter 3.70 +//************************************************************************ + type record Correlation_id + { + BIT8 id, + INT1 lengthField, + + OCTN CorrelationId + } with { variant "PRESENCE( id = '01100101'B)"; + variant (lengthField)"LENGTHTO(CorrelationId)"; + }; + + +//************************************************************************ +// Display Information +// Ericsson Specification Reference: Chapter 2.3.3.28 +// Standard Reference ISUP : Chapter 3.77 +//************************************************************************ + type record Display_information + { + BIT8 id, + INT1 lengthField, + + OCTN DisplayInfo + } with { variant "PRESENCE( id = '01110011'B)"; + variant (lengthField)"LENGTHTO(DisplayInfo)"; + }; + + +//************************************************************************ +// Distributed Dynamic Routing Indicators +// Ericsson Specification Reference: Chapter 2.3.3.29 +//************************************************************************ + type record Distributed_dynamic_routing_indicators + { + BIT8 id, + INT1 lengthField, + + BIT1 AutoReroutingInd, // Automatic re-routing indicator + BIT1 EventDepRoutingInd, // Event dependent routing indicator + BIT6 Spare // Spare + } with { variant "PRESENCE( id = '11111000'B)"; + variant (lengthField)"LENGTHTO(AutoReroutingInd,EventDepRoutingInd, + Spare)"; + }; + + +//************************************************************************ +// Echo Control Information +// Standard Reference ISUP : Chapter 3.19 +//************************************************************************ + type record Echo_control_information + { + BIT8 id, + INT1 lengthField, + + BIT2 OEchoRsI, // Outgoing echo CONtrol device INFormation indicator + BIT2 IEchoRsI, // Incoming echo CONtrol device INFormation indicator + BIT2 OEchoRqI, // Outgoing echo CONtrol device request indicator + BIT2 IEchoRqI // Incoming echo CONtrol device request indicator + } with { variant "PRESENCE( id = '00110111'B)"; + variant (lengthField)"LENGTHTO(OEchoRsI,IEchoRsI,OEchoRqI, + IEchoRqI)"; + }; + + +//************************************************************************ +// Event Information +// Ericsson Specification Reference: Chapter 2.3.3.31 +// Standard Reference ISUP : Chapter 3.21 +//************************************************************************ + type record Event_information + { + BIT7 EventInd, // Event indicator + BIT1 EventPresentRestrInd // Event presentation retriction indicator + } with { variant ""}; + + +//************************************************************************ +// Facility Indicator +// Ericsson Specification Reference: Chapter 2.3.3.32 +// Standard Reference ISUP : Chapter 3.22 +//************************************************************************ + type record Facility_indicator + { + OCT1 FacilityInd // Facility indicator + } with { variant "" }; + + +//************************************************************************ +// Forward Call Indicators +// Ericsson Specification Reference: Chapter 2.3.3.33 +// Standard Reference ISUP : Chapter 3.23 +//************************************************************************ + type record Forward_call_indicators + { + BIT1 NatIntCallInd, // National/international call indicator + BIT2 EndToEndMethInd, // End-to-end method indicator + BIT1 InterworkInd, // Interworking indicator + BIT1 EndToEndInfoInd, // End-to-end INFormation indicator + BIT1 ISUPInd, // ISDN User Part indicator + BIT2 ISUPPreferenceInd, // ISDN User Part preference indicator + BIT1 ISDNAccessInd, // ISDN access indicator + BIT2 SCCPMethodInd, // SCCP method indicator + BIT1 Spare, // Spare + BIT2 Reserved, // Reserved + BIT2 VPNCallInd // VPN call indicator (national use) + } with { variant "" }; + + +//************************************************************************ +// Forward GVNS +// Ericsson Specification Reference: Chapter 2.3.3.34 +// Standard Reference ISUP : Chapter 3.66 +//************************************************************************ + type record Forward_GVNS + { + BIT8 id, + INT1 lengthField, + + INT4b OPSP_Len, // OPSP length indicator + BIT3 OPSP_Spare, // Spare + BIT1 OPSP_OddEven, // Odd/even indicator + HEX1_32 OPSP_AddSign optional, // Digits and Filler if odd digits + HEX1 OPSP_Filler optional, + INT4b GUG_Len, // GUG length indicator + BIT3 GUG_Spare, // Spare + BIT1 GUG_OddEven, // Odd/even indicator + HEX1_32 GUG_AddSign optional, // Digits and Filler if odd digits + HEX1 GUG_Filler optional, + INT4b TNRN_Len, // TNRN length indicator + BIT3 TNRN_NumPlanInd, // Numbering plan indicator + BIT1 TNRN_OddEven, // Odd/even indicator + BIT7 TNRN_NatOfAddInd optional, // Nature of address indicator + BIT1 TNRN_Spare optional, // Spare + HEX1_32 TNRN_AddSign optional, // Digits and Filler if odd digits + HEX1 TNRN_Filler optional + } with { variant (OPSP_Len) "LENGTHTO(OPSP_AddSign,OPSP_Filler)"; + variant (GUG_Len) "LENGTHTO(GUG_AddSign,GUG_Filler)"; + variant (TNRN_Len) "LENGTHTO(TNRN_NatOfAddInd,TNRN_Spare, + TNRN_AddSign,TNRN_Filler)"; + variant (OPSP_AddSign) "HEXORDER(low)"; + variant (GUG_AddSign) "HEXORDER(low)"; + variant (TNRN_AddSign) "HEXORDER(low)"; + variant "PRESENCE( id = '01001100'B)"; + variant (lengthField)"LENGTHTO(OPSP_Len,OPSP_Spare,OPSP_OddEven, + OPSP_AddSign,OPSP_Filler,GUG_Len, + GUG_Spare,GUG_OddEven,GUG_AddSign, + GUG_Filler,TNRN_Len,TNRN_NumPlanInd, + TNRN_OddEven,TNRN_NatOfAddInd, + TNRN_Spare,TNRN_AddSign, + TNRN_Filler)"; + }; + + +//************************************************************************ +// Freephone Indicators +// Ericsson Specification Reference: Chapter 2.3.3.35 +//************************************************************************ + type record Freephone_indicators + { + BIT8 id, + INT1 lengthField, + + BIT1 FreephoneInd, // Freephone indicator + BIT7 Spare // Spare + } with { variant "PRESENCE( id = '01000001'B)"; + variant (lengthField)"LENGTHTO(FreephoneInd,Spare)"; + }; + + +//************************************************************************ +// Generic Digits +// Ericsson Specification Reference: Chapter 2.3.3.36 +// Standard Reference ISUP : Chapter 3.24 +//************************************************************************ + type record Generic_digits + { + BIT8 id, + INT1 lengthField, + + BIT5 TypeOfDigits, // Type of digits + BIT3 EncodingScheme, // Encoding scheme + HEX1_32 Digits // Digits + } with { variant "PRESENCE( id = '11000001'B)"; + variant (lengthField)"LENGTHTO(TypeOfDigits,EncodingScheme, + Digits)"; + }; + + type set of Generic_digits Generic_digits_set + with { variant "" }; + + +//************************************************************************ +// Generic Notification Indicator +// Ericsson Specification Reference: Chapter 2.3.3.37 +// Standard Reference ISUP : Chapter 3.25 +//************************************************************************ + type record Generic_notification_indicator + { + BIT8 id, + INT1 lengthField, + + BIT7 NotificationInd, // Notification indicator + BIT1 ExtInd // Extension indicator + } with { variant "PRESENCE( id = '00101100'B)"; + variant (lengthField)"LENGTHTO(NotificationInd,ExtInd)"; + }; + + type set of Generic_notification_indicator + Generic_notification_indicator_set + with { variant "" }; + + +//************************************************************************ +// Generic Number +// Ericsson Specification Reference: Chapter 2.3.3.38 +// Standard Reference ISUP : Chapter 3.26 +//************************************************************************ + type record Generic_number + { + BIT8 id, + INT1 lengthField, + + BIT8 NumQualifier, // Number qualifier indicator + BIT7 NatureOfAddrInd, // Nature of address indicator + BIT1 Odd_Even, // Odd/even indicator + BIT2 ScreeningInd, // Screening indicator + BIT2 AddrPresentRestInd, // Address presesntation REStricted indicator + BIT3 NumberingPlanInd, // Numbering plan indicator + BIT1 NIInd, // Number incomplete indicator + HEX1_32 AddrSignals optional, // Address signals and Filler if odd addr.signals + HEX1 Filler optional + } with { variant (AddrSignals) "HEXORDER(low)"; + variant "PRESENCE( id = '11000000'B)"; + variant (lengthField)"LENGTHTO(NumQualifier,NatureOfAddrInd, + Odd_Even,ScreeningInd, + AddrPresentRestInd,NumberingPlanInd, + NIInd,AddrSignals,Filler)"; + }; + + type set of Generic_number Generic_number_set + with { variant "" }; + + + //************************************************************************ +// HTR Information +// Standard Reference ISUP : Chapter 3.89 +//************************************************************************ + type record HTR_information + { + BIT8 id, + INT1 lengthField, + + BIT7 NatureOfAddrInd, // Nature of address indicator + BIT1 OddEven, // Odd/even indicator + BIT4 spare_1, // Spare + BIT3 NumberingPlanInd, // Numbering plan indicator + BIT1 spare_2, // Spare + HEX1_32 AddrSignals, // Address signals and Filler if odd addr.signals + HEX1 Filler optional + } with { variant (AddrSignals) "HEXORDER(low)"; + variant "PRESENCE( id = '10000010'B)"; + variant (lengthField)"LENGTHTO(NatureOfAddrInd,OddEven,spare_1, + NumberingPlanInd,spare_2, + AddrSignals,Filler)"; + }; + +//************************************************************************ +// Hop Counter +// Ericsson Specification Reference: Chapter 2.3.3.39 +// Standard Reference ISUP : Chapter 3.80 +//************************************************************************ + type record Hop_counter + { + BIT8 id, + INT1 lengthField, + + BIT5 HopCount, // Hop counter + BIT3 spare // Spare + } with { variant "PRESENCE( id = '00111101'B)"; + variant (lengthField)"LENGTHTO(HopCount,spare)"; + }; + + +//************************************************************************ +// Information Indicators +// Ericsson Specification Reference: Chapter 2.3.3.40 +// Standard Reference ISUP : Chapter 3.28 +//************************************************************************ + type record Information_indicators + { + BIT2 CallingPartyAddrRespInd, // Calling party address RESponse indicator + BIT1 HoldProvidedInd, // Hold provided indicator + BIT2 Spare1, // Spare + BIT1 CallingPartyCatRespInd, // Calling party's category RESponse ind. + BIT1 Reserved1, // Reserved + BIT1 SolicitedInfoInd, // Solicited INFormation indicator + BIT4 Spare2, // Spare + BIT4 Reserved2 // Reserved 2 + } with { variant "" }; + + +//************************************************************************ +// Information Request Indicators +// Ericsson Specification Reference: Chapter 2.3.3.41 +// Standard Reference ISUP : Chapter 3.29 +//************************************************************************ + type record Information_request_indicators + { + BIT1 CallingPartyAddrRequestInd,// Calling party address request ind. + BIT1 HoldingInd_or_Spare, // Holding indicator + BIT1 Spare1, // Spare + BIT1 CallingPartyCatRequestInd, // Calling party's category request ind. + BIT1 Reserved1, // Charge INFormation request ind. + BIT2 Spare2, // Spare + BIT1 MCIDReqInd_or_Spare, // Malicious call identification request ind. + BIT4 Spare3, // Spare + BIT4 Reserved2 // Reserved + } with { variant "" }; + + +//************************************************************************ +// Location Number +// Ericsson Specification Reference: Chapter 2.3.3.42 +// Standard Reference ISUP : Chapter 3.30 +//************************************************************************ + type record Location_number + { + BIT8 id, + INT1 lengthField, + + BIT7 NatureOfAddrInd, // Nature of address indicator + BIT1 OddEven, // Odd/Even indicator + BIT2 ScreeningInd, // Screening indicator + BIT2 AddrPresentRestInd, // Address presentation REStricted indicator + BIT3 NumberingPlanInd, // Numbering plan indicator + BIT1 INNInd, // Internal network number indicator + HEX1_32 AddrSignals optional, // Address signals and Filler if odd addr.signals + HEX1 Filler optional + } with { variant (AddrSignals) "HEXORDER(low)"; + variant "PRESENCE( id = '00111111'B)"; + variant (lengthField)"LENGTHTO(NatureOfAddrInd,OddEven, + ScreeningInd,AddrPresentRestInd, + NumberingPlanInd,INNInd, + AddrSignals,Filler)"; + }; + +//************************************************************************ +// Loop Prevention Indicators +// Ericsson Specification Reference: Chapter 2.3.3.43 +// Standard Reference ISUP : Chapter 3.67 +//************************************************************************ + type record Loop_prevention_indicators + { + BIT8 id, + INT1 lengthField, + + BIT1 Type, // Type + BIT2 ResponseInd_or_Spare, // Response indicator or Spare + BIT5 Spare + } with { variant "PRESENCE( id = '01000100'B)"; + variant (lengthField)"LENGTHTO(Type,ResponseInd_or_Spare,Spare)"; + }; + +//************************************************************************ +// MCID Request Indicators +// Ericsson Specification Reference: Chapter 2.3.3.44 +// Standard Reference ISUP : Chapter 3.31 +//************************************************************************ + type record MCID_request_indicators + { + BIT8 id, + INT1 lengthField, + + BIT1 MCIDReqInd, // MCID request indicator + BIT1 HoldingInd, // Holding indicator + BIT6 Spare // Spare + } with { variant "PRESENCE( id = '00111011'B)"; + variant (lengthField)"LENGTHTO(MCIDReqInd,HoldingInd,Spare)"; + }; + + +//************************************************************************ +// MCID Response Indicators +// Ericsson Specification Reference: Chapter 2.3.3.45 +// Standard Reference ISUP : Chapter 3.32 +//************************************************************************ + type record MCID_response_indicators + { + BIT8 id, + INT1 lengthField, + + BIT1 MCIDRespInd, // MCID RESponse indicator + BIT1 HoldingProvInd, // Hold provided indicator + BIT6 Spare // Spare + } with { variant "PRESENCE( id = '00111100'B)"; + variant (lengthField)"LENGTHTO(MCIDRespInd,HoldingProvInd,Spare)"; + }; + + +//************************************************************************ +// Message Compatibility Information +// Ericsson Specification Reference: Chapter 2.3.3.46 +// Standard Reference ISUP : Chapter 3.33 +//************************************************************************ + type record Message_compatibility_information + { + BIT8 id, + INT1 lengthField, + + BIT1 TransitIntermedExchInd, // Transit at intermediate exchange ind. + BIT1 ReleaseCallInd, // Release call indicator + BIT1 SendNotificationInd, // Send notification indicator + BIT1 DiscardMessageInd, // Discard message indicator + BIT1 PassOnNotPossibleInd, // Pass on not possible indicator + BIT2 BroadNarrowbandIwInd, // Broadband/narrowband interworking ind. + BIT1 ExtInd1, // Extension indicator + OCTN Spare2 optional + } with { variant "EXTENSION_BIT_GROUP (yes,TransitIntermedExchInd,Spare2)"; + variant "PRESENCE( id = '00111000'B)"; + variant (lengthField)"LENGTHTO(TransitIntermedExchInd, + ReleaseCallInd,SendNotificationInd, + DiscardMessageInd, + PassOnNotPossibleInd, + BroadNarrowbandIwInd, + ExtInd1,Spare2)"; + }; + + + + +//************************************************************************ +// Meter Pulse Indicator +// Ericsson Specification Reference: Chapter 2.3.3.47 +//************************************************************************ + type record Meter_pulse_indicator + { + BIT8 id, + INT1 lengthField, + + OCT1 MeterPulse, // Meter pulse indicator + OCT1 Reserved // Reserved + } with { variant "PRESENCE( id = '11111110'B)"; + variant (lengthField)"LENGTHTO(MeterPulse,Reserved)"; + }; + +//************************************************************************ +// MLPP Precedence +// Ericsson Specification Reference: Chapter 2.3.3.48 +// Standard Reference ISUP : Chapter 3.34 +//************************************************************************ + type record MLPP_precedence + { + BIT8 id, + INT1 lengthField, + + BIT4 PreLev, // Precedence level + BIT1 spare_1, // Spare + BIT2 LFB, // Look ahead for busy + BIT1 spare_2, // Spare + OCT2 NI, // Network identity + OCT3 ServDom // MLPP service domain + } with { variant "PRESENCE( id = '00111010'B)"; + variant (lengthField)"LENGTHTO(PreLev,spare_1,LFB,spare_2,NI, + ServDom)"; + }; + + +//************************************************************************ +// Nature Of Connection Indicators +// Ericsson Specification Reference: Chapter 2.3.3.49 +// Standard Reference ISUP : Chapter 3.35 +//************************************************************************ + type record Nature_of_connection_indicators + { + BIT2 SatelliteInd, // Satellite indicator + BIT2 ContinuityCheckInd, // Continuity check indicator + BIT1 EchoControlDevInd, // Echo CONtrol device indicator + BIT3 Spare // Spare + } with { variant "" }; + + +//************************************************************************ +// Network Call Reference +// Ericsson Specification Reference: Chapter 2.3.3.50 +//************************************************************************ + type record Network_call_reference + { + BIT8 id, + INT1 lengthField, + + OCT3 CallIdentity, // Call identity + BIT14 SwitchId, // Switch identity + BIT2 Spare // Spare + } with { variant "PRESENCE( id = '11110100'B)"; + variant (lengthField)"LENGTHTO(CallIdentity,SwitchId,Spare)"; + }; + + +//************************************************************************ +// Network Management Controls +// Standard Reference ISUP : Chapter 3.68 +//************************************************************************ + type record Network_management_controls + { + BIT8 id, + INT1 lengthField, + + BIT1 TAR_indicator, // Temporary alternate routing indicator + BIT6 spare, // Temporary alternate routing indicator + BIT1 ExtI // Extension indicator + } with { variant "PRESENCE( id = '01011011'B)"; + variant (lengthField)"LENGTHTO(TAR_indicator,spare,ExtI)"; + }; + + +//************************************************************************ +// Network Routing Number +// Standard Reference ISUP : Chapter 3.90 +//************************************************************************ + type record Network_routing_number + { + BIT8 id, + INT1 lengthField, + + BIT4 NatureOfAddrInd, // Nature of address indicator + BIT3 NumberingPlanInd, // Numbering plan indicator + BIT1 OddEven, // Odd/even indicator + HEX1_32 AddrSignals, // Address signals and Filler if odd addr.signals + HEX1 Filler optional + } with { variant (AddrSignals) "HEXORDER(low)"; + variant "PRESENCE( id = '10000100'B)"; + variant (lengthField)"LENGTHTO(NatureOfAddrInd,NumberingPlanInd, + OddEven,AddrSignals,Filler)"; + }; + +//************************************************************************ +// Network Specific Facility +// Ericsson Specification Reference: Chapter 2.3.3.51 +// Standard Reference ISUP : Chapter 3.36 +//************************************************************************ + type record Network_specific_facility + { + BIT8 id, + INT1 lengthField, + + INT1 LenOfNetwId, // Length of network identification + BIT4 NetworkIdPlan optional, // Network identification plan + BIT3 TypeofNetworkId optional, // Type of network identification + BIT1 One optional, + OCTN NetworkId optional, // Network id. First bit in octets is 0 + OCTN NetworkSpecificFacility // network-specific FACility indicator + } with { variant (LenOfNetwId) "LENGTHTO(NetworkIdPlan,TypeofNetworkId, + One,NetworkId)"; + variant "PRESENCE( id = '00101111'B)"; + variant (lengthField)"LENGTHTO(LenOfNetwId,NetworkIdPlan, + TypeofNetworkId,One,NetworkId, + NetworkSpecificFacility)"; + }; + + +//************************************************************************ +// Number Portability Forward Information +// Standard Reference ISUP : Chapter 3.101 +//************************************************************************ + type record Number_portability_forward_information + { + BIT8 id, + INT1 lengthField, + + BIT4 NbPStInd, // Number portability status indicator + BIT3 spare, // Spare + BIT1 ExtI // Extension indicator + } with { variant "PRESENCE( id = '10001101'B)"; + variant (lengthField)"LENGTHTO(NbPStInd,spare,ExtI)"; + }; + + +//************************************************************************ +// Optional Backward Call Indicators +// Ericsson Specification Reference: Chapter 2.3.3.52 +// Standard Reference ISUP : Chapter 3.37 +//************************************************************************ + type record Optional_backward_call_indicators + { + BIT8 id, + INT1 lengthField, + + BIT1 InBandInfoInd, // In-band INFormation indicator + BIT1 CallDiversionMayOccurInd, // Call diversion may occur indicator + BIT1 SimpleSegmentationInd, // Simple segmentation indicator + BIT1 MLPPUserInd, // MLPP User Indicator + BIT2 Reserved, // Reserved + BIT1 TimeSupervBeforeAnsInd, // Time supervision before answerind. + BIT1 LastPartyRelInd // Last party release indicator + } with { variant "PRESENCE( id = '00101001'B)"; + variant (lengthField)"LENGTHTO(InBandInfoInd, + CallDiversionMayOccurInd, + SimpleSegmentationInd,MLPPUserInd, + Reserved,TimeSupervBeforeAnsInd, + LastPartyRelInd)"; + }; + + +//************************************************************************ +// Optional Forward Call Indicators +// Ericsson Specification Reference: Chapter 2.3.3.53 +// Standard Reference ISUP : Chapter 3.38 +//************************************************************************ + type record Optional_forward_call_indicators + { + BIT8 id, + INT1 lengthField, + + BIT2 CUGCallInd, // Closed user group call indicator + BIT1 SimpleSegmentationInd, // Simple segmentation indicator + BIT4 Spare, // Spare + BIT1 ConnLineReqInd // Connected line identity request indicator + } with { variant "PRESENCE( id = '00001000'B)"; + variant (lengthField)"LENGTHTO(CUGCallInd,SimpleSegmentationInd, + Spare,ConnLineReqInd)"; + }; + + +//************************************************************************ +// Original Called Number +// Ericsson Specification Reference: Chapter 2.3.3.54 +// Standard Reference ISUP : Chapter 3.39 +//************************************************************************ + type record Original_called_number + { + BIT8 id, + INT1 lengthField, + + BIT7 NatureOfAddrInd, // Nature of address indicator + BIT1 OddEven, // Odd/even indicator + BIT2 Spare_1, // Spare + BIT2 AddrPresentRestInd, // Address presentation REStricted indicator + BIT3 NumberingPlanInd, // Numbering plan indicator + BIT1 Spare_2, // Spare + HEX1_32 AddrSignals optional, // Address signals and Filler if odd addr.signals + HEX1 Filler optional + } with { variant (AddrSignals) "HEXORDER(low)"; + variant "PRESENCE( id = '00101000'B)"; + variant (lengthField)"LENGTHTO(NatureOfAddrInd,OddEven,Spare_1, + AddrPresentRestInd,NumberingPlanInd, + Spare_2,AddrSignals,Filler)"; + }; + +//************************************************************************ +// Original Called IN Number +// Standard Reference ISUP : Chapter 3.87 +//************************************************************************ + type record Original_called_IN_number + { + BIT8 id, + INT1 lengthField, + + BIT7 NatureOfAddrInd, // Nature of address indicator + BIT1 OddEven, // Odd/even indicator + BIT2 spare_1, // Spare + BIT2 AddrPresentRestInd, // Address presentation REStricted indicator + BIT3 NumberingPlanInd, // Numbering plan indicator + BIT1 spare_2, // Spare + HEX1_32 AddrSignals optional, // Address signals and Filler if odd addr.signals + HEX1 Filler optional + } with { variant (AddrSignals) "HEXORDER(low)"; + variant "PRESENCE( id = '01111111'B)"; + variant (lengthField)"LENGTHTO(NatureOfAddrInd,OddEven,spare_1, + AddrPresentRestInd,NumberingPlanInd, + spare_2,AddrSignals,Filler)"; + }; + +//************************************************************************ +// Origination ISC Point Code +// Ericsson Specification Reference: Chapter 2.3.3.55 +// Standard Reference ISUP : Chapter 3.40 +//************************************************************************ + type record Origination_ISC_point_code + { + BIT8 id, + INT1 lengthField, + + OCT2 OriISC_contents // Signalling point code + } with { variant "PRESENCE( id = '00101011'B)"; + variant (lengthField)"LENGTHTO(OriISC_contents)"; + }; + + +//************************************************************************ +// Parameter Compatibility Information +// Ericsson Specification Reference: Chapter 2.3.3.56 +// Standard Reference ISUP : Chapter 3.41 +//************************************************************************ + type record Parameter_compatibility_information + { + BIT8 id, + INT1 lengthField, + + BIT8 FirstUpgradParam, // Upgraded parameter name + BIT7 InstructIndFirst, // all instruction indicators for parameter 1 + BIT1 ExtInd1, // Extension indicator + BIT8 SecondUpgradParam optional, + BIT7 InstructIndSecond optional, // all instruction indicators for param. 2 + BIT1 ExtInd2 optional, // Extension indicator + BIT8 ThirdUpgradParam optional, + BIT7 InstructIndThird optional, // all instruction indicators for param. 3 + BIT1 ExtInd3 optional, // Extension indicator + BIT8 FourthUpgradParam optional, + BIT7 InstructIndFourth optional, // all instruction indicators for param. 4 + BIT1 ExtInd4 optional, // Extension indicator + BIT8 FifthUpgradParam optional, + BIT7 InstructIndFifth optional, // all instruction indicators for param. 5 + BIT1 ExtInd5 optional// Extension indicator + } with { variant "PRESENCE( id = '00111001'B)"; + variant (lengthField)"LENGTHTO(FirstUpgradParam,InstructIndFirst, + ExtInd1,SecondUpgradParam, + InstructIndSecond,ExtInd2, + ThirdUpgradParam,InstructIndThird, + ExtInd3,FourthUpgradParam, + InstructIndFourth,ExtInd4, + FifthUpgradParam,InstructIndFifth, + ExtInd5)"; + }; + + +//************************************************************************ +// Pivot Capability +// Standard Reference ISUP : Chapter 3.84 +//************************************************************************ + type record Pivot_capability + { + BIT8 id, + INT1 lengthField, + + BIT3 PivPosInd, // Pivot possible indicator + BIT3 spare, // Spare + BIT1 IwRedirInd, // Interworking to redirection indicator + BIT1 ExtI // Extension indicator + } with { variant "PRESENCE( id = '01111011'B)"; + variant (lengthField)"LENGTHTO(PivPosInd,spare,IwRedirInd,ExtI)"; + }; + + +//************************************************************************ +// Pivot Counter +// Standard Reference ISUP : Chapter 3.93 +//************************************************************************ + type record Pivot_counter + { + BIT8 id, + INT1 lengthField, + + BIT5 PivCount, // Pivot counter + BIT3 spare // spare + } with { variant "PRESENCE( id = '10000111'B)"; + variant (lengthField)"LENGTHTO(PivCount,spare)"; + }; + + +//************************************************************************ +// Pivot Routing Backward Information +// Standard Reference ISUP : Chapter 3.95 +//************************************************************************ + type record Pivot_routing_backward_information + { + BIT8 id, + INT1 lengthField, + + ISUP_Information_type_set PivotInfo + } with { variant "PRESENCE( id = '10001001'B)"; + variant (lengthField)"LENGTHTO(PivotInfo)"; + }; + + type record ISUP_Information_type + { + BIT8 infoTypeTag, + INT1 infoTypeLength, + OCTN infoTypeValue + } with { variant (infoTypeLength)"LENGTHTO(infoTypeValue)"; + }; + + type set of ISUP_Information_type ISUP_Information_type_set + with { variant "" }; + + +//************************************************************************ +// Pivot Routing Forward Information +// Standard Reference ISUP : Chapter 3.94 +//************************************************************************ + type record Pivot_routing_forward_information + { + BIT8 id, + INT1 lengthField, + + ISUP_Information_type_set PivotInfo + } with { variant "PRESENCE( id = '10001000'B)"; + variant (lengthField)"LENGTHTO(PivotInfo)"; + }; + + +//************************************************************************ +// Pivot Routing Indicators +// Standard Reference ISUP : Chapter 3.85 +//************************************************************************ + type record Pivot_routing_indicators + { + BIT8 id, + INT1 lengthField, + + BIT7 PivRoutInd, // Pivot routing indicators + BIT1 ExtI // Extension indicator + } with { variant "PRESENCE( id = '01111100'B)"; + variant (lengthField)"LENGTHTO(PivRoutInd,ExtI)"; + }; + + +//************************************************************************ +// Pivot Status +// Standard Reference ISUP : Chapter 3.92 +//************************************************************************ + type record Pivot_status + { + BIT8 id, + INT1 lengthField, + + BIT2 PivStInd, // Pivot status indicator + BIT5 spare, // Spare + BIT1 ExtI // Extension indicator + } with { variant "PRESENCE( id = '10000110'B)"; + variant (lengthField)"LENGTHTO(PivStInd,spare,ExtI)"; + }; + + +//************************************************************************ +// Propagation Delay Counter +// Ericsson Specification Reference: Chapter 2.3.3.57 +// Standard Reference ISUP : Chapter 3.42 +//************************************************************************ + type record Propagation_delay_counter + { + BIT8 id, + INT1 lengthField, + + OCT2 PropagationDelayValue + } with { variant "PRESENCE( id = '00110001'B)"; + variant (lengthField)"LENGTHTO(PropagationDelayValue)"; + }; + + +//************************************************************************ +// Query On Release Capability +// Standard Reference ISUP : Chapter 3.91 +//************************************************************************ + type record Query_on_release_capability + { + BIT8 id, + INT1 lengthField, + + BIT1 QoRCapInd, // Query on RELease capability indicator + BIT6 spare, // Spare + BIT1 ExtI // Extension indicator + } with { variant "PRESENCE( id = '10000101'B)"; + variant (lengthField)"LENGTHTO(QoRCapInd,spare,ExtI)"; + }; + + +//************************************************************************ +// Range And Status +// Ericsson Specification Reference: Chapter 2.3.3.58 +// Standard Reference ISUP : Chapter 3.43 +//************************************************************************ + type record Range_and_status + { + INT1 lengthField, + + OCT1 Range, // Range + OCTN Status optional// Status + } with { variant (lengthField)"LENGTHTO(Range,Status)"; + }; + + +//************************************************************************ +// Redirect Backward Information +// Standard Reference ISUP : Chapter 3.100 +//************************************************************************ + type record Redirect_backward_information + { + BIT8 id, + INT1 lengthField, + + ISUP_Information_type_set RedirInfo + } with { variant "PRESENCE( id = '10001100'B)"; + variant (lengthField)"LENGTHTO(RedirInfo)"; + }; + + +//************************************************************************ +// Redirect Capability +// Standard Reference ISUP : Chapter 3.96 +//************************************************************************ + type record Redirect_capability + { + BIT8 id, + INT1 lengthField, + + BIT3 RedirPosInd, // Redirect possible indicator + BIT4 spare, // Spare + BIT1 ExtI // Extension indicator + } with { variant "PRESENCE( id = '01001110'B)"; + variant (lengthField)"LENGTHTO(RedirPosInd,spare,ExtI)"; + }; + + +//************************************************************************ +// Redirect Counter +// Standard Reference ISUP : Chapter 3.97 +//************************************************************************ + type record Redirect_counter + { + BIT8 id, + INT1 lengthField, + + BIT5 RedirCount, // Redirect counter + BIT3 spare // Spare + } with { variant "PRESENCE( id = '01110111'B)"; + variant (lengthField)"LENGTHTO(RedirCount,spare)"; + }; + + +//************************************************************************ +// Redirect Forward Information +// Standard Reference ISUP : Chapter 3.99 +//************************************************************************ + type record Redirect_forward_information + { + BIT8 id, + INT1 lengthField, + + ISUP_Information_type_set RedirInfo + } with { variant "PRESENCE( id = '10001011'B)"; + variant (lengthField)"LENGTHTO(RedirInfo)"; + }; + + +//************************************************************************ +// Redirect Status +// Standard Reference ISUP : Chapter 3.98 +//************************************************************************ + type record Redirect_status + { + BIT8 id, + INT1 lengthField, + + BIT2 RedirStInd, // Redirect status indicator + BIT5 spare, // Spare + BIT1 ExtI // Extension indicator + } with { variant "PRESENCE( id = '10001010'B)"; + variant (lengthField)"LENGTHTO(RedirStInd,spare,ExtI)"; + }; + + +//************************************************************************ +// Redirecting Number +// Ericsson Specification Reference: Chapter 2.3.3.59 +// Standard Reference ISUP : Chapter 3.44 +//************************************************************************ + type record Redirecting_number + { + BIT8 id, + INT1 lengthField, + + BIT7 NatureOfAddrInd, // Nature of address indicator + BIT1 OddEven, // Odd/even indicator + BIT2 Spare1, // Spare + BIT2 AddrPresentRestInd, // Address presentation REStricted indicator + BIT3 NumberingPlanInd, // Numbering plan indicator + BIT1 Spare, // Spare + HEX1_32 AddrSignals optional, // Address signals and Filler if odd addr.signals + HEX1 Filler optional + } with { variant (AddrSignals) "HEXORDER(low)"; + variant "PRESENCE( id = '00001011'B)"; + variant (lengthField)"LENGTHTO(NatureOfAddrInd,OddEven, + Spare1,AddrPresentRestInd, + NumberingPlanInd,Spare,AddrSignals, + Filler)"; + }; + + + +//************************************************************************ +// Redirection Information +// Ericsson Specification Reference: Chapter 2.3.3.60 +// Standard Reference ISUP : Chapter 3.45 +//************************************************************************ + type record Redirection_information + { + BIT8 id, + INT1 lengthField, + + BIT3 RedirectionInd, // Redirecting indicator + BIT1 Spare1, // Redirecting indicator + BIT4 OriginalRedirectionReason, // Original redirection reason + BIT3 RedirectionCounter optional, // Redirection counter + BIT1 Spare2 optional, // Spare + BIT4 RedirectingReason optional // Redirecting reason + } with { variant "PRESENCE( id = '00010011'B)"; + variant (lengthField)"LENGTHTO(RedirectionInd,Spare1, + OriginalRedirectionReason, + RedirectionCounter,Spare2, + RedirectingReason)"; + }; + + +//************************************************************************ +// Redirection Number +// Ericsson Specification Reference: Chapter 2.3.3.61 +// Standard Reference ISUP : Chapter 3.46 +//************************************************************************ + type record Redirection_number + { + BIT8 id, + INT1 lengthField, + + BIT7 NatureOfAddrInd, // Nature of address indicator + BIT1 OddEven, // Odd/even indicator + BIT4 Spare, // spare + BIT3 NumberingPlanInd, // Numbering plan indicator + BIT1 INNInd, // Internal network number indicator + HEX1_32 AddrSignals, // Address signals and Filler if odd addr.signals + HEX1 Filler optional + } with { variant (AddrSignals) "HEXORDER(low)"; + variant "PRESENCE( id = '00001100'B)"; + variant (lengthField)"LENGTHTO(NatureOfAddrInd,OddEven,Spare, + NumberingPlanInd,INNInd, + AddrSignals,Filler)"; + }; + +//************************************************************************ +// Redirection Number Restriction +// Ericsson Specification Reference: Chapter 2.3.3.62 +// Standard Reference ISUP : Chapter 3.47 +//************************************************************************ + type record Redirection_number_restriction + { + BIT8 id, + INT1 lengthField, + + BIT2 PresRestInd, // Presentation REStricted indicator + BIT6 Spare // Spare + } with { variant "PRESENCE( id = '01000000'B)"; + variant (lengthField)"LENGTHTO(PresRestInd,Spare)"; + }; + + +//************************************************************************ +// Remote Operations +// Standard Reference ISUP : Chapter 3.48 +//************************************************************************ + type record Remote_operations + { + BIT8 id, + INT1 lengthField, + + BIT5 ProtProf, // Protocol profile + BIT2 spare, // Spare + BIT1 ExtI, // Extension indicator + OCTN Comp // Components + } with { variant "PRESENCE( id = '00110010'B)"; + variant (lengthField)"LENGTHTO(ProtProf,spare,ExtI,Comp)"; + }; + + +//************************************************************************ +// Route Identity +// Ericsson Specification Reference: Chapter 2.3.3.63 +//************************************************************************ + type record Route_identity + { + BIT8 id, + INT1 lengthField, + + OCT2 RouteIdentity + } with { variant "PRESENCE( id = '11111100'B)"; + variant (lengthField)"LENGTHTO(RouteIdentity)"; + }; + + +//************************************************************************ +// SCF Id +// Ericsson Specification Reference: Chapter 2.3.3.64 +// Standard Reference ISUP : Chapter 3.71 +//************************************************************************ + type record SCF_id + { + BIT8 id, + INT1 lengthField, + + OCTN SCFId + } with { variant "PRESENCE( id = '01100110'B)"; + variant (lengthField)"LENGTHTO(SCFId)"; + }; + + +//************************************************************************ +// Service Activation +// Ericsson Specification Reference: Chapter 2.3.3.65 +// Standard Reference ISUP : Chapter 3.49 +//************************************************************************ + type record Service_activation + { + BIT8 id, + INT1 lengthField, + + OCTN ServAct_contents + } with { variant "PRESENCE( id = '00110011'B)"; + variant (lengthField)"LENGTHTO(ServAct_contents)"; + }; + + +//************************************************************************ +// Signalling Point Code +// Standard Reference ISUP : Chapter 3.50 +//************************************************************************ + type record Signalling_point_code + { + BIT8 id, + INT1 lengthField, + + OCT2 SPC_contents // Signalling point code + } with { variant "PRESENCE( id = '00011110'B)"; + variant (lengthField)"LENGTHTO(SPC_contents)"; + }; + + +//************************************************************************ +// Subsequent Number +// Ericsson Specification Reference: Chapter 2.3.3.66 +// Standard Reference ISUP : Chapter 3.51 +//************************************************************************ + type record Subsequent_number_OPT + { + BIT8 id, + INT1 lengthField, + + BIT7 Spare, // Spare + BIT1 OddEven, // Odd/even inicator + HEX1_32 AddrSignals, // Address signals and Filler if odd addr.signals + HEX1 Filler optional + } with { variant (AddrSignals) "HEXORDER(low)"; + variant "PRESENCE( id = '00000101'B)"; + variant (lengthField)"LENGTHTO(Spare,OddEven,AddrSignals,Filler)"; + }; + + type record Subsequent_number + { + INT1 lengthField, + + BIT7 Spare, // Spare + BIT1 OddEven, // Odd/even inicator + HEX1_32 AddrSignals, // Address signals and Filler if odd addr.signals + HEX1 Filler optional + } with { variant (AddrSignals) "HEXORDER(low)"; + variant (lengthField)"LENGTHTO(Spare,OddEven,AddrSignals,Filler)"; + }; + + +//************************************************************************ +// Suspend Resume Indicators +// Ericsson Specification Reference: Chapter 2.3.3.67 +// Standard Reference ISUP : Chapter 3.52 +//************************************************************************ + type record Suspend_resume_indicators + { + BIT1 SUSRESInd, // Suspend/resume indicator + BIT7 Spare // Spare + } with { variant "" }; + + +//************************************************************************ +// Tariff Indicator +// Ericsson Specification Reference: Chapter 2.3.3.68 +//************************************************************************ + type record Tariff_indicator + { + BIT8 id, + INT1 lengthField, + + OCT1 TariffInd, // Tariff indicator + OCT1 Reserved optional// Reserved + } with { variant "PRESENCE( id = '11111101'B)"; + variant (lengthField)"LENGTHTO(TariffInd,Reserved)"; + }; + + +//************************************************************************ +// Transit Network Selection +// Ericsson Specification Reference: Chapter 2.3.3.69 +// Standard Reference ISUP : Chapter 3.53 +//************************************************************************ + type record Transit_network_selection + { + BIT8 id, + INT1 lengthField, + + BIT4 NetIdPlan, // Network identification plan + BIT3 TypeOfNetId, // Type of network identification + BIT1 OddEvenInd, // Odd/even inicator + OCTN NetId // Network identification + } with { variant "PRESENCE( id = '00100011'B)"; + variant (lengthField)"LENGTHTO(NetIdPlan,TypeOfNetId,OddEvenInd, + NetId)"; + }; + + +//************************************************************************ +// Transmission Medium Requirement +// Ericsson Specification Reference: Chapter 2.3.3.70 +// Standard Reference ISUP : Chapter 3.54 +//************************************************************************ + type record Transmission_medium_requirement + { + BIT8 TMR + } with { variant "" }; + +//************************************************************************ +// Transmission Medium Requirement Prime +// Ericsson Specification Reference: Chapter 2.3.3.71 +// Standard Reference ISUP : Chapter 3.55 +//************************************************************************ + type record Transmission_medium_requirement_prime + { + BIT8 id, + INT1 lengthField, + + BIT8 TMRp_field + } with { variant "PRESENCE( id = '00111110'B)"; + variant (lengthField)"LENGTHTO(TMRp_field)"; + }; + +//************************************************************************ +// Transmission Medium Used +// Ericsson Specification Reference: Chapter 2.3.3.72 +// Standard Reference ISUP : Chapter 3.56 +//************************************************************************ + type record Transmission_medium_used + { + BIT8 id, + INT1 lengthField, + + BIT8 TMU_field + } with { variant "PRESENCE( id = '00110101'B)"; + variant (lengthField)"LENGTHTO(TMU_field)"; + }; + + +//************************************************************************ +// UID Action Indicators +// Standard Reference ISUP : Chapter 3.78 +//************************************************************************ + type record UID_action_indicators + { + BIT8 id, + INT1 lengthField, + + BIT1 ThConInsInd, // Through CONnection instruction indicator + BIT1 T9InsInd, // T9 timer instruction indicator + BIT5 spare, // Spare + BIT1 ExtI // Extension indicator + } with { variant "PRESENCE( id = '01110100'B)"; + variant (lengthField)"LENGTHTO(ThConInsInd,T9InsInd,spare,ExtI)"; + }; + + +//************************************************************************ +// UID Capability Indicators +// Standard Reference ISUP : Chapter 3.79 +//************************************************************************ + type record UID_capability_indicators + { + BIT8 id, + INT1 lengthField, + + BIT1 through_connection_indicator, // Through CONnection indicator + BIT1 T9_timer_indicator, // T9 timer indicator + BIT5 spare, // T9 timer indicator + BIT1 ExtI // Extension indicator + } with { variant "PRESENCE( id = '01110101'B)"; + variant (lengthField)"LENGTHTO(through_connection_indicator, + T9_timer_indicator,spare,ExtI)"; + }; + + +//************************************************************************ +// User Service Information +// Ericsson Specification Reference: Chapter 2.3.3.73 +// Standard Reference ISUP : Chapter 3.57 +//************************************************************************ + type record User_service_information + { + BIT8 id, + INT1 lengthField, + + BIT5 InfTrC, // Information transfer capability + BIT2 CodS, // Coding standard + BIT1 ExtI_1, // Extension indicator (1) + //EXT GR1 start + BIT5 infTR, // Information transfer rate + BIT2 TrMod, // Transfer mode + BIT1 ExtI_2, // Extension indicator (0/1) + + BIT2 establishment optional, // demand + BIT2 configuration optional, // point-to-point + BIT3 structure optional, // default + BIT1 ext2a optional, + + BIT5 infoTransRate optional, //used for packet-mode calls + BIT2 symmetry optional, // bi-directional symmetric + BIT1 ext2b optional, + //EXT GR1 end + BIT7 RatMul optional, // Rate multiplier + BIT1 ExtI_2_1 optional, // Extension indicator (1) + + Layer1_info layer1 optional, + Layer2_info layer2 optional, + Layer3_info layer3 optional + } with { variant "EXTENSION_BIT_GROUP(yes,infTR,ext2b)"; + variant (RatMul) "PRESENCE(infTR = '11000'B)"; + variant (ExtI_2_1) "PRESENCE(infTR = '11000'B)"; + variant "TAG ( layer1, layer_id = '01'B; + layer2, layer_id = '10'B; + layer3, layer_id = '11'B;)" + variant "PRESENCE( id = '00011101'B)"; + variant (lengthField)"LENGTHTO(InfTrC,CodS,ExtI_1,infTR,TrMod, + ExtI_2,establishment,configuration, + structure,ext2a,infoTransRate, + symmetry,ext2b,RatMul,ExtI_2_1, + layer1,layer2,layer3)"; + }; + + type record Layer1_info + { + BIT5 UInf1, // User INFormation layer 1 protocol + BIT2 layer_id, // Layer identification + BIT1 ExtI_3, // Extension indicator (0/1) + + BIT5 UsrRate optional, // User rate + BIT1 Negot optional, // Negotiation + BIT1 SynAsyn optional, // Synchronous/Asynchronous + BIT1 ExtI_3a optional, // Extension indicator (0/1) + + //Note: the content of this field depends on field UInf1 - see Q.931 4.5.5 + BIT7 Bits_3b optional, // info bits in octet 3b + BIT1 ExtI_3b optional, // Extension indicator (0/1) + + //BIT1 Spare_1 optional, // Spare + //BIT1 FlCtrRx optional, // Flow control on Rx + //BIT1 FlCtrTx optional, // Flow control on Tx + //BIT1 NICRx optional, // Network independent clock on RX + //BIT1 NICTx optional, // Network independent clock on TX + //BIT2 IntRate optional, // Intermediate rate + //BIT1 ExtI_6 optional, // Extension indicator (0/1) + + //BIT1 Spare_2 optional, // Spare + //BIT1 InBndNeg optional, // In-band/out-band negotiation + //BIT1 Ass optional, // Assignor/assignee + //BIT1 LLINeg optional, // Logical link identifier negotiation + //BIT1 Mode optional, // Mode of operation + + //BIT1 MultFr optional,// Multiple frame establishment support in data link + //BIT1 Hdr optional, // Rate adaption header/no header + //BIT1 ExtI_7 optional,// Extension indicator (0/1) + + BIT3 Prty optional, // Parity INFormation + BIT2 NDatBit optional, // Number of data bits excluding parity bit if pres. + BIT2 NStpBit optional, // Number of stop bits + BIT1 ExtI_3c optional, // Extension indicator (0/1) + + BIT6 MdmTyp optional, // Modem type + BIT1 DupMod optional, // Mode duplex + BIT1 ExtI_3d optional // Extension indicator (1) + } with { variant "EXTENSION_BIT(yes)"} + + type record Layer2_info + { + BIT5 uInf2, // User information layer 2 protocol + BIT2 layer_id, // Layer identification + BIT1 extI_10 // Extension indicator (1) + } with { variant "" }; + + type record Layer3_info + { + BIT5 uInf3, // User information layer 3 protocol + BIT2 layer_id, // Layer identification + BIT1 extI_11 // Extension indicator (1) + } with { variant "" }; + + +//************************************************************************ +// User Service Information Prime +// Ericsson Specification Reference: Chapter 2.3.3.74 +// Standard Reference ISUP : Chapter 3.58 +//************************************************************************ + type record User_service_information_prime + { + BIT8 id, + INT1 lengthField, + + BIT5 InfTrC, // Information transfer capability + BIT2 CodS, // Coding standard + BIT1 ExtI_1, // Extension indicator (1) + //EXT GR1 start + BIT5 infTR, // Information transfer rate + BIT2 TrMod, // Transfer mode + BIT1 ExtI_2, // Extension indicator (0/1) + + BIT2 establishment optional, // demand + BIT2 configuration optional, // point-to-point + BIT3 structure optional, // default + BIT1 ext2a optional, + + BIT5 infoTransRate optional, //used for packet-mode calls + BIT2 symmetry optional, // bi-directional symmetric + BIT1 ext2b optional, + //EXT GR1 end + BIT7 RatMul optional, // Rate multiplier + BIT1 ExtI_2_1 optional, // Extension indicator (1) + + Layer1_info layer1 optional, + Layer2_info layer2 optional, + Layer3_info layer3 optional + } with { variant "EXTENSION_BIT_GROUP(yes,infTR,ext2b)"; + variant (RatMul) "PRESENCE(infTR = '11000'B)"; + variant (ExtI_2_1) "PRESENCE(infTR = '11000'B)"; + variant "TAG ( layer1, layer_id = '01'B; + layer2, layer_id = '10'B; + layer3, layer_id = '11'B;)" + variant "PRESENCE( id = '00110000'B)"; + variant (lengthField)"LENGTHTO(InfTrC,CodS,ExtI_1,infTR,TrMod, + ExtI_2,establishment,configuration, + structure,ext2a,infoTransRate, + symmetry,ext2b,RatMul,ExtI_2_1, + layer1,layer2,layer3)"; + }; +/* The old version is commented out because it could cause decoding problems. + type record User_service_information // 3.57 / Q.763 + { + BIT5 InfTrC, // Information transfer capability + BIT2 CodS, // Coding standard + BIT1 ExtI_1, // Extension indicator (1) + BIT5 InfTR, // Information transfer rate + BIT2 TrMod, // Transfer mode + BIT1 ExtI_2, // Extension indicator (0/1) + BIT8 RatMul optional, // Rate multiplier + BIT1 ExtI_3 optional, // Extension indicator (1) + BIT5 UInf1 optional, // User INFormation layer 1 protocol + BIT2 Lay1 optional, // Layer identification + BIT1 ExtI_4 optional, // Extension indicator (0/1) + BIT5 UsrRate optional, // User rate + BIT1 Negot optional, // Negotiation + BIT1 SynAsyn optional, // Synchronous/Asynchronous + BIT1 ExtI_5 optional, // Extension indicator (0/1) + BIT1 Spare_1 optional, // Spare + BIT1 FlCtrRx optional, // Flow control on Rx + BIT1 FlCtrTx optional, // Flow control on Tx + BIT1 NICRx optional, // Network independent clock on RX + BIT1 NICTx optional, // Network independent clock on TX + BIT2 IntRate optional, // Intermediate rate + BIT1 ExtI_6 optional, // Extension indicator (0/1) + BIT1 Spare_2 optional, // Spare + BIT1 InBndNeg optional, // In-band/out-band negotiation + BIT1 Ass optional, // Assignor/assignee + BIT1 LLINeg optional, // Logical link identifier negotiation + BIT1 Mode optional, // Mode of operation + BIT1 MultFr optional, // Multiple frame establishment support in data link + BIT1 Hdr optional, // Rate adaption header/no header + BIT1 ExtI_7 optional, // Extension indicator (0/1) + BIT3 Prty optional, // Parity INFormation + BIT2 NDatBit optional, // Number of data bits excluding parity bit if pres. + BIT2 NStpBit optional, // Number of stop bits + BIT1 ExtI_8 optional, // Extension indicator (1) + BIT6 MdmTyp optional, // Modem type + BIT1 DupMod optional, // Mode duplex + BIT1 ExtI_9 optional, // Extension indicator (1) + BIT5 UInf2 optional, // User INFormation layer 2 protocol + BIT2 Lay2 optional, // Layer identification + BIT1 ExtI_10 optional, // Extension indicator (1) + BIT5 UInf3 optional, // User INFormation layer 3 protocol + BIT2 Lay3 optional, // Layer identification + BIT1 ExtI_11 optional // Extension indicator (1) + } with { variant "" }; + + + type record User_service_information_prime // 3.58 / Q.763 + { + BIT5 InfTrC, // Information transfer capability + BIT2 CodS, // Coding standard + BIT1 ExtI_1, // Extension indicator (1) + BIT5 InfTR, // Information transfer rate + BIT2 TrMod, // Transfer mode + BIT1 ExtI_2, // Extension indicator (0/1) + BIT8 RatMul optional, // Rate multiplier + BIT1 ExtI_3 optional, // Extension indicator (1) + BIT5 UInf1 optional, // User INFormation layer 1 protocol + BIT2 Lay1 optional, // Layer identification + BIT1 ExtI_4 optional, // Extension indicator (0/1) + BIT5 UsrRate optional, // User rate + BIT1 Negot optional, // Negotiation + BIT1 SynAsyn optional, // Synchronous/Asynchronous + BIT1 ExtI_5 optional, // Extension indicator (0/1) + BIT1 Spare_1 optional, // Spare + BIT1 FlCtrRx optional, // Flow control on Rx + BIT1 FlCtrTx optional, // Flow control on Tx + BIT1 NICRx optional, // Network independent clock on RX + BIT1 NICTx optional, // Network independent clock on TX + BIT2 IntRate optional, // Intermediate rate + BIT1 ExtI_6 optional, // Extension indicator (0/1) + BIT1 Spare_2 optional, // Spare + BIT1 InBndNeg optional, // In-band/out-band negotiation + BIT1 Ass optional, // Assignor/assignee + BIT1 LLINeg optional, // Logical link identifier negotiation + BIT1 Mode optional, // Mode of operation + BIT1 MultFr optional, // Multiple frame establishment support in data link + BIT1 Hdr optional, // Rate adaption header/no header + BIT1 ExtI_7 optional, // Extension indicator (0/1) + BIT3 Prty optional, // Parity INFormation + BIT2 NDatBit optional, // Number of data bits excluding parity bit if pres. + BIT2 NStpBit optional, // Number of stop bits + BIT1 ExtI_8 optional, // Extension indicator (1) + BIT6 MdmTyp optional, // Modem type + BIT1 DupMod optional, // Mode duplex + BIT1 ExtI_9 optional, // Extension indicator (1) + BIT5 UInf2 optional, // User INFormation layer 2 protocol + BIT2 Lay2 optional, // Layer identification + BIT1 ExtI_10 optional, // Extension indicator (1) + BIT5 UInf3 optional, // User INFormation layer 3 protocol + BIT2 Lay3 optional, // Layer identification + BIT1 ExtI_11 optional // Extension indicator (1) + } with { variant "" }; +*/ + + +//************************************************************************ +// User Teleservice Information +// Ericsson Specification Reference: Chapter 2.3.3.75 +// Standard Reference ISUP : Chapter 3.59 +//************************************************************************ + type record User_teleservice_information + { + BIT8 id, + INT1 lengthField, + + BIT2 Pres, // Presentation + BIT3 Interpr, // Interpretation + BIT2 CodS, // Coding standard + BIT1 ExtI_1, // Extention indicator, always 1 + BIT7 HLChrInf, // High layer characteristics identification + BIT1 ExtI_2, // Extension indicator, (0/1) + BIT7 ExHLChrInf optional, // Extended high layer characteristics id. + BIT1 ExtI_3 optional // Extention indicator, always 1 + } with { variant (ExHLChrInf) "PRESENCE(ExtI_2 = '0'B)"; + variant (ExtI_3) "PRESENCE(ExtI_2 = '0'B)"; + variant "PRESENCE( id = '00110100'B)"; + variant (lengthField)"LENGTHTO(Pres,Interpr,CodS,ExtI_1,HLChrInf, + ExtI_2,ExHLChrInf,ExtI_3)"; + }; + +//************************************************************************ +// User To User Indicators +// Ericsson Specification Reference: Chapter 2.3.3.76 +// Standard Reference ISUP : Chapter 3.60 +//************************************************************************ + type record User_to_user_indicators + { + BIT8 id, + INT1 lengthField, + + BIT1 Type, // type + BIT2 Service1, // Service 1 + BIT2 Service2, // Service 2 + BIT2 Service3, // Service 3 + BIT1 NetworkDiscardInd //Network discard ind. (spare if Type = request) + } with { variant "PRESENCE( id = '00101010'B)"; + variant (lengthField)"LENGTHTO(Type,Service1,Service2,Service3, + NetworkDiscardInd)"; + }; + + +//************************************************************************ +// User To User Information +// Ericsson Specification Reference: Chapter 2.3.3.77 +// Standard Reference ISUP : Chapter 3.61 +//************************************************************************ + type record User_to_user_information_OPT + { + BIT8 id, + INT1 lengthField, + + OCTN UserInfo + } with { variant "PRESENCE( id = '00100000'B)"; + variant (lengthField)"LENGTHTO(UserInfo)"; + }; + + type record User_to_user_information + { + INT1 lengthField, + + OCTN UserInfo + } with { variant (lengthField)"LENGTHTO(UserInfo)"; + }; + + +//************************************************************************ +// Global Call Reference +// GCR included in ISUP market variants based on EED/X 1056-174 Uen - Global +// Call reference for ISUP and BICC, MSC R12. +// It is used in the IAM message. See section 3.1.1 for details. +//************************************************************************ + type record Global_call_reference + { + BIT8 id, + INT1 lengthField, + + INT1 netwIdLenInd, // Network ID length indicator + OCTN netwId, // Network ID + INT1 nodeIdLenInd, // Node ID length indicator + OCTN nodeId, // Node ID + INT1 callRefLenInd, // Call Reference length indicator + OCTN callRefId // Call Reference ID + } with { variant (netwIdLenInd) "LENGTHTO (netwId)"; + variant (nodeIdLenInd) "LENGTHTO(nodeId)"; + variant (callRefLenInd) "LENGTHTO (callRefId)"; + variant "PRESENCE( id = '10100100'B)"; + variant (lengthField)"LENGTHTO(netwIdLenInd,netwId,nodeIdLenInd, + nodeId,callRefLenInd,callRefId)"; + }; +} // END Group ISUP_parameters + + +//************************************************************************ +//************************************************************************ +//************************************************************************ +//************************************************************************ +//************************************************************************ + + +//************************************************************************ +// ACM - Address complete +// Ericsson Specification Reference: Chapter 2.2.2.1 +// Standard Reference ISUP : Chapter 4, Table 21 +//************************************************************************ + type set ACM_optional_part + { + Optional_backward_call_indicators optBackwardCallInd optional, + Cause_indicators_OPT causeInd optional, + User_to_user_indicators userToUserInd optional, + User_to_user_information_OPT userToUserInfo optional, + Access_transport accessTransport optional, + Generic_notification_indicator_set genericNotificationInd optional, + Transmission_medium_used transMediumUsed optional, + Access_delivery_information accessDeliveryInfo optional, + Redirection_number redirectionNum optional, + Parameter_compatibility_information paramCompatibilityInfo optional, + Call_diversion_information callDiversionInfo optional, + Network_specific_facility networkFacility optional, + Redirection_number_restriction redirectionNumRest optional, + Route_identity routeIdentity optional, + Call_transfer_treatment_indicators callTransferTreatmentInd optional, + Conference_treatment_indicators conferenceTreatmentInd optional, + + Call_reference callReference optional, + Echo_control_information echoControlInfo optional, + Remote_operations remoteOperations optional, + Service_activation serviceActivation optional, + UID_action_indicators UIDAcInd optional, + Application_transport_parameter_set ATPP optional, + CCNR_possible_indicator CCNRP optional, + HTR_information HTRInfo optional, + Pivot_routing_backward_information PRBI optional, + Redirect_status RedirSt optional + } with { variant (ATPP,genericNotificationInd) "REPEATABLE(yes)";}; + + + type record ACM_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Backward_call_indicators backwardCallInd, + Pointer opt_part_ptr, + ACM_optional_part acmOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (acmOptionals)"}; + + +//************************************************************************ +// ANM - Answer +// Ericsson Specification Reference: Chapter 2.2.2.2 +// Standard Reference ISUP : Chapter 4, Table 22 +//************************************************************************ + type set ANM_optional_part + { + Backward_call_indicators_OPT backwardCallInd optional, + Optional_backward_call_indicators optBackwardCallInd optional, + User_to_user_indicators userToUserInd optional, + User_to_user_information_OPT userToUserInfo optional, + Connected_number connectedNum optional, + Access_transport accessTransport optional, + Access_delivery_information accessDeliveryInfo optional, + Parameter_compatibility_information paramCompatibilityInfo optional, + Backward_GVNS backwardGVNS optional, + Call_history_information callHistoryInfo optional, + Generic_number_set genericNum optional, + Transmission_medium_used transMediumUsed optional, + Network_specific_facility networkFacility optional, + Redirection_number_restriction redirectionNumRest optional, + Call_transfer_treatment_indicators callTransferTreatmentInd optional, + Conference_treatment_indicators conferenceTreatmentInd optional, + + Call_reference callReference optional, + Generic_notification_indicator_set genericNotificationInd optional, + Remote_operations remoteOperations optional, + Redirection_number redirectionNum optional, + Service_activation serviceActivation optional, + Echo_control_information echoControlInfo optional, + Display_information DisInf optional, + Application_transport_parameter_set ATPP optional, + Pivot_routing_backward_information PRBI optional, + Redirect_status RedirSt optional + } with { variant (ATPP,genericNotificationInd,genericNum) "REPEATABLE(yes)";}; + + + type record ANM_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer opt_part_ptr, + ANM_optional_part anmOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr)"POINTERTO (anmOptionals)"; + }; + + +//************************************************************************ +// APM - Application Transport +// Standard Reference ISUP : Chapter 4, Table 51 +//************************************************************************ + type set APM_optional_part + { + Message_compatibility_information MCI optional, + Parameter_compatibility_information paramCompatibilityInfo optional, + Application_transport_parameter_set ATPP optional + } with { variant (ATPP) "REPEATABLE(yes)";}; + + + type record APM_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer opt_part_ptr, + APM_optional_part apmOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (apmOptionals)"; + }; + + +//************************************************************************ +// BLO - Blocking +// Ericsson Specification Reference: Chapter 2.2.2.3 +// Standard Reference ISUP : Chapter 4, Table 39 +//************************************************************************ + type record BLO_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType + } with { variant "" }; + + +//************************************************************************ +// BLA - Blocking Acknowledgement +// Ericsson Specification Reference: Chapter 2.2.2.4 +// Standard Reference ISUP : Chapter 4, Table 39 +//************************************************************************ + type record BLA_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType + } with { variant "" }; + + +//************************************************************************ +// CPG - Call Progress +// Ericsson Specification Reference: Chapter 2.2.2.5 +// Standard Reference ISUP : Chapter 4, Table 23 +//************************************************************************ + type set CPG_optional_part + { + Cause_indicators_OPT causeInd optional, + Backward_call_indicators_OPT backwardCallInd optional, + Optional_backward_call_indicators optBackwardCallInd optional, + Access_transport accessTransport optional, + User_to_user_indicators userToUserInd optional, + Redirection_number redirectionNum optional, + User_to_user_information_OPT userToUserInfo optional, + Generic_notification_indicator_set genericNotificationInd optional, + Network_specific_facility networkFacility optional, + Transmission_medium_used transMediumUsed optional, + Access_delivery_information accessDeliveryInfo optional, + Parameter_compatibility_information paramCompatibilityInfo optional, + Call_diversion_information callDiversionInfo optional, + Redirection_number_restriction redirectionNumRest optional, + Call_transfer_number callTransferNumber optional, + Call_transfer_treatment_indicators callTransferTreatmentInd optional, + Conference_treatment_indicators conferenceTreatmentInd optional, + + Call_reference callReference optional, + Remote_operations remoteOperations optional, + Service_activation serviceActivation optional, + Echo_control_information echoControlInfo optional, + Connected_number connectedNum optional, + Backward_GVNS backwardGVNS optional, + Generic_number_set genericNum optional, + Call_history_information callHistoryInfo optional, + UID_action_indicators UIDAcInd optional, + Application_transport_parameter_set ATPP optional, + CCNR_possible_indicator CCNRP optional, + Pivot_routing_backward_information PRBI optional, + Redirect_status RedirSt optional + } with { variant (ATPP,genericNotificationInd,genericNum) "REPEATABLE(yes)";}; + + + type record CPG_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Event_information eventInfo, + Pointer opt_part_ptr, + CPG_optional_part cpgOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (cpgOptionals)"; + }; + + +//************************************************************************ +// CRG - Charge Information +// Ericsson Specification Reference: Chapter 2.2.2.6 +//************************************************************************ + type set CRG_optional_part + { + Meter_pulse_indicator meterPulseInd optional, + Tariff_indicator tariffInd optional, + Parameter_compatibility_information paramCompatibilityInfo optional + } with { variant "" }; + + + type record CRG_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer opt_part_ptr, + CRG_optional_part crgOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr)"POINTERTO (crgOptionals)"; + }; + + +//************************************************************************ +// CGB - Circuit Group Blocking +// Ericsson Specification Reference: Chapter 2.2.2.7 +// Standard Reference ISUP : Chapter 4, Table 40 +//************************************************************************ + type record CGB_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Circuit_group_supervision_message_type_indicator circuitGroupSupervMsgInd, + Pointer var_part_ptr, + Range_and_status rangeAndStatus + } with { variant (var_part_ptr) "POINTERTO (rangeAndStatus)"; + }; + + +//************************************************************************ +// CGBA - Circuit Group Blocking Acknowledgement +// Ericsson Specification Reference: Chapter 2.2.2.8 +// Standard Reference ISUP : Chapter 4, Table 40 +//************************************************************************ + type record CGBA_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Circuit_group_supervision_message_type_indicator circuitGroupSupervMsgInd, + Pointer var_part_ptr, + Range_and_status rangeAndStatus + } with { variant (var_part_ptr) "POINTERTO (rangeAndStatus)"; + }; + + +//************************************************************************ +// CQM - Circuit Group Query +// Ericsson Specification Reference: Chapter 2.2.2.9 +// Standard Reference ISUP : Chapter 4, Table 41 +//************************************************************************ + type record CQM_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer var_part_ptr, + Range_and_status rangeAndStatus + } with { variant (var_part_ptr) "POINTERTO (rangeAndStatus)"; + }; + + +//************************************************************************ +// CQR - Circuit Group Query Response +// Ericsson Specification Reference: Chapter 2.2.2.10 +// Standard Reference ISUP : Chapter 4, Table 24 +//************************************************************************ + type record CQR_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer var1_part_ptr, + Pointer var2_part_ptr, + Range_and_status rangeAndStatus, + Circuit_state_indicator circuitStateInd + } with { variant (var1_part_ptr) "POINTERTO (rangeAndStatus)"; + variant (var2_part_ptr) "POINTERTO (circuitStateInd)"; + }; + + +//************************************************************************ +// GRS - Circuit Group Reset +// Ericsson Specification Reference: Chapter 2.2.2.11 +// Standard Reference ISUP : Chapter 4, Table 41 +//************************************************************************ + type record GRS_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer var_part_ptr, + Range_and_status rangeAndStatus + } with { variant (var_part_ptr) "POINTERTO (rangeAndStatus)"; + }; + + +//************************************************************************ +// GRA - Circuit Group Reset Acknowledgement +// Ericsson Specification Reference: Chapter 2.2.2.12 +// Standard Reference ISUP : Chapter 4, Table 25 +//************************************************************************ + type record GRA_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer var_part_ptr, + Range_and_status rangeAndStatus + } with { variant (var_part_ptr) "POINTERTO (rangeAndStatus)"; + }; + +//************************************************************************ +// GGU - Circuit Group Unblocking +// Ericsson Specification Reference: Chapter 2.2.2.13 +// Standard Reference ISUP : Chapter 4, Table 40 +//************************************************************************ + type record CGU_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Circuit_group_supervision_message_type_indicator circuitGroupSupervMsgInd, + Pointer var_part_ptr, + Range_and_status rangeAndStatus + } with { variant (var_part_ptr) "POINTERTO (rangeAndStatus)"; + }; + + +//************************************************************************ +// CGUA - Circuit Group Unblocking Acknowledgement +// Ericsson Specification Reference: Chapter 2.2.2.14 +// Standard Reference ISUP : Chapter 4, Table 40 +//************************************************************************ + type record CGUA_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Circuit_group_supervision_message_type_indicator circuitGroupSupervMsgInd, + Pointer var_part_ptr, + Range_and_status rangeAndStatus + } with { variant (var_part_ptr)"POINTERTO (rangeAndStatus)"; + }; + + +//************************************************************************ +// CFN - Confusion +// Ericsson Specification Reference: Chapter 2.2.2.15 +// Standard Reference ISUP : Chapter 4, Table 26 +//************************************************************************ + type record CFN_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer var_part_ptr, + Pointer opt_part_ptr, + Cause_indicators causeInd, + End_of_optional_parameters_indicator endOfOp + } with { variant (var_part_ptr)"POINTERTO (causeInd)"; + variant (opt_part_ptr)"POINTERTO (endOfOp)"; + }; + + +//************************************************************************ +// CON - Connect +// Ericsson Specification Reference: Chapter 2.2.2.16 +// Standard Reference ISUP : Chapter 4, Table 27 +//************************************************************************ + type set CON_optional_part + { + Optional_backward_call_indicators optBackwardCallInd optional, + Backward_GVNS backwardGVNS optional, + Connected_number connectedNum optional, + User_to_user_indicators userToUserInd optional, + User_to_user_information_OPT userToUserInfo optional, + Access_transport accessTransport optional, + Network_specific_facility networkFacility optional, + Transmission_medium_used transMediumUsed optional, + Access_delivery_information accessDeliveryInfo optional, + Call_history_information callHistoryInfo optional, + Parameter_compatibility_information paramCompatibilityInfo optional, + Generic_number_set genericNum optional, + Route_identity routeIdentity optional, + Redirection_number_restriction redirectionNumRest optional, + Call_transfer_treatment_indicators callTransferTreatmentInd optional, + Conference_treatment_indicators conferenceTreatmentInd optional, + + Call_reference callReference optional, + Generic_notification_indicator_set genericNotificationInd optional, + Remote_operations remoteOperations optional, + Echo_control_information echoControlInfo optional, + Service_activation serviceActivation optional, + Application_transport_parameter_set ATPP optional, + HTR_information HTRInfo optional, + Pivot_routing_backward_information PRBI optional, + Redirect_status RedirSt optional + } with { variant (ATPP,genericNotificationInd,genericNum) "REPEATABLE(yes)";}; + + + type record CON_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Backward_call_indicators backwardCallInd, + Pointer opt_part_ptr, + CON_optional_part conOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (conOptionals)"; + }; + + +//************************************************************************ +// COT - Continuity +// Ericsson Specification Reference: Chapter 2.2.2.17 +// Standard Reference ISUP : Chapter 4, Table 28 +//************************************************************************ + type record COT_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Continuity_indicators continuityInd + } with { variant "" }; + + +//************************************************************************ +// CCR - Continuity Check Request +// Ericsson Specification Reference: Chapter 2.2.2.18 +// Standard Reference ISUP : Chapter 4, Table 39 +//************************************************************************ + type record CCR_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType + } with { variant "" }; + + +//************************************************************************ +// FAC - Facility +// Ericsson Specification Reference: Chapter 2.2.2.19 +// Standard Reference ISUP : Chapter 4, Table 45 +//************************************************************************ + type set FAC_optional_part + { + Message_compatibility_information messageCompatibilityInfo optional, + Parameter_compatibility_information paramCompatibilityInfo optional, + Service_activation serviceActivation optional, + Call_transfer_number callTransferNumber optional, + Access_transport accessTransport optional, + Generic_notification_indicator_set genericNotificationInd optional, + + Remote_operations remoteOperations optional, + Redirection_number redirectionNum optional, + Pivot_routing_indicators PRInd optional, + Pivot_status PSts optional, + Pivot_counter PCount optional, + Pivot_routing_backward_information PRBI optional, + Redirect_status RedirSt optional + } with { variant (genericNotificationInd) "REPEATABLE(yes)";}; + + + type record FAC_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer opt_part_ptr, + FAC_optional_part facOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr)"POINTERTO (facOptionals)"; + }; + + +//************************************************************************ +// FAA - Facility Accepted +// Ericsson Specification Reference: Chapter 2.2.2.20 +// Standard Reference ISUP : Chapter 4, Table 42 +//************************************************************************ + type set FAA_optional_part + { + User_to_user_indicators userToUserInd optional, + Parameter_compatibility_information paramCompatibilityInfo optional, + + Call_reference callReference optional, + Connection_request connectionRequest optional + } with { variant "" }; + + + type record FAA_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Facility_indicator facilityInd, + Pointer opt_part_ptr, + FAA_optional_part faaOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (faaOptionals)"; + }; + + +//************************************************************************ +// FRJ - Facility Reject +// Ericsson Specification Reference: Chapter 2.2.2.21 +// Standard Reference ISUP : Chapter 4, Table 29 +//************************************************************************ + type set FRJ_optional_part + { + User_to_user_indicators userToUserInd optional + } with { variant "" }; + + + type record FRJ_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Facility_indicator facilityInd, + Pointer var_part_ptr, + Pointer opt_part_ptr, + Cause_indicators causeInd, + FRJ_optional_part frjOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (var_part_ptr) "POINTERTO (causeInd)"; + variant (opt_part_ptr) "POINTERTO (frjOptionals)"; + }; + + +//************************************************************************ +// FAR - Facility Request +// Ericsson Specification Reference: Chapter 2.2.2.22 +// Standard Reference ISUP : Chapter 4, Table 42 +//************************************************************************ + type set FAR_optional_part + { + User_to_user_indicators userToUserInd optional, + Parameter_compatibility_information paramCompatibilityInfo optional, + + Call_reference callReference optional, + Connection_request connectionRequest optional + } with { variant "" }; + + + type record FAR_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Facility_indicator facilityInd, + Pointer opt_part_ptr, + FAR_optional_part farOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (farOptionals)"; + }; + + +//************************************************************************ +// FOT - Forward Transfer +// Ericsson Specification Reference: Chapter 2.2.2.23 +// Standard Reference ISUP : Chapter 4, Table 37 +//************************************************************************ + type set FOT_optional_part + { + Parameter_compatibility_information paramCompatibilityInfo optional, + + Call_reference callReference optional + } with { variant "" }; + + + type record FOT_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer opt_part_ptr, + FOT_optional_part fotOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (fotOptionals)"; + }; + + +//************************************************************************ +// IDR - Identification Request +// Ericsson Specification Reference: Chapter 2.2.2.24 +// Standard Reference ISUP : Chapter 4, Table 47 +//************************************************************************ + type set IDR_optional_part + { + MCID_request_indicators MCIDReqInd optional, + Message_compatibility_information messageCompatibilityInfo optional, + Parameter_compatibility_information paramCompatibilityInfo optional + } with { variant "" }; + + + type record IDR_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer opt_part_ptr, + IDR_optional_part idrOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (idrOptionals)"; + }; + + +//************************************************************************ +// IRS - Identification Response +// Ericsson Specification Reference: Chapter 2.2.2.25 +// Standard Reference ISUP : Chapter 4, Table 48 +//************************************************************************ + type set IRS_optional_part + { + MCID_response_indicators MCIDRpInd optional, + Message_compatibility_information messageCompatibilityInfo optional, + Parameter_compatibility_information paramCompatibilityInfo optional, + Calling_party_number callingPartyNum optional, + Access_transport accessTransport optional, + Generic_number_set genericNum optional, + Charged_party_identification ChPId optional + } with { variant (genericNum) "REPEATABLE(yes)";}; + + + type record IRS_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer opt_part_ptr, + IRS_optional_part irsOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (irsOptionals)"; + }; + + +//************************************************************************ +// INF - Information +// Ericsson Specification Reference: Chapter 2.2.2.26 +// Standard Reference ISUP : Chapter 4, Table 30 +//************************************************************************ + type set INF_optional_part + { + Calling_partys_category_OPT callingPartyCat optional, + Calling_party_number callingPartyNum optional, + Access_transport accessTransport optional, + Parameter_compatibility_information paramCompatibilityInfo optional, + Network_specific_facility networkFacility optional, + Display_information displayInfo optional, + + Call_reference callReference optional, + Connection_request connectionRequest optional + } with { variant "" }; + + + type record INF_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Information_indicators informationInd, + Pointer opt_part_ptr, + INF_optional_part infOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (infOptionals)"; + }; + + +//************************************************************************ +// INR - Information Request +// Ericsson Specification Reference: Chapter 2.2.2.27 +// Standard Reference ISUP : Chapter 4, Table 31 +//************************************************************************ + type set INR_optional_part + { + Network_specific_facility networkFacility optional, + Parameter_compatibility_information paramCompatibilityInfo optional, + + Call_reference callReference optional + } with { variant "" }; + + + type record INR_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Information_request_indicators InfRqInd, + Pointer opt_part_ptr, + INR_optional_part inrOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (inrOptionals)"; + }; + + +//************************************************************************ +// IAM - Initial Address Message +// Ericsson Specification Reference: Chapter 2.2.2.28 +// Standard Reference ISUP : Chapter 4, Table 32 +//************************************************************************ + type set IAM_optional_part + { + Transit_network_selection transitNetworkSel optional, + Calling_party_number callingPartyNum optional, + Optional_forward_call_indicators optForwardCallInd optional, + Redirecting_number redirectingNum optional, + Redirection_information redirectionInfo optional, + Closed_user_group_interlock_code cUGInterlockCode optional, + Original_called_number originalCalledNum optional, + User_to_user_information_OPT userToUserInfo optional, + Access_transport accessTransport optional, + User_service_information userServiceInfo optional, + User_to_user_indicators userToUserInd optional, + Generic_number_set genericNum optional, + Propagation_delay_counter propDelayCounter optional, + User_service_information_prime userServiceInfoPrime optional, + Network_specific_facility networkFacility optional, + Generic_digits_set genericDigits optional, + Origination_ISC_point_code origISCPointCode optional, + User_teleservice_information userTeleServiceInfo optional, + Parameter_compatibility_information paramCompatibilityInfo optional, + MLPP_precedence mLPPprecedence optional, + Route_identity routeIdentity optional, + Transmission_medium_requirement_prime transMediumReqPrime optional, + Location_number locationNum optional, + Forward_GVNS forwardGVNS optional, + Freephone_indicators freePhoneInd optional, + CCSS_parameter ccssPar optional, + Distributed_dynamic_routing_indicators distrDynRoutInd optional, + Additional_charging_information addChargeInfo optional, + Additional_routing_information addRoutInfo optional, + Correlation_id correlationId optional, + SCF_id SCFId optional, + Call_transfer_treatment_indicators callTransferTreatmentInd optional, + Conference_treatment_indicators conferenceTreatmentInd optional, + Call_offering_treatment_indicators callOfferingTreatmentInd optional, + Call_diversion_treatment_indicators callDiversionTreatmentInd optional, + Network_call_reference netwCallRef optional, + Calling_name_identity cgNameId optional, + Hop_counter HopCnt optional, + + Call_reference callReference optional, + Connection_request connectionRequest optional, + Remote_operations remoteOperations optional, + Generic_notification_indicator_set genericNotificationInd optional, + Service_activation serviceActivation optional, + Network_management_controls NetManCon optional, + Circuit_assignment_map CctAssMap optional, + Called_IN_number CdINnum optional, + UID_capability_indicators UIDcapInd optional, + Echo_control_information echoControlInfo optional, + Collect_call_request ColCReq optional, + Application_transport_parameter_set ATPP optional, + Pivot_capability PivCap optional, + Called_directory_number CDirNb optional, + Original_called_IN_number OCINNb optional, + Calling_geodetic_location CGeoLoc optional, + Network_routing_number NRNb optional, + Query_on_release_capability QoRCap optional, + Pivot_counter PCount optional, + Pivot_routing_forward_information PRFI optional, + Redirect_capability RedirCap optional, + Redirect_counter RedirCount optional, + Redirect_status RedirSt optional, + Redirect_forward_information RedirFI optional, + Number_portability_forward_information NPFI optional, + Global_call_reference GCRef optional + } with { variant (ATPP,genericNotificationInd,genericNum,genericDigits) + "REPEATABLE(yes)";}; + + + type record IAM_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Nature_of_connection_indicators natureOfConnInd, + Forward_call_indicators forwardCallInd, + Calling_partys_category callingPartyCat, + Transmission_medium_requirement transmissionMediumReq, + Pointer var_part_ptr, + Pointer opt_part_ptr, + Called_party_number calledPartyNum, + IAM_optional_part iamOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (var_part_ptr) "POINTERTO (calledPartyNum)"; + variant (opt_part_ptr) "POINTERTO (iamOptionals)"; + }; + + +//************************************************************************ +// IAM_PTSO - Initial Address Message +// Ericsson Specification Reference: Chapter 2.2.2.28 +// Standard Reference ISUP : Chapter 4, Table 32 +//************************************************************************ +/* + type record PAR_GD + { + OCT1 parameter_type, + OCT1 lengthf, + Generic_digits parameter_contents + } with { variant "" }; + + + type record PAR_OISCP + { + OCT1 parameter_type, + OCT1 lengthf, + Origination_ISC_point_code parameter_contents + } with { variant "" }; + + + type record PAR_AT + { + OCT1 parameter_type, + OCT1 lengthf, + Access_transport parameter_contents + } with { variant "" }; + + + type record PAR_CPN + { + OCT1 parameter_type, + OCT1 lengthf, + Called_party_number parameter_contents + } with { variant "" }; + + + type record PAR_CGPN + { + OCT1 parameter_type, + OCT1 lengthf, + Called_party_number parameter_contents + } with { variant "" }; + + + + type set IAM_PTSO_optional_part + { + PAR_CGPN callingPartyNum, + PAR_AT accessTransport, + PAR_GD genericDigits, + PAR_OISCP origISCPointCode + } with { variant "" }; + + +type record IAM_PTSO_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Nature_of_connection_indicators natureOfConnInd, + Forward_call_indicators forwardCallInd, + Calling_partys_category callingPartyCat, + Transmission_medium_requirement transmissionMediumReq, + Pointer var_part_ptr, + Pointer opt_part_ptr, + INT1 calledPartyNum_length, + PAR_CPN calledPartyNum, + IAM_PTSO_optional_part iamOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (var_part_ptr) "POINTERTO (calledPartyNum_length)"; + variant (opt_part_ptr) "POINTERTO (iamOptionals)"; + variant (calledPartyNum_length) "LENGTHTO (calledPartyNum)"; + }; + +*/ + + +//************************************************************************ +// LPA - Loop Back Acknowledgement +// Standard Reference ISUP : Chapter 4, Table 39 +//************************************************************************ + type record LPA_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType + } with { variant "" }; + + +//************************************************************************ +// LOP - Loop Prevention +// Ericsson Specification Reference: Chapter 2.2.2.29 +// Standard Reference ISUP : Chapter 4, Table 50 +//************************************************************************ + type set LOP_optional_part + { + Message_compatibility_information messageCompatibilityInfo optional, + Parameter_compatibility_information paramCompatibilityInfo optional, + Call_transfer_reference callTransferReference optional, + Loop_prevention_indicators loopPreventionInd optional + } with { variant "" }; + + + type record LOP_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer opt_part_ptr, + LOP_optional_part lopOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (lopOptionals)"; + }; + + +//************************************************************************ +// NRM - Network Resource Management +// Standard Reference ISUP : Chapter 4, Table 46 +//************************************************************************ + type set NRM_optional_part + { + Message_compatibility_information messageCompatibilityInfo optional, + Parameter_compatibility_information paramCompatibilityInfo optional, + Echo_control_information echoControlInfo optional + } with { variant "" }; + + + type record NRM_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer opt_part_ptr, + NRM_optional_part nrmOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (nrmOptionals)"; + }; + + +//************************************************************************ +// OLM - Overload +// Standard Reference ISUP : Chapter 4, Table 39 +//************************************************************************ + type record OLM_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType + } with { variant "" }; + + + +//************************************************************************ +// OPQ - Operator Queue FS: 2.2.2.32 / 61/15517-CRT 212 31 Uen Rev. A +//************************************************************************ +/* + type set OPQ_optional_part + { + Message_compatibility_information messageCompatibilityInfo optional + } with { variant "" }; + + type record OPQ_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer opt_part_ptr, + OPQ_optional_part opqOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (opqOptionals)" }; + +*/ + + +//************************************************************************ +// OPR - Operator +// Ericsson Specification Reference: Chapter 2.2.2.30 +//************************************************************************ + type set OPR_optional_part + { + Message_compatibility_information messageCompatibilityInfo optional + } with { variant "" }; + + + type record OPR_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer opt_part_ptr, + OPR_optional_part oprOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (oprOptionals)"; + }; + + +//************************************************************************ +// PAM - Pass-along +// Standard Reference ISUP : Chapter 4, Table 43 +//************************************************************************ + type record PAM_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer opt_part_ptr, + OCTN contents optional + } with { variant (opt_part_ptr) "POINTERTO (contents)"; + }; + + +//************************************************************************ +// PRI - Pre-release Information +// Standard Reference ISUP : Chapter 4, Table 52 +//************************************************************************ + type set PRI_optional_part + { + Message_compatibility_information messageCompatibilityInfo optional, + Parameter_compatibility_information paramCompatibilityInfo optional, + Optional_forward_call_indicators optForwardCallInd optional, + Optional_backward_call_indicators optBackwardCallInd optional, + Application_transport_parameter_set ATPP optional + } with { variant (ATPP)"REPEATABLE(yes)";}; + + + type record PRI_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer opt_part_ptr, + PRI_optional_part priOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (priOptionals)"; + }; + + +//************************************************************************ +// REL - Release +// Ericsson Specification Reference: Chapter 2.2.2.31 +// Standard Reference ISUP : Chapter 4, Table 33 +//************************************************************************ + type set REL_optional_part + { + Access_transport accessTransport optional, + User_to_user_indicators userToUserInd optional, + User_to_user_information_OPT userToUserInfo optional, + Automatic_congestion_level autCongLevel optional, + Network_specific_facility networkFacility optional, + Access_delivery_information accessDeliveryInfo optional, + Redirection_number redirectionNum optional, + Redirection_information redirectionInfo optional, + Parameter_compatibility_information paramCompatibilityInfo optional, + + Signalling_point_code sigPointCode optional, + Display_information displayInfo optional, + Remote_operations remoteOperations optional, + HTR_information HTRInfo optional, + Redirect_counter RedirCount optional, + Redirection_number_restriction redirectionNumRest optional, + Redirect_backward_information RedirBI optional + } with { variant "" }; + + type record REL_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer var_part_ptr, + Pointer opt_part_ptr, + Cause_indicators causeInd, + REL_optional_part relOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (var_part_ptr) "POINTERTO (causeInd)"; + variant (opt_part_ptr) "POINTERTO (relOptionals)"; + }; + + +//************************************************************************ +// RLC - Release Complete +// Ericsson Specification Reference: Chapter 2.2.2.32 +// Standard Reference ISUP : Chapter 4, Table 34 +//************************************************************************ + type set RLC_optional_part + { + Cause_indicators_OPT causeInd optional + } with { variant "" }; + + + type record RLC_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer opt_part_ptr, + RLC_optional_part rlcOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (rlcOptionals)"; + }; + + +//************************************************************************ +// RSC - Reset Circuit +// Ericsson Specification Reference: Chapter 2.2.2.33 +// Standard Reference ISUP : Chapter 4, Table 39 +//************************************************************************ + type record RSC_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType + } with { variant "" }; + + +//************************************************************************ +// RES - Resume +// Ericsson Specification Reference: Chapter 2.2.2.34 +// Standard Reference ISUP : Chapter 4, Table 38 +//************************************************************************ + type set RES_optional_part + { + Parameter_compatibility_information paramCompatibilityInfo optional, + + Call_reference callReference optional + } with { variant "" }; + + + type record RES_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Suspend_resume_indicators SUSRESInd, + Pointer opt_part_ptr, + RES_optional_part resOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (resOptionals)"; + }; + + +//************************************************************************ +// SGM - Segmentation +// Ericsson Specification Reference: Chapter 2.2.2.35 +// Standard Reference ISUP : Chapter 4, Table 49 +//************************************************************************ + type set SGM_optional_part + { + Access_transport accessTransport optional, + User_to_user_information_OPT userToUserInfo optional, + Message_compatibility_information messageCompatibilityInfo optional, + Generic_digits_set genericDigits optional, + Generic_notification_indicator_set genericNotificationInd optional, + Generic_number_set genericNum optional, + Calling_name_identity cgNameId optional + } with { variant (genericNotificationInd,genericNum,genericDigits) + "REPEATABLE(yes)";}; + + + type record SGM_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer opt_part_ptr, + SGM_optional_part sgmOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (sgmOptionals)"; + }; + + +//************************************************************************ +// SCB - Special Clear Back +// Ericsson Specification Reference: Chapter 2.2.2.36 +//************************************************************************ + type set SCB_optional_part + { + Message_compatibility_information messageCompatibilityInfo optional + } with { variant "" }; + + + type record SCB_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer opt_part_ptr, + SCB_optional_part scbOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (scbOptionals)"; + }; + + +//************************************************************************ +// SAM - Subsequent Address +// Ericsson Specification Reference: Chapter 2.2.2.37 +// Standard Reference ISUP : Chapter 4, Table 35 +//************************************************************************ + type record SAM_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer var_part_ptr, + Pointer opt_part_ptr, + Subsequent_number subsequentNum, + End_of_optional_parameters_indicator endOfOp + } with { variant (var_part_ptr) "POINTERTO (subsequentNum)"; + variant (opt_part_ptr) "POINTERTO (endOfOp)"; + }; + + +//************************************************************************ +// SDM - Subsequent Directory Number +// Standard Reference ISUP : Chapter 4, Table 53 +//************************************************************************ + type set SDM_optional_part + { + Subsequent_number_OPT subsequentNum optional, + Message_compatibility_information messageCompatibilityInfo optional + } with { variant "" }; + + + type record SDM_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer opt_part_ptr, + SDM_optional_part sdmOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (sdmOptionals)"; + }; + + +//************************************************************************ +// SUS - Suspend +// Ericsson Specification Reference: Chapter 2.2.2.38 +// Standard Reference ISUP : Chapter 4, Table 38 +//************************************************************************ + type set SUS_optional_part + { + Parameter_compatibility_information paramCompatibilityInfo optional, + + Call_reference callReference optional + } with { variant "" }; + + + type record SUS_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Suspend_resume_indicators SUSRESInd, + Pointer opt_part_ptr, + SUS_optional_part susOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (susOptionals)"; + }; + + +//************************************************************************ +// UBL - Unblocking +// Ericsson Specification Reference: Chapter 2.2.2.39 +// Standard Reference ISUP : Chapter 4, Table 39 +//************************************************************************ + type record UBL_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType + } with { variant "" }; + + +//************************************************************************ +// UBA - Unblocking Acknowledgement +// Ericsson Specification Reference: Chapter 2.2.2.40 +// Standard Reference ISUP : Chapter 4, Table 39 +//************************************************************************ + type record UBA_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType + } with { variant "" }; + + +//*************************************************************************** +// UCIC - Unequipped Circuit Identification Code +// Ericsson Specification Reference: Chapter 2.2.2.41 +// Standard Reference ISUP : Chapter 4, Table 39 +//*************************************************************************** + type record UCIC_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType + } with { variant "" }; + + +//************************************************************************ +// UPA - User Part Available +// Ericsson Specification Reference: Chapter 2.2.2.42 +// Standard Reference ISUP : Chapter 4, Table 44 +//************************************************************************ + type set UPA_optional_part + { + Parameter_compatibility_information paramCompatibilityInfo optional + } with { variant ""}; + + + type record UPA_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer opt_part_ptr, + UPA_optional_part upaOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (upaOptionals)"; + }; + + +//************************************************************************ +// UPT - User Part Test +// Ericsson Specification Reference: Chapter 2.2.2.43 +// Standard Reference ISUP : Chapter 4, Table 44 +//************************************************************************ + type set UPT_optional_part + { + Parameter_compatibility_information paramCompatibilityInfo optional + } with { variant "" }; + + + type record UPT_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer opt_part_ptr, + UPT_optional_part uptOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (opt_part_ptr) "POINTERTO (uptOptionals)"; + }; + + +//************************************************************************ +// USR - User-to-user Information +// Ericsson Specification Reference: Chapter 2.2.2.44 +// Standard Reference ISUP : Chapter 4, Table 36 +//************************************************************************ + type set USR_optional_part + { + Access_transport accessTransport optional, + Parameter_compatibility_information paramCompatibilityInfo optional + } with { variant "" }; + + + type record USR_parameters + { + Circuit_identification_code cic optional, + ISUP_Message_type messageType, + Pointer var_part_ptr, + Pointer opt_part_ptr, + User_to_user_information userToUserInfo, + USR_optional_part usrOptionals optional, + End_of_optional_parameters_indicator endOfOp optional + } with { variant (var_part_ptr) "POINTERTO (userToUserInfo)"; + variant (opt_part_ptr) "POINTERTO (usrOptionals)"; + }; + + +//************************************************************************ +//************************************************************************ +//************************************************************************ +//************************************************************************ +//************************************************************************ + +//************************************************************************ +// Top level PDU +//************************************************************************ + type union PDU_ISUP + { + ACM_parameters ISUP_ACM, //Address complete + ANM_parameters ISUP_ANM, //Answer + APM_parameters ISUP_APM, //Application transport + BLO_parameters ISUP_BLO, //Blocking + BLA_parameters ISUP_BLA, //Blocking acknowledgement + CPG_parameters ISUP_CPG, //Call progress + CGB_parameters ISUP_CGB, //Circuit group BLOcking + CGBA_parameters ISUP_CGBA, //Circuit group BLOcking acknowledgement + CQM_parameters ISUP_CQM, //Circuit group query + CQR_parameters ISUP_CQR, //Circuit group query RESponse + GRS_parameters ISUP_GRS, //Circuit group RESet + GRA_parameters ISUP_GRA, //Circuit group RESet acknowledge + CGU_parameters ISUP_CGU, //Circuit group unblocking + CGUA_parameters ISUP_CGUA, //Circuit group unblocking acknowledgement + CRG_parameters ISUP_CRG, //Charge INFormation + CFN_parameters ISUP_CFN, //Confusion + CON_parameters ISUP_CON, //Connect + COT_parameters ISUP_COT, //Continuity + CCR_parameters ISUP_CCR, //Continuity check request + FAC_parameters ISUP_FAC, //Facility + FAA_parameters ISUP_FAA, //Facility accepted + FRJ_parameters ISUP_FRJ, //Facility reject + FAR_parameters ISUP_FAR, //Facility request + FOT_parameters ISUP_FOT, //Forward transfer + IDR_parameters ISUP_IDR, //Identification request + IRS_parameters ISUP_IRS, //Identification RESponse + INF_parameters ISUP_INF, //Information + INR_parameters ISUP_INR, //Information request + IAM_parameters ISUP_IAM, //Initial address +// IAM_PTSO_parameters ISUP_IAM_PTSO, //Modified Initial address + LPA_parameters ISUP_LPA, //Loop back acknowlwdgement + LOP_parameters ISUP_LOP, //Loop prevention + NRM_parameters ISUP_NRM, //Network RESource management + OLM_parameters ISUP_OLM, //Overload +// OPQ_parameters ISUP_OPQ, //Operator Queue + OPR_parameters ISUP_OPR, //Operator + PAM_parameters ISUP_PAM, //Pass-along + PRI_parameters ISUP_PRI, //Pre-release INFormation + REL_parameters ISUP_REL, //Release + RLC_parameters ISUP_RLC, //Release complete + RSC_parameters ISUP_RSC, //Reset circuit + RES_parameters ISUP_RES, //Resume + SGM_parameters ISUP_SGM, //Segmentation + SAM_parameters ISUP_SAM, //Subsequent + SCB_parameters ISUP_SCB, //Special Clear Back + SDM_parameters ISUP_SDM, //Subsequent Directory Number + SUS_parameters ISUP_SUS, //Suspend + UBL_parameters ISUP_UBL, //Unblocking + UBA_parameters ISUP_UBA, //Unblocking acknowledge + UCIC_parameters ISUP_UCIC, //Unequipped cic + UPA_parameters ISUP_UPA, //User part available + UPT_parameters ISUP_UPT, //User part test + USR_parameters ISUP_USR //User-to-user INFormation + } with { variant "TAG( + ISUP_ACM, messageType = '00000110'B; + ISUP_ANM, messageType = '00001001'B; + ISUP_APM, messageType = '01000001'B; + ISUP_BLO, messageType = '00010011'B; + ISUP_BLA, messageType = '00010101'B; + ISUP_CPG, messageType = '00101100'B; + ISUP_CGB, messageType = '00011000'B; + ISUP_CGBA, messageType = '00011010'B; + ISUP_CQM, messageType = '00101010'B; + ISUP_CQR, messageType = '00101011'B; + ISUP_GRS, messageType = '00010111'B; + ISUP_GRA, messageType = '00101001'B; + ISUP_CGU, messageType = '00011001'B; + ISUP_CGUA, messageType = '00011011'B; + ISUP_CRG, messageType = '00110001'B; + ISUP_CFN, messageType = '00101111'B; + ISUP_CON, messageType = '00000111'B; + ISUP_COT, messageType = '00000101'B; + ISUP_CCR, messageType = '00010001'B; + ISUP_FAC, messageType = '00110011'B; + ISUP_FAA, messageType = '00100000'B; + ISUP_FRJ, messageType = '00100001'B; + ISUP_FAR, messageType = '00011111'B; + ISUP_FOT, messageType = '00001000'B; + ISUP_IDR, messageType = '00110110'B; + ISUP_IRS, messageType = '00110111'B; + ISUP_INF, messageType = '00000100'B; + ISUP_INR, messageType = '00000011'B; + ISUP_IAM, messageType = '00000001'B; +// ISUP_IAM_PTSO, messageType = '00000001'B; + ISUP_LPA, messageType = '00100100'B; + ISUP_LOP, messageType = '01000000'B; + ISUP_NRM, messageType = '00110010'B; + ISUP_OLM, messageType = '00110000'B; +// ISUP_OPQ, messageType = '11111110'B; + ISUP_OPR, messageType = '11111111'B; + ISUP_PAM, messageType = '00101000'B; + ISUP_PRI, messageType = '01000010'B; + ISUP_REL, messageType = '00001100'B; + ISUP_RLC, messageType = '00010000'B; + ISUP_RSC, messageType = '00010010'B; + ISUP_RES, messageType = '00001110'B; + ISUP_SGM, messageType = '00111000'B; + ISUP_SAM, messageType = '00000010'B; + ISUP_SCB, messageType = '11111001'B; + ISUP_SDM, messageType = '01000011'B; + ISUP_SUS, messageType = '00001101'B; + ISUP_UBL, messageType = '00010100'B; + ISUP_UBA, messageType = '00010110'B; + ISUP_UCIC, messageType = '00101110'B; + ISUP_UPA, messageType = '00110101'B; + ISUP_UPT, messageType = '00110100'B; + ISUP_USR, messageType = '00101101'B)" + }; + + +//************************************************************************ +//************************************************************************ +//************************************************************************ +//************************************************************************ +//************************************************************************ +}with{ encode "RAW"}//end module diff --git a/NS_v7.3.0_CNL113578_LATEST/doc/NS_v7.3.0_CNL113578_FS.pdf b/NS_v7.3.0_CNL113578_LATEST/doc/NS_v7.3.0_CNL113578_FS.pdf Binary files differnew file mode 100644 index 00000000..d9e43422 --- /dev/null +++ b/NS_v7.3.0_CNL113578_LATEST/doc/NS_v7.3.0_CNL113578_FS.pdf diff --git a/NS_v7.3.0_CNL113578_LATEST/doc/NS_v7.3.0_CNL113578_PRI.pdf b/NS_v7.3.0_CNL113578_LATEST/doc/NS_v7.3.0_CNL113578_PRI.pdf Binary files differnew file mode 100644 index 00000000..efcde4ce --- /dev/null +++ b/NS_v7.3.0_CNL113578_LATEST/doc/NS_v7.3.0_CNL113578_PRI.pdf diff --git a/NS_v7.3.0_CNL113578_LATEST/doc/NS_v7.3.0_CNL113578_UG.pdf b/NS_v7.3.0_CNL113578_LATEST/doc/NS_v7.3.0_CNL113578_UG.pdf Binary files differnew file mode 100644 index 00000000..3ebd9a52 --- /dev/null +++ b/NS_v7.3.0_CNL113578_LATEST/doc/NS_v7.3.0_CNL113578_UG.pdf diff --git a/NS_v7.3.0_CNL113578_LATEST/src/NS_Types.ttcn b/NS_v7.3.0_CNL113578_LATEST/src/NS_Types.ttcn new file mode 100644 index 00000000..f80bae8c --- /dev/null +++ b/NS_v7.3.0_CNL113578_LATEST/src/NS_Types.ttcn @@ -0,0 +1,465 @@ +/////////////////////////////////////////////////////////////////////////////// +// // +// Copyright Test Competence Center (TCC) ETH 2008 // +// // +// 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) has been supplied. // +// // +/////////////////////////////////////////////////////////////////////////////// +// +// File: NS_Types.ttcn +// Rev: R1A01 +// Prodnr: CNL 113 578 +// Updated: 2008-01-22 +// Contact: http://ttcn.ericsson.se +// Reference: 3GPP TS 48.016 7.3.0 + +module NS_Types +{ // beginning of module + +// This module contains the Base Station System (BSS) Serving GPRS Support +// Node (SGSN) interface Network Sevice protocol +// 48.016 v7.3.0 with attributes for RAW encoding/decoding. +// + +// History: +// ******** + +import from General_Types all; + +external function enc_PDU_NS(in PDU_NS pdu) return octetstring +with { extension "prototype(convert)" + extension "encode(RAW)" + } + +external function dec_PDU_NS(in octetstring stream) return PDU_NS +with { extension "prototype(convert)" + extension "decode(RAW)" + } + +type record CauseNS +{ +OCT1 iEI, +BIT1 ext, +LIN1_2 lengthIndicator, +OCT1 cause +} with { + variant (lengthIndicator) "LENGTHTO (cause)"; + variant (lengthIndicator) "CROSSTAG( length1, ext = '1'B; + length2, ext = '0'B;)"; + variant (ext,lengthIndicator) "FIELDORDER(msb)"; + } + +type record NS_VCI +{ +OCT1 iEI, +BIT1 ext, +LIN1_2 lengthIndicator, +OCT2 nS_VCI +} with { + variant (lengthIndicator) "LENGTHTO (nS_VCI)"; + variant (lengthIndicator) "CROSSTAG( length1, ext = '1'B; + length2, ext = '0'B;)"; + variant (ext,lengthIndicator) "FIELDORDER(msb)"; + } + +type record NS_PDU +{ +OCT1 iEI, +BIT1 ext, +LIN1_2 lengthIndicator, +octetstring ns_PDU +} with { + variant (lengthIndicator) "LENGTHTO (ns_PDU)"; + variant (lengthIndicator) "CROSSTAG( length1, ext = '1'B; + length2, ext = '0'B;)"; + variant (ext,lengthIndicator) "FIELDORDER(msb)"; + } + +type record BVCI_NS +{ +OCT1 iEI, +BIT1 ext, +LIN1_2 lengthIndicator, +OCT2 bVCI +} with { + variant (lengthIndicator) "LENGTHTO (bVCI)"; + variant (lengthIndicator) "CROSSTAG( length1, ext = '1'B; + length2, ext = '0'B;)"; + variant (ext,lengthIndicator) "FIELDORDER(msb)"; + } + +type record ListofIP4Elements +{ +OCT1 iEI, +BIT1 ext, +LIN1_2 lengthIndicator, +IP4_Elements iP4_Elements +} with { + variant (lengthIndicator) "LENGTHTO (iP4_Elements)"; + variant (lengthIndicator) "CROSSTAG( length1, ext = '1'B; + length2, ext = '0'B;)"; + variant (ext,lengthIndicator) "FIELDORDER(msb)"; + } + +type record IP4_Element +{ +OCT4 ipAddress, +OCT2 uDP_Port, +OCT1 signallingWeight, +OCT1 dataWeight +} + +type record of IP4_Element IP4_Elements; + +type record ListofIP6Elements +{ +OCT1 iEI, +BIT1 ext, +LIN1_2 lengthIndicator, +IP6_Elements iP6_Elements +} with { + variant (lengthIndicator) "LENGTHTO (iP6_Elements)"; + variant (lengthIndicator) "CROSSTAG( length1, ext = '1'B; + length2, ext = '0'B;)"; + variant (ext,lengthIndicator) "FIELDORDER(msb)"; + } + +type record IP6_Element +{ +OCT16 ipAddress, +OCT2 uDP_Port, +OCT1 signallingWeight, +OCT1 dataWeight +} + +type record of IP6_Element IP6_Elements; + +type record IP_Address_NS +{ +OCT1 iEI, +OCT1 addressType, +IPAddress ipAddress +}with { + variant (ipAddress) "CROSSTAG + ( + ip4Address, addressType = '01'O; + ip6Address, addressType = '02'O; + )" +}; + +type union IPAddress +{ +OCT4 ip4Address, +OCT16 ip6Address +} + +type record EndFlag +{ +BIT1 eBIT, +BIT7 spare +} + +type record ResetFlag +{ +OCT1 iEI, +BIT1 resetBIT, +BIT7 spare +} + +type record MaxNumberOfNSVCs +{ +OCT1 iEI, +OCT2 maxNumberOfNSVCs +} + +type record NumberOfIP_Endpoints +{ +OCT1 iEI, +OCT2 numberOfIP_Endpoints +} + + +type record NSEI_NS +{ +OCT1 iEI, +BIT1 ext, +LIN1_2 lengthIndicator, +OCT2 nSEI +} with { + variant (lengthIndicator) "LENGTHTO (nSEI)"; + variant (lengthIndicator) "CROSSTAG( length1, ext = '1'B; + length2, ext = '0'B;)"; + variant (ext,lengthIndicator) "FIELDORDER(msb)"; + } + +type record NS_SDU_ControlBits +{ +BIT1 rBit, +BIT1 cBit, +BIT6 spare +} + +//same type def as LIN2_2a in BSSGP but named differently +type union LIN1_2 +{ +integer length1, +integer length2 +} with { + variant (length1) "FIELDLENGTH(7)"; + variant (length2) "FIELDLENGTH(15)"; + variant (length2) "BYTEORDER(last)"; + variant (length1,length2) "FIELDORDER(msb)" + } + + +// PDUs ************************************************************ + + +type record PDU_NS_Alive +{ +OCT1 nsPduType +} + +type record PDU_NS_Alive_Ack +{ +OCT1 nsPduType +} + +type record PDU_NS_Block +{ +OCT1 nsPduType, +CauseNS causeNS, //TLV +NS_VCI nS_VCI //TLV +} + +type record PDU_NS_Block_Ack +{ +OCT1 nsPduType, +NS_VCI nS_VCI //TLV +} + +type record PDU_NS_Reset +{ +OCT1 nsPduType, +CauseNS causeNS, //TLV +NS_VCI nS_VCI, //TLV +NSEI_NS nSEI_NS //TLV +} + +type record PDU_NS_Reset_Ack +{ +OCT1 nsPduType, +NS_VCI nS_VCI, //TLV +NSEI_NS nSEI_NS //TLV +} + +type record PDU_NS_Status +{ +OCT1 nsPduType, +CauseNS causeNS, //TLV +NS_VCI nS_VCI optional, //TLV +NS_PDU nS_PDU optional, //TLV +BVCI_NS bVCI_NS optional, //TLV +ListofIP4Elements listofIP4Elements optional, //TLV +ListofIP6Elements listofIP6Elements optional //TLV +} with { + variant "TAG ( + nS_VCI, iEI = '01'O; + nS_PDU, iEI = '02'O; + bVCI_NS, iEI = '03'O; + listofIP4Elements, iEI = '05'O; + listofIP6Elements, iEI = '06'O + )" +} + +type record PDU_NS_Unblock +{ +OCT1 nsPduType +} + +type record PDU_NS_Unblock_Ack +{ +OCT1 nsPduType +} + +type record PDU_NS_Unitdata +{ +OCT1 nsPduType, +NS_SDU_ControlBits nS_SDU_ControlBits, //V +OCT2 bVCI, //V +octetstring nS_SDU //V +// decoder interprets all octets after the +// first 4 octets as NS SDU +} + +type record PDU_SNS_Ack +{ +OCT1 nsPduType, +NSEI_NS nSEI_NS, //TLV +integer transactionID, //V +CauseNS causeNS optional, //TLV +IP_Address_NS iP_Address_NS optional, //TV +ListofIP4Elements listofIP4Elements optional, //TLV +ListofIP6Elements listofIP6Elements optional //TLV +} with { + variant (transactionID) "FIELDLENGTH(8)"; + variant "TAG ( + causeNS, iEI = '00'O; + iP_Address_NS, iEI = '0B'O; + listofIP4Elements, iEI = '05'O; + listofIP6Elements, iEI = '06'O + )" +} + +type record PDU_SNS_Add +{ +OCT1 nsPduType, +NSEI_NS nSEI_NS, //TLV +integer transactionID, //V +ListofIP4Elements listofIP4Elements optional, //TLV +ListofIP6Elements listofIP6Elements optional //TLV +} with { + variant (transactionID) "FIELDLENGTH(8)"; + variant "TAG ( + listofIP4Elements, iEI = '05'O; + listofIP6Elements, iEI = '06'O + )" +} + +type record PDU_SNS_ChangeWeight +{ +OCT1 nsPduType, +NSEI_NS nSEI_NS, //TLV +integer transactionID, //V +ListofIP4Elements listofIP4Elements optional, //TLV +ListofIP6Elements listofIP6Elements optional //TLV +} with { + variant (transactionID) "FIELDLENGTH(8)"; + variant "TAG ( + listofIP4Elements, iEI = '05'O; + listofIP6Elements, iEI = '06'O + )" +} + +type record PDU_SNS_Config +{ +OCT1 nsPduType, +EndFlag endFlag, //V +NSEI_NS nSEI_NS, //TLV +ListofIP4Elements listofIP4Elements optional, //TLV +ListofIP6Elements listofIP6Elements optional //TLV +} with { + variant "TAG ( + listofIP4Elements, iEI = '05'O; + listofIP6Elements, iEI = '06'O + )" +} + + + +type record PDU_SNS_Config_Ack +{ +OCT1 nsPduType, +NSEI_NS nSEI_NS, //TLV +CauseNS causeNS optional //TLV +} with { + variant "TAG (causeNS, iEI = '00'O;)" +} + + + +type record PDU_SNS_Delete +{ +OCT1 nsPduType, +NSEI_NS nSEI_NS, //TLV +integer transactionID, //V +IP_Address_NS iP_Address_NS optional, //TV +ListofIP4Elements listofIP4Elements optional, //TLV +ListofIP6Elements listofIP6Elements optional //TLV +} with { + variant (transactionID) "FIELDLENGTH(8)"; + variant "TAG ( + iP_Address_NS, iEI = '0B'O; + listofIP4Elements, iEI = '05'O; + listofIP6Elements, iEI = '06'O + )" +} + +type record PDU_SNS_Size +{ +OCT1 nsPduType, +NSEI_NS nSEI_NS, //TLV +ResetFlag resetFlag, //TV +MaxNumberOfNSVCs maxNumberOfNSVCs, //TV +NumberOfIP_Endpoints numberOfIP4_Endpoints optional, //TV +NumberOfIP_Endpoints numberOfIP6_Endpoints optional //TV +} with { + variant "TAG ( + numberOfIP4_Endpoints, iEI = '08'O; + numberOfIP6_Endpoints, iEI = '09'O; + )" +} + + +type record PDU_SNS_Size_Ack +{ +OCT1 nsPduType, +NSEI_NS nSEI_NS, +CauseNS causeNS optional //TLV +} with { + variant "TAG (causeNS, iEI = '00'O;)" +} + + + +type union PDU_NS +{ + +PDU_NS_Alive pDU_NS_Alive, +PDU_NS_Alive_Ack pDU_NS_Alive_Ack, +PDU_NS_Block pDU_NS_Block, +PDU_NS_Block_Ack pDU_NS_Block_Ack, +PDU_NS_Reset pDU_NS_Reset, +PDU_NS_Reset_Ack pDU_NS_Reset_Ack, +PDU_NS_Status pDU_NS_Status, +PDU_NS_Unblock pDU_NS_Unblock, +PDU_NS_Unblock_Ack pDU_NS_Unblock_Ack, +PDU_NS_Unitdata pDU_NS_Unitdata, +PDU_SNS_Ack pDU_SNS_Ack, +PDU_SNS_Add pDU_SNS_Add, +PDU_SNS_ChangeWeight pDU_SNS_ChangeWeight, +PDU_SNS_Config pDU_SNS_Config, +PDU_SNS_Config_Ack pDU_SNS_Config_Ack, +PDU_SNS_Delete pDU_SNS_Delete, +PDU_SNS_Size pDU_SNS_Size, +PDU_SNS_Size_Ack pDU_SNS_Size_Ack + +} with { variant "TAG ( + + pDU_NS_Alive, nsPduType ='0A'O; + pDU_NS_Alive_Ack, nsPduType ='0B'O; + pDU_NS_Block, nsPduType ='04'O; + pDU_NS_Block_Ack, nsPduType ='05'O; + pDU_NS_Reset, nsPduType ='02'O; + pDU_NS_Reset_Ack, nsPduType ='03'O; + pDU_NS_Status, nsPduType ='08'O; + pDU_NS_Unblock, nsPduType ='06'O; + pDU_NS_Unblock_Ack, nsPduType ='07'O; + pDU_NS_Unitdata, nsPduType ='00'O; + pDU_SNS_Ack, nsPduType ='0C'O; + pDU_SNS_Add, nsPduType ='0D'O; + pDU_SNS_ChangeWeight, nsPduType ='0E'O; + pDU_SNS_Config, nsPduType ='0F'O; + pDU_SNS_Config_Ack, nsPduType ='10'O; + pDU_SNS_Delete, nsPduType ='11'O; + pDU_SNS_Size, nsPduType ='12'O; + pDU_SNS_Size_Ack, nsPduType ='13'O + + )" +} + + +}with{ encode "RAW"} // end of module diff --git a/ROHC_CNL113426_LATEST/doc/ROHC_CNL113426_FS.pdf b/ROHC_CNL113426_LATEST/doc/ROHC_CNL113426_FS.pdf Binary files differnew file mode 100644 index 00000000..c56cc951 --- /dev/null +++ b/ROHC_CNL113426_LATEST/doc/ROHC_CNL113426_FS.pdf diff --git a/ROHC_CNL113426_LATEST/doc/ROHC_CNL113426_PRI.pdf b/ROHC_CNL113426_LATEST/doc/ROHC_CNL113426_PRI.pdf Binary files differnew file mode 100644 index 00000000..3de5f50e --- /dev/null +++ b/ROHC_CNL113426_LATEST/doc/ROHC_CNL113426_PRI.pdf diff --git a/ROHC_CNL113426_LATEST/doc/ROHC_CNL113426_UG.pdf b/ROHC_CNL113426_LATEST/doc/ROHC_CNL113426_UG.pdf Binary files differnew file mode 100644 index 00000000..bf82ee9d --- /dev/null +++ b/ROHC_CNL113426_LATEST/doc/ROHC_CNL113426_UG.pdf diff --git a/ROHC_CNL113426_LATEST/src/ROHC_EncDec.cc b/ROHC_CNL113426_LATEST/src/ROHC_EncDec.cc new file mode 100644 index 00000000..4023e1b8 --- /dev/null +++ b/ROHC_CNL113426_LATEST/src/ROHC_EncDec.cc @@ -0,0 +1,6767 @@ +///////////////////////////////////////////////////////////////////////////////
+// //
+// Copyright Test Competence Center (TCC) ETH 2003 //
+// //
+// 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) has been supplied. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+//
+// File: ROHC_EncDec.cc
+// Description: ROHC
+// Rev: R3A01 +// Prodnr: CNL 113 426
+// Updated: 2007-02-07
+// Contact: http://ttcn.ericsson.se
+//
+
+/* Based on RFC 3095, July 2001 */
+
+#include "IP_Types.hh"
+#include "UDP_Types.hh"
+#include "RTP_Types.hh"
+#include "ROHC_Types.hh"
+
+/* ============ Constants ============ */
+
+/* Encoding and decoding is performed using static buffers */
+#define MAX_PACKET_SIZE 1500
+#define HEXDUMP_BUFFER_SIZE 1500
+
+/* ROHC mode constants */
+#define ROHC_mode_C 0
+#define ROHC_mode_U 1
+#define ROHC_mode_O 2
+#define ROHC_mode_R 3
+
+/* Inner and outer IP level numbers */
+#define Inner_IP 1
+#define Outer_IP 0
+
+/* ============ Utilities ============ */
+
+#define isIR(val) (((val) & 0xFE) == 0xFC)
+#define isIRDYN(val) ((val) == 0xF8)
+#define isUOR2(val) (((val) & 0xE0) == 0xC0)
+
+/* Shifts the passed bit value from the position 0 to position N. */
+#define ShiftUpBit(val, position) ((val) << (position)) & (0x01 << (position))
+
+/* Shifts the passed bit value from the position N to position 0. */
+#define ShiftDownBit(val, position) (((val) >> (position)) & 0x01)
+
+/* Logs an event, when the 'value' field in the type 'typename' is not
+ implemented. 'typename' must be provided in '"'s */
+#define Log_not_implemented_union_field(typename, value) \
+TTCN_error("Encoding of the selected union field (%u) in type " \
+ typename " is not implemented", (value));
+
+/* Prints a hexdump of the buffer 'buf' in length 'length'. */
+#define Log_hexdump(buf, length) \
+TTCN_logger.log(TTCN_DEBUG, "Buffer (length = %d):\n%s", \
+ (length), debug_hexdump((buf), debug_buf, (length)));
+
+/* Logs the name of the function on entering */
+#define Log_function_name_on_enter() \
+TTCN_logger.log(TTCN_DEBUG, "Entering %s", __FUNCTION__);
+
+/* Logs the name of the function on leaving */
+#define Log_function_name_on_leave() \
+TTCN_logger.log(TTCN_DEBUG, "Leaving %s", __FUNCTION__);
+
+/* Logs an object */
+#define Log_object(o) \
+TTCN_logger.begin_event(TTCN_DEBUG); \
+(o).log(); \
+TTCN_logger.end_event(); \
+
+//**********************************************************
+// NAMESPACE
+//**********************************************************
+
+namespace ROHC__Types {
+
+using namespace General__Types;
+using namespace IP__Types;
+using namespace UDP__Types;
+using namespace RTP__Types;
+
+/* Umbrella type for parsing an incoming ROHC packet */
+typedef struct
+{
+ ROHC__context & context;
+ int cid;
+ int compressed_ah_data_len[2];
+ bool ipx_gre_cksum_present[2];
+} t_dat;
+
+/* TODO: this is not a thread-safe thing to do. For FT, it does not
+ matter, but the buffer should be allocated dynamically. */
+static char debug_buf[HEXDUMP_BUFFER_SIZE];
+
+static char *
+debug_hexdump(const unsigned char *src_buf, char *dest_buf, unsigned int len)
+{
+ unsigned int offset = 0;
+ char val;
+
+ memset(dest_buf, 0, HEXDUMP_BUFFER_SIZE);
+
+ if (src_buf == NULL || len == 0)
+ return dest_buf;
+
+ for (unsigned int i = 0; i < len; i++)
+ {
+ if ((i % 16) == 0 && i > 0)
+ {
+ dest_buf[offset] = 0x0A; /* newline after each line */
+ offset++;
+ }
+ if ((i % 8) == 0)
+ {
+ dest_buf[offset] = 0x20; /* space after 8 characters */
+ offset++;
+ }
+ val = (src_buf[i] >> 4) & 0x0F; /* First digit */
+ val = (val < 10) ? (val + 48) : (val + 65 - 10);
+ dest_buf[offset] = val;
+ offset++;
+ val = src_buf[i] & 0x0F; /* Second digit */
+ val = (val < 10) ? (val + 48) : (val + 65 - 10);
+ dest_buf[offset] += val;
+ offset++;
+ dest_buf[offset] = 0x20; /* space after the value */
+ offset++;
+ }
+
+ return dest_buf;
+}
+
+/* ============ Consistency check routines ============ */
+void
+Check_field_value(char *text, int urherenow, int wannabe)
+{
+ if (wannabe != urherenow)
+ {
+ TTCN_logger.log(TTCN_WARNING, "Field '%s' must be %u, %u is given",
+ text, wannabe, urherenow);
+ }
+}
+
+void
+Check_field_presence(char *text, bool flag, bool presence)
+{
+ if (flag && !presence)
+ {
+ TTCN_logger.log(TTCN_WARNING, "Field '%s' must be present, when "
+ "its presence flag is set", text);
+ }
+ else if (!flag && presence)
+ {
+ TTCN_logger.log(TTCN_WARNING, "Field '%s' must not be present, when "
+ "its presence flag is unset", text);
+ }
+}
+
+void
+Check_feedback_code__size(const INT3b & code, const OPTIONAL < LIN1 > &size)
+{
+ if (size.ispresent() && code > 0)
+ {
+ TTCN_logger.log(TTCN_WARNING,
+ "Code field must be 0, when size field is specified");
+ }
+}
+
+void
+Check_feedback_optlen__optsize(const INT4b & len,
+ const OPTIONAL < OCTETSTRING > &data)
+{
+ if (data.ispresent() && (data().lengthof() != len))
+ {
+ int flen = len;
+ int fdatalen = data().lengthof();
+ TTCN_logger.log(TTCN_WARNING,
+ "Feedback option length (%u) is different from "
+ "the length of feedback option data (%u)", flen, fdatalen);
+ }
+ else if (!data.ispresent() && len > 0)
+ {
+ int flen = len;
+ TTCN_logger.log(TTCN_WARNING,
+ "No feedback option data, but feedback option length "
+ "is not 0 (%u)", flen);
+ }
+}
+
+void
+Check_ps_bit__xi_format(const BIT1 & psbit,
+ const OPTIONAL < XI__list > &xilist)
+{
+ if (!xilist.ispresent())
+ return;
+ if (xilist().get_selection() == XI__list::ALT_xi__item8 && (*psbit) == 0)
+ {
+ TTCN_logger.log(TTCN_WARNING, "PS bit is 0, 4-bit indices must be used");
+ }
+ else if (xilist().get_selection() == XI__list::ALT_xi__item4 && (*psbit) == 1)
+ {
+ TTCN_logger.log(TTCN_WARNING, "PS bit is 1, 8-bit indices must be used");
+ }
+}
+
+INTEGER
+ComputeCRC(const unsigned char *buf, int length, int crclen)
+{
+ int crcval, poly, shiftmask;
+
+ Log_function_name_on_enter();
+ TTCN_logger.log(TTCN_DEBUG, "Calculating CRC-%d over:", crclen);
+ Log_hexdump(buf, length);
+
+ switch (crclen)
+ {
+ case 3:
+ poly = 0x06;
+ crcval = 0x07;
+ shiftmask = 0x03;
+ break;
+
+ case 7:
+ poly = 0x79;
+ crcval = 0x7F;
+ shiftmask = 0x3F;
+ break;
+
+ case 8:
+ poly = 0xE0;
+ crcval = 0xFF;
+ shiftmask = 0x7F;
+ break;
+
+ case 32:
+ poly = 0xEDB88320;
+ crcval = 0xFFFFFFFF;
+ shiftmask = 0x7FFFFFFF;
+ break;
+
+ default:
+ poly = 0;
+ TTCN_error("Unknown CRC length(%d)\n", crclen);
+ break;
+ }
+
+ if (poly == 0)
+ return 0;
+
+ for (int i = 0; i < length; i++)
+ {
+ for (int j = 0; j < 8; j++)
+ {
+ if ((crcval & 0x01) ^ (ShiftDownBit(buf[i], j)))
+ {
+ crcval = (crcval >> 1) & shiftmask;
+ crcval ^= poly;
+ }
+ else
+ {
+ crcval = (crcval >> 1) & shiftmask;
+ }
+ }
+ }
+
+ /* CRC-32 in ROHC needs to be negated at the end */
+ if (crclen == 32)
+ {
+ crcval ^= 0xffffffff;
+ }
+
+ Log_function_name_on_leave();
+
+ unsigned int ui = (unsigned int)crcval;
+ char sbuf[16];
+ sprintf(sbuf, "%u", ui);
+
+ return INTEGER(sbuf);
+}
+
+/* ============ Encoding functions for base types ============ */
+
+/** Returns the index of the innermost IP level, based on the number of
+ IP levels in the context. */
+int
+getInnermostIPidx(t_dat *dat)
+{
+ // More than 1 levels: the innermost is always the index = 1
+ if (dat->context.ip__ctx().size_of() > 1)
+ return Inner_IP;
+ else
+ // The index is the one and only 0.
+ return Outer_IP;
+}
+
+/* Returns the index of the inner or outer IP level in the context, based on the
+ number of the IP levels in the context. If the return value is negative,
+ it indicates that the outer IP level does not exists. Negative value is
+ never returned, if the ip_level is the Inner IP level. */
+int
+getIPidx(t_dat *dat, int ip_level)
+{
+ if (ip_level == Outer_IP)
+ {
+ if (dat->context.ip__ctx().size_of() > 1)
+ return Outer_IP;
+ else
+ return -1;
+ }
+ else if (ip_level == Inner_IP)
+ return getInnermostIPidx(dat);
+ else
+ return ip_level;
+}
+
+/** Initializes the context of the specified IP level. */
+void
+initIPcontext(t_dat *dat, int ip_level, int ip_version)
+{
+ unsigned char ctemp = 0;
+ IP__context & field = dat->context.ip__ctx()[ip_level];
+
+ Log_function_name_on_enter();
+
+ field.version() = INTEGER(ip_version);
+ if (! field.rnd__bit().is_bound()) field.rnd__bit() = BOOLEAN(ctemp);
+ if (! field.ah__present().is_bound()) field.ah__present() = BOOLEAN(ctemp);
+ if (! field.gre__present().is_bound()) field.gre__present() = BOOLEAN(ctemp);
+ if (! field.esp__present().is_bound()) field.esp__present() = BOOLEAN(ctemp);
+ if (! field.ah__data__len().is_bound())
+ field.ah__data__len() = INTEGER(ctemp);
+ if (! field.gre__cksum__present().is_bound())
+ field.gre__cksum__present() = BOOLEAN(ctemp);
+
+ Log_object(dat->context);
+
+ Log_function_name_on_leave();
+}
+
+/** Initializes the UDP context. */
+void
+initUDPcontext(t_dat *dat)
+{
+ unsigned char ctemp = 1;
+ UDP__context & field = dat->context.udp__ctx();
+
+ if (! field.udp__cksum().is_bound()) field.udp__cksum() = BOOLEAN(ctemp);
+}
+
+/** Initializes the specified CID's context. */
+void
+initCIDcontext(t_dat *dat)
+{
+ unsigned char ctemp = 0;
+ ROHC__context & field = dat->context;
+
+ if (! field.mode().is_bound()) field.mode() = INTEGER(cg__ROHC__mode__U);
+ if (! field.profile().is_bound()) field.profile() = INTEGER(ctemp);
+ if (! field.pkt().is_bound()) field.pkt() = Packet__type(Packet__type::IR);
+ if (! field.ip__ctx().is_bound()) initIPcontext(dat, 0, 4);
+ initUDPcontext(dat);
+}
+
+/** Initializes the umbrella type before the ROHC packet parsing starts. */
+t_dat
+initTDAT(ROHC__config & config, int cid)
+{
+ t_dat dat = { config.context()[cid], cid, {0, 0}, {false, false} };
+
+ // Expect AH auth data and GRE checksum after the compressed header
+ // by default. If the uncompressed form is used, these values will be
+ // set to 0 or false during parsing.
+ dat.compressed_ah_data_len[0] =
+ config.context()[cid].ip__ctx()[0].ah__data__len();
+ dat.ipx_gre_cksum_present[0] =
+ config.context()[cid].ip__ctx()[0].gre__cksum__present();
+ if (config.context()[cid].ip__ctx().size_of() > 1)
+ {
+ dat.compressed_ah_data_len[1] =
+ config.context()[cid].ip__ctx()[1].ah__data__len();
+ dat.ipx_gre_cksum_present[1] =
+ config.context()[cid].ip__ctx()[1].gre__cksum__present();
+ }
+ return dat;
+}
+
+/** Returns, whether there is any compressed IPv4 level,
+ where the RND bit is 0. */
+bool
+isAnyIPv4RNDunset(t_dat *dat)
+{
+ for (int i = 0; i < 2; i++)
+ {
+ int ip_idx = getIPidx(dat, i);
+
+ if (ip_idx >= 0) // IP level exists
+ {
+ if (! dat->context.ip__ctx()[ip_idx].rnd__bit())
+ return true;
+ }
+ }
+ return false;
+}
+
+/* Encodes an OCTETSTING value */
+int
+Set_octetstring(unsigned char *buf, const OCTETSTRING & val)
+{
+ memcpy(&(buf[0]), val, val.lengthof());
+ return val.lengthof();
+}
+
+/* Encodes a LIN2_BO_LAST value */
+int
+Set_LIN2_BO_LAST(unsigned char *buf, const LIN2__BO__LAST & val)
+{
+ buf[0] = (val >> 8) & 0xFF;
+ buf[1] = val & 0xFF;
+ return 2;
+}
+
+/* Encodes a LIN4_BO_LAST value */
+int
+Set_LIN4_BO_LAST(unsigned char *buf, const LIN4__BO__LAST & val)
+{
+ buf[0] = (val >> 24) & 0xFF;
+ buf[1] = (val >> 16) & 0xFF;
+ buf[2] = (val >> 8) & 0xFF;
+ buf[3] = val & 0xFF;
+ return 4;
+}
+
+/* Encodes a LIN1 value */
+int
+Set_LIN1(unsigned char *buf, const LIN1 & val)
+{
+ buf[0] = val & 0xFF;
+ return 1;
+}
+
+/* Returns the length of the SDVL encoded CID value 'val'. If the value
+ is invalid, exits via the ttcn_error(). */
+int
+SDVL_encoded_CID_length(int val)
+{
+ if (val <= 0x7F)
+ return 1;
+ else if (val <= 0x3FFF)
+ return 2;
+ else if (val <= 0x1FFFFF)
+ return 3;
+ else if (val <= 0x1FFFFFFF)
+ return 4;
+ else
+ TTCN_error("Value %u is too big for the SDVL encoder "
+ "(at most 29 bits can be used)", val);
+
+ return 0;
+}
+
+int
+Set_SDVL_field(unsigned char *buf, const INTEGER & val, int encoded_length)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if ((val <= 0x7F && encoded_length == 0) || encoded_length == 1)
+ {
+ buf[len] = val & 0x7F;
+ len += 1;
+ }
+ else if ((val <= 0x3FFF && encoded_length == 0) || encoded_length == 2)
+ {
+ buf[len] = 0x80 | ((val >> 8) & 0x7F);
+ len += 1;
+ buf[len] = val & 0xFF;
+ len += 1;
+ }
+ else if ((val <= 0x1FFFFF && encoded_length == 0) || encoded_length == 3)
+ {
+ buf[len] = 0xC0 | ((val >> 16) & 0x3F);
+ len += 1;
+ buf[len] = (val >> 8) & 0xFF;
+ len += 1;
+ buf[len] = val & 0xFF;
+ len += 1;
+ }
+ else if ((val <= 0x1FFFFFFF && encoded_length == 0) || encoded_length == 4)
+ {
+ buf[len] = 0xE0 | ((val >> 24) & 0x1F);
+ len += 1;
+ buf[len] = (val >> 16) & 0xFF;
+ len += 1;
+ buf[len] = (val >> 8) & 0xFF;
+ len += 1;
+ buf[len] = val & 0xFF;
+ len += 1;
+ }
+ else
+ {
+ int tmp = val;
+ TTCN_error("Value %u (specified length is %u) is too big for the "
+ "SDVL encoder (at most 29 bits can be used)",
+ tmp, encoded_length);
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+/* ============ Encoding wrappers for optional base types ============ */
+
+/* Encodes an optional OCTETSTING value */
+int
+Set_octetstring_opt(unsigned char *buf, const OPTIONAL < OCTETSTRING > &val)
+{
+ if (!val.ispresent())
+ return 0;
+ return Set_octetstring(buf, val());
+}
+
+/* Encodes an optional LIN2_BO_LAST value */
+int
+Set_LIN2_BO_LAST_opt(unsigned char *buf,
+ const OPTIONAL < LIN2__BO__LAST > &val)
+{
+ if (!val.ispresent())
+ return 0;
+ return Set_LIN2_BO_LAST(buf, val());
+}
+
+/* Encodes an optional LIN4_BO_LAST value */
+int
+Set_LIN4_BO_LAST_opt(unsigned char *buf,
+ const OPTIONAL < LIN4__BO__LAST > &val)
+{
+ if (!val.ispresent())
+ return 0;
+ return Set_LIN4_BO_LAST(buf, val());
+}
+
+/* Encodes an optional LIN1 value */
+int
+Set_LIN1_opt(unsigned char *buf, const OPTIONAL < LIN1 > &val)
+{
+ if (!val.ispresent())
+ return 0;
+ return Set_LIN1(buf, val());
+}
+
+int
+Set_SDVL_field_opt(unsigned char *buf,
+ const OPTIONAL < INTEGER > &val, int length)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (!val.ispresent())
+ return 0;
+ len += Set_SDVL_field(buf, val(), length);
+ Log_function_name_on_leave();
+ return len;
+}
+
+/* ============ Encoding functions for common ROHC types ============ */
+
+int
+Set_CID(unsigned char *buf, const INTEGER & cid, BOOLEAN const &large_cid)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (large_cid == false)
+ {
+ if (cid > 0)
+ {
+ buf[len] = 0xE0 + (cid & 0x0F);
+ len += 1;
+ }
+ }
+ else
+ len += Set_SDVL_field(&buf[len], cid, 0);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+/* CSRC and IP extension header item list encoding */
+int
+Set_Item_list_opt(unsigned char *buf, const OPTIONAL < Item__list > &item_list)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (!item_list.ispresent())
+ {
+ Log_function_name_on_leave();
+ return len;
+ }
+
+ /* Item list is an IP extension header list */
+ if (item_list().get_selection() == Item__list::ALT_ip__item__list)
+ {
+ IP__Item__list ip_item_list = item_list().ip__item__list();
+
+ for (int num = 0; num < ip_item_list.size_of(); num++)
+ {
+ int start_pos = len;
+
+ switch (ip_item_list[num].get_selection())
+ {
+ case Item::ALT_ipv6__ext__item:
+ {
+ IPv6__ext__item & item = ip_item_list[num].ipv6__ext__item();
+
+ len += Set_LIN1(&buf[len], item.nexthead());
+ /* Length of the header in 8-octet units, not including
+ the first 8 octets. */
+ if (item.hdr__ext__len() == 0)
+ {
+ if ((item.data().lengthof() + 2) % 8 != 0)
+ {
+ TTCN_error("Invalid length (%u) of the IPv6 extension header",
+ item.data().lengthof());
+ }
+ buf[len] = (item.data().lengthof() + 2) / 8 - 1;
+ len += 1;
+ }
+ else
+ len += Set_LIN1(&buf[len], item.hdr__ext__len());
+ len += Set_octetstring(&buf[len], item.data());
+ break;
+ }
+ case Item::ALT_mine__item:
+ {
+ MINE__item & item = ip_item_list[num].mine__item();
+
+ Check_field_value("MINE protocol", item.protocol(), c__ip__proto__mine);
+ Check_field_value("MINE reserved", *item.reserved(), 0);
+
+ len += Set_LIN1(&buf[len], item.protocol());
+ buf[len] = (*item.s__bit()) << 7;
+ buf[len] += *item.reserved();
+ len += 1;
+ len += Set_LIN2_BO_LAST(&buf[len], item.cksum());
+ len += Set_octetstring(&buf[len], item.dstaddr());
+ len += Set_octetstring_opt(&buf[len], item.srcaddr());
+ break;
+ }
+ case Item::ALT_ah__item:
+ {
+ AH__item & item = ip_item_list[num].ah__item();
+
+ Check_field_value("AH nexthead", item.nexthead(), c__ip__proto__ah);
+ len += Set_LIN1(&buf[len], item.nexthead());
+
+ /* RFC 2402: This 8-bit field specifies the length of AH in
+ 32-bit words (4-byte units), minus "2". */
+ if (item.payload__len() == 0)
+ {
+ if (item.auth__data().ispresent())
+ buf[len] = (item.auth__data()().lengthof() / 4) + 3 - 2;
+ else
+ buf[len] = 1;
+ len += 1;
+ }
+ else
+ len += Set_LIN1(&buf[len], item.payload__len());
+
+ Check_field_value("AH reserved", item.reserved(), 0);
+ len += Set_LIN2_BO_LAST(&buf[len], item.reserved());
+ len += Set_LIN4_BO_LAST(&buf[len], item.spi());
+ len += Set_LIN4_BO_LAST(&buf[len], item.sn());
+ len += Set_octetstring_opt(&buf[len], item.auth__data());
+ break;
+ }
+ case Item::ALT_esp__item:
+ {
+ ESP__item & item = ip_item_list[num].esp__item();
+
+ Check_field_value("ESP nexthead", item.nexthead(), c__ip__proto__esp);
+ len += Set_LIN1(&buf[len], item.nexthead());
+ len += Set_LIN4_BO_LAST(&buf[len], item.spi());
+ len += Set_LIN4_BO_LAST(&buf[len], item.sn());
+ break;
+ }
+ case Item::ALT_gre__item:
+ {
+ GRE__item & item = ip_item_list[num].gre__item();
+
+ Check_field_value("GRE nexthead", item.nexthead(), c__ip__proto__gre2);
+ len += Set_LIN1(&buf[len], item.nexthead());
+ buf[len] = (*item.C__bit()) << 7;
+ Check_field_value("GRE reserved1", (int) *item.reserved__1(), 0);
+ buf[len] += (*item.reserved__1()) << 6;
+ buf[len] += (*item.K__bit()) << 5;
+ buf[len] += (*item.S__bit()) << 4;
+ Check_field_value("GRE reserved2", (int) *item.reserved__2(), 0);
+ buf[len] += (*item.reserved__2()) << 3;
+ buf[len] += *item.version();
+ len += 1;
+ Check_field_presence("checksum", *item.C__bit() == 1,
+ item.cksum().ispresent());
+ Check_field_presence("key", *item.K__bit() == 1,
+ item.key().ispresent());
+ Check_field_presence("sn", *item.S__bit() == 1,
+ item.sn().ispresent());
+ len += Set_LIN2_BO_LAST_opt(&buf[len], item.cksum());
+ len += Set_LIN4_BO_LAST_opt(&buf[len], item.key());
+ len += Set_LIN4_BO_LAST_opt(&buf[len], item.sn());
+ break;
+ }
+ default:
+ {
+ Log_not_implemented_union_field("Item",
+ ip_item_list[num].get_selection());
+ break;
+ }
+ }
+ TTCN_logger.log(TTCN_DEBUG, "%uth item:", num);
+ Log_hexdump(&(buf[start_pos]), len - start_pos);
+ }
+ }
+ else if (item_list().get_selection() == Item__list::ALT_csrc__item__list)
+ {
+ /* Item list is CSRC item list */
+ for (int num = 0; num < item_list().csrc__item__list().size_of(); num++)
+ {
+ int start_pos = len;
+
+ len += Set_octetstring( &buf[len],
+ item_list().csrc__item__list()[num] );
+ TTCN_logger.log(TTCN_DEBUG, "%uth item:", num);
+ Log_hexdump(&(buf[start_pos]), len - start_pos);
+ }
+ }
+ else if (item_list().get_selection() == Item__list::ALT_raw__data)
+ {
+ /* Item list is a raw octetstring */
+ for (int num = 0; num < item_list().csrc__item__list().size_of(); num++)
+ {
+ int start_pos = len;
+
+ len += Set_octetstring(&buf[len], item_list().raw__data()[num] );
+ TTCN_logger.log(TTCN_DEBUG, "%uth item:", num);
+ Log_hexdump(&(buf[start_pos]), len - start_pos);
+ }
+ }
+ else
+ {
+ Log_not_implemented_union_field("Item_list", item_list().get_selection());
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_XI_list_opt(unsigned char *buf, const OPTIONAL < XI__list > &xilist,
+ const OPTIONAL < BITSTRING > &padding, int length)
+{
+ int len = 0;
+ int halfbyte = 0;
+
+ Log_function_name_on_enter();
+
+ if (!xilist.ispresent())
+ {
+ Log_function_name_on_leave();
+ return len;
+ }
+
+ switch (xilist().get_selection())
+ {
+ case XI__list::ALT_xi__item4:
+ {
+ if (length != xilist().xi__item4().size_of())
+ TTCN_logger.log(TTCN_WARNING,
+ "Number of indices != value of CC field");
+ for (int num = 0; num < xilist().xi__item4().size_of(); num++)
+ {
+ if (halfbyte)
+ {
+ buf[len] += ((*xilist().xi__item4()[num].x__ind()) << 3) & 0x08;
+ buf[len] += xilist().xi__item4()[num].index() & 0x07;
+ len += 1;
+ }
+ else
+ {
+ buf[len] = ((*xilist().xi__item4()[num].x__ind()) << 7) & 0x80;
+ buf[len] += (xilist().xi__item4()[num].index() << 4) & 0x70;
+ }
+ halfbyte = 1 - halfbyte; // Invert the value (0 -> 1 or 1 -> 0)
+ }
+ break;
+ }
+
+ case XI__list::ALT_xi__item8:
+ {
+ if (length != xilist().xi__item8().size_of())
+ TTCN_logger.log(TTCN_WARNING,
+ "Number of indices != value of CC field");
+ for (int num = 0; num < xilist().xi__item8().size_of(); num++)
+ {
+ buf[len] = ((*xilist().xi__item8()[num].x__ind()) << 7) & 0x80;
+ buf[len] += xilist().xi__item8()[num].index() & 0x7F;
+ len += 1;
+ }
+ break;
+ }
+
+ default:
+ Log_not_implemented_union_field("XI_list", xilist().get_selection());
+ break;
+ }
+
+ if (padding.ispresent() && halfbyte == 0)
+ {
+ TTCN_logger.log(TTCN_WARNING, "Specified padding is ignored");
+ }
+ else if (!padding.ispresent() && halfbyte)
+ {
+ TTCN_logger.log(TTCN_WARNING,
+ "Padding not specified, padding bits left uninitialized");
+ }
+ else if (padding.ispresent())
+ {
+ Check_field_value("Index padding", *padding(), 0);
+ buf[len] += (*padding()) & 0x0F;
+ len += 1;
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Encoding_Type_0(unsigned char *buf, const Enc__Type__0 & enct0)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_presence("gen_id", *enct0.gp__bit() == 1,
+ enct0.gen__id().ispresent());
+
+ Check_field_value("Encoding type", *enct0.et(), 0);
+ buf[len] = ((*enct0.et()) << 6) & 0xC0;
+ buf[len] += ShiftUpBit(*enct0.gp__bit(), 5);
+ buf[len] += ShiftUpBit(*enct0.ps__bit(), 4);
+ buf[len] += enct0.cc() & 0x0F;
+ len += 1;
+ len += Set_LIN1_opt(&buf[len], enct0.gen__id());
+ Check_ps_bit__xi_format(enct0.ps__bit(), enct0.xi__list());
+ len += Set_XI_list_opt(&buf[len], enct0.xi__list(), enct0.padding(),
+ enct0.cc());
+ len += Set_Item_list_opt(&buf[len], enct0.item__list());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+
+int
+Set_Encoding_Type_1(unsigned char *buf, const Enc__Type__1 & enct1)
+{
+ int len = 0;
+ int n = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_presence("gen_id", *enct1.gp__bit() == 1,
+ enct1.gen__id().ispresent());
+
+ Check_field_value("Encoding type", *enct1.et(), 1);
+ buf[len] = ((*enct1.et()) << 6) & 0xC0;
+ buf[len] += ShiftUpBit(*enct1.gp__bit(), 5);
+ buf[len] += ShiftUpBit(*enct1.ps__bit(), 4);
+ buf[len] += enct1.xi1() & 0x0F;
+ len += 1;
+ len += Set_LIN1_opt(&buf[len], enct1.gen__id());
+ len += Set_LIN1_opt(&buf[len], enct1.ref__id());
+ len += Set_octetstring(&buf[len], enct1.insbitmask());
+
+ // Count the number of 1's in the bitmask
+ for (int i = 0; i < enct1.insbitmask().lengthof(); ++i)
+ {
+ if (enct1.insbitmask() & int2oct(i + 1, enct1.insbitmask().lengthof()))
+ ++n;
+ }
+
+ Check_ps_bit__xi_format(enct1.ps__bit(), enct1.xi__list());
+ len += Set_XI_list_opt(&buf[len], enct1.xi__list(), enct1.padding(), n);
+ len += Set_Item_list_opt(&buf[len], enct1.item__list());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+
+int
+Set_Encoding_Type_2(unsigned char *buf, const Enc__Type__2 & enct2)
+{
+ int len = 0;
+
+ Check_field_presence("gen_id", *enct2.gp__bit() == 1,
+ enct2.gen__id().ispresent());
+
+ Check_field_value("Encoding type", *enct2.et(), 2);
+ buf[len] = ((*enct2.et()) << 6) & 0xC0;
+ buf[len] += ShiftUpBit(*enct2.gp__bit(), 5);
+ buf[len] += ShiftUpBit(*enct2.res(), 4);
+ buf[len] += enct2.count() & 0x0F;
+ len += 1;
+ len += Set_LIN1_opt(&buf[len], enct2.gen__id());
+ len += Set_LIN1_opt(&buf[len], enct2.ref__id());
+ len += Set_octetstring(&buf[len], enct2.rembitmask());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+
+int
+Set_Encoding_Type_3(unsigned char *buf, const Enc__Type__3 & enct3)
+{
+ int len = 0;
+ int n = 0;
+
+ Check_field_presence("gen_id", *enct3.gp__bit() == 1,
+ enct3.gen__id().ispresent());
+
+ Check_field_value("Encoding type", *enct3.et(), 3);
+ buf[len] = ((*enct3.et()) << 6) & 0xC0;
+ buf[len] += ShiftUpBit(*enct3.gp__bit(), 5);
+ buf[len] += ShiftUpBit(*enct3.ps__bit(), 4);
+ buf[len] += enct3.xi1() & 0x0F;
+ len += 1;
+ len += Set_LIN1_opt(&buf[len], enct3.gen__id());
+ len += Set_LIN1_opt(&buf[len], enct3.ref__id());
+ len += Set_octetstring(&buf[len], enct3.rembitmask());
+ len += Set_octetstring(&buf[len], enct3.insbitmask());
+
+ // Count the number of 1's in the bitmask
+ for (int i = 0; i < enct3.insbitmask().lengthof(); ++i)
+ {
+ if (enct3.insbitmask() & int2oct(i + 1, enct3.insbitmask().lengthof()))
+ ++n;
+ }
+ Check_ps_bit__xi_format(enct3.ps__bit(), enct3.xi__list());
+ len += Set_XI_list_opt(&buf[len], enct3.xi__list(), enct3.padding(), n);
+ len += Set_Item_list_opt(&buf[len], enct3.item__list());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Compr_head_list_opt(unsigned char *buf,
+ const OPTIONAL < Compr__head__list > &chl)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (!chl.ispresent())
+ {
+ Log_function_name_on_leave();
+ return len;
+ }
+ if (chl().get_selection() == Compr__head__list::ALT_enctype0)
+ len += Set_Encoding_Type_0(&buf[len], chl().enctype0());
+ else if (chl().get_selection() == Compr__head__list::ALT_enctype1)
+ len += Set_Encoding_Type_1(&buf[len], chl().enctype1());
+ else if (chl().get_selection() == Compr__head__list::ALT_enctype2)
+ len += Set_Encoding_Type_2(&buf[len], chl().enctype2());
+ else if (chl().get_selection() == Compr__head__list::ALT_enctype3)
+ len += Set_Encoding_Type_3(&buf[len], chl().enctype3());
+ else
+ {
+ Log_not_implemented_union_field("Compr_head_list", chl().get_selection());
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_AEGSeqnum_opt(unsigned char *buf, const OPTIONAL < AEGSeqnum > &oseqn)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (!oseqn.ispresent())
+ {
+ Log_function_name_on_leave();
+ return len;
+ }
+ if (oseqn().get_selection() == AEGSeqnum::ALT_short__form)
+ {
+ Check_field_value("form-bit", (int) *oseqn().short__form().ind(), 0);
+ buf[len] = ShiftUpBit(*oseqn().short__form().ind(), 7);
+ buf[len] += oseqn().short__form().lsb__of__seqnum() & 0x7F;
+ len += 1;
+ }
+ else if (oseqn().get_selection() == AEGSeqnum::ALT_long__form)
+ {
+ Check_field_value("form-bit", (int) *oseqn().long__form().ind(), 1);
+ buf[len] = ShiftUpBit(*oseqn().long__form().ind(), 7);
+ buf[len] += (oseqn().long__form().lsb__of__seqnum() >> 24) & 0x7F;
+ len += 1;
+
+ buf[len] = (oseqn().long__form().lsb__of__seqnum() >> 16) & 0xFF;
+ len += 1;
+
+ buf[len] = (oseqn().long__form().lsb__of__seqnum() >> 8) & 0xFF;
+ len += 1;
+
+ buf[len] = oseqn().long__form().lsb__of__seqnum() & 0xFF;
+ len += 1;
+ }
+ else
+ Log_not_implemented_union_field("AEGSeqnum", oseqn().get_selection());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_IPv4_static_chain(unsigned char *buf, const IPv4__Static & chain)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("IPv4 version", chain.version(), 4);
+ buf[len] = (chain.version() << 4) & 0xF0;
+ Check_field_value("IPv4 reserved (static chain)", chain.reserved(), 0);
+ buf[len] += chain.reserved() & 0x0F;
+ len += 1;
+ len += Set_LIN1(&buf[len], chain.proto());
+ len += Set_octetstring(&buf[len], chain.srcaddr());
+ len += Set_octetstring(&buf[len], chain.dstaddr());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_IPv6_static_chain(unsigned char *buf, const IPv6__Static & chain)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("IPv6 version", chain.version(), 6);
+ buf[len] = (chain.version() << 4) & 0xF0;
+ buf[len] += (chain.flowlabel() >> 16) & 0x0F;
+ len += 1;
+
+ buf[len] = (chain.flowlabel() >> 8) & 0xFF;
+ len += 1;
+ buf[len] = chain.flowlabel() & 0xFF;
+ len += 1;
+
+ len += Set_LIN1(&buf[len], chain.nexthead());
+ len += Set_octetstring(&buf[len], chain.srcaddr());
+ len += Set_octetstring(&buf[len], chain.dstaddr());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_UDP_static_chain(unsigned char *buf, const UDP__Static & chain)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ len += Set_LIN2_BO_LAST(&buf[len], chain.srcport());
+ len += Set_LIN2_BO_LAST(&buf[len], chain.dstport());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_RTP_static_chain(unsigned char *buf, const RTP__Static & chain)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ len += Set_octetstring(&buf[len], chain.ssrc());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_RTP_dynamic_chain(unsigned char *buf, const RTP__Dynamic & chain)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("RTP version", chain.vfield(), 2);
+ buf[len] = (chain.vfield() << 6) & 0xC0;
+ buf[len] += ShiftUpBit(*chain.pbit(), 5);
+ buf[len] += ShiftUpBit(*chain.rxbit(), 4);
+ buf[len] += chain.ccfield() & 0x0F;
+ len += 1;
+ buf[len] = ShiftUpBit(*chain.mbit(), 7);
+ buf[len] += chain.ptfield() & 0x7F;
+ len += 1;
+ len += Set_LIN2_BO_LAST(&buf[len], chain.rtpseqnum());
+ len += Set_LIN4_BO_LAST(&buf[len], chain.rtpts());
+ len += Set_Encoding_Type_0(&buf[len], chain.gencsrclist());
+ Check_field_presence("RTP rx", *chain.rxbit() == 1,
+ chain.rx__field().ispresent());
+ if (chain.rx__field().ispresent())
+ {
+ Check_field_value("RX reserved", (int) *chain.rx__field()().reserved(), 0);
+ buf[len] = ((*chain.rx__field()().reserved()) << 5) & 0xE0;
+ buf[len] += ShiftUpBit(*chain.rx__field()().xbit(), 4);
+ buf[len] += (chain.rx__field()().mode() << 2) & 0x0C;
+ buf[len] += ShiftUpBit(*chain.rx__field()().tisbit(), 1);
+ buf[len] += ShiftUpBit(*chain.rx__field()().tssbit(), 0);
+ len += 1;
+ }
+ Check_field_presence("TS Stride",
+ chain.rx__field().ispresent() &&
+ (*chain.rx__field()().tssbit()) == 1,
+ chain.ts__stride().ispresent());
+ Check_field_presence("TIME Stride",
+ chain.rx__field().ispresent() &&
+ (*chain.rx__field()().tisbit()) == 1,
+ chain.time__stride().ispresent());
+ len += Set_SDVL_field_opt(&buf[len], chain.ts__stride(), 0);
+ len += Set_SDVL_field_opt(&buf[len], chain.time__stride(), 0);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_RTP_flags_fields_opt(unsigned char *buf,
+ const OPTIONAL < RTP__flags__fields > &field)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (!field.ispresent())
+ {
+ Log_function_name_on_leave();
+ return len;
+ }
+ buf[len] = (field().mode() << 6) & 0xC0;
+ buf[len] += ShiftUpBit(*field().r__pt(), 5);
+ buf[len] += ShiftUpBit(*field().m__bit(), 4);
+ buf[len] += ShiftUpBit(*field().r__x(), 3);
+ buf[len] += ShiftUpBit(*field().csrc(), 2);
+ buf[len] += ShiftUpBit(*field().tss(), 1);
+ buf[len] += ShiftUpBit(*field().tis(), 0);
+ len += 1;
+
+ Check_field_presence("RTP flags",
+ *field().r__pt() == 1, field().flags().ispresent());
+ if (field().flags().ispresent())
+ {
+ buf[len] = (((*field().flags()().r__p()) << 7) & 0x80) +
+ (field().flags()().rtp__pt() & 0x7F);
+ len += 1;
+ }
+ Check_field_presence("Compressed CSRC list",
+ *field().csrc() == 1, field().csrc__list().ispresent());
+ len += Set_Compr_head_list_opt(&buf[len], field().csrc__list());
+ Check_field_presence("TS_STRIDE",
+ *field().tss() == 1, field().ts__stride().ispresent());
+ len += Set_SDVL_field_opt(&buf[len], field().ts__stride(), 0);
+ Check_field_presence("TIME_STRIDE",
+ *field().tis() == 1,
+ field().time__stride().ispresent());
+ len += Set_SDVL_field_opt(&buf[len], field().time__stride(), 0);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_IPv4_dynamic_chain(unsigned char *buf, const IPv4__Dynamic & chain)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ len += Set_LIN1(&buf[len], chain.tos());
+ len += Set_LIN1(&buf[len], chain.ttl());
+ len += Set_LIN2_BO_LAST(&buf[len], chain.identification());
+
+ buf[len] = ShiftUpBit(*chain.df__bit(), 7);
+ buf[len] += ShiftUpBit(*chain.rnd__bit(), 6);
+ buf[len] += ShiftUpBit(*chain.nbo__bit(), 5);
+ Check_field_value("IPv4 reserved (dynamic chain)", *chain.reserved(), 0);
+ buf[len] += (*chain.reserved()) & 0x1F;
+ len += 1;
+ len += Set_Encoding_Type_0(&buf[len], chain.genextheadlist());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_IPv6_dynamic_chain(unsigned char *buf, const IPv6__Dynamic & chain)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ len += Set_LIN1(&buf[len], chain.trafficclass());
+ len += Set_LIN1(&buf[len], chain.hoplimit());
+ len += Set_Encoding_Type_0(&buf[len], chain.genextheadlist());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+/* ============ Encoding functions for ROHC types ============ */
+int
+Set_feedback(unsigned char *buf, const Feedback__u & feedback,
+ BOOLEAN const &large_cid)
+{
+ int len = 0, crcpos = 0, crcstart = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("feedback type", (int) *feedback.feedback__type(), 30);
+ Check_feedback_code__size(feedback.code(), feedback.size());
+ buf[len] = ((*feedback.feedback__type()) << 3) & 0xF8;
+ buf[len] += feedback.code() & 0x07;
+ len += 1;
+
+ len += Set_LIN1_opt(&buf[len], feedback.size());
+
+ crcstart = len;
+
+ len += Set_CID(&buf[len], feedback.feedback__data().cid(), large_cid);
+
+ switch (feedback.feedback__data().feedback__type().get_selection())
+ {
+ case Feedback__type::ALT_feedback1:
+ {
+ Feedback1 fback1 =
+ feedback.feedback__data().feedback__type().feedback1();
+
+ len += Set_octetstring(&buf[len], fback1);
+ break;
+ }
+
+ case Feedback__type::ALT_feedback2:
+ {
+ Feedback2 fback2 =
+ feedback.feedback__data().feedback__type().feedback2();
+
+ buf[len] = (fback2.acktype() << 6) & 0xC0;
+ buf[len] += (fback2.mode() << 4) & 0x30;
+ buf[len] += (fback2.sn() >> 8) & 0x0F;
+ len += 1;
+
+ buf[len] = fback2.sn() & 0xFF;
+ len += 1;
+
+ if (fback2.feedback__opts().ispresent())
+ {
+ Feedback__opts & fbopts = fback2.feedback__opts();
+
+ for (int num = 0; num < fbopts.size_of(); num++)
+ {
+ buf[len] = (fbopts[num].opt__type() << 4) & 0xF0;
+ Check_feedback_optlen__optsize(fbopts[num].opt__len(),
+ fbopts[num].opt__data());
+ buf[len] += fbopts[num].opt__len() & 0x0F;
+ len += 1;
+
+ len += Set_octetstring_opt(&buf[len], fbopts[num].opt__data());
+ if (fbopts[num].opt__data().ispresent())
+ {
+ if ((fbopts[num].opt__len() == 1)
+ && (fbopts[num].opt__type() == 1) && (buf[len - 1] == 0))
+ crcpos = len - 1;
+ }
+ }
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ if (feedback.size().ispresent() && feedback.size() == 0)
+ {
+ buf[1] = (len - 2) & 0xFF;
+ }
+ if ((!feedback.size().ispresent()) && feedback.code() == 0)
+ {
+ buf[0] = (buf[0] & 0xF8) + ((len - 1) & 0x07);
+ }
+
+ if ((crcpos > crcstart) && (buf[crcpos] == 0))
+ buf[crcpos] = ComputeCRC(&(buf[crcstart]), len - crcstart, 8);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_ROHC_Feedback_opt(unsigned char *buf,
+ const OPTIONAL < Feedback > &feedback,
+ BOOLEAN const &large_cid)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (!feedback.ispresent())
+ {
+ Log_function_name_on_leave();
+ return len;
+ }
+ for (int num = 0; num < feedback().size_of(); num++)
+ {
+ len += Set_feedback(&buf[len], feedback()[num], large_cid);
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+ return len;
+}
+
+/* Inserts CID infomation into the buffer by moving memory areas */
+int
+Set_CID_for_packets(unsigned char *buf, ROHC__config const &config,
+ int cid, int buflen)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (config.large__cid() == false)
+ { /* Small CID: first octet is the CID */
+ if (cid > 0)
+ {
+ // Overlapping memory areas, use memmove
+ memmove(&(buf[1]), &(buf[0]), buflen);
+ buf[0] = 0xE0 + (cid & 0x0F);
+ len += 1;
+ }
+ }
+ else
+ { /* Large CID: CID is placed after the first octet */
+ int cidlen = SDVL_encoded_CID_length(cid);
+
+ // Overlapping memory areas, use memmove
+ memmove(&(buf[1 + cidlen]), &(buf[1]), buflen - 1);
+ len += Set_SDVL_field(&(buf[1]), cid, 0);
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_ROHC_Header_Profile0(unsigned char *buf,
+ const Profile0__headers & hdr,
+ ROHC__config const &config)
+{
+ int len = 0, crcpos = 0, cidlen, cid;
+
+ Log_function_name_on_enter();
+
+ switch (hdr.get_selection())
+ {
+ case Profile0__headers::ALT_ir:
+ {
+ cid = hdr.ir().cid();
+ Check_field_value("packet type", (int) *hdr.ir().type__ind(), 126);
+ buf[len] = ((*hdr.ir().type__ind()) << 1) & 0xFE;
+ buf[len] += (*hdr.ir().d()) & 0x01;
+ len += 1;
+ Check_field_value("profile", hdr.ir().profile(), 0);
+ len += Set_LIN1(&buf[len], hdr.ir().profile());
+ crcpos = len;
+ len += Set_LIN1(&buf[len], hdr.ir().crc());
+ len += Set_octetstring(&buf[len], hdr.ir().orig__packet());
+ break;
+ }
+
+ case Profile0__headers::ALT_normal:
+ {
+ cid = hdr.normal().cid();
+ len += Set_octetstring(&buf[len], hdr.normal().orig__packet());
+ break;
+ }
+
+ default:
+ Log_not_implemented_union_field("Profile0_headers", hdr.get_selection());
+ break;
+ }
+
+ cidlen = Set_CID_for_packets(buf, config, cid, len);
+ crcpos += cidlen;
+ len += cidlen;
+
+ if (hdr.get_selection() == Profile0__headers::ALT_ir && hdr.ir().crc() == 0)
+ {
+ buf[crcpos] = ComputeCRC(&(buf[0]), crcpos, 8);
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+ return len;
+}
+
+int
+Set_Static_Chain_Profile1(unsigned char *buf, const Static__Chain & chain)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ for (int num = 0; num < chain.size_of(); num++)
+ {
+ switch (chain[num].get_selection())
+ {
+ case Static__Chain__u::ALT_ipv4__stat:
+ len += Set_IPv4_static_chain(&buf[len], chain[num].ipv4__stat());
+ break;
+ case Static__Chain__u::ALT_ipv6__stat:
+ len += Set_IPv6_static_chain(&buf[len], chain[num].ipv6__stat());
+ break;
+ case Static__Chain__u::ALT_udp__stat:
+ len += Set_UDP_static_chain(&buf[len], chain[num].udp__stat());
+ break;
+ case Static__Chain__u::ALT_rtp__stat:
+ len += Set_RTP_static_chain(&buf[len], chain[num].rtp__stat());
+ break;
+ default:
+ Log_not_implemented_union_field
+ ("Static_Chain_u", chain[num].get_selection());
+ break;
+ }
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Dynamic_Chain_Profile1(unsigned char *buf, const Dynamic__Chain & dynch)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ for (int num = 0; num < dynch.size_of(); num++)
+ {
+ switch (dynch[num].get_selection())
+ {
+ case Dynamic__Chain__u::ALT_ipv4__dyn:
+ len += Set_IPv4_dynamic_chain(&buf[len], dynch[num].ipv4__dyn());
+ break;
+ case Dynamic__Chain__u::ALT_ipv6__dyn:
+ len += Set_IPv6_dynamic_chain(&buf[len], dynch[num].ipv6__dyn());
+ break;
+ case Dynamic__Chain__u::ALT_udp__dyn:
+ len += Set_LIN2_BO_LAST(&buf[len], dynch[num].udp__dyn().cksum());
+ break;
+ case Dynamic__Chain__u::ALT_rtp__dyn:
+ len += Set_RTP_dynamic_chain(&buf[len], dynch[num].rtp__dyn());
+ break;
+ default:
+ Log_not_implemented_union_field
+ ("Dynamic_Chain_u", dynch[num].get_selection());
+ break;
+ }
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_ROHC_Header_ir(unsigned char *buf,
+ const Profile1__IR__header & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("packet type", (int) *hdr.type__ind(), 126);
+ buf[len] = ((*hdr.type__ind()) << 1) & 0xFE;
+ Check_field_presence("dynamic chain", *hdr.d() == 1,
+ hdr.dyn__chain().ispresent());
+ buf[len] += ShiftUpBit(*hdr.d(), 0);
+ len += 1;
+ Check_field_value("profile", hdr.profile(), 1);
+ len += Set_LIN1(&buf[len], hdr.profile());
+ len += Set_LIN1(&buf[len], hdr.crc());
+ len += Set_Static_Chain_Profile1(&buf[len], hdr.stat__chain());
+ if (hdr.dyn__chain().ispresent())
+ len += Set_Dynamic_Chain_Profile1(&buf[len], hdr.dyn__chain());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_ROHC_Header_irdyn(unsigned char *buf,
+ const Profile1__IR__DYN__header & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("packet type", (int) *hdr.type__ind(), 248);
+ buf[len] = *hdr.type__ind();
+ len += 1;
+ Check_field_value("profile", hdr.profile(), 1);
+ len += Set_LIN1(&buf[len], hdr.profile());
+ len += Set_LIN1(&buf[len], hdr.crc());
+ len += Set_Dynamic_Chain_Profile1(&buf[len], hdr.dyn__chain());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_ROHC_Header_r0(unsigned char *buf,
+ const Profile1__R__0__header & hdr)
+{
+ Log_function_name_on_enter();
+
+ Check_field_value("packet type", (int) *hdr.type__ind(), 0);
+ buf[0] = ((*hdr.type__ind()) << 6) & 0xC0;
+ buf[0] += hdr.sn() & 0x3F;
+
+ Log_hexdump(buf, 1);
+ Log_function_name_on_leave();
+
+ return 1;
+}
+
+int
+Set_Profile1_ROHC_Header_r0crc(unsigned char *buf,
+ const Profile1__R__0__CRC__header & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("packet type", (int) *hdr.type__ind(), 1);
+ buf[len] = ((*hdr.type__ind()) << 6) & 0xC0;
+ buf[len] += (hdr.sn() >> 1) & 0x3F;
+ len += 1;
+ buf[len] = (hdr.sn() << 7) & 0x80;
+ buf[len] += hdr.crc() & 0x7F;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_ROHC_Header_uo0(unsigned char *buf,
+ const Profile1__UO__0__header & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("packet type", (int) *hdr.type__ind(), 0);
+ buf[len] = ((*hdr.type__ind()) << 7) & 0x80;
+ buf[len] += (hdr.sn() << 3) & 0x78;
+ buf[len] += hdr.crc() & 0x07;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_ROHC_Header_r1(unsigned char *buf,
+ const Profile1__R__1__header & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("packet type", (int) *hdr.type__ind(), 2);
+ buf[len] = ((*hdr.type__ind()) << 6) & 0xC0;
+ buf[len] += hdr.sn() & 0x3F;
+ len += 1;
+ buf[len] = ShiftUpBit(*hdr.m__bit(), 7);
+ buf[len] += ShiftUpBit(*hdr.x__bit(), 6);
+ buf[len] += hdr.ts() & 0x3F;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_ROHC_Header_r1id(unsigned char *buf,
+ const Profile1__R__1__ID__header & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("packet type", (int) *hdr.type__ind(), 2);
+ buf[len] = ((*hdr.type__ind()) << 6) & 0xC0;
+ buf[len] += hdr.sn() & 0x3F;
+ len += 1;
+ buf[len] = ShiftUpBit(*hdr.m__bit(), 7);
+ buf[len] += ShiftUpBit(*hdr.x__bit(), 6);
+ Check_field_value("T-bit", (int) *hdr.t__bit(), 0);
+ buf[len] += ShiftUpBit(*hdr.t__bit(), 5);
+ buf[len] += hdr.ip__id() & 0x1F;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_ROHC_Header_r1ts(unsigned char *buf,
+ const Profile1__R__1__TS__header & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("packet type", (int) *hdr.type__ind(), 2);
+ buf[len] = ((*hdr.type__ind()) << 6) & 0xC0;
+ buf[len] += hdr.sn() & 0x3F;
+ len += 1;
+ buf[len] = ShiftUpBit(*hdr.m__bit(), 7);
+ buf[len] += ShiftUpBit(*hdr.x__bit(), 6);
+ Check_field_value("T-bit", (int) *hdr.t__bit(), 1);
+ buf[len] += ShiftUpBit(*hdr.t__bit(), 5);
+ buf[len] += hdr.ts() & 0x1F;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_ROHC_Header_uo1(unsigned char *buf,
+ const Profile1__UO__1__header & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("packet type", (int) *hdr.type__ind(), 2);
+ buf[len] = ((*hdr.type__ind()) << 6) & 0xC0;
+ buf[len] += hdr.ts() & 0x3F;
+ len += 1;
+ buf[len] = ShiftUpBit(*hdr.m__bit(), 7);
+ buf[len] += (hdr.sn() << 3) & 0x78;
+ buf[len] += hdr.crc() & 0x07;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_ROHC_Header_uo1id(unsigned char *buf,
+ const Profile1__UO__1__ID__header & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("packet type", (int) *hdr.type__ind(), 2);
+ buf[len] = ((*hdr.type__ind()) << 6) & 0xC0;
+ Check_field_value("T-bit", (int) *hdr.t__bit(), 0);
+ buf[len] += ShiftUpBit(*hdr.t__bit(), 5);
+ buf[len] += hdr.ip__id() & 0x1F;
+ len += 1;
+ buf[len] = ShiftUpBit(*hdr.x__bit(), 7);
+ buf[len] += (hdr.sn() << 3) & 0x78;
+ buf[len] += hdr.crc() & 0x07;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_ROHC_Header_uo1ts(unsigned char *buf,
+ const Profile1__UO__1__TS__header & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("packet type", (int) *hdr.type__ind(), 2);
+ buf[len] = ((*hdr.type__ind()) << 6) & 0xC0;
+ Check_field_value("T-bit", (int) *hdr.t__bit(), 1);
+ buf[len] += ShiftUpBit(*hdr.t__bit(), 5);
+ buf[len] += hdr.ts() & 0x1F;
+ len += 1;
+ buf[len] = ShiftUpBit(*hdr.m__bit(), 7);
+ buf[len] += (hdr.sn() << 3) & 0x78;
+ buf[len] += hdr.crc() & 0x07;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_ROHC_Header_uor2(unsigned char *buf,
+ const Profile1__UOR__2__header & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("packet type", (int) *hdr.type__ind(), 6);
+ buf[len] = ((*hdr.type__ind()) << 5) & 0xE0;
+ buf[len] += (hdr.ts() >> 1) & 0x1F;
+ len += 1;
+ buf[len] = (hdr.ts() << 7) & 0x80;
+ buf[len] += ShiftUpBit(*hdr.m__bit(), 6);
+ buf[len] += hdr.sn() & 0x3F;
+ len += 1;
+ buf[len] = ShiftUpBit(*hdr.x__bit(), 7);
+ buf[len] += hdr.crc() & 0x7F;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_ROHC_Header_uor2id(unsigned char *buf,
+ const Profile1__UOR__2__ID__header & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("packet type", (int) *hdr.type__ind(), 6);
+ buf[len] = ((*hdr.type__ind()) << 5) & 0xE0;
+ buf[len] += hdr.ip__id() & 0x1F;
+ len += 1;
+ Check_field_value("T-bit", (int) *hdr.t__bit(), 0);
+ buf[len] = ShiftUpBit(*hdr.t__bit(), 7);
+ buf[len] += ShiftUpBit(*hdr.m__bit(), 6);
+ buf[len] += hdr.sn() & 0x3F;
+ len += 1;
+ buf[len] = ShiftUpBit(*hdr.x__bit(), 7);
+ buf[len] += hdr.crc() & 0x7F;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_ROHC_Header_uor2ts(unsigned char *buf,
+ const Profile1__UOR__2__TS__header & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("packet type", (int) *hdr.type__ind(), 6);
+ Log_hexdump(buf, len);
+ buf[len] = ((*hdr.type__ind()) << 5) & 0xE0;
+ buf[len] += hdr.ts() & 0x1F;
+ len += 1;
+ Check_field_value("T-bit", (int) *hdr.t__bit(), 1);
+ buf[len] = ShiftUpBit(*hdr.t__bit(), 7);
+ buf[len] += ShiftUpBit(*hdr.m__bit(), 6);
+ buf[len] += hdr.sn() & 0x3F;
+ len += 1;
+ buf[len] = ShiftUpBit(*hdr.x__bit(), 7);
+ buf[len] += hdr.crc() & 0x7F;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_Inner_IP_flags_opt(unsigned char *buf,
+ const OPTIONAL < Inner__IP__flags > &field)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (!field.ispresent())
+ {
+ Log_function_name_on_leave();
+ return len;
+ }
+ buf[len] = ShiftUpBit(*field().tos(), 7);
+ buf[len] += ShiftUpBit(*field().ttl(), 6);
+ buf[len] += ShiftUpBit(*field().df(), 5);
+ buf[len] += ShiftUpBit(*field().pr(), 4);
+ buf[len] += ShiftUpBit(*field().ipx(), 3);
+ buf[len] += ShiftUpBit(*field().nbo(), 2);
+ buf[len] += ShiftUpBit(*field().rnd__bit(), 1);
+ buf[len] += ShiftUpBit(*field().ip2__bit(), 0);
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_Outer_IP_flags_opt(unsigned char *buf,
+ const OPTIONAL < Outer__IP__flags > &field)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (!field.ispresent())
+ {
+ Log_function_name_on_leave();
+ return len;
+ }
+ buf[len] = ShiftUpBit(*field().tos2(), 7);
+ buf[len] += ShiftUpBit(*field().ttl2(), 6);
+ buf[len] += ShiftUpBit(*field().df2(), 5);
+ buf[len] += ShiftUpBit(*field().pr2(), 4);
+ buf[len] += ShiftUpBit(*field().ipx2(), 3);
+ buf[len] += ShiftUpBit(*field().nbo2(), 2);
+ buf[len] += ShiftUpBit(*field().rnd2(), 1);
+ buf[len] += ShiftUpBit(*field().i2__bit(), 0);
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_ipx_headers_opt(unsigned char *buf,
+ const OPTIONAL < IP__Ext__heads > &field)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (!field.ispresent())
+ {
+ Log_function_name_on_leave();
+ return len;
+ }
+ buf[len] = ShiftUpBit(*field().cl(), 7);
+ buf[len] += ShiftUpBit(*field().aseq(), 6);
+ buf[len] += ShiftUpBit(*field().eseq(), 5);
+ buf[len] += ShiftUpBit(*field().gseq(), 4);
+ buf[len] += (*field().res()) & 0x0F;
+ len += 1;
+
+ Check_field_presence("AH SN", *field().aseq() == 1,
+ field().ah__seq().ispresent());
+ Check_field_presence("ESP SN", *field().eseq() == 1,
+ field().esp__seq().ispresent());
+ Check_field_presence("GRE SN", *field().gseq() == 1,
+ field().gre__seq().ispresent());
+ Check_field_presence("Compressed header list", *field().cl() == 1,
+ field().compr__head__list().ispresent());
+ len += Set_AEGSeqnum_opt(&buf[len], field().ah__seq());
+ len += Set_AEGSeqnum_opt(&buf[len], field().esp__seq());
+ len += Set_AEGSeqnum_opt(&buf[len], field().gre__seq());
+ len += Set_Compr_head_list_opt(&buf[len], field().compr__head__list());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_Inner_IP_fields_opt(unsigned char *buf,
+ const OPTIONAL < Inner__IP__flags > &flags,
+ const OPTIONAL < Inner__IP__fields > &field)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (!field.ispresent())
+ {
+ Log_function_name_on_leave();
+ return len;
+ }
+ Check_field_presence("TOS (inner IP)",
+ flags.ispresent() && (*flags().tos() == 1),
+ field().tos().ispresent());
+ len += Set_LIN1_opt(&buf[len], field().tos());
+ Check_field_presence("TTL (inner IP)",
+ flags.ispresent() && (*flags().ttl() == 1),
+ field().ttl().ispresent());
+ len += Set_LIN1_opt(&buf[len], field().ttl());
+ Check_field_presence("PROTO (inner IP)",
+ flags.ispresent() && (*flags().pr() == 1),
+ field().proto().ispresent());
+ len += Set_LIN1_opt(&buf[len], field().proto());
+
+ Check_field_presence("IP extension headers (inner IP)",
+ flags.ispresent() && (*flags().ipx() == 1),
+ field().ext__heads().ispresent());
+ len += Set_Profile1_ipx_headers_opt(&buf[len], field().ext__heads());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_Outer_IP_fields_opt(unsigned char *buf,
+ const OPTIONAL < Outer__IP__flags > &flags,
+ const OPTIONAL < Outer__IP__fields > &field)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (!field.ispresent())
+ {
+ Log_function_name_on_leave();
+ return len;
+ }
+ Check_field_presence("TOS (outer IP)",
+ flags.ispresent() && (*flags().tos2() == 1),
+ field().tos().ispresent());
+ len += Set_LIN1_opt(&buf[len], field().tos());
+ Check_field_presence("TTL (outer IP)",
+ flags.ispresent() && (*flags().ttl2() == 1),
+ field().ttl().ispresent());
+ len += Set_LIN1_opt(&buf[len], field().ttl());
+ Check_field_presence("PROTO (outer IP)",
+ flags.ispresent() && (*flags().pr2() == 1),
+ field().proto().ispresent());
+ len += Set_LIN1_opt(&buf[len], field().proto());
+
+ Check_field_presence("IP extension headers (outer IP)",
+ flags.ispresent() && (*flags().ipx2() == 1),
+ field().ext__heads().ispresent());
+ len += Set_Profile1_ipx_headers_opt(&buf[len], field().ext__heads());
+ Check_field_presence("IP-ID (outer IP)",
+ flags.ispresent() && (*flags().i2__bit() == 1),
+ field().ip__id().ispresent());
+ len += Set_LIN2_BO_LAST_opt(&buf[len], field().ip__id());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_ROHC_Header_Extension0(unsigned char *buf, const Extension0 & ext)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("extension type", (int) *ext.ext__type(), 0);
+ buf[len] = ((*ext.ext__type()) << 6) & 0xC0;
+ buf[len] += (ext.sn() << 3) & 0x38;
+ buf[len] += ext.plust() & 0x07;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_ROHC_Header_Extension1(unsigned char *buf, const Extension1 & ext)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("extension type", (int) *ext.ext__type(), 1);
+ buf[len] = ((*ext.ext__type()) << 6) & 0xC0;
+ buf[len] += (ext.sn() << 3) & 0x38;
+ buf[len] += ext.plust() & 0x07;
+ len += 1;
+ len += Set_LIN1(&buf[len], ext.minust());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_ROHC_Header_Extension2(unsigned char *buf, const Extension2 & ext)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("extension type", (int) *ext.ext__type(), 2);
+ buf[len] = ((*ext.ext__type()) << 6) & 0xC0;
+ buf[len] += (ext.sn() << 3) & 0x38;
+ buf[len] += (ext.plust() >> 8) & 0x07;
+ len += 1;
+ buf[len] = ext.plust() & 0xFF;
+ len += 1;
+ len += Set_LIN1(&buf[len], ext.minust());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_ROHC_Header_Extension3(unsigned char *buf, const Extension3 & ext)
+{
+ int len = 0;
+ int ts_length = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("extension type", (int) *ext.ext__type(), 3);
+ buf[len] = ((*ext.ext__type()) << 6) & 0xC0;
+ buf[len] += ShiftUpBit(*ext.s__bit(), 5);
+ buf[len] += ShiftUpBit(*ext.r__ts__bit(), 4);
+ buf[len] += ShiftUpBit(*ext.tsc__bit(), 3);
+ buf[len] += ShiftUpBit(*ext.i__bit(), 2);
+ buf[len] += ShiftUpBit(*ext.ip__bit(), 1);
+ buf[len] += ShiftUpBit(*ext.rtp__bit(), 0);
+ len += 1;
+
+ Check_field_presence("Inner IP flags",
+ *ext.ip__bit() == 1,
+ ext.inner__ip__flags().ispresent());
+ len += Set_Profile1_Inner_IP_flags_opt(&buf[len], ext.inner__ip__flags());
+ Check_field_presence("Outer IP flags",
+ ext.inner__ip__flags().ispresent() &&
+ (*ext.inner__ip__flags()().ip2__bit() == 1),
+ ext.outer__ip__flags().ispresent());
+ len += Set_Profile1_Outer_IP_flags_opt(&buf[len], ext.outer__ip__flags());
+ Check_field_presence("SN", *ext.s__bit() == 1, ext.sn().ispresent());
+ len += Set_LIN1_opt(&buf[len], ext.sn());
+ Check_field_presence("RTP TS", *ext.r__ts__bit() == 1, ext.ts().ispresent());
+ if (ext.ts__length().ispresent()) ts_length = ext.ts__length()();
+ len += Set_SDVL_field_opt(&buf[len], ext.ts(), ts_length);
+ Check_field_presence("Inner IP fields",
+ *ext.ip__bit() == 1, ext.inner__ip__hdr().ispresent());
+ len += Set_Profile1_Inner_IP_fields_opt(&buf[len], ext.inner__ip__flags(),
+ ext.inner__ip__hdr());
+ Check_field_presence("Inner IP-ID",
+ *ext.i__bit() == 1, ext.ip__id().ispresent());
+ len += Set_LIN2_BO_LAST_opt(&buf[len], ext.ip__id());
+ Check_field_presence("Outer IP fields",
+ ext.inner__ip__flags().ispresent() &&
+ (*ext.inner__ip__flags()().ip2__bit() == 1),
+ ext.outer__ip__hdr().ispresent());
+ len += Set_Profile1_Outer_IP_fields_opt(&buf[len], ext.outer__ip__flags(),
+ ext.outer__ip__hdr());
+ Check_field_presence("RTP flags and fields",
+ *ext.rtp__bit() == 1, ext.rtp__fl__fi().ispresent());
+ len += Set_RTP_flags_fields_opt(&buf[len], ext.rtp__fl__fi());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_ROHC_Header_Extension_opt(unsigned char *buf,
+ const OPTIONAL < Profile1__Extension >
+ &ext)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (ext.ispresent())
+ {
+ if (ext().get_selection() == Profile1__Extension::ALT_ext0)
+ {
+ len += Set_Profile1_ROHC_Header_Extension0(&buf[len], ext().ext0());
+ }
+ else if (ext().get_selection() == Profile1__Extension::ALT_ext1)
+ {
+ len += Set_Profile1_ROHC_Header_Extension1(&buf[len], ext().ext1());
+ }
+ else if (ext().get_selection() == Profile1__Extension::ALT_ext2)
+ {
+ len += Set_Profile1_ROHC_Header_Extension2(&buf[len], ext().ext2());
+ }
+ else if (ext().get_selection() == Profile1__Extension::ALT_ext3)
+ {
+ len += Set_Profile1_ROHC_Header_Extension3(&buf[len], ext().ext3());
+ }
+ else
+ {
+ Log_not_implemented_union_field("Profile1_Extension",
+ ext().get_selection());
+ }
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_ROHC_Header_ipid_ah_gre(unsigned char *buf,
+ const Profile1__headers & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ len += Set_LIN2_BO_LAST_opt(&buf[len], hdr.ip__id__outer());
+ len += Set_octetstring_opt(&buf[len], hdr.ah__outer());
+ len += Set_LIN2_BO_LAST_opt(&buf[len], hdr.gre__cksum1());
+ len += Set_LIN2_BO_LAST_opt(&buf[len], hdr.ip__id__inner());
+ len += Set_octetstring_opt(&buf[len], hdr.ah__inner());
+ len += Set_LIN2_BO_LAST_opt(&buf[len], hdr.gre__cksum2());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile1_ROHC_Header(unsigned char *buf,
+ const Profile1__headers & hdr,
+ ROHC__config const &config)
+{
+ int len = 0, crcpos = 0, cidlen = 0, cid;
+
+ Log_function_name_on_enter();
+
+ switch (hdr.base__header().get_selection())
+ {
+ case Profile1__base__header::ALT_ir:
+ cid = hdr.base__header().ir().cid();
+ crcpos = len + 2;
+ len += Set_Profile1_ROHC_Header_ir(&buf[len], hdr.base__header().ir());
+ break;
+ case Profile1__base__header::ALT_ir__dyn:
+ cid = hdr.base__header().ir__dyn().cid();
+ crcpos = len + 2;
+ len += Set_Profile1_ROHC_Header_irdyn(&buf[len],
+ hdr.base__header().ir__dyn());
+ break;
+ case Profile1__base__header::ALT_r__0:
+ cid = hdr.base__header().r__0().cid();
+ len += Set_Profile1_ROHC_Header_r0(&buf[len], hdr.base__header().r__0());
+ break;
+ case Profile1__base__header::ALT_r__0__crc:
+ cid = hdr.base__header().r__0__crc().cid();
+ len += Set_Profile1_ROHC_Header_r0crc(&buf[len],
+ hdr.base__header().r__0__crc());
+ break;
+ case Profile1__base__header::ALT_uo__0:
+ cid = hdr.base__header().uo__0().cid();
+ len += Set_Profile1_ROHC_Header_uo0(&buf[len], hdr.base__header().uo__0());
+ break;
+ case Profile1__base__header::ALT_r__1:
+ cid = hdr.base__header().r__1().cid();
+ len += Set_Profile1_ROHC_Header_r1(&buf[len], hdr.base__header().r__1());
+ break;
+ case Profile1__base__header::ALT_r__1__id:
+ cid = hdr.base__header().r__1__id().cid();
+ len +=
+ Set_Profile1_ROHC_Header_r1id(&buf[len], hdr.base__header().r__1__id());
+ break;
+ case Profile1__base__header::ALT_r__1__ts:
+ cid = hdr.base__header().r__1__ts().cid();
+ len +=
+ Set_Profile1_ROHC_Header_r1ts(&buf[len], hdr.base__header().r__1__ts());
+ break;
+ case Profile1__base__header::ALT_uo__1:
+ cid = hdr.base__header().uo__1().cid();
+ len += Set_Profile1_ROHC_Header_uo1(&buf[len], hdr.base__header().uo__1());
+ break;
+ case Profile1__base__header::ALT_uo__1__id:
+ cid = hdr.base__header().uo__1__id().cid();
+ len +=
+ Set_Profile1_ROHC_Header_uo1id(&buf[len],
+ hdr.base__header().uo__1__id());
+ break;
+ case Profile1__base__header::ALT_uo__1__ts:
+ cid = hdr.base__header().uo__1__ts().cid();
+ len +=
+ Set_Profile1_ROHC_Header_uo1ts(&buf[len],
+ hdr.base__header().uo__1__ts());
+ break;
+ case Profile1__base__header::ALT_uor__2:
+ cid = hdr.base__header().uor__2().cid();
+ len +=
+ Set_Profile1_ROHC_Header_uor2(&buf[len], hdr.base__header().uor__2());
+ break;
+ case Profile1__base__header::ALT_uor__2__id:
+ cid = hdr.base__header().uor__2__id().cid();
+ len +=
+ Set_Profile1_ROHC_Header_uor2id(&buf[len],
+ hdr.base__header().uor__2__id());
+ break;
+ case Profile1__base__header::ALT_uor__2__ts:
+ cid = hdr.base__header().uor__2__ts().cid();
+ len +=
+ Set_Profile1_ROHC_Header_uor2ts(&buf[len],
+ hdr.base__header().uor__2__ts());
+ break;
+ default:
+ Log_not_implemented_union_field
+ ("Profile1_base_header", hdr.base__header().get_selection());
+ break;
+ }
+
+ len += Set_Profile1_ROHC_Header_Extension_opt(&buf[len], hdr.ext());
+ len += Set_Profile1_ROHC_Header_ipid_ah_gre(&buf[len], hdr);
+ len += Set_LIN2_BO_LAST_opt(&buf[len], hdr.udp__cksum());
+
+ cidlen = Set_CID_for_packets(buf, config, cid, len);
+ crcpos += cidlen;
+ len += cidlen;
+
+ if (hdr.base__header().get_selection() == Profile1__base__header::ALT_ir
+ && hdr.base__header().ir().crc() == 0)
+ buf[crcpos] = ComputeCRC(&(buf[0]), len, 8);
+ else if (hdr.base__header().get_selection() ==
+ Profile1__base__header::ALT_ir__dyn
+ && hdr.base__header().ir__dyn().crc() == 0)
+ buf[crcpos] = ComputeCRC(&(buf[0]), len, 8);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile2_Static_Chain(unsigned char
+ *buf, const Profile2__Static__Chain & chain)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ for (int num = 0; num < chain.size_of(); num++)
+ {
+ switch (chain[num].get_selection())
+ {
+ case Static__Chain__u::ALT_ipv4__stat:
+ len += Set_IPv4_static_chain(&buf[len], chain[num].ipv4__stat());
+ break;
+ case Static__Chain__u::ALT_ipv6__stat:
+ len += Set_IPv6_static_chain(&buf[len], chain[num].ipv6__stat());
+ break;
+ case Static__Chain__u::ALT_udp__stat:
+ len += Set_UDP_static_chain(&buf[len], chain[num].udp__stat());
+ break;
+ default:
+ Log_not_implemented_union_field
+ ("Profile2_Static_Chain", chain[num].get_selection());
+ break;
+ }
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile2_Dynamic_Chain(unsigned char
+ *buf, const Profile2__Dynamic__Chain & dynch)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ for (int num = 0; num < dynch.size_of(); num++)
+ {
+ switch (dynch[num].get_selection())
+ {
+ case Profile2__Dynamic__Chain__u::ALT_ipv4__dyn:
+ len += Set_IPv4_dynamic_chain(&buf[len], dynch[num].ipv4__dyn());
+ break;
+ case Profile2__Dynamic__Chain__u::ALT_ipv6__dyn:
+ len += Set_IPv6_dynamic_chain(&buf[len], dynch[num].ipv6__dyn());
+ break;
+ case Profile2__Dynamic__Chain__u::ALT_udp__dyn:
+ len += Set_LIN2_BO_LAST(&buf[len], dynch[num].udp__dyn().cksum());
+ len += Set_LIN2_BO_LAST(&buf[len], dynch[num].udp__dyn().udp__sn());
+ break;
+ default:
+ Log_not_implemented_union_field
+ ("Profile2_Dynamic_Chain", dynch[num].get_selection());
+ break;
+ }
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile2_ROHC_Header_ir(unsigned char
+ *buf, const Profile2__IR__header & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("packet type", (int) *hdr.type__ind(), 126);
+ buf[len] = ((*hdr.type__ind()) << 1) & 0xFE;
+ Check_field_presence("dynamic chain", *hdr.d() == 1,
+ hdr.dyn__chain().ispresent());
+ buf[len] += ShiftUpBit(*hdr.d(), 0);
+ len += 1;
+ Check_field_value("profile", hdr.profile(), 2);
+ len += Set_LIN1(&buf[len], hdr.profile());
+ len += Set_LIN1(&buf[len], hdr.crc());
+ len += Set_Profile2_Static_Chain(&buf[len], hdr.stat__chain());
+ if (hdr.dyn__chain().ispresent())
+ len += Set_Profile2_Dynamic_Chain(&buf[len], hdr.dyn__chain());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile2_ROHC_Header_irdyn(unsigned
+ char *buf,
+ const Profile2__IR__DYN__header & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("packet type", (int) *hdr.type__ind(), 248);
+ buf[len] = *hdr.type__ind();
+ len += 1;
+ Check_field_value("profile", hdr.profile(), 2);
+ len += Set_LIN1(&buf[len], hdr.profile());
+ len += Set_LIN1(&buf[len], hdr.crc());
+ len += Set_Profile2_Dynamic_Chain(&buf[len], hdr.dyn__chain());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile2_ROHC_Header_r1(unsigned char
+ *buf, const Profile2__R__1__header & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("packet type", (int) *hdr.type__ind(), 2);
+ buf[len] = ((*hdr.type__ind()) << 6) & 0xC0;
+ buf[len] += hdr.sn() & 0x3F;
+ len += 1;
+ buf[len] = ShiftUpBit(*hdr.x__bit(), 7);
+ buf[len] += hdr.ip__id() & 0x7F;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile2_ROHC_Header_uo1(unsigned char
+ *buf, const Profile2__UO__1__header & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("packet type", (int) *hdr.type__ind(), 2);
+ buf[len] = ((*hdr.type__ind()) << 6) & 0xC0;
+ buf[len] += hdr.ip__id() & 0x3F;
+ len += 1;
+ buf[len] = (hdr.sn() << 3) & 0xF8;
+ buf[len] += hdr.crc() & 0x07;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile2_ROHC_Header_uor2(unsigned char *buf,
+ const Profile2__UOR__2__header & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("packet type", (int) *hdr.type__ind(), 6);
+ buf[len] = ((*hdr.type__ind()) << 5) & 0xE0;
+ buf[len] += hdr.sn() & 0x1F;
+ len += 1;
+ buf[len] = ShiftUpBit(*hdr.x__bit(), 7);
+ buf[len] += hdr.crc() & 0x7F;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile2_Inner_IP_flags_opt(unsigned char *buf,
+ const OPTIONAL < Profile2__Inner__IP__flags >
+ &field)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (!field.ispresent())
+ {
+ Log_function_name_on_leave();
+ return len;
+ }
+ buf[len] = ShiftUpBit(*field().tos(), 7);
+ buf[len] += ShiftUpBit(*field().ttl(), 6);
+ buf[len] += ShiftUpBit(*field().df(), 5);
+ buf[len] += ShiftUpBit(*field().pr(), 4);
+ buf[len] += ShiftUpBit(*field().ipx(), 3);
+ buf[len] += ShiftUpBit(*field().nbo(), 2);
+ buf[len] += ShiftUpBit(*field().rnd__bit(), 1);
+ Check_field_value("inner IP flags, reserved", (int) *field().reserved(), 0);
+ buf[len] += ShiftUpBit(*field().reserved(), 0);
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile2_Inner_IP_fields_opt(unsigned char *buf,
+ const OPTIONAL < Profile2__Inner__IP__flags >
+ &flags,
+ const OPTIONAL < Inner__IP__fields > &field)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (!field.ispresent())
+ {
+ Log_function_name_on_leave();
+ return len;
+ }
+ Check_field_presence("TOS (inner IP)",
+ flags.ispresent() && (*flags().tos() == 1),
+ field().tos().ispresent());
+ len += Set_LIN1_opt(&buf[len], field().tos());
+ Check_field_presence("TTL (inner IP)",
+ flags.ispresent() && (*flags().ttl() == 1),
+ field().ttl().ispresent());
+ len += Set_LIN1_opt(&buf[len], field().ttl());
+ Check_field_presence("PROTO (inner IP)",
+ flags.ispresent() && (*flags().pr() == 1),
+ field().proto().ispresent());
+ len += Set_LIN1_opt(&buf[len], field().proto());
+
+ len += Set_Profile1_ipx_headers_opt(&buf[len], field().ext__heads());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+
+int
+Set_Profile2_ROHC_Header_Extension0(unsigned char *buf,
+ const Profile2__Extension0 & ext)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("extension type", (int) *ext.ext__type(), 0);
+ buf[len] = ((*ext.ext__type()) << 6) & 0xC0;
+ buf[len] += (ext.sn() << 3) & 0x38;
+ buf[len] += ext.ip__id() & 0x07;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile2_ROHC_Header_Extension1(unsigned char *buf,
+ const Profile2__Extension1 & ext)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("extension type", (int) *ext.ext__type(), 1);
+ buf[len] = ((*ext.ext__type()) << 6) & 0xC0;
+ buf[len] += (ext.sn() << 3) & 0x38;
+ buf[len] += (ext.ip__id() >> 8) & 0x07;
+ len += 1;
+ buf[len] = ext.ip__id() & 0xFF;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile2_ROHC_Header_Extension2(unsigned char *buf,
+ const Profile2__Extension2 & ext)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("extension type", (int) *ext.ext__type(), 2);
+ buf[len] = ((*ext.ext__type()) << 6) & 0xC0;
+ buf[len] += (ext.sn() << 3) & 0x38;
+ buf[len] += (ext.ip__id2() >> 8) & 0x07;
+ len += 1;
+ buf[len] = ext.ip__id2() & 0xFF;
+ len += 1;
+ buf[len] = ext.ip__id() & 0xFF;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile2_ROHC_Header_Extension3(unsigned char *buf,
+ const Profile2__Extension3 & ext)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("extension type", (int) *ext.ext__type(), 3);
+ buf[len] = ((*ext.ext__type()) << 6) & 0xC0;
+ buf[len] += ShiftUpBit(*ext.s__bit(), 5);
+ buf[len] += ((ext.mode()) << 3) & 0x18;
+ buf[len] += ShiftUpBit(*ext.i__bit(), 2);
+ buf[len] += ShiftUpBit(*ext.ip__bit(), 1);
+ buf[len] += ShiftUpBit(*ext.ip2__bit(), 0);
+ len += 1;
+
+ Check_field_presence("Inner IP flags",
+ *ext.ip__bit() == 1,
+ ext.inner__ip__flags().ispresent());
+ len += Set_Profile2_Inner_IP_flags_opt(&buf[len], ext.inner__ip__flags());
+ Check_field_presence("Outer IP flags",
+ *ext.ip2__bit() == 1,
+ ext.outer__ip__flags().ispresent());
+ len += Set_Profile1_Outer_IP_flags_opt(&buf[len], ext.outer__ip__flags());
+ Check_field_presence("SN", *ext.s__bit() == 1, ext.sn().ispresent());
+ len += Set_LIN1_opt(&buf[len], ext.sn());
+ Check_field_presence("Inner IP fields",
+ *ext.ip__bit() == 1, ext.inner__ip__hdr().ispresent());
+ len += Set_Profile2_Inner_IP_fields_opt(&buf[len], ext.inner__ip__flags(),
+ ext.inner__ip__hdr());
+ Check_field_presence("Inner IP-ID",
+ *ext.i__bit() == 1, ext.ip__id().ispresent());
+ len += Set_LIN2_BO_LAST_opt(&buf[len], ext.ip__id());
+ Check_field_presence("Outer IP fields",
+ *ext.ip2__bit() == 1, ext.outer__ip__hdr().ispresent());
+ len += Set_Profile1_Outer_IP_fields_opt(&buf[len], ext.outer__ip__flags(),
+ ext.outer__ip__hdr());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile2_ROHC_Header_Extension_opt(unsigned char *buf,
+ const OPTIONAL < Profile2__Extension >
+ &ext)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (ext.ispresent())
+ {
+ if (ext().get_selection() == Profile2__Extension::ALT_ext0)
+ {
+ len += Set_Profile2_ROHC_Header_Extension0(&buf[len], ext().ext0());
+ }
+ else if (ext().get_selection() == Profile2__Extension::ALT_ext1)
+ {
+ len += Set_Profile2_ROHC_Header_Extension1(&buf[len], ext().ext1());
+ }
+ else if (ext().get_selection() == Profile2__Extension::ALT_ext2)
+ {
+ len += Set_Profile2_ROHC_Header_Extension2(&buf[len], ext().ext2());
+ }
+ else if (ext().get_selection() == Profile2__Extension::ALT_ext3)
+ {
+ len += Set_Profile2_ROHC_Header_Extension3(&buf[len], ext().ext3());
+ }
+ else
+ {
+ Log_not_implemented_union_field("Profile2_Extension",
+ ext().get_selection());
+ }
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile2_ROHC_Header_ipid_ah_gre(unsigned char *buf,
+ const Profile2__headers & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ len += Set_LIN2_BO_LAST_opt(&buf[len], hdr.ip__id__outer());
+ len += Set_octetstring_opt(&buf[len], hdr.ah__outer());
+ len += Set_LIN2_BO_LAST_opt(&buf[len], hdr.gre__cksum1());
+ len += Set_LIN2_BO_LAST_opt(&buf[len], hdr.ip__id__inner());
+ len += Set_octetstring_opt(&buf[len], hdr.ah__inner());
+ len += Set_LIN2_BO_LAST_opt(&buf[len], hdr.gre__cksum2());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile2_ROHC_Header(unsigned char *buf,
+ const Profile2__headers & hdr,
+ ROHC__config const &config)
+{
+ int len = 0, crcpos = 0, cidlen = 0, cid;
+
+ Log_function_name_on_enter();
+
+ switch (hdr.base__header().get_selection())
+ {
+ case Profile2__base__header::ALT_ir:
+ cid = hdr.base__header().ir().cid();
+ crcpos = len + 2;
+ len += Set_Profile2_ROHC_Header_ir(&buf[len], hdr.base__header().ir());
+ break;
+ case Profile2__base__header::ALT_ir__dyn:
+ cid = hdr.base__header().ir__dyn().cid();
+ crcpos = len + 2;
+ len +=
+ Set_Profile2_ROHC_Header_irdyn(&buf[len], hdr.base__header().ir__dyn());
+ break;
+ case Profile1__base__header::ALT_r__0:
+ cid = hdr.base__header().r__0().cid();
+ len += Set_Profile1_ROHC_Header_r0(&buf[len], hdr.base__header().r__0());
+ break;
+ case Profile1__base__header::ALT_r__0__crc:
+ cid = hdr.base__header().r__0__crc().cid();
+ len +=
+ Set_Profile1_ROHC_Header_r0crc(&buf[len],
+ hdr.base__header().r__0__crc());
+ break;
+ case Profile1__base__header::ALT_uo__0:
+ cid = hdr.base__header().uo__0().cid();
+ len += Set_Profile1_ROHC_Header_uo0(&buf[len], hdr.base__header().uo__0());
+ break;
+ case Profile2__base__header::ALT_r__1:
+ cid = hdr.base__header().r__1().cid();
+ len += Set_Profile2_ROHC_Header_r1(&buf[len], hdr.base__header().r__1());
+ break;
+ case Profile2__base__header::ALT_uo__1:
+ cid = hdr.base__header().uo__1().cid();
+ len += Set_Profile2_ROHC_Header_uo1(&buf[len], hdr.base__header().uo__1());
+ break;
+ case Profile2__base__header::ALT_uor__2:
+ cid = hdr.base__header().uor__2().cid();
+ len +=
+ Set_Profile2_ROHC_Header_uor2(&buf[len], hdr.base__header().uor__2());
+ break;
+ default:
+ Log_not_implemented_union_field
+ ("Profile2_base_header", hdr.base__header().get_selection());
+ break;
+ }
+
+ len += Set_Profile2_ROHC_Header_Extension_opt(&buf[len], hdr.ext());
+ len += Set_Profile2_ROHC_Header_ipid_ah_gre(&buf[len], hdr);
+ len += Set_LIN2_BO_LAST_opt(&buf[len], hdr.udp__cksum());
+
+ cidlen = Set_CID_for_packets(buf, config, cid, len);
+ crcpos += cidlen;
+ len += cidlen;
+
+ if (hdr.base__header().get_selection() == Profile2__base__header::ALT_ir)
+ {
+ if (hdr.base__header().ir().crc() == 0)
+ buf[crcpos] = ComputeCRC(&(buf[0]), len, 8);
+ }
+ else
+ if (hdr.base__header().
+ get_selection() == Profile2__base__header::ALT_ir__dyn)
+ {
+ if (hdr.base__header().ir__dyn().crc() == 0)
+ buf[crcpos] = ComputeCRC(&(buf[0]), len, 8);
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+} /* Set_Profile2_ROHC_Header */
+
+int
+Set_Profile4_Static_Chain(unsigned char *buf,
+ const Profile4__Static__Chain & chain)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ for (int num = 0; num < chain.size_of(); num++)
+ {
+ switch (chain[num].get_selection())
+ {
+ case Static__Chain__u::ALT_ipv4__stat:
+ len += Set_IPv4_static_chain(&buf[len], chain[num].ipv4__stat());
+ break;
+ case Static__Chain__u::ALT_ipv6__stat:
+ len += Set_IPv6_static_chain(&buf[len], chain[num].ipv6__stat());
+ break;
+ default:
+ Log_not_implemented_union_field
+ ("Profile4_Static_Chain", chain[num].get_selection());
+ break;
+ }
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile4_IPv4_dynamic(unsigned char *buf,
+ const Profile4__IPv4__Dynamic & chain)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ len += Set_LIN1(&buf[len], chain.tos());
+ len += Set_LIN1(&buf[len], chain.ttl());
+ len += Set_LIN2_BO_LAST(&buf[len], chain.identification());
+
+ buf[len] = ShiftUpBit(*chain.df__bit(), 7);
+ buf[len] += ShiftUpBit(*chain.rnd__bit(), 6);
+ buf[len] += ShiftUpBit(*chain.nbo__bit(), 5);
+ buf[len] += ShiftUpBit(*chain.sid__bit(), 4);
+ Check_field_value("IPv4 reserved (dynamic chain)", *chain.reserved(), 0);
+ buf[len] += (*chain.reserved()) & 0x0F;
+ len += 1;
+ len += Set_Encoding_Type_0(&buf[len], chain.genextheadlist());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile4_Dynamic_Chain(unsigned char *buf,
+ const Profile4__Dynamic__Chain & dynch)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ for (int num = 0; num < dynch.size_of(); num++)
+ {
+ switch (dynch[num].get_selection())
+ {
+ case Profile4__Dynamic__Chain__u::ALT_ipv4__dyn:
+ len += Set_Profile4_IPv4_dynamic(&buf[len], dynch[num].ipv4__dyn());
+ break;
+ case Profile4__Dynamic__Chain__u::ALT_ipv6__dyn:
+ len += Set_IPv6_dynamic_chain(&buf[len], dynch[num].ipv6__dyn());
+ break;
+ case Profile4__Dynamic__Chain__u::ALT_sn:
+ len += Set_LIN2_BO_LAST(&buf[len], dynch[num].sn());
+ break;
+ default:
+ Log_not_implemented_union_field
+ ("Profile4_Dynamic_Chain", dynch[num].get_selection());
+ break;
+ }
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile4_ROHC_Header_ir(unsigned char *buf,
+ const Profile4__IR__header & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("packet type", (int) *hdr.type__ind(), 126);
+ buf[len] = ((*hdr.type__ind()) << 1) & 0xFE;
+ Check_field_presence("dynamic chain", *hdr.d() == 1,
+ hdr.dyn__chain().ispresent());
+ buf[len] += ShiftUpBit(*hdr.d(), 0);
+ len += 1;
+ Check_field_value("profile", hdr.profile(), 4);
+ len += Set_LIN1(&buf[len], hdr.profile());
+ len += Set_LIN1(&buf[len], hdr.crc());
+ len += Set_Profile4_Static_Chain(&buf[len], hdr.stat__chain());
+ if (hdr.dyn__chain().ispresent())
+ len += Set_Profile4_Dynamic_Chain(&buf[len], hdr.dyn__chain());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile4_ROHC_Header_irdyn(unsigned char *buf,
+ const Profile4__IR__DYN__header & hdr)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Check_field_value("packet type", (int) *hdr.type__ind(), 248);
+ buf[len] = *hdr.type__ind();
+ len += 1;
+ Check_field_value("profile", hdr.profile(), 4);
+ len += Set_LIN1(&buf[len], hdr.profile());
+ len += Set_LIN1(&buf[len], hdr.crc());
+ len += Set_Profile4_Dynamic_Chain(&buf[len], hdr.dyn__chain());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile4_ROHC_Header_ipid_ah_gre(unsigned char *buf,
+ const Profile4__headers & other_headers)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ len += Set_LIN2_BO_LAST_opt(&buf[len], other_headers.ip__id__outer());
+ len += Set_octetstring_opt(&buf[len], other_headers.ah__outer());
+ len += Set_LIN2_BO_LAST_opt(&buf[len], other_headers.gre__cksum1());
+ len += Set_LIN2_BO_LAST_opt(&buf[len], other_headers.ip__id__inner());
+ len += Set_octetstring_opt(&buf[len], other_headers.ah__inner());
+ len += Set_LIN2_BO_LAST_opt(&buf[len], other_headers.gre__cksum2());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Set_Profile4_ROHC_Header(unsigned char *buf,
+ const Profile4__headers & hdr,
+ ROHC__config const &config)
+{
+ int len = 0, crcpos = 0, cidlen = 0, cid;
+
+ Log_function_name_on_enter();
+
+ switch (hdr.base__header().get_selection())
+ {
+ case Profile4__base__header::ALT_ir:
+ cid = hdr.base__header().ir().cid();
+ crcpos = len + 2;
+ len += Set_Profile4_ROHC_Header_ir(&buf[len], hdr.base__header().ir());
+ break;
+ case Profile4__base__header::ALT_ir__dyn:
+ cid = hdr.base__header().ir__dyn().cid();
+ crcpos = len + 2;
+ len +=
+ Set_Profile4_ROHC_Header_irdyn(&buf[len], hdr.base__header().ir__dyn());
+ break;
+ case Profile1__base__header::ALT_r__0:
+ cid = hdr.base__header().r__0().cid();
+ len += Set_Profile1_ROHC_Header_r0(&buf[len], hdr.base__header().r__0());
+ break;
+ case Profile1__base__header::ALT_r__0__crc:
+ cid = hdr.base__header().r__0__crc().cid();
+ len +=
+ Set_Profile1_ROHC_Header_r0crc(&buf[len],
+ hdr.base__header().r__0__crc());
+ break;
+ case Profile1__base__header::ALT_uo__0:
+ cid = hdr.base__header().uo__0().cid();
+ len += Set_Profile1_ROHC_Header_uo0(&buf[len], hdr.base__header().uo__0());
+ break;
+ case Profile2__base__header::ALT_r__1:
+ cid = hdr.base__header().r__1().cid();
+ len += Set_Profile2_ROHC_Header_r1(&buf[len], hdr.base__header().r__1());
+ break;
+ case Profile2__base__header::ALT_uo__1:
+ cid = hdr.base__header().uo__1().cid();
+ len += Set_Profile2_ROHC_Header_uo1(&buf[len], hdr.base__header().uo__1());
+ break;
+ case Profile2__base__header::ALT_uor__2:
+ cid = hdr.base__header().uor__2().cid();
+ len +=
+ Set_Profile2_ROHC_Header_uor2(&buf[len], hdr.base__header().uor__2());
+ break;
+ default:
+ Log_not_implemented_union_field
+ ("Profile4_base_header", hdr.base__header().get_selection());
+ break;
+ }
+
+ len += Set_Profile2_ROHC_Header_Extension_opt(&buf[len], hdr.ext());
+ len += Set_Profile4_ROHC_Header_ipid_ah_gre(&buf[len], hdr);
+ if (hdr.additional__IP().ispresent())
+ {
+ len += Set_Profile4_Dynamic_Chain(&buf[len], hdr.additional__IP()());
+ }
+
+ cidlen = Set_CID_for_packets(buf, config, cid, len);
+ crcpos += cidlen;
+ len += cidlen;
+
+ if (hdr.base__header().get_selection() == Profile4__base__header::ALT_ir)
+ {
+ if (hdr.base__header().ir().crc() == 0)
+ buf[crcpos] = ComputeCRC(&(buf[0]), len, 8);
+ }
+ else if (hdr.base__header().get_selection() ==
+ Profile4__base__header::ALT_ir__dyn)
+ {
+ if (hdr.base__header().ir__dyn().crc() == 0)
+ buf[crcpos] = ComputeCRC(&(buf[0]), len, 8);
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+OCTETSTRING
+f__ROHC__enc(ROHC__packet__u const &pdu, ROHC__config const &config)
+{
+ unsigned char buf[MAX_PACKET_SIZE];
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ TTCN_logger.begin_event(TTCN_DEBUG);
+ config.log();
+ pdu.log();
+ TTCN_logger.end_event();
+
+ if (pdu.get_selection() == ROHC__packet__u::ALT_segment)
+ {
+ // Processing padding
+ len += Set_octetstring_opt(&buf[len], pdu.segment().padding());
+ // Processing feedback
+ len +=
+ Set_ROHC_Feedback_opt(&buf[len],
+ pdu.segment().feedback(), config.large__cid());
+ // Processing segment header
+ Check_field_value("segment header id",
+ pdu.segment().segment__header__id(), 127);
+ buf[len] = (pdu.segment().segment__header__id() << 1) & 0xFE;
+ if (pdu.segment().final())
+ buf[len] += 1;
+ len += 1;
+ // Processing payload
+ len += Set_octetstring_opt(&buf[len], pdu.segment().payload());
+ // Processing CRC
+ if (pdu.segment().crc().ispresent())
+ {
+ buf[len] = (pdu.segment().crc()() >> 24) & 0xFF;
+ len += 1;
+ buf[len] = (pdu.segment().crc()() >> 16) & 0xFF;
+ len += 1;
+ buf[len] = (pdu.segment().crc()() >> 8) & 0xFF;
+ len += 1;
+ buf[len] = pdu.segment().crc()() & 0xFF;
+ len += 1;
+ }
+ }
+ else if (pdu.get_selection() == ROHC__packet__u::ALT_rohc)
+ {
+ // Processing padding
+ len += Set_octetstring_opt(&buf[len], pdu.rohc().padding());
+ // Processing feedback
+ len += Set_ROHC_Feedback_opt(&buf[len],
+ pdu.rohc().feedback(), config.large__cid());
+ // Processing ROHC header
+ switch (pdu.rohc().header().get_selection())
+ {
+ case Header::ALT_prof0:
+ len += Set_ROHC_Header_Profile0(&buf[len], pdu.rohc().header().prof0(),
+ config);
+ break;
+ case Header::ALT_prof1:
+ len += Set_Profile1_ROHC_Header(&buf[len], pdu.rohc().header().prof1(),
+ config);
+ break;
+ case Header::ALT_prof2:
+ len += Set_Profile2_ROHC_Header(&buf[len], pdu.rohc().header().prof2(),
+ config);
+ break;
+ case Header::ALT_prof4:
+ len += Set_Profile4_ROHC_Header(&buf[len], pdu.rohc().header().prof4(),
+ config);
+ break;
+ default:
+ Log_not_implemented_union_field("Header",
+ pdu.rohc().header().get_selection());
+ break;
+ }
+
+ // Processing payload
+ len += Set_octetstring_opt(&buf[len], pdu.rohc().payload());
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return OCTETSTRING(len, &(buf[0]));
+}
+
+
+
+
+
+/* ============ Decoding functions for base types ============ */
+
+/* Mirrors the bits of an octet and returns the same pointer. */
+unsigned char *
+Convert_bitstring(unsigned char *buf, int len)
+{
+ unsigned char dst_buf = 0;
+
+ if (len > 8)
+ {
+ TTCN_error("Bitstring is too long, at most 8 bits can be converted");
+ }
+ for (int i = 0; i < 8; i++)
+ {
+ dst_buf += ShiftUpBit(ShiftDownBit(buf[0], i), 7 - i);
+ }
+ buf[0] = dst_buf;
+
+ return buf;
+}
+
+/* Decodes an OCTETSTING value */
+int
+Get_octetstring(const unsigned char *buf, OCTETSTRING & octstr, int length)
+{
+ octstr = OCTETSTRING(length, buf);
+ return length;
+}
+
+/* Decodes a LIN1 value */
+int
+Get_LIN1(const unsigned char *buf, LIN1 & var)
+{
+ var = LIN1(buf[0]);
+ return 1;
+}
+
+/* Decodes a LIN2_BO_LAST value */
+int
+Get_LIN2_BO_LAST(const unsigned char *buf, LIN2__BO__LAST & var)
+{
+ var = (buf[0] << 8) + buf[1];
+ return 2;
+}
+
+/* Decodes a LIN4_BO_LAST value */
+int
+Get_LIN4_BO_LAST(const unsigned char *buf, LIN4__BO__LAST & var)
+{
+ var = (buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3];
+ return 4;
+}
+
+int
+Get_SDVL_field(const unsigned char *buf, INTEGER & dest)
+{
+ int len = 0;
+ int decoded_value;
+
+ Log_function_name_on_enter();
+
+ if ((buf[len] & 0x80) == 0)
+ {
+ dest = buf[len] & 0x7F;
+ len += 1;
+ }
+ else if ((buf[len] & 0xC0) == 0x80)
+ {
+ dest = ((buf[len] << 8) & 0x3F00) + (buf[len + 1] & 0xFF);
+ len += 2;
+ }
+ else if ((buf[len] & 0xE0) == 0xC0)
+ {
+ dest =
+ ((buf[len] << 16) & 0x1F0000) +
+ ((buf[len + 1] << 8) & 0xFF00) + (buf[len + 2] & 0xFF);
+ len += 3;
+ }
+ else // if ((buf[len] & 0xE0) == 0xE0)
+ {
+ dest =
+ ((buf[len] << 24) & 0x1F000000) +
+ ((buf[len + 1] << 16) & 0xFF0000) +
+ ((buf[len + 2] << 8) & 0xFF00) + (buf[len + 3] & 0xFF);
+ len += 4;
+ }
+
+ decoded_value = dest;
+ TTCN_logger.log(TTCN_DEBUG, "Decoded value is %u (encoded on %u octets)",
+ decoded_value, len);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+/* ============ Decoding wrappers for optional base types ============ */
+
+/* Decodes a optional octetstring value */
+int
+Get_octetstring_opt(const unsigned char *buf, OPTIONAL < OCTETSTRING > &var,
+ bool hasvalue, int length)
+{
+ if (hasvalue)
+ {
+ return Get_octetstring(buf, var(), length);
+ }
+ var = OMIT_VALUE;
+ return 0;
+}
+
+/* Decodes a optional LIN1 value */
+int
+Get_LIN1_opt(const unsigned char *buf, OPTIONAL < LIN1 > &var, bool hasvalue)
+{
+ if (hasvalue)
+ {
+ return Get_LIN1(buf, var());
+ }
+ var = OMIT_VALUE;
+ return 0;
+}
+
+/* Decodes a optional LIN2_BO_LAST value */
+int
+Get_LIN2_BO_LAST_opt(const unsigned char *buf,
+ OPTIONAL < LIN2__BO__LAST > &var, bool hasvalue)
+{
+ if (hasvalue)
+ {
+ return Get_LIN2_BO_LAST(buf, var());
+ }
+ var = OMIT_VALUE;
+ return 0;
+}
+
+/* Decodes a optional LIN4_BO_LAST value */
+int
+Get_LIN4_BO_LAST_opt(const unsigned char *buf,
+ OPTIONAL < LIN4__BO__LAST > &var, bool hasvalue)
+{
+ if (hasvalue)
+ {
+ return Get_LIN4_BO_LAST(buf, var());
+ }
+ var = OMIT_VALUE;
+ return 0;
+}
+
+/* Decodes a optional SDVL value */
+int
+Get_SDVL_field_opt(const unsigned char *buf,
+ OPTIONAL < INTEGER > &var, bool hasvalue)
+{
+ if (hasvalue)
+ {
+ return Get_SDVL_field(buf, var());
+ }
+ var = OMIT_VALUE;
+ return 0;
+}
+
+/* ============ Decoding functions for ROHC types ============ */
+
+/* Returns the number of matching octets, that are the same as the passed
+ 'octet'. */
+int
+Strip_leading_octet(const unsigned char *buf, int length, unsigned char octet)
+{
+ int len = 0;
+
+ while ((buf[len] == octet) && (len < length))
+ len += 1;
+ return len;
+}
+
+int
+Get_ROHC_Padding(const unsigned char *buf, int length,
+ OPTIONAL < Padding > &p_padding, ROHC__config & config)
+{
+ int len = Strip_leading_octet(buf, length, 0xE0);
+
+ Log_function_name_on_enter();
+
+ if (len > 0)
+ {
+ p_padding = OCTETSTRING(len, &(buf[0]));
+ Log_hexdump(buf, len);
+ }
+ else
+ p_padding = OMIT_VALUE;
+
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_CID(const unsigned char *buf, INT14b__BO__LAST & cid,
+ ROHC__config & config)
+{
+ int len = 0;
+ int dec_cid;
+
+ Log_function_name_on_enter();
+
+ if (config.large__cid() == false)
+ {
+ if ((buf[len] & 0xF0) == 0xE0)
+ {
+ cid = buf[len] & 0x0F;
+ len += 1;
+ }
+ else
+ cid = 0;
+ }
+ else
+ {
+ len += Get_SDVL_field(&buf[len], cid);
+ }
+
+ dec_cid = cid;
+ TTCN_logger.log(TTCN_DEBUG, "Decoded CID = %u", dec_cid);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_feedback(const unsigned char *buf, Feedback__u & feedback,
+ ROHC__config & config)
+{
+ int len = 0, fbsize = 0, cidlen;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ ctemp = (buf[len] >> 3) & 0x1F;
+ feedback.feedback__type() = BITSTRING(5, &ctemp);
+ feedback.code() = buf[len] & 0x07;
+ fbsize = feedback.code();
+ len += 1;
+ len += Get_LIN1_opt(&buf[len], feedback.size(), feedback.code() == 0);
+ if (feedback.size().ispresent())
+ {
+ fbsize = feedback.size()();
+ }
+
+ cidlen = Get_CID(&buf[len], feedback.feedback__data().cid(), config);
+ fbsize -= cidlen;
+ len += cidlen;
+
+ if (fbsize == 1) /* Feedback type 1 */
+ {
+ len += Get_octetstring(&buf[len],
+ feedback.feedback__data().feedback__type().
+ feedback1(), fbsize);
+ }
+ else /* Feedback type 2 */
+ {
+ int optnum = 0;
+ Feedback__opts fbopts;
+ Feedback2 feedback2;
+
+ feedback2.acktype() = (buf[len] >> 6) & 0x03;
+ feedback2.mode() = (buf[len] >> 4) & 0x03;
+ ctemp = buf[len] & 0x0F;
+ len += 1;
+ fbsize -= 1;
+ feedback2.sn() = ((ctemp << 8) & 0x0F00) + buf[len];
+ len += 1;
+ fbsize -= 1;
+ feedback2.feedback__opts() = OMIT_VALUE;
+ while (fbsize > 0)
+ {
+ fbopts[optnum].opt__type() = (buf[len] >> 4) & 0x0F;
+ fbopts[optnum].opt__len() = buf[len] & 0x0F;
+ len += 1;
+ fbsize -= 1;
+ if (fbopts[optnum].opt__len())
+ {
+ len += Get_octetstring(&buf[len], fbopts[optnum].opt__data(),
+ fbopts[optnum].opt__len());
+ fbsize -= fbopts[optnum].opt__len();
+ }
+ else
+ fbopts[optnum].opt__data() = OMIT_VALUE;
+ feedback2.feedback__opts() = fbopts;
+ optnum += 1;
+ }
+
+ feedback.feedback__data().feedback__type().feedback2() = feedback2;
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_ROHC_Feedback(const unsigned char *buf,
+ int length,
+ OPTIONAL < Feedback > &feedback, ROHC__config & config)
+{
+ int len = 0, fbnum = 0;
+
+ Log_function_name_on_enter();
+
+ feedback = OMIT_VALUE;
+ while (((buf[len] & 0xF8) == 0xF0) && (len < length))
+ {
+ len += Get_feedback(&buf[len], feedback()[fbnum], config);
+ fbnum++;
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_XI_list(const unsigned char *buf,
+ OPTIONAL < XI__list > &xilist, int m,
+ const BITSTRING & ps_bit, int *itemnum,
+ OPTIONAL < BITSTRING > &padding)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ if (!m)
+ {
+ xilist = OMIT_VALUE;
+ padding = OMIT_VALUE;
+ return len;
+ }
+
+ if ((*ps_bit) == 1)
+ {
+ for (int num = 0; num < m; num++)
+ {
+ ctemp = ShiftDownBit(buf[len], 7);
+ xilist().xi__item8()[num].x__ind() = BITSTRING(1, &ctemp);
+ if (ctemp)
+ *itemnum += 1;
+ xilist().xi__item8()[num].index() = buf[len] & 0x7F;
+ len += 1;
+ }
+ padding = OMIT_VALUE;
+ }
+ else
+ {
+ int halfbyte = 0;
+
+ for (int num = 0; num < m; num++)
+ {
+ if (halfbyte)
+ {
+ ctemp = ShiftDownBit(buf[len], 3);
+ xilist().xi__item4()[num].x__ind() = BITSTRING(1, &ctemp);
+ if (ctemp)
+ *itemnum += 1;
+ xilist().xi__item4()[num].index() = buf[len] & 0x07;
+ len += 1;
+ }
+ else
+ {
+ ctemp = ShiftDownBit(buf[len], 7);
+ xilist().xi__item4()[num].x__ind() = BITSTRING(1, &ctemp);
+ if (ctemp)
+ *itemnum += 1;
+ xilist().xi__item4()[num].index() = (buf[len] >> 4) & 0x07;
+ }
+ halfbyte = 1 - halfbyte; /* Invert the value */
+ }
+ /* Padding */
+ if (halfbyte == 1)
+ {
+ ctemp = buf[len] & 0x0F;
+ padding() = BITSTRING(4, &ctemp);
+ len += 1;
+ }
+ else
+ padding = OMIT_VALUE;
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Item_list(const unsigned char *buf,
+ OPTIONAL < Item__list > &item_list, int n,
+ Item__list::union_selection_type selection,
+ t_dat *dat, int ip_idx)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (n == 0)
+ {
+ item_list = OMIT_VALUE;
+ Log_function_name_on_leave();
+ return len;
+ }
+
+ TTCN_logger.log(TTCN_DEBUG, "Expecting %u items", n);
+
+ /* Item list is an IP extension header list */
+ if (selection == Item__list::ALT_ip__item__list)
+ {
+ IP__Item__list & itlist = item_list().ip__item__list();
+ for (int num = 0; num < n; num++)
+ {
+ int headid = buf[len];
+ len += 1;
+
+ TTCN_logger.log(TTCN_DEBUG, "%uth item", num);
+
+ if (headid == c__ip__proto__ah)
+ {
+ AH__item & item = itlist[num].ah__item();
+ int payload_length, ah_data_len;
+
+ TTCN_logger.log(TTCN_DEBUG, "AH header found");
+ item.nexthead() = headid;
+ len += Get_LIN1(&buf[len], item.payload__len());
+ payload_length = item.payload__len();
+ ah_data_len = (item.payload__len() - 1) * 4;
+ len += Get_LIN2_BO_LAST(&buf[len], item.reserved());
+ len += Get_LIN4_BO_LAST(&buf[len], item.spi());
+ len += Get_LIN4_BO_LAST(&buf[len], item.sn());
+ len += Get_octetstring_opt(&buf[len], item.auth__data(),
+ item.payload__len() != 1, ah_data_len);
+ dat->context.ip__ctx()[ip_idx].ah__data__len() = ah_data_len;
+ dat->context.ip__ctx()[ip_idx].ah__present() = true;
+ // There is no compressed AH data after the base header
+ dat->compressed_ah_data_len[ip_idx] = 0;
+ TTCN_logger.log(TTCN_DEBUG,
+ "AH payload length is %d meaning %d octets",
+ payload_length, ah_data_len);
+ Log_hexdump(buf, len);
+ }
+ else if (headid == c__ip__proto__mine)
+ {
+ unsigned char ctemp;
+ MINE__item & item = itlist[num].mine__item();
+
+ TTCN_logger.log(TTCN_DEBUG, "MINE header found");
+ item.protocol() = headid;
+ ctemp = ShiftDownBit(buf[len], 7);
+ item.s__bit() = BITSTRING(1, &ctemp);
+ item.reserved() = BITSTRING(7, &buf[len]);
+ len += 1;
+ len += Get_LIN2_BO_LAST(&buf[len], item.cksum());
+ len += Get_octetstring(&buf[len], item.dstaddr(), 4);
+ len += Get_octetstring_opt(&buf[len], item.srcaddr(),
+ *item.s__bit() == 1, 4);
+ Log_hexdump(buf, len);
+ }
+ else if (headid == c__ip__proto__esp)
+ {
+ ESP__item & item = itlist[num].esp__item();
+
+ TTCN_logger.log(TTCN_DEBUG, "ESP header found");
+ item.nexthead() = headid;
+ len += Get_LIN4_BO_LAST(&buf[len], item.spi());
+ len += Get_LIN4_BO_LAST(&buf[len], item.sn());
+
+ dat->context.ip__ctx()[ip_idx].esp__present() = true;
+ Log_hexdump(buf, len);
+ }
+ else if (headid == c__ip__proto__gre2)
+ {
+ GRE__item & item = itlist[num].gre__item();
+ unsigned char ctemp;
+
+ TTCN_logger.log(TTCN_DEBUG, "GRE header found");
+ item.nexthead() = headid;
+ ctemp = ShiftDownBit(buf[len], 7);
+ item.C__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 6);
+ item.reserved__1() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 5);
+ item.K__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 4);
+ item.S__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 3);
+ item.reserved__2() = BITSTRING(1, &ctemp);
+ ctemp = buf[len] & 0x07;
+ item.version() = BITSTRING(3, &ctemp);
+ len += 1;
+ len += Get_LIN2_BO_LAST_opt(&buf[len], item.cksum(),
+ *item.C__bit() == 1);
+ len += Get_LIN4_BO_LAST_opt(&buf[len], item.key(),
+ *item.K__bit() == 1);
+ len += Get_LIN4_BO_LAST_opt(&buf[len], item.sn(), *item.S__bit() == 1);
+
+ dat->context.ip__ctx()[ip_idx].gre__cksum__present() = (*item.C__bit() == 1);
+ dat->context.ip__ctx()[ip_idx].gre__present() = true;
+ // There is no compressed GRE data after the base header
+ dat->ipx_gre_cksum_present[ip_idx] = false;
+ Log_hexdump(buf, len);
+ }
+ else /* Assuming IPv6 extension header */
+ /* TODO check: why only these were supported:
+ if (headid == 0 || headid == 43 || headid == 60) */
+ {
+ IPv6__ext__item & item = itlist[num].ipv6__ext__item();
+ int ext_len;
+ int ext_len_oct;
+
+ TTCN_logger.log(TTCN_DEBUG, "IPv6 header found (type %d)", headid);
+ item.nexthead() = headid;
+ len += Get_LIN1(&buf[len], item.hdr__ext__len());
+ ext_len_oct = item.hdr__ext__len();
+ ext_len = (item.hdr__ext__len() + 1) * 8;
+ TTCN_logger.log(TTCN_DEBUG,
+ "IPv6 extension length is %d meaning %d octets",
+ ext_len_oct, ext_len);
+ // 2 octets already been read
+ len += Get_octetstring(&buf[len], item.data(), ext_len - 2);
+ Log_hexdump(buf, len);
+ }
+ } /* for (num) */
+ }
+ else if (selection == Item__list::ALT_csrc__item__list)
+ {
+ for (int num = 0; num < n; num++)
+ {
+ TTCN_logger.log(TTCN_DEBUG, "%uth item", num);
+
+ len +=
+ Get_octetstring(&buf[len], item_list().csrc__item__list()[num], 4);
+ }
+ }
+ else if (selection == Item__list::ALT_raw__data)
+ {
+ /* TODO: RAW_data field is just a temporary hack for Profile4 tests */
+ RAW__data & itlist = item_list().raw__data();
+
+ for (int num = 0; num < n; num++)
+ {
+ int headid = char2int(buf[len]);
+
+ if (headid == 0 || headid == 43 || headid == 60)
+ {
+ int itemlimit = char2int(buf[len + 1]) + 1 * 8;
+ for (int itemlen = 0; itemlen < itemlimit; itemlen++)
+ {
+ if (itemlen == 0)
+ itlist[num] = OCTETSTRING(1, &buf[len]);
+ else
+ itlist[num] = itlist[num] + OCTETSTRING(1, &buf[len]);
+ len += 1;
+ }
+ }
+ else if (headid == 51)
+ {
+ int itemlimit = char2int(buf[len + 1]) + 1 * 8;
+ for (int itemlen = 0; itemlen < itemlimit; itemlen++)
+ {
+ if (itemlen == 0)
+ itlist[num] = OCTETSTRING(1, &buf[len]);
+ else
+ itlist[num] = itlist[num] + OCTETSTRING(1, &buf[len]);
+ len += 1;
+ }
+ }
+ else if (headid == 50)
+ {
+ for (int itemlen = 0; itemlen < 9; itemlen++)
+ {
+ if (itemlen == 0)
+ itlist[num] = OCTETSTRING(1, &buf[len]);
+ else
+ itlist[num] = itlist[num] + OCTETSTRING(1, &buf[len]);
+ len += 1;
+ }
+ }
+ else if (headid == 55 || headid == 47)
+ {
+ for (int itemlen = 0; itemlen < 13; itemlen++)
+ {
+ if (itemlen == 0)
+ itlist[num] = OCTETSTRING(1, &buf[len]);
+ else
+ itlist[num] = itlist[num] + OCTETSTRING(1, &buf[len]);
+ len += 1;
+ }
+ }
+ else
+ TTCN_logger.log(TTCN_WARNING,
+ "Unrecognized element in encoding type 0");
+ }
+ }
+ else
+ {
+ Log_not_implemented_union_field("Item_list", selection);
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Encoding_Type_0(Enc__Type__0 & enct0, const unsigned char *buf,
+ Item__list::union_selection_type selection,
+ t_dat *dat, int ip_idx)
+{
+ unsigned char ctemp;
+ int itemnum = 0;
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ ctemp = (buf[len] >> 6) & 0x03;
+ enct0.et() = BITSTRING(2, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 5);
+ enct0.gp__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 4);
+ enct0.ps__bit() = BITSTRING(1, &ctemp);
+ enct0.cc() = buf[len] & 0x0F;
+ len += 1;
+ len += Get_LIN1_opt(&buf[len], enct0.gen__id(), (*enct0.gp__bit()) == 1);
+ len += Get_XI_list(&buf[len], enct0.xi__list(),
+ enct0.cc(), enct0.ps__bit(), &itemnum, enct0.padding());
+ len += Get_Item_list(&buf[len], enct0.item__list(), itemnum, selection,
+ dat, ip_idx);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Encoding_Type_1(Enc__Type__1 & enct1, const unsigned char *buf,
+ Item__list::union_selection_type selection,
+ t_dat *dat, int ip_idx)
+{
+ unsigned char ctemp;
+ int knum = 0, itemnum = 0, len = 0;
+
+ Log_function_name_on_enter();
+
+ ctemp = (buf[len] >> 6) & 0x03;
+ enct1.et() = BITSTRING(2, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 5);
+ enct1.gp__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 4);
+ enct1.ps__bit() = BITSTRING(1, &ctemp);
+ enct1.xi1() = buf[len] & 0x0F;
+ len += 1;
+ len += Get_LIN1_opt(&buf[len], enct1.gen__id(), (*enct1.gp__bit()) == 1);
+ len += Get_LIN1(&buf[len], enct1.ref__id());
+ if ((buf[len] & 0x80) == 0) /* 1 octet insertion mask */
+ {
+ for (int i = 0; i < 8; i++)
+ {
+ if (ShiftDownBit(buf[len], i) == 1)
+ knum++;
+ }
+ len += Get_octetstring(&buf[len], enct1.insbitmask(), 1);
+ }
+ else /* 2 octets insertion mask */
+ {
+ for (int i = 0; i < 8; i++)
+ if (ShiftDownBit(buf[len], i) == 1)
+ knum++;
+ for (int i = 0; i < 8; i++)
+ if (ShiftDownBit(buf[len + 1], i) == 1)
+ knum++;
+ len += Get_octetstring(&buf[len], enct1.insbitmask(), 2);
+ }
+
+ /* Determine whether xi1 already contains the first index */
+ if ((*enct1.ps__bit()) == 0)
+ {
+ knum--;
+ }
+ len +=
+ Get_XI_list(&buf[len], enct1.xi__list(),
+ knum, enct1.ps__bit(), &itemnum, enct1.padding());
+ len += Get_Item_list(&buf[len], enct1.item__list(), itemnum, selection,
+ dat, ip_idx);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+
+int
+Get_Encoding_Type_2(Enc__Type__2 & enct2, const unsigned char *buf,
+ Item__list::union_selection_type selection)
+{
+ unsigned char ctemp;
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ ctemp = (buf[len] >> 6) & 0x03;
+ enct2.et() = BITSTRING(2, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 5);
+ enct2.gp__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 4);
+ enct2.res() = BITSTRING(1, &ctemp);
+ enct2.count() = buf[len] & 0x0F;
+ len += 1;
+ len += Get_LIN1_opt(&buf[len], enct2.gen__id(), (*enct2.gp__bit()) == 1);
+ len += Get_LIN1(&buf[len], enct2.ref__id());
+ if ((buf[len] & 0x80) == 0)
+ len += Get_octetstring(&buf[len], enct2.rembitmask(), 1);
+ else
+ len += Get_octetstring(&buf[len], enct2.rembitmask(), 2);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+
+int
+Get_Encoding_Type_3(Enc__Type__3 & enct3, const unsigned char *buf,
+ Item__list::union_selection_type selection,
+ t_dat *dat, int ip_idx)
+{
+ unsigned char ctemp;
+ int itemnum = 0;
+ int knum = 0;
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ ctemp = (buf[len] >> 6) & 0x03;
+ enct3.et() = BITSTRING(2, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 5);
+ enct3.gp__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 4);
+ enct3.ps__bit() = BITSTRING(1, &ctemp);
+ enct3.xi1() = buf[len] & 0x0F;
+ len += 1;
+ len += Get_LIN1_opt(&buf[len], enct3.gen__id(), (*enct3.gp__bit()) == 1);
+ len += Get_LIN1(&buf[len], enct3.ref__id());
+ if ((buf[len] & 0x80) == 0)
+ len += Get_octetstring(&buf[len], enct3.rembitmask(), 1);
+ else
+ len += Get_octetstring(&buf[len], enct3.rembitmask(), 2);
+
+ if ((buf[len] & 0x80) == 0) /* 1 octet insertion mask */
+ {
+ for (int i = 0; i < 8; i++)
+ {
+ if (ShiftDownBit(buf[len], i) == 1)
+ knum++;
+ }
+ len += Get_octetstring(&buf[len], enct3.insbitmask(), 1);
+ }
+ else /* 2 octets insertion mask */
+ {
+ for (int i = 0; i < 8; i++)
+ if (ShiftDownBit(buf[len], i) == 1)
+ knum++;
+ for (int i = 0; i < 8; i++)
+ if (ShiftDownBit(buf[len + 1], i) == 1)
+ knum++;
+ len += Get_octetstring(&buf[len], enct3.insbitmask(), 2);
+ }
+
+ /* Determine whether xi1 already contains the first index */
+ if ((*enct3.ps__bit()) == 0)
+ {
+ knum--;
+ }
+ len += Get_XI_list(&buf[len], enct3.xi__list(),
+ knum, enct3.ps__bit(), &itemnum, enct3.padding());
+ len += Get_Item_list(&buf[len], enct3.item__list(), itemnum, selection,
+ dat, ip_idx);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Compr_head_list(Compr__head__list & chl, const unsigned char *buf,
+ Item__list::union_selection_type selection,
+ t_dat *dat, int ip_idx)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if ((buf[len] & 0xC0) == 0)
+ len += Get_Encoding_Type_0(chl.enctype0(), &buf[len], selection,
+ dat, ip_idx);
+ else if ((buf[len] & 0xC0) == 0x40)
+ len += Get_Encoding_Type_1(chl.enctype1(), &buf[len], selection,
+ dat, ip_idx);
+ else if ((buf[len] & 0xC0) == 0x80)
+ len += Get_Encoding_Type_2(chl.enctype2(), &buf[len], selection);
+ else
+ len += Get_Encoding_Type_3(chl.enctype3(), &buf[len], selection,
+ dat, ip_idx);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_ipv4_dynamic(const unsigned char *buf, IPv4__Dynamic & chain,
+ t_dat *dat, int ip_level)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ len += Get_LIN1(&buf[len], chain.tos());
+ len += Get_LIN1(&buf[len], chain.ttl());
+ len += Get_LIN2_BO_LAST(&buf[len], chain.identification());
+ ctemp = ShiftDownBit(buf[len], 7);
+ chain.df__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 6);
+ chain.rnd__bit() = BITSTRING(1, &ctemp);
+ dat->context.ip__ctx()[ip_level].rnd__bit() = BOOLEAN(ctemp);
+ ctemp = ShiftDownBit(buf[len], 5);
+ chain.nbo__bit() = BITSTRING(1, &ctemp);
+ ctemp = buf[len] & 0x1F;
+ chain.reserved() = BITSTRING(5, &ctemp);
+ len += 1;
+ len += Get_Encoding_Type_0(chain.genextheadlist(),
+ &buf[len], Item__list::ALT_ip__item__list,
+ dat, ip_level);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_ipv4_static(const unsigned char *buf, IPv4__Static & chain)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ chain.version() = (buf[len] >> 4) & 0x0F;
+ chain.reserved() = buf[len] & 0x0F;
+ len += 1;
+ len += Get_LIN1(&buf[len], chain.proto());
+ len += Get_octetstring(&buf[len], chain.srcaddr(), 4);
+ len += Get_octetstring(&buf[len], chain.dstaddr(), 4);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_ipv6_static(const unsigned char *buf, IPv6__Static & chain)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ chain.version() = (buf[len] >> 4) & 0x0F;
+ chain.flowlabel() =
+ ((buf[len] & 0x0F) << 16) + (buf[len + 1] << 8) + buf[len + 2];
+ len += 3;
+ len += Get_LIN1(&buf[len], chain.nexthead());
+ len += Get_octetstring(&buf[len], chain.srcaddr(), 16);
+ len += Get_octetstring(&buf[len], chain.dstaddr(), 16);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_ipv6_dynamic(const unsigned char *buf, IPv6__Dynamic & chain,
+ t_dat *dat, int ip_level)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ len += Get_LIN1(&buf[len], chain.trafficclass());
+ len += Get_LIN1(&buf[len], chain.hoplimit());
+ len += Get_Encoding_Type_0(chain.genextheadlist(), &buf[len],
+ Item__list::ALT_ip__item__list, dat, ip_level);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_udp_static(const unsigned char *buf, UDP__Static & chain)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ len += Get_LIN2_BO_LAST(&buf[len], chain.srcport());
+ len += Get_LIN2_BO_LAST(&buf[len], chain.dstport());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_udp_dynamic_wo_sn(const unsigned char *buf,
+ UDP__Dynamic & chain, t_dat *dat)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ len += Get_LIN2_BO_LAST(&buf[len], chain.cksum());
+ if (chain.cksum() == 0)
+ {
+ /* Checksum value 0 means that no UDP checksum is present in the
+ forthcoming compressed packets. */
+ dat->context.udp__ctx().udp__cksum() = false;
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_udp_dynamic_w_sn(const unsigned char *buf,
+ Profile2__UDP__Dynamic & chain, t_dat *dat)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ len += Get_LIN2_BO_LAST(&buf[len], chain.cksum());
+ len += Get_LIN2_BO_LAST(&buf[len], chain.udp__sn());
+ if (chain.cksum() == 0)
+ {
+ /* Checksum value 0 means that no UDP checksum is present in the
+ forthcoming compressed packets. */
+ dat->context.udp__ctx().udp__cksum() = false;
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_rtp_static(const unsigned char *buf, RTP__Static & chain)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ len += Get_octetstring(&buf[len], chain.ssrc(), 4);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_rtp_dynamic(const unsigned char *buf, RTP__Dynamic & chain,
+ t_dat *dat)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ chain.vfield() = (buf[len] >> 6) & 0x03;
+ ctemp = ShiftDownBit(buf[len], 5);
+ chain.pbit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 4);
+ chain.rxbit() = BITSTRING(1, &ctemp);
+ chain.ccfield() = buf[len] & 0x0F;
+ len += 1;
+ ctemp = ShiftDownBit(buf[len], 7);
+ chain.mbit() = BITSTRING(1, &ctemp);
+ chain.ptfield() = buf[len] & 0x7F;
+ len += 1;
+ len += Get_LIN2_BO_LAST(&buf[len], chain.rtpseqnum());
+ len += Get_LIN4_BO_LAST(&buf[len], chain.rtpts());
+ len += Get_Encoding_Type_0(chain.gencsrclist(),
+ &buf[len], Item__list::ALT_csrc__item__list,
+ dat, 0);
+ if ((*chain.rxbit()) == 1)
+ {
+ Rx__Field & rxfield = chain.rx__field();
+
+ ctemp = (buf[len] >> 5) & 0x07;
+ rxfield.reserved() = BITSTRING(3, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 4);
+ rxfield.xbit() = BITSTRING(1, &ctemp);
+ rxfield.mode() = (buf[len] >> 2) & 0x03;
+ ctemp = ShiftDownBit(buf[len], 1);
+ rxfield.tisbit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 0);
+ rxfield.tssbit() = BITSTRING(1, &ctemp);
+ len += 1;
+ len += Get_SDVL_field_opt(&buf[len], chain.ts__stride(),
+ *rxfield.tssbit() == 1);
+ len += Get_SDVL_field_opt(&buf[len], chain.time__stride(),
+ *rxfield.tisbit() == 1);
+ }
+ else
+ {
+ chain.rx__field() = OMIT_VALUE;
+ chain.ts__stride() = OMIT_VALUE;
+ chain.time__stride() = OMIT_VALUE;
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+/* Reads the compressed IP-ID field after the base header */
+int
+Get_IP_ID_compressed_opt(unsigned char *buf,
+ OPTIONAL < LIN2__BO__LAST > &field,
+ t_dat *dat, int ip_level)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (dat->context.pkt() != Packet__type::IR && dat->context.pkt() != Packet__type::IR__DYN)
+ {
+ int ip_idx = getIPidx(dat, ip_level);
+ TTCN_logger.log(TTCN_DEBUG, "iplevel = %d, ip_idx = %d", ip_level, ip_idx);
+
+ if (ip_idx >= 0)
+ {
+ if (dat->context.ip__ctx()[ip_idx].rnd__bit())
+ len += Get_LIN2_BO_LAST(&buf[len], field());
+ else
+ field = OMIT_VALUE;
+ }
+ else
+ field = OMIT_VALUE;
+ }
+ else
+ field = OMIT_VALUE;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+/* Reads the AH data field after the base header */
+int
+Get_AH_data_opt(unsigned char *buf,
+ OPTIONAL < OCTETSTRING > &field, t_dat *dat,
+ int ip_level)
+{
+ int len = 0;
+ int ip_idx = getIPidx(dat, ip_level);
+
+ Log_function_name_on_enter();
+
+ TTCN_logger.log(TTCN_DEBUG, "iplevel = %d, ip_idx = %d", ip_level, ip_idx);
+
+ /* AH present */
+ if (ip_idx >= 0)
+ {
+ int ah_len = dat->compressed_ah_data_len[ip_idx];
+
+ if (ah_len > 0)
+ len += Get_octetstring(&buf[len], field(), ah_len);
+ else
+ field = OMIT_VALUE;
+ }
+ else
+ field = OMIT_VALUE;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+/* Reads the GRE checksum field after the base header */
+int
+Get_GRE_cksum_opt(unsigned char *buf,
+ OPTIONAL < LIN2__BO__LAST > &field, t_dat *dat,
+ int ip_level)
+{
+ int len = 0;
+ int ip_idx = getIPidx(dat, ip_level);
+
+ Log_function_name_on_enter();
+
+ TTCN_logger.log(TTCN_DEBUG, "iplevel = %d, ip_idx = %d", ip_level, ip_idx);
+
+ /* Compressed packet and GRE present */
+ if (ip_idx >= 0)
+ {
+ if (dat->ipx_gre_cksum_present[ip_idx])
+ len += Get_LIN2_BO_LAST(&buf[len], field());
+ else
+ field = OMIT_VALUE;
+ }
+ else
+ field = OMIT_VALUE;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+/* Reads the UDP checksum field after the base header */
+int
+Get_UDP_cksum_opt(unsigned char *buf,
+ OPTIONAL < LIN2__BO__LAST > &field, t_dat *dat)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (dat->context.pkt() != Packet__type::IR && dat->context.pkt() != Packet__type::IR__DYN &&
+ dat->context.udp__ctx().udp__cksum())
+ {
+ len += Get_LIN2_BO_LAST(&buf[len], field());
+ }
+ else
+ field = OMIT_VALUE;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_AEGSeqnum_opt(OPTIONAL < AEGSeqnum > &seqn, const unsigned char *buf,
+ bool hasvalue)
+{
+ unsigned char ctemp;
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (hasvalue)
+ {
+ if ((buf[len] & 0x80) == 0)
+ {
+ ctemp = ShiftDownBit(buf[len], 7);
+ seqn().short__form().ind() = BITSTRING(1, &ctemp);
+ seqn().short__form().lsb__of__seqnum() = buf[len] & 0x7F;
+ len += 1;
+ }
+ else
+ {
+ ctemp = ShiftDownBit(buf[len], 7);
+ seqn().long__form().ind() = BITSTRING(1, &ctemp);
+ seqn().long__form().lsb__of__seqnum() =
+ ((buf[len] & 0x7F) << 24) +
+ (buf[len + 1] << 16) + (buf[len + 2] << 8) + buf[len + 3];
+ len += 4;
+ }
+ }
+ else
+ seqn = OMIT_VALUE;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Inner_IP_flags_opt(unsigned char *buf,
+ OPTIONAL < Inner__IP__flags > &field,
+ t_dat *dat, bool hasvalue)
+{
+ int len = 0;
+ int ip_idx = getIPidx(dat, Inner_IP);
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ TTCN_logger.log(TTCN_DEBUG, "iplevel = %d, ip_idx = %d", Inner_IP, ip_idx);
+
+ if (hasvalue)
+ {
+ ctemp = ShiftDownBit(buf[len], 7);
+ field().tos() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 6);
+ field().ttl() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 5);
+ field().df() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 4);
+ field().pr() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 3);
+ field().ipx() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 2);
+ field().nbo() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 1);
+ field().rnd__bit() = BITSTRING(1, &ctemp);
+ dat->context.ip__ctx()[ip_idx].rnd__bit() = BOOLEAN(ctemp);
+ ctemp = ShiftDownBit(buf[len], 0);
+ field().ip2__bit() = BITSTRING(1, &ctemp);
+ len += 1;
+ }
+ else
+ field = OMIT_VALUE;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Outer_IP_flags_opt(unsigned char *buf,
+ OPTIONAL < Outer__IP__flags > &field,
+ t_dat *dat, bool hasvalue)
+{
+ int len = 0;
+ int ip_idx = getIPidx(dat, Outer_IP);
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ TTCN_logger.log(TTCN_DEBUG, "iplevel = %d, ip_idx = %d", Outer_IP, ip_idx);
+
+ if (hasvalue)
+ {
+ ctemp = ShiftDownBit(buf[len], 7);
+ field().tos2() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 6);
+ field().ttl2() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 5);
+ field().df2() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 4);
+ field().pr2() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 3);
+ field().ipx2() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 2);
+ field().nbo2() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 1);
+ field().rnd2() = BITSTRING(1, &ctemp);
+ dat->context.ip__ctx()[ip_idx].rnd__bit() = BOOLEAN(ctemp);
+ ctemp = ShiftDownBit(buf[len], 0);
+ field().i2__bit() = BITSTRING(1, &ctemp);
+ len += 1;
+ }
+ else
+ field = OMIT_VALUE;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_ipx_headers_opt(unsigned char *buf, OPTIONAL < IP__Ext__heads > &field,
+ t_dat *dat, bool hasvalue, int ip_idx)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ TTCN_logger.log(TTCN_DEBUG, "present = %d, ip_idx = %d", hasvalue, ip_idx);
+
+ if (hasvalue)
+ {
+ ctemp = ShiftDownBit(buf[len], 7);
+ field().cl() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 6);
+ field().aseq() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 5);
+ field().eseq() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 4);
+ field().gseq() = BITSTRING(1, &ctemp);
+ ctemp = buf[len] & 0x0F;
+ field().res() = BITSTRING(4, &ctemp);
+ len += 1;
+
+ len +=
+ Get_AEGSeqnum_opt(field().ah__seq(), &buf[len], *field().aseq() == 1);
+ len +=
+ Get_AEGSeqnum_opt(field().esp__seq(), &buf[len], *field().eseq() == 1);
+ len +=
+ Get_AEGSeqnum_opt(field().gre__seq(), &buf[len], *field().gseq() == 1);
+
+ if (*field().cl() == 1)
+ {
+ len += Get_Compr_head_list(field().compr__head__list(), &buf[len],
+ Item__list::ALT_ip__item__list,
+ dat, ip_idx);
+ }
+ else
+ field().compr__head__list() = OMIT_VALUE;
+ }
+ else
+ field = OMIT_VALUE;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Inner_IP_fields_opt(unsigned char *buf,
+ OPTIONAL < Inner__IP__fields > &field,
+ OPTIONAL < Inner__IP__flags > &flags,
+ t_dat *dat, bool hasvalue)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (hasvalue)
+ {
+ len += Get_LIN1_opt(&buf[len], field().tos(), (*flags().tos()) == 1);
+ len += Get_LIN1_opt(&buf[len], field().ttl(), (*flags().ttl()) == 1);
+ len += Get_LIN1_opt(&buf[len], field().proto(), (*flags().pr()) == 1);
+ len += Get_ipx_headers_opt(&buf[len], field().ext__heads(), dat,
+ (*flags().ipx()) == 1, getIPidx(dat, Inner_IP));
+ }
+ else
+ field = OMIT_VALUE;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Outer_IP_fields_opt(unsigned char *buf,
+ OPTIONAL < Outer__IP__fields > &field,
+ OPTIONAL < Outer__IP__flags > &flags,
+ t_dat *dat, bool hasvalue)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (hasvalue)
+ {
+ len += Get_LIN1_opt(&buf[len], field().tos(), (*flags().tos2()) == 1);
+ len += Get_LIN1_opt(&buf[len], field().ttl(), (*flags().ttl2()) == 1);
+ len += Get_LIN1_opt(&buf[len], field().proto(), (*flags().pr2()) == 1);
+ len += Get_ipx_headers_opt(&buf[len], field().ext__heads(), dat,
+ (*flags().ipx2()) == 1, getIPidx(dat, Outer_IP));
+ len += Get_LIN2_BO_LAST_opt(&buf[len], field().ip__id(),
+ (*flags().i2__bit()) == 1);
+ }
+ else
+ field = OMIT_VALUE;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_RTP_flags_fields_opt(unsigned char *buf,
+ OPTIONAL < RTP__flags__fields > &field,
+ t_dat *dat, bool hasvalue)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ if (hasvalue)
+ {
+ field().mode() = (buf[len] >> 6) & 0x03;
+ ctemp = ShiftDownBit(buf[len], 5);
+ field().r__pt() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 4);
+ field().m__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 3);
+ field().r__x() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 2);
+ field().csrc() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 1);
+ field().tss() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 0);
+ field().tis() = BITSTRING(1, &ctemp);
+ len += 1;
+
+ if (*field().r__pt() == 1)
+ {
+ ctemp = ShiftDownBit(buf[len], 7);
+ field().flags()().r__p() = BITSTRING(1, &ctemp);
+ field().flags()().rtp__pt() = buf[len] & 0x7F;
+ len += 1;
+ }
+ else
+ field().flags() = OMIT_VALUE;
+
+ if (*field().csrc() == 1)
+ {
+ len += Get_Compr_head_list(field().csrc__list(),
+ &buf[len], Item__list::ALT_csrc__item__list,
+ dat, 0);
+ }
+ else
+ field().csrc__list() = OMIT_VALUE;
+
+ len += Get_SDVL_field_opt(&buf[len], field().ts__stride(),
+ *field().tss() == 1);
+ len += Get_SDVL_field_opt(&buf[len], field().time__stride(),
+ *field().tis() == 1);
+ }
+ else
+ field = OMIT_VALUE;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile0_ROHC_Header(unsigned char *buf, t_dat *dat, int length,
+ Profile0__headers & p_header, int cid)
+{
+ unsigned char ctemp;
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (isIR(buf[len]))
+ {
+ Profile0__IR__packet & bhead = p_header.ir();
+
+ bhead.cid() = cid;
+ ctemp = (buf[len] >> 1) & 0x7F;
+ bhead.type__ind() = BITSTRING(7, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 0);
+ bhead.d() = BITSTRING(1, &ctemp);
+ len += 1;
+ len += Get_LIN1(&buf[len], bhead.profile());
+ dat->context.profile() = bhead.profile();
+ len += Get_LIN1(&buf[len], bhead.crc());
+ Get_octetstring(&buf[len], bhead.orig__packet(), length - len);
+ len = length;
+ }
+ else
+ {
+ Profile0__normal__packet & bhead = p_header.normal();
+ bhead.cid() = cid;
+ Get_octetstring(&buf[len], bhead.orig__packet(), length - len);
+ len = length;
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_Dynamic_Chain(Dynamic__Chain & dynch,
+ const unsigned char *buf, t_dat *dat)
+{
+ int len = 0, num;
+
+ Log_function_name_on_enter();
+
+ for (num = 0; num < dat->context.ip__ctx().size_of(); num++)
+ {
+ if (dat->context.ip__ctx()[num].version() == 4)
+ {
+ len += Get_ipv4_dynamic(&buf[len], dynch[num].ipv4__dyn(), dat, num);
+ }
+ else if (dat->context.ip__ctx()[num].version() == 6)
+ {
+ len += Get_ipv6_dynamic(&buf[len], dynch[num].ipv6__dyn(), dat, num);
+ }
+ else
+ {
+ int ipver = dat->context.ip__ctx()[num].version();
+ TTCN_error("Invalid IP version %u on level %d", ipver, num);
+ }
+ }
+
+ num = dynch.size_of();
+ len += Get_udp_dynamic_wo_sn(&buf[len], dynch[num].udp__dyn(), dat);
+
+ num = dynch.size_of();
+ len += Get_rtp_dynamic(&buf[len], dynch[num].rtp__dyn(), dat);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_Static_Chain(unsigned char *buf, Static__Chain & chain,
+ t_dat *dat)
+{
+ int len = 0, num = 0, nextheader = 0;
+
+ Log_function_name_on_enter();
+
+ while (nextheader != c__ip__proto__udp)
+ {
+ if (((buf[len] >> 4) & 0x0F) == 4)
+ {
+ initIPcontext(dat, num, 4);
+ len += Get_ipv4_static(&buf[len], chain[num].ipv4__stat());
+ nextheader = chain[num].ipv4__stat().proto();
+ }
+ else if (((buf[len] >> 4) & 0x0F) == 6)
+ {
+ initIPcontext(dat, num, 6);
+ len += Get_ipv6_static(&buf[len], chain[num].ipv6__stat());
+ nextheader = chain[num].ipv6__stat().nexthead();
+ }
+ else
+ {
+ TTCN_error("Invalid IP version %u on level %u (nextheader = %d)",
+ buf[len], num, nextheader);
+ }
+ num += 1;
+ }
+
+ len += Get_udp_static(&buf[len], chain[num].udp__stat());
+ num += 1;
+
+ len += Get_rtp_static(&buf[len], chain[num].rtp__stat());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_extension0(unsigned char *buf, Extension0 & ext,
+ t_dat *dat)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ ctemp = (buf[len] >> 6) & 0x03;
+ ext.ext__type() = BITSTRING(2, &ctemp);
+ ext.sn() = (buf[len] >> 3) & 0x07;
+ ext.plust() = buf[len] & 0x07;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_extension1(unsigned char *buf, Extension1 & ext,
+ t_dat *dat)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ ctemp = (buf[len] >> 6) & 0x03;
+ ext.ext__type() = BITSTRING(2, &ctemp);
+ ext.sn() = (buf[len] >> 3) & 0x07;
+ ext.plust() = buf[len] & 0x07;
+ len += 1;
+ ext.minust() = buf[len];
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_extension2(unsigned char *buf, Extension2 & ext,
+ t_dat *dat)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ ctemp = (buf[len] >> 6) & 0x03;
+ ext.ext__type() = BITSTRING(2, &ctemp);
+ ext.sn() = (buf[len] >> 3) & 0x07;
+ ext.plust() = ((buf[len] & 0x07) << 8) + (buf[len + 1] & 0xFF);
+ len += 2;
+ ext.minust() = buf[len];
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_extension3(unsigned char *buf, Extension3 & ext,
+ t_dat *dat)
+{
+ int len = 0;
+ int ts_length = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ ctemp = (buf[len] >> 6) & 0x03;
+ ext.ext__type() = BITSTRING(2, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 5);
+ ext.s__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 4);
+ ext.r__ts__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 3);
+ ext.tsc__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 2);
+ ext.i__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 1);
+ ext.ip__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 0);
+ ext.rtp__bit() = BITSTRING(1, &ctemp);
+ len += 1;
+
+ len += Get_Inner_IP_flags_opt(&buf[len], ext.inner__ip__flags(),
+ dat, *ext.ip__bit() == 1);
+
+ len += Get_Outer_IP_flags_opt(&buf[len], ext.outer__ip__flags(), dat,
+ (ext.inner__ip__flags().ispresent() &&
+ (*ext.inner__ip__flags()().ip2__bit()) == 1));
+
+ len += Get_LIN1_opt(&buf[len], ext.sn(), *ext.s__bit() == 1);
+ ts_length = Get_SDVL_field_opt(&buf[len], ext.ts(), *ext.r__ts__bit() == 1);
+ if (ts_length > 0)
+ {
+ ext.ts__length()() = ts_length;
+ }
+ else
+ {
+ ext.ts__length() = OMIT_VALUE;
+ }
+ len += ts_length;
+ len += Get_Inner_IP_fields_opt(&buf[len], ext.inner__ip__hdr(),
+ ext.inner__ip__flags(), dat,
+ *ext.ip__bit() == 1);
+
+ len += Get_LIN2_BO_LAST_opt(&buf[len], ext.ip__id(), *ext.i__bit() == 1);
+ len += Get_Outer_IP_fields_opt(&buf[len], ext.outer__ip__hdr(),
+ ext.outer__ip__flags(), dat,
+ (ext.inner__ip__flags().ispresent() &&
+ (*ext.inner__ip__flags()().ip2__bit()) == 1));
+
+ len += Get_RTP_flags_fields_opt(&buf[len], ext.rtp__fl__fi(), dat,
+ *ext.rtp__bit() == 1);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_extensions_opt(unsigned char *buf,
+ OPTIONAL < Profile1__Extension > &ext,
+ t_dat *dat, bool hasvalue)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (hasvalue)
+ {
+ if ((buf[len] & 0xC0) == 0)
+ {
+ len += Get_Profile1_extension0(&buf[len], ext().ext0(), dat);
+ }
+ else if ((buf[len] & 0xC0) == 0x40)
+ {
+ len += Get_Profile1_extension1(&buf[len], ext().ext1(), dat);
+ }
+ else if ((buf[len] & 0xC0) == 0x80)
+ {
+ len += Get_Profile1_extension2(&buf[len], ext().ext2(), dat);
+ }
+ else /* if ((buf[len] & 0xC0) == 0xC0) */
+ {
+ len += Get_Profile1_extension3(&buf[len], ext().ext3(), dat);
+ }
+ }
+ else
+ {
+ ext = OMIT_VALUE;
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_ROHC_Header_ir(unsigned char *buf, Profile1__IR__header & bhead,
+ t_dat *dat, int cid)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::IR);
+ bhead.cid() = cid;
+ ctemp = (buf[len] >> 1) & 0x7F;
+ bhead.type__ind() = BITSTRING(7, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 0);
+ bhead.d() = BITSTRING(1, &ctemp);
+ len += 1;
+
+ len += Get_LIN1(&buf[len], bhead.profile());
+ dat->context.profile() = bhead.profile();
+ len += Get_LIN1(&buf[len], bhead.crc());
+
+ len += Get_Profile1_Static_Chain(&buf[len], bhead.stat__chain(), dat);
+
+ if (*bhead.d() == 1)
+ len += Get_Profile1_Dynamic_Chain(bhead.dyn__chain(), &buf[len], dat);
+ else
+ bhead.dyn__chain() = OMIT_VALUE;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_ROHC_Header_irdyn(unsigned char *buf,
+ Profile1__IR__DYN__header & bhead,
+ t_dat *dat, int cid)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::IR__DYN);
+ bhead.cid() = cid;
+ bhead.type__ind() = BITSTRING(8, &buf[len]);
+ len += 1;
+ len += Get_LIN1(&buf[len], bhead.profile());
+ dat->context.profile() = bhead.profile();
+ len += Get_LIN1(&buf[len], bhead.crc());
+
+ len += Get_Profile1_Dynamic_Chain(bhead.dyn__chain(), &buf[len], dat);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_ROHC_Header_r0(unsigned char *buf,
+ Profile1__R__0__header & bhead,
+ t_dat *dat, int cid)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::R__0);
+
+ bhead.cid() = cid;
+ ctemp = (buf[len] >> 6) & 0x03;
+ bhead.type__ind() = BITSTRING(2, &ctemp);
+ bhead.sn() = buf[len] & 0x3F;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_ROHC_Header_r0crc(unsigned char *buf,
+ Profile1__R__0__CRC__header & bhead,
+ t_dat *dat, int cid)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::R__0__CRC);
+
+ bhead.cid() = cid;
+ ctemp = (buf[len] >> 6) & 0x03;
+ bhead.type__ind() = BITSTRING(2, &ctemp);
+ ctemp = (buf[len] << 1) & 0x7E;
+ len += 1;
+ ctemp += ShiftDownBit(buf[len], 7);
+ bhead.sn() = ctemp;
+ bhead.crc() = buf[len] & 0x7F;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_ROHC_Header_uo0(unsigned char *buf,
+ Profile1__UO__0__header & bhead,
+ t_dat *dat, int cid)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::UO__0);
+ bhead.cid() = cid;
+ ctemp = ShiftDownBit(buf[len], 7);
+ bhead.type__ind() = BITSTRING(1, &ctemp);
+ bhead.sn() = (buf[len] >> 3) & 0x0F;
+ bhead.crc() = buf[len] & 0x07;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_ROHC_Header_r1(unsigned char *buf,
+ Profile1__R__1__header & bhead,
+ t_dat *dat, int cid,
+ OPTIONAL < Profile1__Extension > &ext)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::R__1);
+ bhead.cid() = cid;
+ ctemp = (buf[len] >> 6) & 0x03;
+ bhead.type__ind() = BITSTRING(2, &ctemp);
+ bhead.sn() = buf[len] & 0x3F;
+ len += 1;
+ ctemp = ShiftDownBit(buf[len], 7);
+ bhead.m__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 6);
+ bhead.x__bit() = BITSTRING(1, &ctemp);
+ bhead.ts() = buf[len] & 0x3F;
+ len += 1;
+
+ if (*bhead.x__bit())
+ {
+ len += Get_Profile1_extensions_opt(&buf[len], ext, dat,
+ *bhead.x__bit());
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_ROHC_Header_r1_id(unsigned char *buf,
+ Profile1__R__1__ID__header & bhead,
+ t_dat *dat, int cid,
+ OPTIONAL < Profile1__Extension > &ext)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::R__1__ID);
+ bhead.cid() = cid;
+ ctemp = (buf[len] >> 6) & 0x03;
+ bhead.type__ind() = BITSTRING(2, &ctemp);
+ bhead.sn() = buf[len] & 0x3F;
+ len += 1;
+ ctemp = ShiftDownBit(buf[len], 7);
+ bhead.m__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 6);
+ bhead.x__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 5);
+ bhead.t__bit() = BITSTRING(1, &ctemp);
+ bhead.ip__id() = buf[len] & 0x1F;
+ len += 1;
+
+ if (*bhead.x__bit())
+ {
+ len += Get_Profile1_extensions_opt(&buf[len], ext, dat,
+ *bhead.x__bit());
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_ROHC_Header_r1_ts(unsigned char *buf,
+ Profile1__R__1__TS__header & bhead,
+ t_dat *dat, int cid,
+ OPTIONAL < Profile1__Extension > &ext)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::R__1__TS);
+ bhead.cid() = cid;
+ ctemp = (buf[len] >> 6) & 0x03;
+ bhead.type__ind() = BITSTRING(2, &ctemp);
+ bhead.sn() = buf[len] & 0x3F;
+ len += 1;
+ ctemp = ShiftDownBit(buf[len], 7);
+ bhead.m__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 6);
+ bhead.x__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 5);
+ bhead.t__bit() = BITSTRING(1, &ctemp);
+ bhead.ts() = buf[len] & 0x1F;
+ len += 1;
+
+ if (*bhead.x__bit())
+ {
+ len += Get_Profile1_extensions_opt(&buf[len], ext, dat,
+ *bhead.x__bit());
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_ROHC_Header_uo1(unsigned char *buf,
+ Profile1__UO__1__header & bhead,
+ t_dat *dat, int cid)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::UO__1);
+ bhead.cid() = cid;
+ ctemp = (buf[len] >> 6) & 0x03;
+ bhead.type__ind() = BITSTRING(2, &ctemp);
+ bhead.ts() = buf[len] & 0x3F;
+ len += 1;
+ ctemp = ShiftDownBit(buf[len], 7);
+ bhead.m__bit() = BITSTRING(1, &ctemp);
+ bhead.sn() = (buf[len] >> 3) & 0x0F;
+ bhead.crc() = buf[len] & 0x07;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_ROHC_Header_uo1_id(unsigned char *buf,
+ Profile1__UO__1__ID__header & bhead,
+ t_dat *dat, int cid,
+ OPTIONAL < Profile1__Extension > &ext)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::UO__1__ID);
+ bhead.cid() = cid;
+ ctemp = (buf[len] >> 6) & 0x03;
+ bhead.type__ind() = BITSTRING(2, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 5);
+ bhead.t__bit() = BITSTRING(1, &ctemp);
+ bhead.ip__id() = buf[len] & 0x1F;
+ len += 1;
+ ctemp = ShiftDownBit(buf[len], 7);
+ bhead.x__bit() = BITSTRING(1, &ctemp);
+ bhead.sn() = (buf[len] >> 3) & 0x0F;
+ bhead.crc() = buf[len] & 0x07;
+ len += 1;
+
+ if (*bhead.x__bit())
+ {
+ len += Get_Profile1_extensions_opt(&buf[len], ext,
+ dat, *bhead.x__bit());
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_ROHC_Header_uo1_ts(unsigned char *buf,
+ Profile1__UO__1__TS__header & bhead,
+ t_dat *dat, int cid)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::UO__1__TS);
+ bhead.cid() = cid;
+ ctemp = (buf[len] >> 6) & 0x03;
+ bhead.type__ind() = BITSTRING(2, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 5);
+ bhead.t__bit() = BITSTRING(1, &ctemp);
+ bhead.ts() = buf[len] & 0x1F;
+ len += 1;
+ ctemp = ShiftDownBit(buf[len], 7);
+ bhead.m__bit() = BITSTRING(1, &ctemp);
+ bhead.sn() = (buf[len] >> 3) & 0x0F;
+ bhead.crc() = buf[len] & 0x07;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_ROHC_Header_uor2(unsigned char *buf,
+ Profile1__UOR__2__header & bhead,
+ t_dat *dat, int cid,
+ OPTIONAL < Profile1__Extension > &ext)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::UOR__2);
+ bhead.cid() = cid;
+ ctemp = (buf[len] >> 5) & 0x07;
+ bhead.type__ind() = BITSTRING(3, &ctemp);
+ ctemp = (buf[len] & 0x1F) << 1;
+ len += 1;
+ ctemp += ShiftDownBit(buf[len], 7);
+ bhead.ts() = ctemp;
+ ctemp = ShiftDownBit(buf[len], 6);
+ bhead.m__bit() = BITSTRING(1, &ctemp);
+ bhead.sn() = buf[len] & 0x3F;
+ len += 1;
+ ctemp = ShiftDownBit(buf[len], 7);
+ bhead.x__bit() = BITSTRING(1, &ctemp);
+ bhead.crc() = buf[len] & 0x7F;
+ len += 1;
+
+ if (*bhead.x__bit())
+ {
+ len += Get_Profile1_extensions_opt(&buf[len], ext,
+ dat, *bhead.x__bit());
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_ROHC_Header_uor2_id(unsigned char *buf,
+ Profile1__UOR__2__ID__header & bhead,
+ t_dat *dat, int cid,
+ OPTIONAL < Profile1__Extension > & ext)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::UOR__2__ID);
+ bhead.cid() = cid;
+ ctemp = (buf[len] >> 5) & 0x07;
+ bhead.type__ind() = BITSTRING(3, &ctemp);
+ bhead.ip__id() = buf[len] & 0x1F;
+ len += 1;
+ ctemp = ShiftDownBit(buf[len], 7);
+ bhead.t__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 6);
+ bhead.m__bit() = BITSTRING(1, &ctemp);
+ bhead.sn() = buf[len] & 0x3F;
+ len += 1;
+ ctemp = ShiftDownBit(buf[len], 7);
+ bhead.x__bit() = BITSTRING(1, &ctemp);
+ bhead.crc() = buf[len] & 0x7F;
+ len += 1;
+
+ if (*bhead.x__bit())
+ {
+ len += Get_Profile1_extensions_opt(&buf[len], ext,
+ dat, *bhead.x__bit());
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_ROHC_Header_uor2_ts(unsigned char *buf,
+ Profile1__UOR__2__TS__header & bhead,
+ t_dat *dat, int cid,
+ OPTIONAL < Profile1__Extension > & ext)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::UOR__2__TS);
+ bhead.cid() = cid;
+ ctemp = (buf[len] >> 5) & 0x07;
+ bhead.type__ind() = BITSTRING(3, &ctemp);
+ bhead.ts() = buf[len] & 0x1F;
+ len += 1;
+ ctemp = ShiftDownBit(buf[len], 7);
+ bhead.t__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 6);
+ bhead.m__bit() = BITSTRING(1, &ctemp);
+ bhead.sn() = buf[len] & 0x3F;
+ len += 1;
+ ctemp = ShiftDownBit(buf[len], 7);
+ bhead.x__bit() = BITSTRING(1, &ctemp);
+ bhead.crc() = buf[len] & 0x7F;
+ len += 1;
+
+ if (*bhead.x__bit())
+ {
+ len += Get_Profile1_extensions_opt(&buf[len], ext,
+ dat, *bhead.x__bit());
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile1_ROHC_Header(unsigned char *buf, t_dat *dat, int length,
+ Profile1__headers & hdr, int cid)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (isIR(buf[len]))
+ {
+ len += Get_Profile1_ROHC_Header_ir(&buf[len],
+ hdr.base__header().ir(), dat, cid);
+ }
+ else if (isIRDYN(buf[len]))
+ {
+ len += Get_Profile1_ROHC_Header_irdyn(&buf[len],
+ hdr.base__header().ir__dyn(),
+ dat, cid);
+ }
+ else if (isUOR2(buf[len]))
+ {
+ if (isAnyIPv4RNDunset(dat))
+ {
+ if (buf[len + 1] & 0x80) // T = 1
+ {
+ len += Get_Profile1_ROHC_Header_uor2_ts(&buf[len],
+ hdr.base__header().
+ uor__2__ts(), dat, cid,
+ hdr.ext());
+ }
+ else // T = 0
+ {
+ len += Get_Profile1_ROHC_Header_uor2_id(&buf[len],
+ hdr.base__header().
+ uor__2__id(), dat, cid,
+ hdr.ext());
+ }
+ }
+ else // at least one RND is unset
+ {
+ len += Get_Profile1_ROHC_Header_uor2(&buf[len],
+ hdr.base__header().uor__2(),
+ dat, cid, hdr.ext());
+ }
+ }
+ else if (dat->context.mode() == ROHC_mode_R)
+ {
+ if ((buf[len] & 0xC0) == 0)
+ {
+ len += Get_Profile1_ROHC_Header_r0(&buf[len],
+ hdr.base__header().r__0(),
+ dat, cid);
+ }
+ else if ((buf[len] & 0xC0) == 0x40)
+ {
+ len += Get_Profile1_ROHC_Header_r0crc(&buf[len],
+ hdr.base__header().r__0__crc(),
+ dat, cid);
+ }
+ else if ((buf[len] & 0xC0) == 0x80) // PT-1
+ {
+ if (isAnyIPv4RNDunset(dat))
+ {
+ if (buf[len + 1] & 0x20) // T = 1
+ {
+ len += Get_Profile1_ROHC_Header_r1_ts(&buf[len],
+ hdr.base__header().r__1__ts(),
+ dat, cid, hdr.ext());
+ }
+ else // T = 0
+ {
+ len += Get_Profile1_ROHC_Header_r1_id(&buf[len],
+ hdr.base__header().r__1__id(),
+ dat, cid, hdr.ext());
+ }
+ }
+ else // at least one RND is unset
+ {
+ len += Get_Profile1_ROHC_Header_r1(&buf[len],
+ hdr.base__header().r__1(),
+ dat, cid, hdr.ext());
+ }
+ }
+ }
+ else if (dat->context.mode() != ROHC_mode_R) // U-O modes
+ {
+ if ((buf[len] & 0x80) == 0)
+ {
+ len += Get_Profile1_ROHC_Header_uo0(&buf[len],
+ hdr.base__header().uo__0(),
+ dat, cid);
+ }
+ else if ((buf[len] & 0xC0) == 0x80) // PT-1
+ {
+ if (isAnyIPv4RNDunset(dat))
+ {
+ if (buf[len] & 0x20) // T = 1
+ {
+ len += Get_Profile1_ROHC_Header_uo1_ts(&buf[len],
+ hdr.base__header().uo__1__ts(),
+ dat, cid);
+ }
+ else // T = 0
+ {
+ len += Get_Profile1_ROHC_Header_uo1_id(&buf[len],
+ hdr.base__header().uo__1__id(),
+ dat, cid, hdr.ext());
+ }
+ }
+ else // at least one RND is unset
+ {
+ len += Get_Profile1_ROHC_Header_uo1(&buf[len],
+ hdr.base__header().uo__1(),
+ dat, cid);
+ }
+ }
+ }
+
+ if (!hdr.ext().is_bound())
+ hdr.ext() = OMIT_VALUE;
+ len += Get_IP_ID_compressed_opt(&buf[len], hdr.ip__id__outer(),
+ dat, Outer_IP);
+ len += Get_AH_data_opt(&buf[len], hdr.ah__outer(), dat, Outer_IP);
+ len += Get_GRE_cksum_opt(&buf[len], hdr.gre__cksum1(), dat, Outer_IP);
+ len += Get_IP_ID_compressed_opt(&buf[len], hdr.ip__id__inner(),
+ dat, Inner_IP);
+ len += Get_AH_data_opt(&buf[len], hdr.ah__inner(), dat, Inner_IP);
+ len += Get_GRE_cksum_opt(&buf[len], hdr.gre__cksum2(), dat, Inner_IP);
+ len += Get_UDP_cksum_opt(&buf[len], hdr.udp__cksum(), dat);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+} /* Get_Profile1_ROHC_Header */
+
+int
+Get_Profile2_Dynamic_Chain(Profile2__Dynamic__Chain & dynch,
+ const unsigned char *buf, t_dat *dat)
+{
+ int len = 0, num;
+
+ Log_function_name_on_enter();
+
+ for (num = 0; num < dat->context.ip__ctx().size_of(); num++)
+ {
+ if (dat->context.ip__ctx()[num].version() == 4)
+ {
+ len += Get_ipv4_dynamic(&buf[len], dynch[num].ipv4__dyn(), dat, num);
+ }
+ else if (dat->context.ip__ctx()[num].version() == 6)
+ {
+ len += Get_ipv6_dynamic(&buf[len], dynch[num].ipv6__dyn(), dat, num);
+ }
+ else
+ {
+ int ipver = dat->context.ip__ctx()[num].version();
+ TTCN_error("Invalid IP version %u on level %d", ipver, num);
+ }
+ }
+
+ num = dynch.size_of();
+ len += Get_udp_dynamic_w_sn(&buf[len], dynch[num].udp__dyn(), dat);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile2_extension0(unsigned char *buf, Profile2__Extension0 & ext,
+ t_dat *dat)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ ctemp = (buf[len] >> 6) & 0x03;
+ ext.ext__type() = BITSTRING(2, &ctemp);
+ ext.sn() = (buf[len] >> 3) & 0x07;
+ ext.ip__id() = buf[len] & 0x07;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile2_extension1(unsigned char *buf, Profile2__Extension1 & ext,
+ t_dat *dat)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ ctemp = (buf[len] >> 6) & 0x03;
+ ext.ext__type() = BITSTRING(2, &ctemp);
+ ext.sn() = (buf[len] >> 3) & 0x07;
+ ext.ip__id() = ((buf[len] & 0x07) << 8) + (buf[len + 1] & 0xFF);
+ len += 2;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile2_extension2(unsigned char *buf, Profile2__Extension2 & ext,
+ t_dat *dat)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ ctemp = (buf[len] >> 6) & 0x03;
+ ext.ext__type() = BITSTRING(2, &ctemp);
+ ext.sn() = (buf[len] >> 3) & 0x07;
+ ext.ip__id2() = ((buf[len] & 0x07) << 8) + (buf[len + 1] & 0xFF);
+ len += 2;
+ ext.ip__id() = buf[len];
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile2_Inner_IP_flags_opt(unsigned char *buf,
+ OPTIONAL < Profile2__Inner__IP__flags > &field,
+ t_dat *dat, bool hasvalue)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ if (hasvalue)
+ {
+ ctemp = ShiftDownBit(buf[len], 7);
+ field().tos() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 6);
+ field().ttl() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 5);
+ field().df() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 4);
+ field().pr() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 3);
+ field().ipx() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 2);
+ field().nbo() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 1);
+ field().rnd__bit() = BITSTRING(1, &ctemp);
+ dat->context.ip__ctx()[getIPidx(dat, Inner_IP)].rnd__bit() = BOOLEAN(ctemp);
+ ctemp = ShiftDownBit(buf[len], 0);
+ field().reserved() = BITSTRING(1, &ctemp);
+ len += 1;
+ }
+ else
+ field = OMIT_VALUE;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile2_Inner_IP_fields_opt(unsigned char *buf,
+ OPTIONAL < Inner__IP__fields > &field,
+ OPTIONAL < Profile2__Inner__IP__flags >
+ &flags, t_dat *dat,
+ bool hasvalue)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (hasvalue)
+ {
+ len += Get_LIN1_opt(&buf[len], field().tos(), (*flags().tos()) == 1);
+ len += Get_LIN1_opt(&buf[len], field().ttl(), (*flags().ttl()) == 1);
+ len += Get_LIN1_opt(&buf[len], field().proto(), (*flags().pr()) == 1);
+ len += Get_ipx_headers_opt(&buf[len], field().ext__heads(), dat,
+ (*flags().ipx()) == 1, getIPidx(dat, Inner_IP));
+ }
+ else
+ field = OMIT_VALUE;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile2_extension3(unsigned char *buf, Profile2__Extension3 & ext,
+ t_dat *dat)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Profile2__Inner__IP__flags inipflags;
+
+ Log_function_name_on_enter();
+
+ ctemp = (buf[len] >> 6) & 0x03;
+ ext.ext__type() = BITSTRING(2, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 5);
+ ext.s__bit() = BITSTRING(1, &ctemp);
+ ext.mode() = (buf[len] >> 3) & 0x03;
+ ctemp = ShiftDownBit(buf[len], 2);
+ ext.i__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 1);
+ ext.ip__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 0);
+ ext.ip2__bit() = BITSTRING(1, &ctemp);
+ len += 1;
+
+ len +=
+ Get_Profile2_Inner_IP_flags_opt(&buf[len], ext.inner__ip__flags(),
+ dat, *ext.ip__bit() == 1);
+
+ len += Get_Outer_IP_flags_opt(&buf[len], ext.outer__ip__flags(), dat,
+ *ext.ip2__bit() == 1);
+
+ len += Get_LIN1_opt(&buf[len], ext.sn(), *ext.s__bit() == 1);
+
+ len += Get_Profile2_Inner_IP_fields_opt(&buf[len], ext.inner__ip__hdr(),
+ ext.inner__ip__flags(), dat,
+ *ext.ip__bit() == 1);
+
+ len += Get_LIN2_BO_LAST_opt(&buf[len], ext.ip__id(), *ext.i__bit() == 1);
+
+ len += Get_Outer_IP_fields_opt(&buf[len], ext.outer__ip__hdr(),
+ ext.outer__ip__flags(), dat,
+ *ext.ip2__bit() == 1);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile2_extensions_opt(unsigned char *buf,
+ OPTIONAL < Profile2__Extension > &ext,
+ t_dat *dat, bool hasvalue)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (hasvalue)
+ {
+ if ((buf[len] & 0xC0) == 0)
+ {
+ len += Get_Profile2_extension0(&buf[len], ext().ext0(), dat);
+ }
+ else if ((buf[len] & 0xC0) == 0x40)
+ {
+ len += Get_Profile2_extension1(&buf[len], ext().ext1(), dat);
+ }
+ else if ((buf[len] & 0xC0) == 0x80)
+ {
+ len += Get_Profile2_extension2(&buf[len], ext().ext2(), dat);
+ }
+ else /* if ((buf[len] & 0xC0) == 0xC0) */
+ {
+ len += Get_Profile2_extension3(&buf[len], ext().ext3(), dat);
+ }
+ }
+ else
+ {
+ ext = OMIT_VALUE;
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile2_Static_Chain(unsigned char *buf, Profile2__Static__Chain & chain,
+ t_dat *dat)
+{
+ int len = 0, num = 0, nextheader = 0;
+
+ Log_function_name_on_enter();
+
+ while (nextheader != c__ip__proto__udp)
+ {
+ if (((buf[len] >> 4) & 0x0F) == 4)
+ {
+ initIPcontext(dat, num, 4);
+ len += Get_ipv4_static(&buf[len], chain[num].ipv4__stat());
+ nextheader = chain[num].ipv4__stat().proto();
+ }
+ else if (((buf[len] >> 4) & 0x0F) == 6)
+ {
+ initIPcontext(dat, num, 6);
+ len += Get_ipv6_static(&buf[len], chain[num].ipv6__stat());
+ nextheader = chain[num].ipv6__stat().nexthead();
+ }
+ else
+ {
+ TTCN_error("Invalid IP version %u on level %u", buf[len], num);
+ }
+ num += 1;
+ }
+
+ len += Get_udp_static(&buf[len], chain[num].udp__stat());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile2_ROHC_Header_ir(unsigned char *buf, Profile2__IR__header & bhead,
+ t_dat *dat, int cid)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::IR);
+ bhead.cid() = cid;
+ ctemp = (buf[len] >> 1) & 0x7F;
+ bhead.type__ind() = BITSTRING(7, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 0);
+ bhead.d() = BITSTRING(1, &ctemp);
+ len += 1;
+ len += Get_LIN1(&buf[len], bhead.profile());
+ dat->context.profile() = bhead.profile();
+ len += Get_LIN1(&buf[len], bhead.crc());
+
+ len += Get_Profile2_Static_Chain(&buf[len], bhead.stat__chain(), dat);
+
+ if (*bhead.d() == 1)
+ len += Get_Profile2_Dynamic_Chain(bhead.dyn__chain(), &buf[len], dat);
+ else
+ bhead.dyn__chain() = OMIT_VALUE;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile2_ROHC_Header_irdyn(unsigned char *buf,
+ Profile2__IR__DYN__header & bhead,
+ t_dat *dat, int cid)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::IR__DYN);
+ bhead.cid() = cid;
+ bhead.type__ind() = BITSTRING(8, &buf[len]);
+ len += 1;
+ len += Get_LIN1(&buf[len], bhead.profile());
+ dat->context.profile() = bhead.profile();
+ len += Get_LIN1(&buf[len], bhead.crc());
+
+ len += Get_Profile2_Dynamic_Chain(bhead.dyn__chain(), &buf[len], dat);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile2_ROHC_Header_r1(unsigned char *buf,
+ Profile2__R__1__header & bhead,
+ t_dat *dat, int cid,
+ OPTIONAL < Profile2__Extension > &ext)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::R__1);
+ bhead.cid() = cid;
+ ctemp = (buf[len] >> 6) & 0x03;
+ bhead.type__ind() = BITSTRING(2, &ctemp);
+ bhead.sn() = buf[len] & 0x3F;
+ len += 1;
+ ctemp = ShiftDownBit(buf[len], 7);
+ bhead.x__bit() = BITSTRING(1, &ctemp);
+ bhead.ip__id() = buf[len] & 0x7F;
+ len += 1;
+
+ if (*bhead.x__bit())
+ {
+ len += Get_Profile2_extensions_opt(&buf[len], ext,
+ dat, *bhead.x__bit());
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile2_ROHC_Header_uo1(unsigned char *buf,
+ Profile2__UO__1__header & bhead,
+ t_dat *dat, int cid)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::UO__1);
+ bhead.cid() = cid;
+ ctemp = (buf[len] >> 6) & 0x03;
+ bhead.type__ind() = BITSTRING(2, &ctemp);
+ bhead.ip__id() = buf[len] & 0x3F;
+ len += 1;
+ bhead.sn() = (buf[len] >> 3) & 0x1F;
+ bhead.crc() = buf[len] & 0x07;
+ len += 1;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile2_ROHC_Header_uor2(unsigned char *buf,
+ Profile2__UOR__2__header & bhead,
+ t_dat *dat, int cid,
+ OPTIONAL < Profile2__Extension > &ext)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::UOR__2);
+ bhead.cid() = cid;
+ ctemp = (buf[len] >> 5) & 0x07;
+ bhead.type__ind() = BITSTRING(3, &ctemp);
+ bhead.sn() = buf[len] & 0x1F;
+ len += 1;
+ ctemp = ShiftDownBit(buf[len], 7);
+ bhead.x__bit() = BITSTRING(1, &ctemp);
+ bhead.crc() = buf[len] & 0x7F;
+ len += 1;
+
+ if (*bhead.x__bit())
+ {
+ len += Get_Profile2_extensions_opt(&buf[len], ext,
+ dat, *bhead.x__bit());
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile2_ROHC_Header(unsigned char *buf, int length,
+ Profile2__headers & hdr,
+ t_dat *dat, int cid)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (isIR(buf[len]))
+ {
+ len += Get_Profile2_ROHC_Header_ir(&buf[len],
+ hdr.base__header().ir(), dat, cid);
+ }
+ else if (isIRDYN(buf[len]))
+ {
+ len += Get_Profile2_ROHC_Header_irdyn(&buf[len],
+ hdr.base__header().ir__dyn(),
+ dat, cid);
+ }
+ else if (isUOR2(buf[len]))
+ {
+ len += Get_Profile2_ROHC_Header_uor2(&buf[len],
+ hdr.base__header().uor__2(),
+ dat, cid, hdr.ext());
+ }
+ else if (dat->context.mode() == ROHC_mode_R)
+ {
+ if ((buf[len] & 0xC0) == 0)
+ {
+ len += Get_Profile1_ROHC_Header_r0(&buf[len],
+ hdr.base__header().r__0(),
+ dat, cid);
+ }
+ else if ((buf[len] & 0xC0) == 0x40)
+ {
+ len += Get_Profile1_ROHC_Header_r0crc(&buf[len],
+ hdr.base__header().r__0__crc(),
+ dat, cid);
+ }
+ else if ((buf[len] & 0xC0) == 0x80)
+ {
+ len += Get_Profile2_ROHC_Header_r1(&buf[len],
+ hdr.base__header().r__1(),
+ dat, cid, hdr.ext());
+ }
+ else
+ {
+ TTCN_error("Unknown compressed packet (R mode) (0x%02x)", buf[len]);
+ }
+ }
+ else if (dat->context.mode() != ROHC_mode_R) // U-O modes
+ {
+ if ((buf[len] & 0x80) == 0)
+ {
+ len += Get_Profile1_ROHC_Header_uo0(&buf[len],
+ hdr.base__header().uo__0(),
+ dat, cid);
+ }
+ else if ((buf[len] & 0xC0) == 0x80)
+ {
+ len += Get_Profile2_ROHC_Header_uo1(&buf[len],
+ hdr.base__header().uo__1(),
+ dat, cid);
+ }
+ else
+ {
+ TTCN_error("Unknown compressed packet (U-O mode) (0x%02x)", buf[len]);
+ }
+ }
+
+ if (!hdr.ext().is_bound())
+ hdr.ext() = OMIT_VALUE;
+ len += Get_IP_ID_compressed_opt(&buf[len], hdr.ip__id__outer(),
+ dat, Outer_IP);
+ len += Get_AH_data_opt(&buf[len], hdr.ah__outer(), dat, Outer_IP);
+ len += Get_GRE_cksum_opt(&buf[len], hdr.gre__cksum1(), dat, Outer_IP);
+ len += Get_IP_ID_compressed_opt(&buf[len], hdr.ip__id__inner(),
+ dat, Inner_IP);
+ len += Get_AH_data_opt(&buf[len], hdr.ah__inner(), dat, Inner_IP);
+ len += Get_GRE_cksum_opt(&buf[len], hdr.gre__cksum2(), dat, Inner_IP);
+ len += Get_UDP_cksum_opt(&buf[len], hdr.udp__cksum(), dat);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+} /* Get_Profile2_ROHC_Header */
+
+int
+Get_Profile4_ipv4_dynamic(const unsigned char *buf,
+ Profile4__IPv4__Dynamic & chain,
+ t_dat *dat, int ip_level)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ len += Get_LIN1(&buf[len], chain.tos());
+ len += Get_LIN1(&buf[len], chain.ttl());
+ len += Get_LIN2_BO_LAST(&buf[len], chain.identification());
+ ctemp = ShiftDownBit(buf[len], 7);
+ chain.df__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 6);
+ chain.rnd__bit() = BITSTRING(1, &ctemp);
+ dat->context.ip__ctx()[ip_level].rnd__bit() = BOOLEAN(ctemp);
+ ctemp = ShiftDownBit(buf[len], 5);
+ chain.nbo__bit() = BITSTRING(1, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 4);
+ chain.sid__bit() = BITSTRING(1, &ctemp);
+ ctemp = buf[len] & 0x0F;
+ chain.reserved() = BITSTRING(4, &ctemp);
+ len += 1;
+ len += Get_Encoding_Type_0(chain.genextheadlist(),
+ &buf[len], Item__list::ALT_ip__item__list,
+ dat, ip_level);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile4_Dynamic_Chain(Profile4__Dynamic__Chain & dynch,
+ const unsigned char *buf, t_dat *dat)
+{
+ int len = 0, num;
+
+ Log_function_name_on_enter();
+
+ for (num = 0; num < dat->context.ip__ctx().size_of() && num < 2; num++)
+ {
+ if (dat->context.ip__ctx()[num].version() == 4)
+ {
+ len += Get_Profile4_ipv4_dynamic(&buf[len], dynch[num].ipv4__dyn(),
+ dat, num);
+ }
+ else if (dat->context.ip__ctx()[num].version() == 6)
+ {
+ len += Get_ipv6_dynamic(&buf[len], dynch[num].ipv6__dyn(), dat, num);
+ }
+ else
+ {
+ int ipver = dat->context.ip__ctx()[num].version();
+ TTCN_error("Invalid IP version %u on level %d", ipver, num);
+ }
+ }
+
+ num = dynch.size_of();
+ len += Get_LIN2_BO_LAST(&buf[len], dynch[num].sn());
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile4_Additional_Dynamic_Chain_opt(OPTIONAL < Profile4__Dynamic__Chain >
+ &dynch,
+ const unsigned char *buf,
+ t_dat *dat)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (dat->context.ip__ctx().size_of() > 2)
+ {
+ for (int num = 2; num < dat->context.ip__ctx().size_of(); num++)
+ {
+ if (dat->context.ip__ctx()[num].version() == 4)
+ {
+ len += Get_Profile4_ipv4_dynamic(&buf[len],
+ dynch()[num - 2].ipv4__dyn(),
+ dat, num);
+ }
+ else if (dat->context.ip__ctx()[num].version() == 6)
+ {
+ len += Get_ipv6_dynamic(&buf[len], dynch()[num - 2].ipv6__dyn(),
+ dat, num);
+ }
+ else
+ {
+ int ipver = dat->context.ip__ctx()[num].version();
+ TTCN_error("Invalid IP version %u on level %d", ipver, num);
+ }
+ }
+ }
+ else
+ dynch = OMIT_VALUE;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile4_Static_Chain(unsigned char *buf, Profile4__Static__Chain & chain,
+ t_dat *dat)
+{
+ int len = 0, num = 0, nextheader = 0;
+ bool terminated = false;
+
+ Log_function_name_on_enter();
+
+ do
+ {
+ /* Version does not include the MSB bit of the version field */
+ int ver = (buf[len] >> 4) & 0x07;
+
+ terminated = (buf[len] & 0x80 > 0) ? true : false;
+ if (ver == c__ip__version__ipv4)
+ {
+ // version is stored with the MSB bit
+ initIPcontext(dat, num, (buf[len] >> 4) & 0x0F);
+ len += Get_ipv4_static(&buf[len], chain[num].ipv4__stat());
+ nextheader = chain[num].ipv4__stat().proto();
+ }
+ else if (ver == c__ip__version__ipv6)
+ {
+ // version is stored with the MSB bit
+ initIPcontext(dat, num, (buf[len] >> 4) & 0x0F);
+ len += Get_ipv6_static(&buf[len], chain[num].ipv6__stat());
+ nextheader = chain[num].ipv6__stat().nexthead();
+ }
+ else
+ {
+ TTCN_error("Invalid IP version %u on level %u", ver, num);
+ }
+ /* Explicit MSB termination */
+ if (terminated)
+ {
+ TTCN_logger.log(TTCN_DEBUG, "MSB static chain termination on level %u",
+ num);
+ }
+ num += 1;
+ }
+ while ((nextheader == c__ip__proto__ipv4 || nextheader == c__ip__proto__ipv6) &&
+ !terminated);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile4_ROHC_Header_ir(unsigned char *buf, Profile4__IR__header & bhead,
+ t_dat *dat, int cid)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::IR);
+ bhead.cid() = cid;
+ ctemp = (buf[len] >> 1) & 0x7F;
+ bhead.type__ind() = BITSTRING(7, &ctemp);
+ ctemp = ShiftDownBit(buf[len], 0);
+ bhead.d() = BITSTRING(1, &ctemp);
+ len += 1;
+ len += Get_LIN1(&buf[len], bhead.profile());
+ dat->context.profile() = bhead.profile();
+ len += Get_LIN1(&buf[len], bhead.crc());
+
+ len += Get_Profile4_Static_Chain(&buf[len], bhead.stat__chain(), dat);
+
+ if (*bhead.d() == 1)
+ len += Get_Profile4_Dynamic_Chain(bhead.dyn__chain(), &buf[len], dat);
+ else
+ bhead.dyn__chain() = OMIT_VALUE;
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile4_ROHC_Header_irdyn(unsigned char *buf,
+ Profile4__IR__DYN__header & bhead,
+ t_dat *dat, int cid)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::IR__DYN);
+ bhead.cid() = cid;
+ bhead.type__ind() = BITSTRING(8, &buf[len]);
+ len += 1;
+ len += Get_LIN1(&buf[len], bhead.profile());
+ dat->context.profile() = bhead.profile();
+ len += Get_LIN1(&buf[len], bhead.crc());
+
+ len += Get_Profile4_Dynamic_Chain(bhead.dyn__chain(), &buf[len], dat);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile4_ROHC_Header_r1(unsigned char *buf,
+ Profile2__R__1__header & bhead,
+ t_dat *dat, int cid,
+ OPTIONAL < Profile2__Extension > &ext)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::R__1);
+ bhead.cid() = cid;
+ ctemp = (buf[len] >> 6) & 0x03;
+ bhead.type__ind() = BITSTRING(2, &ctemp);
+ bhead.sn() = buf[len] & 0x3F;
+ len += 1;
+ ctemp = ShiftDownBit(buf[len], 7);
+ bhead.x__bit() = BITSTRING(1, &ctemp);
+ bhead.ip__id() = buf[len] & 0x7F;
+ len += 1;
+
+ if (*bhead.x__bit())
+ {
+ len += Get_Profile2_extensions_opt(&buf[len], ext,
+ dat, *bhead.x__bit());
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile4_ROHC_Header_uor2(unsigned char *buf,
+ Profile2__UOR__2__header & bhead,
+ t_dat *dat, int cid,
+ OPTIONAL < Profile2__Extension > &ext)
+{
+ int len = 0;
+ unsigned char ctemp;
+
+ Log_function_name_on_enter();
+
+ dat->context.pkt() = Packet__type(Packet__type::UOR__2);
+ bhead.cid() = cid;
+ ctemp = (buf[len] >> 5) & 0x07;
+ bhead.type__ind() = BITSTRING(3, &ctemp);
+ bhead.sn() = buf[len] & 0x1F;
+ len += 1;
+ ctemp = ShiftDownBit(buf[len], 7);
+ bhead.x__bit() = BITSTRING(1, &ctemp);
+ bhead.crc() = buf[len] & 0x7F;
+ len += 1;
+
+ if (*bhead.x__bit())
+ {
+ len += Get_Profile2_extensions_opt(&buf[len], ext,
+ dat, *bhead.x__bit());
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+int
+Get_Profile4_ROHC_Header(unsigned char *buf, int length,
+ Profile4__headers & hdr, t_dat *dat,
+ int cid)
+{
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ if (isIR(buf[len]))
+ {
+ len += Get_Profile4_ROHC_Header_ir(&buf[len],
+ hdr.base__header().ir(), dat, cid);
+ }
+ else if (isIRDYN(buf[len]))
+ {
+ len += Get_Profile4_ROHC_Header_irdyn(&buf[len],
+ hdr.base__header().ir__dyn(),
+ dat, cid);
+ }
+ else if (isUOR2(buf[len]))
+ {
+ len += Get_Profile4_ROHC_Header_uor2(&buf[len],
+ hdr.base__header().uor__2(),
+ dat, cid, hdr.ext());
+ }
+ else if (dat->context.mode() == ROHC_mode_R)
+ {
+ if ((buf[len] & 0xC0) == 0)
+ {
+ len += Get_Profile1_ROHC_Header_r0(&buf[len],
+ hdr.base__header().r__0(),
+ dat, cid);
+ }
+ else if ((buf[len] & 0xC0) == 0x40)
+ {
+ len += Get_Profile1_ROHC_Header_r0crc(&buf[len],
+ hdr.base__header().r__0__crc(),
+ dat, cid);
+ }
+ else if ((buf[len] & 0xC0) == 0x80)
+ {
+ len += Get_Profile4_ROHC_Header_r1(&buf[len],
+ hdr.base__header().r__1(),
+ dat, cid, hdr.ext());
+ }
+ else
+ {
+ TTCN_error("Unknown compressed packet (R mode) (0x%02x)", buf[len]);
+ }
+ }
+ else if (dat->context.mode() != ROHC_mode_R) // U-O modes
+ {
+ if ((buf[len] & 0x80) == 0)
+ {
+ len += Get_Profile1_ROHC_Header_uo0(&buf[len],
+ hdr.base__header().uo__0(),
+ dat, cid);
+ }
+ else if ((buf[len] & 0xC0) == 0x80)
+ {
+ len += Get_Profile2_ROHC_Header_uo1(&buf[len],
+ hdr.base__header().uo__1(),
+ dat, cid);
+ }
+ else
+ {
+ TTCN_error("Unknown compressed packet (U-O modes) (0x%02x)", buf[len]);
+ }
+ }
+
+ if (!hdr.ext().is_bound())
+ hdr.ext() = OMIT_VALUE;
+ len += Get_IP_ID_compressed_opt(&buf[len], hdr.ip__id__outer(),
+ dat, Outer_IP);
+ len += Get_AH_data_opt(&buf[len], hdr.ah__outer(), dat, Outer_IP);
+ len += Get_GRE_cksum_opt(&buf[len], hdr.gre__cksum1(), dat, Outer_IP);
+ len += Get_IP_ID_compressed_opt(&buf[len], hdr.ip__id__inner(),
+ dat, Inner_IP);
+ len += Get_AH_data_opt(&buf[len], hdr.ah__inner(), dat, Inner_IP);
+ len += Get_GRE_cksum_opt(&buf[len], hdr.gre__cksum2(), dat, Inner_IP);
+ len += Get_Profile4_Additional_Dynamic_Chain_opt(hdr.additional__IP(),
+ &buf[len], dat);
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+} /* Get_Profile4_ROHC_Header */
+
+int
+Get_ROHC_Header(const unsigned char *p_buf,
+ int length, Header & p_header, ROHC__config & config)
+{
+ unsigned char buf[MAX_PACKET_SIZE];
+ int len = 0, cidlen = 0;
+ INTEGER cid;
+
+ Log_function_name_on_enter();
+
+ memcpy(buf, p_buf, length);
+
+ if (config.large__cid())
+ {
+ /* Skip packet type octet */
+ cidlen = Get_CID(&p_buf[1], cid, config);
+ /* Move the packet type octet right after the CID */
+ buf[cidlen] = buf[0];
+ }
+ else
+ {
+ cidlen = Get_CID(&p_buf[0], cid, config);
+ }
+ len += cidlen;
+
+ if (isIR(buf[len]) || isIRDYN(buf[len]))
+ {
+ config.context()[cid].profile() = buf[len + 1];
+ }
+
+ t_dat dat = initTDAT(config, cid);
+ initCIDcontext(&dat);
+
+ switch (config.context()[cid].profile())
+ {
+ case 0:
+ len += Get_Profile0_ROHC_Header(&buf[len], &dat,
+ length - cidlen, p_header.prof0(),
+ (int) cid);
+ break;
+ case 1:
+ len += Get_Profile1_ROHC_Header(&buf[len], &dat, length - cidlen,
+ p_header.prof1(), (int) cid);
+ break;
+ case 2:
+ len += Get_Profile2_ROHC_Header(&buf[len], length - cidlen,
+ p_header.prof2(), &dat,
+ (int) cid);
+ break;
+ case 4:
+ len += Get_Profile4_ROHC_Header(&buf[len], length - cidlen,
+ p_header.prof4(), &dat,
+ (int) cid);
+ break;
+ default:
+ break;
+ }
+
+ Log_hexdump(buf, len);
+ Log_function_name_on_leave();
+
+ return len;
+}
+
+ROHC__packet__u
+f__ROHC__dec(OCTETSTRING const &data, ROHC__config & p_config)
+{
+ ROHC__packet__u packet;
+ OPTIONAL < Padding > padding;
+ OPTIONAL < Feedback > feedback;
+ const unsigned char *buf = (const unsigned char *) data;
+ int len = 0;
+
+ Log_function_name_on_enter();
+
+ Log_object(p_config);
+
+ // Processing padding
+ Log_hexdump(buf, data.lengthof() - len);
+ len += Get_ROHC_Padding(&buf[len], data.lengthof() - len, padding, p_config);
+ // Processing feedback
+ len += Get_ROHC_Feedback(&buf[len], data.lengthof() - len, feedback, p_config);
+ // Processing ROHC header
+ if ((buf[len] & 0xFE) == 0xFE)
+ {
+ packet.segment().padding() = padding;
+ packet.segment().feedback() = feedback;
+ packet.segment().segment__header__id() = 0x7F;
+ if (ShiftDownBit(buf[len], 0))
+ {
+ packet.segment().final() = BOOLEAN(true);
+ len += 1;
+ if (data.lengthof() - len < 4)
+ {
+ packet.segment().payload() =
+ OCTETSTRING(data.lengthof() - len, &buf[len]);
+ len = data.lengthof();
+ packet.segment().crc() = OMIT_VALUE;
+ }
+ else
+ {
+ packet.segment().payload() =
+ OCTETSTRING(data.lengthof() - len - 4, &buf[len]);
+ len = data.lengthof() - 4;
+ packet.segment().crc() =
+ ((buf[len] << 24) & 0xFF000000) +
+ ((buf[len + 1] << 16) & 0xFF0000) +
+ ((buf[len + 2] << 8) & 0xFF00) + (buf[len + 3] & 0xFF);
+ }
+ }
+ else
+ {
+ packet.segment().final() = BOOLEAN(false);
+ len += 1;
+ packet.segment().payload() =
+ OCTETSTRING(data.lengthof() - len, &buf[len]);
+ packet.segment().crc() = OMIT_VALUE;
+ }
+
+ }
+ else
+ {
+ packet.rohc().padding() = padding;
+ packet.rohc().feedback() = feedback;
+ len += Get_ROHC_Header(&buf[len],
+ data.lengthof() - len, packet.rohc().header(),
+ p_config);
+ if (data.lengthof() == len)
+ {
+ packet.rohc().payload() = OMIT_VALUE;
+ }
+ else
+ {
+ packet.rohc().payload() = OCTETSTRING(data.lengthof() - len, &buf[len]);
+ }
+ }
+
+ TTCN_logger.begin_event(TTCN_DEBUG);
+ p_config.log();
+ packet.log();
+ TTCN_logger.end_event();
+
+ Log_function_name_on_leave();
+
+ return packet;
+}
+
+INTEGER
+f__ROHC__CRC(OCTETSTRING const &data, INTEGER const &crclen)
+{
+ const unsigned char *buf = (const unsigned char *) data;
+ INTEGER crcval;
+ int crclength = crclen;
+
+ Log_function_name_on_enter();
+
+ TTCN_logger.log(TTCN_DEBUG, "Calculating CRC-%d over:", crclength);
+ Log_hexdump(buf, data.lengthof());
+
+ crcval = INTEGER(ComputeCRC(&(buf[0]), data.lengthof(), crclength));
+ Log_function_name_on_leave();
+ return crcval;
+}
+
+OCTETSTRING
+f__FBCK__enc(Feedback__data const &feedback_data, ROHC__config const &config)
+{
+ unsigned char buf[MAX_PACKET_SIZE];
+ int len = 0, crcpos = 0;
+ INTEGER cid;
+
+ Log_function_name_on_enter();
+
+ cid = feedback_data.cid();
+ if (config.large__cid() == false)
+ {
+ if (cid > 0)
+ {
+ buf[len] = 0xE0 + (cid & 0x0F);
+ len += 1;
+ }
+ }
+ else
+ len += Set_SDVL_field(&buf[len], cid, 0);
+ switch (feedback_data.feedback__type().get_selection())
+ {
+ case Feedback__type::ALT_feedback1:
+ const unsigned char *tempbuf;
+ tempbuf =
+ (const unsigned char *) feedback_data.feedback__type().feedback1();
+ buf[len] = tempbuf[0];
+ len += 1;
+ break;
+ case Feedback__type::ALT_feedback2:
+ {
+ Feedback2 fback2;
+ fback2 = feedback_data.feedback__type().feedback2();
+ buf[len] = (fback2.acktype() << 6) & 0xC0;
+ buf[len] += (fback2.mode() << 4) & 0x30;
+ buf[len] += (fback2.sn() >> 8) & 0x0F;
+ len += 1;
+ buf[len] = fback2.sn() & 0xFF;
+ len += 1;
+ if (fback2.feedback__opts().ispresent())
+ {
+ Feedback__opts & fbopts = fback2.feedback__opts();
+ for (int num2 = 0; num2 < fbopts.size_of(); num2++)
+ {
+ buf[len] = (fbopts[num2].opt__type() << 4) & 0xF0;
+ buf[len] += fbopts[num2].opt__len() & 0x0F;
+ len += 1;
+ len += Set_octetstring_opt(&buf[len], fbopts[num2].opt__data());
+ if (fbopts[num2].opt__data().ispresent())
+ {
+ OCTETSTRING opt;
+ opt = fbopts[num2].opt__data();
+ if (fbopts[num2].opt__len() != opt.lengthof())
+ TTCN_logger.
+ log(TTCN_WARNING,
+ "Feedback option length mismatch: %d, %d",
+ (int) fbopts[num2].opt__len(), opt.lengthof());
+ else
+ if ((fbopts[num2].opt__len() == 1)
+ && (fbopts[num2].opt__type() == 1) && (buf[len - 1] == 0))
+ crcpos = len - 1;
+ }
+ }
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ if ((crcpos > 0) && (buf[crcpos] == 0))
+ buf[crcpos] = ComputeCRC(&(buf[0]), len, 8);
+
+ Log_function_name_on_leave();
+
+ return OCTETSTRING(len, &(buf[0]));
+}
+
+Feedback__data
+f__FBCK__dec(OCTETSTRING const &data, ROHC__config const &config)
+{
+ Feedback__data feedback_data;
+ const unsigned char *buf;
+ unsigned char ctemp;
+ int len = 0, fbsize, cidlen = 0;
+ buf = (const unsigned char *) data;
+ fbsize = data.lengthof();
+
+ Log_function_name_on_enter();
+
+ if (config.large__cid() == false)
+ {
+ if ((buf[len] & 0xF0) == 0xE0)
+ {
+ feedback_data.cid() = buf[len] & 0x0F;
+ len += 1;
+ fbsize -= 1;
+ }
+ else
+ feedback_data.cid() = 0;
+ }
+ else
+ {
+ cidlen = Get_SDVL_field(&buf[len], feedback_data.cid());
+ len += cidlen;
+ fbsize -= cidlen;
+ }
+
+ if (fbsize == 1)
+ {
+ feedback_data.feedback__type().feedback1() = OCTETSTRING(1, &buf[len]);
+ len += 1;
+ }
+ else if (fbsize >= 1)
+ {
+ int optnum;
+ Feedback__opts fbopts;
+ Feedback2 feedback2;
+ feedback2.acktype() = (buf[len] >> 6) & 0x03;
+ feedback2.mode() = (buf[len] >> 4) & 0x03;
+ ctemp = buf[len] & 0x0F;
+ len += 1;
+ fbsize -= 1;
+ feedback2.sn() = ((ctemp << 8) & 0x0F00) + buf[len];
+ len += 1;
+ fbsize -= 1;
+ optnum = 0;
+ feedback2.feedback__opts() = OMIT_VALUE;
+ while (fbsize)
+ {
+ fbopts[optnum].opt__type() = (buf[len] >> 4) & 0x0F;
+ fbopts[optnum].opt__len() = buf[len] & 0x0F;
+ len += 1;
+ fbsize -= 1;
+ if (fbopts[optnum].opt__len())
+ {
+ len += Get_octetstring(&buf[len], fbopts[optnum].opt__data(),
+ fbopts[optnum].opt__len());
+ fbsize -= fbopts[optnum].opt__len();
+ }
+ else
+ fbopts[optnum].opt__data() = OMIT_VALUE;
+ feedback2.feedback__opts() = fbopts;
+ optnum += 1;
+ }
+
+ feedback_data.feedback__type().feedback2() = feedback2;
+ }
+ else
+ TTCN_logger.log(TTCN_WARNING, "Size mismatch in feedback(%d)", fbsize);
+
+ Log_function_name_on_leave();
+
+ return feedback_data;
+}
+
+}//namespace
diff --git a/ROHC_CNL113426_LATEST/src/ROHC_Types.ttcn b/ROHC_CNL113426_LATEST/src/ROHC_Types.ttcn new file mode 100644 index 00000000..5ca513ee --- /dev/null +++ b/ROHC_CNL113426_LATEST/src/ROHC_Types.ttcn @@ -0,0 +1,1079 @@ +/////////////////////////////////////////////////////////////////////////////// +// // +// Copyright Test Competence Center(TCC) ETH 2003 // +// // +// 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) has been supplied. // +// // +/////////////////////////////////////////////////////////////////////////////// +// +// File: ROHC_Types.ttcn +// Description: ROHC +// Rev: R3A01 +// Prodnr: CNL 113 426 +// Updated: 2006.04.13 +// Contact: http://ttcn.ericsson.se +// + +/* Based on RFC 3095, July 2001 */ + +/* TODO: improvements:: +- Profile4_Dynamic_Chain_u should not contain the sn field + +ethesi */ + +module ROHC_Types +{ +import from General_Types all; + +external function f_ROHC_enc(in ROHC_packet_u pdu, in ROHC_config p_config) +return octetstring; +external function f_ROHC_dec(in octetstring data, inout ROHC_config p_config) +return ROHC_packet_u; +external function f_ROHC_CRC(in octetstring data, in integer crclen) +return integer; +external function f_FBCK_enc(in Feedback_data pdu, in ROHC_config p_config) +return octetstring; +external function f_FBCK_dec(in octetstring data, in ROHC_config p_config) +return Feedback_data; + +/* Constants for ROHC mode field values including mode cancellation */ +const integer cg_ROHC_mode_C := 0; +const integer cg_ROHC_mode_U := 1; +const integer cg_ROHC_mode_O := 2; +const integer cg_ROHC_mode_R := 3; + +/* Constants for ROHC feedback type */ +const integer cg_ROHC_fbck_type_ACK := 0; +const integer cg_ROHC_fbck_type_NACK := 1; +const integer cg_ROHC_fbck_type_SNACK := 2; +const integer cg_ROHC_fbck_type_reserved := 3; + +type bitstring ROHC_BIT7_BO_LAST length (7) with {variant "BYTEORDER(last)"}; + +type enumerated Packet_type { R_0(0), R_0_CRC(1), UO_0(2), R_1(3), R_1_ID(4), + R_1_TS(5), UO_1(6), UO_1_ID(7), UO_1_TS(8), UOR_2(9), UOR_2_ID(10), + UOR_2_TS(11), IR(12), IR_DYN(13), NOPKT(14) }; + +/* ==================== ROHC configuration and context ==================== */ + + type record IP_context { + /* Version of this IP level. MSB bit may be set (Profile 4 only). */ + integer version, + /* RND bit of this IP level (RND or RND2) */ + boolean rnd_bit, + /* Whether AH is present in the IPX index list */ + boolean ah_present, + /* Whether GRE is present in the IPX index list */ + boolean gre_present, + /* Whether ESP is present in the IPX index list */ + boolean esp_present, + /* Length of the compressed AH data field after the base header */ + integer ah_data_len, + /* Whether GRE header has GRE checksum or not */ + boolean gre_cksum_present + }; + + type record UDP_context { + boolean udp_cksum + }; + + type record of IP_context IP_contexts; + + type record ROHC_context { + integer mode, + integer profile, + /* The decoded packet type */ + Packet_type pkt, + IP_contexts ip_ctx, + UDP_context udp_ctx + }; + + type record of integer int_array; + + type record of ROHC_context ROHC_context_rof; + + type record ROHC_config { + boolean large_cid, + int_array rtp_ports, + ROHC_context_rof context + }; + + type port ROHC_ASP_SP_PT message + { + inout ROHC_packet_u; + inout octetstring; + } with { extension "internal" } + + + /* ROHC Configuration port */ + type record ROHC_ROHCCFG_REQ_setconfig + { + ROHC_config config + } + + type enumerated ROHC_ROHCCFG_REQ_operation { rohccfg_getconfig } + + type union ROHC_ROHCCFG_REQ + { + ROHC_ROHCCFG_REQ_operation simpleop, + ROHC_ROHCCFG_REQ_setconfig setconfig + } + + type enumerated ROHC_ROHCCFG_RSP_operation { rohccfg_ok } + + type record ROHC_ROHCCFG_RSP_config + { + ROHC_config config + } + + type union ROHC_ROHCCFG_RSP + { + ROHC_ROHCCFG_RSP_operation simpleop, + ROHC_ROHCCFG_RSP_config config + } + + type port ROHC_PORTCFG_PT message + { + inout ROHC_config; + inout charstring; + inout ROHC_ROHCCFG_REQ; + inout ROHC_ROHCCFG_RSP; + } with { extension "internal" } + + type union ROHC_packet_u + { + ROHC_packet rohc, + Segment_packet segment + } + + type record ROHC_packet /* p.42 */ + { + Padding padding optional, + Feedback feedback optional, + Header header, + Payload payload optional + }; + +/* TODO CHECK: why this is needed ? +type record Reconstructed_unit +{ + octetstring reconstructed_packet, + OCT4 CRC +}; */ + + type record Segment_packet /* p.50 */ + { + Padding padding optional, + Feedback feedback optional, + INT7b segment_header_id, /* Must be 127 (0x7F) */ + boolean final, + Payload payload optional, + integer crc optional + }; + + type octetstring Padding; /* Must be a serie of 0xE0 */ + type octetstring Payload; + + type OCT1n Feedback1; /* p.91 */ + + type record Feedback_opts_u /* p.91 */ + { + INT4b opt_type, + INT4b opt_len, + octetstring opt_data optional + }; + + type record of Feedback_opts_u Feedback_opts; /* p.91 */ + + type record Feedback2 /* p.91 */ + { + INT2b acktype, + INT2b mode, + INT12b_BO_LAST sn, + Feedback_opts feedback_opts optional + }; + + type union Feedback_type /* p.46 */ + { + Feedback1 feedback1, + Feedback2 feedback2 + }; + + type record Feedback_data /* p.46 */ + { + INT14b_BO_LAST cid, + Feedback_type feedback_type + }; + + type record Feedback_u /* p.45 */ + { + BIT5 feedback_type, /* Must be '11110'B */ + INT3b code, + LIN1 size optional, + /* TODO: size could be 0, so feedback_data should be optional; + although it's a weird case, but still possible */ + Feedback_data feedback_data + }; + + type record of Feedback_u Feedback; /* p.42 */ + + type union Header /* p.77 */ + { + Profile0_headers prof0, + Profile1_headers prof1, + Profile2_headers prof2, + Profile4_headers prof4 + }; + + //Profile0 + + type union Profile0_headers + { + Profile0_IR_packet ir, + Profile0_normal_packet normal + }; + + type record Profile0_IR_packet /* p.127 */ + { + INT14b_BO_LAST cid, + BIT7 type_ind, /* Must be '1111110'B */ + BIT1 d, /* Must be 0 */ + LIN1 profile, /* Must be 0 */ + LIN1 crc, + octetstring orig_packet + }; + + type record Profile0_normal_packet /* p.128 */ + { + INT14b_BO_LAST cid, + octetstring orig_packet + }; + + //Profile1 + + type record Profile1_headers /* p.77 */ + { + Profile1_base_header base_header, + Profile1_Extension ext optional, + LIN2_BO_LAST ip_id_outer optional, + octetstring ah_outer optional, + LIN2_BO_LAST gre_cksum1 optional, + LIN2_BO_LAST ip_id_inner optional, + octetstring ah_inner optional, + LIN2_BO_LAST gre_cksum2 optional, + LIN2_BO_LAST udp_cksum optional + }; + + type union Profile1_base_header + { + Profile1_IR_header ir, + Profile1_IR_DYN_header ir_dyn, + Profile1_R_0_header r_0, + Profile1_R_0_CRC_header r_0_crc, + Profile1_UO_0_header uo_0, + Profile1_R_1_header r_1, + Profile1_R_1_ID_header r_1_id, + Profile1_R_1_TS_header r_1_ts, + Profile1_UO_1_header uo_1, + Profile1_UO_1_ID_header uo_1_id, + Profile1_UO_1_TS_header uo_1_ts, + Profile1_UOR_2_header uor_2, + Profile1_UOR_2_ID_header uor_2_id, + Profile1_UOR_2_TS_header uor_2_ts + }; + + type union Static_Chain_u /* p.91 */ + { + IPv4_Static ipv4_stat, + IPv6_Static ipv6_stat, + UDP_Static udp_stat, + RTP_Static rtp_stat, + ESP_Static esp_stat + }; + + type union Dynamic_Chain_u /* p.91 */ + { + IPv4_Dynamic ipv4_dyn, + IPv6_Dynamic ipv6_dyn, + UDP_Dynamic udp_dyn, + RTP_Dynamic rtp_dyn, + ESP_Dynamic esp_dyn + }; + + type record of Static_Chain_u Static_Chain; /* p.91 */ + + type record of Dynamic_Chain_u Dynamic_Chain; /* p.91 */ + + type record Profile1_IR_header /* p.45 */ /* p.91 */ + { + INT14b_BO_LAST cid, + BIT7 type_ind, /* Must be '1111110'B */ + BIT1 d, + LIN1 profile, /* Must be 1 */ + LIN1 crc, + Static_Chain stat_chain, + Dynamic_Chain dyn_chain optional + }; + + type record Profile1_IR_DYN_header /* p.46 */ /* p.92 */ + { + INT14b_BO_LAST cid, + BIT8 type_ind, /* Must be '11111000'B */ + LIN1 profile, /* Must be 1 */ + LIN1 crc, + Dynamic_Chain dyn_chain + }; + + type record Profile1_R_0_header /* p.74 */ + { + INT14b_BO_LAST cid, + BIT2 type_ind, /* Must be '00'B */ + INT6b sn + }; + + type record Profile1_R_0_CRC_header /* p.74 */ + { + INT14b_BO_LAST cid, + BIT2 type_ind, /* Must be '01'B */ + INT7b sn, + INT7b crc + }; + + type record Profile1_UO_0_header /* p.75 */ + { + INT14b_BO_LAST cid, + BIT1 type_ind, /* Must be '0'B */ + INT4b sn, + INT3b crc + }; + + type record Profile1_R_1_header /* p.75 */ + { + INT14b_BO_LAST cid, + BIT2 type_ind, /* Must be '10'B */ + INT6b sn, + BIT1 m_bit, + BIT1 x_bit, + INT6b ts + }; + + type record Profile1_R_1_ID_header /* p.75 */ + { + INT14b_BO_LAST cid, + BIT2 type_ind, /* Must be '10'B */ + INT6b sn, + BIT1 m_bit, + BIT1 x_bit, + BIT1 t_bit, /* Must be '0'B */ + INT5b ip_id + }; + + type record Profile1_R_1_TS_header /* p.75 */ + { + INT14b_BO_LAST cid, + BIT2 type_ind, /* Must be '10'B */ + INT6b sn, + BIT1 m_bit, + BIT1 x_bit, + BIT1 t_bit, /* Must be '1'B */ + INT5b ts + }; + + type record Profile1_UO_1_header /* p.76 */ + { + INT14b_BO_LAST cid, + BIT2 type_ind, /* Must be '10'B */ + INT6b ts, + BIT1 m_bit, + INT4b sn, + INT3b crc + }; + + type record Profile1_UO_1_ID_header /* p.76 */ + { + INT14b_BO_LAST cid, + BIT2 type_ind, /* Must be '10'B */ + BIT1 t_bit, /* Must be '0'B */ + INT5b ip_id, + BIT1 x_bit, + INT4b sn, + INT3b crc + }; + + type record Profile1_UO_1_TS_header /* p.76 */ + { + INT14b_BO_LAST cid, + BIT2 type_ind, /* Must be '10'B */ + BIT1 t_bit, /* Must be '1'B */ + INT5b ts, + BIT1 m_bit, + INT4b sn, + INT3b crc + }; + + type record Profile1_UOR_2_header /* p.77 */ + { + INT14b_BO_LAST cid, + BIT3 type_ind, /* Must be '110'B */ + INT6b ts, + BIT1 m_bit, + INT6b sn, + BIT1 x_bit, + INT7b crc + }; + + type record Profile1_UOR_2_ID_header /* p.77 */ + { + INT14b_BO_LAST cid, + BIT3 type_ind, /* Must be '110'B */ + INT5b ip_id, + BIT1 t_bit, /* Must be '0'B */ + BIT1 m_bit, + INT6b sn, + BIT1 x_bit, + INT7b crc + }; + + type record Profile1_UOR_2_TS_header /* p.77 */ + { + INT14b_BO_LAST cid, + BIT3 type_ind, /* Must be '110'B */ + INT5b ts, + BIT1 t_bit, /* Must be '1'B */ + BIT1 m_bit, + INT6b sn, + BIT1 x_bit, + INT7b crc + }; + + type record Short_Seqnum /* p.120 */ + { + BIT1 ind, /* Must be '0'B */ + INT7b lsb_of_seqnum + }; + + type record Long_Seqnum /* p.120 */ + { + BIT1 ind, /* Must be '1'B */ + INT31b_BO_LAST lsb_of_seqnum + }; + + type union AEGSeqnum /* p.112 */ + { + Short_Seqnum short_form, + Long_Seqnum long_form + }; + + type record XI_Item4_r /* p.121 */ + { + BIT1 x_ind, + INT3b index + }; + + type record XI_Item8_r /* p.121 */ + { + BIT1 x_ind, + INT7b index + }; + + type record of XI_Item4_r XI_Item4; + + type record of XI_Item8_r XI_Item8; + + type union XI_list /* p.113 */ + { + XI_Item4 xi_item4, + XI_Item8 xi_item8 + }; + + type record IPv6_ext_item + { + LIN1 nexthead, + LIN1 hdr_ext_len, + octetstring data + } + + type record MINE_item { + LIN1 protocol, + BIT1 s_bit, + ROHC_BIT7_BO_LAST reserved, + LIN2_BO_LAST cksum, + OCT4 dstaddr, + OCT4 srcaddr optional + } with { + variant "FIELDORDER(msb)"; + variant (srcaddr) "PRESENCE(s_bit = '1'B)"; + } + +/* TODO: check why better use INTn intead of OCTn */ + type record AH_item /* RFC 2402, p.3 */ + { + LIN1 nexthead, /* Must be 51 */ + LIN1 payload_len, + LIN2_BO_LAST reserved, /* Must be 0 */ + LIN4_BO_LAST spi, + LIN4_BO_LAST sn, + octetstring auth_data optional + } + + type record ESP_item + { + LIN1 nexthead, /* Must be 50 */ + LIN4_BO_LAST spi, + LIN4_BO_LAST sn + } + + type record GRE_item + { + LIN1 nexthead, /* Must be 47 */ + BIT1 C_bit, + BIT1 reserved_1, /* Must be '0'B */ + BIT1 K_bit, + BIT1 S_bit, + BIT1 reserved_2, /* Must be '0'B */ + BIT3 version, + LIN2_BO_LAST cksum optional, + LIN4_BO_LAST key optional, + LIN4_BO_LAST sn optional + } + + type union Item + { + IPv6_ext_item ipv6_ext_item, + AH_item ah_item, + ESP_item esp_item, + GRE_item gre_item, + MINE_item mine_item +/* TODO CHECK: could we use it ? + octetstring any_item */ + } + + type record of Item IP_Item_list; + + type record of OCT4n CSRC_Item_list; + + /* TODO: temporary solution for profile4 tests */ + type record of octetstring RAW_data; + + type union Item_list + { + CSRC_Item_list csrc_item_list, + IP_Item_list ip_item_list, + /* TODO: temporary solution for profile4 tests */ + RAW_data raw_data + } + + type record Enc_Type_0 /* p.112 */ + { + BIT2 et, /* Must be '00'B */ + BIT1 gp_bit, + BIT1 ps_bit, + INT4b cc, + LIN1 gen_id optional, + XI_list xi_list optional, + BIT4 padding optional, /* Must be '0000'B */ + Item_list item_list optional + }; + + type record Enc_Type_1 /* p.114 */ + { + BIT2 et, /* Must be '01'B */ + BIT1 gp_bit, + BIT1 ps_bit, + INT4b xi1, + LIN1 gen_id optional, + LIN1 ref_id, + octetstring insbitmask, + XI_list xi_list optional, + BIT4 padding optional, /* Must be '0000'B */ + Item_list item_list optional + }; + + type record Enc_Type_2 /* p.115 */ + { + BIT2 et, /* Must be '10'B */ + BIT1 gp_bit, + BIT1 res, + INT4b count, + LIN1 gen_id optional, + LIN1 ref_id, + octetstring rembitmask + }; + + type record Enc_Type_3 /* p.115 */ + { + BIT2 et, /* Must be '11'B */ + BIT1 gp_bit, + BIT1 ps_bit, + INT4b xi1, + LIN1 gen_id optional, + LIN1 ref_id, + octetstring rembitmask, + octetstring insbitmask, + XI_list xi_list optional, + BIT4 padding optional, /* Must be '0000'B */ + Item_list item_list optional + }; + + type record IPv4_Static /* p.94 */ + { + INT4b version, /* Must be '0100'B */ + INT4b reserved, /* Must be '0000'B */ + LIN1 proto, + OCT4 srcaddr, + OCT4 dstaddr + }; + + type record IPv4_Dynamic /* p.94 */ + { + LIN1 tos, + LIN1 ttl, + LIN2_BO_LAST identification, + BIT1 df_bit, + BIT1 rnd_bit, + BIT1 nbo_bit, + BIT5 reserved, /* Must be '00000'B */ + Enc_Type_0 genextheadlist + }; + + type record IPv6_Static /* p.93 */ + { + INT4b version, /* Must be '0110'B */ + INT20b_BO_LAST flowlabel, + LIN1 nexthead, + OCT16 srcaddr, + OCT16 dstaddr + }; + + type record IPv6_Dynamic /* p.93 */ + { + LIN1 trafficclass, + LIN1 hoplimit, + Enc_Type_0 genextheadlist + }; + + type record UDP_Static /* p.95 */ + { + LIN2_BO_LAST srcport, + LIN2_BO_LAST dstport + }; + + type record UDP_Dynamic /* p.95 */ + { + LIN2_BO_LAST cksum + }; + + type record RTP_Static /* p.96 */ + { + OCT4 ssrc + }; + + type record Rx_Field /* p.96 */ + { + BIT3 reserved, /* Must be '000'B */ + BIT1 xbit, + INT2b mode, + BIT1 tisbit, + BIT1 tssbit + }; + + type record RTP_Dynamic /* p.96 */ + { + INT2b vfield, /* Must be '10'B */ + BIT1 pbit, + BIT1 rxbit, + INT4b ccfield, + BIT1 mbit, + INT7b ptfield, + LIN2_BO_LAST rtpseqnum, + LIN4_BO_LAST rtpts, + Enc_Type_0 gencsrclist, + Rx_Field rx_field optional, + integer ts_stride optional, + integer time_stride optional + }; + + type record ESP_Static /* p.97 */ + { + LIN4_BO_LAST spi + }; + + type record ESP_Dynamic /* p.97 */ + { + LIN4_BO_LAST seqnum + }; + + type union Compr_head_list /* p.112 */ + { + Enc_Type_0 enctype0, + Enc_Type_1 enctype1, + Enc_Type_2 enctype2, + Enc_Type_3 enctype3 + }; + + type record IP_Ext_heads /* p.111 */ + { + BIT1 cl, + BIT1 aseq, + BIT1 eseq, + BIT1 gseq, + BIT4 res, + AEGSeqnum ah_seq optional, + AEGSeqnum esp_seq optional, + AEGSeqnum gre_seq optional, + Compr_head_list compr_head_list optional + }; + + type record Outer_IP_fields /* p.82 */ + { + LIN1 tos optional, + LIN1 ttl optional, + LIN1 proto optional, + IP_Ext_heads ext_heads optional, + LIN2_BO_LAST ip_id optional + }; + + type record Outer_IP_flags /* p.81 */ + { + BIT1 tos2, + BIT1 ttl2, + BIT1 df2, + BIT1 pr2, + BIT1 ipx2, + BIT1 nbo2, + BIT1 rnd2, + BIT1 i2_bit + }; + + type record Inner_IP_fields /* p.81 */ + { + LIN1 tos optional, + LIN1 ttl optional, + LIN1 proto optional, + IP_Ext_heads ext_heads optional + }; + + type record Inner_IP_flags /* p.80 */ + { + BIT1 tos, + BIT1 ttl, + BIT1 df, + BIT1 pr, + BIT1 ipx, + BIT1 nbo, + BIT1 rnd_bit, + BIT1 ip2_bit + }; + + type record RTP_flags + { + BIT1 r_p, + INT7b rtp_pt + } + + type record RTP_flags_fields /* p.82 */ + { + INT2b mode, + BIT1 r_pt, + BIT1 m_bit, + BIT1 r_x, + BIT1 csrc, + BIT1 tss, + BIT1 tis, + RTP_flags flags optional, + Compr_head_list csrc_list optional, + integer ts_stride optional, + integer time_stride optional + } + + type record Extension0 /* p.79 */ + { + BIT2 ext_type, /* Must be '00'B */ + INT3b sn, + INT3b plust + } + + type record Extension1 /* p.79 */ + { + BIT2 ext_type, /* Must be '01'B */ + INT3b sn, + INT3b plust, + LIN1 minust + }; + + type record Extension2 /* p.79 */ + { + BIT2 ext_type, /* Must be '10'B */ + INT3b sn, + INT11b_BO_LAST plust, + LIN1 minust + }; + + type record Extension3 /* p.79 */ + { + BIT2 ext_type, /* Must be '11'B */ + BIT1 s_bit, + BIT1 r_ts_bit, + BIT1 tsc_bit, + BIT1 i_bit, + BIT1 ip_bit, + BIT1 rtp_bit, + Inner_IP_flags inner_ip_flags optional, + Outer_IP_flags outer_ip_flags optional, + LIN1 sn optional, + integer ts optional, + /* This field contains the length of the SDVL encoded TS value counted in + octets. */ + integer ts_length optional, + Inner_IP_fields inner_ip_hdr optional, + LIN2_BO_LAST ip_id optional, + Outer_IP_fields outer_ip_hdr optional, + RTP_flags_fields rtp_fl_fi optional + }; + + type union Profile1_Extension /* p.79 */ + { + Extension0 ext0, + Extension1 ext1, + Extension2 ext2, + Extension3 ext3 + }; + + //Profile2 + + type record Profile2_headers /* p.77 */ + { + Profile2_base_header base_header, + Profile2_Extension ext optional, + LIN2_BO_LAST ip_id_outer optional, + octetstring ah_outer optional, + LIN2_BO_LAST gre_cksum1 optional, + LIN2_BO_LAST ip_id_inner optional, + octetstring ah_inner optional, + LIN2_BO_LAST gre_cksum2 optional, + LIN2_BO_LAST udp_cksum optional + }; + + type union Profile2_base_header + { + Profile2_IR_header ir, + Profile2_IR_DYN_header ir_dyn, + Profile1_R_0_header r_0, + Profile1_R_0_CRC_header r_0_crc, + Profile1_UO_0_header uo_0, + Profile2_R_1_header r_1, + Profile2_UO_1_header uo_1, + Profile2_UOR_2_header uor_2 + }; + + type union Profile2_Static_Chain_u + { + IPv4_Static ipv4_stat, + IPv6_Static ipv6_stat, + UDP_Static udp_stat + }; + + type record Profile2_UDP_Dynamic + { + LIN2_BO_LAST cksum, + LIN2_BO_LAST udp_sn + }; + + type union Profile2_Dynamic_Chain_u + { + IPv4_Dynamic ipv4_dyn, + IPv6_Dynamic ipv6_dyn, + Profile2_UDP_Dynamic udp_dyn + }; + + type record of Profile2_Static_Chain_u Profile2_Static_Chain; + + type record of Profile2_Dynamic_Chain_u Profile2_Dynamic_Chain; + + type record Profile2_IR_header + { + INT14b_BO_LAST cid, + BIT7 type_ind, /* Must be '1111110'B */ + BIT1 d, + LIN1 profile, /* Must be 2 */ + LIN1 crc, + Profile2_Static_Chain stat_chain, + Profile2_Dynamic_Chain dyn_chain optional + }; + + type record Profile2_IR_DYN_header /* p.46 */ /* p.92 */ + { + INT14b_BO_LAST cid, + BIT8 type_ind, /* Must be '11111000'B */ + LIN1 profile, /* Must be 2 */ + LIN1 crc, + Profile2_Dynamic_Chain dyn_chain + }; + + type record Profile2_R_1_header + { + INT14b_BO_LAST cid, + BIT2 type_ind, /* Must be '10'B */ + INT6b sn, + BIT1 x_bit, + INT7b ip_id + }; + + type record Profile2_UO_1_header + { + INT14b_BO_LAST cid, + BIT2 type_ind, /* Must be '10'B */ + INT6b ip_id, + INT5b sn, + INT3b crc + }; + + type record Profile2_UOR_2_header + { + INT14b_BO_LAST cid, + BIT3 type_ind, /* Must be '110'B */ + INT5b sn, + BIT1 x_bit, + INT7b crc + }; + + type record Profile2_Inner_IP_flags + { + BIT1 tos, + BIT1 ttl, + BIT1 df, + BIT1 pr, + BIT1 ipx, + BIT1 nbo, + BIT1 rnd_bit, + BIT1 reserved /* Must be '0'B */ + }; + + type union Profile2_Extension + { + Profile2_Extension0 ext0, + Profile2_Extension1 ext1, + Profile2_Extension2 ext2, + Profile2_Extension3 ext3 + }; + + type record Profile2_Extension0 + { + BIT2 ext_type, /* Must be '00'B */ + INT3b sn, + INT3b ip_id + } + + type record Profile2_Extension1 + { + BIT2 ext_type, /* Must be '01'B */ + INT3b sn, + INT11b_BO_LAST ip_id + }; + + type record Profile2_Extension2 + { + BIT2 ext_type, /* Must be '10'B */ + INT3b sn, + INT11b_BO_LAST ip_id2, + LIN1 ip_id + }; + + type record Profile2_Extension3 + { + BIT2 ext_type, /* Must be '11'B */ + BIT1 s_bit, + INT2b mode, + BIT1 i_bit, + BIT1 ip_bit, + BIT1 ip2_bit, + Profile2_Inner_IP_flags inner_ip_flags optional, + Outer_IP_flags outer_ip_flags optional, + LIN1 sn optional, + Inner_IP_fields inner_ip_hdr optional, + LIN2_BO_LAST ip_id optional, + Outer_IP_fields outer_ip_hdr optional + }; + + //Profile4 + + type record Profile4_headers + { + Profile4_base_header base_header, + Profile2_Extension ext optional, + LIN2_BO_LAST ip_id_outer optional, + octetstring ah_outer optional, + LIN2_BO_LAST gre_cksum1 optional, + LIN2_BO_LAST ip_id_inner optional, + octetstring ah_inner optional, + LIN2_BO_LAST gre_cksum2 optional, + Profile4_Dynamic_Chain additional_IP optional + }; + + type union Profile4_base_header + { + Profile4_IR_header ir, + Profile4_IR_DYN_header ir_dyn, + Profile1_R_0_header r_0, + Profile1_R_0_CRC_header r_0_crc, + Profile1_UO_0_header uo_0, + Profile2_R_1_header r_1, + Profile2_UO_1_header uo_1, + Profile2_UOR_2_header uor_2 + }; + + type union Profile4_Static_Chain_u + { + IPv4_Static ipv4_stat, + IPv6_Static ipv6_stat + }; + + type record Profile4_IPv4_Dynamic + { + LIN1 tos, + LIN1 ttl, + LIN2_BO_LAST identification, + BIT1 df_bit, + BIT1 rnd_bit, + BIT1 nbo_bit, + BIT1 sid_bit, + BIT4 reserved, /* Must be '0000'B */ + Enc_Type_0 genextheadlist + }; + + type union Profile4_Dynamic_Chain_u + { + Profile4_IPv4_Dynamic ipv4_dyn, + IPv6_Dynamic ipv6_dyn, + LIN2_BO_LAST sn + }; + + type record of Profile4_Static_Chain_u Profile4_Static_Chain; + + type record of Profile4_Dynamic_Chain_u Profile4_Dynamic_Chain; + + type record Profile4_IR_header + { + INT14b_BO_LAST cid, + BIT7 type_ind, /* Must be '1111110'B */ + BIT1 d, + LIN1 profile, /* Must be 4 */ + LIN1 crc, + Profile4_Static_Chain stat_chain, + Profile4_Dynamic_Chain dyn_chain optional + }; + + type record Profile4_IR_DYN_header + { + INT14b_BO_LAST cid, + BIT8 type_ind, /* Must be '11111000'B */ + LIN1 profile, /* Must be 4 */ + LIN1 crc, + Profile4_Dynamic_Chain dyn_chain + }; + +} with { encode "RAW" } + diff --git a/SNDCP_v7.0.0_CNL113576_LATEST/doc/SNDCP_v7.0.0_CNL113576_FS.pdf b/SNDCP_v7.0.0_CNL113576_LATEST/doc/SNDCP_v7.0.0_CNL113576_FS.pdf Binary files differnew file mode 100644 index 00000000..5c4a49cb --- /dev/null +++ b/SNDCP_v7.0.0_CNL113576_LATEST/doc/SNDCP_v7.0.0_CNL113576_FS.pdf diff --git a/SNDCP_v7.0.0_CNL113576_LATEST/doc/SNDCP_v7.0.0_CNL113576_PRI.pdf b/SNDCP_v7.0.0_CNL113576_LATEST/doc/SNDCP_v7.0.0_CNL113576_PRI.pdf Binary files differnew file mode 100644 index 00000000..677e4517 --- /dev/null +++ b/SNDCP_v7.0.0_CNL113576_LATEST/doc/SNDCP_v7.0.0_CNL113576_PRI.pdf diff --git a/SNDCP_v7.0.0_CNL113576_LATEST/doc/SNDCP_v7.0.0_CNL113576_UG.pdf b/SNDCP_v7.0.0_CNL113576_LATEST/doc/SNDCP_v7.0.0_CNL113576_UG.pdf Binary files differnew file mode 100644 index 00000000..4b94413e --- /dev/null +++ b/SNDCP_v7.0.0_CNL113576_LATEST/doc/SNDCP_v7.0.0_CNL113576_UG.pdf diff --git a/SNDCP_v7.0.0_CNL113576_LATEST/src/SNDCP_Types.ttcn b/SNDCP_v7.0.0_CNL113576_LATEST/src/SNDCP_Types.ttcn new file mode 100644 index 00000000..e2cebf30 --- /dev/null +++ b/SNDCP_v7.0.0_CNL113576_LATEST/src/SNDCP_Types.ttcn @@ -0,0 +1,96 @@ +/* +/////////////////////////////////////////////////////////////////////////////// +// // +// Copyright Test Competence Center (TCC) ETH 2008 // +// // +// 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) has been supplied. // +// // +/////////////////////////////////////////////////////////////////////////////// +// +// File: SNDCP_Types.ttcn +// Rev: R1A01 +// Prodnr: CNL 113 576 +// Updated: 2008-01-21 +// Contact: http://ttcn.ericsson.se +// Reference: 3GPP TS 44.065 7.0.0 +*/ +module SNDCP_Types +{ + +// This module contains the Subnetwork Dependent Convergence Protocol +// 44.065 v7.0.0 with attributes for RAW encoding/decoding. + +// According to 3GPP 04.64 - the maximum(!) length of the PDU_SN_UNITDATA and PDU_SN_DATA +// is minimum 140 and maximum 520 octets. +// The actual length of the PDU_SN_UNITDATA and PDU_SN_DATA is given in LLC ASPs or set to a parameter value. +// The possible maximum length of dataSegmentSnUnitdataPdu or dataSegmentSnDataPdu is therefore variable and +// will depend on this setting. +// The RAW decoder should have no problem decoding these fields when they are simply defined as octetstrings +// and stand at the end of the SNDPC PDUs. +// + +// + +import from General_Types all; + +external function enc_PDU_SN(in PDU_SN pdu ) return octetstring +with { extension "prototype(convert)" + extension "encode(RAW)" + } + +external function dec_PDU_SN(in octetstring stream) return PDU_SN +with { extension "prototype(convert)" + extension "decode(RAW)" + } + +type union PDU_SN +{ +PDU_SN_UNITDATA pDU_SN_UNITDATA, +PDU_SN_DATA pDU_SN_DATA +} with { variant "TAG ( + pDU_SN_UNITDATA, snPduType ='1'B; + pDU_SN_DATA, snPduType ='0'B + )" +}; + + +type record PDU_SN_UNITDATA +{ + BIT4 nsapi, + BIT1 moreBit, + BIT1 snPduType, + BIT1 firstSegmentIndicator, + BIT1 spareBit, // set to '0'B + BIT4 pcomp optional, + BIT4 dcomp optional, + BIT4 npduNumber, + BIT4 segmentNumber, + OCT1 npduNumberContinued, + octetstring dataSegmentSnUnitdataPdu +} with { variant (pcomp) "PRESENCE(firstSegmentIndicator = '1'B)"; + variant (dcomp) "PRESENCE(firstSegmentIndicator = '1'B)" + }; + + +type record PDU_SN_DATA +{ + BIT4 nsapi, + BIT1 moreBit, + BIT1 snPduType, + BIT1 firstSegmentIndicator, + BIT1 spareBit, // set to '0'B + BIT4 pcomp optional, + BIT4 dcomp optional, + OCT1 npduNumberAck optional, + octetstring dataSegmentSnDataPdu + +} with { variant (pcomp) "PRESENCE(firstSegmentIndicator = '1'B)"; + variant (dcomp) "PRESENCE(firstSegmentIndicator = '1'B)"; + variant (npduNumberAck) "PRESENCE(firstSegmentIndicator = '1'B)" + }; + + +}with{ encode "RAW"} // end of module |