VOS_INT32 NAS_ERABM_PrintRabmRrcMsg ( VOS_CHAR *pcBuff, VOS_UINT16 usOffset, const PS_MSG_HEADER_STRU *pstMsg ) { VOS_UINT32 ulLoop; VOS_UINT32 ulRabmRrcMsgNum; VOS_INT32 ilOutPutLen = 0; VOS_UINT16 usTotalLen = usOffset; /* 获得消息表的长度 */ ulRabmRrcMsgNum = sizeof(g_astERabmRrcMsgIdArray)/sizeof(NAS_COMM_PRINT_LIST_STRU); /* 查找对应的消息 */ for (ulLoop = 0; ulLoop< ulRabmRrcMsgNum ; ulLoop++) { if (pstMsg->ulMsgName == g_astERabmRrcMsgIdArray[ulLoop].ulId) { break; } } /* 打印对应的消息 */ if ( ulLoop < ulRabmRrcMsgNum ) { NAS_COMM_nsprintf(pcBuff, usOffset, (VOS_CHAR *)(g_astERabmRrcMsgIdArray[ulLoop].aucPrintString), &ilOutPutLen); usTotalLen += (VOS_UINT16)ilOutPutLen; NAS_COMM_nsprintf_1(pcBuff, usTotalLen, "[ TICK : %ld ]", PS_GET_TICK(), &ilOutPutLen); usTotalLen += (VOS_UINT16)ilOutPutLen; if (VOS_NULL_PTR != g_astERabmRrcMsgIdArray[ulLoop].pfActionFun) { ilOutPutLen = g_astERabmRrcMsgIdArray[ulLoop].pfActionFun(pcBuff, usTotalLen, pstMsg); } usTotalLen += (VOS_UINT16)ilOutPutLen; } else { NAS_ERABM_LOG1("NAS_ERABM_PrintRabmRrcMsg, Invalid enMsgId: ",pstMsg->ulMsgName); } return (usTotalLen - usOffset); }
/*lint -e961*/ VOS_VOID NAS_ERABM_TaskEntry( MsgBlock* pMsg ) { PS_MSG_HEADER_STRU *pHeader = VOS_NULL_PTR; /*定义消息头指针*/ /* 判断入口参数是否合法*/ if (VOS_NULL_PTR == pMsg) { /*报告错误消息*/ NAS_ERABM_WARN_LOG("NAS_ERABM_TaskEntry:ERROR: No Msg!"); return; } pHeader = (PS_MSG_HEADER_STRU *)pMsg; /* 获取消息头指针*/ NAS_ERABM_PrintRabmRevMsg(pHeader,NAS_COMM_GET_ESM_PRINT_BUF()); /*判断接收到的消息,进行分发处理*/ switch (pHeader->ulSenderPid) { /*如果是SM消息,调用SM分发函数*/ case PS_PID_ESM: NAS_ERABM_EsmMsgDistr(pMsg); break; /*如果是EMM消息,调用EMM分发函数*/ case PS_PID_MM: NAS_ERABM_EmmMsgDistr(pMsg); break; /*如果是RRC消息,调用RRC分发函数*/ case PS_PID_ERRC: NAS_ERABM_RrcMsgDistr(pMsg); break; /*如果是Timer消息,调用Timer溢出分发函数*/ case VOS_PID_TIMER: NAS_ERABM_TimerMsgDistr(pMsg); break; /*如果是APP消息,调用APP分发函数*/ case PS_PID_APP: NAS_ERABM_AppMsgDistr(pMsg); break; case PS_PID_TC: NAS_ERABM_TcMsgDistr(pMsg); break; case UEPS_PID_CDS: NAS_ERABM_CdsMsgDistr(pMsg); break; /*发送对象错误,报警*/ default: NAS_ERABM_LOG1("NAS_ERABM_TaskEntry:NORM: Error SenderPid :",(VOS_INT32)pHeader->ulSenderPid); break; } }
VOS_INT32 NAS_ERABM_PrintRabmCdsMsg ( VOS_CHAR *pcBuff, VOS_UINT16 usOffset, CDS_ERABM_MSG_ID_ENUM_UINT32 enMsgId ) { VOS_UINT32 ulLoop; VOS_UINT32 ulRabmAppMsgNum; VOS_INT32 ilOutPutLen = 0; VOS_UINT16 usTotalLen = usOffset; /* 获得消息表的长度 */ ulRabmAppMsgNum = sizeof(g_astERabmCdsMsgIdArray)/sizeof(NAS_COMM_PRINT_MSG_LIST_STRU); /* 查找对应的消息 */ for (ulLoop = 0; ulLoop< ulRabmAppMsgNum ; ulLoop++) { if (enMsgId == g_astERabmCdsMsgIdArray[ulLoop].ulId) { break; } } /* 打印对应的消息 */ if ( ulLoop < ulRabmAppMsgNum ) { NAS_COMM_nsprintf(pcBuff, usTotalLen, (VOS_CHAR *)(g_astERabmCdsMsgIdArray[ulLoop].aucPrintString), &ilOutPutLen); usTotalLen += (VOS_UINT16)ilOutPutLen; NAS_COMM_nsprintf_1(pcBuff, usTotalLen, "[ TICK : %ld ]", PS_GET_TICK(), &ilOutPutLen); usTotalLen += (VOS_UINT16)ilOutPutLen; } else { NAS_ERABM_LOG1("NAS_ERABM_PrintRabmCdsMsg, Invalid enMsgId: ",enMsgId); } return (usTotalLen - usOffset); }
VOS_INT32 NAS_ERABM_PrintRabmTimer ( VOS_CHAR *pcBuff, VOS_UINT16 usOffset, VOS_UINT32 ulTimerType ) { VOS_UINT32 ulRabmTimerNum; VOS_INT32 ilOutPutLen = 0; VOS_UINT16 usTotalLen = usOffset; /* 获得消息表的长度 */ ulRabmTimerNum = sizeof(g_astERabmStateTimerArray)/sizeof(NAS_COMM_PRINT_MSG_LIST_STRU); /* 打印对应的消息 */ if ( ulTimerType < ulRabmTimerNum ) { NAS_COMM_nsprintf(pcBuff, usTotalLen, (VOS_CHAR *)(g_astERabmStateTimerArray[ulTimerType].aucPrintString), &ilOutPutLen); usTotalLen += (VOS_UINT16)ilOutPutLen; NAS_COMM_nsprintf_1(pcBuff, usTotalLen, "[ TICK : %ld ]", PS_GET_TICK(), &ilOutPutLen); usTotalLen += (VOS_UINT16)ilOutPutLen; } else { NAS_ERABM_LOG1("NAS_ERABM_PrintRabmTimer, Invalid enMsgId: ",ulTimerType); } return (usTotalLen - usOffset); }
VOS_VOID NAS_ERABM_TimerStart ( VOS_UINT32 ulTimerLen, NAS_ERABM_TIMER_NAME_ENUM_UINT8 enTimerName, VOS_UINT32 ulTimerPara ) { NAS_ERABM_START_TIMER_STRU *pstTimerInfo = VOS_NULL_PTR; /*打印进入该函数*/ NAS_ERABM_INFO_LOG("NAS_ERABM_TimerStart is entered."); /*获取RABM实体中的定时器结构地址指针*/ pstTimerInfo = NAS_ERABM_GetRbTimer(enTimerName); if ( VOS_NULL_PTR == pstTimerInfo ) { NAS_ERABM_WARN_LOG("NAS_ERABM_TimerStart: pstStateTimer NULL."); return ; } /*判断定时器是否打开,打开则关闭*/ if (VOS_NULL_PTR != pstTimerInfo->stHTimer) { if (VOS_OK != PS_STOP_REL_TIMER(&(pstTimerInfo->stHTimer))) { NAS_ERABM_ERR_LOG("NAS_ERABM_TimerStart: start reltimer error1 "); return; } NAS_ERABM_LOG1("(TimerType) Timer not close!", (VOS_INT32)enTimerName); } if(NAS_ERABM_NULL == ulTimerLen) { NAS_ERABM_WARN_LOG("NAS_ERABM_TimerStart:WARN: TimerLen = 0"); return; } /* lihong00150010 emergency tau&service begin */ /*设定定时器LENGTH和NAME,打开失败则报警返回*/ if (VOS_OK != PS_START_REL_TIMER(&(pstTimerInfo->stHTimer),PS_PID_RABM, ulTimerLen,(VOS_UINT32)enTimerName, ulTimerPara, VOS_RELTIMER_NOLOOP)) { NAS_ERABM_WARN_LOG("NAS_ERABM_TimerStart:WARN: start reltimer error2"); return; } /* lihong00150010 emergency tau&service end */ /*钩出当前的定时器信息 */ NAS_ERABM_SndOmErabmTimerStatus(NAS_ERABM_TIMER_RUNNING, enTimerName, ulTimerLen); /*更新定时器开启信息和定时器类别*/ pstTimerInfo->enName = enTimerName; /*根据定时器的不同类型,打印相应信息*/ switch (enTimerName) { case NAS_ERABM_WAIT_EPSB_ACT_TIMER: NAS_ERABM_NORM_LOG("NAS_ERABM_TimerStart:NORM:RABM TimerStart: NAS_ERABM_RB_WAIT_EPSB_ACT_TIMER"); break; case NAS_ERABM_WAIT_RB_REEST_TIMER: NAS_ERABM_NORM_LOG("NAS_ERABM_TimerStart:NORM:RABM TimerStart: NAS_ERABM_WAIT_RB_REEST_TIMER"); break; case NAS_ERABM_WAIT_RB_RESUME_TIMER: NAS_ERABM_NORM_LOG("NAS_ERABM_TimerStart:NORM:RABM TimerStart: NAS_ERABM_WAIT_RB_RESUME_TIMER"); break; case NAS_ERABM_WAIT_TC_FREE_BUFFER_TIMER: NAS_ERABM_NORM_LOG("NAS_ERABM_TimerStart:NORM:RABM TimerStart: NAS_ERABM_WAIT_TC_FREE_BUFFER_TIMER"); break; default: NAS_ERABM_ERR_LOG("NAS_ERABM_TimerStart:ERROR: start unreasonable reltimer."); break; } }
CDS_ERABM_TRANSFER_RESULT_ENUM_UINT32 CDS_ERABM_GetDrbId ( VOS_UINT8 ucEpsbId, VOS_UINT8 *pucDrbId ) { /* 上行收到数据包增加统计 */ NAS_ERABM_AddUlReceivePackageNum(); /* 输入参数合法性检测 */ if (VOS_NULL_PTR == pucDrbId) { NAS_ERABM_ERR_LOG("CDS_ERABM_GetDrbId:pucDrbId is NULL!"); /* 上行丢弃数据包增加统计 */ NAS_ERABM_AddUlDiscardPackageNum(); return PS_FAIL; } if ((ucEpsbId < NAS_ERABM_MIN_EPSB_ID) || (ucEpsbId > NAS_ERABM_MAX_EPSB_ID)) { NAS_ERABM_ERR_LOG("CDS_ERABM_GetDrbId:EpsbId is illegal!"); /* 上行丢弃数据包增加统计 */ NAS_ERABM_AddUlDiscardPackageNum(); return CDS_ERABM_TRANSFER_RESULT_FAIL; } if (NAS_ERABM_RB_CONNECTED == NAS_ERABM_GetRbStateInfo(ucEpsbId)) { *pucDrbId = (VOS_UINT8)NAS_ERABM_GetEpsbRbIdInfo(ucEpsbId); /* 增加上行发送总数据包数 */ NAS_ERABM_AddUlSendPackageNum(); /* 增加承载上行发送总数据包数 */ NAS_ERABM_AddBearerSendPackageNum((VOS_UINT32)ucEpsbId); return CDS_ERABM_TRANSFER_RESULT_SUCC; } else if(NAS_ERABM_RB_SUSPENDED == NAS_ERABM_GetRbStateInfo(ucEpsbId)) { /* 设置上行数据阻塞标志*/ NAS_ERABM_SetUpDataPending(EMM_ERABM_UP_DATA_PENDING); NAS_ERABM_LOG1("CDS_ERABM_GetDrbId:DRB_SUSPENDED, set data pending = ",NAS_ERABM_GetUpDataPending()); *pucDrbId = (VOS_UINT8)NAS_ERABM_GetEpsbRbIdInfo(ucEpsbId); /* 增加上行Suspend总数据包数 */ NAS_ERABM_AddUlSuspendPackageNum(); /* 增加承载上行Suspend总数据包数 */ NAS_ERABM_AddBearerSuspendPackageNum((VOS_UINT32)ucEpsbId); return CDS_ERABM_TRANSFER_RESULT_DRB_SUSPEND; } else { /* 判断是否处于连接态 */ if (NAS_ERABM_SUCCESS == NAS_ERABM_IsAllActtiveBearerWithoutDrb()) { /* 设置上行数据阻塞标志*/ NAS_ERABM_SetUpDataPending(EMM_ERABM_UP_DATA_PENDING); NAS_ERABM_LOG1("CDS_ERABM_GetDrbId:AllActtiveBearerWithoutDrb, set data pending = ",NAS_ERABM_GetUpDataPending()); /* 增加上行IDLE总数据包数 */ NAS_ERABM_AddUlIdlePackageNum(); /* 增加承载上行IDLE总数据包数 */ NAS_ERABM_AddBearerIdlePackageNum((VOS_UINT32)ucEpsbId); return CDS_ERABM_TRANSFER_RESULT_IDLE; } /* 对于当前处于连接态,但承载对应的DRB不存在这种暂态,暂时先返回 CDS_ERABM_TRANSFER_RESULT_FAIL,由CDS释放内存,后续优化时再返回 CDS_ERABM_TRANSFER_RESULT_DRB_NOT_EXIST,由CDS负责缓存数据包。*/ /* 上行丢弃数据包增加统计 */ NAS_ERABM_AddUlDiscardPackageNum(); /* 承载上行丢弃数据包增加统计 */ NAS_ERABM_AddBearerDiscardPackageNum((VOS_UINT32)ucEpsbId); return APP_ERABM_TRANSFER_RESULT_FAIL; } }
/*lint -e961*/ VOS_VOID NAS_ERABM_RcvRabmEmmReestInd(const EMM_ERABM_REEST_IND_STRU *pRcvMsg ) { if (NAS_ERABM_L_MODE_STATUS_NORMAL != NAS_ERABM_GetLModeStatus()) { NAS_ERABM_WARN_LOG("NAS_ERABM_RcvRabmEmmReestInd:Rabm is already suspended!"); return ; } switch(pRcvMsg->enReEstState) { /*case EMM_ERABM_REEST_STATE_SUCC:*/ case EMM_ERABM_REEST_STATE_FAIL: /*打印进入该函数*/ NAS_ERABM_LOG1("NAS_ERABM_RcvRabmEmmReestInd: receive Emm Reset result: .", pRcvMsg->enReEstState); /*SERVICE流程结束*,停止定时器*/ NAS_ERABM_TimerStop(NAS_ERABM_WAIT_RB_REEST_TIMER); NAS_ERABM_SetEmmSrState(NAS_ERABM_SERVICE_STATE_TERMIN); /* 如果在正常模式下 */ if (NAS_ERABM_MODE_TYPE_NORMAL == NAS_ERABM_GetMode()) { /* 通知L2释放缓存的数据包 */ /*APPITF_FreeAllofRabmBuf();*/ /* 通知CDS释放缓存的数据包 */ NAS_ERABM_SndErabmCdsFreeBuffDataInd(); /* 清除上行数据阻塞标志*/ NAS_ERABM_SetUpDataPending(EMM_ERABM_NO_UP_DATA_PENDING); } else if (NAS_ERABM_TIMER_STATE_STOPED == NAS_ERABM_IsTimerRunning(NAS_ERABM_WAIT_TC_FREE_BUFFER_TIMER)) /*环回模式下不清理缓存,保持原上行数据Pending状态*/ { NAS_ERABM_INFO_LOG("NAS_ERABM_RcvRabmEmmReestInd: NAS_ERABM_WAIT_TC_FREE_BUFFER_TIMER start."); /* lihong00150010 emergency tau&service begin */ NAS_ERABM_TimerStart( NAS_ERABM_WAIT_TC_FREE_BUFFER_LENGTH, NAS_ERABM_WAIT_TC_FREE_BUFFER_TIMER, NAS_ERABM_WAIT_TC_FREE_BUFFER_TIMER); } /* lihong00150010 emergency tau&service end */ else { NAS_ERABM_INFO_LOG("NAS_ERABM_RcvRabmEmmReestInd: NAS_ERABM_WAIT_TC_FREE_BUFFER_TIMER is running."); } break; case EMM_ERABM_REEST_STATE_INITIATE: /*打印进入该函数*/ NAS_ERABM_INFO_LOG("NAS_ERABM_RcvRabmEmmReestInd: receive EMM_ERABM_REEST_STATE_INITIATE ."); /*SERVICE流程启动,启动定时器*/ if (NAS_ERABM_SERVICE_STATE_TERMIN == NAS_ERABM_GetEmmSrState()) {/* lihong00150010 emergency tau&service begin */ NAS_ERABM_TimerStart( NAS_ERABM_WAIT_RB_REEST_LENGTH, NAS_ERABM_WAIT_RB_REEST_TIMER, VOS_FALSE); NAS_ERABM_SetEmmSrState(NAS_ERABM_SERVICE_STATE_INIT); }/* lihong00150010 emergency tau&service end */ break; default: NAS_ERABM_WARN_LOG("NAS_ERABM_RcvRabmEmmReestInd:WARNNING: EstState illegal!"); break; } }