VOS_VOID NAS_EMM_AttSetMsId(VOS_VOID                *pstRcvMsg)
{
    NAS_EMM_CN_ATTACH_ACP_STRU          *pstAttAcp;

    if (NAS_EMM_NULL_PTR == pstRcvMsg)
    {
        /*打印错误*/
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_AppSendAttSucc: Input para is invalid!");
        return;
    }

    pstAttAcp = (NAS_EMM_CN_ATTACH_ACP_STRU *)pstRcvMsg;

    if(pstAttAcp->ucBitOpMsId == NAS_EMM_AD_BIT_SLCT)
    {
        NAS_EMM_GLO_AD_OP_GetMsId()   = NAS_EMM_AD_BIT_SLCT;
        NAS_LMM_MEM_CPY(                NAS_EMM_GLO_AD_GetMsIdAddr(),
                                        &pstAttAcp->stMsId,
                                        sizeof(NAS_EMM_MSID_STRU));
    }
    else
    {
        NAS_EMM_GLO_AD_OP_GetMsId()   = NAS_EMM_AD_BIT_NO_SLCT;
        NAS_LMM_MEM_SET(                NAS_EMM_GLO_AD_GetMsIdAddr(),
                                        0,
                                        sizeof(NAS_EMM_MSID_STRU));
    }
    return;
}
/*lint -e960*/
VOS_VOID    NAS_EMM_EsmSendEstCnf (EMM_ESM_ATTACH_STATUS_ENUM_UINT32 ucEstRst)
{
    EMM_ESM_EST_CNF_STRU                 *pEmmEsmEstCnfMsg;


    /*申请消息内存*/
    pEmmEsmEstCnfMsg   = (VOS_VOID *)NAS_LMM_ALLOC_MSG(sizeof(EMM_ESM_EST_CNF_STRU));

    /*判断申请结果,若失败打印错误并退出*/
    if (NAS_EMM_NULL_PTR == pEmmEsmEstCnfMsg)
    {
        /*打印错误*/
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_EsmSendEstCnf: MSG ALLOC ERR!");
        return;

    }

    /*构造ID_EMM_ESM_EST_CNF消息*/
    /*填充消息头*/
    NAS_EMM_COMP_AD_ESM_MSG_HEADER(      pEmmEsmEstCnfMsg,
                                         (sizeof(EMM_ESM_EST_CNF_STRU)-
                                          NAS_EMM_LEN_VOS_MSG_HEADER));

    /*填充消息ID*/
    pEmmEsmEstCnfMsg->ulMsgId            = ID_EMM_ESM_EST_CNF;

    /*填充消息内容*/
    pEmmEsmEstCnfMsg->ulEstRst           = ucEstRst;

    /*向ESM发送ID_EMM_ESM_EST_CNF消息*/
    NAS_LMM_SEND_MSG(                   pEmmEsmEstCnfMsg);

    return;

}
VOS_VOID NAS_EMM_AttSetEplms(VOS_VOID                *pstRcvMsg)
{
    NAS_EMM_CN_ATTACH_ACP_STRU          *pstAttAcp;

    if (NAS_EMM_NULL_PTR == pstRcvMsg)
    {
        /*打印错误*/
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_AppSendAttSucc: Input para is invalid!");
        return;
    }

    pstAttAcp = (NAS_EMM_CN_ATTACH_ACP_STRU *)pstRcvMsg;

    if(pstAttAcp->ucBitOpPlmnList == NAS_EMM_AD_BIT_SLCT)
    {
        NAS_LMM_GetEmmInfoNetInfoOpEplmnListAddr()   = NAS_EMM_AD_BIT_SLCT;
        NAS_LMM_MEM_CPY(                NAS_LMM_GetEmmInfoNetInfoEplmnListAddr(),
                                        &pstAttAcp->stPlmnList,
                                        sizeof(MMC_LMM_EPLMN_STRU));
    }
    else
    {
        NAS_LMM_GetEmmInfoNetInfoOpEplmnListAddr()   = NAS_EMM_AD_BIT_NO_SLCT;

        NAS_LMM_MEM_SET(                NAS_LMM_GetEmmInfoNetInfoEplmnListAddr(),
                                        0,
                                        sizeof(MMC_LMM_EPLMN_STRU));
    }
    return;
}
VOS_UINT32    NAS_EMM_MsRegInitSsWaitRrcDataCnfMsgAppAttachReq(VOS_UINT32  ulMsgId,
                                                            VOS_VOID   *pMsgStru  )
{
    MMC_LMM_ATTACH_REQ_STRU              *pRcvEmmMsg;

    (VOS_VOID)ulMsgId;

    pRcvEmmMsg                          = (MMC_LMM_ATTACH_REQ_STRU *)pMsgStru;


    /*打印进入该函数*/
    NAS_EMM_ATTACH_LOG_NORM("NAS_EMM_MsRegInitSsWtEsmBearerCnfMsgAppAttachReq is entered");

    /*检查状态是否匹配,若不匹配,退出*/
    if (NAS_EMM_AD_CHK_STAT_INVALID(EMM_MS_REG_INIT,EMM_SS_ATTACH_WAIT_RRC_DATA_CNF))
    {
        /*打印出错信息*/
         NAS_EMM_ATTACH_LOG_WARN("NAS_EMM_MsDrgSsPlmnSrcMsgAppAttachReq: STATE ERR!");
        return  NAS_LMM_MSG_DISCARD;
    }

    /*消息内容检查,若有错,打印并退出*/
    if (NAS_EMM_PARA_INVALID == NAS_EMM_AppAttachReqMsgChk(pRcvEmmMsg))
    {
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_MsRegInitSsWaitRrcDataCnfMsgAppAttachReq: MMC_LMM_ATTACH_REQ_STRU PARA ERR!");
        return  NAS_LMM_ERR_CODE_PARA_INVALID;

    }

    return NAS_LMM_STORE_LOW_PRIO_MSG;

}
/*****************************************************************************
 Function Name   : NAS_EMM_TcSendDataInd
 Description     : 向TC发送ID_EMM_ETC_DATA_IND消息
 Input           : None
 Output          : None
 Return          : VOS_VOID

 History         :
    1.lihong00150010      2009-10-16  Draft Enact

*****************************************************************************/
VOS_VOID  NAS_EMM_TcSendDataInd
(
    const NAS_EMM_CN_MSGCON_STRU       *pstTcMsg
)
{
    EMM_ETC_DATA_IND_STRU               *pEmmTcDataIndMsg = VOS_NULL_PTR;
    VOS_UINT32                          ulTcMsgLen;
    VOS_UINT32                          ulDataIndLenNoHeader;


    ulTcMsgLen                          = pstTcMsg->ulMsgLen;
    ulDataIndLenNoHeader                = NAS_EMM_CountTcDataIndLen(ulTcMsgLen);


    /*申请消息内存*/
    if (ulTcMsgLen < 4)
    {
        pEmmTcDataIndMsg = (VOS_VOID *)NAS_LMM_ALLOC_MSG(sizeof(EMM_ETC_DATA_IND_STRU));

    }
    else
    {
        pEmmTcDataIndMsg = (VOS_VOID *)NAS_LMM_ALLOC_MSG(
                               ulDataIndLenNoHeader + NAS_EMM_LEN_VOS_MSG_HEADER);
    }

    /*判断申请结果,若失败打印错误并退出*/
    if (NAS_EMM_NULL_PTR == pEmmTcDataIndMsg)
    {
        /*打印错误*/
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_TcSendDataInd: MSG ALLOC ERR!");
        return;

    }

    /*构造ID_EMM_ETC_DATA_IND消息*/
    /*填充消息头*/
    NAS_EMM_COMP_AD_TC_MSG_HEADER(pEmmTcDataIndMsg, ulDataIndLenNoHeader);

    /*填充消息ID*/
    pEmmTcDataIndMsg->ulMsgId         = ID_EMM_ETC_DATA_IND;

    /*填充消息内容*/
    pEmmTcDataIndMsg->stTcMsg.ulTcMsgSize = pstTcMsg->ulMsgLen;

    NAS_LMM_MEM_CPY(                 pEmmTcDataIndMsg->stTcMsg.aucTcMsg,
                                     pstTcMsg->aucMsg,
                                     pstTcMsg->ulMsgLen);

    /*向TC发送ID_EMM_ETC_DATA_IND消息*/
    NAS_LMM_SEND_MSG(                   pEmmTcDataIndMsg);

    /* 打印发送消息 */
    NAS_EMM_ATTACH_LOG_NORM("NAS_EMM_TcSendDataInd:NORM:Send ID_EMM_ETC_DATA_IND!");
}
/*lint -e960*/
VOS_VOID    NAS_EMM_SendRejEventToSTK(VOS_UINT8 ucCauseCode,
                                      LNAS_STK_UPDATE_TYPE_ENUM_UINT8          enUpdateType)
{
    LNAS_STK_NETWORK_REJECTION_EVENT_STRU       *pEmmNetworkRejectMsg;
    NAS_MM_PLMN_ID_STRU     *pEmmPlmnID;
    NAS_MM_TAC_STRU         *pEmmTac;

    NAS_EMM_ATTACH_LOG_NORM("NAS_EMM_SendRejEventToSTK is entered");
    /*申请消息内存*/
    pEmmNetworkRejectMsg   = (VOS_VOID *)NAS_LMM_ALLOC_MSG(sizeof(LNAS_STK_NETWORK_REJECTION_EVENT_STRU));

    /*判断申请结果,若失败打印错误并退出*/
    if (NAS_EMM_NULL_PTR == pEmmNetworkRejectMsg)
    {
        /*打印错误*/
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_SendRejEventToSTK: MSG ALLOC ERR!");
        return;

    }

    /*构造ID_LNAS_STK_NETWORK_REJECTION_EVENT消息*/
    /*填充消息头*/
    NAS_EMM_STK_MSG_HEADER(      pEmmNetworkRejectMsg,
                                 (sizeof(LNAS_STK_NETWORK_REJECTION_EVENT_STRU)-
                                  NAS_EMM_LEN_VOS_MSG_HEADER));

    /*填充消息ID*/
    pEmmNetworkRejectMsg->ulMsgName = ID_LNAS_STK_NETWORK_REJECTION_EVENT;

    /*填充消息内容*/
    pEmmNetworkRejectMsg->stNetworkRejectionEvent.ucCauseCode = ucCauseCode;

    /*填充消息plmn*/
    pEmmPlmnID = NAS_LMM_GetEmmInfoPresentPlmnAddr();
    pEmmNetworkRejectMsg->stNetworkRejectionEvent.stTaiInfo.stCurPlmnID.aucPlmnId[0] =
        pEmmPlmnID->aucPlmnId[0];
    pEmmNetworkRejectMsg->stNetworkRejectionEvent.stTaiInfo.stCurPlmnID.aucPlmnId[1] =
        pEmmPlmnID->aucPlmnId[1];
    pEmmNetworkRejectMsg->stNetworkRejectionEvent.stTaiInfo.stCurPlmnID.aucPlmnId[2] =
        pEmmPlmnID->aucPlmnId[2];

    /*填充消息TAC*/
    pEmmTac = NAS_LMM_GetEmmInfoPresentTacAddr();
    pEmmNetworkRejectMsg->stNetworkRejectionEvent.stTaiInfo.stTac.ucTac    = pEmmTac->ucTac;
    pEmmNetworkRejectMsg->stNetworkRejectionEvent.stTaiInfo.stTac.ucTacCnt = pEmmTac->ucTacCnt;

    /*填充消息enUpdateAttachType*/
    pEmmNetworkRejectMsg->stNetworkRejectionEvent.enUpdateAttachType = enUpdateType;

    /*向stk发送rejection消息*/
    NAS_LMM_SEND_MSG(pEmmNetworkRejectMsg);

    return;
}
VOS_UINT32    NAS_EMM_MsRegSsNoCellAvailMsgAppAttachReq( VOS_UINT32  ulMsgId,
                                                    VOS_VOID   *pMsgStru  )
{
    MMC_LMM_ATTACH_REQ_STRU             *pRcvEmmMsg;

    (VOS_VOID)ulMsgId;

    pRcvEmmMsg                          = (MMC_LMM_ATTACH_REQ_STRU *)pMsgStru;


    /*打印进入该函数*/
    NAS_EMM_ATTACH_LOG_NORM("NAS_EMM_MsRegSsNoCellAvailMsgAppAttachReq is entered");

    /*检查状态是否匹配,若不匹配,退出*/
    if (NAS_EMM_AD_CHK_STAT_INVALID(EMM_MS_REG,EMM_SS_REG_NO_CELL_AVAILABLE))
    {
        /*打印出错信息*/
         NAS_EMM_ATTACH_LOG_WARN("NAS_EMM_MsDrgSsPlmnSrcMsgAppAttachReq: STATE ERR!");
        return  NAS_LMM_MSG_DISCARD;
    }

    /*消息内容检查,若有错,打印并退出*/
    if (NAS_EMM_PARA_INVALID == NAS_EMM_AppAttachReqMsgChk(pRcvEmmMsg))
    {
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_MsRegSsNoCellAvailMsgAppAttachReq: APP_MM_ATTACH_REQ_STRU PARA ERR!");
        return  NAS_LMM_ERR_CODE_PARA_INVALID;

    }


    /*保存APP参数*/
    NAS_EMM_SaveAppMsgPara(pRcvEmmMsg->ulMsgId,pRcvEmmMsg->ulOpId);

    if(MMC_LMM_ATT_REQ_TYPE_PS_ONLY == pRcvEmmMsg->ulAttachType)
    {

        /*向MMC发送ATTACH成功*/
        NAS_EMM_MmcSendAttCnf(MMC_LMM_ATT_RSLT_SUCCESS);
        return  NAS_LMM_MSG_HANDLED;
    }
    if ( (NAS_EMM_YES == NAS_EMM_IsCsPsUeMode())
        &&(NAS_LMM_REG_DOMAIN_CS_PS == NAS_LMM_GetEmmInfoRegDomain()))
    {
        NAS_EMM_MmcSendAttCnf(MMC_LMM_ATT_RSLT_SUCCESS);
        return NAS_LMM_MSG_HANDLED;
    }
    else
    {

        NAS_EMM_MmcSendAttCnf(MMC_LMM_ATT_RSLT_FAILURE);
        return NAS_LMM_MSG_HANDLED;
    }

}
VOS_VOID    NAS_EMM_EsmSendDataInd (const NAS_EMM_CN_MSGCON_STRU *pstEsmBearerReq)
{
    EMM_ESM_DATA_IND_STRU                *pEmmEsmBearerReqMsg;
    VOS_UINT32                          ulEsmMsgLen;
    VOS_UINT32                          ulDataIndLenNoHeader;


    ulEsmMsgLen                          = pstEsmBearerReq->ulMsgLen;
    ulDataIndLenNoHeader                = NAS_EMM_CountEsmDataIndLen(ulEsmMsgLen);


    /*申请消息内存*/
    if (ulEsmMsgLen < 4)
    {
        pEmmEsmBearerReqMsg = (VOS_VOID *)NAS_LMM_ALLOC_MSG(sizeof(EMM_ESM_DATA_IND_STRU));

    }
    else
    {
        pEmmEsmBearerReqMsg = (VOS_VOID *)NAS_LMM_ALLOC_MSG(
                                  ulDataIndLenNoHeader + NAS_EMM_LEN_VOS_MSG_HEADER);
    }

    /*判断申请结果,若失败打印错误并退出*/
    if (NAS_EMM_NULL_PTR == pEmmEsmBearerReqMsg)
    {
        /*打印错误*/
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_EsmSendDataInd: MSG ALLOC ERR!");
        return;

    }

    /*构造ID_EMM_ESM_DATA_IND消息*/
    /*填充消息头*/
    NAS_EMM_COMP_AD_ESM_MSG_HEADER(pEmmEsmBearerReqMsg, ulDataIndLenNoHeader);

    /*填充消息ID*/
    pEmmEsmBearerReqMsg->ulMsgId         = ID_EMM_ESM_DATA_IND;

    /*填充消息内容*/
    pEmmEsmBearerReqMsg->stEsmMsg.ulEsmMsgSize = pstEsmBearerReq->ulMsgLen;

    NAS_LMM_MEM_CPY(                 pEmmEsmBearerReqMsg->stEsmMsg.aucEsmMsg,
                                     pstEsmBearerReq->aucMsg,
                                     pstEsmBearerReq->ulMsgLen);

    /*向ESM发送ID_EMM_ESM_DATA_IND消息*/
    NAS_LMM_SEND_MSG(                   pEmmEsmBearerReqMsg);

    return;

}
VOS_UINT32  NAS_EMM_MsRegSsRegAttemptUpdateMmMsgAppAttachReq
(
    VOS_UINT32  ulMsgId,
    VOS_VOID   *pMsgStru
)
{
    MMC_LMM_ATTACH_REQ_STRU              *pRcvEmmMsg;

    (VOS_VOID)ulMsgId;

    pRcvEmmMsg                          = (MMC_LMM_ATTACH_REQ_STRU *)pMsgStru;


    /*打印进入该函数*/
    NAS_EMM_ATTACH_LOG_NORM("NAS_EMM_MsRegSsRegAttemptUpdateMmMsgAppAttachReq is entered");

    /*检查状态是否匹配,若不匹配,退出*/
    if (NAS_EMM_AD_CHK_STAT_INVALID(EMM_MS_REG,EMM_SS_REG_ATTEMPTING_TO_UPDATE_MM))
    {
        /*打印出错信息*/
         NAS_EMM_ATTACH_LOG_WARN("NAS_EMM_MsRegSsRegAttemptUpdateMmMsgAppAttachReq: STATE ERR!");
        return  NAS_LMM_MSG_DISCARD;
    }

    /*消息内容检查,若有错,打印并退出*/
    if (NAS_EMM_PARA_INVALID == NAS_EMM_AppAttachReqMsgChk(pRcvEmmMsg))
    {
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_MsRegSsRegAttemptUpdateMmMsgAppAttachReq: MMC_LMM_ATTACH_REQ_STRU PARA ERR!");
        return  NAS_LMM_ERR_CODE_PARA_INVALID;

    }

    /*保存APP参数*/
    NAS_EMM_SaveAppMsgPara(pRcvEmmMsg->ulMsgId,pRcvEmmMsg->ulOpId);

    if(MMC_LMM_ATT_REQ_TYPE_PS_ONLY == pRcvEmmMsg->ulAttachType)
    {
        /*向MMC发送ATTACH成功*/
        NAS_EMM_MmcSendAttCnf(MMC_LMM_ATT_RSLT_SUCCESS);
        return NAS_LMM_MSG_HANDLED;
    }

    NAS_EMM_MmcSendAttCnf(MMC_LMM_ATT_RSLT_FAILURE);


    return  NAS_LMM_MSG_HANDLED;
}
VOS_UINT32    NAS_EMM_MsRegInitSsWtCnAttCnfMsgAppAttachReq(VOS_UINT32  ulMsgId,
                                                         VOS_VOID   *pMsgStru  )
{
    MMC_LMM_ATTACH_REQ_STRU              *pRcvEmmMsg;

    (VOS_VOID)ulMsgId;

    pRcvEmmMsg                          = (MMC_LMM_ATTACH_REQ_STRU *) pMsgStru;


    /*打印进入该函数*/
    NAS_EMM_ATTACH_LOG_NORM("NAS_EMM_MsRegInitSsWtCnAttCnfMsgAppAttachReq is entered");

    /*检查状态是否匹配,若不匹配,退出*/
    if (NAS_EMM_AD_CHK_STAT_INVALID(EMM_MS_REG_INIT,EMM_SS_ATTACH_WAIT_CN_ATTACH_CNF))
    {
        /*打印出错信息*/
         NAS_EMM_ATTACH_LOG_WARN("NAS_EMM_MsDrgSsPlmnSrcMsgAppAttachReq: STATE ERR!");
        return  NAS_LMM_MSG_DISCARD;
    }

    /*消息内容检查,若有错,打印并退出*/
    if (NAS_EMM_PARA_INVALID == NAS_EMM_AppAttachReqMsgChk(pRcvEmmMsg))
    {
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_MsRegInitSsWtCnAttCnfMsgAppAttachReq: MMC_LMM_ATTACH_REQ_STRU PARA ERR!");
        return  NAS_LMM_ERR_CODE_PARA_INVALID;

    }

    /* 用户请求ATTACH类型为IMSI,UE模式为PS,则直接回复FAILURE ,
       用户请求ATTACH类型为IMSI,UE模式为CS_PS,此时注册状态为NULL,则直接回复FAILURE ,
       综上,RegInitSsWtCnAttCnf状态下CS的ATTACH都直接回复失败 */
    if( (MMC_LMM_ATT_REQ_TYPE_CS_ONLY == pRcvEmmMsg->ulAttachType)
      &&(NAS_EMM_NO == NAS_EMM_IsCsPsUeMode()))
    {
        /*保存APP参数*/
        NAS_EMM_SaveAppMsgPara(pRcvEmmMsg->ulMsgId,pRcvEmmMsg->ulOpId);

        /*向MMC发送ATTACH失败*/
        NAS_EMM_MmcSendAttCnf(MMC_LMM_ATT_RSLT_FAILURE);
        return  NAS_LMM_MSG_HANDLED;
    }

    /* 低优先级缓存 */
    NAS_EMM_ATTACH_LOG_INFO("NAS_EMM_MsRegInitSsWtCnAttCnfMsgAppAttachReq  IS NAS_LMM_STORE_LOW_PRIO_MSG");
    return  NAS_LMM_STORE_LOW_PRIO_MSG;
}
VOS_VOID    NAS_EMM_CompCnDetachReqMo(  NAS_EMM_MRRC_DATA_REQ_STRU *pDetReqMoMsg)
{
    VOS_UINT32                          ulIndex;
    VOS_UINT32                          ulDataReqLenNoHeader;
    NAS_EMM_MRRC_DATA_REQ_STRU         *pTempDetReqMsg = pDetReqMoMsg;

    if (NAS_EMM_NULL_PTR == pDetReqMoMsg)
    {
        /*打印错误*/
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_CompCnDetachReqMo: Mem Alloc Err!");
        return;
    }

    ulIndex = 0;
    /*计算DETACH REQ空口消息*/
    NAS_EMM_CompCnDetachReqMoNasMsg(pTempDetReqMsg->stNasMsg.aucNasMsg, &ulIndex);

    /*内部消息长度计算*/
    ulDataReqLenNoHeader             = NAS_EMM_CountMrrcDataReqLen(ulIndex);

    if ( NAS_EMM_INTRA_MSG_MAX_SIZE < ulDataReqLenNoHeader )
    {
        /* 打印错误信息 */
        NAS_LMM_PUBM_LOG_ERR("NAS_EMM_CompCnDetachReqMo, Size error");
        return ;
    }

    /*填充消息长度*/
    pTempDetReqMsg->stNasMsg.ulNasMsgSize    = ulIndex;

    /*填充消息头*/
    NAS_EMM_COMP_AD_INTRA_MSG_HEADER(pTempDetReqMsg, ulDataReqLenNoHeader);

    /*填充消息ID*/
    pTempDetReqMsg->ulMsgId                  = ID_NAS_LMM_INTRA_MRRC_DATA_REQ;

    pTempDetReqMsg->enDataCnf                = LRRC_LMM_DATA_CNF_NEED;

    /*填充消息内容*/
    pTempDetReqMsg->enEstCaue                = LRRC_LNAS_EST_CAUSE_MO_SIGNALLING;
    pTempDetReqMsg->enCallType               = LRRC_LNAS_CALL_TYPE_ORIGINATING_SIGNALLING;
    pTempDetReqMsg->enEmmMsgType             = NAS_EMM_MSG_DETACH_REQ;

    return;
}
VOS_UINT32    NAS_EMM_MsDrgSsAttNeedMsgAppAttachReq(VOS_UINT32  ulMsgId,
                                                  VOS_VOID   *pMsgStru )
{
    MMC_LMM_ATTACH_REQ_STRU              *pRcvEmmMsg;

    (VOS_VOID)ulMsgId;

    pRcvEmmMsg                          = (MMC_LMM_ATTACH_REQ_STRU *)pMsgStru;


    /*打印进入该函数*/
    NAS_EMM_ATTACH_LOG_NORM("NAS_EMM_MsDrgSsAttNeedMsgAppAttachReq is entered");

    /*检查状态是否匹配,若不匹配,退出*/
    if (NAS_EMM_AD_CHK_STAT_INVALID(EMM_MS_DEREG,EMM_SS_DEREG_ATTACH_NEEDED))
    {
        /*打印出错信息*/
         NAS_EMM_ATTACH_LOG_WARN("NAS_EMM_MsDrgSsPlmnSrcMsgAppAttachReq: STATE ERR!");
        return  NAS_LMM_MSG_DISCARD;
    }

    /*消息内容检查,若有错,打印并退出*/
    if (NAS_EMM_PARA_INVALID == NAS_EMM_AppAttachReqMsgChk(pRcvEmmMsg))
    {
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_MsDrgSsAttNeedMsgAppAttachReq: MMC_LMM_ATTACH_REQ_STRU PARA ERR!");
        return  NAS_LMM_ERR_CODE_PARA_INVALID;

    }

    /*保存APP参数*/
    NAS_EMM_SaveAppMsgPara(pRcvEmmMsg->ulMsgId,pRcvEmmMsg->ulOpId);

    /*向MMC发送ATTACH失败*/
    NAS_EMM_AppSendAttRstDefaultReqType(MMC_LMM_ATT_RSLT_ACCESS_BAR);

    /* ATTACH NEEDED 状态下,等3402超时后,会自动发起ATTACH,不必由APP
    的ATTACH REQ触发ATTACH流程;
    返回NAS_LMM_MSG_HANDLED,不返回DISCARD,避免MMC再处理一遍*/
    NAS_EMM_ATTACH_LOG_INFO("NAS_EMM_MsDrgSsAttemptToAttMsgAppAttachReq: handled and discard out of NAS.");
    return  NAS_LMM_MSG_HANDLED;


  }
VOS_UINT32    NAS_EMM_MsDrgSsNoCellAvailMsgAppAttachReq(VOS_UINT32  ulMsgId,
                                                      VOS_VOID   *pMsgStru )
{
    MMC_LMM_ATTACH_REQ_STRU              *pRcvEmmMsg;

    (VOS_VOID)ulMsgId;

    pRcvEmmMsg                          = (MMC_LMM_ATTACH_REQ_STRU *)pMsgStru;


    /*打印进入该函数*/
    NAS_EMM_ATTACH_LOG_NORM("NAS_EMM_MsDrgSsNoCellAvailMsgAppAttachReq is entered");

    /*检查状态是否匹配,若不匹配,退出*/
    if (NAS_EMM_AD_CHK_STAT_INVALID(EMM_MS_DEREG,EMM_SS_DEREG_NO_CELL_AVAILABLE))
    {
        /*打印出错信息*/
         NAS_EMM_ATTACH_LOG_WARN("NAS_EMM_MsDrgSsPlmnSrcMsgAppAttachReq: STATE ERR!");
        return  NAS_LMM_MSG_DISCARD;
    }

    /*消息内容检查,若有错,打印并退出*/
    if (NAS_EMM_PARA_INVALID == NAS_EMM_AppAttachReqMsgChk(pRcvEmmMsg))
    {
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_MsDrgSsNoCellAvailMsgAppAttachReq: MMC_LMM_ATTACH_REQ_STRU PARA ERR!");
        return  NAS_LMM_ERR_CODE_PARA_INVALID;

    }


    /*保存APP参数*/
    NAS_EMM_SaveAppMsgPara(pRcvEmmMsg->ulMsgId,pRcvEmmMsg->ulOpId);

    /*向MMC发送ATTACH失败*/
    NAS_EMM_MmcSendAttCnf(MMC_LMM_ATT_RSLT_FAILURE);

    /*返回NAS_LMM_MSG_HANDLED,不返回DISCARD,避免MMC再处理一遍*/
    NAS_EMM_ATTACH_LOG_INFO("NAS_EMM_MsDrgSsNoCellAvailMsgAppAttachReq: handled and discard out of NAS.");
    return  NAS_LMM_MSG_HANDLED;



}
VOS_UINT32    NAS_EMM_MsDrgInitSsWtCnDetCnfMsgAppAttachReq( VOS_UINT32  ulMsgId,
                                                    VOS_VOID   *pMsgStru  )
{
    MMC_LMM_ATTACH_REQ_STRU              *pRcvEmmMsg;

    (VOS_VOID)(ulMsgId);


    pRcvEmmMsg                          = (MMC_LMM_ATTACH_REQ_STRU *) pMsgStru;

    /* 打印,*/
    NAS_EMM_ATTACH_LOG_WARN("NAS_EMM_MsDrgInitSsWtCnDetCnfMsgAppAttachReq: Receive Message APP ATTACH.");

    /*消息内容检查,若有错,打印并退出*/
    if (NAS_EMM_PARA_INVALID == NAS_EMM_AppAttachReqMsgChk(pRcvEmmMsg))
    {
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_MsDrgInitSsWtCnDetCnfMsgAppAttachReq: NAS_EMM_CN_ATTACH_REQ_STRU PARA ERR!");
        return  NAS_LMM_ERR_CODE_PARA_INVALID;

    }


    /*停止定时器T3421*/
    NAS_LMM_StopStateTimer(              TI_NAS_EMM_T3421);

    /*向ESM发送ID_EMM_ESM_STATUS_IND消息*/
    NAS_EMM_EsmSendStatResult(       EMM_ESM_ATTACH_STATUS_DETACHED);

    /*给MMC回复Detach Cnf */
    NAS_EMM_SendDetRslt(MMC_LMM_DETACH_RSLT_SUCCESS);

	/* lihong00150010 emergency tau&service begin */
    if (VOS_TRUE == NAS_EMM_GLO_AD_GetUsimPullOutFlag())
    {/* lihong00150010 emergency tau&service end */
        NAS_EMM_DETACH_LOG_NORM("NAS_EMM_MsDrgInitSsWtCnDetCnfMsgAppAttachReq: No USIM");

        NAS_EMM_ProcLocalNoUsim();
    }
    else
    {
        /* 本地DETACH释放资源:动态内存、赋初值 */
        NAS_LMM_DeregReleaseResource();

        NAS_EMM_AdStateConvert( EMM_MS_DEREG,
                                    EMM_SS_DEREG_NORMAL_SERVICE,
                                    TI_NAS_EMM_STATE_NO_TIMER);

    }
    /*保存APP参数*/
    NAS_EMM_SaveAppMsgPara(pRcvEmmMsg->ulMsgId,pRcvEmmMsg->ulOpId);


    /*重新保存用户发起ATTACH的请求类型*/
    NAS_EMM_GLO_SetAttReqType(pRcvEmmMsg->ulAttachType);

    /*CS域的attach请求直接返回失败 */
    if (MMC_LMM_ATT_REQ_TYPE_CS_ONLY == pRcvEmmMsg->ulAttachType)
    {

        NAS_EMM_MmcSendAttCnf(MMC_LMM_ATT_RSLT_FAILURE);

    }

    /*向MRRC发送NAS_EMM_MRRC_REL_REQ消息*/
    NAS_EMM_RelReq(                     NAS_LMM_NOT_BARRED);


    return NAS_LMM_MSG_HANDLED;
}
VOS_UINT32    NAS_EMM_MsRegSsWaitAccessGrantIndMsgAppAttachReq( VOS_UINT32  ulMsgId,
                                                    VOS_VOID   *pMsgStru  )
{
    MMC_LMM_ATTACH_REQ_STRU              *pRcvEmmMsg;

    (VOS_VOID)ulMsgId;

    pRcvEmmMsg                          = (MMC_LMM_ATTACH_REQ_STRU *)pMsgStru;


    /*打印进入该函数*/
    NAS_EMM_ATTACH_LOG_NORM("NAS_EMM_MsRegSsWaitAccessGrantIndMsgAppAttachReq is entered");

    /*检查状态是否匹配,若不匹配,退出*/
    if (NAS_EMM_AD_CHK_STAT_INVALID(EMM_MS_REG,EMM_SS_REG_WAIT_ACCESS_GRANT_IND))
    {
        /*打印出错信息*/
         NAS_EMM_ATTACH_LOG_WARN("NAS_EMM_MsRegSsWaitAccessGrantIndMsgAppAttachReq: STATE ERR!");
        return  NAS_LMM_MSG_DISCARD;
    }

    /*消息内容检查,若有错,打印并退出*/
    if (NAS_EMM_PARA_INVALID == NAS_EMM_AppAttachReqMsgChk(pRcvEmmMsg))
    {
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_MsRegSsWaitAccessGrantIndMsgAppAttachReq: MMC_LMM_ATTACH_REQ_STRU PARA ERR!");
        return  NAS_LMM_ERR_CODE_PARA_INVALID;

    }


    /*保存APP参数*/
    NAS_EMM_SaveAppMsgPara(pRcvEmmMsg->ulMsgId,pRcvEmmMsg->ulOpId);

    if(MMC_LMM_ATT_REQ_TYPE_PS_ONLY == pRcvEmmMsg->ulAttachType)
    {
        /*向MMC发送ATTACH成功*/
        NAS_EMM_MmcSendAttCnf(MMC_LMM_ATT_RSLT_SUCCESS);
        return NAS_LMM_MSG_HANDLED;
    }

    /*操作模式是PS*/
    if(NAS_EMM_NO == NAS_EMM_IsCsPsUeMode())
    {
        NAS_EMM_MmcSendAttCnf(MMC_LMM_ATT_RSLT_FAILURE);
        return NAS_LMM_MSG_HANDLED;
    }

    /*注册域为CS_PS*/
    if (NAS_LMM_REG_DOMAIN_CS_PS == NAS_LMM_GetEmmInfoRegDomain())
    {
        NAS_EMM_MmcSendAttCnf(MMC_LMM_ATT_RSLT_SUCCESS);
        return NAS_LMM_MSG_HANDLED;
    }
    /*注册域为PS*/
    if (NAS_LMM_REG_DOMAIN_PS == NAS_LMM_GetEmmInfoRegDomain())
    {
        if( (NAS_EMM_REJ_YES == NAS_LMM_GetEmmInfoRejCause2Flag())
            ||(NAS_EMM_REJ_YES == NAS_EMMC_GetRejCause18Flag()))
        {
            NAS_EMM_MmcSendAttCnf(MMC_LMM_ATT_RSLT_FAILURE);
            return NAS_LMM_MSG_HANDLED;
        }
        /*联合TAU*/
        /*信令被BAR不能发起,其它可以发起,内部消息处理中会判断,此处不再判断*/
        NAS_EMM_SendIntraTauReq(ID_APP_MM_MSG_TYPE_BUTT,NAS_LMM_INTRA_TAU_TYPE_IMSI_ATTACH);
        return NAS_LMM_MSG_HANDLED;
    }

    return  NAS_LMM_MSG_HANDLED;
}
VOS_UINT32  NAS_EMM_MsRegInitSsWtCnAttCnfMsgCnAttachAcp(VOS_UINT32  ulMsgId,
        VOS_VOID   *pMsgStru)
{
    NAS_EMM_CN_ATTACH_ACP_STRU         *pRcvEmmMsg;
    NAS_LMM_NETWORK_INFO_STRU          *pMmNetInfo = VOS_NULL_PTR;
#if (VOS_OS_VER != VOS_WIN32)
    static VOS_UINT32  s_ulAttachAcpCnt = 1;
#endif

    (VOS_VOID)ulMsgId;

    pRcvEmmMsg                          = (NAS_EMM_CN_ATTACH_ACP_STRU *)pMsgStru;

    /*打印进入该函数*/
    NAS_EMM_ATTACH_LOG_NORM("NAS_EMM_MsRegInitSsWtCnAttCnfMsgCnAttachAcp is entered");

    /*检查状态是否匹配,若不匹配,退出*/
    if (NAS_EMM_AD_CHK_STAT_INVALID(EMM_MS_REG_INIT,EMM_SS_ATTACH_WAIT_CN_ATTACH_CNF))
    {
        /*打印出错信息*/
        NAS_EMM_ATTACH_LOG_WARN("NAS_EMM_MsRegInitSsWtCnAttCnfMsgCnAttachAcp: STATE ERR!");
        return  NAS_LMM_MSG_DISCARD;
    }

    /* 如果ATTACH ACP消息内容不合法,不处理消息,直接丢弃*/
    if (NAS_EMM_PARA_INVALID == NAS_EMM_CnAttachAcpMsgChk(pRcvEmmMsg))
    {
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_MsRegInitSsWtCnAttCnfMsgCnAttachAcp: NAS_EMM_CN_ATTACH_ACC_STRU para err!");
        return  NAS_LMM_ERR_CODE_PARA_INVALID;

    }


    /*停止定时器T3410*/
    NAS_LMM_StopStateTimer(          TI_NAS_EMM_T3410);

    /* 存储ATTACH ACCPET中携带的信元 */
    NAS_EMM_SaveAttachAcpIe(pMsgStru);


    /*清除ATTACH ATTEMPTING COUNTER和TRACKING AREA UPDATING ATTEMPT计数器*/
    /*NAS_EMM_GLO_AD_GetAttAtmpCnt()      = 0;*/
    NAS_EMM_TAU_SaveEmmTAUAttemptCnt(NAS_EMM_TAU_ATTEMPT_CNT_ZERO);

    /*注册成功后,注册前的TAU/SERVICE/DETACH模块记录的历史信息不应该影响后续流程
      清除TAU/service/detach资源
    */
    NAS_EMM_TAU_ClearResouce();
    NAS_EMM_SER_ClearResource();
    NAS_EMM_Detach_ClearResourse();

    /*联合注册仅EPS ONLY成功*/
    if ((MMC_LMM_ATT_TYPE_COMBINED_EPS_IMSI == NAS_EMM_GLO_GetCnAttReqType()) &&
            (EMM_ATTACH_RST_PS == pRcvEmmMsg->ucAttachRst))
    {
        NAS_EMM_ProcEpsOnlySucc(pMsgStru);
    }
    else
    {
        /*设置EPS UPDATE STAUS为EU1*/
        NAS_LMM_GetMmAuxFsmAddr()->ucEmmUpStat = EMM_US_UPDATED_EU1;

        /*启动定时器TI_NAS_EMM_WAIT_ESM_BEARER_CNF*/
        NAS_LMM_StartStateTimer(         TI_NAS_EMM_WAIT_ESM_BEARER_CNF);

        /*修改状态:进入主状态REG_INIT子状态ATTACH_WAIT_ESM_BEARER_CNF*/
        NAS_EMM_AdStateConvert(             EMM_MS_REG_INIT,
                                            EMM_SS_ATTACH_WAIT_ESM_BEARER_CNF,
                                            TI_NAS_EMM_WAIT_ESM_BEARER_CNF);
    }

    /* lihong00150010 emergency tau&service begin */
    /* 参照标杆做法,在收到ATTACH ACCEPT时就更新GUTI, LAST VISIT TAI,EU值,
       并写卡或者NV */
    pMmNetInfo                          = NAS_LMM_GetEmmInfoNetInfoAddr();
    NAS_EMM_SetLVRTai(                  &pMmNetInfo->stPresentNetId);

    /* 判断没有放到函数NAS_LMM_WritePsLoc中来做,是由于紧急注册被拒或者尝试次数
       达到5次时还是要删除参数 ,协议只规定是紧急注册成功后才不写卡或者NV项 */
    if (NAS_LMM_REG_STATUS_EMC_REGING != NAS_LMM_GetEmmInfoRegStatus())
    {
        /*保存PS LOC信息*/
        NAS_LMM_WritePsLoc(NAS_NV_ITEM_UPDATE);
    }
    /* lihong00150010 emergency tau&service end */

    /* 清除接入技术变化标识,在这里清除不考虑ATTACH失败的原因值
          因为要么必然转入了DEREG态,要么MME已经查询完UE无线能力*/
    NAS_EMM_ClearUeRadioAccCapChgFlag();

#if (VOS_OS_VER != VOS_WIN32)
    if(1 == s_ulAttachAcpCnt)
    {
        (VOS_VOID)ddmPhaseScoreBoot("UE attach success",__LINE__);
        s_ulAttachAcpCnt++;
    }
#endif

    return NAS_LMM_MSG_HANDLED;
}
VOS_UINT32  NAS_EMM_MsRegInitSsWtCnAttCnfMsgCnAttachReject(
    VOS_UINT32  ulMsgId,
    VOS_VOID   *pMsgStru )
{
    NAS_EMM_CN_ATTACH_REJ_STRU          *pRcvEmmMsg;
    LNAS_STK_UPDATE_TYPE_ENUM_UINT8     uAttachType;

    (VOS_VOID)ulMsgId;

    pRcvEmmMsg                          = (NAS_EMM_CN_ATTACH_REJ_STRU *) pMsgStru;

    /*打印进入该函数*/
    NAS_EMM_ATTACH_LOG_NORM("NAS_EMM_MsRegInitSsWtCnAttCnfMsgCnAttachReject is entered");

    /*检查状态是否匹配,若不匹配,退出*/
    if (NAS_EMM_AD_CHK_STAT_INVALID(EMM_MS_REG_INIT,EMM_SS_ATTACH_WAIT_CN_ATTACH_CNF))
    {
        /*打印出错信息*/
        NAS_EMM_ATTACH_LOG_WARN("NAS_EMM_MsRegInitSsWtCnAttCnfMsgCnAttachReject: STATE ERR!");
        return  NAS_LMM_MSG_DISCARD;
    }

    /*消息内容检查*/
    if (NAS_EMM_PARA_INVALID == NAS_EMM_CnAttachRejMsgChk(pRcvEmmMsg))
    {
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_MsRegInitSsWtCnAttCnfMsgCnAttachReject: NAS_EMM_CN_ATTACH_REJ_STRU para err!");
        return  NAS_LMM_ERR_CODE_PARA_INVALID;
    }

    /*停止定时器T3410*/
    NAS_LMM_StopStateTimer(              TI_NAS_EMM_T3410);

    /*保存ATTACH拒绝原因*/
    NAS_EMM_GLO_AD_GetAttRejCau()       = pRcvEmmMsg->ucCause;
    NAS_EMM_GLO_AD_GetAttRejEsmCau()    = pRcvEmmMsg->ucEsmCause;

    /* xiongxianghui00253310 modify for ftmerrlog begin */
#if (FEATURE_PTM == FEATURE_ON)
    NAS_LMM_ErrlogInfoProc(pRcvEmmMsg->ucCause);
#endif
    /* xiongxianghui00253310 modify for ftmerrlog end   */

    /* 根据当前场景考虑是否修改原因值 */
    NAS_LMM_AdaptRegRejCau(&NAS_EMM_GLO_AD_GetAttRejCau());

    if(pRcvEmmMsg->ucBitOpMsgCon == NAS_EMM_AD_BIT_SLCT)
    {
        /*向ESM发送消息*/
        NAS_EMM_EsmSendDataInd(          &(pRcvEmmMsg->stMsgCon));
    }

    switch(NAS_EMM_GLO_GetCnAttReqType())
    {
    case MMC_LMM_ATT_TYPE_EPS_ONLY:
        uAttachType = LNAS_STK_UPDATE_TYPE_EPS_ATTACH;
        break;

    case  MMC_LMM_ATT_TYPE_COMBINED_EPS_IMSI:
        uAttachType = LNAS_STK_UPDATE_TYPE_COMBINED_ATTACH;
        break;

    default:
        uAttachType = LNAS_STK_UPDATE_TYPE_EPS_ATTACH;
        break;

    }

    /*在ATTACH过程中出现rej,将rej事件报告给STK*/
    NAS_EMM_SendRejEventToSTK(NAS_EMM_GLO_AD_GetAttRejCau(), uAttachType);

    /*判断拒绝原因值,根据不同原因值进行处理*/
    NAS_EMM_RejCauseValProc(NAS_EMM_GLO_AD_GetAttRejCau());

    return  NAS_LMM_MSG_HANDLED;
}
VOS_UINT32    NAS_EMM_MsDrgSsNmlSrvMsgAppAttachReq( VOS_UINT32  ulMsgId,
                                                  VOS_VOID   *pMsgStru)
{
    MMC_LMM_ATTACH_REQ_STRU              *pRcvEmmMsg;

    (VOS_VOID)ulMsgId;

    pRcvEmmMsg                          = (MMC_LMM_ATTACH_REQ_STRU *) pMsgStru;

    /*打印进入该函数*/
    NAS_EMM_ATTACH_LOG_INFO("NAS_EMM_MsDrgSsNmlSrvMsgAppAttachReq is entered");

    /*检查状态是否匹配,若不匹配,退出*/
    if (NAS_EMM_AD_CHK_STAT_INVALID(EMM_MS_DEREG,EMM_SS_DEREG_NORMAL_SERVICE))
    {
        /*打印出错信息*/
        NAS_EMM_ATTACH_LOG_WARN("NAS_EMM_MsDrgSsNmlSrvMsgAppAttachReq: STATE ERR!");
        return  NAS_LMM_MSG_DISCARD;
    }

    /*消息内容检查,若有错,打印并退出*/
    if (NAS_EMM_PARA_INVALID == NAS_EMM_AppAttachReqMsgChk(pRcvEmmMsg))
    {
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_MsDrgSsNmlSrvMsgAppAttachReq: NAS_EMM_CN_ATTACH_REQ_STRU PARA ERR!");
        return  NAS_LMM_ERR_CODE_PARA_INVALID;

    }

    /*保存APP参数*/
    NAS_EMM_SaveAppMsgPara(pRcvEmmMsg->ulMsgId,pRcvEmmMsg->ulOpId);

    /*保存触发ATTACH的原因*/
    NAS_EMM_GLO_AD_GetAttCau()          = EMM_ATTACH_CAUSE_APP;

    /* 用户请求ATTACH类型为IMSI,UE模式为PS,则直接回复FAILURE ,
       用户请求ATTACH类型为IMSI,UE模式为CS_PS,此时注册状态为NULL,则直接回复FAILURE ,
       综上,dereg.normalserive状态下CS的ATTACH都直接回复失败 */
    if (MMC_LMM_ATT_REQ_TYPE_CS_ONLY == pRcvEmmMsg->ulAttachType)
    {

        NAS_EMM_MmcSendAttCnf(MMC_LMM_ATT_RSLT_FAILURE);

    }

    /*用户请求ATTACH类型为PS或者CS_PS,直接发起ATTACH,填充ATTACH消息时判断ATTACH类型*/
    else
    {

        /*向ESM发送ID_EMM_ESM_PDN_CON_IND消息*/
        NAS_EMM_EsmSendPdnConnInd(           NAS_EMM_DEFAULT_CID);

        /*启动定时器TI_NAS_EMM_WAIT_ESM_PDN_RSP*/
        NAS_LMM_StartStateTimer(         TI_NAS_EMM_WAIT_ESM_PDN_RSP);

        /*修改状态:进入主状态REG_INIT子状态ATTACH_WAIT_ESM_PDN_RSP*/
        NAS_EMM_AdStateConvert(             EMM_MS_REG_INIT,
                                            EMM_SS_ATTACH_WAIT_ESM_PDN_RSP,
                                            TI_NAS_EMM_WAIT_ESM_PDN_RSP);

    }


   return   NAS_LMM_MSG_HANDLED;

}
Esempio n. 19
0
VOS_VOID    NAS_EMM_SER_SendMrrcDataReq_ExtendedServiceReq(VOS_VOID)
{
    NAS_EMM_MRRC_DATA_REQ_STRU         *pMrrcDataReqMsg         = NAS_EMM_NULL_PTR;
    VOS_UINT32                          ulDataReqMsgLenNoHeader = NAS_EMM_NULL;
    VOS_UINT32                          ulIndex                 = NAS_EMM_NULL;

    NAS_EMM_SER_LOG_INFO("NAS_EMM_SER_SendMrrcDataReq_ExtendedServiceReq is entered.");

    /*以最小消息长度,申请消息内存,主要是看是否队列有空间*/
    pMrrcDataReqMsg = (VOS_VOID *) NAS_LMM_MEM_ALLOC(NAS_EMM_INTRA_MSG_MAX_SIZE);

    /*判断申请结果,若失败打印错误并退出*/
    if (NAS_EMM_NULL_PTR == pMrrcDataReqMsg)
    {
        /*打印错误*/
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_SER_SendMrrcDataReq_ExtendedServiceReq: MSG ALLOC ERR!");
        return;

    }

    /* 清除CSFB ABORT标识 */
    NAS_EMM_SER_SaveEmmSerCsfbAbortFlag(NAS_EMM_CSFB_ABORT_FLAG_INVALID);

    /*组装EXTENDED SERVICE REQ消息*/
    NAS_EMM_CompCnExtendedSerReqMoNasMsg(pMrrcDataReqMsg->stNasMsg.aucNasMsg, &ulIndex);

    /*内部消息长度计算*/
    ulDataReqMsgLenNoHeader = NAS_EMM_CountMrrcDataReqLen(ulIndex);

    if ( NAS_EMM_INTRA_MSG_MAX_SIZE < ulDataReqMsgLenNoHeader )
    {
        /* 打印错误信息 */
        NAS_LMM_PUBM_LOG_ERR("NAS_EMM_SER_SendMrrcDataReq_ExtendedServiceReq, Size error");
        NAS_LMM_MEM_FREE(pMrrcDataReqMsg);
        return ;
    }

    /*填充消息长度*/
    pMrrcDataReqMsg->stNasMsg.ulNasMsgSize = ulIndex;

    /*填充消息头*/
    EMM_COMP_MM_MSG_HEADER(pMrrcDataReqMsg, ulDataReqMsgLenNoHeader);

    /* 填写MRRC_DATA_REQ 的消息ID标识 */
    pMrrcDataReqMsg->ulMsgId            = ID_NAS_LMM_INTRA_MRRC_DATA_REQ;
    /*填写建立原因*/
    switch(NAS_EMM_SER_GetEmmSERStartCause())
    {
        case NAS_EMM_SER_START_CAUSE_MT_CSFB_REQ:
            pMrrcDataReqMsg->enEstCaue  = LRRC_LNAS_EST_CAUSE_MT_ACCESS;
            pMrrcDataReqMsg->enCallType = LRRC_LNAS_CALL_TYPE_TERMINATING_CALL;
            break;

        case NAS_EMM_SER_START_CAUSE_MO_CSFB_REQ:
            pMrrcDataReqMsg->enEstCaue  = LRRC_LNAS_EST_CAUSE_MO_DATA;
            pMrrcDataReqMsg->enCallType = LRRC_LNAS_CALL_TYPE_MO_CSFB;
            break;

        case NAS_EMM_SER_START_CAUSE_MO_EMERGENCY_CSFB_REQ:
            pMrrcDataReqMsg->enEstCaue  = LRRC_LNAS_EST_CAUSE_EMERGENCY_CALL;
            pMrrcDataReqMsg->enCallType = LRRC_LNAS_CALL_TYPE_EMERGENCY_CALL;
            break;

        default:
            NAS_EMM_SER_LOG_ERR("Nas_Emm_SER_SendMrrcDataReq_ServiceReq:StartCause ERR");
            break;
    }
    pMrrcDataReqMsg->enEmmMsgType       = NAS_EMM_MSG_EXTENDED_SERVICE_REQ;

    pMrrcDataReqMsg->enDataCnf          = LRRC_LMM_DATA_CNF_NEED;

    /*空口消息上报SER REQ*/
    NAS_LMM_SendOmtAirMsg(NAS_EMM_OMT_AIR_MSG_UP, NAS_EMM_EXTENDED_SER_REQ,  (NAS_MSG_STRU*)&(pMrrcDataReqMsg->stNasMsg));

    /*关键事件上报SER REQ*/
    NAS_LMM_SendOmtKeyEvent(            EMM_OMT_KE_EXTENDED_SER_REQ);

    /* 发送消息(Send the msg of) MRRC_DATA_REQ(SER_REQ) */
    NAS_EMM_SndUplinkNasMsg(             pMrrcDataReqMsg);

    NAS_LMM_MEM_FREE(pMrrcDataReqMsg);

    return;
}
VOS_UINT32    NAS_EMM_MsSerInitSsWtCnSerCnfMsgAppAttachReq( VOS_UINT32  ulMsgId,
                                                         VOS_VOID   *pMsgStru )
{
    MMC_LMM_ATTACH_REQ_STRU              *pRcvEmmMsg;

    (VOS_VOID)ulMsgId;

    pRcvEmmMsg                          = (MMC_LMM_ATTACH_REQ_STRU *)pMsgStru;


    /*打印进入该函数*/
    NAS_EMM_ATTACH_LOG_NORM("NAS_EMM_MsSerInitSsWtCnSerCnfMsgAppAttachReq is entered");

    /*检查状态是否匹配,若不匹配,退出*/
    if (NAS_EMM_AD_CHK_STAT_INVALID(EMM_MS_SER_INIT,EMM_SS_SER_WAIT_CN_SER_CNF))
    {
        /*打印出错信息*/
         NAS_EMM_ATTACH_LOG_WARN("NAS_EMM_MsSerInitSsWtCnSerCnfMsgAppAttachReq: STATE ERR!");
        return  NAS_LMM_MSG_DISCARD;
    }

    /*消息内容检查,若有错,打印并退出*/
    if (NAS_EMM_PARA_INVALID == NAS_EMM_AppAttachReqMsgChk(pRcvEmmMsg))
    {
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_MsSerInitSsWtCnSerCnfMsgAppAttachReq: MMC_LMM_ATTACH_REQ_STRU PARA ERR!");
        return  NAS_LMM_ERR_CODE_PARA_INVALID;

    }

    /*保存APP参数*/
    NAS_EMM_SaveAppMsgPara(pRcvEmmMsg->ulMsgId,pRcvEmmMsg->ulOpId);

    if(MMC_LMM_ATT_REQ_TYPE_PS_ONLY == pRcvEmmMsg->ulAttachType)
    {
        /*向MMC发送ATTACH成功*/
        NAS_EMM_MmcSendAttCnf(MMC_LMM_ATT_RSLT_SUCCESS);
        return NAS_LMM_MSG_HANDLED;
    }

    /*请求类型是IMSI或者CS_ps,操作模式是PS*/
    if(NAS_EMM_NO == NAS_EMM_IsCsPsUeMode())
    {
        NAS_EMM_MmcSendAttCnf(MMC_LMM_ATT_RSLT_FAILURE);
        return NAS_LMM_MSG_HANDLED;
    }

    /*请求类型是IMSI或者CS_ps操作模式是CS_PS,注册域为CS_PS*/
    if (NAS_LMM_REG_DOMAIN_CS_PS == NAS_LMM_GetEmmInfoRegDomain())
    {
        NAS_EMM_MmcSendAttCnf(MMC_LMM_ATT_RSLT_SUCCESS);
        return NAS_LMM_MSG_HANDLED;
    }
    /*请求类型是IMSI或者CS_ps操作模式是CS_PS,注册域为PS*/
    if(NAS_LMM_REG_DOMAIN_PS == NAS_LMM_GetEmmInfoRegDomain())
    {
        /* 发起TAU,打断SERVICE */
        /*停止T3417定时器*/
        NAS_LMM_StopStateTimer(TI_NAS_EMM_STATE_SERVICE_T3417);

        /*Inform RABM that SER fail*/
        NAS_EMM_SER_SendRabmReestInd(EMM_ERABM_REEST_STATE_FAIL);

        /*结束SER流程*/
        /* NAS_EMM_SER_AbnormalOver();*/

        /*设置流程冲突标志位*/
        NAS_EMM_TAU_SaveEmmCollisionCtrl(NAS_EMM_COLLISION_SERVICE);

        /*NAS_EMM_TAU_SaveEmmTAUStartCause(NAS_EMM_TAU_START_CAUSE_IMSI_ATTACH);*/
        NAS_EMM_TAU_SaveEmmTAUStartCause(NAS_EMM_TAU_START_CAUSE_OTHERS);

        /*启动TAU Procedure*/
        NAS_EMM_TAU_StartTAUREQ();

        return NAS_LMM_MSG_HANDLED;
    }

    return  NAS_LMM_MSG_HANDLED;
}
VOS_UINT32    NAS_EMM_MsTauInitSsWtCnTauCnfMsgAppAttachReq(VOS_UINT32  ulMsgId,
                                                    VOS_VOID   *pMsgStru )
{
    MMC_LMM_ATTACH_REQ_STRU              *pRcvEmmMsg;

    (VOS_VOID)ulMsgId;

    pRcvEmmMsg                          = (MMC_LMM_ATTACH_REQ_STRU *)pMsgStru;


    /*打印进入该函数*/
    NAS_EMM_ATTACH_LOG_NORM("NAS_EMM_MsTauInitSsWtCnTauCnfMsgAppAttachReq is entered");

    /*检查状态是否匹配,若不匹配,退出*/
    if (NAS_EMM_AD_CHK_STAT_INVALID(EMM_MS_TAU_INIT,EMM_SS_TAU_WAIT_CN_TAU_CNF))
    {
        /*打印出错信息*/
         NAS_EMM_ATTACH_LOG_WARN("NAS_EMM_MsDrgSsPlmnSrcMsgAppAttachReq: STATE ERR!");
        return  NAS_LMM_MSG_DISCARD;
    }

    /*消息内容检查,若有错,打印并退出*/
    if (NAS_EMM_PARA_INVALID == NAS_EMM_AppAttachReqMsgChk(pRcvEmmMsg))
    {
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_MsTauInitSsWtCnTauCnfMsgAppAttachReq: MMC_LMM_ATTACH_REQ_STRU PARA ERR!");
        return  NAS_LMM_ERR_CODE_PARA_INVALID;

    }


    /*保存APP参数*/
    NAS_EMM_SaveAppMsgPara(pRcvEmmMsg->ulMsgId,pRcvEmmMsg->ulOpId);

    if(MMC_LMM_ATT_REQ_TYPE_PS_ONLY == pRcvEmmMsg->ulAttachType)
    {
        /*向MMC发送ATTACH成功*/
        NAS_EMM_MmcSendAttCnf(MMC_LMM_ATT_RSLT_SUCCESS);
        return NAS_LMM_MSG_HANDLED;
    }

    /*操作模式是PS*/
    if(NAS_EMM_NO == NAS_EMM_IsCsPsUeMode())
    {
        NAS_EMM_MmcSendAttCnf(MMC_LMM_ATT_RSLT_FAILURE);
        return NAS_LMM_MSG_HANDLED;
    }
    /*操作模式是CS_PS*/
    /*注册域为CS_PS*/
    if (NAS_LMM_REG_DOMAIN_CS_PS == NAS_LMM_GetEmmInfoRegDomain())
    {
        NAS_EMM_MmcSendAttCnf(MMC_LMM_ATT_RSLT_SUCCESS);
        return NAS_LMM_MSG_HANDLED;
    }
    /*注册域为PS*/
    if(NAS_LMM_REG_DOMAIN_PS == NAS_LMM_GetEmmInfoRegDomain())
    {
        return NAS_LMM_STORE_LOW_PRIO_MSG;
    }

    return  NAS_LMM_MSG_HANDLED;
}