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

📄 ma_acc3.c

📁 gsm map协议源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
         if (maAccPopMsgQ(&msg) != ROK)
         {
            MAACCPRNERROR((prntBuf, "maAccOpenDlgAndOperC1: Queue is !!EMPTY\n"));
            maAccCb.curTst.result = MA_TST_FAILED;
            RETVOID;
         }
 
         /* check if the message was received on the expected SAP */
         if (dstSap != msg->suId)
         {
            MAACCPRNERROR((prntBuf, "maAccOpenDlgAndOperC1: Primitive Rxd on Wrong SAP\n"));
            maAccCb.curTst.result = MA_TST_FAILED;
            RETVOID;
         }
 
         if (msg->evtType != MA_ACC_EVT_STAT_IND)
         {
            MAACCPRNERROR(
            (prntBuf, "maAccOpenDlgAndOperC1: Wrong MsgType(%d) \n", msg->evtType));
            maAccCb.curTst.result = MA_TST_FAILED;
            RETVOID;
         }

         /* check the cause and the source parameter */
         if (msg->s.statEv.primType != MAT_EVTOPENRSP)
         {
            MAACCPRNERROR((prntBuf,"maAccOpenDlgAndOperC1: Bad prim type  \n"));
            maAccCb.curTst.result = MA_TST_FAILED;
            RETVOID;
         }
         break;
 
 
      default:
         MAACCPRNERROR((prntBuf, "maAccOpenDlgAndOperC1: Bad State Info Passed\n"));
         maAccCb.curTst.result = MA_TST_FAILED;
         break;
   }

   RETVOID;
} /* end of maAccOpenDlgAndOperC1 */

#ifdef MA_SEG

/*
*
*       Fun:     maAccTstClass13SegRsp
*
*       Desc:    This function performs the common steps for testing
*                the segmented responses. i.e. for MAP RR-NL segments.
*            
*       Ret:     Void.
*              
*       Notes:   None.
*
*       File:    ma_acc3.c
*
*/
#ifdef ANSI
PUBLIC Void maAccTstClass13SegRsp
(
PTR    invoke,       /* invoke to be tested */
U16    type,         /* operation to be tested */
U32    size          /* segment size  */
)
#else
PUBLIC Void maAccTstClass13SegRsp(invoke, type, size)
PTR    invoke;       /* invoke to be tested */
U16    type;         /* operation to be tested */
U32    size;         /* segment size       */
#endif
{
   Txt                    prntBuf[MA_PRNTBUF_SIZE];   /* buffer to print */
   /* static variables */
   PRIVATE U16            srcDlgIdx;      /* source dialogue index */
   PRIVATE U16            dstDlgIdx;      /* destination dialogue index */
   PRIVATE MaInvokeId     invId;          /* invoke Id */
   PRIVATE MaOprType      oprCode;        /* operation code */
   PRIVATE MaInvokeId     lnkInvId;       /* linked invoke Id */
   PRIVATE MaApConName    acn;            /* ap context name */

   /* non-static variables */
   MaOpenEv               openEv;         /* open event structure */
   MaCloseEv              closeEv;        /* close event structure */
   MaUsrErr               dstErr;         /* operation error */
   MaUsrErr               *srcUsrErr;     /* operation error */
   MaPrvErr               *srcPrvErr;     /* operation error */
   MaAllSSEv              *srcEv;         /* operation event */
   MaAccMsgQElm  *msg;             /* queue message to be returned */
   Bool          queueStatus; 
#if MAP_REL99
#if (MAP_SEC && LMAV2)
   PRIVATE Bool           done; 
#endif /* MAP_SEC */
#endif
  

   TRC2(maAccTstClass13SegRsp)

   /* Initialize the Test variables */
   if (!maAccCb.curTst.init)
   {
      MaApConName            altAcn;     
      U8                     oprClass1,maVer;    
      srcDlgIdx     = 0;
      dstDlgIdx     = 1;
      lnkInvId.pres = NOTPRSNT;
      maAccInitDlgCp(MA_ACC_SAP_0,
                     &maAccCb.dlgCp[srcDlgIdx], 
                     MA_ACC_SAP_1,
                     &maAccCb.dlgCp[dstDlgIdx]);
      maAccCb.curTst.init = TRUE;
      oprCode = (MaOprType)type;
      maAccFillAcn((U8)type,&acn,&altAcn,&oprClass1,&maVer);
      acn.val[acn.len-1] = (U8)maAccCb.pSwtch;
      /* check for the operation version applicability */
      MA_ACC_CHECK_OPR_VER(16,maVer)
#if MAP_REL99
#if (MAP_SEC && LMAV2)
      maAccSecCfgMaTst(&done, TRUE, TRUE);
#endif /*MAP_SEC*/
#endif
   }
 
#if MAP_REL99
#if (MAP_SEC && LMAV2)
   if(maAccCb.curTst.init == TRUE) 
   {
      if(done == FALSE)
      {
         maAccSecCfgMaTst(&done, TRUE, TRUE);
         RETVOID;
      }
   }
   else 
   {
      maAccCb.curTst.init = TRUE;
      RETVOID;
   }
#endif /*MAP_SEC*/
#endif
   queueStatus = TRUE;
   /* pop the message from the queue */
   if (maAccPopMsgQ(&msg) == ROK)
   {
      if ((msg->evtType == MA_ACC_EVT_OPEN_CFM) || 
          (msg->evtType == MA_ACC_EVT_DELIM_IND))
      {
         RETVOID;
      }
      else
      {

         if(maAccCb.msgQ.rdPtr == 0)
         {
            maAccCb.msgQ.rdPtr = (U16)MA_ACC_MSG_QSIZE-1;
         }
         else
         {
            maAccCb.msgQ.rdPtr--;
         }
      }
   }
   switch(maAccCb.curTst.state)
   {
 
      /* Send Open Request on SAP_0 */
      case 0:
         /* Prepare the open event structure */
         maAccCb.curTst.state++;
         (Void)maAccSegGenCfg(ENTMA, 
                           TSTINST_0, 
                           MA_ACC_MAX_SAPS, 
                           MA_ACC_MAX_DLGS,
                           MA_ACC_MAX_OPRS,
                           0,200,type,size);
         break;
 
      /* Send Open Request on SAP_0 */
      case 1:
         /* Prepare the open event structure */
         maAccCb.curTst.state++;
#if (MAP_SEC && LMAV2 && MAP_REL99)
         /* Prepare the open event structure for secured MAP dialogue */
         maAccSetOpenEvent(&openEv, &maAccAddrs1[MA_ACC_MAP_PLMNA],
                           &maAccAddrs1[MA_ACC_MAP_PLMNB],
         &acn,FALSE,FALSE);
         maAccSetPlmnId(&openEv.plmnId,MA_ACC_PLMN_MCC_B, MA_ACC_PLMN_MNC_B);
#else
         maAccSetOpenEvent(&openEv, &maAccAddrs[MA_ACC_MAP],
               &maAccAddrs[MA_ACC_MAP_PEER], &acn,FALSE,FALSE);
#endif 
         MAACCOPENREQ(MA_ACC_SAP_0, srcDlgIdx, &openEv);
         break;
 
      /* Receive Dialogue Confirm on SAP_0 */
      case 2:
         maAccCb.curTst.state++;
         maAccChkDlgCfm(MA_ACC_SAP_0, srcDlgIdx);
         break;
 
      /* Send an operation request for this invoke */
      case 3:

         maAccCb.curTst.state++;
         invoke = (PTR )&maInvoke;

         if (maAccSetInvoke(invoke, oprCode) != ROK)
         {
            MAACCPRNERROR((prntBuf, "TstClass13SegRsp:failed to set Inv\n"));
            maAccCb.curTst.result = MA_TST_FAILED;
            break;
         }
         
         /* allocate an invoke Id for this operation */
         if (maAccAllocInvokeId(&invId) != ROK)
         {
            MAACCPRNERROR((prntBuf, "TstClass13SegRsp:AllocInvokeId failed\n"));
            maAccCb.curTst.result = MA_TST_FAILED;
            break;
         }
 
    
         /* Now issue an operation request to MAP */
         maAccOprReq(MA_ACC_SAP_0, 
                     srcDlgIdx, 
                     &invId, 
                     &lnkInvId,
                     oprCode, 
                     (PTR) invoke);         

         break;

      /* Send Delimiter Request on SAP_0 */
      case 4:
         maAccCb.curTst.state++;
         MAACCDELIMREQ(MA_ACC_SAP_0, srcDlgIdx);
         break;
 
      /* Receive Open Indication on SAP_1 */
      case 5:
         maAccCb.curTst.state++;
         maAccChkOpenInd(MA_ACC_SAP_1, dstDlgIdx, &acn);
         break;
 
      /* receive this invoke at the Peer MAP (SAP_1) */
      case 6: 

         /* invoke event structure is checked inside the maAccChkOprInd */
         maAccCb.curTst.state++;
         if (maAccChkOprInd(MA_ACC_SAP_1, dstDlgIdx, &invId, oprCode) != ROK)
         {
            MAACCPRNERROR((prntBuf, "maAccTstClass13SegRsp: Chk Opr Ind failed\n"));
            maAccCb.curTst.result = MA_TST_FAILED;
            break;
         }
         break;
 
      /* Send Open Response on SAP_1 */
      case 7:
         /* Prepare the open event structure */
         maAccCb.curTst.state++;
#if (MAP_SEC && LMAV2 && MAP_REL99)
         /* Prepare the open event struct for Open rsp to secured MAP dlg */
         maAccSetOpenEvent(&openEv,
         &maAccAddrs1[MA_ACC_MAP_PLMNB],
                           &maAccAddrs1[MA_ACC_MAP_PLMNA],
         &acn,FALSE,FALSE);
#else
         maAccSetOpenEvent(&openEv,
                           &maAccAddrs[MA_ACC_MAP_PEER],
                           &maAccAddrs[MA_ACC_MAP],
                           &acn,FALSE,FALSE);                   
#endif /*MAP_SEC*/
         MAACCOPENRSP(MA_ACC_SAP_1, dstDlgIdx, &openEv);
         break;
 
      /* send a return result for this invoke on SAP_1 */
      case 8:
         /* no error should be set here */
         maAccCb.curTst.state++;
         dstErr.pres   = FALSE;

         /* set the appropriate return result */
         maAccSetRR((PTR)&maRetRslt, oprCode);
 
         maAccOprRsp(MA_ACC_SAP_1, dstDlgIdx, &invId, 
                                  oprCode, &dstErr, (PTR ) &maRetRslt);
         break;
 
      case 9:
         maAccCb.curTst.state++;
         MAACCDELIMREQ(MA_ACC_SAP_1, dstDlgIdx);
         break;
      case 10:
         maAccCb.curTst.state++;
         if (maAccChkOprCfm(MA_ACC_SAP_0, srcDlgIdx, &invId, 
                  &srcUsrErr, &srcPrvErr,(PTR *) &srcEv) != ROK)
         {
            MAACCPRNERROR((prntBuf, "maAccTstClass13SegRsp: Chk Opr Cfm failed\n"));
            maAccCb.curTst.result = MA_TST_FAILED;
            break;
         }

         if (srcUsrErr->pres || srcPrvErr->pres)
         {
            MAACCPRNERROR((prntBuf, "maAccTstClass13SegRsp: Error returned\n"));
            maAccCb.curTst.result = MA_TST_FAILED;
            break;
         }
         if (maAccChkRR((PTR)srcEv, oprCode) != ROK)
         {
            MAACCPRNERROR((prntBuf, "maAccTstClass13SegRsp: Chk RR failed\n"));
            maAccCb.curTst.result = MA_TST_FAILED;
         } 
         break;
      /* Send Close Request on SAP_1 */
      case 11:
         /* Prepare the close event structure */
         maAccCb.curTst.state++;
         cmZero((Data *) &closeEv, sizeof(MaCloseEv));

         closeEv.rlsCause = MAT_NORMAL_RELEASE;
         MAACCCLOSEREQ(MA_ACC_SAP_1, dstDlgIdx, &closeEv);
         break;
 
      /* Receive Close Indication on SAP_0 */
      case 12:
         maAccCb.curTst.state++;
         maAccChkCloseInd(MA_ACC_SAP_0, srcDlgIdx);
         break;

      /* Get the statistics on SAP_0 and don't zero the counters */
      case 13:
         maAccCb.curTst.state++;
         maAccStsReq(MA_ACC_SAP_0, ZEROSTS, MAACC_TRANSID1);

         /* Watch for the statistics counters being printed on the screen */
         break;
 
      /* Get the statistics on SAP_1 and don't zero the counters */
      case 14:
         maAccCb.curTst.state++;
         maAccStsReq(MA_ACC_SAP_1, ZEROSTS, MAACC_TRANSID2);

         /* Watch for the statistics counters being printed on the screen */
         break;
 
      /* Clear the resources, Test case has ended */
      case 15:
         /* Free the invoke Id here */
         maAccCb.curTst.state++;
         maAccFreeInvokeId(&invId);
         break;

      /* Clear the resources, Test case has ended */
      case 16:
         /* Free the invoke Id here */
         (Void)maAccGenCfg(ENTMA, 
                           TSTINST_0, 
                           MA_ACC_MAX_SAPS, 
                           MA_ACC_MAX_DLGS,
                           MA_ACC_MAX_OPRS,
                           0,200);
         maAccCb.curTst.result = MA_TST_OK;
         maAccCb.curTst.end    = TRUE;
         break;
   }
 
   RETVOID;
} /* maAccTstClass13SegRsp */


/*
*
*       Fun:     maAccTstNegSegRsp
*
*       Desc:    This function performs the common steps for testing
*                failure case for MAP RR NL segmentation. 
*            
*       Ret:     Void.
*              
*       Notes:   None.
*
*       File:    ma_acc3.c
*
*/
#ifdef ANSI
PUBLIC Void maAccTstNegSegRsp
(
PTR    invoke,       /* invoke to be tested */
U16    type,         /* operation to be tested */
U32    size,         /* segment size  */
U8     primType      /* primitive type */
)
#else
PUBLIC Void maAccTstNegSegRsp(invoke, type, size,primType)
PTR    invoke;       /* invoke to be tested */
U16    type;         /* operation to be tested */
U32    size;         /* segment size       */
U8     primType;     /* primitive type     */
#endif
{
   Txt                    prntBuf[MA_PRNTBUF_SIZE];   /* buffer to print */
   

⌨️ 快捷键说明

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