X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fcu_stub%2Fcu_stub_egtp.c;h=dfdacbbb0edcc0b8d531a99f436e41735bde40d9;hb=3f340f5742e5c7c92b8541479ee7f2d670200cfb;hp=b8616c067a24a1fb3d80f5960a244cb08f180d44;hpb=4d45b914f9e94203603d3b9fdbcb1aad361301dd;p=o-du%2Fl2.git diff --git a/src/cu_stub/cu_stub_egtp.c b/src/cu_stub/cu_stub_egtp.c index b8616c067..dfdacbbb0 100644 --- a/src/cu_stub/cu_stub_egtp.c +++ b/src/cu_stub/cu_stub_egtp.c @@ -48,7 +48,7 @@ EgtpGlobalCb egtpCb; S16 egtpActvInit() { DU_LOG("\n\nEGTP : Initializing"); - cmMemset ((U8 *)&egtpCb, 0, sizeof(EgtpGlobalCb)); + memset (&egtpCb, 0, sizeof(EgtpGlobalCb)); protType = CM_INET_PROTO_UDP; return ROK; } @@ -73,9 +73,9 @@ S16 egtpActvInit() * RFAILED - failure * ***************************************************************************/ -S16 egtpInitReq() +uint8_t egtpInitReq() { - S16 ret = ROK; + uint8_t ret = ROK; EgtpTnlEvt tnlEvt; ret = cuEgtpCfgReq(); @@ -102,8 +102,7 @@ S16 egtpInitReq() return RFAILED; } - return (ret); - + return ret; } /* egtpInitReq */ /************************************************************************** @@ -124,7 +123,7 @@ S16 cuEgtpCfgReq() { U8 ret; - cmMemcpy((U8 *)&egtpCb.egtpCfg, (U8 *)&cuCfgParams.egtpParams, (PTR)sizeof(EgtpParams)); + memcpy(&egtpCb.egtpCfg, &cuCfgParams.egtpParams, sizeof(EgtpParams)); egtpCb.recvTptSrvr.addr.address = CM_INET_NTOH_U32(egtpCb.egtpCfg.localIp.ipV4Addr); egtpCb.recvTptSrvr.addr.port = EGTP_DFLT_PORT; @@ -175,7 +174,7 @@ S16 cuEgtpSrvOpenReq(Pst *pst) DU_LOG("\nEGTP : Received open server request"); sockType = CM_INET_DGRAM; - if(ret = (cmInetSocket(sockType, &(egtpCb.recvTptSrvr.sockFd), protType)) != ROK) + if((ret = (cmInetSocket(sockType, &(egtpCb.recvTptSrvr.sockFd), protType))) != ROK) { DU_LOG("\nEGTP : Failed to open UDP socket"); return RFAILED; @@ -290,7 +289,7 @@ S16 cuEgtpTnlAdd(EgtpTnlEvt tnlEvt) } - cmMemset((U8 *)teidCb, 0, sizeof(EgtpTeIdCb)); + memset(teidCb, 0, sizeof(EgtpTeIdCb)); teidCb->teId = tnlEvt.lclTeid; teidCb->remTeId = tnlEvt.remTeid; @@ -304,7 +303,7 @@ S16 cuEgtpTnlAdd(EgtpTnlEvt tnlEvt) egtpCb.dstCb.numTunn++; /* Encoding pre-defined header */ - cmMemset((U8*)&preDefHdr, 0, sizeof(EgtpMsgHdr)); + memset(&preDefHdr, 0, sizeof(EgtpMsgHdr)); preDefHdr.msgType = EGTPU_MSG_GPDU; preDefHdr.teId = teidCb->remTeId; preDefHdr.extHdr.pdcpNmb.pres = FALSE; @@ -513,7 +512,6 @@ S16 cuEgtpHdlRecvMsg(Buffer *mBuf) S16 cuEgtpDecodeHdr(Buffer *mBuf) { EgtpMsg egtpMsg; - S16 retVal = ROK; /* Holds the return value */ U8 tmpByte[5]; /* Holds one byte of data after Dec */ U8 version = 0; /* Holds the version type, decoded */ MsgLen msgLen = 0; /* Holds the msgLen from the Hdr */ @@ -522,7 +520,7 @@ S16 cuEgtpDecodeHdr(Buffer *mBuf) U8 extHdrLen = 0; /* Extension hdr length */ Bool extPres = FALSE; /* Flag for indication of S, E or P presense flag */ - ODU_FIND_MSG_LEN(mBuf, &bufLen); + ODU_GET_MSG_LEN(mBuf, &bufLen); /* Decode version */ ODU_REM_PRE_MSG(&tmpByte[0], mBuf); @@ -645,7 +643,7 @@ S16 cuEgtpDatReq() cnt++; } - ODU_PUT_MSG(egtpMsg.msg); + ODU_PUT_MSG_BUF(egtpMsg.msg); return ROK; } @@ -658,12 +656,12 @@ S16 BuildAppMsg(EgtpMsg *egtpMsg) Buffer *mBuf; - if(ODU_GET_MSG(CU_APP_MEM_REG, CU_POOL, &mBuf) == ROK) + if(ODU_GET_MSG_BUF(CU_APP_MEM_REG, CU_POOL, &mBuf) == ROK) { if(ODU_ADD_POST_MSG_MULT((Data *)data, datSize, mBuf) != ROK) { DU_LOG("\nEGTP : ODU_ADD_POST_MSG_MULT failed"); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return RFAILED; } } @@ -678,9 +676,9 @@ S16 BuildAppMsg(EgtpMsg *egtpMsg) MsgLen mLen; mLen = 0; - ODU_FIND_MSG_LEN(mBuf, &mLen); + ODU_GET_MSG_LEN(mBuf, &mLen); - cmMemset((U8 *)&ipv4Hdr, 0, sizeof(CmIpv4Hdr)); + memset(&ipv4Hdr, 0, sizeof(CmIpv4Hdr)); ipv4Hdr.length = CM_IPV4_HDRLEN + mLen; ipv4Hdr.hdrVer = 0x45; ipv4Hdr.proto = 1; @@ -694,8 +692,8 @@ S16 BuildAppMsg(EgtpMsg *egtpMsg) /* initialize locals */ cnt = 0; - cmMemset(revPkArray, 0, CM_IPV4_HDRLEN); - cmMemset(pkArray, 0, CM_IPV4_HDRLEN); + memset(revPkArray, 0, CM_IPV4_HDRLEN); + memset(pkArray, 0, CM_IPV4_HDRLEN); /* Pack Header Version */ pkArray[cnt++] = ipv4Hdr.hdrVer; @@ -750,7 +748,7 @@ S16 BuildAppMsg(EgtpMsg *egtpMsg) egtpMsg->msgHdr.teId = 10; egtpMsg->msg = mBuf; - return ROK; + return ret; } @@ -787,7 +785,7 @@ S16 BuildEgtpMsg(EgtpMsg *egtpMsg) teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 1] &= ~(EGTP_MASK_BIT3); } - ODU_FIND_MSG_LEN(egtpMsg->msg, &tPduSize); + ODU_GET_MSG_LEN(egtpMsg->msg, &tPduSize); /*Adjust the header to fill the correct length*/ msgLen = tPduSize + (EGTP_MAX_HDR_LEN - hdrLen) - 0x08;