TipcSrvSubjectDefaultCbCreate create a default subject callback
func
callback function
arg
user-defined argument to pass to func
New callback if successful, NULL
otherwise.
If TipcSrvSubjectDefaultCbCreate fails, it returns NULL
and sets the global SmartSockets error number to one of:
TipcSrvSubjectDefaultCbCreate creates a default subject callback. Callbacks are called by TipcSrvMsgProcess to perform the processing of a message. The callback function, func
, is only called when no other subject callback matches the subject of the message being processed.
The T_ENTRY declaration specifier is required in the definition of all callback functions as well as their prototypes.
TipcSrvSubjectCbCreate, TipcSrvSubjectCbLookup, TipcSrvSubjectDefaultCbLookup
This example creates a default subject callback:
/* =============================================================== */
/*..default_subject_cb -- default subject callback */
void T_ENTRY default_subject_cb(conn, data, arg) T_IPC_CONN conn; T_IPC_SRV_SUBJECT_CB_DATA data; T_CB_ARG arg;/* not used */
{ T_STR mt_name; T_IPC_MT mt; T_STR subject; if (!TipcMsgGetType(data->msg, &mt)) {return
; /* error */
} if (!TipcMtGetName(mt, &mt_name)) {return
; /* error */
} if (!TipcMsgGetDest(data->msg, &subject)) {return
; /* error */
} TutOut("DEFAULT: Message type %s recvd by %s\n", mt_name, subject); }/* default_subject_cb */
/* =========================================================== */
/*...code from calling function is below */
T_CB cb; cb = TipcSrvSubjectDefaultCbCreate(default_subject_cb, NULL); if (cb == NULL) {return
; /* error */
}
TIBCO SmartSockets™ Application Programming Interface Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |