📄 ictamain.c
字号:
funct_2 = scrnLogOff; funct_3 = startCompTest; funct_4 = stopCompTest; funct_5 = chgTraceLevel; funct_6 = reDefARem; funct_7 = unDefARem; funct_8 = enableIncVar; funct_9 = disableIncVar; funct_menu = showCurrMenu; callingMenu = NULL; }/************************************************************************//* newB4B8Menu *//* set up menu to access the new Block4 and Block 8 functions *//************************************************************************/static ST_VOID newB4B8Menu (ST_VOID) { CLEARSCR; showHeading(); theCurrentMenu = B4B8_MENU; printf ("\n\n"); printf ("\t New Block 4 and Block 8 Functions Menu \n\n"); printf ("\t 1 - Register Message Callback (client)\n"); printf ("\t 2 - Define Block 4 Conditions (client)\n"); printf ("\t 3 - Define Block 8 Conditions (client)\n "); printf ("\t 4 - Register Block 4 Condition Callback (server)\n "); printf ("\t 5 - Register Block 8 Condition Callback (server)\n"); printf ("\t 6 - Send a Message (server)\n"); printf ("\t 0 - Previous Menu\n"); printf ("\t\n "); printf ("\t\n "); printf ("\t\n "); printf("\n\n\n\n"); flush_keys (); fun_null (); funct_1 = b4b8RegMsgCB; funct_2 = b4DefCond; funct_3 = b8DefCond; funct_4 = b4RegCondCB; funct_5 = b8RegCondCB; funct_6 = b4b8SendMsg; funct_7 = testNoFun; funct_8 = testNoFun; funct_9 = testNoFun; funct_10 = callingMenu; funct_menu = showCurrMenu; }/************************************************************************//* errorCallBack: called by API when an error occurs */ /************************************************************************/void errorCallBack(icInt errorCode, icErrorMessage inf) { printf("\n\n>>>> ERROR CALLBACK <<<<\n"); printf("\tError = %d '%s'\n", errorCode, icPerror(errorCode)); printf("\tCheck Log File for more Details.\n"); ICA_Log_Err0(">>> ERROR CALLBACK <<<<"); ICA_Log_Err2("Error = %d, '%s'", errorCode, icPerror(errorCode)); switch (errorCode) { case IC_DUPLICATE_OBJECT: ICA_Log_ErrC1("Duplicate Object Name='%s'", inf.errorResponse.inf1.name); break; case IC_INVALID_TYPEID: ICA_Log_ErrC1("Invalid Type Id='%d'", inf.errorCode); break; case IC_UNKNOWN_TYPE: ICA_Log_ErrC1("Unknown Type Id='%d'", inf.errorCode); break; case IC_BLT_ERROR: ICA_Log_ErrC1("Bilateral Table Error '%s'.", inf.errorResponse.inf1.name); break; case IC_DSTRANSFERSET_ERROR: ICA_Log_ErrC1("DSTransferSet Error '%s'.", inf.errorResponse.inf1.name); break; case IC_INACTIVE_ARNAME: ICA_Log_ErrC1("Inactive AR Name '%s'.", inf.errorResponse.inf1.name); break; case IC_NOREG_ARNAME: ICA_Log_ErrC1("UnRegistered AR Name '%s'.", inf.errorResponse.inf1.name); break; case IC_ARNAME_FAIL: ICA_Log_ErrC1("AR Name Failure '%s'.", inf.errorResponse.inf1.name); break; case IC_MS_LOCL_TO_ASN1_ERROR: ICA_Log_ErrC1("ASN1 Encoding error for type '%s'.", inf.errorResponse.inf1.name); break; case IC_PE_STATUS_ERROR: ICA_Log_ErrC1("PE Status Error Code=%d.", inf.errorCode); break; case IC_UNKNOWN_TA_TYPE: ICA_Log_ErrC1("Unknown TA Type '%s'.", inf.errorResponse.inf1.name); break; case IC_MPERRRESP_ERROR: ICA_Log_ErrC1("MP Error for data set '%s'.", inf.errorResponse.inf1.name); break; case IC_UNKNOWN_OBJ_TAG: ICA_Log_ErrC2("Unknown Object Tag=%d. Object Name='%s'", inf.errorCode, inf.errorResponse.inf1.name); break; case IC_UNKNOWN_DATASET_ERROR: ICA_Log_ErrC1("Unknown Data Set Error for Data Set '%s'.", inf.errorResponse.inf1.name); break; case IC_DATASET_LOCK_ERROR: ICA_Log_ErrC1("Data Set Lock Error for Data Set '%s'.", inf.errorResponse.inf1.name); break; case IC_DATASET_SETUP_ERROR: ICA_Log_ErrC1("Data Set Setup Error for Data Set '%s'.", inf.errorResponse.inf1.name); break; case IC_RESPONSE_TOOLARGE_ERROR: ICA_Log_ErrC1("Response Too Large - #Resp = %d.", inf.errorCode); break; case IC_NO_WRITE_PERMISSION: ICA_Log_ErrC1("No Write Permission for data set type '%d'.\n", inf.errorCode); break; default: switch (inf.fieldId) { case 1: ICA_Log_ErrC1("Name='%s'.\n", inf.errorResponse.inf1.name); break; case 2: ICA_Log_ErrC3("Resp Err=%d Class=%d Code=%d", inf.errorResponse.inf2.resp_err, inf.errorResponse.inf2.eclass, inf.errorResponse.inf2.code); break; default: ICA_Log_ErrC1("Error Code = %d.", inf.errorCode); break; } } } /************************************************************************//* defCfgAll: define all configured stuff *//************************************************************************/static ST_BOOLEAN bShowMsg = SD_TRUE;ST_VOID defCfgAll (ST_VOID) {ST_BOOLEAN bIsClient = SD_FALSE;ST_BOOLEAN bIsServer = SD_FALSE;ICTA_REMOTE_INFO *pstRemote; #ifdef SISCO_THREADS#if defined(__alpha) || defined(_AIX)icInt status;#endif if (bMultiThreads) { /* first define any types */ if (doDefTypes() != SD_SUCCESS) printf("\n Problems defining types - see log file for details.\n"); pstRemote = pstVCC->remoteList; while (pstRemote) {#if defined(__alpha) || defined(_AIX) IC_PTHREAD_MUTEX_LOCK (&mutex, status); if (status) { printf("thread lock mutex failed.\n"); return; } printf ("\n Creating Thread to handle remote %p", pstRemote);#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 199506L) IC_PTHREAD_CREATE (&threadIDs[nLastThread++], NULL, doRemoteThread, pstRemote, status);#else IC_PTHREAD_CREATE (&threadIDs[nLastThread++], pthread_attr_default, (pthread_startroutine_t) doRemoteThread, (pthread_addr_t) pstRemote, status);#endif if (status) printf("Failed to create the thread!\n"); else printf("The thread has started.\n"); IC_PTHREAD_MUTEX_UNLOCK (&mutex, status); if (status) printf("thread mutex unlock failed.\n");#endif#ifdef _WIN32 threadHandles[nLastThread] = CreateThread (NULL, 0, doRemoteThread, (LPVOID)pstRemote, 0, threadIDs[nLastThread++]);#endif pstRemote = (ICTA_REMOTE_INFO *) list_get_next ((ST_VOID *)pstVCC->remoteList, (ST_VOID *)pstRemote); } /* end while */ return; } /* end if (bMultiThreads) */#endif bShowMsg = SD_FALSE; pstRemote = pstVCC->remoteList; while (pstRemote) { bIsClient |= pstRemote->bIsClient; bIsServer |= pstRemote->bIsServer; pstRemote = (ICTA_REMOTE_INFO *) list_get_next ((ST_VOID *)pstVCC->remoteList, (ST_VOID *)pstRemote); } if (bIsServer) defCfgServer(); if (bIsClient) defCfgClient(); bShowMsg = SD_TRUE; pause_msg("\nPress a key to continue!"); showCurrMenu(); }/************************************************************************//* defCfgSerfer: define all configured server stuff *//************************************************************************/ST_VOID defCfgServer (ST_VOID) { printf("\nDefining Server Objects . . .\n");#ifdef SISCO_THREADS if (bMultiThreads) { printf ("\nFor MultiThreaded testing, select Define All Configured Items."); pause_msg("\nPress a key to continue!"); showCurrMenu(); return; } /* end if (bMultiThreads) */#endif /* non threaded configuration starts here */ /* define remotes */ if (doDefRemotes (pstVCC->remoteList, ICTA_SERVER) != SD_SUCCESS) printf ("Define Server Remotes Failed - See Log File.\n"); else { printf ("Server Remotes Defined.\n"); /* define local features */ if (doDefFeatures (pstVCC->remoteList) != SD_SUCCESS) printf("Define Server Local Features Failed - See Log File\n"); else { /* define links */ if (doDefLinks (pstVCC->remoteList, ICTA_SERVER) != SD_SUCCESS) printf ("Define Server Links Failed - See Log File.\n"); else { printf ("Server Links Defined.\n"); /* define types */ if (doDefTypes() != SD_SUCCESS) printf("\n Problems defining types - see log file for details.\n"); /* define server variables */ if (doDefServerVars () == SD_SUCCESS) printf ("Server Variables Defined.\n"); else printf ("Define Server Variables Failed - See Log File.\n"); /* define server message */ if (doDefMsgs (ICTA_SERVER, pstVCC->remoteList) == SD_SUCCESS) printf ("Server Messages Defined.\n"); else printf ("Define Server Messages Failed - See Log File.\n"); /* define server devices */ if (doDefDevices (ICTA_SERVER, pstVCC->remoteList) == SD_SUCCESS) printf ("Server Devices Defined.\n"); else printf ("Define Server Devices Failed - See Log File.\n"); /* define server accounts */ if (doDefAccounts (ICTA_SERVER, pstVCC->remoteList) == SD_SUCCESS) printf ("Server Accounts Defined.\n"); else printf ("Define Server Accounts Failed - See Log File.\n"); } /* defined links ok */ } /* defined local features ok */ } /* defined remotes ok */ if (bShowMsg) { pause_msg("\nPress a key to continue!"); showCurrMenu(); } }/************************************************************************//* defCfgClient: define all configured client stuff *//************************************************************************/ST_VOID defCfgClient (ST_VOID) { printf("\nDefining Client Objects . . .\n");#ifdef SISCO_THREADS if (bMultiThreads) { printf ("\nFor MultiThreaded testing, select Define All Configured Items."); pause_msg("\nPress a key to continue!"); showCurrMenu(); return; } /* end if (bMultiThreads) */#endif /* define remotes */ if (doDefRemotes (pstVCC->remoteList, ICTA_CLIENT) != SD_SUCCESS) printf ("Define Client Remotes Failed - See Log File.\n"); else { printf ("Client Remotes Defined.\n"); /* define links */ if (doDefLinks (pstVCC->remoteList, ICTA_CLIENT) != SD_SUCCESS) printf ("Define Client Links Failed - See Log File.\n"); else { printf ("Client Links Defined.\n"); /* define types */ if (doDefTypes() != SD_SUCCESS) printf("\n Problems defining types - see log file for details.\n"); /* define client variables */ if (doDefClientVars () != SD_SUCCESS) printf ("Define Client Variables Failed - See Log File.\n"); else { printf ("Client Variables Defined.\n"); /* define client transfer groups */ if (doDefTranGroups() != SD_SUCCESS) printf("\nErrors defining Transfer Groups - See log file for details."); /* define client message */ if (doDefMsgs (ICTA_CLIENT, pstVCC->remoteList) == SD_SUCCESS) printf ("Client Messages Defined.\n"); else printf ("Define Client Messages Failed - See Log File.\n"); /* define client devices */ if (doDefDevices (ICTA_CLIENT, pstVCC->remoteList) == SD_SUCCESS) printf ("Client Devices Defined.\n"); else printf ("Define Client Devices Failed - See Log File.\n"); /* define client accounts */ if (doDefAccounts (ICTA_CLIENT, pstVCC->remoteList) == SD_SUCCESS) printf ("Client Accounts Defined.\n"); else printf ("Define Client Accounts Failed - See Log File.\n"); /* define TAConditions */ if (doDefConditions() != SD_SUCCESS) printf("\nProblem Defining Conditions - See log file for details."); else printf("\nConfigured Conditions Defined Successfully."); } /* defined data values OK */ } /* defined link OK */ } /* defined remote OK */ if (bShowMsg) { pause_msg("\nPress a key to continue!"); showCurrMenu(); } }/************************************************************************//* scrnLogOn: Turn on Screen Logging *//************************************************************************/ST_VOID scrnLogOn (ST_VOID) { slogDynOn(); pause_msg("\nPress a key to continue!"); showCurrMenu(); }/************************************************************************//* defAllStartAll: define all configured items and start remotes and *//* links *//************************************************************************/void defAllStartAll (void) {icInt status;ICTA_REMOTE_INFO *pstRemote;ICTA_LINK_INFO *pstLink; defCfgAll (); pstRemote = pstVCC->remoteList; while (pstRemote) { if (!pstRemote->bRemoteStarted) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -