# Sending ISDN messages to the stack

To send a message to the NMS ISDN protocol stack, the application builds two structures:

Structure | Description
ISDN_MESSAGE | In this structure, the application specifies the message to be sent, using one of the message primitives. For more information, refer to Overview of message primitives. The message primitive appears in the code field in this structure. For details about ISDN_MESSAGE, see ISDN_MESSAGE structure.
A message structure (optional). | For messages that require additional data, a message structure (containing the data) is sent. The data differs for each message type. For details on each message type, see Overview of message primitives.

The application then calls isdnSendMessage in the NMS ISDN library. The ctahd argument in the function call specifies the context of the trunk on which the call is taking place. message is a pointer to ISDN_MESSAGE. pdata is a pointer to the associated message structure (if any). size is the size of the message structure (if any).

The following illustration shows the content and meaning of each of the arguments sent in isdnSendMessage:

ISDN_MESSAGE is defined as follows:

typedef struct ISDN_MESSAGE
{
nai_t nai; /* Network access interface index */
ent_id_t from_ent;/* Message source */
ent_id_t to_ent; /* Message destination */
sapi_t to_sapi; /* Destination Service Access Point */
union {
add_t conn_id; /* Connection identifier for the ACU layer */
add_t crv; /* Call Reference value for the NS layer. Not used. */
add_t ces; /* Connection Endpoint suffix (DL later upper half) */
add_t tei; /* Terminal Endpoint ID (DL layer lower half). Not used.*/
add_t chani; /* Physical layer channel identifier. Not used. */
} add;
code_t code; /* Primitive code unique only between two entities */
WORD inf0; /* Information location 0 */
WORD inf1; /* Information location 1 */
WORD inf2; /* Information location 2 */
WORD inf3; /* Information location 3 */
WORD inf4; /* Information location 4 */
WORD data_size; /* Size of data to follow */
WORD nfas_group; /* NFAS group number */
DWORD userid; /* User ID */
} ISDN_MESSAGE;