# NMS ISDN Management service events

All events in the Natural Access environment are represented by a C data structure, as shown in the generic CTA_EVENT below:

typedef struct
{
DWORD id; /* Event id (LIBEVN_xxx in 'libdef.h') */
CTAHD ctahd; /* Context handle */
DWORD timestamp; /* Timestamp */
DWORD userid; /* Use-supplied id */
DWORD size; /* Size of buffer if buffer is not NULL */
/* Otherwise, may contain event-specific data */
void *buffer; /* Buffer pointer */
DWORD value; /* Event status or event-specific data */
DWORD objHd; /* Service client-side object handle */
} CTA_EVENT;

This structure, returned by ctaWaitEvent, informs the application which event occurred on which context and provides additional information specific to the event. The LIB prefix in LIBEVN indicates the association between events and specific NMS services. For example, the IMGT prefix is associated with the IMGT service.

Because the IMGT service is a Natural Access service, IMGT functions can also receive Natural Access events. Refer to the Natural Access Developer's Reference Manual for listings and descriptions of the Natural Access events.

The event structure contains the following fields:

Field | Description
--- | ---
id | An event code defined in the library header file. All IMGT events are prefixed with IMGTEVN_ (for example, IMGTEVN_SOMETHING_HAPPENED).
ctahd | The context handle (returned from ctaCreateContext).
timestamp | The time when the event was created, in milliseconds since midnight, January 1, 1970, modulo 49 days. The resolution for board events is ten milliseconds.
userid | The user-supplied ID. This field is unaltered by Natural Access and facilitates asynchronous programming. Its purpose is to correlate a context with an application object and context when events occur.
size | The size (in bytes) of the area pointed to by the buffer. If the buffer is NULL, this field may be used to hold an event-specific value.
buffer | A pointer to data returned with the event. The field contains an application process address. The event size field contains the actual size of the buffer.
value | A reason code or an error code. This field contains an event-specific value.
objHd | The call handle, if the event concerns a particular call. If the event concerns the line and not a particular call, objHd is NULL.

## IMGT service event summary

The following events are specific to the NMS ISDN Management service:

Event | Hexadecimal | Decimal | Description
--- | --- | --- | ---
ISDNEVN_SEND_MESSAGE | 0x00182003 | 1581059 | Message has been sent and failed.
ISDNEVN_RCV_MESSAGE | 0x00182005 | 1581061 | Message was received from the trunk.