# CTA event structure

NMS OAM events arrive encapsulated in the standard CTA_EVENT data structure (defined in ctadef.h):

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;

This structure, returned by ctaWaitEvent, informs the application which event occurred on which context, and includes additional information specific to the event.

The CTA_EVENT structure contains the following fields:

Field | Description
--- | ---
id | Event code defined in the library header file. For example: OAMEVN_SOMETHING_ HAPPENED. For a list of NMS OAM event codes, see NMS OAM events.
ctahd | Context handle returned from ctaCreateContext.
timestamp | Time when the event was created in milliseconds since midnight, January 1, 1970, modulo 49 days. An application can decode the timestamp using ctaGetTimeStamp.
userid | User-supplied identifier. This field is unaltered by Natural Access and facilitates asynchronous programming. Its purpose is to correlate a context with an application object/context when events occur.
size | Size (bytes) of the area to which the buffer field points. This field also indicates whether a data buffer associated with the event must be freed using ctaFreeBuffer. If the buffer is NULL, this field can hold an event-specific value. For NMS OAM events, size indicates the size of the OAM_MSG structure.
buffer | Pointer to data returned with the event. The field contains an application process address and the event's size field contains the actual size of the buffer. For NMS OAM events, the buffer points to an OAM_MSG structure. Note: After processing an NMS OAM event, the application must free the event buffer for Natural Access. For more information, see Event buffer management.
value | Event-specific value. If the event is a DONE event (an event indicating that a function was successfully invoked, such as OAMEVN_STARTBOARD_DONE), this field holds a reason code indicating the actual results of the function. For more information, see NMS OAM reason codes.
objHd | The service client-side object handle.