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

📄 layer4.c

📁 gsm map协议源代码
💻 C
📖 第 1 页 / 共 3 页
字号:
      compFlag = FALSE;

      if (qSize > 0)
      {
         compFlag = TRUE;
      }

      pAbtCause.pres = FALSE;
      pAbtCause.octet = 0;

      if ((maAccCb.curTst.id == MA_TSTID_600) && (msgType == STU_BEGIN))
      {
         SInitMsg(uiBuf);
         SAddPstMsgMult(msg_buffer, 24, uiBuf);
      }

      /* swap the address */
      if ((maAccCb.curTst.cptFlag == TRUE) &&
          ((maAccCb.curTst.id == MA_TSTID_563) ||
           (maAccCb.curTst.id == MA_TSTID_564) ||
           (maAccCb.curTst.id == MA_TSTID_566) ||
           (maAccCb.curTst.id == MA_TSTID_567)))
      {
         dlgEv->apConName.string[(dlgEv->apConName.len) - 1] = LMA_VER3;
         maAccCb.curTst.cptFlag = FALSE;
      }

       
      if ((maAccCb.curTst.cptFlag == TRUE) &&
          (maAccCb.curTst.id == MA_TSTID_565))
      {
         dlgEv->apConName.string[(dlgEv->apConName.len) - 1] = LMA_VER1;
         maAccCb.curTst.cptFlag = FALSE;
      }

      if ((maAccCb.curTst.cptFlag == TRUE) &&
          (maAccCb.curTst.id == MA_TSTID_552))
      {
         srcAddr->gt.addr.strg[0]=0xff;
         maAccCb.curTst.cptFlag = FALSE;
      }
      if ((maAccCb.curTst.cptFlag == TRUE) &&
          (maAccCb.curTst.id == MA_TSTID_553))
      {
         SRepMsg(02,uiBuf,28);
         maAccCb.curTst.cptFlag = FALSE;
      }
      if ((maAccCb.curTst.cptFlag == TRUE) &&
          ((maAccCb.curTst.id == MA_TSTID_540) ||
           (maAccCb.curTst.id == MA_TSTID_588) ||
           (maAccCb.curTst.id == MA_TSTID_583)))
      {
         /* Modify the value in the ACN string to any arbitrary value */
         dlgEv->apConName.string[(dlgEv->apConName.len) - 3] = 9;
         maAccCb.curTst.cptFlag = FALSE;
      }
      if ((maAccCb.curTst.cptFlag == TRUE) &&
          ((maAccCb.curTst.id == MA_TSTID_584) ||
           (maAccCb.curTst.id == MA_TSTID_589) ||
           (maAccCb.curTst.id == MA_TSTID_582)))
      {
         SRepMsg(0xff,uiBuf,22);
         maAccCb.curTst.cptFlag = FALSE;
      }

#ifdef MATV3
      if ((maAccCb.curTst.cptFlag == TRUE) &&
          ((maAccCb.curTst.id == MA_TSTID_698) ||
           (maAccCb.curTst.id == MA_TSTID_700) ||
           (maAccCb.curTst.id == MA_TSTID_701)))
      {
         dlgEv->apConName.string[(dlgEv->apConName.len) - 1] = LMA_VER3;
         maAccCb.curTst.cptFlag = FALSE;
      }

       
      if ((maAccCb.curTst.cptFlag == TRUE) &&
          (maAccCb.curTst.id == MA_TSTID_699))
      {
         dlgEv->apConName.string[(dlgEv->apConName.len) - 1] = LMA_VER1;
         maAccCb.curTst.cptFlag = FALSE;
      }

      /* To check the value of the priority and protocol class fields
       * required in the MATV3 testcases */
      if(msgType == STU_BEGIN)
      {
         maPriorBgn.pres = TRUE;
         maPriorBgn.val  = qos->msgPrior;
         pClassBgn.pres  = TRUE;
         pClassBgn.val   = (qos->seqCtl == TRUE)?(PCLASS1):(PCLASS0);
      }
      if(msgType == STU_CONTINUE)
      {
         maPriorCont.pres = TRUE;
         maPriorCont.val  = qos->msgPrior;
         pClassCont.pres  = TRUE;
         pClassCont.val   = (qos->seqCtl == TRUE)?(PCLASS1):(PCLASS0);
      }
      if(msgType == STU_END)
      {
         maPriorEnd.pres  = TRUE;
         maPriorEnd.val   = qos->msgPrior;
         pClassEnd.pres   = TRUE;
         pClassEnd.val    = (qos->seqCtl == TRUE)?(PCLASS1):(PCLASS0);
      }
      if(msgType == STU_ABORT)
      {
         maPriorAbrt.pres = TRUE;
         maPriorAbrt.val  = qos->msgPrior;
         pClassAbrt.pres  = TRUE;
         pClassAbrt.val   = (qos->seqCtl == TRUE)?(PCLASS1):(PCLASS0);
      }

#endif

#ifdef STUV2

      /* To check the value of the importance field
       * required in the MATV2/STUV2 testcases */
      if(msgType == STU_BEGIN)
      {
         impBgn.pres = dataParam->imp.pres;
         if (impBgn.pres)
            impBgn.val  = dataParam->imp.val;
      }
      if(msgType == STU_CONTINUE)
      {
         impCont.pres = dataParam->imp.pres;
         if (impCont.pres) 
            impCont.val  = dataParam->imp.val;
      }
      if(msgType == STU_END)
      {
         impEnd.pres = dataParam->imp.pres;
         if (impEnd.pres)
            impEnd.val  = dataParam->imp.val;
      }
      if(msgType == STU_ABORT)
      {
         impAbrt.pres = dataParam->imp.pres;
         if (impAbrt.pres)
            impAbrt.val  = dataParam->imp.val;
      }


      (Void) StUiStuDatInd(&maAccCb.liPst, spId, msgType,
                           maAccCb.dlgCp[dlgIdx].dmaDlgId,
                           maAccCb.dlgCp[dlgIdx].dstDlgId,
                           srcAddr, dstAddr, compFlag, &pAbtCause, qos,
                           (Dpc) 0, dlgEv, dataParam,uiBuf);
#else
      (Void) StUiStuDatInd(&maAccCb.liPst, spId, msgType,
                           maAccCb.dlgCp[dlgIdx].dmaDlgId,
                           maAccCb.dlgCp[dlgIdx].dstDlgId,
                           srcAddr, dstAddr, compFlag, &pAbtCause, qos,
                           (Dpc) 0, dlgEv, uiBuf);
#endif

      for (i = 0; i < qSize; i++)
      {
          (Void) maAccPopCmpQ(&cmpElm, dlgIdx);

          /* Check if it is the last component in the queue */
          if ((i + 1) == qSize)
          {
             cmpElm->compEv.stLastCmp = TRUE;
          }
          else
          {
             cmpElm->compEv.stLastCmp = FALSE;
          }

          (Void) StUiStuCmpInd(&maAccCb.liPst, spId,
                               maAccCb.dlgCp[dlgIdx].dmaDlgId,
                               maAccCb.dlgCp[dlgIdx].dstDlgId,
                               &cmpElm->compEv, (Dpc) 0, 0, cmpElm->cpBuf);
     cmpElm->cpBuf = NULLP;
      }
   }
   else
   {
      if (uiBuf)
      {
         SPutMsg(uiBuf);
      }
   }

   (Void) maAccFlushCmpQ(dlgIdx);

   RETVALUE(ROK);
} /* StUiStuDatReq */

/*
*
*       Fun:   TCAP Unidirectional Data Request
*
*       Desc:  Request to send Unidirectional Message of TCAP
*
*       Ret:   ROK      - ok
*
*       Notes: This is the entry point for the unidirectional message.
*
*       File:  layer4.c
*
*/
#ifdef ANSI
PUBLIC S16 StUiStuUDatReq
(
Pst      *pst,           /* Post structure */
SpId      spId,          /* provider id */
StDlgId   suDlgId,       /* dialog id */
StDlgId   spDlgId,       /* Dialog Id assigned by TCAP (0 in BEGIN) */
SpAddr   *dstAddr,       /* SCCP destination address - if needed */
SpAddr   *srcAddr,       /* SCCP source address - if needed */
StQosSet *qos,           /* TCAP Quality of Service */
StDlgEv  *dlgEv,         /* tcap dialog portion event */
#ifdef STUV2
StDataParam *dataParam,  /* data parameter */
#endif /* STUV2 */
Buffer   *uiBuf          /* user information buffer */
)
#else
#ifdef STUV2
PUBLIC S16 StUiStuUDatReq(pst, spId, suDlgId, spDlgId, dstAddr, srcAddr,
                          qos, dlgEv, dataParam, uiBuf)
#else
PUBLIC S16 StUiStuUDatReq(pst, spId, suDlgId, spDlgId, dstAddr, srcAddr,
                          qos, dlgEv, uiBuf)
#endif
Pst      *pst;           /* Post structure */
SpId      spId;          /* provider id */
StDlgId   suDlgId;       /* dialog id */
StDlgId   spDlgId;       /* Dialog Id assigned by TCAP (0 in BEGIN) */
SpAddr   *dstAddr;       /* SCCP destination address - if needed */
SpAddr   *srcAddr;       /* SCCP source address - if needed */
StQosSet *qos;           /* TCAP Quality of Service */
StDlgEv  *dlgEv;         /* tcap dialog portion event */
#ifdef STUV2
StDataParam *dataParam;  /* data parameter */
#endif /* STUV2 */
Buffer   *uiBuf;         /* user information buffer */
#endif
{
   Txt            prntBuf[200];
   MaAccCmpQElm  *cmpElm;
   U16            dlgIdx;
   U16            qSize;
   U16            i;

   TRC2(StUiStuUDatReq)

   MAACCPRINT((prntBuf, "\nMAP link %d - Uni Msg, SuDlgId %5ld  SpDlgId %5ld\n",
               spId, suDlgId, spDlgId));

   /* Find the dialogue control point */
   if (maAccFndDlgCp(spId, suDlgId, spDlgId, &dlgIdx))
   {
      /* Dialogue not found */
      if (uiBuf)
      {
         SPutMsg(uiBuf);
      }

      RETVALUE(RFAILED);
   }

   /* Check If the request is to be loopbacked as indication */
   if (maAccCb.curTst.loopBack)
   {
      /* Swap the post structure to direct the primitive back to MAP */
      maSwapPst(pst);

      /* Change the spId to inject the primitive at another SAP */
      if (maAccSwapSpId(&spId) != ROK)
      {
         /* Sap Id is not recognized, drop the message */
         if (uiBuf)
         {
            SPutMsg(uiBuf);
         }

         RETVALUE(RFAILED);
      }

#ifdef STUV2
#ifdef STUV3
      (Void) StUiStuUDatInd(&maAccCb.liPst, spId, suDlgId, spDlgId, srcAddr, dstAddr, qos, 
                            (Dpc) 0, dlgEv, dataParam, uiBuf);
#else
      (Void) StUiStuUDatInd(&maAccCb.liPst, spId, srcAddr, dstAddr, qos, 
                            (Dpc) 0, dlgEv, dataParam, uiBuf);
#endif
#else /* STUV2 */
      (Void) StUiStuUDatInd(&maAccCb.liPst, spId, srcAddr, dstAddr, qos, 
                            (Dpc) 0, dlgEv, uiBuf);
#endif /* STUV2 */

      /* Now get the number of component requests stored in the queue */
      (Void) maAccGetCmpQSize(dlgIdx, &qSize);

      for (i = 0; i < qSize; i++)
      {
          (Void) maAccPopCmpQ(&cmpElm, dlgIdx);

          /* Check if it is the last component in the queue */
          if ((i + 1) == qSize)
          {
             cmpElm->compEv.stLastCmp = TRUE;
          }
          else
          {
             cmpElm->compEv.stLastCmp = FALSE;
          }

          (Void) StUiStuCmpInd(&maAccCb.liPst, spId,
                               maAccCb.dlgCp[dlgIdx].dmaDlgId,
                               maAccCb.dlgCp[dlgIdx].dstDlgId,
                               &cmpElm->compEv, (Dpc) 0, 0, cmpElm->cpBuf);
     cmpElm->cpBuf = NULLP;
      }
   }
   else
   {
      if (uiBuf)
      {
         SPutMsg(uiBuf);
      }
   }

   (Void) maAccFlushCmpQ(dlgIdx);

   RETVALUE(ROK);
} /* StUiStuUDatReq */

/*
*
*       Fun:   TCAP User Component Request
*
*       Desc:  This function handles a component.
*
*       Ret:   ROK      - ok
*
*       Notes: None
*
*       File:  layer4.c
*
*/
  
#ifdef ANSI
PUBLIC S16 StUiStuCmpReq
(
Pst      *pst,           /* Post structure */
SpId      spId,          /* service provider id number */
StDlgId   suDlgId,       /* dialog ID for this component */
StDlgId   spDlgId,       /* Dialog Id assigned by TCAP (0 in BEGIN) */
StComps  *compEv,        /* component being passed */
Buffer   *cpBuf          /* component parameters being passed */
)
#else
PUBLIC S16 StUiStuCmpReq(pst, spId, suDlgId, spDlgId, compEv, cpBuf)
Pst      *pst;           /* Post structure */
SpId      spId;          /* service provider id number */
StDlgId   suDlgId;       /* dialog ID for this component */
StDlgId   spDlgId;       /* Dialog Id assigned by TCAP (0 in BEGIN) */
StComps  *compEv;        /* component being passed */
Buffer   *cpBuf;         /* component parameters being passed */
#endif
{
   Txt            prntBuf[200];
   U16            dlgIdx;

   TRC2(StUiStuCmpReq)

   UNUSED(pst);

   MAACCPRINT((prntBuf, "\nMAP link %d - Cmp Req, SuDlgId %5ld  SpDlgId %5ld\n",
               spId, suDlgId, spDlgId));

   /* Find the dialogue control point */
   if (maAccFndDlgCp(spId, suDlgId, 0, &dlgIdx))
   {
      /* Dialogue not found */
      if (cpBuf)
      {
         SPutMsg(cpBuf);
      }

      RETVALUE(RFAILED);
   }

   if (compEv->cancelFlg)
   {
      /* cancel thsi invoke */
      if (cpBuf)
      {
         SPutMsg(cpBuf);
      }

⌨️ 快捷键说明

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