Esempio n. 1
0
VOS_VOID NAS_ESM_ClearEsmResoureWhenEstingEmcPdn(VOS_VOID)
{
    VOS_UINT32 ulCnt = 0;

    NAS_ESM_INFO_LOG("NAS_ESM_ClearEsmResoureWhenEstingEmcPdn: enter");


    /*设置ESM状态为正在注册*/
    NAS_ESM_SetEmmStatus(NAS_ESM_PS_REGISTER_STATUS_ATTACHING);

    /* 如果支持双APN,则停止对应定时器,并设置注册承载无效 */
    if (NAS_ESM_OP_TRUE == NAS_ESM_AttachBearerReestEnable())
    {
        NAS_ESM_TimerStop(0, TI_NAS_ESM_ATTACH_BEARER_REEST);
        NAS_ESM_SetAttachBearerId(NAS_ESM_UNASSIGNED_EPSB_ID);
    }

    /* 本地去激活除紧急之外的所有承载 */
    for( ulCnt = NAS_ESM_MIN_EPSB_ID; ulCnt <= NAS_ESM_MAX_EPSB_ID; ulCnt++ )
    {
        /*
         * 如果是激活的非紧急默认承载,则去激活;
         * 如果是非激活的默认承载或紧急的默认承载,不需要去激活,跳过
         * 如果是专有承载,则在NAS_ESM_DeactBearerAndInformApp中进行去激活
         */
        if ((NAS_ESM_BEARER_TYPE_DEFAULT == NAS_ESM_GetBearCntxtType(ulCnt)) &&
                (NAS_ESM_BEARER_STATE_ACTIVE == NAS_ESM_GetBearCntxtState(ulCnt)))
        {
            NAS_ESM_DeactBearerAndInformApp(ulCnt);
        }
    }

    /* 初始化PDN连接的个数 */
    NAS_ESM_SetCurPdnNum(NAS_ESM_NULL);

    /* 通知RABM清除资源 */
    NAS_ESM_SndEsmRabmRelIndMsg();

    /*清除动态表,紧急相关除外*/
    NAS_ESM_ClearStateTable(APP_ERR_SM_NON_EMERGENCY_NOT_ALLOWED, PS_TRUE);

    /* 初始化发送空口消息的结构体 */
    NAS_ESM_ClearEsmSndNwMsgAddr();

    /* 清除ESM缓存区 */
    NAS_ESM_ClearEsmBuff();
}
VOS_VOID  NAS_ESM_ProcValidNwMsgResAllocRej
(
    VOS_UINT32                          ulStateTblIndex,
    const EMM_ESM_INTRA_DATA_IND_STRU  *pRcvMsg
)
{
    NAS_ESM_STATE_INFO_STRU            *pstStateAddr       = VOS_NULL_PTR;
    VOS_UINT32                          ulTmpStateTblIndex =  NAS_ESM_NULL;

    /*打印进入该函数*/
    NAS_ESM_NORM_LOG("NAS_ESM_ProcValidNwMsgResAllocRej is entered.");
    TLPS_PRINT2LAYER_INFO(NAS_ESM_ProcValidNwMsgResAllocRej_ENUM, LNAS_ENTRY);

    /*停止定时器*/
    NAS_ESM_TimerStop(ulStateTblIndex, TI_NAS_ESM_T3480);

    pstStateAddr = NAS_ESM_GetStateTblAddr(ulStateTblIndex);

    if(ID_APP_ESM_PDP_SETUP_REQ == pstStateAddr->stAppMsgRecord.enAppMsgType )
    {
        if( NAS_ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY == pRcvMsg->stEsmNwMsgIE.enEsmCau )
        {
            /* 本地释放此承载的关联缺省承载和相关承载 */
            NAS_ESM_DeactBearerAndInformApp(pstStateAddr->ulLinkedEpsbId);

            /*通知EMM当前承载状态信息,发送ID_EMM_ESM_BEARER_STATUS_REQ*/
            NAS_ESM_SndEsmEmmBearerStatusReqMsg(EMM_ESM_BEARER_CNTXT_MOD_MUTUAL);

            /*清除和中止与ulEpsbId关联的流程信息*/
            if(NAS_ESM_SUCCESS == NAS_ESM_QueryStateTblIndexByEpsbId(pstStateAddr->ulLinkedEpsbId, &ulTmpStateTblIndex))
            {
                NAS_ESM_RelStateTblResource(ulTmpStateTblIndex);
            }
        }
        /*向APP发送ID_APP_ESM_BEARER_SETUP_CNF(失败)消息*/
        NAS_ESM_SndEsmAppSdfSetupCnfFailMsg(ulStateTblIndex, \
                 NAS_ESM_GetAppErrorByEsmCause(pRcvMsg->stEsmNwMsgIE.enEsmCau));
    }

    /*释放状态表资源*/
    NAS_ESM_RelStateTblResource(ulStateTblIndex);
}
VOS_VOID    NAS_ESM_ProcTimerMsgT3481Exp(const VOS_VOID * pMsg)
{
    VOS_UINT32                          ulStateTblIndex     = NAS_ESM_NULL;
    VOS_UINT32                          ulErrorCode         = APP_ERR_TIME_OUT;
    VOS_UINT32                          ulActCidNum         = NAS_ESM_NULL;
    NAS_ESM_TIMER_STRU                 *pTimer3481          = VOS_NULL_PTR;
    NAS_ESM_STATE_INFO_STRU            *pstStateAddr        = VOS_NULL_PTR;

    /*打印进入该函数*/
    NAS_ESM_NORM_LOG("NAS_ESM_ProcTimerMsgT3481Exp is entered.");

    /*获取消息中包含的状态表StateTblIndex*/
    ulStateTblIndex = PS_GET_REL_TIMER_NAME(pMsg);
    pstStateAddr = NAS_ESM_GetStateTblAddr(ulStateTblIndex);

    if (NAS_ESM_L_MODE_STATUS_NORMAL != NAS_ESM_GetLModeStatus())
    {
        NAS_ESM_WARN_LOG("NAS_ESM_ProcTimerMsgT3481Exp: L mode is already suspended!");

        /*释放状态表资源*/
        NAS_ESM_RelStateTblResource(ulStateTblIndex);

        return ;
    }

    /*根据消息对应的ulStateTblIndex,获取相关联的定时器*/
    pTimer3481 = NAS_ESM_GetStateTblTimer(ulStateTblIndex);

    /*超时次数++*/
    pTimer3481->ucExpireTimes++;

    /*如果当前定时器超时次数小于NAS_ESM_MAX_TIMER_EXPIRE_TIMES次*/
    if(pTimer3481->ucExpireTimes < TI_NAS_ESM_T3481_TIMER_MAX_EXP_NUM)
    {
        /*调用函数:SM向MM发送消息:NAS_ESMCN_BEARER_RES_MOD_REQ*/
        NAS_ESM_SndEsmEmmDataReqMsg(pstStateAddr->stNwMsgRecord.ulOpId,
                                    pstStateAddr->stNwMsgRecord.ucIsEmcPdnReq,
                                    pstStateAddr->stNwMsgRecord.ulMsgLength,
                                    pstStateAddr->stNwMsgRecord.aucMsgBuff);

        /*重新启动定时器*/
        NAS_ESM_TimerStart(ulStateTblIndex,TI_NAS_ESM_T3481);

        /*上报空口消息*/
        NAS_ESM_SndAirMsgReportInd(pstStateAddr->stNwMsgRecord.aucMsgBuff,
                                   pstStateAddr->stNwMsgRecord.ulMsgLength,
                                   NAS_ESM_AIR_MSG_DIR_ENUM_UP,
                                   ESM_BEARER_RESOUCE_MOD_REQ);
        return;

    }

    if(ID_APP_ESM_PDP_SETUP_REQ == NAS_ESM_GetStateTblAppMsgType(ulStateTblIndex) )
    {
        /*调用函数:发送确认消息通知APP,本次承载资源分配过程失败*/
        NAS_ESM_SndEsmAppSdfSetupCnfFailMsg(ulStateTblIndex, ulErrorCode);
    }
    else  if(ID_APP_ESM_PDP_RELEASE_REQ == NAS_ESM_GetStateTblAppMsgType(ulStateTblIndex) )
    {
        ulActCidNum = NAS_ESM_GetBearerLinkedCidNum(pstStateAddr->ulEpsbId);

        /* 如果只对应一个激活的Cid,说明App要释放所有的SDF */
        if (ulActCidNum == NAS_ESM_BEARER_ACT_CID_NUM_ONE)
        {
            /* 本地释放此承载 */
            NAS_ESM_DeactBearerAndInformApp(pstStateAddr->ulEpsbId);

            /*通知EMM当前承载状态信息,发送ID_EMM_ESM_BEARER_STATUS_REQ*/
            NAS_ESM_SndEsmEmmBearerStatusReqMsg(EMM_ESM_BEARER_CNTXT_MOD_LOCAL);
        }
        else
        {
            NAS_ESM_SndEsmAppSdfModCnfFailMsg(ulStateTblIndex, ulErrorCode);
        }
    }
    else
    {
        NAS_ESM_SndEsmAppSdfModCnfFailMsg(ulStateTblIndex, ulErrorCode);
    }

    /*释放状态表资源*/
    NAS_ESM_RelStateTblResource(ulStateTblIndex);
}
VOS_VOID    NAS_ESM_ProcTimerMsgT3492Exp(const VOS_VOID * pMsg)
{
    VOS_UINT32                          ulStateTblIndex  = NAS_ESM_NULL;
    NAS_ESM_TIMER_STRU                 *pTimer3492       = VOS_NULL_PTR;
    NAS_ESM_STATE_INFO_STRU            *pstStateAddr        = VOS_NULL_PTR;

    /*打印进入该函数*/
    NAS_ESM_NORM_LOG("NAS_ESM_ProcTimerMsgT3492Exp is entered.");

    /*获取消息中包含的状态表StateTblIndex*/
    ulStateTblIndex = PS_GET_REL_TIMER_NAME(pMsg);
    pstStateAddr = NAS_ESM_GetStateTblAddr(ulStateTblIndex);

    if (NAS_ESM_L_MODE_STATUS_NORMAL != NAS_ESM_GetLModeStatus())
    {
        NAS_ESM_WARN_LOG("NAS_ESM_ProcTimerMsgT3492Exp: L mode is already suspended!");

        /*释放状态表资源*/
        NAS_ESM_RelStateTblResource(ulStateTblIndex);

        return ;
    }

    /*根据消息对应的ulStateTblIndex,获取相关联的定时器*/
    pTimer3492 = NAS_ESM_GetStateTblTimer(ulStateTblIndex);

    /*超时次数++*/
    pTimer3492->ucExpireTimes++;

    /*如果当前定时器超时次数小于NAS_ESM_MAX_TIMER_EXPIRE_TIMES次*/
    if(pTimer3492->ucExpireTimes < TI_NAS_ESM_T3492_TIMER_MAX_EXP_NUM)
    {
        /*调用函数:SM向MM发送消息:NAS_ESMCN_PDN_DISCONNECT_REQ*/
        NAS_ESM_SndEsmEmmDataReqMsg(pstStateAddr->stNwMsgRecord.ulOpId,
                                    pstStateAddr->stNwMsgRecord.ucIsEmcPdnReq,
                                    pstStateAddr->stNwMsgRecord.ulMsgLength,
                                    pstStateAddr->stNwMsgRecord.aucMsgBuff);

        /*重新启动定时器*/
        NAS_ESM_TimerStart(ulStateTblIndex,TI_NAS_ESM_T3492);

        /*上报空口消息*/
        NAS_ESM_SndAirMsgReportInd(pstStateAddr->stNwMsgRecord.aucMsgBuff,
                                   pstStateAddr->stNwMsgRecord.ulMsgLength,
                                   NAS_ESM_AIR_MSG_DIR_ENUM_UP,
                                   ESM_PDN_DISCONNECT_REQ);
        return;

    }
    else
    {
        NAS_ESM_WARN_LOG("NAS_ESM_DefltAttingBInactPPendMsgT3492Exp:WARNING:ExpireTimes exceed!");

        /*本地释放缺省承载资源,向APP回复释放成功消息*/
        NAS_ESM_DeactBearerAndInformApp(pstStateAddr->ulEpsbId);

        /*通知EMM当前承载状态信息,发送ID_EMM_ESM_BEARER_STATUS_REQ*/
        NAS_ESM_SndEsmEmmBearerStatusReqMsg(EMM_ESM_BEARER_CNTXT_MOD_LOCAL);
    }

    /*释放状态表资源*/
    NAS_ESM_RelStateTblResource(ulStateTblIndex);
}