⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ictaacct.c

📁 ICCP Toolkit 是在 Tru64下开发Tase.2通信协议的开发包
💻 C
📖 第 1 页 / 共 3 页
字号:
    bMatrixAcct = icTrue;    pstAcct = pstRemote->serverObj->accountList;    }  else    {    pstAcct = findSimpleAccount(nRef, ICTA_SERVER);     if (!pstAcct)      {      printf("\nInvalid Account Reference.");      pause_msg("\nPress a key to continue!");      showCurrMenu();      return;      }    }  printf("\nEnter Condition in HEX:  ");  dataEntered = input_hex(hexBuffer, 1);  condition = hexBuffer[0];  printf("\nEnter Local Reference:  ");  dataEntered = strget(buffer);  if (dataEntered)    localRef = atoi(buffer);  else    localRef = 0;  printf("Enter Transfer Name:  ");  dataEntered = strget(name);  printf("Enter Periodic Resolution String:  ");  dataEntered = strget(periodResol);  acctHdrPtr.SendUtility = ICTA_UTIL_SEND;  acctHdrPtr.RecvUtility = ICTA_UTIL_RECEIVE;  acctHdrPtr.SellingUtility = ICTA_UTIL_SELLING;  acctHdrPtr.BuyerUtility = ICTA_UTIL_BUYING;  acctHdrPtr.TimeStamp = time(NULL);  acctHdrPtr.StartTime = acctHdrPtr.TimeStamp - 60;  if (localRef != 0)    acctHdrPtr.NumberLocalRef = 1;  else    acctHdrPtr.NumberLocalRef = 0;  acctHdrPtr.NumberSegments = 0;  strcpy(acctHdrPtr.Name, name);  strcpy(acctHdrPtr.PeriodResolution, periodResol);  while (pstAcct)    {    if (!bMatrixAcct || (pstAcct->matrixRef == nRef))      {      switch (pstAcct->valueType)        {        case IC_INTEGER_ACCOUNT:          acctHdrPtr.TransferAccountRef = pstAcct->nRef;          acctHdrPtr.NumberFloatIds = 0;          acctHdrPtr.NumberIntegerIds = 1;          acctHdrPtr.NumberProfileVals = 0;          acctHdrPtr.NumberPeriods = pstAcct->rows;          for (i=0; i<pstAcct->rows; i++)            {	    intVals[i] = anIntVal++;	    }          acctValPtr = (void *) intVals;          break;        case IC_FLOAT_ACCOUNT:          acctHdrPtr.TransferAccountRef = pstAcct->nRef;          acctHdrPtr.NumberFloatIds = 1;          acctHdrPtr.NumberIntegerIds = 0;          acctHdrPtr.NumberProfileVals = 0;          acctHdrPtr.NumberPeriods = pstAcct->rows;          for (i=0; i<pstAcct->rows; i++)            {	    floatVals[i] = aFloatVal;	    aFloatVal *= (float) 1.25;	    }          acctValPtr = (void *) floatVals;          break;        case IC_PROFILE_ACCOUNT:          acctHdrPtr.TransferAccountRef = pstAcct->nRef;          acctHdrPtr.NumberFloatIds = 0;          acctHdrPtr.NumberIntegerIds = 0;          acctHdrPtr.NumberProfileVals = pstAcct->rows;          acctHdrPtr.NumberPeriods = 0;          for (i=0; i<pstAcct->rows; i++)            {	    profVal[i].RampStartTime = time(NULL);	    profVal[i].RampDuration = profVal[i].RampStartTime + 120;	    profVal[i].ProfilePrice = profilePrice;	    profVal[i].ProfileTargetClass = targetClass;	    profVal[i].ProfileTarget =  targetValue;	    profilePrice *= (float) 1.05;	    targetClass++;	    targetClass = targetClass % 3;	    targetValue *= (float) 1.22;	    }          acctValPtr = (void *) profVal;          break;        default:          ICA_Log_Err2("Server Account Ref %d has an invalid value type %d",                        pstAcct->nRef, pstAcct->valueType);          break;        }	/* end the switch	*/      if (pstAcct->acctType == IC_TYPE_NAME_SEG_PRD)        {	segValIndex = 0;        acctHdrPtr.NumberSegments = pstAcct->rows; 	for (i=0; i<pstAcct->rows; i++)	  {	  tranSegs[i].TransmissionRef = i;	  tranSegs[i].UtilWheeling = ICTA_UTIL_WHEELING;	  tranSegs[i].UtilPaying = ICTA_UTIL_PAYING;	  tranSegs[i].TransmissionSegType = 1;	/* valid 0 thru 3 */	  tranSegs[i].UtilIn = ICTA_UTIL_IN;	  tranSegs[i].UtilOut = ICTA_UTIL_OUT;	  tranSegs[i].InterchangePtIn = 0;	  tranSegs[i].InterchangePtOut = 0;	  tranSegs[i].InterchangePt = 0;          if (pstAcct->valueType == IC_INTEGER_ACCOUNT)	    {	    tranSegs[i].NumberFloatIds = 0;	    tranSegs[i].NumberIntegerIds = 1;	    for (j=0; j<=pstAcct->rows; j++, segValIndex++)	      segIntVals[segValIndex] = segValIndex * 10;	    }	  else	    {	    tranSegs[i].NumberFloatIds = 1;	    tranSegs[i].NumberIntegerIds = 0;	    for (j=0; j<=pstAcct->rows; j++, segValIndex++)	      segFloatVals[segValIndex] = segValIndex * (float) 1.05;	    }	  }	segHdrPtr = tranSegs;        if (pstAcct->valueType == IC_INTEGER_ACCOUNT)	  segValPtr = (void *) segIntVals;	else          segValPtr = (void *) segFloatVals;	}      else        {        segValPtr = NULL;	segHdrPtr = NULL;	}      status = icSendSimpleAccount(pstLink->linkId,			           pstAcct->variableId,			           condition,			           0,			           localRef,			           &acctHdrPtr,			           acctValPtr,			           segHdrPtr,			           segValPtr);      if (status)        {        printf("\nSend Simple Account Failed (status =%d %s)",               status, icPerror(status));        ICA_Log_Err3("ERROR:  Send Simple Account %d, status = %d %s",                     pstAcct->nRef, status, icPerror(status));        }      }		/* end the if		*/    if (bMatrixAcct)      pstAcct = (ICTA_SIMPLE_ACCT *) list_get_next		((ST_VOID *)pstRemote->serverObj->accountList, (ST_VOID *)pstAcct);    else      pstAcct = NULL;    }		/* end while pstAcct	*/  pause_msg("\nPress a key to continue!");  showCurrMenu();  }/************************************************************************//* doDefAccounts:  define all accounts for all remotes for selected who *//************************************************************************/ST_INT doDefAccounts (int who, ICTA_REMOTE_INFO *remoteList)  {ICTA_REMOTE_INFO *pstRemote;ICTA_SIMPLE_ACCT *pstAcct, *pstAcctList;icInt		 status;ST_INT		 rtnVal = SD_SUCCESS;  pstRemote = remoteList;  while (pstRemote)    {    if (!pstRemote->bRemoteDefined)      {      pstRemote = (ICTA_REMOTE_INFO *) list_get_next		  ((ST_VOID *)remoteList, (ST_VOID *)pstRemote);      continue;      }    if (bUseNewB4B8)      {      if (who == ICTA_CLIENT)	setupB8Client (pstRemote);      else	setupB8Server (pstRemote);      pstRemote = (ICTA_REMOTE_INFO *) list_get_next		  ((ST_VOID *)remoteList, (ST_VOID *)pstRemote);      continue;      }    pstAcctList = NULL;    if (who == ICTA_CLIENT)      {      if (pstRemote->bIsClient)        pstAcctList = pstRemote->clientObj->accountList;      }    else      {      if (pstRemote->bIsServer)        pstAcctList = pstRemote->serverObj->accountList;      }    pstAcct = pstAcctList;    while (pstAcct)      {      if (!pstAcct->bAcctDefined)        {        switch (who)          {      	  case ICTA_CLIENT:	    status = icDefineClientSimpleAccount(pstRemote->remoteId,					         pstAcct->nRef,					         pstAcct->scope,					         pstAcct->acctType,						 NULL,	       						 pstAcct->valueType,					         &pstAcct->variableId,					         (icUserData)pstAcct,						 recvTACallBack);            if (status)	      {	      rtnVal = SD_FAILURE;	      ICA_Log_Err3("ERROR:  DefineClientAccount %d status = %d %s",	                   pstAcct->nRef, status, icPerror(status));	      }	    else	      {	      pstAcct->bAcctDefined = icTrue;	      ICA_Log_Flow1("ClientAccount ref %d defined ok.", pstAcct->nRef);	      }	    break;	  case ICTA_SERVER:	    status = icDefineServerSimpleAccount(pstRemote->remoteId,					         pstAcct->nRef,					         pstAcct->scope,					         pstAcct->acctType,						 NULL,						 pstAcct->valueType,					         &pstAcct->variableId,					         (icUserData)pstAcct,						 sendTACallBack,						 TACondCallBack);            if (status)	      {	      rtnVal = SD_FAILURE;	      ICA_Log_Err3("ERROR:  DefineServerAccount %d status = %d %s",	                   pstAcct->nRef, status, icPerror(status));	      }	    else	      {	      pstAcct->bAcctDefined = icTrue;	      ICA_Log_Flow1("ServerAccount ref %d defined ok.", pstAcct->nRef);	      }	    break;	  }		/* end the switch	*/	}		/* end the if		*/      pstAcct = (ICTA_SIMPLE_ACCT * ) list_get_next		((ST_VOID *)pstAcctList, (ST_VOID *)pstAcct);      }			/* end while pstAcct	*/    pstRemote = (ICTA_REMOTE_INFO *) list_get_next		((ST_VOID *)remoteList, (ST_VOID *)pstRemote);    }			/* end while pstRemote	*/  return rtnVal;  }/************************************************************************//* doDefMatrixAccts:  traverse client remote matrix list and create em	*//************************************************************************/static ST_VOID doDefMatrixAccts(ST_VOID)  {icInt numFloats, numInts, status;icTAVariableId floatIds[50], intIds[50];ICTA_REMOTE_INFO *pstRemote, *remoteList;ICTA_MATRIX_ACCT *pstMatrix;ICTA_SIMPLE_ACCT *pstAcct;ST_BOOLEAN	 bIsClient = SD_FALSE;  printf("\n\nDefine Matris Accounts . . .\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("\nDefineMatrixAccounts is Client Option ONLY!");    pause_msg("\nPress a key to continue!");    showCurrMenu();    return;    }  remoteList = pstVCC->remoteList;  pstRemote = remoteList;  while (pstRemote)    {    if (!pstRemote->bRemoteDefined)      {      pstRemote = (ICTA_REMOTE_INFO *) list_get_next		  ((ST_VOID *)remoteList, (ST_VOID *)pstRemote);      continue;      }    pstMatrix = pstRemote->clientObj->matrixList;    while (pstMatrix && !pstMatrix->bMatrixDefined)      {      numFloats = 0;      numInts = 0;      pstAcct = pstRemote->clientObj->accountList;      while (pstAcct)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -