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 NAS_MML_InsertInternalMsgHead(
    VOS_VOID                           *pSndMsg
)
{
    VOS_UINT8                           ucMsgPnt;
    NAS_MML_INTERNAL_MSG_BUF_STRU      *pstMmlMsg           = VOS_NULL_PTR;
    NAS_MML_INTERNAL_MSG_QUEUE_STRU    *pstInternalMsgQueue = VOS_NULL_PTR;
    NAS_MML_INTERNAL_MSG_BUF_STRU      *pstSndMsg           = VOS_NULL_PTR;

    pstInternalMsgQueue                 = &(NAS_MML_GetMmlCtx()->stInternalMsgQueue);
    pstSndMsg                           = (NAS_MML_INTERNAL_MSG_BUF_STRU*)pSndMsg;

    /* 1. 判断内部消息缓冲区是否已满 */
    ucMsgPnt = pstInternalMsgQueue->ucTail;
    if ( ((ucMsgPnt + 1) % NAS_MML_MAX_MSG_QUEUE_SIZE) == pstInternalMsgQueue->ucHeader )
    {
        NAS_WARNING_LOG(WUEPS_PID_MMC, "NAS_MML_InsertInternalMsgHead:Warning: The Queue is full.");
        NAS_MMC_SndOmInternalMsgQueueInfo(VOS_TRUE, VOS_FALSE);
        NAS_MMC_SndOmInternalMsgQueueDetailInfo(pstInternalMsgQueue);
        return;
    }
    /* 2. 判断消息长度是否非法 */
    if ( pstSndMsg->ulLength > NAS_MML_MAX_INTERNAL_MSG_LEN)
    {
        NAS_WARNING_LOG(WUEPS_PID_MMC, "NAS_MML_InsertInternalMsgHead:Warning: ulBufLen is too long.");
        NAS_MMC_SndOmInternalMsgQueueInfo(VOS_FALSE, VOS_TRUE);
        return;
    }

    if ( (pstInternalMsgQueue->ucHeader % NAS_MML_MAX_MSG_QUEUE_SIZE) >= 1 )
    {
        pstInternalMsgQueue->ucHeader--;
        pstInternalMsgQueue->ucHeader         %= NAS_MML_MAX_MSG_QUEUE_SIZE;
    }
    else
    {
        pstInternalMsgQueue->ucHeader = NAS_MML_MAX_MSG_QUEUE_SIZE- 1;
    }

    /* 3. 取得一个消息缓冲单元 */
    pstMmlMsg = (NAS_MML_INTERNAL_MSG_BUF_STRU *)&(pstInternalMsgQueue->astNasMmMsgQueue[pstInternalMsgQueue->ucHeader]);

    NAS_NORMAL_LOG1(WUEPS_PID_MMC, "NAS_MML_InsertInternalMsgHead: usMsgID is ", pstMmlMsg->usMsgID);

    /* 4. 将内部消息发送到内部消息队列的最前面 */
    PS_MEM_CPY(pstMmlMsg, pstSndMsg, sizeof(NAS_MML_INTERNAL_MSG_BUF_STRU));

    /* 更新内部消息缓冲区 */

    return;
}
VOS_UINT32  NAS_MMC_PostProcessMsg(
    VOS_UINT32                          ulEventType,
    struct MsgCB                       *pstMsg
)
{

    /* 判断是否需要打断当前状态机 */
    if (VOS_TRUE == NAS_MMC_ProcMsgPrio(ulEventType, pstMsg))
    {
        NAS_NORMAL_LOG1(WUEPS_PID_MMC, "NAS_MMC_PostProcessMsg:ulEventType", ulEventType);

        return VOS_TRUE;
    }


    return VOS_FALSE;
}
VOS_VOID  NAS_MMC_StopTimer(
    NAS_MMC_TIMER_ID_ENUM_UINT16        enTimerId
)
{
    NAS_MMC_TIMER_CTX_STRU             *pstMmcTimerCtx;
    VOS_UINT32                          i;

    VOS_UINT32                          ulTimerRemainLen;

    ulTimerRemainLen = 0;


    pstMmcTimerCtx   =  NAS_MMC_GetTimerAddr();

    for ( i = 0 ; i < NAS_MMC_MAX_TIMER_NUM ; i++ )
    {
        if ( ( NAS_MMC_TIMER_STATUS_RUNING  == pstMmcTimerCtx[i].enTimerStatus )
          && ( enTimerId                    == pstMmcTimerCtx[i].enTimerId))
        {
            break;
        }
    }

    if ( i >= NAS_MMC_MAX_TIMER_NUM)
    {
        NAS_NORMAL_LOG1(WUEPS_PID_MMC, "NAS_MMC_StopTimer:Timer not running", enTimerId);

        return;
    }

    /* 停止VOS定时器: 当定时器的指针已经为空的时候, 说明其已经停止或者超时 */
    if (VOS_NULL_PTR != pstMmcTimerCtx[i].hTimer)
    {


        /* 获取当前定时器的剩余时间 */
        if (VOS_OK != VOS_GetRelTmRemainTime(&(pstMmcTimerCtx[i].hTimer), &ulTimerRemainLen ))
        {
            ulTimerRemainLen = 0;
        }



        (VOS_VOID)VOS_StopRelTimer(&(pstMmcTimerCtx[i].hTimer));
    }

    pstMmcTimerCtx[i].hTimer        = VOS_NULL_PTR;
    pstMmcTimerCtx[i].enTimerId     = TI_NAS_MMC_TIMER_BUTT;
    pstMmcTimerCtx[i].enTimerStatus = NAS_MMC_TIMER_STATUS_STOP;



    if (0!=ulTimerRemainLen)
    {
        NAS_TIMER_EventReport(enTimerId, WUEPS_PID_MMC, NAS_OM_EVENT_TIMER_OPERATION_STOP);
    }


    /* 定时器状态勾包出来 */
    NAS_MMC_SndOmMmcTimerStatus(NAS_MMC_TIMER_STATUS_STOP, enTimerId, ulTimerRemainLen * 10);




}