# signature

Procedure signatures (or signatures for short) are needed for procedure-based communication. Signatures are syntactically similar to external functions (contain the remote procedure prototype) while semantically are similar to type definitions (used for template definitions). There are two classes of signatures:

1. Signature for blocking communication
2. Signature for non-blocking communication

- Signature definitions may have parameters. The direction of the parameters is as seen by the called party rather than the calling party.
- Signature definitions may indicate that the remote procedure returns a value after its termination.
- Signature definitions may indicate that the remote procedure may raise exception.

Related keywords:

- exception
- in
- inout
- noblock
- out
- return

1. Blocking communication is blocking on the calling and the called side, i.e., TTCN-3 processing is suspended until the respective response has arrived.

### signature identifier ( [ parameter_list ] )[ return return_type ] [ exception exception_list ] ;

- The signature keyword introduces the signature definition.

- identifier is the name used to refer to the structured type. Must begin with a letter, may contain letters, numbers and underscore characters. According to the Naming convention, the prefix S_ is recommended.

- The optional parameter_list may contain some of the following (if more than one parameter applies, they are separated by comma)

- the in keyword, the type of the parameter and the name of the parameter
- the inout keyword, the type of the parameter and the name of the parameter
- the out keyword, the type of the parameter and the name of the parameter

- The optional return keyword indicates that the called procedure will return a value.

- return_type specifies the type of the value returned by the procedure.

- The optional exception keyword indicates that the called procedure may raise an exception.

- exception_list enumerates the (user defined or bulit-on) types of the values representing the exception. More than one types may be specified, they are separated by comma.

2. Non-blocking communication is only blocking on the called side, i.e., TTCN-3 processing is suspended on the called side until the response has been sent.

### signature identifier ( [ parameter_list ] ) noblock [ exception exception_list ] ;

- The signature keyword introduces the signature definition.

- identifier is the name used to refer to the structured type. Must begin with a letter, may contain letters, numbers and underscore characters. According to the Naming convention, the prefix S_ is recommended.

- The optional parameter_list may contain the following:

- the in keyword, the type of the parameter and the name of the parameter

- The noblock keyword indicating that the procedure signature is intended for non-blocking communication.

- return_type specifies the type of the value returned by the procedure.

- The optional exception keyword indicates that the called procedure may raise an exception.

- exception_list enumerates the (user defined or bulit-on) types of the values representing the exception. More than one types may be specified, they are separated by comma.

Example 1: signature for blocking communication

signature P_MyRemoteProcOne ();

P_MyRemoteProcOne will be used for blocking procedure-based communication. It has neither parameters nor a return value.

Example 2: signature for non-blocking communication

signature P_MyRemoteProcTwo () noblock;

P_MyRemoteProcTwo will be used for non blocking procedure-based communication. It has neither parameters nor a return value.

Example 3: parameters of procedure signatures

signature P_MyRemoteProcThree (in integer pl_Par1, out float pl_Par2, inout integer pl_Par3);

P_MyRemoteProcThree will be used for blocking procedure-based communication. The procedure has three parameters: pl_Par1 an in parameter of type integer, pl_Par2 an out parameter of type float and pl_Par3 an inout parameter of type integer.

Example 4: value returning remote procedures

signature P_MyRemoteProcFour (in integer pl_Par1) return integer;

P_MyRemoteProcFour will be used for blocking procedure-based communication. The procedure has the in parameter pl_Par1 of type integer and returns a value of type integer after its termination.

Example 5: specifying exceptions

signature P_MyRemoteProcFive (inout float pl_Par1) return integer exception (ExceptionType1, ExceptionType2);

P_MyRemoteProcFive will be used for blocking procedure-based communication. It returns a float value in the inout parameter pl_Par1 and an integer value, or may raise exceptions of type ExceptionType1 or ExceptionType2

Example 6: specifying exceptions for non-blocking communication

signature P_MyRemoteProcSix (in integer pl_Par1) noblock exception (integer, float);

P_MyRemoteProcSix will be used for non-blocking procedure-based communication. In case of an unsuccessful termination, P_MyRemoteProcSix raises exceptions of type integer or float.

BNF definition of signature