VOS_VOID NAS_RABM_MsgProc(
    struct MsgCB                       *pMsg
)
{
    MSG_HEADER_STRU                    *pstMsg;
    struct MsgCB                       *pstDestMsg;


    pstDestMsg = VOS_NULL_PTR;

    /* 入口消息非空检查 */
    if (VOS_NULL_PTR == pMsg)
    {
        NAS_WARNING_LOG(WUEPS_PID_RABM,
                        "NAS_RABM_MsgProc: Message is NULL.");
        return;
    }

    /* 支持TD-SCDMA特性时,需对消息进行适配处理,将TD模的发送PID适配为W模的PID */
    if ( VOS_TRUE == NAS_UTRANCTRL_MsgProc(pMsg, &pstDestMsg) )
    {
        /* 消息在UTRANCTRL模块处理完成,直接返回,不进入后续处理 */
        return;
    }

    /* 替换消息指针 */
    pstMsg = (MSG_HEADER_STRU*)pstDestMsg;

    /* 处理消息 */
    switch (pstMsg->ulSenderPid)
    {
    case WUEPS_PID_SM:
        NAS_RABM_RcvSmMsg(pstDestMsg);
        break;

    case WUEPS_PID_GMM:
        NAS_RABM_RcvGmmMsg(pstDestMsg);
        break;

    case WUEPS_PID_AT:
        NAS_RABM_RcvAtMsg(pstDestMsg);
        break;

    case UEPS_PID_CDS:
        NAS_RABM_RcvCdsMsg(pstDestMsg);
        break;
#if (FEATURE_ON == FEATURE_BASTET)
    case UEPS_PID_BASTET:
        NAS_RABM_RcvBastetMsg(pstDestMsg);
        break;
#endif
    default:
        NAS_RABM_RcvCommMsg(pstDestMsg);
        break;
    }
}
VOS_UINT32  NAS_MML_FidMsgProc(
    struct MsgCB                        *pRcvMsg
)
{
    MSG_HEADER_STRU                    *pstMsgHeader = VOS_NULL_PTR;
    struct MsgCB                       *pstDestMsg;
    VOS_UINT32                          ulRslt;


    pstDestMsg = VOS_NULL_PTR;

    /* 入口参数检查 */
    if ( VOS_NULL_PTR == pRcvMsg )
    {
        NAS_ERROR_LOG(WUEPS_PID_MMC, "NAS_MML_FidMsgProc:Empty Msg");
        return VOS_ERR;
    }

    pstMsgHeader = (MSG_HEADER_STRU *)pRcvMsg;

    NAS_MML_LogMsgInfo(pstMsgHeader);


    /* 将当前消息进入UTRANCTRL模块进行处理 */
    ulRslt = NAS_UTRANCTRL_MsgProc(pRcvMsg, &pstDestMsg);

    /* 消息在UTRANCTRL模块处理完成,直接返回,不进入后续处理 */
    if ( VOS_TRUE == ulRslt )
    {
        return VOS_OK;
    }

    /* 如果经过UTRUNCTRL处理消息改变,则在记录一次 */
    if (pRcvMsg != pstDestMsg)
    {
        NAS_MML_LogMsgInfo(pstMsgHeader);
    }

    /* 处理从UTRANCTRL模块返回的消息 */
    NAS_MML_MsgProc(pstDestMsg);

    /* 处理UTRANCTRL模块缓存的消息 */
    NAS_UTRANCTRL_ProcBufferMsg();

    NAS_MML_UpdateExitTime();

    return VOS_OK;
}
VOS_VOID NAS_UTRANCTRL_ProcBufferMsg(VOS_VOID)
{
#if (FEATURE_ON == FEATURE_UE_MODE_TDS)
    struct MsgCB                       *pstNextBufferMsg     = VOS_NULL_PTR;
    struct MsgCB                       *pstNextBufferDestMsg = VOS_NULL_PTR;
    VOS_UINT32                          ulRslt;

    /* 先判断是否可以处理UTRANCTRL模块的缓存消息 */
    if (NAS_UTRANCTRL_FSM_MAIN == NAS_UTRANCTRL_GetCurrFsmId())
    {
        /* 从UTRANCTRL模块获取缓存的外部消息 */
        pstNextBufferMsg = NAS_UTRANCTRL_GetNextCachBufferMsg();

        while (VOS_NULL_PTR != pstNextBufferMsg)
        {
            /* 将当前消息进入UTRANCTRL模块进行处理 */
            ulRslt = NAS_UTRANCTRL_MsgProc(pstNextBufferMsg, &pstNextBufferDestMsg);

            /* 消息在UTRANCTRL模块未处理完成,继续在MMC继续处理 */
            if (VOS_FALSE == ulRslt)
            {
                /* 处理从UTRANCTRL模块获取的缓存消息 */
                NAS_MML_MsgProc(pstNextBufferDestMsg);
            }

            /* 消息在UTRANCTRL处理后,可能重新进到状态机,需要跳出当前缓冲消息循环处理 */
            if (NAS_UTRANCTRL_FSM_MAIN != NAS_UTRANCTRL_GetCurrFsmId())
            {
                /* 跳出循环 */
                break;
            }

            /* 寻找下一条UTRANCTRL模块缓存的外部消息 */
            pstNextBufferMsg = (struct MsgCB *)NAS_UTRANCTRL_GetNextCachBufferMsg();
        }
    }
#endif
}
VOS_VOID NAS_MML_MsgProc(
    struct MsgCB                        *pRcvMsg
)
{
    NAS_MML_INTERNAL_MSG_BUF_STRU      *pstNextMsg   = VOS_NULL_PTR;
    pNasMmPIdMsgProc                    pMsgProc     = VOS_NULL_PTR;
    MSG_HEADER_STRU                    *pstMsgHeader = VOS_NULL_PTR;
#ifndef __PS_WIN32_RECUR__
    VOS_UINT32                          ulIsSndOmPcRecurMsgValid;
#endif
    VOS_UINT32                          ulRslt;
    struct MsgCB                       *pstNextDestMsg;

    /* 入口参数检查 */
    if ( VOS_NULL_PTR == pRcvMsg )
    {
        NAS_ERROR_LOG(WUEPS_PID_MMC, "NAS_MML_MsgProc:Empty Msg");
        return;
    }

    if (VOS_TRUE == NAS_MML_GetSvlteSupportFlag())
    {
        NAS_MML_ConvertOamSendPid(&pRcvMsg->ulSenderPid);
    }

    pMsgProc = NAS_MML_FindPidMsgProc(pRcvMsg->ulReceiverPid);

    /* 未找到处理函数直接返回 */
    if ( VOS_NULL_PTR == pMsgProc )
    {
        NAS_ERROR_LOG(WUEPS_PID_MMC, "NAS_MML_MsgProc:Invalid rcv pid");
        return;
    }

    /* 先处理外部消息 */
    pMsgProc(pRcvMsg);

    /* 外部消息处理完成后处理内部消息 */
    pstNextMsg = NAS_MML_GetNextInternalMsg();

    while (VOS_NULL_PTR != pstNextMsg)
    {
#if (FEATURE_ON == FEATURE_LTE)
        if (PS_PID_MM == pstNextMsg->ulSenderPid)
        {
            pstMsgHeader = (MSG_HEADER_STRU *)pstNextMsg;

            NAS_MML_LogMsgInfo(pstMsgHeader);

        }
#endif

        pMsgProc = NAS_MML_FindPidMsgProc(pstNextMsg->ulReceiverPid);

        /* 未找到处理函数直接返回 */
        if ( VOS_NULL_PTR == pMsgProc )
        {
            NAS_ERROR_LOG(WUEPS_PID_MMC, "NAS_MML_MsgProc:Invalid rcv pid");
        }
#if (FEATURE_ON == FEATURE_LTE)
        else if ((VOS_FALSE == NAS_MML_IsPlatformSupportLte())
              && (PS_PID_MM == pstNextMsg->ulReceiverPid))
        {
            NAS_INFO_LOG(WUEPS_PID_MMC, "NAS_MML_MsgProc:Platform not support Lte");
        }
#endif
        else
        {
            /* 将该消息钩出来,以便于在PSTAS中显示 */
            DIAG_TraceReport(pstNextMsg);


            /* 将当前消息进入UTRANCTRL模块进行处理 */
            ulRslt = NAS_UTRANCTRL_MsgProc((struct MsgCB *)pstNextMsg, &pstNextDestMsg);

            /* 消息在UTRANCTRL模块处理完成,直接返回,不进入后续处理 */
            if ( VOS_FALSE == ulRslt )
            {
                pMsgProc((struct MsgCB *)pstNextDestMsg);
            }

        }

        /* 寻找下一条内部消息 */
        pstNextMsg = NAS_MML_GetNextInternalMsg();
    }

#ifndef __PS_WIN32_RECUR__

    ulIsSndOmPcRecurMsgValid = NAS_MML_IsSndOmPcRecurMsgValid();

    if ( (VOS_TRUE == NAS_MML_GetUePcRecurFlg())
      && (VOS_TRUE == ulIsSndOmPcRecurMsgValid))
    {
        NAS_MML_SetUePcRecurFlg(VOS_FALSE);

        NAS_MMC_SndOutsideContextData();
        NAS_MM_SndOutsideContextData();
        NAS_GMM_SndOutsideContextData();
    }

#endif


    return;
}
VOS_VOID  MN_DispatchMsg (struct MsgCB * pstMsg)
{
    struct MsgCB                      *pstSrcMsg = VOS_NULL_PTR;
    struct MsgCB                      *pstDestMsg = VOS_NULL_PTR;

    if (VOS_NULL_PTR == pstMsg)
    {
        return;
    }

    if (VOS_TRUE == TAF_SDC_GetSvlteSupportFlag())
    {
        /* svlte特性开启时,modem1可能收到usim0的消息,需要将消息中send pid进行转换 */
        pstMsg->ulSenderPid = TAF_SDC_ConvertOamSendPid(pstMsg->ulSenderPid);
    }


    /* 支持TD-SCDMA特性时,需对消息进行适配处理 */
    if ( VOS_TRUE == NAS_UTRANCTRL_MsgProc(pstMsg, &pstDestMsg) )
    {
        /* 消息在UTRANCTRL模块处理完成,直接返回,不进入后续处理 */
        return;
    }

    pstSrcMsg = pstDestMsg;

    if (VOS_TRUE == TAF_SPM_MsgProc(pstSrcMsg, &pstDestMsg))
    {
        /* 消息在SPM模块处理完成,直接返回,不需要进入后续处理 */
        return;
    }

    /* 替换消息指针 */
    switch (pstDestMsg->ulSenderPid)
    {
    case VOS_PID_TIMER:
        MN_ProcTimerMsg(pstDestMsg);
        break;

    case UEPS_PID_CST:
        MN_CALL_ProcCstCallPrimitive(pstDestMsg);
        break;

    case MAPS_STK_PID:
        MN_DispatchStkMsg(pstDestMsg);
        break;

    case WUEPS_PID_TAF:
        MN_DispatchTafMsg(pstDestMsg);
        break;

    case WUEPS_PID_AT:
        MN_DispatchAppMsg(pstDestMsg);
        break;

    case WUEPS_PID_CC:
        MN_CALL_ProcMnccPrimMsg(pstDestMsg);
        break;

    case WUEPS_PID_MMC:
        MN_ProcMmcMsg(pstDestMsg);
        break;

    case WUEPS_PID_MMA:
        MN_ProcMmaMsg(pstDestMsg);
        break;

    case WUEPS_PID_MM:
        break;

    case WUEPS_PID_SS:
        break;

    case WUEPS_PID_SMS:
        MN_MSG_ProcSmsMsg((VOS_VOID*)pstDestMsg);
        break;

#if (FEATURE_IMS == FEATURE_ON)
    case PS_PID_IMSA:
        MN_DispatchImsaMsg((VOS_VOID*)pstDestMsg);
        break;
#endif

    case WUEPS_PID_SM:
        TAF_APS_ProcMsg(pstDestMsg);
        break;

#if (FEATURE_ON == FEATURE_LTE)
    case PS_PID_ESM:
        TAF_APS_ProcMsg(pstDestMsg);
        break;

    case MSP_L4_L4A_PID:
        TAF_APS_ProcMsg(pstDestMsg);
        break;

#endif

    case WUEPS_PID_RABM:
        MN_DispatchRabmMsg(pstDestMsg);
        break;

    case UEPS_PID_SN:
        TAF_APS_ProcMsg(pstDestMsg);
        break;

    case WUEPS_PID_USIM:
    case MAPS_PB_PID:
        MN_ProcUsimMsg(pstDestMsg);
        break;
    case MAPS_PIH_PID:
        MN_ProcPihMsg(pstDestMsg);
        break;

    case WUEPS_PID_OM:
        MN_ProcOmMsg(pstDestMsg);
        break;

    case WUEPS_PID_VC:

         MN_CALL_ProcVCMsg(pstDestMsg);
        break;


#if ((FEATURE_ON == FEATURE_GCBS) || (FEATURE_ON == FEATURE_WCBS))
    case UEPS_PID_GAS:
    case WUEPS_PID_BMC:
#if (FEATURE_ON == FEATURE_LTE)
    case PS_PID_ERRC:
#endif
    case WUEPS_PID_WRR:
        TAF_CBA_MsgProc(pstDestMsg);
        break;

#endif

    case UEPS_PID_NDCLIENT:
        TAF_APS_ProcMsg(pstDestMsg);
        break;

    case ACPU_PID_TAFAGENT:
        TAF_APS_ProcMsg(pstDestMsg);
        break;

    default:
        MN_ERR_LOG1("MN_DispatchMsg: Unknown message sender, SenderPid, ", (VOS_INT32)pstMsg->ulSenderPid);
        break;
    }
}