示例#1
0
IPC_RETURN_TYPE IPC_respond (MSG_INSTANCE msgInstance, const char *msgName,
			     unsigned int length, BYTE_ARRAY content)
{
  MSG_PTR msg;
  void *replyData;
  IPC_VARCONTENT_TYPE vc;

  if (!msgName || strlen(msgName) == 0) {
    RETURN_ERROR(IPC_Null_Argument);
  } else if (!msgInstance) {
    RETURN_ERROR(IPC_Null_Argument);
  } else if (!X_IPC_CONNECTED()) {
    RETURN_ERROR(IPC_Not_Connected);
  } else {
    msg = x_ipc_msgFind(msgName);
    if (!msg) {
      RETURN_ERROR(IPC_Message_Not_Defined);
    } else if (ipcDataToSend(msg->msgData->msgFormat, msgName, 
			     length, content, &replyData, &vc) != IPC_OK) {
      PASS_ON_ERROR();
    } else {
      return ipcReturnValue(x_ipc_sendResponse(msgInstance, msg,
					       (char *)replyData,
					       ReplyClass, NULL,
					       msgInstance->responseSd));
    }
  }
}
示例#2
0
文件: ipc.c 项目: Paresh1693/carmen
IPC_RETURN_TYPE IPC_publish (const char *msgName,
			     unsigned int length, BYTE_ARRAY content)
{
  MSG_PTR msg;
  CONST_FORMAT_PTR format;
  void *dataToSend;
  IPC_VARCONTENT_TYPE vc;

  if (!msgName || strlen(msgName) == 0) {
    RETURN_ERROR(IPC_Null_Argument);
  } else if (!X_IPC_CONNECTED()) {
    RETURN_ERROR(IPC_Not_Connected);
  } else {
    msg = x_ipc_msgFind(msgName);
    if (!msg) {
      RETURN_ERROR(IPC_Message_Not_Defined);
    } else {
      format = msg->msgData->msgFormat;
      if (ipcDataToSend(format, msgName, length, content, &dataToSend, &vc)
	  != IPC_OK) {
	PASS_ON_ERROR();
      } else {
	return ipcReturnValue(x_ipcBroadcast(msgName, dataToSend));
      }
    }
  }
}
示例#3
0
IPC_RETURN_TYPE IPC_queryNotify (const char *msgName,
				 unsigned int length, BYTE_ARRAY content,
				 HANDLER_TYPE handler, void *clientData)
{
  MSG_PTR msg;
  void *queryData;
  IPC_VARCONTENT_TYPE vc;

  if (!msgName || strlen(msgName) == 0) {
    RETURN_ERROR(IPC_Null_Argument);
  } else if (!X_IPC_CONNECTED()) {
    RETURN_ERROR(IPC_Not_Connected);
  } else {
    msg = x_ipc_msgFind(msgName);
    if (msg == NULL) {
      RETURN_ERROR(IPC_Message_Not_Defined);
    } else if (ipcDataToSend(msg->msgData->msgFormat, msgName, 
			     length, content, &queryData, &vc) != IPC_OK) {
      PASS_ON_ERROR();
    } else {
      return ipcReturnValue(x_ipc_queryNotifySend(msg, msgName, queryData,
						  (REPLY_HANDLER_FN)handler, 
						  clientData));
    }
  }
}