TipcConnProcessCbCreate create a process callback in a connection
T_CB TipcConnProcessCbCreate(conn
,mt
,func
,arg
) T_IPC_CONNconn
; T_IPC_MTmt
; T_IPC_CONN_PROCESS_CB_FUNCfunc
; T_CB_ARGarg
;
conn
connection to create callback for
mt
message type to create callback for (null means global callback)
func
callback function
arg
user-defined argument to pass to func
New callback if successful, NULL
otherwise.
If TipcConnProcessCbCreate fails, it returns NULL
and sets the global SmartSockets error number to one of:
TipcConnProcessCbCreate creates a process callback in a connection. These callbacks are called by TipcConnMsgProcess to perform the normal processing of a message, such as storing numeric data values and then acting on the variables. See the TIBCO SmartSockets Utilities for more information on callbacks.
A process callback is usually created for a specific message type and connection. If the message type is null, then a global process callback is created for all message types on that connection.
The T_ENTRY declaration specifier is required in the definition of all callback functions as well as their prototypes.
TipcConnDefaultCbCreate, TipcConnMsgProcess, TipcConnProcessCbLookup; see the TIBCO SmartSockets Utilities for information on TutCbDestroy.
This example creates a global connection process callback that writes all processed messages to a message file:
void T_ENTRY my_conn_process_cb(conn, data, arg) T_IPC_CONN conn; T_IPC_CONN_PROCESS_CB_DATA data; T_CB_ARG arg;/* really (T_IPC_MSG_FILE) */
{ T_IPC_MSG msg = data->msg; T_IPC_MSG_FILE msg_file = arg; if (!TipcMsgFileWrite(msg_file, msg)) {return
; /* error */
} }/* my_conn_process_cb */
/* =========================================================== */
/*...code from calling function is below */
msg_file = TipcMsgFileCreate("my_log.msg", T_IPC_MSG_FILE_CREATE_WRITE); if (msg_file == NULL) {return
; /* error */
}/* global connection process callback */
if (TipcConnProcessCbCreate(conn, NULL, my_conn_process_cb, msg_file) == NULL) {return
; /* error */
}
TIBCO SmartSockets™ Application Programming Interface Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |