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

📄 ma_acc3.c

📁 gsm map协议源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
      /* send a return result for this invoke on SAP_1 */
      case 1:
         MAACCPRINT_TEST((prntBuf, "Send OperRsp on SAP 1\n"));
         /* no error should be set here */
         maAccCb.curTst.state++;
         /* operation response is sent before 
            getting Delimiter Indication */
#ifndef MA_ACC_OPRRSP_CHANGE
         dstErr.pres   = FALSE;

         /* set the appropriate return result */
         maAccSetRR((PTR)&maRetRslt, oprCode);
 
         maAccOprRsp(dstSap, dstDlgIdx, invId, 
                                  oprCode, &dstErr, (PTR ) &maRetRslt);
#endif /* MA_ACC_OPRRSP_CHANGE */
         break;
 
      /* Send Delimiter Request on SAP_1 */
      case 2:
         MAACCPRINT_TEST((prntBuf, "Send DelimReq on SAP 1\n"));
         maAccCb.curTst.state++;
         MAACCDELIMREQ(dstSap, dstDlgIdx);
         break;
 
      /* Receive Open Confirm on SAP_0 */
      case 3:
         MAACCPRINT_TEST((prntBuf, "Check for OpenCfm on SAP 0\n"));
         maAccCb.curTst.state++;
         maAccChkOpenCfm(srcSap, srcDlgIdx, apn);
         break;
 
      /* receive a opr cfm for this invoke on SAP_0 */
      case 4:
         MAACCPRINT_TEST((prntBuf, "Check for OperCfm on SAP 0\n"));
         maAccCb.curTst.state++;
         if (maAccChkOprCfm(srcSap, srcDlgIdx, invId, 
                  &srcUsrErr, &srcPrvErr,(PTR *) &srcEv) != ROK)
         {
            MAACCPRNERROR((prntBuf, " Chk Opr Cfm failed\n"));
            maAccCb.curTst.result = MA_TST_FAILED;
            break;
         }

         if (srcUsrErr->pres || srcPrvErr->pres)
         {
            MAACCPRNERROR((prntBuf, " Error returned\n"));
            maAccCb.curTst.result = MA_TST_FAILED;
            break;
         }
         if (maAccChkRR((PTR)srcEv, oprCode) != ROK)
         {
            MAACCPRNERROR((prntBuf, " Chk RR failed\n"));
            maAccCb.curTst.result = MA_TST_FAILED;
         } 
         break;
      /* Receive Delimiter Indication on SAP_0 */
      case 5:
         maAccCb.curTst.state++;
         MAACCPRINT_TEST((prntBuf, "Check for DellimInd on SAP 0\n"));
         maAccChkDelimInd(srcSap, srcDlgIdx);
         break;
 
      /* Send Close Request on SAP_1 */
      case 6:
         /* Prepare the close event structure */
         maAccCb.curTst.state++;
         MAACCPRINT_TEST((prntBuf, "Send CloseInd on SAP 1\n"));
         cmZero((Data *) &closeEv, sizeof(MaCloseEv));

         closeEv.rlsCause = MAT_NORMAL_RELEASE;
         MAACCCLOSEREQ(dstSap, dstDlgIdx, &closeEv);
         break;
 
      /* Receive Close Indication on SAP_0 */
      case 7:
         maAccCb.curTst.state++;
         MAACCPRINT_TEST((prntBuf, "Recv CloseInd on SAP 0\n"));
         maAccChkCloseInd(srcSap, srcDlgIdx);
         break;
 
      default:
         MAACCPRNERROR((prntBuf, "maAccOpenDlgAndOperC: Bad State Info Passed\n"));
         maAccCb.curTst.result = MA_TST_FAILED;
         break;
   }

   RETVOID;
} /* end of maAccOpenDlgAndOperC */



/*
*
*       Fun:        maAccOpenDlgAnd3OperC
*
*       Desc:       Companion function
*            
*       Ret:        Void.
*              
*       Notes:      None.
*
*       File:       ma_acc3.c
*
*/
#ifdef ANSI
PUBLIC Void maAccOpenDlgAnd3OperC
(
U16         step,
U16         srcDlgIdx,            /* source dialogue index      */
U16         dstDlgIdx,            /* destination dialogue index */ 
MaApConName *apn,                 /* Apn to send                */
SpId        srcSap,
SpId        dstSap,
MaInvokeId  *invId,
MaInvokeId  *lnkInvId
)
#else
PUBLIC Void maAccOpenDlgAnd3OperC(step, srcDlgIdx, dstDlgIdx,apn,srcSap, 
                                   dstSap, invId, lnkInvId)
U16         step;
U16         srcDlgIdx;            /* source dialogue index      */
U16         dstDlgIdx;            /* destination dialogue index */ 
MaApConName *apn;                 /* Apn to send                */
SpId        srcSap;
SpId        dstSap;
MaInvokeId  *invId;
MaInvokeId  *lnkInvId;
#endif
{
   Txt            prntBuf[MA_PRNTBUF_SIZE];   /* buffer to print */
   MaOpenEv       openEv;                     /* open event structure */
   MaOprType      oprCode;
   MaCloseEv              closeEv;        /* close event structure */
   MaUsrErr               dstErr;         /* operation error */
   MaUsrErr               *srcUsrErr;     /* operation error */
   MaPrvErr               *srcPrvErr;     /* operation error */
   MaAllSSEv              *srcEv;         /* operation event */


   oprCode=MAT_UPLOC;
   MAACC_FILL_MANDATORY;

   TRC2(maAccOpenDlgAnd3OperC)

   switch(step)
   {
      /* Send Open Request on SAP_0 */
      case 0:
         /* Prepare the open event structure */
         maAccFlushQ();
         maAccFlushMsgQ();
         MAACCPRINT_TEST((prntBuf, "Send OpenRsp on Sap 1\n"));
         maAccCb.curTst.state++;
         maAccSetOpenEvent(&openEv,
                           &maAccAddrs[MA_ACC_MAP_PEER],
                           &maAccAddrs[MA_ACC_MAP],
                           apn,FALSE,FALSE);                   
         MAACCOPENRSP(dstSap, dstDlgIdx, &openEv);
         break;
 
      /* send a return result for this invoke on SAP_1 */
      case 1:
         MAACCPRINT_TEST((prntBuf, "Send OperRsp - 1 on SAP 1\n"));
         /* no error should be set here */
         maAccCb.curTst.state++;
         /* operation response is sent before 
            getting Delimiter Indication */
#ifndef MA_ACC_OPRRSP_CHANGE
         dstErr.pres   = FALSE;

         /* set the appropriate return result */
         maAccSetRR((PTR)&maRetRslt, oprCode);
 
         maAccOprRsp(dstSap, dstDlgIdx, invId, 
                                  oprCode, &dstErr, (PTR ) &maRetRslt);
#endif /* MA_ACC_OPRRSP_CHANGE */
         break;
 
      /* send a return result for this invoke on SAP_1 */
      case 2:
         MAACCPRINT_TEST((prntBuf, "Send OperRsp on SAP 1\n"));
         /* no error should be set here */
         maAccCb.curTst.state++;
         /* operation response is sent before 
            getting Delimiter Indication */
#ifndef MA_ACC_OPRRSP_CHANGE
         dstErr.pres   = FALSE;

         /* set the appropriate return result */
         maAccSetRR((PTR)&maRetRslt, oprCode);
 
         maAccOprRsp(dstSap, dstDlgIdx, invId + 1, 
                                  oprCode, &dstErr, (PTR ) &maRetRslt);
#endif /* MA_ACC_OPRRSP_CHANGE */
         break;

      /* send a return result for this invoke on SAP_1 */
      case 3:
         MAACCPRINT_TEST((prntBuf, "Send OperRsp - 2 on SAP 1\n"));
         /* no error should be set here */
         maAccCb.curTst.state++;
         /* operation response is sent before 
            getting Delimiter Indication */
#ifndef MA_ACC_OPRRSP_CHANGE
         dstErr.pres   = FALSE;

         /* set the appropriate return result */
         maAccSetRR((PTR)&maRetRslt, oprCode);
 
         maAccOprRsp(dstSap, dstDlgIdx, invId + 2, 
                                  oprCode, &dstErr, (PTR ) &maRetRslt);
#endif /* MA_ACC_OPRRSP_CHANGE */
         break;

      /* Send Delimiter Request on SAP_1 */
      case 4:
         MAACCPRINT_TEST((prntBuf, "Send DelimReq on SAP 1\n"));
         maAccCb.curTst.state++;
         MAACCDELIMREQ(dstSap, dstDlgIdx);
         break;
 
      /* Receive Open Confirm on SAP_0 */
      case 5:
         MAACCPRINT_TEST((prntBuf, "Check for OpenCfm on SAP 0\n"));
         maAccCb.curTst.state++;
         maAccChkOpenCfm(srcSap, srcDlgIdx, apn);
         break;
 
      /* receive a opr cfm for this invoke on SAP_0 */
      case 6:
         MAACCPRINT_TEST((prntBuf, "Check for OperCfm - 1 on SAP 0\n"));
         maAccCb.curTst.state++;
         if (maAccChkOprCfm(srcSap, srcDlgIdx, invId, 
                  &srcUsrErr, &srcPrvErr,(PTR *) &srcEv) != ROK)
         {
            MAACCPRNERROR((prntBuf, " Chk Opr Cfm failed\n"));
            maAccCb.curTst.result = MA_TST_FAILED;
            break;
         }

         if (srcUsrErr->pres || srcPrvErr->pres)
         {
            MAACCPRNERROR((prntBuf, " Error returned\n"));
            maAccCb.curTst.result = MA_TST_FAILED;
            break;
         }
         if (maAccChkRR((PTR)srcEv, oprCode) != ROK)
         {
            MAACCPRNERROR((prntBuf, " Chk RR failed\n"));
            maAccCb.curTst.result = MA_TST_FAILED;
         } 
         break;

      /* receive a opr cfm for this invoke on SAP_0 */
      case 7:
         MAACCPRINT_TEST((prntBuf, "Check for OperCfm - 2 on SAP 0\n"));
         maAccCb.curTst.state++;
         if (maAccChkOprCfm(srcSap, srcDlgIdx, invId + 1, 
                  &srcUsrErr, &srcPrvErr,(PTR *) &srcEv) != ROK)
         {
            MAACCPRNERROR((prntBuf, " Chk Opr Cfm failed\n"));
            maAccCb.curTst.result = MA_TST_FAILED;
            break;
         }

         if (srcUsrErr->pres || srcPrvErr->pres)
         {
            MAACCPRNERROR((prntBuf, " Error returned\n"));
            maAccCb.curTst.result = MA_TST_FAILED;
            break;
         }
         if (maAccChkRR((PTR)srcEv, oprCode) != ROK)
         {
            MAACCPRNERROR((prntBuf, " Chk RR failed\n"));
            maAccCb.curTst.result = MA_TST_FAILED;
         } 
         break;

      /* receive a opr cfm for this invoke on SAP_0 */
      case 8:
         MAACCPRINT_TEST((prntBuf, "Check for OperCfm on SAP 0\n"));
         maAccCb.curTst.state++;
         if (maAccChkOprCfm(srcSap, srcDlgIdx, invId + 2, 
                  &srcUsrErr, &srcPrvErr,(PTR *) &srcEv) != ROK)
         {
            MAACCPRNERROR((prntBuf, " Chk Opr Cfm failed\n"));
            maAccCb.curTst.result = MA_TST_FAILED;
            break;
         }

         if (srcUsrErr->pres || srcPrvErr->pres)
         {
            MAACCPRNERROR((prntBuf, " Error returned\n"));
            maAccCb.curTst.result = MA_TST_FAILED;
            break;
         }
         if (maAccChkRR((PTR)srcEv, oprCode) != ROK)
         {
            MAACCPRNERROR((prntBuf, " Chk RR failed\n"));
            maAccCb.curTst.result = MA_TST_FAILED;
         } 
         break;

      /* Receive Delimiter Indication on SAP_0 */
      case 9:
         maAccCb.curTst.state++;
         MAACCPRINT_TEST((prntBuf, "Check for DellimInd on SAP 0\n"));
         maAccChkDelimInd(srcSap, srcDlgIdx);
         break;
 
      /* Send Close Request on SAP_1 */
      case 10:
         /* Prepare the close event structure */
         maAccCb.curTst.state++;
         MAACCPRINT_TEST((prntBuf, "Send CloseInd on SAP 1\n"));
         cmZero((Data *) &closeEv, sizeof(MaCloseEv));

         closeEv.rlsCause = MAT_NORMAL_RELEASE;
         MAACCCLOSEREQ(dstSap, dstDlgIdx, &closeEv);
         break;
 
      /* Receive Close Indication on SAP_0 */
      case 11:
         maAccCb.curTst.state++;
         MAACCPRINT_TEST((prntBuf, "Recv CloseInd on SAP 0\n"));
         maAccChkCloseInd(srcSap, srcDlgIdx);
         break;
 
      default:
         MAACCPRNERROR((prntBuf, "maAccOpenDlgAndOperC: Bad State Info Passed\n"));
         maAccCb.curTst.result = MA_TST_FAILED;
         break;
   }

   RETVOID;
} /* end of maAccOpenDlgAnd3OperC */



/*
*
*       Fun:        maAccOpenDlgAndOperC1
*
*       Desc:       Companion function (when dialogues do not exist)
*            
*       Ret:        Void.
*              
*       Notes:      None.
*
*       File:       ma_acc3.c
*
*/
#ifdef ANSI
PUBLIC Void maAccOpenDlgAndOperC1
(
U16         step,
U16         srcDlgIdx,            /* source dialogue index      */
U16         dstDlgIdx,            /* destination dialogue index */ 
MaApConName *apn,                 /* Apn to send                */
SpId        srcSap,
SpId        dstSap,
MaInvokeId  *invId,
MaInvokeId  *lnkInvId
)
#else
PUBLIC Void maAccOpenDlgAndOperC1(step, srcDlgIdx, dstDlgIdx,apn,srcSap, 
                                   dstSap, invId, lnkInvId)
U16         step;
U16         srcDlgIdx;            /* source dialogue index      */
U16         dstDlgIdx;            /* destination dialogue index */ 
MaApConName *apn;                 /* Apn to send                */
SpId        srcSap;
SpId        dstSap;
MaInvokeId  *invId;
MaInvokeId  *lnkInvId;
#endif
{
   Txt            prntBuf[MA_PRNTBUF_SIZE];   /* buffer to print */
   MaOpenEv       openEv;                     /* open event structure */
   MaOprType      oprCode;
   MaAccMsgQElm  *msg;

   oprCode=MAT_UPLOC;
   MAACC_FILL_MANDATORY;

   TRC2(maAccOpenDlgAndOperC)

   switch(step)
   {
      /* Send Open Request on SAP_0 */
      case 0:
         /* Prepare the open event structure */
         maAccFlushQ();
         maAccFlushMsgQ();
         MAACCPRINT_TEST((prntBuf, "Send OpenRsp on Sap 1\n"));
         maAccCb.curTst.state++;
         maAccSetOpenEvent(&openEv,
                           &maAccAddrs[MA_ACC_MAP_PEER],
                           &maAccAddrs[MA_ACC_MAP],
                           apn,FALSE,FALSE);                   
         MAACCOPENRSP(dstSap, dstDlgIdx, &openEv);
         break;
 
      /* Check for Sta Ind as Dlg does not exist. */
      case 1:
         MAACCPRINT_TEST((prntBuf, "Check for Sta Ind on SAP 0\n"));
         maAccCb.curTst.state++;
         /* pop the message from the queue */

⌨️ 快捷键说明

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