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

📄 ictatest.c

📁 ICCP Toolkit 是在 Tru64下开发Tase.2通信协议的开发包
💻 C
📖 第 1 页 / 共 4 页
字号:
  ICA_Log_Flow1("\nClientInfoMessageReciept for message %d", pstInfo->nRef);  if (status == IC_OK)    pstInfo->numHits++;  }/************************************************************************//* ctSendMsgCallBack:  called by API when receive req of Info Message 	*//*		       Objects 						*//************************************************************************/void ctSendMsgCallBack(icInt status, icLinkId linkId, icBoolean startTransfer,    		      icUserData usrData)  {ICTA_MSG_INFO *pstInfo;  pstInfo = (ICTA_MSG_INFO *) usrData;  if (bCompTestVerbose)    printf("\nServer IMTransfer Start %d", pstInfo->nRef);  ICA_Log_Flow1("\nServer IMTransfer Start %d", pstInfo->nRef);  }/************************************************************************//* ctSelectDevInd:  server receives select device indication		*//************************************************************************/void ctSelectDevInd(icRemoteId remoteId, icUserData ud)  {ICTA_DEVICE *pstDevice;icInt status;  pstDevice = (ICTA_DEVICE *)ud;  if (bCompTestVerbose)    printf("\nServerSelectDeviceIndication %s", pstDevice->name);  ICA_Log_Flow1("\nServerSelectDeviceIndication %s", pstDevice->name);  pstDevice->checkBackId++;  pstDevice->numSelect++;  IC_UNLOCK_SEM;  status = icSelectResponse(pstDevice->deviceId,    			    pstDevice->checkBackId,			    icssSelectOk);  IC_LOCK_SEM;  if (status)    {    if (bCompTestVerbose)      printf("\nSelect Device Response Failed - see log file for details");    ICA_Log_Err3("ERROR:  select device response%s status =%d %s",                  pstDevice->name, status, icPerror(status));    }  }/************************************************************************//* ctOperateDevInd:  server received an operate device indication		*//************************************************************************/void ctOperateDevInd(icRemoteId remoteId, icDeviceValue value, icUserData ud)  {ICTA_DEVICE *pstDevice;icInt status;  pstDevice = (ICTA_DEVICE *)ud;  if (bCompTestVerbose)    printf("\nServerOperateDeviceIndication %s", pstDevice->name);  ICA_Log_Flow1("\nServerOperateDeviceIndication %s", pstDevice->name);  pstDevice->numOperate++;  IC_UNLOCK_SEM;  status = icOperateResponse(pstDevice->deviceId, icosOperateOk);  IC_LOCK_SEM;  if (status)    {    if (bCompTestVerbose)      printf("\nOperate Device Response Failed - see log file for details");    ICA_Log_Err3("ERROR:  operate device response%s status =%d %s",                  pstDevice->name, status, icPerror(status));    }  }/************************************************************************//* ctSelectDevConf:  the client received a select device confirmation	*//************************************************************************/void ctSelectDevConf (icSelectStatus status, icCheckbackID checkbackID,                    icUserData ud)  {ICTA_DEVICE *pstDevice, *pstTempDev;ICTA_REMOTE_INFO *pstRemote;ICTA_LINK_INFO *pstLink;icInt stat;icBoolean bFound = icFalse;  pstDevice = (ICTA_DEVICE *)ud;  if (bCompTestVerbose)    printf("\nClientSelectDeviceConfirmation %s", pstDevice->name);  ICA_Log_Flow1("\nClientSelectDeviceConfirmation %s", pstDevice->name);    if (status == icssSelectOk)    {    pstDevice->numSelect++;    /* you need a remote pointer	*/    pstRemote = pstVCC->remoteList;	/* if you get here a server is valid */    while (pstRemote && !bFound)      {      pstTempDev = pstRemote->clientObj->devicesList;      while (pstTempDev && !bFound)        {	if (pstTempDev == pstDevice)	  bFound = icTrue;	else	  pstTempDev = (ICTA_DEVICE *) list_get_next		       ((ST_VOID *)pstRemote->clientObj->devicesList, (ST_VOID *)pstTempDev);	}      if (!bFound)        pstRemote = (ICTA_REMOTE_INFO *) list_get_next		    ((ST_VOID *)pstVCC->remoteList, (ST_VOID *)pstRemote);      }    if (bFound)      {      pstDevice->checkBackId = checkbackID;      pstLink = pstRemote->linkList;		/* always use the first link */      if (pstLink)        {        stat = icOperateDevice(pstDevice->deviceId,   			         pstLink->linkId,			         pstDevice->value,			         ctOperateDevConf,			         (icUserData) pstDevice);        if (stat)          {	  if (bCompTestVerbose)            printf("\nOperate Device Status %d '%s'", status, icPerror(status));          ICA_Log_Err3("ERROR:  operate device %s status =%d %s",                       pstDevice->name, status, icPerror(status));          }        }      }    }  else    pstDevice->numErrors++;  }/************************************************************************//* ctOperateDevConf:  the client receive an operate device confirmation	*//************************************************************************/void ctOperateDevConf (icOperStatus status, icUserData ud)  {ICTA_DEVICE *pstDevice;  pstDevice = (ICTA_DEVICE *)ud;  if (bCompTestVerbose)    printf("\nClientOperateDeviceConfirmation %s", pstDevice->name);  ICA_Log_Flow1("\nClientOperateDeviceConfirmation %s", pstDevice->name);  if (status == icosOperateOk)    pstDevice->numOperate++;  else    pstDevice->numErrors++;  }      /************************************************************************//* ctRecvTACallBack:  called when received requested  TranAcct object	*//*						(client function)	*//************************************************************************/void ctRecvTACallBack (icInt status,   		      icChar condition, 		      icInt requestId,		      icGMTBasedSType timeStamp, 		      icReferenceNumType *localRefPtr,		      icTypeAccountHeader *accountHdrPtr, 		      void *accountValPtr,		      icTypeTransmissionSeg *segmentHdrPtr, 		      void *segmentValPtr,		      icUserData data)  {ICTA_SIMPLE_ACCT *pstAcct;  pstAcct = (ICTA_SIMPLE_ACCT *)data;  if (bCompTestVerbose)    printf("\nClientTransferAccountCallBack %d", pstAcct->nRef);  ICA_Log_Flow1("\nClientTransferAccountCallBack %d", pstAcct->nRef);  if (status == IC_OK)    pstAcct->numHits++;  else    pstAcct->numErrors++;  }/************************************************************************//* ctSendTACallBack:  called by API when received request of Transfer 	*//*		    Account Objects     (server function)		*//************************************************************************/void ctSendTACallBack (icInt status,    		       icLinkId lp,    		       icInt requestId,    		       icScheduleTimeType startTime,    		       icDurationType duration,    		       icInt reference,    		       icChar conditionRequested,    		       icUserData data)  {ICTA_SIMPLE_ACCT *pstAcct, *pstTempAcct;ICTA_REMOTE_INFO *pstRemote;icBoolean bFound = icFalse;  pstAcct = (ICTA_SIMPLE_ACCT *) data;  if (bCompTestVerbose)    printf("\nServerAccountRequestCallBack %d", pstAcct->nRef);  ICA_Log_Flow1("\nServerAccountRequestCallBack %d", pstAcct->nRef);  if (status == IC_OK)    {    pstAcct->numRequests++;    pstRemote = pstVCC->remoteList;	/* if you get here a server is valid */    while (pstRemote && !bFound)      {      pstTempAcct = pstRemote->serverObj->accountList;      while (pstTempAcct && !bFound)        {	if (pstTempAcct == pstAcct)	  bFound = icTrue;	else	  pstTempAcct = (ICTA_SIMPLE_ACCT *) list_get_next			((ST_VOID *)pstRemote->serverObj->accountList, (ST_VOID *)pstTempAcct);	}      if (!bFound)        pstRemote = (ICTA_REMOTE_INFO *) list_get_next		    ((ST_VOID *)pstVCC->remoteList, (ST_VOID *)pstRemote);      }    if (bFound)      {      if (!bMultiThreads)        doSendAcct(pstAcct, pstRemote->linkList, requestId);      }    else      pstAcct->numErrors++;    }  else    pstAcct->numErrors++;  ICA_Log_Flow1("\nEnd ServerAccountRequestCallBack %d", pstAcct->nRef);  }/************************************************************************//* ctTACondCallBack:   called by API when received request of Transfer 	*//*                     Account condition 	(server function)	*//************************************************************************/void ctTACondCallBack (icInt status, icLinkId lp,		      icChar conditions, icUserData data)  {ICTA_SIMPLE_ACCT *pstAcct;  pstAcct = (ICTA_SIMPLE_ACCT *) data;  if (status == IC_OK)    pstAcct->numConditionHits++;  else    pstAcct->numConditionErrs++;  }/************************************************************************//* logCompTestResults:							*//************************************************************************/void logCompTestResults(void)  {  ICA_Log_Always0 ("ICCP TestApplication Comprehensive Test Results:");  ICA_Log_CAlways1("StartTime:  %s", ctime(&compStartTime));  ICA_Log_CAlways1(" End Time:  %s", ctime(&compStopTime));  ICA_Log_CAlways1(" Duration:  %d seconds", (compStopTime - compStartTime));  ICA_Log_CAlways0("  ");  doResultsDetail();  }/************************************************************************//* doResultsDetail:							*//************************************************************************/static void doResultsDetail (void)  {ICTA_REMOTE_INFO *pstRemote;ICTA_VAR_INFO *pstVar;ICTA_MSG_INFO *pstMsg;ICTA_DEVICE *pstDevice;ICTA_SIMPLE_ACCT *pstAcct;  pstRemote = pstVCC->remoteList;  while (pstRemote)    {    if (pstRemote->bIsServer)      {      ICA_Log_CAlways0("ServerVariableName          NumReads NumWrite NumErrors");      pstVar = pstRemote->serverObj->variableList;      while (pstVar)        {        ICA_Log_CAlways4(" %-25s         %d        %d         %d", 	                 pstVar->varName, pstVar->numReads, pstVar->numWrites, pstVar->numErrors);        pstVar = (ICTA_VAR_INFO *) list_get_next		 ((ST_VOID *)pstRemote->serverObj->variableList, (ST_VOID *)pstVar);        }      ICA_Log_CAlways0("  ");      ICA_Log_CAlways0("ServerMessageID       NumHits      NumErrors");      pstMsg = pstRemote->serverObj->infoMsgsList;      while (pstMsg)        {        ICA_Log_CAlways3("      %d                %d          %d", 	                  pstMsg->nRef, pstMsg->numHits, pstMsg->numErrors);        pstMsg = (ICTA_MSG_INFO *) list_get_next		 ((ST_VOID *)pstRemote->serverObj->infoMsgsList, (ST_VOID *)pstMsg);        }      ICA_Log_CAlways0("    ");        ICA_Log_CAlways0("ServerDeviceName      NumSelect    NumOperate    NumErrors");      pstDevice = pstRemote->serverObj->devicesList;      while (pstDevice)        {        ICA_Log_CAlways4("     %-20s      %d          %d          %d",	                 pstDevice->name, pstDevice->numSelect, pstDevice->numOperate,		         pstDevice->numErrors);        pstDevice = (ICTA_DEVICE *) list_get_next		    ((ST_VOID *)pstRemote->serverObj->devicesList, (ST_VOID *)pstDevice);        }      ICA_Log_CAlways0("     ");      ICA_Log_CAlways0("ServerAcctRef NumHits  NumReqs  NumErrs NumCondHit NumCondErr");      pstAcct = pstRemote->serverObj->accountList;      while (pstAcct)        {        ICA_Log_CAlways6("     %d       %d       %d       %d       %d       %d",	                 pstAcct->nRef, pstAcct->numHits, 		         pstAcct->numRequests, pstAcct->numErrors,	                 pstAcct->numConditionHits, pstAcct->numConditionErrs);        pstAcct = (ICTA_SIMPLE_ACCT *) list_get_next		  ((ST_VOID *)pstRemote->serverObj->accountList, (ST_VOID *)pstAcct);        }      ICA_Log_CAlways0("  ");      }    if (pstRemote->bIsClient)      {      ICA_Log_CAlways0("ClientVariableName          NumReads NumWrite NumErrors");      pstVar = pstRemote->clientObj->variableList;      while (pstVar)        {        ICA_Log_CAlways4(" %-25s         %d        %d         %d", 	                 pstVar->varName, pstVar->numReads, pstVar->numWrites, pstVar->numErrors);        pstVar = (ICTA_VAR_INFO *) list_get_next		 ((ST_VOID *)pstRemote->clientObj->variableList, (ST_VOID *)pstVar);        }      ICA_Log_CAlways0("  ");      ICA_Log_CAlways0("ClientMessageID       NumHits");      pstMsg = pstRemote->clientObj->infoMsgsList;      while (pstMsg)        {        ICA_Log_CAlways2("      %d                %d", 	                  pstMsg->nRef, pstMsg->numHits);        pstMsg = (ICTA_MSG_INFO *) list_get_next		 ((ST_VOID *)pstRemote->clientObj->infoMsgsList, (ST_VOID *)pstMsg);        }      ICA_Log_CAlways0("    ");        ICA_Log_CAlways0("ClientDeviceName      NumSelect    NumOperate    NumErrors");      pstDevice = pstRemote->clientObj->devicesList;      while (pstDevice)        {        ICA_Log_CAlways4("     %-20s      %d          %d          %d",	                 pstDevice->name, pstDevice->numSelect, pstDevice->numOperate,		         pstDevice->numErrors);        pstDevice = (ICTA_DEVICE *) list_get_next		    ((ST_VOID *)pstRemote->clientObj->devicesList, (ST_VOID *)pstDevice);        }      ICA_Log_CAlways0("     ");      ICA_Log_CAlways0("ClientAcctRef NumHits  NumReqs  NumErrs NumCondHit NumCondErr");      pstAcct = pstRemote->clientObj->accountList;      while (pstAcct)        {        ICA_Log_CAlways6("     %d       %d       %d       %d       %d       %d",	                 pstAcct->nRef, pstAcct->numHits, 		         pstAcct->numRequests, pstAcct->numErrors,	                 pstAcct->numConditionHits, pstAcct->numConditionErrs);        pstAcct = (ICTA_SIMPLE_ACCT *) list_get_next		  ((ST_VOID *)pstRemote->clientObj->accountList, (ST_VOID *)pstAcct);        }      ICA_Log_Always0("  ");      }          pstRemote = (ICTA_REMOTE_INFO *) list_get_next		((ST_VOID *)pstVCC->remoteList, (ST_VOID *)pstRemote);    }  }/************************************************************************//* testFindAccount:  search remote who accounts for selected nRef	*//************************************************************************/static ICTA_SIMPLE_ACCT *testFindAccount(ICTA_REMOTE_INFO *pstRemote,				 	 icInt nAcctRef, int who)  {ICTA_SIMPLE_ACCT *pstAcct, *pstAcctList;ST_BOOLEAN       bDone = SD_FALSE;  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);    }  return pstAcct;  }

⌨️ 快捷键说明

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