ctaFormatEvent

Formats an event into a string for print diagnostics.

Prototype

DWORD ctaFormatEvent ( char *lineprefix, CTA_EVENT *ctaevt, char *buffer, unsigned size)

Argument

Description

lineprefix

Pointer to a character string that is placed at the beginning of every new line in the formatted event string.

ctaevt

Pointer to an event structure to be formatted. The CTA_EVENT structure is:

typedef struct
{
   DWORD  id;            /* Event code and source service ID       */
   CTAHD  ctahd;         /* Natural Access context handle          */
   DWORD  timestamp;     /* Timestamp                              */
   DWORD  userid;        /* Userid (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 object handle                  */
} CTA_EVENT;

buffer

Pointer to the buffer to receive the event string.

size

Size of the buffer in bytes.


Return values

Return value

Description

SUCCESS

 

CTAERR_BAD_ARGUMENT

buffer is NULL.

CTAERR_BAD_SIZE

size is not big enough to fit the formatted event.

CTAERR_NOT_FOUND

The service to format the event is not found.

CTAERR_NOT_INITIALIZED

Natural Access is not initialized. Call ctaInitialize first.

CTAERR_SVR_COMM

Server communication error.


Details

ctaFormatEvent creates a detailed textual description of the event.

Note: If you are working with OAM service events, refer to the NMS OAM Service Developer's Reference Manual for information on formatting events.

See also

ctaFormatEventEx, ctaGetText

Example

void DemoShowEvent( CTA_EVENT *event )
{
    char format_buffer[CTA_MAX_FORMAT_SIZE];
    char *prefix = "\t\t\t";  /* default demo indent */

    format_buffer[0] = '\0';

    ctaFormatEvent( prefix, event, format_buffer, CTA_MAX_FORMAT_SIZE );

    printf( "%s", format_buffer );

}