📄 ictassoc.c
字号:
/************************************************************************//* SISCO SOFTWARE MODULE HEADER *****************************************//************************************************************************//* (c) Copyright Systems Integration Specialists Company, Inc., *//* 1996-1998, All Rights Reserved *//* *//* MODULE NAME : ICTASSOC.C *//* *//* MODULE DESCRIPTION : *//* handle association management functions *//* *//* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : *//* ST_VOID defCfgRemotes (ST_VOID) *//* ST_VOID defCftLinks (ST_VOID) *//* ST_VOID startRemotes (ST_VOID) *//* ST_VOID startLinks (ST_VOID) *//* ST_VOID stopRemotes (ST_VOID) *//* ST_VOID stopLinks (ST_VOID) *//* ST_VOID showChanInfo (ST_VOID) *//* ST_VOID showAssocSummary (ST_VOID) *//* *//* *//* MODIFICATION LOG : *//* Date Who Rev Comments *//* -------- --- ------ ------------------------------------------- *//* 08/09/02 nav 8 dump the wait in linkDown *//* 08/05/02 nav 7 changes to test 8 remote ar names *//* 08/28/00 nav 6 change logic in doDefRemote *//* 05/31/00 nav 5 start/stop individual links *//* 01/19/98 EJV 4 Added typecast in list functions. *//* 12/11/97 nav 3 Add icDefineDomainNames when defining remote *//* 06/20/97 nav 2 Overhaul - One process can be client& server *//* 06/05/97 nav 1 Convert to MMS-EASE V7.00 *//* 12/20/96 NAV creation *//************************************************************************/#include "ictamain.h"#include "scrndefs.h"#include "gvaldefs.h"#include "fkeydefs.h"#include "mms_user.h"/************************************************************************//* Global and Local variables *//************************************************************************/static char *thisFileName = __FILE__;/************************************************************************//* Static Function Declarations *//************************************************************************/static ST_RET doStartRemote(int howMany, int who, ICTA_REMOTE_INFO *remoteListHead);static ST_RET doStopRemote(int howMany, int who, ICTA_REMOTE_INFO *remoteListHead);static ST_RET doStartLinks(int howMany, int who, ICTA_REMOTE_INFO *remoteListHead);/************************************************************************//* defCfgRemotes: define configured remotes *//************************************************************************/ST_VOID defCfgRemotes (ST_VOID) { printf("\n\nDefine Configured Remotes . . .\n"); if (doDefRemotes (pstVCC->remoteList, ICTA_BOTH) == SD_SUCCESS) printf ("Remotes Defined.\n"); else printf ("Define Remotes Failed - See Log File.\n"); if (doDefFeatures (pstVCC->remoteList) != SD_SUCCESS) printf("Define Server Local Features Failed - See Log File\n"); pause_msg("\nPress a key to continue!"); showCurrMenu(); }/************************************************************************//* defCfgLinks: define configured links *//************************************************************************/ST_VOID defCfgLinks (ST_VOID) { printf("\n\nDefine Configured Links . . .\n"); if (doDefLinks (pstVCC->remoteList, ICTA_BOTH) == SD_SUCCESS) printf ("Links Defined.\n"); else printf ("Define Links Failed - See Log File.\n"); pause_msg("\nPress a key to continue!"); showCurrMenu(); }/************************************************************************//* startRemotes: start defined selected remotes *//************************************************************************/ST_VOID startRemotes (ST_VOID) {ST_BOOLEAN dataEntered;ST_CHAR buffer[256];ICTA_REMOTE_INFO *pstRemote; printf("\n\nStart Remotes . . .\n"); printf("Enter Remote Name To Start (enter=all): \n"); dataEntered = strget(buffer); if (dataEntered) { pstRemote = findRemote(ICTA_BOTH, buffer); if (pstRemote) { if (doStartRemote(ICTA_DO_ONE, ICTA_BOTH, pstRemote) != SD_SUCCESS) printf ("Start Remote '%s' failed!\n", buffer); else printf ("Start Remote '%s' SUCCESSFUL.\n", buffer); } else printf ("Remote Name '%s' NOT FOUND.\n", buffer); } else { if (doStartRemote(ICTA_DO_ALL, ICTA_BOTH, pstVCC->remoteList) != SD_SUCCESS) printf ("Start All Remotes FAILED!\n"); else printf ("Start All Remotes Successful.\n"); } pause_msg("\nPress a key to continue!"); showCurrMenu(); }/************************************************************************//* startLinks: start all links select remote or all remotes *//************************************************************************/ST_VOID startLinks (ST_VOID) {ST_CHAR buffer[256];ST_BOOLEAN dataEntered;ICTA_REMOTE_INFO *pstRemote;ICTA_LINK_INFO *pstLink; printf("\n\nStart Links . . .\n"); printf("Enter Remote Name (enter=all): \n"); dataEntered = strget(buffer); if (dataEntered) { pstRemote = findRemote(ICTA_BOTH, buffer); if (pstRemote) { pstLink = findOutWhichLink (&pstRemote); if (pstLink) { icStartLink(pstLink->linkId); pstLink->bLinkStarted = icTrue; printf ("Link '%s' to '%s' Started", pstLink->localAr, pstLink->remoteArs[0]); ICA_Log_Flow2("Link '%s' to '%s' Started OK.", pstLink->localAr, pstLink->remoteArs[0]); } else { if (doStartLinks(ICTA_DO_ONE, ICTA_BOTH, pstRemote) != SD_SUCCESS) printf ("Start Links for Remote '%s' failed!\n", buffer); else printf ("Start Links for Remote '%s' SUCCESSFUL.\n", buffer); } } else printf ("Remote Name '%s' NOT FOUND.\n", buffer); } else { if (doStartLinks(ICTA_DO_ALL, ICTA_BOTH, pstVCC->remoteList) != SD_SUCCESS) printf ("Start All Links FAILED!\n"); else printf ("Start All Links Successful.\n"); } pause_msg("\nPress a key to continue!"); showCurrMenu(); }/************************************************************************//* stopRemotes: stop one or all remotes for select who *//************************************************************************/ST_VOID stopRemotes (ST_VOID) {ST_BOOLEAN dataEntered;ST_CHAR buffer[256];ICTA_REMOTE_INFO *pstRemote; printf("\n\nStop Remotes . . .\n"); printf("Enter Remote Name To Stop (enter=all): \n"); dataEntered = strget(buffer); if (dataEntered) { pstRemote = findRemote(ICTA_BOTH, buffer); if (pstRemote) { if (doStopRemote(ICTA_DO_ONE, ICTA_BOTH, pstRemote) != SD_SUCCESS) printf ("Stop Remote '%s' failed!\n", buffer); else printf ("Stop Remote '%s' SUCCESSFUL.\n", buffer); } else printf ("Remote Name '%s' NOT FOUND.\n", buffer); } else { if (doStopRemote(ICTA_DO_ALL, ICTA_BOTH, pstVCC->remoteList) != SD_SUCCESS) printf ("Stop All Remotes FAILED!\n"); else printf ("Stop All Remotes Successful.\n"); } pause_msg("\nPress a key to continue!"); showCurrMenu(); }/************************************************************************//* stopLinks: stop all links for one or all remotes *//************************************************************************/ST_VOID stopLinks (ST_VOID) {ST_BOOLEAN dataEntered;ST_CHAR buffer[256];ICTA_REMOTE_INFO *pstRemote;ICTA_LINK_INFO *pstLink; printf("\n\nStop Links . . .\n"); printf("Enter Remote Name (enter=all): \n"); dataEntered = strget(buffer); if (dataEntered) { pstRemote = findRemote(ICTA_BOTH, buffer); if (pstRemote) { pstLink = findOutWhichLink (&pstRemote); if (pstLink) { icStopLink(pstLink->linkId); pstLink->bLinkStarted = icFalse; printf ("Link '%s' to '%s' Stopped", pstLink->localAr, pstLink->remoteArs[0]); ICA_Log_Flow2("Link '%s' to '%s' Stopped OK.", pstLink->localAr, pstLink->remoteArs[0]); } else { if (doStopLinks(ICTA_DO_ONE, pstRemote) != SD_SUCCESS) printf ("Stop Links for Remote '%s' failed!\n", buffer); else printf ("Stop Links for Remote '%s' SUCCESSFUL.\n", buffer); } } else printf ("Remote Name '%s' NOT FOUND.\n", buffer); } else { if (doStopLinks(ICTA_DO_ALL, pstVCC->remoteList) != SD_SUCCESS) printf ("Stop All Links FAILED!\n"); else printf ("Stop All Links Successful.\n"); } pause_msg("\nPress a key to continue!"); showCurrMenu(); }/************************************************************************//* showChanInfo: use undocumented icDisplayChanInfo *//************************************************************************/ST_VOID showChanInfo (ST_VOID) {ST_BOOLEAN dataEntered;ST_CHAR buffer[256]; printf("\n\nShow Channel Info . . .\n"); printf("\nEnter the Channel Number: "); if (dataEntered = strget(buffer)) icDisplayChanInfo(buffer); pause_msg("\nPress a key to continue!"); showCurrMenu(); } /************************************************************************//* showAssocSummary: *//************************************************************************/ST_VOID showAssocSummary (ST_VOID) {ICTA_REMOTE_INFO *pstRemote;ICTA_LINK_INFO *pstLink; printf("\n\nShow Association Summary . . .\n"); printf("\nLocal Control Center Name: %s", pstVCC->stLocal.localName); printf("\n Maximum TransferSets: %d", pstVCC->stLocal.nMaxTransferSets); printf("\n Maximum DataSets: %d", pstVCC->stLocal.nMaxDataSets); printf("\n Maximum MMS Message Size: %d", pstVCC->stLocal.nMaxMMSMsgSize); printf("\n\nRemotes:"); pstRemote = pstVCC->remoteList; while (pstRemote) { printf("\n\t Remote Name: %s", pstRemote->remoteName); printf("\n\tICCP Version: %s", pstRemote->iccpVersion); printf("\n\tBilateral ID: %s", pstRemote->bilatTableID); if (pstRemote->bRemoteDefined) printf("\n\tRemote has been Defined."); if (pstRemote->bRemoteStarted) printf("\n\tRemote has been Started."); if (pstRemote->bIsServer) printf("\n\tRemote is Configured as a SERVER."); if (pstRemote->bIsClient) printf("\n\tRemote is Configured as a CLIENT."); pstLink = pstRemote->linkList; while (pstLink) { printf("\n\t\tLink Name: %s", pstLink->linkName); printf("\n\t\t Local AR: %s", pstLink->localAr); printf("\n\t\tRemote AR: %s", pstLink->remoteArs[0]); printf("\n\t\tChannel #: %d", pstLink->nChannel); if (pstLink->bLinkDefined) printf("\n\t\tLink has been Defined."); if (pstLink->bLinkStarted) printf("\n\t\tLink has been Started."); pstLink = (ICTA_LINK_INFO *) list_get_next ((ST_VOID *)pstRemote->linkList, (ST_VOID *)pstLink); } pause_msg("Press a key to continue."); pstRemote = (ICTA_REMOTE_INFO *) list_get_next ((ST_VOID *)pstVCC->remoteList, (ST_VOID *)pstRemote); } /* end while pstRemote */ showCurrMenu(); }/************************************************************************//* doDefRemotes: traverse list and call icDefineRemote *//************************************************************************/ST_RET doDefRemotes(ICTA_REMOTE_INFO *remoteListHead, int who) {ICTA_REMOTE_INFO *pstRemote;icInt status;ST_RET rtnVal = SD_SUCCESS; pstRemote = remoteListHead; while (pstRemote) { if (!pstRemote->bRemoteDefined && ((who == ICTA_CLIENT && pstRemote->bIsClient) || (who == ICTA_SERVER && pstRemote->bIsServer) || (who == ICTA_BOTH) ) ) { 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", status, icPerror(status)); rtnVal = SD_FAILURE; } 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) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -