# Building ACU message structures

The NMS ISDN protocol stack must be in ACU stack mode to send ACU messages. To learn how to place the stack in this mode, see Initializing ISDN protocol stack instances.

Before sending an ACU message, the application creates a message structure containing the ACU message data. When this structure (and its substructures) reaches the ISDN protocol stack, the stack rearranges the data into several Q.931 information elements (IEs), builds a complete Q.931 message with the IEs, and sends it to the network.

The application uses macros to assign values to the fields in the message structure. Each macro corresponds to a field in the structure. The application uses these macros instead of accessing fields directly, because the fields do not correspond to actual C language structure fields and need some simple addressing computation to be reached. These macros are defined in isdnacu.h. See ACU primitives summary for more information about message primitives and macros.

The following sample code shows how to use macros to assign values to fields in an ACU message structure:

void build_cc_conn_rs(char *buffer, int *len, char ts)
{
struct acu_conn_rs_args *p_data;
p_data = (struct acu_conn_rs_args *)buffer;
memset(p_data, OFF, ISDN_BUFFER_DATA_LGTH);
/* Fill in two fields using macros*/
Acu_conn_rs_data_chani = ts; /* T1/E1 time-slot */
Acu_conn_rs_data_chani_nb = 1; /* Only one B channel */
/* User to user information could go here */
*len = sizeof( struct acu_conn_rs_args );
return;
}

Certain pointer and size macros must be called in a specific sequence, so that the corresponding IEs are filled out in order. For details, see ACU primitives summary.

The application also builds an ISDN_MESSAGE structure specifying the message primitive and other data, as follows:

ISDN_MESSAGE field | Value
--- | ---
nai | Specifies the network access identifier (NAI) of the destination trunk.
from_ent | ENT_APPLI Indicates that the message is sent from the application to the stack.
to_ent | ENT_CC Indicates that the message is sent to the call control layer (ACU).
to_sapi | ACU_SAPI Specifies the unique service access point identifier (SAPI) associated with the ACU service access point (SAP).
conn_id | Specifies the connection ID of the call that the message concerns.
code | Specifies the primitive of the ACU message (for example ACU_CONN_RQ).
inf0, inf1, inf2, inf3, inf4 | Reserved for internal data relay.
data_size | Specifies the size of the message buffer containing data associated with message.
nfas_group | Specifies the NFAS group number for this network access identifier (NAI). Used only if duplicate NAI values are defined.
userid | Not used.

An application can specify custom information elements containing raw Q.931 data, using transparent IEs. For details, see Overview of Q.931 data.