# getcall

The operation belongs to the family of procedure-based communication operations. It is used to specify that a test component accepts a procedure calls from the system under test or from another test component.

- The operation can be used on connected procedure-based (or mixed) ports.
- The operation is blocking (blocks TTCN3 program execution until reply is sent).
- In case of multiple connections the operation may be restricted to one communication partner.

Related keywords:

- address
- create
- from
- modifies
- param
- sender
- signature
- system

### port_reference.getcall [ ( template_instance ) ] [ from address_reference ] [ -> assignment_part ];

- port_reference points out the port where the procedure call is accepted at.

  - the keywords any port may be used to indicate that procedure calls at any ports will be accepted (see the example 4).

- The getcall keyword introduces the procedure call acceptance.

- template_instance may be one of the following (when omitted, the call on the top of the incoming port queue (if any) will be removed):

  - in-line signature template (see the example1);
  - a signature template (see the example 2);
  - a modified signature template (see the example 3);

- The optional from keyword is used when a port is connected to several entities and restriction to one communication partner is required.

- address_reference is one of the following:

  - a component reference (cf. create) or the keyword system, in case of one-to-many connections.

  - an address reference (cf. address) , when there are several entities within the system under test.

- assignment_part is one or more of the following:

  - the sender keyword followed by a variable of address or component type to store the address of the sender (see the example 2).
  - the param keyword followed of variables of the same type as the received message to store the received parameters (see the example 1).

Example 1: in-line signature template and parameter redirect

signature S_MyProc (out integer pl_MyPar1, inout boolean pl_MyPar2, in charset pl_MyPar3) noblock;
MujPort_PCO.getcall(S_MyProc:{ ?, ?, "estanco"}) from system -> param (vl_MyPar1, vl_MyPar2, vl_MyPar3);

The signature S_MyProc suitable for non-blocking communication is defined in the first line. It has three parameters (pl_MyPar1, pl_MyPar2 and pl_MyPar3).
In the second line, the procedure call is accepted at the port MujPort_PCO. The port is connected to several components, but communication is restricted to one component, here to the test system interface. The value of the first two parameters does not matter, but the third one must be equal to "estanco" for the call to be accepted. The parameter values are sotred in the variables vl_MyPar1, vl_MyPar2 and vl_MyPar3, respectively.

Example 2: signature template and address redirect

template S_MyProc t_NiaTemplate (boolean pl_param) := {
field1 := 16,
field2 := pl_param,
field3 := "massepain"
}

MujPort_PCO.getcall (t_NiaTemplate(true)) -> sender v_address;

The parameterized template (t_NiaTemplate) has three fields. Procedure calls are accepted where the first parameter is don't care because it is defined as an out parameter, the second and the third must have the values true and "massepain", respectively . The address of the component calling the procedure is stored in the variable v_address.

Example 3: modified signature template

MujPort_PCO.getcall (modifies t_NiaTemplate(false) := {field3 := "pate d'amande"});

The template defined in example 2 is modified. The procedure call is now accepted when the second and the third parameters have the values false and ""pate d'amande", respectively.

Example 4: receive on any port

any port.getcall (t_NiaTemplate(true));

The procedure call matching the template t_NiaTemplate will be accepted on any port.

Example 5: Accepting any call

MujPort_PCO.getcall;

Removes the top call from MujPort_PCO.

BNF definition of getcall