Defining a client message callback

A client message callback is defined as follows:

CS_RETCODE CS_PUBLIC clientmsg_cb(context, connection,
                                  message)

CS_CONTEXT            *context;
CS_CONNECTION         *connection;
CS_CLIENTMSG          *msg;

where:

A client message callback must return either CS_SUCCEED or CS_FAIL:

Table 2-3 lists the Client-Library routines that a client message callback can call:

Table 2-3: Routines that a client-message callback can call

Callable routine

Permitted use

ct_config

To retrieve information only

ct_con_props

To retrieve information or to set the CS_USERDATA property only

ct_cmd_props

To retrieve information or to set the CS_USERDATA property only

ct_cancel (CS_CANCEL_ATTN)

Any circumstances

Most applications use a client message callback that simply displays the error details or logs them to a file. However, some applications may require a callback that recognizes certain errors and takes specific action. See “Handling specific Client-Library messages” for more information on how this is done.