TipcConnDefaultCbCreate create a default callback in a connection
T_CB TipcConnDefaultCbCreate(conn
,func
,arg
) T_IPC_CONNconn
; T_IPC_CONN_DEFAULT_CB_FUNCfunc
; T_CB_ARGarg
;
conn
connection for which to create callback
func
callback function
arg
user-defined argument to pass to func
New callback if successful, NULL
otherwise.
If TipcConnDefaultCbCreate fails, it returns NULL
and sets the global SmartSockets error number to one of:
TipcConnDefaultCbCreate creates a default callback in a connection. These callbacks are called by TipcConnMsgProcess when there are no process callbacks for the type of message being processed. Default callbacks are useful for processing unexpected message types or for generic processing of most message types.
See TipcConnMsgProcess for more information on the relationship between process callbacks and default callbacks.
The T_ENTRY declaration specifier is required in the definition of all callback functions as well as their prototypes.
TipcConnMsgProcess, TipcConnDefaultCbLookup; see the TIBCO SmartSockets Utilities for information on TutCbDestroy.
This example creates a default callback which warns that an unexpected message has arrived:
void T_ENTRY my_conn_default_cb(conn, data, arg) T_IPC_CONN conn; T_IPC_CONN_DEFAULT_CB_DATA data; T_CB_ARG arg;/* not used */
{ if (!TipcMsgPrintError(data->msg)) {
return
; /* error */
} }/* my_conn_default_cb */
/* =========================================================== */
/*...code from calling function is below */
/* create default callback */
if (TipcConnDefaultCbCreate(conn, my_conn_default_cb, NULL) == NULL) {return
; /* error */
}
TIBCO SmartSockets™ Application Programming Interface Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |