TipcSrvConnSubjectDefaultCbCreate


Name

TipcSrvConnSubjectDefaultCbCreate — create a default subject callback

Synopsis

T_CB TipcSrvConnSubjectDefaultCbCreate(srv, func, arg) 
T_IPC_SRV srv; 
T_IPC_SRV_SUBJECT_CB_FUNC func; 
T_CB_ARG arg; 

Arguments

srv — connection handle to RTserver

func — callback function

arg — user-defined argument to pass to func

Return Values

New callback if successful, NULL otherwise.

Diagnostics

If TipcSrvConnSubjectDefaultCbCreate fails, it returns NULL and sets the global SmartSockets error number to one of:

Description

TipcSrvConnSubjectDefaultCbCreate creates a default subject callback. Callbacks are called by TipcSrvConnMsgProcess 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.

Caution

The T_ENTRY declaration specifier is required in the definition of all callback functions as well as their prototypes.

See Also

TipcSrvConnSubjectCbCreate, TipcSrvConnSubjectCbLookup, TipcSrvConnSubjectDefaultCbLookup

Examples

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 */ 
 
cb = TipcSrvConnSubjectDefaultCbCreate(srv, 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