VOS_VOID NAS_RABM_RcvCdsServiceInd(
    CDS_RABM_SERVICE_IND_STRU          *pstCdsServiceInd
)
{
    /* 检查RABID有效性 */
    if (!RAB_MAP_RAB_IS_VALID(pstCdsServiceInd->ucRabId))
    {
        NAS_ERROR_LOG1(WUEPS_PID_RABM,
                       "NAS_RABM_RcvCdsServiceInd: Invalid RABID. <RABID>", pstCdsServiceInd->ucRabId);
        return;
    }

    switch (NAS_RABM_GetWPsEntState(pstCdsServiceInd->ucRabId - RABM_NSAPI_OFFSET))
    {
    case RABM_NSAPI_ACTIVE_WITH_RAB:
        NAS_NORMAL_LOG1(WUEPS_PID_RABM,
                        "NAS_RABM_RcvCdsServiceInd: RABID is already active. <RABID>", pstCdsServiceInd->ucRabId);
        NAS_RABM_SndCdsSendBuffDataInd(pstCdsServiceInd->ucRabId, CDS_RABM_SEND_BUFF_DATA_ALLOWED_TYPE_SERVICE_SUCC);
        break;

    case RABM_NSAPI_ACTIVE_NO_RAB:
        if (VOS_TRUE == NAS_RABM_GetWPsEntRabReestFlg(pstCdsServiceInd->ucRabId - RABM_NSAPI_OFFSET))
        {
            NAS_NORMAL_LOG1(WUEPS_PID_RABM,
                            "NAS_RABM_RcvCdsServiceInd: Reestablish is in process. <RABID>", pstCdsServiceInd->ucRabId);
        }
        else if (VOS_TRUE == NAS_RABM_IsDataServiceRequestPending())
        {
            NAS_NORMAL_LOG1(WUEPS_PID_RABM,
                            "NAS_RABM_RcvCdsServiceInd: Data service request is sent, set reestablish flag. <RABID>", pstCdsServiceInd->ucRabId);
            NAS_RABM_SetWPsEntRabReestFlg(pstCdsServiceInd->ucRabId - RABM_NSAPI_OFFSET);
        }
        else if (VOS_TRUE == NAS_RABM_IsRabReestablishPending())
        {
            NAS_NORMAL_LOG1(WUEPS_PID_RABM,
                            "NAS_RABM_RcvCdsServiceInd: Start RB setup protect timer. <RABID>", pstCdsServiceInd->ucRabId);
            NAS_RABM_SetWPsEntRabReestFlg(pstCdsServiceInd->ucRabId - RABM_NSAPI_OFFSET);
            NAS_RABM_StartReestRabPendingTmr(pstCdsServiceInd->ucRabId);
        }
        else
        {
            NAS_NORMAL_LOG1(WUEPS_PID_RABM,
                            "NAS_RABM_RcvCdsServiceInd: Send data service request.  <RABID>", pstCdsServiceInd->ucRabId);
            NAS_RABM_SetWPsEntRabReestFlg(pstCdsServiceInd->ucRabId - RABM_NSAPI_OFFSET);
            NAS_RABM_SetRabRsestTimerFlg();
            RABM_TimerStart(RABM_REESTABLISH_REQ_SENT, RABM_RABM_REEST_PROT_TIMER_LEN);
            RABM_SndRabReestReq();
        }
        break;

    default:
        NAS_WARNING_LOG1(WUEPS_PID_RABM,
                         "NAS_RABM_RcvCdsServiceInd: Can't reestablish RAB. <RABID>", pstCdsServiceInd->ucRabId);
        NAS_RABM_SndCdsFreeBuffDataInd(pstCdsServiceInd->ucRabId);
        break;
    }

    return;
}
VOS_VOID RABM_ComSaveRabPara(
                         RRRABM_RAB_IND_STRU  *pMsg                             /* 目前处理的消息                           */
                         )
{
    VOS_UINT8                           i;
    VOS_UINT8                           j;
    VOS_UINT8                           ucEntId = 0xff;
    VOS_UINT8                           ucTcFlg = RABM_FALSE;
    VOS_UINT16                          k;
    VOS_UINT8                           ucChgMask;

    for(i = 0; i < pMsg->ulRabCnt; i++)
    {
        if(RABM_CN_PS == pMsg->aRabInfo[i].ulCnDomainId)
        {                                                                       /* 是PS域的RAB                              */
            if ( VOS_TRUE == gRabm2GTo3GDataResume )
            {
                /*复位2G向3G切换使用的数传恢复标志:*/
                gRabm2GTo3GDataResume = VOS_FALSE;

                /*向PDCP发送2G向3G切换的数传恢复指示:*/
                NAS_RabmSndPdcpDataResumeInd(pMsg);
            }

            if ( (RABM_TC_NO_START != g_RabmTcInf.ucTcStartSta)
              && ((pMsg->aRabInfo[i].ulRabId & 0x0f) < RABM_NSAPI_OFFSET) )
            {
                ucEntId = (VOS_UINT8)(pMsg->aRabInfo[i].ulRabId & 0x0f);
            }
            else
            {
                if ((pMsg->aRabInfo[i].ulRabId & 0x0f) < RABM_NSAPI_OFFSET)
                {
                   continue;
                }

                ucEntId = (VOS_UINT8)
                ((pMsg->aRabInfo[i].ulRabId & 0x0f) - RABM_NSAPI_OFFSET);       /* 获得PS域的RABM实体ID                     */
            }

            switch(g_aRabmPsEnt[ucEntId].ucState)
            {                                                                   /* 根据实体状态作相应处理                   */
            case RABM_NULL:
                break;
            case RABM_NSAPI_ACTIVE_PENDING:
                if(RABM_TC_NO_START != g_RabmTcInf.ucTcStartSta)
                {
                    Rabm_TcInfSave(pMsg, i);
                }
                RABM_SetWState(ucEntId, RABM_ACT_PENDING_WITH_RAB);             /* 改变实体的状态                           */
                PS_LOG(WUEPS_PID_RABM, VOS_NULL, PS_PRINT_NORMAL, "RABM_ComSaveRabPara:NORMAL:RABM state: RABM_NSAPI_ACTIVE_PENDING ==> RABM_ACT_PENDING_WITH_RAB");
                g_aRabmPsEnt[ucEntId].RabInfo.ucRabId =
                    (VOS_UINT8)(pMsg->aRabInfo[i].ulRabId);                         /* 保存RAB ID                               */
                g_aRabmPsEnt[ucEntId].RabInfo.ucRbNum =
                    (VOS_UINT8)(pMsg->aRabInfo[i].ulRbNum);                         /* 保存RB的个数                             */

                for ( j = 0 ; j < g_aRabmPsEnt[ucEntId].RabInfo.ucRbNum ; j++ )
                {
                    g_aRabmPsEnt[ucEntId].RabInfo.aucRbId[j] =
                        (VOS_UINT8)(pMsg->aRabInfo[i].aulRbId[j]);                  /* 保存RB ID                                */

                    g_aRabmPsEnt[ucEntId].RabInfo.aucRbTxMode[j] =
                        (VOS_UINT8)(pMsg->aRabInfo[i].aenUlRlcMode[j]);             /* 保存RB 的传输模式 */
                }

                /*此时RAB_MAP表的实体并未创建,无需更新RAB_MAP中的ucAsId*/
                break;
            case RABM_NSAPI_ACTIVE_NO_RAB:
                if(RABM_TC_NO_START != g_RabmTcInf.ucTcStartSta)
                {
                    Rabm_TcInfSave(pMsg, i);
                }
                g_aRabmPsEnt[ucEntId].RabInfo.ucRabId =
                    (VOS_UINT8)(pMsg->aRabInfo[i].ulRabId);                         /* 保存RAB ID                               */
                g_aRabmPsEnt[ucEntId].RabInfo.ucRbNum =
                    (VOS_UINT8)(pMsg->aRabInfo[i].ulRbNum);                         /* 保存RB的个数                             */

                for ( j = 0 ; j < g_aRabmPsEnt[ucEntId].RabInfo.ucRbNum ; j++ )
                {
                    g_aRabmPsEnt[ucEntId].RabInfo.aucRbId[j] =
                        (VOS_UINT8)(pMsg->aRabInfo[i].aulRbId[j]);                  /* 保存RB ID                                */
                    g_aRabmPsEnt[ucEntId].RabInfo.aucRbTxMode[j] =
                        (VOS_UINT8)(pMsg->aRabInfo[i].aenUlRlcMode[j]);             /* 保存RB 的传输模式 */
                }


                RABM_SetWState(ucEntId, RABM_NSAPI_ACTIVE_WITH_RAB);            /* 改变实体的状态                           */
                PS_LOG(WUEPS_PID_RABM, VOS_NULL, PS_PRINT_NORMAL, "RABM_ComSaveRabPara:NORMAL:RABM state: RABM_NSAPI_ACTIVE_NO_RAB ==> RABM_NSAPI_ACTIVE_WITH_RAB");

                /*更新RAB_MAP表中的ucAsId*/
                ucChgMask = 0;
                ucChgMask |= RAB_MAP_CHG_MASK_AS_ID;
                RABM_ChgRabMap(ucEntId + RABM_NSAPI_OFFSET,
                               ucChgMask,
                               g_aRabmPsEnt[ucEntId].RabInfo.aucRbId[0],
                               VOS_NULL_PTR,
                               VOS_NULL_PTR);

                if (VOS_TRUE == NAS_RABM_GetWPsEntRabReestFlg(ucEntId))
                {
                    /* 停止RB建立保护定时器 */
                    NAS_RABM_StopReestRabPendingTmr(ucEntId + RABM_NSAPI_OFFSET);

                    /* 清除RABM实体的重建标识 */
                    NAS_RABM_ClearWPsEntRabReestFlg(ucEntId);

                    g_aRabmPsEnt[ucEntId].ucStpFlg = RABM_FALSE;
                    RABM_SaveDataProcess(ucEntId, RABM_UPLINK);                 /* 处理缓存的上行数据                       */

                    /* 通知CDS发送缓存数据 */
                    NAS_RABM_SndCdsSendBuffDataInd(ucEntId + RABM_NSAPI_OFFSET,
                                                   CDS_RABM_SEND_BUFF_DATA_ALLOWED_TYPE_SERVICE_SUCC);
                }
                break;
            case RABM_ACT_PENDING_WITH_RAB:
                g_aRabmPsEnt[ucEntId].RabInfo.ucRabId =
                    (VOS_UINT8)(pMsg->aRabInfo[i].ulRabId);                         /* 保存RAB ID                               */
                g_aRabmPsEnt[ucEntId].RabInfo.ucRbNum =
                    (VOS_UINT8)(pMsg->aRabInfo[i].ulRbNum);                         /* 保存RB的个数                             */

                for ( j = 0 ; j < g_aRabmPsEnt[ucEntId].RabInfo.ucRbNum ; j++ )
                {
                    g_aRabmPsEnt[ucEntId].RabInfo.aucRbId[j] =
                            (VOS_UINT8)(pMsg->aRabInfo[i].aulRbId[j]);              /* 保存RB ID                                */
                    g_aRabmPsEnt[ucEntId].RabInfo.aucRbTxMode[j] =
                        (VOS_UINT8)(pMsg->aRabInfo[i].aenUlRlcMode[j]);             /* 保存RB 的传输模式 */
                }

                /*此时RAB_MAP表的实体并未创建,无需更新RAB_MAP中的ucAsId*/
                break;
            case RABM_NSAPI_ACTIVE_WITH_RAB:
            case RABM_DATA_TRANSFER_STOP:
                g_aRabmPsEnt[ucEntId].RabInfo.ucRabId =
                    (VOS_UINT8)(pMsg->aRabInfo[i].ulRabId);                         /* 保存RAB ID                               */
                g_aRabmPsEnt[ucEntId].RabInfo.ucRbNum =
                    (VOS_UINT8)(pMsg->aRabInfo[i].ulRbNum);                         /* 保存RB的个数                             */

                for ( j = 0 ; j < g_aRabmPsEnt[ucEntId].RabInfo.ucRbNum ; j++ )
                {
                    g_aRabmPsEnt[ucEntId].RabInfo.aucRbId[j] =
                            (VOS_UINT8)(pMsg->aRabInfo[i].aulRbId[j]);              /* 保存RB ID                                */
                    g_aRabmPsEnt[ucEntId].RabInfo.aucRbTxMode[j] =
                        (VOS_UINT8)(pMsg->aRabInfo[i].aenUlRlcMode[j]);             /* 保存RB 的传输模式 */
                }

                /*更新RAB_MAP表中的ucAsId*/
                ucChgMask = 0;
                ucChgMask |= RAB_MAP_CHG_MASK_AS_ID;
                RABM_ChgRabMap(ucEntId + RABM_NSAPI_OFFSET,
                               ucChgMask,
                               g_aRabmPsEnt[ucEntId].RabInfo.aucRbId[0],
                               VOS_NULL_PTR,
                               VOS_NULL_PTR);
                break;
            case RABM_TC_STATE_NULL:
                g_aRabmPsEnt[ucEntId].RabInfo.ucRabId =
                    (VOS_UINT8)(pMsg->aRabInfo[i].ulRabId);                         /* 保存RAB ID                               */
                g_aRabmPsEnt[ucEntId].RabInfo.ucRbNum =
                    (VOS_UINT8)(pMsg->aRabInfo[i].ulRbNum);                         /* 保存RB的个数                             */

                for ( j = 0 ; j < pMsg->aRabInfo[i].ulRbNum ; j++ )
                {
                    g_aRabmPsEnt[ucEntId].RabInfo.aucRbId[j] =
                        (VOS_UINT8)(pMsg->aRabInfo[i].aulRbId[j]);              /* 保存RB ID                                */
                    g_aRabmPsEnt[ucEntId].RabInfo.aucRbTxMode[j] =
                        (VOS_UINT8)(pMsg->aRabInfo[i].aenUlRlcMode[j]);             /* 保存RB 的传输模式 */
                }
                Rabm_TcInfSave(pMsg, i);
                break;
            default:
                break;
            }

            if(RABM_NSAPI_ACTIVE_WITH_RAB == g_aRabmPsEnt[ucEntId].ucState)
            {
                if(0 != g_aRabmPsEnt[ucEntId].DlDataSave.ucNum)
                {                                                               /* 有缓存的下行数据                         */
                    RABM_SaveDataProcess(ucEntId,RABM_DOWNLINK);                /* 处理缓存的下行数据                       */
                }
            }
        }
        else
        {
            if( NAS_RRC_RAB_SETUP_SUCCESS == pMsg->ulRabChangeType )
            {

                ucTcFlg = RABM_FALSE;
                for( j = 0; j < RABM_CS_MAX_ENT_NUM; j++ )
                {
                    for( k = 0; k < 256; k++ )
                    {
                        if ( g_aucSiMapEnt[k] == j )
                        {
                            break;
                        }
                    }

                    if( k < 256 )
                    {
                        continue;
                    }
                    if( RABM_NULL == g_aRabmCsEnt[j].ucState)
                    {
                        g_aucSiMapEnt[pMsg->aRabInfo[i].ulRabId] = j;
                        break;
                    }
                    else if(RABM_TC_NO_START != g_RabmTcInf.ucTcStartSta)
                    {
                        Rabm_TcInfSave(pMsg, i);
                        ucTcFlg = RABM_TRUE;
                        break;
                    }
                    else
                    {
                    }
                }
                if(RABM_TRUE == ucTcFlg)
                {
                    g_aucSiMapEnt[pMsg->aRabInfo[i].ulRabId] = j;
                    ucEntId = g_aucSiMapEnt[pMsg->aRabInfo[i].ulRabId];
                    g_aRabmCsEnt[ucEntId].RabInfo.ucRabId = (VOS_UINT8)(pMsg->aRabInfo[i].ulRabId);
                    g_aRabmCsEnt[ucEntId].RabInfo.ucRbNum = (VOS_UINT8)(pMsg->aRabInfo[i].ulRbNum);
                    for(j = 0; j < pMsg->aRabInfo[i].ulRbNum; j++)
                    {
                        g_aRabmCsEnt[ucEntId].RabInfo.aucRbId[j] = (VOS_UINT8)(pMsg->aRabInfo[i].aulRbId[j]);
                        g_aRabmCsEnt[ucEntId].RabInfo.aucRbTxMode[j] = (VOS_UINT8)(pMsg->aRabInfo[i].aenUlRlcMode[j]);
                    }
                    continue;
                }
                if( RABM_CS_MAX_ENT_NUM == j )
                {
                    PS_LOG(WUEPS_PID_RABM, VOS_NULL, PS_PRINT_WARNING, "RABM_ComSaveRabPara:WARNING:Exceed RABM_CS_MAX_ENT_NUM!");
                    return;
                }
            }
            ucEntId = g_aucSiMapEnt[pMsg->aRabInfo[i].ulRabId];

            for(j = 0; j < pMsg->aRabInfo[i].ulRbNum; j++)
            {
                g_aRabmCsEnt[ucEntId].RabInfo.aucRbTxMode[j] =
                        (VOS_UINT8)(pMsg->aRabInfo[i].aenUlRlcMode[j]);
            }
            switch(g_aRabmCsEnt[ucEntId].ucState)
            {
            case RABM_NULL:
                g_aRabmCsEnt[ucEntId].ucState = RABM_SI_ACTIVE_WITH_RAB;
                PS_LOG(WUEPS_PID_RABM, VOS_NULL, PS_PRINT_NORMAL, "RABM_ComSaveRabPara:NORMAL:RABM state: RABM_NULL ==> RABM_SI_ACTIVE_WITH_RAB");
                g_aRabmCsEnt[ucEntId].ucSi = (VOS_UINT8)pMsg->aRabInfo[i].ulRabId;  /* 存储SI                                   */

                RABM_SndCcSyncInd(RABMCC_RAB_ACTIVE, pMsg->aRabInfo[i].ulRabId);/* 通知cc                                   */

                RABM_SndCallSyncInd(RABMCALL_RAB_ACTIVE, &pMsg->aRabInfo[i]);   /* 通知CALL */
                g_aRabmCsEnt[ucEntId].RabInfo.ucRabId =
                    (VOS_UINT8)(pMsg->aRabInfo[i].ulRabId);                         /* 保存RAB ID                               */
                g_aRabmCsEnt[ucEntId].RabInfo.ucRbNum =
                    (VOS_UINT8)(pMsg->aRabInfo[i].ulRbNum);                         /* 保存RB的个数                             */
                for(j = 0; j < g_aRabmCsEnt[ucEntId].RabInfo.ucRbNum; j++)
                {                                                               /* 保存RB ID                                */
                    g_aRabmCsEnt[ucEntId].RabInfo.aucRbId[j] =
                        (VOS_UINT8)(pMsg->aRabInfo[i].aulRbId[j]);
                }
                break;

            case RABM_SI_ACTIVE_WITH_RAB:
                g_aRabmCsEnt[ucEntId].RabInfo.ucRabId =
                    (VOS_UINT8)(pMsg->aRabInfo[i].ulRabId);                         /* 保存RAB ID                               */
                g_aRabmCsEnt[ucEntId].RabInfo.ucRbNum =
                    (VOS_UINT8)(pMsg->aRabInfo[i].ulRbNum);                         /* 保存RB的个数                             */
                for(j = 0; j < g_aRabmCsEnt[ucEntId].RabInfo.ucRbNum; j++)
                {                                                               /* 保存RB ID                                */
                    g_aRabmCsEnt[ucEntId].RabInfo.aucRbId[j] =
                        (VOS_UINT8)(pMsg->aRabInfo[i].aulRbId[j]);
                }
                break;
            default:
                break;
            }
        }
    }

    return;
}