# Sending IMGT messages to the stack

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

Structure | Description
IMGT_MESSAGE | In this structure, the application specifies the message to be sent by using one of the message primitives documented in IMGT data structures. The message primitive appears in the code field in this structure. In an NFAS configuration, the NAI in the IMGT_MESSAGE structure must be the same as the NAI carrying the D channel.
A primitive-specific data structure (if needed) | For messages that require additional data, a message structure is sent containing the data. The data differs for each message type. For details about seach message type, see IMGT data structures.

In addition, the application calls imgtSendMessage and specifies the following arguments:

Argument | Description
ctahd | The context identifier associated with the trunk on which the call is taking place.
pmessage | A pointer to IMGT_MESSAGE.
size | The size of the message structure.
pbuff | A pointer to the primitive-specific data structure.

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

imgtSendMessage data structures

IMGT_MESSAGE is defined as follows:

typedef struct IMGT_MESSAGE
{
BYTE nai; /* Network access interface index */
BYTE code; /* Primitive code */
WORD nfas_group; /* NFAS group number, only required for */
/* configurations with duplicate NAI values */
DWORD status; /* Status or error for START/STOP */
} IMGT MESSAGE;

Note: When NFAS is in use, the application should set nai in the IMGT_MESSAGE structure to the NAI that is carrying the D channel.