Commit f5a2d8b2 authored by cheny's avatar cheny

delete old version of CUUP

parent 8fdc3d58
/******************************************************************************
**
** Copyright (c) 2021 ICT.
** All rights reserved.
** File name:
** Description:
**
** Current Version:
** Author:
** Date:
** Contact: yuanchunjing@ict.ac.cn
** Note: If you have any difficulties or need help, please contact us
*******************************************************************************/
#include "cuupTest.h"
INT32 printfPduSessionCfgType(UpcCfgType_e type)
{
return VOS_OK;
}
INT32 printfTransLayerAddr(TransLayerAddr_t *pAddr)
{
return VOS_OK;
}
INT32 printfNguInstance(NguInstance_t *pNguInstance)
{
return VOS_OK;
}
INT32 printfNguCfgResult(NguCfgResult_t *pCfg)
{
return VOS_OK;
}
INT32 printfSecuResult(SecuResult_t *pResult)
{
return VOS_OK;
}
INT32 printfPdcpRlcMode(PdcpRlcMode_e mode)
{
return VOS_OK;
}
INT32 printfDrbEntity(PdcpDrbEntity_t *pEntity)
{
return VOS_OK;
}
INT32 printfDrbFailedCause(DrbFailedCause_t *p)
{
return VOS_OK;
}
INT32 printfPdcpuCfgResult(PdcpuCfgResult_t *pResult)
{
return VOS_OK;
}
INT32 printfCuf1uInstance(Cuf1uInstance_t *pF1u)
{
return VOS_OK;
}
INT32 printfCuf1uSetupInfo(Cuf1uSetupInfo_t *pInfo)
{
return VOS_OK;
}
INT32 printfCuf1uCfgResult(Cuf1uCfgResult_t *pResult)
{
return VOS_OK;
}
INT32 printfPdcpuSecInfo(PdcpuSecInfo_t *pSec)
{
return VOS_OK;
}
INT32 printfVosSockAddr(vos_sockaddr_t *pAddr)
{
return VOS_OK;
}
INT32 printfTun(Tun_t *pTun)
{
return VOS_OK;
}
INT32 printfPdcpuSecEnableInfo(PdcpuSecEnableInfo_t *pInfo)
{
return VOS_OK;
}
INT32 printfCuupUeIdxTable(CuupUeIdxTable_t *pTable)
{
return VOS_OK;
}
INT32 printfMsgbBuff(MsgbBuff_t *pMsgBuff)
{
return VOS_OK;
}
INT32 printfExPduInfo(ExPduInfo_t *pPdu)
{
return VOS_OK;
}
INT32 printfSdapNewInstance(SdapGlobalDtat_t *pGlobalData)
{
return VOS_OK;
}
/******************************************************************************
**
** Copyright (c) 2021 ICT.
** All rights reserved.
** File name:
** Description:
**
** Current Version:
** Author:
** Date:
** Contact: yuanchunjing@ict.ac.cn
** Note: If you have any difficulties or need help, please contact us
*******************************************************************************/
#include "vos_types.h"
#include "vos_string.h"
#include "vos_linklist.h"
#include "vos_sem.h"
#include "pdcpu.h"
#include "cuupCommon.h"
#include "cuModuleInterface.h"
#include "gnbCommon.h"
#include "upcContext.h"
#include "cuupTest.h"
PdcpuUeInfo_t *gPdcpuUeInfo[MAX_UE_NUM];
extern ULONG gPdcpuModuleId;
/* not used at the moment */
/*void pdcpuSetLessCountFun(const void* cpv_first, const void* cpv_second, void* pv_output)
{
assert(cpv_first != NULL && cpv_second != NULL && pv_output != NULL);
*(bool_t*)pv_output = (((PdcpuDataBuffNode_t *)cpv_first)->count) < (((PdcpuDataBuffNode_t *)cpv_second)->count) ? true : false;
}*/
/** 释放一个 PdcpuDataBuffNode_t 数据,赋值给plist->del */
VOID pdcpuFreeDataBuffNode(VOID *p)
{
PdcpuDataBuffNode_t *pNode = NULL;
if(NULL == p)
{
return ;
}
pNode = (PdcpuDataBuffNode_t *)p;
if(NULL != pNode->pData)
{
msgbFree(pNode->pData);
pNode->pData = NULL;
}
VOS_Free(p);
p = NULL;
return ;
}
/*******************************************************************************
* discard all stored PDCP PDUs in the transmitting buffer
* INPUT:
* pTxPduList: transmitting buffer list
* OUTPUT:
* 0: success
* -1:failed
*******************************************************************************/
INT32 pdcpuDiscardTransmitBuff(plist pTxPduList)
{
return VOS_OK;
}
/*******************************************************************************
* transmit or retransmit all stored PDCP PDUs in the transmitting buffer
* INPUT:
* pTxPduList: transmitting buffer list
* OUTPUT:
* 0: success
* -1:failed
*******************************************************************************/
INT32 pdcpuDeliverTransmitBuff(PdcpDrbEntity_t *pPdcpuEntity)
{
return VOS_OK;
}
/*******************************************************************************
* deliver the PDCP SDUs stored in the receiving buffer to upper layers
* in ascending order of associated COUNT values
* INPUT:
* pTxPduList: transmitting buffer list
* OUTPUT:
* 0: success
* -1:failed
*******************************************************************************/
INT32 pdcpuDeliverRecvBuff(PdcpDrbEntity_t *pPdcpuEntity)
{
return VOS_OK;
}
/*******************************************************************************
* To construct and send a PDCP status report
* INPUT:
* pPdcpuEntity: pdcpu entity
* OUTPUT:
* 0: success
* -1:failed
*******************************************************************************/
INT32 pdcpuConstructStatusReport(PdcpDrbEntity_t *pPdcpuEntity)
{
return VOS_OK;
}
/*******************************************************************************
* To perform PDCP data recovery
* INPUT:
* ueE1apId: UE E1AP ID
* drbId : DRB ID
* OUTPUT:
* 0: success
* -1:failed
*******************************************************************************/
INT32 pdcpuDataRecovery(PdcpDrbEntity_t *pPdcpuEntity)
{
return VOS_OK;
}
INT32 pdcpuRecfgRohc(PdcpDrbEntity_t *pPdcpuEntity, upcTempDrbInfo_t *pDrbItem)
{
return VOS_OK;
}
INT32 pdcpuSetSn(PdcpSnSize_e *pSn, PdcpSNSize_e snCfg)
{
if(PDCP_SN_SIZE_S12 == snCfg)
{
*pSn = LEN12BITS;
}else if(PDCP_SN_SIZE_S18 == snCfg)
{
*pSn = LEN18BITS;
}else
{
pdcpuLog(LOG_ERR,"[PDCPU] input sn size is wrong!\n");
return VOS_ERROR;
}
return VOS_OK;
}
INT32 pdcpuSetRlcMode(PdcpRlcMode_e *pRlcMode, CuRlcMode_e rlcCfg)
{
switch(rlcCfg)
{
case RLCMODE_TM:
pdcpuLog(LOG_ERR,"[PDCPU] input-TM MODE is wrong!\n");
return VOS_ERROR;
case RLCMODE_AM:
*pRlcMode = AM_MODE;
return VOS_OK;
case RLCMODE_UM_BIDIRECTIONAL:
case RLCMODE_UM_UNIDIRECTIONAL_UL:
case RLCMODE_UM_UNIDIRECTIONAL_DL:
*pRlcMode = UM_MODE;
return VOS_OK;
default:
pdcpuLog(LOG_ERR,"[PDCPU] input-rlc mode is wrong\n");
return VOS_ERROR;
}
}
/*******************************************************************************
* To get SDAP DATA PDU header length configuration
* INPUT:
* sdapHeadInd :
* sdapHeadLen :
* OUTPUT:
* none
*******************************************************************************/
INT32 pdcpuGetSdapHeadLen(SdapHeader_e sdapHeadInd, UINT8 *sdapHeadLen)
{
if(SDAP_HEADER_PRESENT == sdapHeadInd)
{
*sdapHeadLen = 1; /*Data PDU with SDAP header*/
}else if(SDAP_HEADER_ABSENT == sdapHeadInd)
{
*sdapHeadLen = 0; /*Data PDU without SDAP header*/
}else
{
pdcpuLog(LOG_ERR,"[PDCPU] sdap head cfg is wrong\n");
return VOS_ERROR;
}
return VOS_OK;
}
/*******************************************************************************
* To create PDCP-U entity
* INPUT:
* ueE1apId: UE E1AP ID
* pDrbItem : DRB to setup item
* OUTPUT:
* 0: success
* -1:failed
*******************************************************************************/
INT32 pdcpuCreateEntity(UINT64 ueE1apId, UINT16 ueIdx, UINT16 pduSessionId, upcTempDrbInfo_t *pDrbItem)
{
UINT8 drbId = pDrbItem->drbId;
PdcpuUeInfo_t *pPdcpUeInfo = NULL;
PdcpDrbEntity_t *pPdcpuEntity = NULL;
INT8 ret = 0;
pdcpuCheckUeIdx(ueIdx);
pdcpuCheckDrbId(drbId);
/* examine ue info */
if(NULL == gPdcpuUeInfo[ueIdx])
{
pPdcpUeInfo = VOS_Malloc(sizeof(PdcpuUeInfo_t), gPdcpuModuleId);
pdcpuNullCheck(pPdcpUeInfo);
VOS_MemZero(pPdcpUeInfo, sizeof(PdcpuUeInfo_t));
gPdcpuUeInfo[ueIdx] = pPdcpUeInfo;
}else
{
pPdcpUeInfo = gPdcpuUeInfo[ueIdx];
}
/* examine drb info */
if(NULL != pPdcpUeInfo->pdcpDrbEntity[drbId])
{
pPdcpuEntity = pPdcpUeInfo->pdcpDrbEntity[drbId];
}
pPdcpuEntity = VOS_Malloc(sizeof(PdcpDrbEntity_t), gPdcpuModuleId);
pdcpuNullCheck(pPdcpuEntity);
VOS_MemZero(pPdcpuEntity, sizeof(PdcpDrbEntity_t));
pPdcpUeInfo->pdcpDrbEntity[drbId] = pPdcpuEntity;
PDCPConfiguration_t *pPdcpCfg = &(pDrbItem->pdcpConfig);
pPdcpuEntity->ueE1apId = ueE1apId;
pPdcpuEntity->ueIdx = ueIdx;
pPdcpuEntity->pduSessionId = pduSessionId;
pPdcpuEntity->drbId = drbId;
if(0 != ((pPdcpCfg->bitMask)&PDCP_CONFIGURATION_OUT_OF_ORDER_DELIVERY_PRESENT))
{
pdcpuLog(LOG_INFO,"[PDCPU] 乱序递交已设置\n");
pPdcpuEntity->outOfOrderDelivery= TRUE;
}
/* set rlc mode */
ret += pdcpuSetRlcMode(&pPdcpuEntity->rlcMode, pPdcpCfg->rlcMode);
/* set sn size- Cond Setup2(38.331) */
ret += pdcpuSetSn(&pPdcpuEntity->pdcpSnSizeUl, pPdcpCfg->pdcpSNSizeUl);
ret += pdcpuSetSn(&pPdcpuEntity->pdcpSnSizeDl, pPdcpCfg->pdcpSNSizeDl);
/* set sdap head length */
ret += pdcpuGetSdapHeadLen(pDrbItem->sdapConfig.sdapDlHeaderInd, &pPdcpuEntity->sdapDlHeadLen);
ret += pdcpuGetSdapHeadLen(pDrbItem->sdapConfig.sdapUlHeaderInd, &pPdcpuEntity->sdapUlHeadLen);
/* check the above return results */
if(0 != ret)
{
pdcpuLog(LOG_ERR,"[PDCPU] input parameter is wrong\n");
VOS_Free(pPdcpuEntity);
pPdcpUeInfo->pdcpDrbEntity[drbId] = NULL;
return VOS_ERROR;
}
/* set security enable information */
PdcpuSecEnableInfo_t *pEnableInfo = gPdcpuUeInfo[ueIdx]->secEnableInfo[pduSessionId];
pdcpuNullCheck(pEnableInfo);
pPdcpuEntity->integrityProtection = pEnableInfo->integrityEnableFlag;
pPdcpuEntity->ciperingEnabled = pEnableInfo->cipherEnableFlag;
/* not support: ulDataSplitThreshold, pdcpDuplication */
/* set state variable */
VOS_MemZero(&(pPdcpuEntity->stateVar), sizeof(PdcpStateVar_t));
/* initial transmitting buffer */
pPdcpuEntity->txListLock = VOS_SemMCreate(VOS_SEM_Q_FIFO);
pPdcpuEntity->pTxPduList = cl_lib_list_new("pdcpuTxPduList", gPdcpuModuleId);
/* initial receiving buffer */
pPdcpuEntity->rxListLock = VOS_SemMCreate(VOS_SEM_Q_FIFO);
pPdcpuEntity->pRxSduList = cl_lib_list_new("pdcpuRxSduList", gPdcpuModuleId);
printfDrbEntity(pPdcpuEntity);
return VOS_OK;
}
/******************************************************************************
**
** Copyright (c) 2021 ICT.
** All rights reserved.
** File name:
** Description:
**
** Current Version:
** Author:
** Date:
** Contact: yuanchunjing@ict.ac.cn
** Note: If you have any difficulties or need help, please contact us
*******************************************************************************/
#include <sys/time.h>
#include "vos_types.h"
#include "vos_linklist.h"
#include "vos_sem.h"
#include "cuupCommon.h"
#include "msgb.h"
#include "bitsPack.h"
#include "pdcpu.h"
#include "gnbCommon.h"
#include "cuupUeIdTransf.h"
#include "cuupTest.h" //for test
extern PdcpuUeInfo_t *gPdcpuUeInfo[MAX_UE_NUM];
extern CuupUeIdxTable_t gPdcpuUeIdxTable;
extern ULONG gPdcpuModuleId;
ULONG gPdcpuDlModuleId;
INT32 pdcpuDlInit(ULONG userModuleId)
{
gPdcpuDlModuleId = userModuleId;
return VOS_OK;
}
INT32 pdcpuPackPduHead(PdcpRlcMode_e rlc_mode,PdcpSnSize_e snSize, UINT32 sn, MsgbBuff_t *msgb)
{
BitOpt_t bit;
UINT8 *p = NULL;
UINT8 *pPduHead = NULL;
UINT8 pduHeadLen = 0;
if(LEN12BITS == snSize)
{
pduHeadLen = PDCP_SN_12_HEAD_LEN;
}else if(LEN18BITS == snSize)
{
pduHeadLen = PDCP_SN_18_HEAD_LEN;
}else
{
pdcpuLog(LOG_ERR,"[PDCPU] sn size is wrong!\n");
return VOS_ERROR;
}
pPduHead = VOS_Malloc(pduHeadLen,gPdcpuDlModuleId);
pdcpuNullCheck(pPduHead);
VOS_MemZero(pPduHead, pduHeadLen);
if(snSize == LEN12BITS)
{
if(sn >= MAX_PDCP_SN_12)
{
pdcpuLog(LOG_ERR,"[PDCPU] sn too big\n");
return VOS_ERROR;
}
initBits(&bit, pPduHead, 16, 0);
packBits(&bit, 1, 1);
skipBits(&bit, 3, BIT_PACKED);
packBits(&bit, 4, ((sn & 0xf00)>>8));
packBits(&bit, 8, sn & 0x0ff);
}else if(snSize == LEN18BITS)
{
if(sn >= MAX_PDCP_SN_18)
{
pdcpuLog(LOG_ERR,"[PDCPU] sn too big\n");
return VOS_ERROR;
}
initBits(&bit, pPduHead, 24, 0);
packBits(&bit, 1, 1);
skipBits(&bit, 5, BIT_PACKED);
packBits(&bit, 2, ((sn & 0x00030000)>>16));
packBits(&bit, 8, ((sn & 0x0000ff00)>>8));
packBits(&bit, 8, sn & 0x000000ff);
}else
{
pdcpuLog(LOG_ERR,"[PDCPU] sn size error\n");
return VOS_ERROR;
}
p = msgbHeadPush(msgb, pduHeadLen);
if(NULL != p)
{
VOS_MemCpy(p, pPduHead, pduHeadLen);
}else
{
pdcpuLog(LOG_ERR,"[PDCPU] msgbHeadPush failed!\n");
return VOS_ERROR;
}
if(NULL != pPduHead)
{
VOS_Free(pPduHead);
pPduHead= NULL;
}
return pduHeadLen;
}
/*******************************************************************************
* pdcp-u dl data process
* INPUT:
* ueE1apId: E1AP ID of the UE
* drbId: ID of data radio bearer
* pMsgBuff: PDCP PDU
* OUTPUT:
* 0: success
* -1:failed
*******************************************************************************/
INT32 pdcpuDlDataProc(UINT64 ueE1apId, UINT8 drbId, MsgbBuff_t *pMsgBuff, UINT8 sdapPduType)
{
UINT32 sn = 0;
INT8 pduHeadLen = 0;
PdcpSnSize_e snSize;
PdcpRlcMode_e rlcMode;
PdcpDrbEntity_t *pPdcpDrbEntity = NULL;
UINT16 ueIdx;
if(VOS_ERROR == cuupGetUeIdx(ueE1apId, &ueIdx, &gPdcpuUeIdxTable))
{
pdcpuLog(LOG_ERR,"[PDCPU] get ueIdx failed,ueE1apId:%d\n",ueE1apId);
return VOS_ERROR;
}
pdcpuCheckUeIdx(ueIdx);
pdcpuCheckDrbId(drbId);
pdcpuGetEntity(ueIdx, drbId, pPdcpDrbEntity);
pdcpuNullCheck(pPdcpDrbEntity);
rlcMode = pPdcpDrbEntity->rlcMode;
//1.check data
pdcpuNullCheck(pMsgBuff);
//2.assign the sn
UINT32 count = pPdcpDrbEntity->stateVar.txNext++;
// check out count wrapping around whether or not
if(0xffffffff == count)
{
pdcpuLog(LOG_ERR,"[PDCPU] count value is going to wrap around!\n");
return VOS_ERROR;
}
snSize = pPdcpDrbEntity->pdcpSnSizeDl;
if(snSize == LEN12BITS)
{
sn = GET_SN_12_SN(count);
}else if(snSize == LEN18BITS)
{
sn = GET_SN_18_SN(count);
}else
{
pdcpuLog(LOG_ERR,"[PDCPU] sn size is wrong!\n");
return VOS_ERROR;
}
//4.add pdu head
pduHeadLen = pdcpuPackPduHead(rlcMode, snSize, sn, pMsgBuff);
if(VOS_ERROR == pduHeadLen)
{
pdcpuLog(LOG_ERR,"[PDCPU] pack pdcp pdu head failed!\n");
return VOS_ERROR;
}
//8. 否则:cuf1u将数据发送成功后,释放
if(VOS_OK == cuf1uDlDataProc(ueE1apId, drbId, pMsgBuff, NULL))
{
//vos_info_print("there is no buffer\n");
msgbFree(pMsgBuff);
pMsgBuff = NULL;
return VOS_OK;
}else
{
pdcpuLog(LOG_ERR,"[PDCPU] cuf1u send failed\n");
return VOS_ERROR;
}
}
/******************************************************************************
**
** Copyright (c) 2021 ICT.
** All rights reserved.
** File name:
** Description:
**
** Current Version:
** Author:
** Date:
** Contact: yuanchunjing@ict.ac.cn
** Note: If you have any difficulties or need help, please contact us
*******************************************************************************/
#include "vos_types.h"
#include "vos_linklist.h"
#include "vos_module.h"
#include "vos_sem.h"
#include "cuupCommon.h"
#include "msgb.h"
#include "bitsPack.h"
#include "pdcpu.h"
#include "gnbCommon.h"
#include "pdcpCommon.h"
#include "pdcpuCore.h"
#include "cuupUeIdTransf.h"
#include "cuupTest.h"
extern PdcpuUeInfo_t *gPdcpuUeInfo[MAX_UE_NUM];
extern CuupUeIdxTable_t gPdcpuUeIdxTable;
extern ULONG gPdcpuModuleId;
ULONG gPdcpuUlModuleId;
extern INT32 sdapUlDataProc(UINT64 upE1apId, UINT64 sessId, UINT64 drbId, MsgbBuff_t *pMsgBuff);
INT32 pdcpuUlInit(ULONG userModuleId)
{
gPdcpuUlModuleId = userModuleId;
return VOS_OK;
}
INT32 pdcpuUnpackPduHead(MsgbBuff_t *pMsgBuff, PdcpSnSize_e snSize,
UINT8 *pPdutype, UINT32 *pSn)
{
BitOpt_t bit;
UINT8 *pMsgHead = msgbData(pMsgBuff);
UINT16 pduLen = msgbDataUsedLen(pMsgBuff);
initBits(&bit, pMsgHead, pduLen, 0);
*pPdutype = unpackBits(&bit, 1);
if(PDCP_CTRL_PDU == *pPdutype)
{
//*pCtrlPduType = unpackBits(&bit, 3);
return 0;
}else if(PDCP_DATA_PDU == *pPdutype)
{
if(LEN12BITS == snSize)
{
/*************D/C + 3R + PDCP SN = 16bits*************/
skipBits(&bit, 3, BIT_UNPACKED);
*pSn = unpackBits(&bit, LEN12BITS);
return PDCP_SN_12_HEAD_LEN;
}else if(LEN18BITS == snSize)
{
/*************D/C + 5R + PDCP SN =24bits*************/
skipBits(&bit, 5, BIT_UNPACKED);
*pSn = unpackBits(&bit, LEN18BITS);
return PDCP_SN_18_HEAD_LEN;
}else
{
pdcpuLog(LOG_ERR,"[PDCPU] sn size is wrong!\n");
return VOS_ERROR;
}
}
return VOS_OK;
}
INT32 pdcpuDecideCountAndHFN(PdcpStateVar_t *pStateVar, INT32 rcvdSn, PdcpSnSize_e snSize)
{
UINT32 rcvdHFN = 0;
UINT32 rxDeliv = pStateVar->rxDelivery;
INT32 tmp = 0;
if(LEN12BITS == snSize)
{
tmp = GET_SN_12_SN(rxDeliv) - SN_12_WINDOW_SIZE;
if(rcvdSn < tmp)
{
rcvdHFN = GET_HFN_12_SN(rxDeliv) + 1;
}else if(rcvdSn >= GET_SN_12_SN(rxDeliv) + SN_12_WINDOW_SIZE)
{
rcvdHFN = GET_HFN_12_SN(rxDeliv) - 1;
}else
{
rcvdHFN = GET_HFN_12_SN(rxDeliv);
}
pStateVar->rxCount = GET_COUNT_12_SN(rcvdHFN, rcvdSn);
}else if(LEN18BITS == snSize)
{
tmp = GET_SN_18_SN(rxDeliv) - SN_18_WINDOW_SIZE;
if(rcvdSn < tmp)
{
rcvdHFN = GET_HFN_18_SN(rxDeliv) + 1;
}else if(rcvdSn >= GET_SN_18_SN(rxDeliv) + SN_18_WINDOW_SIZE)
{
rcvdHFN = GET_HFN_18_SN(rxDeliv) - 1;
}else
{
rcvdHFN = GET_HFN_18_SN(rxDeliv);
}
pStateVar->rxCount = GET_COUNT_18_SN(rcvdHFN, rcvdSn);
}else
{
pdcpuLog(LOG_ERR,"[PDCPU] sn size is wrong!\n");
return VOS_ERROR;
}
return VOS_OK;
}
INT32 pdcpuCtrlPduProc(MsgbBuff_t *pMsgBuff, PdcpCtrlPduType_e ctrlPduType, PdcpDrbEntity_t *pPdcpDrbEntity)
{
pdcpuMsgbFree(pMsgBuff);
return VOS_OK;
}
INT32 pdcpuDelivUldata(PdcpDrbEntity_t *pDrbEntity)
{
/* traverse list and send data to SDAP */
struct cl_lib_listnode *pNode = NULL;
PdcpuDataBuffNode_t *pDataInBuff1 = NULL;
PdcpuDataBuffNode_t *pDataInBuff2 = NULL;
UINT32 count = 0;
pNode = cl_lib_listhead(pDrbEntity->pRxSduList);
if(NULL == pNode)
{
/* There is no data in buffer */
VOS_Printf("there is no data in buffer\n");
return VOS_OK;
}
pDataInBuff1 = (PdcpuDataBuffNode_t *)cl_lib_getdata(pNode);
if(pDataInBuff1->count == pDrbEntity->stateVar.rxDelivery)
{
while(pNode)
{
cl_lib_nextnode (pNode);
count = pDataInBuff1->count;
/*+++++++++++++++++++++++++++test+++++++++++++++++++++++++++*/
//VOS_Printf("\n[pdcp ul data] pdcpuDelivUldata ueIdx:%d ueE1apId:%d drbId:%d count:%d \n",
// pDrbEntity->ueIdx,pDrbEntity->ueE1apId,pDrbEntity->drbId,count);
//printfMsgbBuff(pDataInBuff1->pData);
/*---------------------------test----------------------------*/
/* delivery to sdap,if sdapUlDataProc return VOS_OK,free the data
else, also free the data */
sdapUlDataProc(pDrbEntity->ueE1apId,pDrbEntity->pduSessionId,pDrbEntity->drbId,pDataInBuff1->pData);
/* update stateVar */
pDrbEntity->stateVar.rxDelivery = count + 1;
/* delete rx buffer */
cl_lib_listnode_delete(pDrbEntity->pRxSduList, pDataInBuff1);
pdcpuFreeDataBuffNode(pDataInBuff1);
if(NULL == pNode)
{
/* There is no more data in buffer */
return VOS_OK;
}
pDataInBuff2 = (PdcpuDataBuffNode_t *)cl_lib_getdata(pNode);
if(NULL == pDataInBuff2)
{
/* There is no more data in buffer */
pdcpuLog(LOG_ERR,"[PDCPU] data is null\n");
return VOS_ERROR;
}
if(pDataInBuff2->count == count + 1)
{
/* The data is continuously */
pDataInBuff1 = pDataInBuff2;
}else if(pDataInBuff2->count > count + 1)
{
/* The data is not continuously */
return VOS_OK;
}else
{
pdcpuLog(LOG_ERR,"[PDCPU] out of order in receiving buffer!\n");
return VOS_ERROR;
}
}
return VOS_OK;
}else if(pDataInBuff1->count > pDrbEntity->stateVar.rxDelivery)
{
/* the data whose count value is equal to rxDelivery,is still waited for */
return VOS_OK;
}else
{
pdcpuLog(LOG_ERR,"[PDCPU] rxbuff is wrong!\n");
return VOS_ERROR;
}
return VOS_OK;
}
/*******************************************************************************
* pdcp-u ul data process
* INPUT:
* ueE1apId: E1AP ID of the UE
* drbId: ID of data radio bearer
* pMsgBuff: SDAP PDU
* OUTPUT:
* 0: success
* -1:failed
*******************************************************************************/
INT32 pdcpuUlDataProc(UINT64 ueE1apId, UINT8 drbId, MsgbBuff_t *pMsgBuff)
{
UINT8 pduType = 0;
UINT32 rcvdSn = 0;
UINT32 count = 0;
INT8 pduHeadLen = 0;
UINT16 ueIdx = 0xffff;
INT32 ret = -1;
PdcpSnSize_e snSize;
PdcpDrbEntity_t *pPdcpDrbEntity = NULL;
PdcpStateVar_t *pStateVar = NULL;
pdcpuNullCheck(pMsgBuff);
UINT8 *pMsgHead = msgbData(pMsgBuff);
UINT16 pduLen = msgbDataUsedLen(pMsgBuff);
if(pduLen<1)
{
pdcpuMsgbFree(pMsgBuff);
pdcpuLog(LOG_ERR,"[PDCPU] data len is too small!\n");
return VOS_ERROR;
}
if(VOS_ERROR == cuupGetUeIdx(ueE1apId, &ueIdx, &gPdcpuUeIdxTable))
{
pdcpuLog(LOG_ERR,"[PDCPU] add ueE1apId failed\n");
pdcpuMsgbFree(pMsgBuff);
return VOS_ERROR;
}
pdcpuGetEntity(ueIdx, drbId, pPdcpDrbEntity);
pdcpuNullCheck(pPdcpDrbEntity);
snSize = pPdcpDrbEntity->pdcpSnSizeUl;
pStateVar = &pPdcpDrbEntity->stateVar;
/* get pdcp pdu type */
BitOpt_t bit;
initBits(&bit, pMsgHead, pduLen, 0);
pduType = unpackBits(&bit, 1);
if(PDCP_DATA_PDU == pduType)
{
//1.analysis pdcp header: shall not move the data start pointer
pduHeadLen = pdcpuUnpackPduHead(pMsgBuff, snSize, &pduType, &rcvdSn);
if(VOS_ERROR == pduHeadLen)
{
pdcpuLog(LOG_ERR,"[PDCPU] unpack pdu head wrong!\n");
pdcpuMsgbFree(pMsgBuff);
return VOS_ERROR;
}
//make sure received HFN and received Count
if(VOS_ERROR == pdcpuDecideCountAndHFN(pStateVar, rcvdSn, snSize))
{
pdcpuLog(LOG_ERR,"[PDCPU] get count wrong!\n");
pdcpuMsgbFree(pMsgBuff);
return VOS_ERROR;
}
count = pStateVar->rxCount;
//2.deciphering : except pdcp pdu head, the SDAP header and the SDAP Control PDU
//get sdap pdu type
BitOpt_t SdapHeadbit;
UINT8 *pSdapPduHead = msgbData(pMsgBuff) + pduHeadLen;
initBits(&SdapHeadbit, pSdapPduHead, 1, 0);
//5.remove pdcp pdu head
msgbHeadPull(pMsgBuff, pduHeadLen);
ret = sdapUlDataProc(ueE1apId,pPdcpDrbEntity->pduSessionId,drbId,pMsgBuff);
pPdcpDrbEntity->stateVar.rxDelivery = count + 1;
if(VOS_OK == ret)
{
pdcpuMsgbFree(pMsgBuff);
return VOS_OK;
}else
{
pdcpuMsgbFree(pMsgBuff);
pdcpuLog(LOG_ERR,"[PDCPU] ul proc failed\n");
return VOS_ERROR;
}
}
return VOS_OK;
}
This diff is collapsed.
include ${G_COMMON_OBJ_DIR_F}
SRC_DIR_UP=$(shell pwd)/PdcpUp/Src
SRC_DIR_CM=$(shell pwd)/Common/Src
M_TARGET=${G_TARGET_DIR}/libPdcp.a
M_SOURCES += $(wildcard *.c $(SRC_DIR_UP)/*.c)
M_SOURCES += $(wildcard *.c $(SRC_DIR_CM)/*.c)
# todo
include ${G_COMPILE_S_LIB_F}
include ${G_COMMON_COMPILE_F}
-include $(M_DEPS)
include ${G_COMMON_OBJ_DIR_F}
SRC_DIR=$(shell pwd)
M_TARGET=${G_TARGET_DIR}/libsdap.a
M_SOURCES += $(SRC_DIR)/sdap/Src/sdapCore.c
M_SOURCES += $(SRC_DIR)/sdap/Src/sdapDataProc.c
include ${G_COMPILE_S_LIB_F}
include ${G_COMMON_COMPILE_F}
-include $(M_DEPS)
/******************************************************************************
**
** Copyright (c) 2021 ICT.
** All rights reserved.
** File name:
** Description:
**
** Current Version:
** Author:
** Date:
** Contact: yuanchunjing@ict.ac.cn
** Note: If you have any difficulties or need help, please contact us
*******************************************************************************/
#include "sdapCore.h"
SdapGlobalDtat_t s_SdapGlobalData[UPC_MAX_UE_NUM] = {{0}};
void sdapResortDrbId(SdapInstance_t *pSdapInstance, int idx)
{
int i = 0;
int j = 0;
for(i = 0; i < pSdapInstance->drbNum; i++)
{
if(i == idx)
{
continue;
}
pSdapInstance->drbId[j] = pSdapInstance->drbId[i];
j++;
}
}
void sdapResortSessionId(SdapGlobalDtat_t *pGlobalData, int idx)
{
int i = 0;
int j = 0;
for(i = 0; i < pGlobalData->sessNum; i++)
{
if(i == idx)
{
continue;
}
pGlobalData->sessId[j] = pGlobalData->sessId[i];
j++;
}
}
SdapGlobalDtat_t* sdapGetUeGlobalData(UINT64 upE1apId, UINT8 *flag)
{
int i = 0;
for(i = 0; i < UPC_MAX_UE_NUM; i++)
{
if(upE1apId == s_SdapGlobalData[i].upE1apId)
{
*flag = 1;
return &s_SdapGlobalData[i];
}
}
for(i = 0; i < UPC_MAX_UE_NUM; i++)
{
if(0 == s_SdapGlobalData[i].upE1apId)
{
*flag = 0;
return &s_SdapGlobalData[i];
}
}
return NULL;
}
#if CONCEPT('Create Instance')
INT32 sdapCreateQosInfo(SdapDrbCfg_t *pDrbCfg, upcTempDrbInfo_t *pTempDrb, SdapDrbCfgRet_t *pDrbCfgRet)
{
int i = 0;
INT64 qosFlowId = 0;
upcTempQosInfo_t *pTempQos;
for(i = 0; i < pTempDrb->qosSetupNum; i++)
{
pTempQos = &pTempDrb->pQosSetupList[i];
if((NULL == pTempQos) || (TRUE != pTempQos->qosSetupAllowed))
{
continue;
}
qosFlowId = pTempQos->qosFlowId;
pDrbCfg->qfi[pDrbCfg->qfiNum] = qosFlowId;
pDrbCfg->qosFlowInfo[qosFlowId].qosFlowLevelQosPar = pTempQos->qosPara;
if(pTempQos->qosMapFlag)
{
pDrbCfg->qosFlowInfo[qosFlowId].qosFlowMapInd = pTempQos->qosFlowMapInd;
}
pDrbCfg->qfiNum++;
pDrbCfgRet->Qfi[pDrbCfgRet->QosNum] = qosFlowId;
pDrbCfgRet->QosNum++;
}
if(0 == pDrbCfg->qfiNum)
{
return VOS_ERROR;
}
return VOS_OK;
}
INT32 sdapCreateDrbInfo(SdapInstance_t *pInstance, upcTempSessInfo_t *pSessTempInfo, sdapSessCfgRet_t *pCfgRet)
{
int i = 0;
UINT64 drbId = 0;
upcTempDrbInfo_t *pTempDrb = NULL;
pInstance->sessId = pSessTempInfo->pduSessId;
pCfgRet->sessId = pInstance->sessId;
for(i = 0; i < pSessTempInfo->drbSetupNum; i++)
{
pTempDrb = &pSessTempInfo->pTempDrbSetupList[i];
if((NULL == pTempDrb) || (TRUE != pTempDrb->drbSetupAllowed))
{
continue;
}
drbId = pTempDrb->drbId;
if(VOS_OK != sdapCreateQosInfo(&pInstance->drbCfg[drbId - 1], pTempDrb, &pCfgRet->actDrbCfg[drbId - 1]))
{
pCfgRet->failDrbId[pCfgRet->failDrbNum] = drbId;
pCfgRet->failDrbNum++;
pCfgRet->cause[drbId - 1] = RNL_UNSPECIFIED;
continue;
}
pCfgRet->actDrbId[pCfgRet->actDrbNum] = drbId;
pCfgRet->actDrbCfg[drbId - 1].drbId = drbId;
pCfgRet->actDrbNum++;
VOS_MemCpy(&pInstance->drbCfg[drbId - 1].sdapCfg, &pTempDrb->sdapConfig, sizeof(SdapCfg_t));
pInstance->drbCfg[drbId - 1].drbId = drbId;
pInstance->drbId[pInstance->drbNum] = drbId;
pInstance->drbNum++;
}
if(0 == pCfgRet->actDrbNum)
{
pCfgRet->sessFailCause = RNL_UNSPECIFIED;
return VOS_ERROR;
}
return VOS_OK;
}
extern INT32 printfSdapNewInstance(SdapGlobalDtat_t *pGlobalData);
extern INT32 sdapInactiveDetectSet(UINT64 ueE1apId);
INT32 sdapCreateNewInstance
(
SdapGlobalDtat_t *pGlobalData,
UINT64 upE1apId,
upcTempSessInfo_t *pSessTempInfo,
sdapSessCfgRet_t *pCfgRet
)
{
int idx = 0;
UINT64 sessId = 0;
pGlobalData->upE1apId = upE1apId;
sessId = pSessTempInfo->pduSessId;
idx = pGlobalData->sessNum;
if(VOS_OK != sdapCreateDrbInfo(&pGlobalData->sdapInstance[sessId], pSessTempInfo, pCfgRet))
{
pCfgRet->sessFailCause = RNL_UNSPECIFIED;
return VOS_ERROR;
}
pGlobalData->sessId[idx] = sessId;
pGlobalData->sessNum++;
printfSdapNewInstance(pGlobalData);
return VOS_OK;
}
INT32 sdapCreateInstance(UINT64 upE1apId, upcTempSessInfo_t *pSessTempInfo, sdapSessCfgRet_t *pCfgRet)
{
INT32 ret = VOS_OK;
UINT8 flag = 0;
SdapGlobalDtat_t *pGlobalData = NULL;
pGlobalData = sdapGetUeGlobalData(upE1apId, &flag);
if(NULL == pGlobalData)
{
pCfgRet->sessFailCause = RNL_UNSPECIFIED;
return VOS_ERROR;
}
/* 1、首次创建,初始化数据
2、只针对E1接口BearerContextSetupReq*/
if(0 == flag)
{
VOS_MemZero(pGlobalData, sizeof(SdapGlobalDtat_t));
}
ret = sdapCreateNewInstance(pGlobalData, upE1apId, pSessTempInfo, pCfgRet);
return ret;
}
#endif
#if CONCEPT('Delete Instance')
INT32 sdapDeleteDrbInfo(SdapInstance_t *pSdapInstance, UINT8 drbId)
{
int i = 0;
for(i = 0; i < pSdapInstance->drbNum; i++)
{
if(drbId == pSdapInstance->drbId[i])
{
sdapResortDrbId(pSdapInstance, i);
pSdapInstance->drbNum--;
VOS_MemZero(&pSdapInstance->drbCfg[drbId - 1], sizeof(SdapDrbCfg_t));
return VOS_OK;
}
}
return VOS_OK;
}
INT32 sdapDeleteDrbInfoOfInstance(UINT64 upE1apId, UINT8 sessId, UINT8 drbId)
{
int i = 0;
UINT8 flag = 0;
SdapGlobalDtat_t *pGlobalData = NULL;
pGlobalData = sdapGetUeGlobalData(upE1apId, &flag);
/* 查找失败也认为是成功的 */
if(NULL == pGlobalData || 0 == flag)
{
return VOS_OK;
}
for(i = 0; i < pGlobalData->sessNum; i++)
{
if(sessId == pGlobalData->sessId[i])
{
sdapDeleteDrbInfo(&pGlobalData->sdapInstance[sessId], drbId);
return VOS_OK;
}
}
return VOS_OK;
}
INT32 sdapDeleteInstance(UINT64 upE1apId, UINT16 sessId)
{
int i = 0;
UINT8 flag = 0;
SdapGlobalDtat_t *pGlobalData = NULL;
pGlobalData = sdapGetUeGlobalData(upE1apId, &flag);
/* 查找失败也认为是成功的 */
if(NULL == pGlobalData || 0 == flag)
{
return VOS_OK;
}
for(i = 0; i < pGlobalData->sessNum; i++)
{
if(sessId == pGlobalData->sessId[i])
{
sdapResortSessionId(pGlobalData, i);
pGlobalData->sessNum--;
VOS_MemZero(&pGlobalData->sdapInstance[sessId], sizeof(SdapInstance_t));
return VOS_OK;
}
}
return VOS_OK;
}
#endif
/******************************************************************************
**
** Copyright (c) 2021 ICT.
** All rights reserved.
** File name:
** Description:
**
** Current Version:
** Author:
** Date:
** Contact: yuanchunjing@ict.ac.cn
** Note: If you have any difficulties or need help, please contact us
*******************************************************************************/
#include "sdapCore.h"
#include "msgb.h"
#include "bitsPack.h"
#include "pdcpuDlDataProc.h"
#include "nguUlDataProc.h"
#include "cuupTest.h"
INT8 sdapMatchQosFlowId(SdapInstance_t *pSdapInstance, INT64 qosFlowId, UINT64 *pDrbId, UINT8 *pFlag)
{
int i = 0;
int j = 0;
UINT64 drbId = 0;
SdapDrbCfg_t sdapDrbCfg = {0};
for(i = 0; i < pSdapInstance->drbNum; i++)
{
drbId = pSdapInstance->drbId[i];
VOS_MemCpy(&sdapDrbCfg, &pSdapInstance->drbCfg[drbId - 1], sizeof(SdapDrbCfg_t));
for(j = 0; j < sdapDrbCfg.qfiNum; j++)
{
if(qosFlowId == sdapDrbCfg.qfi[j])
{
*pDrbId = drbId;
break;
}
}
}
/* 没有查找到DRB,映射到默认的DRB */
if(0 == *pDrbId)
{
for(i = 0; i < pSdapInstance->drbNum; i++)
{
drbId = pSdapInstance->drbId[i];
/* 一个实例,即一个会话内,有且只有一个默认的DRB */
if(DEFAULT_DRB_TRUE == pSdapInstance->drbCfg[drbId - 1].sdapCfg.defaultDrbInd)
{
*pDrbId = drbId;
*pFlag = 1;
break;
}
}
}
return VOS_OK;
}
INT8 sdapPackPduHead(SdapInstance_t *pSdapInstance, INT64 qosFlowId, UINT64 *pDrbId, MsgbBuff_t *pMsgBuff, UINT8 rqi)
{
UINT8 *p= NULL;
UINT64 qosNum = 0;
UINT8 updateFlag = 0;
sdapDlHeader_t sdapHeader = {0};
INT8 pduHeadLen = 0;
if(VOS_OK != sdapMatchQosFlowId(pSdapInstance, qosFlowId, pDrbId, &updateFlag))
{
return VOS_ERROR;
}
if(*pDrbId < 1 || *pDrbId > 32)
{
return VOS_ERROR;
}
/*表明默认DRB上,增加了一条QOS的映射*/
if(1 == updateFlag)
{
qosNum = pSdapInstance->drbCfg[*pDrbId -1].qfiNum;
pSdapInstance->drbCfg[*pDrbId -1].qfi[qosNum] = qosFlowId;
pSdapInstance->drbCfg[*pDrbId -1].qfiNum++;
}
if(SDAP_HEADER_PRESENT == pSdapInstance->drbCfg[*pDrbId - 1].sdapCfg.sdapDlHeaderInd)
{
sdapHeader.QFI = qosFlowId;
if(1 == updateFlag)
{
sdapHeader.RDI = 1;
}
sdapHeader.RQI = rqi;
pduHeadLen = sizeof(sdapDlHeader_t);
p = msgbHeadPush(pMsgBuff, pduHeadLen);
VOS_MemCpy(p, &sdapHeader, pduHeadLen);
return pduHeadLen;
}
/* 没有消息头的配置 */
return 0;
}
INT32 sdapDlDataProc(UINT64 upE1apId, UINT64 sessId, INT64 qosFlowId, MsgbBuff_t *pMsgBuff, UINT8 rqi)
{
int i = 0;
UINT8 flag = 0;
UINT16 sduLen = 0;
INT8 pduHeadLen = 0;
UINT64 drbId = 0;
SdapGlobalDtat_t *pGlobalData = NULL;
SdapInstance_t *pSdapInstance = NULL;
UINT8 *pMsgHead = NULL;
if(NULL == pMsgBuff)
{
return VOS_ERROR;
}
/* Get Instance */
pGlobalData = sdapGetUeGlobalData(upE1apId, &flag);
if(NULL == pGlobalData || 0 == flag)
{
return VOS_ERROR;
}
for(i = 0; i < pGlobalData->sessNum; i++)
{
if(sessId == pGlobalData->sessId[i])
{
pSdapInstance = &pGlobalData->sdapInstance[sessId];
break;
}
}
if(NULL == pSdapInstance)
{
return VOS_ERROR;
}
sduLen = msgbDataUsedLen(pMsgBuff); //length of sdap sdu, not include sdap pdu head
pMsgHead = msgbData(pMsgBuff);//start of sdap sdu, not include sdap pdu head
if(0 > sduLen || NULL == pMsgHead)
{
return VOS_ERROR;
}
pduHeadLen = sdapPackPduHead(pSdapInstance, qosFlowId, &drbId, pMsgBuff, rqi);
if(VOS_ERROR == pduHeadLen)
{
return VOS_ERROR;
}
/*传递到PDCP-U*/
pdcpuDlDataProc(upE1apId, drbId, pMsgBuff, 1);
return VOS_OK;
}
INT8 sdapUnPackPduHead(MsgbBuff_t *pMsgBuff)
{
BitOpt_t bit;
UINT32 bitSize = 0;
UINT8 *pMsgHead = msgbData(pMsgBuff);
UINT16 pduLen = msgbDataUsedLen(pMsgBuff);
initBits(&bit, pMsgHead, pduLen, 0);
/* SDAP头固定长度 1 */
bitSize = SDAP_HEADER_LEN*8;
if(-1 == unpackBits(&bit, bitSize))
{
return VOS_ERROR;
}
return SDAP_HEADER_LEN;
}
INT32 sdapUlDataProc(UINT64 upE1apId, UINT64 sessId, UINT64 drbId, MsgbBuff_t *pMsgBuff)
{
int i = 0;
UINT8 flag = 0;
INT8 pduHeadLen = 0;
sdapUlHeader_t *pHead = NULL;
UINT8 qosFlowId = 0xff;
UINT8 pduType = 0;
SdapGlobalDtat_t *pGlobalData = NULL;
SdapInstance_t *pSdapInstance = NULL;
SdapDrbCfg_t *pDrbCfgInfo = NULL;
if(NULL == pMsgBuff)
{
return VOS_ERROR;
}
/* Get Instance */
pGlobalData = sdapGetUeGlobalData(upE1apId, &flag);
if(NULL == pGlobalData || 0 == flag)
{
return VOS_ERROR;
}
/* get instance */
for(i = 0; i < pGlobalData->sessNum; i++)
{
if(sessId == pGlobalData->sessId[i])
{
pSdapInstance = &pGlobalData->sdapInstance[sessId];
break;
}
}
if(NULL == pSdapInstance)
{
return VOS_ERROR;
}
/* get Drb Cfg */
for(i = 0; i < pSdapInstance->drbNum; i++)
{
if(drbId == pSdapInstance->drbId[i])
{
pDrbCfgInfo = &pSdapInstance->drbCfg[drbId - 1];
break;
}
}
if(NULL == pDrbCfgInfo)
{
return VOS_ERROR;
}
/* 有消息头的情况,去头 */
if(SDAP_HEADER_PRESENT == pDrbCfgInfo->sdapCfg.sdapUlHeaderInd)
{
pduHeadLen = sdapUnPackPduHead(pMsgBuff);
pHead = (sdapUlHeader_t *)msgbData(pMsgBuff);
qosFlowId = pHead->QFI;
pduType = pHead->TYPE;
if(!pduType)
{
/* receive control pdu */
return VOS_OK;
}
/* check qosFlowId */
for(i = 0; i < pDrbCfgInfo->qfiNum; i++)
{
if(pDrbCfgInfo->qfi[i] == qosFlowId)
{
break;
}
}
if(i < pDrbCfgInfo->qfiNum)
{
/* qfi found */
msgbHeadPull(pMsgBuff, pduHeadLen);
}else
{
/* qfi not found */
return VOS_ERROR;
}
}
/* 调用NG-U的上行数据处理接口 */
return nguUlDataProc(upE1apId, sessId, qosFlowId, pMsgBuff);
}
M_SUB_DIRS += Pdcp
M_SUB_DIRS += Sdap
include ${G_COMMON_L1_F}
/******************************************************************************
**
** Copyright (c) 2021 ICT.
** All rights reserved.
** File name:
** Description:
**
** Current Version:
** Author:
** Date:
** Contact: yuanchunjing@ict.ac.cn
** Note: If you have any difficulties or need help, please contact us
*******************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>
#include <getopt.h>
#include "vos_common.h"
#include "vos_time.h"
#include "vos_cli.h"
#include "plat_alarm.h"
#include "plat_db.h"
#include "gnbCommon.h"
#include "cuCommon.h"
#include "omCuupApi.h"
extern UCHAR cuupUnSocketPath[];
INT32 cuupGetSetUpPara(INT32 argc, INT8 **argv)
{
UCHAR *pInt = NULL;
struct option long_options[] =
{
{"startup-item", required_argument, 0, 'i' },
{"version", no_argument, 0, 'v' },
{"help", no_argument, 0, 'h' },
{0, 0, 0, 0 }
};
while (1)
{
int option_index = 0;
int c = getopt_long(argc, argv, "i:vh", long_options, &option_index);
if (c == -1)
{
break;
}
switch (c)
{
case 'i':
pInt = (UCHAR *)cuupUnSocketPath;
break;
case 'v':
exit(0);
break;
case 'h':
exit(0);
default:
return VOS_OK;
}
if (pInt && optarg)
{
sscanf(optarg, "%s", pInt);
VOS_Printf("unSocketPath: %s\n", cuupUnSocketPath);
}
}
return VOS_OK;
}
void cuupAppSigHandler(int sig)
{
VOS_Printf("\r\nReceive signal:%d\r\n",sig);
if(SIGSEGV == sig)
{
if(shm_unlink(CUUP_SHM_FILE) < 0)
{
VOS_Printf("Du_shm Delete CUUP_SHM_FILE shared memory failed !\n ");
return;
}
signal(sig, SIG_DFL);
kill(getpid(), sig);
}
else if(SIGINT == sig)
{
}
else if(SIGABRT == sig)
{
if(shm_unlink(CUUP_SHM_FILE) < 0)
{
VOS_Printf("Du_shm Delete CUUP_SHM_FILE shared memory failed !\n ");
return;
}
}
return;
}
INT32 cuupAppregisterSignal()
{
/*9:SIGSEGV signal*/
if ( Product_Signal( SIGSEGV, 0,cuupAppSigHandler ) == VOS_ERROR )
{
/*commomctrl_om_init_fail_rsp(0);*/
return VOS_ERROR;
}
if ( Product_Signal( SIGINT, 0,cuupAppSigHandler ) == VOS_ERROR )
{
return VOS_ERROR;
}
/*2:capture signal*/
if ( Product_Signal( SIGABRT,0,cuupAppSigHandler ) == VOS_ERROR )
{
/*commomctrl_om_init_fail_rsp(0);*/
return VOS_ERROR;
}
return VOS_OK;
}
/*
function name: main
function: 协议栈入口函数
para: 无
return value: VOS_OK,VOS_ERROR
*/
INT32 main(int argc,INT8 **argv)
{
/*check para*/
CHECK_FUNCTION_RET(cuupGetSetUpPara(argc,argv));
/*init cucp global var*/
CHECK_FUNCTION_RET(cuupAppGlobalVarInit());
/*platform init*/
CHECK_FUNCTION_RET(cuupAppPlatformInit(argv));
/*register signal*/
CHECK_FUNCTION_RET(cuupAppregisterSignal());
/*VOS_TaskInfoAttach 必须在main函数里调用*/
/*omadp vos task create*/
CHECK_FUNCTION_RET(cuupAppOmadpModuleInit());
while(1)
{
sleep(5000);
}
return 0;
}
include ${G_MODULE_CONFIG_F}
M_OBJS_DIR=${G_TARGET_DIR}/app/objs
M_DEPS_DIR=${G_TARGET_DIR}/app/deps
SRC_DIR=$(shell pwd)
M_TARGET = ${G_TARGET_DIR}/CuUpApp
M_S_LIBS += ${G_TARGET_DIR}/libsdap.a
M_S_LIBS += ${G_TARGET_DIR}/libPdcp.a
M_D_LIBS += -lssl
M_D_LIBS += -lcrypto
#把make_config/Makefile改APP下所有的依赖生成的.a都需要增加在该路径下
#M_SOURCES += ${G_ROOT_DIR}/Cu/OamAdp/Src/cuupInit.c
M_SOURCES += $(SRC_DIR)/Src/main.c
include ${G_COMPILE_APP_F}
include ${G_COMMON_COMPILE_F}
-include $(M_DEPS)
M_SUB_DIRS += CuUp
include ${G_COMMON_L1_F}
/******************************************************************************
**
** Copyright (c) 2021 ICT.
** All rights reserved.
** File name:
** Description:
**
** Current Version:
** Author:
** Date:
** Contact: yuanchunjing@ict.ac.cn
** Note: If you have any difficulties or need help, please contact us
*******************************************************************************/
#ifndef __BITS_PACK_H__
#define __BITS_PACK_H__
#include "vos_types.h"
/* Dependencies ------------------------------------------------------------- */
/* Constants ---------------------------------------------------------------- */
/*
* The Bits operation type.
*/
typedef enum bitOptType
{
BIT_PACKED, /* Packed bits. */
BIT_UNPACKED /* Unpacked bits. */
} BitOptType_t;
/* Types -------------------------------------------------------------------- */
/*
* Type of Bits for pack message operation.
*/
typedef struct bitOpt
{
UINT8 *pMsg; /* Point to the message whitch packed or unpacked */
UINT32 bitOffset; /* The bit offset from the start of msg_p. */
UINT32 msgLen; /* The total length of the message. */
} BitOpt_t;
/* Globals ------------------------------------------------------------------ */
extern INT32 unpackBitsWithdebug(BitOpt_t *pBit, UINT32 n,unsigned char *fun, unsigned long line);
extern INT32 packBitsWithdebug(BitOpt_t *pBit, UINT32 n, UINT32 value,unsigned char *fun, unsigned long line);
/* Functions ---------------------------------------------------------------- */
/*******************************************************************************
* Convert length of bits to length of bytes.
*
* Input: bitLen : The lenght of bits.
*
* Output: return the length of bytes.
******************************************************************************/
extern UINT32 convertBitlen2Bytelen(UINT32 bitLen);
/*******************************************************************************
* Get the length of message.
*
* Input: pBit : The pointer to struct bit operation.
*
* Output: return the length of message, or -1 when filed.
******************************************************************************/
extern INT32 getBitsMsgLen(BitOpt_t *pBit, UINT32 optType);
/*******************************************************************************
* Show every bits of memory.
*
* Input: pMsg: The start pointer of memory.
* msgLen: The length of memory.
* lable: The lable of the memory.
*
* Output: None.
******************************************************************************/
extern void showBits(UINT8 *pMsg, UINT32 msgLen, INT8 *name);
/*******************************************************************************
* Initial the struct of BitOpt.
*
* Input: pBit : The pointer to struct bit operation.
* pMsg : Point to the message, that will be packed or unpacked.
* msgLen : The length of message.
* bitOffset : The bit offset from the start of msg_p;
*
* Output: return 0, or -1 when filed.
******************************************************************************/
extern INT32 initBits(BitOpt_t *pBit, UINT8 *pMsg, UINT32 msgLen, UINT8 bitOffset);
/*******************************************************************************
* Skip n bits in packed or unpacked operation. Pack operation, not insure the
* validity of the bits that ware sikped.
*
* Input: pBit : The pointer to struct bit operation.
* n : The number of bits will be skiped.
*
* Output: return 0, or -1 when filed.
******************************************************************************/
extern INT32 skipBits(BitOpt_t *pBit, UINT32 n, UINT8 optType);
/*******************************************************************************
* Unpack n bits from message, not support 32 bits or more.
*
* Input: pBit : The pointer to struct bit operation.
* n : The number of bits will be unpacked.
* msgLen : The length of message.
*
* Output: return the unpacked value, or -1 when error occur.
******************************************************************************/
#define unpackBits(pBit,n) unpackBitsWithdebug(pBit, n,(UCHAR *)__func__,__LINE__)
/*******************************************************************************
* Pack the value into message with n bits, not support more than 32 bits.
*
* Input: pBit : The pointer to struct bit operation.
* n : The number of bits will be packed.
* value : The value need pacded into message.
*
* Output: return the length of message after packed, or -1 when filed.
******************************************************************************/
#define packBits(pBit,n,value) packBitsWithdebug(pBit, n, value,(UCHAR *)__func__,__LINE__)
#endif
/******************************************************************************
**
** Copyright (c) 2021 ICT.
** All rights reserved.
** File name:
** Description:
**
** Current Version:
** Author:
** Date:
** Contact: yuanchunjing@ict.ac.cn
** Note: If you have any difficulties or need help, please contact us
*******************************************************************************/
extern int opt_debug;
#define ASN_DEBUG(fmt, args...) do { \
if(opt_debug < 2) break; \
fprintf(stderr, fmt, ##args); \
fprintf(stderr, " (%s:%d)\n", \
__FILE__, __LINE__); \
} while(0)
/*-
* Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#ifndef ASN1_CONSTRAINTS_VALIDATOR_H
#define ASN1_CONSTRAINTS_VALIDATOR_H
#include "asn_system.h" /* Platform-dependent types */
#ifdef __cplusplus
extern "C" {
#endif
struct asn_TYPE_descriptor_s; /* Forward declaration */
/*
* Validate the structure according to the ASN.1 constraints.
* If errbuf and errlen are given, they shall be pointing to the appropriate
* buffer space and its length before calling this function. Alternatively,
* they could be passed as NULL's. If constraints validation fails,
* errlen will contain the actual number of bytes taken from the errbuf
* to encode an error message (properly 0-terminated).
*
* RETURN VALUES:
* This function returns 0 in case all ASN.1 constraints are met
* and -1 if one or more constraints were failed.
*/
int asn_check_constraints(
const struct asn_TYPE_descriptor_s *type_descriptor,
const void *struct_ptr, /* Target language's structure */
char *errbuf, /* Returned error description */
size_t *errlen /* Length of the error description */
);
/*
* Generic type for constraint checking callback,
* associated with every type descriptor.
*/
typedef int(asn_constr_check_f)(
const struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr,
asn_app_constraint_failed_f *optional_callback, /* Log the error */
void *optional_app_key /* Opaque key passed to a callback */
);
/*******************************
* INTERNALLY USEFUL FUNCTIONS *
*******************************/
asn_constr_check_f asn_generic_no_constraint; /* No constraint whatsoever */
asn_constr_check_f asn_generic_unknown_constraint; /* Not fully supported */
/*
* Invoke the callback with a complete error message.
*/
#define ASN__CTFAIL if(ctfailcb) ctfailcb
#ifdef __cplusplus
}
#endif
#endif /* ASN1_CONSTRAINTS_VALIDATOR_H */
/******************************************************************************
**
** Copyright (c) 2021 ICT.
** All rights reserved.
** File name:
** Description:
**
** Current Version:
** Author:
** Date:
** Contact: yuanchunjing@ict.ac.cn
** Note: If you have any difficulties or need help, please contact us
*******************************************************************************/
#ifndef _CU_COMMON_H_
#define _CU_COMMON_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <netinet/in.h>
#include "gnbCommon.h"
#define MAX_CU_NAME_LEN 256
#define MAX_CUCP_NAME_LEN 256
#define MAX_CUUP_NAME_LEN 256
#define MAX_OM_MSG_BUF_LEN 64
/****************************************oam active message code****************************************/
#define OAM_CU_ACTIVE_BASE 0x7000
#define OAM_CUUP_NET_ELEMENT_ACTIVE_REQ OAM_CU_ACTIVE_BASE + 1
#define OAM_CUCP_NET_ELEMENT_ACTIVE_REQ OAM_CU_ACTIVE_BASE + 2
#define CUCP_OAM_CELL_ACTIVE_RSP OAM_CU_ACTIVE_BASE + 3
#define CUUP_OAM_CELL_ACTIVE_RSP OAM_CU_ACTIVE_BASE + 3
typedef enum
{
MODULE_OM,
MODULE_CUCP_E1,
MODULE_CUUP_E1 ,
MODULE_NG,
MODULE_Xn,
MODULE_F1_C,
MODULE_CUC,
MODULE_RRC,
MODULE_PDCP_C,
MODULE_UPC,
MODULE_NG_U,
MODULE_NG_GTPU,
MODULE_SDAP,
MODULE_F1_U,
MODULE_F1_GTPU,
}CuModule_e;
typedef enum CuCpVosTask
{
CUCP_OMADP_VOS_TASK,
CUC_VOS_TASK,
CUCP_NG_C_VOS_TASK,
CUCP_F1_C_VOS_TASK,
CUCP_E1_VOS_TASK,
#ifdef AMF_TEST
AMF_VOS_TASK,
#endif
CP_MAX_VOS_TASK
}CuCpVosTask_e;
typedef enum CuUpVosTask
{
UP_OMADP_VOS_TASK,
UP_DL_VOS_TASK,
UP_UL_VOS_TASK,
UP_GTPU_VOS_TASK,
UP_MAX_VOS_TASK
}CuUpVosTask_e;
typedef enum
{
CUCP_HOST_TASK,
CUUP_HOST_TASK,
CUUP_DATA_HOST_TASK
}CuHostTask_e;
typedef enum
{
#if 0
CUC_USER_TASK,
CUCP_NG_C_USER_TASK,
CUCP_F1_C_USER_TASK,
CUCP_E1_USER_TASK,
#endif
/*注意:请新增任务定义在注释中间*/
/*注意:请新增任务定义在注释中间*/
CUCP_END_USER_TASK = 100
}CucpUserTask_e;
typedef enum
{
CUUP_BEGIN_USER_TASK=200,
CUUP_UPC_USER_TASK,
CUUP_E1_USER_TASK,
CUUP_NGGTPU_DL_TASK,
CUUP_NGU_DL_TASK,
CUUP_SDAP_DL_TASK,
CUUP_PDCPU_DL_TASK,
CUUP_F1U_DL_TASK,
CUUP_F1GTPU_DL_TASK,
CUUP_NGGTPU_UL_TASK,
CUUP_NGU_UL_TASK,
CUUP_SDAP_UL_TASK,
CUUP_PDCPU_UL_TASK,
CUUP_F1U_UL_TASK,
CUUP_F1GTPU_UL_TASK,
/*注意:请新增任务定义在注释中间*/
CUUP_GTPU_USER_TASK,
CUUP_PDCPU_USER_TASK,
CUUP_SDAP_USER_TASK,
/*注意:请新增任务定义在注释中间*/
CUUP_END_USER_TASK=400,
}CuupUserTask_e;
typedef struct
{
UINT8 cuName[MAX_CU_NAME_LEN]; /* CU Name */
UINT32 nodeID;
IpAddress_t cuIpAddr;
IpAddress_t omIpAddr;
IpAddress_t amfIpAddr;
IpAddress_t umfIpAddr;
IpAddress_t cucpF1SctpIpAddr;
IpAddress_t cuupF1GtpuIpAddr;
IpAddress_t duF1SctpIpAddr;
IpAddress_t duF1GtpuIpAddr;
IpAddress_t cucpE1SctpIpAddr;
IpAddress_t cuupE1SctpIpAddr;
IpAddress_t cucpNgSctpIpAddr;
IpAddress_t cuupNgGtpuIpAddr;
IpAddress_t cuXnSctpIpAddr;
}CuCommCfg_t;
typedef struct
{
UINT8 NodeBName[MAX_CU_NAME_LEN];
UINT32 procId;
UserTaskInfo_t userTaskInfo[MAX_TASK_NUM];
CuCommCfg_t commCfg;
UINT8 cuStackState;
UINT8 omState;
UINT8 printDebug;
UINT8 printLevel;
UINT8 interLogFlag;
} CuCtrlBlock_t;
typedef struct
{
PlmnId_t plmnId;
NrCellId_t CellId[MAX_CELL_NUM];
}CellIdList_t;
typedef struct oamCuUpNetElementActReq
{
UINT8 actCellNum;
CellIdList_t cellIdList;
} OamCuUpNetElementActReq_t;
typedef struct oamCuUpCellActRsp
{
UINT8 successCellNum;
UINT8 failCellNum;
NrCellId_t failCellId[MAX_CELL_NUM];
} OamCuUpCellActRsp_t;
typedef struct oamCuCpNetElementActReq
{
UINT8 cuCpNetElementAct[MAX_CELL_NUM];
} OamCuCpNetElementActReq_t;
typedef struct oamCuCpCellActRsp
{
UINT8 cuCpCellActFlag[MAX_CELL_NUM];
} OamCuCpCellActRsp_t;
typedef enum
{
SRB0 =0 ,
SRB1 = 1,
SRB2 = 2,
SRB3 = 3,
}SRB_e;
#ifdef __cplusplus
}
#endif
#endif /* _CU_COMMON_H_*/
/******************************************************************************
**
** Copyright (c) 2021 ICT.
** All rights reserved.
** File name:
** Description:
**
** Current Version:
** Author:
** Date:
** Contact: yuanchunjing@ict.ac.cn
** Note: If you have any difficulties or need help, please contact us
*******************************************************************************/
#ifndef __CUMODULECOMMONH__
#define __CUMODULECOMMONH__
#ifdef __cplusplus
extern "C" {
#endif
#include "gnbCommon.h"
#include "cuModuleEnum.h"
#define MAX_LENGTH_RAN_NAME 150
#define CU_MAX_PLMN_NUM 6
#define CU_MAX_UES_PER_CELL 32
#define CU_MAX_DU_NUM 2
#define CU_MAX_AMF_NUM 2
#define CU_MAX_UPF_NUM 2
#define CU_MAX_CUUP_NUM 4
#define CU_MAX_CUCP_NUM 2
#define CU_SEC_SNOW3G_ALGO_BITMASK 0x01
#define CU_SEC_AES_ALGO_BITMASK 0x02
#define CU_SEC_ZUC_ALGO_BITMASK 0x03
#define CU_MAX_AS_SEC_ALGOS 4
#define CU_MAX_SNSSAI_NUM 3
typedef enum cuSecAlgo_
{
CU_SEC_NULL_ALGO,
CU_SEC_SNOW3G_ALGO,
CU_SEC_AES_ALGO,
CU_SEC_ZUC_ALGO
} CuSecAlgo_e;
#define CU_INVALID_AP_ID 0xFFFFFFFF;
#define CU_SET_CU_UE_F1AP_ID(_cuUeF1apId,_cellIdx,_ueIdx) CU_SET_TRANS_ID(_cuUeF1apId,_cellIdx,_ueIdx,0)
/* gNB Identity */
typedef UINT32 gNBId_t;
typedef struct
{
PlmnId_t plmnId;
gNBId_t gNBId;
}GlobalRanNodeId_t;
/* Ran name, a string */
typedef struct RanName
{
char nodeName[MAX_LENGTH_RAN_NAME];
}RanName_t;
/* Tracking Area Code */
typedef struct cuTac
{
UINT8 tac[3];
}CuTac_t;
typedef struct cuepsTac_s
{
UINT8 tac[2];
}CuEpsTac_t;
/* S_NSSAI */
#define S_NSSAI_SD_PRESENT (1 << 0)
typedef struct SNssai
{
UINT16 bitMask;
UINT8 sst;
UINT32 sd:24;/*optional*/
}SNssai_t;
typedef struct
{
UINT8 sNssaiNum;
SNssai_t sNssai[CU_MAX_SNSSAI_NUM];
}SliceList_t;
/* time stamp */
typedef struct Timestamp
{
UINT8 timeStamp[4];
}Timestamp_t;
/* NR-CGI */
typedef struct cuNrCgi
{
PlmnId_t plmnId;
NrCellId_t nrCellId;
}CuNrCgi_t;
/* TAI */
typedef struct Tai
{
PlmnId_t plmnId;
CuTac_t tac;
}Tai_t;
/* masked imeisv */
typedef UINT64 MaskedImeiSv_t;
/* UE Identity Index value */
typedef struct UeIdIdxValue
{
UINT16 ueIdIdxValue:10;
}UeIdIdxValue_t;
/* GTP Teid */
typedef UINT32 GtpTeid_t;
typedef struct recomRanGnbId
{
PlmnId_t plmnId;
gNBId_t gNBId;
}RecomRanGnbId_t;
typedef struct transLayerAddr
{
UINT8 transLayerAddress[20];
UINT8 bitStringSize; /* bit string size in bytes */
}TransLayerAddr_t;
typedef struct secuResult
{
IPResult_e integrityProtectionResult;
CPResult_e confidentialityProtectionResult;
} SecuResult_t;
typedef struct gtpTunnel
{
TransLayerAddr_t transLayerAddr;
GtpTeid_t gtpTeid;
} GtpTunnel_t;
typedef struct upTransLayerInfo
{
GtpTunnel_t gtpTunnel;
} UpTransLayerInfo_t;
typedef struct
{
IPIndication_e IPIndication;
CPIndication_e CPIndication;
MaxIpDataRate_e maxIPdataRate;
}SecuInd_t;
#define PRIORITY_LEVEL_QOS_PRESENT (1 << 0)
#define NON_DYNAMIC_AVERAGING_WINDOW_PRESENT (1 << 1)
#define NON_DYNAMIC_MAX_DATA_BURST_VOLUME (1 << 2)
typedef struct nonDynamic5QIDescr
{
UINT16 bitMask;
INT64 fiveQI;
INT64 priorityLevelQos; /* OPTIONAL */
INT64 averagingWindow; /* OPTIONAL */
INT64 maxDataBurstVolume; /* OPTIONAL */
} NonDynamic5QIDescr_t;
typedef struct
{
INT64 perScalar;
INT64 perExponent;
}PackErrorRate_t;
#define FIVEQI_PRESENT (1 << 0)
#define DELAY_CRITICAL_PRESENT (1 << 1)
#define DYNAMIC_AVERAGING_WINDOW_PRESENT (1 << 2)
#define DYNAMIC_MAX_DATA_BURST_VOLUME (1 << 3)
typedef struct dynamic5QIDescr
{
UINT16 bitMask;
INT64 priorityLevelQos;
INT64 packetDelayBudget;
PackErrorRate_t packetErrorRate;
INT64 fiveQI; /* OPTIONAL */
Dynamic5QIDelayCritical_e delayCritical; /* OPTIONAL */
INT64 averagingWindow; /* OPTIONAL */
INT64 maxDataBurstVolume; /* OPTIONAL */
} Dynamic5QIDescr_t;
typedef struct QosCharact
{
QosCharacterPR_e present;
union{
NonDynamic5QIDescr_t nonDynamic5QI;
Dynamic5QIDescr_t dynamic5QI;
}choice;
} QosCharact_t;
typedef struct
{
PriorityLevel_e priorityLevel;
PreEmptionCapability_e pre_emptionCapability;
PreEmptionVulnerability_e pre_emptionVulnerability;
}AllocAndRetenPriority_t;
typedef struct
{
SecuResult_t securityResult;
SecuInd_t securityIndication;
}UserPlaneSecurInfo_t;
#ifdef __cplusplus
}
#endif
#endif
This diff is collapsed.
This diff is collapsed.
/******************************************************************************
**
** Copyright (c) 2021 ICT.
** All rights reserved.
** File name:
** Description:
**
** Current Version:
** Author:
** Date:
** Contact: yuanchunjing@ict.ac.cn
** Note: If you have any difficulties or need help, please contact us
*******************************************************************************/
#ifndef CU_UP_COMMON_H
#define CU_UP_COMMON_H
#include "vos_types.h"
#include "gnbServiceType.h"
#include "cuModuleCommon.h"
#include "cuModuleInterface.h"
#define CUUP_MAX_SESSION_NUM 256
#define CFG_OK 0
#define CFG_FAIL -1
#define SECURITY_PERFORMED 0
#define SECURITY_NOT_PERFORMED 1
#define CUUP_DL_HEAD_LEN 4 // SDAP MAX HEAD 1 + PDCP MAX HEAD +3
#define CUUP_UL_HEAD_LEN 0
#define AS_KEY_LEN 4 //4 bytes
/**
* @brief calc function run time
*/
#define CUUP_CALC_ELAPSED_TIME(func) \
({ \
struct timeval start, end; \
INT64 diff; \
gettimeofday(&start,0); \
func; \
gettimeofday(&end,0); \
diff = ( end.tv_sec*1000000L + end.tv_usec ) \
- ( start.tv_sec*1000000L + start.tv_usec ); \
vos_info_print("func %s spend time = %ld us\n",#func ,diff);\
})
/* brief UE E1AP ID */
typedef UINT32 CuupUeE1apId;
/* brief Session ID */
typedef UINT8 CuupSessionId; /* INTEGER (0 ..255) 38463 */
/* brief Data Radio Bearer ID */
typedef UINT8 CuupDrbId;
/* brief QFI */
typedef UINT8 CuupQFI;
typedef enum
{
PDU_SESSION_ADD, /* SESSION TO SETUP */
PDU_SESSION_MOD, /* SESSION TO MODIFY */
PDU_SESSION_DEL, /* SESSION TO DELETE */
DRB_DEL, /* DRB TO DELETE */
UE_RELEASE
}UpcCfgType_e;
typedef struct
{
UINT64 ueE1apId;
UINT8 drbId;
}drbToDel_t;
typedef struct
{
UpcCfgType_e cfgType;
UINT16 pduSessionId;
INT8 cfgResult; //will be removed
UINT32 nggtpuTeid;
TransLayerAddr_t nggtpuAddr;
E1apCause_e failureCause;
}NguCfgResult_t;
typedef struct
{
UINT8 drbId;
E1apCause_e cause;
}DrbFailedCause_t;
typedef struct
{
UpcCfgType_e cfgType;
UINT8 secResPresent;
SecuResult_t secuResult;
UINT16 pduSessionId;
UINT8 drbSetupSuccessNum;
UINT8 drbSetupSuccessArray[MAX_DRB_NUM];
UINT8 drbSetupFailNum;
DrbFailedCause_t drbSetupFailedArray[MAX_DRB_NUM];
UINT8 drbModifySuccessNum;
UINT8 drbModifySuccessArray[MAX_DRB_NUM];
UINT8 drbModifyFailNum;
DrbFailedCause_t drbModifyFailedArray[MAX_DRB_NUM];
E1apCause_e pduSessionCause;
}PdcpuCfgResult_t;
typedef struct
{
UINT8 drbId;
UINT32 f1gtpuTeid;
TransLayerAddr_t gtpuAddr;
}Cuf1uSetupInfo_t;
typedef struct
{
UpcCfgType_e cfgType;
UINT16 pduSessionId;
UINT8 drbSetupSuccessNum;
Cuf1uSetupInfo_t drbSetupSuccessArray[MAX_DRB_NUM];
UINT8 drbSetupFailNum;
DrbFailedCause_t drbSetupFailedArray[MAX_DRB_NUM];
UINT8 drbModifySuccessNum;
UINT8 drbModifySuccessArray[MAX_DRB_NUM];
UINT8 drbModifyFailNum;
DrbFailedCause_t drbModifyFailedArray[MAX_DRB_NUM];
E1apCause_e pduSessionCause;
}Cuf1uCfgResult_t;
typedef enum
{
CUUP_BEARER_NORMAL,
CUUP_BERAER_SUSPEND,
CUUP_DETECT_DL_DATA /* in suspend, ngu recv dl data */
}CuupBearerStatus_e;
typedef struct bearerCxtInactive_s
{
CuupUeE1apId ueId;
UINT8 tag;
union {
E1apDrbActivityList_t drbActivityList;
E1apPduSessionActivityList_t pduSessionActivityList;
E1apUeActivity_t ueActivity;
}u;
}BearerCxtInactive_t;
extern INT32 ifmUpcBearerCxtInactiveNotification(BearerCxtInactive_t *bearerCxtInactive);
extern INT32 ifmUpcDlDataNotification(UINT64 ueE1apId, UINT8 PPI);
#endif /* CU_UP_COMMON_H */
/******************************************************************************
**
** Copyright (c) 2021 ICT.
** All rights reserved.
** File name:
** Description:
**
** Current Version:
** Author:
** Date:
** Contact: yuanchunjing@ict.ac.cn
** Note: If you have any difficulties or need help, please contact us
*******************************************************************************/
#ifndef __CUUPPROTOCOLPARA_H__
#define __CUUPPROTOCOLPARA_H__
#include "vos_lib.h"
#pragma pack(1)
/*******************************CUUP基本信息***********************************/
#define CUUP_NAME_MAX_LEN 32
typedef struct CuupBasicInfoCfg_s
{
UINT64 gnbCuupId;
UCHAR gnbCuupName[CUUP_NAME_MAX_LEN];
UINT8 cnSupportType;//ENUMERATED (EPC,5GC,both)
UINT8 cuupCapacity_presence;//cuupCapacity配置标志位
UINT8 cuupCapacity;//取值范围(0…255)
}cuupBasicInfoCfg_t;
/**********************************IP信息**************************************/
#define MAX_CUUP_IPV6_ADDR_LEN 40
#define MAX_CUUP_IPV4_ADDR_LEN 16
#define MAX_NROF_CUUP_CUC_IP_ADDR 5
#define MAX_NROF_CUUP_CUUP_IP_ADDR 5
typedef struct CuupIpAddrList_s
{
UINT8 ipType;
UINT32 port;
char ipv4Address[MAX_CUUP_IPV4_ADDR_LEN];
char ipv6Address[MAX_CUUP_IPV6_ADDR_LEN];
}cuupIpAddrList_t;
typedef struct CuupIpInfoList_s
{
UINT8 cucIpAddrNum;
cuupIpAddrList_t cucIpList[MAX_NROF_CUUP_CUC_IP_ADDR];
UINT8 cuupIpAddrNum;
cuupIpAddrList_t cuupIpList[MAX_NROF_CUUP_CUUP_IP_ADDR];
}cuupIpInfoList_t;
/**********************************PLMN信息表**************************************/
#define MAX_CUUP_NROF_PLMN 5//12
#define CU_MCC_LEN 3
#define CU_MAX_MNC_LEN 3
typedef struct CuupPlmnIdList_s
{
UINT8 MCC_Presence;//MCC配置标志位
UINT8 MCC[CU_MCC_LEN];
UINT8 mncNum;//取值2或者3
UINT8 MNC[CU_MAX_MNC_LEN];
}cuupPlmnIdList_t;
typedef struct CuupPlmnIdInfo_s
{
UINT8 plmnIdNum;//取值范围1...12(协议规定),目前暂定取值范围1...5
cuupPlmnIdList_t plmnIdList[MAX_CUUP_NROF_PLMN];
}cuupPlmnIdInfo_t;
/**********************************E1接口信息***********************************/
#define MAX_NROF_NG_RAN_QOS_PARAMETER 1//256协议规定
typedef struct qosSupportInfo_s
{
UINT8 plmnIdx;
UINT8 fiveQI;//取值范围:0~255
UINT8 qoSPrirotyLevel_presence;//qoSPrirotyLevel配置标志位
UINT8 qoSPrirotyLevel;//取值范围:0~127
UINT8 averagingWindow_presence;//averagingWindow配置标志位
UINT16 averagingWindow;//取值范围:0~4095
UINT16 maxDataBurstVolume_presence;//maxDataBurstVolume配置标志位
UINT16 maxDataBurstVolume;//取值范围:0~4095
}qosSupportInfo_t;
typedef struct ngranQosSupportList_s
{
UINT8 qosSupportNum;
qosSupportInfo_t qosSupportInfo[MAX_NROF_NG_RAN_QOS_PARAMETER];
}ngranQosSupportList_t;
/**********************************切片信息***********************************/
#define MAX_NROF_SLICE_SUPPORTED 3
typedef struct SliceSupportInfo_s
{
UINT8 PlmnIdx;
UINT8 SST; //为了支持网络切片,与SD字段可以组成S-NSSAI
UINT8 SD_presence;//SD配置标志位
UINT32 SD:24;
}sliceSupportInfo_t;
typedef struct SliceSupportList_s
{
UINT8 sliceSupportNum;//取值范围1--1024(协议规定),目前取值范围1...3
sliceSupportInfo_t sliceSupportInfo[MAX_NROF_SLICE_SUPPORTED];
}sliceSupportList_t;
/**********************************UP支持的小区ID列表****************************/
#define MAX_NROF_CUUP_SUPPORT_CELL 10//512
typedef struct cellIdSupportInfo_s
{
UINT8 plmnIdx;
UINT64 cellGlobalId;
}cellIdSupportInfo_t;
typedef struct cellIdSupportList_s
{
UINT8 cellSupportNum;//取值范围0--512(协议规定),目前取值范围0...10
cellIdSupportInfo_t cellIdInfo[MAX_NROF_CUUP_SUPPORT_CELL];
}cellIdSupportList_t;
#pragma pack()
#endif
/******************************************************************************
**
** Copyright (c) 2021 ICT.
** All rights reserved.
** File name:
** Description:
**
** Current Version:
** Author:
** Date:
** Contact: yuanchunjing@ict.ac.cn
** Note: If you have any difficulties or need help, please contact us
*******************************************************************************/
#ifndef CUUP_TEST_H
#define CUUP_TEST_H
#include "vos_socket.h"
#include "pdcpu.h"
#include "ngu.h"
#include "cuupCommon.h"
#include "f1uCommon.h"
#include "gtpCommon.h"
#include "cuupUeIdTransf.h"
#include "msgb.h"
#include "sdapCore.h"
extern INT32 printfTransLayerAddr(TransLayerAddr_t *pAddr);
extern INT32 printfNguInstance(NguInstance_t *pNguInstance);
extern INT32 printfNguCfgResult(NguCfgResult_t *pCfg);
extern INT32 printfDrbEntity(PdcpDrbEntity_t *pEntity);
extern INT32 printfPdcpuCfgResult(PdcpuCfgResult_t *pResult);
extern INT32 printfCuf1uInstance(Cuf1uInstance_t *pF1u);
extern INT32 printfCuf1uCfgResult(Cuf1uCfgResult_t *pResult);
extern INT32 printfPdcpuSecInfo(PdcpuSecInfo_t *pSec);
extern INT32 printfVosSockAddr(vos_sockaddr_t *pAddr);
extern INT32 printfTun(Tun_t *pTun);
extern INT32 printfPdcpuSecEnableInfo(PdcpuSecEnableInfo_t *pInfo);
extern INT32 printfCuupUeIdxTable(CuupUeIdxTable_t *pTable);
extern INT32 printfMsgbBuff(MsgbBuff_t *pMsgBuff);
extern INT32 printfExPduInfo(ExPduInfo_t *pPdu);
#endif /* CUUP_TEST_H */
/******************************************************************************
**
** Copyright (c) 2021 ICT.
** All rights reserved.
** File name:
** Description:
**
** Current Version:
** Author:
** Date:
** Contact: yuanchunjing@ict.ac.cn
** Note: If you have any difficulties or need help, please contact us
*******************************************************************************/
#ifndef CUUP_UE_INFO_H
#define CUUP_UE_INFO_H
#include "vos_types.h"
#include "vos_lib.h"
#define FALSE 0
#define TRUE 1
#define MAX_UE_NUM 42
typedef struct cuupUeIdxInfo
{
UINT8 isUsed; /* TRUE:used, FALSE: not used */
UINT16 ueIdx;
UINT64 ueE1apId;
}CuupUeIdxInfo_t;
typedef struct cuupUeIdxTable
{
CuupUeIdxInfo_t ueIdxInfo[MAX_UE_NUM];
}CuupUeIdxTable_t;
extern INT32 cuupAddUeE1apid(UINT64 ueE1apId, UINT16 *ueIdx, CuupUeIdxTable_t *pTable);
extern INT32 cuupDelUeIdx(UINT16 ueIdx, CuupUeIdxTable_t *pTable);
extern INT32 cuupGetUeIdx(UINT64 ueE1apId, UINT16 *ueIdx, CuupUeIdxTable_t *pTable);
#endif /* CUUP_UE_INFO_H */
/******************************************************************************
**
** Copyright (c) 2021 ICT.
** All rights reserved.
** File name:
** Description:
**
** Current Version:
** Author:
** Date:
** Contact: yuanchunjing@ict.ac.cn
** Note: If you have any difficulties or need help, please contact us
*******************************************************************************/
#ifndef F1U_COMMON_H
#define F1U_COMMON_H
#include "gnbCommon.h"
#define DL_USER_DATA 0
#define DL_DATA_DELIVERY_STATUS 1
#define CUF1U_PDU_SESSION_MAX_NUM 256
typedef enum{
LEN_12_BITS = 0,
LEN_18_BITS = 1
}PDCPSnSize_e;
/* CU-F1-U instance */
typedef struct {
UINT64 ueE1apId;
UINT16 ueIdx;
UINT8 drbId;
UINT16 pduSessionId;
UINT32 nextSubmitSn;
PDCPSnSize_e pdcpSnSize;
UINT32 ownTeid; /* Local teid */
}Cuf1uInstance_t;
#endif /* F1U_COMMON_H */
This diff is collapsed.
/******************************************************************************
**
** Copyright (c) 2021 ICT.
** All rights reserved.
** File name:
** Description:
**
** Current Version:
** Author:
** Date:
** Contact: yuanchunjing@ict.ac.cn
** Note: If you have any difficulties or need help, please contact us
*******************************************************************************/
#ifndef __GNB_COMM_TYPE_H__
#define __GNB_COMM_TYPE_H__
/** @brief max cell num */
#define MAX_CELL_NUM 4
/** @brief max cell id */
#define MAX_CELL_ID (MAX_CELL_NUM - 1)
/** @brief max ue num */
#define MAX_UE_NUM 42
#define MAX_UE_NUM_PER_CELL 21
/** @brief max ue id */
#define MAX_UE_ID (MAX_UE_NUM - 1)
/** @brief max drb num */
#define MAX_DRB_NUM 33
/** @brief max drb id */
#define MAX_DRB_ID (MAX_DRB_NUM - 1)
/** @brief max srb num */
#define MAX_SRB_NUM 4
/** @brief max srb id */
#define MAX_SRB_ID (MAX_SRB_NUM - 1)
/** @brief max logical channel num */
#define MAX_LCH_NUM 33
#define MAX_PLMN_ID_NUM 8
/** @brief tunnel port */
#define TUNNEL_PORT 2152
#define MAX_PDU_SESSION_NUM (10)
#define MAC_CU_DU_TNL_ASSOC_NUM (32)
/** @brief Cell ID */
typedef UINT16 CmNrCellId;
/** @brief RNTI */
typedef UINT16 CmNrRnti;
/** @brief I-RNTI */
typedef UINT64 CmNrIRnti;
/** @brief Ue Id */
typedef UINT16 CmNrUeId;
/** @brief Radio Bearer ID */
typedef UINT8 CmNrRbId;
/** @brief Logical Channel Type */
typedef UINT8 CmNrLcType;
/** @brief Radio Bearer ID */
typedef UINT8 CmNrRbId;
/** @brief Mode Type TM/UM/AM */
typedef UINT8 CmNrRlcMode;
/** @brief Logical Channel ID */
typedef UINT8 CmNrLcId;
/** @brief Logical Channel Type */
typedef UINT8 CmNrLcType;
/** @brief Sn bits*/
typedef UINT8 CmRlcSnLen;
/*见协议38401 8.5 F1 Startup and cells activation*/
typedef enum
{
CELL_ACTIVE_STATE,
CELL_INACTIVE_STATE,
}CellState_e;
typedef struct PlmnId
{
UINT8 mcc2:4;
UINT8 mcc1:4;
UINT8 mnc3:4;
UINT8 mcc3:4;
UINT8 mnc2:4;
UINT8 mnc1:4;
} PlmnId_t;
/* NR CELL Identity */
typedef struct NrCellId
{
UINT64 cellId:36;
}NrCellId_t;
#define TRACKING_AREA_CODE (1<<0)
#define RANRC (1<<1)
typedef struct plmnInformation
{
UINT16 bitMask;
UINT8 plmnIdNum;
PlmnId_t plmnId[MAX_PLMN_ID_NUM];
UINT32 trackingAreaCode; /*option*/
UINT8 ranac; /*option*/
UINT64 cellIdentity;
BOOL cellReservedForOperatorUse;
} PlmnInformation_t;
typedef struct
{
PlmnId_t plmn;
UINT64 cellId;
} GnbNrCgi_t;
typedef struct
{
PlmnId_t plmn;
}GnbServedPlmn_t;
/** @brief SRBID */
typedef LONG GnbSrbId_t;//9.3.1.7
/** @brief DRB ID */
typedef LONG GnbDrbId_t;
/** @brief Transaction ID */
typedef LONG GnbTransId;
/** @brief gND DU ID */
typedef LONG GnbDuId;
/** @brief gND CU ID */
typedef LONG GnbCuId;
#endif
/******************************************************************************
**
** Copyright (c) 2021 ICT.
** All rights reserved.
** File name:
** Description:
**
** Current Version:
** Author:
** Date:
** Contact: yuanchunjing@ict.ac.cn
** Note: If you have any difficulties or need help, please contact us
*******************************************************************************/
#ifndef GTPU_COMMON_H
#define GTPU_COMMON_H
#include <sys/socket.h>
#include <netinet/in.h>
#include "vos_lib.h"
#include "vos_linklist.h"
#include "vos_types.h"
#include "plat_syslog.h"
#include "vos_sockMgr.h"
#include "vos_module.h"
#include "gnbCommon.h"
#include "msgb.h"
#define GTP_MAX_TUN_NUM 100
#define GTPU_MODULE 1 /* just for compile */
#define GTP_MAX_DATA_LEN 8000
#define GTP_HEADER_SIZE_SHORT 8
#define GTP_HEADER_SIZE_LONG 12
/* GTP version 1 extension header type definitions. */
#define GTP_EXT_PDCP_PDU 0xC0 /* PDCP PDU Number */
#define GTP_EXT_RAN_CONTAINER 0X81 /* RAN Container */
#define GTP_EXT_NRRAN_CONTAINER 0X84 /* NR RAN Container */
#define GTP_EXT_PDUSESSION_CONTAINER 0X85 /* PDU Session Container */
#define GTP_ECHO_REQ 1 /* Echo Request */
#define GTP_ECHO_RSP 2 /* Echo Response */
#define GTP_NOT_SUPPORTED 3 /* Version Not Supported */
#define GTP_ERROR 26 /* Error Indication */
#define GTP_SUPP_EXT_HEADER 31 /* Supported Extension Headers Notification */
#define GTP_GPDU 255 /* G-PDU */
#define GTP_END_MARKER 254
/* for f1u pdu */
#define GTP_DLUSERDATA_EX_LEN 2
#define GTP_DLUSERDATA_BYTES_LEN 8
#define GTP_DDDS_EX_LEN 6
#define GTP_DDDS_BYTES_LEN 24
/* for ngu pdu */
#define GTP_DLPDUSESSION_EX_LEN 2
#define GTP_DLPDUSESSION_BYTES_LEN 8
#define GTP_ULPDUSESSION_EX_LEN 1
#define GTP_ULPDUSESSION_BYTES_LEN 4
#define GTP_EXHEAD_LEN 256
#define PATH_DETECT_TIMER 60 /* detect path every 60 seconds */
#define T3RESPONSE_TIMER 3 /* T3-RESPONSE timer defaults to 1 second */
#define N3REQUESTS 5 /* max times of retransmssion of echo quest */
#define GTPU_ENTITY_NUM 2 /* CUGTPU+DUGTPU */
#define gtpLog(iLog_Level, gtp, content, arg...) \
{\
if(NULL != gtp)\
{\
VOS_SysLog(gtp->userModuleID, iLog_Level, __FILE__, __LINE__, __func__, content, ##arg);\
}else\
{\
vos_err_print("gtp entity is NULL!\n");\
}\
}
#if 0
#define gtpNullCheck(p,gtp) \
{\
if(NULL == p)\
{\
gtpLog(LOG_ERR,gtp,"[GTPU] NULL pointer\n");\
return VOS_ERROR;\
}\
}
#endif
typedef enum
{
CU_GTPU,
DU_GTPU
}GtpType_e;
typedef enum
{
CU_NG_TUNNEL,
CU_F1_TUNNEL,
DU_TUNNEL
}TunnelType_e;
typedef enum
{
TUNNEL_INACTIVE = 0,
TUNNEL_ACTIVE
}TunnelStatus_e;
/* GTP-U header definitions */
typedef struct
{ /* Descriptions from 3GPP 29060 */
UINT8 pn :1; /* .......0 PN: N-PDU Number flag */
UINT8 s :1; /* ......0. Sequence number flag: 0 */
UINT8 e :1; /* .....0.. Extension header flag: 0 */
UINT8 spare :1; /* ....0... Spare = 0 */
UINT8 pt :1; /* ...1.... Protocol Type: GTP=1, GTP'=0 */
UINT8 ver :3; /* 001..... Version: 1 */
UINT8 type; /* 02 Message type. T-PDU = 0xff */
UINT16 length; /* 03 Length (of IP packet or signalling) */
UINT32 tei; /* 05 - 08 Tunnel Endpoint ID */
} GtpHeadShort_t;
typedef struct
{ /* Descriptions from 3GPP 29060 */
UINT8 pn :1; /* .......0 PN: N-PDU Number flag */
UINT8 s :1; /* ......0. Sequence number flag: 0 */
UINT8 e :1; /* .....0.. Extension header flag: 0 */
UINT8 spare :1; /* ....0... Spare = 0 */
UINT8 pt :1; /* ...1.... Protocol Type: GTP=1, GTP'=0 */
UINT8 ver :3; /* 001..... Version: 1 */
UINT8 type; /* 02 Message type. T-PDU = 0xff */
UINT16 length; /* 03 Length (of IP packet or signalling) */
UINT32 tei; /* 05 - 08 Tunnel Endpoint ID */
UINT16 seq; /* 09 - 10 Sequence Number */
UINT8 npdu; /* 11 N-PDU Number */
UINT8 next; /* 12 Next extension header type. Empty = 0 */
}GtpHeadLong_t;
struct gtpExtHead{
uint8_t type;
uint8_t len;
uint8_t data[];
} __attribute__((packed));
#define GTP_EXTHDR(buf) ((struct gtpExtHead *)buf)
#define GTP_LHDR(buf) ((GtpHeadLong_t *)buf)
#define GTP_FIRSTHDR(buf) ((GTP_LHDR(buf)->length >= 5 && \
GTP_LHDR(buf)->next) ? \
(struct gtpExtHead *)&GTP_LHDR(buf)->next : NULL)
#define GTP_NXTHDR(buf, ext) \
(ext == NULL ? GTP_FIRSTHDR(buf) : \
((uint8_t *)&ext->len + ext->len * 4 - \
(uint8_t *)&GTP_LHDR(buf)->seq) > \
GTP_LHDR(buf)->length ? \
NULL : *((uint8_t *)&ext->len + ext->len * 4 - 1) ? \
(struct gtpExtHead *)((uint8_t *)&ext->len + \
ext->len * 4 - 1) : NULL)
#define GTP_EXTDATA(buf) (GTP_LHDR(buf)->data)
/* GTP-U packet */
typedef struct
{
GtpHeadShort_t h;
UINT8 p[GTP_MAX_DATA_LEN]; /* store data */
}GtpPacketShort_t;
typedef struct
{
GtpHeadLong_t h;
UINT8 p[GTP_MAX_DATA_LEN]; /* store data */
}GtpPacketLong_t;
union gtpPacket
{
GtpPacketShort_t gtps;
GtpPacketLong_t gtpl;
};
/* GTP-U tunnels management structures */
typedef struct tun
{
TunnelStatus_e tunState; /* 0 for suspend, others are active */
UINT16 seq; /* G-PUD Sequence number counter */
UINT32 tunId;
UINT32 ownTeid; /* own TEID */
UINT32 remTeid; /* remote TEID */
vos_sock_info_t tunOpval; /* Address packet was sent to / received from */
TunnelType_e tunType;
} Tun_t;
typedef struct gtpMsg
{
UINT16 seq; /* The sequence number */
UINT8 type; /* The type of packet */
UINT32 l; /* Length of the packet */
union gtpPacket p; /* The packet stored */
vos_sock_info_t *pOpval; /* Address packet was sent to / received from */
time_t timeout; /* When do we retransmit this packet? */
UINT8 retrans; /* How many times did we retransmit this? */
}GtpMsgNode_t;
/* GTP-U Protocol entity */
typedef struct
{
GtpType_e gtpId;
ULONG userModuleID;
/* Parameters related to the network INT32erface */
vos_sockaddr_t localAddr; /* Local IP address for signaling and G-PDU */
/* Parameters related to signaling messages */
UINT16 seq_next; /* Next sequence number to use */
UINT8 restart_counter; /* Increment on restart. */
plist pReqMsgList; /* list header */
Tun_t *tuns[GTP_MAX_TUN_NUM]; /* store memory,use TEID_OWN assignment */
/* Counters ,some of them may not be used. */
UINT32 err_socket; /* Number of socket errors */
UINT32 err_readfrom; /* Number of readfrom errors */
UINT32 err_sendto; /* Number of sendto errors */
UINT32 err_memcpy; /* Number of memcpy */
UINT32 err_seq; /* Number of seq out of range */
UINT32 err_cause; /* Unexpected cause value received */
UINT32 empty; /* Number of empty packets */
UINT32 unsup; /* Number of unsupported version 29.60 11.1.1 */
UINT32 tooshort; /* Number of too short headers 29.60 11.1.2 */
UINT32 unknown; /* Number of unknown messages 29.60 11.1.3 */
UINT32 nu_rabid; /* Number of unknown RAD ID message */
UINT32 unexpect; /* Number of unexpected messages 29.60 11.1.4 */
UINT32 duplicate; /* Number of duplicate or unsolicited replies */
UINT32 missing; /* Number of missing information field messages */
UINT32 incorrect; /* Number of incorrect information field messages */
UINT32 invalid; /* Number of invalid message format messages */
} Gtp_t;
typedef struct
{
UINT8 *pPdu; /* length, content, next extension type */
UINT16 len; /* len = exHeaderLen * 4 */
UINT16 exHdrLen;
UINT8 exHdrType;
}ExPduInfo_t;
/* log level */
typedef enum gtpuLogLevel
{
GTPULOG_CRIT = 1, ///< critical conditions
GTPULOG_ERR, ///< error conditions
GTPULOG_WARNING, ///< warning conditions
GTPULOG_INFO, ///< informational
GTPULOG_DEBUG, ///< debug info
} GtpuLogLevel_e;
/* struct for gtpu receive data */
typedef struct
{
vos_sock_info_t op;
MsgbBuff_t *pData;
}GtpuRecvUdpInfo_t;
typedef struct
{
UINT32 tunId;
MsgbBuff_t *pMsgBuff;
ExPduInfo_t *pExPduInfo;
}GpduInfo_t;
typedef INT32 (* GtpuDataProcFn)(GpduInfo_t *pInfo);
typedef struct
{
GtpuDataProcFn action_fn_p;
}GtpuGpduHandler_t;
//check teid
#define gtpCheckTeid(n) if(n<0 || n>GTP_MAX_TUN_NUM) {vos_err_print(#n" is wrong\r\n");return VOS_ERROR;}
#endif /* GTPU_COMMON_H */
/******************************************************************************
**
** Copyright (c) 2021 ICT.
** All rights reserved.
** File name:
** Description:
**
** Current Version:
** Author:
** Date:
** Contact: yuanchunjing@ict.ac.cn
** Note: If you have any difficulties or need help, please contact us
*******************************************************************************/
#ifndef MSGB_H
#define MSGB_H
#include "vos_lib.h"
#include "vos_types.h"
#include "vos_string.h"
extern ULONG gMsgbFreeCount;
typedef struct
{
UINT16 maxHeadLen; /* Head域预留的长度 */
UINT16 maxDataLen; /* Data域预留的长度 */
UINT16 headSpareLen; /* Head域空闲的长度 */
UINT16 tailOffset; /* 数据尾端到dataBuff[]起始位置的距离,包括1.整个Head域 2.Data域的使用部分 */
}MsgbInfo_t;
typedef struct
{
MsgbInfo_t msgbInfo;
UINT8 dataBuff[0]; /* DataBuff域的起始地址,指向msgbInfo变量后面的地址,该成员不占用内存 */
}MsgbBuff_t;
INT32 msgbCheck(MsgbBuff_t *pMsgBuff);
MsgbBuff_t *msgbAllocWithDebug(UINT16 dataLen, UINT16 maxHeadLen, ULONG moduleId,unsigned char *file, unsigned long line);
UINT8 *msgbDataWithDebug(MsgbBuff_t *pMsgBuff,unsigned char *fun, unsigned long line);
UINT8 *msgbTailWithDebug(MsgbBuff_t *pMsgBuff,unsigned char *fun, unsigned long line);
UINT16 msgbDataUsedLenWithDebug(MsgbBuff_t *pMsgBuff,unsigned char *fun, unsigned long line);
UINT16 msgbDataAllocLenWithDebug(MsgbBuff_t *pMsgBuff,unsigned char *fun, unsigned long line);
UINT8 *msgbHeadPushWithDebug(MsgbBuff_t *pMsgBuff, UINT32 len,unsigned char *fun, unsigned long line);
UINT8 *msgbHeadPullWithDebug(MsgbBuff_t *pMsgBuff, UINT32 len,unsigned char *fun, unsigned long line);
UINT8 *msgbTailPushWithDebug(MsgbBuff_t *pMsgBuff, UINT32 len,unsigned char *fun, unsigned long line);
UINT8 *msgbTailPullWithDebug(MsgbBuff_t *pMsgBuff, UINT32 len,unsigned char *fun, unsigned long line);
#define msgbAlloc( dataLen, maxHeadLen, moduleId) msgbAllocWithDebug( dataLen, maxHeadLen, moduleId,(UCHAR *)__func__,__LINE__)
#define msgbData(pMsgBuff) msgbDataWithDebug(pMsgBuff,(UCHAR *)__func__,__LINE__)
#define msgbTail(pMsgBuff) msgbTailWithDebug(pMsgBuff,(UCHAR *)__func__,__LINE__)
#define msgbDataUsedLen(pMsgBuff) msgbDataUsedLenWithDebug(pMsgBuff,(UCHAR *)__func__,__LINE__)
#define msgbDataAllocLen(pMsgBuff) msgbDataAllocLenWithDebug(pMsgBuff,(UCHAR *)__func__,__LINE__)
extern UINT16 msgbHeadLeftRoom(MsgbBuff_t *pMsgBuff);
extern UINT16 msgbTailLeftRoom(MsgbBuff_t *pMsgBuff);
#define msgbFree(pMsgBuff)\
({\
if(NULL == pMsgBuff)\
{\
vos_err_print("input is NULL!\n");\
}\
VOS_Free(pMsgBuff);\
gMsgbFreeCount++;\
})
#define msgbHeadPush(pMsgBuff, len) msgbHeadPushWithDebug(pMsgBuff, len,(UCHAR *)__func__,__LINE__)
#define msgbHeadPull(pMsgBuff, len) msgbHeadPullWithDebug(pMsgBuff, len,(UCHAR *)__func__,__LINE__)
#define msgbTailPush(pMsgBuff, len) msgbTailPushWithDebug(pMsgBuff, len,(UCHAR *)__func__,__LINE__)
#define msgbTailPull(pMsgBuff, len) msgbTailPullWithDebug(pMsgBuff, len,(UCHAR *)__func__,__LINE__)
#endif /* MSGB_H */
This diff is collapsed.
This diff is collapsed.
/******************************************************************************
**
** Copyright (c) 2021 ICT.
** All rights reserved.
** File name:
** Description:
**
** Current Version:
** Author:
** Date:
** Contact: yuanchunjing@ict.ac.cn
** Note: If you have any difficulties or need help, please contact us
*******************************************************************************/
#ifndef NGU_UL_DATA_PROC_H
#define NGU_UL_DATA_PROC_H
#include "cuupCommon.h"
#include "msgb.h"
extern INT32 nguUlDataProc(UINT64 ueE1apId, UINT16 pduSessionId, UINT8 qfi, MsgbBuff_t *pMsgBuff);
#endif /* NGU_UL_DATA_PROC_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/******************************************************************************
**
** Copyright (c) 2021 ICT.
** All rights reserved.
** File name:
** Description:
**
** Current Version:
** Author:
** Date:
** Contact: yuanchunjing@ict.ac.cn
** Note: If you have any difficulties or need help, please contact us
*******************************************************************************/
#ifndef PDCPU_DL_DATA_PROC_H
#define PDCPU_DL_DATA_PROC_H
#include "vos_types.h"
#include "cuupCommon.h"
#include "msgb.h"
extern INT32 pdcpuDlDataProc(UINT64 ueE1apId, UINT8 drbId, MsgbBuff_t *pMsgBuff, UINT8 sdapPduType);
#endif /* PDCPU_DL_DATA_PROC_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#/bin/bash
handle SIGSTOP nostop noprint
set confirm off
r
q
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment