# Receiving events and IMGT messages

The IMGT service sends messages to the application by means of a standard Natural Access event structure. The information arrives as a buffer attached to an IMGTEVN_RCV_MESSAGE event. See IMGT d ata structures for information about the contents of the buffer.

This topic describes:

- Receiving events

- Receiving IMGT messages

- Stopping a management session

## Receiving events

The events returned can be standard Natural Access events, events sent by an ISDN protocol stack instance or IMGT session, or events specific to any Natural Access extensions. They arrive in the form of the standard event data structure:

typedef struct CTA_EVENT
{
DWORD id; /* Event code (and source service id) */
CTAHD ctahd; /* Context handle */
DWORD timestamp; /* Timestamp */
DWORD userid; /* User id (defined by ctaCreateContext) */
DWORD size; /* Size of buffer if buffer != NULL */
void *buffer; /* Buffer pointer */
DWORD value; /* Event status or event-specific data */
DWORD objHd; /* Service client-side object handle */
} CTA_EVENT;

The CTA_EVENT structure informs the application about events that occur on particular contexts, and provides additional information specific to the event. The event's prefix indicates the NMS service with which the event is associated. A partial list of these prefixes is shown in the following table:

This prefix... | Indicates...
--- | ---
CTAEVN | A Natural Access event
NCCEVN | An NCC service event
ADIEVN | An ADI service event
ISDNEVN | An NMS ISDN event
IMGTEVN | An IMGT service event

To receive these events, the application can invoke ctaWaitEvent.

## Receiving IMGT messages

When an IMGT message is received, an IMGTEVN_RCV_MESSAGE event occurs. In the Natural Access structure, buffer is a pointer to an IMGT_MSG_PACKET structure. This structure contains:

- An IMGT_MESSAGE structure that contains the message and other data.

- A data area containing the message header.

The following illustration shows the structure of this message packet:

Receiving IMGT messages

Most IMGT events have a buffer associated with them. When the buffer and size fields of the Natural Access event indicate that a buffer is associated with the event, the application processes the buffer and must release it as soon as possible by calling imgtReleaseBuffer. Otherwise, the IMGT service interface runs out of buffers and stops passing events to the application.

If the configuration includes NAIs whose values are not unique on a given board, the nfas_group field of the IMGT_MESSAGE structure contains the NFAS group number for the NAI.

## Stopping a management session

Use imgtStop to end an IMGT session.