📄 ictaacct.c
字号:
/************************************************************************//* SISCO SOFTWARE MODULE HEADER *****************************************//************************************************************************//* (c) Copyright Systems Integration Specialists Company, Inc., *//* 1996-2002, All Rights Reserved *//* *//* MODULE NAME : ICTAACCT.C *//* *//* MODULE DESCRIPTION : *//* handle transfer account functions *//* *//* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : *//* ST_VOID defCfgAccts (ST_VOID) *//* ST_VOID defNewAcct (ST_VOID) *//* ST_VOID defCfgConditions (ST_VOID) *//* ST_VOID defNewConditions (ST_VOID) *//* ST_VOID requestTA (ST_VOID) *//* ST_VOID sendTA (ST_VOID) *//* void recvTACallBack (...) *//* void sendTACallBack (...) *//* void TACondCallBack (...) *//* *//* *//* MODIFICATION LOG : *//* Date Who Rev Comments *//* -------- --- ------ ------------------------------------------- *//* 07/05/02 nav 8 doDefAccounts: watch for nulls *//* 02/15/02 EJV 7 Added typecast in ctime. *//* 08/28/00 NAV 6 Watch for bUseNewB4B8 *//* 08/18/98 NAV 5 Watch for valid LinkName *//* 06/10/98 nav 4 Clean up output *//* 01/19/98 EJV 3 Added typecast in list functions. *//* 11/07/97 nav 3 add segments to send account *//* 06/20/97 nav 2 Overhaul - One process can be client& server *//* 06/05/97 nav 1 Convert to MMS-EASE V7.00 *//* 12/30/96 NAV creation *//************************************************************************/#include "ictamain.h"#include "scrndefs.h"#include "gvaldefs.h"#include "fkeydefs.h"/************************************************************************//* Global and Local variables *//************************************************************************/static char *thisFileName = __FILE__;static icInt requestID = 0;static int anIntVal = 0;static float aFloatVal = (float) 1.0;static float profilePrice = (float) .99;static short targetClass = 0;static float targetValue = (float) .58;/************************************************************************//* static functions *//************************************************************************/static ST_VOID doDefMatrixAccts(ST_VOID);/************************************************************************//* defCfgAccts: define configured accounts *//************************************************************************/ST_VOID defCfgAccts (ST_VOID) {int todo; printf("\n\nDefine Configured Accounts . . .\n"); todo = findOutWho(); switch (todo) { case ICTA_CLIENT: if (doDefAccounts (ICTA_CLIENT, pstVCC->remoteList) == SD_SUCCESS) printf ("Client Accounts Defined.\n"); else printf ("Define Client Accounts Failed - See Log File.\n"); doDefMatrixAccts(); break; case ICTA_SERVER: if (doDefAccounts (ICTA_SERVER, pstVCC->remoteList) == SD_SUCCESS) printf ("Server Accounts Defined.\n"); else printf ("Define Server Accounts Failed - See Log File.\n"); break; case ICTA_BOTH: if (doDefAccounts (ICTA_SERVER, pstVCC->remoteList) == SD_SUCCESS) printf ("Server Accounts Defined.\n"); else printf ("Define Server Accounts Failed - See Log File.\n"); if (doDefAccounts (ICTA_CLIENT, pstVCC->remoteList) == SD_SUCCESS) printf ("Client Accounts Defined.\n"); else printf ("Define Client Accounts Failed - See Log File.\n"); doDefMatrixAccts(); break; default: printf ("NO ACCOUNTS defined.\n"); break; } pause_msg("\nPress a key to continue!"); showCurrMenu(); }/************************************************************************//* defNewAcct: define a new account *//************************************************************************/ST_VOID defNewAcct (ST_VOID) { printf("\n\nDefine New Account . . .\n"); printf("\n Sorry - Just a Stub!!!!"); pause_msg("\nPress a key to continue!"); showCurrMenu(); }/************************************************************************//* defCfgConditions: define configured conditions *//************************************************************************/ST_VOID defCfgConditions (ST_VOID) {ST_BOOLEAN bIsClient = SD_FALSE;ICTA_REMOTE_INFO *pstRemote; printf("\n\nDefine Configured Conditions . . .\n"); pstRemote = pstVCC->remoteList; while (pstRemote && !bIsClient) { bIsClient = pstRemote->bIsClient; pstRemote = (ICTA_REMOTE_INFO *) list_get_next ((ST_VOID *)pstVCC->remoteList, (ST_VOID *)pstRemote); } if (!bIsClient) { printf("\nDefine Conditions is a CLIENT ONLY Operation!"); pause_msg("\nPress a key to continue!"); showCurrMenu(); return; } if (doDefConditions() != SD_SUCCESS) printf("\nProblem Defining Conditions - See log file for details."); else printf("\nConfigured Conditions Defined Successfully."); pause_msg("\nPress a key to continue!"); showCurrMenu(); }/************************************************************************//* defNewConditions: define new conditions *//************************************************************************/ST_VOID defNewConditions (ST_VOID) { printf("\n\nDefine New Condition . . .\n"); printf("\n Sorry - Just a Stub!!!!"); pause_msg("\nPress a key to continue!"); showCurrMenu(); }/************************************************************************//* requestTA: the client request transfer account data *//************************************************************************/ST_VOID requestTA (ST_VOID) {ICTA_REMOTE_INFO *pstRemote;ICTA_LINK_INFO *pstLink;ICTA_SIMPLE_ACCT *pstAcct;ST_CHAR buffer[100];ST_BOOLEAN dataEntered;icInt nRef, status;icLong duration;icChar condition;ST_UCHAR hexBuffer[100];ST_BOOLEAN bIsClient = SD_FALSE; printf("\n\nRequest Transfer Account . . .\n"); pstRemote = pstVCC->remoteList; while (pstRemote && !bIsClient) { bIsClient = pstRemote->bIsClient; pstRemote = (ICTA_REMOTE_INFO *) list_get_next ((ST_VOID *)pstVCC->remoteList, (ST_VOID *)pstRemote); } if (!bIsClient) { printf("\nClient Option ONLY!"); pause_msg("\nPress a key to continue!"); showCurrMenu(); return; } pstRemote = pstVCC->remoteList; pstLink = findOutWhichLink(&pstRemote); if (!pstLink) { printf ("Invalid LinkName"); pause_msg("Press a key to continue!\n"); showCurrMenu(); return; } printf("Enter Account Reference: "); dataEntered = strget(buffer); if (!dataEntered) { pause_msg("\nPress a key to continue!"); showCurrMenu(); return; } nRef = atoi(buffer); pstAcct = findSimpleAccount(nRef, ICTA_CLIENT); if (!pstAcct) { printf("\nInvalid Account Reference."); pause_msg("\nPress a key to continue!"); showCurrMenu(); return; } if (ask("Include Condition? (N) ", SD_FALSE)) { printf("\nEnter Condition in HEX: "); dataEntered = input_hex(hexBuffer, 1); condition = hexBuffer[0]; } else condition = (char) TAC_ALL; printf("\nEnter the duration in seconds: "); dataEntered = strget(buffer); if (!dataEntered) { printf("\nabort request transfer account."); pause_msg("\nPress a key to continue!"); showCurrMenu(); return; } duration = atol(buffer); status = icRequestSimpleAccount(pstLink->linkId, pstAcct->variableId, requestID++, time(NULL), duration, condition); if (status) { printf("\nRequest Simple Account Failed (status =%d %s)", status, icPerror(status)); ICA_Log_Err3("ERROR: Request Simple Account %d, status = %d %s", pstAcct->nRef, status, icPerror(status)); } pause_msg("\nPress a key to continue!"); showCurrMenu(); }/************************************************************************//* sendTA: the server sends transfer account data to the client *//************************************************************************/#define MAX_TRAN_PERIODS 10ST_VOID sendTA (ST_VOID) {ICTA_REMOTE_INFO *pstRemote;ICTA_LINK_INFO *pstLink;ICTA_SIMPLE_ACCT *pstAcct;ICTA_MATRIX_ACCT *pstMatrix;icBoolean bMatrixAcct = icFalse;ST_CHAR buffer[100], name[MAX_ID_LEN], periodResol[MAX_ID_LEN];ST_UCHAR hexBuffer[100];ST_BOOLEAN dataEntered;icInt nRef, status;icChar condition;icReferenceNumType localRef;icTypeAccountHeader acctHdrPtr;void *acctValPtr, *segValPtr;int j, intVals[MAX_TRAN_PERIODS], segIntVals[100], i, segValIndex;float floatVals[MAX_TRAN_PERIODS], segFloatVals[100];icTypeProfileValue profVal[MAX_TRAN_PERIODS];icTypeTransmissionSeg tranSegs[MAX_TRAN_PERIODS], *segHdrPtr;ST_BOOLEAN bIsServer = SD_FALSE; printf("\n\nSend Transfer Account . . .\n"); pstRemote = pstVCC->remoteList; while (pstRemote && !bIsServer) { bIsServer = pstRemote->bIsServer; pstRemote = (ICTA_REMOTE_INFO *) list_get_next ((ST_VOID *)pstVCC->remoteList, (ST_VOID *)pstRemote); } if (!bIsServer) { printf("\nServer Option ONLY!"); pause_msg("\nPress a key to continue!"); showCurrMenu(); return; } pstRemote = pstVCC->remoteList; pstLink = findOutWhichLink(&pstRemote); if (!pstLink) { printf ("Invalid LinkName"); pause_msg("Press a key to continue!\n"); showCurrMenu(); return; } printf("\nEnter Account Reference: "); dataEntered = strget(buffer); if (!dataEntered) { pause_msg("\nPress a key to continue!"); showCurrMenu(); return; } nRef = atoi(buffer); pstMatrix = findMatrixAccount(nRef, ICTA_SERVER); if (pstMatrix) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -