Exemple #1
0
/*****************************************************************************
 *
 * FUNCTION: void centralIgnoreVarLogging
 *
 * DESCRIPTION:
 *
 * INPUTS:
 *
 * OUTPUTS: void
 *
 *****************************************************************************/
void centralIgnoreVarLogging(const char *varName)
{
  char *setMsgName;
  char *getMsgName;
  char *getSetMsgName;
  char *watchMsgName;
  
  setMsgName = (char *)x_ipcMalloc(1+strlen(varName)+strlen(VAR_SET_PREFIX));
  strcpy(setMsgName,VAR_SET_PREFIX);
  strcat(setMsgName,varName);
  Add_Message_To_Ignore(setMsgName);
  x_ipcFree(setMsgName);

  getMsgName = (char *)x_ipcMalloc(1+strlen(varName)+strlen(VAR_GET_PREFIX));
  strcpy(getMsgName,VAR_GET_PREFIX);
  strcat(getMsgName,varName);
  Add_Message_To_Ignore(getMsgName);
  x_ipcFree(getMsgName);
  
  getSetMsgName = (char *)x_ipcMalloc(1+strlen(varName)+ 
				    strlen(VAR_GET_SET_PREFIX));
  strcpy(getSetMsgName,VAR_GET_SET_PREFIX);
  strcat(getSetMsgName,varName);
  Add_Message_To_Ignore(getSetMsgName);
  x_ipcFree(getSetMsgName);
  
  watchMsgName = (char *)x_ipcMalloc(1+strlen(varName)+strlen(VAR_WATCH_PREFIX));
  strcpy(watchMsgName,VAR_WATCH_PREFIX);
  strcat(watchMsgName,varName);
  Add_Message_To_Ignore(watchMsgName);
  x_ipcFree(watchMsgName);
}
Exemple #2
0
DATA_MSG_PTR x_ipc_dataMsgFree(DATA_MSG_PTR dataMsg)
{
  if (dataMsg) {
    (dataMsg->refCount)--;
    if (dataMsg->refCount < 1) {
      if (dataMsg->dataRefCountPtr != NULL) {
	(*(dataMsg->dataRefCountPtr))--;
	if (*(dataMsg->dataRefCountPtr) < 1) {
	  /* Can now free the data. */
	  x_ipcFree((char *)dataMsg->dataRefCountPtr);
	  dataMsg->dataRefCountPtr = NULL;
 	  if ((dataMsg->msgData != NULL) &&
 	      (dataMsg->msgData != dataMsg->dataStruct)) {
	    x_ipcFree((char *)dataMsg->msgData);
	  }
	}
      }
      if (dataMsg->vec != NULL)
	x_ipcFree((char *)dataMsg->vec);
      dataMsg->vec = NULL;
      
      x_ipcFree((char *)dataMsg);
      LOCK_M_MUTEX;
      (GET_M_GLOBAL(DMFree))++;
      UNLOCK_M_MUTEX;
      dataMsg = NULL;
    }
  }
  return dataMsg;
}
Exemple #3
0
void _x_ipcRegisterHandlerL(const char *msgName, const char *hndName, 
			  X_IPC_HND_FN hndProc, HND_LANGUAGE_ENUM hndLanguage)
{
  HND_DATA_PTR hndData;
  HND_PTR hnd;
  
  if (!hndProc) {
    X_IPC_MOD_ERROR1("ERROR: x_ipcRegisterHandler: hndProc for %s is NULL.\n",
		hndName);
    return;
  }
  
  hndData = NEW(HND_DATA_TYPE);
  
  hndData->refId = 0; /* will be updated by selfRegisterHandler */
  /* Copy these -- they need to be saved */
  hndData->msgName = strdup(msgName);
  hndData->hndName = strdup(hndName);
  
  hnd = x_ipc_selfRegisterHnd(0, (MODULE_PTR)NULL, hndData, hndProc);
  hnd->hndLanguage = hndLanguage;
  
  if (x_ipcInform(X_IPC_REGISTER_HND_INFORM, (void *)hndData) == Success) {
    if (hnd->hndData != hndData) {
      x_ipcFree((void *)hndData->msgName);
      x_ipcFree((void *)hndData->hndName);
      x_ipcFree((void *)hndData);
    }
  }
}
Exemple #4
0
/******************************************************************************
 *
 * FUNCTION: void x_ipc_hashTableFree(HASH_TABLE_PTR table);
 *
 * DESCRIPTION:
 * Release memory used by hash table.  Does not release the memory for the 
 * items in the hash table.
 *
 *****************************************************************************/
static void x_ipc_hashElementFree(HASH_ELEM_PTR element)
{
  
  if (element != NULL) {
    x_ipc_hashElementFree(element->next);
    if (element->key) {
      x_ipcFree((char *) element->key);
      element->key = NULL;
    }
    x_ipcFree((char *) element);
  }
}
Exemple #5
0
static void FreeTokenList (TokenPtr TokenList)
{ 
  TokenPtr LastToken;
  
  while (TokenList) {
    LastToken = TokenList;
    TokenList = TokenList->next;
    if (LastToken->Type == STR_TOK)
      x_ipcFree(LastToken->value.str);
    x_ipcFree((char *)LastToken);
  }
}
Exemple #6
0
void x_ipc_idTableFree(ID_TABLE_PTR *table)
{
  if (table == NULL) return;
  if (*table) {
    if ((*table)->table) {
      
      x_ipcFree((char *)(*table)->table);
    }
    x_ipcFree((char *)*table);
  }
  *table=NULL;
}
Exemple #7
0
void x_ipc_hndDelete(HND_PTR hnd)
{
  HND_KEY_TYPE hndKey;
  LIST_PTR msgList;
  LIST_ELEM_PTR listTmp;
  MODULE_PTR module;
  MSG_PTR msg;
  
  if (hnd) {
    if (hnd->hndLanguage == UNKNOWN_LANGUAGE) return;
    
    hnd->hndLanguage = UNKNOWN_LANGUAGE;
    
    hnd->msg = NULL;
    msgList = hnd->msgList;
    hnd->msgList = NULL; /* to revent recursion of free's */
    x_ipc_listTestDeleteItemAll((LIST_ITER_FN) x_ipc_removeHndFromMsg, 
			  (char *)hnd, msgList);
    
    x_ipc_listFree(&msgList);
    
    LOCK_CM_MUTEX;
    (void)x_ipc_idTableRemove(hnd->localId, GET_C_GLOBAL(hndIdTable));
    /* Need to remove from the module list.   */
    if (GET_M_GLOBAL(moduleList) != NULL) {
      for (listTmp = GET_M_GLOBAL(moduleList)->first; 
	   (listTmp != NULL);
	   listTmp = listTmp->next
	   ) {
	module = (MODULE_PTR)(listTmp->item);
	x_ipc_listDeleteItemAll(hnd,module->hndList);
      }
    }
    if (hnd->hndData) {
      hndKey.num = hnd->sd;
      hndKey.str = hnd->hndData->hndName;
      x_ipc_hashTableRemove((char *)&hndKey, GET_C_GLOBAL(handlerTable));
      msg = GET_MESSAGE(hnd->hndData->msgName);
      if (msg) x_ipc_removeHndFromMsg(hnd, msg);
      x_ipcFree((char *)hnd->hndData->msgName);
      hnd->hndData->msgName = NULL;
      x_ipcFree((char *)hnd->hndData->hndName);
      hnd->hndData->hndName = NULL;
      x_ipcFree((char *)hnd->hndData);
      hnd->hndData = NULL;
    }
    UNLOCK_CM_MUTEX;
    hnd->hndData = NULL;
    
    x_ipcFree((char *)hnd);
  }
}
Exemple #8
0
void x_ipcDBFree(const char* file, int line, char *item)
{
#ifdef UNUSED_PRAGMA
#pragma unused(file, line)
#endif
  x_ipcFree(item);
}
Exemple #9
0
static void ipcDeleteTimer (TIMER_PTR timer)
{
  LOCK_M_MUTEX;
  x_ipc_listDeleteItem((const void *)timer, GET_M_GLOBAL(timerList));
  UNLOCK_M_MUTEX;
  x_ipcFree((char *)timer);
}
Exemple #10
0
static void setVarHnd(DISPATCH_PTR dispatch, void *varValue)
{
  GLOBAL_VAR_PTR var=NULL;
  const char *msgName = dispatch->msg->msgData->name;
  const char *varName;
  char *watchMsgName;
  
  varName = &(msgName[strlen(VAR_SET_PREFIX)]);
  
  var = (GLOBAL_VAR_PTR) x_ipc_hashTableFind(varName, GET_S_GLOBAL(varTable));
  if (var == NULL) {
    /* handle the error here. */
  } else {
    /* Free the old data if it exists */
    if (var->value != NULL)
      x_ipcFreeData(msgName,var->value);
    /* Store the pointer to the new data */
    var->value = varValue;
  }
  /* Need to do a x_ipcSuccess, if a command. */
  /*  centralSuccess(dispatch);*/
  /* Broadcast the result. */
  
  watchMsgName = (char *)x_ipcMalloc(1+strlen(varName)+strlen(VAR_WATCH_PREFIX));
  strcpy(watchMsgName,VAR_WATCH_PREFIX);
  strcat(watchMsgName,varName);

  centralBroadcast(watchMsgName,var->value);
  x_ipcFree(watchMsgName);
}
Exemple #11
0
static void recvMultiQueryMessage (DISPATCH_PTR dispatch)
{
  tapWhenSent(dispatch);
  /* 
   * Need to "park" the class data somewhere, so that it will not be freed
   * when a reply comes in.  Instead of adding another slot to "dispatch",
   * just reuse the "blockCom" slot
   */
  dispatch->blockCom = (BLOCK_COM_PTR)dispatch->classData;
  dispatch->classData = NULL;
  
  MULTI_QUERY_NUM(dispatch) = x_ipc_listLength(dispatch->msg->hndList);
  if (MULTI_QUERY_MAX(dispatch) > MULTI_QUERY_NUM(dispatch)) {
    MULTI_QUERY_MAX(dispatch) = MULTI_QUERY_NUM(dispatch);
  }
  
  if (MULTI_QUERY_MAX(dispatch) == 0) {
    sendMultiQueryTermination(dispatch);
    /* Free the class data, saved in "blockCom" slot */
    x_ipcFree((char *)dispatch->blockCom);
    dispatchFree(dispatch);
  } else {
    (void)x_ipc_listIterateFromLast((LIST_ITER_FN)processBroadcast, 
			      (char *)dispatch, 
			      dispatch->msg->hndList);
  }
}
Exemple #12
0
void x_ipc_hashTableFree(HASH_TABLE_PTR *table,HASH_ITER_FN iterFunc, void *param)
{
  int32 i;
  
  if (*table == NULL)
    return;
  
  if (iterFunc != NULL) 
    x_ipc_hashTableIterate(iterFunc, *table, param);
  
  for (i=0;i < (*table)->size;i++) {
    x_ipc_hashElementFree((*table)->table[i]);
  }
  x_ipcFree((char *)(*table)->table);
  x_ipcFree((char *)*table);
  *table = NULL;
}
Exemple #13
0
int32 x_ipc_hashItemsFree(const void *key, const void *item, void *ignore)
{
#ifdef UNUSED_PRAGMA
#pragma unused(key, ignore)
#endif
  if (item != NULL)
    x_ipcFree((char *)item);
  return 1;
}
Exemple #14
0
void x_ipc_strListFree(STR_LIST_PTR *strList, BOOLEAN freeString)
{
  int i;
  const char **strings;
  
  if (!(*strList))
    return;
  
  if (freeString) {
    for (i=0, strings=(*strList)->strings; i<(*strList)->length; 
	 i++, strings++) {
      x_ipcFree((char *)*strings);
    }
  }
  x_ipcFree((void *)(*strList)->strings);
  x_ipcFree((void *)(*strList));
  *strList = NULL;
}    
Exemple #15
0
/******************************************************************************
 *
 * FUNCTION: void x_ipc_globalMFree(void)
 *
 * DESCRIPTION: 
 * Free memory that x_ipc allocates in the module.
 *
 *****************************************************************************/
void x_ipc_globalMFree(void)
{
  if (mGlobalp()) {
    LOCK_M_MUTEX;
    x_ipc_listFreeAllItems((LIST_FREE_FN)x_ipcFree, 
		     GET_M_GLOBAL(dataMsgBufferList));
    x_ipc_listFree(&(GET_M_GLOBAL(dataMsgBufferList)));
    GET_M_GLOBAL(dataMsgBufferList) = NULL;
    x_ipc_listFree(&(GET_M_GLOBAL(Message_Ignore_Set)));
    GET_M_GLOBAL(Message_Ignore_Set) = NULL;
    
    x_ipc_hashTableFree(&GET_M_GLOBAL(classFormatTable),
		  (HASH_ITER_FN)x_ipc_classEntryFree, NULL);
    x_ipc_hashTableFree(&GET_M_GLOBAL(formatNamesTable),
		  (HASH_ITER_FN)x_ipc_formatFreeEntry, NULL);
    x_ipc_hashTableFree(&GET_M_GLOBAL(externalFdTable),x_ipc_hashItemsFree, NULL);
    
    if (GET_M_GLOBAL(logList)[0]) {
      x_ipcFree((char *)(GET_M_GLOBAL(logList)[0])->theFile);
      x_ipcFree((char *)GET_M_GLOBAL(logList)[0]);
    }
    GET_M_GLOBAL(logList)[0] = NULL;
    if (GET_M_GLOBAL(logList)[1]) {
      x_ipcFree((char *)(GET_M_GLOBAL(logList)[1])->theFile);
      x_ipcFree((char *)GET_M_GLOBAL(logList)[1]);
    }
    GET_M_GLOBAL(logList)[1] = NULL;

    x_ipc_freeContext(&GET_M_GLOBAL(currentContext));

    x_ipc_listCleanup();
    
    x_ipc_strListFree(&GET_M_GLOBAL(requiredResources), TRUE);

    x_ipcFree((char *)GET_M_GLOBAL(modNameGlobal));

    if (GET_M_GLOBAL(byteFormat)) x_ipc_freeFormatter(&GET_M_GLOBAL(byteFormat));
    if (GET_M_GLOBAL(charFormat)) x_ipc_freeFormatter(&GET_M_GLOBAL(charFormat));
    if (GET_M_GLOBAL(shortFormat)) x_ipc_freeFormatter(&GET_M_GLOBAL(shortFormat));
    if (GET_M_GLOBAL(intFormat)) x_ipc_freeFormatter(&GET_M_GLOBAL(intFormat));
    if (GET_M_GLOBAL(longFormat)) x_ipc_freeFormatter(&GET_M_GLOBAL(longFormat));
    if (GET_M_GLOBAL(floatFormat)) x_ipc_freeFormatter(&GET_M_GLOBAL(floatFormat));
    if (GET_M_GLOBAL(doubleFormat)) x_ipc_freeFormatter(&GET_M_GLOBAL(doubleFormat));

    x_ipc_listFreeAllItems((LIST_FREE_FN)x_ipcFree, GET_M_GLOBAL(timerList));
    x_ipc_listFree(&(GET_M_GLOBAL(timerList)));

#if defined(VXWORKS)
    x_ipcFree((char *)x_ipc_gM);
    x_ipc_gM = NULL;
#else
    x_ipc_globalMInit();
    x_ipcFree((char *)GET_M_GLOBAL(currentContext));
    bzero((char *)&x_ipc_gM,sizeof(x_ipc_gM));
    x_ipc_gM_ptr = NULL;
#endif
    UNLOCK_M_MUTEX;
  }
}
Exemple #16
0
static void x_ipc_listFreeMaster(LIST_PTR *list)
{
  if (!(*list))
    return;
  
  LOCK_LIST_MUTEX;
  x_ipc_listFreeMaster(&(*list)->freeList);
  x_ipcFree((char *)*list);
  *list = NULL;
  UNLOCK_LIST_MUTEX;
}    
Exemple #17
0
void *x_ipcReferenceData(X_IPC_REF_PTR ref)
{
  int32 refId, sd;
  MSG_PTR msg;
  char *msgData;
  X_IPC_REF_PTR waitRef;
  X_IPC_RETURN_VALUE_TYPE returnValue;

  msg = x_ipc_msgFind(X_IPC_REF_DATA_QUERY);
  if (msg == NULL) return NULL;

  if (!ref->msg) {
    if (!ref->name) {
      /* 17-Jun-91: fedor: start enforcing correct refs */
      X_IPC_MOD_ERROR1("ERROR: x_ipcReferenceData: Badly Formed Reference: %d\n",
		  ref->refId);
      return NULL;
    }
    ref->msg = x_ipc_msgFind(ref->name);
    if (ref->msg == NULL) return NULL;
  }

  /* 17-Jun-91: fedor: check if any message form */
  if (!ref->msg->msgData->msgFormat)
    return NULL;

  refId = x_ipc_nextSendMessageRef();
  returnValue = x_ipc_sendMessage((X_IPC_REF_PTR)NULL, msg,
				  (char *)&ref->refId, (char *)NULL, refId);

  if (returnValue != Success) {
    X_IPC_MOD_ERROR("ERROR: x_ipcReferenceData: x_ipc_sendMessage Failed.\n");
    return NULL;
  }

  waitRef = x_ipcRefCreate(ref->msg, ref->name, refId);

  msgData = (char *)x_ipcMalloc((unsigned)x_ipc_dataStructureSize(ref->msg->msgData->msgFormat));

  LOCK_CM_MUTEX;
  sd = GET_C_GLOBAL(serverRead);
  UNLOCK_CM_MUTEX;
  returnValue = x_ipc_waitForReplyFrom(waitRef, msgData, TRUE, WAITFOREVER, sd);

  x_ipcRefFree(waitRef);

  if (returnValue == NullReply) {
    /* 17-Jun-91: fedor: if NullReply then nothing else was malloced. */
    x_ipcFree(msgData);
    return NULL;
  }
  else
    return msgData;
}
Exemple #18
0
void x_ipcUnwatchVar(const char *varName)
{
  char *watchMsgName;
  
  watchMsgName = (char *)x_ipcMalloc(1+strlen(varName)+strlen(VAR_WATCH_PREFIX));
  strcpy(watchMsgName,VAR_WATCH_PREFIX);
  strcat(watchMsgName,varName);
  
  /* Unregister the tap messages and handler */
  x_ipcDeregisterHandler(watchMsgName,watchMsgName);
  x_ipcFree(watchMsgName);
}
Exemple #19
0
static void x_ipc_terminalLogVarHnd(X_IPC_REF_PTR Ref, LOG_PTR log)
{
#ifdef UNUSED_PRAGMA
#pragma unused(Ref)
#endif
  LOCK_M_MUTEX;
  if (GET_M_GLOBAL(logList)[1] != NULL)
    x_ipcFree((void *)GET_M_GLOBAL(logList)[1]);
  GET_M_GLOBAL(logList)[1] = log;
  GET_M_GLOBAL(logList)[2] = NULL;
  UNLOCK_M_MUTEX;
}
Exemple #20
0
static void x_ipc_freeContext(X_IPC_CONTEXT_PTR *context)
{
  if (!*context) return;

  x_ipcFree((char *)(*context)->servHostGlobal);
  
  x_ipc_freeContextList(&((*context)->queryNotificationList));
  x_ipc_freeContextList(&((*context)->connectNotifyList));
  x_ipc_freeContextList(&((*context)->disconnectNotifyList));
  x_ipc_freeContextList(&((*context)->changeNotifyList));
  LOCK_M_MUTEX;
  x_ipcRefFree(GET_M_GLOBAL(x_ipcRootNodeGlobal));
  GET_M_GLOBAL(x_ipcRootNodeGlobal) = NULL;
  UNLOCK_M_MUTEX;
  x_ipc_freeContextList(&((*context)->x_ipcRefFreeList));
  
  x_ipc_hashTableFree(&((*context)->moduleConnectionTable),
		      x_ipc_hashItemsFree, NULL);
  x_ipc_hashTableFree(&((*context)->handlerTable),
		      (HASH_ITER_FN) x_ipc_hndFree, NULL);
  x_ipc_hashTableFree(&((*context)->messageTable),
		      (HASH_ITER_FN) x_ipc_msgFree, NULL);
  x_ipc_hashTableFree(&((*context)->resourceTable),x_ipc_hashItemsFree, NULL);
  x_ipc_idTableFree(&(*context)->hndIdTable);
  x_ipc_idTableFree(&(*context)->msgIdTable);
  x_ipc_listFreeAllItems((LIST_FREE_FN)x_ipc_dataMsgFree,
			 (*context)->pendingReplies);
  x_ipc_listFree(&((*context)->pendingReplies));
  (*context)->pendingReplies = NULL;
  x_ipcFree((char *)(*context)->msgQueue.messages);
  initMsgQueue(&(*context)->msgQueue);
  x_ipc_strListFree(&((*context)->tappedMsgs),TRUE);
  x_ipc_strListFree(&((*context)->broadcastMsgs),TRUE);
  
  x_ipc_listFree(&((*context)->queryNotificationList));
  
  x_ipcFree((char *)*context);
  *context = NULL;
}
Exemple #21
0
void x_ipcFreeVar(const char *varName, void *varData)
{
  char *getMsgName;

  getMsgName = (char *)x_ipcMalloc(1+strlen(varName)+strlen(VAR_GET_PREFIX));
  strcpy(getMsgName,VAR_GET_PREFIX);
  strcat(getMsgName,varName);

  x_ipcFreeReply(getMsgName, varData);

  x_ipcFree(getMsgName);

}
Exemple #22
0
static FORMAT_PTR Named_Format(Format_Parse_Ptr parser, TokenPtr Token)
{ 
  NAMED_FORMAT_PTR namedFormat;
  FORMAT_PTR format;
  
  if (parser->formatStack == NULL) {
    parser->formatStack = x_ipc_strListCreate();
  }
  
  if (x_ipc_strListMemberItem(Token->value.str, parser->formatStack)) {
    /* found a recursive definition. just return pointer */
    return new_n_formatter(Token->value.str);
  }
  
  x_ipc_strListPush(strdup(Token->value.str), parser->formatStack);

  LOCK_M_MUTEX;
  namedFormat = 
    (NAMED_FORMAT_PTR)x_ipc_hashTableFind(Token->value.str,
				    GET_M_GLOBAL(formatNamesTable));
  UNLOCK_M_MUTEX;
  if (!namedFormat) {
#ifdef NMP_IPC
    if (GET_C_GLOBAL(serverRead) != CENTRAL_SERVER_ID) {
      if (x_ipcQueryCentral(X_IPC_NAMED_FORM_QUERY,
			  &Token->value.str, &format) != Success ||
	  !format) {
        X_IPC_MOD_WARNING2("Warning: Named Format %s is not registered\n%s\n",
			   Token->value.str, parser->ParseString);
        format = new_f_formatter(BadFormatFMT, NULL);
      }
    } else
#endif
      {
	X_IPC_MOD_WARNING2("Warning: Named Format %s is not registered\n%s\n",
			   Token->value.str, parser->ParseString);
	format = new_f_formatter(BadFormatFMT, NULL);
      }
  } else {
    /* Need to use the named formatter -- parse it now */
    if (!namedFormat->parsed) {
      namedFormat->format = 
	(FORMAT_PTR)ParseFormatString(namedFormat->definition);
      namedFormat->parsed = TRUE;
    }
    format = copyFormatter(namedFormat->format);
  }
  
  x_ipcFree((void *)x_ipc_strListPopItem(parser->formatStack));
  return format;
}
Exemple #23
0
const void *x_ipc_hashTableRemove(const void *key, HASH_TABLE_PTR table)
{
  EQ_HASH_FN eq;
  const char *oldData;
  int32 hash, location;
  HASH_ELEM_PTR previous, current;
  
  hash = (*table->hashFunc)(key);
  location = hash % table->size;
  
  eq = table->eqFunc;
  
  previous = table->table[location];
  if (!previous)
    return NULL;
  
  if ((*eq)(previous->key, key)) {
    table->table[location] = previous->next;
    oldData = previous->data;
    x_ipcFree((char *)previous->key);
    x_ipcFree((char *)previous);
    return oldData;
  }
  current = previous->next;
  while (current) {
    if ((*eq)(current->key, key)) {
      oldData = current->data;
      previous->next = current->next;
      x_ipcFree((char *)current->key);
      x_ipcFree((char *)current);
      return oldData;
    }
    previous = current;
    current = current->next;
  }
  
  return NULL;
}
Exemple #24
0
X_IPC_RETURN_VALUE_TYPE _x_ipcGetVar(const char *varName, void *value)
{
  char *getMsgName;
  X_IPC_RETURN_VALUE_TYPE result;
  
  getMsgName = (char *)x_ipcMalloc(1+strlen(varName)+strlen(VAR_GET_PREFIX));
  strcpy(getMsgName,VAR_GET_PREFIX);
  strcat(getMsgName,varName);
  
  result = x_ipcQuery(getMsgName, NULL, value);

  x_ipcFree(getMsgName);
  return result;
}
Exemple #25
0
void x_ipcRefFree(X_IPC_REF_PTR x_ipcRef)
{
  if (x_ipcRef) {
    x_ipcRef->refId = 0;
    x_ipcRef->msg = NULL;

    x_ipcFree((char *)x_ipcRef->name);
    x_ipcRef->name = NULL;

    LOCK_CM_MUTEX;
    x_ipc_listInsertItemFirst((char *)x_ipcRef, GET_C_GLOBAL(x_ipcRefFreeList));
    UNLOCK_CM_MUTEX;
  }
}
Exemple #26
0
/*****************************************************************************
 *
 * FUNCTION: void centralSetVar
 *
 * DESCRIPTION:
 *
 * INPUTS:
 *
 * OUTPUTS: void
 *
 *****************************************************************************/
void centralSetVar(const char *varName, const char *value)
{
  char *setMsgName;

  if (!mGlobalp())
    return;
  
  setMsgName = (char *)x_ipcMalloc(1+strlen(varName)+strlen(VAR_SET_PREFIX));
  strcpy(setMsgName,VAR_SET_PREFIX);
  strcat(setMsgName,varName);
  
  centralInform(setMsgName, value);
  x_ipcFree(setMsgName);
}
Exemple #27
0
void multiQueryUpdate(DISPATCH_PTR dispatch, int32 logStatus)
{
  --MULTI_QUERY_NUM(dispatch);
  --MULTI_QUERY_MAX(dispatch);
  if (MULTI_QUERY_MAX(dispatch) == 0) {
    sendMultiQueryTermination(dispatch);
  } else if (logStatus && MULTI_QUERY_MAX(dispatch) < 0) {
    LOG_STATUS("    MultiQuery: Max replies already received; this reply not actually sent\n");
  }
  if (MULTI_QUERY_NUM(dispatch) == 0) {
    /* Free the class data, saved in "blockCom" slot */
    x_ipcFree((char *)dispatch->blockCom);
  }
}
Exemple #28
0
X_IPC_RETURN_VALUE_TYPE _x_ipcSetVar(const char *varName, const void *value)
{
  char *setMsgName;
  X_IPC_RETURN_VALUE_TYPE result;
  
  setMsgName = (char *)x_ipcMalloc(1+strlen(varName)+strlen(VAR_SET_PREFIX));
  strcpy(setMsgName,VAR_SET_PREFIX);
  strcat(setMsgName,varName);
  
  /*  x_ipcExecuteCommandAsync(setMsgName, value);*/
  result = x_ipcInform(setMsgName, value);

  x_ipcFree(setMsgName);
  return result;
}
Exemple #29
0
static void x_ipc_msgFreeMsg(MSG_PTR msg)
{
  LIST_PTR hndList;

  if (msg) {
    if (msg->direct == -1) return;
    msg->direct = -1; /* Flag that msg has already been freed */

    if ((msg)->hndList != NULL) {
      hndList = (msg)->hndList;
      (msg)->hndList = NULL;
      x_ipc_listFree(&hndList);
    }
    freeDirectList(msg);
    if (msg->msgData) {
      x_ipcFree((char *)msg->msgData->name);
      x_ipc_freeFormatter(&(msg->msgData->msgFormat));
      x_ipc_freeFormatter(&(msg->msgData->resFormat));
      x_ipcFree((char *)msg->msgData);
    }
    x_ipcFree((char *)(msg));
    msg = NULL;
  }
}
Exemple #30
0
static void strListIncrement(STR_LIST_PTR strList)
{
  int newListSize, currentSize;
  const char **newList;

  currentSize = strList->size;
  newListSize = currentSize + STR_LIST_INC;
  newList = (const char **)x_ipcMalloc(newListSize*sizeof(char *));
  bzero((char *)newList, newListSize*sizeof(char *));
  if (currentSize > 0) {
    /* Copy Old List */
    BCOPY(strList->strings, newList, currentSize*sizeof(char *));
    x_ipcFree((char *)strList->strings);
  }
  strList->size = newListSize;
  strList->strings = newList;
}