--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+#include "cuupTest.h"
+
+INT32 printfPduSessionCfgType(UpcCfgType_e type)
+{
+ VOS_Printf("cfg type : ");
+ switch(type)
+ {
+ case PDU_SESSION_ADD:
+ VOS_Printf("PDU_SESSION_ADD\n");
+ break;
+
+ case PDU_SESSION_MOD:
+ VOS_Printf("PDU_SESSION_MOD\n");
+ break;
+
+ case PDU_SESSION_DEL:
+ VOS_Printf("PDU_SESSION_DEL\n");
+ break;
+
+ case DRB_DEL:
+ VOS_Printf("DRB_DEL\n");
+ break;
+
+ default:
+ break;
+ }
+
+ return VOS_OK;
+}
+
+INT32 printfTransLayerAddr(TransLayerAddr_t *pAddr)
+{
+ NULL_CHECK(pAddr);
+
+ VOS_Printf("addr size: %d bytes ",pAddr->bitStringSize);
+
+ UINT8 i = 0;
+ for(i=0; i<pAddr->bitStringSize; i++)
+ {
+ VOS_Printf("%d ",pAddr->transLayerAddress[i]);
+ }
+ VOS_Printf("\n");
+
+ return VOS_OK;
+}
+
+INT32 printfNguInstance(NguInstance_t *pNguInstance)
+{
+ NULL_CHECK(pNguInstance);
+ VOS_Printf("\n");
+ VOS_Printf("#################################\n");
+ VOS_Printf(" ngu instance parameters \n");
+ VOS_Printf("#################################\n");
+ VOS_Printf("ueE1apId: %d\n",pNguInstance->ueE1apId);
+ VOS_Printf("ueIdx: %d\n",pNguInstance->ueIdx);
+ VOS_Printf("pduSessionId: %d\n",pNguInstance->pduSessionId);
+ VOS_Printf("ownTeid: 0x%08x\n",pNguInstance->ownTeid);
+
+ return VOS_OK;
+}
+
+INT32 printfNguCfgResult(NguCfgResult_t *pCfg)
+{
+ NULL_CHECK(pCfg);
+ VOS_Printf("\n");
+ VOS_Printf("##########################\n");
+ VOS_Printf(" ngu config result \n");
+ VOS_Printf("##########################\n");
+ printfPduSessionCfgType(pCfg->cfgType);
+ VOS_Printf("pduSessionId: %d\n",pCfg->pduSessionId);
+ VOS_Printf("nggtpuTeid: 0x%08x\n",pCfg->nggtpuTeid);
+ printfTransLayerAddr(&pCfg->nggtpuAddr);
+ VOS_Printf("failureCause: %d\n",pCfg->failureCause);
+
+ return VOS_OK;
+}
+
+
+INT32 printfSecuResult(SecuResult_t *pResult)
+{
+ NULL_CHECK(pResult);
+
+ if(CP_RESULT_PERFORMED == pResult->confidentialityProtectionResult)
+ {
+ VOS_Printf("cipher is performed\n");
+
+ }else if(CP_RESULT_NOT_PERFORMED == pResult->confidentialityProtectionResult)
+ {
+ VOS_Printf("cipher is not performed\n");
+
+ }else
+ {
+ VOS_Printf("ciper result is wrong!\n");
+ }
+
+ if(IP_RESULT_PERFORMED == pResult->integrityProtectionResult)
+ {
+ VOS_Printf("integrity is performed\n");
+
+ }else if(IP_RESULT_NOT_PERFORMED == pResult->integrityProtectionResult)
+ {
+ VOS_Printf("integrity is not performed\n");
+
+ }else
+ {
+ VOS_Printf("integrity result is wrong!\n");
+ }
+
+ return VOS_OK;
+}
+
+INT32 printfPdcpRlcMode(PdcpRlcMode_e mode)
+{
+ if(TM_MODE == mode)
+ {
+ VOS_Printf("rlc mode: TM_MODE\n");
+
+ }else if(UM_MODE == mode)
+ {
+ VOS_Printf("rlc mode: UM_MODE\n");
+
+ }else if(AM_MODE == mode)
+ {
+ VOS_Printf("rlc mode: AM_MODE\n");
+
+ }else
+ {
+ VOS_Printf("rlc mode: wrong\n");
+ }
+
+ return VOS_OK;
+}
+
+
+INT32 printfDrbEntity(PdcpDrbEntity_t *pEntity)
+{
+ NULL_CHECK(pEntity);
+ VOS_Printf("\n");
+ VOS_Printf("#####################\n");
+ VOS_Printf(" pdcpu entity \n");
+ VOS_Printf("#####################\n");
+ VOS_Printf("ueE1apId: %d\n", pEntity->ueE1apId);
+ VOS_Printf("ueIdx: %d\n", pEntity->ueIdx);
+ VOS_Printf("pduSessionId: %d\n", pEntity->pduSessionId);
+ VOS_Printf("drbId: %d\n", pEntity->drbId);
+ printfPdcpRlcMode(pEntity->rlcMode);
+ VOS_Printf("sdapUlHeadLen: %d\n", pEntity->sdapUlHeadLen);
+ VOS_Printf("sdapDlHeadLen: %d\n", pEntity->sdapDlHeadLen);
+ VOS_Printf("pdcpSnSizeUl: %d bits\n", pEntity->pdcpSnSizeUl);
+ VOS_Printf("pdcpSnSizeDl: %d bits\n", pEntity->pdcpSnSizeDl);
+
+ if(pEntity->tDiscardActive)
+ {
+ VOS_Printf("discard timer is active, ");
+ }else
+ {
+ VOS_Printf("discard timer is not active, ");
+ }
+
+ if(pEntity->tDiscardRun)
+ {
+ VOS_Printf("running, ");
+ }else
+ {
+ VOS_Printf("not running, ");
+ }
+
+ VOS_Printf("period:%d ms\n", pEntity->tDiscard);
+
+ if(pEntity->tReorderActive)
+ {
+ VOS_Printf("reorder timer is active, ");
+ }else
+ {
+ VOS_Printf("reorder timer is not active, ");
+ }
+
+ if(pEntity->tReorderRun)
+ {
+ VOS_Printf("running, ");
+ }else
+ {
+ VOS_Printf("not running, ");
+ }
+
+ VOS_Printf("period:%d ms\n", pEntity->tReorder);
+
+ if(TRUE == pEntity->integrityProtection)
+ {
+ VOS_Printf("integrityProtection: enabled\n");
+
+ }else if(FALSE == pEntity->integrityProtection)
+ {
+ VOS_Printf("integrityProtection: disabled\n");
+ }else
+ {
+ vos_err_print("integrityProtection: enable flag is wrong\n");
+ }
+
+ if(TRUE == pEntity->ciperingEnabled)
+ {
+ VOS_Printf("cipher: enabled\n");
+
+ }else if(FALSE == pEntity->ciperingEnabled)
+ {
+ VOS_Printf("cipher: disabled\n");
+ }else
+ {
+ vos_err_print("cipher: enable flag is wrong\n");
+ }
+
+ if(TRUE == pEntity->outOfOrderDelivery)
+ {
+ VOS_Printf("outOfOrderDelivery: enabled\n");
+
+ }else
+ {
+ VOS_Printf("outOfOrderDelivery: disabled\n");
+ }
+
+ if(TRUE == pEntity->headerCompress.notUsed)
+ {
+ VOS_Printf("headerCompress: not used\n");
+
+ }else
+ {
+ VOS_Printf("headerCompress: used\n");
+ }
+
+ VOS_Printf("stateVar.rxCount: %d\n", pEntity->stateVar.rxCount);
+ VOS_Printf("stateVar.txNext: %d\n", pEntity->stateVar.txNext);
+ VOS_Printf("stateVar.rxDelivery: %d\n", pEntity->stateVar.rxDelivery);
+ VOS_Printf("stateVar.rxNext: %d\n", pEntity->stateVar.rxNext);
+ VOS_Printf("stateVar.rxReorder: %d\n", pEntity->stateVar.rxReorder);
+
+ return VOS_OK;
+}
+
+INT32 printfDrbFailedCause(DrbFailedCause_t *p)
+{
+ VOS_Printf("drb id: %d, failed cause: %d\n", p->drbId, p->cause);
+
+ return VOS_OK;
+}
+
+INT32 printfPdcpuCfgResult(PdcpuCfgResult_t *pResult)
+{
+ UINT8 i = 0;
+
+ NULL_CHECK(pResult);
+ VOS_Printf("\n");
+ VOS_Printf("##########################\n");
+ VOS_Printf(" pdcpu cfg result \n");
+ VOS_Printf("##########################\n");
+ VOS_Printf("pdu Session Id: %d\n", pResult->pduSessionId);
+ printfPduSessionCfgType(pResult->cfgType);
+
+ if(pResult->secResPresent)
+ {
+ VOS_Printf("there is security result\n");
+ printfSecuResult(&pResult->secuResult);
+ }else
+ {
+ VOS_Printf("there is no security result\n");
+ }
+
+ VOS_Printf("drbSetupSuccessNum: %d\ndrb id list: ", pResult->drbSetupSuccessNum);
+ for(i=0; i<pResult->drbSetupSuccessNum; i++)
+ {
+ VOS_Printf("%d ", pResult->drbSetupSuccessArray[i]);
+ }
+
+ VOS_Printf("\ndrbSetupFailNum: %d\ndrb id list: ", pResult->drbSetupFailNum);
+ for(i=0; i<pResult->drbSetupFailNum; i++)
+ {
+ printfDrbFailedCause(&pResult->drbSetupFailedArray[i]);
+ }
+
+ VOS_Printf("\ndrbModifySuccessNum: %d\ndrb id list: ", pResult->drbModifySuccessNum);
+ for(i=0; i<pResult->drbModifySuccessNum; i++)
+ {
+ VOS_Printf("%d ", pResult->drbModifySuccessArray[i]);
+ }
+
+ VOS_Printf("\ndrbModifyFailNum: %d\ndrb id list: ", pResult->drbModifyFailNum);
+ for(i=0; i<pResult->drbModifyFailNum; i++)
+ {
+ printfDrbFailedCause(&pResult->drbModifyFailedArray[i]);
+ }
+ VOS_Printf("\n");
+
+ return VOS_OK;
+}
+
+
+INT32 printfCuf1uInstance(Cuf1uInstance_t *pF1u)
+{
+ NULL_CHECK(pF1u);
+ VOS_Printf("\n");
+ VOS_Printf("##########################\n");
+ VOS_Printf(" cuf1u instance \n");
+ VOS_Printf("##########################\n");
+ VOS_Printf("ueE1apId: %d\n", pF1u->ueE1apId);
+ VOS_Printf("ueIdx: %d\n", pF1u->ueIdx);
+ VOS_Printf("pduSessionId: %d\n", pF1u->pduSessionId);
+ VOS_Printf("drbId: %d\n", pF1u->drbId);
+ if(LEN_12_BITS == pF1u->pdcpSnSize)
+ {
+ VOS_Printf("pdcpSnSize: 12 bits\n", pF1u->pdcpSnSize);
+
+ }else if(LEN_18_BITS == pF1u->pdcpSnSize)
+ {
+ VOS_Printf("pdcpSnSize: 18 bits\n", pF1u->pdcpSnSize);
+
+ }else{
+ VOS_Printf("pdcpSnSize: wrong!\n");
+ }
+
+ VOS_Printf("ownTeid: 0X%08X\n", pF1u->ownTeid);
+ VOS_Printf("nextSubmitSn: %d\n", pF1u->nextSubmitSn);
+
+ return VOS_OK;
+}
+
+INT32 printfCuf1uSetupInfo(Cuf1uSetupInfo_t *pInfo)
+{
+ NULL_CHECK(pInfo);
+
+ VOS_Printf("setup info-->drbId: %02x\n", pInfo->drbId);
+ VOS_Printf("setup info-->f1gtpuTeid: %08x\n", pInfo->f1gtpuTeid);
+ VOS_Printf("setup info-->");
+ printfTransLayerAddr(&pInfo->gtpuAddr);
+
+ return VOS_OK;
+}
+
+
+INT32 printfCuf1uCfgResult(Cuf1uCfgResult_t *pResult)
+{
+ UINT8 i = 0;
+
+ NULL_CHECK(pResult);
+ VOS_Printf("\n");
+ VOS_Printf("##########################\n");
+ VOS_Printf(" cuf1u cfg result \n");
+ VOS_Printf("##########################\n");
+ VOS_Printf("pdu Session Id: %d\n", pResult->pduSessionId);
+ printfPduSessionCfgType(pResult->cfgType);
+
+ VOS_Printf("drbSetupSuccessNum: %d\ndrb id list:", pResult->drbSetupSuccessNum);
+ for(i=0; i<pResult->drbSetupSuccessNum; i++)
+ {
+ printfCuf1uSetupInfo(&pResult->drbSetupSuccessArray[i]);
+ }
+
+ VOS_Printf("\ndrbSetupFailNum: %d\n", pResult->drbSetupFailNum);
+ for(i=0; i<pResult->drbSetupFailNum; i++)
+ {
+ printfDrbFailedCause(&pResult->drbSetupFailedArray[i]);
+ }
+
+ VOS_Printf("\ndrbModifySuccessNum: %d\n", pResult->drbModifySuccessNum);
+ for(i=0; i<pResult->drbModifySuccessNum; i++)
+ {
+ VOS_Printf("%d ", pResult->drbModifySuccessArray[i]);
+ }
+
+ VOS_Printf("\ndrbModifyFailNum: %d\n", pResult->drbModifyFailNum);
+ for(i=0; i<pResult->drbModifyFailNum; i++)
+ {
+ printfDrbFailedCause(&pResult->drbModifyFailedArray[i]);
+ }
+
+ VOS_Printf("pduSessionFailCause: %d\n",pResult->pduSessionCause);
+
+ return VOS_OK;
+}
+
+INT32 printfPdcpuSecInfo(PdcpuSecInfo_t *pSec)
+{
+ NULL_CHECK(pSec);
+
+ UINT8 i = 0;
+
+ VOS_Printf("\n");
+ VOS_Printf("#################################################\n");
+ VOS_Printf(" pdcpu set security info successful \n");
+ VOS_Printf("#################################################\n");
+ VOS_Printf("ueE1apId: 0X%x\n",pSec->ueE1apId);
+ VOS_Printf("ueIdx: 0X%04x\n",pSec->ueIdx);
+
+ VOS_Printf("kUpEnc:");
+ for(i=0; i<4; i++)
+ {
+ VOS_Printf("%08x ",pSec->kUpEnc[i]);
+ }
+ VOS_Printf("\n");
+
+ VOS_Printf("kUpInt:");
+ for(i=0; i<4; i++)
+ {
+ VOS_Printf("%08x ",pSec->kUpInt[i]);
+ }
+ VOS_Printf("\n");
+
+ /*VOS_Printf("nh:");
+ for(i=0; i<8; i++)
+ {
+ VOS_Printf("%08x ",pSec->nh[i]);
+ }
+ VOS_Printf("\n");
+
+ VOS_Printf("ncc: 0X%02x\n",pSec->ncc);*/
+
+ //打印加密算法
+ if(NEA0 == pSec->encAlgorithm)
+ {
+ VOS_Printf("encAlgorithm: NEA0\n");
+
+ }else if(NEA1 == pSec->encAlgorithm)
+ {
+ VOS_Printf("encAlgorithm: NEA1\n");
+
+ }else if(NEA2 == pSec->encAlgorithm)
+ {
+ VOS_Printf("encAlgorithm: NEA2\n");
+
+ }else
+ {
+ VOS_Printf("encAlgorithm: %d error!\n",pSec->encAlgorithm);
+ }
+
+ //打印完保算法
+ if(NIA0 == pSec->intAlgorithm)
+ {
+ VOS_Printf("intAlgorithm: NIA0\n");
+
+ }else if(NIA1 == pSec->intAlgorithm)
+ {
+ VOS_Printf("intAlgorithm: NIA1\n");
+
+ }else if(NIA2 == pSec->intAlgorithm)
+ {
+ VOS_Printf("intAlgorithm: NIA2\n");
+
+ }else
+ {
+ VOS_Printf("intAlgorithm: %d error!\n",pSec->intAlgorithm);
+ }
+
+ //打印加密是否激活
+ if(0 == pSec->encActiveFlag)
+ {
+ VOS_Printf("enc status: inactive\n");
+ }else
+ {
+ VOS_Printf("enc status: active\n");
+ }
+
+ //打印完保是否激活
+ if(0 == pSec->intActiveFlag)
+ {
+ VOS_Printf("int status: inactive\n");
+ }else
+ {
+ VOS_Printf("int status: active\n");
+ }
+
+ if(0 == pSec->nhInd)
+ {
+ VOS_Printf("nhInd: not exist\n");
+ }else
+ {
+ VOS_Printf("nhInd: exist\n");
+ }
+
+ return VOS_OK;
+}
+
+INT32 printfVosSockAddr(vos_sockaddr_t *pAddr)
+{
+ NULL_CHECK(pAddr);
+
+ UINT8 *temp = NULL;
+ UINT8 i = 0;
+
+ if(AF_INET == pAddr->sa.sa_family)
+ {
+ VOS_Printf("IP type : IPV4\n");
+ VOS_Printf("IP addr : ");
+ for(i=0; i<4; i++)
+ {
+ temp = (UINT8 *)&pAddr->sin.sin_addr + i;
+ VOS_Printf("%d ",*temp);
+ }
+ VOS_Printf("\n");
+ }else if(AF_INET6 == pAddr->sa.sa_family)
+ {
+ VOS_Printf("IP type : IPV6\n");
+ VOS_Printf("IP addr : ");
+ for(i=0; i<16; i++)
+ {
+ temp = (UINT8 *)&pAddr->sin6.sin6_addr + i;
+ VOS_Printf("%d ",*temp);
+ }
+ VOS_Printf("\n");
+ }else
+ {
+ VOS_Printf("addr type is wrong!\n");
+ }
+
+ return VOS_OK;
+}
+
+INT32 printfTun(Tun_t *pTun)
+{
+ NULL_CHECK(pTun);
+
+ VOS_Printf("\n");
+ VOS_Printf("##############################\n");
+ VOS_Printf(" tunnel info \n");
+ VOS_Printf("##############################\n");
+
+ if(0 == pTun->tunState)
+ {
+ VOS_Printf("tun state is inactive\n");
+ }else
+ {
+ VOS_Printf("tun state is active\n");
+ }
+
+ VOS_Printf("seq: %d\n",pTun->seq);
+ VOS_Printf("tunId: 0x%08x\n",pTun->tunId);
+ VOS_Printf("ownTeid: 0x%08x\n",pTun->ownTeid);
+ VOS_Printf("remTeid: 0x%08x\n",pTun->remTeid);
+ printfVosSockAddr(&pTun->tunOpval.addr);
+
+ return VOS_OK;
+}
+
+INT32 printfPdcpuSecEnableInfo(PdcpuSecEnableInfo_t *pInfo)
+{
+ NULL_CHECK(pInfo);
+
+ VOS_Printf("\n");
+ VOS_Printf("######################################\n");
+ VOS_Printf(" security enable info \n");
+ VOS_Printf("######################################\n");
+ VOS_Printf("pduSessionId: %d\n",pInfo->pduSessionId);
+
+ //加密
+ if(TRUE == pInfo->cipherEnableFlag)
+ {
+ VOS_Printf("cipher : enabled\n");
+ }else
+ {
+ VOS_Printf("cipher : disabled\n");
+ }
+
+ //完整性保护
+ if(TRUE == pInfo->integrityEnableFlag)
+ {
+ VOS_Printf("integrity : enabled\n");
+ }else
+ {
+ VOS_Printf("integrity : disabled\n");
+ }
+
+ //完保速率
+ VOS_Printf("maxIPDataRate: %d\n",pInfo->maxIPDataRate);
+
+ return VOS_OK;
+}
+
+INT32 printfCuupUeIdxTable(CuupUeIdxTable_t *pTable)
+{
+ UINT8 i = 0;
+ VOS_Printf("0 is used, 1 is not used, else is wrong\n");
+ for(i=0; i<MAX_UE_NUM; i++)
+ {
+ VOS_Printf("i is %d ",i);
+ VOS_Printf("usedFlag: %d ",pTable->ueIdxInfo[i].isUsed);
+ VOS_Printf("ueE1apId: %d ",pTable->ueIdxInfo[i].ueE1apId);
+ VOS_Printf("ueIdx: %04x\n",pTable->ueIdxInfo[i].ueIdx);
+ }
+ VOS_Printf("at end i = %d\n",i);
+
+ return VOS_OK;
+}
+
+INT32 printfMsgbBuff(MsgbBuff_t *pMsgBuff)
+{
+ NULL_CHECK(pMsgBuff);
+
+ UINT8 *pMsgHead = msgbData(pMsgBuff);
+ UINT32 pduLen = msgbDataUsedLen(pMsgBuff);
+
+ /*VOS_Printf("msgb maxDataLen:%d maxHeadLen:%d headSpareLen:%d tailOffset:%d ",
+ pMsgBuff->msgbInfo.maxDataLen,
+ pMsgBuff->msgbInfo.maxHeadLen,
+ pMsgBuff->msgbInfo.headSpareLen,
+ pMsgBuff->msgbInfo.tailOffset);*/
+
+ VOS_Printf(VOS_COLOR_BLUE"data len:%d\n"VOS_COLOR_NONE,pduLen);
+
+ UINT32 j = 0;
+ for(j=0; j<pduLen; j++)
+ {
+ VOS_Printf("%02x ",*(pMsgHead+j));
+ }
+ VOS_Printf("\n");
+
+ return VOS_OK;
+}
+
+INT32 printfExPduInfo(ExPduInfo_t *pPdu)
+{
+ NULL_CHECK(pPdu);
+
+ VOS_Printf("exHdrLen:%d Byteslen:%d exHdrType:0x%02x\n",
+ pPdu->exHdrLen,pPdu->len,pPdu->exHdrType);
+
+ UINT8 i = 0;
+ for(i=0; i<pPdu->len; i++)
+ {
+ VOS_Printf("%02x ",*((UINT8 *)(pPdu->pPdu)+i));
+ }
+ VOS_Printf("\n");
+
+ return VOS_OK;
+}
+
+INT32 printfSdapNewInstance(SdapGlobalDtat_t *pGlobalData)
+{
+ VOS_Printf("\n**sdapCreateNewInstance**\n");
+ VOS_Printf("upE1apId:%d\n",pGlobalData->upE1apId);
+ VOS_Printf("sessNum:%d\n",pGlobalData->sessNum);
+ UINT8 i = 0;
+ UINT8 m = 0;
+ UINT8 n = 0;
+ VOS_Printf("sessId list:");
+ for(i=0; i<pGlobalData->sessNum; i++)
+ {
+ VOS_Printf("%d,",pGlobalData->sessId[i]);
+ }
+ VOS_Printf("\n");
+
+ UINT8 pduId = 0;
+ for(i=0; i<pGlobalData->sessNum; i++)
+ {
+ pduId = pGlobalData->sessId[i];
+ VOS_Printf("i:%d, sessId:%d, sessNum:%d\n",i,pduId,pGlobalData->sessNum);
+ VOS_Printf("drbNum:%d\n",pGlobalData->sdapInstance[pduId].drbNum);
+ VOS_Printf("drbId list:");
+ for(m=0; m<pGlobalData->sdapInstance[pduId].drbNum; m++)
+ {
+ VOS_Printf("%d,",pGlobalData->sdapInstance[pduId].drbId[m]);
+ }
+ VOS_Printf("\n");
+
+ VOS_Printf("\n******drbCfg*******\n");
+
+ UINT8 j=0;
+ UINT8 drbId = 0;
+ UINT8 qfiNum = 0;
+ for(n=0; n<pGlobalData->sdapInstance[pduId].drbNum; n++)
+ {
+ drbId = pGlobalData->sdapInstance[pduId].drbId[n];
+ VOS_Printf("drbId:%d \n",drbId);
+ VOS_Printf("drbCfg.drbId:%d\n",pGlobalData->sdapInstance[pduId].drbCfg[drbId-1].drbId);
+ VOS_Printf("drbCfg.sdapUlHead:%d\n",pGlobalData->sdapInstance[pduId].drbCfg[drbId-1].sdapCfg.sdapUlHeaderInd);
+ VOS_Printf("drbCfg.sdapDlHead:%d\n",pGlobalData->sdapInstance[pduId].drbCfg[drbId-1].sdapCfg.sdapDlHeaderInd);
+ VOS_Printf("drbCfg.defaultDrbInd:%d\n",pGlobalData->sdapInstance[pduId].drbCfg[drbId-1].sdapCfg.defaultDrbInd);
+ qfiNum = pGlobalData->sdapInstance[pduId].drbCfg[drbId-1].qfiNum;
+ VOS_Printf("drbCfg.qfiNum:%d\nqfi list:",qfiNum);
+ for(j=0; j<qfiNum; j++)
+ {
+ VOS_Printf("%d ",pGlobalData->sdapInstance[pduId].drbCfg[drbId-1].qfi[j]);
+ }
+ VOS_Printf("\n");
+ }
+ }
+
+ return VOS_OK;
+}
+
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+#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;
+}
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+#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;
+ }
+
+}
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+#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;
+}
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+#include "vos_types.h"
+#include "vos_string.h"
+#include "vos_lib.h"
+#include "pdcpu.h"
+#include "pdcpuCore.h"
+#include "pdcpCommon.h"
+#include "cuupCommon.h"
+#include "cuModuleInterface.h"
+#include "pdcpComprohc.h"
+#include "cuupTest.h"
+#include "cuupUeIdTransf.h"
+#include "upcContext.h"
+
+extern PdcpuUeInfo_t *gPdcpuUeInfo[MAX_UE_NUM];
+ULONG gPdcpuModuleId;
+CuupUeIdxTable_t gPdcpuUeIdxTable;
+
+
+/*******************************************************************************
+* To
+* INPUT:
+* :
+* OUTPUT:
+* 0:success
+* -1:fail
+*******************************************************************************/
+INT32 pdcpuInit(ULONG userModuleId)
+{
+ /* get pdcpu moduleId */
+ gPdcpuModuleId = userModuleId;
+
+ /* init ueIdx table */
+ UINT8 i = 0;
+ for(i=0; i<MAX_UE_NUM; i++)
+ {
+ gPdcpuUeIdxTable.ueIdxInfo[i].isUsed = FALSE;
+ }
+
+ /* init ue info */
+ for(i=0; i<MAX_UE_NUM; i++)
+ {
+ gPdcpuUeInfo[i] = NULL;
+ }
+
+ return VOS_OK;
+}
+
+
+INT32 pdcpuFreeSecInfo(UINT16 ueIdx)
+{
+ PdcpuSecInfo_t *pDrbSecInfo = gPdcpuUeInfo[ueIdx]->secInfo;
+ if(NULL != pDrbSecInfo)
+ {
+ VOS_Free(pDrbSecInfo);
+ gPdcpuUeInfo[ueIdx]->secInfo = NULL;
+ }
+
+ return VOS_OK;
+}
+
+/*******************************************************************************
+* To deal with security indication
+* Security Result indicates whether the security policy indicated as "preferred"
+* in the Security Indication IE is performed or not.
+* INPUT:
+* ueE1apId : UE E1AP ID
+* pduSessionId : pdu session id
+* pSecInd : security indication
+* pSecResult : security result
+* OUTPUT:
+* 0:success
+* -1:fail
+*******************************************************************************/
+INT32 pdcpuDealSecurityInd(PdcpuSecInfo_t *pSec, PdcpuSecEnableInfo_t *pEnableInfo, SecuInd_t *pSecInd, PdcpuCfgResult_t *pResult)
+{
+ /* get security enable information global variable */
+ pdcpuNullCheck(pSec);
+ pdcpuNullCheck(pEnableInfo);
+ pdcpuNullCheck(pSecInd);
+
+ /* for integrity protection */
+ if(ACTIVE_INT_STATE == pSec->intActiveFlag)
+ {
+ /* integrity protection is active for the UE, apply the indication */
+ if(IP_REQUIRED == pSecInd->IPIndication)
+ {
+ pEnableInfo->integrityEnableFlag = TRUE;
+ pEnableInfo->maxIPDataRate = pSecInd->maxIPdataRate;
+ pResult->secResPresent = FALSE;
+
+ }else if(IP_PREFERRED == pSecInd->IPIndication)
+ {
+ pEnableInfo->integrityEnableFlag = TRUE;
+ pEnableInfo->maxIPDataRate = pSecInd->maxIPdataRate;
+ pResult->secResPresent = TRUE;
+ pResult->secuResult.integrityProtectionResult= IP_RESULT_PERFORMED;
+
+ }else
+ {
+ pEnableInfo->integrityEnableFlag = FALSE;
+ pResult->secResPresent = FALSE;
+
+ }
+
+ }else
+ {
+ /* integrity protection is inactive for the UE */
+ pEnableInfo->integrityEnableFlag = FALSE;
+ if(IP_PREFERRED == pSecInd->IPIndication)
+ {
+ pResult->secResPresent = TRUE;
+ pResult->secuResult.integrityProtectionResult= IP_RESULT_NOT_PERFORMED;
+ }
+ }
+
+ /* for ciphering */
+ if(ACTIVE_ENC_STATE == pSec->encActiveFlag)
+ {
+ /* ciphering is active for the UE, apply the indication */
+ if(CP_REQUIRED == pSecInd->CPIndication)
+ {
+ pEnableInfo->cipherEnableFlag = TRUE;
+ pResult->secResPresent = FALSE;
+
+ }else if(CP_PREFERRED == pSecInd->CPIndication)
+ {
+ pEnableInfo->cipherEnableFlag = TRUE;
+ pResult->secResPresent = TRUE;
+ pResult->secuResult.confidentialityProtectionResult = CP_RESULT_PERFORMED;
+
+ }else
+ {
+ pEnableInfo->cipherEnableFlag = FALSE;
+ pResult->secResPresent = FALSE;
+
+ }
+
+ }else
+ {
+ /* ciphering is inactive for the UE */
+ pEnableInfo->cipherEnableFlag = FALSE;
+ if(CP_PREFERRED == pSecInd->CPIndication)
+ {
+ pResult->secResPresent = TRUE;
+ pResult->secuResult.confidentialityProtectionResult= CP_RESULT_NOT_PERFORMED;
+ }
+ }
+
+ return VOS_OK;
+}
+
+INT32 pdcpuRetFailResult(UpcCfgType_e cfgType, upcTempSessInfo_t *pCfgInfo, PdcpuCfgResult_t *pResult)
+{
+ pdcpuLog(LOG_ERR,"[PDCPU] pdu session config failed\n");
+
+ UINT8 i = 0;
+ if(PDU_SESSION_ADD == cfgType)
+ {
+ /* drb to setup list */
+ for(i=0; i<pCfgInfo->drbSetupNum; i++)
+ {
+ pResult->drbSetupFailedArray[i].drbId = pCfgInfo->pTempDrbSetupList[i].drbId;
+ pResult->drbSetupFailedArray[i].cause = RNL_UNSPECIFIED;
+ }
+ pResult->drbSetupFailNum = pCfgInfo->drbSetupNum;
+ pResult->pduSessionCause = RNL_UNSPECIFIED;
+
+ }
+
+
+ return VOS_ERROR;
+}
+
+/*******************************************************************************
+* To deal with PDU session to setup config
+* INPUT:
+* ueE1apId : UE E1AP ID
+* pPduSessionCfg : PDU session to setup config
+* pResult : PDU session to setup result
+* OUTPUT:
+* none
+*******************************************************************************/
+INT32 pdcpuSessionAddProc(UINT64 ueE1apId, VOID *pCfgInfo, PdcpuCfgResult_t *pResult)
+{
+ upcTempSessInfo_t *pSetupInfo = (upcTempSessInfo_t *)pCfgInfo;
+ upcTempDrbInfo_t *pDrbTemp = NULL;
+ PdcpuSecInfo_t *pSec = NULL;
+ PdcpuSecEnableInfo_t *pEnableInfo = NULL;
+
+ UINT16 pduSessionId = pSetupInfo->pduSessId;
+ pResult->pduSessionId = pduSessionId;
+
+ /* get ueIdx */
+ UINT16 ueIdx;
+ if(VOS_ERROR == cuupAddUeE1apid(ueE1apId, &ueIdx, &gPdcpuUeIdxTable))
+ {
+ pdcpuLog(LOG_ERR,"[PDCPU] add ueE1apId failed\n");
+ return pdcpuRetFailResult(PDU_SESSION_ADD,pCfgInfo,pResult);
+ }
+
+ /* check ue and security context block */
+ if((NULL == gPdcpuUeInfo[ueIdx]) || (NULL == gPdcpuUeInfo[ueIdx]->secInfo))
+ {
+ pdcpuLog(LOG_ERR,"[PDCPU] ue and security context block not exist\n");
+ return pdcpuRetFailResult(PDU_SESSION_ADD,pCfgInfo,pResult);
+ }
+ pSec = gPdcpuUeInfo[ueIdx]->secInfo;
+
+ /* alloc pdu session information */
+ pEnableInfo = gPdcpuUeInfo[ueIdx]->secEnableInfo[pduSessionId];
+ if(NULL == pEnableInfo)
+ {
+ pEnableInfo = VOS_Malloc(sizeof(PdcpuSecEnableInfo_t), gPdcpuModuleId);
+ if(NULL == pEnableInfo)
+ {
+ pdcpuLog(LOG_ERR,"[PDCPU] vos_malloc failed\n");
+ return pdcpuRetFailResult(PDU_SESSION_ADD,pCfgInfo,pResult);
+ }
+ VOS_MemZero(pEnableInfo, sizeof(PdcpuSecEnableInfo_t));
+ gPdcpuUeInfo[ueIdx]->secEnableInfo[pduSessionId] = pEnableInfo;
+ }
+ pEnableInfo->pduSessionId = pduSessionId;
+
+ /* deal with security indication */
+ if(VOS_ERROR == pdcpuDealSecurityInd(pSec, pEnableInfo, &pSetupInfo->secuIndi, pResult))
+ {
+ pdcpuLog(LOG_ERR,"[PDCPU] deal security indication failed\n");
+ return pdcpuRetFailResult(PDU_SESSION_ADD,pCfgInfo,pResult);
+ }
+
+ /* create pdcp entity */
+ UINT8 i = 0;
+ for(i = 0; i < pSetupInfo->drbSetupNum; i++)
+ {
+ pDrbTemp = &pSetupInfo->pTempDrbSetupList[i];
+
+ if((NULL == pDrbTemp) || (FALSE == pDrbTemp->drbSetupAllowed))
+ {
+ continue;
+ }
+
+ if(VOS_OK == pdcpuCreateEntity(ueE1apId, ueIdx, pduSessionId, pDrbTemp))
+ {
+ pResult->drbSetupSuccessArray[pResult->drbSetupSuccessNum] = pDrbTemp->drbId;
+ pResult->drbSetupSuccessNum += 1;
+ }else
+ {
+ pResult->drbSetupFailedArray[pResult->drbSetupFailNum].drbId = pDrbTemp->drbId;
+ pResult->drbSetupFailedArray[pResult->drbSetupFailNum].cause = RNL_PDCP_CONFIG_NOT_SUPPORT;
+ pResult->drbSetupFailNum += 1;
+
+ }
+ }
+
+ /* return */
+ if(0 != pResult->drbSetupSuccessNum)
+ {
+ return VOS_OK;
+ }else
+ {
+ pResult->pduSessionCause = RNL_UNSPECIFIED;
+ pdcpuLog(LOG_ERR,"[PDCPU] all drbs setup failed\n");
+ return VOS_ERROR;
+ }
+}
+
+/*******************************************************************************
+ * To manage pdcp-u entity
+ * INPUT:
+ * ueE1apId : UE E1AP ID
+ * pPduSessionCfg : PDU Session Resource to setup item
+ * cfgType : configuration type
+ * pResult : result which will return to upc
+ * OUTPUT:
+ * result: PDCP config result
+ *******************************************************************************/
+INT32 pdcpuConfig(UINT64 ueE1apId, VOID *pCfgInfo, UpcCfgType_e cfgType, PdcpuCfgResult_t *pResult)
+{
+ switch(cfgType)
+ {
+ case PDU_SESSION_ADD:
+ {
+ pdcpuNullCheck(pCfgInfo);
+ pdcpuNullCheck(pResult);
+ VOS_MemZero(pResult, sizeof(PdcpuCfgResult_t));
+ pResult->cfgType = cfgType;
+ return pdcpuSessionAddProc(ueE1apId, pCfgInfo, pResult);
+ }
+ default:
+ {
+ pdcpuLog(LOG_ERR,"[PDCPU] cfgType error\n");
+ return VOS_ERROR;
+ }
+ }
+
+}
+
+
+/*******************************************************************************
+ * To get ue security information pointer
+ * INPUT:
+ * ueIdx: UE index
+ * OUTPUT:
+ * pDrbSecInfo: ue security information pointer
+ *******************************************************************************/
+PdcpuSecInfo_t *pdcpuAllocUeSecInfo(UINT16 ueIdx)
+{
+ PdcpuSecInfo_t *pSecInfo = NULL;
+ PdcpuUeInfo_t *pPdcpUeInfo = NULL;
+
+ //check ue
+ if(NULL == gPdcpuUeInfo[ueIdx])
+ {
+ pPdcpUeInfo = VOS_Malloc(sizeof(PdcpuUeInfo_t), gPdcpuModuleId);
+ pdcpuNullCheckRp(pPdcpUeInfo);
+ VOS_MemZero(pPdcpUeInfo, sizeof(PdcpuUeInfo_t));
+ gPdcpuUeInfo[ueIdx] = pPdcpUeInfo;
+ }else
+ {
+ pPdcpUeInfo = gPdcpuUeInfo[ueIdx];
+ }
+ //check secInfo
+ if(NULL == pPdcpUeInfo->secInfo)
+ {
+ pSecInfo = VOS_Malloc(sizeof(PdcpuSecInfo_t), gPdcpuModuleId);
+ pdcpuNullCheckRp(pSecInfo);
+ VOS_MemZero(pSecInfo, sizeof(PdcpuSecInfo_t));
+ pPdcpUeInfo->secInfo = pSecInfo;
+ }else
+ {
+ pSecInfo = pPdcpUeInfo->secInfo;
+ }
+
+ VOS_MemZero(pSecInfo, sizeof(PdcpuSecInfo_t));
+
+ return pSecInfo;
+}
+
+
+/*******************************************************************************
+ * To set ue security parameters. When receiving security information,
+ * pdcp-u shall save AS keys, AS algorithm and active integrity and ciphering.
+ * INPUT:
+ * ueE1apId: UE E1AP ID
+ * secInfo: security information
+ * OUTPUT:
+ * 0: success
+ * -1:failed
+ *******************************************************************************/
+INT32 pdcpuSetSecParam(UINT64 ueE1apId, SecuInfo_t *secInfo)
+{
+ pdcpuNullCheck(secInfo);
+
+ UINT16 ueIdx;
+ if(VOS_ERROR == cuupAddUeE1apid(ueE1apId, &ueIdx, &gPdcpuUeIdxTable))
+ {
+ pdcpuLog(LOG_ERR,"[PDCPU] add ueE1apId failed\n");
+ return VOS_ERROR;
+ }
+
+ /* find ue security struct */
+ PdcpuSecInfo_t *pDrbSecInfo = pdcpuAllocUeSecInfo(ueIdx);
+ pdcpuNullCheck(pDrbSecInfo);
+
+ /* activate integrity */
+ if(secInfo->secuAlgorithm.bitMask & SECURITY_ALGORITHM_INTERGRITY_PROTECTION_ALGORITHM)
+ {
+ UINT8 intAlgorithm = secInfo->secuAlgorithm.integrityProtectionAlgorithm;
+ UINT8 *pIntKey = secInfo->upSecukey.integrityProtectionKey.buffer;
+ UINT8 intKeyLen = secInfo->upSecukey.integrityProtectionKey.size; /* 128 bits */
+
+ if(intKeyLen < AS_KEY_LEN)
+ {
+ pdcpuLog(LOG_ERR,"[PDCPU] integrity parameter is wrong!\n");
+ pdcpuFreeSecInfo(ueIdx);
+ return VOS_ERROR;
+ }
+
+ pDrbSecInfo->intActiveFlag = ACTIVE_INT_STATE; /* 0-inactive, 1-active */
+ if(intAlgorithm == NIA0 || intAlgorithm == NIA1 || intAlgorithm == NIA2)
+ {
+ pDrbSecInfo->intAlgorithm = intAlgorithm;
+ VOS_MemCpy(pDrbSecInfo->kUpInt, pIntKey, AS_KEY_LEN); /* 128 bits */
+ }else
+ {
+ pDrbSecInfo->intActiveFlag = INACTIVE_INT_STATE;
+ pdcpuLog(LOG_ERR,"[PDCPU] integrity algorithm is %d, not supported!\n",intAlgorithm);
+ pdcpuFreeSecInfo(ueIdx);
+ return VOS_ERROR;
+ }
+ }else
+ {
+ pDrbSecInfo->intActiveFlag = INACTIVE_INT_STATE;
+ pdcpuLog(LOG_INFO,"[PDCPU] integrity is not config\n");
+ }
+
+ /* activate encryption */
+ UINT8 encAlgorithm = secInfo->secuAlgorithm.cipheringAlgorithm;
+ UINT8 *pEncKey = secInfo->upSecukey.encryptionKey.buffer;
+ UINT8 encKeyLen = secInfo->upSecukey.encryptionKey.size; /* 128 bits */
+
+ if(encKeyLen < AS_KEY_LEN)
+ {
+ pdcpuLog(LOG_ERR,"[PDCPU] encryption parameter is wrong!\n");
+ pdcpuFreeSecInfo(ueIdx);
+ return VOS_ERROR;
+ }
+
+ pDrbSecInfo->encActiveFlag = ACTIVE_ENC_STATE; /* 0-inactive, 1-active */
+ if(encAlgorithm == NEA0 || encAlgorithm == NEA1 || encAlgorithm == NEA2)
+ {
+ pDrbSecInfo->encAlgorithm = encAlgorithm;
+ VOS_MemCpy(pDrbSecInfo->kUpEnc, pEncKey, AS_KEY_LEN); /* 128 bits */
+ }else
+ {
+ pDrbSecInfo->encActiveFlag = INACTIVE_ENC_STATE;
+ pdcpuLog(LOG_ERR,"[PDCPU] encryption algorithm:%d, is not supported!\n", encAlgorithm);
+ pdcpuFreeSecInfo(ueIdx);
+ return VOS_ERROR;
+ }
+
+ pDrbSecInfo->ueE1apId = ueE1apId;
+ pDrbSecInfo->ueIdx = ueIdx;
+ pDrbSecInfo->nhInd = FALSE;
+
+ return VOS_OK;
+}
+
--- /dev/null
+
+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)
--- /dev/null
+
+ 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)
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+#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
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+#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);
+}
+
--- /dev/null
+
+ M_SUB_DIRS += Pdcp
+ M_SUB_DIRS += Sdap
+
+include ${G_COMMON_L1_F}
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+#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;
+}
+
+
+
+
+
+
--- /dev/null
+
+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)
+
--- /dev/null
+ M_SUB_DIRS += CuUp
+
+
+include ${G_COMMON_L1_F}
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+#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
+
+
+
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+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)
+
--- /dev/null
+/*-
+ * 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 */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+#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_*/
+
+
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+#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
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+#ifndef __CUMODULEENUMH__
+#define __CUMODULEENUMH__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**********************************************************************************
+***********************************************************************************
+******************* Common Enum Type ***************************
+***********************************************************************************
+***********************************************************************************/
+typedef enum
+{
+ NEXT_PAGING_AREA_SCOPE_SAME = 0,
+ NEXT_PAGING_AREA_SCOPE_CHANGED = 1
+}NextPagingAreaScope_e;
+
+typedef enum
+{
+ PAGING_ORIGIN_NON_3GPP = 0
+}PagingOrigin_e;
+
+typedef enum
+{
+ RRC_STATE_INACTIVE = 0,
+ RRC_STATE_CONNECTED = 1
+}RrcState_e;
+
+typedef enum
+{
+ DATA_FORWARDING_ACCEPTED = 0
+}DataForwardAccepted_e;
+
+typedef enum
+{
+ EVENT_TYPE_direct = 0,
+ EVENT_TYPE_change_of_serve_cell = 1,
+ EVENT_TYPE_ue_presence_in_area_of_interest = 2,
+ EVENT_TYPE_stop_change_of_serve_cell = 3,
+ EVENT_TYPE_stop_ue_presence_in_area_of_interest = 4,
+ EVENT_TYPE_cancel_location_reporting_for_the_ue = 5
+}EventType_e;
+
+typedef enum
+{
+ REPORT_AREA_CELL = 0
+}ReportArea_e;
+
+typedef enum
+{
+ HANDOVERTYPE_INTRA_5GS = 0,
+ HANDOVERTYPE_5GS_TO_EPS = 1,
+ HANDOVERTYPE_EPS_TO_5GS = 2
+}HandoverType_e;
+
+typedef enum
+{
+ DL_NGU_TNL_INFO_REUSED_TRUE = 0
+}DlNguTnlInfoReused_e;
+
+typedef enum
+{
+ NEW_SECURITY_CONTEXT_IND_TRUE = 0
+}NewSecurityCtxInd_e;
+
+typedef enum
+{
+ TIME_WAIT_1S = 0,
+ TIME_WAIT_2S = 1,
+ TIME_WAIT_5S = 2,
+ TIME_WAIT_10S = 3,
+ TIME_WAIT_20S = 4,
+ TIME_WAIT_60S = 5
+} TimeToWait_e;
+
+typedef enum
+{
+ INITIATING_MESSAGE = 0,
+ SUCCESSFUL_OUTCOME = 1,
+ UNSUCCESSFUL_OUTCOME = 2
+} TriggerMsg_e;
+
+typedef enum
+{
+ CRITICALITY_REJECT = 0,
+ CRITICALITY_IGNORE = 1,
+ CRITICALITY_NOTIFY = 2
+} Criticality_e;
+
+typedef enum
+{
+ ERROR_NOT_UNDERSTOOD = 0,
+ ERROR_MISSING = 1
+} ErrorType_e;
+
+typedef enum
+{
+ CN_SUPPORT_EPC = 0,
+ CN_SUPPORT_5GC = 1,
+ CN_SUPPORT_BOTH = 2
+}CNSupport_e;
+
+typedef enum pduSessType
+{
+ Pdu_Session_Type_ipv4 = 0,
+ Pdu_Session_Type_ipv6 = 1,
+ Pdu_Session_Type_ipv4v6 = 2,
+ Pdu_Session_Type_ethernet = 3,
+ Pdu_Session_Type_unstructured = 4
+} PduSessType_e;
+
+typedef enum iPIndication
+{
+ IP_REQUIRED = 0,
+ IP_PREFERRED = 1,
+ IP_NOT_NEEDED = 2
+} IPIndication_e;
+
+typedef enum cPIndication
+{
+ CP_REQUIRED = 0,
+ CP_PREFERRED = 1,
+ CP_NOT_NEEDED = 2
+} CPIndication_e;
+
+typedef enum maxIpDataRate
+{
+ BITRATE_64K = 0,
+ MAX_UE_RATE = 1
+} MaxIpDataRate_e;
+
+typedef enum iPResult
+{
+ IP_RESULT_PERFORMED = 0,
+ IP_RESULT_NOT_PERFORMED = 1
+} IPResult_e;
+
+typedef enum cPResult
+{
+ CP_RESULT_PERFORMED = 0,
+ CP_RESULT_NOT_PERFORMED = 1
+} CPResult_e;
+
+typedef enum
+{
+ Dynamic5QIDelayCritical_delay_critical = 0,
+ Dynamic5QIDelayCritical_non_delay_critical = 1
+} Dynamic5QIDelayCritical_e;
+
+typedef enum
+{
+ PreEmptionCapability_shall_not_trigger_pre_emption = 0,
+ PreEmptionCapability_may_trigger_pre_emption = 1
+} PreEmptionCapability_e;
+
+typedef enum
+{
+ PreEmptionVulnerability_not_pre_emptable = 0,
+ PreEmptionVulnerability_pre_emptable = 1
+} PreEmptionVulnerability_e;
+
+
+typedef enum
+{
+ QOS_CHARACTER_PR_NOTHING,
+ QOS_CHARACTER_PR_NON_DINAMIC_5QI,
+ QOS_CHARACTER_PR_DYNAMIC_5QI,
+ QOS_CHARACTER_PR_CHOICE_EXTENSION
+} QosCharacterPR_e;
+
+typedef enum
+{
+ ADDITIONAL_QOS_FLOW_INFORMATION_MORE_LIKELY
+} AddQosFlowInfo_e;
+
+typedef enum
+{
+ REFLECTIVE_QOS_ATTRIBUTE_SUBJECT_TO
+} ReflectiveQosAttribute_e;
+
+typedef enum
+{
+ QOS_FLOW_MAP_IND_UL,
+ QOS_FLOW_MAP_IND_DL
+} QosFlowMapInd_e;
+
+/**********************************************************************************
+***********************************************************************************
+********************* NG Enum Type ***************************
+***********************************************************************************
+***********************************************************************************/
+
+typedef enum ngapCause_s
+{
+ NG_START,
+ Ng_RNL_UNSPECIFIED,
+ Ng_RNL_TXnRELOCOverallExpiry,
+ Ng_RNL_Successful_handover,
+ NG_RNL_RELEASE_DUE_TO_GENERATED_REASON,
+ NG_RNL_RELEASE_DUE_TO_5GC_GENERATE_REASON,
+ NG_RNL_HANDOVER_CANCELLED,
+ NG_RNL_PARTIAL_HANDOVER,
+ NG_RNL_HANDOVER_FAILURE_IN_TARGET_5GC_NGRAN_NODE_OR_TARGET_SYSTEM,
+ NG_RNL_HANDOVER_FAILURE_5GC_NGRAN_OR_SYSTEM,
+ NG_RNL_HANDOVER_TARGET_NOT_ALLOWED,
+ NG_RNL_TNGRELOCOVERALL_EXPIRY,
+ NG_RNL_TNGRELOCPREP_EXPIRY,
+ NG_RNL_CELL_NOT_AVAILABLE,
+ NG_RNL_UNKNOWN_TARGET_ID,
+ NG_RNL_NO_RADIO_RESOURCES_AVAILABLE_IN_TARGET_CELL,
+ NG_RNL_UNKNOWN_LOCAL_UE_NGAP_ID,
+ NG_RNL_INCONSISTENT_REMOTE_UE_NGAP_ID,
+ NG_RNL_HANDOVER_DESIRABLE_FOR_RADIO_REASONS,
+ NG_RNL_TIME_CRITICAL_HANDOVER,
+ NG_RNL_RESOURCE_OPTIMISATION_HANDOVER,
+ NG_RNL_REDUCE_LOAD_IN_SERVING_CELL,
+ NG_RNL_USER_INACTIVITY,
+ NG_RNL_RADIO_CONNECTION_WITH_UE_LOST,
+ NG_RNL_RADIO_RESOURCES_NOT_AVAILABLE,
+ NG_RNL_INVALID_QOS_COMBINATION,
+ NG_RNL_FAILURE_IN_THE_RADIO_INTERFACE_PROCEDURE,
+ NG_RNL_INTERACTION_WITH_OTHER_PROCEDURE,
+ NG_RNL_UNKNOWN_PDU_SESSION_ID,
+ NG_RNL_UNKNOWN_QOS_FLOW_ID,
+ NG_RNL_MULTIPLE_PDU_SESSION_ID_INSTANCES,
+ NG_RNL_MULTIPLE_QOS_FLOW_ID_INSTANCES,
+ NG_RNL_ENCRYPTION_AND_OR_INTEGRITY_PROTECTION_ALGORITHMS_NOT_SUPPORTED,
+ NG_RNL_NG_INTRA_SYSTEM_HANDOVER_TRIGGERED,
+ NG_RNL_NG_INTER_SYSTEM_HANDOVER_TRIGGERED,
+ NG_RNL_XN_HANDOVER_TRIGGERED,
+ NG_RNL_NOT_SUPPORTED_5QI_VALUE,
+ NG_RNL_UE_CONTEXT_TRANSFER,
+ NG_RNL_IMS_VOICE_EPS_FALLBACK_OR_RAT_FALLBACK_TRIGGERED,
+ NG_RNL_UP_INTEGRITY_PROTECTION_NOT_POSSIBLE,
+ NG_RNL_UP_CONFIDENTIALITY_PROTECTION_NOT_POSSIBLE,
+ NG_RNL_SLICE_NOT_SUPPORTED,
+ NG_RNL_UE_IN_RRC_INACTIVE_STATE_NOT_REACHABLE,
+ NG_RNL_REDIRECTION,
+ NG_RNL_RESOURCES_NOT_AVAILABLE_FOR_THE_SLICE,
+ NG_RNL_UE_MAXIMUM_INTEGRITY_PROTECTED_DATA_RATE_REASON,
+ NG_RNL_RELEASE_DUE_TO_CN_DETECTED_MOBILITY,
+ NG_RNL_N26_INTERFACE_NOT_AVAILABLE,
+ NG_RNL_RELEASE_DUE_TO_PRE_EMPTION,
+ NG_RNL_END,
+ NG_TL_TRANSPORT_RESOURCE_UNAVAILABLE,
+ NG_TL_UNSPECIFIED,
+ NG_TL_END,
+ NG_NAS_NORMAL_RELEASE,
+ NG_NAS_AUTHENTICATION_FAILURE,
+ NG_NAS_DEREGISTER,
+ NG_NAS_UNSPECIFIED,
+ NG_NAS_END,
+ NG_PC_TRANSFER_SYNTAX_ERROR,
+ NG_PC_ABSTRACT_SYNTAX_ERROR_REJECT,
+ NG_PC_ABSTRACT_SYNTAX_ERROR_IGNORE_AND_NOTIFY,
+ NG_PC_MESSAGE_NOT_COMPATIBLE_WITH_RECEIVER_STATE,
+ NG_PC_SEMANTIC_ERROR,
+ NG_PC_ABSTRACT_SYNTAX_ERROR,
+ NG_PC_UNSPECIFIED,
+ NG_PC_END,
+ NG_MISC_CONTROL_PROCESSING_OVERLOAD,
+ NG_MISC_NOT_ENOUGH_USER_PLANE_PROCESSING_RESOURCES,
+ NG_MISC_HARDWARE_FAILURE,
+ NG_MISC_OM_INTERVENTION,
+ NG_MISC_UNKNOWN_PLMN,
+ NG_MISC_UNSPECIFIED,
+ NG_MISC_END,
+ NG_END
+}NgapCause_e;
+
+typedef enum ngapProcCode
+{
+ Ng_AMFConfigurationUpdate = 0,
+ Ng_AMFStatusIndication = 1,
+ Ng_CellTrafficTrace = 2,
+ Ng_DeactivateTrace = 3,
+ Ng_DownlinkNASTransport = 4,
+ Ng_DownlinkNonUEAssociatedNRPPaTransport = 5,
+ Ng_DownlinkRANConfigurationTransfer = 6,
+ Ng_DownlinkRANStatusTransfer = 7,
+ Ng_DownlinkUEAssociatedNRPPaTransport = 8,
+ Ng_NGErrorIndication = 9,
+ Ng_HandoverCancel = 10,
+ Ng_HandoverNotification = 11,
+ Ng_HandoverPreparation = 12,
+ Ng_HandoverResourceAllocation = 13,
+ Ng_InitialContextSetup = 14,
+ Ng_InitialUEMessage = 15,
+ Ng_LocationReportingControl = 16,
+ Ng_LocationReportingFailureIndication = 17,
+ Ng_LocationReport = 18,
+ Ng_NASNonDeliveryIndication = 19,
+ Ng_NGReset = 20,
+ Ng_NGSetup = 21,
+ Ng_OverloadStart = 22,
+ Ng_OverloadStop = 23,
+ Ng_NGPaging = 24,
+ Ng_PathSwitchRequest = 25,
+ Ng_PDUSessionResourceModify = 26,
+ Ng_PDUSessionResourceModifyIndication = 27,
+ Ng_PDUSessionResourceRelease = 28,
+ Ng_PDUSessionResourceSetup = 29,
+ Ng_PDUSessionResourceNotify = 30,
+ Ng_NGPrivateMessage = 31,
+ Ng_NGPWSCancel = 32,
+ Ng_NGPWSFailureIndication = 33,
+ Ng_NGPWSRestartIndication = 34,
+ Ng_RANConfigurationUpdate = 35,
+ Ng_RerouteNASRequest = 36,
+ Ng_RRCInactiveTransitionReport = 37,
+ Ng_TraceFailureIndication = 38,
+ Ng_TraceStart = 39,
+ Ng_NGUEContextModification = 40,
+ Ng_NGUEContextRelease = 41,
+ Ng_NGUEContextReleaseRequest = 42,
+ Ng_UERadioCapabilityCheck = 43,
+ Ng_UERadioCapabilityInfoIndication = 44,
+ Ng_UETNLABindingRelease = 45,
+ Ng_UplinkNASTransport = 46,
+ Ng_UplinkNonUEAssociatedNRPPaTransport = 47,
+ Ng_UplinkRANConfigurationTransfer = 48,
+ Ng_UplinkRANStatusTransfer = 49,
+ Ng_UplinkUEAssociatedNRPPaTransport = 50,
+ Ng_WriteReplaceWarning = 51,
+ Ng_SecondaryRATDataUsageReport = 52
+} NgapProcCode_e;
+
+typedef enum ngapProtocolIeId
+{
+ Ngap_AllowedNSSAI = 0,
+ Ngap_AMFName = 1,
+ Ngap_AMFOverloadResponse = 2,
+ Ngap_AMFSetID = 3,
+ Ngap_AMF_TNLAssociationFailedToSetupList = 4,
+ Ngap_AMF_TNLAssociationSetupList = 5,
+ Ngap_AMF_TNLAssociationToAddList = 6,
+ Ngap_AMF_TNLAssociationToRemoveList = 7,
+ Ngap_AMF_TNLAssociationToUpdateList = 8,
+ Ngap_AMFTrafficLoadReductionIndication = 9,
+ Ngap_AMF_UE_NGAP_ID = 10,
+ Ngap_AssistanceDataForPaging = 11,
+ Ngap_BroadcastCancelledAreaList = 12,
+ Ngap_BroadcastCompletedAreaList = 13,
+ Ngap_CancelAllWarningMessages = 14,
+ Ngap_NGCause = 15,
+ Ngap_CellIDListForRestart = 16,
+ Ngap_ConcurrentWarningMessageInd = 17,
+ Ngap_CoreNetworkAssistanceInformation = 18,
+ Ngap_NGCriticalityDiagnostics = 19,
+ Ngap_DataCodingScheme = 20,
+ Ngap_DefaultPagingDRX = 21,
+ Ngap_DirectForwardingPathAvailability = 22,
+ Ngap_EmergencyAreaIDListForRestart = 23,
+ Ngap_EmergencyFallbackIndicator = 24,
+ Ngap_EUTRA_CGI = 25,
+ Ngap_FiveG_S_TMSI = 26,
+ Ngap_GlobalRANNodeID = 27,
+ Ngap_GUAMI = 28,
+ Ngap_HandoverType = 29,
+ Ngap_IMSVoiceSupportIndicator = 30,
+ Ngap_IndexToRFSP = 31,
+ Ngap_InfoOnRecommendedCellsAndRANNodesForPaging = 32,
+ Ngap_LocationReportingRequestType = 33,
+ Ngap_NGMaskedIMEISV = 34,
+ Ngap_MessageIdentifier = 35,
+ Ngap_MobilityRestrictionList = 36,
+ Ngap_NASC = 37,
+ Ngap_NAS_PDU = 38,
+ Ngap_NASSecurityParametersFromNGRAN = 39,
+ Ngap_NewAMF_UE_NGAP_ID = 40,
+ Ngap_NewSecurityContextInd = 41,
+ Ngap_NGAP_Message = 42,
+ Ngap_NGRAN_CGI = 43,
+ Ngap_NGRANTraceID = 44,
+ Ngap_NGNR_CGI = 45,
+ Ngap_NRPPa_PDU = 46,
+ Ngap_NumberOfBroadcastsRequested = 47,
+ Ngap_OldAMF = 48,
+ Ngap_OverloadStartNSSAIList = 49,
+ Ngap_NGPagingDRX = 50,
+ Ngap_PagingOrigin = 51,
+ Ngap_NGPagingPriority = 52,
+ Ngap_PDUSessionResourceAdmittedList = 53,
+ Ngap_PDUSessionResourceFailedToModifyListModRes = 54,
+ Ngap_PDUSessionResourceFailedToSetupListCxtRes = 55,
+ Ngap_PDUSessionResourceFailedToSetupListHOAck = 56,
+ Ngap_PDUSessionResourceFailedToSetupListPSReq = 57,
+ Ngap_PDUSessionResourceFailedToSetupListSURes = 58,
+ Ngap_PDUSessionResourceHandoverList = 59,
+ Ngap_PDUSessionResourceListCxtRelCpl = 60,
+ Ngap_PDUSessionResourceListHORqd = 61,
+ Ngap_PDUSessionResourceModifyListModCfm = 62,
+ Ngap_PDUSessionResourceModifyListModInd = 63,
+ Ngap_PDUSessionResourceModifyListModReq = 64,
+ Ngap_PDUSessionResourceModifyListModRes = 65,
+ Ngap_PDUSessionResourceNotifyList = 66,
+ Ngap_PDUSessionResourceReleasedListNot = 67,
+ Ngap_PDUSessionResourceReleasedListPSAck = 68,
+ Ngap_PDUSessionResourceReleasedListPSFail = 69,
+ Ngap_PDUSessionResourceReleasedListRelRes = 70,
+ Ngap_PDUSessionResourceSetupListCxtReq = 71,
+ Ngap_PDUSessionResourceSetupListCxtRes = 72,
+ Ngap_PDUSessionResourceSetupListHOReq = 73,
+ Ngap_PDUSessionResourceSetupListSUReq = 74,
+ Ngap_PDUSessionResourceSetupListSURes = 75,
+ Ngap_PDUSessionResourceToBeSwitchedDLList = 76,
+ Ngap_PDUSessionResourceSwitchedList = 77,
+ Ngap_PDUSessionResourceToReleaseListHOCmd = 78,
+ Ngap_PDUSessionResourceToReleaseListRelCmd = 79,
+ Ngap_PLMNSupportList = 80,
+ Ngap_PWSFailedCellIDList = 81,
+ Ngap_RANNodeName = 82,
+ Ngap_RANPagingPriority = 83,
+ Ngap_RANStatusTransfer_TransparentContainer = 84,
+ Ngap_RAN_UE_NGAP_ID = 85,
+ Ngap_RelativeAMFCapacity = 86,
+ Ngap_NGRepetitionPeriod = 87,
+ Ngap_NGResetType = 88,
+ Ngap_RoutingID = 89,
+ Ngap_RRCEstablishmentCause = 90,
+ Ngap_RRCInactiveTransitionReportRequest = 91,
+ Ngap_RRCState = 92,
+ Ngap_SecurityContext = 93,
+ Ngap_SecurityKey = 94,
+ Ngap_SerialNumber = 95,
+ Ngap_ServedGUAMIList = 96,
+ Ngap_NGSliceSupportList = 97,
+ Ngap_SONConfigurationTransferDL = 98,
+ Ngap_SONConfigurationTransferUL = 99,
+ Ngap_SourceAMF_UE_NGAP_ID = 100,
+ Ngap_SourceToTarget_TransparentContainer = 101,
+ Ngap_SupportedTAList = 102,
+ Ngap_TAIListForPaging = 103,
+ Ngap_TAIListForRestart = 104,
+ Ngap_TargetID = 105,
+ Ngap_TargetToSource_TransparentContainer = 106,
+ Ngap_NGTimeToWait = 107,
+ Ngap_TraceActivation = 108,
+ Ngap_TraceCollectionEntityIPAddress = 109,
+ Ngap_UEAggregateMaximumBitRate = 110,
+ Ngap_UE_associatedLogicalNG_connectionList = 111,
+ Ngap_UEContextRequest = 112,
+ Ngap_UE_NGAP_IDs = 114,
+ Ngap_UEPagingIdentity = 115,
+ Ngap_UEPresenceInAreaOfInterestList = 116,
+ Ngap_UERadioCapability = 117,
+ Ngap_UERadioCapabilityForPaging = 118,
+ Ngap_UESecurityCapabilities = 119,
+ Ngap_UnavailableGUAMIList = 120,
+ Ngap_UserLocationInformation = 121,
+ Ngap_WarningAreaList = 122,
+ Ngap_WarningMessageContents = 123,
+ Ngap_WarningSecurityInfo = 124,
+ Ngap_WarningType = 125,
+ Ngap_AdditionalUL_NGU_UP_TNLInformation = 126,
+ Ngap_DataForwardingNotPossible = 127,
+ Ngap_DL_NGU_UP_TNLInformation = 128,
+ Ngap_NGNetworkInstance = 129,
+ Ngap_PDUSessionAggregateMaximumBitRate = 130,
+ Ngap_PDUSessionResourceFailedToModifyListModCfm = 131,
+ Ngap_PDUSessionResourceFailedToSetupListCxtFail = 132,
+ Ngap_PDUSessionResourceListCxtRelReq = 133,
+ Ngap_PDUSessionType = 134,
+ Ngap_QosFlowAddOrModifyRequestList = 135,
+ Ngap_QosFlowSetupRequestList = 136,
+ Ngap_QosFlowToReleaseList = 137,
+ Ngap_NGSecurityIndication = 138,
+ Ngap_UL_NGU_UP_TNLInformation = 139,
+ Ngap_UL_NGU_UP_TNLModifyList = 140,
+ Ngap_WarningAreaCoordinates = 141,
+ Ngap_PDUSessionResourceSecondaryRATUsageList = 142,
+ Ngap_HandoverFlag = 143,
+ Ngap_SecondaryRATUsageInformation = 144,
+ Ngap_PDUSessionResourceReleaseResponseTransfer = 145,
+ Ngap_RedirectionVoiceFallback = 146,
+ Ngap_UERetentionInformation = 147,
+ Ngap_NGS_NSSAI = 148,
+ Ngap_PSCellInformation = 149,
+ Ngap_LastEUTRAN_PLMNIdentity = 150,
+ Ngap_MaximumIntegrityProtectedDataRate_DL = 151,
+ Ngap_AdditionalDLForwardingUPTNLInformation = 152,
+ Ngap_AdditionalDLUPTNLInformationForHOList = 153,
+ Ngap_AdditionalNGU_UP_TNLInformation = 154,
+ Ngap_AdditionalDLQosFlowPerTNLInformation = 155,
+ Ngap_NGSecurityResult = 156,
+ Ngap_ENDC_SONConfigurationTransferDL = 157,
+ Ngap_ENDC_SONConfigurationTransferUL = 158
+} NgapProtocolIeId_e;
+
+typedef enum
+{
+ GUAMITYPE_NATIVE,
+ GUAMITYPE_MAPPPED
+}guamiType_e;
+
+typedef enum
+{
+ IMSVoiceSupportInd_supported,
+ IMSVoiceSupportInd_not_supported
+}IMSVoiceSupportInd_e;
+
+typedef enum
+{
+ rrcEstablishmentCause_emergency = 0,
+ rrcEstablishmentCause_highPriorityAccess = 1,
+ rrcEstablishmentCause_mt_Access = 2,
+ rrcEstablishmentCause_mo_Signalling = 3,
+ rrcEstablishmentCause_mo_Data = 4,
+ rrcEstablishmentCause_mo_VoiceCall = 5,
+ rrcEstablishmentCause_mo_VideoCall = 6,
+ rrcEstablishmentCause_mo_SMS = 7,
+ rrcEstablishmentCause_mps_PriorityAccess = 8,
+ rrcEstablishmentCause_mcs_PriorityAccess = 9,
+ rrcEstablishmentCause_notAvailable = 10
+} RrcEstablishmentCause_e;
+
+typedef enum
+{
+ CONTEXT_REQUESTED = 0
+} ueContextRequest_e;
+
+typedef enum
+{
+ amfPging_None,
+ amfPging_gNBId,
+ amfPging_Tai,
+ amfPging_Extension
+} AmfPgType_e;
+
+typedef enum
+{
+ ONLY_AMF_NGAPID,
+ BOTH_AMF_RAN_NGAPID
+}NgapIdType_e;
+
+typedef enum
+{
+ Paging_DRX_v32 = 0,
+ Paging_DRX_v64 = 1,
+ Paging_DRX_v128 = 2,
+ Paging_DRX_v256 = 3
+} PagingDRX_e;
+
+typedef enum
+{
+ PAGING_PRIORITY_LEVEL1 = 0,
+ PAGING_PRIORITY_LEVEL2 = 1,
+ PAGING_PRIORITY_LEVEL3 = 2,
+ PAGING_PRIORITY_LEVEL4 = 3,
+ PAGING_PRIORITY_LEVEL5 = 4,
+ PAGING_PRIORITY_LEVEL6 = 5,
+ PAGING_PRIORITY_LEVEL7 = 6,
+ PAGING_PRIORITY_LEVEL8 = 7,
+}PagingPriority_e;
+
+typedef enum
+{
+ UE_RETEN_INFO_UES_RETAINED = 0
+} UERetentionInformation_e;
+
+typedef enum
+{
+ EMERGENCY_FALLBACK_REQUESTED = 0
+} EmergencyFallbackRequestIndicator_e;
+
+typedef enum
+{
+ EMERGENCY_SERVICE_TARGET_5GC = 0,
+ EMERGENCY_SERVICE_TARGET_epc
+} EmergencyServiceTargetCN_e;
+
+typedef enum
+{
+ BEHAVIOUR_INFO_SUBSCRIPTION_INFORMATION = 0,
+ BEHAVIOUR_INFO_STATISTICS = 1
+} SourceOfUEActivityBehaviourInformation_e;
+
+typedef enum
+{
+ NotificationControl_requested = 0
+} NotificationControl_e;
+
+typedef enum
+{
+ AVAILABLE = 0
+}DirectForwardPathAvailability_e;
+
+/**********************************************************************************
+***********************************************************************************
+********************* E1 Enum Type ***************************
+***********************************************************************************
+***********************************************************************************/
+
+typedef enum e1apCausePr
+{
+ E1apCause_PR_NOTHING,
+ E1apCause_PR_radioNetwork,
+ E1apCause_PR_transport,
+ E1apCause_PR_protocol,
+ E1apCause_PR_misc,
+ E1apCause_PR_choice_extension
+} E1apCausePr_e;
+typedef enum e1apResetPr
+{
+ E1Reset_PR_NOTHING,
+ E1Reset_PR_e1_Interface,
+ E1Reset_PR_partOfE1_Interface,
+ E1Reset_PR_choice_extension
+} E1apResetPr_e;
+
+typedef enum e1apCauseRadioNetwork
+{
+ E1apCauseRadioNetwork_unspecified = 0,
+ E1apCauseRadioNetwork_unknown_or_already_allocated_gnb_cu_cp_ue_e1ap_id = 1,
+ E1apCauseRadioNetwork_unknown_or_already_allocated_gnb_cu_up_ue_e1ap_id = 2,
+ E1apCauseRadioNetwork_unknown_or_inconsistent_pair_of_ue_e1ap_id = 3,
+ E1apCauseRadioNetwork_interaction_with_other_procedure = 4,
+ E1apCauseRadioNetwork_pPDCP_Count_wrap_around = 5,
+ E1apCauseRadioNetwork_not_supported_E1QCI_value = 6,
+ E1apCauseRadioNetwork_not_supported_5QI_value = 7,
+ E1apCauseRadioNetwork_encryption_algorithms_not_supported = 8,
+ E1apCauseRadioNetwork_integrity_protection_algorithms_not_supported = 9,
+ E1apCauseRadioNetwork_uP_integrity_protection_not_possible = 10,
+ E1apCauseRadioNetwork_uP_confidentiality_protection_not_possible = 11,
+ E1apCauseRadioNetwork_multiple_PDU_Session_ID_Instances = 12,
+ E1apCauseRadioNetwork_unknown_PDU_Session_ID = 13,
+ E1apCauseRadioNetwork_multiple_QoS_Flow_ID_Instances = 14,
+ E1apCauseRadioNetwork_unknown_QoS_Flow_ID = 15,
+ E1apCauseRadioNetwork_multiple_E1DRB_ID_Instances = 16,
+ E1apCauseRadioNetwork_unknown_E1DRB_ID = 17,
+ E1apCauseRadioNetwork_invalid_QoS_combination = 18,
+ E1apCauseRadioNetwork_procedure_cancelled = 19,
+ E1apCauseRadioNetwork_normal_release = 20,
+ E1apCauseRadioNetwork_no_radio_resources_available = 21,
+ E1apCauseRadioNetwork_action_desirable_for_radio_reasons = 22,
+ E1apCauseRadioNetwork_resources_not_available_for_the_slice = 23,
+ E1apCauseRadioNetwork_pDCP_configuration_not_supported = 24,
+ E1apCauseRadioNetwork_ue_dl_max_IP_data_rate_reason = 25,
+ E1apCauseRadioNetwork_uP_integrity_protection_failure = 26,
+ E1apCauseRadioNetwork_release_due_to_pre_emption = 27
+} E1apCauseRadioNetwork_e;
+
+typedef enum e1apCauseTransport
+{
+ E1apCauseTransport_unspecified = 0,
+ E1apCauseTransport_transport_resource_unavailable = 1
+} E1apCauseTransport_e;
+
+typedef enum e1apCauseProtocol
+{
+ E1apCauseProtocol_transfer_syntax_error = 0,
+ E1apCauseProtocol_abstract_syntax_error_reject = 1,
+ E1apCauseProtocol_abstract_syntax_error_ignore_and_notify = 2,
+ E1apCauseProtocol_message_not_compatible_with_receiver_state = 3,
+ E1apCauseProtocol_semantic_error = 4,
+ E1apCauseProtocol_abstract_syntax_error_falsely_constructed_message = 5,
+ E1apCauseProtocol_unspecified = 6
+} E1apCauseProtocol_e;
+
+typedef enum e1apCauseMisc
+{
+ E1apCauseMisc_control_processing_overload = 0,
+ E1apCauseMisc_not_enough_user_plane_processing_resources = 1,
+ E1apCauseMisc_hardware_failure = 2,
+ E1apCauseMisc_om_intervention = 3,
+ E1apCauseMisc_unspecified = 4
+} E1apCauseMisc_e;
+
+typedef enum e1apCause_s
+{
+ RNL_UNSPECIFIED,
+ RNL_CUCP_UE_E1AP_ID_ERROR,
+ RNL_CUUP_UE_E1AP_ID_ERROR,
+ RNL_PAIR_UE_E1AP_ID_ERROR,
+ RNL_INTERACTIIN_WITH_OTHER_PROCEDURE,
+ RNL_PDCP_COUNT_WRAP_ROUND,
+ RNL_QCI_NOT_SUPPORT,
+ RNL_5QI_NOT_SUPPORT,
+ RNL_ENCRYPTION_ALGO_NOT_SUPPORT,
+ RNL_INTEGRITY_ALGO_NOT_SUPPORT,
+ RNL_UP_INTEGRITY_PROTECTION_NOT_POSSIBLE,
+ RNL_UP_CONFIDENTIALITY_PROTECTION_NOT_POSSIBLE,
+ RNL_MULTI_PDU_SESSION_ID_INSTANCE,
+ RNL_UNKNOW_PDU_SESSION_ID,
+ RNL_MULTI_QOS_FLOW_ID_INSTANCE,
+ RNL_UNKNOW_QOS_FLOW_ID,
+ RNL_MULTI_DRB_ID_INSTANCE,
+ RNL_UNKNOW_DRB_ID,
+ RNL_INVALID_QOS_COMBINATION,
+ RNL_PROCEDURE_CANCELLED,
+ RNL_NORMAL_RELEASE,
+ RNL_NO_RADIO_RESOUCE_AVALABLE,
+ RNL_ACTION_DESIRABLE_FOR_RADIO_REASONS,
+ RNL_RESOUCE_NOT_AVALABLE_FOR_SLICE,
+ RNL_PDCP_CONFIG_NOT_SUPPORT,
+ RNL_CAUSE_MAX_VALUE,
+ TLC_UNSPECIFIED,
+ TLC_TRANSPORT_RESOURCE_UNAVALABLE,
+ TLC_CAUSE_MAX_VALUE,
+ PC_TRANSFER_SYNTAX_ERROR,
+ PC_ABSTRACT_SYNTAX_ERROR_REJECT,
+ PC_ABSTRACT_SYNTAX_ERROR_IGNORE_NOTIFY,
+ PC_MSG_NOT_COMPATIBLE_WITH_STATE,
+ PC_SMANITC_ERROR,
+ PC_ABSTRACT_SYSNTAX_ERROR_FALSE_CONSTRUCT_MSG,
+ PC_UNSPECIFIED,
+ PC_CAUSE_MAX_VALUE,
+ MISC_CONTROL_PROCESS_OVERLOAD,
+ MISC_USER_PLANE_PROCESS_OVERLOAD,
+ MISC_HARDWARE_FAILURE,
+ MISC_OM_INTERVENTION,
+ MISC_UNSPECIFIED,
+ MISC_CAUSE_MAX_VALUE
+}E1apCause_e;
+
+typedef enum e1apProcCode
+{
+ E1_e1reset = 0,
+ E1_e1errorIndication = 1,
+ E1_privateMessage = 2,
+ E1_gNB_CU_UP_E1Setup = 3,
+ E1_gNB_CU_CP_E1Setup = 4,
+ E1_gNB_CU_UP_ConfigurationUpdate = 5,
+ E1_gNB_CU_CP_ConfigurationUpdate = 6,
+ E1_e1Release = 7,
+ E1_bearerContextSetup = 8,
+ E1_bearerContextModification = 9,
+ E1_bearerContextModificationRequired = 10,
+ E1_bearerContextRelease = 11,
+ E1_bearerContextReleaseRequest = 12,
+ E1_bearerContextInactivityNotification = 13,
+ E1_dLDataNotification = 14,
+ E1_dataUsageReport = 15,
+ E1_gNB_CU_UP_CounterCheck = 16,
+ E1_gNB_CU_UP_StatusIndication = 17,
+ E1_uLDataNotification = 18,
+ E1_mRDC_DataUsageReport = 19
+} E1apProcCode_e;
+
+typedef enum e1apProtocolIeId
+{
+ E1ap_E1Cause = 0,
+ E1ap_E1CriticalityDiagnostics = 1,
+ E1ap_gNB_CU_CP_UE_E1AP_ID = 2,
+ E1ap_gNB_CU_UP_UE_E1AP_ID = 3,
+ E1ap_E1ResetType = 4,
+ E1ap_UE_associatedLogicalE1_ConnectionItem = 5,
+ E1ap_UE_associatedLogicalE1_ConnectionListResAck = 6,
+ E1ap_gNB_CU_UP_ID = 7,
+ E1ap_gNB_CU_UP_Name = 8,
+ E1ap_gNB_CU_CP_Name = 9,
+ E1ap_CNSupport = 10,
+ E1ap_SupportedPLMNs = 11,
+ E1ap_E1TimeToWait = 12,
+ E1ap_SecurityInformation = 13,
+ E1ap_UEDLAggregateMaximumBitRate = 14,
+ E1ap_System_BearerContextSetupRequest = 15,
+ E1ap_System_BearerContextSetupResponse = 16,
+ E1ap_BearerContextStatusChange = 17,
+ E1ap_System_BearerContextModificationRequest = 18,
+ E1ap_System_BearerContextModificationResponse = 19,
+ E1ap_System_BearerContextModificationConfirm = 20,
+ E1ap_System_BearerContextModificationRequired = 21,
+ E1ap_DRB_Status_List = 22,
+ E1ap_ActivityNotificationLevel = 23,
+ E1ap_ActivityInformation = 24,
+ E1ap_Data_Usage_Report_List = 25,
+ E1ap_New_UL_TNL_Information_Required = 26,
+ E1ap_GNB_CU_CP_TNLA_To_Add_List = 27,
+ E1ap_GNB_CU_CP_TNLA_To_Remove_List = 28,
+ E1ap_GNB_CU_CP_TNLA_To_Update_List = 29,
+ E1ap_GNB_CU_CP_TNLA_Setup_List = 30,
+ E1ap_GNB_CU_CP_TNLA_Failed_To_Setup_List = 31,
+ E1ap_DRB_To_Setup_List_EUTRAN = 32,
+ E1ap_DRB_To_Modify_List_EUTRAN = 33,
+ E1ap_DRB_To_Remove_List_EUTRAN = 34,
+ E1ap_DRB_Required_To_Modify_List_EUTRAN = 35,
+ E1ap_DRB_Required_To_Remove_List_EUTRAN = 36,
+ E1ap_DRB_Setup_List_EUTRAN = 37,
+ E1ap_DRB_Failed_List_EUTRAN = 38,
+ E1ap_DRB_Modified_List_EUTRAN = 39,
+ E1ap_DRB_Failed_To_Modify_List_EUTRAN = 40,
+ E1ap_DRB_Confirm_Modified_List_EUTRAN = 41,
+ E1ap_PDU_Session_Resource_To_Setup_List = 42,
+ E1ap_PDU_Session_Resource_To_Modify_List = 43,
+ E1ap_PDU_Session_Resource_To_Remove_List = 44,
+ E1ap_PDU_Session_Resource_Required_To_Modify_List = 45,
+ E1ap_PDU_Session_Resource_Setup_List = 46,
+ E1ap_PDU_Session_Resource_Failed_List = 47,
+ E1ap_PDU_Session_Resource_Modified_List = 48,
+ E1ap_PDU_Session_Resource_Failed_To_Modify_List = 49,
+ E1ap_PDU_Session_Resource_Confirm_Modified_List = 50,
+ E1ap_DRB_To_Setup_Mod_List_EUTRAN = 51,
+ E1ap_DRB_Setup_Mod_List_EUTRAN = 52,
+ E1ap_DRB_Failed_Mod_List_EUTRAN = 53,
+ E1ap_PDU_Session_Resource_Setup_Mod_List = 54,
+ E1ap_PDU_Session_Resource_Failed_Mod_List = 55,
+ E1ap_PDU_Session_Resource_To_Setup_Mod_List = 56,
+ E1ap_E1TransactionID = 57,
+ E1ap_Serving_PLMN = 58,
+ E1ap_UE_Inactivity_Timer = 59,
+ E1ap_System_GNB_CU_UP_CounterCheckRequest = 60,
+ E1ap_DRBs_Subject_To_Counter_Check_List_EUTRAN = 61,
+ E1ap_DRBs_Subject_To_Counter_Check_List_NG_RAN = 62,
+ E1ap_PPI = 63,
+ E1ap_gNB_CU_UP_Capacity = 64,
+ E1ap_GNB_CU_UP_OverloadInformation = 65,
+ E1ap_UEDLMaximumIntegrityProtectedDataRate = 66,
+ E1ap_PDU_Session_To_Notify_List = 67,
+ E1ap_PDU_Session_Resource_Data_Usage_List = 68,
+ E1ap_E1SNSSAI = 69,
+ E1ap_DataDiscardRequired = 70
+} E1apProtocolIeId_e;
+
+typedef enum
+{
+ ACT_NOTI_DRB,
+ ACT_NOTI_PDU_SESSION,
+ ACT_NOTI_UE
+} ActNotiLevel_e;
+
+typedef enum
+{
+ BEARER_CXT_STATUS_CHANGE_SUSPEND,
+ BEARER_CXT_STATUS_CHANGE_RESUME
+} BearCxtStatusChange_e;
+
+typedef enum
+{
+ DATA_FORWARD_REQ_UL,
+ DATA_FORWARD_REQ_DL,
+ DATA_FORWARD_REQ_BOTH
+} DataForwardReq_e;
+
+typedef enum
+{
+ CipAlgorithm_NEA0,
+ CipAlgorithm_NEA1,
+ CipAlgorithm_NEA2,
+ CipAlgorithm_NEA3
+}CipAlgorithm_e;
+
+typedef enum
+{
+ IpAlgorithm_NIA0,
+ IpAlgorithm_NIA1,
+ IpAlgorithm_NIA2,
+ IpAlgorithm_NIA3
+}IpAlgorithm_e;
+
+typedef enum
+{
+ PRIORITY_LEVEL_SPARE = 0,
+ PRIORITY_LEVEL_HIGHEST = 1,
+ PRIORITY_LEVEL_LOWEST = 14,
+ PRIORITY_LEVEL_NO_PRIORITY = 15
+} PriorityLevel_e;
+
+typedef enum
+{
+ UL_CONFIG_NODATA = 0,
+ UL_CONFIG_SHARED = 1,
+ UL_CONFIG_ONLY = 2
+} UlConfig_e;
+
+typedef enum
+{
+ DL_TX_STOP_STOP = 0,
+ DL_TX_STOP_RESUME = 1
+} DlTXStop_e;
+
+typedef enum
+{
+ RAT_TYPE_NR = 0,
+ RAT_TYPE_EUTRA_NR = 1,
+ RAT_TYPE_RUTRA = 2,
+ RAT_TYPE_SPARE1 = 3
+} RatType_e;
+
+typedef enum
+{
+ DEFAULT_DRB_TRUE,
+ DEFAULT_DRB_FALSE
+} DefaultDRB_e;
+
+typedef enum
+{
+ SDAP_HEADER_PRESENT,
+ SDAP_HEADER_ABSENT
+} SdapHeader_e;
+
+typedef enum
+{
+ PDCP_SN_SIZE_S12,
+ PDCP_SN_SIZE_S18
+} PdcpSNSize_e;
+
+typedef enum
+{
+ RLCMODE_TM = 0,
+ RLCMODE_AM = 1,
+ RLCMODE_UM_BIDIRECTIONAL = 2,
+ RLCMODE_UM_UNIDIRECTIONAL_UL = 3,
+ RLCMODE_UM_UNIDIRECTIONAL_DL = 4
+} CuRlcMode_e;
+
+typedef enum
+{
+ ROHC_PARA_PR_NOTHING,
+ ROHC_PARA_PR_ROHC,
+ ROHC_PARA_PR_UL_ONLY_ROHC,
+ ROHC_PARA_PR_CHOICE_ECTENSION
+} RohcParaPR_e;
+
+typedef enum
+{
+ ROHC_CONTINUE_ROHC_TRUE = 0
+} RohcContinueRohc_e;
+
+typedef enum
+{
+ T_REORFING_MS_0 = 0,
+ T_REORFING_MS_1 = 1,
+ T_REORFING_MS_2 = 2,
+ T_REORFING_MS_4 = 3,
+ T_REORFING_MS_5 = 4,
+ T_REORFING_MS_8 = 5,
+ T_REORFING_MS_10 = 6,
+ T_REORFING_MS_15 = 7,
+ T_REORFING_MS_20 = 8,
+ T_REORFING_MS_30 = 9,
+ T_REORFING_MS_40 = 10,
+ T_REORFING_MS_50 = 11,
+ T_REORFING_MS_60 = 12,
+ T_REORFING_MS_80 = 13,
+ T_REORFING_MS_100 = 14,
+ T_REORFING_MS_120 = 15,
+ T_REORFING_MS_140 = 16,
+ T_REORFING_MS_160 = 17,
+ T_REORFING_MS_180 = 18,
+ T_REORFING_MS_200 = 19,
+ T_REORFING_MS_220 = 20,
+ T_REORFING_MS_240 = 21,
+ T_REORFING_MS_260 = 22,
+ T_REORFING_MS_280 = 23,
+ T_REORFING_MS_300 = 24,
+ T_REORFING_MS_500 = 25,
+ T_REORFING_MS_750 = 26,
+ T_REORFING_MS_1000 = 27,
+ T_REORFING_MS_1250 = 28,
+ T_REORFING_MS_1500 = 29,
+ T_REORFING_MS_1750 = 30,
+ T_REORFING_MS_2000 = 31,
+ T_REORFING_MS_2250 = 32,
+ T_REORFING_MS_2500 = 33,
+ T_REORFING_MS_2750 = 34,
+ T_REORFING_MS_3000 = 35,
+ T_REORFING_INVALID = 0xFF
+} TReordering_e;
+
+typedef enum
+{
+ DISCARD_TIMER_MS_10 = 0,
+ DISCARD_TIMER_MS_20 = 1,
+ DISCARD_TIMER_MS_30 = 2,
+ DISCARD_TIMER_MS_40 = 3,
+ DISCARD_TIMER_MS_50 = 4,
+ DISCARD_TIMER_MS_60 = 5,
+ DISCARD_TIMER_MS_75 = 6,
+ DISCARD_TIMER_MS_100 = 7,
+ DISCARD_TIMER_MS_150 = 8,
+ DISCARD_TIMER_MS_200 = 9,
+ DISCARD_TIMER_MS_250 = 10,
+ DISCARD_TIMER_MS_300 = 11,
+ DISCARD_TIMER_MS_500 = 12,
+ DISCARD_TIMER_MS_750 = 13,
+ DISCARD_TIMER_MS_1500 = 14,
+ DISCARD_TIMER_INFINITY = 15,
+ DISCARD_TIMER_INVALID = 0xFF
+} DiscardTimer_e;
+
+typedef enum
+{
+ UL_DATA_SPLIT_THRESHOLD_B0 = 0,
+ UL_DATA_SPLIT_THRESHOLD_B100 = 1,
+ UL_DATA_SPLIT_THRESHOLD_B200 = 2,
+ UL_DATA_SPLIT_THRESHOLD_B400 = 3,
+ UL_DATA_SPLIT_THRESHOLD_B800 = 4,
+ UL_DATA_SPLIT_THRESHOLD_B1600 = 5,
+ UL_DATA_SPLIT_THRESHOLD_B3200 = 6,
+ UL_DATA_SPLIT_THRESHOLD_B6400 = 7,
+ UL_DATA_SPLIT_THRESHOLD_B12800 = 8,
+ UL_DATA_SPLIT_THRESHOLD_B25600 = 9,
+ UL_DATA_SPLIT_THRESHOLD_B51200 = 10,
+ UL_DATA_SPLIT_THRESHOLD_B102400 = 11,
+ UL_DATA_SPLIT_THRESHOLD_B204800 = 12,
+ UL_DATA_SPLIT_THRESHOLD_B409600 = 13,
+ UL_DATA_SPLIT_THRESHOLD_B819200 = 14,
+ UL_DATA_SPLIT_THRESHOLD_B1228800 = 15,
+ UL_DATA_SPLIT_THRESHOLD_B1638400 = 16,
+ UL_DATA_SPLIT_THRESHOLD_B2457600 = 17,
+ UL_DATA_SPLIT_THRESHOLD_B3276800 = 18,
+ UL_DATA_SPLIT_THRESHOLD_B4096000 = 19,
+ UL_DATA_SPLIT_THRESHOLD_B4915200 = 20,
+ UL_DATA_SPLIT_THRESHOLD_B5734400 = 21,
+ UL_DATA_SPLIT_THRESHOLD_B6553600 = 22,
+ UL_DATA_SPLIT_THRESHOLD_INFINITY = 23
+} UlDataSplitThreshold_e;
+
+typedef enum
+{
+ PDCP_DUPLICATION_TRUE = 0
+} PdcpDuplication_e;
+
+typedef enum
+{
+ PDCP_REESTABLISHMENT_TRUE = 0
+} PdcpReestablishment_e;
+
+typedef enum
+{
+ PDCP_DATA_RECOVERY_TRUE = 0
+} PdcpDataRecovery_e;
+
+typedef enum
+{
+ DUPLICATION_ACTIVATION_ACTIVE = 0,
+ DUPLICATION_ACTIVATION_INACTIVE = 1
+} DuplicationActivation_e;
+
+typedef enum
+{
+ OUTOFORDER_DELIVERY_TRUE = 0
+} OutOfOrderDelivery_e;
+
+typedef enum pdcpSNStatusRequest
+{
+ PDCP_SN_Status_Request = 0
+} PdcpSNStatusRequest_e;
+
+typedef enum newUlTnlInfoRequire
+{
+ New_UL_TNL_Info_Required = 0
+} NewUlTnlInfoRequire_e;
+
+typedef enum dataDisRequire
+{
+ Data_Discard_Required = 0
+}DataDisRequire_e;
+
+typedef enum
+{
+ NG_DL_UP_UNCHANGED_TRUE = 0
+}NgDlUpUnchange_e;
+
+typedef enum
+{
+ EDI_ENABLE
+}RDI_e;
+
+#ifdef __cplusplus
+}
+
+#endif
+
+#endif
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+#ifndef __CUMODULEINTERFACEH__
+#define __CUMODULEINTERFACEH__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "cuCommon.h"
+#include "cuModuleCommon.h"
+#include "ngasn_constant.h"
+/**********************************************************************************
+***********************************************************************************
+**************** CUC <--> NGAP ACCORDING TO STRUCTURE ***************
+***********************************************************************************
+***********************************************************************************/
+typedef UINT16 Instance_t;
+
+#define NGAP_MAX_AMF_NUM 2
+#define NGAP_MAX_UE_NUM MAX_UE_NUM
+
+#define NG_MAX_TAC_NUM 10
+#define NG_MAX_PLMN_NUM 2
+
+#define NG_MAX_GUAMI_NUM 2
+#define NG_MAX_SESSION_NUM 10
+
+#define RrcVersionLatestVerEnhancedChosen 0x1
+
+#define e1ap_maxnoofErrors 256
+#define e1ap_maxnoofSPLMNs 12
+#define e1ap_maxnoofSliceItems 1024
+#define e1ap_maxnoofIndividualE1ConnectionsToReset 65536
+#define e1ap_maxnoofNGRANQOSParameters 256
+#define e1ap_maxnoofDRBs 32
+#define e1ap_maxnoofNRCGI 512
+#define e1ap_maxnoofPDUSessionResource 256
+#define e1ap_maxnoofQoSFlows 64
+#define e1ap_maxnoofUPParameters 8
+#define e1ap_maxnoofCellGroups 4
+
+
+typedef struct rrcVersion
+{
+ UINT16 bitmask;
+ UINT8 latestRrcVer;//f30版本中 asn的语法描述中是个错误,不应该是bitstring,在f70版本中已经修复
+ UINT8 latestRrcVerEn[3]; /* OPTIONAL */
+} RrcVersion_t;
+
+/* AMF Name */
+typedef RanName_t AmfName_t;
+
+typedef struct
+{
+ UINT16 plmnNum;
+ PlmnId_t plmnId[NG_MAX_PLMN_NUM];
+ SliceList_t taiSlice[NG_MAX_PLMN_NUM];
+}BroadPlmns_t;
+
+typedef struct
+{
+ UINT16 taNum;
+ CuTac_t tac[NG_MAX_TAC_NUM];
+ BroadPlmns_t bPlmn[NG_MAX_TAC_NUM];
+}SupportTas_t;
+
+typedef UINT8 AmfRegionId_t;
+
+typedef struct AmfSetId
+{
+ UINT16 amfSetId:10;
+}AmfSetId_t;
+
+typedef struct AmfPointer
+{
+ UINT8 amfPointer:6;
+}AmfPointer_t;
+
+#define GUAMI_PLMNID_PRESENCE (1<<0)
+typedef struct guami
+{
+ UINT8 bitMask;
+ PlmnId_t plmnId;
+ AmfRegionId_t amfRegionId;
+ AmfSetId_t amfSetId;
+ AmfPointer_t amfPointer;
+}Guami_t;
+
+typedef struct guamiList
+{
+ UINT8 guamiNum;
+ Guami_t guAmi[NG_MAX_GUAMI_NUM];
+ AmfName_t backupAmfName[NG_MAX_GUAMI_NUM]; /* xycTBD */
+}GuamiList_t;
+
+#define MAX_SIZE_OF_OCTET_STRING 255
+typedef struct NasPdu
+{
+ UINT32 size;
+ UINT8 buffer[MAX_SIZE_OF_OCTET_STRING];
+}NasPdu_t;
+
+typedef struct FiveGTmsi
+{
+ UINT8 fivegTmsi[4];
+}FiveGTmsi_t;
+
+typedef struct FiveGSTmsi
+{
+ AmfSetId_t amfSetId;
+ AmfPointer_t amfPointer;
+ FiveGTmsi_t fiveGTmsi;
+}FiveGSTmsi_t;
+
+typedef UINT64 AmfUeNgapId_t;
+
+#define EMERGENCY_SERVICE_TARGET_CN_PRESENT (1 << 0)
+typedef struct emergFbInd
+{
+ UINT16 bitMask;
+ EmergencyFallbackRequestIndicator_e emergencyFallbackRequestIndicator;
+ EmergencyServiceTargetCN_e emergencyServiceTargetCn; /* OPTIONAL */
+} EmergFbInd_t;
+
+typedef struct ueRadioCapaForPagOfNr
+{
+ UINT32 size;
+ UINT8 buffer[MAX_SIZE_OF_OCTET_STRING];
+}UeRadioCapaForPagOfNr_t;
+
+#define UE_RADIO_CAPABILITY_PAGING_NR_PRESENT (1 << 0)
+#define UE_RADIO_CAPABILITY_PAGING_EUTRA_PRESENT (1 << 1)
+typedef struct UeRadioCapaForPag
+{
+ UINT16 bitMask;
+ UeRadioCapaForPagOfNr_t ueRadioCapabilityForPagingOfNr; /* OPTIONAL */
+ UeRadioCapaForPagOfNr_t ueRadioCapabilityForPagingOfEutra; /* OPTIONAL */
+} UeRadioCapaForPag_t;
+
+typedef struct UeRadioCapability
+{
+ UINT32 size;
+ UINT8 buffer[MAX_SIZE_OF_OCTET_STRING];
+}UeRadioCapability_t;
+
+typedef struct ngRanTraceId
+{
+ UINT32 size;
+ UINT8 buffer[MAX_SIZE_OF_OCTET_STRING];
+}NgRanTraceId_t;
+
+typedef UINT8 InterToTrace_t;
+
+typedef struct traceActiv
+{
+ NgRanTraceId_t ngRanTraceId;
+ InterToTrace_t interfacesToTrace;
+ INT64 traceDepth;
+ TransLayerAddr_t traceCollectionEntityIpAddress;
+} TraceActiv_t;
+
+typedef struct secuKey
+{
+ UINT8 securityKey[32];
+}SecuKey_t;
+
+typedef struct
+{
+ UINT8 nextHopChainingCount;
+ SecuKey_t nextHopNH;
+}SecurityCtx_t;
+typedef UINT8 RatRestrInfo_t;
+
+typedef struct ratRestrItem
+{
+ PlmnId_t plmnId;
+ RatRestrInfo_t ratRestrInfo;
+} RatRestrItem_t;
+
+typedef struct mobiRestrInfo
+{
+ PlmnId_t plmnId;
+ UINT8 equalPlmnNum;
+ PlmnId_t ePlmnId[ngap_maxnoofEPLMNs];
+ UINT8 ratRestrictNum;
+ RatRestrItem_t ratRestrictItem[ngap_maxnoofEPLMNsPlusOne];
+ UINT8 forbiddenAreaNum;
+ PlmnId_t forbPlmnId[ngap_maxnoofEPLMNsPlusOne];
+ UINT16 forbTacNum[ngap_maxnoofEPLMNsPlusOne];
+ CuTac_t forbTac[ngap_maxnoofEPLMNsPlusOne][ngap_maxnoofForbTACs];
+ UINT8 servAreaNum;
+ PlmnId_t servPlmnId[ngap_maxnoofEPLMNsPlusOne];
+ UINT8 allowTacNum[ngap_maxnoofEPLMNsPlusOne];
+ CuTac_t allowedTac[ngap_maxnoofEPLMNsPlusOne][ngap_maxnoofAllowedAreas];
+ UINT8 notAllowTacNum[ngap_maxnoofEPLMNsPlusOne];
+ CuTac_t notAllowedTac[ngap_maxnoofEPLMNsPlusOne][ngap_maxnoofAllowedAreas];
+}MobiRestrInfo_t;
+
+typedef struct ueSecurCapa
+{
+ UINT16 nrEncryptionAlgorithms;
+ UINT16 nrIntegrityProtectionAlgorithms;
+ UINT16 eutraEncryptionAlgorithms;
+ UINT16 eutraIntegrityProtectionAlgorithms;
+} UeSecurCapa_t;
+
+#define EXPECTED_ACTIVITY_PERIOD_PRESENT (1 << 0)
+#define EXPECTED_IDLE_PERIOD_PRESENT (1 << 1)
+#define SOURCEOF_UE_ACTIVITY_BEHAVIOUR_INFORMATION_PRESENT (1 << 2)
+typedef struct expectedUeActivityBehaviour
+{
+ UINT16 bitMask;
+ INT64 expectedActivityPeriod; /* OPTIONAL */
+ INT64 expectedIdlePeriod; /* OPTIONAL */
+ SourceOfUEActivityBehaviourInformation_e sourceOfUeActivityBehaviourInformation; /* OPTIONAL */
+} ExpectedUeActivityBehaviour_t;
+
+#define EXPECTEDUEMOVINGTRAJECTORYITEM_TIME_STAYED_IN_CELL_PRESENT (1 << 0)
+typedef struct expectedUeMovingTrajectoryItem
+{
+ UINT16 bitMask;
+ CuNrCgi_t nrCgi;
+ INT64 timeStayedInCell; /* OPTIONAL */
+} ExpectedUeMovingTrajectoryItem_t;
+
+#define EXPECTED_UE_ACTIVITY_BEHAVIOR_PRESENT (1 << 0)
+#define EXPECTED_HO_INTERVAL_PRESENT (1 << 1)
+#define EXPECTED_UE_MOBILITY_PRESENT (1 << 2)
+typedef struct
+{
+ UINT16 bitMask;
+ ExpectedUeActivityBehaviour_t expectedUeActivityBehaviour;
+ INT64 expectedHoInterval;
+ INT64 expectedUeMobility;
+ UINT8 expectUeMovTrajectoryNum;
+ ExpectedUeMovingTrajectoryItem_t expectedUeMovingTrajectory[ngap_maxnoofCellsUEMovingTrajectory];
+}ExpectUeBeHaviour_t;
+
+#define CORE_ASSISTANCE_INFO_UE_SPECIFIC_DRX_PRESENT (1 << 0)
+#define CORE_ASSISTANCE_INFO_MICO_MODE_INDICATION_PRESENT (1 << 1)
+#define CORE_ASSISTANCE_INFO_EXPECT_UE_BEHAVIOUR_PRESENT (1 << 2)
+typedef struct coreAssitInfo
+{
+ UINT16 bitMask;
+ UeIdIdxValue_t ueIdIdxValue;
+ INT64 ueSpecificDrx;
+ UINT8 periodicRegistrationUpdateTimer;
+ INT64 micoModeIndication;
+ UINT8 inactiveTaiNum;
+ Tai_t inactiveTai[ngap_maxnoofTAIforInactive];
+ ExpectUeBeHaviour_t exceptUeBehaviour;
+}CoreAssitInfo_t;
+
+#define NOTIFICATION_CONTROL_PRESENT (1 << 0)
+#define MAX_PACKET_LOSSRATE_DL_PRESENT (1 << 1)
+#define MAX_PACKET_LOSSRATE_UL_PRESENT (1 << 2)
+typedef struct gbrQosInfo
+{
+ UINT16 bitMask;
+ UINT64 maxFlowBitRateDL;
+ UINT64 maxFlowBitRateUL;
+ UINT64 guaranteedFlowBitRateDL;
+ UINT64 guaranteedFlowBitRateUL;
+ NotificationControl_e notificationControl; /* OPTIONAL */
+ INT64 maxPacketLossRateDL; /* OPTIONAL */
+ INT64 maxPacketLossRateUL; /* OPTIONAL */
+} GbrQosInfo_t;
+
+#define GBR_QOS_INFORMATION_PRESENT (1 << 0)
+#define REFLECTIVE_QOS_ATTRIBUTE_PRESENT (1 << 1)
+#define ADDITIONAL_QOS_FLOW_INFORMATION_PRESENT (1 << 2)
+typedef struct qosFlowLevelQosParam
+{
+ UINT16 bitMask;
+ QosCharact_t qosCharacteristics;
+ AllocAndRetenPriority_t allocationAndRetentionPriority;
+ GbrQosInfo_t gbrQosInformation; /* OPTIONAL */
+ ReflectiveQosAttribute_e reflectiveQosAttribute; /* OPTIONAL */
+ AddQosFlowInfo_e additionalQosFlowInformation; /* OPTIONAL */
+} QosFlowLevelQosParam_t;
+
+#define QOS_FLOW_SETUP_REQ_E_RAB_ID_PRESENT (1 << 0)
+typedef struct qosFlowSetupReqItem
+{
+ UINT16 bitMask;
+ INT64 qosFlowId;
+ QosFlowLevelQosParam_t qosFlowLevelQosParameters;
+ INT64 eRabId; /* OPTIONAL */
+} QosFlowSetupReqItem_t;
+
+#define MAX_INTERITY_PROTECTED_DATARATE_PRESENT (1 << 0)
+typedef struct securIndic
+{
+ UINT16 bitMask;
+ INT64 integrityProtectionIndication;
+ INT64 confidentialityProtectionIndication;
+ INT64 maxIntegrityProtectedDataRate; /* OPTIONAL */
+} SecurIndic_t;
+
+typedef struct
+{
+ UINT64 DlSessAMBR;
+ UINT64 UlSessAmbr;
+}NgapPduSessAmber_t;
+
+#define PDU_SESSION_SETUP_REQ_TRANSFER_SESSION_AMBR_PRESENT (1 << 0)
+#define PDU_SESSION_SETUP_REQ_TRANSFER_DATA_FORWARD_NOT_POSSIBLE_PRESENT (1 << 1)
+#define PDU_SESSION_SETUP_REQ_TRANSFER_SECURITY_INDICATION_PRESENT (1 << 2)
+#define PDU_SESSION_SETUP_REQ_TRANSFER_NET_WORK_INSTANCE_PRESENT (1 << 3)
+
+typedef struct
+{
+ UINT16 bitMask;
+ NgapPduSessAmber_t sessAMBR;//Optional
+ UpTransLayerInfo_t ulNguUpTnlInfor;
+ UINT8 additionalUpTnlNum;
+ UpTransLayerInfo_t additionalUlNguUpTnlInfor[ngap_maxnoofMultiConnectivityMinusOne];
+ INT64 dataForwardingNotPossible;//Optional
+ INT64 pduSessionType;
+ SecurIndic_t securityIndication;//Optional
+ INT64 networkInstance;//Optional
+ UINT8 qosFlowSetupReqNum;// >= 1
+ QosFlowSetupReqItem_t qosFlowSetupRequestItems[ngap_maxnoofQosFlows];
+}PduSessSetupReqTransfer_t;
+
+#define PDU_SESSION_RESOURCE_SETUP_REQUEST_NAS_PDU_PRESENT (1 << 0)
+typedef struct pduSessionSetupReq
+{
+ UINT16 bitMask;
+ UINT16 pduSessID;
+ NasPdu_t nasPdu;//Optional
+ SNssai_t sNSSAI;
+ PduSessSetupReqTransfer_t pduSetupReqTransfer;
+}PduSessionSetupReq_t;
+
+typedef struct recommRanforPag
+{
+ UINT8 ranNum;
+ /* AMFPagingTarget_PR */
+ AmfPgType_e amfPgType[ngap_maxnoofRecommendedRANNodes];
+ RecomRanGnbId_t gNBId[ngap_maxnoofRecommendedRANNodes];
+ Tai_t Tai[ngap_maxnoofRecommendedRANNodes];
+}RecommRanforPag_t;
+
+#define RECOMMCELLITEM_TIME_STAYED_INCELL_PRESENT (1 << 0)
+typedef struct recommCellItem
+{
+ UINT16 bitMask;
+ CuNrCgi_t nrCgi;
+ UINT64 timeStayedInCell; /* OPTIONAL */
+} RecommCellItem_t;
+
+typedef struct recommCellforPag
+{
+ UINT8 cellNum;
+ RecommCellItem_t cellItem[ngap_maxnoofRecommendedCells];
+}RecommCellforPag_t;
+
+
+#define PAGING_ATTEMPT_INFO_NEXT_PAGING_AREA_SCOPE_PRESENT (1 << 0)
+typedef struct pagingAttemptInfo
+{
+ UINT8 pagingAttemptCount;
+ UINT8 intendNoOfPagingAttempt;
+ NextPagingAreaScope_e nextPagingAreaScope;//Optional
+}PagingAttemptInfo_t;
+
+#define ASSIST_DATA_FOR_PAGING_RECOMMAND_CELL_PRESENT (1 << 0)
+#define ASSIST_DATA_FOR_PAGING_PAGING_ATTEMPT_INFO_PRESENT (1 << 1)
+typedef struct assistDataForPaging
+{
+ RecommCellforPag_t recommandCell;//Optinal
+ PagingAttemptInfo_t pagingAttemptInfo;//Optional
+}AssistDataForPaging_t;
+#define QOSFLOW_MAPPING_INDICATION_PRESENT (1 << 0)
+typedef struct AssocQosFlowItem
+{
+ UINT16 bitMask;
+ INT64 qosFlowId;
+ QosFlowMapInd_e qosFlowMappingIndication; /* OPTIONAL */
+} AssocQosFlowItem_t;
+
+typedef struct qosFlowPerTnlInfo
+{
+ UpTransLayerInfo_t upTransLayerInfo;
+ UINT8 assocQosFlowNum;
+ AssocQosFlowItem_t assocQosItem[ngap_maxnoofQosFlows];
+}QosFlowPerTnlInfo_t;
+
+typedef struct qosFlowIte
+{
+ INT64 qosFlowId;
+ NgapCause_e cause;
+} QosFlowIte_t;
+
+#define PDU_SESSION_SETUP_RSP_SECURITY_RESULT_PRESENT (1 << 0)
+typedef struct pduSessSetupResp
+{
+ UINT16 bitMask;
+ UINT16 pduSessId;
+ QosFlowPerTnlInfo_t dlQosFlowTnlInfo;
+ UINT8 addDlQosFlowNum;
+ QosFlowPerTnlInfo_t addDlQosFlowTnlInfo[ngap_maxnoofMultiConnectivityMinusOne];
+ SecuResult_t securityResult;
+ UINT8 qosFlowFailNum;
+ QosFlowIte_t qosFlowFailtoSetup[ngap_maxnoofQosFlows];
+}PduSessSetupResp_t;
+
+typedef struct pduSessSetupFail
+{
+ UINT16 pduSessId;
+ NgapCause_e cause;
+}PduSessSetupFail_t;
+
+typedef struct
+{
+ UINT64 DlUeAMBR;
+ UINT64 UlUeAmbr;
+}NgapUeAmber_t;
+
+typedef struct
+{
+ UINT8 timePeriodsNum;
+ Timestamp_t startTimeStamp[ngap_maxnoofTimePeriods];
+ Timestamp_t endTimeStamp[ngap_maxnoofTimePeriods];
+ UINT64 usageCountUl[ngap_maxnoofTimePeriods];
+ UINT64 usageConutDl[ngap_maxnoofTimePeriods];
+}VolumeTimedRpt_t;
+
+typedef struct
+{
+ INT64 ratType;
+ VolumeTimedRpt_t sessTimedRpt;
+}PduSessUsageRpt_t;
+
+typedef struct
+{
+ INT64 qfi;
+ INT64 ratType;
+ VolumeTimedRpt_t flowTimedRpt;
+}QosFlowUsageRptItem_t;
+
+typedef struct
+{
+ PduSessUsageRpt_t sessUsageRpt;
+ UINT8 qosFlowUsageRptNum;
+ QosFlowUsageRptItem_t qosFlowUsageRptItem;
+}SecondRATUsageInfo_t;
+
+#define PDU_SESSION_RESOURCE_ITEM_SECOND_RAT_USAGE_INFO_PRESENT (1 << 0)
+typedef struct
+{
+ UINT16 sessId;
+ SecondRATUsageInfo_t secondRatUsageInfo;
+}PduSessResourceItem_t;
+
+#define HO_REQUIRED_TRANSFER_DIRECT_FORWARD_PATH_AVAILABILITY_PRESENT (1 << 0)
+typedef struct
+{
+ UINT16 bitMask;
+ DirectForwardPathAvailability_e directForwardPathAvailability;//Optional
+}HoRequiredTransfer_t;
+
+typedef struct
+{
+ UINT16 sessId;
+ HoRequiredTransfer_t HoRequiredTransfer;
+}HoRequiredPduSessResourcItem_t;
+
+typedef struct
+{
+ INT8 qosFlowId;
+ DataForwardAccepted_e dataForwardAccepted;
+}QosFlowSetupRspItem_t;
+
+typedef struct
+{
+ UINT8 qosFlowFailNum;
+ QosFlowIte_t qosFlowFailtoSetup[ngap_maxnoofQosFlows];
+}QosFlowSetupFailItem_t;
+
+typedef struct
+{
+ UpTransLayerInfo_t additionDlUpTnlInfo;
+ QosFlowSetupRspItem_t additionQosFlowSetupRsp;
+ UpTransLayerInfo_t additionDlForwardUpTnlInfo;
+}HoAdditionDlUpTnlInfoItem_t;
+
+#define DATA_FORWARD_RSP_DRB_DL_NGU_UP_TNL_INFO_PRESENT (1 << 0)
+#define DATA_FORWARD_RSP_DRB_UL_NGU_UP_TNL_INFO_PRESENT (1 << 1)
+typedef struct
+{
+ UINT8 bitMask;
+ UINT8 drbId;
+ UpTransLayerInfo_t dlNguUpTnlInfo;//Optional
+ UpTransLayerInfo_t ulNguUpTnlInfo;//Optional
+}DataForwardRspDrb_t;
+
+#define HO_REQUEST_ACK_TRANSFER_DL_FORWARD_UP_TNL_INFO_PRESENT (1 << 0)
+#define HO_REQUEST_ACK_TRANSFER_SECURITY_RESULT_PRESENT (1 << 1)
+typedef struct
+{
+ UpTransLayerInfo_t dlNguUpTnlInfo;
+ UpTransLayerInfo_t dlForwardUpTnlInfo;//Optinal
+ SecuResult_t securityResult;//Optional
+ UINT8 qosFlowRspNum;
+ QosFlowSetupRspItem_t qosFlowSetupRspItem[ngap_maxnoofQosFlows];
+ UINT8 qosFlowFailNum;
+ QosFlowSetupFailItem_t qosFlowSetupFailItem[ngap_maxnoofQosFlows];
+ UINT8 drbNum;
+ DataForwardRspDrb_t dataForwardRspDrbItem[ngap_maxnoofDRBs];
+ UINT8 HoAddDlUpTnlInfoNum;
+ HoAdditionDlUpTnlInfoItem_t HoAddDlUpTnlInfoItem[ngap_maxnoofMultiConnectivityMinusOne];
+}HoRequestAckTransfer_t;
+
+typedef struct
+{
+ UINT16 sessId;
+ HoRequestAckTransfer_t HoRequestAckTransfer;
+}HoRequestAckPduSessItem_t;
+
+typedef struct
+{
+ NgapCause_e cause;
+}HoRequestUnsuccTransfer_t;
+
+typedef struct
+{
+ UINT16 sessId;
+ HoRequestUnsuccTransfer_t HoRequestUnsuccTransfer;
+}HoRequestFailPduSessItem_t;
+
+#define HO_CMD_SUCC_TRANSFER_DATA_FORWARD_RSP_DRB_PRESENT (1 << 0)
+typedef struct
+{
+ UpTransLayerInfo_t dlNguUpTnlInfo;//Optional
+ UINT8 qosFlowNum;
+ UINT64 qosFlowIdItem[ngap_maxnoofQosFlows];
+ UINT8 drbNum;
+ DataForwardRspDrb_t dataForwardRspDrbItem[ngap_maxnoofDRBs];
+ UINT8 addDlQosFlowNum;
+ QosFlowPerTnlInfo_t addDlQosFlowTnlInfo[ngap_maxnoofMultiConnectivityMinusOne];
+}HoCmdSuccTransfer_t;
+
+typedef struct
+{
+ UINT16 sessId;
+ HoCmdSuccTransfer_t HoCmdSuccTransfer;
+}HoCmdSuccPduSessResourceItem_t;
+
+typedef struct
+{
+ NgapCause_e cause;
+}HoCmdFailTransfer_t;
+
+typedef struct
+{
+ UINT16 sessId;
+ HoCmdFailTransfer_t HoCmdFailTranser;
+}HoCmdFailPduSessResourcItem_t;
+
+typedef struct
+{
+ UINT16 sessId;
+ SNssai_t sNssai;
+ PduSessSetupReqTransfer_t HoRequestTransfer;
+}HoRequestPduSessResourceItem_t;
+#define PATH_SWITCH_REQ_TRANSFER_DL_NGU_TNL_INFO_REUSED_PRESENT (1 << 0)
+#define PATH_SWITCH_REQ_TRANSFER_USER_PLANE_SECUR_INFO_PRESENT (1 << 1)
+typedef struct
+{
+ UpTransLayerInfo_t dlNguUpTnlInfo;
+ DlNguTnlInfoReused_e dlNguUpTnlInfoReused;//Optional
+ UserPlaneSecurInfo_t userPlaneSecurInfo;//Optional
+ UINT8 qosFlowNum;
+ UINT64 qosFlowIdItem[ngap_maxnoofQosFlows];
+ UINT8 addDlQosFlowNum;
+ QosFlowPerTnlInfo_t addDlQosFlowTnlInfo[ngap_maxnoofMultiConnectivityMinusOne];
+}PathSwitchReqTransfer_t;
+
+typedef struct
+{
+ UINT16 sessId;
+ PathSwitchReqTransfer_t pathSwitchReqTransfer;
+}PathSwitchReqPduSessItem_t;
+
+typedef struct
+{
+ NgapCause_e cause;
+}PathSwitchReqFailTransfer_t;
+
+typedef struct
+{
+ UINT16 sessId;
+ PathSwitchReqFailTransfer_t pathSwitchReqFailTransfer;
+}PathSwitchReqFailPduSessItem_t;
+
+#define PATH_SWITCH_REQ_ACK_TRANSFER_UL_NGU_UP_TNL_INFO_PRESENT (1 << 0)
+#define PATH_SWITCH_REQ_ACK_TRANSFER_SECURITY_IND_PRESENT (1 << 1)
+typedef struct
+{
+ UpTransLayerInfo_t ulNguUpTnlInfo;//Optional
+ SecurIndic_t securityIndication;//Optional
+ UINT8 upTransLayerInfoPairItemNum;
+ UpTransLayerInfo_t ulNguUpTnlInfoItem[ngap_maxnoofMultiConnectivityMinusOne];
+ UpTransLayerInfo_t dlNguUpTnlInfoItem[ngap_maxnoofMultiConnectivityMinusOne];
+}PathSwitchReqAckTransfer_t;
+
+typedef struct
+{
+ UINT16 sessId;
+ PathSwitchReqAckTransfer_t pathSwitchReqAckTransfer;
+}PathSwitchReqAckPduSessItem_t;
+
+typedef struct
+{
+ NgapCause_e cause;
+}PathSwitchReqUnsuccTransfer_t;
+
+
+typedef struct
+{
+ UINT16 sessId;
+ PathSwitchReqUnsuccTransfer_t pathSwitchReqUnsuccTransfer;
+}PathSwitchRlsPduSessItem_t;
+
+typedef struct
+{
+ UINT8 numAmf;
+ IpAddress_t amfAddr[NGAP_MAX_AMF_NUM];
+ BroadPlmns_t broadPlmn[NGAP_MAX_AMF_NUM];
+}RegisterAmf_t;
+
+typedef struct
+{
+ IpAddress_t ipAddr;
+ UINT8 state;
+ NgapCause_e cause;
+ BroadPlmns_t bPlmn;
+}AmfRegistResult_t;
+typedef struct
+{
+ UINT8 areaIntTaiNUm;
+ Tai_t areaIntTaiItem[ngap_maxnoofTAIinAoI];
+ UINT8 areaIntCellNum;
+ CuNrCgi_t areaIntCgiItem[ngap_maxnoofCellinAoI];
+ UINT8 areaIntRanNodeIdNum;
+ GlobalRanNodeId_t areaIntRanNodeIdItem[ngap_maxnoofRANNodeinAoI];
+}AreaInterestItem_t;
+
+typedef struct
+{
+ UINT8 areaIntItemNum;
+ AreaInterestItem_t areaIntItem[ngap_maxnoofAoI];
+ UINT8 locaReportReferenceId;
+}AreaInterestListItem_t;
+
+typedef struct
+{
+ EventType_e eventType;
+ ReportArea_e reportArea;
+ UINT8 areaIntListItemNum;
+ AreaInterestListItem_t areaIntListItem[ngap_maxnoofAoI];
+ UINT8 locaReportReferenceIdTobeCancel;//Condition
+}LocationReportRequestType_t;
+
+/**********************************************************************************
+***********************************************************************************
+*********** CUC --> NGAP MESSAGE STRUCTURE *************************
+***********************************************************************************
+***********************************************************************************/
+
+/* Register Request ( NG Setup Request )*/
+typedef struct ngapRegistergNBReq
+{
+ Instance_t instance;
+ PlmnId_t plmnId;
+ gNBId_t gnbId;
+ RanName_t ranName;
+ SupportTas_t supportTa;
+ PagingDRX_e ranDefaPagDrx;
+ UINT8 ueRetInfoFlag;
+ UERetentionInformation_e ueRetenInfo;
+ RegisterAmf_t registerAmfInfo;
+}NgapRegistergNBReq_t;
+
+/* First NAS Request (Initial Ue Message)*/
+#define FIRST_UL_NAS_AMF_REGISTER_PRESENT (1 << 0)
+#define FIRST_UL_NAS_FIVEG_STMSI_PRESENT (1 << 1)
+#define FIRST_UL_NAS_LOCATION_INFO_TIMESTAMP_PRESENT (1 << 2)
+#define FIRST_UL_NAS_UE_CONTEXT_REQ_PRESENT (1 << 3)
+typedef struct ngapFirstNasReq
+{
+ UINT16 bitMask;
+ NrCellId_t nrCellId;
+ Instance_t instance;
+ UINT64 ranUeNgapId;
+ PlmnId_t plmnId;
+ guamiType_e guamiType;
+ Guami_t guami;
+ /* e_RRCEstablishmentCause */
+ RrcEstablishmentCause_e establishmentCause;
+ NasPdu_t nasPdu;
+ CuTac_t tac;
+ Timestamp_t timeStamp;
+ FiveGSTmsi_t fiveGSTmsi;
+ ueContextRequest_e ueReq;
+ SliceList_t ranAllowNssai;
+} NgapFirstNasReq_t;
+
+/* Ue Radio Capability Check Response */
+typedef struct ngapUeRadioCapaCheckRsp
+{
+ Instance_t instance;
+ UINT64 ranUeNgapId;
+ AmfUeNgapId_t amfUeNgapId;
+ IMSVoiceSupportInd_e IMSVoiceSupportInd;
+}NgapUeRadioCapaCheckRsp_t;
+
+/* UL NAS Transfer */
+#define UL_NAS_LOCATION_INFO_TIMESTAMP_PRESENT (1 << 0)
+typedef struct ngapULNas
+{
+ UINT16 bitMask;
+ Instance_t instance;
+ NrCellId_t nrCellId;
+ UINT64 ranUeNgapId;
+ AmfUeNgapId_t amfUeNgapId;
+ NasPdu_t nasPdu;
+ PlmnId_t plmnId;
+ CuTac_t tac;
+ Timestamp_t timeStamp;
+} NgapULNas_t;
+
+/*Ue Radio Capability Information Indication*/
+#define UE_RADIO_CAPABILITY_PAGING_PRESENT (1 << 0)
+typedef struct ngapUeRadioCapaInfoIndication
+{
+ UINT16 bitMask;
+ Instance_t instance;
+ UINT64 ranUeNgapId;
+ AmfUeNgapId_t amfUeNgapId;
+ UeRadioCapability_t ueRadioCapability;
+ UeRadioCapaForPag_t ueRadioCapabilityForPag;/* optional */
+}NgapUeRadioCapaInfoIndication_t;
+
+/* Initial Context Setup Response */
+typedef struct ngapInitialContextSetupResp
+{
+ Instance_t instance;
+ AmfUeNgapId_t amfUeNgapId;
+ UINT64 ranUeNgapId;
+ UINT8 rspFailFlag;
+ NgapCause_e failCause;
+ UINT16 pduSessSetRspNum;
+ PduSessSetupResp_t pduSessSetRspItem[NG_MAX_SESSION_NUM];
+ UINT16 pduSessSetFailNum;
+ PduSessSetupFail_t pduSessSetFailItem[NG_MAX_SESSION_NUM];
+} NgapInitialContextSetupResp_t;
+
+/* PDU Session Resource Setup Response */
+typedef struct ngapPduSessSetupRsp
+{
+ Instance_t instance;
+ AmfUeNgapId_t amfUeNgapId;
+ UINT64 ranUeNgapId;
+ UINT16 pduSessSetRspNum;
+ PduSessSetupResp_t pduSessSetRspItem[NG_MAX_SESSION_NUM];
+ UINT16 pduSessSetFailNum;
+ PduSessSetupFail_t pduSessSetFailItem[NG_MAX_SESSION_NUM];
+}NgapPduSessSetupRsp_t;
+
+/* Ue Context Release Request */
+typedef struct ngapUeCxtReleaseReq
+{
+ Instance_t instance;
+ UINT64 ranUeNgapId;
+ AmfUeNgapId_t amfUeNgapId;
+ UINT16 sessRlsNum;
+ UINT16 rlsSessId[NG_MAX_SESSION_NUM];
+ NgapCause_e cause;
+} NgapUeCxtReleaseReq_t;
+
+/* Ue Context Release Complete */
+#define UE_CONTEXT_RELEASE_COMPLETE_USERLOCATION_TIMESTAMP_PRESENT (1 << 0)
+typedef struct ngapUeReleaseComplete
+{
+ UINT16 bitMask;
+ Instance_t instance;
+ UINT64 ranUeNgapId;
+ AmfUeNgapId_t amfUeNgapId;
+ UINT8 locationFlag;
+ PlmnId_t plmnId;
+ NrCellId_t cellId;
+ CuTac_t tac;
+ Timestamp_t timeStamp;
+ RecommCellforPag_t recomCellInfo;
+ RecommRanforPag_t recomRanInfo;
+ UINT8 rlsSessNum;
+ PduSessResourceItem_t sessResourceItem[NG_MAX_SESSION_NUM];
+ UINT8 allSessRlsFlag;
+} NgapUeReleaseComplete_t;
+
+#define HANDOVER_REQUIRED_DIRECT_FORWARDING_PATH_AVAILABILITY_PRESENT (1 << 0)
+typedef struct ngapHandoverRequired
+{
+ UINT16 bitMask;
+ Instance_t instance;
+ UINT64 ranUeNgapId;
+ AmfUeNgapId_t amfUeNgapId;
+ HandoverType_e handoverType;
+ NgapCause_e cause;
+ PlmnId_t plmnId;
+ gNBId_t gnbId;
+ Tai_t tai;
+ DirectForwardPathAvailability_e directForwardPathAvailability;//Optional
+ UINT8 sessNum;
+ HoRequiredPduSessResourcItem_t sessResourceItem[NG_MAX_SESSION_NUM];
+}NgapHandoverRequired_t;
+
+typedef struct ngapHandoverRequestAcknowledge
+{
+ Instance_t instance;
+ UINT64 ranUeNgapId;
+ AmfUeNgapId_t amfUeNgapId;
+ UINT8 ackSessNum;
+ HoRequestAckPduSessItem_t HoRequestAckSessItem[NG_MAX_SESSION_NUM];
+ UINT8 failSessNum;
+ HoRequestFailPduSessItem_t HoRequestFailSessItem[NG_MAX_SESSION_NUM];
+}NgapHandoverRequestAcknowledge_t;
+typedef struct ngapHandoverFailure
+{
+ Instance_t instance;
+ AmfUeNgapId_t amfUeNgapId;
+ NgapCause_e cause;
+}NgapHandoverFailure_t;
+#define HANDOVER_NOTIFY_USERLOCATION_TIMESTAMP_PRESENT (1 << 0)
+typedef struct ngapHandoverNotify
+{
+ Instance_t instance;
+ UINT64 ranUeNgapId;
+ AmfUeNgapId_t amfUeNgapId;
+ PlmnId_t plmnId;
+ NrCellId_t cellId;
+ CuTac_t tac;
+ Timestamp_t timeStamp;
+}NgapHandoverNotify_t;
+/* Handover Cancel */
+typedef struct ngapHandoverCancel
+{
+ Instance_t instance;
+ UINT64 ranUeNgapId;
+ AmfUeNgapId_t amfUeNgapId;
+ NgapCause_e cause;
+}NgapHandoverCancel_t;
+
+/* Path Switch Request */
+#define PATH_SWITCH_REQUEST_USERLOCATION_TIMESTAMP_PRESENT (1 << 0)
+typedef struct ngapPathSwitchRequest
+{
+ UINT16 bitMask;
+ Instance_t instance;
+ UINT64 ranUeNgapId;
+ AmfUeNgapId_t sourceAmfUeNgapId;
+ PlmnId_t plmnId;
+ NrCellId_t cellId;
+ CuTac_t tac;
+ Timestamp_t timeStamp;
+ UeSecurCapa_t ueSecurityCapability;
+ UINT8 switchSessNum;
+ PathSwitchReqPduSessItem_t switchPduSessItem[NG_MAX_SESSION_NUM];
+ UINT8 setupFailSessNum;
+ PathSwitchReqFailPduSessItem_t setupFailPduSessItem[NG_MAX_SESSION_NUM];
+}NgapPathSwitchRequest_t;
+
+/* RRC Inactive Transition Report */
+#define RRC_INACTIVE_TRANSITION_REPORT_USERLOCATION_TIMESTAMP_PRESENT (1 << 0)
+typedef struct ngapRrcInactiveTransitionReport
+{
+ Instance_t instance;
+ UINT64 ranUeNgapId;
+ AmfUeNgapId_t amfUeNgapId;
+ RrcState_e rrcState;
+ PlmnId_t plmnId;
+ NrCellId_t cellId;
+ CuTac_t tac;
+ Timestamp_t timeStamp;
+}NgapRrcInactiveTransitionReport_t;
+/**********************************************************************************
+***********************************************************************************
+*************** NGAP --> CUC MESSAGE STRUCTURE ********************
+***********************************************************************************
+***********************************************************************************/
+/* Register Confirm (NG Setup Response)*/
+typedef struct ngapRegistergNBCnf
+{
+ Instance_t instance;
+ UINT8 numAmf; /* Number of AMF connected */
+ AmfRegistResult_t registRet[NGAP_MAX_AMF_NUM];
+} NgapRegistergNBCnf_t;
+
+/* Deregister Indication */
+typedef struct ngapDeregisteredgNBInd_t
+{
+ UINT8 numAmf; /* Number of AMF connected */
+} NgapDeregisteredgNBInd_t;
+
+#define UE_RADIO_CAPA_CHECK_REQ_UE_RADIO_CAPA_PRESENT (1 << 0)
+/* Ue Radio Capability Check Request */
+typedef struct ngapUeRadioCapaCheckReq
+{
+ UINT16 bitMask;
+ Instance_t instance;
+ AmfUeNgapId_t amfUeNgapId;
+ UINT64 ranUeNgapId;
+ UeRadioCapability_t ueRadioCapability;//Optional
+}NgapUeRadioCapaCheckReq_t;
+
+/* DL NAS Transfer */
+#define DL_NAS_TRANSFER_OLD_AMF_NAME_PRESENT (1 << 0)
+#define DL_NAS_TRANSFER_RAN_PAGING_PRIORITY_PRESENT (1 << 1)
+#define DL_NAS_TRANSFER_MOBILITY_RESTRICTION_PRESENT (1 << 2)
+#define DL_NAS_TRANSFER_INDEX_TO_RFSP_PRESENT (1 << 3)
+#define DL_NAS_TRANSFER_UE_AMBR_PRESENT (1 << 4)
+#define DL_NAS_TRANSFER_SNSSAI_PRESENT (1 << 5)
+typedef struct ngapDLNas
+{
+ UINT16 bitMask;
+ Instance_t instance;
+ AmfUeNgapId_t amfUeNgapId;
+ UINT64 ranUeNgapId;
+ AmfName_t oldAmfName;
+ INT64 ranPagPriority;
+ NasPdu_t nasPdu;
+ MobiRestrInfo_t mobiRestrictInfo;
+ INT64 indexToRfsp;
+ UINT64 ueAMBRDl;
+ UINT64 ueAMBRUl;
+ SliceList_t amfSlice;
+}ngapDLNas_t;
+
+/* Initial Context Setup Request */
+#define INITIAL_CXT_SETUP_REQ_OLD_AMFNAME_PRESENT (1 << 0)
+#define INITIAL_CXT_SETUP_REQ_UE_AGGREGATE_MAX_BITRATE_PRESENT (1 << 1)
+#define INITIAL_CXT_SETUP_REQ_CORE_INFO_PRESENT (1 << 2)
+#define INITIAL_CXT_SETUP_REQ_PDU_SESSION_RESOURCE_SETUPLIST_CXTREQ_PRESENT (1 << 3)
+#define INITIAL_CXT_SETUP_REQ_TRACE_ACTIVATION_PRESENT (1 << 4)
+#define INITIAL_CXT_SETUP_REQ_MOBI_RESTRICT_PRESENT (1 << 5)
+#define INITIAL_CXT_SETUP_REQ_UE_RADIO_CAPA_PRESENT (1 << 6)
+#define INITIAL_CXT_SETUP_REQ_IDX_RFSP_PRESENT (1 << 7)
+#define INITIAL_CXT_SETUP_REQ_MASK_IMEISV_PRESENT (1 << 8)
+#define INITIAL_CXT_SETUP_REQ_NASPDU_PRESENT (1 << 9)
+#define INITIAL_CXT_SETUP_REQ_EMERGENCY_FB_PRESENT (1 << 10)
+#define INITIAL_CXT_SETUP_REQ_INACT_TRANS_RPT_REQ_PRESENT (1 << 11)
+#define INITIAL_CXT_SETUP_REQ_RADIO_CAPA_FOR_PAG_PRESENT (1 << 12)
+#define INITIAL_CXT_SETUP_REQ_REDIRECTION_FOR_VOICE_EPS_FB_PRESENT (1 << 13)
+typedef struct ngapInitialContextSetupReq
+{
+ UINT16 bitMask;
+ Instance_t instance;
+ AmfUeNgapId_t amfUeNgapId;
+ UINT64 ranUeNgapId;
+ AmfName_t oldAmfName;//Optional
+ NgapUeAmber_t ueAMBR;//Optional
+ CoreAssitInfo_t coreNetAssistInfo;//Optional
+ Guami_t guami;
+ UINT16 pduSessSetupNum;
+ PduSessionSetupReq_t pduSessSetReqItem[NG_MAX_SESSION_NUM];
+ SliceList_t amfSlice;
+ UeSecurCapa_t ueSecurityCapa;
+ SecuKey_t securityKey;
+ TraceActiv_t traceActivation;//Optional
+ MobiRestrInfo_t mobiRestrictInfo;//Optional
+ UeRadioCapability_t ueRadioCapability;//Optional
+ INT64 indexToRfsp;//Optional
+ MaskedImeiSv_t maskedImeisv;//Optional
+ NasPdu_t nasPdu;//Optional
+ EmergFbInd_t emergencyFallbackIndicator;//Optional
+ INT64 rrcInactiveTransitionReportRequest;//Optional
+ UeRadioCapaForPag_t ueRadioCapabilityForPag;//Optional
+ INT64 redirectVoiceFb;//Optional
+}NgapInitialContextSetupReq_t;
+
+/* PDU Session Resource Setup Request */
+#define PDU_SESS_SETUP_REQ_RAN_PAGING_PRIORITY_PRESENT (1 << 0)
+#define PDU_SESS_SETUP_REQ_NAS_PDU_PRESENT (1 << 1)
+#define PDU_SESS_SETUP_REQ_UE_AMBR_PRESENT (1 << 2)
+
+typedef struct ngapPduSessSetupReq
+{
+ UINT16 bitMask;
+ Instance_t instance;
+ AmfUeNgapId_t amfUeNgapId;
+ UINT64 ranUeNgapId;
+ INT64 ranPagPriority;//Optional
+ NasPdu_t nasPdu;//Optional
+ UINT16 pduSessSetupNum;
+ PduSessionSetupReq_t pduSessSetReqItem[NG_MAX_SESSION_NUM];
+ UINT64 ueAMBRDl;//Optional
+ UINT64 ueAMBRUl;//Optional
+}NgapPduSessSetupReq_t;
+
+/* Ue Context Release Command */
+typedef struct ngapUeReleaseCommand
+{
+ /* UE_NGAP_IDs_PR */
+ Instance_t instance;
+ NgapIdType_e ngapIdType;
+ INT64 ranUeNgapId;
+ AmfUeNgapId_t amfUeNgapId;
+ NgapCause_e cause;
+}NgapUeReleaseCommand_t;
+
+/* Handover Command */
+#define HANDOVER_COMMAND_NAS_SECURITY_PARAM_FROM_NGRAN_PRESENT (1 << 0)
+typedef struct ngapHandoverCommand
+{
+ UINT16 bitMask;
+ Instance_t instance;
+ AmfUeNgapId_t amfUeNgapId;
+ UINT64 ranUeNgapId;
+ HandoverType_e handoverType;
+ UINT8 HoSessNum;
+ HoCmdSuccPduSessResourceItem_t HoSessResourceItem[NG_MAX_SESSION_NUM];
+ UINT8 rlsSessNum;
+ HoCmdFailPduSessResourcItem_t rlsSessResourceItem[NG_MAX_SESSION_NUM];
+}NgapHandoverCommand_t;
+
+/* Handover Preparation Failure*/
+typedef struct ngapHandoverPreparationFailure
+{
+ UINT16 bitMask;
+ Instance_t instance;
+ AmfUeNgapId_t amfUeNgapId;
+ UINT64 ranUeNgapId;
+ NgapCause_e cause;
+}NgapHandoverPreparationFailure_t;
+
+/* Handover Request */
+#define HANDOVER_REQUEST_CORE_ASSIST_INFO_PRESENT (1 << 0)
+#define HANDOVER_REQUEST_NEW_SECURITY_CTX_IND_PRESENT (1 << 1)
+#define HANDOVER_REQUEST_TRACE_ACTIVATION_PRESENT (1 << 2)
+#define HANDOVER_REQUEST_MASKED_IMEISV_PRESENT (1 << 3)
+#define HANDOVER_REQUEST_MOBILITY_RESTRICTION_INFO_PRESENT (1 << 4)
+#define HANDOVER_REQUEST_LOCATION_REPORT_REQUEST_TYPE_PRESENT (1 << 5)
+#define HANDOVER_REQUEST_RRC_INACTIVE_TRANS_REPORT_REQUEST_PRESNET (1 << 6)
+#define HANDOVER_REQUEST_REDIRECT_VOICE_FB_PRESNET (1 << 7)
+typedef struct ngapHandoverRequest
+{
+ UINT16 bitMask;
+ Instance_t instance;
+ AmfUeNgapId_t amfUeNgapId;
+ HandoverType_e handoverType;
+ NgapCause_e cause;
+ NgapUeAmber_t ueAMBR;
+ CoreAssitInfo_t coreNetAssistInfo;//Optional
+ UeSecurCapa_t ueSecurityCapability;
+ SecurityCtx_t securityContext;
+ NewSecurityCtxInd_e newSecurityContextInd;//Optional
+ NasPdu_t NASC;
+ UINT8 sessNum;
+ HoRequestPduSessResourceItem_t HoRequestSessResourceItem[NG_MAX_SESSION_NUM];
+ SliceList_t amfSlice;
+ TraceActiv_t traceActivation;//Optional
+ MaskedImeiSv_t maskedImeisv;//Optional
+ MobiRestrInfo_t mobiRestrictInfo;//Optional
+ LocationReportRequestType_t locaReportReqType;//Optional
+ INT64 rrcInactiveTransitionReportRequest;//Optional
+ Guami_t guami;
+ INT64 redirectVoiceFb;//Optional
+}NgapHandoverRequest_t;
+
+/* Handover Cancel Acknowledge */
+typedef struct ngapHandoverCancelAcknowledge
+{
+ Instance_t instance;
+ AmfUeNgapId_t amfUeNgapId;
+ UINT64 ranUeNgapId;
+}NgapHandoverCancelAcknowledge_t;
+
+/* Paging */
+#define PAGING_PAGING_DRX_PRESENT (1 << 0)
+#define PAGING_PAGING_PRIORITY_PRESENT (1 << 1)
+#define PAGING_UE_RADIO_CAPABILITY_FOR_PAGING_PRESENT (1 << 2)
+#define PAGING_PAGING_ORIGIN_PRESENT (1 << 3)
+#define PAGING_ASSIST_DATA_FOR_PAGING (1 << 4)
+typedef struct ngapPaging
+{
+ FiveGSTmsi_t fiveGSTmsi;
+ PagingDRX_e pagingDrx;//Optional
+ UINT8 taiForPagingNum;
+ Tai_t taiForPagingItem[ngap_maxnoofTAIforPaging];
+ PagingPriority_e pagingPriority;//Optional
+ UeRadioCapaForPag_t ueRadioCapabilityForPaging;//Optional
+ PagingOrigin_e pagingOrigin;//Optional
+ AssistDataForPaging_t assistDataForPaging;//Optional
+}NgapPaging_t;
+
+/* Path Switch Request Acknowledge */
+#define PATH_SWITCH_REQUEST_ACK_UE_SECURITY_CAPABILITY_PRESENT (1 << 0)
+#define PATH_SWITCH_REQUEST_ACK_NEW_SECURITY_CTX_IND_PRESENT (1 << 1)
+#define PATH_SWITCH_REQUEST_ACK_CORE_NETWORK_ASSIST_INFO_PRESENT (1 << 2)
+#define PATH_SWITCH_REQUEST_ACK_RRC_INACTIVE_TRANSITION_REPORT_REQUEST_PRESENT (1 << 3)
+#define PATH_SWITCH_REQUEST_ACK_REDIRECT_VOICE_FB_PRESENT (1 << 4)
+typedef struct ngapPathSwitchRequestAcknowledge
+{
+ UINT16 bitMask;
+ Instance_t instance;
+ AmfUeNgapId_t amfUeNgapId;
+ UINT64 ranUeNgapId;
+ UeSecurCapa_t ueSecurityCapability;//optional
+ SecurityCtx_t securityContext;
+ NewSecurityCtxInd_e newSecurCtxInd;//optional
+ UINT8 switchSessNum;
+ PathSwitchReqAckPduSessItem_t switchPduSessItem[NG_MAX_SESSION_NUM];
+ UINT8 rlsSessNum;
+ PathSwitchRlsPduSessItem_t rlsPduSessItem[NG_MAX_SESSION_NUM];
+ UINT8 SNssaiNum;
+ SNssai_t SNssaiItem[ngap_maxnoofAllowedS_NSSAIs];
+ CoreAssitInfo_t coreNetworkAssitInfo;//optional
+ INT64 rrcInactiveTransitionReportRequest;//Optional
+ INT64 redirectVoiceFb;//Optional
+}NgapPathSwitchRequestAcknowledge_t;
+
+/* Path Switch Request Failure */
+typedef struct ngapPathSwitchRequestFailure
+{
+ Instance_t instance;
+ AmfUeNgapId_t amfUeNgapId;
+ UINT64 ranUeNgapId;
+ UINT8 rlsSessNum;
+ PathSwitchRlsPduSessItem_t rlsPduSessItem[NG_MAX_SESSION_NUM];
+}NgapPathSwitchRequestFailure_t;
+/**********************************************************************************
+***********************************************************************************
+***************** CUC <--> E1AP ACCORDING TO STRUCTURE **************
+***********************************************************************************
+***********************************************************************************/
+#define MAX_LENGTH_GNBCUCP_NAME 150
+
+typedef struct gnbCucpName
+{
+ char gnbCucpName[MAX_LENGTH_GNBCUCP_NAME];
+}GnbCucpName_t;
+
+#define SECURITY_ALGORITHM_INTERGRITY_PROTECTION_ALGORITHM (1 << 0)
+typedef struct
+{
+ UINT16 bitMask;
+ CipAlgorithm_e cipheringAlgorithm;
+ IpAlgorithm_e integrityProtectionAlgorithm ;/* OPTIONAL */
+}SecuAlgorithm_t;
+
+typedef struct
+{
+ UINT32 size;
+ UINT8 buffer[MAX_SIZE_OF_OCTET_STRING];
+}EncrypTionKey_t;
+
+typedef struct
+{
+ UINT32 size;
+ UINT8 buffer[MAX_SIZE_OF_OCTET_STRING];
+}IntegrityProtectKey_t;
+
+#define USER_PLANE_SECURITY_KEY_INTERGRITYPROTECTIONKEY_PRESENT (1 << 0)
+typedef struct
+{
+ UINT16 bitMask;
+ EncrypTionKey_t encryptionKey;
+ IntegrityProtectKey_t integrityProtectionKey;/* OPTIONAL */
+}UpSecuritykey_t;
+
+typedef struct
+{
+ SecuAlgorithm_t secuAlgorithm;
+ UpSecuritykey_t upSecukey;
+}SecuInfo_t;
+
+#define GBR_QOS_FLOW_INFO_MAX_PACKET_LOSSRATE_DOWNLINK_PRESENT (1 << 0)
+#define GBR_QOS_FLOW_INFO_MAX_PACKET_LOSSRATE_UPLINK_PRESENT (1 << 1)
+typedef struct gbrQoSFlowInformation
+{
+ UINT16 bitMask;
+ UINT64 maxFlowBitRateDownlink;
+ UINT64 maxFlowBitRateUplink;
+ UINT64 guaranteedFlowBitRateDownlink;
+ UINT64 guaranteedFlowBitRateUplink;
+ UINT64 maxPacketLossRateDownlink;/* OPTIONAL */
+ UINT64 maxPacketLossRateUplink;/* OPTIONAL */
+} GBRQoSFlowInformation_t;
+
+#define QOS_FLOW_LEVEL_PARA_GBR_QOS_FLOW_INFO_PRESENT (1 << 0)
+#define QOS_FLOW_LEVEL_PARA_REFLECTIVE_QOS_ATTRIBUTE_PRESENT (1 << 1)
+#define QOS_FLOW_LEVEL_PARA_ADDITIONAL_QOS_FLOW_INFO_PRESENT (1 << 2)
+#define QOS_FLOW_LEVEL_PARA_PAGING_POLICY_INDICATOR_PRESENT (1 << 3)
+#define QOS_FLOW_LEVEL_PARA_RDI_PRESENT (1 << 4)
+typedef struct
+{
+ UINT16 bitMask;
+ /* QoS_Characteristics_PR */
+ QosCharact_t qosCharacter;
+ AllocAndRetenPriority_t ngRanAllAndRetentionPriority;
+ GBRQoSFlowInformation_t gbrQoSFlowInformation;/* OPTIONAL */
+ /* e_ReflectiveQosAttribute */
+ ReflectiveQosAttribute_e reflectiveQosAttribute;/* OPTIONAL */
+ /* e_AdditionalQosFlowInformation */
+ AddQosFlowInfo_e addiQosFlowInfo;/* OPTIONAL */
+ INT64 pagingPolicyInd;/* OPTIONAL */
+ RDI_e rDI;/* OPTIONAL */
+}QosFlowLevelQosPar_t;
+
+#define QOS_FLOW_QOS_ITEM_QOS_FLOW_MAP_INDICATION_PRESENT (1 << 0)
+typedef struct
+{
+ UINT16 bitMask;
+ INT64 qosFlowIdentifier;
+ QosFlowLevelQosPar_t qosFlowLevelQosPar;
+ /* e_QoS_Flow_Mapping_Indication */
+ QosFlowMapInd_e qosFlowMapInd;/* OPTIONAL */
+}QoSFlowQosItem_t;
+
+#define QOS_FLOW_ITEM_QOS_FLOW_MAP_INDICATION_PRESENT (1 << 0)
+typedef struct qoSFlowItem
+{
+ long qosFlowIdentifier;
+}QoSFlowItem_t;
+
+typedef struct qosFlowList
+{
+ UINT8 qosFlowItemNum;
+ QoSFlowItem_t qosFlowItem[e1ap_maxnoofQoSFlows];
+}QoSFlowList_t;
+
+typedef struct qosFlowMap
+{
+ UINT8 qosFlowNum;
+ INT64 qfi;
+ UINT8 qosFlowMapFlag;
+ /* e_QoS_Flow_Mapping_Indication */
+ QosFlowMapInd_e qosFlowMapInd;
+}QosFlowMap_t;
+
+#define QOS_FLOW_MAP_IND_PRESENT (1 << 0)
+typedef struct qosFlowMapItem
+{
+ UINT16 bitMask;
+ UINT8 qosFlowIdentifier;
+ QosFlowMapInd_e qosFlowMappingInd;/* OPTIONAL */
+}QosFlowMapItem_t;
+
+typedef struct qosFlowMapList
+{
+ UINT8 qosFlowMapItemNum;
+ QosFlowMapItem_t qosFlowMapItem[e1ap_maxnoofQoSFlows];
+}QosFlowMapList_t;
+
+#define DATA_FORWARDIGN_INFO_REQ_QOS_FLOWS_FORWARD_TUNNELS_PRESENT (1 << 0)
+typedef struct
+{
+ UINT16 bitMask;
+ /* e_Data_Forwarding_Request */
+ DataForwardReq_e dataForwardingRequest;
+ QosFlowMapList_t qosFlowForwardTunnelList;/* OPTIONAL */
+}DFIRequest_t;
+
+#define CELL_GROUP_ITEM_UL_CONFIGURATION_PRESENT (1 << 0)
+#define CELL_GROUP_ITEM_DL_TX_STOP_PRESENT (1 << 1)
+#define CELL_GROUP_ITEM_RAT_TYPE_PRESENT (1 << 2)
+typedef struct cellGroupItem
+{
+ UINT16 bitMask;
+ INT64 cellGroupID;
+ /* e_UL_Configuration */
+ UlConfig_e ulConfig;/* OPTIONAL */
+ /* e_DL_TX_Stop */
+ DlTXStop_e dlTxStop;/* OPTIONAL */
+ /* e_RAT_Type */
+ RatType_e ratType;/* OPTIONAL */
+}CellGroupItem_t;
+
+typedef struct cellGroupInformation
+{
+ UINT8 cellGroupNum;
+ CellGroupItem_t cellGroupItem[e1ap_maxnoofCellGroups];
+}CellGroupInformation_t;
+
+typedef struct flowMappingInformation
+{
+ QoSFlowList_t qosFlowList;
+}FlowMappingInformation_t;
+
+#define ROHC_CONTINUE_ROHC_PRESENT (1 << 0)
+typedef struct
+{
+ UINT16 bitMask;
+ INT64 maxCid;
+ INT64 rohcProfiles;
+ /* e_ROHC__continueROHC */
+ RohcContinueRohc_e continueRohc;/* OPTIONAL */
+}Rohc_t;
+
+typedef struct
+{
+ /* ROHC_Parameters_PR */
+ RohcParaPR_e rohcType;
+ Rohc_t rohc;
+ Rohc_t ulOnlyRohc;
+}RohcPara_t;
+
+#define PDCP_CONFIGURATION_ROHC_PARA_PRESENT (1 << 0)
+#define PDCP_CONFIGURATION_REORDERING_TIMER_PRESENT (1 << 1)
+#define PDCP_CONFIGURATION_DISCARD_TIMER_PRESENT (1 << 2)
+#define PDCP_CONFIGURATION_UL_DATA_SPLIT_THRESHOLD_PRESENT (1 << 3)
+#define PDCP_CONFIGURATION_PDCP_DUPLICATION_PRESENT (1 << 4)
+#define PDCP_CONFIGURATION_PDCP_REESTABLISHMENT_PRESENT (1 << 5)
+#define PDCP_CONFIGURATION_PDCP_DATA_RECOVERY_PRESENT (1 << 6)
+#define PDCP_CONFIGURATION_DUPLICATION_ACTIVATION_PRESENT (1 << 7)
+#define PDCP_CONFIGURATION_OUT_OF_ORDER_DELIVERY_PRESENT (1 << 8)
+typedef struct pdcpConfiguration
+{
+ UINT16 bitMask;
+ /* e_PDCP_SN_Size */
+ PdcpSNSize_e pdcpSNSizeUl;
+ PdcpSNSize_e pdcpSNSizeDl;
+ /* e_RLC_Mode */
+ CuRlcMode_e rlcMode;
+ RohcPara_t rohcPara;/* OPTIONAL */
+ /* e_T_Reordering */
+ TReordering_e reorderTimer;/* OPTIONAL */
+ /* e_DiscardTimer */
+ DiscardTimer_e discadTimer;/* OPTIONAL */
+ /* e_ULDataSplitThreshold */
+ UlDataSplitThreshold_e ulDataSplitThreshold;/* OPTIONAL */
+ /* e_PDCP_Duplication */
+ PdcpDuplication_e pdcpDuplication;/* OPTIONAL */
+ /* e_PDCP_Reestablishment */
+ PdcpReestablishment_e pdcpReestablishment;/* OPTIONAL */
+ /* e_PDCP_DataRecovery */
+ PdcpDataRecovery_e pdcpDataRecovery;/* OPTIONAL */
+ /* e_Duplication_Activation */
+ DuplicationActivation_e duplicationAct;/* OPTIONAL */
+ /* e_OutOfOrderDelivery */
+ OutOfOrderDelivery_e outofOrderDelivery;/* OPTIONAL */
+}PDCPConfiguration_t;
+
+typedef struct
+{
+ /* e_DefaultDRB */
+ DefaultDRB_e defaultDrbInd;
+ /* e_SDAP_Header_UL */
+ SdapHeader_e sdapUlHeaderInd;
+ /* e_SDAP_Header_DL */
+ SdapHeader_e sdapDlHeaderInd;
+}SdapCfg_t;
+
+typedef struct
+{
+ UINT8 qosFlowNum;
+ QoSFlowQosItem_t qosFlowInfo[e1ap_maxnoofQoSFlows];
+}QosFlowQosPara_t;
+
+typedef struct
+{
+ INT64 pdcpSN;
+ UINT64 hFN;
+}PdcpCount_t;
+
+#define PDCP_SN_STATUS_INFORMATION_RECEIVE_PDCP_SDU_STATUSPRESENT (1 << 0)
+typedef struct
+{
+ UINT16 bitMask;
+ UINT64 receivePdcpSDUBitNum;/* OPTIONAL */
+ UINT64 receiveStatusofPdcpSDU[2048]; /*Length: 1 - 131072 */
+ PdcpCount_t ulCountValue;
+}PdcpUlStatusInfo_t;
+
+typedef struct
+{
+ PdcpCount_t dlCountValue;
+}PdcpDlStatusInfo_t;
+
+typedef struct
+{
+ PdcpUlStatusInfo_t pdcpUlStatusInfo;
+ PdcpDlStatusInfo_t pdcpDlStatusInfo;
+}PdcpSNStatusInfo_t;
+
+#define DRB_TO_SETUP_ITEM_DRB_DFI_REQUEST_PRESENT (1 << 0)
+#define DRB_TO_SETUP_ITEM_DRB_INACTIVITY_TIMER_PRESENT (1 << 1)
+#define DRB_TO_SETUP_ITEM_PDCP_SN_STATUS_INFO_PRESENT (1 << 2)
+typedef struct drbToSetupItem
+{
+ UINT16 bitMask;
+ UINT8 drbID;
+ SdapCfg_t sdapConfig;
+ PDCPConfiguration_t pdcpConfig;
+ CellGroupInformation_t cellGroupInfo;
+ QosFlowQosPara_t qosFlowSetup;
+ DFIRequest_t drbDataForwardInfoReq;/* OPTIONAL */
+ INT64 inactivityTimer;/* OPTIONAL */
+ PdcpSNStatusInfo_t pdcpSNStatusInfo;/* OPTIONAL */
+}DRBToSetupItem_t;
+
+typedef struct drbToSetupList
+{
+ UINT8 drbToSetupListNum;
+ DRBToSetupItem_t drbToSetupItem[e1ap_maxnoofDRBs];
+}DRBToSetupList_t;
+
+#define PDU_SESSION_RESOURCE_SETUP_DL_AMBR_PRESENT (1 << 0)
+#define PDU_SESSION_RESOURCE_SETUP_DATA_FORWARD_INFORMATION_REQ_PRESENT (1 << 1)
+#define PDU_SESSION_RESOURCE_SETUP_INACTIVITY_TIMER_PRESENT (1 << 2)
+#define PDU_SESSION_RESOURCE_SETUP_DL_UP_TRANSPORT_LAYER_INFO_PRESENT (1 << 3)
+#define PDU_SESSION_RESOURCE_SETUP_NETWORK_INSTANCE_PRESENT (1 << 4)
+typedef struct pduSessionResourceToSetupItem
+{
+ UINT16 bitMask;
+ UINT16 pduSessionId;
+ PduSessType_e pduSessionType;
+ SNssai_t snssai;
+ SecuInd_t securityIndication;
+ UINT64 pduSessionResourceDlAMBR;/* OPTIONAL */
+ UpTransLayerInfo_t ulUpTNLInformation;
+ DFIRequest_t dataForwardInfoReq;/* OPTIONAL */
+ INT64 inactTimer;/* OPTIONAL */
+ UpTransLayerInfo_t existAllocateNgDlUpTnlInfo;/* OPTIONAL */
+ INT64 networkInstance;/* OPTIONAL */
+ DRBToSetupList_t drbToSetupList;
+}PduSessionResourceToSetupItem_t;
+
+typedef struct pduSessionResourceToSetupList
+{
+ UINT8 sessNum;
+ PduSessionResourceToSetupItem_t pduSessionResourceToSetupItem[e1ap_maxnoofPDUSessionResource];
+}PduSessionResourceToSetupList_t;
+
+typedef struct upParametersItem
+{
+ UpTransLayerInfo_t upTransLayerInfo;
+ INT64 cellGroupID;
+} UPParametersItem_t;
+
+typedef struct upParametersList
+{
+ UINT8 upParaNum;
+ UPParametersItem_t upParametersItem[e1ap_maxnoofUPParameters];
+} UPParametersList_t;
+
+#define DATA_FORWARDIGN_INFO_RSP_UL_DATA_FORWARD_PRESENT (1 << 0)
+#define DATA_FORWARDIGN_INFO_RSP_DL_DATA_FORWARD_PRESENT (1 << 1)
+typedef struct dFIResponse
+{
+ UINT16 bitMask;
+ UpTransLayerInfo_t ulDataForwarding;/*optional*/
+ UpTransLayerInfo_t dlDataForwarding;/*optional*/
+} DFIResponse_t;
+
+#define DRB_TO_MODIFY_ITEM_SDAP_CONFIG_PRESENT (1 << 0)
+#define DRB_TO_MODIFY_ITEM_PDCP_CONFIG_PRESENT (1 << 1)
+#define DRB_TO_MODIFY_ITEM_DRB_DATA_FORWARD_INFO_RSP_PRESENT (1 << 2)
+#define DRB_TO_MODIFY_ITEM_PDCP_SN_STATUS_REQ_PRESENT (1 << 3)
+#define DRB_TO_MODIFY_ITEM_PDCP_SN_STATUS_INFO_PRESENT (1 << 4)
+#define DRB_TO_MODIFY_ITEM_DL_UP_PARA_PRESENT (1 << 5)
+#define DRB_TO_MODIFY_ITEM_CELL_GROUP_TO_ADD_PRESENT (1 << 6)
+#define DRB_TO_MODIFY_ITEM_CELL_GROUP_TO_MODIFY_PRESENT (1 << 7)
+#define DRB_TO_MODIFY_ITEM_CELL_GROUP_TO_REMOVE_PRESENT (1 << 8)
+#define DRB_TO_MODIFY_ITEM_FLOW_MAPPING_INFO_PRESENT (1 << 9)
+#define DRB_TO_MODIFY_ITEM_DRB_INACTIVITY_TIMER_PRESENT (1 << 10)
+typedef struct drbToModifyItem
+{
+ UINT16 bitMask;
+ UINT8 drb_ID;
+ SdapCfg_t sdapConfig;/* OPTIONAL */
+ PDCPConfiguration_t pdcpConfig;/* OPTIONAL */
+ DFIResponse_t drbDataForwardInfoRsp;/* OPTIONAL */
+ PdcpSNStatusRequest_e pdcpSNStatusReq;/* OPTIONAL */
+ PdcpSNStatusInfo_t pdcpSNStatusInfo;/* OPTIONAL */
+ UPParametersList_t dlUPParameters;/* OPTIONAL */
+ CellGroupInformation_t cellGroupToAdd;/* OPTIONAL */
+ CellGroupInformation_t cellGroupToModify;/* OPTIONAL */
+ CellGroupInformation_t cellGroupToRemove;/* OPTIONAL */
+ QosFlowQosPara_t flowMappingInfo;/* OPTIONAL */
+ INT64 drbInactTimer;/* OPTIONAL */
+}DRBToModifyItem_t;
+
+typedef struct drbToModifyList
+{
+ UINT8 drbToModifyItemNum;
+ DRBToModifyItem_t drbToModifyItem[e1ap_maxnoofDRBs];
+}DRBToModifyList_t;
+
+typedef struct drbToRemoveItem
+{
+ UINT8 drb_ID;
+}DRBToRemoveItem_t;
+
+typedef struct drbToRemoveList
+{
+ UINT8 drbToRemovetemNum;
+ DRBToRemoveItem_t drbToRemoveItem[e1ap_maxnoofDRBs];
+}DRBToRemoveList_t;
+
+#define PDU_SESSION_RESOURCE_TO_MODIFY_SECURITY_INDICATION_PRESENT (1 << 0)
+#define PDU_SESSION_RESOURCE_TO_MODIFY_DL_AMBR_PRESENT (1 << 1)
+#define PDU_SESSION_RESOURCE_TO_MODIFY_UL_UP_TNL_INFO_PRESENT (1 << 2)
+#define PDU_SESSION_RESOURCE_TO_MODIFY_DATA_FORWARD_INFORMATION_REQ_PRESENT (1 << 3)
+#define PDU_SESSION_RESOURCE_TO_MODIFY_DATA_FORWARD_INFORMATION_RSP_PRESENT (1 << 4)
+#define PDU_SESSION_RESOURCE_TO_MODIFY_INACTIVITY_TIMER_PRESENT (1 << 5)
+#define PDU_SESSION_RESOURCE_TO_MODIFY_NETWORK_INSTANCE_PRESENT (1 << 6)
+#define PDU_SESSION_RESOURCE_TO_MODIFY_DRB_TO_SETUP_LIST_PRESENT (1 << 7)
+#define PDU_SESSION_RESOURCE_TO_MODIFY_DRB_TO_MODIFY_LIST_PRESENT (1 << 8)
+#define PDU_SESSION_RESOURCE_TO_MODIFY_DRB_TO_REMOVE_LIST_PRESENT (1 << 9)
+typedef struct pduSessionResourceToModifyItem
+{
+ UINT16 bitmask;
+ UINT8 pduSessionId;
+ SecuInd_t secuIndi;/* OPTIONAL */
+ UINT64 pduSessionResourceDlAMBR;/* OPTIONAL */
+ UpTransLayerInfo_t ngUlUpTnlInfo;/* OPTIONAL */
+ DFIRequest_t pduSessionDataForwardInfoReq;/* OPTIONAL */
+ DFIResponse_t pduSessionDataForwardInfoRsp;/* OPTIONAL */
+ INT64 pduSessionInactTimer;/* OPTIONAL */
+ INT64 networkInstance;/* OPTIONAL */
+ DRBToSetupList_t drbToSetupList;/* OPTIONAL */
+ DRBToModifyList_t drbToModifyList;/* OPTIONAL */
+ DRBToRemoveList_t drbToRemoveList;/* OPTIONAL */
+}PduSessionResourceToModifyItem_t;
+
+typedef struct pduSessionResourceToModifylist
+{
+ UINT8 pduSessionResourceToModifyItemNum;
+ PduSessionResourceToModifyItem_t pduSessionResourceToModifyItem[e1ap_maxnoofPDUSessionResource];
+}PduSessionResourceToModifyList_t;
+
+typedef struct cellGroupList
+{
+ UINT8 numCellGroupItem;
+ CellGroupItem_t cellGroupItem[e1ap_maxnoofCellGroups];
+}CellGroupList_t;
+
+typedef struct pduSessionResourceToRemoveItem
+{
+ UINT16 pduSessionID;
+}PduSessionResourceToRemoveItem_t;
+
+typedef struct pduSessionResourceToRemoveList
+{
+ UINT8 pduSessionResourceToRemoveItemNum;
+ PduSessionResourceToRemoveItem_t pduSessionResourceToRemoveItem[e1ap_maxnoofPDUSessionResource];
+}PduSessionResourceToRemoveList_t;
+
+typedef struct ieCriticalityDiagnostics
+{
+ Criticality_e ieCriticality;
+ E1apProtocolIeId_e protocolIEId;
+ ErrorType_e typeOfError;
+}E1IECriticalityDiagnostics_t;
+
+#define PROCEDURE_CODE_PRESENT (1 << 0)
+#define TRIGGER_MESSAGE_TYPE_PRESENT (1 << 1)
+#define PROCDURE_CRITICALITY_PRESENT (1 << 2)
+#define TRANSACTION_ID_PRESENT (1 << 3)
+#define IE_CRITICALITY_DIAGNOSTICS_PRESENT (1 << 4)
+typedef struct criticalitydiagnostics
+{
+ UINT16 bitMask;
+ E1apProcCode_e procedureCode;/* OPTIONAL */
+ TriggerMsg_e typeOfMessage;/* OPTIONAL */
+ Criticality_e criticality;/* OPTIONAL */
+ INT64 transactionID;/* OPTIONAL */
+ UINT8 IECriticalityDiagnosticsNum;/* OPTIONAL */
+ E1IECriticalityDiagnostics_t ieCriticalityDiagnostics[e1ap_maxnoofErrors];/* OPTIONAL */
+}E1Criticalitydiagnostics_t;
+
+typedef struct e1apCause
+{
+ E1apCausePr_e present;
+ union E1apCause_u
+ {
+ E1apCauseRadioNetwork_e e1apRadioNetwork;
+ E1apCauseTransport_e e1apTransport;
+ E1apCauseProtocol_e e1apProtocol;
+ E1apCauseMisc_e e1apMisc;
+ } choice;
+} E1apCause_t;
+
+#define PART_E1_INTERFACE_GNBCUCPUEID_PRESENT (1 << 0)
+#define PART_E1_INTERFACE_GNBCUUPUEID_PRESENT (1 << 1)
+
+typedef struct partE1InterfaceItem
+{
+ UINT16 bitMask;
+ UINT32 gnbCucpUeE1apId;/*optional*/
+ UINT32 gnbCuupUeE1apId;/*optional*/
+}PartE1InterfaceItem_t;
+
+typedef struct partE1InterfaceList
+{
+ UINT8 PartE1InterfaceListNum;
+ PartE1InterfaceItem_t partE1InterfaceItem[e1ap_maxnoofIndividualE1ConnectionsToReset];
+}PartE1InterfaceList_t;
+
+typedef struct e1apResetType
+{
+ E1apResetPr_e present;
+ union E1apReset_u
+ {
+ INT64 resetAll;
+ PartE1InterfaceList_t PartE1InterfaceList;
+ } choice;
+} E1apResetType_t;
+
+/**********************************************************************************
+***********************************************************************************
+***************** CUC <--> E1AP MESSAGE STRUCTURE ******************
+***********************************************************************************
+***********************************************************************************/
+typedef struct ifmCucpE1apReset
+{
+ UINT64 transactionId;
+ E1apCause_t cause;
+ E1apResetType_t e1apResetType;
+} IfmCucpE1apReset_t;
+
+#define CUUPE1APRESETACKPARTE1INTERFACE (1 << 0)
+#define CUUPE1APRESETACKCRITICALDIAGNOSTICS (1 << 1)
+
+typedef struct ifmE1apResetAck
+{
+ UINT16 bitMask;
+ UINT64 transactionId;
+ PartE1InterfaceList_t PartE1InterfaceList;/*optional*/
+ E1Criticalitydiagnostics_t criticalDiagnostics;/*optional*/
+} IfmE1apResetAck_t;
+
+#define CUCP_E1AP_SETUP_REQ_GNB_CUCP_NAME_CHOSEN_PRESENT (1 << 0)
+typedef struct ifmCucpE1apSetupReq
+{
+ UINT16 bitMask;
+ UINT64 transactionId;
+ GnbCucpName_t gnbCucpName;/*optional*/
+} IfmCucpE1apSetupReq_t;
+
+#define CUUPE1APSETUPRSPGNBCUCPNAMECHOSEN (1 << 0)
+typedef struct ifmCuupE1apSetupRsp
+{
+ UINT16 bitMask;
+ UINT64 transactionId;
+ GnbCucpName_t gnbCucpName;/*optional*/
+} IfmCuupE1apSetupRsp_t;
+
+#define CUUPE1APSETUPFAILURETIMETOWAIT (1 << 0)
+#define CUUPE1APSETUPFAILURECRITICALDIAGNOSTICS (1 << 1)
+typedef struct ifmCuupE1apSetupFailure
+{
+ UINT16 bitMask;
+ long transactionId;
+ E1apCause_t cause;
+ TimeToWait_e timeToWait;/*optional*/
+ E1Criticalitydiagnostics_t criticalDiagnostics;/*optional*/
+} IfmCuupE1apSetupFailure_t;
+
+typedef struct e1apReleaseReq
+{
+ INT64 transactionId;
+ E1apCause_t cause;
+} E1apReleaseReq_t;
+
+#define BEARER_CONTEXT_SETUP_UE_DL_MAX_IPDR_PRESENT (1 << 0)
+#define BEARER_CONTEXT_SETUP_UE_INACTIVITY_TIMER_PRESENT (1 << 1)
+#define BEARER_CONTEXT_SETUP_BEARER_CONTEXT_STATUS_CHANGE_PRESENT (1 << 2)
+typedef struct e1apBearerContextSetupReq
+{
+ UINT16 bitMask;
+ NrCellId_t cellId;
+ UINT32 cucpUeE1apId;
+ SecuInfo_t secuInfo;
+ UINT64 ueDlAMBR;
+ UINT64 ueDlMaxIPDR;/*optional*/
+ PlmnId_t servPlmnId;
+ /* e_ActivityNotificationLevel */
+ ActNotiLevel_e actNotiLevel;
+ /* Inactivity_Timer_t */
+ INT64 inactTimer;/*optional*/
+ /* e_BearerContextStatusChange */
+ BearCxtStatusChange_e bearerCxtStatusChg;/*optional*/
+ PduSessionResourceToSetupList_t pduSessionResourceToSetupList;
+} E1apBearerContextSetupReq_t;
+
+#define DRB_TO_SETUP_MOD_ITEM_DRB_DATA_FORWARD_INFO_REQ_PRESENT (1 << 0)
+#define DRB_TO_SETUP_MOD_ITEM_DRB_INACTIVITY_TIMER_PRESENT (1 << 1)
+#define DRB_TO_SETUP_MOD_ITEM_PDCP_UL_COUNT_PRESENT (1 << 2)
+#define DRB_TO_SETUP_MOD_ITEM_PDCP_DL_COUNT_PRESENT (1 << 3)
+typedef struct drbToSetupModItem
+{
+ UINT16 bitMask;
+ UINT8 drbID;
+ SdapCfg_t sdapConfig;
+ PDCPConfiguration_t pdcpConfig;
+ CellGroupInformation_t cellGroupInfo;
+ QosFlowQosPara_t flowMappingInfo;
+ DFIRequest_t drbDataForwardInfoReq;/* OPTIONAL */
+ INT64 drbInactTimer;/* OPTIONAL */
+ PdcpCount_t pdcpUlCnt;/* OPTIONAL */
+ PdcpCount_t pdcpDlCnt;/* OPTIONAL */
+}DrbToSetupModItem_t;
+
+typedef struct drbToSetupModList
+{
+ UINT8 drbToSetupModListNum;
+ DrbToSetupModItem_t drbToSetupModItem[e1ap_maxnoofDRBs];
+}DrbToSetupModList_t;
+
+#define PDU_SESSION_RESOURCE_TO_SETUP_MOD_AMBR_PRESENT (1 << 0)
+#define PDU_SESSION_RESOURCE_TO_SETUP_MOD_DATA_FORWARD_INFORMATION_REQ_PRESENT (1 << 1)
+#define PDU_SESSION_RESOURCE_TO_SETUP_MOD_INACTIVITY_TIMER_PRESENT (1 << 2)
+typedef struct pduSessionResourceToSetupModItem
+{
+ UINT16 bitMask;
+ UINT8 pduSessionId;
+ PduSessType_e pduSessionType;
+ SNssai_t snssai;
+ SecuInd_t secuIndi;
+ UINT64 pduSessionResourceAMBR;/* OPTIONAL */
+ UpTransLayerInfo_t ngUlUpTnlInfo;
+ DFIRequest_t pduSessionDataForwardInfoReq;/* OPTIONAL */
+ INT64 pduSessionInactTimer;/* OPTIONAL */
+ DrbToSetupModList_t drbToSetupModList;
+}PduSessionResourceToSetupModItem_t;
+
+typedef struct pduSessionResourceToSetupModList
+{
+ UINT8 pduSessionResourceToSetupModItemNum;
+ PduSessionResourceToSetupModItem_t pduSessionResourceToSetupModItem[e1ap_maxnoofPDUSessionResource];
+}PduSessionResourceToSetupModList_t;
+
+#define BEARER_CONTEXT_MODIFY_REQ_PDU_SESSION_RESOURCE_TO_SETUP_MOD_LIST_PRESENT (1 << 0)
+#define BEARER_CONTEXT_MODIFY_REQ_PDU_SESSION_RESOURCE_TO_MODIFY_LIST_PRESENT (1 << 1)
+#define BEARER_CONTEXT_MODIFY_REQ_PDU_SESSION_RESOURCE_TO_REMOVE_LIST_PRESENT (1 << 2)
+typedef struct e1apPduSessionResourceToList
+{
+ UINT16 bitMask;
+ PduSessionResourceToSetupModList_t pduSessionResourceToSetupModList; ///< Optional field
+ PduSessionResourceToModifyList_t pduSessionResourceToModfiyList; ///< Optional field
+ PduSessionResourceToRemoveList_t pduSessionResourceToRemoveList; ///< Optional field
+} PduSessionResourceList_t;
+
+#define BEARER_CONTEXT_MODIFY_REQ_SECURITY_INFORMATION_PRESENT (1 << 0)
+#define BEARER_CONTEXT_MODIFY_REQ_UE_DL_AMBR_PRESENT (1 << 1)
+#define BEARER_CONTEXT_MODIFY_REQ_UE_DL_MAX_IPDR_PRESENT (1 << 2)
+#define BEARER_CONTEXT_MODIFY_REQ_BEARER_CTX_SATAUS_CHANGE_PRESENT (1 << 3)
+#define BEARER_CONTEXT_MODIFY_REQ_NEW_UL_TNL_INFO_REQ_PRESENT (1 << 4)
+#define BEARER_CONTEXT_MODIFY_REQ_UE_INACTIBITY_TIMER_PRESENT (1 << 5)
+#define BEARER_CONTEXT_MODIFY_REQ_DATA_DISCARD_REQUIRED_PRESENT (1 << 6)
+#define BEARER_CONTEXT_MODIFY_REQ_PDU_SESSION_RESOURCE (1 << 7)
+typedef struct e1apBearerContextModReq
+{
+ UINT16 bitMask;
+ NrCellId_t cellId;
+ UINT32 gnbCucpUeE1apId;
+ UINT32 gnbCuupUeE1apId;
+ SecuInfo_t secuInfo; ///< Optional field
+ UINT64 ueDlAMBR; ///< Optional field
+ UINT64 ueDlMaxIPDR; ///< Optional field
+ BearCxtStatusChange_e bearerCtxStatusChg; ///< Optional field
+ NewUlTnlInfoRequire_e newUlTnlInfoRequire; ///< Optional field
+ INT64 ueInactTimer; ///< Optional field
+ DataDisRequire_e dataDisRequire; ///< Optional field
+ PduSessionResourceList_t pduSessionResourceList;///< Optional field
+} E1apBearerContextModReq_t;
+
+typedef struct e1apBearerContextRelCmd
+{
+ NrCellId_t cellId;//added artifficially
+ UINT64 gnbCucpUeE1apId;
+ UINT64 gnbCuupUeE1apId;
+ E1apCause_t cause;
+} E1apBearerContextRelCmd_t;
+
+/**********************************************************************************
+ ** UPC <--> E1AP ACCORDING TO STRUCTURE
+***********************************************************************************/
+#define MAX_LENGTH_GNBCUUP_NAME 150
+typedef struct gnbCuupName
+{
+ char gnbCuupName[MAX_LENGTH_GNBCUUP_NAME];
+
+}GnbCuupName_t;
+
+#define DATA_FORWARDING_INFO_UL_DATA_FORWARD_PRESENT (1 << 0)
+#define DATA_FORWARDING_INFO_DL_DATA_FORWARD_PRESENT (1 << 1)
+typedef struct qosFlowItemIEs
+{
+ UINT8 qosFlowIndicator;
+ E1apCause_t cause;
+} QoSFlowItemIEs_t;
+typedef struct flowFailedlist
+{
+ UINT8 qosFlowNum;
+ QoSFlowItemIEs_t qosFlowItemIEs[e1ap_maxnoofQoSFlows];
+} FlowFailedlist_t;
+
+#define DRB_SETUP_ITEM_DATA_FORWARD_INFO_RES_PRESENT (1 << 0)
+#define DRB_SETUP_ITEM_FLOW_FAILED_LIST_PRESENT (1 << 1)
+typedef struct drbSetupItem
+{
+ UINT16 bitMask;
+ UINT8 drId;
+ DFIResponse_t dataForwardInfoRsp;/*optional*/
+ UPParametersList_t upPara;
+ QoSFlowList_t flowSetupList;
+ FlowFailedlist_t flowFailedlist;/*optional*/
+} DRBSetupItem_t;
+typedef struct drbSetupList
+{
+ UINT8 drbSetupNum;
+ DRBSetupItem_t drbSetupItem[e1ap_maxnoofDRBs];
+} DRBSetupList_t;
+
+typedef struct
+{
+ UINT8 drbID;
+ E1apCause_t cause;
+}DRBFailItem_t;
+
+typedef struct drbFailedList
+{
+ UINT8 drbFailNum;
+ DRBFailItem_t drbFailItem[e1ap_maxnoofDRBs];
+} DRBFailedList_t;
+
+#define PDU_SESSION_RESOURCE_SETUP_SECURITY_RESULT_PRESENT (1 << 0)
+#define PDU_SESSION_RESOURCE_SETUP_DATA_FORWARD_INFO_RES_PRESENT (1 << 1)
+#define PDU_SESSION_RESOURCE_SETUP_NG_DL_UP_UNCHANGED_PRESENT (1 << 2)
+#define PDU_SESSION_RESOURCE_SETUP_DRB_FAILED_LIST_PRESENT (1 << 3)
+
+typedef struct pduSessionResourceSetupItem
+{
+ UINT16 bitMask;
+ INT64 pduSessionId;
+ SecuResult_t securityResult;/* OPTIONAL */
+ UpTransLayerInfo_t ngDlUpTransLayerInfo;
+ DFIResponse_t dataForwardingInformationResponse;/* OPTIONAL */
+ /* e_PDU_Session_Resource_Setup_Item__nG_DL_UP_Unchanged */
+ NgDlUpUnchange_e ngDlUpUchange;/* OPTIONAL */
+ DRBSetupList_t drbSetupList;
+ DRBFailedList_t drbFailedList;
+}PduSessionResourceSetupItem_t;
+
+typedef struct pduSessionResourceSetupList
+{
+ UINT8 sessionResourceSetupNum;
+ PduSessionResourceSetupItem_t pduSessionResourceSetupItem[e1ap_maxnoofPDUSessionResource];
+}PduSessionResourceSetupList_t;
+
+typedef struct pduSessionResourceFailedItem
+{
+ INT64 sessId;
+ E1apCause_t cause;
+}PduSessionResourceFailedItem_t;
+
+typedef struct pduSessionResourceFailedlist
+{
+ UINT8 sessFailNum;
+ PduSessionResourceFailedItem_t sessFailItem[e1ap_maxnoofPDUSessionResource];
+}PduSessionResourceFailedList_t;
+
+#define DRB_MODIFY_ITEM_UL_UP_TRANSPORT_PARA_PRESENT (1 << 0)
+#define DRB_MODIFY_ITEM_PDCP_SN_STATUS_INFO_PRESENT (1 << 1)
+#define DRB_MODIFY_ITEM_FLOW_SETUP_LIST_PRESENT (1 << 2)
+#define DRB_MODIFY_ITEM_FLOW_FAILED_LIST_PRESENT (1 << 3)
+typedef struct dRBModifyItem
+{
+ UINT16 bitMask;
+ UINT8 drbId;
+ UPParametersList_t ulUpTransPara;/* OPTIONAL */
+ PdcpSNStatusInfo_t pdcpSNStatusInfo;/* OPTIONAL */
+ QoSFlowList_t flowSetupList;/* OPTIONAL */
+ FlowFailedlist_t flowFailedlist;/* OPTIONAL */
+} DRBModifyItem_t;
+
+typedef struct dRBModifyList
+{
+ UINT8 drbModifyItemNum;
+ DRBModifyItem_t drbModifyItem[e1ap_maxnoofDRBs];
+} DRBModifyList_t;
+
+#define PDU_SESSION_RESOURCE_MODIFY_DL_UP_TNL_INFO_PRESENT (1 << 0)
+#define PDU_SESSION_RESOURCE_MODIFY_SECURITY_RESULT_PRESENT (1 << 1)
+#define PDU_SESSION_RESOURCE_MODIFY_DATA_FORWARD_INFO_RSP_PRESENT (1 << 2)
+#define PDU_SESSION_RESOURCE_MODIFY_DRB_SETUP_LIST_PRESENT (1 << 3)
+#define PDU_SESSION_RESOURCE_MODIFY_DRB_FAILED_LIST_PRESENT (1 << 4)
+#define PDU_SESSION_RESOURCE_MODIFY_DRB_MODIFY_LIST_PRESENT (1 << 5)
+#define PDU_SESSION_RESOURCE_MODIFY_DRB_FAILED_TO_MOD_LIST_PRESENT (1 << 6)
+typedef struct pduSessionResourceModifyItem
+{
+ UINT16 bitmask;
+ UINT8 pduSessionId;
+ UpTransLayerInfo_t ngDlUpTnlInfo;/* OPTIONAL */
+ SecuResult_t securityResult;/* OPTIONAL */
+ DFIResponse_t pduSessionDataForwardInfoRsp;/* OPTIONAL */
+ DRBSetupList_t drbSetupList;/* OPTIONAL */
+ DRBFailedList_t drbFailedList;/* OPTIONAL */
+ DRBModifyList_t drbModifyList;/* OPTIONAL */
+ DRBFailedList_t drbFailedToModList;/* OPTIONAL */
+}PduSessionResourceModifyItem_t;
+
+typedef struct pduSessionResourceModifyList
+{
+ UINT8 pduSessionResourceModifyItemNum;
+ PduSessionResourceModifyItem_t pduSessionResourceModifyItem[e1ap_maxnoofPDUSessionResource];
+}PduSessionResourceModifyList_t;
+
+typedef struct e1apSliceSupportItem
+{
+ SNssai_t snssai;
+}E1apsliceSupportItem_t;
+
+typedef struct e1apSliceSupportList
+{
+ UINT8 SliceSupportItemNum;
+ E1apsliceSupportItem_t sliceSupportItem[e1ap_maxnoofSliceItems];
+}E1apsliceSupportList_t;
+
+typedef struct nrCgiSupportItem
+{
+ CuNrCgi_t NrCgi;
+}NrCgiSupportItem_t;
+
+typedef struct nrCgiSupportList
+{
+ UINT8 NrCgiSupportItemNum;
+ NrCgiSupportItem_t NrCgiSupportItem[e1ap_maxnoofNRCGI];
+}NrCgiSupportList_t;
+
+typedef struct NGRANQoSSupportItem
+{
+ NonDynamic5QIDescr_t NonDynamic5QIDescr;
+}NGRANQoSSupportItem_t;
+
+typedef struct nGRANQoSSupportList
+{
+ UINT8 NGRANQoSSupportItemNum;
+ NGRANQoSSupportItem_t NGRANQoSSupportItem[e1ap_maxnoofNGRANQOSParameters];
+}NGRANQoSSupportList_t;
+
+typedef struct qosParamtersSupportList
+{
+ UINT16 bitMask;
+ NGRANQoSSupportList_t NGRANQoSSupportList;
+}QosParamtersSupportList_t;
+
+typedef struct supportedPLMNsItem_s
+{
+ PlmnId_t plmnId;
+ E1apsliceSupportList_t sliceSupportList;/*optional*/
+ NrCgiSupportList_t nrCgiSupportList;/*optional*/
+ QosParamtersSupportList_t qosParamtersSupportList;/*optional*/
+}SupportedPLMNsItem_t;
+
+typedef struct supportedPLMNsList_s
+{
+ UINT8 supportPlmns;
+ SupportedPLMNsItem_t SupportedPLMNsItem[e1ap_maxnoofSPLMNs];
+}SupportedPLMNsList_t;
+
+typedef struct pduSessionToNotifyItem_s
+{
+ UINT8 pduSessionId;
+ QoSFlowList_t flowSetupList;
+}PduSessionToNotifyItem_t;
+
+typedef struct pduSessionToNotifyList_s
+{
+ UINT8 pduSessionToNotifynum;
+ PduSessionToNotifyItem_t pduSessionToNotifyItem[e1ap_maxnoofPDUSessionResource];
+}PduSessionToNotifyList_t;
+
+typedef struct e1apUpbPlmnCfgInfo_s
+{
+ PlmnId_t plmnId;
+ UINT16 cgiNum;
+ CuNrCgi_t cgi[e1ap_maxnoofNRCGI];/*optional*/
+ E1apsliceSupportList_t sliceSupportList;/*optional*/
+ UINT32 qosNum;
+ NonDynamic5QIDescr_t qosPara[e1ap_maxnoofNGRANQOSParameters];/*optional*/
+}E1apUpbPlmnCfgInfo_t;
+
+/**********************************************************************************
+ ** UPC <--> E1AP MESSAGE STRUCTURE
+***********************************************************************************/
+
+typedef struct e1apRegistergNBReq
+{
+ Instance_t instance;
+ UINT8 state;
+ GnbCuupName_t gnbCuupName;
+}E1apRegistergNBReq_t;
+
+/* ¸ÃÏûÏ¢½á¹¹Ó¦¸ÃŲµ½ CUUP/INC Ŀ¼Ï TBD */
+typedef struct e1apRegistergNBCnf
+{
+ Instance_t instance;
+ UINT8 state;
+ GnbCucpName_t gnbCucpName;
+ int successCellNum;
+ CellIdList_t successCellList;
+ int failCellNum;
+ CellIdList_t failCellList;
+} E1apRegistergNBCnf_t;
+
+/* Deregister Indication */
+typedef struct e1apDeregisteredgNBInd
+{
+ Instance_t instance;
+} E1apDeregisteredgNBInd_t;
+
+typedef struct UpbPlmnCfgInfolist
+{
+ UINT32 bPlmnNum;
+ E1apUpbPlmnCfgInfo_t bPlmnCfgInfo[e1ap_maxnoofSPLMNs];
+} E1apUpbPlmnCfgInfoList_t;
+
+#define E1AP_REGISTER_REQ_UPNAME_PRESENT (1 << 0)
+#define E1AP_REGISTER_REQ_UP_CAPACITY_PRESENT (1 << 1)
+typedef struct e1apRegisterCpReq
+{
+ UINT16 bitMask;
+ Instance_t instance;
+ UINT64 transactionId;
+ UINT64 gnbCuupId;
+ GnbCuupName_t gnbCuupName;/*optional*/
+ CNSupport_e cnSupport;
+ E1apUpbPlmnCfgInfoList_t e1apUpbPlmnCfgInfoList;
+ INT64 upCapacity;/*optional*/
+} E1apRegisterCpReq_t;
+#define E1AP_SETUP_RSP_UPNAME_PRESENT (1 << 0)
+#define E1AP_SETUP_RSP_UP_CAPACITY_PRESENT (1 << 1)
+typedef struct e1apSetupRsp
+{
+ UINT16 bitMask;
+ Instance_t instance;
+ UINT64 transactionId;
+ UINT64 gnbCuupId;
+ GnbCuupName_t gnbCuupName;/*optional*/
+ CNSupport_e cnSupport;
+ E1apUpbPlmnCfgInfoList_t e1apUpbPlmnCfgInfoList;
+ INT64 upCapacity;/*optional*/
+} E1apSetupRsp_t;
+typedef struct e1apSetupFail
+{
+ UINT16 bitMask;
+ long transactionId;
+ E1apCause_t cause;
+ TimeToWait_e timeToWait;/*optional*/
+ E1Criticalitydiagnostics_t criticalDiagnostics;/*optional*/
+} E1apSetupFail_t;
+
+typedef struct e1apReleaseRsp
+{
+ INT64 transactionId;
+} E1apReleaseRsp_t;
+
+#define E1AP_PDU_SESSION_RESOURCE_FAILED_LIST_PRESENT (1 << 0)
+typedef struct e1apPduSessionResourceSetuplist
+{
+ UINT16 bitMask;
+ PduSessionResourceSetupList_t pduSessionResourceSetuplist;
+ PduSessionResourceFailedList_t pduSessionResourceFailedList; //OPTION
+} E1apPduSessionResourceSetupList_t;
+
+typedef struct e1apBearerContextSetupRsp
+{
+ UINT64 gnbCucpUeE1apId;
+ UINT64 gnbCuupUeE1apId;
+ E1apPduSessionResourceSetupList_t e1apPduSessionResourceSetuplist;
+} E1apBearerContextSetupRsp_t;
+
+#define BEARER_CONTEXT_MOD_FAIL_CRITICAL_DIAGNOSE_PRESENT (1 << 0)
+typedef struct e1apBearerContextModFail
+{
+ UINT16 bitMask;
+ UINT32 gnbCucpUeE1apId;
+ UINT32 gnbCuupUeE1apId;
+ E1apCause_t cause;
+ E1Criticalitydiagnostics_t e1apCriticalDiagnose;
+} E1apBearerContextModFail_t;
+
+#define BEARER_CONTEXT_SETUP_FAILURE_CRITICAL_DIAGNOSE_PRESENT (1 << 0)
+typedef struct e1apBearerContextSetupFailure
+{
+ UINT16 bitMask;
+ UINT64 gnbCucpUeE1apId;
+ UINT64 gnbCuupUeE1apId;
+ E1apCause_t cause;
+ E1Criticalitydiagnostics_t criticalDiagnose; /* Optional field*/
+} E1apBearerContextSetupFailure_t;
+
+#define DRB_SETUP_MOD_ITEM_DATA_FORWARD_INFO_RSP_PRESENT (1 << 0)
+#define DRB_SETUP_MOD_ITEM_FLOW_FAILED_LIST_PRESENT (1 << 1)
+typedef struct dRBSetupModItem
+{
+ UINT16 bitMask;
+ UINT8 drbId;
+ DFIResponse_t drbDataForwardInfoRsp;/* OPTIONAL */
+ UPParametersList_t ulUpTransPara;
+ QoSFlowList_t flowSetupList;
+ FlowFailedlist_t flowFailedlist;/* OPTIONAL */
+} DRBSetupModItem_t;
+
+typedef struct dRBSetupModList
+{
+ UINT8 drbSetupModItemNum;
+ DRBSetupModItem_t drbSetupModItem[e1ap_maxnoofDRBs];
+} DRBSetupModList_t;
+
+#define PDU_SESSION_RESOURCE_SETUP_MOD_SECURITY_RESULT_PRESENT (1 << 0)
+#define PDU_SESSION_RESOURCE_SETUP_MOD_DATA_FORWARD_INFO_RSP_PRESENT (1 << 1)
+#define PDU_SESSION_RESOURCE_SETUP_MOD_DRB_FAILED_LIST_PRESENT (1 << 2)
+typedef struct pduSessionResourceSetupModItem
+{
+ UINT16 bitmask;
+ UINT8 pduSessionId;
+ SecuResult_t securityResult;/* OPTIONAL */
+ UpTransLayerInfo_t ngDlUpTnlInfo;
+ DFIResponse_t pduSessionDataForwardInfoRsp;/* OPTIONAL */
+ DRBSetupModList_t drbSetupModList;
+ DRBFailedList_t drbFailedList;/* OPTIONAL */
+}PduSessionResourceSetupModItem_t;
+
+typedef struct pduSessionResourceSetupModList
+{
+ UINT8 pduSessionResourceSetupModItemNum;
+ PduSessionResourceSetupModItem_t pduSessionResourceSetupModItem[e1ap_maxnoofPDUSessionResource];
+}PduSessionResourceSetupModList_t;
+
+#define BEARER_CONTEXT_MODIFY_RSP_PDU_SESSION_RESOURCE_SETUP_MOD_LIST_PRESENT (1 << 0)
+#define BEARER_CONTEXT_MODIFY_RSP_PDU_SESSION_RESOURCE_FAILED_MOD_LIST_PRESENT (1 << 1)
+#define BEARER_CONTEXT_MODIFY_RSP_PDU_SESSION_RESOURCE_MODIFY_LIST_PRESENT (1 << 2)
+#define BEARER_CONTEXT_MODIFY_RSP_PDU_SESSION_RESOURCE_FAILED_TO_MOD_LIST_PRESENT (1 << 3)
+typedef struct e1apBearModPduSessionResource
+{
+ UINT16 bitmask;
+ PduSessionResourceSetupModList_t pduSessionResourceSetupModList;///< Optional field
+ PduSessionResourceFailedList_t pduSessionResourceFailedModList;///< Optional field
+ PduSessionResourceModifyList_t pduSessionResourceModfiyList;///< Optional field
+ PduSessionResourceFailedList_t pduSessionResourceFailedToModList;///< Optional field
+} E1apBearModPduSessionResource_t;
+
+#define BEARER_CONTEXT_MODIFY_RSP_PDU_SESSION_RESOURCE_LIST (1 << 0)
+typedef struct e1apBearerContextModRsp
+{
+ UINT16 bitmask;
+ UINT64 gnbCucpUeE1apId;
+ UINT64 gnbCuupUeE1apId;
+ E1apBearModPduSessionResource_t e1apBearModPduSessionResource;/*optional*/
+} E1apBearerContextModRsp_t;
+
+#define BREARE_CONTEXT_RELEASE_COMPLETE_CRITICALITY_DIAGNOSTICS_PRESENT (1 << 0)
+typedef struct e1apBearerContextRlsCmp
+{
+ UINT16 bitmask;
+ UINT64 gnbCucpUeE1apId;
+ UINT64 gnbCuupUeE1apId;
+ E1Criticalitydiagnostics_t criticalDiagnostics;/*optional*/
+}E1apBearerContextRlsCmp_t;
+
+#define E1AP_DL_DATA_NOTIFY_PPI_PRESENCE (1 << 0)
+typedef struct e1apDlDataNote
+{
+ UINT16 bitmask;
+ UINT64 gnbCucpUeE1apId;
+ UINT64 gnbCuupUeE1apId;
+ INT64 ppi; /*optional*/
+}IfmE1apDlDataNotify_t;
+
+typedef struct e1apUlDataNote
+{
+ UINT64 gnbCucpUeE1apId;
+ UINT64 gnbCuupUeE1apId;
+ PduSessionToNotifyList_t pduSessionToNotifyList;
+}E1apUlDataNote_t;
+
+/* Error Indication */
+#define ERROR_INDICATION_CU_CP_UE_E1AP_ID_PRESENT (1 << 0)
+#define ERROR_INDICATION_CU_UP_UE_E1AP_ID_PRESENT (1 << 1)
+#define ERROR_INDICATION_CAUSE_PRESENT (1 << 2)
+#define ERROR_INDICATION_CRITICALITYDIAGNOSTICS_PRESENT (1 << 3)
+typedef struct E1apErrInd
+{
+ UINT8 bitMask;
+ UINT64 transId;
+ UINT64 gnbCucpUeE1apId; /* OPTIONAL */
+ UINT64 gnbCuupUeE1apId; /* OPTIONAL */
+ E1apCause_t cause; /* OPTIONAL */
+ E1Criticalitydiagnostics_t critiDiag; /* OPTIONAL */
+} IfmE1apErrInd_t;
+
+//RRC_INACTIVE Begin
+typedef struct e1apDrbActivityItem_s
+{
+ UINT32 drbId;
+ BOOL active;
+}E1apDrbActivityItem_t;
+
+typedef struct e1apDrbActivityList_s
+{
+ UINT8 numDrbActivityItem;//1~e1ap_maxnoofDRBs
+ E1apDrbActivityItem_t drbActivityItem[e1ap_maxnoofDRBs];
+}E1apDrbActivityList_t;
+
+
+typedef struct e1apPduSessionActivityItem_s
+{
+ UINT8 pduSessionId;
+ BOOL active;
+}E1apPduSessionActivityItem_t;
+typedef struct e1apPduSessionActivityList_s
+{
+ UINT16 numPduSessionActivityItem;//1~e1ap_maxnoofPDUSessionResource
+ E1apPduSessionActivityItem_t pduSessionActivityItem[e1ap_maxnoofPDUSessionResource];
+}E1apPduSessionActivityList_t;
+typedef struct e1apUeActivity_s
+{
+ BOOL active;
+}E1apUeActivity_t;
+
+//UPC_E1AP_BEAR_CTX_INACTIVE_NOTIFY
+//E1AP_CUC_BEAR_CTX_INACTIVE_NOTIFY
+#define TAG_E1AP_BEAR_INAC_DRB_ACTIVITY_LIST 1
+#define TAG_E1AP_BEAR_INAC_PDU_SESSION_ACTIVITY_LIST 2
+#define TAG_E1AP_BEAR_INAC_UE_ACTIVITY 3
+typedef struct ifmE1apBearCtxInactiveNotify
+{
+ UINT64 transId;
+ UINT64 gnbCucpUeE1apId;
+ UINT64 gnbCuupUeE1apId;
+ UINT8 tag;
+ union {
+ E1apDrbActivityList_t drbActivityList;
+ E1apPduSessionActivityList_t pduSessionActivityList;
+ E1apUeActivity_t ueActivity;
+ }u;
+} IfmE1apBearCtxInactiveNotify_t;
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __CUMODULEINTERFACEH__*/
+
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+#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 */
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+#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
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2019] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+#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 */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+#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 */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+#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 */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+#ifndef _GNB_COMMON_H_
+#define _GNB_COMMON_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "vos_common.h"
+#include "vos_sockMgr.h"
+#include <netinet/in.h>
+#include "gnbServiceType.h"
+#include "vos_lib.h"
+
+
+extern struct timeval procStart, procEnd;
+
+#define MARK_START_TIME() do{\
+ gettimeofday(&procStart,0);\
+}while(0)
+
+#define CU_CALC_ELAPSED_TIME(S) do{\
+ INT32 diff; \
+ gettimeofday(&procEnd,0);\
+ diff = ( procEnd.tv_sec*1000000L + procEnd.tv_usec ) \
+ - ( procStart.tv_sec*1000000L + procStart.tv_usec ); \
+ vos_info_print("Msg %s spend time = %ld us\n",S ,diff);\
+}while(0)
+
+
+#define GNB_OK 0
+#define GNB_ERROR 1
+
+#define TRUE 1
+#define FALSE 0
+
+/***********************************************************************************************************
+************************************************define type in DU ****************************************
+************************************************************************************************************/
+
+
+/***********************************************************************************************************
+************************************************** macro define ******************************************
+************************************************************************************************************/
+
+
+/** @brief max logical channel id */
+#define MAX_LCH_ID (MAX_LCH_NUM - 1)
+
+#define MAX_LEN_AMF_NAME 150
+#define MAX_GNB_DU_NAME 150
+#define MAX_GNB_CU_NAME 150
+#define MAX_GNB_DU_NUM 2
+
+
+#define MAX_TASK_NUM 60
+#define MAX_TASK_NAME_LEN 256
+#define MAX_QUEUE_NUM 20
+#define MAX_QUEUE_MSG_NUM 256
+#define MAX_IP_ADDR_STRING_LEN 256
+#define MAX_IP_ADDR_NUM COMM_SCTP_ADDR_MAX
+
+#define MAX_LOCK_NUM 20
+#define MAX_SEMA_NUM 20
+#define MAX_TIMER_NUM 100
+
+#define MAX_SI_NUM 32
+#define MAX_SI_MESSAGE 32
+#define MAX_SIB 32
+#define MAX_SIB_LEN 300
+
+#define RRC_SI_DATA 4
+#define MAX_TX_PDU_NUM 256//1024
+#define MAX_MULTI_BANDS 8
+#define MAX_NR_NS_PMAX 8
+#define MAX_ACCESS_CAT 64
+#define MAX_BARRING_SET 8
+#define MAX_PLMN 12
+#define MAXCELLINTRA 16 //Maximum number of intra-Freq cells listed in SIB3
+#define MAXCELLBLACK 16 //Maximum number of NR blacklisted cell ranges in SIB3, SIB4
+/** @brief max cell bands num */
+#define MAX_NR_CELL_BANDS 16//32
+/** @brief F1 max cell num */
+#define F1_MAX_CELL_NUM MAX_CELL_NUM
+
+
+#define COMMON_LOG_LEVEL (0)
+#define MAJOR_LOG_LEVEL (1)
+
+/*module msg marco define*/
+#define MSG_HEAD_LEN (20)
+#define MSG_TOTAL_LEN (8096)
+#define MSG_MAX_BUFFER_LEN (MSG_TOTAL_LEN-MSG_HEAD_LEN)
+
+#define MAX_MODULE_NAME_LEN (256)
+
+/*MAX IPV6 ADDR LEN*/
+#define MAX_IPV6ADDR_LEN (16)
+
+#define MAX_ENTITY_MANAGE_MSG_NUM 100
+#define CHECK_FUNCTION_RET(ret) \
+ do { \
+ if (VOS_OK != (ret)) { \
+ return VOS_ERROR; \
+ } \
+ } while(0)
+
+extern UINT32 f1apGetModuleId();
+
+#define DUCP_MODULE_ID ducpGetModuleId()
+#define F1AP_MODULE_ID f1apGetModuleId()
+
+
+
+#define MAX_SCS 5
+#define MAX_LENGTH_NGAP_RAN_NAME 150
+
+
+
+/***********************************************************************************************************
+********************************************* enum define*************************************************
+************************************************************************************************************/
+
+/* IP Type */
+typedef enum ipAddrType
+{
+ IPv4,
+ IPv6,
+ IPTypeMax,
+}IpAddrType_e;
+
+typedef enum
+{
+ SOCKET_SCTP,
+ SOCKET_UDP,
+ SOCKET_TCP,
+ SOCKET_UNIX_UDP,
+ SOCKET_UNIX_TCP,
+}SOCKET_TYPE;
+
+/** log level */
+typedef enum gnbLogLevel
+{
+ LOG_CRIT = 1, ///< critical conditions
+ LOG_ERR, ///< error conditions
+ LOG_WARNING, ///< warning conditions
+ LOG_INFO, ///< informational
+ LOG_DEBUG, ///< debug info
+} gnbLogLevel_e;
+
+
+/***********************************************************************************************************
+****************************************************define typ *********************************************
+************************************************************************************************************/
+typedef VOID (*FUNCPTR)(void *args);
+typedef INT32 (*VOS_TASK_INIT_FUNCPTR)();
+typedef VOID (*VOS_TASK_FUNCPTR)(ULONG ulArg1, ULONG ulArg2,ULONG ulArg3, ULONG ulArg4,ULONG ulArg5, ULONG ulArg6,ULONG ulArg7, ULONG ulArg8,ULONG ulArg9, ULONG ulArg10);
+
+typedef INT32 (*USER_TASK_INIT_FUNCPTR)();
+typedef LONG (*USER_TASK_FUNCPTR)(ULONG aulMsg[VOS_QUEUE_MSG_SIZE]);
+
+
+typedef INT32 (*HOST_TASK_FUNCPTR)(ULONG aulMsg[VOS_QUEUE_MSG_SIZE]);
+typedef INT32 (*HOST_TASK_INIT_FUNCPTR)(void);
+
+
+/***********************************************************************************************************
+************************************************task info strcut *******************************************
+************************************************************************************************************/
+
+/* IPV4 Address */
+typedef struct
+{
+ UINT16 port;
+ UINT32 address;
+} Ipv4Addr_t;
+
+/* IPV6 Address */
+typedef struct cmInetIpv6Addr
+{
+ UINT16 port;
+ UINT8 IpAddr6[MAX_IPV6ADDR_LEN];
+} Ipv6Addr_t;
+
+
+/* IP Address */
+typedef struct ipAddress
+{
+ IpAddrType_e ipType; /* type of transport address */
+ union
+ {
+ Ipv4Addr_t ipv4Addr; /* IPv4 transport address */
+ Ipv6Addr_t ipv6Addr; /* IPv6 transport address */
+ }u;
+} IpAddress_t;
+
+/* Ran name, a string */
+typedef struct ngapRanName
+{
+ char ranName[MAX_LENGTH_NGAP_RAN_NAME];
+}NgapRanName_t;
+
+/* user task info */
+typedef struct
+{
+ UINT32 userTaskId;
+ UINT32 hostTaskId;
+ UINT8 userTaskName[MAX_TASK_NAME_LEN];
+ UINT32 userTaskPriority;
+ FUNCPTR userTaskEntry;
+} UserTaskInfo_t;
+
+/* Host task info */
+typedef struct
+{
+ UINT32 hostTaskId;
+ UINT32 procId;
+ UINT8 hostTaskName[MAX_TASK_NAME_LEN];
+ UINT32 hostTaskpriority;
+ FUNCPTR hostTaskEntry;
+} HostTaskInfo_t;
+
+/* user task table info */
+typedef struct
+{
+ UINT32 userTaskId;
+ UINT32 hostTaskId;
+ CHAR userTaskName[MAX_TASK_NAME_LEN];/*线程名称*/
+ ULONG userModuleID;
+ UINT32 userTaskPriority;/*优先级*/
+ USER_TASK_INIT_FUNCPTR userTaskInitPtr;
+ USER_TASK_FUNCPTR userTaskEntry;/*线程执行函数*/
+} UserTaskTable_t;
+
+/* Host task table info */
+
+typedef struct
+{
+ UINT32 hostTaskId;
+ CHAR hostTaskName[MAX_TASK_NAME_LEN];/*线程名称*/
+ UINT32 priority;/*优先级*/
+ LONG cpuSize;
+ LONG cpus[8];
+} HostTaskTable_t;
+
+/* vos task info */
+typedef struct
+{
+ UINT8 vosTaskId;
+ CHAR vosTaskName[MAX_TASK_NAME_LEN];/*线程名称*/
+ CHAR vosMoudleName[MAX_MODULE_NAME_LEN];
+ UINT8 vosTaskpriority;/*优先级*/
+ VOS_TASK_INIT_FUNCPTR vosTaskInitPtr;
+ VOS_TASK_FUNCPTR vosTaskEntry;/*线程执行函数*/
+} VosTaskTable_t;
+
+typedef struct
+{
+ UINT8 vosTaskId;
+ vos_module_t vosModule;
+ VOS_HANDLE taskHandle;
+}MoudleInfo_t;
+
+typedef struct
+{
+ UCHAR ipAddrStr[MAX_IP_ADDR_STRING_LEN];
+ UINT32 port;
+}IpAddrStr_t;
+
+typedef struct
+{
+ LONG Count;//最大个数为COMM_SCTP_ADDR_MAX
+ IpAddrStr_t ipList[MAX_IP_ADDR_NUM];
+}SockAddrStr_t;
+
+typedef struct
+{
+ UINT32 vosTaskId;
+ SockAddrStr_t ipAddrStr;
+
+ SockAddrStr_t clientAddrInfo;
+}TaskSockAddrInfo_t;
+
+typedef struct
+{
+ UINT32 vosTaskId;
+ CHAR vosTaskName[MAX_TASK_NAME_LEN];
+ SockAddrStr_t sockAddrInfo;
+ SockAddrStr_t clientSockAddrInfo;
+ UINT32 sockType;
+ vos_sock_para_t comPara;
+ vos_sock_info_t comOpInfo;
+}CommPara_t;
+
+typedef struct
+{
+ UINT8 isUsed;
+ vos_sock_info_t opInfo;
+}E1UpClientSockInfo_t;
+
+
+
+
+typedef struct
+{
+
+}UdpSocketMsg_t;
+typedef struct
+{
+
+}TcpSocketMsg_t;
+
+typedef struct
+{
+ UINT32 connectId;/*SOCKET INDEX*/
+ UINT32 fd;/*用于收消息的fd*/
+ vos_sockaddr_t fromAddr;/*用于消息来源地址*/
+ struct sctp_sndrcvinfo sri;/*收到的SCTP消息信息*/
+ LONG msg_flags;/*链路信息*/
+ UINT32 assocState;/*链路状态*/
+
+}SctpSocketMsg_t;
+
+typedef struct
+{
+
+}UnixUdpSocketMsg_t;
+
+typedef struct
+{
+
+}UnixTcpSocketMsg_t;
+
+/*
+SOCKET msg
+*/
+typedef struct
+{
+ UINT32 socketMsgType;
+ union
+ {
+ UdpSocketMsg_t udpMsg;
+ TcpSocketMsg_t tcpMsg;
+ SctpSocketMsg_t sctpMsg;
+ UnixUdpSocketMsg_t unixUdpSocketMsg;
+ UnixTcpSocketMsg_t unixTcpSocketMsg;
+ }u;
+}SocketMsg_t;
+
+typedef struct
+{
+ UINT32 associationId;
+ vos_sock_info_t op;/*发送时索引到该字段*/
+ ULONG usedFlag;
+}SockInfoMng_t;
+
+
+
+/*
+1.非SOCKET msg 格式化为接口数据
+2.SOCKET msg格式化为:SocketMsg_t数据+接口数据
+*/
+typedef struct
+{
+ UINT32 srcModuleId;
+ UINT32 dstModuleId;
+ UINT32 msgSap;
+ UINT32 msgCode;
+ UINT32 msgLen;
+ UINT8 msgBuf[MSG_MAX_BUFFER_LEN];
+} ModuleMsg_t;
+
+
+
+/** 采用非VOS通信方式的模块需要提供的额外参数 */
+typedef struct
+{
+ module_comm_type_t type; ///< 通信方式
+ union{
+ vos_sockaddr_t addr; ///< socket 通信
+ sctp_para_t sctp; ///< sctp 通信
+ }u;
+ receive_handler recv_handle; ///< 接收函数
+ LONG maxClient; ///< tcp server 允许的连接数
+ BOOL soloMode; ///< 如果为真,则单独创建接收线程;如果为假,则由 VOS socket代理任务负责接收
+ LONG fdIdx; ///< 无需关心
+}CommunicatePara_t;
+
+
+/***********************************************************************************************************
+*********************************************protocol info strcut ******************************************
+************************************************************************************************************/
+
+/*********************************** Mib_t ***************************************/
+typedef enum mibSubCarrierSpacingCommon
+{
+ MIB_subCarrierSpacingCommon_scs15or60 = 0,
+ MIB_subCarrierSpacingCommon_scs30or120 = 1
+} MibSubCarrierSpacingCommon_e;
+
+typedef enum mibDmrsTypeaPosition
+{
+ MIB_dmrs_TypeA_Position_pos2 = 0,
+ MIB_dmrs_TypeA_Position_pos3 = 1
+} MibDmrsTypeaPosition_e;
+
+typedef enum mibCellBarred
+{
+ MIB_cellBarred_barred = 0,
+ MIB_cellBarred_notBarred = 1
+} MibCellBarred_e;
+
+typedef enum mibIntraFreqReselection
+{
+ MIB_intraFreqReselection_allowed = 0,
+ MIB_intraFreqReselection_notAllowed = 1
+} MibIntraFreqReselection_e;
+
+typedef enum
+{
+ mibCellBarredBarred = 0,
+ mibCellBarredNotBarred = 1
+} CellBarred_e;
+
+typedef enum
+{
+ mibIntraFreqReselectionAllowed = 0,
+ mibIntraFreqReselectionNotAllowed = 1
+} IntraFreqReselection_e;
+
+typedef struct PDCCHConfigSIB1
+{
+ UINT8 controlResourceSetZero;
+ UINT8 searchSpaceZero;
+
+}PDCCHConfigSIB1_t;
+
+typedef struct mib
+{
+ UINT8 systemFrameNumber;
+ MibSubCarrierSpacingCommon_e subCarrierSpacingCommon;
+ UINT8 ssbSubcarrierOffset;
+ MibDmrsTypeaPosition_e dmrsTypeaPosition;
+ UINT8 searchSpaceZero;
+ UINT8 controlResourceSetZero;
+ CellBarred_e cellBarred;
+ IntraFreqReselection_e intraFreqReselection;
+
+}Mib_t;
+
+typedef struct macCellCfgPara_s
+{
+ UINT32 nSSBAbsFre;//
+ UINT16 PCI;//
+}macCellCfgPara_t;
+
+/*********************************** SIB1_t ***************************************/
+typedef enum connEstFailureControlCount
+{
+ NR_ConnEstFailureControl__connEstFailCount_n1 = 0,
+ NR_ConnEstFailureControl__connEstFailCount_n2 = 1,
+ NR_ConnEstFailureControl__connEstFailCount_n3 = 2,
+ NR_ConnEstFailureControl__connEstFailCount_n4 = 3
+} ConnEstFailureControlCount_e;
+
+typedef enum connEstFailureControlOffsetValidity
+{
+ NR_ConnEstFailureControl__connEstFailOffsetValidity_s30 = 0,
+ NR_ConnEstFailureControl__connEstFailOffsetValidity_s60 = 1,
+ NR_ConnEstFailureControl__connEstFailOffsetValidity_s120 = 2,
+ NR_ConnEstFailureControl__connEstFailOffsetValidity_s240 = 3,
+ NR_ConnEstFailureControl__connEstFailOffsetValidity_s300 = 4,
+ NR_ConnEstFailureControl__connEstFailOffsetValidity_s420 = 5,
+ NR_ConnEstFailureControl__connEstFailOffsetValidity_s600 = 6,
+ NR_ConnEstFailureControl__connEstFailOffsetValidity_s900 = 7
+} ConnEstFailureControlOffsetValidity_e;
+
+#define CONN_EST_FAILOFFSET (1<<0)
+typedef struct connEstFailCtrl
+{
+ UINT16 bitMask;
+ ConnEstFailureControlCount_e connEstFailCount;
+ ConnEstFailureControlOffsetValidity_e connEstFailOffsetValidity;
+ UINT8 connEstFailOffset; /*option*/
+} ConnEstFailCtrl_t;
+
+typedef enum timerT300
+{
+ NR_UE_TimersAndConstants__t300_ms100 = 0,
+ NR_UE_TimersAndConstants__t300_ms200 = 1,
+ NR_UE_TimersAndConstants__t300_ms300 = 2,
+ NR_UE_TimersAndConstants__t300_ms400 = 3,
+ NR_UE_TimersAndConstants__t300_ms600 = 4,
+ NR_UE_TimersAndConstants__t300_ms1000 = 5,
+ NR_UE_TimersAndConstants__t300_ms1500 = 6,
+ NR_UE_TimersAndConstants__t300_ms2000 = 7
+} TimerT300_e;
+
+typedef enum timerT301
+{
+ NR_UE_TimersAndConstants__t301_ms100 = 0,
+ NR_UE_TimersAndConstants__t301_ms200 = 1,
+ NR_UE_TimersAndConstants__t301_ms300 = 2,
+ NR_UE_TimersAndConstants__t301_ms400 = 3,
+ NR_UE_TimersAndConstants__t301_ms600 = 4,
+ NR_UE_TimersAndConstants__t301_ms1000 = 5,
+ NR_UE_TimersAndConstants__t301_ms1500 = 6,
+ NR_UE_TimersAndConstants__t301_ms2000 = 7
+} TimerT301_e;
+
+typedef enum timerT310
+{
+ NR_UE_TimersAndConstants__t310_ms0 = 0,
+ NR_UE_TimersAndConstants__t310_ms50 = 1,
+ NR_UE_TimersAndConstants__t310_ms100 = 2,
+ NR_UE_TimersAndConstants__t310_ms200 = 3,
+ NR_UE_TimersAndConstants__t310_ms500 = 4,
+ NR_UE_TimersAndConstants__t310_ms1000 = 5,
+ NR_UE_TimersAndConstants__t310_ms2000 = 6
+} TimerT310_e;
+
+typedef enum timerN310
+{
+ NR_UE_TimersAndConstants__n310_n1 = 0,
+ NR_UE_TimersAndConstants__n310_n2 = 1,
+ NR_UE_TimersAndConstants__n310_n3 = 2,
+ NR_UE_TimersAndConstants__n310_n4 = 3,
+ NR_UE_TimersAndConstants__n310_n6 = 4,
+ NR_UE_TimersAndConstants__n310_n8 = 5,
+ NR_UE_TimersAndConstants__n310_n10 = 6,
+ NR_UE_TimersAndConstants__n310_n20 = 7
+} TimerN310_e;
+
+typedef enum timerT311
+{
+ NR_UE_TimersAndConstants__t311_ms1000 = 0,
+ NR_UE_TimersAndConstants__t311_ms3000 = 1,
+ NR_UE_TimersAndConstants__t311_ms5000 = 2,
+ NR_UE_TimersAndConstants__t311_ms10000 = 3,
+ NR_UE_TimersAndConstants__t311_ms15000 = 4,
+ NR_UE_TimersAndConstants__t311_ms20000 = 5,
+ NR_UE_TimersAndConstants__t311_ms30000 = 6
+} TimerT311_e;
+
+typedef enum timerN311
+{
+ NR_UE_TimersAndConstants__n311_n1 = 0,
+ NR_UE_TimersAndConstants__n311_n2 = 1,
+ NR_UE_TimersAndConstants__n311_n3 = 2,
+ NR_UE_TimersAndConstants__n311_n4 = 3,
+ NR_UE_TimersAndConstants__n311_n5 = 4,
+ NR_UE_TimersAndConstants__n311_n6 = 5,
+ NR_UE_TimersAndConstants__n311_n8 = 6,
+ NR_UE_TimersAndConstants__n311_n10 = 7
+} TimerN311_e;
+
+typedef enum timerT319
+{
+ NR_UE_TimersAndConstants__t319_ms100 = 0,
+ NR_UE_TimersAndConstants__t319_ms200 = 1,
+ NR_UE_TimersAndConstants__t319_ms300 = 2,
+ NR_UE_TimersAndConstants__t319_ms400 = 3,
+ NR_UE_TimersAndConstants__t319_ms600 = 4,
+ NR_UE_TimersAndConstants__t319_ms1000 = 5,
+ NR_UE_TimersAndConstants__t319_ms1500 = 6,
+ NR_UE_TimersAndConstants__t319_ms2000 = 7
+} TimerT319_e;
+
+typedef struct ueTimersAndConstants {
+ TimerT300_e t300;
+ TimerT301_e t301;
+ TimerT310_e t310;
+ TimerN310_e n310;
+ TimerT311_e t311;
+ TimerN311_e n311;
+ TimerT319_e t319;
+} UETimersAndConstants_t;
+
+
+
+
+
+#define CELL_RESERVED_FOR_OTHERUSE (1<<0)
+typedef struct cellAccessInfo
+{
+ UINT16 bitMask;
+ UINT16 plmnInfoNum;
+ PlmnInformation_t plmnInfo[MAX_PLMN];
+ BOOL cellReservedForOtherUse; /*option*/
+
+} CellAccessInfo_t;
+
+#define RA_ASSOCIATION_PERIOD_INDEX (1<<0)
+#define RA_SSB_OCCASION_MASK_INDEX (1<<1)
+typedef struct siReqRes
+{
+ UINT16 bitMask;
+ UINT8 raPreambleStartIndex;
+ UINT8 raAssociationPeriodIndex; /*option*/
+ UINT8 raSsbOccasionMaskIndex; /*option*/
+
+} SiReqRes_t;
+
+#define PRACH_CONFIGURATION_INDEX (1<<0)
+#define MSG1_FDM (1<<1)
+#define MSG1_FREQUENCYSTART (1<<2)
+#define ZERO_COR_RELATION_ZONECONFIG (1<<3)
+#define PREAMBLE_RECEIVED_TARGETPOWER (1<<4)
+#define PREAMBLE_TRANS_MAX (1<<5)
+#define POWER_RAMPING_STEP (1<<6)
+#define RA_RESPONSE_WINDOW (1<<7)
+
+#define SI_REQUEST_PERIOD (1<<8)
+typedef struct siRequestConfig
+{
+ UINT16 bitMask;
+ UINT8 prach_ConfigurationIndex; /*option*/
+ UINT8 msg1_FDM; /*option*/
+ UINT16 msg1_FrequencyStart; /*option*/
+ UINT8 zeroCorrelationZoneConfig; /*option*/
+ INT16 preambleReceivedTargetPower; /*option*/
+ UINT8 preambleTransMax; /*option*/
+ UINT8 powerRampingStep; /*option*/
+ UINT8 raResponseWindow; /*option*/
+ UINT8 ssbPerRachOccasion;
+ UINT8 siRequestPeriod; /*option*/
+ UINT16 siRequestResourcesNum;
+ SiReqRes_t siRequestResources[MAX_SI_MESSAGE];
+} SiRequestConfig_t;
+
+typedef enum schInfoSiPeriod
+{
+ NR_SchedulingInfo__si_Periodicity_rf8 = 0,
+ NR_SchedulingInfo__si_Periodicity_rf16 = 1,
+ NR_SchedulingInfo__si_Periodicity_rf32 = 2,
+ NR_SchedulingInfo__si_Periodicity_rf64 = 3,
+ NR_SchedulingInfo__si_Periodicity_rf128 = 4,
+ NR_SchedulingInfo__si_Periodicity_rf256 = 5,
+ NR_SchedulingInfo__si_Periodicity_rf512 = 6
+} SchInfoSiPeriod_e;
+
+typedef enum sibType
+{
+ NR_SIB_TypeInfo__type_sibType2 = 0,
+ NR_SIB_TypeInfo__type_sibType3 = 1,
+ NR_SIB_TypeInfo__type_sibType4 = 2,
+ NR_SIB_TypeInfo__type_sibType5 = 3,
+ NR_SIB_TypeInfo__type_sibType6 = 4,
+ NR_SIB_TypeInfo__type_sibType7 = 5,
+ NR_SIB_TypeInfo__type_sibType8 = 6,
+ NR_SIB_TypeInfo__type_sibType9 = 7
+} SibType_e;
+
+typedef enum sibAreaScope
+{
+ NR_SIB_TypeInfo__areaScope_true = 0
+} SibAreaScope_e;
+
+#define VALUE_TAG (1<<0)
+#define AREA_SCOPE (1<<1)
+
+typedef struct sibTypeInfo
+{
+ UINT16 bitMask;
+ SibType_e type;
+ UINT8 valueTag; /*option*/
+ SibAreaScope_e areaScope; /*option*/
+} SibTypeInfo_t;
+
+typedef struct siSchInfo
+{
+
+ BOOL siBroadcastStatus;
+ SchInfoSiPeriod_e siPeriodicity;
+ UINT16 sibMappingNum;
+ SibTypeInfo_t sibMapping[MAX_SIB];
+
+} SiSchInfo_t;
+
+typedef enum nrControlResourceSet_cce_REG_MappingType_PR
+{
+ NrControlResourceSet_cce_REG_MappingType_PR_NOTHING, /* No components present */
+ NrControlResourceSet_cce_REG_MappingType_PR_interleaved,
+ NrControlResourceSet_cce_REG_MappingType_PR_nonInterleaved
+} NrControlResourceSet_cce_REG_MappingType_PR;
+
+#define MAC_TCI_STATEID 64
+#define NrControlResourceSetShiftIndexChosen 0x1
+#define NrControlResourceSetTciPresentInDciChosen 0x2
+#define NrControlResourceSetDmrsScramblingIDChosen 0x4
+typedef struct nrControlResourceSet
+{
+ UINT16 bitmask;
+ long controlResourceSetId;
+ UINT64 frequencyDomainResources;
+ long duration;
+ NrControlResourceSet_cce_REG_MappingType_PR present;
+ union ControlResourceSet_cce_REG_MappingType_u
+ {
+ struct ControlResourceSet_cce_REG_MappingType_interleaved
+ {
+ long reg_BundleSize;
+ long interleaverSize;
+ long shiftIndex; /* OPTIONAL */
+ } nrInterleaved;
+ int nonInterleaved;
+ } choice;
+ long precoderGranularity;
+ UINT8 tciPdcchToAddListNum;
+ long tciStateIdAddList[MAC_TCI_STATEID];
+ UINT8 tciPdcchToReleaseListNum;
+ long tciStateIdReleaseList[MAC_TCI_STATEID];
+ long tci_PresentInDCI; /* OPTIONAL */
+ long pdcch_DMRS_ScramblingID; /* OPTIONAL */
+} NrControlResourceSet_t;
+
+typedef struct nrofCandidates
+{
+ long aggregationLevel1;
+ long aggregationLevel2;
+ long aggregationLevel4;
+ long aggregationLevel8;
+ long aggregationLevel16;
+} NrofCandidates_t;
+
+typedef enum nrSearchSpace_searchSpaceType_PR {
+ NrSearchSpace_searchSpaceType_PR_NOTHING, /* No components present */
+ NrSearchSpace_searchSpaceType_PR_common,
+ NrSearchSpace_searchSpaceType_PR_ue_Specific
+} NrSearchSpace_searchSpaceType_PR;
+
+#define NrSearchSpaceTypeCommonDciFormat0_0_AndFormat1_0_Presence 1
+#define NrSearchSpaceTypeCommonDci_Format2_0_Presence 2
+#define NrSearchSpaceTypeCommonDci_Format2_1_Presence 4
+#define NrSearchSpaceTypeCommonDci_Format2_2_Presence 8
+#define NrSearchSpaceTypeCommonDci_Format2_3_Presence 16
+typedef struct nrSearchSpaceType
+{
+ NrSearchSpace_searchSpaceType_PR present;
+ union SearchSpace_searchSpaceType_u
+ {
+ struct SearchSpace_searchSpaceType_common
+ {
+ UINT16 bitMask;
+ struct SearchSpace_searchSpaceType_common_dci_Format0_0_AndFormat1_0
+ {
+ } dci_Format0_0_AndFormat1_0;//option
+
+ struct SearchSpace_searchSpaceType_common_dci_Format2_0
+ {
+#define NrSearchSpaceTypeAggLevel1Chosen 1
+#define NrSearchSpaceTypeAggLevel2Chosen 2
+#define NrSearchSpaceTypeAggLevel4Chosen 4
+#define NrSearchSpaceTypeAggLevel8Chosen 8
+#define NrSearchSpaceTypeAggLevel16Chosen 16
+
+ UINT8 bitMask;
+ long aggregationLevel1; /* OPTIONAL */
+ long aggregationLevel2; /* OPTIONAL */
+ long aggregationLevel4; /* OPTIONAL */
+ long aggregationLevel8; /* OPTIONAL */
+ long aggregationLevel16; /* OPTIONAL */
+ } dci_Format2_0;//optional
+
+ struct SearchSpace_searchSpaceType_common_dci_Format2_1
+ {
+ } dci_Format2_1;//optional
+
+ struct SearchSpace_searchSpaceType_common_dci_Format2_2
+ {
+ } dci_Format2_2;//optional
+
+ struct NrSearchSpace_searchSpaceType_common_dci_Format2_3
+ {
+#define NrSearchSpaceTypeDciFormat2_3Dummy1Chosen 1
+ UINT8 bitMask;
+ long dummy1; /* OPTIONAL */
+ long dummy2;
+ } dci_Format2_3;//optional
+ } common;
+ struct SearchSpace_searchSpaceType_specific
+ {
+ long dci_Formats;
+ }specific;
+
+ } choice;
+}NrSearchSpaceType_t;
+
+typedef enum nrSearchSpaceMonitoringSlotPeriodicityAndOffset_PR
+{
+ NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_NOTHING, /* No components present */
+ NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl1,
+ NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl2,
+ NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl4,
+ NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl5,
+ NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl8,
+ NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl10,
+ NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl16,
+ NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl20,
+ NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl40,
+ NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl80,
+ NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl160,
+ NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl320,
+ NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl640,
+ NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl1280,
+ NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl2560
+} NrSearchSpaceMonitoringSlotPeriodicityAndOffset_PR;
+
+#define NrSearchSpaceControlResIdChosen 0x1
+#define NrSearchSpaceMonSlotPeriodAndOddsetChosen 0x2
+#define NrSearchSpaceDurationChosen 0x4
+#define MONITORING_SYMBOLS_WITHIN_SLOT 0x08
+typedef struct nrSearchSpace
+{
+ UINT16 bitmask;
+ long searchSpaceId;
+ long controlResourceSetId; /* OPTIONAL */
+
+ struct SearchSpaceMonitoringSlotPeriodicityAndOffset
+ {
+ NrSearchSpaceMonitoringSlotPeriodicityAndOffset_PR present;
+ union SearchSpaceMonitoringSlotPeriodicityAndOffset_u
+ {
+ int sl1;
+ long sl2;
+ long sl4;
+ long sl5;
+ long sl8;
+ long sl10;
+ long sl16;
+ long sl20;
+ long sl40;
+ long sl80;
+ long sl160;
+ long sl320;
+ long sl640;
+ long sl1280;
+ long sl2560;
+ } choice;
+ } monitoringSlotPeriodicityAndOffset;/* OPTIONAL */
+
+ long duration; /* OPTIONAL */
+ UINT16 monitoringSymbolsWithinSlot; /* OPTIONAL */
+ NrofCandidates_t nrofCandidates;
+ NrSearchSpaceType_t searchSpaceType;
+} NrSearchSpace_t;
+
+#define MAX_SEARCHSPACE_NUM 4
+
+#define PdcchCfgCommonCtrlResSetZeroChosen 1
+#define PdcchCfgCommonCtrlResSetChosen 2
+#define PdcchCfgCommonSearchSpaceZeroChosen 4
+#define PdcchCfgCommonSearchSpaceSIB1Chosen 8
+#define PdcchCfgCommonSearchSpaceOtherSysInfoChosen 16
+#define PdcchCfgCommonPagingSearchSpaceChosen 32
+#define PdcchCfgCommonRaSearchSpaceChosen 64
+
+typedef struct PDCCHCfgCommon
+{
+
+ UINT16 bitmask;
+ long controlResourceSetZero; /* OPTIONAL */
+ NrControlResourceSet_t commonControlResourceSet; /* OPTIONAL */
+ long searchSpaceZero; /* OPTIONAL */
+ UINT8 searchSpaceNum;
+ NrSearchSpace_t searchSpace[MAX_SEARCHSPACE_NUM];
+
+ long searchSpaceSIB1; /* OPTIONAL */
+ long searchSpaceOtherSystemInformation; /* OPTIONAL */
+ long pagingSearchSpace; /* OPTIONAL */
+ long raSearchSpace; /* OPTIONAL */
+}Pdcch_Cfg_Common_t;
+
+typedef enum setup_Release_PDCCH_PR
+{
+ Setup_Release_PDCCH_PR_NOTHING, /* No components present */
+ Setup_Release_PDCCH_PR_release,
+ Setup_Release_PDCCH_PR_setup
+
+}Setup_Release_PDCCH_PR;
+typedef struct pdcchCfgCommon
+{
+ Setup_Release_PDCCH_PR present;
+ union Setup_Release_PDCCH_PR_u {
+ UINT32 release;
+ Pdcch_Cfg_Common_t setup;
+
+ }choice;
+
+} PdcchCfgCommon_t;
+
+/* PUCCH-ConfigCommon */
+#define PucchCfgCommonResourceCommonChosen 1
+#define PucchCfgCommonHoppingIdChosen 2
+#define PucchCfgCommonP0NominalChosen 4
+typedef struct nrPucch_ConfigCommon
+{
+ UINT16 bitmask;
+ long pucchResourceCommon; /* OPTIONAL */
+ long pucchGroupHopping;
+ long hoppingId; /* OPTIONAL */
+ long p0Nominal; /* OPTIONAL */
+}NrPucch_ConfigCommon_t;
+
+typedef enum nrPucchCfgCommon_PR
+{
+ NrPucchCfgCommon_PR_NOTHING, /* No components present */
+ NrPucchCfgCommon_PR_release,
+ NrPucchCfgCommon_PR_setup
+}NrPucchCfgCommon_PR;
+
+typedef struct nrPucchCfgCommon
+{
+
+ NrPucchCfgCommon_PR present;
+ union NrPucchCfgCommon_u {
+ int release;
+ NrPucch_ConfigCommon_t setup;
+ } choice;
+
+} NrPucchCfgCommon_t;
+
+#define PdschTimeDomainAllockOChosen 1
+typedef struct pdschTimeDomainAlloc
+{
+ UINT16 bitmask;
+ long k0; /* OPTIONAL */
+ long mappingType;
+ long startSymbolAndLength;
+} PdschTimeDomainAlloc_t;
+
+#define PuschTimeDomainAllock2Chosen 1
+typedef struct puschTimeDomainAlloc
+{
+ UINT16 bitmask;
+ long k2; /* OPTIONAL */
+ long mappingType;
+ long startSymbolAndLength;
+} PuschTimeDomainAlloc_t;
+
+
+#define MAX_TIME_DOMAIN_NUM 16
+#define PdschTimeDomainAllocationChose (1 << 0)
+typedef struct pdsch_Cfg_Common_t
+{
+ UINT16 bitmask;
+ UINT8 timeDomainNum;
+ PdschTimeDomainAlloc_t pdschTimeDomainAllocation[MAX_TIME_DOMAIN_NUM]; /* OPTIONAL */
+} Pdsch_Cfg_Common_t;
+
+typedef enum setup_Release_PDSCH_PR
+{
+ Setup_Release_PDSCH_PR_NOTHING, /* No components present */
+ Setup_Release_PDSCH_PR_release,
+ Setup_Release_PDSCH_PR_setup
+}Setup_Release_PDSCH_PR;
+
+typedef struct pdschCfgCommon
+{
+ Setup_Release_PDSCH_PR present;
+ union Setup_Release_PDSCH_PR_u {
+ UINT32 release;
+ Pdsch_Cfg_Common_t setup;
+
+ }choice;
+
+} PdschCfgCommon_t;
+
+typedef struct nrBWP
+{
+ UINT16 locationAndBandwidth;
+ UINT8 subcarrierSpacing;
+ /*UINT8 cyclicPrefix; extension*/
+} NrBWP_t;
+
+#define NrBwpDownLinkCommonPdcchCfgChosen 0x1
+#define NrBwpDownLinkCommonPdschCfgChosen 0x2
+typedef struct nrBwpDownLinkCommon
+{
+ UINT16 bitmask;
+ NrBWP_t bwp;
+ PdcchCfgCommon_t pdcchCfgCommon; /* OPTIONAL */
+ PdschCfgCommon_t pdschCfgCommon; /* OPTIONAL */
+} NrBwpDownLinkCommon_t;
+
+#define ADDITIONAL_PMAX (1<<0)
+typedef struct pmaxValue
+{
+ UINT16 bitMask;
+ INT8 additionalPmax; /*option*/
+ UINT16 additionalSpectrumEmission;
+} PmaxValue_t;
+
+#define FREQ_BAND_INDICATOR_NR (1<<0)
+#define PMAX_LIST (1<<1)
+typedef struct nrMultiBand
+{
+ UINT16 bitMask;
+ UINT16 freqBandIndicatorNR; /*option*/
+ UINT16 pmaxListNum;
+ PmaxValue_t pmaxList[MAX_NR_NS_PMAX]; /*option*/
+} NrMultiBand_t;
+
+typedef struct specificCarrier
+{
+ UINT16 offsetToCarrier;
+ UINT8 subcarrierSpacing;
+ UINT16 carrierBandwidth;
+ /*UINT16 txDirectCurrentLocation_v1530; extension*/
+
+} SpecificCarrier_t;
+
+#define ABSOLUTE_FREQUENCY_POINTA (1<<0)
+#define PMAX (1<<1)
+
+typedef struct freqInfoUlSib
+{
+ UINT16 bitMask;
+ UINT16 nrMulBandNum;
+ NrMultiBand_t nrMulBand[MAX_MULTI_BANDS];
+ UINT32 absoluteFrequencyPointA; /*option*/
+ UINT16 speCarrierNum;
+ SpecificCarrier_t speCarrier[MAX_SCS];
+ INT8 pMax; /*option*/
+ /*UINT8 frequencyShift7p5khz; extension*/
+} FreqInfoUlSib_t;
+
+/* RACH-ConfigGeneric */
+typedef struct nrRachCfgGeneric_t
+{
+ long prach_ConfigurationIndex;
+ long msg1_FDM;
+ long msg1_FrequencyStart;
+ long zeroCorrelationZoneConfig;
+ long preambleReceivedTargetPower;
+ long preambleTransMax;
+ long powerRampingStep;
+ long ra_ResponseWindow;
+} NrRachCfgGeneric_t;
+
+typedef enum nrRachCfgCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB
+{
+ NrRACH_ConfigCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING, /* No components present */
+ NrRACH_ConfigCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth,
+ NrRACH_ConfigCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth,
+ NrRACH_ConfigCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf,
+ NrRACH_ConfigCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one,
+ NrRACH_ConfigCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two,
+ NrRACH_ConfigCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four,
+ NrRACH_ConfigCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight,
+ NrRACH_ConfigCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen
+} NrRachCfgCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_e;
+typedef enum nrRachCfgCommonPrachRootSequenceIndex
+{
+ NrRACH_ConfigCommon_prach_RootSequenceIndex_PR_NOTHING, /* No components present */
+ NrRACH_ConfigCommon_prach_RootSequenceIndex_PR_l839,
+ NrRACH_ConfigCommon_prach_RootSequenceIndex_PR_l139
+} NrRachCfgCommonPrachRootSequenceIndex_e;
+
+#define NrRachCfgCommonTotalNumberOfRaChosen (1<<0)
+#define NrRachCfgCommongroupBconfiguredChosen (1<<1)
+#define NrRachCfgCommonRsrpThresholdSSBChosen (1<<2)
+#define NrRachCfgCommonRsrpThresholdSSBSulChosen (1<<3)
+#define NrRachCfgCommonMsg1SubcarrierSpacingChosen (1<<4)
+#define NrRachCfgCommonMsg3TransformPrecoderChosen (1<<5)
+#define NrRachCfgCommonGroupBconfigChosen 32
+typedef struct RACH_Config_Common
+{
+ UINT16 bitmask;
+ NrRachCfgGeneric_t rachCfgGeneric;
+ long totalNumberOfRA_Preambles; /* OPTIONAL */
+ struct RACH_ConfigCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB
+ {
+ NrRachCfgCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_e present;
+ union ssbPerRachOccAndCBPreamblesPerSSB_u
+ {
+ long oneEighth;
+ long oneFourth;
+ long oneHalf;
+ long one;
+ long two;
+ long four;
+ long eight;
+ long sixteen;
+ } choice;
+ } ssbPerRachOccAndCBPreamblesPerSSB;
+
+ struct rachCfgCommonGroupBconfigured
+ {
+ long ra_Msg3SizeGroupA;
+ long messagePowerOffsetGroupB;
+ long numberOfRA_PreamblesGroupA;
+ } groupBconfigured;/* OPTIONAL */
+
+ long ra_ContentionResolutionTimer;
+ long rsrp_ThresholdSSB; /* OPTIONAL */
+ long rsrp_ThresholdSSB_SUL; /* OPTIONAL */
+ struct rachCfgCommonPrachRootSequenceIndex
+ {
+ NrRachCfgCommonPrachRootSequenceIndex_e present;
+ union rachCfgCommonPrachRootSequenceIndex_u
+ {
+ long l839;
+ long l139;
+ } choice;
+ } prachRootSequenceIndex;
+ long msg1_SubcarrierSpacing;/* OPTIONAL */
+ long restrictedSetConfig;
+ long msg3_transformPrecoder;/* OPTIONAL */
+
+}rACH_Config_Common_t;
+typedef enum setup_Release_903P7_PR
+{
+ NrRachCfgCommon_PR_NOTHING, /* No components present */
+ NrRachCfgCommon_PR_release,
+ NrRachCfgCommon_PR_setup
+}NrRachCfgCommon_PR;
+
+typedef struct nrRachCfgCommon
+{
+ NrRachCfgCommon_PR present;
+ union NrRachCfgCommon_PR_u {
+ int release;
+ rACH_Config_Common_t setup;
+ } choice;
+} NrRachCfgCommon_t;
+
+/* PUSCH-ConfigCommon */
+#define NrPuschCfgCommonGroupHoppingChosen 1
+#define NrPuschCfgCommonMsg3DeltaChosen 2
+#define NrPuschCfgCommonPoNominalChosen 4
+#define NrPuschCfgCommonpuschTimeDomainAllocationChosen 8
+
+typedef struct nrPusch_ConfigCommon
+{
+ UINT16 bitmask;
+ long groupHoppingEnabledTransformPrecoding; /* OPTIONAL */
+ long msg3DeltaPreamble; /* OPTIONAL */
+ long p0NominalWithGrant; /* OPTIONAL */
+ UINT8 timeDomainNum;
+ PuschTimeDomainAlloc_t puschTimeDomainAllocation[MAX_TIME_DOMAIN_NUM]; /* OPTIONAL */
+
+}NrPusch_ConfigCommon_t;
+
+typedef enum
+{
+ NrPuschCfgCommon_PR_NOTHING, /* No components present */
+ NrPuschCfgCommon_PR_release,
+ NrPuschCfgCommon_PR_setup
+}NrPuschCfgCommon_PR;
+typedef struct nrPuschCfgCommon
+{
+ NrPuschCfgCommon_PR present;
+ union NrPuschCfgCommon_u {
+ int release;
+ NrPusch_ConfigCommon_t setup;
+ } choice;
+
+} NrPuschCfgCommon_t;
+
+#define InitialUlBwpRachCfgChosen 1
+#define InitialUlBwpPuschCfgChosen 2
+#define InitialUlBwpPucchCfgChosen 4
+typedef struct initialUlBwp
+{
+ UINT16 bitmask;
+ NrBWP_t bwp;
+ NrRachCfgCommon_t rachCfgCommon; /* OPTIONAL */
+ NrPuschCfgCommon_t puschCfgCommon; /* OPTIONAL */
+ NrPucchCfgCommon_t pucchCfgCommon; /* OPTIONAL */
+} InitialUlBwp_t;
+
+typedef struct ulCfgCommonSIB
+{
+ FreqInfoUlSib_t frequencyInfoUL;
+ InitialUlBwp_t initialUplinkBWP;
+ UINT8 timeAlignmentTimerCommon;
+} UlCfgCommonSIB_t;
+
+typedef struct freqInfoDlSib
+{
+ UINT16 frequencyBandListNum;
+ NrMultiBand_t frequencyBandList[MAX_MULTI_BANDS];
+ UINT16 offsetToPointA;
+ UINT16 speCarrierNum;
+ SpecificCarrier_t speCarrier[MAX_SCS];
+} FreqInfoDlSib_t;
+
+#define FIRST_PDCCH_MONITORING_OCCASION_OF_PO_T (1<<0)
+typedef enum
+{
+ PagingFrameOffset_PR_NOTHING, /* No components present */
+ PagingFrameOffset_PR_oneT,
+ PagingFrameOffset_PR_halfT,
+ PagingFrameOffset_PR_quarterT,
+ PagingFrameOffset_PR_oneEighthT,
+ PagingFrameOffset_PR_oneSixteenthT,
+} PagingFrameOffset_e;
+
+typedef enum
+{
+ PDCCH_Monitoring_PR_NOTHING, /* No components present */
+ PDCCH_Monitoring_PR_sCS15KHZoneT,
+ PDCCH_Monitoring_PR_sCS30KHZoneT_SCS15KHZhalfT,
+ PDCCH_Monitoring_PR_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT,
+ PDCCH_Monitoring_PR_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT,
+ PDCCH_Monitoring_PR_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT,
+ PDCCH_Monitoring_PR_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT,
+ PDCCH_Monitoring_PR_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT,
+ PDCCH_Monitoring_PR_sCS120KHZoneSixteenthT,
+} FirstPDCCH_MonitoringOccasionOfPO_e;
+
+#define MAX_PDCCH_MONITORING_OCCASION 4
+
+typedef struct sCS15KHZoneT_s
+{
+ UINT16 poNum;
+ UINT16 firstMonitorOccasionOfPO[MAX_PDCCH_MONITORING_OCCASION];
+}SCS15KHZoneT_t;
+
+typedef struct sCS30KHZoneT_SCS15KHZhalfT_s
+{
+
+ UINT16 poNum;
+ UINT16 firstMonitorOccasionOfPO[MAX_PDCCH_MONITORING_OCCASION];
+
+}sCS30KHZoneT_SCS15KHZhalfT_t;
+
+typedef struct sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_s
+{
+ UINT16 poNum;
+ UINT16 firstMonitorOccasionOfPO[MAX_PDCCH_MONITORING_OCCASION];
+
+}sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_t;
+
+typedef struct sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_s
+{
+ UINT16 poNum;
+ UINT16 firstMonitorOccasionOfPO[MAX_PDCCH_MONITORING_OCCASION];
+
+}sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_t;
+
+typedef struct sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_s
+{
+ UINT16 poNum;
+ UINT16 firstMonitorOccasionOfPO[MAX_PDCCH_MONITORING_OCCASION];
+
+}sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_t;
+
+typedef struct sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_s
+{
+ UINT16 poNum;
+ UINT16 firstMonitorOccasionOfPO[MAX_PDCCH_MONITORING_OCCASION];
+
+}sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_t;
+
+typedef struct sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_s
+{
+ UINT16 poNum;
+ UINT16 firstMonitorOccasionOfPO[MAX_PDCCH_MONITORING_OCCASION];
+
+}sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_t;
+
+typedef struct sCS120KHZoneSixteenthT_s
+{
+ UINT16 poNum;
+ UINT16 firstMonitorOccasionOfPO[MAX_PDCCH_MONITORING_OCCASION];
+
+}sCS120KHZoneSixteenthT_t;
+
+#define FirstPDCCH_MonitoringOccasionOfpoChosen (1 << 0)
+typedef struct pcchConfig
+{
+ UINT16 bitMask;
+ UINT8 defaultPagingCycle;
+
+ struct PagingFrameOffset
+ { PagingFrameOffset_e present;
+ union PagingFrame {
+ INT32 oneT;
+ UINT8 halfT;
+ UINT8 quarterT;
+ UINT8 oneEighthT;
+ UINT8 oneSixteenthT;
+ }choice;
+ }pagingFrameOffset_t;
+ UINT8 ns;
+ struct FirstPDCCH_MonitoringOccasionOfPO
+ { FirstPDCCH_MonitoringOccasionOfPO_e present;
+ union PDCCH_MonitoringOccasion {
+
+ SCS15KHZoneT_t SCS15KHZoneT;
+ sCS30KHZoneT_SCS15KHZhalfT_t sCS30KHZoneT_SCS15KHZhalfT;
+ sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_t sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT;
+ sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_t sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT;
+ sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_t sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT;
+ sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_t sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT;
+ sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_t sCS120KHZoneEighthT_SCS60KHZoneSixteenthT;
+ sCS120KHZoneSixteenthT_t sCS120KHZoneSixteenthT;
+ }choice;
+ }firstPDCCH_MonitoringOccasionOfPO_t; /*option*/
+
+} PcchConfig_t;
+
+typedef struct dlCfgCommonSIB
+{
+ FreqInfoDlSib_t frequencyInfoDL;
+ NrBwpDownLinkCommon_t initialDownlinkBWP;
+ UINT8 modificationPeriodCoeff;
+ PcchConfig_t pcchConfig;
+} DlCfgCommonSIB_t;
+
+typedef struct tddUlDlPattern
+{
+ UINT8 dlULTransmissionPeriodicity;
+ UINT16 nrofDownlinkSlots;
+ UINT8 nrofDownlinkSymbols;
+ UINT16 nrofUplinkSlots;
+ UINT8 nrofUplinkSymbols;
+ /*UINT8 dlULTransmissionPeriodicity_v1530; extension*/
+} TddUlDlPattern_t;
+
+
+typedef struct tddUlDlCfgCom
+{
+ UINT8 referenceSubcarrierSpacing;
+ TddUlDlPattern_t pattern1;
+ /*TddUlDlPattern_t pattern2; extension*/
+} TddUlDlCfgCom_t;
+
+
+#define UPLINK_CONFIG_COMMON (1<<0)
+#define SUPPLEMENTARY_UPLINK (1<<1)
+#define NTIMING_ADVANCE_OFFSET (1<<2)
+#define GROUP_PRESENCE (1<<3)
+#define TDD_ULDL_CFG_COMMON (1<<4)
+typedef struct servingCellCfg
+{
+ UINT16 bitMask;
+ DlCfgCommonSIB_t downlinkConfigCommon;
+ UlCfgCommonSIB_t uplinkConfigCommon; /*option*/
+ UlCfgCommonSIB_t supplementaryUplink; /*option*/
+ UINT8 nTimingAdvanceOffset; /*option*/
+ UINT8 inOneGroup;
+ UINT8 groupPresence; /*option*/
+ UINT8 ssbPeriodServingCell;
+ TddUlDlCfgCom_t tddUlDlCfgCommon; /*option*/
+ INT8 ssPBCHBlockPower;
+} ServingCellCfg_t;
+
+typedef struct uACBarringPerCat
+{
+ UINT8 accessCategory;
+ UINT8 uacBarringInfoSetIndex;
+} UACBarringPerCat_t;
+
+#define UAC_AC_BARRING_LIST_TYPE (1 << 0)
+
+typedef enum UacAcBarringListType_PR {
+ UacImplicitACBarringList_UacExplicitAcBarringListType_PR_NOTHING, /* No components present */
+ UacImplicitACBarringList_UacExplicitAcBarringListType_PR_UacImplicitACBarringList,
+ UacImplicitACBarringList_UacExplicitAcBarringListType_PR_UacExplicitAcBarringList
+} UacImplicitACBarringList_UacExplicitAcBarringList_PR;
+
+
+typedef struct uACBarringPerPLMN
+{
+ UINT16 bitMask;
+ UINT8 plmnIdentityIndex;
+ UINT16 BarringListNum;
+ UacImplicitACBarringList_UacExplicitAcBarringList_PR present;
+ union UacAcBarringListType_u {
+ UINT8 uacImplicitACBarringList[MAX_ACCESS_CAT - 1];
+ UACBarringPerCat_t uacExplicitAcBarringList[MAX_ACCESS_CAT - 1];
+ }choice; /*option*/
+} UACBarringPerPLMN_t;
+
+/***
+typedef struct uACBarringPerPLMN
+{
+ UINT8 plmnIdentityIndex;
+ UINT8 present;
+ UINT8 uacImplicitACBarringList[MAX_ACCESS_CAT - 1];
+ UACBarringPerCat_t uacExplicitAcBarringList[MAX_ACCESS_CAT - 1];
+
+} UACBarringPerPLMN_t;
+
+
+***/
+
+
+typedef struct uACBarringInfoSet
+{
+ UINT8 uacBarringFactor;
+ UINT8 uacBarringTime;
+ UINT8 uacBarringForAccessIdentity;
+} UACBarringInfoSet_t;
+
+#define UAC_BARRING_FOR_COMMON (1 << 0)
+#define UAC_BARRING_PER_PLMN_LIST (1 << 1)
+#define UAC_INDIVIDUAL_PLMN_LIST (1 << 2)
+#define UAC_ACT1_ESCLECT_ASSISTANCE_INFO (1 << 3)
+
+typedef enum uac_AccessCategory1_SelectionAssistanceInfo_PR
+{
+ uac_AccessCategory1_SelectionAssistanceInfo_nonthing,//guotingting
+ uac_AccessCategory1_SelectionAssistanceInfo_plmnCommon,
+ uac_AccessCategory1_SelectionAssistanceInfo_individualPLMNList
+} Uac_AccessCategory1_SelectionAssistanceInfo_PR;
+
+
+typedef struct sib1UacBarringInfo
+{
+ UINT16 bitMask;
+ UINT16 uac_BarringForCommonNUM;
+ UACBarringPerCat_t uac_BarringForCommon[MAX_ACCESS_CAT - 1]; /*option*/
+ UINT16 uacBarringPerPLMNListNUM;
+ UACBarringPerPLMN_t uacBarringPerPLMNList[MAX_PLMN]; /*option*/
+ UINT16 uacBarringInfoSetListNUM;
+ UACBarringInfoSet_t uacBarringInfoSetList[MAX_BARRING_SET];
+ Uac_AccessCategory1_SelectionAssistanceInfo_PR present;
+ UINT16 individualPLMNListNUM;
+ union uac_AccessCategory1_SelectionAssistanceInfo
+ {
+ UINT8 plmnCommon;
+ UINT8 individualPLMNList[MAX_PLMN];
+
+ }choice; /*option*/
+
+} Sib1UacBarringInfo_t;
+
+
+
+#define Q_RXLEVMIN_OFFSETD (1 << 0)
+#define Q_RXLEVMIN_SUL (1 << 1)
+#define Q_QUAL_MIN (1 << 2)
+#define Q_QUALMIN_OFFSET (1 << 3)
+#define CONN_EST_FAILURE_CTRL (1 << 4)
+#define SI_SCHE_LIST_PRESENCE (1 << 5)
+#define SI_SCHEDUL_INFO (1 << 6)
+#define SI_REQ_CFG (1 << 7)
+#define SI_REQ_CFGSUL (1 << 8)
+#define SYSTEM_INFORMATION_AREAID (1 << 9)
+#define SERVING_CELL_CFGCOMMON (1 << 10)
+#define IMS_EMERGENCY_SUPPORT (1 << 11)
+#define E_CALL_OVERIMS_SUPPORT (1 << 12)
+#define UE_TIMERS_ANDCONSTS (1 << 13)
+#define SIB1_UAC_BARINFO (1 << 14)
+#define USEFULL_RESUMEID (1 << 15)
+
+
+typedef struct sib1
+{
+ UINT16 bitMask;
+ INT8 qRxLevMin;
+ UINT8 qRxLevMinOffsetd; /*option*/
+ INT8 qRxLevMinSUL; /*option*/
+ INT8 qQualMin; /*option*/
+ UINT8 qQualMinOffset; /*option*/
+ CellAccessInfo_t cellAccessRelateInfo;
+ ConnEstFailCtrl_t connEstFailureCtrl; /*option*/
+ UINT8 siWindowLen;
+ UINT16 siNum;
+ SiSchInfo_t siSchedulInfo[MAX_SI_MESSAGE]; /*option*/
+ SiRequestConfig_t siReqCfg; /*option*/
+ SiRequestConfig_t siReqCfgSul; /*option*/
+ UINT32 systemInformationAreaID; /*option*/
+ ServingCellCfg_t servingCellCfgCommon; /*option*/
+ BOOL ims_EmergencySupport; /*option*/
+ BOOL eCallOverIMS_Support; /*option*/
+ UETimersAndConstants_t ueTimersAndConsts; /*option*/
+ Sib1UacBarringInfo_t sib1UacBarInfo; /*option*/
+ BOOL useFullResumeID; /*option*/
+}Sib1_t;
+
+/********************** Sib2_t ************************/
+typedef enum cmSib2QHyst
+{
+ qHystdB0 = 0,
+ qHystdB1 = 1,
+ qHystdB2 = 2,
+ qHystdB3 = 3,
+ qHystdB4 = 4,
+ qHystdB5 = 5,
+ qHystdB6 = 6,
+ qHystdB8 = 7,
+ qHystdB10 = 8,
+ qHystdB12 = 9,
+ qHystdB14 = 10,
+ qHystdB16 = 11,
+ qHystdB18 = 12,
+ qHystdB20 = 13,
+ qHystdB22 = 14,
+ qHystdB24 = 15
+}CmSib2QHyst_e;
+
+
+typedef enum cmSib2SfMedium
+{
+ qHystSFdBMedium0 = 0,
+ qHystSFdBMedium2 = 1,
+ qHystSFdBMedium4 = 2,
+ qHystSFdBMedium6 = 3
+}CmSib2SfMedium_e;
+
+typedef enum cmSib2SfHigh
+{
+ qHystSFdBHigh0 = 0,
+ qHystSFdBHigh2 = 1,
+ qHystSFdBHigh4 = 2,
+ qHystSFdBHigh6 = 3
+}CmSib2SfHigh_e;
+
+typedef struct cmSib2QHystSf
+{
+ CmSib2SfMedium_e sfMedium;
+ CmSib2SfHigh_e sfHigh;
+}CmSib2QHystSf_t;
+
+
+typedef enum cmSib2TEvaluation
+{
+ tEvaluationS30 = 0,
+ tEvaluationS60 = 1,
+ tEvaluationS120 = 2,
+ tEvaluationS180 = 3,
+ tEvaluationS240 = 4,
+ tEvaluationSpare3 = 5,
+ tEvaluationSpare2 = 6,
+ tEvaluationSpare1 = 7
+}CmSib2TEvaluation_e;
+
+typedef enum cmSib2THystNormal
+{
+ tHystNormalS30 = 0,
+ tHystNormalS60 = 1,
+ tHystNormalS120 = 2,
+ tHystNormalS180 = 3,
+ tHystNormalS240 = 4,
+ tHystNormalSpare3 = 5,
+ tHystNormalSpare2 = 6,
+ tHystNormalSpare1 = 7
+}CmSib2THystNormal_e;
+
+
+typedef struct cmSib2MobilityStateParameters
+{
+ CmSib2TEvaluation_e tEvaluation;
+ CmSib2THystNormal_e tHystNormal;
+ UINT8 nCellChangeMedium; /*1-16*/
+ UINT8 nCellChangeHigh; /*1-16*/
+}CmSib2MobilityStateParameters_t;
+
+
+typedef struct cmSib2SpeedStateReselectionPars
+{
+ CmSib2MobilityStateParameters_t mobilityStateParameters;
+ CmSib2QHystSf_t qHystSF;
+}CmSib2SpeedStateReselectionPars_t;
+
+#define THRESHOLD_RSRP_PRESENT (1 << 0)
+#define THRESHOLD_PSRQ_PRESENT (1 << 1)
+#define THRESHOLD_SINR_PRESENT (1 << 2)
+typedef struct cmSib2ThresholdNr
+{
+ UINT16 bitMask;
+ UINT8 thresholdRSRP; /*0-127 OPTIONAL*/
+ UINT8 thresholdRSRQ; /*0-127 OPTIONAL*/
+ UINT8 thresholdSINR; /*0-127 OPTIONAL*/
+}CmSib2ThresholdNr_t;
+
+typedef enum cmSib2QOffsetRange
+{
+ sib2qOffsetRangeMinus24 = 0,
+ sib2qOffsetRangeMinus22 = 1,
+ sib2qOffsetRangeMinus20 = 2,
+ sib2qOffsetRangeMinus18 = 3,
+ sib2qOffsetRangeMinus16 = 4,
+ sib2qOffsetRangeMinus14 = 5,
+ sib2qOffsetRangeMinus12 = 6,
+ sib2qOffsetRangeMinus10 = 7,
+ sib2qOffsetRangeMinus8 = 8,
+ sib2qOffsetRangeMinus6 = 9,
+ sib2qOffsetRangeMinus5 = 10,
+ sib2qOffsetRangeMinus4 = 11,
+ sib2qOffsetRangeMinus3 = 12,
+ sib2qOffsetRangeMinus2 = 13,
+ sib2qOffsetRangeMinus1 = 14,
+ sib2qOffsetRangePlus0 = 15,
+ sib2qOffsetRangePlus1 = 16,
+ sib2qOffsetRangePlus2 = 17,
+ sib2qOffsetRangePlus3 = 18,
+ sib2qOffsetRangePlus4 = 19,
+ sib2qOffsetRangePlus5 = 20,
+ sib2qOffsetRangePlus6 = 21,
+ sib2qOffsetRangePlus8 = 22,
+ sib2qOffsetRangePlus10 = 23,
+ sib2qOffsetRangePlus12 = 24,
+ sib2qOffsetRangePlus14 = 25,
+ sib2qOffsetRangePlus16 = 26,
+ sib2qOffsetRangePlus18 = 27,
+ sib2qOffsetRangePlus20 = 28,
+ sib2qOffsetRangePlus22 = 29,
+ sib2qOffsetRangePlus24 = 30,
+
+}CmSib2QOffsetRange_e;
+
+#define NROF_SS_BLOCKS_TO_AVERAGE_PRESENT (1 << 0)
+#define ABS_THRESH_SS_BLOCKS_CONSOLIDATION_PRESENT (1 << 1)
+#define RANGE_TO_BEST_CELL_PRESENT (1 << 2)
+#define SPEED_STATE_RESELECTION_PARS_PRESENT (1 << 3)
+typedef struct cmSib2CellReselectionInfoCommon
+{
+ UINT16 bitMask;
+ UINT8 nrofSsBlocksToAverage; /*2-16 OPTIONAL*/
+ CmSib2ThresholdNr_t absThreshSsBlocksConsolidation; /*OPTIONAL*/
+ CmSib2QOffsetRange_e rangeToBestCell; /*OPTIONAL*/
+ CmSib2QHyst_e qHyst;
+ CmSib2SpeedStateReselectionPars_t speedStateReselectionPars;
+} CmSib2CellReselectionInfoCommon_t;
+
+typedef enum cmSib2CellReselectionSubPriority
+{
+ cellReselectionSubPriorityoDot2 = 0,
+ cellReselectionSubPriorityoDot4 = 1,
+ cellReselectionSubPriorityoDot6 = 2,
+ cellReselectionSubPriorityoDot8 = 3
+}CmSib2CellReselectionSubPriority_e;
+
+#define CM_SIB2_RESELECT_SERV_FREQ_SNON_INTRA_SEARCH_P (1 << 0)
+#define CM_SIB2_RESELECT_SERV_FREQ_SNON_INTRA_SEARCH_Q (1 << 1)
+#define CM_SIB2_RESELECT_SERV_FREQ_THRESH_SERV_LOWQ (1 << 2)
+#define CM_SIB2_RESELECT_SERV_FREQ_SUB_PRIORITY (1 << 3)
+typedef struct cmSib2CellReselectionServingFreqInfo
+{
+ UINT16 bitMask;
+ UINT8 sNonIntraSearchP; //0-31
+ UINT8 sNonIntraSearchQ; //0-31
+ UINT8 threshServingLowP; //0-31
+ UINT8 threshServingLowQ; //0-31
+ UINT8 cellReselectionPriority; //0-7
+ CmSib2CellReselectionSubPriority_e cellReselectionSubPriority;
+} CmSib2CellReselectionServingFreqInfo_t;
+
+
+typedef struct cmSib2SsRssiMeasurement
+{
+ UINT8 measurementSlots[10]; //BIT STRING SIZE(1-80)
+ UINT8 endSymbol; //0-3
+} CmSib2SsRssiMeasurement_t;
+
+
+typedef struct cmSib2NrNsPmaxValue
+{
+ INT8 additionalPmax; /*-30~30 OPTIONAL*/
+ UINT8 additionalSpectrumEmission; /*0-7*/
+} CmSib2NrNsPmaxValue_t;
+
+
+typedef struct cmSib2NrNsPmaxList
+{
+ CmSib2NrNsPmaxValue_t nRNsPmaxList[MAX_NR_NS_PMAX];
+} CmSib2NrNsPmaxList_t;
+
+
+typedef struct cmSib2NrMultiBandInfo
+{
+ UINT16 freqBandIndicatorNR; //1-1024
+ CmSib2NrNsPmaxList_t nRNsPmaxList;
+} CmSib2NrMultiBandInfo_t;
+
+
+typedef struct cmSib2MultiFrequencyBandListNrSib
+{
+ CmSib2NrMultiBandInfo_t multiFrequencyBandListNrSib[MAX_MULTI_BANDS];
+
+} CmSib2MultiFrequencyBandListNrSib_t;
+
+
+typedef enum cmSib2Duration
+{
+ durationSf1 = 0,
+ durationSf2 = 1,
+ durationSf3 = 2,
+ durationSf4 = 3,
+ durationSf5 = 4,
+}CmSib2Duration_e;
+
+typedef enum cmSib2SsMtcPresent
+{
+ CM_SIB2_SSB_MTC_NOTHING = 0,
+ CM_SIB2_SSB_MTC_SF5 = 1,
+ CM_SIB2_SSB_MTC_SF10 = 2,
+ CM_SIB2_SSB_MTC_SF20 = 3,
+ CM_SIB2_SSB_MTC_SF40 = 4,
+ CM_SIB2_SSB_MTC_SF80 = 5,
+ CM_SIB2_SSB_MTC_SF160 = 6,
+}CmSib2SsMtcPresent_e;
+
+typedef struct cmSib2SsbMtc //choice sf5-sf160
+{
+ CmSib2SsMtcPresent_e present;
+ UINT8 sf5; //0-4
+ UINT8 sf10; //0-9
+ UINT8 sf20; //0-19
+ UINT8 sf40; //0-39
+ UINT8 sf80; //0-79
+ UINT8 sf160; //0-159
+ CmSib2Duration_e duration;
+
+} CmSib2SsbMtc_t;
+
+typedef enum cmSib2SsbToMeasurePresent
+{
+ CM_SIB2_SSB_TO_MEASURE_NOTHING = 0,
+ CM_SIB2_SSB_TO_MEASURE_SHORT_BITMAP = 1,
+ CM_SIB2_SSB_TO_MEASURE_MEDIUM_BITMAP = 2,
+ CM_SIB2_SSB_TO_MEASURE_LONG_BITMAP = 3,
+}CmSib2SsbToMeasurePresent_e;
+
+typedef struct cmSib2SsbToMeasure
+{
+ CmSib2SsbToMeasurePresent_e present;
+ UINT8 shortBitmap; //BIT STRING SIZE(4)
+ UINT8 mediumBitmap; //BIT STRING SIZE(8)
+ UINT64 longBitmap; //BIT STRING SIZE(64)
+
+} CmSib2SsbToMeasure_t;
+
+#define CM_INTRA_FREQ_CELL_RESELECT_QRX_LEV_MIN_SUL_PRESENT (1 << 0)
+#define CM_INTRA_FREQ_CELL_RESELECT_QUAL_MIN_PRESENT (1 << 1)
+#define CM_INTRA_FREQ_CELL_RESELECT_SINTRA_SEARCH_Q_PRESENT (1 << 2)
+#define CM_INTRA_FREQ_CELL_RESELECT_FREQUENCY_BAND_LIST_PRESENT (1 << 3)
+#define CM_INTRA_FREQ_CELL_RESELECT_FREQUENCY_BAND_LIST_SUL_PRESENT (1 << 4)
+#define CM_INTRA_FREQ_CELL_RESELECT_PMAX_PRESENT (1 << 5)
+#define CM_INTRA_FREQ_CELL_RESELECT_CM_SIB2_SSB_MTC_PRSENT (1 << 6)
+#define CM_INTRA_FREQ_CELL_RESELECT_CM_SIB2_SS_RSSI_MEASUREMENT_PRSENT (1 << 7)
+#define CM_INTRA_FREQ_CELL_RESELECT_CM_SIB2_SSB_TO_MEASURE_PRSENT (1 << 8)
+typedef struct cmSib2IntraFreqCellReselectionInfo
+{
+ UINT16 bitMask;
+ INT8 qRxLevMin; //-70~-22
+ INT8 qRxLevMinSUL; //-70~-22
+ INT8 qQualMin; //-34~-3
+ UINT8 sIntraSearchP; //0-31
+ UINT8 sIntraSearchQ; //0-31
+ UINT8 tReselectionNR; //0-7
+ CmSib2MultiFrequencyBandListNrSib_t frequencyBandList;
+ CmSib2MultiFrequencyBandListNrSib_t frequencyBandListSUL;
+ INT8 pMax; //-30-33
+ CmSib2SsbMtc_t smtc;
+ CmSib2SsRssiMeasurement_t ssRssiMeasurement ;
+ CmSib2SsbToMeasure_t ssbToMeasure;
+ BOOL deriveSSBIndexFromCell;
+} CmSib2IntraFreqCellReselectionInfo_t;
+
+typedef struct sib2
+{
+ CmSib2CellReselectionInfoCommon_t cellReselectionCommon;
+ CmSib2CellReselectionServingFreqInfo_t cellReselectionServingFreq;
+ CmSib2IntraFreqCellReselectionInfo_t intraFreqCellReselection;
+}Sib2_t;
+
+/********************** Sib3_t ************************/
+typedef enum cmSib3QOffsetRange
+{
+ sib3qOffsetRangeMinus24 = 0,
+ sib3qOffsetRangeMinus22 = 1,
+ sib3qOffsetRangeMinus20 = 2,
+ sib3qOffsetRangeMinus18 = 3,
+ sib3qOffsetRangeMinus16 = 4,
+ sib3qOffsetRangeMinus14 = 5,
+ sib3qOffsetRangeMinus12 = 6,
+ sib3qOffsetRangeMinus10 = 7,
+ sib3qOffsetRangeMinus8 = 8,
+ sib3qOffsetRangeMinus6 = 9,
+ sib3qOffsetRangeMinus5 = 10,
+ sib3qOffsetRangeMinus4 = 11,
+ sib3qOffsetRangeMinus3 = 12,
+ sib3qOffsetRangeMinus2 = 13,
+ sib3qOffsetRangeMinus1 = 14,
+ sib3qOffsetRangePlus0 = 15,
+ sib3qOffsetRangePlus1 = 16,
+ sib3qOffsetRangePlus2 = 17,
+ sib3qOffsetRangePlus3 = 18,
+ sib3qOffsetRangePlus4 = 19,
+ sib3qOffsetRangePlus5 = 20,
+ sib3qOffsetRangePlus6 = 21,
+ sib3qOffsetRangePlus8 = 22,
+ sib3qOffsetRangePlus10 = 23,
+ sib3qOffsetRangePlus12 = 24,
+ sib3qOffsetRangePlus14 = 25,
+ sib3qOffsetRangePlus16 = 26,
+ sib3qOffsetRangePlus18 = 27,
+ sib3qOffsetRangePlus20 = 28,
+ sib3qOffsetRangePlus22 = 29,
+ sib3qOffsetRangePlus24 = 30
+}CmSib3QOffsetRange_e;
+
+#define CM_INTRA_FREQ_NEIGH_CELL_QRX_LEV_MIN_OFFSET_CELL (1 << 0)
+#define CM_INTRA_FREQ_NEIGH_CELL_QRX_LEV_MIN_OFFSET_SUL_CELL (1 << 1)
+#define CM_INTRA_FREQ_NEIGH_CELL_QUAL_MIN_OFFSET_CELL (1 << 2)
+typedef struct cmSib3IntraFreqNeighCellInfo
+{
+ UINT32 bitMask;
+ UINT16 physCellId; //0-1007
+ CmSib3QOffsetRange_e qOffsetCell;
+ UINT8 qRxLevMinOffsetCell; //1-8
+ UINT8 qRxLevMinOffsetCellSUL; //1-8
+ UINT8 qQualMinOffsetCell; //1-8
+
+} CmSib3IntraFreqNeighCellInfo_t;
+
+
+typedef struct cmSib3IntraFreqNeighCellList
+{
+ UINT32 neighNum;
+ CmSib3IntraFreqNeighCellInfo_t intraFrequenceNeighCellList[MAXCELLINTRA];
+
+} CmSib3IntraFreqNeighCellList_t;
+
+
+typedef enum cmSib3Range
+{
+ rangeN4 = 0,
+ rangeN8 = 1,
+ rangeN12 = 2,
+ rangeN16 = 3,
+ rangeN24 = 4,
+ rangeN32 = 5,
+ rangeN48 = 6,
+ rangeN64 = 7,
+ rangeN84 = 8,
+ rangeN96 = 9,
+ rangeN128 = 10,
+ rangeN168 = 11,
+ rangeN252 = 12,
+ rangeN504 = 13,
+ rangeN1008 = 14,
+ rangeSpare1 = 15,
+}CmSib3Range_e;
+
+#define CM_SIB3_PCI_RANGE (1 << 0)
+typedef struct cmSib3PciRange
+{
+ UINT32 bitMask;
+ UINT16 physCellId; //0-1007
+ CmSib3Range_e range;
+} CmSib3PciRange_t;
+
+
+typedef struct cmSib3IntraFreqBlackCellList
+{
+ UINT32 blackNum;
+ CmSib3PciRange_t intraFrequenceBlackCellList[MAXCELLBLACK];
+
+} CmSib3IntraFreqBlackCellList_t;
+
+#define CM_SIB3_INTRA_FREQ_NEIGH_CELL_LIST (1 << 0)
+#define CM_SIB3_INTRA_FREQ_BLACK_CELL_LIST (1 << 1)
+typedef struct sib3
+{
+ UINT16 bitMask;
+ CmSib3IntraFreqNeighCellList_t intraFreqNeighCell;
+ CmSib3IntraFreqBlackCellList_t intraFreqBlackCell;
+}Sib3_t;
+
+/********************** SystemInfo_t ************************/
+typedef struct systemInfo
+{
+ Sib2_t siSib2;
+ Sib3_t siSib3;
+#if 0
+ Sib4_t siSib4;
+ Sib5_t siSib5;
+ Sib6_t siSib6;
+ Sib7_t siSib7;
+ Sib8_t siSib8;
+ Sib9_t siSib9;
+#endif
+}SystemInfo_t;
+
+/********************** SiConfig_t ************************/
+typedef struct siConfig
+{
+ Mib_t mibCfg;
+ Sib1_t sib1Cfg;
+ Sib2_t sib2Cfg;
+ Sib3_t sib3Cfg;
+ SystemInfo_t si1Cfg;
+ SystemInfo_t si2Cfg;
+ UINT8 sib1Flag;
+ UINT8 siFlag;
+ UINT8 pagingFlag;
+#if 0
+ Sib4_t sib4Cfg;
+ Sib5_t sib5Cfg;
+ Sib6_t sib6Cfg;
+ Sib7_t sib7Cfg;
+ Sib8_t sib8Cfg;
+ Sib9_t sib9Cfg;
+ SystemInfo_t si3;
+ SystemInfo_t si4;
+ SystemInfo_t si5;
+ SystemInfo_t si6;
+ SystemInfo_t si7;
+ SystemInfo_t si8;
+#endif
+} SiConfig_t;
+
+typedef struct ngapConfig
+{
+ UINT32 gNBId; /* Global Ran Node ID of one gNB */
+ NgapRanName_t ranNodeName; /* name of one gNB */
+ IpAddress_t ranNodeIp; /* IP Address of gNB */
+} NGAPConfig_t;
+/********************** OamCuCpConfig_t ************************/
+typedef struct
+{
+ UINT64 gnbDuId;
+ IpAddress_t gnbDuIp;/* IP Address of DU */
+ UCHAR gnbDuName[MAX_GNB_DU_NAME];
+
+}F1apDuInfo_t;
+
+typedef struct f1apConfig
+{
+ UINT32 gNBId;
+
+ UINT64 gnbCuId;
+ IpAddress_t gnbCuIp;/* IP Address of CU */
+ UCHAR gnbCuName[MAX_GNB_CU_NAME];
+ UINT8 gnbDuNum;
+ F1apDuInfo_t gnbDuCfg[MAX_GNB_DU_NUM];
+} F1APConfig_t;
+
+/**
+ * @struct Transmission BandWidth
+ This structure is the Transmission BandWidth of Cell Configuration
+*/
+typedef struct transBandWidth
+{
+ long nrScs;
+ long nrb;
+} TransBandWidth_t;
+
+/**
+ * @struct SULInfo
+ This structure is the sul Info of Cell Configuration
+*/
+typedef struct sulInfo
+{
+ UINT32 sulArfcn;
+ TransBandWidth_t sulTransBW;
+} SulInfo_t;
+
+/**
+ * @struct FreqBand
+ This structure is the freq Band of Cell Configuration
+*/
+typedef struct freqBand
+{
+ UINT32 nrFreqBand;
+ UINT8 supportedSulBandNum;
+ UINT32 sulBand[MAX_NR_CELL_BANDS];
+} FreqBand_t;
+
+/**
+ * @struct FreqInfo
+ This structure is the freq Info of Cell Configuration
+*/
+#define FreqInfoSulInfoChosen 0x01
+typedef struct freqInfo
+{
+ UINT16 bitmask;
+ UINT32 nrArfcn;
+ SulInfo_t sulInfo;
+ UINT8 freqBandNum;
+ FreqBand_t freqBandItem[MAX_NR_CELL_BANDS];
+} FreqInfo_t;
+
+/**
+ * @struct FDDInfo
+ This structure is the FDD Mode Config Info of Cell Configuration
+*/
+typedef struct fddInfo
+{
+ FreqInfo_t ulFreqInfo;
+ FreqInfo_t dlFreqInfo;
+ TransBandWidth_t ulTransBW;
+ TransBandWidth_t dlTransBW;
+} FddInfo_t;
+
+/**
+ * @struct TDDInfo
+ This structure is the TDD Mode Config Info of Cell Configuration
+*/
+typedef struct tddInfo
+{
+ FreqInfo_t nrFreqInfo;
+ TransBandWidth_t transBW;
+} TddInfo_t;
+
+/**
+ * @struct oamActCellInfo
+ This structure is oam send this message to Du act cell
+*/
+typedef struct oamActCellInfo
+{
+ UINT8 actCellNum;
+ CmNrCellId actCellId[MAX_CELL_NUM];
+} OamActCellInfo_t;
+
+/**
+ * @struct oamActCellRsp
+ This structure is DU send reponse message to OAM
+*/
+typedef struct oamActCellRsp
+{
+ UINT8 actResult; //0: all failed 1: all success 2: some success and some failed
+ UINT8 actCellNum;
+ CmNrCellId actSuccessCellId[MAX_CELL_NUM];
+ CmNrCellId actFailedCellId[MAX_CELL_NUM];
+} OamActCellRsp_t;
+
+
+/** 从原始消息中获取SOCKET msg */
+#define GNB_GET_SOCKET_MSG(src,dst) VOS_MemCpy((CHAR*)dst,(CHAR*)src,sizeof(vos_sock_info_t))
+
+/** 从原始消息中拷贝消息到dst中 */
+#define GNB_GET_DATA(src,dst,len) if(len > sizeof(vos_sock_info_t)) \
+ { \
+ VOS_MemCpy((CHAR*)dst,((CHAR*)src+sizeof(vos_sock_info_t)),(len-sizeof(vos_sock_info_t))); \
+ } \
+ else \
+ { \
+ printf("msg len invalid, len = %d \r\n",len);\
+ VOS_ASSERT(0); \
+ return VOS_ERROR;\
+ }
+/*获取msgBuf中消息地址*/
+#define GNB_GET_MODULE_MSG_DATA_PTR(dataType,pData,buf) do{ \
+ ULONG ulBufAddr = 0; \
+ VOS_MemCpy((CHAR*)&ulBufAddr,(CHAR*)buf,sizeof(ULONG));\
+ pData =(dataType*)(ULONG*)ulBufAddr; \
+ }while(0)
+/*设置msgBuf中消息地址*/
+#define GNB_SET_MODULE_MSG_DATA_PTR(src,dst) do{ \
+ ULONG ulBufAddr = 0; \
+ ulBufAddr= (ULONG)((ULONG*)src); \
+ VOS_MemCpy(dst, &ulBufAddr, sizeof(ULONG)); \
+ }while(0)
+
+/*填充数据地址到msgBuf中*/
+#define GNB_SET_MODULE_MSG(msg,pModuleMsg) do{ \
+ CHAR* bufPtr = NULL; \
+ ULONG ulBufAddr = 0; \
+ bufPtr = (CHAR*)VOS_Malloc((pModuleMsg)->msgLen,(pModuleMsg)->srcModuleId); \
+ if(NULL == bufPtr) \
+ { \
+ VOS_ASSERT(0); \
+ return VOS_ERROR; \
+ } \
+ VOS_MemCpy(bufPtr,&msg,sizeof(msg)); \
+ ulBufAddr= (ULONG)((ULONG*)bufPtr); \
+ VOS_MemCpy((pModuleMsg)->msgBuf, &ulBufAddr, sizeof(ULONG)); \
+ }while(0)
+#define BUFFER_TO_UINT32(buf, x) \
+do { \
+ x = ((uint32_t)((buf)[0]) ) | \
+ ((uint32_t)((buf)[1]) << 8) | \
+ ((uint32_t)((buf)[2]) << 16) | \
+ ((uint32_t)((buf)[3]) << 24); \
+} while(0)
+
+#define INT32_TO_BUFFER(x, buf) \
+do { \
+ (buf)[0] = (x) >> 24; \
+ (buf)[1] = (x) >> 16; \
+ (buf)[2] = (x) >> 8; \
+ (buf)[3] = (x); \
+} while(0)
+
+
+
+
+extern void fillSocketPara(UINT32 sockType,SockAddrStr_t* pSockAddr,SockAddrStr_t* clientSockAddrInfo,vos_sock_para_t *para);
+extern INT32 get_file_len(FILE *file_p);
+extern INT32 tell_file(FILE *file_p);
+extern INT32 getpos_file(FILE *file_p, fpos_t *pos);
+extern INT32 putpos_file(FILE *file_p, fpos_t *pos);
+extern INT32 seek_file(FILE *file_p, INT32 offset, INT32 whence);
+extern INT32 eof_file(FILE *file_p);
+extern INT32 error_file(FILE *file_p);
+extern FILE *open_file(const char *path, const char *flag);
+extern INT32 close_file(FILE *file_p);
+extern INT32 read_file(void *buf, INT32 size, INT32 count, FILE *file_p);
+
+extern VOID sctpMsgNotifyProc(vos_sock_info_t* opval,VOID* buffer);
+
+void gnbPrintRrcMsg(int direction, int msgType, UINT8 *buf, INT32 size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CU_COMMON_H_*/
+
+
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+#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
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+#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 *)>P_LHDR(buf)->next : NULL)
+#define GTP_NXTHDR(buf, ext) \
+ (ext == NULL ? GTP_FIRSTHDR(buf) : \
+ ((uint8_t *)&ext->len + ext->len * 4 - \
+ (uint8_t *)>P_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 */
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+#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 */
+
--- /dev/null
+/*
+ * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
+ */
+
+#ifndef _NG_ASN_CONSTANT_H
+#define _NG_ASN_CONSTANT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ngap_min_val_AMF_UE_NGAP_ID (0)
+#define ngap_max_val_AMF_UE_NGAP_ID (1099511627775)
+#define ngap_min_val_NextHopChainingCount (0)
+#define ngap_max_val_NextHopChainingCount (7)
+#define ngap_min_val_NumberOfBroadcasts (0)
+#define ngap_max_val_NumberOfBroadcasts (65535)
+#define ngap_min_val_NumberOfBroadcastsRequested (0)
+#define ngap_max_val_NumberOfBroadcastsRequested (65535)
+#define ngap_min_val_PDUSessionID (0)
+#define ngap_max_val_PDUSessionID (255)
+#define ngap_min_val_PriorityLevelARP (1)
+#define ngap_max_val_PriorityLevelARP (15)
+#define ngap_min_val_RANPagingPriority (1)
+#define ngap_max_val_RANPagingPriority (256)
+#define ngap_min_val_RAN_UE_NGAP_ID (0)
+#define ngap_max_val_RAN_UE_NGAP_ID (4294967295)
+#define ngap_min_val_RelativeAMFCapacity (0)
+#define ngap_max_val_RelativeAMFCapacity (255)
+#define ngap_min_val_RepetitionPeriod (0)
+#define ngap_max_val_RepetitionPeriod (131071)
+#define ngap_min_val_TimeUEStayedInCell (0)
+#define ngap_max_val_TimeUEStayedInCell (4095)
+#define ngap_min_val_TimeUEStayedInCellEnhancedGranularity (0)
+#define ngap_max_val_TimeUEStayedInCellEnhancedGranularity (40950)
+#define ngap_min_val_TNLAddressWeightFactor (0)
+#define ngap_max_val_TNLAddressWeightFactor (255)
+#define ngap_min_val_TrafficLoadReductionIndication (1)
+#define ngap_max_val_TrafficLoadReductionIndication (99)
+#define ngap_min_val_ProcedureCode (0)
+#define ngap_max_val_ProcedureCode (255)
+#define ngap_min_val_ProtocolExtensionID (0)
+#define ngap_max_val_ProtocolExtensionID (65535)
+#define ngap_min_val_ProtocolIE_ID (0)
+#define ngap_max_val_ProtocolIE_ID (65535)
+#define ngap_maxPrivateIEs (65535)
+#define ngap_maxProtocolExtensions (65535)
+#define ngap_maxProtocolIEs (65535)
+#define ngap_maxnoofAllowedAreas (16)
+#define ngap_maxnoofAllowedS_NSSAIs (8)
+#define ngap_maxnoofBPLMNs (12)
+#define ngap_maxnoofCellIDforWarning (65535)
+#define ngap_maxnoofCellinAoI (256)
+#define ngap_maxnoofCellinEAI (65535)
+#define ngap_maxnoofCellinTAI (65535)
+#define ngap_maxnoofCellsingNB (16384)
+#define ngap_maxnoofCellsinngeNB (256)
+#define ngap_maxnoofCellsinUEHistoryInfo (16)
+#define ngap_maxnoofCellsUEMovingTrajectory (16)
+#define ngap_maxnoofDRBs (32)
+#define ngap_maxnoofEmergencyAreaID (65535)
+#define ngap_maxnoofEAIforRestart (256)
+#define ngap_maxnoofEPLMNs (15)
+#define ngap_maxnoofEPLMNsPlusOne (16)
+#define ngap_maxnoofE_RABs (256)
+#define ngap_maxnoofErrors (256)
+#define ngap_maxnoofForbTACs (4096)
+#define ngap_maxnoofMultiConnectivity (4)
+#define ngap_maxnoofMultiConnectivityMinusOne (3)
+#define ngap_maxnoofNGConnectionsToReset (65536)
+#define ngap_maxnoofPDUSessions (256)
+#define ngap_maxnoofPLMNs (12)
+#define ngap_maxnoofQosFlows (64)
+#define ngap_maxnoofRANNodeinAoI (64)
+#define ngap_maxnoofRecommendedCells (16)
+#define ngap_maxnoofRecommendedRANNodes (16)
+#define ngap_maxnoofAoI (64)
+#define ngap_maxnoofServedGUAMIs (256)
+#define ngap_maxnoofSliceItems (1024)
+#define ngap_maxnoofTACs (256)
+#define ngap_maxnoofTAIforInactive (16)
+#define ngap_maxnoofTAIforPaging (16)
+#define ngap_maxnoofTAIforRestart (2048)
+#define ngap_maxnoofTAIforWarning (65535)
+#define ngap_maxnoofTAIinAoI (16)
+#define ngap_maxnoofTimePeriods (2)
+#define ngap_maxnoofTNLAssociations (32)
+#define ngap_maxnoofXnExtTLAs (2)
+#define ngap_maxnoofXnGTP_TLAs (16)
+#define ngap_maxnoofXnTLAs (16)
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ASN_CONSTANT_H */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+#ifndef NG_U_H
+#define NG_U_H
+
+#include "vos_lib.h"
+#include "cuupCommon.h"
+#include "plat_syslog.h"
+
+#define DL_PDU_SESSION_INFORMATION 0 /* NGU DL PDU type */
+#define UL_PDU_SESSION_INFORMATION 1 /* NGU UL PDU type */
+
+#define NGU_FREE(p) if(NULL != p)\
+ {\
+ VOS_Free(p);\
+ p = NULL;\
+ }
+
+#define nguLog(iLog_Level, content, arg...) \
+ VOS_SysLog(gNguModuleId, iLog_Level, __FILE__, __LINE__, __func__, content, ##arg);
+
+#define nguNullCheck(p) \
+{\
+ if(NULL == p)\
+ {\
+ nguLog(LOG_ERR, "[NGU] NULL pointer\n");\
+ return VOS_ERROR;\
+ }\
+}
+
+#define nguGetInstance(ueIdx,pduSessId,p) \
+{\
+ if((NULL == gNguUeInfo[ueIdx])\
+ || (NULL == gNguUeInfo[ueIdx]->nguInstance[pduSessId]))\
+ {\
+ p = NULL;\
+ }else\
+ {\
+ p = gNguUeInfo[ueIdx]->nguInstance[pduSessId];\
+ }\
+}
+
+#define nguDlDataCheck(p) if(NULL == p)\
+ {\
+ nguLog(LOG_ERR,"[NGU] input is NULL!\n");\
+ return VOS_ERROR;\
+ }else if(NULL==p->pMsgBuff)\
+ {\
+ nguLog(LOG_ERR,"[NGU] p->pMsgBuff in input is NULL!\n");\
+ return VOS_ERROR;\
+ }\
+
+#define nguExPduCheck(p) if(NULL == p)\
+ {\
+ nguLog(LOG_ERR,"[NGU] ex pdu is null\n");\
+ return VOS_ERROR;\
+ }else if( (GTP_EXT_PDUSESSION_CONTAINER!=p->exHdrType) || (NULL==p->pPdu) || (p->len<=0))\
+ {\
+ nguLog(LOG_ERR,"[NGU] ex pdu is wrong\n");\
+ return VOS_ERROR;\
+ }
+
+#define nguDlDataFree(p) \
+{\
+ if(NULL != p)\
+ {\
+ if(NULL != p->pExPduInfo)\
+ {\
+ if(NULL != p->pExPduInfo->pPdu)\
+ {\
+ NGU_FREE(p->pExPduInfo->pPdu);\
+ p->pExPduInfo->pPdu = NULL;\
+ }\
+ NGU_FREE(p->pExPduInfo);\
+ p->pExPduInfo = NULL;\
+ }\
+ NGU_FREE(p);\
+ p = NULL;\
+ }\
+}
+
+
+
+typedef struct
+{
+ UINT64 ueE1apId;
+ UINT16 ueIdx;
+ UINT16 pduSessionId;
+ UINT32 ownTeid;
+}NguInstance_t;
+
+
+typedef struct
+{
+ UINT16 ueIdx;
+ UINT64 ueE1apId;
+ CuupBearerStatus_e ueStatus;
+ NguInstance_t *nguInstance[CUUP_MAX_SESSION_NUM];
+}NguUeInfo_t;
+
+
+typedef struct dlPduSessInfo
+{
+ UINT8 exHdrLen; /* gtp extension head length:2 */
+ UINT8 spare1 :4; /* spare: 0 */
+ UINT8 pduType :4; /* pdu type:0 */
+ UINT8 qfi :6; /* qfi */
+ UINT8 rqi :1;
+ UINT8 ppp :1;
+ UINT8 spare2 :5;
+ UINT8 ppi :3;
+ UINT8 padding[3];
+ UINT8 nextExHdrType;/* next extension head type:0 */
+}DlPduSessInfo_t;
+
+typedef struct ulPduSessInfo
+{
+ UINT8 exHdrLen; /* gtp extension head length:1 */
+ UINT8 spare1 :4; /* spare: 0 */
+ UINT8 pduType :4; /* pdu type:1 */
+ UINT8 qfi :6; /* qfi */
+ UINT8 spare2 :2;
+ UINT8 nextExHdrType;/* next extension head type:0 */
+}UlPduSessInfo_t;
+
+
+#endif /* NG_U_H */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+#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 */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+#ifndef __OMCUUPAPI_H__
+#define __OMCUUPAPI_H__
+
+#include "cuupProtocolPara.h"
+
+
+
+#define MAC_CUUP_CELL_NUM 10
+
+#define CUUP_SHM_FILE "cuup_shm"
+
+/*结构体id*/
+typedef enum{
+ id_cuupBasicInfoCf = 1,
+ id_cuupIpInfoList,
+ id_cuupPlmnInfo,
+ id_qosSupportList,
+ id_sliceSupportList,
+ id_cellIdSupportList,
+}OM_CuUp_para_struct_id;
+
+
+/////CPUP配置信息
+#pragma pack(1)
+
+
+typedef struct CuUpCfg_s
+{
+ cuupBasicInfoCfg_t cuupBasicInfoCfg;
+ cuupIpInfoList_t cuupIpInfoList;
+ cuupPlmnIdInfo_t plmnInfo;
+ ngranQosSupportList_t qosSupportList;
+ sliceSupportList_t sliceSupportList;
+ cellIdSupportList_t cellIdSupportList;
+}cuUpCfg_t;
+
+
+/////小区配置信息
+/*typedef struct CuUpCellInfoCfg_s
+{
+ UINT32 cellId;
+ e1setupRequestInfo_t e1setupRequestInfo;
+ sliceSupportList_t sliceSupportList;
+
+}cuUpCellInfoCfg_t;
+*/
+
+
+typedef struct CuUp_shm_table_s
+{
+ //UINT8 cell_num;
+ cuUpCfg_t shm_cuupCfg;
+}CuUp_shm_table_t;
+
+#pragma pack()
+
+
+#endif
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+#ifndef NR_PDCP_COMMON_H
+#define NR_PDCP_COMMON_H
+
+#include "vos_types.h"
+#include "vos_linklist.h"
+#include "vos_lib.h"
+#include "gnbCommon.h"
+
+
+#define FALSE 0
+#define TRUE 1
+#define PDCP_INFINITY 1
+#define PDCP_DISCARD_TIMER_INFINITY 2
+#define ROHC_BUFFER_SIZE 8096//1024
+#define PDCP_MAC_I_LEN 4
+#define PDCP_SN_12_HEAD_LEN 2
+#define PDCP_SN_18_HEAD_LEN 3
+#define MAX_PDCP_SN_12 0x1000
+#define MAX_PDCP_SN_18 0x40000
+#define SN_12_WINDOW_SIZE 2048
+#define SN_18_WINDOW_SIZE 131072
+#define REORDER_TIMER_NUM 36
+#define DISCARD_TIMER_NUM 15
+
+
+// TODO: the number of node is not sure yet
+#define PDCP_MAX_NODE_NUM 10
+#define PDCP_SPARED -1
+
+/* for ciphering */
+#define INACTIVE_ENC_STATE 0
+#define ACTIVE_ENC_STATE 1
+#define MIDDLE_ENC_STATE 3 /* for srb */
+
+/* for ciphering */
+#define INACTIVE_INT_STATE 0
+#define ACTIVE_INT_STATE 1
+
+
+typedef plist pdcpcList;
+
+#if 0
+typedef UINT8 PdcpSrbId;
+typedef UINT16 PdcpUeIdx;
+typedef UINT8 PdcpCellId;
+#endif
+
+typedef UINT8 PdcpBool_t;
+
+/* the type of RB */
+typedef enum
+{
+ SRB = 0,
+ DRB = 1
+}RbType;
+
+
+/* the direction of data transmission */
+typedef enum
+{
+ UPLINK = 0,
+ DOWNLINK = 1
+}PdcpDirection_e;
+
+
+/* pdcp pdu type */
+typedef enum
+{
+ PDCP_CTRL_PDU = 0, /* control pdu */
+ PDCP_DATA_PDU = 1 /* data pdu */
+}PdcpPduType_e;
+
+
+/* pdcp control pdu type */
+typedef enum
+{
+ PDCP_CTRL_PDU_SR = 0, /*status report*/
+ PDCP_CTRL_PDU_RF = 1, /*rohc feedback*/
+ PDCP_CTRL_PDU_RESERVED1 = 2,
+ PDCP_CTRL_PDU_RESERVED2 = 3,
+ PDCP_CTRL_PDU_RESERVED3 = 4,
+ PDCP_CTRL_PDU_RESERVED4 = 5,
+ PDCP_CTRL_PDU_RESERVED5 = 6,
+ PDCP_CTRL_PDU_RESERVED6 = 7
+}PdcpCtrlPduType_e;
+
+
+/* integrity algorithm */
+typedef enum
+{
+ NIA0 = 0,
+ NIA1 = 1,
+ NIA2 = 2,
+ NIA3 = 3,
+ INT_SPARE4 = 4,
+ INT_SPARE3 = 5,
+ INT_SPARE2 = 6,
+ INT_SPARE1 = 7
+}IntAlgorithm;
+
+
+/* ciphering algorithm */
+typedef enum
+{
+ NEA0 = 0,
+ NEA1 = 1,
+ NEA2 = 2,
+ NEA3 = 3,
+ CIP_SPARE4 = 4,
+ CIP_SPARE3 = 5,
+ CIP_SPARE2 = 6,
+ CIP_SPARE1 = 7
+}CipAlgorithm;
+
+
+#if 0
+/* For all srbs and drbs per ue */
+typedef struct{
+ UINT32 k_gnb[8]; /* 256 bit */
+ UINT32 k_up_enc[4]; /* 128 bit */
+ UINT32 k_cp_enc[4]; /* 128 bit */
+ UINT32 k_up_int[4]; /* 128 bit */
+ UINT32 k_cp_int[4]; /* 128 bit */
+ UINT32 nh[8]; /* Next Hop parameter 256 bit */
+ UINT8 ncc; /* maximum: 3bit */
+ UINT8 enc_algorithm; /* Encryption Algorithm */
+ UINT8 int_algorithm; /* Integrity Algorithm */
+ UINT8 enc_active_flag; /* define whether the encryption function has been activated */
+ UINT8 int_active_flag; /* define whether the integrity protection function has been activated */
+ UINT8 nh_ind; /* 1: nh existed 0: not existed */
+} UeSecurityParams;
+#endif
+
+typedef enum {
+ DISCARD_MS10 = 10,
+ DISCARD_MS20 = 20,
+ DISCARD_MS30 = 30,
+ DISCARD_MS40 = 40,
+ DISCARD_MS50 = 50,
+ DISCARD_MS60 = 60,
+ DISCARD_MS75 = 75,
+ DISCARD_MS100 = 100,
+ DISCARD_MS150 = 150,
+ DISCARD_MS200 = 200,
+ DISCARD_MS250 = 250,
+ DISCARD_MS300 = 300,
+ DISCARD_MS500 = 500,
+ DISCARD_MS750 = 750,
+ DISCARD_MS1500 = 1500,
+ DISCARD_INFINITY = PDCP_DISCARD_TIMER_INFINITY
+}DISCARD_TIMER;
+
+
+typedef enum{
+ LEN12BITS = 12,
+ LEN18BITS = 18
+}PdcpSnSize_e;
+
+
+typedef enum pdcpRlcMode
+{
+ TM_MODE = 1, /*!< RLC TM Mode */
+ UM_MODE, /*!< RLC UM Mode */
+ AM_MODE, /*!< RLC AM Mode */
+}PdcpRlcMode_e;
+
+
+typedef struct{
+ PdcpBool_t profile0x0001;
+ PdcpBool_t profile0x0002;
+ PdcpBool_t profile0x0003;
+ PdcpBool_t profile0x0004;
+ PdcpBool_t profile0x0005;
+ PdcpBool_t profile0x0006;
+ PdcpBool_t profile0x0101;
+ PdcpBool_t profile0x0102;
+ PdcpBool_t profile0x0103;
+ PdcpBool_t profile0x0104;
+}ROHCProfiles_t;
+
+typedef struct{
+ UINT16 maxCID;
+ ROHCProfiles_t rohcProfiles;
+}ROHCConfig_t;
+
+typedef struct{
+ UINT16 maxCID;
+ PdcpBool_t profile0x0006;
+}UplinkOnlyRohc_t;
+
+
+typedef struct{
+ UINT16 cellGroupID;
+ UINT8 lcID;
+}PrimaryPath;
+
+typedef enum{
+ B0 = 0,
+ B100 = 100,
+ B200 = 200,
+ B400 = 400,
+ B800 = 800,
+ B1600 = 1600,
+ B3200 = 3200,
+ B6400 = 6400,
+ B12800 = 12800,
+ B51200 = 51200,
+ B102400 = 102400,
+ B204800 = 204800,
+ B409600 = 409600,
+ B819200 = 819200,
+ B1228800 = 1228800,
+ B1638400 = 1638400,
+ B2457600 = 2457600,
+ B3276800 = 3276800,
+ B4096000 = 4096000,
+ B4915200 = 4915200,
+ B5734400 = 5734400,
+ B6553600 = 6553600,
+ INFINITY = PDCP_INFINITY,
+ SPARE8 = PDCP_SPARED,
+ SPARE7 = PDCP_SPARED,
+ SPARE6 = PDCP_SPARED,
+ SPARE5 = PDCP_SPARED,
+ SPARE4 = PDCP_SPARED,
+ SPARE3 = PDCP_SPARED,
+ SPARE2 = PDCP_SPARED,
+ SPARE1 = PDCP_SPARED
+}ULSPILT_THRESHOLD;
+
+typedef struct{
+ UINT16 release;
+ ULSPILT_THRESHOLD ulspiltThreshold;
+}UlDataSplitThreshold;
+
+typedef struct{
+ PrimaryPath primaryPath;
+ UlDataSplitThreshold ulDataSplitThreshold;
+ PdcpBool_t duplication;
+}MoreThanOneRLCContext;
+
+typedef enum{
+ REORDER_MS0 = 0,
+ REORDER_MS1 = 1,
+ REORDER_MS2 = 2,
+ REORDER_MS4 = 4,
+ REORDER_MS5 = 5,
+ REORDER_MS8 = 8,
+ REORDER_MS10 = 10,
+ REORDER_MS15 = 15,
+ REORDER_MS20 = 20,
+ REORDER_MS30 = 30,
+ REORDER_MS40 = 40,
+ REORDER_MS50 = 50,
+ REORDER_MS60 = 60,
+ REORDER_MS80 = 80,
+ REORDER_MS100 = 100,
+ REORDER_MS120 = 120,
+ REORDER_MS140 = 140,
+ REORDER_MS160 = 160,
+ REORDER_MS180 = 180,
+ REORDER_MS200 = 200,
+ REORDER_MS220 = 220,
+ REORDER_MS240 = 240,
+ REORDER_MS260 = 260,
+ REORDER_MS280 = 280,
+ REORDER_MS300 = 300,
+ REORDER_MS500 = 500,
+ REORDER_MS750 = 750,
+ REORDER_MS1000 = 1000,
+ REORDER_MS1250 = 1250,
+ REORDER_MS1500 = 1500,
+ REORDER_MS1750 = 1750,
+ REORDER_MS2000 = 2000,
+ REORDER_MS2250 = 2250,
+ REORDER_MS2500 = 2500,
+ REORDER_MS2750 = 2750,
+ REORDER_MS3000 = 3000,
+ REORDER_SPARE28 = PDCP_SPARED,
+ REORDER_SPARE27 = PDCP_SPARED,
+ REORDER_SPARE26 = PDCP_SPARED,
+ REORDER_SPARE25 = PDCP_SPARED,
+ REORDER_SPARE24 = PDCP_SPARED,
+ REORDER_SPARE23 = PDCP_SPARED,
+ REORDER_SPARE22 = PDCP_SPARED,
+ REORDER_SPARE21 = PDCP_SPARED,
+ REORDER_SPARE20 = PDCP_SPARED,
+ REORDER_SPARE19 = PDCP_SPARED,
+ REORDER_SPARE18 = PDCP_SPARED,
+ REORDER_SPARE17 = PDCP_SPARED,
+ REORDER_SPARE16 = PDCP_SPARED,
+ REORDER_SPARE15 = PDCP_SPARED,
+ REORDER_SPARE14 = PDCP_SPARED,
+ REORDER_SPARE13 = PDCP_SPARED,
+ REORDER_SPARE12 = PDCP_SPARED,
+ REORDER_SPARE11 = PDCP_SPARED,
+ REORDER_SPARE10 = PDCP_SPARED,
+ REORDER_SPARE09 = PDCP_SPARED,
+ REORDER_SPARE08 = PDCP_SPARED,
+ REORDER_SPARE07 = PDCP_SPARED,
+ REORDER_SPARE06 = PDCP_SPARED,
+ REORDER_SPARE05 = PDCP_SPARED,
+ REORDER_SPARE04 = PDCP_SPARED,
+ REORDER_SPARE03 = PDCP_SPARED,
+ REORDER_SPARE02 = PDCP_SPARED,
+ REORDER_SPARE01 = PDCP_SPARED
+}PDCP_TREORDERING;
+
+typedef struct{
+ UINT32 rxCount; /* count value calculated of per data packet */
+ UINT32 txNext;
+ UINT32 rxDelivery;
+ UINT32 rxNext;
+ UINT32 rxReorder;
+}PdcpStateVar_t;
+
+
+typedef struct{
+
+}ROHCCompressor;
+
+typedef struct{
+
+}ROHCDecompressor;
+
+
+/* get sn value when sn size is 12 bits */
+#define GET_SN_12_SN(p) ((p) & 0x00000fff)
+
+/* get sn value when sn size is 18 bits */
+#define GET_SN_18_SN(p) ((p) & 0x0003ffff)
+
+/* get hfn value when sn size is 12 bits */
+#define GET_HFN_12_SN(p) (((p) & 0xfffff000) >> 12)
+
+/* get hfn value when sn size is 18 bits */
+#define GET_HFN_18_SN(p) (((p) & 0xfffc0000) >> 18)
+
+/* get count value when sn size is 12 bits */
+#define GET_COUNT_12_SN(a,b) ((((a) & 0x000fffff)<<12)|((b) & 0x00000fff))
+
+/* get count value when sn size is 18 bits */
+#define GET_COUNT_18_SN(a,b) ((((a) & 0x00003fff)<<18)|((b) & 0x00003ffff))
+
+
+
+
+#endif /* NR_PDCP_COMMON_H */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+#include <errno.h>
+#include <signal.h>
+#include <netdb.h>
+#include <unistd.h>
+#include <ucontext.h>
+#include <stdlib.h>
+#include <net/if.h>
+#include <netinet/ip.h>
+#include <netinet/if_ether.h>
+#include <netinet/udp.h>
+#include <arpa/inet.h>
+#include <sys/ioctl.h>
+#include <execinfo.h>
+#include <getopt.h>
+#include <pthread.h>
+#include <memory.h>
+#include <regex.h>
+
+#include <stdio.h> /* for the printf() function */
+
+/* includes required to create a fake IP packet */
+#include <netinet/ip.h> /* for the IPv4 header */
+#include <string.h> /* for the strlen() */
+#include <rohc/rohc_buf.h> /* for the rohc_buf_*() functions */
+
+/* includes required to use the compression part of the ROHC library */
+#include <time.h> /* required by time() */
+#include <rohc/rohc_comp.h> /* for rohc_comp_*() functions */
+
+
+struct rohc_comp * create_compressor();
+bool compress_with_callback(struct rohc_comp *const compressor,struct rohc_buf uncomp_packet,struct rohc_buf *const packet);
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+#ifndef PDCP_U_H
+#define PDCP_U_H
+
+#include "vos_linklist.h"
+#include "pdcpCommon.h"
+#include "msgb.h"
+#include "cuupCommon.h"
+#include "cuModuleCommon.h"
+#include "plat_syslog.h"
+
+#define PROFILE0X0001_PRENSENT 0x0001
+#define PROFILE0X0002_PRENSENT 0x0002
+#define PROFILE0X0003_PRENSENT 0x0004
+#define PROFILE0X0004_PRENSENT 0x0008
+#define PROFILE0X0006_PRENSENT 0x0010
+#define PROFILE0X0101_PRENSENT 0x0020
+#define PROFILE0X0102_PRENSENT 0x0040
+#define PROFILE0X0103_PRENSENT 0x0080
+#define PROFILE0X0104_PRENSENT 0x0100
+
+#define pdcpuLog(iLog_Level, content, arg...) \
+ VOS_SysLog(gPdcpuModuleId, iLog_Level, __FILE__, __LINE__, __func__, content, ##arg);
+
+#define pdcpuNullCheck(p) \
+{\
+ if(NULL == p)\
+ {\
+ pdcpuLog(LOG_ERR,"[PDCPU] NULL pointer\n");\
+ return VOS_ERROR;\
+ }\
+}
+
+#define pdcpuNullCheckRp(p) \
+{\
+ if(NULL == p)\
+ {\
+ pdcpuLog(LOG_ERR,"[PDCPU] NULL pointer\n");\
+ return NULL;\
+ }\
+}
+
+
+#define pdcpuCheckUeIdx(n) if(n<0 || n>MAX_UE_NUM) {pdcpuLog(LOG_ERR,#n" is wrong\r\n");return VOS_ERROR;}
+#define pdcpuCheckDrbId(n) if(n<1 || n>MAX_DRB_ID) {pdcpuLog(LOG_ERR,#n":%d is wrong\r\n");return VOS_ERROR;}
+#define pdcpuCheckPduSessionId(n) if(n<0 || n>255) {pdcpuLog(LOG_ERR,#n" is wrong\r\n");return VOS_ERROR;}
+
+#define pdcpuGetEntity(ueIdx, drbId, p)\
+{\
+ if((NULL==gPdcpuUeInfo[ueIdx])\
+ ||(NULL==gPdcpuUeInfo[ueIdx]->pdcpDrbEntity[drbId]))\
+ {\
+ p = NULL;\
+ }else\
+ {\
+ p = gPdcpuUeInfo[ueIdx]->pdcpDrbEntity[drbId];\
+ }\
+}
+
+#define pdcpuMsgbFree(p)\
+{\
+ if(NULL != p)\
+ {\
+ msgbFree(p);\
+ p = NULL;\
+ }\
+}
+
+typedef struct
+{
+ UINT16 pduSessionId;
+ UINT8 integrityEnableFlag;
+ UINT8 cipherEnableFlag;
+ UINT64 maxIPDataRate; /* Maximum Integrity Protected Data Rate */
+}PdcpuSecEnableInfo_t;
+
+
+typedef enum
+{
+ NEW_PACKET = 0,
+ OLD_PACKET
+}PdcpTxNodeType_e;
+
+typedef enum
+{
+ PDCP_DISCARD_TIMER = 1,
+ PDCP_REORDER_TIMER
+}PdcpTimer_e;
+
+
+typedef struct
+{
+ UINT32 count;
+ UINT32 f1uSn; /* Not used in receiving buffer */
+ MsgbBuff_t *pData;
+ UINT8 flag;
+ struct timeval startTime;
+}PdcpuDataBuffNode_t;
+
+
+typedef struct
+{
+ UINT16 notUsed;
+ RohcParaPR_e rohcType;
+ union
+ {
+ ROHCConfig_t rohcConfig;
+ UplinkOnlyRohc_t uplinkOnlyRohc;
+ }u;
+}HeaderCompression_t;
+
+typedef struct
+{
+ UINT8 drbId;
+ UINT16 pduSessionId;
+ UINT64 ueE1apId;
+ UINT16 ueIdx;
+ UINT32 rlcState;
+ PdcpRlcMode_e rlcMode;
+ UINT8 sdapUlHeadLen;
+ UINT8 sdapDlHeadLen;
+ PdcpSnSize_e pdcpSnSizeUl;
+ PdcpSnSize_e pdcpSnSizeDl;
+ HeaderCompression_t headerCompress;
+
+ UINT8 tDiscardActive; /* TRUE/FALSE */
+ UINT8 tDiscardRun; /* TRUE/FALSE */
+ UINT16 tDiscard; /* ms */
+ ModuleMsg_t *pDiscardMsg;
+
+ UINT8 tReorderActive; /* TRUE/FALSE */
+ UINT8 tReorderRun; /* TRUE/FALSE */
+ UINT16 tReorder; /* ms */
+ ModuleMsg_t *pReorderMsg;
+ LONG tReorderId;
+
+ MoreThanOneRLCContext moreThanOneRLCContext;
+ UINT8 integrityProtection; /* TRUR: used, FALSE: not used */
+ UINT8 outOfOrderDelivery;
+ UINT8 ciperingEnabled; /* TRUR: used, FALSE: not used */
+ PdcpStateVar_t stateVar;
+
+ plist pTxPduList; /* transmitting buffer */
+ ULONG txListLock; /* txListLock */
+
+ plist pRxSduList; /* receiving buffer */
+ ULONG rxListLock; /* rxListLock */
+}PdcpDrbEntity_t;
+
+typedef struct
+{
+ UINT64 ueE1apId;
+ UINT16 ueIdx;
+ UINT32 kUpEnc[4]; /* 128 bit */
+ UINT32 kUpInt[4]; /* 128 bit */
+ UINT32 nh[8]; /* Next Hop parameter 256 bit */
+ UINT8 ncc; /* maximum: 3bit */
+ UINT8 encAlgorithm; /* Encryption Algorithm */
+ UINT8 intAlgorithm; /* Integrity Algorithm */
+ UINT8 encActiveFlag; /* define whether the encryption function has been activated */
+ UINT8 intActiveFlag; /* define whether the integrity protection function has been activated */
+ UINT8 nhInd; /* 1: nh existed 0: not existed */
+}PdcpuSecInfo_t;
+
+typedef struct
+{
+ UINT16 ueIdx;
+ CuupBearerStatus_e ueStatus;
+ PdcpuSecInfo_t *secInfo;
+ PdcpuSecEnableInfo_t *secEnableInfo[CUUP_MAX_SESSION_NUM];
+ PdcpDrbEntity_t *pdcpDrbEntity[MAX_DRB_NUM];
+}PdcpuUeInfo_t;
+
+typedef struct
+{
+ UINT16 ueIdx;
+ UINT8 drbId;
+}PdcpuDrbIdx_t;
+
+
+#endif /* PDCP_U_H */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+#ifndef PDCPU_CORE_H
+#define PDCPU_CORE_H
+
+#include "vos_types.h"
+#include "cuModuleInterface.h"
+#include "upcContext.h"
+
+extern VOID pdcpuFreeDataBuffNode(VOID *p);
+
+extern INT32 pdcpuCreateEntity(UINT64 ueE1apId, UINT16 ueIdx, UINT16 pduSessionId, upcTempDrbInfo_t *pDrbItem);
+
+extern INT32 pdcpuModCreateEntity(UINT64 ueE1apId, UINT16 ueIdx, UINT16 pduSessionId, upcTempDrbInfo_t *pDrbItem);
+
+extern INT32 pdcpuUpdateEntity(UINT16 ueIdx, UINT16 pduSessionId, upcTempDrbInfo_t *pDrbItem);
+
+extern INT32 pdcpuDeleteEntity(UINT16 ueIdx, UINT8 drbId);
+
+extern INT32 pdcpuDiscardByHighestDelivSn(UINT16 ueIdx, UINT8 drbId, UINT32 sn);
+
+extern INT32 pdcpuRetransmit(UINT16 ueIdx, UINT8 drbId, UINT32 f1uSnStart, UINT32 f1uSnEnd);
+
+#endif /* PDCPU_CORE_H */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+#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 */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+#ifndef __PLAT_ALARM_H__
+#define __PLAT_ALARM_H__
+#include "vos_types.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+#include "vos_common.h"
+
+
+
+/** trap OID 长度 */
+#define TRAP_OID_LEN (32)
+
+/** 告警源信息中index最大个数 */
+#define ALARM_INDEX_MAX_LEN 5
+
+/** 告警源信息中所携带数据大小 *sizeof(ULONG) */
+#define MAXLEN_EVENT_DATA 16
+
+/** 记录告警源信息 */
+typedef union alarmSrc_s{
+ ULONG alarmSrcData[MAXLEN_EVENT_DATA]; ///< 告警数据
+}__attribute__((packed)) alarmSrc_t;
+
+
+/**
+* 告警消息
+*/
+typedef struct alarmMsg_s
+{
+ UCHAR alarmType; ///< 告警类型
+ UCHAR alarmId; ///< 告警标识:用于映射告警描述
+ alarmSrc_t alarmSrc; ///< 告警源信息
+}__attribute__((packed))alarmMsg_t;
+
+
+typedef struct {
+ ULONG year :6;
+ ULONG month :4;
+ ULONG day :5;
+ ULONG hour :5;
+ ULONG minute :6;
+ ULONG second :6;
+}__attribute__((packed)) logDateAndTime_t;
+
+/**
+* 用于当前告警和历史告警存储
+*/
+typedef struct {
+ ULONG sequenceID; ///< 告警序号
+ UCHAR alarmType; ///< 告警类型
+ UCHAR alarmId; ///< 告警标识:用于映射告警描述
+ alarmSrc_t alarmSrc; ///< 告警源
+ logDateAndTime_t alarmTime; ///< 告警发生时间
+ logDateAndTime_t clearTime; ///< 告警清除时间
+ UCHAR alarmMskFlg; ///< 告警屏蔽标记
+ UCHAR alarmInvFlg; ///< 告警翻转标记
+ UCHAR reserved[2]; ///< 保留字段
+} __attribute__((packed)) alm_status_t;
+
+/**
+ * 通用告警上报API,使用变长参数,变长参数只支持ULONG 和char * 字符串。
+ * 设备索引和上报参数依次排列,不能乱序。
+ * @param[in] alarmType 告警类型
+ * @param[in] alarmId 告警ID
+ * @return VOS_OK - 成功,VOS_ERROR- 失败
+ */
+LONG alarm_commonReport( LONG alarmType, LONG alarmId, ... );
+
+
+/**
+ * 根据 alarmType 和 alarmId 获取告警 TrapOid。
+ * @param[in ] alarmType 告警类型
+ * @param[in ] alarmId 告警ID
+ * @param[out] pTrapOid 存放oid 的数组
+ * @param[out] pOidLen oid长度
+ * @return 成功返回 VOS_OK ,失败返回 其他
+ */
+LONG alarm_TrapOid_get( ULONG alarmType, ULONG alarmId, ULONG pTrapOid[TRAP_OID_LEN], LONG *pOidLen );
+
+
+/**
+ * 根据 alarmType 和 alarmId 获取告警 level。
+ * @param[in] alarmType 告警类型
+ * @param[in] alarmId 告警ID
+ * @return 成功返回告警 level,失败返回 0
+ */
+ULONG alarm_Level_get( ULONG alarmType, ULONG alarmId );
+
+
+/**
+ * 根据 alarmType 和 alarmId 获取告警 trap使能。
+ * @param[in] alarmType 告警类型
+ * @param[in] alarmId 告警ID
+ * @return 返回告警 trap是否使能
+ */
+ULONG alarm_TrapEnable_get( ULONG alarmType, ULONG alarmId );
+
+
+/**
+ * 根据 alarmType 和 alarmId 获取告警 index个数。
+ * @param[in] alarmType 告警类型
+ * @param[in] alarmId 告警ID
+ * @return 返回告警 index个数
+ */
+ULONG alarm_IndexNum_get( ULONG alarmType, ULONG alarmId );
+
+
+/**
+ * 根据 alarmType 和 alarmId 获取告警 参数个数。
+ * @param[in] alarmType 告警类型
+ * @param[in] alarmId 告警ID
+ * @return 返回告警 参数个数
+ */
+ULONG alarm_ParaNum_get( ULONG alarmType, ULONG alarmId );
+
+
+/**
+ * 根据 alarmType 和 alarmId 获取告警 index打印格式。
+ * @param[in ] alarmType 告警类型
+ * @param[in ] alarmId 告警ID
+ * @param[out] fmt index打印格式
+ * @return 成功返回 VOS_OK ,失败返回 其他
+ */
+LONG alarm_IndexFormat_get( ULONG alarmType, ULONG alarmId ,CHAR *fmt);
+
+
+/**
+ * 根据 alarmType 和 alarmId 获取告警 参数打印格式。
+ * @param[in ] alarmType 告警类型
+ * @param[in ] alarmId 告警ID
+ * @param[out] fmt 参数打印格式
+ * @return 成功返回 VOS_OK ,失败返回 其他
+ */
+LONG alarm_ParaFormat_get( ULONG alarmType, ULONG alarmId ,CHAR *fmt);
+
+
+
+/**
+ * 根据 alarmType 和 alarmId 获取告警 priority
+ * @param[in] alarmType 告警类型
+ * @param[in] alarmId 告警ID
+ * @return 成功返回告警 priority,失败返回 0
+ */
+ULONG alarm_Priority_get( ULONG alarmType, ULONG alarmId );
+
+/**
+ * 根据 alarmType 和 alarmId 获取告警 PartnerId
+ * @param[in] alarmType 告警类型
+ * @param[in] alarmId 告警ID
+ * @return 成功返回告警 PartnerId,失败返回 0
+ */
+ULONG alarm_PartnerId_get( ULONG alarmType, ULONG alarmId );
+
+/**
+ * 判断该告警是否为事件
+ * @param[in] alarmType 告警类型
+ * @param[in] alarmId 告警ID
+ * @return 为事件返回真,为告警返回false
+ */
+BOOL alarm_is_event( ULONG alarmType, ULONG alarmId );
+
+/**
+ * 将告警数据转换成字符串
+ * @param[in] pAlmMsg 告警数据
+ * @param[in] logDesc 存放转换后的结果
+ * @param[in] size logDesc 的大小,建议大小512字节
+ * @return 返回指向转换结果的指针(同logDesc)
+ */
+CHAR *alarmDataToStrings( alarmMsg_t *pAlmMsg, CHAR *logDesc,LONG size );
+
+/**
+ * 获取当前告警的第一条。
+ * @param[out] pItem 告警条目
+ * @return 成功返回 VOS_OK ,失败返回 其他
+ */
+LONG alarm_alm_cur_list_get_first(alm_status_t *pItem);
+
+
+/**
+ * 获取当前告警的下一条。
+ * @param[in ] pItem 当前条目
+ * @param[out] pItem 下一条目
+ * @return 成功返回 VOS_OK ,失败返回 其他
+ */
+LONG alarm_alm_cur_list_get_next(alm_status_t *pItem);
+
+
+/**
+ * 获取历史告警的第一条。
+ * @param[out] pItem 告警条目
+ * @return 成功返回 VOS_OK ,失败返回 其他
+ */
+LONG alarm_alm_hist_list_get_first(alm_status_t *pItem);
+
+
+/**
+ * 获取历史告警的下一条。
+ * @param[in ] pItem 当前条目
+ * @param[out] pItem 下一条目
+ * @return 成功返回 VOS_OK ,失败返回 其他
+ */
+LONG alarm_alm_hist_list_get_next(alm_status_t *pItem);
+
+/**
+ * 获取事件的第一条。
+ * @param[in ] pItem 当前条目
+ * @return 成功返回 VOS_OK ,失败返回 其他
+ */
+LONG alarm_alm_event_list_get_first(alm_status_t *pItem);
+
+
+/**
+ * 获取事件的下一条。
+ * @param[in ] pItem 当前条目
+ * @param[out] pItem 下一条目
+ * @return 成功返回 VOS_OK ,失败返回 其他
+ */
+LONG alarm_alm_event_list_get_next(alm_status_t *pItem);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __PLAT_ALARM_H__ */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+
+#ifndef __PLAT_DB_H__
+#define __PLAT_DB_H__
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+#include "vos_types.h"
+#include "vos_lib.h"
+
+/** 最多的表数 */
+#define DB_MAX_TABLE 200
+
+
+/** 表名最大长度 */
+#define DB_TABLE_NAME_LEN 40
+
+/** 列名最大长度 */
+#define DB_COLUMN_NAME_LEN 40
+
+/** 表的最大列数 */
+#define DB_TABLE_COLUMNS_MAX 40
+
+/** 默认值最大长度 */
+#define DB_DEFAULTVAL_LEN 2048
+
+/** 外键最大长度 */
+#define DB_FKEY_LEN (DB_TABLE_NAME_LEN+DB_COLUMN_NAME_LEN)
+
+/** filer子元素最大个数 */
+#define DB_FILTER_SUB_NUM 8
+
+#define DB_FILTER_SUB_VAL_NUM 8
+
+/** INTEGER类型数据长度 */
+#define DB_INTEGER_LEN 8
+
+
+/** TIME类型数据长度 */
+#define DB_TIME_LEN 16
+
+
+/** 时间字符串数据长度 */
+#define DB_TIME_STR_MAX_LEN 22
+
+/** MAC地址类型数据长度 */
+#define DB_MAC_ADDR_STR_MAX_LEN 18
+
+/** IPV4地址类型数据长度 */
+#define DB_IPV4_ADDR_STR_MAX_LEN 16
+
+/** IPV6地址类型数据长度 */
+#define DB_IPV6_ADDR_STR_MAX_LEN 40
+
+
+#define DB_FILTER_OP_STR_LEN 10
+
+/** 初始化函数名最大长度 */
+#define DB_TABLE_INIT_FUNC_NAME_LEN 100
+
+/** 数据库的数据类型 */
+typedef enum DB_data_type_e{
+ DB_DATA_TYPE_INTEGER = 1L, ///< 数值型
+ DB_DATA_TYPE_STR , ///< 字符串型
+ DB_DATA_TYPE_DATETIME , ///< 时间型
+ DB_DATA_TYPE_MAC , ///< MAC地址型
+ DB_DATA_TYPE_IPV4_ADDR , ///< IPv4地址型
+ DB_DATA_TYPE_IPV6_ADDR , ///< IPv6地址型
+ DB_DATA_TYPE_BUFFER , ///< buffer型
+ DB_DATA_TYPE_MAX
+}DB_data_type_t;
+
+
+/** 数据库的查询的比较类型 */
+typedef enum DB_filter_sub_type_e{
+ DB_FILTER_SUB_TYPE_EQUAL = 1, ///< 相等
+ DB_FILTER_SUB_TYPE_N_EQUAL , ///< 不相等
+ DB_FILTER_SUB_TYPE_GREAT , ///< 大于
+ DB_FILTER_SUB_TYPE_LESS , ///< 小于
+ DB_FILTER_SUB_TYPE_GREAT_EQ , ///< 大于等于
+ DB_FILTER_SUB_TYPE_LESS_EQ , ///< 小于等于
+ DB_FILTER_SUB_TYPE_INCLUDE , ///< 包含
+ DB_FILTER_SUB_TYPE_EXCLUDE , ///< 不包含
+ DB_FILTER_SUB_TYPE_MAX
+}DB_filter_sub_type_t;
+
+/** filter的组合方式 */
+typedef enum DB_filter_option_e{
+ DB_FILTER_OPTION_AND = 1, ///< 与
+ DB_FILTER_OPTION_OR , ///< 或
+ DB_filter_TYPE_MAX
+}DB_filter_option_t;
+
+/** 排序方式 */
+typedef enum DB_order_type_e{
+ DB_ORDER_TYPE_ASCEND = 0, ///< 升序(默认)
+ DB_ORDER_TYPE_DESCEND = 1, ///< 降序
+ DB_ORDER_TYPE_MAX
+}DB_order_type_t;
+#define DB_ORDER_TYPE_DESCEND_STR "DESC"
+
+/** 排序信息 */
+typedef struct DB_order_s{
+ CHAR col_name[DB_COLUMN_NAME_LEN];
+ DB_order_type_t type; ///< 默认升序
+}DB_order_t;
+
+
+/** 数据库数据的值 */
+typedef union DB_data_val_u{
+ LONG integerVal;
+ CHAR strVal[DB_DEFAULTVAL_LEN];
+ CHAR datetimeVal[DB_DEFAULTVAL_LEN];
+ CHAR macVal[DB_MAC_ADDR_STR_MAX_LEN];
+ CHAR ipv4_addrVal[DB_IPV4_ADDR_STR_MAX_LEN];
+ CHAR ipv6_addrVal[DB_IPV6_ADDR_STR_MAX_LEN];
+}VOS_PACKED DB_data_val_t;
+
+
+/** 列信息 */
+typedef struct DB_column_info_s{
+ CHAR name[DB_COLUMN_NAME_LEN]; ///< 列名
+ LONG type; ///< 数据的类型
+ LONG size; ///< 对于BUFFER和STR 类型,代表BUFFER 和 STR(包含字符串结尾 '\0') 占用的字节数
+ LONG pkey; ///< 主键标志
+ CHAR fkey[DB_FKEY_LEN]; ///< 外键,表名+.+列名的字符串,格式为 table(column),字符串长度为 0 则表示不是外键
+ DB_data_val_t defaultVal; ///< 默认值
+}VOS_PACKED DB_column_info_t;
+
+/** 数据库句柄 */
+typedef struct DB_database_s{
+ CHAR path[FILE_PATH_MAX]; ///< 文件路径
+ VOID *handle; ///< 被打开的数据库
+ LONG seqID;
+}DB_database_t;
+
+/** 数据库查询结果的行句柄 */
+typedef ULONG DB_row_handle_t;
+
+
+/** 数据初始化函数回调函数原型
+* 无参数,返回 VOS_OK 表示成功
+*/
+typedef LONG (*DB_table_init_func_t)(VOID);
+
+/** 表信息 */
+typedef struct DB_table_info_s{
+ CHAR name[DB_TABLE_NAME_LEN]; ///< name 表名
+ LONG max_row; ///< 静态表标志,1为静态表,0为动态表
+ DB_table_init_func_t table_init_func; ///< 表初始化函数,可以为空
+ CHAR table_init_func_name[DB_TABLE_INIT_FUNC_NAME_LEN];
+}DB_table_info_t;
+
+/** filer子元素 */
+typedef struct DB_query_filter_sub_s{
+ CHAR col_name[DB_COLUMN_NAME_LEN]; ///< name 表名
+ DB_data_val_t val[DB_FILTER_SUB_VAL_NUM];
+ DB_filter_sub_type_t sub_type;
+ DB_filter_option_t option;
+}DB_query_filter_sub_t;
+
+/** filer */
+typedef struct DB_query_filter_s{
+ DB_query_filter_sub_t sub[DB_FILTER_SUB_NUM];
+ DB_filter_option_t option;
+}DB_query_filter_t;
+
+
+/** 排序方式 */
+typedef enum DB_ret_code_e{
+ DB_RET_CODE_OK = 0, ///< 执行成功
+ DB_RET_CODE_table_already_exist , ///< 表已存在
+ DB_RET_CODE_table_not_exist , ///< 表已存在
+ DB_RET_CODE_table_info_already_exist , ///< 表的信息在数据库管理表中已存在(由数据库模块问题导致)
+ DB_RET_CODE_col_info_already_exist , ///< 表的列信息在数据库管理表中已存在(由数据库模块问题导致)
+ DB_RET_CODE_table_info_not_exist , ///< 表的信息在数据库管理表中不存在(由数据库模块问题导致)
+ DB_RET_CODE_col_info_not_exist , ///< 表的列信息在数据库管理表不中已存在(由数据库模块问题导致)
+ DB_RET_CODE_table_info_add_error , ///< 数据库模块添加表信息失败
+ DB_RET_CODE_col_info_add_error , ///< 数据库模块添加列信息失败
+ DB_RET_CODE_get_col_size_error , ///< 获取列大小失败
+ DB_RET_CODE_row_data_have_more , ///< row_handle 中还有数据
+ DB_RET_CODE_row_data_done , ///< row_handle 中没有数据
+ DB_RET_CODE_row_data_pk_exist , ///< 添加的数据主键冲突
+ DB_RET_CODE_table_full , ///< 表已满,无法在添加数据
+
+ DB_RET_CODE_error, ///< 其他错误
+ DB_RET_CODE_max, ///<
+}DB_ret_code_t;
+
+
+/**
+ * 打开平台数据库
+ * @param[out] db 成功时返回被打开的数据
+ * @return 成功返回 VOS_OK,失败则返回其他
+ */
+LONG DB_open_plat_db(DB_database_t *db);
+
+
+/**
+ * 关闭平台数据库
+ * @param[in ] db 要操作的数据库
+ * @return 成功返回 VOS_OK,失败则返回其他
+ */
+LONG DB_close_plat_db(DB_database_t *db);
+
+
+/**
+ * 查看表是否存在
+ * @param[in ] db 要操作的数据库
+ * @param[in ] table_name 表名
+ * @param[out] retCode 数据库执行结果,如果不关心可以填 NULL,如果关心需要传入timeout,等待时间
+ * @param[in ] timeout 等待执行结果的时间,单位 秒
+ * @return 返回向数据库模块发送消息的结果,成功返回 VOS_OK,失败则返回其他,
+ */
+BOOL DB_table_exist(DB_database_t *db,const CHAR *table_name,
+ LONG *retCode,LONG timeout);
+
+
+/**
+ * 在指定数据库中创建表
+ * @param[in ] db 要操作的数据库
+ * @param[in ] table 表信息
+ * @param[in ] cols 表的列定义数组,数组最后一个成员的name为空做为数组结尾
+ * @param[out] retCode 数据库执行结果,如果不关心可以填 NULL,如果关心需要传入timeout,等待时间
+ * @param[in ] timeout 等待执行结果的时间,单位 秒
+ * @return 返回向数据库模块发送消息的结果,成功返回 VOS_OK,失败则返回其他,
+ */
+LONG DB_table_create(DB_database_t *db,DB_table_info_t *table,DB_column_info_t cols[],
+ LONG *retCode,LONG timeout);
+
+
+/**
+ * 在指定数据库中删除表
+ * @param[in ] db 要操作的数据库
+ * @param[in ] name 表名
+ * @param[out] retCode 数据库执行结果,如果不关心可以填 NULL,如果关心需要传入timeout,等待时间
+ * @param[in ] timeout 等待执行结果的时间,单位 秒
+ * @return 返回向数据库模块发送消息的结果,成功返回 VOS_OK,失败则返回其他,
+ */
+LONG DB_table_delete(DB_database_t *db,const CHAR name[DB_TABLE_NAME_LEN],
+ LONG *retCode,LONG timeout);
+
+
+/**
+ * 向表中插入一行数据
+ * @param[in ] db 要操作的数据库
+ * @param[in ] table_name 要操作的表名
+ * @param[in ] data 要插入的数据,需按照创建表时定义的按顺序和大小排列每项数据,
+ 可以传入按1字节对齐的结构体。
+ * @param[out] retCode 数据库执行结果,如果不关心可以填 NULL,如果关心需要传入timeout,等待时间
+ * @param[in ] timeout 等待执行结果的时间,单位 秒
+ * @return 返回向数据库模块发送消息的结果,成功返回 VOS_OK,失败则返回其他,
+ */
+LONG DB_table_row_add(DB_database_t *db,const CHAR table_name[DB_TABLE_NAME_LEN],VOID *data,
+ LONG *retCode,LONG timeout);
+
+
+/**
+* 查询数据
+* @param[in ] db 要操作的数据库
+* @param[in ] table_name 要操作的表名
+* @param[out] row_handle 查询到的行句柄
+* @param[in ] filter 查询时的过滤条件,为NULL 表示没有过滤条件,查询所有行
+* @param[in ] filter_num filter的个数
+* @param[in ] order 查询结果排序方式
+* @param[in ] order_num order的个数
+* @param[out] retCode 数据库执行结果,如果不关心可以填 NULL,如果关心需要传入timeout,等待时间
+* @param[in ] timeout 等待执行结果的时间,单位 秒
+* @return 返回向数据库模块发送消息的结果,成功返回 VOS_OK,失败则返回其他,
+*/
+LONG DB_table_row_query(DB_database_t *db,const CHAR table_name[DB_TABLE_NAME_LEN],DB_row_handle_t *row_handle,
+ DB_query_filter_t filter[],LONG filter_num,DB_order_t order[],LONG order_num,
+ LONG *retCode,LONG timeout);
+
+
+
+/**
+* 获取行句柄当前行数据,并自动指向下一行,当没下一行数据时,句柄会被销毁,不可再用
+* @param[in ] db 要操作的数据库
+* @param[in ] table_name 要操作的表名
+* @param[in] row_handle 行句柄
+* @param[out] data 获取到的数据,按照创建表时定义的按顺序和大小排列每项数据,
+ 可以传入按1字节对齐的结构体指针。
+* @param[out] retCode 数据库执行结果,如果不关心可以填 NULL,如果关心需要传入timeout,等待时间
+* @param[in ] timeout 等待执行结果的时间,单位 秒
+* @return 返回向数据库模块发送消息的结果,成功返回 VOS_OK,失败则返回其他,
+*/
+LONG DB_table_row_data_pop(DB_database_t *db,const CHAR table_name[DB_TABLE_NAME_LEN],
+ DB_row_handle_t *row_handle,VOID *data,
+ LONG *retCode,LONG timeout);
+
+/**
+* 销毁行句柄
+* @param[in ] db 要操作的数据库
+* @param[in ] table_name 要操作的表名
+* @param[in ] row_handle 行句柄
+* @param[out] retCode 数据库执行结果,如果不关心可以填 NULL,如果关心需要传入timeout,等待时间
+* @param[in ] timeout 等待执行结果的时间,单位 秒
+* @return 返回向数据库模块发送消息的结果,成功返回 VOS_OK,失败则返回其他,
+*/
+LONG DB_table_row_handle_destroy(DB_database_t *db,const CHAR table_name[DB_TABLE_NAME_LEN],DB_row_handle_t *row_handle,
+ LONG *retCode,LONG timeout);
+
+
+/**
+* 删除行
+* @param[in ] db 要操作的数据库
+* @param[in ] table_name 要操作的表名
+* @param[in ] filter 删除时的过滤条件,为NULL 表示没有过滤条件,删除所有行
+* @param[in ] filter_num filter的个数
+* @param[out] retCode 数据库执行结果,如果不关心可以填 NULL,如果关心需要传入timeout,等待时间
+* @param[in ] timeout 等待执行结果的时间,单位 秒
+* @return 返回向数据库模块发送消息的结果,成功返回 VOS_OK,失败则返回其他,
+*/
+LONG DB_table_row_delete(DB_database_t *db,const CHAR table_name[DB_TABLE_NAME_LEN],
+ DB_query_filter_t filter[],LONG filter_num,
+ LONG *retCode,LONG timeout);
+
+
+
+/**
+* 更新行
+* @param[in ] db 要操作的数据库
+* @param[in ] table_name 要操作的表名
+* @param[in ] newData 新的数据,需按照创建表时定义的按顺序和大小排列每项数据,
+ 可以传入按1字节对齐的结构体。
+* @param[in ] filter 更新时的过滤条件,为NULL 表示没有过滤条件,更新所有行
+* @param[in ] filter_num filter的个数
+* @param[in ] col 只会用到name成员,用于更新指定的列,为NULL 表示更新匹配行的每一列,数组最后一个成员的name为空做为数组结尾
+* @param[in ] col_num col的个数
+* @param[out] retCode 数据库执行结果,如果不关心可以填 NULL,如果关心需要传入timeout,等待时间
+* @param[in ] timeout 等待执行结果的时间,单位 秒
+* @return 返回向数据库模块发送消息的结果,成功返回 VOS_OK,失败则返回其他,
+*/
+LONG DB_table_row_update(DB_database_t *db,const CHAR table_name[DB_TABLE_NAME_LEN],VOID *newData,
+ DB_query_filter_t filter[],LONG filter_num,DB_column_info_t col[],LONG col_num,
+ LONG *retCode,LONG timeout);
+
+
+/**
+* 计算行数
+* @param[in ] db 要操作的数据库
+* @param[in ] table_name 要操作的表名
+* @param[out] row_count 查询到的行数
+* @param[in ] filter 查询时的过滤条件,为NULL 表示没有过滤条件,查询所有行
+* @param[in ] filter_num filter的个数
+* @param[out] retCode 数据库执行结果,如果不关心可以填 NULL,如果关心需要传入timeout,等待时间
+* @param[in ] timeout 等待执行结果的时间,单位 秒
+* @return 返回向数据库模块发送消息的结果,成功返回 VOS_OK,失败则返回其他,
+*/
+LONG DB_table_row_count(DB_database_t *db,const CHAR table_name[DB_TABLE_NAME_LEN],LONG *row_count,
+ DB_query_filter_t filter[],LONG filter_num,
+ LONG *retCode,LONG timeout);
+
+/**
+* 覆盖最早插入的数据,用于表行数到达上限的覆盖操作
+* @param[in ] db 要操作的数据库
+* @param[in ] table_name 要操作的表名
+* @param[in ] newData 新的数据,需按照创建表时定义的按顺序和大小排列每项数据,
+ 可以传入按1字节对齐的结构体。
+* @param[out] retCode 数据库执行结果,如果不关心可以填 NULL,如果关心需要传入timeout,等待时间
+* @param[in ] timeout 等待执行结果的时间,单位 秒
+* @return 返回向数据库模块发送消息的结果,成功返回 VOS_OK,失败则返回其他,
+*/
+LONG DB_table_overwrite_first_row( DB_database_t *db,const CHAR table_name[DB_TABLE_NAME_LEN],VOID *newData,
+ LONG *retCode,LONG timeout);
+
+
+/**
+* 将DB 的error code转换成字符串
+* @param[in ] code 错误码
+* @return 返回错误码对应的字符串
+*/
+const CHAR *DB_err_msg(LONG code);
+
+
+#ifdef __cplusplus
+}
+#endif /* end of __cplusplus */
+
+#endif /* end of __PLAT_DB_H__ */
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+#ifndef PLATFORM_INCLUDE_PLAT_SYSLOG_H_
+#define PLATFORM_INCLUDE_PLAT_SYSLOG_H_
+
+#include "vos_common.h"
+
+/** 日志等级 */
+typedef enum _tag_SYSLOG_LEVEL
+{
+ SYSLOG_CRIT = 1, ///< critical conditions
+ SYSLOG_ERR, ///< error conditions
+ SYSLOG_WARNING, ///< warning conditions
+ SYSLOG_INFO, ///< informational
+ SYSLOG_DEBUG, ///< debug info
+ VOS_SYSLOGLEVELS_NUM ///< max
+}SYSLOG_LEVEL;
+
+
+/**
+ * 日志记录
+ * @param[in] module_id 模块ID
+ * @param[in] iLog_Level Log等级
+ * @param[in] content Log内容,fmt字符串
+ * @param[in] arg... fmt中要输出的变量
+ * @return 无
+ */
+#define VOS_log(module_id, iLog_Level, content,...)\
+ VOS_SysLog(module_id, iLog_Level, __FILE__, __LINE__, __func__, content,##__VA_ARGS__);
+
+
+/**
+ * 指定参数日志记录,只支持打印 %d 类型,传参必须为INT
+ * @param[in] module_id 模块ID
+ * @param[in] iLog_Level Log等级
+ * @param[in] para_no 参数的数量,最多为5
+ * @param[in] content Log内容,fmt字符串
+ * @param[in] arg... fmt中要输出的变量
+ * @return 无
+ */
+#define VOS_Nlog(module_id, iLog_Level, para_no, content,...) \
+ VOS_NsysLog(module_id, iLog_Level, __FILE__, __LINE__, __func__, para_no, content,##__VA_ARGS__);
+
+
+/**
+ * 指定参数日志记录,只支持打印 %ld %lu %lx 类型,传参必须为LONG ULONG
+ * @param[in] module_id 模块ID
+ * @param[in] iLog_Level Log等级
+ * @param[in] para_no 参数的数量,最多为5
+ * @param[in] content Log内容,fmt字符串
+ * @param[in] arg... fmt中要输出的变量
+ * @return 无
+ */
+#define VOS_Nlog2(module_id, iLog_Level, para_no, content,...) \
+ VOS_NsysLog_2(module_id, iLog_Level, __FILE__, __LINE__, __func__, para_no, content,##__VA_ARGS__);
+
+
+/**
+ * 指定参数日志记录,只支持打印 %ld %lu %lx %d %u %x %s 类型
+ * @param[in] module_id 模块ID
+ * @param[in] iLog_Level Log等级
+ * @param[in] content Log内容,fmt字符串
+ * @param[in] arg... fmt中要输出的变量
+ * @return 无
+ */
+#define VOS_Nlog2ex(module_id, iLog_Level,content,...) \
+ VOS_NsysLog_2ex(module_id, iLog_Level, __FILE__, __LINE__, __func__,content,##__VA_ARGS__);
+
+extern VOID VOS_SysLog(ULONG module_id, ULONG iLog_Level,CONST CHAR *file, LONG lineno,CONST CHAR *func, CONST CHAR *content, ... );
+extern VOID VOS_NsysLog(ULONG module_id, ULONG iLog_Level, CONST CHAR *file, LONG lineno,CONST CHAR *func, UINT para_no, CONST CHAR * content, ... );
+extern VOID VOS_NsysLog_2(ULONG module_id, ULONG iLog_Level,CONST CHAR *file, LONG lineno,CONST CHAR *func,UINT para_no,CONST CHAR *content, ... );
+extern VOID VOS_NsysLog_2ex(ULONG module_id, ULONG iLog_Level,CONST CHAR *file, LONG lineno,CONST CHAR *func,CONST CHAR *content, ... );
+
+
+#endif /* PLATFORM_INCLUDE_PLAT_SYSLOG_H_ */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+#ifndef __PLATFORM_MODULE_NAMES_H__
+#define __PLATFORM_MODULE_NAMES_H__
+
+#include "vos_common.h"
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+
+
+
+#define MOD_NAME_VOS_MEM ("VOS_mem")
+#define MOD_NAME_VOS_LIST ("VOS_list")
+#define MOD_NAME_VOS_MODULE_MGR ("VOS_module_mgr")
+#define MOD_NAME_VOS_TASKMON ("VOS_taskMon")
+#define MOD_NAME_VOS_CLI ("VOS_cli")
+#define MOD_NAME_VOS_SOCKET ("VOS_socket")
+#define MOD_NAME_VOS_HOSTTASK ("VOS_hostTask")
+
+
+#define MOD_NAME_PLAT_ALARM ("PLAT_alarm")
+#define MOD_NAME_PLAT_ALARM_PROC ("PLAT_alarm_proc")
+#define MOD_NAME_PLAT_DB ("PLAT_DB")
+
+#define MOD_NAME_PLAT_SYSLOG ("PLAT_syslog")
+#define MOD_NAME_PLAT_SYSLOG_SUP ("PLAT_syslog_sup")
+
+#define MOD_NAME_LIB_CSTL ("cstl")
+
+#define MOD_NAME_PRINT_FLTER ("print_filter")
+
+#define MOD_NAME_US_TIMER ("usTimer")
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __PLATFORM_MODULE_NAMES_H__ */
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+#ifndef __SDAPCORE_H__
+#define __SDAPCORE_H__
+
+#include "vos_types.h"
+#include "cuModuleInterface.h"
+#include "upcContext.h"
+#include "upcCommon.h"
+
+#define UE_ACTIVITY_NOTIFY_LEVEL 1
+#define PDU_SESS_ACTIVITY_NOTIFY_LEVEL 2
+#define DRB_ACTIVITY_NOTIFY_LEVEL 3
+
+typedef struct
+{
+ UINT64 ueDataCount;
+}UeActivityNotify_t;
+
+typedef struct
+{
+ UINT64 pduDataCount[256];
+}PduSessActivityNotify_t;
+
+typedef struct
+{
+ UINT64 drbDataCount[33];
+}DrbActivityNotify_t;
+
+typedef struct
+{
+ UINT64 ueE1apId;
+ UINT8 notifyLevel; /*UE, PDU SESSION, DRB*/
+ union {
+ UeActivityNotify_t ueNotify;
+ PduSessActivityNotify_t pduSessNotify;
+ DrbActivityNotify_t drbNotify;
+ }u;
+}SdapActivityNotify_t;
+
+
+/* 1、每个实体内的Session ID、drbID、QosFlowId,都是连续的
+ 2、Session和Qos相关的信息都是以ID作为下标保存的
+ 3、DRB是以DRB ID - 1 保存的*/
+
+/* 实体的配置结果和实体的保存原则是一致的 */
+
+typedef struct
+{
+ UINT64 drbId;
+ UINT16 QosNum;
+ UINT64 Qfi[UPC_MAX_QOS_PARA_NUM];
+ UINT64 failQosNum;
+ UINT64 failQfi[UPC_MAX_QOS_PARA_NUM];
+ E1apCause_e cause[UPC_MAX_QOS_PARA_NUM];
+}SdapDrbCfgRet_t;
+
+typedef struct
+{
+ UINT64 sessId;
+ E1apCause_e sessFailCause;
+
+ /* Setup */
+ UINT16 actDrbNum;
+ UINT8 actDrbId[UPC_MAX_DRB_NUM];
+ SdapDrbCfgRet_t actDrbCfg[UPC_MAX_DRB_NUM];
+ UINT16 failDrbNum;
+ UINT64 failDrbId[UPC_MAX_DRB_NUM];
+ E1apCause_e cause[UPC_MAX_DRB_NUM];
+
+ /* Modify */
+ UINT16 modDrbNum;
+ UINT8 modDrbId[UPC_MAX_DRB_NUM];
+ SdapDrbCfgRet_t modDrbCfg[UPC_MAX_DRB_NUM];
+ UINT16 failModDrbNum;
+ UINT64 failModDrbId[UPC_MAX_DRB_NUM];
+ E1apCause_e modCause[UPC_MAX_DRB_NUM];
+}sdapSessCfgRet_t;
+
+typedef struct
+{
+ UINT64 drbId;
+ SdapCfg_t sdapCfg;
+ UINT8 qfiNum;
+ INT64 qfi[UPC_MAX_QOS_PARA_NUM];
+ QoSFlowQosItem_t qosFlowInfo[UPC_MAX_QOS_PARA_NUM];
+}SdapDrbCfg_t;
+
+typedef struct
+{
+ UINT64 sessId;
+ UINT8 drbNum;
+ UINT64 drbId[UPC_MAX_DRB_NUM];
+ SdapDrbCfg_t drbCfg[UPC_MAX_DRB_NUM];
+}SdapInstance_t;
+
+typedef struct
+{
+ UINT64 upE1apId;
+ UINT16 sessNum;
+ UINT16 sessId[UPC_MAX_SESSION_NUM];
+ SdapInstance_t sdapInstance[UPC_MAX_SESSION_NUM];
+}SdapGlobalDtat_t;
+
+typedef struct
+{
+ UINT8 QFI :6;
+ UINT8 RQI :1;
+ UINT8 RDI :1;
+}sdapDlHeader_t;
+
+typedef struct
+{
+ UINT8 QFI :6;
+ UINT8 R :1;
+ UINT8 TYPE :1;
+}sdapUlHeader_t;
+
+
+#define SDAP_HEADER_LEN 1
+
+SdapGlobalDtat_t* sdapGetUeGlobalData(UINT64 upE1apId, UINT8 *flag);
+INT32 sdapCreateInstance(UINT64 upE1apId, upcTempSessInfo_t *pSessTempInfo, sdapSessCfgRet_t *pCfgRet);
+INT32 sdapModSetupInstance(UINT64 upE1apId, upcTempSessInfo_t *pSessTempInfo, sdapSessCfgRet_t *pCfgRet);
+INT32 sdapModInstance(UINT64 upE1apId, upcTempSessInfo_t *pSessTempInfo, sdapSessCfgRet_t *pCfgRet);
+INT32 sdapDeleteDrbInfo(SdapInstance_t *pSdapInstance, UINT8 drbId);
+INT32 sdapDeleteDrbInfoOfInstance(UINT64 upE1apId, UINT8 sessId, UINT8 drbId);
+INT32 sdapDeleteInstance(UINT64 upE1apId, UINT16 sessId);
+
+#endif
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+#ifndef __SYS_MAIN_API_H__
+#define __SYS_MAIN_API_H__
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/****************************** Begin of File Body **********************/
+#include "vos_common.h"
+#ifdef PLAT_MODULE_DEVSM
+
+extern LONG sys_slot_is_master_slot( ULONG slotno );
+extern LONG devsm_module_workmode_is_master(ULONG slotno);
+extern LONG devsm_module_workmode_is_slave(ULONG slotno);
+extern LONG devsm_module_workmode_is_master_active(ULONG slotno);
+extern LONG devsm_module_workmode_is_master_standby(ULONG slotno);
+extern LONG sys_product_name_get(CHAR *str, ULONG max_len);
+extern USHORT sys_chassis_max_slotnum_get();
+extern USHORT sys_chassis_master_slotnum_get();
+extern ULONG sys_master_active_slotno_get();
+extern ULONG sys_local_module_slotno_get();
+extern ULONG sys_module_running_state_get(ULONG slotno);
+extern ULONG sys_module_is_have_cpu(ULONG slotno);
+extern ULONG sys_module_is_running(ULONG slotno);
+extern ULONG sys_module_is_ready(ULONG slotno);
+extern ULONG sys_module_is_inserted(ULONG slotno);
+extern LONG devsm_hot_get_module_type( LONG slotno );
+extern ULONG sys_module_type_get(ULONG slotno);
+extern LONG sys_module_have_pp(ULONG module_type);
+extern LONG sys_module_have_fpgapp(ULONG module_type);
+extern LONG sys_module_port_type_num(ULONG slotno, ULONG port_type);
+
+extern ULONG g_ulProductDevIndex;
+
+/** JT_SRAN设备索引 */
+#define JT_SRAN_DEV_ID (g_ulProductDevIndex)
+
+/** TRAP 类型,Dev 必须为1 */
+#define TRAP_TYPE_DEV 1
+
+/** TRAP 类型,board 必须为2 */
+#define TRAP_TYPE_BOARD 2
+
+/** TRAP 程序启动成功,AlarmID 为1*/
+#define ProgramStartSuccessAlarmID 1
+
+/** TRAP 板卡热插入事件,AlarmID 为11*/
+#define BoardHotInsertAlarmID 11
+
+/** TRAP 板卡热拔出事件,AlarmID 为12*/
+#define BoardHotPullAlarmID 12
+
+/** TRAP 板卡重启事件,AlarmID 为13*/
+#define BoardHotRebootAlarmID 13
+
+/** 设备管理模块名*/
+#define MOD_DEVSM_NAME "DEVSM_MODULE"
+
+/** 设备机框最大槽位个数 */
+#define PRODUCT_MAX_TOTAL_SLOTNUM 21
+
+/** 设备管理使用通知链发送的信息 */
+typedef struct _devsm_notify_info_s
+{
+ ULONG slotno; ///< 槽位号
+ ULONG module_type; ///< 板卡类型
+}devsm_notify_info_t;
+
+/** 设备管理通知链板卡RUNNING事件 */
+#define DEVSN_NOTIFY_MOD_RUNNING_EVENT 0X01
+
+#define CPI_HOOK_CALL(hookfunc) (NULL == (hookfunc))?(VOS_ERROR):(*hookfunc)
+
+/************************** 产品相关 ***************************/
+#define SYS_PRODUCT_NAME_GET(str, maxlen) (sys_product_name_get(str, maxlen)) /*产品名称*/
+
+/************************** 全局机框槽位相关 **************************/
+#define SYS_MASTER_ACTIVE_SLOTNO_UNKNOW (0x00) /*主用主控槽位号未知*/
+#define SYS_CHASSIS_SLOTNUM_GET (sys_chassis_max_slotnum_get()) /*产品机框的最大槽位个数*/
+#define SYS_CHASSIS_MASTER_SLOTNUM_GET (sys_chassis_master_slotnum_get()) /*产品的主控槽位个数*/
+#define SYS_MASTER_ACTIVE_SLOTNO_GET (sys_master_active_slotno_get()) /*主用主控槽位号*/
+#define SYS_CHASSIS_SLAVE_SLOTNUM (SYS_CHASSIS_SLOTNUM_GET-SYS_CHASSIS_MASTER_SLOTNUM_GET)/*产品机框的从板槽位个数*/
+#define SYS_CHASSIS_SLOTNO_ISMASTERSLOTNO(slotno) (VOS_YES == sys_slot_is_master_slot(slotno)) /*判断槽位是否为主控*/
+#define SYS_CHASSIS_SLOTNO_ISSLAVESLOTNO(slotno) (VOS_NO == sys_slot_is_master_slot(slotno)) /*判断槽位是否为从板*/
+
+
+/************************** 槽位号判断相关 **************************/
+#define SYS_SLOTNO_IS_ILLEGAL(slotno) (((slotno) > (SYS_CHASSIS_SLOTNUM_GET))||((slotno) < 1)) /*槽位不合法*/
+#define SYS_SLOT_IS_LEGAL(slot) ((slot>0) && (slot<=SYS_CHASSIS_SLOTNUM_GET)) /*槽位合法*/
+
+#define SYS_SLOT_LOOP_BEGIN(slot) for (slot = 1; slot <= SYS_CHASSIS_SLOTNUM_GET; ++slot) {
+#define SYS_SLOT_LOOP_END(slot) }
+
+#ifdef PLAT_MODULE_IFM
+#define SYS_MODULE_PORT_NUM(slotno, port_type) (sys_module_port_type_num(slotno, port_type))
+#define SYS_SLOT_PORT_IS_LEGAL(slot, port_type, port) (SYS_SLOT_IS_LEGAL(slot) && ((port>0) && (port<=SYS_MODULE_PORT_NUM(slot, port_type))))
+#endif
+
+/************************** 板卡工作模式、主备状态相关 *****************/
+#define SYS_MODULE_WORKMODE_ISMASTER(slotno) (devsm_module_workmode_is_master(slotno)) /*板卡工作模式是否为master*/
+#define SYS_MODULE_WORKMODE_ISSLAVE(slotno) (devsm_module_workmode_is_slave(slotno)) /*板卡工作模式是否为slave*/
+#define SYS_MODULE_ISMASTERACTIVE(slotno) (devsm_module_workmode_is_master_active(slotno)) /*板卡是否是主用主控*/
+#define SYS_MODULE_ISMASTERSTANDBY(slotno) (devsm_module_workmode_is_master_standby(slotno)) /*板卡是否是备用主控*/
+
+
+/********************* local板卡工作模式、主备状态相关 ****** *****************/
+#define SYS_LOCAL_MODULE_SLOTNO_GET (sys_local_module_slotno_get()) /*本板槽位号*/
+#define SYS_LOCAL_MODULE_WORKMODE_ISMASTER SYS_MODULE_WORKMODE_ISMASTER(SYS_LOCAL_MODULE_SLOTNO_GET) /*本板是否工作在master*/
+#define SYS_LOCAL_MODULE_WORKMODE_ISSLAVE SYS_MODULE_WORKMODE_ISSLAVE(SYS_LOCAL_MODULE_SLOTNO_GET) /*本板是否工作在slave*/
+#define SYS_LOCAL_MODULE_ISMASTERACTIVE SYS_MODULE_ISMASTERACTIVE(SYS_LOCAL_MODULE_SLOTNO_GET) /*本板是否是主用主控*/
+#define SYS_LOCAL_MODULE_ISMASTERSTANDBY SYS_MODULE_ISMASTERSTANDBY(SYS_LOCAL_MODULE_SLOTNO_GET) /*本板是否是备用主控*/
+
+
+/************************** 板卡公共信息相关 ***************************/
+#if 0 /*暂不对外开放,要用到再放开*/
+#define SYS_MODULE_SW_VERSION(slotno) _SYS_MODULE_SW_VERSION_(slotno) /*软件版本信息*/
+#define SYS_MODULE_NAME(slotno) _SYS_MODULE_NAME_(slotno) /*板卡名称*/
+#define SYS_MODULE_HARDWARE_VERSION(slotno) _SYS_MODULE_HARDWARE_VERSION_(slotno) /*硬件版本信息*/
+#define SYS_MODULE_MANUFACTURE_DATE(slotno) _SYS_MODULE_MANUFACTURE_DATE_(slotno) /*生产日期*/
+#define SYS_MODULE_SERIALNO(slotno) _SYS_MODULE_SERIALNO_(slotno) /*序列号*/
+#endif
+
+#define SYS_MODULE_TYPE(slotno) (devsm_hot_get_module_type(slotno)) /*include pulled module lastly*/
+
+#define __SYS_MODULE_TYPE__GET(slotno) (sys_module_type_get(slotno)) /*insert type*/
+
+#define SYS_MODULE_SLOT_ISHAVECPU(slotno) (VOS_YES == sys_module_is_have_cpu(slotno)) /*板卡是否有CPU*/
+
+#define SYS_MODULE_ISHAVEPP(type) (VOS_YES == sys_module_have_pp(type))
+#define SYS_MODULE_SLOT_ISHAVEPP(slotno) (SYS_MODULE_ISHAVEPP(__SYS_MODULE_TYPE__GET(slotno)))
+#define SYS_LOCAL_MODULE_ISHAVEPP() SYS_MODULE_SLOT_ISHAVEPP(SYS_LOCAL_MODULE_SLOTNO)
+
+#define SYS_MODULE_ISHAVEFPGAPP(type) (VOS_YES == sys_module_have_fpgapp(type))
+#define SYS_MODULE_SLOT_ISHAVEFPGAPP(slotno) (SYS_MODULE_ISHAVEFPGAPP(SYS_MODULE_TYPE(slotno)))
+
+
+/************************** 槽位运行状态相关 ***************************/
+#define SYS_MODULE_RUNNINGSTATE_GET(slotno) (sys_module_running_state_get(slotno)) /*槽位的运行状态*/
+#define SYS_LOCAL_MODULE_RUNNINGSTATE (SYS_MODULE_RUNNINGSTATE_GET(SYS_LOCAL_MODULE_SLOTNO_GET)) /*本板的运行状态*/
+#define SYS_MODULE_IS_RUNNING(slotno) (VOS_YES == sys_module_is_running(slotno)) /*槽位是否是RUNNING状态*/
+#define SYS_MODULE_IS_READY(slotno) (VOS_YES == sys_module_is_ready(slotno)) /*槽位是否是READY状态*/
+#define SYS_MODULE_IS_INSERTED(slotno) (VOS_YES == sys_module_is_inserted(slotno)) /*槽位是否在位*/
+
+extern ULONG g_SysInstallMode;
+#define SYS_MODULE_IS_INSTALL_MODE (g_SysInstallMode) /*板卡的安装模式,默认自动安装*/
+/******************************* End of File Body ***********************/
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+#ifndef __UPCCOMMON_H__
+#define __UPCCOMMON_H__
+
+#include "plat_syslog.h"
+#include "cuCommon.h"
+#include "upcContext.h"
+
+#define CONCEPT(x) 1
+
+extern UpInstance_t s_UpcGlobalData;
+
+#define UPC_MODULE_ID s_UpcGlobalData.moduleId
+
+#define upclog(level, content, arg...) VOS_SysLog(UPC_MODULE_ID, level, __FILE__, __LINE__, "", content, ##arg);
+
+#define UPC_MIN(x, y) ((x) <= (y)? (x) : (y))
+
+#define UPC_PRESENCE(bitmask,bit) ((bit) == ((bit) & (bitmask)))
+
+#define UPC_CHECK_NULL(prama) \
+{\
+ if (NULL == prama)\
+ {\
+ upclog(LOG_ERR, "UPC NULL pointer\n");\
+ VOS_ASSERT(0); \
+ return VOS_ERROR;\
+ }\
+}
+
+INT32 upcSendE1apMsg(void *pMsg, UINT64 msgLen);
+
+extern INT32 vosAdpSendAsynMsg2ModuleEx( CHAR src_moduleName[MODULE_NAME_LEN],
+ CHAR dst_moduleName[MODULE_NAME_LEN],
+ VOID *msgData,
+ LONG msgDataLen);
+INT32 upcConstructAndSendOamUpActRsp(int actNum, int failNum, CellIdList_t failCellList);
+void upcResortDrbId(UpSessCb_t *pSessCb, UINT8 drbId);
+INT32 upcCheckSessId(UpUeCb_t *pUeCb, UINT8 sessId);
+UINT32 upcCheckDrbId(UpUeCb_t *pUeCb, UINT8 drbId);
+void upcFreeTempInfo(upcTempInfo_t *pTempInfo);
+void upcCauseConvertToInterfaceType(E1apCause_e srcCause, E1apCause_t *dstCause);
+extern UINT32 cuAppGetCucommonParaNum();
+INT32 upcSendUpOamMsg(void *pMsg, UINT64 msgLen);
+INT32 upcGetBearerModFailureFlag(UINT16 bitMask, UINT8 setupFailFlag, UINT8 ModFailFlag);
+
+#ifdef NR_CUUP
+INT32 upcNotifyOmaUpConnectState(INT32 state);
+#endif
+
+#endif
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+#ifndef __UPCCONTEXT_H__
+#define __UPCCONTEXT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "gnbCommon.h"
+#include "cuModuleInterface.h"
+
+
+
+#define UPC_MAX_IP_NUM 5
+#define UPC_MAX_UP_NUM 1
+#define UPC_MAX_PLMN_NUM 2
+#define UPC_MAX_SLICE_NUM 3
+#define UPC_MAX_QOS_PARA_NUM 10
+#define UPC_MAX_UE_NUM MAX_UE_NUM
+#define UPC_MAX_SESSION_NUM 10
+#define UPC_MAX_DRB_NUM 2
+
+typedef struct
+{
+ INT64 sessId;
+ E1apCause_e cause;
+}SessFailitem_t;
+
+typedef struct
+{
+ INT16 drbId;
+ E1apCause_e cause;
+}DrbFailitem_t;
+
+typedef struct
+{
+ UINT8 qosFlowId;
+ E1apCause_e cause;
+}qosFailitem_t;
+
+typedef struct
+{
+ UINT8 qosSetupAllowed;
+ UINT8 qosModAllowed;
+
+ UINT8 qosFlowId;
+
+ /* QOS Info Begin */
+ QosFlowLevelQosPar_t qosPara;
+
+ UINT8 qosMapFlag;
+ QosFlowMapInd_e qosFlowMapInd;
+ /* QOS Info End */
+
+ E1apCause_e qosSetFailCause;
+ E1apCause_e qosModFailCause;
+}upcTempQosInfo_t;
+
+typedef struct
+{
+ UINT8 drbSetupAllowed;
+ UINT8 drbModAllowed;
+
+ UINT8 drbId;
+
+ UINT16 qosSetupNum;
+ UINT16 qosSetupSuccNum;/* 最终建立成功的个数 */
+ UINT16 qosSetupFailNum;/* 最终建立失败的个数 */
+
+ UINT16 qosModNum;
+ UINT16 qosModSuccNum;/* 最终建立成功的个数 */
+ UINT16 qosModFailNum;/* 最终建立失败的个数 */
+
+ upcTempQosInfo_t *pQosSetupList;
+ upcTempQosInfo_t *pQosModList;
+
+ /* DRB Info --Begin */
+
+ UINT8 sdapFlag;/* Only Mod Optional */
+ SdapCfg_t sdapConfig;
+
+ UINT8 pdcpFlag;/* Only Mod Optional */
+ PDCPConfiguration_t pdcpConfig;
+ CellGroupInformation_t cellGroupInfo;
+
+ CellGroupInformation_t cellGroupToAdd;/* Only Mod Optional */
+ CellGroupInformation_t cellGroupToMod;/* Only Mod Optional */
+ CellGroupInformation_t cellGroupToRemove;/* Only Mod Optional */
+
+ UINT8 DFIReqFlag;
+ DFIRequest_t drbDFIReq;
+ UINT8 DFIRspFlag;/* Only Mod Optional */
+ DFIResponse_t drbDFIRsp;
+
+ UINT8 inactTimeFlag;
+ INT64 inactivityTimer;
+
+ UINT8 pdcpSNStatuFlag;
+ PdcpSNStatusInfo_t pdcpSNStatusInfo;
+
+ PdcpSNStatusRequest_e pdcpSNStatusReq;
+
+ UPParametersList_t f1UlUpPara;
+ UINT8 f1DlUpParaFlag;/* Only Mod Optional */
+ UPParametersList_t f1DlUpPara;
+
+ UINT8 pdcpUlCntFlag;
+ PdcpCount_t pdcpUlCount;
+
+ UINT8 pdcpDlCntFlag;
+ PdcpCount_t pdcpDlConut;
+
+ /* DRB Info -- end */
+
+ E1apCause_e drbSetFailCause;
+ E1apCause_e drbModFailCause;
+}upcTempDrbInfo_t;
+
+typedef struct
+{
+ UINT8 sessSetupAllowed;
+ UINT8 sessModAllowed;
+
+ UINT16 pduSessId;
+
+ UINT16 drbSetupNum;
+ UINT16 drbSetupSuccNum;/* 最终建立成功的个数 */
+ UINT16 drbSetupFailNum;/* 最终建立失败的个数 */
+
+ UINT16 drbModNum; /* 最初请求修改的个数 */
+ UINT16 drbModSuccNum; /* 最终修改成功的个数 */
+ UINT16 drbModFailNum; /* 最终修改失败的个数 */
+
+ UINT8 drbRemoveNum;
+ UINT8 drbRemoveId[UPC_MAX_DRB_NUM];
+
+ upcTempDrbInfo_t *pTempDrbSetupList;
+ upcTempDrbInfo_t *pTempDrbModList;
+
+ /* Session Info --Begin */
+ PduSessType_e pduSessionType;
+ SNssai_t snssai;
+
+ UINT8 secuIndiFlag;/* Only Mod Optional */
+ SecuInd_t secuIndi;
+ SecuResult_t securityResult;
+
+ UINT8 ulUpChgFlag;/* Only Mod Optional */
+ UpTransLayerInfo_t ulUpTNLInfo;
+
+ UINT8 dlAMBRFlag;
+ UINT64 sessDlAMBR;
+
+ UINT8 DFIReqFlag;
+ DFIRequest_t DFIInfoReq;
+ UINT8 DFIRspFlag;/* Only Mod Optional */
+ DFIResponse_t DFIInfoRsp;
+
+ UINT8 InactTimerFlag;
+ INT64 inactTimer;
+
+ UINT8 dlNGupTnlFlag;
+ UpTransLayerInfo_t dlNgUpTnlInfo;
+ UINT8 dlNgUpChgFlag;
+
+ UINT8 InstanceFlag;
+ INT64 networkInstance;
+ /* session Info --End */
+
+ E1apCause_e sessSetFailCause;
+ E1apCause_e sessModFailCause;
+}upcTempSessInfo_t;
+
+
+typedef struct
+{
+ struct upUeCb *pUeCb;
+
+ UINT16 sessSetupNum; /* 最初请求建立的个数 */
+ UINT16 sessSetupSuccNum;/* 最终建立成功的个数 */
+ UINT16 sessSetupFailNum;/* 最终建立失败的个数 */
+
+ UINT16 sessModNum; /* 最初请求修改的个数 */
+ UINT16 sessModSuccNum; /* 最终修改成功的个数 */
+ UINT16 sessModFailNum; /* 最终修改失败的个数 */
+
+ upcTempSessInfo_t *pTempSessSetupList;
+ upcTempSessInfo_t *pTempSessModList;
+
+
+ /* Content --Begin */
+ UINT8 secuInfoFlag;/* Only Mod Optional */
+ SecuInfo_t secuInfo;
+
+ UINT8 dlAmbrFlag;/* Only Mod Optional */
+ UINT64 ueDlAMBR;
+
+ PlmnId_t servPlmnId;
+ ActNotiLevel_e actNotiLevel;
+
+ UINT8 dlIPDRFlag;
+ UINT64 ueDlMaxIPDR;
+
+ UINT8 inactTimeFlag;
+ INT64 inactTimer;
+
+ UINT8 bearStaChageFlag;
+ BearCxtStatusChange_e bearerCxtStatusChg;
+
+ UINT8 newTnlInfoReqFlag;/* Only Mod Optional */
+ NewUlTnlInfoRequire_e newTnlInfoReq;
+
+ UINT8 dataDisFlag;/* Only Mod Optional */
+ DataDisRequire_e dataDisRequire;
+ /* Content --End */
+}upcTempInfo_t;
+
+
+struct upSessCb;
+struct upUeCb;
+struct upInstance;
+typedef struct upDrbCb
+{
+ UINT8 useFlag;
+ INT64 drbId;
+
+ SdapCfg_t sdapConfig;
+ PDCPConfiguration_t pdcpConfig;
+ UPParametersList_t f1UlUpPara;
+ UPParametersList_t f1DlUpPara;
+ CellGroupInformation_t cellGroupInfo;
+
+ /* QOS INFO */
+ QosFlowQosPara_t qosFlowPara;
+
+ UINT8 DFIFlag;
+ DFIRequest_t dataForInfoReq;
+
+
+ PdcpSNStatusInfo_t pdcpSNStatusInfo;
+ struct upSessCb *pSessionCb;
+}UpDrbCb_t;
+
+typedef struct upSessCb
+{
+ UINT8 useFlag;
+ UINT16 sessId;
+ PduSessType_e sessType;
+ SNssai_t sNSsai;
+
+ SecuInd_t secuInd;
+ SecuResult_t securityResult;
+
+ UINT64 dlAMBR;
+
+ UpTransLayerInfo_t ngUlUpTransInfo;
+ UpTransLayerInfo_t ngDlUpTransInfo;
+
+ DFIRequest_t dataForInfoReq;
+
+
+
+ INT64 networkInstance;
+
+ UINT8 drbNum;
+ UpDrbCb_t *pDrbCb[UPC_MAX_DRB_NUM];
+
+ struct upUeCb *pUeCb;
+}UpSessCb_t;
+
+typedef enum upUeState_e
+{
+ UP_UE_INIT,
+ UP_UE_ACTIVE,
+ UP_UE_WAITING_INACTIVE,
+ UP_UE_INACTIVE
+}UpUeState_e;
+
+typedef struct upUeCb
+{
+ UINT8 useFlag;
+ UINT64 cpE1apId;
+ UINT64 upE1apId;
+
+ UpUeState_e ueState;
+ SecuInfo_t secuInfo;
+ UINT64 ueDlAMBR;
+ UINT64 ueDlMaxIPDR;
+ PlmnId_t plmnId;
+
+ INT64 inActTimer;
+
+ UINT16 sessNum;/* current session num */
+ UpSessCb_t *pSessCb[UPC_MAX_SESSION_NUM];
+ struct upInstance *pUpInstance;
+}UpUeCb_t;
+
+typedef struct upInstance
+{
+ Instance_t instance;
+ UINT32 moduleId;
+ UINT32 state;
+ UINT64 upId;
+ GnbCuupName_t upName;
+ GnbCucpName_t cpName;
+ INT8 upAddrNum;
+ IpAddress_t upAddr[UPC_MAX_IP_NUM];
+ INT8 cpAddrNum;
+ IpAddress_t cpAddr[UPC_MAX_IP_NUM];
+
+ INT64 upCapa;
+ UINT32 bPlmnNum;
+ E1apUpbPlmnCfgInfo_t bPlmnCfgInfo[e1ap_maxnoofSPLMNs];
+ UINT32 ueNum;
+ UpUeCb_t *pUeCb[UPC_MAX_UE_NUM];
+}UpInstance_t;
+
+UpInstance_t *upcGetInstance();
+UpUeCb_t* upcAllocUeCb(UpInstance_t *pInstance, UINT64 cuCpE1apId);
+INT32 upcSetSessionCb(UpUeCb_t * pUeCb, PduSessionResourceToSetupList_t *pPduSessionSetupList);
+void upcSetUeCb(UpUeCb_t * pUeCb, E1apBearerContextSetupReq_t *pBearerCxtSetupReq);
+UpUeCb_t* upcGetUeCbByUpUeE1apId(UpInstance_t *pInstance, UINT64 cuUpE1apId);
+void upcRemoveSessionCb(UpUeCb_t * pUeCb, PduSessionResourceToRemoveList_t *pRemoveList);
+UpSessCb_t *upcGetSessCb(UpUeCb_t *pUeCb, UINT8 pduSessId);
+UpDrbCb_t *upcGetDrbCb(UpSessCb_t *pSessCb, UINT8 drbId);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+
+#ifndef _VOS_BYTEORDER_H_
+#define _VOS_BYTEORDER_H_
+
+#ifdef __cplusplus
+extern "C"{
+#endif /* __cplusplus */
+
+/*
+ * 下面两个宏为RPU软件定义另外字节顺序,也是
+ * 两个互斥的宏。各个产品应该根据所采用CPU的类别恰当地设置
+ * default endian is little??
+ * #include <arpa/inet.h> for ntohl, ntohs, htons, htonl
+ */
+#include <arpa/inet.h>
+
+#define VOS_LITTLE_ENDIAN (1)
+#define VOS_BIG_ENDIAN (0)
+#include <arpa/inet.h>
+
+
+#if VOS_LITTLE_ENDIAN
+
+#ifndef VOS_NTOHL /* 4字节 */
+#if 0
+#define VOS_NTOHL(x) ((((x) & 0xFF000000)>>24) | (((x) & 0x00FF0000)>>8) | \
+ (((x) & 0x0000FF00)<<8 ) | (((x) & 0x000000FF)<<24))
+#endif
+#define VOS_NTOHL(x) ntohl(x)
+#endif
+
+#ifndef VOS_NTOHS
+#define VOS_NTOHS(x) ntohs(x)
+#endif
+
+#ifndef VOS_HTONL /* 4字节 */
+#define VOS_HTONL(x) htonl(x)
+#endif
+
+#ifndef VOS_HTONS
+#define VOS_HTONS(x) htons(x)
+#endif
+
+#elif VOS_BIG_ENDIAN
+
+#ifndef VOS_NTOHL
+#define VOS_NTOHL(x) (x)
+#endif
+
+#ifndef VOS_NTOHS
+#define VOS_NTOHS(x) (x)
+#endif
+
+#ifndef VOS_HTONL
+#define VOS_HTONL(x) (x)
+#endif
+
+#ifndef VOS_HTONS
+#define VOS_HTONS(x) (x)
+#endif
+#else
+"BYTEORDER not defined"
+#endif /* VOS_LITTLE_ENDIAN */
+
+
+#ifndef HAVE_MAKEWORD
+#define HAVE_MAKEWORD
+#define MAKEWORD(a, b) ((WORD)(((BYTE)(a)) | ((WORD)((BYTE)(b))) << 8))
+#endif
+
+#ifndef HAVE_MAKELONG
+#define HAVE_MAKELONG
+#define MAKELONG(a, b) ((LONG)(((WORD)(a)) | ((DWORD)((WORD)(b))) << 16))
+#endif
+
+#ifndef HAVE_LOWORD
+#define HAVE_LOWORD
+#define LOWORD(l) ((WORD)(l))
+#endif
+
+#ifndef HAVE_HIWORD
+#define HAVE_HIWORD
+#define HIWORD(l) ((WORD)(((DWORD)(l) >> 16) & 0xFFFF))
+#endif
+
+#ifndef HAVE_LOBYTE
+#define HAVE_LOBYTE
+#define LOBYTE(w) ((BYTE)(w))
+#endif
+
+#ifndef HAVE_HIBYTE
+#define HAVE_HIBYTE
+#define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xFF))
+#endif
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _VOS_BYTEORDER_H_ */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+#ifndef __VOS_CLI_H__
+#define __VOS_CLI_H__
+#include "vos_types.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/** 历史命令记录条数 */
+#define VTY_MAXHIST 20
+
+/** 命令行提示符长度 */
+#define VTY_CMD_PROMPT_MAX 64
+
+/** 节点嵌套层数 */
+#define VTY_NODE_HIS_MAX 8
+
+/* 换行字符串 */
+#define VTY_NEWLINE ((vty->type == VTY_TERM) ? "\r\n" : "\r\n")
+
+/** show 命令说明字符串 */
+#define SHOW_STR "Show running system information\n"
+
+/** config 命令说明字符串 */
+#define CONFIG_STR "Config system's setting\n"
+
+/** no 命令说明字符串 */
+#define NO_STR "Negate a command or set its defaults\n"
+
+/** debug 命令说明字符串 */
+#define DEBUG_STR "Debugging functions\n"
+
+/** 命令回调函数返回值 命令执行 OK */
+#define CMD_RET_OK (0)
+
+/** 命令回调函数返回值 命令执行 ERROR */
+#define CMD_RET_ERROR (1)
+
+
+
+/** VOS 预定义的节点 */
+enum node_type
+{
+ VOS_CLI_VIEW_NODE, ///< View node. Default mode of vty interface.
+ VOS_CLI_CONFIG_NODE, ///< Config node. Default mode of config file.
+ VOS_CLI_DEBUG_HIDDEN_NODE, ///< Debug hidden node.
+ VOS_CLI_CONFIRM_ACTION_NODE, ///< Confirm action.
+ VOS_CLI_RESV_MAX_NODE ///< Vos max reserved node ID
+};
+
+
+struct exit_use_node
+{
+ int node_in_use; ///< 使用标记
+ enum node_type node; ///< 节点ID
+ void *context_data; ///< 记录命令行上下文数据,如进入端口节点可以记录端口号
+ INT context_data_need_free; ///< 标记context_data 是否需要free,在exit 命令中会执行VOS_free
+ CHAR vty_cmd_prompt[ VTY_CMD_PROMPT_MAX ]; ///< 自定义提示符
+};
+
+
+/** VTY 结构体,只需关心fd之前的成员. */
+struct vty
+{
+ char vty_cmd_prompt[VTY_CMD_PROMPT_MAX]; ///< 自定义提示符
+
+ VOID *context_data; ///< 记录命令行上下文数据,如进入端口节点可以记录端口号
+
+ INT context_data_need_free; ///< 标记context_data 是否需要free,在exit 命令中会执行VOS_free
+
+ int (*action_func) (struct vty *vty); ///< confirm action 的回调函数
+
+ int (*no_action_func) (struct vty *vty); ///< refuse action 的回调函数
+
+ /* 文件描述符 */
+ int fd;
+
+ /* 当前节点ID */
+ enum node_type node;
+
+ /* 上一节点ID */
+ enum node_type prev_node;
+
+ /* VTY 类型 */
+ enum { VTY_TERM, }type;
+
+ /* client IP */
+ char *address;
+
+ /* vty 输出缓冲区 */
+ struct buffer *obuf;
+
+ /* obuf 的锁 */
+ LONG Sem_obuf ;
+
+ /* vty 命令输入缓冲区 */
+ char *buf;
+
+ /* 当前光标的位置 */
+ int cp;
+
+ /* 当前输入的长度 */
+ int length;
+
+ /* buf 的大小. */
+ int max;
+
+ /* 历史命令 */
+ char *hist[VTY_MAXHIST];
+
+ /* 查看历史命令时记录当前索引 */
+ int hp;
+
+ /* 历史命令条数 */
+ int hindex;
+
+ struct exit_use_node node_his_save[VTY_NODE_HIS_MAX];
+
+ /* 转义字符状态. */
+ unsigned char escape;
+
+ /* vty 状态. */
+ enum { VTY_NORMAL, VTY_CLOSE, VTY_MORE, VTY_START, VTY_CONTINUE, VTY_IOREDIRECT }status;
+
+ /* telnet IAC handling */
+ unsigned char iac;
+
+ /* telnet IAC SB handling */
+ unsigned char iac_sb_in_progress;
+ /* telnet IAC SB buffer */
+ struct buffer *sb_buffer;
+
+ /* 窗口宽度,暂未使用 */
+ int width;
+ /* 窗口高度,lines为0时有效 */
+ int height;
+
+ /* 一次输出的做大行数 */
+ int lines;
+
+ /* 已进入config节点,用于限制多用户进入config */
+ int config;
+
+ /* 输入监控任务 */
+ struct cl_lib_thread *t_read;
+ /* 输出监控任务 */
+ struct cl_lib_thread *t_write;
+
+ /*VTY 超时时间,秒 */
+ unsigned long v_timeout;
+
+ /*VTY 超时处理任务 */
+ struct cl_lib_thread *t_timeout;
+
+ /*VTY 退出标志位 */
+ unsigned short cl_vty_exit;
+
+ /* vty 接入类型console,telnet, telnet IPv6 */
+ int conn_type;
+
+ /* vty 接入用户名 */
+ char *user_name;
+
+ /* vty 会话任务 */
+ struct cl_lib_thread_master *sub_thread_master;
+
+ /* vty 会话任务handle */
+ VOS_HANDLE sub_task_id;
+
+ /* vty 调试标志位 */
+ unsigned short debug_monitor;
+
+ /************************************
+ frozen vty in and(or) out
+ used for if a command can't return immediately
+ then call frozen to freeze vty's in and(or) out
+ call unfrozen when finished.
+ 1: freezed
+ 0: unfreezed
+ ***********************************/
+ unsigned short frozen;
+
+ //VOS_SYSLOG_MONITOR_CONF monitor_conf;
+ int veryBigOutLineCount;
+ int veryBigOutNoFirst;
+
+ /* vty 引用计数,当引用计数为0的时候调用vty_close释放内存 */
+ int ncount;
+};
+
+
+/** cl_vector 动态数组指针 */
+struct _cl_vector
+{
+ unsigned int max; ///< 当前最大索引加1
+ unsigned int alloced; ///< 数组大小 */
+ void **index; ///< 指针数组
+};
+typedef struct _cl_vector *cl_vector;
+
+
+/** 命令结构体 */
+struct cmd_element
+{
+ char *string; ///< 命令字符串,多个用空格分隔的单词组成的句子
+ int (*func) (struct cmd_element *, struct vty *, int, char **); ///< 命令回调函数
+ char *doc; ///< 命令说明,对命令字符串中的每个单词进行说明
+ int msg_flag; ///< 命令类型标识,当前只有 DEFUN_FLAG 类型
+ cl_vector strvec; ///< 将 string和doc 拆分后放入该数组中 ,存放struct desc
+ int cmdsize; ///< string 中单词个数
+ cl_vector subconfig; ///< 将 string中可以重复的单词的重复位置和重复次数等
+};
+
+
+/** 命令节点结构体 */
+struct cmd_node
+{
+ enum node_type node_id; ///< 节点ID
+ char prompt[VTY_CMD_PROMPT_MAX]; ///< 节点提示符
+ cl_vector cmd_vector; ///< 节点命令数组
+};
+
+
+#define DEFUN_FLAG 0
+
+/**
+ * 命令行定义宏
+ * @param[in] funcname 回调函数的函数名
+ * @param[in] cmdname 命令变量的变量名
+ * @param[in] cmdstr 命令字符串
+ * @param[in] helpstr 命令字符串中各个单词的注解
+ * @return 返回输出的字节数
+ */
+#define DEFUN(funcname, cmdname, cmdstr, helpstr) \
+ int funcname (struct cmd_element *, struct vty *, int, char **);\
+ struct cmd_element cmdname = {cmdstr, funcname, helpstr , DEFUN_FLAG};\
+ int funcname (struct cmd_element *self, struct vty *vty, int argc, char **argv)
+
+
+/**
+ * 命令行回调函数中的标准输出函数,
+ * 注意 LONG 输出时,要用%ld,或%lx
+ * @param[in] vty vty
+ * @param[in] format 格式字符串
+ * @param[in] ... 要输出的变量
+ * @return 返回输出的字节数
+ */
+INT vty_out ( struct vty * vty, const CHAR * format, ... );
+
+/**
+ * 创建并安装命令节点
+ * @param[in] prompt 节点提示符,用于命令行提示符的显示
+ * @return 成功返回 一个新节点的指针,失败返回NULL
+ */
+struct cmd_node *VOS_cli_create_node(char prompt[VTY_CMD_PROMPT_MAX]);
+
+
+/**
+ * 把命令安装到指定节点
+ * @param[in] node_id 节点ID
+ * @param[in] cmd 命令
+ * @return 成功返回 VOS_OK,失败返回其他
+ */
+VOID VOS_cli_install_element( enum node_type node_id, struct cmd_element * cmd );
+
+
+/**
+ * 在进入节点函数中调用,用于进入节点
+ * @param[in] vty vty
+ * @param[in] newnode 要进入的节点ID
+ * @return 成功返回 VOS_OK,失败返回其他
+ */
+LONG vty_enter_node(struct vty *vty,enum node_type newnode);
+
+
+/**
+ * 在进入节点函数中调用,用于自定义要进入节点的命令行提示符,
+ * 调用vty_enter_node后调用
+ * @param[in] vty vty
+ * @param[in] cpPrompt 提示符
+ */
+VOID vty_set_prompt( struct vty * vty, CHAR cpPrompt[VTY_CMD_PROMPT_MAX] );
+
+
+
+
+/**
+ * Completion match types. 匹配度,数值越大匹配度越高,命令行模块内部使用无需关心
+ */
+enum match_type
+{
+ no_match,
+ incomplete_match,
+ ambiguous_match,
+ extend_match,
+ vararg_match,
+ one_element_two_partly_match,
+ partly_match,
+ almost_exact_match, /* exactmatch except last word */
+ ipv4_prefix_match,
+ ipv4_match,
+ ipv6_prefix_match,
+ ipv6_match,
+
+ aann_match,
+ mac_match,
+ slot_port_match,
+ slot_subport_match,
+
+ time_match,
+ range_match,
+
+ /*其余的匹配类型在此之前*/
+ register_match,
+
+ exact_match
+};
+
+
+/** 自定义命令行参数解析函数 */
+typedef struct _cmd_notify_register_tag
+{
+ CHAR *match_str ; ///< 匹配的格式,如<H.H.H>
+ enum match_type (*pnotify_call) (CHAR *str); ///< 格式解析的回调函数,解析成功返回exact_match,解析失败返回no_match
+ CHAR IsCapital ; ///< 是否包含大写字母 0 - 全小写; 1 - 含有大写字母
+}CMD_NOTIFY_REFISTER_S;
+
+/**
+ * 添加自定义命令行参数解析函数
+ * @param[in] pNotifyRegister 自定义解析函数信息
+ * @return 成功返回 register_match,失败返回no_match
+ */
+enum match_type cmd_rugular_register(CMD_NOTIFY_REFISTER_S * pNotifyRegister);
+
+/**
+ * 配置/获取 vty超时时间
+ * @param[in ] vty vty
+ * @param[in ] newTime 新的超时时间,大于等于0时有效,0表示不会超时
+ * @param[out] oldTime 如果不为NULL 返回配置前的超时时间
+ * @return 成功返回 VOS_OK,失败则返回其他
+ */
+LONG vty_timeout_config ( struct vty * vty, LONG newTime, LONG *oldTime);
+
+
+/**
+ * 要使用vty_very_big_out 函数必须先调用此初始化函数
+ * @param[in ] vty vty
+ */
+void vty_very_big_out_init ( struct vty *vty );
+
+/**
+ * 用于长字符串打印
+ * @param[in] vty vty
+ * @param[in] format 格式字符串
+ * @param[in] ... 要输出的变量
+ */
+int vty_very_big_out (struct vty *vty, const char *format, ...);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __VOS_CLI_H__ */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+ ******************************************************************************/
+
+#ifndef _VOS_COMMON_H_
+#define _VOS_COMMON_H_
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include "vos_lib.h"
+#include "vos_task.h"
+#include "vos_timer.h"
+#include "vos_module.h"
+#include "vos_sem.h"
+#include "vos_que.h"
+#include "vos_linklist.h"
+#include "vos_ctype.h"
+#include "vos_string.h"
+#include "vos_sysmsg.h"
+#include "vos_byteorder.h"
+#include "platform_module_names.h"
+#include "sys_main_api.h"
+#include "plat_syslog.h"
+
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /*_VOS_COMMON_H_*/
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+
+#ifndef _VOS_CTYPE_H
+#define _VOS_CTYPE_H
+
+#include "vos_types.h"
+
+/*
+ * NOTE! This ctype does not handle EOF like the standard C
+ * library is required to.
+ */
+
+#define _VOS_U 0x01 /* upper */
+#define _VOS_L 0x02 /* lower */
+#define _VOS_D 0x04 /* digit */
+#define _VOS_C 0x08 /* cntrl */
+#define _VOS_P 0x10 /* punct */
+#define _VOS_S 0x20 /* white space (space/lf/tab) */
+#define _VOS_X 0x40 /* hex digit */
+#define _VOS_SP 0x80 /* hard space (0x20) */
+
+extern unsigned char _vos_ctype[];
+
+#define __vos_ismask(x) (_vos_ctype[(int)(unsigned char)(x)])
+
+/** 同 isalnum */
+#define vos_isalnum(c) ((__vos_ismask(c)&(_VOS_U|_VOS_L|_VOS_D)) != 0)
+
+/** 同 isalpha */
+#define vos_isalpha(c) ((__vos_ismask(c)&(_VOS_U|_VOS_L)) != 0)
+
+/** 同 iscntrl */
+#define vos_iscntrl(c) ((__vos_ismask(c)&(_VOS_C)) != 0)
+
+/** 同 isdigit */
+#define vos_isdigit(c) ((__vos_ismask(c)&(_VOS_D)) != 0)
+
+/** 同 isgraph */
+#define vos_isgraph(c) ((__vos_ismask(c)&(_VOS_P|_VOS_U|_VOS_L|_VOS_D)) != 0)
+
+/** 同 islower */
+#define vos_islower(c) ((__vos_ismask(c)&(_VOS_L)) != 0)
+
+/** 同 isprint */
+#define vos_isprint(c) ((__vos_ismask(c)&(_VOS_P|_VOS_U|_VOS_L|_VOS_D|_VOS_SP)) != 0)
+
+/** 同 ispunct */
+#define vos_ispunct(c) ((__vos_ismask(c)&(_VOS_P)) != 0)
+
+/** 同 isspace */
+#define vos_isspace(c) ((__vos_ismask(c)&(_VOS_S)) != 0)
+
+/** 同 isupper */
+#define vos_isupper(c) ((__vos_ismask(c)&(_VOS_U)) != 0)
+
+/** 同 isxdigit */
+#define vos_isxdigit(c) ((__vos_ismask(c)&(_VOS_D|_VOS_X)) != 0)
+
+/** 同 isascii */
+#define vos_isascii(c) (((unsigned char)(c))<=0x7f)
+
+/** 同 toascii */
+#define vos_toascii(c) (((unsigned char)(c))&0x7f)
+
+/** 同 tolower */
+UCHAR vos_tolower(UCHAR c);
+
+/** 同 toupper */
+UCHAR vos_toupper(UCHAR c);
+
+#endif
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+#ifndef _VOS_LIB_H_
+#define _VOS_LIB_H_
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include "vos_types.h"
+#include "vos_module.h"
+#include <stdarg.h>
+#include "plat_syslog.h"
+#include <stdio.h>
+
+
+
+#define FILE_PATH_MAX 4096
+
+
+/**
+ * VOS 平台初始化
+ * @param[in] appPath APP文件路径
+ * @param[in] cfgPath vos config 文件路径
+ * @param[in] mods 定义已存在模块的数组
+ * @param[in] num mods数组大小
+ * @return 成功时返回申请内存的地址,失败则返回NULL。
+ */
+LONG VOS_Init(const CHAR *appPath,const CHAR *cfgPath,vos_module_t * mods,INT num);
+
+
+/**
+ * 分配内存
+ * @param[in] ulSize 申请内存的大小
+ * @param[in] ulModuleId 申请模块的模块ID
+ * @return 成功时返回申请内存的地址,失败则返回NULL。
+ */
+#define VOS_Malloc(ulSize,ulModuleId) VOS_MallocWithDebug(ulSize,ulModuleId,(UCHAR *)__FILE__,__LINE__)
+
+
+/**
+ * 释放内存
+ * @param[in] ptr 释放内存的指针
+ */
+#define VOS_Free(ptr) VOS_Free_Debug(ptr,(UCHAR *)__FILE__,__LINE__)
+
+
+/**
+ * 根据bExp判断是否打印调用栈
+ * @param[in] exp 当bExp为假时打印调用栈
+ */
+#define VOS_ASSERT(exp) VOS_ASSERT_X( (LONG)(exp), __FILE__, __LINE__ , 0)
+
+
+/**
+ * 格式化输出到默认输出
+ * 注意 LONG 输出时,要用%ld,或%lx
+ * @param[in] format 格式字符串
+ * @param[in] ... 要输出的变量
+ * @return 返回输出的字节数
+ */
+ULONG VOS_Printf(const CHAR *format ,...);
+
+
+/**
+ * 格式化输出到指定字符串中
+ * @param[in] buf 输出位置
+ * @param[in] fmt 格式字符串
+ * @param[in] ... 要输出的变量
+ * @return 返回输出的字节数
+ */
+ULONG VOS_Sprintf(CHAR *buf ,CHAR *fmt, ...);
+
+
+/**
+ * 格式化输出到指定字符串中
+ * @param[in] buf 输出位置
+ * @param[in] size buf的大小
+ * @param[in] fmt 格式字符串
+ * @param[in] ... 要输出的变量
+ * @return 返回输出的字节数
+ */
+ULONG VOS_Snprintf(CHAR *buf, ULONG size, CHAR *fmt, ...);
+
+
+/**
+ * 读取格式化的字符串中的数据
+ * @param[in] buf 要读取的字符串
+ * @param[in] fmt 读取格式
+ * @param[in] ... 存储数据的指针
+ * @return 返回成功读取的字段个数
+ */
+ULONG VOS_Sscanf(const CHAR * buf, const CHAR * fmt,...);
+
+
+/** 同qsort */
+VOID VOS_qsort(VOID *base, INT nmemb, INT size,
+ INT (*compar)(const VOID *, const VOID *));
+
+/** 同 vsnprintf */
+ULONG VOS_Vsnprintf(CHAR * buf, ULONG size, const CHAR * fmt, va_list args);
+
+/** 同 vsprintf */
+ULONG VOS_Vsprintf(CHAR * buf, const CHAR * fmt, va_list args);
+
+/**
+ * 判断文件是否存在
+ * @param[in] path 文件路径
+ * @return path存在返回TURE,不存在则返回FALSE
+ */
+BOOL VOS_file_exist(const CHAR *path);
+
+#define NUM_LIST_MAX 4096
+
+/**
+ * 将数值list字符串(1-6,8,13)转换为,数组
+ * @param[in ] list 数值字符串
+ * @param[out] numList 解析后的数值数组
+ * @return 成功解析的个数
+ */
+LONG parseNumList(const CHAR * list,ULONG numList[NUM_LIST_MAX]);
+
+
+/**
+ * 将数值list字符串(1-6,8,13)转换为一个ULONG bitmap
+ * @param[in ] list 数值字符串
+ * @param[out] map 解析后的bitmap
+ * @return 成功返回VOS_OK,失败返回其他
+ */
+LONG parseNumList2BitMap(const CHAR * list,ULONG *map);
+
+/**
+ * 延时
+ * @param[in ] seconds 延时的秒数
+ */
+VOID VOS_Sleep(LONG seconds);
+
+typedef VOID( *VOS_SIGNAL_FUNC ) ( int signal);
+
+/**
+ * vos信号处理回调函数注册
+ * @param[in ] sig 信号
+ * @param[in ] sig_handler 回调函数
+ * @return 成功返回VOS_OK,失败返回VOS_ERROR
+ */
+LONG Vos_Signal(int sig, VOS_SIGNAL_FUNC sig_handler);
+
+/**
+ * product信号处理回调函数注册
+ * @param[in ] sig 信号
+ * @param[in ] status 是否退出
+ * @param[in ] sig_handler 回调函数
+ * @return 成功返回VOS_OK,失败返回VOS_ERROR
+ */
+LONG Product_Signal(int sig, ULONG status, VOS_SIGNAL_FUNC sig_handler);
+
+/**
+ * product最后处理的信号回调函数注册
+ * @param[in ] sig 信号
+ * @param[in ] status 是否退出
+ * @param[in ] sig_handler 回调函数
+ * @return 成功返回VOS_OK,失败返回VOS_ERROR
+ */
+LONG Product_Signal_Last(int sig, ULONG status, VOS_SIGNAL_FUNC sig_handler);
+
+/**
+ * 信号处理模块初始化
+ * @param[in ] signal 信号
+ * @return 成功返回VOS_OK,失败返回VOS_ERROR
+ */
+LONG Vos_SignalInit();
+
+//信号最小值
+#define SIGNAL_MIN 0
+
+//信号最大值
+#define SIGNAL_MAX 65
+
+/** VOS 消息类型 */
+typedef enum VOS_MOD_EVENT_TYPE_S
+{
+ VOS_MOD_EVENT_TYPE_ASYN = 1, ///< 异步消息
+ VOS_MOD_EVENT_TYPE_SYN = 2, ///< 同步消息
+ VOS_MOD_EVENT_TYPE_TIMER = 3, ///< 定时器消息
+ VOS_MOD_EVENT_TYPE_MAX = 0x100, ///< VOS 占用最大消息类型ID
+}VOS_MOD_EVENT_TYPE_T;
+
+#define VOS_MOD_EVENT_TYPE_MAC_UL (VOS_MOD_EVENT_TYPE_MAX+1)
+
+
+/*=========================================================================================================================*/
+/* ###### 下面的函数不要直接调用,使用上面提供的宏 ###### */
+/**
+ * 分配内存,不要直接调用该API,通过宏 VOS_Malloc 调用
+ * @param[in] size 申请内存的大小
+ * @param[in] moduleId 申请内存的模块ID
+ * @param[in] file 申请内存处的文件名
+ * @param[in] line 申请内存处的行号
+ * @return 成功时返回申请内存的地址,失败则返回NULL。
+ */
+void* VOS_MallocWithDebug(unsigned long size, unsigned long moduleId, unsigned char *file, unsigned long line);
+
+/**
+ * 释放内存,不要直接调用该API,通过宏 VOS_Free 调用
+ * @param[in] ptr 释放内存的地址
+ * @param[in] file 释放内存处的文件名
+ * @param[in] line 释放内存处的行号
+ * @return
+ */
+void VOS_Free_Debug(const void *ptr, UCHAR *file, ULONG line);
+
+/**
+ * 打印断言,根据bExp判断是否打印调用栈,不要直接调用该API,通过宏 VOS_ASSERT 调用
+ * @param[in] bExp 当bExp为假时打印调用栈
+ * @param[in] szFileName 打印处的文件名
+ * @param[in] iLine 打印处的行号
+ * @param[in] bOutConsole 输出fd
+ */
+VOID VOS_ASSERT_X( BOOL bExp, CHAR *szFileName, INT iLine , INT bOutConsole);
+
+/******计算某个函数运行时间******/
+extern ULONG gTimerTickPerNsec;
+uint64_t timer_get_ticks_diff(uint64_t CurrTick, uint64_t LastTick);
+uint64_t timer_get_ticks(void);
+
+
+
+#define VOS_CALC_ELAPSED_TIME_NS(func) \
+({ \
+ uint64_t start, end; \
+ uint64_t diff; \
+ start = timer_get_ticks(); \
+ func; \
+ end = timer_get_ticks(); \
+ diff = timer_get_ticks_diff(end,start);\
+ vos_info_print("func %s spend diff %ld,gTimerTickPerNsec %ld, time = %ld ns,\n",#func ,diff,gTimerTickPerNsec,diff/gTimerTickPerNsec);\
+})
+
+#define __vos_start_tick() uint64_t start_tick = timer_get_ticks(),cur_tick = 0;
+#define __vos_diff_tick() cur_tick = timer_get_ticks();printf("%s.%d diff ticks %ld \r\n",__func__,__LINE__,timer_get_ticks_diff(cur_tick,start_tick));start_tick = timer_get_ticks();
+
+typedef LONG (*vos_print_wrapper_func_t)(void *dst,const char * format,...);
+LONG vos_vty_out_wrapper(void *vty,const char * format, ... );
+LONG vos_printf_wrapper(void *vty,const char * format, ... );
+
+//#####################################################################################
+// 未包含设备管理模块时需要添加的宏
+#ifndef PLAT_MODULE_DEVSM
+#define SYS_LOCAL_MODULE_SLOTNO_GET (1)
+#define SYS_MODULE_IS_RUNNING(slotno) (VOS_TRUE)
+
+#endif
+
+//#####################################################################################
+typedef enum {
+ _vos_print_lv_info = 0,
+ _vos_print_lv_warning,
+ _vos_print_lv_err,
+ _vos_print_lv_max
+}_vos_print_lv;
+
+
+// 带颜色的打印,开发调试时使用
+#define VOS_COLOR_NONE "\033[m"
+#define VOS_COLOR_RED "\033[1;31m"
+#define VOS_COLOR_BLUE "\033[1;34m"
+#define VOS_COLOR_PURPLE "\033[1;35m"
+#define VOS_COLOR_GREEN "\033[1;32m"
+
+
+extern BOOL vos_info_print_filter_is_filtered(LONG lv,const char *val);
+#define __is_p_(lv,val) vos_info_print_filter_is_filtered(lv,val)
+#define __print_check(lv,func,line) char tmp1[200];snprintf(tmp1,sizeof(tmp1),"%s.%d",func,line);if( !( __is_p_(lv,tmp1)||__is_p_(lv,func)))
+extern int sprintf(char *str, const char *format, ...);
+#define vos_raw_print(_format, ...) printf(_format, ##__VA_ARGS__)
+#define vos_info_print(_format, ...) {__print_check(_vos_print_lv_info,__func__,__LINE__){vos_raw_print(VOS_COLOR_BLUE"%s.%d:" _format VOS_COLOR_NONE"",__func__,__LINE__,##__VA_ARGS__);}}
+#ifdef VOS_log
+extern vos_module_t module_print_filter;
+#define __log_mid module_print_filter.moduleID
+#define vos_warning_print(_format, ...) {__print_check(_vos_print_lv_warning,__func__,__LINE__){vos_raw_print(VOS_COLOR_PURPLE"%s.%d:"_format VOS_COLOR_NONE"",__func__,__LINE__,##__VA_ARGS__);VOS_log(__log_mid,SYSLOG_WARNING,_format, ##__VA_ARGS__);}}
+#define vos_err_print(_format, ...) {__print_check(_vos_print_lv_err,__func__,__LINE__){vos_raw_print(VOS_COLOR_RED"%s.%d:"_format VOS_COLOR_NONE"",__func__,__LINE__,##__VA_ARGS__);VOS_log(__log_mid,SYSLOG_ERR,_format, ##__VA_ARGS__);}}
+#define vos_perror(_format, ...) {__print_check(_vos_print_lv_err,__func__,__LINE__){char tmp[200];vos_raw_print(VOS_COLOR_RED"%s.%d:",__func__,__LINE__);vos_raw_print(_format, ##__VA_ARGS__);sprintf(tmp,"%m");vos_raw_print(": %s",tmp);vos_raw_print(VOS_COLOR_NONE"");VOS_log(__log_mid,SYSLOG_ERR,_format, ##__VA_ARGS__);}}
+#else
+#define vos_warning_print(_format, ...) {__print_check(_vos_print_lv_warning,__func__,__LINE__){vos_raw_print(VOS_COLOR_PURPLE"%s.%d:"_format VOS_COLOR_NONE"",__func__,__LINE__,##__VA_ARGS__);}}
+#define vos_err_print(_format, ...) {__print_check(_vos_print_lv_err,__func__,__LINE__){vos_raw_print(VOS_COLOR_RED"%s.%d:"_format VOS_COLOR_NONE"",__func__,__LINE__,##__VA_ARGS__);}}
+#define vos_perror(_format, ...) {__print_check(_vos_print_lv_err,__func__,__LINE__){char tmp[200];vos_raw_print(VOS_COLOR_RED"%s.%d:",__func__,__LINE__);vos_raw_print(_format, ##__VA_ARGS__);sprintf(tmp,"%m");vos_raw_print(": %s",tmp);vos_raw_print(VOS_COLOR_NONE"");}}
+#endif
+
+#define NULL_CHECK(p) if(NULL == p) {vos_err_print(#p" is null\r\n");return VOS_ERROR;}
+
+#define NULL_CHECK_RP(p) if(NULL == p) {vos_err_print(#p" is null\r\n");return NULL;}
+
+
+#define RET_CHECK(bool,p) if(bool) {vos_err_print(#p" error\r\n");return VOS_ERROR;}
+
+LONG VOS_mini_Init(VOID);// 调试时使用
+LONG VOS_mini_Init_task(VOID);
+LONG VOS_mini_Init_cli(VOID);
+LONG VOS_mini_Init_cli_db(const CHAR *appPath,const CHAR *cfgPath,vos_module_t * mods,INT num);
+LONG VOS_mini_Init_cli_alarm(const CHAR *appPath,const CHAR *cfgPath,vos_module_t * mods,INT num);
+
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /*_VOS_LIB_H_*/
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+
+#ifndef _VOS_LINKLIST_H
+#define _VOS_LINKLIST_H
+
+#ifdef __cplusplus
+extern"C"{
+#endif
+
+/** 链表节点 */
+typedef struct cl_lib_listnode
+{
+ struct cl_lib_listnode *next;
+ struct cl_lib_listnode *prev;
+ void *data;
+}*plistnode;
+
+/** 链表名长度 */
+#define LIST_NAME_LEN (48)
+
+/** 链表节 */
+typedef struct cl_lib_list
+{
+ struct cl_lib_listnode *head;
+ struct cl_lib_listnode *tail;
+ char name[LIST_NAME_LEN];
+ unsigned long moduleID;
+ unsigned int count;
+ int ( *cmp ) ( void *val1, void *val2 );
+ void ( *del ) ( void *val );
+}*plist;
+
+
+/** 获得链表头 */
+#define cl_lib_listhead(X) ((X)->head)
+
+/** 获得链表尾 */
+#define cl_lib_listtail(X) ((X)->tail)
+
+/** 获得下个节点 */
+#define cl_lib_nextnode(X) ((X) = (X)->next)
+
+/** 获得上个节点 */
+#define cl_lib_prevnode(X) ((X) = (X)->prev)
+
+/** 获得链表中节点数量 */
+#define cl_lib_listcount(X) ((X)->count)
+
+/** 链表为空 */
+#define cl_lib_list_isempty(X) ((X)->head == NULL && (X)->tail == NULL)
+
+/** 获得节点中的数据 */
+#define cl_lib_getdata(X) ((X)->data)
+
+/**
+ * 创建一个linklist
+ * @param[in] name list名 最大长度 LIST_NAME_LEN
+ * @param[in] moduleID 创建list的模块ID
+ * @return 成功时返回新list地址,失败则返回NULL。
+ */
+struct cl_lib_list *cl_lib_list_new (char *name,unsigned long moduleID);
+
+
+
+/**
+ * free并删除linklist中的所有节点,然后free该list
+ * !!!注意,如果data也需要free,则需要实现list的del成员
+ * @param[in] plist1 要删除的list
+ */
+void cl_lib_list_delete ( struct cl_lib_list * plist1 );
+
+/**
+ * 将数据添加到链表尾,直接传入要添加的数据,该API会自动创建节点
+ * @param[in] plist1 待添加的list
+ * @param[in] val 待添加的数据
+ */
+void cl_lib_listnode_add ( struct cl_lib_list * plist1, void * val );
+
+
+/**
+ * 将数据添加到链表头,直接传入要添加的数据,该API会自动创建节点
+ * @param[in] plist1 待添加的list
+ * @param[in] val 待添加的数据
+ */
+void cl_lib_listnode_add_toHead ( struct cl_lib_list * plist1, void * val );
+
+/**
+ * 删除数据等于val的节点,!!!不会free 数据
+ * @param[in] plist1 待删除的list
+ * @param[in] val 待删除的数据
+ */
+void cl_lib_listnode_delete ( struct cl_lib_list * plist1, void * val );
+
+/**
+ * 根据注册的cmp函数删除节点,cmd 返回值为0 时删除,!!!不会free 数据
+ * @param[in] plist1 待删除的list
+ * @param[in] val cmp 函数参数
+ * @return 成功时返回被删除节点数据地址,用于free数据,失败则返回NULL。
+ */
+void *cl_lib_listnode_cmp_delete ( struct cl_lib_list * plist1, void * val );
+
+/**
+ * 在当前节点前插入数据
+ * @param[in] plist1 待插入数据的list
+ * @param[in] currentnode 当前节点
+ * @param[in] val 待插入数据
+ */
+void cl_lib_list_add_node_prev ( plist plist1, plistnode currentnode, void *val );
+
+/**
+ * 在当前节点后插入数据
+ * @param[in] plist1 待插入数据的list
+ * @param[in] currentnode 当前节点
+ * @param[in] val 待插入数据
+ */
+void cl_lib_list_add_node_next ( plist plist1, plistnode currentnode, void *val );
+
+/**
+ * 节点查找 API,根据给定val查找
+ * !!!用此API 需要确保 plist->cmp 成员已赋值,否则无法查找
+ * !!!不可修改获得节点的 prev 和 next指针
+ * !!!不可释放获得节点
+ * !!!如果替换获得节点的data数据,如果旧的data需要释放,需自己手动释放data数据
+ * @param[in] plist1 要查找的list
+ * @param[in] data 进行比较的数据
+ * @return 找到返回节点指针,未找到返回 NULL。
+ */
+plistnode cl_lib_listnode_lookup_by_val( plist plist1, void *data );
+
+
+/**
+ * 节点查找 API,根据给定val和cmp方法查找
+ * !!!不可修改获得节点的 prev 和 next指针
+ * !!!不可释放获得节点
+ * !!!如果替换获得节点的data数据,如果旧的data需要释放,需自己手动释放data数据
+ * @param[in] plist1 要查找的list
+ * @param[in] cmp 比较函数,当val1 与val2相等时返回0,不相等时返回非0值
+ * @param[in] data 进行比较的数据
+ * @return 找到返回节点指针,未找到返回 NULL。
+ */
+plistnode cl_lib_listnode_lookup_by_func( plist plist1, int (*cmp)(void *val1, void *val2),void *data);
+
+
+/**
+ * 查找到的节点,如果想要从链表中删除,必须使用该接口
+ * !!!注意,如果data也需要free,则需要实现list的del成员
+ * @param[in] plist1 list
+ * @param[in] node 要删除的节点
+ */
+void cl_lib_list_delete_node ( plist plist1, plistnode node );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _VOS_LINKLIST_H */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+#ifndef __VOS_MODULE_H__
+#define __VOS_MODULE_H__
+
+#include "vos_types.h"
+#include "vos_timer.h"
+#include "vos_que.h"
+#include "vos_socket.h"
+
+
+
+/** 模块名大小 */
+#define MODULE_NAME_LEN (48)
+
+
+/** 模块类型 */
+typedef enum module_type_e{
+ VOS_MOD_T_NORMAL = 0, ///< 一般模块
+ VOS_MOD_T_HOST, ///< host task
+ VOS_MOD_T_USER, ///< user task
+ VOS_MOD_T_EXTERN, ///< 外部模块 (不是 vos app 中的模块,其他的进程 )
+ VOS_MOD_T_MAX, ///<
+}module_type_t;
+
+/** 模块通信类型 */
+typedef enum module_comm_type_e{
+ VOS_MOD_COMM_T_VOS = (1 << 0), ///< vos 模块间通信
+ VOS_MOD_COMM_T_UNIX_UDP_C = (1 << 1), ///< unix socket udp client
+ VOS_MOD_COMM_T_UNIX_UDP_S = (1 << 2), ///< unix socket udp server
+ VOS_MOD_COMM_T_UNIX_TCP_C = (1 << 3), ///< unix socket tcp client
+ VOS_MOD_COMM_T_UNIX_TCP_S = (1 << 4), ///< unix socket tcp server
+ VOS_MOD_COMM_T_UDP_C = (1 << 5), ///< udp client
+ VOS_MOD_COMM_T_UDP_S = (1 << 6), ///< udp server
+ VOS_MOD_COMM_T_TCP_C = (1 << 7), ///< tcp client
+ VOS_MOD_COMM_T_TCP_S = (1 << 8), ///< tcp server
+ VOS_MOD_COMM_T_SCTP_ONE2ONE_C = (1 << 9), ///< sctp one2one client
+ VOS_MOD_COMM_T_SCTP_ONE2ONE_S = (1 << 10), ///< sctp one2one server
+ VOS_MOD_COMM_T_SCTP_ONE2MANY_C = (1 << 11), ///< sctp one2many client
+ VOS_MOD_COMM_T_SCTP_ONE2MANY_S = (1 << 12), ///< sctp one2many server
+ VOS_MOD_COMM_T_SOCK_OP = (1 << 13), ///< socket
+ VOS_MOD_COMM_T_MAX, ///< max
+}module_comm_type_t;
+
+
+/** 模块管理类型 */
+typedef struct vos_module_s{
+ module_type_t modType; ///< 模块类型
+ LONG commType; ///< 当前的通信类型
+ ULONG moduleID; ///< 模块ID
+ CHAR name[MODULE_NAME_LEN]; ///< 模块名
+ ULONG queueID; ///< 模块消息队列,用于接收从其他模块发送过来的消息
+ LONG paraCount; ///< 无需关心, (添加的额外参数个数)
+ void *pPara; ///< 无需关心, (vos_mod_com_para_cb_t)
+ LONG paraLock; ///< 无需关心,
+}vos_module_t;
+
+
+/** 采用非VOS通信方式的模块需要提供的handle函数,用于接收数据
+* buf 用于消息接收的缓冲区
+* size buf 大小
+* opval 额外信息,类型为 vos_mod_com_op_t
+* opvalLen opval的大小
+*
+*/
+typedef LONG (*receive_handler)(VOID *buf,LONG size,VOID *opval,LONG opvalLen);
+
+
+/**
+ * 模块注册 API
+ * 向VOS 模块管理中注册模块 。
+ * @param[in ] name 模块名,大小为 MODULE_NAME_LEN
+ * @param[in] module 模块管理信息
+ * 传入值
+ * module.queueID 用于模块间通信
+ * module.mod_type 模块类型
+ * @param[out] module 模块管理信息
+ * 传出值
+ * module.name
+ * module.moduleID
+ * @return VOS_OK - 成功,其他 - 失败
+ */
+LONG VOS_module_register(const CHAR *name,vos_module_t *module);
+
+
+/**
+ * 模块注销 API
+ * 向VOS 模块管理中注册模块 。
+ * @param[in ] name 模块名,大小为 MODULE_NAME_LEN
+ * @return VOS_OK - 成功,其他 - 失败
+ */
+LONG VOS_module_deregister(const CHAR *name);
+
+
+/**
+ * 根据模块ID获得模块名
+ * @param[in ] id 模块ID
+ * @param[out] name 模块名,大小为 MODULE_NAME_LEN
+ * @return VOS_OK - 成功,其他 - 失败
+ */
+LONG VOS_module_get_name(ULONG id,CHAR name[MODULE_NAME_LEN]);
+
+/**
+ * 根据模块名获得模块ID
+ * @param[in ] name 模块名,大小为 MODULE_NAME_LEN
+ * @return 成功返回模块ID,失败返回 0
+ */
+ULONG VOS_module_get_Id(CHAR *name);
+
+
+/**
+ * 向某个模块发送异步消息
+ * @param[in ] dst_slot 目的槽位号
+ * @param[in ] dst_moduleName 目的模块名,大小为 MODULE_NAME_LEN
+ * @param[in ] src_moduleName 源模块名,大小为 MODULE_NAME_LEN
+ * @param[in ] msgCode 消息码
+ * @param[in ] msgData 消息数据
+ * @param[in ] msgDataLen 消息数据长度
+ * @return 成功返回 VOS_OK,失败返回 其他
+ */
+LONG VOS_SendAsynMsg2Module(LONG dst_slot,CHAR dst_moduleName[MODULE_NAME_LEN],CHAR src_moduleName[MODULE_NAME_LEN],
+ LONG msgCode,VOID *msgData,LONG msgDataLen);
+
+/**
+ * 向某个模块发送同步消息
+ * @param[in ] dst_slot 目的槽位号
+ * @param[in ] dst_moduleName 目的模块名,大小为 MODULE_NAME_LEN
+ * @param[in ] src_moduleName 源模块名,大小为 MODULE_NAME_LEN
+ * @param[in ] msgCode 消息码
+ * @param[in ] msgData 消息数据,如果没有则填 NULL
+ * @param[in ] msgDataLen 消息数据长度,如果msgData 为NULL 填0
+ * @param[out] ackData 接收返回数据的buf
+ * @param[in ] ackDataLen 输入:接收返回数据buf的长度
+ * @param[out] ackDataLen 输出:buf的有效长度
+ * @param[in ] timeout 等待接收的时间,单位毫秒,调用者自行判断需要等待时间,一般等待 5秒
+ * @return 成功返回 VOS_OK,失败返回 其他
+ */
+LONG VOS_SendSynMsg2Module(LONG dst_slot,CHAR dst_moduleName[MODULE_NAME_LEN],CHAR src_moduleName[MODULE_NAME_LEN],
+ LONG msgCode,VOID *msgData,LONG msgDataLen,VOID *ackData,LONG *ackDataLen,LONG timeout);
+
+
+
+/**
+ * 向某个模块发送异步消息,支持非VOS通信方式
+ * @param[in ] dst_slot 目的槽位号
+ * @param[in ] dst_moduleName 目的模块名,大小为 MODULE_NAME_LEN
+ * @param[in ] src_moduleName 源模块名,大小为 MODULE_NAME_LEN
+ * @param[in ] msgCode 消息码
+ * @param[in ] msgData 消息数据
+ * @param[in ] msgDataLen 消息数据长度
+ * @param[in ] commType 通信方式
+ * @param[in ] optval 可选参数,不需要则填NULL
+ * @param[in ] optlen 可选参数长度
+ * @return 成功返回 VOS_OK,失败返回 其他
+ */
+LONG VOS_SendAsynMsg2ModuleEx(LONG dst_slot,CHAR dst_moduleName[MODULE_NAME_LEN],CHAR src_moduleName[MODULE_NAME_LEN],
+ LONG msgCode,VOID *msgData,LONG msgDataLen,
+ module_comm_type_t commType,VOID *optval,LONG optlen);
+
+
+/**
+ * 向某个模块发送同步消息,仅支持VOS通信方式
+ * @param[in ] dst_slot 目的槽位号
+ * @param[in ] dst_moduleName 目的模块名,大小为 MODULE_NAME_LEN
+ * @param[in ] src_moduleName 源模块名,大小为 MODULE_NAME_LEN
+ * @param[in ] msgCode 消息码
+ * @param[in ] msgData 消息数据,如果没有则填 NULL
+ * @param[in ] msgDataLen 消息数据长度,如果msgData 为NULL 填0
+ * @param[out] ackData 接收返回数据的buf
+ * @param[in ] ackDataLen 输入:接收返回数据buf的长度
+ * @param[out] ackDataLen 输出:buf的有效长度
+ * @param[in ] timeout 等待接收的时间,单位毫秒,调用者自行判断需要等待时间,一般等待 5秒
+ * @param[in ] commType 通信方式
+ * @param[in ] optval 可选参数,不需要则填NULL
+ * @param[in ] optlen 可选参数长度
+ * @return 成功返回 VOS_OK,失败返回 其他
+ */
+LONG VOS_SendSynMsg2ModuleEx(LONG dst_slot,CHAR dst_moduleName[MODULE_NAME_LEN],CHAR src_moduleName[MODULE_NAME_LEN],
+ LONG msgCode,VOID *msgData,LONG msgDataLen,VOID *ackData,LONG *ackDataLen,LONG timeout,
+ module_comm_type_t commType,VOID *optval,LONG optlen);
+
+LONG VOS_SendAsynMsg2Module_Raw(LONG dst_slot,CHAR dst_moduleName[MODULE_NAME_LEN],CHAR src_moduleName[MODULE_NAME_LEN],
+ ULONG aulMsg[VOS_QUEUE_MSG_SIZE]);
+
+
+
+/**
+* 回复同步消息
+* @param[in ] aulMsg VOS_QueReceive 收到的原始消息
+* @param[in ] ackData 返回数据的buf
+* @param[in ] ackDataLen 返回数据buf的长度
+* @return 成功返回 VOS_OK,失败返回 其他
+*/
+LONG VOS_SendSynAckMsg(ULONG aulMsg[VOS_QUEUE_MSG_SIZE],VOID *ackData,LONG ackDataLen);
+
+
+/**
+* 注册timer 消息
+* @param[in ] module_ID 要注册timer msg的模块号
+* @param[in ] msg_code 消息码
+* @param[in ] interval 发送间隔,毫秒
+* @param[in ] type 类型,循环或者只执行一次
+* @param[in ] pArg 附加参数,一般为一个指针
+* @return 成功返回 VOS_OK,失败返回 其他
+*/
+LONG VOS_RegTimerMsg(LONG module_ID,LONG msg_code,LONG interval,VOS_TIMER_TYPE_EN type,VOID *pArg);
+
+
+/**
+* 注销timer 消息
+* @param[in ] module_ID 要注销timer msg的模块号
+* @param[in ] msg_code 消息码
+* @return 成功返回 VOS_OK,失败返回 其他
+*/
+LONG VOS_DeregTimerMsg(LONG module_ID,LONG msg_code);
+
+
+/** 从原始消息中获取消息类型 (同步/异步) */
+#define VOS_MOD_MSG_GET_EVENT_TYPE(aulMsg) aulMsg[0]
+
+/** 从原始消息中获取消息类码 */
+#define VOS_MOD_MSG_GET_CODE(aulMsg) ((SYS_MSG_S *)(aulMsg[3]))->usMsgCode
+
+
+/** 从原始消息中获取源模块号 */
+#define VOS_MOD_MSG_GET_SRC_ID(aulMsg) ((SYS_MSG_S *)(aulMsg[3]))->ulSrcModuleID
+
+
+/** 从原始消息中获取目的模块号 */
+#define VOS_MOD_MSG_GET_DST_ID(aulMsg) ((SYS_MSG_S *)(aulMsg[3]))->ulDstModuleID
+
+
+/** 从原始消息中获取源槽位号 */
+#define VOS_MOD_MSG_GET_SRC_SLOT(aulMsg) ((SYS_MSG_S *)(aulMsg[3]))->ulSrcSlotID
+
+
+/** 从原始消息中获取目的槽位号 */
+#define VOS_MOD_MSG_GET_DST_SLOT(aulMsg) ((SYS_MSG_S *)(aulMsg[3]))->ulDstSlotID
+
+
+/** 从原始消息中获取消息长度 */
+#define VOS_MOD_MSG_GET_LEN(aulMsg) ((SYS_MSG_S *)(aulMsg[3]))->usFrameLen
+
+/** 从原始消息中获取消息buf 的指针 */
+#define VOS_MOD_MSG_GET_DATAPTR(aulMsg) ((SYS_MSG_S *)(aulMsg[3]))->ptrMsgBody
+
+/** 从原始消息中拷贝消息到dst中 */
+#define VOS_MOD_MSG_GET_DATA(dst,aulMsg) if( NULL != VOS_MOD_MSG_GET_DATAPTR(aulMsg) ) \
+ { VOS_MemCpy(dst,VOS_MOD_MSG_GET_DATAPTR(aulMsg),VOS_MOD_MSG_GET_LEN(aulMsg)); } \
+ else \
+ { VOS_ASSERT(0); }
+
+/** 释放原始消息中的sys msg */
+#define VOS_MOD_MSG_FREE(aulMsg) VOS_Free((VOID *)aulMsg[3])
+
+
+/** msg handler的函数原型 */
+typedef LONG(*VOS_msg_code_handler_ptr)(ULONG aulMsg[VOS_QUEUE_MSG_SIZE]);
+
+
+/** 用于模块间通信的code 和 handler的map */
+typedef struct msg_code_handle_map_s
+{
+ LONG msg_code; ///< 消息码
+ VOS_msg_code_handler_ptr handler; ///< 消息码的处理函数
+}VOS_msg_code_handle_map_t;
+
+
+
+#endif /* __VOS_MODULE_H__ */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+#ifndef __VOS_QUE_H__
+#define __VOS_QUE_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/** 队列中无消息 */
+#define VOS_NO_MSG 0
+
+
+#define VOS_QUEUE_MSG_SIZE 4
+
+/** 队列中有消息 */
+#define VOS_HAVE_MSG (VOS_QUEUE_MSG_SIZE * sizeof(ULONG))
+
+/** 队列类型,linux中只支持 VOS_MSG_Q_FIFO 和 VOS_MSG_Q_PRIORITY 类型 */
+typedef enum {
+ VOS_MSG_Q_FIFO = 0, ///< first in first out queue
+ VOS_MSG_Q_PRIORITY = 1, ///< priority sorted queue
+ VOS_MSG_Q_PIPE = 2, ///< pipe queue
+ VOS_MSG_Q_ISOCK = 3, ///< ISOCK queue
+}VOS_msgq_type_t;
+
+/** 消息优先级 */
+typedef enum {
+ MSG_PRI_NORMAL = 0, ///< 普通优先级
+ MSG_PRI_URGENT = 1, ///< 高优先级
+}VOS_msgq_pri_t;
+
+
+/**
+ * 创建消息队列
+ * @param[in] lMaxMsgs 消息队列中最大消息数目
+ * @param[in] lOptions 选项,VOS_msgq_type_t 类型,linux中支持MSG_Q_FIFO和MSG_Q_PRIORITY
+ * @return 成功返回队列ID,失败则返回 0
+ */
+ULONG VOS_QueCreate(LONG lMaxMsgs, LONG lOptions);
+
+
+/**
+ * 删除队列
+ * @param[in] msgQId 消息队列ID
+ * @return 成功返回队列ID,失败则返回 0
+ */
+LONG VOS_QueDelete(ULONG msgQId);
+
+
+/**
+ * 向消息队列发消息
+ * @param[in] msgQId 消息队列ID
+ * @param[in] aulMsg 发送的消息,含有VOS_QUEUE_MSG_SIZE个ULONG的数组
+ * @param[in] lMsec 当队列满时,发送任务等待的时间,单位是毫秒。
+ * VOS_WAIT_FOREVER 表示永久等待。VOS_WAIT_NO_WAIT 表示不等待。
+ * @param[in] lPriority 消息的优先级。分为MSG_PRI_NORMAL和MSG_PRI_URGENT两种。
+ * @return VOS_OK - 成功,其他 - 失败
+ * @note WINDOWS中存在Bug,队列满了后,不能等待,只能返回失败
+ */
+LONG VOS_QueSend(ULONG msgQId, ULONG aulMsg[VOS_QUEUE_MSG_SIZE], LONG lMsec, LONG lPriority);
+
+
+/**
+ * 从消息队列接受
+ * @param[in] msgQId 消息队列ID
+ * @param[in] aulMsg 接收的消息,含有VOS_QUEUE_MSG_SIZE个ULONG的数组
+ * @param[in] lMsec 当队列满时,发送任务等待的时间,单位是毫秒。
+ * VOS_WAIT_FOREVER 表示永久等待。VOS_WAIT_NO_WAIT 表示不等待。
+ * @return 失败为VOS_ERROR;成功时如果消息队列中消息数为0 则返回VOS_NO_MSG,
+ * 如果消息队列中消息数不为0 ,则返回VOS_HAVE_MSG。
+ * @note 一般任务的入口函数就阻塞在VOS_QueReceive。
+ */
+LONG VOS_QueReceive(ULONG msgQId, ULONG aulMsg[VOS_QUEUE_MSG_SIZE], LONG lMsec);
+
+
+/**
+ * 将队列和任务绑定,用于队列管理,一般创建完队列和任务后调用
+ * @param[in] hTask 任务句柄
+ * @param[in] ulQId 消息队列ID
+ */
+VOID VOS_QueBindTask(VOS_HANDLE hTask, ULONG ulQId);
+
+
+/**
+ * 获得队列中消息的数目
+ * @param[in] msgQId 消息队列ID
+ * @return 成功则返回消息队列中消息的数目,失败则VOS_ERROR。
+ */
+LONG VOS_QueNum(ULONG msgQId);
+
+/**
+ * 删除所有创建的消息队列
+ * @return 成功VOS_OK
+ */
+LONG VOS_QueClean();
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __VOS_QUE_H__ */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+
+#ifndef __VOS_SCTP_H__
+#define __VOS_SCTP_H__
+
+#include <stdint.h>
+#include <linux/types.h>
+#include <sys/socket.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef __s32 sctp_assoc_t;
+
+/* Socket option layer for SCTP */
+#ifndef SOL_SCTP
+#define SOL_SCTP 132
+#endif
+
+#ifndef IPPROTO_SCTP
+#define IPPROTO_SCTP 132
+#endif
+
+/* 9. Preprocessor constants */
+#define HAVE_SCTP
+#define HAVE_KERNEL_SCTP
+#define HAVE_SCTP_MULTIBUF
+#define HAVE_SCTP_NOCONNECT
+#define HAVE_SCTP_PRSCTP
+#define HAVE_SCTP_ADDIP
+#define HAVE_SCTP_CANSET_PRIMARY
+
+/* The following symbols come from the Sockets API Extensions for
+ * SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>.
+ */
+#define SCTP_RTOINFO 0
+#define SCTP_ASSOCINFO 1
+#define SCTP_INITMSG 2
+#define SCTP_NODELAY 3 /* Get/set nodelay option. */
+#define SCTP_AUTOCLOSE 4
+#define SCTP_SET_PEER_PRIMARY_ADDR 5
+#define SCTP_PRIMARY_ADDR 6
+#define SCTP_ADAPTATION_LAYER 7
+#define SCTP_DISABLE_FRAGMENTS 8
+#define SCTP_PEER_ADDR_PARAMS 9
+#define SCTP_DEFAULT_SEND_PARAM 10
+#define SCTP_EVENTS 11
+#define SCTP_I_WANT_MAPPED_V4_ADDR 12 /* Turn on/off mapped v4 addresses */
+#define SCTP_MAXSEG 13 /* Get/set maximum fragment. */
+#define SCTP_STATUS 14
+#define SCTP_GET_PEER_ADDR_INFO 15
+#define SCTP_DELAYED_ACK_TIME 16
+#define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME
+#define SCTP_DELAYED_SACK SCTP_DELAYED_ACK_TIME
+#define SCTP_CONTEXT 17
+#define SCTP_FRAGMENT_INTERLEAVE 18
+#define SCTP_PARTIAL_DELIVERY_POINT 19 /* Set/Get partial delivery point */
+#define SCTP_MAX_BURST 20 /* Set/Get max burst */
+#define SCTP_AUTH_CHUNK 21 /* Set only: add a chunk type to authenticate */
+#define SCTP_HMAC_IDENT 22
+#define SCTP_AUTH_KEY 23
+#define SCTP_AUTH_ACTIVE_KEY 24
+#define SCTP_AUTH_DELETE_KEY 25
+#define SCTP_PEER_AUTH_CHUNKS 26 /* Read only */
+#define SCTP_LOCAL_AUTH_CHUNKS 27 /* Read only */
+#define SCTP_GET_ASSOC_NUMBER 28 /* Read only */
+
+/* Internal Socket Options. Some of the sctp library functions are
+ * implemented using these socket options.
+ */
+#define SCTP_SOCKOPT_BINDX_ADD 100 /* BINDX requests for adding addrs */
+#define SCTP_SOCKOPT_BINDX_REM 101 /* BINDX requests for removing addrs. */
+#define SCTP_SOCKOPT_PEELOFF 102 /* peel off association. */
+/* Options 104-106 are deprecated and removed. Do not use this space */
+#define SCTP_SOCKOPT_CONNECTX_OLD 107 /* CONNECTX old requests. */
+#define SCTP_GET_PEER_ADDRS 108 /* Get all peer addresss. */
+#define SCTP_GET_LOCAL_ADDRS 109 /* Get all local addresss. */
+#define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */
+#define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */
+
+/* SCTP socket option used to read per endpoint association statistics. */
+#define SCTP_GET_ASSOC_STATS 112 /* Read only */
+
+/*
+ * 5.2.1 SCTP Initiation Structure (SCTP_INIT)
+ *
+ * This cmsghdr structure provides information for initializing new
+ * SCTP associations with sendmsg(). The SCTP_INITMSG socket option
+ * uses this same data structure. This structure is not used for
+ * recvmsg().
+ *
+ * cmsg_level cmsg_type cmsg_data[]
+ * ------------ ------------ ----------------------
+ * IPPROTO_SCTP SCTP_INIT struct sctp_initmsg
+ *
+ */
+struct sctp_initmsg {
+ __u16 sinit_num_ostreams;
+ __u16 sinit_max_instreams;
+ __u16 sinit_max_attempts;
+ __u16 sinit_max_init_timeo;
+};
+
+/*
+ * 5.2.2 SCTP Header Information Structure (SCTP_SNDRCV)
+ *
+ * This cmsghdr structure specifies SCTP options for sendmsg() and
+ * describes SCTP header information about a received message through
+ * recvmsg().
+ *
+ * cmsg_level cmsg_type cmsg_data[]
+ * ------------ ------------ ----------------------
+ * IPPROTO_SCTP SCTP_SNDRCV struct sctp_sndrcvinfo
+ *
+ */
+struct sctp_sndrcvinfo {
+ __u16 sinfo_stream;
+ __u16 sinfo_ssn;
+ __u16 sinfo_flags;
+ __u32 sinfo_ppid;
+ __u32 sinfo_context;
+ __u32 sinfo_timetolive;
+ __u32 sinfo_tsn;
+ __u32 sinfo_cumtsn;
+ sctp_assoc_t sinfo_assoc_id;
+};
+
+/*
+ * sinfo_flags: 16 bits (unsigned integer)
+ *
+ * This field may contain any of the following flags and is composed of
+ * a bitwise OR of these values.
+ */
+
+enum sctp_sinfo_flags {
+ SCTP_UNORDERED = 1, /* Send/receive message unordered. */
+ SCTP_ADDR_OVER = 2, /* Override the primary destination. */
+ SCTP_ABORT=4, /* Send an ABORT message to the peer. */
+ SCTP_SACK_IMMEDIATELY = 8, /* SACK should be sent without delay */
+ SCTP_EOF=MSG_FIN, /* Initiate graceful shutdown process. */
+};
+
+
+typedef union {
+ __u8 raw;
+ struct sctp_initmsg init;
+ struct sctp_sndrcvinfo sndrcv;
+} sctp_cmsg_data_t;
+
+/* These are cmsg_types. */
+typedef enum sctp_cmsg_type {
+ SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */
+#define SCTP_INIT SCTP_INIT
+ SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */
+#define SCTP_SNDRCV SCTP_SNDRCV
+} sctp_cmsg_t;
+
+
+/*
+ * 5.3.1.1 SCTP_ASSOC_CHANGE
+ *
+ * Communication notifications inform the ULP that an SCTP association
+ * has either begun or ended. The identifier for a new association is
+ * provided by this notificaion. The notification information has the
+ * following format:
+ *
+ */
+struct sctp_assoc_change {
+ __u16 sac_type;
+ __u16 sac_flags;
+ __u32 sac_length;
+ __u16 sac_state;
+ __u16 sac_error;
+ __u16 sac_outbound_streams;
+ __u16 sac_inbound_streams;
+ sctp_assoc_t sac_assoc_id;
+ __u8 sac_info[0];
+};
+
+/*
+ * sac_state: 32 bits (signed integer)
+ *
+ * This field holds one of a number of values that communicate the
+ * event that happened to the association. They include:
+ *
+ * Note: The following state names deviate from the API draft as
+ * the names clash too easily with other kernel symbols.
+ */
+enum sctp_sac_state {
+ SCTP_COMM_UP,
+ SCTP_COMM_LOST,
+ SCTP_RESTART,
+ SCTP_SHUTDOWN_COMP,
+ SCTP_CANT_STR_ASSOC,
+};
+
+/*
+ * 5.3.1.2 SCTP_PEER_ADDR_CHANGE
+ *
+ * When a destination address on a multi-homed peer encounters a change
+ * an interface details event is sent. The information has the
+ * following structure:
+ */
+struct sctp_paddr_change {
+ __u16 spc_type;
+ __u16 spc_flags;
+ __u32 spc_length;
+ struct sockaddr_storage spc_aaddr;
+ int spc_state;
+ int spc_error;
+ sctp_assoc_t spc_assoc_id;
+} __attribute__((packed, aligned(4)));
+
+/*
+ * spc_state: 32 bits (signed integer)
+ *
+ * This field holds one of a number of values that communicate the
+ * event that happened to the address. They include:
+ */
+enum sctp_spc_state {
+ SCTP_ADDR_AVAILABLE,
+ SCTP_ADDR_UNREACHABLE,
+ SCTP_ADDR_REMOVED,
+ SCTP_ADDR_ADDED,
+ SCTP_ADDR_MADE_PRIM,
+ SCTP_ADDR_CONFIRMED,
+};
+
+
+/*
+ * 5.3.1.3 SCTP_REMOTE_ERROR
+ *
+ * A remote peer may send an Operational Error message to its peer.
+ * This message indicates a variety of error conditions on an
+ * association. The entire error TLV as it appears on the wire is
+ * included in a SCTP_REMOTE_ERROR event. Please refer to the SCTP
+ * specification [SCTP] and any extensions for a list of possible
+ * error formats. SCTP error TLVs have the format:
+ */
+struct sctp_remote_error {
+ __u16 sre_type;
+ __u16 sre_flags;
+ __u32 sre_length;
+ __u16 sre_error;
+ sctp_assoc_t sre_assoc_id;
+ __u8 sre_data[0];
+};
+
+
+/*
+ * 5.3.1.4 SCTP_SEND_FAILED
+ *
+ * If SCTP cannot deliver a message it may return the message as a
+ * notification.
+ */
+struct sctp_send_failed {
+ __u16 ssf_type;
+ __u16 ssf_flags;
+ __u32 ssf_length;
+ __u32 ssf_error;
+ struct sctp_sndrcvinfo ssf_info;
+ sctp_assoc_t ssf_assoc_id;
+ __u8 ssf_data[0];
+};
+
+/*
+ * ssf_flags: 16 bits (unsigned integer)
+ *
+ * The flag value will take one of the following values
+ *
+ * SCTP_DATA_UNSENT - Indicates that the data was never put on
+ * the wire.
+ *
+ * SCTP_DATA_SENT - Indicates that the data was put on the wire.
+ * Note that this does not necessarily mean that the
+ * data was (or was not) successfully delivered.
+ */
+enum sctp_ssf_flags {
+ SCTP_DATA_UNSENT,
+ SCTP_DATA_SENT,
+};
+
+/*
+ * 5.3.1.5 SCTP_SHUTDOWN_EVENT
+ *
+ * When a peer sends a SHUTDOWN, SCTP delivers this notification to
+ * inform the application that it should cease sending data.
+ */
+struct sctp_shutdown_event {
+ __u16 sse_type;
+ __u16 sse_flags;
+ __u32 sse_length;
+ sctp_assoc_t sse_assoc_id;
+};
+
+/*
+ * 5.3.1.6 SCTP_ADAPTATION_INDICATION
+ *
+ * When a peer sends a Adaptation Layer Indication parameter , SCTP
+ * delivers this notification to inform the application
+ * that of the peers requested adaptation layer.
+ */
+struct sctp_adaptation_event {
+ __u16 sai_type;
+ __u16 sai_flags;
+ __u32 sai_length;
+ __u32 sai_adaptation_ind;
+ sctp_assoc_t sai_assoc_id;
+};
+
+/*
+ * 5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT
+ *
+ * When a receiver is engaged in a partial delivery of a
+ * message this notification will be used to indicate
+ * various events.
+ */
+struct sctp_pdapi_event {
+ __u16 pdapi_type;
+ __u16 pdapi_flags;
+ __u32 pdapi_length;
+ __u32 pdapi_indication;
+ sctp_assoc_t pdapi_assoc_id;
+};
+
+enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, };
+
+/*
+* 5.3.1.8. SCTP_AUTHENTICATION_EVENT
+*
+* When a receiver is using authentication this message will provide
+* notifications regarding new keys being made active as well as errors.
+*/
+
+struct sctp_authkey_event {
+ __u16 auth_type;
+ __u16 auth_flags;
+ __u32 auth_length;
+ __u16 auth_keynumber;
+ __u16 auth_altkeynumber;
+ __u32 auth_indication;
+ sctp_assoc_t auth_assoc_id;
+};
+
+enum { SCTP_AUTH_NEWKEY = 0, };
+
+struct sctp_sender_dry_event {
+ __u16 sender_dry_type;
+ __u16 sender_dry_flags;
+ __u32 sender_dry_length;
+ sctp_assoc_t sender_dry_assoc_id;
+};
+
+/*
+ * Described in Section 7.3
+ * Ancillary Data and Notification Interest Options
+ */
+struct sctp_event_subscribe {
+ __u8 sctp_data_io_event;
+ __u8 sctp_association_event;
+ __u8 sctp_address_event;
+ __u8 sctp_send_failure_event;
+ __u8 sctp_peer_error_event;
+ __u8 sctp_shutdown_event;
+ __u8 sctp_partial_delivery_event;
+ __u8 sctp_adaptation_layer_event;
+ __u8 sctp_authentication_event;
+ __u8 sctp_sender_dry_event;
+};
+
+/*
+ * 5.3.1 SCTP Notification Structure
+ *
+ * The notification structure is defined as the union of all
+ * notification types.
+ *
+ */
+union sctp_notification {
+ struct {
+ __u16 sn_type; /* Notification type. */
+ __u16 sn_flags;
+ __u32 sn_length;
+ } sn_header;
+ struct sctp_assoc_change sn_assoc_change;
+ struct sctp_paddr_change sn_paddr_change;
+ struct sctp_remote_error sn_remote_error;
+ struct sctp_send_failed sn_send_failed;
+ struct sctp_shutdown_event sn_shutdown_event;
+ struct sctp_adaptation_event sn_adaptation_event;
+ struct sctp_pdapi_event sn_pdapi_event;
+ struct sctp_authkey_event sn_authkey_event;
+ struct sctp_sender_dry_event sn_sender_dry_event;
+};
+
+/* Section 5.3.1
+ * All standard values for sn_type flags are greater than 2^15.
+ * Values from 2^15 and down are reserved.
+ */
+
+enum sctp_sn_type {
+ SCTP_SN_TYPE_BASE = (1<<15),
+ SCTP_ASSOC_CHANGE,
+#define SCTP_ASSOC_CHANGE SCTP_ASSOC_CHANGE
+ SCTP_PEER_ADDR_CHANGE,
+#define SCTP_PEER_ADDR_CHANGE SCTP_PEER_ADDR_CHANGE
+ SCTP_SEND_FAILED,
+#define SCTP_SEND_FAILED SCTP_SEND_FAILED
+ SCTP_REMOTE_ERROR,
+#define SCTP_REMOTE_ERROR SCTP_REMOTE_ERROR
+ SCTP_SHUTDOWN_EVENT,
+#define SCTP_SHUTDOWN_EVENT SCTP_SHUTDOWN_EVENT
+ SCTP_PARTIAL_DELIVERY_EVENT,
+#define SCTP_PARTIAL_DELIVERY_EVENT SCTP_PARTIAL_DELIVERY_EVENT
+ SCTP_ADAPTATION_INDICATION,
+#define SCTP_ADAPTATION_INDICATION SCTP_ADAPTATION_INDICATION
+ SCTP_AUTHENTICATION_INDICATION,
+#define SCTP_AUTHENTICATION_INDICATION SCTP_AUTHENTICATION_INDICATION
+ SCTP_SENDER_DRY_EVENT,
+#define SCTP_SENDER_DRY_EVENT SCTP_SENDER_DRY_EVENT
+};
+
+/* Notification error codes used to fill up the error fields in some
+ * notifications.
+ * SCTP_PEER_ADDRESS_CHAGE : spc_error
+ * SCTP_ASSOC_CHANGE : sac_error
+ * These names should be potentially included in the draft 04 of the SCTP
+ * sockets API specification.
+ */
+typedef enum sctp_sn_error {
+ SCTP_FAILED_THRESHOLD,
+ SCTP_RECEIVED_SACK,
+ SCTP_HEARTBEAT_SUCCESS,
+ SCTP_RESPONSE_TO_USER_REQ,
+ SCTP_INTERNAL_ERROR,
+ SCTP_SHUTDOWN_GUARD_EXPIRES,
+ SCTP_PEER_FAULTY,
+} sctp_sn_error_t;
+
+/*
+ * 7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO)
+ *
+ * The protocol parameters used to initialize and bound retransmission
+ * timeout (RTO) are tunable. See [SCTP] for more information on how
+ * these parameters are used in RTO calculation.
+ */
+struct sctp_rtoinfo {
+ sctp_assoc_t srto_assoc_id;
+ __u32 srto_initial;
+ __u32 srto_max;
+ __u32 srto_min;
+};
+
+/*
+ * 7.1.2 Association Parameters (SCTP_ASSOCINFO)
+ *
+ * This option is used to both examine and set various association and
+ * endpoint parameters.
+ */
+struct sctp_assocparams {
+ sctp_assoc_t sasoc_assoc_id;
+ __u16 sasoc_asocmaxrxt;
+ __u16 sasoc_number_peer_destinations;
+ __u32 sasoc_peer_rwnd;
+ __u32 sasoc_local_rwnd;
+ __u32 sasoc_cookie_life;
+};
+
+/*
+ * 7.1.9 Set Peer Primary Address (SCTP_SET_PEER_PRIMARY_ADDR)
+ *
+ * Requests that the peer mark the enclosed address as the association
+ * primary. The enclosed address must be one of the association's
+ * locally bound addresses. The following structure is used to make a
+ * set primary request:
+ */
+struct sctp_setpeerprim {
+ sctp_assoc_t sspp_assoc_id;
+ struct sockaddr_storage sspp_addr;
+} __attribute__((packed, aligned(4)));
+
+/*
+ * 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR)
+ *
+ * Requests that the local SCTP stack use the enclosed peer address as
+ * the association primary. The enclosed address must be one of the
+ * association peer's addresses. The following structure is used to
+ * make a set peer primary request:
+ */
+struct sctp_setprim {
+ sctp_assoc_t ssp_assoc_id;
+ struct sockaddr_storage ssp_addr;
+} __attribute__((packed, aligned(4)));
+
+/* For backward compatibility use, define the old name too */
+#define sctp_prim sctp_setprim
+
+/*
+ * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER)
+ *
+ * Requests that the local endpoint set the specified Adaptation Layer
+ * Indication parameter for all future INIT and INIT-ACK exchanges.
+ */
+struct sctp_setadaptation {
+ __u32 ssb_adaptation_ind;
+};
+
+/*
+ * 7.1.13 Peer Address Parameters (SCTP_PEER_ADDR_PARAMS)
+ *
+ * Applications can enable or disable heartbeats for any peer address
+ * of an association, modify an address's heartbeat interval, force a
+ * heartbeat to be sent immediately, and adjust the address's maximum
+ * number of retransmissions sent before an address is considered
+ * unreachable. The following structure is used to access and modify an
+ * address's parameters:
+ */
+enum sctp_spp_flags {
+ SPP_HB_ENABLE = 1<<0, /*Enable heartbeats*/
+ SPP_HB_DISABLE = 1<<1, /*Disable heartbeats*/
+ SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE,
+ SPP_HB_DEMAND = 1<<2, /*Send heartbeat immediately*/
+ SPP_PMTUD_ENABLE = 1<<3, /*Enable PMTU discovery*/
+ SPP_PMTUD_DISABLE = 1<<4, /*Disable PMTU discovery*/
+ SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE,
+ SPP_SACKDELAY_ENABLE = 1<<5, /*Enable SACK*/
+ SPP_SACKDELAY_DISABLE = 1<<6, /*Disable SACK*/
+ SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE,
+ SPP_HB_TIME_IS_ZERO = 1<<7, /* Set HB delay to 0 */
+};
+
+struct sctp_paddrparams {
+ sctp_assoc_t spp_assoc_id;
+ struct sockaddr_storage spp_address;
+ __u32 spp_hbinterval;
+ __u16 spp_pathmaxrxt;
+ __u32 spp_pathmtu;
+ __u32 spp_sackdelay;
+ __u32 spp_flags;
+} __attribute__((packed, aligned(4)));
+
+/*
+ * 7.1.18. Add a chunk that must be authenticated (SCTP_AUTH_CHUNK)
+ *
+ * This set option adds a chunk type that the user is requesting to be
+ * received only in an authenticated way. Changes to the list of chunks
+ * will only effect future associations on the socket.
+ */
+struct sctp_authchunk {
+ __u8 sauth_chunk;
+};
+
+/*
+ * 7.1.19. Get or set the list of supported HMAC Identifiers (SCTP_HMAC_IDENT)
+ *
+ * This option gets or sets the list of HMAC algorithms that the local
+ * endpoint requires the peer to use.
+*/
+
+enum {
+ SCTP_AUTH_HMAC_ID_SHA1 = 1,
+ SCTP_AUTH_HMAC_ID_SHA256 = 3,
+};
+
+struct sctp_hmacalgo {
+ __u32 shmac_number_of_idents;
+ __u16 shmac_idents[];
+};
+
+/*
+ * 7.1.20. Set a shared key (SCTP_AUTH_KEY)
+ *
+ * This option will set a shared secret key which is used to build an
+ * association shared key.
+ */
+struct sctp_authkey {
+ sctp_assoc_t sca_assoc_id;
+ __u16 sca_keynumber;
+ __u16 sca_keylength;
+ __u8 sca_key[];
+};
+
+/*
+ * 7.1.21. Get or set the active shared key (SCTP_AUTH_ACTIVE_KEY)
+ *
+ * This option will get or set the active shared key to be used to build
+ * the association shared key.
+ */
+
+struct sctp_authkeyid {
+ sctp_assoc_t scact_assoc_id;
+ __u16 scact_keynumber;
+};
+
+
+/*
+ * 7.1.23. Get or set delayed ack timer (SCTP_DELAYED_SACK)
+ *
+ * This option will effect the way delayed acks are performed. This
+ * option allows you to get or set the delayed ack time, in
+ * milliseconds. It also allows changing the delayed ack frequency.
+ * Changing the frequency to 1 disables the delayed sack algorithm. If
+ * the assoc_id is 0, then this sets or gets the endpoints default
+ * values. If the assoc_id field is non-zero, then the set or get
+ * effects the specified association for the one to many model (the
+ * assoc_id field is ignored by the one to one model). Note that if
+ * sack_delay or sack_freq are 0 when setting this option, then the
+ * current values will remain unchanged.
+ */
+struct sctp_sack_info {
+ sctp_assoc_t sack_assoc_id;
+ uint32_t sack_delay;
+ uint32_t sack_freq;
+};
+
+struct sctp_assoc_value {
+ sctp_assoc_t assoc_id;
+ uint32_t assoc_value;
+};
+
+/*
+ * 7.2.2 Peer Address Information
+ *
+ * Applications can retrieve information about a specific peer address
+ * of an association, including its reachability state, congestion
+ * window, and retransmission timer values. This information is
+ * read-only. The following structure is used to access this
+ * information:
+ */
+struct sctp_paddrinfo {
+ sctp_assoc_t spinfo_assoc_id;
+ struct sockaddr_storage spinfo_address;
+ __s32 spinfo_state;
+ __u32 spinfo_cwnd;
+ __u32 spinfo_srtt;
+ __u32 spinfo_rto;
+ __u32 spinfo_mtu;
+} __attribute__((packed, aligned(4)));
+
+/* Peer addresses's state. */
+/* UNKNOWN: Peer address passed by the upper layer in sendmsg or connect[x]
+ * calls.
+ * UNCONFIRMED: Peer address received in INIT/INIT-ACK address parameters.
+ * Not yet confirmed by a heartbeat and not available for data
+ * transfers.
+ * ACTIVE : Peer address confirmed, active and available for data transfers.
+ * INACTIVE: Peer address inactive and not available for data transfers.
+ */
+enum sctp_spinfo_state {
+ SCTP_INACTIVE,
+ SCTP_PF,
+ SCTP_ACTIVE,
+ SCTP_UNCONFIRMED,
+ SCTP_UNKNOWN = 0xffff
+};
+
+/*
+ * 7.2.1 Association Status (SCTP_STATUS)
+ *
+ * Applications can retrieve current status information about an
+ * association, including association state, peer receiver window size,
+ * number of unacked data chunks, and number of data chunks pending
+ * receipt. This information is read-only. The following structure is
+ * used to access this information:
+ */
+struct sctp_status {
+ sctp_assoc_t sstat_assoc_id;
+ __s32 sstat_state;
+ __u32 sstat_rwnd;
+ __u16 sstat_unackdata;
+ __u16 sstat_penddata;
+ __u16 sstat_instrms;
+ __u16 sstat_outstrms;
+ __u32 sstat_fragmentation_point;
+ struct sctp_paddrinfo sstat_primary;
+};
+
+/*
+ * 7.2.3. Get the list of chunks the peer requires to be authenticated
+ * (SCTP_PEER_AUTH_CHUNKS)
+ *
+ * This option gets a list of chunks for a specified association that
+ * the peer requires to be received authenticated only.
+ */
+struct sctp_authchunks {
+ sctp_assoc_t gauth_assoc_id;
+ __u32 gauth_number_of_chunks;
+ uint8_t gauth_chunks[];
+};
+/* The broken spelling has been released already,
+ * so don't break anyone, now that it's fixed.
+ */
+#define guth_number_of_chunks gauth_number_of_chunks
+
+/* Association states. */
+enum sctp_sstat_state {
+ SCTP_EMPTY = 0,
+ SCTP_CLOSED = 1,
+ SCTP_COOKIE_WAIT = 2,
+ SCTP_COOKIE_ECHOED = 3,
+ SCTP_ESTABLISHED = 4,
+ SCTP_SHUTDOWN_PENDING = 5,
+ SCTP_SHUTDOWN_SENT = 6,
+ SCTP_SHUTDOWN_RECEIVED = 7,
+ SCTP_SHUTDOWN_ACK_SENT = 8,
+};
+
+/*
+ * 8.3, 8.5 get all peer/local addresses in an association.
+ * This parameter struct is used by SCTP_GET_PEER_ADDRS and
+ * SCTP_GET_LOCAL_ADDRS socket options used internally to implement
+ * sctp_getpaddrs() and sctp_getladdrs() API.
+ */
+struct sctp_getaddrs_old {
+ sctp_assoc_t assoc_id;
+ int addr_num;
+ struct sockaddr *addrs;
+};
+struct sctp_getaddrs {
+ sctp_assoc_t assoc_id; /*input*/
+ __u32 addr_num; /*output*/
+ __u8 addrs[0]; /*output, variable size*/
+};
+
+/* A socket user request obtained via SCTP_GET_ASSOC_STATS that retrieves
+ * association stats. All stats are counts except sas_maxrto and
+ * sas_obs_rto_ipaddr. maxrto is the max observed rto + transport since
+ * the last call. Will return 0 when did not change since last call
+ */
+struct sctp_assoc_stats {
+ sctp_assoc_t sas_assoc_id; /* Input */
+ /* Transport of the observed max RTO spike */
+ struct sockaddr_storage sas_obs_rto_ipaddr;
+ __u64 sas_maxrto; /* Maximum Observed RTO for period */
+ __u64 sas_isacks; /* SACKs received */
+ __u64 sas_osacks; /* SACKs sent */
+ __u64 sas_opackets; /* Packets sent */
+ __u64 sas_ipackets; /* Packets received */
+ __u64 sas_rtxchunks; /* Retransmitted Chunks */
+ __u64 sas_outofseqtsns;/* TSN received > next expected */
+ __u64 sas_idupchunks; /* Dups received (ordered+unordered) */
+ __u64 sas_gapcnt; /* Gap Acknowledgements Received */
+ __u64 sas_ouodchunks; /* Unordered data chunks sent */
+ __u64 sas_iuodchunks; /* Unordered data chunks received */
+ __u64 sas_oodchunks; /* Ordered data chunks sent */
+ __u64 sas_iodchunks; /* Ordered data chunks received */
+ __u64 sas_octrlchunks; /* Control chunks sent */
+ __u64 sas_ictrlchunks; /* Control chunks received */
+};
+
+/* These are bit fields for msghdr->msg_flags. See section 5.1. */
+/* On user space Linux, these live in <bits/socket.h> as an enum. */
+enum sctp_msg_flags {
+ MSG_NOTIFICATION = 0x8000,
+#define MSG_NOTIFICATION MSG_NOTIFICATION
+};
+
+/*
+ * 8.1 sctp_bindx()
+ *
+ * The flags parameter is formed from the bitwise OR of zero or more of the
+ * following currently defined flags:
+ */
+#define SCTP_BINDX_ADD_ADDR 0x01
+#define SCTP_BINDX_REM_ADDR 0x02
+
+/* This is the structure that is passed as an argument(optval) to
+ * getsockopt(SCTP_SOCKOPT_PEELOFF).
+ */
+typedef struct {
+ sctp_assoc_t associd;
+ int sd;
+} sctp_peeloff_arg_t;
+
+
+
+
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __VOS_SCTP_H__ */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+
+
+#ifndef __VOS_SEM_H__
+#define __VOS_SEM_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/** 阻塞 */
+#define VOS_WAIT_FOREVER -1
+
+/** 非阻塞 */
+#define VOS_WAIT_NO_WAIT 0
+
+
+/** 信号量状态 */
+typedef enum
+{
+ VOS_SEM_EMPTY, ///< 0: semaphore not available
+ VOS_SEM_FULL ///< 1: semaphore available
+}VOS_SEM_B_STATE;
+
+/** 信号量选项,linux 中无效,使用 VOS_SEM_Q_FIFO */
+typedef enum{
+ VOS_SEM_Q_FIFO = 0x0, ///< first in first out queue
+ VOS_SEM_Q_PRIORITY = 0x1, ///< priority sorted queue
+ VOS_SEM_DELETE_SAFE = 0x4, ///< owner delete safe (mutex opt.)
+ VOS_SEM_INVERSION_SAFE = 0x8, ///< no priority inversion (mutex opt.)
+}VOS_sem_option_t;
+
+
+/**
+ * 创建Bianary类型的信号量,linux中 与Count类型 一致
+ * @param[in] lOption 信号量选项,linux 中无效,使用 VOS_SEM_Q_FIFO
+ * @param[in] enInitialState 初始化状态,VOS_SEM_B_STATE 类型的枚举值
+ * @return 返回SEM_ID,失败则返回 0
+ */
+#define VOS_SemBCreate(lOption, enInitialState) __VOS_SemBCreate(lOption, enInitialState, __FUNCTION__, __LINE__)
+
+
+/**
+ * 创建Count类型的信号量
+ * @param[in] lOption 信号量选项,linux 中无效,使用 VOS_SEM_Q_FIFO
+ * @param[in] enInitialState 初始化状态,VOS_SEM_B_STATE 类型的枚举值
+ * @return 返回SEM_ID,失败则返回 0
+ */
+#define VOS_SemCCreate(lOption, enInitialState) __VOS_SemCCreate(lOption, enInitialState, __FUNCTION__, __LINE__)
+
+
+/**
+ * 创建互斥锁
+ * @param[in] lOption 信号量选项,linux 中无效,使用 VOS_SEM_Q_FIFO
+ * @return 返回SEM_ID,失败则返回 0
+ */
+#define VOS_SemMCreate(lOption) __VOS_SemMCreate(lOption, __FUNCTION__, __LINE__)
+
+
+/**
+ * 获取信号量
+ * @param[in] semID 信号量ID
+ * @param[in] lMsec 超时等待的时间,单位毫秒,也可以为VOS_WAIT_FOREVER或VOS_NO_WAIT
+ * @return VOS_OK - 成功,其他 - 失败/超时
+ */
+LONG VOS_SemTake(ULONG semID, LONG lMsec);
+
+
+/**
+ * 释放信号量
+ * @param[in] semID 信号量ID
+ * @return VOS_OK - 成功,其他 - 失败
+ */
+LONG VOS_SemGive(ULONG semID);
+
+
+/**
+ * 删除信号量
+ * @param[in] semID 信号量ID
+ * @return VOS_OK - 成功,其他 - 失败
+ */
+LONG VOS_SemDelete(ULONG semID);
+
+
+
+
+
+
+/* ###### 下面的函数不要直接调用,使用上面提供的宏 ###### */
+
+
+/**
+ * 不要直接调用该API,通过宏 VOS_SemBCreate 使用
+ * 创建Bianary类型的信号量,linux中 与Count类型 一致
+ * @param[in] lOption 信号量选项,linux 中无效,使用 VOS_SEM_Q_FIFO
+ * @param[in] enInitialState 初始化状态,VOS_SEM_B_STATE 类型
+ * @param[in] pFunc 调用该API的文件名
+ * @param[in] iLine 调用该API的行号
+ * @return 返回SEM_ID,失败则返回 0
+ */
+ULONG __VOS_SemBCreate(LONG lOption, VOS_SEM_B_STATE enInitialState,const CHAR *pFunc, INT iLine);
+
+
+/**
+ * 不要直接调用该API,通过宏 VOS_SemCCreate 使用
+ * 创建Count类型的信号量,linux中 与Count类型 一致
+ * @param[in] lOption 信号量选项,linux 中无效,使用 VOS_SEM_Q_FIFO
+ * @param[in] lInitialCount 初始值
+ * @param[in] pFunc 调用该API的文件名
+ * @param[in] iLine 调用该API的行号
+ * @return 返回SEM_ID,失败则返回 0
+ */
+ULONG __VOS_SemCCreate(LONG lOption, LONG lInitialCount,const CHAR *pFunc, INT iLine);
+
+
+/**
+ * 不要直接调用该API,通过宏 VOS_SemMCreate 使用
+ * 创建互斥锁
+ * @param[in] lOption 信号量选项,linux 中无效,使用 VOS_SEM_Q_FIFO
+ * @param[in] pFunc 调用该API的文件名
+ * @param[in] iLine 调用该API的行号
+ * @return 返回SEM_ID,失败则返回 0
+ */
+ULONG __VOS_SemMCreate(LONG lOption,const CHAR *pFunc, INT iLine);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __VOS_SEM_H__ */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+
+#ifndef __VOS_SOCKMGR_H__
+#define __VOS_SOCKMGR_H__
+
+#include "vos_types.h"
+#include "vos_timer.h"
+#include "vos_que.h"
+#include "vos_socket.h"
+#include "vos_module.h"
+
+#define COMM_SCTP_ADDR_MAX 5
+
+
+#define VOS_SOCKET_MSG_MAX 9000
+
+
+/** 采用socket mgr 需要提供的handle函数,用于接收数据
+ * @param[in ] buf 用于消息接收的缓冲区
+ * @param[in ] size buf 大小
+ * @param[in ] opval 额外信息,类型为 vos_mod_com_op_t
+ * @param[in ] opvalLen opval的大小
+ *
+*/
+typedef LONG (*receive_handler)(VOID *buf,LONG size,VOID *opval,LONG opvalLen);
+
+
+/** tcp/sctp one-to-one 用于接收客户端accept 事件的函数
+* @param[in ] info 客户端信息,实际为vos_sock_info_t
+* @param[in ] infoLen 信息长度
+*
+*/
+typedef LONG (*accept_handler)(VOID *info,LONG infoLen);
+
+
+typedef struct sctp_para_s {
+ vos_sockaddr_t addrs[COMM_SCTP_ADDR_MAX]; ///< ip 地址
+ LONG addrsCnt; ///< ip 个数
+ struct sctp_sndrcvinfo sinfo; ///< sctp_sndrcvinfo
+ struct sctp_initmsg initmsg; ///< sctp_initmsg
+ struct sctp_event_subscribe events; ///< sctp_event_subscribe
+}sctp_para_t;
+
+typedef union {
+ vos_sockaddr_t addr;
+ sctp_para_t sctp;
+}___addr_u;
+
+/** 创建socket需要提供的参数 */
+typedef struct vos_sock_para_s
+{
+ module_comm_type_t type; ///< 通信方式
+ union{
+ vos_sockaddr_t addr; ///< socket 通信
+ sctp_para_t sctp; ///< sctp 通信
+ }u;
+ ___addr_u client_bind_addr; ///< 创建客户端时如果也需要绑定地址,填写该变量
+ receive_handler recv_handle; ///< 接收函数
+ accept_handler accept_handle; ///< 接收accept 事件
+ LONG maxClient; ///< tcp server 允许的连接数
+ BOOL soloMode; ///< 如果为真,则单独创建接收线程;如果为假,则由 VOS socket代理任务负责接收
+ LONG fdIdx; ///< 无需关心
+}vos_sock_para_t;
+
+typedef struct vos_sock_info_s{
+ module_comm_type_t type; ///< 通信方式
+ LONG fd; ///< socket
+ LONG fdIdx; ///< 无需关心
+ LONG c_flag; ///< 无需关心
+ struct sctp_sndrcvinfo sri; ///< sctp_recvmsg()/sctp_send() 中的 sinfo,sctp_sendmsg() 中ppid,flags,stream_no,timetolive,context也从该结构中获得
+ LONG msg_flags; ///< sctp_recvmsg() 中的 msg_flags
+ vos_sockaddr_t addr; ///< udp/sctp one-to-many 接收到的对端地址,同时也是udp/sctp one-to-many 发送的目的地址
+}vos_sock_info_t;
+
+
+/**
+ * 创建socket通信
+ * @param[in ] name 模块名,大小为 MODULE_NAME_LEN
+ * @param[in ] pPara 额外参数数组
+ * @param[in ] size 数组大小
+ * @param[out] info socket 相关信息,用于发送消息和删除该socket
+ * @return VOS_OK - 成功,其他 - 失败
+ */
+LONG VOS_SOCKET_create(const CHAR *name,vos_sock_para_t *pPara,LONG size,vos_sock_info_t *info);
+
+
+/**
+ * 删除 socket
+ * @param[in ] info 创建时获得的socket 相关信息
+ * @return VOS_OK - 成功,其他 - 失败
+ */
+LONG VOS_SOCKET_delete(vos_sock_info_t *info);
+
+
+/**
+ * 判断是否连接成功(只判断tcp 和sctp one-to-one 是否connect成功)
+ * @param[in ] info 创建时获得的socket 相关信息
+ * @return 连接正常返回 VOS_TRUE,否则返回 VOS_FALSE
+ */
+BOOL VOS_SOCKET_isLink(vos_sock_info_t *info);
+
+
+/**
+ * socket 发送数据
+ * @param[in ] info socket 相关信息
+ * @param[in ] msgData 数据
+ * @param[in ] msgDataLen 数据长度
+ * @return 成功返回 发送的字节数 ,失败则返回 VOS_ERROR
+ */
+LONG VOS_SOCKET_send(vos_sock_info_t *info,VOID *msgData,LONG msgDataLen);
+
+
+
+#endif /* __VOS_SOCKMGR_H__ */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+
+#ifndef __VOS_SOCKET_H__
+#define __VOS_SOCKET_H__
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+#include "vos_types.h"
+#include <unistd.h>
+#include <sys/un.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <net/if.h>
+#include <sys/ioctl.h>
+#include <netpacket/packet.h>
+#include "vos_sctp.h"
+#include "vos_linklist.h"
+
+/**
+ * socket地址联合体,可用于IPv4,IPv6,和unix类型的socket
+ */
+typedef union vos_sockaddr_u
+{
+ struct sockaddr sa; ///< 通用结构
+ struct sockaddr_in sin; ///< IPv4 结构
+ struct sockaddr_in6 sin6; ///< IPv6 结构
+ struct sockaddr_un un; ///< unix 结构
+ struct sockaddr_ll raw; ///< raw 结构
+}vos_sockaddr_t;
+
+/**
+ * 协议族
+*/
+typedef enum vos_domain_e{
+ VOS_AF_UNIX = AF_UNIX, ///< unix socket
+ VOS_AF_INET = AF_INET, ///< ipv4
+ VOS_AF_INET6 = AF_INET6, ///< ipv6
+ VOS_AF_PACKET= AF_PACKET, ///< 用于raw socket
+}vos_domain_t;
+
+/**
+ * socket类型
+*/
+typedef enum vos_socktype_e{
+ VOS_SOCK_STREAM = SOCK_STREAM, ///< TCP
+ VOS_SOCK_DGRAM = SOCK_DGRAM, ///< UDP
+ VOS_SOCK_RAW = SOCK_RAW, ///< raw socket
+ VOS_SOCK_SEQPACKET = SOCK_SEQPACKET, ///< sctp one2many
+}vos_socktype_t;
+
+
+/**
+ * 将IP地址结构转换成IP地址字符串
+ * @param[in ] af 协议族,VOS_AF_INET 或 VOS_AF_INET6
+ * @param[in ] src IP地址结构
+ * @param[out] dst 用于存储转换结果的buf,
+ * @param[in ] size buf的大小
+ * @return 成功返回指向dst的指针,失败返回 NULL
+*/
+const CHAR *vos_inet_ntop(LONG af, const vos_sockaddr_t *src,CHAR *dst, socklen_t size);
+
+
+/**
+ * 将IP地址字符串转换成IP地址结构
+ * @param[in ] af 协议族,VOS_AF_INET 或 VOS_AF_INET6
+ * @param[in ] src IP地址字符串
+ * @param[out] dst 用于存储转换结果的IP地址结构,
+ * @return 成功返回 VOS_OK,失败则返回其他
+*/
+LONG vos_inet_pton(LONG af, const CHAR *src, vos_sockaddr_t *dst);
+
+
+
+/**
+ * 创建socket
+ * @param[in ] domain 协议族
+ * @param[in ] type socket类型
+ * @param[out] protocol 协议,一般填0
+ * @return 成功返回 文件描述符,失败则返回 其他
+*/
+LONG vos_socket(vos_domain_t domain,vos_socktype_t type,LONG protocol);
+
+/**
+ * 为socket绑定地址
+ * @param[in ] sockfd 要绑定的socket
+ * @param[in ] my_addr 地址结构
+ * @return 成功返回 VOS_OK ,失败则返回 其他
+*/
+LONG vos_bind(LONG sockfd,vos_sockaddr_t *my_addr);
+
+
+
+/**
+ * 为socket绑定地址
+ * @param[in ] sockfd 要绑定的socket
+ * @param[in ] family 协议族
+ * @param[in ] port 端口号,当family为 VOS_AF_INET 和 VOS_AF_INET6 有效
+ * @param[in ] addrStr 地址字符串,
+ 当family为 VOS_AF_INET 和 VOS_AF_INET6 时为IP地址字符串,
+ 当family为 VOS_AF_UNIX 时 为本地文件路径字符串
+ * @param[in ] protocol 协议,当family为 VOS_AF_PACKET 时有效,为协议类型
+ * @param[in ] ifName 网口名,当family为 VOS_AF_PACKET 时有效,为绑定的网口名
+ * @return 成功返回 VOS_OK ,失败则返回 其他
+*/
+LONG vos_bind_str(LONG sockfd,vos_domain_t family,SHORT port,const CHAR *addrStr,SHORT protocol,const CHAR *ifName);
+
+
+/**
+ * 监听socket
+ * @param[in ] sockfd 欲监听的socket
+ * @param[in ] maxClient 最大连接数
+ * @return 成功返回 VOS_OK ,失败则返回 其他
+*/
+LONG vos_listen(LONG sockfd, LONG maxClient);
+
+
+/**
+ * 获得连接请求
+ * @param[in ] sockfd 被监听的socket
+ * @param[in ] addr 客户端地址
+ * @return 成功返回 VOS_OK ,失败则返回 其他
+*/
+LONG vos_accept(LONG sockfd,vos_sockaddr_t *addr);
+
+
+
+/**
+ * 建立与指定socket的连接
+ * @param[in ] sockfd 欲建立连接的socket
+ * @param[in ] con_addr 服务端地址
+ * @return 成功返回 VOS_OK ,失败则返回 其他
+*/
+LONG vos_connect(LONG sockfd,vos_sockaddr_t *con_addr);
+
+
+
+/**
+ * 建立与指定socket的连接
+ * @param[in ] sockfd 欲建立连接的socket
+ * @param[in ] family 协议族
+ * @param[in ] port 端口号,当family为 VOS_AF_INET 和 VOS_AF_INET6 有效
+ * @param[in ] addrStr 服务端地址字符串,
+ 当family为 VOS_AF_INET 和 VOS_AF_INET6 时为IP地址字符串,
+ 当family为 VOS_AF_UNIX 时 为本地文件路径字符串
+ * @return 成功返回 VOS_OK ,失败则返回 其他
+*/
+LONG vos_connect_str(LONG sockfd,vos_domain_t family,SHORT port,const CHAR *addrStr);
+
+
+/**
+ * 从已连接的socket的接收数据
+ * @param[in ] sockfd 已建立连接的socket
+ * @param[in ] buf 存储数据的缓冲区
+ * @param[in ] len buf的大小
+ * @param[in ] flags 参考 系统 recv 函数
+ * @return 成功返回 接收的字节数 ,失败则返回 VOS_ERROR
+*/
+LONG vos_recv(LONG sockfd, VOID *buf, size_t len, LONG flags);
+
+/**
+ * 向已连接的socket的发送数据
+ * @param[in ] sockfd 已建立连接的socket
+ * @param[in ] buf 存储数据的缓冲区
+ * @param[in ] len buf的大小
+ * @param[in ] flags 参考 系统 recv 函数
+ * @return 成功返回 发送的字节数 ,失败则返回 VOS_ERROR
+*/
+LONG vos_send(LONG sockfd, const VOID *buf, size_t len, LONG flags);
+
+/**
+ * 从socket中接收数据
+ * @param[in ] sockfd socket
+ * @param[in ] buf 存储数据的缓冲区
+ * @param[in ] len buf的大小
+ * @param[in ] flags 参考 系统 recv 函数
+ * @param[in ] src_addr 数据来源端的地址
+ * @return 成功返回 接收的字节数 ,失败则返回 VOS_ERROR
+*/
+LONG vos_recvfrom(LONG sockfd, void *buf, size_t len, LONG flags,vos_sockaddr_t *src_addr);
+
+/**
+ * 向socket中发送数据
+ * @param[in ] sockfd socket
+ * @param[in ] buf 存储数据的缓冲区
+ * @param[in ] len buf的大小
+ * @param[in ] flags 参考 系统 sendto 函数
+ * @param[in ] dest_addr 数据发送的目的地址
+ * @return 成功返回 发送的字节数 ,失败则返回 VOS_ERROR
+*/
+LONG vos_sendto(LONG sockfd, const void *buf, size_t len, LONG flags,const vos_sockaddr_t *dest_addr);
+
+
+
+/**
+ * 获取 本地的 IP 地址
+ * @param[in ] sockfd socket
+ * @param[out] addr 用于存放地址
+ * @return 成功返回 地址个数,失败则返回 VOS_ERROR
+*/
+LONG vos_getsockname(LONG sockfd,vos_sockaddr_t *addr);
+
+/**
+ * 获取 对端的 IP 地址
+ * @param[in ] sockfd socket
+ * @param[out] addr 用于存放地址
+ * @return 成功返回 地址个数,失败则返回 VOS_ERROR
+*/
+LONG vos_getpeername(LONG sockfd, vos_sockaddr_t *addr);
+
+
+/**
+ * 向raw socket中发送数据
+ * @param[in ] sockfd socket
+ * @param[in ] ifName 用于数据发送的网口名
+ * @param[in ] buf 存储数据的缓冲区
+ * @param[in ] len buf的大小
+ * @param[in ] flags 参考 系统 sendto 函数
+ * @return 成功返回 发送的字节数 ,失败则返回 VOS_ERROR
+*/
+LONG vos_raw_sendto(LONG sockfd,const CHAR *ifName, const void *buf, size_t len, LONG flags);
+
+
+/**
+ * 填充vos_sockaddr_t地址结构
+ * @param[in ] socket 相关的socket,当family 为VOS_AF_PACKET时有效
+ * @param[out] my_addr 被填充的 vos_sockaddr_t 变量
+ * @param[in ] family 协议族
+ * @param[in ] port 端口号,当family为 VOS_AF_INET 和 VOS_AF_INET6 有效
+ * @param[in ] addrStr 地址字符串,
+ 当family为 VOS_AF_INET 和 VOS_AF_INET6 时为IP地址字符串,
+ 当family为 VOS_AF_UNIX 时 为本地文件路径字符串
+ * @param[in ] protocol 协议,当family为 VOS_AF_PACKET 时有效,为协议类型
+ * @param[in ] ifName 网口名,当family为 VOS_AF_PACKET 时有效,为绑定的网口名
+ * @return 成功返回 VOS_OK ,失败则返回 其他
+*/
+LONG vos_addr_fill(LONG socket,vos_sockaddr_t *my_addr,vos_domain_t family,SHORT port,const CHAR *addrStr,SHORT protocol,const CHAR *ifName);
+
+
+/**
+ * 获取本机网口的MAC地址
+ * @param[in ] ifName 网口名
+ * @param[out] addr MAC 地址
+ * @return 成功返回 VOS_OK ,失败则返回 其他
+*/
+LONG vos_get_if_mac_addr(const CHAR *ifName,UCHAR addr[6]);
+
+/**
+ * 创建unix udp socket,包含创建、绑定和监听
+ * @param[in ] local_path 本地文件路径
+ * @param[in ] isbind 是否绑定端口
+ * @return 成功返回 文件描述符,失败则返回 其他
+*/
+LONG vos_unix_udp_socket_create(const CHAR *local_path,BOOL isbind);
+
+
+/**
+ * 创建unix tcp socket,包含创建、绑定和监听
+ * @param[in ] local_path 本地文件路径
+ * @param[in ] maxClient 最大连接数
+ * @return 成功返回 文件描述符,失败则返回 其他
+*/
+LONG vos_unix_tcp_server_socket_create(const CHAR *local_path, LONG maxClient);
+
+
+/**
+ * 创建unix tcp socket,包含创建和连接
+ * @param[in ] local_path 本地文件路径
+ * @return 成功返回 文件描述符,失败则返回 其他
+*/
+LONG vos_unix_tcp_client_socket_create(const CHAR *local_path);
+
+
+/**
+ * 创建tcp socket,包含创建、绑定和监听
+ * @param[in ] family VOS_AF_INET 和 VOS_AF_INET6
+ * @param[in ] addrStr IPv4/IPv6 地址
+ * @param[in ] port 端口号
+ * @param[in ] maxClient 最大连接数
+ * @return 成功返回 文件描述符,失败则返回 其他
+*/
+LONG vos_tcp_server_socket_create(vos_domain_t family,const CHAR *addrStr,SHORT port, LONG maxClient);
+
+/**
+ * 创建tcp socket,包含创建和连接
+ * @param[in ] family VOS_AF_INET 和 VOS_AF_INET6
+ * @param[in ] addrStr IPv4/IPv6 地址
+ * @param[in ] port 端口号
+ * @return 成功返回 文件描述符,失败则返回 其他
+*/
+LONG vos_tcp_client_socket_create(vos_domain_t family,const CHAR *addrStr,SHORT port);
+
+/**
+ * 创建udp socket,包含创建、绑定
+ * @param[in ] family VOS_AF_INET 和 VOS_AF_INET6
+ * @param[in ] addrStr IPv4/IPv6 地址
+ * @param[in ] port 端口号
+ * @return 成功返回 文件描述符,失败则返回 其他
+*/
+LONG vos_udp_server_socket_create(vos_domain_t family,const CHAR *addrStr,SHORT port);
+
+/**
+ * 创建udp socket,包含创建并返回server 地址结构
+ * @param[in ] family VOS_AF_INET 和 VOS_AF_INET6
+ * @param[in ] s_addrStr IPv4/IPv6 地址
+ * @param[in ] s_port 端口号
+ * @param[out] s_addr s_addr 由s_addrStr和s_port生成的地址结构
+ * @return 成功返回 文件描述符,失败则返回 其他
+*/
+LONG vos_udp_client_socket_create(vos_domain_t family,const CHAR *s_addrStr,SHORT s_port,vos_sockaddr_t *s_addr);
+
+
+/**
+ * 创建raw socket,包含创建、绑定
+ * @param[in ] protocol 协议
+ * @param[in ] ifName 网口名
+ * @return 成功返回 文件描述符,失败则返回 其他
+*/
+LONG vos_raw_server_socket_create(SHORT protocol,const CHAR *ifName);
+
+
+/**
+ * 创建sctp socket 绑定,可以指定多个地址,
+ * 如果 sock 参数为 IPv4 套接字,则传送给 sctp_bindx() 函数的地址必须为 IPv4 地址。
+ * 如果 sock 参数为 IPv6 套接字,则传送给 sctp_bindx() 函数的地址可以为 IPv4 或 IPv6 地址。
+ * @param[in ] sockfd 要绑定的socket
+ * @param[in ] addrs 地址数组
+ * @param[in ] addrcnt 地址个数
+ * @param[in ] flags 有如下取值:
+ * SCTP_BINDX_ADD_ADDR 指示 SCTP 将给定地址添加到关联中
+ * SCTP_BINDX_REM_ADDR 指示 SCTP 从关联中删除给定地址
+ * @return 成功返回 VOS_OK,失败则返回 其他
+*/
+LONG vos_sctp_bindx(LONG sockfd, vos_sockaddr_t *addrs, LONG addrcnt, LONG flags);
+
+
+/**
+ * 创建sctp socket 绑定,可以指定多个地址,
+ * 如果 sock 参数为 IPv4 套接字,则传送给 sctp_bindx() 函数的地址必须为 IPv4 地址。
+ * 如果 sock 参数为 IPv6 套接字,则传送给 sctp_bindx() 函数的地址可以为 IPv4 或 IPv6 地址。
+ * @param[in ] sockfd 要绑定的socket
+ * @param[in ] family 协议族,VOS_AF_INET 和 VOS_AF_INET6 有效
+ * @param[in ] port 端口号
+ * @param[in ] addrStr 地址字符串数组
+ * @param[in ] addrcnt 地址个数
+ * @param[in ] flags 有如下取值:
+ * SCTP_BINDX_ADD_ADDR 指示 SCTP 将给定地址添加到关联中
+ * SCTP_BINDX_REM_ADDR 指示 SCTP 从关联中删除给定地址
+ * @return 成功返回 VOS_OK,失败则返回 其他
+*/
+LONG vos_sctp_bindx_str(LONG sockfd,vos_domain_t family,SHORT port,CHAR *addrStr[], LONG addrcnt, LONG flags);
+
+
+
+/**
+ * 建立与指定socket的连接
+ * @param[in ] sockfd 欲建立连接的socket
+ * @param[in ] addrs 地址数组
+ * @param[in ] addrcnt 地址个数
+ * @param[out] id 关联ID
+ * @return 成功返回 VOS_OK ,失败则返回 其他
+*/
+LONG vos_sctp_connectx(LONG sockfd, vos_sockaddr_t *addrs, LONG addrcnt,sctp_assoc_t *id);
+
+
+/**
+ * 建立与指定socket的连接
+ * @param[in ] sockfd 欲建立连接的socket
+ * @param[in ] family 协议族
+ * @param[in ] port 端口号,当family为 VOS_AF_INET 和 VOS_AF_INET6 有效
+ * @param[in ] addrStr 地址字符串数组
+ * @param[in ] addrcnt 地址个数
+ * @param[out] id 关联ID
+ * @return 成功返回 VOS_OK ,失败则返回 其他
+*/
+LONG vos_sctp_connectx_str(LONG sockfd,vos_domain_t family,SHORT port,CHAR *addrStr[], LONG addrcnt,sctp_assoc_t *id);
+
+
+/**
+ * 向socket发送数据
+ * @param[in ] sockfd socket
+ * @param[in ] msg 存储数据的缓冲区
+ * @param[in ] len msg的大小
+ * @param[in ] sinfo 包含用于发送消息的参数。可以指定,流、ppid、TTL、关联 ID等。
+ * @param[in ] flags 此值在将逻辑运算 OR 以按位形式应用于以下零个或多个标志位时形成:
+ * MSG_UNORDERED :设置此标志之后,vos_sctp_sendmsg() 函数将无序传送消息。
+ * MSG_ADDR_OVER:设置此标志之后,vos_sctp_sendmsg() 函数将使用 to 参数中的地址,而不使用关联的主要目标地址。此标志仅用于一对多风格 SCTP 套接字。
+ * MSG_ABORT:设置此标志之后,指定的关联将异常中止,同时向其对等方发送 ABORT 信号。此标志仅用于一对多风格 SCTP 套接字。
+ * MSG_EOF:设置此标志之后,指定的关联将进入正常关闭状态。此标志仅用于一对多风格 SCTP 套接字。
+ * @return 成功返回 发送的字节数 ,失败则返回 VOS_ERROR
+*/
+LONG vos_sctp_send(LONG sockfd, const void *msg, size_t len,const struct sctp_sndrcvinfo *sinfo, LONG flags);
+
+
+
+/**
+ * 向socket发送数据
+ * @param[in ] sockfd socket
+ * @param[in ] msg 存储数据的缓冲区
+ * @param[in ] len msg的大小
+ * @param[in ] to 目的地址
+ * @param[in ] ppid 协议无关的一个自定义值,一般填0即可
+ * @param[in ] flags 同vos_sctp_send
+ * @param[in ] stream_no 此消息的目标流
+ * @param[in ] timetolive TTL 以毫秒为单位,0表示无限生命期。
+ * @param[in ] context 一个本地标志,用于检测无法发送到对端的消息,一般填0即可
+ * @return 成功返回 发送的字节数 ,失败则返回 VOS_ERROR
+*/
+LONG vos_sctp_sendmsg(LONG sockfd, const void *msg, size_t len, vos_sockaddr_t *to,
+ LONG ppid, LONG flags,
+ LONG stream_no, LONG timetolive, LONG context);
+
+
+
+/**
+ * 从socket接收数据
+ * @param[in ] sockfd socket
+ * @param[out] msg 存储数据的缓冲区
+ * @param[in ] len msg的大小
+ * @param[in ] from 源地址
+ * @param[out] sinfo 包含接收消息的参数。包含流、ppid、TTL、关联 ID等。
+ * @param[out] msg_flags 同vos_sctp_send
+ * @return 成功返回 接收的字节数 ,失败则返回 VOS_ERROR
+*/
+LONG vos_sctp_recvmsg(LONG sockfd, void *msg, size_t len, vos_sockaddr_t *from,
+ struct sctp_sndrcvinfo *sinfo,
+ LONG *msg_flags);
+
+/**
+ * 获取 socket 选项参数
+ * @param[in ] sockfd sctp socket
+ * @param[in ] level 选项定义的层次;支持SOL_SOCKET、IPPROTO_SCTP、IPPROTO_TCP、IPPROTO_IP和IPPROTO_IPV6。
+ * @param[in ] optname 需获取的选项
+ * @param[out] optval 存放获取的值
+ * @param[in ] optlen optval的大小
+ * @param[out] optlen 获取的大小
+ * @return 成功返回 VOS_OK,失败则返回 其他
+*/
+LONG vos_getsockopt(LONG sockfd, LONG level, LONG optname,void *optval, socklen_t *optlen);
+
+
+/**
+ * 设置 socket 选项参数
+ * @param[in ] sockfd sctp socket
+ * @param[in ] level 同 vos_getsockopt
+ * @param[in ] optname 需设置的选项
+ * @param[in ] optval 要设置的值
+ * @param[in ] optlen optval的大小
+ * @return 成功返回 VOS_OK,失败则返回 其他
+*/
+LONG vos_setsockopt(LONG sockfd, LONG level, LONG optname,const void *optval, socklen_t optlen);
+
+
+/**
+ * 关闭文件描述符
+ * @param[in ] sockfd socket
+ * @return 成功返回 VOS_OK,失败则返回 其他
+*/
+LONG vos_close(LONG sockfd);
+
+
+/**
+ * 从一对多式socket的关联标识id中抽取一个一对一式socket
+ * @param[in ] sockfd 一对多式socket
+ * @param[in ] assoc_id 关联标识id
+ * @return 成功返回 文件描述符,失败则返回 其他
+*/
+LONG vos_sctp_peeloff(LONG sockfd, sctp_assoc_t assoc_id);
+
+
+/**
+ * 获取 SCTP 相关的 socket 选项参数
+ * @param[in ] sockfd sctp socket
+ * @param[in ] assoc_id 关联标识id
+ * @param[in ] opt SCTP 相关的 socket 选项
+ * @param[out] arg 用于存放参数
+ * @param[out] size 参数的大小
+ * @return 成功返回 VOS_OK,失败则返回 其他
+*/
+LONG vos_sctp_opt_info(LONG sockfd, sctp_assoc_t assoc_id, LONG opt, void *arg, socklen_t *size);
+
+
+/**
+ * 获取 对端的 IP 地址,使用完需要调用 vos_sctp_freepaddrs 释放资源
+ * @param[in ] sockfd sctp socket
+ * @param[in ] assoc_id 关联标识id
+ * @param[out] addrs 用于存放地址
+ * @return 成功返回 地址个数,失败则返回 VOS_ERROR
+*/
+LONG vos_sctp_getpaddrs(LONG sockfd, sctp_assoc_t assoc_id,vos_sockaddr_t **addrs);
+
+
+/**
+ * 释放由 vos_sctp_getpaddrs 函数分配的资源,获取到 0 个时不需要释放
+ * @param[out] addrs vos_sctp_getpaddrs 返回的地址
+ * @return 成功返回 VOS_OK ,失败则返回 其他
+*/
+LONG vos_sctp_freepaddrs(vos_sockaddr_t *addrs);
+
+/**
+ * 获取 本地的 IP 地址,使用完需要调用 vos_sctp_freepaddrs 释放资源
+ * @param[in ] sockfd sctp socket
+ * @param[in ] assoc_id 关联标识id
+ * @param[out] addrs 用于存放地址
+ * @return 成功返回 地址个数,失败则返回 VOS_ERROR
+*/
+LONG vos_sctp_getladdrs(LONG sockfd, sctp_assoc_t assoc_id,vos_sockaddr_t **addrs);
+
+/**
+ * 释放由 vos_sctp_getladdrs 函数分配的资源,获取到 0 个时不需要释放
+ * @param[out] addrs vos_sctp_getladdrs 返回的地址
+ * @return 成功返回 VOS_OK ,失败则返回 其他
+*/
+LONG vos_sctp_freeladdrs(vos_sockaddr_t *addrs);
+
+/**
+ * 判断字符串是否为IPv4地址
+ * @param[in ] str 待判断字符串
+ * @return 是返回 TRUE ,否返回 FALSE
+*/
+BOOL vos_is_ipv4_addr(CHAR *str);
+
+/**
+ * 判断字符串是否为IPv6地址
+ * @param[in ] str 待判断字符串
+ * @return 是返回 TRUE ,否返回 FALSE
+*/
+BOOL vos_is_ipv6_addr(char *str);
+
+/**
+ * 判断两个addr是否相等
+ * @param[in ] addr1 待判断地址结构
+ * @param[in ] addr2 待判断地址结构
+ * @param[in ] ignPort 是否忽略端口号
+ * @return 相等则返回0,不相等返回非0
+*/
+LONG vos_sock_addr_cmp(vos_sockaddr_t *addr1,vos_sockaddr_t *addr2,BOOL ignPort);
+
+
+/**
+ * addr 地址结构转换成用于打印的字符串
+ * @param[in ] addr 地址结构
+ * @param[in ] str 用于存放生成的字符串
+ * @param[in ] size str大小
+ * @return 返回指向str的指针
+*/
+CHAR *vos_addr_showstr(vos_sockaddr_t *addr,CHAR *str,LONG size);
+
+
+/**
+ * 创建sctp 一对一 socket,包含创建、绑定和监听
+ * @param[in ] family VOS_AF_INET 和 VOS_AF_INET6
+ * @param[in ] addrs 地址数组
+ * @param[in ] addrcnt 地址个数
+ * @param[in ] port 端口号
+ * @param[in ] maxClient 最大连接数
+ * @param[in ] initmsg sctp 相关信息
+ * @param[in ] events sctp 事件,如果传入 NULL 则默认监听 data_io
+ * @return 成功返回 文件描述符,失败则返回 其他
+*/
+LONG vos_sctp_server_one2one_create(vos_domain_t family,vos_sockaddr_t *addrs,LONG addrcnt, SHORT port, LONG maxClient,struct sctp_initmsg *initmsg,struct sctp_event_subscribe *events);
+
+/**
+ * 创建sctp 一对一 socket,包含创建 和 连接
+ * @param[in ] family VOS_AF_INET 和 VOS_AF_INET6
+ * @param[in ] s_addrs 地址数组
+ * @param[in ] s_addrcnt 地址个数
+ * @param[in ] s_port 端口号
+ * @param[in ] initmsg sctp 相关信息
+ * @param[in ] events sctp 事件,如果传入 NULL 则默认监听 data_io
+ * @param[out] id sctp_assoc id
+ * @return 成功返回 文件描述符,失败则返回 其他
+*/
+LONG vos_sctp_client_one2one_create(vos_domain_t family,vos_sockaddr_t *s_addrs,LONG s_addrcnt, SHORT s_port,
+ struct sctp_initmsg *initmsg,struct sctp_event_subscribe *events,sctp_assoc_t *id);
+
+
+/**
+ * 通过字符串地址创建sctp 一对一 socket,包含创建 和 连接
+ * @param[in ] family VOS_AF_INET 和 VOS_AF_INET6
+ * @param[in ] s_addrStr 地址数组
+ * @param[in ] s_addrcnt 地址个数
+ * @param[in ] s_port 端口号
+ * @param[in ] initmsg sctp 相关信息
+ * @param[in ] events sctp 事件,如果传入 NULL 则默认监听 data_io
+ * @param[out] id sctp_assoc id
+ * @return 成功返回 文件描述符,失败则返回 其他
+*/
+LONG vos_sctp_client_one2one_str_create(vos_domain_t family,CHAR *s_addrStr[],LONG s_addrcnt, SHORT s_port,
+ struct sctp_initmsg *initmsg,struct sctp_event_subscribe *events,sctp_assoc_t *id);
+
+
+/**
+ * 创建sctp 一对一 socket,包含创建、绑定和监听
+ * @param[in ] family VOS_AF_INET 和 VOS_AF_INET6
+ * @param[in ] addrStr 地址字符串数组
+ * @param[in ] addrcnt 地址个数
+ * @param[in ] port 端口号
+ * @param[in ] maxClient 最大连接数
+ * @param[in ] initmsg sctp 相关信息
+ * @param[in ] events sctp 事件,如果传入 NULL 则默认监听 data_io
+ * @return 成功返回 文件描述符,失败则返回 其他
+*/
+LONG vos_sctp_server_one2one_str_create(vos_domain_t family,CHAR *addrStr[],LONG addrcnt, SHORT port, LONG maxClient,struct sctp_initmsg *initmsg,struct sctp_event_subscribe *events);
+
+
+/**
+ * 创建sctp 一对多 socket,包含创建、绑定和监听
+ * @param[in ] family VOS_AF_INET 和 VOS_AF_INET6
+ * @param[in ] addrs 地址数组
+ * @param[in ] addrcnt 地址个数
+ * @param[in ] port 端口号
+ * @param[in ] maxClient 最大连接数
+ * @param[in ] initmsg sctp 相关信息
+ * @param[in ] events sctp 事件,如果传入 NULL 则默认监听 data_io
+ * @return 成功返回 文件描述符,失败则返回 其他
+*/
+LONG vos_sctp_server_one2many_create(vos_domain_t family,vos_sockaddr_t *addrs,LONG addrcnt, SHORT port, LONG maxClient,struct sctp_initmsg *initmsg,struct sctp_event_subscribe *events);
+
+/**
+ * 创建sctp 一对多 socket,包含创建
+ * @param[in ] family VOS_AF_INET 和 VOS_AF_INET6
+ * @param[in ] s_addrs 地址数组
+ * @param[in ] s_addrcnt 地址个数
+ * @param[in ] s_port 端口号
+ * @param[in ] initmsg sctp 相关信息
+ * @param[in ] events sctp 事件,如果传入 NULL 则默认监听 data_io
+ * @return 成功返回 文件描述符,失败则返回 其他
+*/
+LONG vos_sctp_client_one2many_create(vos_domain_t family,vos_sockaddr_t *s_addrs,LONG s_addrcnt, SHORT s_port,
+ struct sctp_initmsg *initmsg,struct sctp_event_subscribe *events);
+
+/**
+ * 创建sctp 一对多 socket,包含创建、绑定和监听
+ * @param[in ] family VOS_AF_INET 和 VOS_AF_INET6
+ * @param[in ] addrStr 地址字符串数组
+ * @param[in ] addrcnt 地址个数
+ * @param[in ] port 端口号
+ * @param[in ] maxClient 最大连接数
+ * @param[in ] initmsg sctp 相关信息
+ * @param[in ] events sctp 事件,如果传入 NULL 则默认监听 data_io
+ * @return 成功返回 文件描述符,失败则返回 其他
+*/
+LONG vos_sctp_server_one2many_str_create(vos_domain_t family,CHAR *addrStr[],LONG addrcnt, SHORT port, LONG maxClient,struct sctp_initmsg *initmsg,struct sctp_event_subscribe *events);
+
+/**
+ * 通过字符串地址创建sctp 一对多 socket,包含创建
+ * @param[in ] family VOS_AF_INET 和 VOS_AF_INET6
+ * @param[in ] s_addrStr 地址数组
+ * @param[in ] s_addrcnt 地址个数
+ * @param[in ] s_port 端口号
+ * @param[in ] initmsg sctp 相关信息
+ * @param[in ] events sctp 事件,如果传入 NULL 则默认监听 data_io
+ * @return 成功返回 文件描述符,失败则返回 其他
+*/
+LONG vos_sctp_client_one2many_str_create(vos_domain_t family,CHAR *s_addrStr[],LONG s_addrcnt, SHORT s_port,
+ struct sctp_initmsg *initmsg,struct sctp_event_subscribe *events);
+
+
+LONG vos_udp_client_socket_create_bind(vos_domain_t family,const CHAR *s_addrStr,SHORT s_port,vos_sockaddr_t *s_addr,vos_sockaddr_t *my_addr);
+
+LONG vos_tcp_client_socket_create_bind(vos_domain_t family,const CHAR *addrStr,SHORT port,vos_sockaddr_t *my_addr);
+
+LONG vos_sctp_client_one2one_create_bind(vos_domain_t family,vos_sockaddr_t *s_addrs,LONG s_addrcnt, SHORT s_port,
+ struct sctp_initmsg *initmsg,struct sctp_event_subscribe *events,sctp_assoc_t *id,
+ vos_sockaddr_t *my_addrs,LONG my_addrcnt);
+
+LONG vos_sctp_client_one2many_create_bind(vos_domain_t family,vos_sockaddr_t *s_addrs,LONG s_addrcnt, SHORT s_port,
+ struct sctp_initmsg *initmsg,struct sctp_event_subscribe *events,
+ vos_sockaddr_t *my_addrs,LONG my_addrcnt);
+
+
+#ifdef __cplusplus
+}
+#endif /* end of __cplusplus */
+
+#endif /* end of __VOS_SOCKET_H__ */
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+#ifndef __VOS_STRING_H__
+#define __VOS_STRING_H__
+
+#ifdef __cplusplus
+extern "C"{
+#endif /* __cplusplus */
+
+/** 同 memcpy */
+VOID *VOS_MemCpy(VOID * pcDest, const VOID * pcSrc, ULONG ulLen);
+
+/** 同 memmove */
+VOID *VOS_MemMove(VOID * pcDest, const VOID * pcSrc, ULONG ulLen);
+
+/** 同 memset */
+VOID *VOS_MemSet(VOID *pcBuf, CHAR cWhat, ULONG ulHowMany);
+
+/** 同 memset(&var,0,sizeof(var)) */
+VOID *VOS_MemZero(VOID *pcBuf, ULONG ulHowMany);
+
+/** 同 memcmp */
+LONG VOS_MemCmp(const VOID *pcBuf1, const VOID *pcBuf2, ULONG ulLen);
+
+/** 同 strchr */
+CHAR *VOS_StrChr(const CHAR *pcStr, CHAR cCh);
+
+/** 同 strrchr */
+CHAR *VOS_StrRChr(const CHAR *pcStr, CHAR cCh);
+
+/** 同 strcat */
+CHAR *VOS_StrCat(CHAR *pcDest, const CHAR *pcAppend);
+
+/** 同 strncat */
+CHAR *VOS_StrnCat(CHAR *pcDest, const CHAR *pcAppend, ULONG ulLen);
+
+/** 同 strcpy */
+CHAR *VOS_StrCpy(CHAR *pcDest, const CHAR *pcSrc);
+
+/** 同 strncpy */
+CHAR *VOS_StrnCpy(CHAR * pcDest,const CHAR *pcSrc, ULONG ulCount);
+
+/** 同 strncmp */
+ULONG VOS_StrnCmp(const CHAR * cs, const CHAR * ct, ULONG count);
+
+/** 同 strcmp */
+LONG VOS_StrCmp(const CHAR *szStr1, const CHAR *szStr2);
+
+/** 同 strlen */
+ULONG VOS_StrLen(const CHAR *szStr);
+
+/** 同 strstr */
+CHAR *VOS_StrStr(const CHAR *szStr, const CHAR *szToFind);
+
+/** 同 strncmp */
+CHAR *VOS_StrpBrk(const CHAR *szStr, const CHAR *szToFind);
+
+/** 同 atol */
+LONG VOS_AtoL(const CHAR *szString);
+
+/** 同 strtol */
+LONG VOS_StrToL(const CHAR *cp,CHAR **endp,INT base);
+
+/** 同 strtoul */
+ULONG VOS_StrToUL(const CHAR *szNptr, CHAR **szEndptr, INT ulBase );
+
+/** 同 strtoll */
+LONGLONG VOS_StrToLL(const CHAR *cp,CHAR **endp,INT base);
+
+/** 同 strtoull */
+ULONGLONG VOS_StrToULL(const CHAR *cp,CHAR **endp,INT base);
+
+/** 同 strtok */
+CHAR * VOS_StrToK(CHAR* strToken, const CHAR * strDelimit);
+
+/** 同 atoi */
+INT VOS_AtoI(const CHAR* s);
+
+/** 同 strncasecmp */
+ULONG VOS_StrnCaseCmp(const CHAR*, const CHAR*, ULONG ulLen);
+
+/** 同 strcasecmp */
+LONG VOS_StrCaseCmp(const CHAR *cs, const CHAR *ct);
+
+/** 同 strnlen */
+ULONG VOS_StrnLen(const CHAR * s, ULONG count);
+
+/** 将字符串转换为小写 */
+CHAR *VOS_StrToLower(CHAR *src);
+
+/** 将字符串转换为大写 */
+CHAR *VOS_StrToUpper(CHAR *src);
+
+
+/**
+ * 复制字符串,申请大小为strlen(src)+1内存,然后将字符串拷入,并返回
+ * @param[in] src 源字符串
+ * @param[in] mod_id 模块ID
+ * @return 成功返回新字符串的地址,失败返回NULL
+ */
+CHAR *VOS_StrDup (const CHAR *src,INT mod_id);
+
+
+/**
+ * 复制字符串,并转换为小写,申请大小为strlen(src)+1内存,然后将字符串拷入,并返回
+ * @param[in] src 源字符串
+ * @param[in] mod_id 模块ID
+ */
+CHAR *VOS_StrDupToLower (const CHAR *src,INT mod_id);
+
+
+/**
+ * 计算从左侧第一个不是空白字符起到字符串结尾的长度
+ * @param[in] szStr 字符串
+* @return 字符串长度
+*/
+ULONG VOS_StrLeftTrimLen(const CHAR *szStr);
+
+
+/**
+ * 将str 中的old字符替换成new字符
+ * @param[in] src 字符串
+ * @param[in] old 要替换的字符
+ * @param[in] new 替换成的字符
+ * @return 返回指向src的指针
+ */
+CHAR *VOS_StrCharReplace(CHAR *src,const CHAR old,const CHAR new);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /*__VOS_STRING_H__*/
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+
+
+#ifndef __VOS_SYS_DIFF_H__
+#define __VOS_SYS_DIFF_H__
+
+#include "vos_types.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+#if OS_LINUX
+#define __TASK_PRIORITY_TIME_CRITICAL 90 /* tTimer */
+#define __TASK_PRIORITY_HIGHEST 80 /* tDevice */
+#define __TASK_PRIORITY_HIGHER 70 /* consloe telnet */
+#define __TASK_PRIORITY_HIGH 60 /* cdp等 *//*hot */
+#define __TASK_PRIORITY_ABOVE_NORMAL 50 /* stp *//* IP Receive *//*backup*/
+#define __TASK_PRIORITY_NORMAL 40 /* protocols *//* FDB FIB *//* radius */
+#define __TASK_PRIORITY_BELOW_NORMAL 30 /* syslog */
+#define __TASK_PRIORITY_LOWEST 10
+#define __TASK_PRIORITY_IDLE 1
+#define __VOS_DEFAULT_STACKSIZE 1024*1024*8 /* 任务的缺省栈大小. */
+#endif
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __VOS_SYS_DIFF_H__ */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+
+
+
+#ifndef __VOS_SYSMSG_H__
+#define __VOS_SYSMSG_H__
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+typedef struct
+{
+ USHORT usMessageType; /*用于指示发送或接收*/
+ USHORT usPririty; /*优先级(用户自己定义),支持4个优先级 */
+ ULONG ulSrcModuleID; /*源模块号*/
+ ULONG ulDstModuleID; /*目标模块号*/
+ ULONG ulSequence; /*发送序号,RPC专用*/
+
+ ULONG ulSrcSlotID; /*源槽位号*/
+ ULONG ulDstSlotID; /*目的槽位号*/
+ UCHAR ucMsgType; /*消息类型,如PDU, TIMER, REQUEST, NOTIFY... */
+ UCHAR ucMsgBodyStyle; /*用于指明消息头和消息体是否是一体的*/
+ USHORT usMsgCode; /*消息码,具体消息类型的细分*/
+ LONG ulUserCode; /* usertask user code */
+
+ USHORT usResponseType; /*是否要求接收方用户应答:ACK/ NOACK/NEGACK*/
+ USHORT usFrameLen; /*frame content 的长度 ,用户数据区长度*/
+ VOID * ptrMsgBody; /*消息体指针*/
+ USHORT usAppSeqNum; /*应用层系列号,用于发送方和接收方请求应答之间建立关联*/
+ USHORT usReserved; /*保留 ,以后扩充使用*/
+} SYS_MSG_S;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__SYSDEF_H__*/
+
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+#ifndef __VOS_TASK_H__
+#define __VOS_TASK_H__
+
+#include "vos_types.h"
+#include "vos_module.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/** VOS任务的参数个数. */
+#define VOS_MAX_TASK_ARGS 10
+
+/** 任务的缺省栈大小. */
+#define VOS_DEFAULT_STACKSIZE __VOS_DEFAULT_STACKSIZE
+
+/** 任务入口定义宏. */
+#define DECLARE_VOS_TASK(VOS_TASK_ENTRY)\
+ VOID VOS_TASK_ENTRY(\
+ ULONG ulArg1, ULONG ulArg2,\
+ ULONG ulArg3, ULONG ulArg4,\
+ ULONG ulArg5, ULONG ulArg6,\
+ ULONG ulArg7, ULONG ulArg8,\
+ ULONG ulArg9, ULONG ulArg10\
+ )
+
+/** 任务优先级枚举值,创建任务时请使用下面的枚举值,不要用立即数. */
+typedef enum VOS_task_pri_s
+{
+ TASK_PRIORITY_TIME_CRITICAL = __TASK_PRIORITY_TIME_CRITICAL,
+ TASK_PRIORITY_HIGHEST = __TASK_PRIORITY_HIGHEST,
+ TASK_PRIORITY_HIGHER = __TASK_PRIORITY_HIGHER,
+ TASK_PRIORITY_HIGH = __TASK_PRIORITY_HIGH,
+ TASK_PRIORITY_ABOVE_NORMAL = __TASK_PRIORITY_ABOVE_NORMAL,
+ TASK_PRIORITY_NORMAL = __TASK_PRIORITY_NORMAL,
+ TASK_PRIORITY_BELOW_NORMAL = __TASK_PRIORITY_BELOW_NORMAL,
+ TASK_PRIORITY_LOWEST = __TASK_PRIORITY_LOWEST,
+ TASK_PRIORITY_IDLE = __TASK_PRIORITY_IDLE,
+}VOS_task_pri_t;
+
+typedef VOS_msg_code_handler_ptr VOS_user_task_entry;
+
+
+/** 用户任务结构体 */
+typedef struct VOS_user_task_s
+{
+ CHAR userTaskName[VOS_NAME_MAX_LENGTH]; ///< 用户任务名
+ VOS_user_task_entry userTaskEntry; ///< 用户任务入口
+ ULONG moduleID; ///< 用于 VOS_Malloc 的第二个参数
+}VOS_user_task_t;
+
+
+/** 任务入口函数类型. */
+typedef VOID (*VOS_TASK_ENTRY)( ULONG pArg1, ULONG pArg2, ULONG pArg3,
+ ULONG pArg4, ULONG pArg5, ULONG pArg6,
+ ULONG pArg7, ULONG pArg8, ULONG pArg9,
+ ULONG pArg10 );
+
+/**
+ * 任务创建 宏,
+ * 该宏 会创建一个线程,栈大小为 VOS_DEFAULT_STACKSIZE 。
+ * @param[in] taskName 任务名,长度为 VOS_NAME_MAX_LENGTH
+ * @param[in] lPriority 优先级,使用 VOS_task_pri_t 枚举值
+ * @param[in] pfEntry 任务入口函数, 原型为VOS_TASK_ENTRY,10个ULONG 参数,无返回值
+ 定义时使用宏DECLARE_VOS_TASK定义,eg:DECLARE_VOS_TASK(task1){ .... }
+ * @param[in] lTaskArg 传给任务入口函数的参数,类型为ULONG pArgs[10]
+ * @return 成功返回VOS_HANDLE 类型的任务句柄,失败返回NULL
+ */
+#define VOS_TaskCreate( taskName, lPriority, pfEntry, lTaskArg )\
+ VOS_TaskCreate_Ex_X( taskName, pfEntry, #pfEntry, (ULONG)(lPriority), VOS_DEFAULT_STACKSIZE, (ULONG *)(lTaskArg) )
+
+/**
+ * 任务创建 宏,
+ * 该宏 会创建一个线程。
+ * @param[in] taskName 任务名,长度为 VOS_NAME_MAX_LENGTH
+ * @param[in] pfEntry 任务入口函数, 原型为VOS_TASK_ENTRY,10个ULONG 参数,无返回值
+ 定义时使用宏DECLARE_VOS_TASK定义,eg:DECLARE_VOS_TASK(task1){ .... }
+ * @param[in] lPriority 优先级,使用 VOS_task_pri_t 枚举值
+ * @param[in] ulStackSize 栈大小
+ * @param[in] lTaskArg 传给任务入口函数的参数,类型为ULONG pArgs[10]
+ * @return 成功返回VOS_HANDLE 类型的任务句柄,失败返回NULL
+ */
+#define VOS_TaskCreateEx( taskName, pfEntry, lPriority, ulStackSize, lTaskArg )\
+ VOS_TaskCreate_Ex_X( taskName, pfEntry, #pfEntry, lPriority, ulStackSize, lTaskArg )
+
+
+/**
+ * 任务延时 宏,
+ * 当前任务睡眠一定的时间.
+ * @param[in] lMsec 延时时间,毫秒
+ * @return VOS_OK - 成功,其他 - 失败
+ */
+#define VOS_TaskDelay( lMsec )\
+ (LONG)VOS_TaskDelay_Ex_X( (lMsec), __FILE__, __LINE__ )
+
+
+/**
+ * 任务删除 API,
+ * 将指定任务删除 。
+ * @param[in] hTaskHandle 任务创建时返回的任务句柄
+ * @param[in] ulExitCode 任务退出码,仅在windows系统中有效,其他传 0 即可
+ * @return VOS_OK - 成功,其他 - 失败
+ */
+LONG VOS_TaskTerminate( VOS_HANDLE hTaskHandle, ULONG ulExitCode );
+
+/**
+ * 将任务信息注册到vos task,在任务入口的最开始调用。main函数则在调用VOS_init()后调用
+ * @return VOS_OK - 成功,其他 - 失败
+ */
+LONG VOS_TaskInfoAttach(void);
+
+/**
+* 得到当前VOS任务句柄
+* @return 成功返回VOS_HANDLE 类型的任务句柄,失败返回NULL
+*/
+VOS_HANDLE VOS_GetCurrentTask( VOID );
+
+
+/**
+ * 获得任务优先级
+ *
+ * @param[in] hTaskHandle 任务创建时返回的任务句柄
+ * @param[out] pPrio 任务优先级
+ * @return VOS_OK - 成功,其他 - 失败
+ */
+LONG VOS_TaskGetPriority( VOS_HANDLE hTaskHandle, ULONG *pPrio );
+
+
+/**
+ * 设置任务优先级
+ *
+ * @param[in] hTaskHandle 任务创建时返回的任务句柄
+ * @param[in] ulnewPrio 任务优先级
+ * @return VOS_OK - 成功,其他 - 失败
+ */
+LONG VOS_TaskSetPriority( VOS_HANDLE hTaskHandle, ULONG ulnewPrio );
+
+
+/**
+ * 获取当前任务的名字.
+ *
+ * @param[out] szTaskName 任务名,长度 VOS_NAME_MAX_LENGTH
+ * @return VOS_OK - 成功,其他 - 失败
+ */
+LONG VOS_GetCurrentTaskName( CHAR szTaskName[VOS_NAME_MAX_LENGTH] );
+
+
+/**
+ * 判断任务句柄是否有效.
+ *
+ * @param[in] hTaskHandle 任务句柄
+ * @return 有效返回真,否则返回假
+ */
+BOOL VOS_TaskHandleVerify( VOS_HANDLE hTaskHandle );
+
+
+/**
+ * 创建宿主任务,宿主任务可以绑定多个用户任务(回调函数),栈大小为 VOS_DEFAULT_STACKSIZE。
+ * @param[in] taskName 任务名,长度为 VOS_NAME_MAX_LENGTH
+ * @param[in] lPriority 优先级,使用 VOS_task_pri_t 枚举值
+ * @return 成功返回VOS_HANDLE 类型的任务句柄,失败返回NULL
+ */
+#define VOS_TaskHostCreate( taskName, lPriority )\
+ VOS_TaskHostCreate_Ex_X( taskName, lPriority, VOS_DEFAULT_STACKSIZE)
+
+/**
+ * 创建宿主任务,宿主任务可以绑定多个用户任务(回调函数)。
+ * @param[in] taskName 任务名,长度为 VOS_NAME_MAX_LENGTH
+ * @param[in] lPriority 优先级,使用 VOS_task_pri_t 枚举值
+ * @param[in] ulStackSize 栈大小
+ * @return 成功返回VOS_HANDLE 类型的任务句柄,失败返回NULL
+ */
+#define VOS_TaskHostCreateEx( taskName, lPriority, ulStackSize )\
+ VOS_TaskHostCreate_Ex_X( taskName, lPriority, ulStackSize )
+
+
+
+/**
+ * 删除宿主任务,同时该宿主任务下的用户任务将被全部删除
+ *
+ * @param[in ] szTaskName 宿主任务名
+ * @param[in ] ulExitCode 退出码(暂未使用,填0即可)
+ * @return VOS_OK - 成功,其他 - 失败
+ */
+LONG VOS_TaskHostTerminate(CHAR szTaskName[VOS_NAME_MAX_LENGTH], ULONG ulExitCode);
+
+
+/**
+ * 向宿主任务中添加用户任务(回调函数)。
+ *
+ * @param[in ] hostTaskName 宿主任务名
+ * @param[in ] userTask 用户任务
+ * @return VOS_OK - 成功,其他 - 失败
+ */
+LONG VOS_UserTaskAttach(CHAR hostTaskName[VOS_NAME_MAX_LENGTH],VOS_user_task_t *userTask);
+
+
+/**
+ * 从宿主任务中删除用户任务(回调函数)。
+ *
+ * @param[in ] hostTaskName 宿主任务名
+ * @param[in ] userTaskName 用户任务
+ * @return VOS_OK - 成功,其他 - 失败
+ */
+LONG VOS_UserTaskDetach(CHAR hostTaskName[VOS_NAME_MAX_LENGTH],CHAR userTaskName[VOS_NAME_MAX_LENGTH]);
+
+
+
+/**
+ * 设置任务的CPU亲和性
+ *
+ * @param[in ] taskName 任务名(包含宿主任务,不包含用户任务)
+ * @param[in ] size CPU个数
+ * @param[in ] cpus CPU ID 数组
+ * @return VOS_OK - 成功,其他 - 失败
+ */
+LONG VOS_TaskAffinitySet(CHAR taskName[VOS_NAME_MAX_LENGTH],LONG size,LONG cpus[]);
+
+
+/**
+ * 获取任务的CPU亲和性,如果实际CPU个数超过cpus数组大小,则只返回size个cpu ID,返回值为 VOS_ERROR_BAD_ARGUMENTS
+ *
+ * @param[in ] taskName 任务名(包含宿主任务,不包含用户任务)
+ * @param[in ] size cpus数组大小
+ * @param[out] size cpus数组有效值个数
+ * @param[in ] cpus CPU ID 数组
+ * @return VOS_OK - 成功,其他 - 失败
+ */
+LONG VOS_TaskAffinityGet(CHAR taskName[VOS_NAME_MAX_LENGTH],LONG *size,LONG cpus[]);
+
+
+
+/*=========================================================================================================================*/
+/* ###### 下面的函数不要直接调用,使用上面提供的宏 ###### */
+
+/**
+* 任务创建 API,不要直接使用,通过 VOS_TaskCreate 宏使用
+* 该API会创建一个线程,栈大小为 VOS_DEFAULT_STACKSIZE 。
+* @param[in] szTaskName 任务名,长度为 VOS_NAME_MAX_LENGTH
+* @param[in] pfnFunc 任务入口函数, 原型为VOS_TASK_ENTRY,10个ULONG 参数,无返回值
+* @param[in] szFuncName 任务入口函数名
+* @param[in] ulStartPriority 优先级,使用 VOS_task_pri_t 枚举值
+* @param[in] ulStackSize 栈大小
+* @param[in] pArgs 传给任务入口函数的参数,类型为ULONG pArgs[10]
+* @return 成功返回VOS_HANDLE 类型的任务句柄,失败返回NULL
+*/
+VOS_HANDLE VOS_TaskCreate_Ex_X( CHAR szTaskName[VOS_NAME_MAX_LENGTH],
+ VOS_TASK_ENTRY pfnFunc,
+ CHAR *szFuncName,
+ ULONG ulStartPriority,
+ ULONG ulStackSize,
+ ULONG pArgs[VOS_MAX_TASK_ARGS]);
+
+/**
+* 任务延时 API,不要直接使用,通过 VOS_TaskDelay 宏使用
+* 当前任务睡眠一定的时间.
+* @param[in] lMsec 延时时间,毫秒
+* @param[in] szFileName 调用者的文件
+* @param[in] iLine 调用者的行号
+* @return VOS_OK - 成功,其他 - 失败
+*/
+LONG VOS_TaskDelay_Ex_X( ULONG lMsec, CHAR *szFileName, INT iLine );
+
+
+/**
+ * 创建宿主任务,不要直接使用,通过 VOS_TaskHostCreate 宏使用,宿主任务可以绑定多个用户任务(回调函数)。
+ *
+ * @param[in] szTaskName 任务名,长度为 VOS_NAME_MAX_LENGTH
+ * @param[in] ulStartPriority 优先级,使用 VOS_task_pri_t 枚举值
+ * @param[in] ulStackSize 栈大小
+ * @return 成功返回VOS_HANDLE 类型的任务句柄,失败返回NULL
+ */
+VOS_HANDLE VOS_TaskHostCreate_Ex_X( CHAR szTaskName[VOS_NAME_MAX_LENGTH],
+ ULONG ulStartPriority,
+ ULONG ulStackSize);
+
+
+/**
+ * 获得当前任务的进程ID(PID)
+ *
+ * @return 返回进程ID(PID)
+ */
+ULONG VOS_TaskSelfGetPID(void);
+
+
+/**
+ * 获得当前任务的线程ID(SPID)
+ *
+ * @return 返回线程ID(SPID)
+ */
+ULONG VOS_TaskSelfGetSPID(void);
+
+
+/**
+ * 获得当前任务的线程ID(thread ID)
+ *
+ * @return 返回线程ID(thread ID)
+ */
+ULONG VOS_TaskSelfThreadID(void);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __VOS_TASK_H__ */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+#ifndef __VOS_TIME_H__
+#define __VOS_TIME_H__
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+#include "vos_types.h"
+
+#define VOS_TIME_STR_LEN 20
+
+typedef struct LOCAL_TIME {
+ USHORT usYear;
+ USHORT usMonth;
+ USHORT usDayOfWeek;
+ USHORT usDay;
+ USHORT usHour;
+ USHORT usMinute;
+ USHORT usSecond;
+ USHORT usMilliseconds;
+}VOS_LOCAL_TIME;
+
+
+
+/**
+ * 获取当前时间
+ * @param[in] vos_time 存储时间的指针
+ * @return 成功返回 VOS_OK,失败则返回其他
+ */
+LONG VOS_local_time( VOS_LOCAL_TIME *vos_time );
+
+
+/**
+ * 获取当前时间
+ * @param[out] sys_time 时间
+ * @return 返回值同 sys_time
+ */
+LONG VOS_time( LONG *sys_time );
+
+/**
+ * 时间转换,local time 转成秒数
+ * @param[out] sys_time 时间
+ * @return 返回 sys_time 对应的秒数
+ */
+LONG VOS_mkTime(const VOS_LOCAL_TIME *sys_time );
+
+
+/**
+ * 时间转换,秒数 转成local time
+ * @param[out] sys_time 时间
+ * @param[in ] time 时间秒数
+ * @return 成功返回 VOS_OK,失败则返回其他
+ */
+LONG VOS_mkLocalTime( VOS_LOCAL_TIME *sys_time ,LONG time);
+
+
+/**
+ * 获得时间字符串 YYYY-MM-DD hh:mm:ss
+ * 如果sys_time非空则根据sys_time转换,否则根据time转换,time为0时取当前时间转换,
+ * 转换完成后存入str中
+ * @param[in ] sys_time 时间
+ * @param[in ] time 时间秒数
+ * @param[out] str 时间字符串
+ * @return 指向str的指针
+ */
+CHAR *VOS_mkLocalTimeStr( VOS_LOCAL_TIME *sys_time ,LONG time,CHAR str[VOS_TIME_STR_LEN]);
+
+
+/**
+ * 将时间字符串 YYYY-MM-DD hh:mm:ss 转换,为VOS_LOCAL_TIME 和 LONG型
+ * sys_time和time不为空则填入转换后的值,某一项不需要可以使用NULL
+ * @param[in ] str 时间字符串
+ * @param[out] sys_time 时间
+ * @param[out] time 时间秒数
+ * @return 成功返回 VOS_OK,失败则返回其他
+ */
+LONG VOS_StrmkLocalTime( CHAR str[VOS_TIME_STR_LEN],VOS_LOCAL_TIME *sys_time ,LONG *time);
+
+
+/**
+ * 将时间秒数转换成 snmp 时间
+ * @param[in ] sys_time 时间秒数
+ * @param[out] snmpTime 时间
+ * @return 成功返回 VOS_OK,失败则返回其他
+ */
+LONG vos_time2snmp(LONG sys_time,VOS_SNMP_DateAndTime_t *snmpTime);
+
+#ifdef __cplusplus
+}
+#endif /* end of __cplusplus */
+
+#endif /* end of __VOS_TIME_H__ */
+
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+#ifndef __VOS_TIMER_H__
+#define __VOS_TIMER_H__
+#include "vos_types.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+
+/** VOS Timer 类型枚举值 */
+typedef enum
+{
+ VOS_TIMER_LOOP, ///< 循环执行的timer
+ VOS_TIMER_NO_LOOP, ///< 执行一次的timer
+}VOS_TIMER_TYPE_EN;
+
+
+/**
+ * 创建定时器
+ * @param[in] ulModuleId 模块ID
+ * @param[in] msgQId 如果pfTimerFunc非空则无效;如果pfTimerFunc为NULL,则向msgQId队列发送定时器超时消息
+ * @param[in] lMillSec 定时器的时间,毫秒
+ * @param[in] pfTimerFunc 超时回调函数
+ * @param[in] pArg 回调函数参数
+ * @param[in] enType 定时器类型
+ * @return 返回Timer ID,失败则返回VOS_ERROR
+ */
+LONG VOS_TimerCreate(ULONG ulModuleId, ULONG msgQId, LONG lMillSec,
+ VOID (*pfTimerFunc)(VOID *), VOID *pArg, VOS_TIMER_TYPE_EN enType);
+
+
+/**
+* 改变定时器时间,不能在超时回调函数中调用
+* @param[in] ulModuleId 模块ID
+* @param[in] ulTimerId 定时器Id
+* @param[in] lMillSec 定时器的时间,毫秒
+* @return 成功返回VOS_OK,失败则返回VOS_ERROR
+*/
+LONG VOS_TimerChange(ULONG ulModuleId, ULONG ulTimerId, LONG lMillSec);
+
+
+/**
+* 删除定时器
+* @param[in] ulModuleId 模块ID
+* @param[in] ulTimerId 定时器Id
+* @return 成功VOS_OK,失败则返回VOS_ERROR
+*/
+LONG VOS_TimerDelete(ULONG ulModuleId, ULONG ulTimerId);
+
+
+/**
+ * 创建微秒定时器,必须绑核
+ * @param[in] ulModuleId 模块ID
+ * @param[in] luSec 定时器的时间,微妙
+ * @param[in] pfTimerFunc 超时回调函数
+ * @param[in] pArg 回调函数参数
+ * @param[in] enType 定时器类型
+ * @param[in] cpuNum CPU个数
+ * @param[in] cpus CPU ID 数组
+ * @return 返回Timer ID,失败则返回VOS_ERROR
+ */
+LONG VOS_usTimerCreate(ULONG ulModuleId,LONG luSec,VOID (*pfTimerFunc)(VOID *), VOID *pArg, VOS_TIMER_TYPE_EN enType,LONG cpuNum,LONG cpus[]);
+
+
+
+/**
+ * 创建微秒定时器,必须绑核
+ * @param[in] ulModuleId 模块ID
+ * @param[in] ulTimerId Timer ID
+ * @return 成功VOS_OK,失败则返回VOS_ERROR
+ */
+LONG VOS_usTimerDestroy(ULONG ulModuleId, ULONG ulTimerId);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __VOS_TIMER_H__ */
--- /dev/null
+/******************************************************************************
+###############################################################################
+# Copyright (c) [2017-2020] [ICT/CAS] #
+# Licensed under the ORAN Software License v1.0 (License) #
+###############################################################################
+******************************************************************************/
+
+
+#include "vos_sys_diff.h"
+
+#ifndef _VOS_TYPES_H_
+#define _VOS_TYPES_H_
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+#include <stddef.h>
+
+#define VOS_NAME_MAX_LENGTH 128 /* VOS有名字的对象的名字的最大长度. */
+
+
+#define VOS_YES (1)
+#define VOS_NO (0)
+
+#define VOS_OK (0)
+#define VOS_ERROR (-1)
+
+#define VOS_FALSE (0)
+#define VOS_TRUE (1)
+
+#define CONST const
+#define VOS_PACKED __attribute__((packed))
+
+typedef struct VOS_MAC_addr_s{
+ unsigned char addr[6];
+}VOS_PACKED VOS_MAC_addr_t;
+
+typedef struct VOS_IPv4_addr_s{
+ unsigned long addr;
+}VOS_PACKED VOS_IPv4_addr_t;
+
+typedef struct VOS_IPv6_addr_s{
+ unsigned char addr[16];
+}VOS_PACKED VOS_IPv6_addr_t;
+
+
+typedef void VOID;
+typedef int BOOL;
+
+typedef char CHAR;
+typedef unsigned char UCHAR;
+
+typedef short SHORT;
+typedef unsigned short USHORT;
+
+
+typedef int INT;
+typedef unsigned int UINT;
+
+typedef long LONG;
+typedef unsigned long ULONG;
+
+typedef unsigned char BYTE;
+typedef unsigned short WORD;
+typedef unsigned long DWORD;
+typedef float FLOAT;
+
+
+typedef char *LPSTR;
+typedef const char *LPCSTR;
+typedef unsigned long *PULONG;
+
+typedef LONG LRESULT;
+typedef void *VOS_HANDLE;
+
+
+typedef char INT8;
+typedef unsigned char UINT8;
+
+typedef short INT16;
+typedef unsigned short UINT16;
+
+typedef int INT32;
+typedef unsigned int UINT32;
+
+typedef long INT64;
+typedef unsigned long UINT64;
+
+
+#if 0
+#if defined __GNUG__
+#define NULL (__null)
+#else
+#if !defined(__cplusplus) && 0
+#define NULL ((void*)0)
+#else
+#define NULL (0)
+#endif
+#endif
+#endif
+
+#if defined (OS_LINUX)
+
+#ifndef HAVE_DOUBLE
+#define HAVE_DOUBLE
+typedef double DOUBLE;
+#endif
+
+#ifndef HAVE_PUSHORT
+#define HAVE_PUSHORT
+typedef unsigned short *PUSHORT;
+#endif
+
+#ifndef HAVE_PUCHAR
+#define HAVE_PUCHAR
+typedef unsigned char *PUCHAR;
+#endif
+
+
+#ifndef HAVE_PFLOAT
+#define HAVE_PFLOAT
+typedef FLOAT *PFLOAT;
+#endif
+
+#ifndef HAVE_PBOOL
+#define HAVE_PBOOL
+typedef int *PBOOL;
+#endif
+
+#ifndef HAVE_LPBOOL
+#define HAVE_LPBOOL
+typedef int *LPBOOL;
+#endif
+
+#ifndef HAVE_PBYTE
+#define HAVE_PBYTE
+typedef BYTE *PBYTE;
+#endif
+
+#ifndef HAVE_LPBYTE
+#define HAVE_LPBYTE
+typedef BYTE *LPBYTE;
+#endif
+
+#ifndef HAVE_PINT
+#define HAVE_PINT
+typedef int *PINT;
+#endif
+
+#ifndef HAVE_LPINT
+#define HAVE_LPINT
+typedef int *LPINT;
+#endif
+
+#ifndef HAVE_PWORD
+#define HAVE_PWORD
+typedef WORD *PWORD;
+#endif
+
+#ifndef HAVE_LPWORD
+#define HAVE_LPWORD
+typedef WORD *LPWORD;
+#endif
+
+#ifndef HAVE_LPLONG
+#define HAVE_LPLONG
+typedef long *LPLONG;
+#endif
+
+#ifndef HAVE_PDWORD
+#define HAVE_PDWORD
+typedef DWORD *PDWORD;
+#endif
+
+#ifndef HAVE_LPDWORD
+#define HAVE_LPDWORD
+typedef DWORD *LPDWORD;
+#endif
+
+#ifndef HAVE_LPVOID
+#define HAVE_LPVOID
+typedef void *LPVOID;
+#endif
+
+#ifndef HAVE_LPCVOID
+#define HAVE_LPCVOID
+typedef const void *LPCVOID;
+#endif
+
+#ifndef HAVE_PUINT
+#define HAVE_PUINT
+typedef unsigned int *PUINT;
+#endif
+
+/* Types use for passing & returning polymorphic values */
+#ifndef HAVE_WPARAM
+#define HAVE_WPARAM
+typedef unsigned int WPARAM;
+#endif
+
+#ifndef HAVE_LPARAM
+#define HAVE_LPARAM
+typedef LONG LPARAM;
+#endif
+
+#ifndef HAVE_LRESULT
+#define HAVE_LRESULT
+typedef LONG LRESULT;
+#endif
+
+
+#ifndef HAVE_LONGLONG
+#define HAVE_LONGLONG
+typedef long long LONGLONG;
+#endif
+
+#ifndef HAVE_ULONGLONG
+#define HAVE_ULONGLONG
+typedef unsigned long long ULONGLONG;
+#endif
+
+#ifndef HAVE_longlong
+#define HAVE_longlong
+typedef long long longlong;
+#endif
+
+#ifndef HAVE_ulonglong
+#define HAVE_ulonglong
+typedef unsigned long long ulonglong;
+#endif
+
+#if OS_LINUX
+#define inline
+#define _inline
+#define __inline__
+#define __const__ const
+#define __signed__ signed
+#define __const__ const
+#endif
+
+/* base 32*/
+
+#define VOS_ERR_OUT VOS_Printf("error! %s(%u),%s\r\n",__FILE__,__LINE__,__func__)
+#define VOS_VAL_OUT(a) VOS_Printf("\r\n var(%s),value(%d),%s(%u),%s\r\n",(#a),(a),__FILE__,__LINE__,__func__)
+#define VOS_VAL_OUT_U(a) VOS_Printf("\r\n var(%s),value(%u),%s(%u),%s\r\n",(#a),(a),__FILE__,__LINE__,__func__)
+#define VOS_STR_OUT(a) VOS_Printf("\r\n %s,%s(%u),%s\r\n",(a),__FILE__,__LINE__,__func__)
+
+
+/* 求余 */
+#define __VOS_RESIDUE( _n, _2_exp ) (((_n)<<(32-(_2_exp)))>>(32-(_2_exp)))
+
+/* 求商 */
+#define __VOS_QUOTIENT( _n, _2_exp ) ((_n)>>(_2_exp))
+
+/* 去尾取整 */
+#define __VOS_INTZERO( _n, _2_exp ) (__VOS_QUOTIENT( _n, _2_exp )<<(_2_exp))
+
+/* 进位取整 */
+#define __VOS_INTINCR( _n, _2_exp ) \
+ ((__VOS_QUOTIENT( _n, _2_exp ) + (0==__VOS_QUOTIENT( __VOS_RESIDUE( _n, _2_exp ), _2_exp ))?0:1)<<(_2_exp))
+
+
+#endif
+
+#define CL_LIB_AF_INET6 10
+#define CL_LIB_AF_INET 2
+
+typedef struct{
+ UINT family;
+ union {
+ /** IPv4 addr */
+ UINT ip4;
+ /** IPv6 addr structure */
+ union
+ {
+ UCHAR addr8[16];
+ USHORT addr16[8];
+ UINT addr32[4];
+ } ip6;
+ }addr;
+}VOS_IP_t;
+
+#define VOS_SNMP_DateAndTime_SIZE 8
+typedef struct VOS_SNMP_DateAndTime_s{
+ CHAR DateAndTime[VOS_SNMP_DateAndTime_SIZE];
+}VOS_SNMP_DateAndTime_t;
+
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /*_VOS_TYPES_H_*/