📄 ictamain.c
字号:
{ 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);#if defined (_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 199506L) return argP;#endif } 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); } /* if comprehensive test - sleep for a while then do stuff */ while (bCompTestInProgress && !bStopCompTest) {#if defined(__alpha) || defined(_AIX) status = pthread_get_expiration_np(&delta, &abstime); IC_PTHREAD_MUTEX_LOCK (&mutex, status); serverCompTest ((icUserData) pstRemote, NULL); clientCompTest ((icUserData) pstRemote, NULL); status = pthread_cond_timedwait(&condVar, &mutex, &abstime); /* if the status is not a timeout then wait the time desired */ if ( status != ETIMEDOUT ) { pthread_get_expiration_np(&curdelta, &curtime); /* get current UTC time */ if ( abstime.tv_sec > curtime.tv_sec ) { diftime.tv_sec = abstime.tv_sec - curtime.tv_sec; diftime.tv_nsec = 0; status = pthread_delay_np(&diftime); /* sleep until abstime */ } } IC_PTHREAD_MUTEX_UNLOCK (&mutex, status);#endif#ifdef _WIN32 serverCompTest ((icUserData) pstRemote, NULL); clientCompTest ((icUserData) pstRemote, NULL); Sleep (compSleepTime * 1000);#endif }#if defined(__alpha) || defined(_AIX) printf("\n\nThread %p has done its job and will exit now.", pthread_self());#if defined (_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 199506L) return argP;#endif#else printf ("\n\nThread %d has done its job and will exit now.", GetCurrentThreadId ()); return FALSE;#endif }#endif/************************************************************************//* reDefARem: example of icReDefineRemote *//************************************************************************/static ST_VOID reDefARem (ST_VOID) {ICTA_REMOTE_INFO *pstRemote;icInt status;ICTA_LINK_INFO *pstLink;ICTA_TRANSFER_INFO *pstTran;ICTA_VAR_INFO *pstVar;ICTA_DEVICE *pstDevice;ICTA_MSG_INFO *pstInfoMsg;ICTA_SIMPLE_ACCT *pstAcct;ICTA_MATRIX_ACCT *pstMatrix;ICTA_TA_CONDITION *pstCond;ST_BOOLEAN dataEntered;ST_CHAR buffer[100];char *localDom, *remoteDom; printf ("\n\nRedefine a Remote . . ."); printf ("\nEnter Remote Name: "); dataEntered = strget(buffer); if (!dataEntered) { pause_msg("\nPress a key to continue!"); showCurrMenu(); return; } pstRemote = findRemote(ICTA_NOONE, buffer); if (!pstRemote) { printf("\nInvalid Remote Name!!!!!\n\n"); pause_msg("\nPress a key to continue!"); showCurrMenu(); return; } ICA_Log_Err1 ("Start redefining remote %s", pstRemote->remoteName); if (strlen (pstRemote->localDom)) localDom = pstRemote->localDom; else localDom = NULL; if (strlen (pstRemote->remoteDom)) remoteDom = pstRemote->remoteDom; else remoteDom = NULL; status = icReDefineRemote (pstRemote->remoteName, IC_TYPE_ICCP, pstRemote->iccpVersion, pstRemote->bilatTableID, pstRemote->bInitiate, pstRemote->nReqTimeout, pstRemote->nRetries, pstRemote->nReplyTimeout, pstRemote->nShortestInterval, pstRemote->bReqIdentity, (icUserData) pstRemote, localDom, remoteDom, pstRemote->remoteId); if (status) { printf ("icReDefineRemote failed - status = %d %s", status, icPerror (status)); ICA_Log_Err2 ("ERROR: ReDefineRemote status = %d %s", status, icPerror (status)); return; } else { ICA_Log_Flow3 ("Remote %s Doms %s, %s Redefined OK", pstRemote->remoteName, pstRemote->localDom, pstRemote->remoteDom); } /* set all objects as undefined */ pstRemote->bRemoteDefined = icTrue; pstRemote->bRemoteStarted = icFalse; pstLink = pstRemote->linkList; while (pstLink) { pstLink->bLinkDefined = icFalse; pstLink = (ICTA_LINK_INFO *) list_get_next ((ST_VOID *) pstRemote->linkList, (ST_VOID *) pstLink); } if (pstRemote->bIsServer) { pstVar = pstRemote->serverObj->variableList; while (pstVar) { pstVar->bVarDefined = icFalse; pstVar = (ICTA_VAR_INFO *) list_get_next ((ST_VOID *) pstRemote->serverObj->variableList, (ST_VOID *) pstVar); } pstInfoMsg = pstRemote->serverObj->infoMsgsList; while (pstInfoMsg) { pstInfoMsg->bMsgDefined = icFalse; pstInfoMsg = (ICTA_MSG_INFO *) list_get_next ((ST_VOID *) pstRemote->serverObj->infoMsgsList, (ST_VOID *) pstInfoMsg); } pstAcct = pstRemote->serverObj->accountList; while (pstAcct) { pstAcct->bAcctDefined = icFalse; pstAcct = (ICTA_SIMPLE_ACCT *) list_get_next ((ST_VOID *) pstRemote->serverObj->accountList, (ST_VOID *) pstAcct); } pstMatrix = pstRemote->serverObj->matrixList; while (pstMatrix) { pstMatrix->bMatrixDefined = icFalse; pstMatrix = (ICTA_MATRIX_ACCT *) list_get_next ((ST_VOID *) pstRemote->serverObj->matrixList, (ST_VOID *) pstMatrix); } pstDevice = pstRemote->serverObj->devicesList; while (pstDevice) { pstDevice->bDeviceDefined = icFalse; pstDevice = (ICTA_DEVICE *) list_get_next ((ST_VOID *) pstRemote->serverObj->devicesList, (ST_VOID *) pstDevice); } } if (pstRemote->bIsClient) { pstVar = pstRemote->clientObj->variableList; while (pstVar) { pstVar->bVarDefined = icFalse; pstVar = (ICTA_VAR_INFO *) list_get_next ((ST_VOID *) pstRemote->clientObj->variableList, (ST_VOID *) pstVar); } pstTran = pstRemote->clientObj->tranGroupList; while (pstTran) { pstTran->bGroupDefined = icFalse; pstTran = (ICTA_TRANSFER_INFO *) list_get_next ((ST_VOID *) pstRemote->clientObj->tranGroupList, (ST_VOID *) pstTran); } pstInfoMsg = pstRemote->clientObj->infoMsgsList; while (pstInfoMsg) { pstInfoMsg->bMsgDefined = icFalse; pstInfoMsg = (ICTA_MSG_INFO *) list_get_next ((ST_VOID *) pstRemote->clientObj->infoMsgsList, (ST_VOID *) pstInfoMsg); } pstAcct = pstRemote->clientObj->accountList; while (pstAcct) { pstAcct->bAcctDefined = icFalse; pstAcct = (ICTA_SIMPLE_ACCT *) list_get_next ((ST_VOID *) pstRemote->clientObj->accountList, (ST_VOID *) pstAcct); } pstMatrix = pstRemote->clientObj->matrixList; while (pstMatrix) { pstMatrix->bMatrixDefined = icFalse; pstMatrix = (ICTA_MATRIX_ACCT *) list_get_next ((ST_VOID *) pstRemote->clientObj->matrixList, (ST_VOID *) pstMatrix); } pstCond = pstRemote->clientObj->conditionList; while (pstCond) { pstCond->bCondDefined = icFalse; pstCond = (ICTA_TA_CONDITION *) list_get_next ((ST_VOID *) pstRemote->clientObj->conditionList, (ST_VOID *) pstCond); } pstDevice = pstRemote->clientObj->devicesList; while (pstDevice) { pstDevice->bDeviceDefined = icFalse; pstDevice = (ICTA_DEVICE *) list_get_next ((ST_VOID *) pstRemote->clientObj->devicesList, (ST_VOID *) pstDevice); } } defAllObjForRemote (pstRemote); printf ("\nRemote %s and all its objects has been redefined!", pstRemote->remoteName); pause_msg("\nPress a key to continue!"); showCurrMenu(); }/************************************************************************//* unDefARem: example of icUnDefineRemote *//************************************************************************/static ST_VOID unDefARem (ST_VOID) {ICTA_REMOTE_INFO *pstRemote;icInt status;ICTA_LINK_INFO *pstLink;ICTA_TRANSFER_INFO *pstTran;ICTA_VAR_INFO *pstVar;ICTA_DEVICE *pstDevice;ICTA_MSG_INFO *pstInfoMsg;ICTA_SIMPLE_ACCT *pstAcct;ICTA_MATRIX_ACCT *pstMatrix;ICTA_TA_CONDITION *pstCond;ST_BOOLEAN dataEntered;ST_CHAR buffer[100]; printf ("\n\nUnDefine a Remote . . ."); printf ("\nEnter Remote Name: "); dataEntered = strget(buffer); if (!dataEntered) { pause_msg("\nPress a key to continue!"); showCurrMenu(); return; } pstRemote = findRemote(ICTA_NOONE, buffer); if (!pstRemote) { printf("\nInvalid Remote Name!!!!!\n\n"); pause_msg("\nPress a key to continue!"); showCurrMenu(); return; } ICA_Log_Err1 ("Start undefining remote %s", pstRemote->remoteName); status = icUnDefineRemote (pstRemote->remoteId); if (status) { printf ("icUnDefineRemote failed - status = %d %s", status, icPerror (status)); ICA_Log_Err2 ("ERROR: UnDefineRemote status = %d %s", status, icPerror (status)); return; } else { ICA_Log_Flow1 ("Remote %s Undefined OK", pstRemote->remoteName); } /* set all objects as undefined */ pstRemote->bRemoteDefined = icFalse; pstRemote->bRemoteStarted = icFalse; pstRemote->remoteId = NULL; pstLink = pstRemote->linkList; while (pstLink) { pstLink->bLinkDefined = icFalse; pstLink->linkId = NULL; pstLink = (ICTA_LINK_INFO *) list_get_next ((ST_VOID *) pstRemote->linkList, (ST_VOID *) pstLink); } if (pstRemote->bIsServer) { pstVar = pstRemote->serverObj->variableList; while (pstVar) { pstVar->bVarDefined = icFalse; pstVar->varId = NULL; pstVar = (ICTA_VAR_INFO *) list_get_next ((ST_VOID *) pstRemote->serverObj->variableList, (ST_VOID *) pstVar); } pstInfoMsg = pstRemote->serverObj->infoMsgsList; while (pstInfoMsg) { pstInfoMsg->bMsgDefined = icFalse; pstInfoMsg->msgId = NULL; pstInfoMsg = (ICTA_MSG_INFO *) list_get_next ((ST_VOID *) pstRemote->serverObj->infoMsgsList, (ST_VOID *) pstInfoMsg); } pstAcct = pstRemote->serverObj->accountList; while (pstAcct) { pstAcct->bAcctDefined = icFalse; pstAcct->variableId = NULL; pstAcct = (ICTA_SIMPLE_ACCT *) list_get_next ((ST_VOID *) pstRemote->serverObj->accountList, (ST_VOID *) pstAcct); } pstMatrix = pstRemote->serverObj->matrixList; while (pstMatrix) { pstMatrix->bMatrixDefined = icFalse; pstMatrix->variableId = NULL; pstMatrix = (ICTA_MATRIX_ACCT *) list_get_next ((ST_VOID *) pstRemote->serverObj->matrixList, (ST_VOID *) pstMatrix); } pstDevice = pstRemote->serverObj->devicesList; while (pstDevice) { pstDevice->bDeviceDefined = icFalse; pstDevice->deviceId = NULL; pstDevice = (ICTA_DEVICE *) list_get_next ((ST_VOID *) pstRemote->serverObj->devicesList, (ST_VOID *) pstDevice); } } if (pstRemote->bIsClient) { pstVar = pstRemote->clientObj->variableList; while (pstVar) { pstVar->bVarDefined = icFalse; pstVar->varId = NULL; pstVar = (ICTA_VAR_INFO *) list_get_next ((ST_VOID *) pstRemote->clientObj->variableList, (ST_VOID *) pstVar); } pstTran = pstRemote->clientObj->tranGroupList; while (pstTran) { pstTran->bGroupDefined = icFalse; pstTran->transferGroupId = NULL; pstTran = (ICTA_TRANSFER_INFO *) list_get_next ((ST_VOID *) pstRemote->clientObj->tranGroupList, (ST_VOID *) pstTran); } pstInfoMsg = pstRemote->clientObj->infoMsgsList; while (pstInfoMsg) { pstInfoMsg->bMsgDefined = icFalse; pstInfoMsg->msgId = NULL; pstInfoMsg = (ICTA_MSG_INFO *) list_get_next ((ST_VOID *) pstRemote->clientObj->infoMsgsList, (ST_VOID *) pstInfoMsg); } pstAcct = pstRemote->clientObj->accountList
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -