⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ictautil.c

📁 ICCP Toolkit 是在 Tru64下开发Tase.2通信协议的开发包
💻 C
📖 第 1 页 / 共 3 页
字号:
  }/************************************************************************//* findSimpleAccount:  search who accounts for selected nRef		*//************************************************************************/ICTA_SIMPLE_ACCT *findSimpleAccount(icInt nAcctRef, int who)  {ICTA_SIMPLE_ACCT *pstAcct, *pstAcctList;ICTA_REMOTE_INFO *pstRemote;ST_BOOLEAN          bDone = SD_FALSE;  pstRemote = pstVCC->remoteList;  while (pstRemote && !bDone)    {    if (who == ICTA_CLIENT)      pstAcctList = pstRemote->clientObj->accountList;    else      pstAcctList = pstRemote->serverObj->accountList;    pstAcct = pstAcctList;    while (pstAcct && !bDone)      {      if (pstAcct->nRef == nAcctRef)        bDone = SD_TRUE;      else        pstAcct = (ICTA_SIMPLE_ACCT *) list_get_next		  ((ST_VOID *)pstAcctList, (ST_VOID *)pstAcct);      }    pstRemote = (ICTA_REMOTE_INFO *) list_get_next		((ST_VOID *)pstVCC->remoteList, (ST_VOID *)pstRemote);    }  return pstAcct;  }/************************************************************************//* findMatrixAccount:  search remote matrix accounts for selected nRef	*//************************************************************************/ICTA_MATRIX_ACCT *findMatrixAccount(icInt nAcctRef, int who)  {ICTA_MATRIX_ACCT *pstMatrix, *pstMatrixList;ICTA_REMOTE_INFO *pstRemote;ST_BOOLEAN          bDone = SD_FALSE;  pstRemote = pstVCC->remoteList;  while (pstRemote && !bDone)    {    if (who == ICTA_CLIENT)      pstMatrixList = pstRemote->clientObj->matrixList;    else      pstMatrixList = pstRemote->serverObj->matrixList;    pstMatrix = pstMatrixList;    while (pstMatrix && !bDone)      {      if (pstMatrix->matrixRef == nAcctRef)        bDone = SD_TRUE;      else        pstMatrix = (ICTA_MATRIX_ACCT *) list_get_next		    ((ST_VOID *)pstMatrixList, (ST_VOID *)pstMatrix);      }    pstRemote = (ICTA_REMOTE_INFO *) list_get_next		((ST_VOID *)pstVCC->remoteList, (ST_VOID *)pstRemote);    }  return pstMatrix;  }/************************************************************************//*			pause_msg					*//* Function to display a message and wait for a key hit 		*//************************************************************************/ST_VOID pause_msg (ST_CHAR *str)  {#ifdef _WIN32  flush_keys ();  printf ("\n %s",str);  do_key_wait_service ();  flush_keys ();#else  flush_keys ();  printf ("\n %s",str);  while (!kbhit())    (*servefun) ();			/* execute background task	*/  flush_keys ();#endif  }/************************************************************************//* startInterval:  set current time for use in elapsed time calc	*//************************************************************************/void startInterval( void )  {  stimeInit();  beginTime = sGetMsTime ();  }/************************************************************************//* endInterval:  return elapsed time for the interval			*//************************************************************************/double endInterval( void )  {  endTime = sGetMsTime ();  return (endTime - beginTime);  }/************************************************************************//* findLink:  search remote link list for link name			*//************************************************************************/ICTA_LINK_INFO *findLink(ICTA_REMOTE_INFO *pstRemote, char *linkName)  {ICTA_LINK_INFO *pstLink;ST_BOOLEAN bFound = SD_FALSE;  pstLink = pstRemote->linkList;  while (pstLink && !bFound)    {    if (strcmp (pstLink->linkName, linkName) ==0)      bFound = SD_TRUE;    else      pstLink = (ICTA_LINK_INFO *) list_get_next		((ST_VOID *)pstRemote->linkList, (ST_VOID *)pstLink);    }  return pstLink;  }/************************************************************************//* freeVCC: free all allocated memory for the vcc			*//************************************************************************/void freeVCC (void)  {ICTA_REMOTE_INFO *pstRemote;ICTA_TRANSFER_INFO *pstTran;ICTA_VAR_LIST *pstVarList;ICTA_TA_CONDITION *pstCond;ICTA_MATRIX_ACCT *pstMatrix;ICTA_SIMPLE_ACCT *pstAcct;ICTA_DEVICE *pstDevice;ICTA_MSG_INFO *pstMsg;ICTA_VAR_INFO *pstVar;ICTA_LINK_INFO *pstLink;ICTA_TYPE *pstType;  pstRemote = pstVCC->remoteList;  while (pstRemote)    {    if (pstRemote->bIsClient)      {      pstTran = pstRemote->clientObj->tranGroupList;      while (pstTran)        {        pstVarList = pstTran->varList;        while (pstVarList)          {	  list_unlink ((ST_VOID **)&pstTran->varList, (ST_VOID *)pstVarList);	  chk_free (pstVarList);	  pstVarList = pstTran->varList;	  }	list_unlink ((ST_VOID **)&pstRemote->clientObj->tranGroupList, (ST_VOID *)pstTran);	chk_free (pstTran);	pstTran = pstRemote->clientObj->tranGroupList;	}      pstCond = pstRemote->clientObj->conditionList;      while (pstCond)        {	list_unlink ((ST_VOID **)&pstRemote->clientObj->conditionList, (ST_VOID *)pstCond);	chk_free (pstCond);        pstCond = pstRemote->clientObj->conditionList;	}      pstMatrix = pstRemote->clientObj->matrixList;      while (pstMatrix)        {	list_unlink ((ST_VOID **)&pstRemote->clientObj->matrixList, (ST_VOID *)pstMatrix);	chk_free (pstMatrix);        pstMatrix = pstRemote->clientObj->matrixList;	}      pstAcct = pstRemote->clientObj->accountList;      while (pstAcct)        {	list_unlink ((ST_VOID **)&pstRemote->clientObj->accountList, (ST_VOID *)pstAcct);	chk_free (pstAcct);        pstAcct = pstRemote->clientObj->accountList;	}      pstDevice = pstRemote->clientObj->devicesList;      while (pstDevice)        {	list_unlink ((ST_VOID **)&pstRemote->clientObj->devicesList, (ST_VOID *)pstDevice);	chk_free (pstDevice);        pstDevice = pstRemote->clientObj->devicesList;	}      pstMsg = pstRemote->clientObj->infoMsgsList;      while (pstMsg)        {	list_unlink ((ST_VOID **)&pstRemote->clientObj->infoMsgsList, (ST_VOID *)pstMsg);	chk_free (pstMsg);        pstMsg = pstRemote->clientObj->infoMsgsList;	}      pstVar = pstRemote->clientObj->variableList;      while (pstVar)        {	if (pstVar->varPtr)	  chk_free (pstVar->varPtr);#ifdef SISCO_THREADS	if (pstVar->extraPtr)	  chk_free (pstVar->extraPtr);#endif	list_unlink ((ST_VOID **)&pstRemote->clientObj->variableList, (ST_VOID *)pstVar);	chk_free (pstVar);        pstVar = pstRemote->clientObj->variableList;	}      chk_free (pstRemote->clientObj);      }		/* end if bIsClient			*/    if (pstRemote->bIsServer)      {      pstMatrix = pstRemote->serverObj->matrixList;      while (pstMatrix)        {	list_unlink ((ST_VOID **)&pstRemote->serverObj->matrixList, (ST_VOID *)pstMatrix);	chk_free (pstMatrix);        pstMatrix = pstRemote->serverObj->matrixList;	}      pstAcct = pstRemote->serverObj->accountList;      while (pstAcct)        {	list_unlink ((ST_VOID **)&pstRemote->serverObj->accountList, (ST_VOID *)pstAcct);	chk_free (pstAcct);        pstAcct = pstRemote->serverObj->accountList;	}      pstDevice = pstRemote->serverObj->devicesList;      while (pstDevice)        {	list_unlink ((ST_VOID **)&pstRemote->serverObj->devicesList, (ST_VOID *)pstDevice);	chk_free (pstDevice);        pstDevice = pstRemote->serverObj->devicesList;	}      pstMsg = pstRemote->serverObj->infoMsgsList;      while (pstMsg)        {	list_unlink ((ST_VOID **)&pstRemote->serverObj->infoMsgsList, (ST_VOID *)pstMsg);	chk_free (pstMsg);        pstMsg = pstRemote->serverObj->infoMsgsList;	}      pstVar = pstRemote->serverObj->variableList;      while (pstVar)        {	if (pstVar->varPtr)	  chk_free (pstVar->varPtr);#ifdef SISCO_THREADS	if (pstVar->extraPtr)	  chk_free (pstVar->extraPtr);#endif	list_unlink ((ST_VOID **)&pstRemote->serverObj->variableList, (ST_VOID *)pstVar);	chk_free (pstVar);        pstVar = pstRemote->serverObj->variableList;	}      chk_free (pstRemote->serverObj);      }		/* end if bIsClient			*/    pstLink = pstRemote->linkList;    while (pstLink)      {      list_unlink ((ST_VOID **)&pstRemote->linkList, (ST_VOID *)pstLink);      chk_free (pstLink);      pstLink = pstRemote->linkList;      }    list_unlink ((ST_VOID **)&pstVCC->remoteList, (ST_VOID *)pstRemote);    chk_free (pstRemote);    pstRemote = pstVCC->remoteList;    }  pstType = pstVCC->typeList;  while (pstType)    {    if (pstType->tdl)      chk_free (pstType->tdl);    list_unlink ((ST_VOID **)&pstVCC->typeList, (ST_VOID *)pstType);    chk_free (pstType);    pstType = pstVCC->typeList;    }  chk_free (pstVCC);  }/************************************************************************//* dummy function to satisfy MMS-EASE				*//************************************************************************/ST_CHAR *u_get_named_addr (NAMED_VAR *vardef)  {  return ((ST_CHAR *) u_get_named_addr);  }  /************************************************************************//* defAllObjForRemote: 							*//************************************************************************/void defAllObjForRemote (ICTA_REMOTE_INFO *pstRemote)  {  printf ("\nDefining All Objects for Remote %s", pstRemote->remoteName);  defAllLinksForRemote (pstRemote);  defAllVarsForRemote (pstRemote);  defAllTGForRemote (pstRemote);  defAllMsgForRemote (pstRemote);  defAllDevForRemote (pstRemote);  defAllTAForRemote (pstRemote);  }/************************************************************************//* defAllLinksForRemote: define all links for a remote			*//************************************************************************/static void defAllLinksForRemote (ICTA_REMOTE_INFO *pstRemote)  {ICTA_LINK_INFO *pstLink;icInt status;int i;icChar *tempRemotes[MAX_REMOTE_ARNAMES];icInt numRemAr = 0;  printf ("\nDefining All Links for Remote %s", pstRemote->remoteName);  ICA_Log_Flow1 ("Defining All Links for Remote %s", pstRemote->remoteName);  pstLink = pstRemote->linkList;  while (pstLink && !pstLink->bLinkDefined)    {    if (pstLink->nChannel == -1)      pstLink->nChannel = currChannelNum++;    if (bUseNewDefLink)      {      for (i = 0; i < MAX_REMOTE_ARNAMES; i++)        {        tempRemotes[i] = pstLink->remoteArs[i];        if (pstLink->remoteArs[i] != NULL)          numRemAr = i + 1;        }      status = icDefineLinkEx (pstRemote->remoteId, pstLink->nChannel,                               pstLink->localAr, tempRemotes, numRemAr,                                pstLink->nCriticalTimeout,                                (icUserData) pstLink, &pstLink->linkId);      }    else      {      status = icDefineLink(pstRemote->remoteId,      		            pstLink->nChannel,			    pstLink->localAr,			    pstLink->remoteArs[0],			    pstLink->remoteArs[1],			    pstLink->remoteArs[2],			    pstLink->remoteArs[3],			    pstLink->nCriticalTimeout,			    (icUserData) pstLink,			    &pstLink->linkId);      }    if (status)      {      ICA_Log_Err2("ERROR:  Define Link Status = %d %s\n",                    status, icPerror(status));      ICA_Log_ErrC2("       Local AR '%s' to Remote AR '%s'",                    pstLink->localAr, pstLink->remoteArs[0]);      }    else      {       pstLink->bLinkDefined = icTrue;       }	           pstLink = (ICTA_LINK_INFO *) list_get_next		  ((ST_VOID *)pstRemote->linkList, (ST_VOID *)pstLink);    }	/* end the while pstLink */  }/************************************************************************//* defAllVarsForRemote: define all variables for a remote		*//************************************************************************/static void defAllVarsForRemote (ICTA_REMOTE_INFO *pstRemote)  {ICTA_VAR_INFO *pstVar;icInt status;icTypeId theTypeId;  printf ("\nDefining All Vars for Remote %s", pstRemote->remoteName);  ICA_Log_Flow1 ("Defining All Variables for Remote %s", pstRemote->remoteName);  if (pstRemote->bIsServer)    {    pstVar = pstRemote->serverObj->variableList;    while (pstVar && !pstVar->bVarDefined)      {      if (pstVar->bUserType)        theTypeId = pstVar->pstType->typeId;      else        theTypeId = NULL;      if (!pstVar->varPtr)        initializeVar (pstVar);      status = icDefineServerVariable(pstRemote->remoteId,				      pstVar->varName,				      pstVar->varScope,				      pstVar->iccpType,				      theTypeId,				      pstVar->varPtr,				      pstVar->bWriteable,				      (icUserData) pstVar,				      &pstVar->varId,				      serverWriteCallBack,				      serverReadCallBack);      if (status)        {	ICA_Log_Err2("ERROR:  icDefineServerVariable status =%d %s",	              status, icPerror(status));	ICA_Log_ErrC1("       Var = %s", pstVar->varName);	}      else        pstVar->bVarDefined = icTrue;            pstVar = (ICTA_VAR_INFO *) list_get_next	       ((ST_VOID *)pstRemote->serverObj->variableList, (ST_VOID *)pstVar);      }    }  if (pstRemote->bIsClient)    {    pstVar = pstRemote->clientObj->variableList;    while (pstVar && !pstVar->bVarDefined)      {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -