![]() |
![]() |
![]() |
![]() |
![]() |
This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. |
Add a set of server event handlers to a client connection object
int PtConnectionAddEventHandlers(
PtConnectionClient_t *connection,
PtConnectionEventHandler_t const *handlers,
unsigned nhandlers );
ph
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.
Photon
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | No |
| Thread | No |
PtConnectionAddMsgHandlers(), PtConnectionNotify(), PtConnectionReply(), PtConnectionReplymx(), PtConnectionResizeEventBuffer()
"Connections" in the Interprocess Communication chapter of the Photon Programmer's Guide
![]() |
![]() |
![]() |
![]() |