Exemple #1
0
DISPATCH_PTR dispatchCopy(DISPATCH_PTR dispatch)
{
  DISPATCH_PTR newDispatch;
  int32 locId;
  
  newDispatch = dispatchAllocate();
  locId = newDispatch->locId;
  
  BCOPY((char *)dispatch, (char *)newDispatch, sizeof(DISPATCH_TYPE));
  
  DISPATCH_MSG_DATA(newDispatch) = NULL;
  dispatchSetMsgData(DISPATCH_MSG_DATA(dispatch), newDispatch);
  newDispatch->locId = locId;
  
  return newDispatch;
}
Exemple #2
0
void blockingCommandReply(DISPATCH_PTR dispatch, X_IPC_MSG_CLASS_TYPE msg_class)
{
  DISPATCH_PTR replyDispatch;
  
  replyDispatch = dispatchAllocate();
  replyDispatch->msg = dispatch->msg;
  
  replyDispatch->org = dispatch->org;
  replyDispatch->orgId = dispatch->orgId;
  
  replyDispatch->refId = dispatch->refId;
  
  DISPATCH_SET_STATUS(AttendingDispatch, replyDispatch);
  
  centralReply(replyDispatch, (char *)&msg_class);
}
Exemple #3
0
DISPATCH_PTR buildDispatchInternal(MSG_PTR msg, DATA_MSG_PTR dataMsg,
				   void *classData, 
				   DISPATCH_PTR parentDispatch,
				   RESP_PROC_FN resProc, void *resData)
{
  int32 savedRef;
  DISPATCH_PTR dispatch;
  
  if (!msg) {
    X_IPC_ERROR("ERROR: sendDataMsg: NULL msg.\n");
  }
  
  /* save the message ref to use in case x_ipc_msgFind triggers 
     a recursive call to x_ipc_sendMessage */
  savedRef = x_ipc_nextSendMessageRef();
  
  dispatch = dispatchAllocate();
  dispatch->msg = msg;
  
  dispatch->org = GET_S_GLOBAL(x_ipcServerModGlobal);
  dispatch->orgId = GET_C_GLOBAL(serverWrite);
  
  dispatch->refId = savedRef;
  
  dispatchSetMsgData(dataMsg, dispatch);
  
  if (resProc) {
    dispatch->respProc = resProc;
    dispatch->respData = (char *)resData;
  }
  
  if (parentDispatch)
    dispatch->pRef = parentDispatch->locId;
  
  dispatch->msg_class = msg->msgData->msg_class;
  dispatch->classData = (char *)classData;
  
  return dispatch;
}
Exemple #4
0
void recvMessageBuild(MODULE_PTR module, DATA_MSG_PTR dataMsg)
{
  char *classData;
  MSG_PTR msg = NULL;
  
  DISPATCH_PTR dispatch;
  X_IPC_MSG_CLASS_TYPE msg_class;
  CLASS_FORM_PTR classForm;
  
  CONST_FORMAT_PTR classFormat = NULL;
  
  if (dataMsg->intent != NO_REF)
    msg = (MSG_PTR)idTableItem(ABS(dataMsg->intent), GET_C_GLOBAL(msgIdTable));
  
  msg_class = (X_IPC_MSG_CLASS_TYPE)dataMsg->classId;
  classForm = GET_CLASS_FORMAT(&msg_class);
  
  if (classForm)
    classFormat = classForm->format;
  
  classData = (char *)x_ipc_dataMsgDecodeClass(classFormat, dataMsg);
  
  if (dataMsg->dispatchRef != NO_REF) {
    dispatch = DISPATCH_FROM_ID(dataMsg->dispatchRef);
  } else {
    dispatch = dispatchAllocate();
    dispatch->msg = msg;
    
    dispatch->org = module;
    dispatch->orgId = module->readSd;
    
    dispatch->refId = dataMsg->msgRef;
    dispatch->pRef = dataMsg->parentRef;
  }
  
  if (dispatch == NULL)
    /* Probably a reply that was not needed */
    return;
  
  if (dataMsg->msgRef == NO_REF)
    dispatchSetResData(dataMsg, dispatch);
  else 
    dispatchSetMsgData(dataMsg, dispatch);
  
  
  /* 22-May-91: fedor: NOTE: class and classData will change if this
     is a previously created dispatch. This may be undesired for
     behavior for a x_ipc_sendResponse call that refers to a previously
     created dispatch. */
  /*  3-Jul-91: reid: Clean up previous class data, 
      except for command class data, which is stored in blockCom */
  if (dispatch->classData && dispatch->msg_class != CommandClass) 
    x_ipc_classDataFree(dispatch->msg_class, dispatch->classData);

  /* RGS 1/11/01: This prevents a reply from being sent when it shouldn't be.
     The problem is that with IPC, one can have a message sent to a query
     handler without expecting a reply (e.g, using a broadcast rather than
     a QueryClass). */
  if (msg_class == ReplyClass && 
      (dispatch->msg_class != QueryClass &&
       dispatch->msg_class != MultiQueryClass)) {
    msg_class = SuccessClass;
  }

  dispatch->msg_class = msg_class;
  dispatch->classData = classData;
  
  recvMessage(dispatch, msg_class, classData);
}