📄 ictamain.c
字号:
if (bUseNewStartRem) { status = icStartRemoteEx (pstRemote->remoteId, linkUpCallBackEx, linkDownCallBackEx); } else { 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); } } if (pstRemote->bRemoteStarted) { /* the remote is up - start the links . . . */ pstLink = pstRemote->linkList; while (pstLink) { if (pstLink->bLinkDefined && !pstLink->bLinkStarted) { 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 *)pstVCC->remoteList, (ST_VOID *)pstRemote); } } /************************************************************************//* scrnLogOff: Turn off Screen Logging *//************************************************************************/ST_VOID scrnLogOff (ST_VOID) { slogDynOff(); pause_msg("\nPress a key to continue!"); showCurrMenu(); }/************************************************************************//* showSizes: *//************************************************************************/ST_VOID showSizes (ST_VOID) { printf ("\n\nSome Sizes . . ."); printf ("\nSize of int = %d", sizeof (int)); printf ("\nSize of icInt = %d", sizeof (icInt)); printf ("\nSize of short int = %d", sizeof (short int)); printf ("\nSize of icShort = %d", sizeof (icShort)); printf ("\nSize of long int = %d", sizeof (long int)); printf ("\nSize of icLong = %d", sizeof (icLong)); pause_msg("\nPress a key to continue!"); showCurrMenu(); }/************************************************************************//* chgTraceLevel: modify SDK trace level *//************************************************************************/static ST_VOID chgTraceLevel (ST_VOID) {ST_BOOLEAN dataEntered;ST_INT traceLevel; printf("\nEnter new trace level (0 to 10): "); if (!(dataEntered = intget(&traceLevel))) traceLevel = 1; /* default to min */ if (traceLevel == 0) { icSetupTrace(IC_NO_LOG, 1, NULL, NULL, NULL); } else { icSetupTrace(IC_TRACE_LOG, traceLevel, NULL, NULL, dyn_iccp_slog_fun); } pause_msg("\nPress a key to continue!"); showCurrMenu(); }/************************************************************************//* startCompTest: Start Comprehensive Testing *//************************************************************************/ST_VOID startCompTest (ST_VOID) {ST_BOOLEAN dataEntered, bStartEmUp = SD_FALSE;int i=0;ICTA_REMOTE_INFO *pstRemote; printf("\n\nStart Comprehensive Test . . .\n"); printf("\nThis option will define all configured items, start all remotes"); printf("\nand links. The client will sleep for a while then issue some"); printf("\nrequests of the server. The server will sleep for a while then"); printf("\nsend a message to the client. To Stop the test, select Stop"); printf("\nComprehensive Test option from the menu."); if (ask ("\n\n Do you want to continue (Y)? ", SD_TRUE)) { if (bMultiThreads) { if (ask ("\n\n Do you want to test with separate threads? (Y)? ", SD_TRUE)) bCompTestThreaded = icTrue; } if (ask ("\n\n Do you want to display messages? (Y)? ", SD_TRUE) ) bCompTestVerbose = icTrue; else bCompTestVerbose = icFalse; printf("\nEnter SleepTime in seconds (30): "); if (!(dataEntered = intget(&compSleepTime))) compSleepTime = 30; /* default to thirty seconds */ bCompTestInProgress = icTrue; bStopCompTest = icFalse; time( &compStartTime ); /* first define configured things */ defCfgAll(); /* if threaded, thread routines will initiate the test else do it here */ if (!bMultiThreads) { pstRemote = pstVCC->remoteList; while (pstRemote) { pstRemote->index = i++; pstRemote->bCompServerDefined = icFalse; cfgServerCompTest(pstRemote); /* initial sleep time doubled */ pstRemote->timerId = icAddTimeOutHandler (compSleepTime*2000, serverCompTest, (icUserData) pstRemote); bStartEmUp = SD_TRUE; pstRemote->bCompClientDefined = icFalse; cfgClientCompTest(pstRemote); /* initial sleep time doubled */ pstRemote->timerId = icAddTimeOutHandler (compSleepTime*2000, clientCompTest, (icUserData) pstRemote); pstRemote = (ICTA_REMOTE_INFO *) list_get_next ((ST_VOID *)pstVCC->remoteList, (ST_VOID *)pstRemote); } if (bStartEmUp) doCompStartEmUp(pstVCC->remoteList); } printf("\n\nCOMPREHENSIVE TEST IN PROGRESS."); } if (!bMultiThreads) pause_msg("\nPress a key to continue!"); showCurrMenu(); }/************************************************************************//* stopCompTest: Stop Comprehensive Testing *//************************************************************************/ST_VOID stopCompTest (ST_VOID) { printf("\n\nStop Comprehensive Test . . ."); if (!bCompTestInProgress) printf("\nComprehensive Test is not ACTIVE - no need to stop it."); else { printf ("\nComprehensive Test running since %s.", ctime(&compStartTime)); if (ask ("\n\n Do you want to stop it (Y)? ", SD_TRUE)) { time( &compStopTime ); bStopCompTest = icTrue; cleanUpCompTest(); } } pause_msg("\nPress a key to continue!"); showCurrMenu(); }/************************************************************************//* ictaExit: your done! clean it up *//************************************************************************/static ST_VOID ictaExit (ST_VOID) {ICTA_REMOTE_INFO *pstRemote;icInt status; pstRemote = pstVCC->remoteList; while (pstRemote) { if (pstRemote->bRemoteStarted) { status = icStopRemote(pstRemote->remoteId, remoteStopCallBack); if (status) { ICA_Log_Err2("ERROR: Unable to Stop Remote, status=%d %s\n", status, icPerror(status)); ICA_Log_ErrC1(" Remote= '%s'", pstRemote->remoteName); } else { pstRemote->bRemoteStarted = icFalse; ICA_Log_Flow1("Remote '%s' Stopped OK.", pstRemote->remoteName); } } pstRemote = (ICTA_REMOTE_INFO *) list_get_next ((ST_VOID *)pstVCC->remoteList, (ST_VOID *)pstRemote); }#ifdef QUALITY_TEST doSlogQualityTest ();#endif icUnloadMemory (); icCloseAPI(); /* close up the toolkit */ freeVCC();/* see just who has all that memory */ if (m_mem_debug) dyn_mem_ptr_status(); #if (SYSTEM_SEL & (SYS_5)) term_rest(); /* restore the screen */#endif#if defined(_WIN32) term_rest();#endif exit (0); }#if (SYSTEM_SEL & (SYS_5))/************************************************************************//************************************************************************//* sigfun *//* This functions catches a signal and restores terminfo. *//************************************************************************/void sigfun (int sig) { bShutItDown = SD_TRUE; /* let the testCheckKey do the shut down work */ }/************************************************************************//* sigbus *//* This functions catches bus errors which on a risk (sparcstation) are *//* caused by alignment problems on an assignment. *//************************************************************************/void sigbus (int sig) { bShutItDown = SD_TRUE; /* let the testCheckKey do the shut down work */ }#endif#ifdef _WIN32/************************************************************************//* ShutDown: caught a signal - close it all up *//************************************************************************/void ShutDown( int p1 ) { bShutItDown = SD_TRUE; /* let the testCheckKey do the shut down work */ }#endif#ifdef SISCO_THREADS/************************************************************************//* doRemoteThread: define everything for the specified remote, start *//* up the remote and all links and call compTest funs *//************************************************************************/#if defined(__alpha) || defined(_AIX)#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 199506L)void *doRemoteThread (void *argP)#elsevoid doRemoteThread (pthread_addr_t argP)#endif#endif#ifdef _WIN32DWORD WINAPI doRemoteThread (LPVOID argP)#endif {ICTA_REMOTE_INFO *pstRemote;ICTA_LINK_INFO *pstLink;icInt status;#if defined(__alpha) || defined(_AIX)struct timespec abstime, delta;struct timespec curtime, diftime, curdelta; delta.tv_sec = compSleepTime; delta.tv_nsec = 0; curdelta.tv_sec = 0; /* delta to obtain current UTC time */ curdelta.tv_nsec = 0;#endif pstRemote = (ICTA_REMOTE_INFO *) argP; printf ("\n doRemoteThread %p", pstRemote);#if defined(__alpha) || defined(_AIX) IC_PTHREAD_MUTEX_LOCK (&mutex, status);#endif /* define the remote first */ if (!pstRemote->bRemoteDefined) { status = icDefineRemote(pstRemote->remoteName, IC_TYPE_ICCP, pstRemote->iccpVersion, pstRemote->bilatTableID, pstRemote->bInitiate, pstRemote->nReqTimeout, pstRemote->nRetries, pstRemote->nReplyTimeout, pstRemote->nShortestInterval, pstRemote->bReqIdentity, icFalse, (icUserData) pstRemote, &pstRemote->remoteId); if (status) { ICA_Log_Err2("ERROR: Define remote status = %d %s\n", status, icPerror(status));#if defined(__alpha) || defined(_AIX)#if defined (_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 199506L) return argP;#else return;#endif#endif#ifdef _WIN32 return FALSE;#endif } else { ICA_Log_Flow1("Remote '%s' Defined Successfully.", pstRemote->remoteName); pstRemote->bRemoteDefined = icTrue; if ((strlen(pstRemote->localDom) > 0) && (strlen(pstRemote->remoteDom) > 0)) { status = icDefineDomainNames (pstRemote->remoteId, pstRemote->localDom, pstRemote->remoteDom); if (status) { ICA_Log_Err2 ("ERROR: DefineDomainNames status = %d %s", status, icPerror (status)); } else { ICA_Log_Flow3 ("Remote %s Doms %s, %s defined OK", pstRemote->remoteName, pstRemote->localDom, pstRemote->remoteDom); } } } } /* end define remote */ /* define local features */ if (pstRemote->bRemoteDefined && pstRemote->bIsServer) { status = icDefineLocalFeatures(pstRemote->remoteId, pstRemote->serverObj->stFeatures.bBlock2, pstRemote->serverObj->stFeatures.bBlock3, pstRemote->serverObj->stFeatures.bBlock4, pstRemote->serverObj->stFeatures.bBlock5, pstRemote->serverObj->stFeatures.bBlock6, pstRemote->serverObj->stFeatures.bBlock7, pstRemote->serverObj->stFeatures.bBlock8, pstRemote->serverObj->stFeatures.bBlock9, &pstRemote->serverObj->stFeatures.supportedFeatures); if (status) { ICA_Log_Err2("ERROR: Define Local Features status = %d %s\n", status, icPerror(status)); } else { ICA_Log_Flow1("Local Features '%s' Defined Successfully.", pstRemote->remoteName); } } /* end define local features */ /* define all client and server objects for the remote */ defAllObjForRemote (pstRemote); /* if comprehensive test is happening - configure comp stuff */ if (bCompTestInProgress) { cfgServerCompTest (pstRemote); cfgClientCompTest (pstRemote); }#if defined(__alpha) || defined(_AIX) IC_PTHREAD_MUTEX_UNLOCK (&mutex, status);#endif /* now start em up!!!!! */ if (bUseNewStartRem) { status = icStartRemoteEx (pstRemote->remoteId, linkUpCallBackEx, linkDownCallBackEx); } else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -