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

📄 ictatest.c

📁 ICCP Toolkit 是在 Tru64下开发Tase.2通信协议的开发包
💻 C
📖 第 1 页 / 共 4 页
字号:
      status = icStartRemote(pstRemote->remoteId,			     linkUpCallBack,			     linkDownCallBack);      }    if (status)      {      ICA_Log_Err2("ERROR:  Unable to Start Remote, status=%d %s\n",                    status, icPerror(status));      ICA_Log_ErrC1("       Remote= '%s'", pstRemote->remoteName);      }    else      {      pstRemote->bRemoteStarted = icTrue;      ICA_Log_Flow1("Remote '%s' Started OK.", pstRemote->remoteName);      /* the remote is up - start the links . . . */      pstLink = pstRemote->linkList;      while (pstLink)        {        icStartLink(pstLink->linkId);        pstLink->bLinkStarted = icTrue;        ICA_Log_Flow2("Link '%s' to '%s' Started OK.",                       pstLink->localAr, pstLink->remoteArs[0]);        pstLink = (ICTA_LINK_INFO *) list_get_next		  ((ST_VOID *)pstRemote->linkList, (ST_VOID *)pstLink);        }      }    pstRemote = (ICTA_REMOTE_INFO *) list_get_next		((ST_VOID *)remoteList, (ST_VOID *)pstRemote);    }  }/************************************************************************//* static functions							*//************************************************************************//************************************************************************//* cfgCompServerVars:  define comp test server read/write vars		*//************************************************************************/static void cfgCompServerVars(ICTA_REMOTE_INFO *pstRemote)  {ST_INT index;icInt status;ICTA_VAR_INFO *pstVar;/*  index = pstRemote->index;	*/  index = 0;  /* define the read variable	*/  pstVar = chk_calloc(1, sizeof(ICTA_VAR_INFO));  sprintf(pstVar->varName, "%s_%1d", READ_VAR_NAME, index);  pstVar->varScope = IC_SCOPE_VMD;  pstVar->iccpType = index;		/* this will blow if index>11	*/  pstVar->bUserType = icFalse;  pstVar->pstType = NULL;    pstVar->bWriteable = icFalse;  pstVar->bVarDefined = icFalse;  pstVar->numReads = 0;  pstVar->numWrites=0;  pstVar->numErrors=0;  initializeVar(pstVar);  list_add_last ((ST_VOID **)&pstRemote->serverObj->variableList, pstVar);  status = icDefineServerVariable(pstRemote->remoteId,				  pstVar->varName,				  pstVar->varScope,				  pstVar->iccpType,				  NULL,				  pstVar->varPtr,				  pstVar->bWriteable,				  (icUserData) pstVar,				  &pstVar->varId,				  ctServerWriteCallBack,				  ctServerReadCallBack);  if (status)    {    ICA_Log_Err2("ERROR:  icDefineServerVariable status =%d %s",                  status, icPerror(status));    ICA_Log_ErrC1("       Var = %s", pstVar->varName);    }  else    pstVar->bVarDefined = icTrue;  /* define the write variable	*/  pstVar = chk_calloc(1, sizeof(ICTA_VAR_INFO));  sprintf(pstVar->varName, "%s_%1d", WRITE_VAR_NAME, index);  pstVar->varScope = IC_SCOPE_VMD;  pstVar->iccpType = index;		/* this will blow if index>11	*/  pstVar->bUserType = icFalse;  pstVar->pstType = NULL;    pstVar->bWriteable = icTrue;  pstVar->bVarDefined = icFalse;  pstVar->numReads = 0;  pstVar->numWrites=0;  pstVar->numErrors=0;  initializeVar(pstVar);  list_add_last ((ST_VOID **)&pstRemote->serverObj->variableList, pstVar);  status = icDefineServerVariable(pstRemote->remoteId,				  pstVar->varName,				  pstVar->varScope,				  pstVar->iccpType,				  NULL,				  pstVar->varPtr,				  pstVar->bWriteable,				  (icUserData) pstVar,				  &pstVar->varId,				  ctServerWriteCallBack,				  ctServerReadCallBack);  if (status)    {    ICA_Log_Err2("ERROR:  icDefineServerVariable status =%d %s",                  status, icPerror(status));    ICA_Log_ErrC1("       Var = %s", pstVar->varName);    }  else    pstVar->bVarDefined = icTrue;  } /************************************************************************//* cfgCompClientVars:  define comp test client read/write vars		*//************************************************************************/static void cfgCompClientVars(ICTA_REMOTE_INFO *pstRemote)  {ST_INT16 index;icInt status;ICTA_VAR_INFO *pstVar;  index = 0;  /* define the read variable	*/  pstVar = chk_calloc(1, sizeof(ICTA_VAR_INFO));  sprintf(pstVar->varName, "%s_%1d", READ_VAR_NAME, index);  pstVar->varScope = IC_SCOPE_VMD;  pstVar->iccpType = (index % 12);  pstVar->bUserType = icFalse;  pstVar->pstType = NULL;    pstVar->bWriteable = icFalse;  pstVar->bVarDefined = icFalse;  pstVar->numReads = 0;  pstVar->numWrites=0;  pstVar->numErrors=0;  initializeVar(pstVar);  list_add_last ((ST_VOID **)&pstRemote->clientObj->variableList, pstVar);  status = icDefineClientVariable(pstRemote->remoteId,				  pstVar->varName,				  pstVar->varScope,				  pstVar->iccpType,				  NULL,				  pstVar->varPtr,				 (icUserData) pstVar,				  &pstVar->varId,				  ctClientWriteCallBack,				  ctClientReadCallBack);  if (status)    {    ICA_Log_Err2("ERROR:  icDefineClientVariable status =%d %s",                  status, icPerror(status));    ICA_Log_ErrC1("       Var = %s", pstVar->varName);    }  else    pstVar->bVarDefined = icTrue;  /* define the write variable	*/  pstVar = chk_calloc(1, sizeof(ICTA_VAR_INFO));  sprintf(pstVar->varName, "%s_%1d", WRITE_VAR_NAME, index);  pstVar->varScope = IC_SCOPE_VMD;  pstVar->iccpType = (index % 12);  pstVar->bUserType = icFalse;  pstVar->pstType = NULL;    pstVar->bWriteable = icTrue;  pstVar->bVarDefined = icFalse;  pstVar->numReads = 0;  pstVar->numWrites=0;  pstVar->numErrors=0;  initializeVar(pstVar);  list_add_last ((ST_VOID **)&pstRemote->clientObj->variableList, pstVar);  status = icDefineClientVariable(pstRemote->remoteId,				  pstVar->varName,				  pstVar->varScope,				  pstVar->iccpType,				  NULL,				  pstVar->varPtr,				  (icUserData) pstVar,				  &pstVar->varId,				  ctClientWriteCallBack,				  ctClientReadCallBack);  if (status)    {    ICA_Log_Err2("ERROR:  icDefineClientVariable status =%d %s",                  status, icPerror(status));    ICA_Log_ErrC1("       Var = %s", pstVar->varName);    }  else    pstVar->bVarDefined = icTrue;  } /************************************************************************//* cfgCompServerMsg:  define comp test server info message		*//************************************************************************/static void cfgCompServerMsg(ICTA_REMOTE_INFO *pstRemote)  {ST_INT index;icInt status;ICTA_MSG_INFO *pstInfo;  index = 0;  pstInfo = chk_calloc(1, sizeof(ICTA_MSG_INFO));  pstInfo->nRef = 100 * (index+1) + index;  pstInfo->scope = IC_SCOPE_VMD;  pstInfo->maxMsgSize = IM_MAX_SIZE;		  pstInfo->msgId = NULL;  pstInfo->bMsgDefined = icFalse;  pstInfo->numHits = 0;		  list_add_last ((ST_VOID **)&pstRemote->serverObj->infoMsgsList, pstInfo);  status = icDefineServerMessage(pstRemote->remoteId,				 pstInfo->nRef,				 pstInfo->scope,				 pstInfo->maxMsgSize,				 &pstInfo->msgId,				 (icUserData) pstInfo,				 ctSendMsgCallBack);  if (status)    {    ICA_Log_Err3("ERROR:  DefineServerMessage ref#=%d status = %d %s",	          pstInfo->nRef, status, icPerror(status));    }  else    pstInfo->bMsgDefined = icTrue;	  }/************************************************************************//* cfgCompClientMsg:  define comp test client info message		*//************************************************************************/static void cfgCompClientMsg(ICTA_REMOTE_INFO *pstRemote)  {ST_INT index;icInt status;ICTA_MSG_INFO *pstInfo;  index = 0;  pstInfo = chk_calloc(1, sizeof(ICTA_MSG_INFO));  pstInfo->nRef = 100 * (index+1) + index;  pstInfo->scope = IC_SCOPE_VMD;  pstInfo->maxMsgSize = IM_MAX_SIZE;		  pstInfo->msgId = NULL;  pstInfo->bMsgDefined = icFalse;  pstInfo->numHits = 0;		  list_add_last ((ST_VOID **)&pstRemote->clientObj->infoMsgsList, pstInfo);  status = icDefineClientMessage(pstRemote->remoteId,				 pstInfo->nRef,				 pstInfo->scope,				 pstInfo->maxMsgSize,				 &pstInfo->msgId,				 (icUserData) pstInfo,		 		 ctRecvMsgCallBack);  if (status)    {    ICA_Log_Err3("ERROR:  DefineClientMessage ref#=%d status = %d %s",	          pstInfo->nRef, status, icPerror(status));    }  else    pstInfo->bMsgDefined = icTrue;	  }/************************************************************************//* cfgCompServerDevices:  define comp test server devices		*//************************************************************************/static void cfgCompServerDevices(ICTA_REMOTE_INFO *pstRemote)  {ST_INT index;icInt status;ICTA_DEVICE *pstDevice;  index = 0;  /* define an sbo device			*/  pstDevice = chk_calloc(1, sizeof(ICTA_DEVICE));  sprintf(pstDevice->name, "%s_%1d", DEV_SBO_NAME, index);  pstDevice->scope = IC_SCOPE_VMD;  pstDevice->type = IC_TYPE_COMMAND + (index % 3);  pstDevice->sbo = icTrue;  pstDevice->value.int_16 = 0;  pstDevice->checkBackId = 0;  pstDevice->deviceId = NULL;  pstDevice->bDeviceDefined = icFalse;  pstDevice->numSelect = 0;  pstDevice->numOperate = 0;  pstDevice->numErrors = 0;  list_add_last ((ST_VOID **)&pstRemote->serverObj->devicesList, pstDevice);   status = icDefineServerDevice(pstRemote->remoteId,				pstDevice->name,				pstDevice->scope,				pstDevice->type,				(icUserData) pstDevice,				&pstDevice->deviceId,				pstDevice->sbo,				ctSelectDevInd,				ctOperateDevInd);  if (status)    {    ICA_Log_Err3("ERROR:  DefineServerDevice %s status = %d %s",	          pstDevice->name, status, icPerror(status));    }  else    pstDevice->bDeviceDefined = icTrue;	  /* define a non sbo device	*/  pstDevice = chk_calloc(1, sizeof(ICTA_DEVICE));  sprintf(pstDevice->name, "%s_%1d", DEVICE_NAME, index);  pstDevice->scope = IC_SCOPE_VMD;  pstDevice->type = IC_TYPE_COMMAND + (index % 3);  pstDevice->sbo = icFalse;  pstDevice->value.int_16 = 0;  pstDevice->checkBackId = 0;  pstDevice->deviceId = NULL;  pstDevice->bDeviceDefined = icFalse;  pstDevice->numSelect = 0;  pstDevice->numOperate = 0;  pstDevice->numErrors = 0;  list_add_last ((ST_VOID **)&pstRemote->serverObj->devicesList, pstDevice);  status = icDefineServerDevice(pstRemote->remoteId,				pstDevice->name,				pstDevice->scope,				pstDevice->type,				(icUserData) pstDevice,				&pstDevice->deviceId,				pstDevice->sbo,				ctSelectDevInd,				ctOperateDevInd);  if (status)    {    ICA_Log_Err3("ERROR:  DefineServerDevice %s status = %d %s",	          pstDevice->name, status, icPerror(status));    }  else    pstDevice->bDeviceDefined = icTrue; 	  }/************************************************************************//* cfgCompClientDevices:  define comp test client devices		*//************************************************************************/static void cfgCompClientDevices(ICTA_REMOTE_INFO *pstRemote)  {ST_INT index;icInt status;ICTA_DEVICE *pstDevice;  index = 0;  /* define an sbo device			*/  pstDevice = chk_calloc(1, sizeof(ICTA_DEVICE));  sprintf(pstDevice->name, "%s_%1d", DEV_SBO_NAME, index);  pstDevice->scope = IC_SCOPE_VMD;  pstDevice->type = IC_TYPE_COMMAND + (index % 3);  pstDevice->sbo = icTrue;  pstDevice->value.int_16 = 0;  pstDevice->checkBackId = 0;  pstDevice->deviceId = NULL;  pstDevice->bDeviceDefined = icFalse;  pstDevice->numSelect = 0;  pstDevice->numOperate = 0;  pstDevice->numErrors = 0;  list_add_last ((ST_VOID **)&pstRemote->clientObj->devicesList, pstDevice);  status = icDefineClientDevice(pstRemote->remoteId,				pstDevice->name,				pstDevice->scope,				pstDevice->type,				&pstDevice->deviceId,				pstDevice->sbo);  if (status)    {    ICA_Log_Err3("ERROR:  DefineClientDevice %s status = %d %s",	          pstDevice->name, status, icPerror(status));    }  else    pstDevice->bDeviceDefined = icTrue;	  /* define a non sbo device	*/  pstDevice = chk_calloc(1, sizeof(ICTA_DEVICE));  sprintf(pstDevice->name, "%s_%1d", DEVICE_NAME, index);  pstDevice->scope = IC_SCOPE_VMD;  pstDevice->type = IC_TYPE_COMMAND + (index % 3);  pstDevice->sbo = icFalse;  pstDevice->value.int_16 = 0;  pstDevice->checkBackId = 0;  pstDevice->deviceId = NULL;  pstDevice->bDeviceDefined = icFalse;  pstDevice->numSelect = 0;  pstDevice->numOperate = 0;  pstDevice->numErrors = 0;  list_add_last ((ST_VOID **)&pstRemote->clientObj->devicesList, pstDevice);  status = icDefineClientDevice(pstRemote->remoteId,				pstDevice->name,				pstDevice->scope,				pstDevice->type,				&pstDevice->deviceId,				pstDevice->sbo);  if (status)    {    ICA_Log_Err3("ERROR:  DefineClientDevice %s status = %d %s",	          pstDevice->name, status, icPerror(status));    }  else    pstDevice->bDeviceDefined = icTrue; 	  }/************************************************************************//* cfgCompServerAccts:  define comp test server accounts		*//************************************************************************/static void cfgCompServerAccts(ICTA_REMOTE_INFO *pstRemote)  {ST_INT index;icInt status;ICTA_SIMPLE_ACCT *pstAcct;  index = 0;  /* an int account	*/  pstAcct = chk_calloc(1, sizeof(ICTA_SIMPLE_ACCT));  pstAcct->nRef = 1000 * (index+1) + 1;  pstAcct->scope = IC_SCOPE_VMD;  pstAcct->acctType = IC_TYPE_NAME_PRD;  pstAcct->valueType = IC_INTEGER_ACCOUNT;  pstAcct->rows = 10;  pstAcct->matrixRef = 0;  pstAcct->variableId = NULL;  pstAcct->bAcctDefined = icFalse;  pstAcct->numHits = 0;  pstAcct->numRequests = 0;  pstAcct->numErrors = 0;  pstAcct->numConditionHits=0;  pstAcct->numConditionErrs = 0;  pstAcct->request = 0;  list_add_last ((ST_VOID **)&pstRemote->serverObj->accountList, pstAcct);  status = icDefineServerSimpleAccount(pstRemote->remoteId,				       pstAcct->nRef,				       pstAcct->scope,				       pstAcct->acctType,				       NULL,				       pstAcct->valueType,

⌨️ 快捷键说明

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