Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pt/ptconnectionaddeventhandlers.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pt/ptconnectionaddeventhandlers.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pt/ptconnectionaddeventhandlers.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pt/ptconnectionaddeventhandlers.html on line 8

PtConnectionAddEventHandlers()

Add a set of server event handlers to a client connection object

Synopsis:

int PtConnectionAddEventHandlers(
        PtConnectionClient_t *connection,
        PtConnectionEventHandler_t const *handlers,
        unsigned nhandlers );

Library:

ph

Description:

This function adds a set of server event handlers to a client connection object. The handlers[] argument points to an array of PtConnectionEventHandler_t structures:

typedef int PtConnectionEventFunc_t(
    PtConnectionClient_t *connection, void *user_data,
    unsigned long type, void const *msg, unsigned len );

typedef struct Pt_connection_event_handler {
    unsigned long type;
    PtConnectionEventFunc_t *fun;
} PtConnectionEventHandler_t;

The array must be sorted with respect to the type field; it also must not be destroyed or modified as long as the connection object using it exists.

If you add multiple tables to a connection object, they're searched in the reverse order: a call to PtConnectionAddEventHandlers() can override handlers that were attached by a previous call. An event handler should return Pt_END to “consume” the event, or Pt_CONTINUE to continue the search.

A special value of zero in the type field means “any type.” When a notification from the server arrives, all the tables are searched for an exact match on the type, and if the event isn't consumed, the tables are searched again for a handler with type 0.

Returns:

0
Success.
-1
An error occurred; errno is set.

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PtConnectionAddMsgHandlers(), PtConnectionNotify(), PtConnectionReply(), PtConnectionReplymx(), PtConnectionResizeEventBuffer()

Connections in the Interprocess Communication chapter of the Photon Programmer's Guide


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pt/ptconnectionaddeventhandlers.html on line 137

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pt/ptconnectionaddeventhandlers.html on line 137