VOS_VOID BST_SYS_MsgProcEntry( MsgBlock  *pstMsg )
{
    if(BST_FALSE == BST_SYS_ApiGetSupported())
    {
        BST_DBG_LOG("BST_SYS_MsgProcEntry: bastet nv disabled");
        return;
    }
    
    switch(pstMsg->ulSenderPid)
    {
        case WUEPS_PID_USIM:
            break;

        case VOS_PID_TIMER:
            BST_DBG_LOG("BST_SYS_MsgProcEntry: VOS_PID_TIMER");
            BST_OS_PalTimerCallBack();
            break;

        case ACPU_PID_BASTET_COMM:
            BST_DBG_LOG("BST_SYS_MsgProcEntry: ACPU_PID_BASTET_COMM");
            BST_Pal_DrvAcomRecv( ( BST_UINT32 ) BST_OS_SIZEOF( BST_ACOM_MSG_STRU ),
                                 ( BST_UINT8 *) pstMsg );
            break;

        case UEPS_PID_CDS:
            BST_DBG_LOG("BST_SYS_MsgProcEntry: UEPS_PID_CDS");
            OM_TraceMsgHook(pstMsg);
            BST_PAL_NetMsgEntry( pstMsg );
            break;
        case I0_WUEPS_PID_MMA:
            OM_TraceMsgHook(pstMsg);
            BST_MSG_ProcMmaRecv(pstMsg,BST_MODEM_ID_1);
            break;
        case I1_WUEPS_PID_MMA:
            OM_TraceMsgHook(pstMsg);
            BST_MSG_ProcMmaRecv(pstMsg,BST_MODEM_ID_2);
            break;
        case WUEPS_PID_WRR:
            OM_TraceMsgHook(pstMsg);
            BST_MSG_ProcWrrcRecv(pstMsg);
            break;
        case TPS_PID_RRC:
            OM_TraceMsgHook(pstMsg);
            BST_MSG_ProcTrrcRecv(pstMsg);
            break;
        case PS_PID_ERRC:
            OM_TraceMsgHook(pstMsg);
            BST_MSG_ProcLrrcRecv(pstMsg);
            break;
        default:
            break;
    }
}
BST_ERR_ENUM_UINT8 BST_OS_RegisgerMemStatus( BST_MEM_TYPE_ENUM_UINT8 enType, BST_MEM_STATUS_CALLBACK_FUNC pfCallBack )
{
    BST_UINT32                          ulIndex;

    if( BST_NULL_PTR == pfCallBack )
    {
        return BST_ERR_INVALID_PTR;
    }

    if( enType >= BST_MEM_TYPE_BUTT)
    {
        return BST_ERR_NOT_SUPPORT;
    }

    for(ulIndex=0; ulIndex < BST_MEM_STATUS_CALLBACK_MAX_NUMBER; ulIndex++)
    {
        if( BST_NULL_PTR == g_acBstMemCallBackInfo[enType][ulIndex].pfCallBack )
        {
            g_acBstMemCallBackInfo[enType][ulIndex].pfCallBack        = pfCallBack;
            g_acBstMemCallBackInfo[enType][ulIndex].usLastReportValue = BST_MEM_HIGH_LEVEL;
            return BST_NO_ERROR_MSG;
        }
    }

    BST_DBG_LOG("BST_OS_RegisgerMemStatus client max number");
    return BST_ERR_NOT_SUPPORT;
}
BST_ERR_ENUM_UINT8  BST_DSPP_CDlLayerBase::UnPack ( BST_DSPP_HEAD_STRU *const pstRxHeadInfo )
{
    BST_DSPP_CDlLayerBase              *pcNextLayer;
    BST_DSPP_VERION_ENUM_UINT8          enNextVer;
    BST_ERR_ENUM_UINT8                  ucRtnVal;

    enNextVer                           = BST_DSPP_VER_INVALID;
    pcNextLayer                         = BST_NULL_PTR;
    BST_DBG_LOG ( "BST_DSPP_CDlLayerBase::UnPack is called" );

    ucRtnVal                            =  UnpackInternal ( pstRxHeadInfo, &enNextVer );
    if ( BST_NO_ERROR_MSG != ucRtnVal )
    {
        BST_RLS_LOG1( "BST_DSPP_CDlLayerBase::UnPack UnpackInternal Err=%u",
                      ucRtnVal );
        return BST_ERR_LAYER_VER;
    }

    if ( BST_DSPP_VER_VOID == enNextVer )
    {
        return BST_ERR_LAYER_VER;
    }

    pcNextLayer                         = GetNextStrategy ( enNextVer );
    if ( BST_NULL_PTR != pcNextLayer )
    {
        ucRtnVal                        = pcNextLayer->UnPack ( pstRxHeadInfo );
    }
    else
    {
        ucRtnVal                        = BST_NO_ERROR_MSG;
    }
    return ucRtnVal;
}
BST_IP_ERR_T BST_SRV_CChnlIpRcver::Connectd( BST_IP_CSocket *pcSocket )
{
    BST_DBG_LOG("BST_SRV_CChnlIpRcver Connectd. ");
#if ( ( BST_OS_VER == BST_WIN32 && BST_VER_TYPE == BST_DBG_VER ) || (BST_MODEM_SELF == 1) )
    BST_SRV_CHNL_LINK_STRU     *pstLinkItem = BST_NULL_PTR;
    BST_SRV_CHNL_LINK_STRU     *pstLinkItem2;
    BST_SRV_CHNL_HEAD_STRU     *pstPktItem;
    BST_ERR_ENUM_UINT8          enRtnVal;
    
    pstLinkItem                 = BST_SRV_Q_PeekHead( g_lstChnlMng );
    pstPktItem                  = BST_SRV_Q_PeekHead( pstLinkItem->pUnsendList );
    pstPktItem->ucPropType      = BST_IP_SKT_PROP_NONE; /*不使用包中的socket属性*/
    enRtnVal                    = BST_SRV_CHNL_Send_Runing( pstLinkItem, pstPktItem );
    if( BST_ERR_ILLEGAL_PARAM == enRtnVal )
    {
        BST_SRV_Q_RmvItem( (BST_SRV_CHNL_Q **)&g_lstChnlMng,
                           (BST_SRV_CHNL_Q *)pstLinkItem,
                           (BST_SRV_CHNL_Q **)&pstLinkItem2 );
        BST_OS_TimerRemove( pstLinkItem->ulTimerId );
        BST_DBG_LOG1( "tiger BST_OS_FREE 10,", pstLinkItem );
        BST_OS_FREE( pstLinkItem );
    }
#endif
    return BST_IP_ERR_OK;
}
BST_UINT16 BST_CORE_CNPTask::InquiredSocketProperty(
    BST_UINT16  usDataSize,
    BST_VOID   *const pData )
{
    BST_IP_ERR_T                        enIpErr;

    BST_DBG_LOG ( " BST_CORE_CNPTask::InquiredSocketProperty Enter.");
    if ( usDataSize < BST_OS_SIZEOF ( BST_IP_SKT_PROPTY_STRU ) )
    {
        BST_RLS_LOG1 ( "BST_CORE_CNPTask::InquiredSocketProperty usDataSize=%d",
                       usDataSize );
        return BST_CORE_INVALID_INQUIRED_LEN;
    }
    Stop();
    enIpErr                     = m_pSocket->IoCtrl ( BST_SCKT_CMD_GET_PROPERTY, pData );
    BST_ResetPrptyFlag();
    ( BST_VOID )PidInquired ( BST_PID_SOCKET_PROPERTY, usDataSize, pData );
    if ( BST_IP_ERR_OK == enIpErr )
    {
        return ( BST_OS_SIZEOF ( BST_IP_SKT_PROPTY_STRU ) );
    }
    else
    {
        return BST_CORE_INVALID_INQUIRED_LEN;
    }
}
BST_CORE_CNPTask::~BST_CORE_CNPTask ( BST_VOID )
{
    BST_CORE_CRegedit                  *pcRegedit;
    BST_APP_CMainTask                  *pcMainTask;

    BST_ERR_ENUM_UINT8                  ucRtnVal;
#if ( BST_OS_VER != BST_QCOM_ROS )
    try
    {
#endif
        BST_DBG_LOG( "BST_CORE_CNPTask::~BST_CORE_CNPTask in" );
        pcRegedit                       = BST_CORE_CRegedit::GetInstance();
        pcMainTask                      = BST_APP_CMainTask::GetInstance();

        if ( BST_NULL_PTR != m_pExptReport )
        {
            ucRtnVal                    = Report ( BST_TRAFFIC_FLOW_REPORT );
            if ( BST_NO_ERROR_MSG != ucRtnVal )
            {
                BST_RLS_LOG1( "BST_CORE_CNPTask::~BST_CORE_CNPTask Report Traffic Error: %u", ucRtnVal );
            }
            ucRtnVal                    = Report ( BST_ERR_TASK_REMOVED );
            if ( BST_NO_ERROR_MSG != ucRtnVal )
            {
                BST_RLS_LOG1( "BST_CORE_CNPTask::~BST_CORE_CNPTask Report Removed Error: %u", ucRtnVal );
            }
            delete m_pExptReport;
        }
        if ( BST_NULL_PTR != pcRegedit )
        {
            pcRegedit->unRegist ( this );
        }
        if ( BST_NULL_PTR != pcMainTask )
        {
            pcMainTask->Detach ( this );
        }
        BST_DBG_LOG1( "BST_CORE_CNPTask::~BST_CORE_CNPTask m_pSocket=%p",
                      m_pSocket );
        if ( BST_NULL_PTR != m_pSocket )
        {
            delete m_pSocket;
        }
#if ( BST_OS_VER != BST_QCOM_ROS )
    }
    catch (...)
    {
        BST_RLS_LOG("BST_CORE_CNPTask destructor exception!");
    }
#endif
}
BST_VOID BST_SRV_CHNL_Close(
    BST_SRV_CHNL_LINK_STRU     *pstChnlLink )
{
    BST_ASSERT_NULL( pstChnlLink );
    BST_SRV_CHNL_Clear( pstChnlLink );
    BST_DBG_LOG("BST_SRV_CHNL_Close");

    pstChnlLink->ulIsPropSet    = BST_FALSE;
    if( BST_NULL_PTR != pstChnlLink->pcSocket )
    {
        pstChnlLink->pcSocket->CloneClose();
    }
    return;
}
BST_VOID BST_PAL_NetSendNetStateMsg( BST_UINT32 ulNetState )
{
    BST_CDS_NET_DEVICE_STATE_STRU      *pstNetStateMsg;
    BST_UINT32                          ulMsgLen;

    ulMsgLen                            = sizeof( BST_CDS_NET_DEVICE_STATE_STRU );
    pstNetStateMsg                      = BST_PAL_NetAllocMsgWithHdr( ulMsgLen );

    if (BST_NULL_PTR == pstNetStateMsg)
    {
        BST_RLS_LOG( "BST_PAL_NetSendNetStateMsg : Alloc Msg Fail. Size ." );
        return;
    }

    /*填写消息内容*/
    BST_PAL_NetCfgMsgHead( pstNetStateMsg, UEPS_PID_CDS );
    pstNetStateMsg->ulMsgId             = ID_BST_CDS_NET_DEVICE_UP_IND;
    if ( BST_DRV_NETSTATE_UP == ulNetState )
    {
        pstNetStateMsg->ulNetDeviceState= CDS_BASTET_NET_DEVICE_UP;
        BST_DBG_LOG( "BST_PAL_NetSendNetStateMsg: Up. " );
    }
    else if ( BST_DRV_NETSTATE_DOWN == ulNetState )
    {
        pstNetStateMsg->ulNetDeviceState= CDS_BASTET_NET_DEVICE_DOWN;
        BST_DBG_LOG( "BST_PAL_NetSendNetStateMsg: Down. " );
    }
    else
    {
        pstNetStateMsg->ulNetDeviceState= CDS_BASTET_NET_DEVICE_UNKNOW;
        BST_DBG_LOG( "BST_PAL_NetSendNetStateMsg: Unknow. " );
    }

    /*发送消息*/
    BST_PAL_NetSendMsg( pstNetStateMsg );
}
BST_VOID BST_SYS_InitPlatform( BST_VOID )
{
    if(BST_FALSE == BST_SYS_ApiGetSupported())
    {
        BST_DBG_LOG("BST_SYS_InitPlatform: bastet nv disabled");
        return;
    }

    BST_OS_InitLock();
    BST_OS_InitSpinLock( &g_MboxLock );
    BST_OS_MemInit();
    BST_OS_TimerSysInit();
    BST_DBG_INITIAL();
    if( BST_TRUE == BST_SYS_InitThread() )
    {
        BST_SYS_InitDriver();
    }
}
/*lint -e438*/
BST_VOID BST_CTaskSchdler::Detach ( BST_CORE_CPTask *pC_PTask )
{
    BST_CORE_PTASK_NODE_STRU   *pstPtaskNode;

    if ( !BST_OS_IsTimerValid (m_ulTimerId) )
    {
        BST_RLS_LOG1( "BST_CTaskSchdler::Detach m_ulTimerId=%u is invalid",
                      m_ulTimerId );
        return;
    }
    if ( BST_NULL_PTR == pC_PTask )
    {
        BST_RLS_LOG( "BST_CTaskSchdler::Detach pC_PTask=NULL" );
        return;
    }
    /*
     * 遍历列表,找到pctask相符的任务,从链表删除,释放资源
     */
    for ( pstPtaskNode = (BST_CORE_PTASK_NODE_STRU *)lstFirst( &g_stPTaskList );
          pstPtaskNode!= BST_NULL_PTR;
          pstPtaskNode = (BST_CORE_PTASK_NODE_STRU *)lstNext((NODE *)pstPtaskNode) )
    {
        if( pstPtaskNode->pcTask != pC_PTask )
        {
            continue;
        }
        lstDelete( &g_stPTaskList, (NODE *)pstPtaskNode );
        BST_OS_FREE( pstPtaskNode );
        break;
    }
    /*
     * 注销后,如果认为列表为空,则直接关闭定时器,不进行任何调度
     */
    if ( 0 == lstCount( &g_stPTaskList ) )
    {
        BST_DBG_LOG( "BST_CTaskSchdler::Detach Stop Scheduler Timer" );
        BST_OS_TimerStop ( m_ulTimerId );
    }
}
BST_OS_MBX_T *BST_OS_CreateMbx( BST_VOID *pvArg, BST_UINT32 ulSize )
{
    BST_OS_MBX_T                       *pstMbx;

    pstMbx                              = BST_OS_MALLOC( BST_OS_SIZEOF(BST_OS_MBX_T) );
    BST_ASSERT_NULL_RTN( pstMbx, BST_NULL_PTR );
    pstMbx->hSem                        = BST_NULL_PTR;

    lstInit( &pstMbx->hList );
    pstMbx->hSem                        = BST_OS_CreateSem( pvArg, 0U );

    if( BST_NULL_PTR == pstMbx->hSem )
    {
        BST_DBG_LOG("Create Mail Box Fail.\n");
        lstFree( &pstMbx->hList );
        BST_OS_FREE(pstMbx);
        /*lint -e438*/
        return BST_NULL_PTR;
        /*lint +e438*/
    }
    return( pstMbx );
}
BST_ERR_ENUM_UINT8 BST_SRV_CHNL_ProcInCB(
    BST_SRV_CHNL_LINK_STRU     *pstChnlLink )
{
    BST_SRV_CHNL_HEAD_STRU     *pstPktItem;
    BST_SRV_CHNL_HEAD_STRU     *pstPktItem2;
    BST_ERR_ENUM_UINT8          enRtnVal;

    BST_ASSERT_NULL_RTN( pstChnlLink, BST_ERR_INVALID_PTR );
    pstChnlLink->enState        = BST_SRV_CHNL_STATE_SUSPEND;
    BST_DBG_LOG("BST_SRV_CHNL_ProcInCB"); 
    for(;;)
    {
        pstPktItem              = BST_SRV_Q_PeekHead(pstChnlLink->pUnsendList);
        enRtnVal                = BST_NO_ERROR_MSG;
        if( BST_NULL_PTR == pstPktItem )
        {
            break;
        }
        enRtnVal                = BST_SRV_CHNL_Send_InCB( pstChnlLink, pstPktItem );
        if( BST_NO_ERROR_MSG == enRtnVal )
        {
            BST_SRV_Q_RmvItem( (BST_SRV_CHNL_Q **)&pstChnlLink->pUnsendList,
                               (BST_SRV_CHNL_Q *)pstPktItem,
                               (BST_SRV_CHNL_Q **)&pstPktItem2 );
            BST_SRV_FreeIpBlock( pstPktItem );
            continue;
        }
        else
        {
            break;
        }
    }
    if( BST_SRV_Q_IsEmpty( pstChnlLink->pUnsendList ) )
    {
        pstChnlLink->enState    = BST_SRV_CHNL_STATE_RUN;
    }
    return BST_NO_ERROR_MSG;
}
BST_UINT16 BST_CORE_CNPTask::InquiredTrafficFlow(
    BST_UINT16  usDataSize,
    BST_VOID   *const pData )
{
    BST_IP_ERR_T                        enIpErr;

    BST_DBG_LOG( "BST_CORE_CNPTask::InquiredTrafficFlow email traffic flow info");
    if ( usDataSize < BST_OS_SIZEOF ( BST_IP_TRAFFIC_FLOW_STRU ) )
    {
        BST_RLS_LOG1( "BST_CORE_CNPTask::InquiredTrafficFlow usDataSize=%u",
                      usDataSize );
        return BST_CORE_INVALID_INQUIRED_LEN;
    }
    enIpErr                     = m_pSocket->IoCtrl ( BST_SCKT_CMD_GET_TRAFFIC_FLOW, pData );
    ( BST_VOID )PidInquired ( BST_PID_TRAFFIC_FLOW, usDataSize, pData );
    if ( BST_IP_ERR_OK == enIpErr )
    {
        return ( BST_OS_SIZEOF ( BST_IP_TRAFFIC_FLOW_STRU ) );
    }
    else
    {
        return BST_CORE_INVALID_INQUIRED_LEN;
    }
}
BST_IP_ERR_T BST_IP_SslReceive( BST_FD_T fd, BST_UINT8* pData, BST_UINT16 usLength )
{
    SSL                *pstSsl;
    BST_UINT8          *pucTmpBuf;
    BST_INT32           lRtnVal;
    BST_INT32           lCopyedLen;
    BST_INT32           lSelect;
    BST_INT32           lSockFd;
    fd_set              stRdFds;
    timeval             stTval;
    stTval.tv_sec       = 0;
    stTval.tv_usec      = 0;
    if ( BST_NULL_PTR == fd.pFd )
    {
        return BST_IP_ERR_ARG;
    }
    if ( BST_NULL_PTR == pData )
    {
        return BST_IP_ERR_ARG;
    }

    lCopyedLen          = 0;
    pstSsl              = (SSL *)fd.pFd;
    lSockFd             = SSL_get_fd( pstSsl );

    pucTmpBuf           = (BST_UINT8 *)BST_OS_MALLOC( usLength );

    if ( BST_NULL_PTR == pucTmpBuf )
    {
        return BST_IP_ERR_MEM;
    }
    
    do {
        FD_ZERO( &stRdFds );
        FD_SET( lSockFd, &stRdFds );

        lRtnVal         = SSL_read( pstSsl, pucTmpBuf, usLength );

        
        if ( lRtnVal <= 0 )
        {
            BST_RLS_LOG( "BST_IP_SslReceive SSL_read error" );
            break;
        }
        if ( 0 == lCopyedLen )
        {
            BST_OS_MEMCPY( pData, pucTmpBuf, lRtnVal );
            lCopyedLen  = lRtnVal;
            BST_DBG_LOG1( "BST_IP_SslReceive lCopyedLen", lCopyedLen );
        }
        /*如果ssl内部缓冲区没有数据可读,则判断IP协议栈是否有数据可读*/
        if ( !SSL_pending( pstSsl ) )
        {
            lSelect     = lwip_select( lSockFd + 1, &stRdFds, NULL, NULL, &stTval );
            if ( lSelect < 0)
            {
                BST_RLS_LOG( "BST_IP_SslReceive lwip_select error" );
                break;
            }

            /*如果协议栈也没有数据可读,则说明这次读取完毕,退出*/
            if ( !FD_ISSET( lSockFd,&stRdFds ) )
            {
                BST_DBG_LOG( "BST_IP_SslReceive socket is not data" );
                break;
            }
        }
    } while( 1 );

    BST_OS_FREE( pucTmpBuf );
    return lCopyedLen;
}
BST_IP_CSocket *BST_SRV_CHNL_CreateSocket(
    BST_SRV_CHNL_HEAD_STRU     *pstPktItem )
{
    BST_IP_CSocket             *pcSocket;
    BST_IP_CNetRcver           *pNetRcver;
    BST_SCKT_TYPE_ENUM_UINT32   enSocketType;
    BST_IP_ERR_T                enIpErrMsg;

    BST_ASSERT_NULL_RTN( pstPktItem, BST_NULL_PTR );
    enSocketType                = BST_SCKT_TYPE_TCP;

#if( BST_VER_TYPE == BST_DBG_VER )
    pcSocket                    = new BST_IP_CSocket ( 0, 0 );
#else
    pcSocket                    = new BST_IP_CSocket ();
#endif
    pNetRcver                   = BST_SRV_CChnlIpRcver::GetInstance();
    if ( BST_NULL_PTR == pNetRcver )
    {
        delete pcSocket;
        return BST_NULL_PTR;
    }

    enIpErrMsg                  = pcSocket->IoCtrl ( BST_SCKT_CMD_DEF_TYPE,
                                                    ( BST_VOID  *)&enSocketType );
    if ( BST_IP_ERR_OK != enIpErrMsg )
    {
        BST_DBG_LOG("BST_APP_CPRITask CreateSocket BST_SCKT_CMD_DEF_TYPE");
        delete pcSocket;
        return BST_NULL_PTR;
    }
    enIpErrMsg                  = pcSocket->IoCtrl( BST_SCKT_CMD_SET_ADDRESS,
                                                    ( BST_VOID  *)&pstPktItem->stAddr.stInet );
    if ( BST_IP_ERR_OK != enIpErrMsg )
    {
        BST_DBG_LOG("BST_APP_CPRITask CreateSocket BST_SCKT_CMD_SET_ADDRESS");
        delete pcSocket;
        return BST_NULL_PTR;
    }

    enIpErrMsg                  = pcSocket->IoCtrl( BST_SCKT_CMD_REG_CALLBACK,
                                                    pNetRcver ); 
    if ( BST_IP_ERR_OK != enIpErrMsg )
    {
        BST_DBG_LOG("BST_APP_CPRITask CreateSocket BST_SCKT_CMD_REG_CALLBACK");
        delete pcSocket;
        return BST_NULL_PTR;
    }
    enIpErrMsg                  = pcSocket->Socket( BST_SRV_GetChnlCtrlHandle( 0 ) );
    if ( BST_IP_ERR_OK != enIpErrMsg )
    {
        BST_DBG_LOG("BST_APP_CPRITask CreateSocket Socket error");
        delete pcSocket;
        return BST_NULL_PTR;
    }
#if ( ( BST_OS_VER == BST_WIN32 && BST_VER_TYPE == BST_DBG_VER )||( BST_MODEM_SELF == 1 ) )
    pcSocket->Bind();
    pcSocket->Connect();
#else
    enIpErrMsg                  = pcSocket->Clone();
#endif
    if ( BST_IP_ERR_OK != enIpErrMsg )
    {
        BST_RLS_LOG( "BST_APP_CPRITask Clone err" );
        return BST_NULL_PTR;
    }
    return pcSocket;
}
BST_ERR_ENUM_UINT8 BST_SRV_CHNL_Acked (
    BST_SRV_CHNL_LINK_STRU     *pstLinkItem,
    const BST_UINT32            ulMinNumber,
    const BST_UINT32            ulMaxNumber )
{
    BST_SRV_CHNL_SENT_STRU             *pSentItem;
    BST_SRV_CHNL_SENT_STRU             *pSentItem2;
    BST_SRV_CHNL_HEAD_STRU             *pstPktItem;
    BST_SRV_CHNL_HEAD_STRU             *pstPktItem2;
    BST_UINT32                          ulSpinlockCnt;
    BST_UINT32                          ulOrigCounter;
    BST_DRV_STRU                       *pNetDrvHandle;
    BST_ERR_ENUM_UINT8                  enRtnVal;

    BST_ASSERT_NULL_RTN( pstLinkItem, BST_ERR_INVALID_PTR );
    BST_ASSERT_NORM_RTN( ulMaxNumber < ulMinNumber, BST_ERR_ILLEGAL_PARAM );

    BST_DBG_LOG2( "BST_SRV_CHNL_Acked ulMinNumber, ulMaxNumber",
                  ulMinNumber, ulMaxNumber );
    /*查找已发送的数据包的*/
    pSentItem                           = BST_SRV_Q_PeekHead(pstLinkItem->pSentList);
    ulOrigCounter                       = g_ulHighPriCnt;
    pSentItem2                          = BST_NULL_PTR;
    pstPktItem2                         = BST_NULL_PTR;
    while( pSentItem != BST_NULL_PTR )
    {
        if ( ( pSentItem->ulAckNo > ulMinNumber )
           &&( pSentItem->ulAckNo <=ulMaxNumber ) )
        {
            if( BST_DSPP_FLG_LVLTYPE_HS == pSentItem->usProcLevel )
            {
                ulSpinlockCnt           = BST_OS_SpinLock( &g_HighPriCntSpinLock );
                if ( g_ulHighPriCnt > 0 )
                {
                    g_ulHighPriCnt--;
                }
                BST_OS_SpinUnLock( &g_HighPriCntSpinLock , ulSpinlockCnt );
            }
            BST_DBG_LOG1("BST_SRV_CHNL_Acked,g_ulHighPriCnt--",g_ulHighPriCnt);
            BST_SRV_Q_RmvItem( (BST_SRV_CHNL_Q **)&pstLinkItem->pSentList,
                               (BST_SRV_CHNL_Q *)pSentItem,
                               (BST_SRV_CHNL_Q **)&pSentItem2 );
            BST_OS_FREE( pSentItem );
        }
        else
        {
            pSentItem2                  = pSentItem->pNext;
        }
        pSentItem                       = pSentItem2;
    }

    pstPktItem                          = BST_SRV_Q_PeekHead(pstLinkItem->pUnsendList);
    while ( pstPktItem != BST_NULL_PTR )
    {
        if( BST_IP_SKT_PROP_NONE != pstPktItem->ucPropType )
        {
            if( ( ( pstPktItem->stProp.ulSeqNum + pstPktItem->ulUsed  ) > ulMinNumber )
              &&( ( pstPktItem->stProp.ulSeqNum + pstPktItem->ulUsed  ) <=ulMaxNumber ) )
            {
                BST_SRV_Q_RmvItem( (BST_SRV_CHNL_Q **)&pstLinkItem->pUnsendList,
                                   (BST_SRV_CHNL_Q *)pstPktItem,
                                   (BST_SRV_CHNL_Q **)&pstPktItem2 );
                BST_SRV_FreeIpBlock( pstPktItem );
            }
            else
            {
                pstPktItem2             = pstPktItem->pNext;
            }
        }
        else
        {
            pstPktItem2                 = pstPktItem->pNext;
        }
        pstPktItem                      = pstPktItem2;
    }
    enRtnVal                            = BST_NO_ERROR_MSG;
    if( BST_NULL_PTR != pstLinkItem->pUnsendList )
    {
        BST_OS_TimerStop( pstLinkItem->ulTimerId );
        BST_DBG_LOG( "BST_SRV_CHNL_Acked, Proc Unsent List" );
        enRtnVal                        = BST_SRV_CHNL_ProcInCB( pstLinkItem );
    }

    /**
     * 刚刚有值,现在无值,那么说明全部高优先数据发送完成
     */
    if( ( 0 != ulOrigCounter ) && ( 0 == g_ulHighPriCnt ) )
    {
        pNetDrvHandle   = BST_DRV_NetGetDvcHandle();
        enRtnVal        = 0;
        pNetDrvHandle->pfIoCtrl( BST_DRV_CMD_HPR_DATA_FINISH, (BST_VOID *)&enRtnVal );
        BST_DBG_LOG( "BST_SRV_CHNL_Acked, BST_DRV_CMD_HPR_DATA_FINISH" );
    }

    return enRtnVal;
}