srv_handle

Installs a standard event handler for an ODS application.

Syntax

SRV_HANDLE_PROC srv_handle (
SRV_SERVER *
server,
DBINT
event,
SRV_HANDLE_PROC
handler );

where

server
Is a pointer to the SRV_SERVER structure. Use srv_init to get this pointer.
event
Specifies the event that is assigned to handler. All ODS events are valid. For a list of ODS events, see Appendix B, "Events and Event Types."
handler
Is a pointer to the function that is called when the event defined by event occurs. This function is global to the ODS application and will be called every time event occurs.

This function should be defined as returning an int and taking a single parameter. This parameter should be defined as SRV_SERVER * when event is one of the following:

and should be defined as SRV_PROC * when event is one of the following:

This function must return one of the following values:
Return value Description
SRV_CONTINUE Continue normal processing
SRV_DISCONNECT Fires a disconnect event to close the client connection
SRV_EXIT Fires a disconnect event to close the client connection

Returns

A pointer to the previously defined event-handling function.

Remarks

When an event occurs, ODS calls the following functions in this order:

  1. The pre-event handler (installed by srv_pre_handle)
  2. The standard event handler (installed by srv_handle)
  3. The post-event handler (installed by srv_post_handle)

Each ODS event has a default standard event handler which returns SRV_CONTINUE. Installing a standard event handler with srv_handle replaces the default handler with one supplied by the application.

You can install standard event handlers dynamically. The new standard event handler is called when the next event occurs. An ODS application can have one standard event handler for each event. Open Data Services will automatically remove the event handler when necessary; your program should not attempt to do this.

See Also

This entry For information about
srv_event Adding an event request
srv_pre_handle Installing a pre-event handler.
srv_post_handle Installing a post-event handler.