pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/41118?usp=email )

 (

2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted 
one.
 )Change subject: Introduce TCAP asn enc/dec
......................................................................

Introduce TCAP asn enc/dec

ASN.1 files obtained from libosmo-asn1-tcap.git
a92fd1a6206832b626aa2a5c841b890ca37e4bd0.

Related: SYS#5423
Change-Id: Iae7f92cde02e5da966966bc95f9b74feec51958d
---
A library/tcap/TCAPMessages.asn
A library/tcap/TCAP_CodecPort.ttcn
A library/tcap/TCAP_DialoguePDUs.asn
A library/tcap/TCAP_EncDec.cc
A library/tcap/TCAP_Types.ttcn
A library/tcap/TCAP_UnidialoguePDUs.asn
A library/tcap/regen_makefile.sh
7 files changed, 789 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  osmith: Looks good to me, but someone else must approve
  fixeria: Looks good to me, approved
  daniel: Looks good to me, but someone else must approve




diff --git a/library/tcap/TCAPMessages.asn b/library/tcap/TCAPMessages.asn
new file mode 100644
index 0000000..84a3532
--- /dev/null
+++ b/library/tcap/TCAPMessages.asn
@@ -0,0 +1,247 @@
+-- $Id: tcap.asn 26192 2008-09-14 14:42:39Z etxrab $
+TCAPMessages {itu-t recommendation q 773 modules(2) messages(1) version3(3)}
+
+DEFINITIONS  ::=
+
+BEGIN
+
+--EXPORTS                   OPERATION, ERROR, Component, InvokeId Type;
+-- WS stuff
+ExternalPDU ::= [APPLICATION 8] IMPLICIT SEQUENCE
+                                       {
+                                       oid OBJECT IDENTIFIER,
+                                       dialog [0] IMPLICIT Dialog1
+                                       }
+
+
+Dialog1 ::= OCTET STRING
+-- End WS
+-- Transaction Portion fields
+
+TCMessage ::= CHOICE {
+                               unidirectional                          
[APPLICATION 1]         IMPLICIT Unidirectional,
+                               begin                                           
[APPLICATION 2]         IMPLICIT Begin,
+                               end                                             
        [APPLICATION 4]         IMPLICIT End,
+                               continue                                        
[APPLICATION 5]         IMPLICIT Continue,
+                               abort                                           
[APPLICATION 7]         IMPLICIT Abort
+}
+
+Unidirectional ::=     SEQUENCE{
+       dialoguePortion DialoguePortion OPTIONAL,
+       components              ComponentPortion
+       }
+
+Begin ::= SEQUENCE{
+       otid                    OrigTransactionID,
+       dialoguePortion DialoguePortion OPTIONAL,
+       components              ComponentPortion OPTIONAL
+       }
+
+End ::=        SEQUENCE{
+       dtid                    DestTransactionID,
+       dialoguePortion DialoguePortion OPTIONAL,
+       components              ComponentPortion OPTIONAL
+       }
+
+
+Continue ::= SEQUENCE {
+       otid                    OrigTransactionID,
+       dtid                    DestTransactionID,
+       dialoguePortion DialoguePortion OPTIONAL,
+    components         ComponentPortion OPTIONAL
+       }
+
+Abort ::= SEQUENCE{
+       dtid                    DestTransactionID,
+       reason                  Reason OPTIONAL
+       }
+
+Reason ::= CHOICE{
+       p-abortCause            P-AbortCause,
+       u-abortCause            DialoguePortion
+       }
+
+-- NOTE - When the Abort Message is generated by the Transaction sublayer, a 
p-Abort Cause may be
+-- present. The u-abortCause may be generated by the component sublayer in 
which case it is an ABRT
+-- APDU, or by the TC-User in which case it could be either an ABRT APDU or 
data in some user-defined
+-- abstract syntax.
+
+DialoguePortion ::= [APPLICATION 11] EXPLICIT EXTERNAL
+
+-- WS adaptation
+--DialoguePortion ::= [APPLICATION  11] IMPLICIT DialogueOC
+--DialogueOC ::= OCTET STRING
+
+-- The dialogue portion carries the dialogue control PDUs as value of the 
external data type.
+-- The direct reference should be set to { ccitt recommendation q 773 as (1) 
dialogue-as (1) version (1) }
+-- if structured dialogue is used and to { ccitt recommendation q 773 as (1) 
unidialogue-as (2) version (1) }
+-- if unstructured dialogue is used or any user defined abstract syntax name 
when only user information
+-- is carried (e.g. when user information is sent in a 1988 Abort message).
+
+OrigTransactionID ::= [APPLICATION 8] IMPLICIT OCTET STRING (SIZE (1..4) )
+
+DestTransactionID ::=[APPLICATION 9] IMPLICIT OCTET STRING (SIZE (1..4) )
+
+P-AbortCause ::= [APPLICATION 10] IMPLICIT INTEGER {
+       unrecognizedMessageType (0),
+       unrecognizedTransactionID (1),
+       badlyFormattedTransactionPortion (2),
+       incorrectTransactionPortion (3),
+       resourceLimitation (4)}(0..127)
+
+-- COMPONENT PORTION. The last field in the transaction portion of the TCAP 
message is the Component Portion.
+-- The Component Portion may be absent.
+
+ComponentPortion ::= [APPLICATION 12]  IMPLICIT SEQUENCE SIZE (1..MAX) OF 
Component
+
+-- Component Portion fields
+-- Recommendation X.880 defines four Application Protocol Data Units (APDUs) 
for invoking
+-- operations, returning results or error, and for the rejection of invalid 
PDUs.
+-- TCAP adds returnResultNotLast to allow for the segmentation of a result.
+
+Component ::=  CHOICE {
+       invoke                                  [1] IMPLICIT Invoke,
+       returnResultLast                [2] IMPLICIT ReturnResult,
+       returnError                             [3] IMPLICIT ReturnError,
+       reject                                  [4] IMPLICIT Reject,
+       returnResultNotLast             [7] IMPLICIT ReturnResult
+       }
+
+-- The Components are sequences of data elements.
+
+Invoke ::=             SEQUENCE {
+                               invokeID                                
InvokeIdType,
+                               linkedID                                [0] 
IMPLICIT InvokeIdType OPTIONAL,
+                               opCode                  OPERATION,
+                               parameter        Parameter OPTIONAL }
+
+Parameter ::= ANY
+
+-- ANY is filled by the single ASN.1 data type following the keyword PARAMETER 
or the keyword ARGUMENT
+-- in the type definition of a particular operation.
+
+ReturnResult ::=       SEQUENCE {
+       invokeID                                InvokeIdType,
+       resultretres                    SEQUENCE {
+               opCode                  OPERATION,
+               parameter               Parameter OPTIONAL
+               } OPTIONAL
+       }
+
+-- ANY is filled by the single ASN.1 data type following the keyword RESULT in 
the type definition
+-- of a particular operation.
+
+ReturnError ::=        SEQUENCE {
+                               invokeID                                
InvokeIdType,
+                               errorCode                               
ErrorCode,
+                               parameter                               
Parameter  OPTIONAL }
+
+-- ANY is filled by the single ASN.1 data type following the keyword PARAMETER 
in the type definition
+-- of a particular error.
+
+Reject ::=             SEQUENCE {
+                               invokeIDRej CHOICE {
+                                       derivable                       
InvokeIdType,
+                                       not-derivable           NULL },
+                               problem CHOICE {
+                                       generalProblem          [0] IMPLICIT 
GeneralProblem,
+                                       invokeProblem           [1] IMPLICIT 
InvokeProblem,
+                                       returnResultProblem     [2] IMPLICIT 
ReturnResultProblem,
+                                       returnErrorProblem      [3] IMPLICIT 
ReturnErrorProblem } }
+
+InvokeIdType ::=       INTEGER (-128..127)
+
+
+OPERATION      ::=     CHOICE {
+                                                       localValue INTEGER,
+                                                       globalValue OBJECT 
IDENTIFIER }
+
+ERROR  ::=     CHOICE {
+                       localValue INTEGER,
+                       globalValue OBJECT IDENTIFIER }
+
+-- OPERATIONS
+
+-- Operations are specified with the OPERATION MACRO.
+-- When an operation is specified, the valid parameter set, results, and 
errors for that operation are indicated.
+-- Default values and optional parameters are permitted.
+
+--OPERATION MACRO              ::=
+
+--BEGIN
+--     TYPE NOTATION           ::=     Parameter Result Errors LinkedOperations
+--     VALUE NOTATION  ::=     value (VALUE CHOICE {
+--                                                     localValue INTEGER,
+--                                                     globalValue OBJECT 
IDENTIFIER } )
+--     Parameter                       ::=     ArgKeyword NamedType | empty
+--     ArgKeyword                      ::=     "ARGUMENT" | "PARAMETER"
+--     Result                          ::=     "RESULT" ResultType | empty
+--     Errors                  ::=     "ERRORS" "{"ErrorNames"}" | empty
+--     LinkedOperations                ::=     "LINKED" 
"{"LinkedOperationNames"}" | empty
+--     ResultType                      ::=     NamedType | empty
+--     ErrorNames                      ::=     ErrorList | empty
+--     ErrorList                       ::=     Error | ErrorList "," Error
+--     Error                           ::=     value (ERROR)
+                                                       -- shall reference an 
error value
+                                               --| type         shall 
reference an error type
+                                                       -- if no error value is 
specified
+
+--     LinkedOperationNames    ::=     OperationList | empty
+--     OperationList           ::=     Operation | OperationList "," Operation
+--     Operation                       ::=     value (OPERATION)
+                                                       -- shall reference an 
operation value
+--                                             | type   shall reference an 
operation type if
+                                                       -- no operation value 
is specified
+--     NamedType                       ::=     identifier type | type
+--END
+
+-- ERRORS
+
+-- Errors are specified with the ERROR MACRO.
+-- When an error is specified, the valid parameters for that error are 
indicated.
+-- Default values and optional parameters are permitted.
+
+--ERROR MACRO                  ::=
+--
+--BEGIN
+--     TYPE NOTATION           ::=     Parameter
+--     VALUE NOTATION  ::=     value (VALUE CHOICE {
+--                                                     localValue INTEGER,
+--                                                     globalValue OBJECT 
IDENTIFIER } )
+--     Parameter       ::=     "PARAMETER" NamedType | empty
+--     NamedType       ::=     identifier type | type
+--END
+
+-- PROBLEMS
+
+GeneralProblem         ::=     INTEGER {               unrecognizedComponent 
(0),
+                                                               
mistypedComponent (1),
+                                                               
badlyStructuredComponent (2) }
+
+InvokeProblem          ::=     INTEGER {               duplicateInvokeID (0),
+                                                               
unrecognizedOperation (1),
+                                                               
mistypedParameter (2),
+                                                               
resourceLimitation (3),
+                                                               
initiatingRelease (4),
+                                                               
unrecognizedLinkedID (5),
+                                                               
linkedResponseUnexpected (6),
+                                                               
unexpectedLinkedOperation (7) }
+
+ReturnResultProblem    ::=     INTEGER {               unrecognizedInvokeID 
(0),
+                                                               
returnResultUnexpected (1),
+                                                               
mistypedParameter (2) }
+
+ReturnErrorProblem     ::=     INTEGER {               unrecognizedInvokeID 
(0),
+                                                               
returnErrorUnexpected (1),
+                                                               
unrecognizedError (2),
+                                                               unexpectedError 
(3),
+                                                               
mistypedParameter (4) }
+
+
+ErrorCode ::= CHOICE
+                       {
+                               nationaler              [PRIVATE 19] IMPLICIT 
INTEGER (-32768..32767),
+                               privateer               [PRIVATE 20] IMPLICIT 
INTEGER
+                       }
+
+END -- end of the TCAP Package Module
diff --git a/library/tcap/TCAP_CodecPort.ttcn b/library/tcap/TCAP_CodecPort.ttcn
new file mode 100644
index 0000000..50b0eed
--- /dev/null
+++ b/library/tcap/TCAP_CodecPort.ttcn
@@ -0,0 +1,394 @@
+module TCAP_CodecPort {
+
+/* Simple TCAP Codec Port, translating between raw SCCP primitives with
+ * octetstring payload towards the SCCP provider, and TCAP-SCCP primitives
+ * which carry the decoded TCAP data types as payload.
+ *
+ * (C) 2025 by sysmocom s.f.m.c. GmbH <i...@sysmocom.de>
+ * All rights reserved.
+ *
+ * Released under the terms of GNU General Public License, Version 2 or
+ * (at your option) any later version.
+ */
+
+import from General_Types all;
+import from Osmocom_Types all;
+
+import from SCCPasp_Types all;
+import from SCCP_Types all;
+
+import from TCAPMessages language "ASN.1:1997" all;
+import from TCAP_Types all;
+
+type record TCAP_N_CONNECT_req
+{
+   SCCP_PAR_Address                 calledAddress,
+   SCCP_PAR_Address                 callingAddress     optional,
+   SCCP_PAR_Expedited_Data_Sel     expeditedDataSel   optional,
+   SCCP_PAR_Quality_Of_Service      qualityOfService   optional,
+   TCMessage                        userData           optional,
+   SCCP_PAR_Connection_Id           connectionId       optional,
+   SCCP_PAR_Importance              importance         optional
+}
+
+template (value) TCAP_N_CONNECT_req ts_TCAP_CONNECT_req(SCCP_PAR_Address 
called,
+                                                      SCCP_PAR_Address calling,
+                                                      SCCP_PAR_Connection_Id 
conn_id,
+                                                      template (omit) 
TCMessage ranap := omit) := {
+       calledAddress := called,
+       callingAddress := calling,
+       expeditedDataSel := omit,
+       qualityOfService := omit,
+       userData := ranap,
+       connectionId := conn_id,
+       importance := omit
+}
+
+type record TCAP_N_CONNECT_ind
+{
+   SCCP_PAR_Address                 calledAddress,
+   SCCP_PAR_Address                 callingAddress     optional,
+   SCCP_PAR_Quality_Of_Service      qualityOfService   optional,
+   TCMessage                        userData           optional,
+   SCCP_PAR_Connection_Id           connectionId       optional,
+   SCCP_PAR_Importance              importance         optional
+}
+
+template (present) TCAP_N_CONNECT_ind tr_TCAP_CONNECT_ind(template 
SCCP_PAR_Address called,
+                                                         template 
SCCP_PAR_Address calling,
+                                                         template TCMessage 
payload := *) := {
+       calledAddress := called,
+       callingAddress := calling,
+       qualityOfService := *,
+       userData := payload,
+       connectionId := *,
+       importance := *
+}
+
+type record TCAP_N_CONNECT_res
+{
+   SCCP_PAR_Address                    respondingAddress optional,
+   SCCP_PAR_Expedited_Data_Sel         expeditedDataSel  optional,
+   SCCP_PAR_Quality_Of_Service         qualityOfService  optional,
+   TCMessage                           userData          optional,
+   SCCP_PAR_Connection_Id              connectionId      optional,
+   SCCP_PAR_Importance                         importance        optional
+}
+
+template (value) TCAP_N_CONNECT_res ts_TCAP_CONNECT_res(SCCP_PAR_Connection_Id 
conn_id,
+                                                       template (omit) 
TCMessage ranap := omit) := {
+       respondingAddress := omit,
+       expeditedDataSel := omit,
+       qualityOfService := omit,
+       userData := ranap,
+       connectionId := conn_id,
+       importance := omit
+}
+
+type record TCAP_N_CONNECT_cfm
+{
+  SCCP_PAR_Address              respondingAddress optional,
+  SCCP_PAR_Quality_Of_Service   qualityOfService  optional,
+  TCMessage                     userData           optional,
+  SCCP_PAR_Connection_Id        connectionId      optional,
+  SCCP_PAR_Importance           importance        optional
+}
+
+template (present) TCAP_N_CONNECT_cfm tr_TCAP_CONNECT_cfm(template 
SCCP_PAR_Connection_Id conn_id,
+                                                         template TCMessage 
ranap := *) := {
+       respondingAddress := *,
+       qualityOfService := *,
+       userData := ranap,
+       connectionId := conn_id,
+       importance := *
+}
+
+type record TCAP_N_DATA_req
+{
+  TCMessage               userData               ,
+  SCCP_PAR_Connection_Id  connectionId  optional ,
+  SCCP_PAR_Importance     importance    optional
+}
+
+template (value) TCAP_N_DATA_req ts_TCAP_DATA_req(SCCP_PAR_Connection_Id 
conn_id,
+                                                 template (value) TCMessage 
ranap) := {
+       userData := ranap,
+       connectionId := conn_id,
+       importance := omit
+}
+
+
+type record TCAP_N_DATA_ind
+{
+  TCMessage               userData               ,
+  SCCP_PAR_Connection_Id  connectionId optional  ,
+  SCCP_PAR_Importance     importance   optional
+}
+
+template (present) TCAP_N_DATA_ind tr_TCAP_DATA_ind(SCCP_PAR_Connection_Id 
conn_id,
+                                                   template TCMessage ranap := 
*) := {
+       userData := ranap,
+       connectionId := conn_id,
+       importance := *
+}
+
+
+type record TCAP_N_DISCONNECT_req
+{
+  SCCP_PAR_Address         respondingAddress  optional,
+  SCCP_PAR_Reason          reason                      ,
+  TCMessage                userData           optional ,
+  SCCP_PAR_Connection_Id   connectionId       optional ,
+  SCCP_PAR_Importance      importance         optional
+}
+
+template (value) TCAP_N_DISCONNECT_req ts_TCAP_DISC_req(SCCP_PAR_Connection_Id 
conn_id,
+                                                       template (value) 
SCCP_PAR_Reason reason,
+                                                       template (omit) 
TCMessage ranap := omit) := {
+       respondingAddress := omit,
+       reason := reason,
+       userData := ranap,
+       connectionId := conn_id,
+       importance := omit
+}
+
+
+type record TCAP_N_DISCONNECT_ind
+{
+  SCCP_PAR_Originator     originator                  ,
+  SCCP_PAR_Address        respondingAddress  optional ,
+  SCCP_PAR_Reason         reason                      ,
+  TCMessage               userData           optional ,
+  SCCP_PAR_Connection_Id  connectionId       optional ,
+  SCCP_PAR_Importance     importance         optional
+}
+
+template (present) TCAP_N_DISCONNECT_ind tr_TCAP_DISC_ind(template (present) 
SCCP_PAR_Connection_Id conn_id,
+                                                         template (present) 
SCCP_PAR_Originator originator,
+                                                         template (present) 
SCCP_PAR_Reason reason,
+                                                         template TCMessage 
ranap := *) := {
+       originator := originator,
+       respondingAddress:= *,
+       reason := reason,
+       userData := ranap,
+       connectionId := conn_id,
+       importance := *
+}
+
+type record TCAP_N_UNITDATA_req
+{
+  SCCP_PAR_Address          calledAddress               ,
+  SCCP_PAR_Address          callingAddress              ,
+  SCCP_PAR_Sequence_Control sequenceControl    optional ,
+  SCCP_PAR_Return_Option    returnOption       optional ,
+  TCMessage                 userData                    ,
+  SCCP_PAR_Importance       importance         optional
+ }
+
+template (value) TCAP_N_UNITDATA_req ts_TCAP_UNITDATA_req(SCCP_PAR_Address 
called,
+                                                         SCCP_PAR_Address 
calling,
+                                                         template (value) 
TCMessage payload) := {
+       calledAddress := called,
+       callingAddress := calling,
+       sequenceControl := omit,
+       returnOption := omit,
+       userData := payload,
+       importance := omit
+}
+
+type record TCAP_N_UNITDATA_ind
+{
+  SCCP_PAR_Address           calledAddress              ,
+  SCCP_PAR_Address           callingAddress             ,
+  SCCP_PAR_Sequence_Control  sequenceControl  optional  ,
+  SCCP_PAR_Return_Option     returnOption     optional  ,
+  TCMessage                  userData                   ,
+  SCCP_PAR_Importance        importance       optional
+}
+
+template (present) TCAP_N_UNITDATA_ind tr_TCAP_UNITDATA_ind(template 
SCCP_PAR_Address called,
+                                                           template 
SCCP_PAR_Address calling,
+                                                           template TCMessage 
payload) := {
+       calledAddress := called,
+       callingAddress := calling,
+       sequenceControl := *,
+       returnOption := *,
+       userData := payload,
+       importance := *
+}
+
+type record TCAP_N_NOTICE_ind
+{
+  SCCP_PAR_Address               calledAddress            ,
+  SCCP_PAR_Address               callingAddress           ,
+  SCCP_PAR_Reason_For_Return     reasonForReturn          ,
+  TCMessage                      userData                 ,
+  SCCP_PAR_Importance            importance       optional
+}
+
+
+
+private function f_dec_ConnectInd(in ASP_SCCP_N_CONNECT_ind pin, out 
TCAP_N_CONNECT_ind pout) {
+       pout.calledAddress := pin.calledAddress;
+       pout.callingAddress := pin.callingAddress;
+       pout.qualityOfService := pin.qualityOfService;
+       if (ispresent(pin.userData)) {
+               pout.userData := dec_TCAP_TCMessage(pin.userData);
+       } else {
+               pout.userData := omit;
+       }
+       pout.connectionId := pin.connectionId;
+       pout.importance := pin.importance;
+       //port.setstate(0);
+} with {extension "prototype(fast)" }
+
+private function f_dec_ConnectCfm(in ASP_SCCP_N_CONNECT_cfm pin, out 
TCAP_N_CONNECT_cfm pout) {
+       pout.respondingAddress := pin.respondingAddress;
+       pout.qualityOfService := pin.qualityOfService;
+       if (ispresent(pin.userData)) {
+               pout.userData := dec_TCAP_TCMessage(pin.userData);
+       } else {
+               pout.userData := omit;
+       }
+       pout.connectionId := pin.connectionId;
+       pout.importance := pin.importance;
+       //port.setstate(0);
+} with {extension "prototype(fast)" }
+
+private function f_dec_DataInd(in ASP_SCCP_N_DATA_ind pin, out TCAP_N_DATA_ind 
pout) {
+       pout.userData := dec_TCAP_TCMessage(pin.userData);
+       pout.connectionId := pin.connectionId;
+       pout.importance := pin.importance;
+       //port.setstate(0);
+} with {extension "prototype(fast)" }
+
+private function f_dec_DisconnectInd(in ASP_SCCP_N_DISCONNECT_ind pin, out 
TCAP_N_DISCONNECT_ind pout) {
+       pout.originator := pin.originator;
+       pout.respondingAddress := pin.respondingAddress;
+       pout.reason := pin.reason;
+       if (ispresent(pin.userData)) {
+               pout.userData := dec_TCAP_TCMessage(pin.userData);
+       } else {
+               pout.userData := omit;
+       }
+       pout.connectionId := pin.connectionId;
+       pout.importance := pin.importance;
+       //port.setstate(0);
+} with {extension "prototype(fast)" }
+
+private function f_dec_UnitdataInd(in ASP_SCCP_N_UNITDATA_ind pin, out 
TCAP_N_UNITDATA_ind pout) {
+       pout.calledAddress := pin.calledAddress;
+       pout.callingAddress := pin.callingAddress;
+       pout.sequenceControl := pin.sequenceControl;
+       pout.returnOption := pin.returnOption;
+       pout.userData := dec_TCAP_TCMessage(pin.userData);
+       pout.importance := pin.importance;
+       //port.setstate(0);
+} with {extension "prototype(fast)" }
+
+private function f_dec_NoticeInd(in ASP_SCCP_N_NOTICE_ind pin, out 
TCAP_N_NOTICE_ind pout) {
+       pout.calledAddress := pin.calledAddress;
+       pout.callingAddress := pin.callingAddress;
+       pout.reasonForReturn := pin.reasonForReturn;
+       pout.userData := dec_TCAP_TCMessage(pin.userData);
+       pout.importance := pin.importance;
+       //port.setstate(0);
+} with {extension "prototype(fast)" }
+
+
+
+private function f_enc_ConnectReq(in TCAP_N_CONNECT_req pin, out 
ASP_SCCP_N_CONNECT_req pout) {
+       pout.calledAddress := pin.calledAddress;
+       pout.callingAddress := pin.callingAddress;
+       pout.expeditedDataSel := pin.expeditedDataSel;
+       pout.qualityOfService := pin.qualityOfService;
+       if (ispresent(pin.userData)) {
+               pout.userData := enc_TCAP_TCMessage(pin.userData);
+       } else {
+               pout.userData := omit;
+       }
+       pout.connectionId := pin.connectionId;
+       pout.importance := pin.importance;
+       //port.setstate(0);
+} with {extension "prototype(fast)" }
+
+private function f_enc_ConnectRes(in TCAP_N_CONNECT_res pin, out 
ASP_SCCP_N_CONNECT_res pout) {
+       pout.respondingAddress := pin.respondingAddress;
+       pout.expeditedDataSel := pin.expeditedDataSel;
+       pout.qualityOfService := pin.qualityOfService;
+       if (ispresent(pin.userData)) {
+               pout.userData := enc_TCAP_TCMessage(pin.userData);
+       } else {
+               pout.userData := omit;
+       }
+       pout.connectionId := pin.connectionId;
+       pout.importance := pin.importance;
+       //port.setstate(0);
+} with {extension "prototype(fast)" }
+
+private function f_enc_DataReq(in TCAP_N_DATA_req pin, out ASP_SCCP_N_DATA_req 
pout) {
+       pout.userData := enc_TCAP_TCMessage(pin.userData);
+       pout.connectionId := pin.connectionId;
+       pout.importance := pin.importance;
+       //port.setstate(0);
+} with {extension "prototype(fast)" }
+
+private function f_enc_DisconnectReq(in TCAP_N_DISCONNECT_req pin, out 
ASP_SCCP_N_DISCONNECT_req pout) {
+       pout.respondingAddress := pin.respondingAddress;
+       pout.reason := pin.reason;
+       if (ispresent(pin.userData)) {
+               pout.userData := enc_TCAP_TCMessage(pin.userData);
+       } else {
+               pout.userData := omit;
+       }
+       pout.connectionId := pin.connectionId;
+       pout.importance := pin.importance;
+       //port.setstate(0);
+} with {extension "prototype(fast)" }
+
+private function f_enc_UnitdataReq(in TCAP_N_UNITDATA_req pin, out 
ASP_SCCP_N_UNITDATA_req pout) {
+       pout.calledAddress := pin.calledAddress;
+       pout.callingAddress := pin.callingAddress;
+       pout.userData := enc_TCAP_TCMessage(pin.userData);
+       pout.sequenceControl := pin.sequenceControl;
+       pout.returnOption := pin.returnOption;
+       pout.importance := pin.importance;
+       //port.setstate(0);
+} with {extension "prototype(fast)" }
+
+type port TCAP_CODEC_PT message {
+       out     TCAP_N_CONNECT_req,
+               TCAP_N_CONNECT_res,
+               TCAP_N_DATA_req,
+               TCAP_N_DISCONNECT_req,
+               TCAP_N_UNITDATA_req,
+               ASP_SCCP_N_RESET_req;
+       in      TCAP_N_CONNECT_ind,
+               TCAP_N_CONNECT_cfm,
+               TCAP_N_DATA_ind,
+               TCAP_N_DISCONNECT_ind,
+               TCAP_N_UNITDATA_ind,
+               TCAP_N_NOTICE_ind,
+               ASP_SCCP_N_RESET_ind,
+               ASP_SCCP_N_RESET_cfm,
+               ASP_SCCP_N_STATE_ind;
+} with { extension "internal user SCCPasp_PT
+       out(TCAP_N_CONNECT_req -> ASP_SCCP_N_CONNECT_req: 
function(f_enc_ConnectReq);
+           TCAP_N_CONNECT_res -> ASP_SCCP_N_CONNECT_res: 
function(f_enc_ConnectRes);
+           TCAP_N_DATA_req -> ASP_SCCP_N_DATA_req: function(f_enc_DataReq);
+           TCAP_N_DISCONNECT_req -> ASP_SCCP_N_DISCONNECT_req: 
function(f_enc_DisconnectReq);
+           TCAP_N_UNITDATA_req -> ASP_SCCP_N_UNITDATA_req: 
function(f_enc_UnitdataReq);
+           ASP_SCCP_N_RESET_req -> ASP_SCCP_N_RESET_req: simple)
+       in(ASP_SCCP_N_CONNECT_ind -> TCAP_N_CONNECT_ind: 
function(f_dec_ConnectInd);
+          ASP_SCCP_N_CONNECT_cfm -> TCAP_N_CONNECT_cfm: 
function(f_dec_ConnectCfm);
+          ASP_SCCP_N_DATA_ind -> TCAP_N_DATA_ind: function(f_dec_DataInd);
+          ASP_SCCP_N_DISCONNECT_ind -> TCAP_N_DISCONNECT_ind: 
function(f_dec_DisconnectInd);
+          ASP_SCCP_N_UNITDATA_ind -> TCAP_N_UNITDATA_ind: 
function(f_dec_UnitdataInd);
+          ASP_SCCP_N_NOTICE_ind -> TCAP_N_NOTICE_ind: 
function(f_dec_NoticeInd);
+          ASP_SCCP_N_RESET_ind -> ASP_SCCP_N_RESET_ind: simple;
+          ASP_SCCP_N_RESET_cfm -> ASP_SCCP_N_RESET_cfm: simple;
+          ASP_SCCP_N_STATE_ind -> ASP_SCCP_N_STATE_ind: simple)"
+}
+
+
+}
diff --git a/library/tcap/TCAP_DialoguePDUs.asn 
b/library/tcap/TCAP_DialoguePDUs.asn
new file mode 100644
index 0000000..183b2ca
--- /dev/null
+++ b/library/tcap/TCAP_DialoguePDUs.asn
@@ -0,0 +1,80 @@
+-- $Id: DialoguePDUs.asn 26186 2008-09-13 11:44:33Z etxrab $
+-- Generated by Asnp, the pretty-printer of France Telecom R&D 
(http://asn1.elibel.tm.fr/asnp/)
+DialoguePDUs {itu-t recommendation q 773 modules(2) dialoguePDUs(2) version1(1)
+  } DEFINITIONS ::=
+BEGIN
+
+EXPORTS dialogue-as-id, DialoguePDU;
+
+-- abstract syntax name for structured dialogue APDUs
+dialogue-as-id OBJECT IDENTIFIER ::=
+  {itu-t recommendation q 773 as(1) dialogue-as(1) version1(1)}
+
+DialoguePDU ::= CHOICE {
+  dialogueRequest   AARQ-apdu,
+  dialogueResponse  AARE-apdu,
+  dialogueAbort     ABRT-apdu
+}
+
+AARQ-apdu ::= [APPLICATION 0] IMPLICIT SEQUENCE {
+  protocol-version
+    [0] IMPLICIT BIT STRING {version1(0)} DEFAULT {version1},
+  application-context-name  [1]  OBJECT IDENTIFIER,
+  user-information          [30] IMPLICIT SEQUENCE OF EXTERNAL OPTIONAL
+}
+
+AARE-apdu ::= [APPLICATION 1] IMPLICIT SEQUENCE {
+  protocol-version
+    [0] IMPLICIT BIT STRING {version1(0)} DEFAULT {version1},
+  application-context-name  [1]  OBJECT IDENTIFIER,
+  result                    [2]  Associate-result,
+  result-source-diagnostic  [3]  Associate-source-diagnostic,
+  user-information          [30] IMPLICIT SEQUENCE OF EXTERNAL OPTIONAL
+}
+
+-- RLRQ PDU is currently not used.
+-- It is included for completeness only.
+RLRQ-apdu ::= [APPLICATION 2] IMPLICIT SEQUENCE {
+  reason            [0] IMPLICIT Release-request-reason OPTIONAL,
+  user-information  [30] IMPLICIT SEQUENCE OF EXTERNAL OPTIONAL
+}
+
+-- RLRE PDU is currently not used.
+-- It is included for completeness only
+RLRE-apdu ::= [APPLICATION 3] IMPLICIT SEQUENCE {
+  reason            [0] IMPLICIT Release-response-reason OPTIONAL,
+  user-information  [30] IMPLICIT SEQUENCE OF EXTERNAL OPTIONAL
+}
+
+ABRT-apdu ::= [APPLICATION 4] IMPLICIT SEQUENCE {
+  abort-source      [0] IMPLICIT ABRT-source,
+  user-information  [30] IMPLICIT SEQUENCE OF EXTERNAL OPTIONAL
+}
+
+ABRT-source ::= INTEGER {dialogue-service-user(0), dialogue-service-provider(1)
+}
+
+Associate-result ::= INTEGER {accepted(0), reject-permanent(1)}
+
+Associate-source-diagnostic ::= CHOICE {
+  dialogue-service-user
+    [1]  INTEGER {null(0), no-reason-given(1),
+                  application-context-name-not-supported(2)},
+  dialogue-service-provider
+    [2]  INTEGER {null(0), no-reason-given(1), no-common-dialogue-portion(2)}
+}
+
+-- Release-request-reason is currently not used.
+-- It is included for completeness only.
+Release-request-reason ::= INTEGER {normal(0), urgent(1), user-defined(30)
+}
+
+-- Release-response-reason is currently not used.
+-- It is included for completeness only.
+Release-response-reason ::= INTEGER {
+  normal(0), not-finished(1), user-defined(30)}
+
+END -- DialoguePDUs
+
+-- Generated by Asnp, the ASN.1 pretty-printer of France Telecom R&D
+
diff --git a/library/tcap/TCAP_EncDec.cc b/library/tcap/TCAP_EncDec.cc
new file mode 100644
index 0000000..35cd30c
--- /dev/null
+++ b/library/tcap/TCAP_EncDec.cc
@@ -0,0 +1,30 @@
+
+#include <string.h>
+#include <stdarg.h>
+#include "TCAPMessages.hh"
+namespace TCAP__Types {
+
+TTCN_Module TCAP__EncDec("TCAP_EncDec", __DATE__, __TIME__);
+
+OCTETSTRING enc__TCAP__TCMessage(const TCAPMessages::TCMessage &pdu)
+{
+       TTCN_Buffer TTCN_buf;
+       TTCN_buf.clear();
+       pdu.encode(TCAPMessages::TCMessage_descr_, TTCN_buf,
+                  TTCN_EncDec::CT_BER, BER_ENCODE_DER);
+       return OCTETSTRING(TTCN_buf.get_len(), TTCN_buf.get_data());
+}
+
+TCAPMessages::TCMessage dec__TCAP__TCMessage(const OCTETSTRING &stream)
+{
+       TCAPMessages::TCMessage pdu;
+       TTCN_Buffer TTCN_buf;
+       TTCN_buf.clear();
+       TTCN_buf.put_os(stream);
+       pdu.decode(TCAPMessages::TCMessage_descr_, TTCN_buf,
+                  TTCN_EncDec::CT_BER, BER_ACCEPT_ALL);
+       return pdu;
+}
+
+
+}
diff --git a/library/tcap/TCAP_Types.ttcn b/library/tcap/TCAP_Types.ttcn
new file mode 100644
index 0000000..6703b72
--- /dev/null
+++ b/library/tcap/TCAP_Types.ttcn
@@ -0,0 +1,7 @@
+module TCAP_Types {
+
+       import from TCAPMessages language "ASN.1:1997" all;
+
+       external function enc_TCAP_TCMessage(in TCMessage pdu) return 
octetstring;
+       external function dec_TCAP_TCMessage(in octetstring stream) return 
TCMessage;
+}
diff --git a/library/tcap/TCAP_UnidialoguePDUs.asn 
b/library/tcap/TCAP_UnidialoguePDUs.asn
new file mode 100644
index 0000000..4f7c6c3
--- /dev/null
+++ b/library/tcap/TCAP_UnidialoguePDUs.asn
@@ -0,0 +1,25 @@
+-- Generated by Asnp, the pretty-printer of France Telecom R&D 
(http://asn1.elibel.tm.fr/asnp/)
+UnidialoguePDUs {itu-t recommendation q 773 modules(2) unidialoguePDUs(3)
+  version1(1)} DEFINITIONS ::=
+BEGIN
+
+EXPORTS uniDialogue-as-id, UniDialoguePDU;
+
+-- Abstract syntax name for unstructured dialogue APDUs
+uniDialogue-as-id OBJECT IDENTIFIER ::=
+  {itu-t recommendation q 773 as(1) unidialogue-as(2) version1(1)}
+
+UniDialoguePDU ::= CHOICE {unidialoguePDU  AUDT-apdu
+}
+
+AUDT-apdu ::= [APPLICATION 0] IMPLICIT SEQUENCE {
+  protocol-version
+    [0] IMPLICIT BIT STRING {version1(0)} DEFAULT {version1},
+  application-context-name  [1]  OBJECT IDENTIFIER,
+  user-information          [30] IMPLICIT SEQUENCE OF EXTERNAL OPTIONAL
+}
+
+END -- UNIDialoguePDU
+
+-- Generated by Asnp, the ASN.1 pretty-printer of France Telecom R&D
+
diff --git a/library/tcap/regen_makefile.sh b/library/tcap/regen_makefile.sh
new file mode 100755
index 0000000..2ace50d
--- /dev/null
+++ b/library/tcap/regen_makefile.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+FILES="*.asn *.ttcn TCAP_EncDec.cc"
+
+../../_buildsystem/regen-makefile.sh $FILES
+

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/41118?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Iae7f92cde02e5da966966bc95f9b74feec51958d
Gerrit-Change-Number: 41118
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pes...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillm...@sysmocom.de>
Gerrit-Reviewer: fixeria <vyanits...@sysmocom.de>
Gerrit-Reviewer: osmith <osm...@sysmocom.de>
Gerrit-Reviewer: pespin <pes...@sysmocom.de>

Reply via email to