X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fcm%2Flegtp.c;h=5e676741aa8299edd510ab0fc375ada9bdb16b74;hb=4d45b914f9e94203603d3b9fdbcb1aad361301dd;hp=a1ba6b1fb26aefab968d36109a2a4ea19f74165d;hpb=3235ecfc7414aa0b72d0ad50db63ae8b5626045b;p=o-du%2Fl2.git diff --git a/src/cm/legtp.c b/src/cm/legtp.c index a1ba6b1fb..5e676741a 100644 --- a/src/cm/legtp.c +++ b/src/cm/legtp.c @@ -17,8 +17,7 @@ *******************************************************************************/ /* This file contains DU APP and EGTP interface functions */ - -#include "du_egtp.h" +#include "common_def.h" #include "legtp.h" /******************************************************************* @@ -27,7 +26,7 @@ * * @details * - * Function : cmPkEgtpCfmStatus + * Function : packEgtpCfmStatus * * Functionality: * Packs EGTP confirm status @@ -38,12 +37,12 @@ * RFAILED - failure * ******************************************************************/ -S16 cmPkEgtpCfmStatus(CmStatus cfm, Buffer *mBuf) +uint8_t packEgtpCfmStatus(CmStatus cfm, Buffer *mBuf) { - SPkU16(cfm.status, mBuf); - SPkU16(cfm.reason, mBuf); + oduUnpackUInt16(cfm.status, mBuf); + oduUnpackUInt16(cfm.reason, mBuf); - RETVALUE(ROK); + return ROK; } /******************************************************************* @@ -52,7 +51,7 @@ S16 cmPkEgtpCfmStatus(CmStatus cfm, Buffer *mBuf) * * @details * - * Function : cmUnpkEgtpCfmStatus + * Function : unpackEgtpCfmStatus * * Functionality: * Packs EGTP confirm status @@ -64,12 +63,12 @@ S16 cmPkEgtpCfmStatus(CmStatus cfm, Buffer *mBuf) * ******************************************************************/ -S16 cmUnpkEgtpCfmStatus(CmStatus *cfm, Buffer *mBuf) +uint8_t unpackEgtpCfmStatus(CmStatus *cfm, Buffer *mBuf) { - SUnpkU16(&(cfm->reason), mBuf); - SUnpkU16(&(cfm->status), mBuf); + oduPackUInt16(&(cfm->reason), mBuf); + oduPackUInt16(&(cfm->status), mBuf); - RETVALUE(ROK); + return ROK; } /******************************************************************* @@ -78,7 +77,7 @@ S16 cmUnpkEgtpCfmStatus(CmStatus *cfm, Buffer *mBuf) * * @details * - * Function : cmPkEgtpCfgReq + * Function : packEgtpCfgReq * * Functionality: * Packs EGTP configuration @@ -89,35 +88,35 @@ S16 cmUnpkEgtpCfmStatus(CmStatus *cfm, Buffer *mBuf) * RFAILED - failure * ******************************************************************/ -S16 cmPkEgtpCfgReq(Pst *pst, EgtpConfig egtpCfg) +uint8_t packEgtpCfgReq(Pst *pst, EgtpConfig egtpCfg) { Buffer *mBuf; - if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK) + if(ODU_GET_MSG(DFLT_REGION, pst->pool, &mBuf) != ROK) { printf("\nDU_APP : Failed to allocate memory"); - RETVALUE(RFAILED); + return RFAILED; } if(egtpCfg.localIp.ipV4Pres) { - SPkU32(egtpCfg.localIp.ipV4Addr, mBuf); + oduUnpackUInt32(egtpCfg.localIp.ipV4Addr, mBuf); } - cmPkBool(egtpCfg.localIp.ipV4Pres, mBuf); - SPkU16(egtpCfg.localPort, mBuf); + oduPackBool(egtpCfg.localIp.ipV4Pres, mBuf); + oduUnpackUInt16(egtpCfg.localPort, mBuf); if(egtpCfg.destIp.ipV4Pres) { - SPkU32(egtpCfg.destIp.ipV4Addr, mBuf); + oduUnpackUInt32(egtpCfg.destIp.ipV4Addr, mBuf); } - cmPkBool(egtpCfg.destIp.ipV4Pres, mBuf); - SPkU16(egtpCfg.destPort, mBuf); + oduPackBool(egtpCfg.destIp.ipV4Pres, mBuf); + oduUnpackUInt16(egtpCfg.destPort, mBuf); - SPkU32(egtpCfg.minTunnelId, mBuf); - SPkU32(egtpCfg.maxTunnelId, mBuf); + oduUnpackUInt32(egtpCfg.minTunnelId, mBuf); + oduUnpackUInt32(egtpCfg.maxTunnelId, mBuf); - SPstTsk(pst, mBuf); + ODU_POST_TASK(pst, mBuf); - RETVALUE(ROK); + return ROK; } /******************************************************************* @@ -126,7 +125,7 @@ S16 cmPkEgtpCfgReq(Pst *pst, EgtpConfig egtpCfg) * * @details * - * Function : cmUnpkEgtpCfgReq + * Function : unpackEgtpCfgReq * * Functionality: * Unpacks EGTP configuration @@ -138,32 +137,32 @@ S16 cmPkEgtpCfgReq(Pst *pst, EgtpConfig egtpCfg) * RFAILED - failure * * ****************************************************************/ -S16 cmUnpkEgtpCfgReq(EgtpCfgReq func, Pst *pst, Buffer *mBuf) +uint8_t unpackEgtpCfgReq(EgtpCfgReq func, Pst *pst, Buffer *mBuf) { EgtpConfig egtpCfg; - cmMemset((U8 *)&egtpCfg, 0, sizeof(EgtpConfig)); + memset((uint8_t *)&egtpCfg, 0, sizeof(EgtpConfig)); - SUnpkU32(&(egtpCfg.maxTunnelId), mBuf); - SUnpkU32(&(egtpCfg.minTunnelId), mBuf); + oduPackUInt32(&(egtpCfg.maxTunnelId), mBuf); + oduPackUInt32(&(egtpCfg.minTunnelId), mBuf); - SUnpkU16(&(egtpCfg.destPort), mBuf); - cmUnpkBool(&(egtpCfg.destIp.ipV4Pres), mBuf); + oduPackUInt16(&(egtpCfg.destPort), mBuf); + oduUnpackBool(&(egtpCfg.destIp.ipV4Pres), mBuf); if(egtpCfg.destIp.ipV4Pres) { - SUnpkU32(&(egtpCfg.destIp.ipV4Addr), mBuf); + oduPackUInt32(&(egtpCfg.destIp.ipV4Addr), mBuf); } - SUnpkU16(&(egtpCfg.localPort), mBuf); - cmUnpkBool(&(egtpCfg.localIp.ipV4Pres), mBuf); + oduPackUInt16(&(egtpCfg.localPort), mBuf); + oduUnpackBool(&(egtpCfg.localIp.ipV4Pres), mBuf); if(egtpCfg.localIp.ipV4Pres) { - SUnpkU32(&(egtpCfg.localIp.ipV4Addr), mBuf); + oduPackUInt32(&(egtpCfg.localIp.ipV4Addr), mBuf); } - SPutMsg(mBuf); + ODU_PUT_MSG(mBuf); - RETVALUE((*func)(pst, egtpCfg)); + return ((*func)(pst, egtpCfg)); } @@ -173,7 +172,7 @@ S16 cmUnpkEgtpCfgReq(EgtpCfgReq func, Pst *pst, Buffer *mBuf) * * @details * - * Function : cmPkEgtpCfgCfm + * Function : packEgtpCfgCfm * * Functionality: * Packs EGTP configuration result @@ -185,19 +184,19 @@ S16 cmUnpkEgtpCfgReq(EgtpCfgReq func, Pst *pst, Buffer *mBuf) * ******************************************************************/ -S16 cmPkEgtpCfgCfm(Pst *pst, CmStatus cfm) +uint8_t packEgtpCfgCfm(Pst *pst, CmStatus cfm) { Buffer *mBuf; - if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK) + if(ODU_GET_MSG(DFLT_REGION, pst->pool, &mBuf) != ROK) { printf("\nEGTP : Failed to allocate memory"); - RETVALUE(RFAILED); + return RFAILED; } - cmPkEgtpCfmStatus(cfm, mBuf); - SPstTsk(pst, mBuf); - RETVALUE(ROK); + packEgtpCfmStatus(cfm, mBuf); + ODU_POST_TASK(pst, mBuf); + return ROK; } /******************************************************************* @@ -206,7 +205,7 @@ S16 cmPkEgtpCfgCfm(Pst *pst, CmStatus cfm) * * @details * - * Function : cmUnpkEgtpCfgCfm + * Function : unpackEgtpCfgCfm * * Functionality: * Unpacks EGTP configuration result @@ -218,14 +217,14 @@ S16 cmPkEgtpCfgCfm(Pst *pst, CmStatus cfm) * ******************************************************************/ -S16 cmUnpkEgtpCfgCfm(EgtpCfgCfm func, Buffer *mBuf) +uint8_t unpackEgtpCfgCfm(EgtpCfgCfm func, Buffer *mBuf) { CmStatus cfm; - cmMemset((U8 *)&cfm, 0, sizeof(CmStatus)); - cmUnpkEgtpCfmStatus(&cfm, mBuf); + memset((uint8_t *)&cfm, 0, sizeof(CmStatus)); + unpackEgtpCfmStatus(&cfm, mBuf); - RETVALUE((*func)(cfm)); + return ((*func)(cfm)); } /******************************************************************* @@ -234,7 +233,7 @@ S16 cmUnpkEgtpCfgCfm(EgtpCfgCfm func, Buffer *mBuf) * * @details * - * Function : cmPkEgtpSrvOpenReq + * Function : packEgtpSrvOpenReq * * Functionality: * Packs EGTP server open request @@ -244,18 +243,18 @@ S16 cmUnpkEgtpCfgCfm(EgtpCfgCfm func, Buffer *mBuf) * RFAILED - failure * *******************************************************************/ -S16 cmPkEgtpSrvOpenReq(Pst *pst) +uint8_t packEgtpSrvOpenReq(Pst *pst) { Buffer *mBuf; - if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK) + if(ODU_GET_MSG(DFLT_REGION, pst->pool, &mBuf) != ROK) { printf("\nDU_APP : Failed to allocate memory"); - RETVALUE(RFAILED); + return RFAILED; } - SPstTsk(pst, mBuf); - RETVALUE(ROK); + ODU_POST_TASK(pst, mBuf); + return ROK; } /******************************************************************* @@ -264,7 +263,7 @@ S16 cmPkEgtpSrvOpenReq(Pst *pst) * * @details * - * Function : cmUnpkEgtpSrvOpenReq + * Function : unpackEgtpSrvOpenReq * * Functionality: * Unpacks EGTP server open req @@ -275,9 +274,9 @@ S16 cmPkEgtpSrvOpenReq(Pst *pst) * RFAILED - failure * ******************************************************************/ -S16 cmUnpkEgtpSrvOpenReq(EgtpSrvOpenReq func, Pst *pst, Buffer *mBuf) +uint8_t unpackEgtpSrvOpenReq(EgtpSrvOpenReq func, Pst *pst, Buffer *mBuf) { - RETVALUE((*func)(pst)); + return ((*func)(pst)); } @@ -287,7 +286,7 @@ S16 cmUnpkEgtpSrvOpenReq(EgtpSrvOpenReq func, Pst *pst, Buffer *mBuf) * * @details * - * Function : cmPkEgtpSrvOpenCfm + * Function : packEgtpSrvOpenCfm * * Functionality: * Packs EGTP server open confirm @@ -297,19 +296,19 @@ S16 cmUnpkEgtpSrvOpenReq(EgtpSrvOpenReq func, Pst *pst, Buffer *mBuf) * RFAILED - failure * *******************************************************************/ -S16 cmPkEgtpSrvOpenCfm(Pst *pst, CmStatus cfm) +uint8_t packEgtpSrvOpenCfm(Pst *pst, CmStatus cfm) { Buffer *mBuf; - if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK) + if(ODU_GET_MSG(DFLT_REGION, pst->pool, &mBuf) != ROK) { printf("\nEGTP : Failed to allocate memory"); - RETVALUE(RFAILED); + return RFAILED; } - cmPkEgtpCfmStatus(cfm, mBuf); - SPstTsk(pst, mBuf); - RETVALUE(ROK); + packEgtpCfmStatus(cfm, mBuf); + ODU_POST_TASK(pst, mBuf); + return ROK; } @@ -319,7 +318,7 @@ S16 cmPkEgtpSrvOpenCfm(Pst *pst, CmStatus cfm) * * @details * - * Function : cmUnpkEgtpSrvOpenCfm + * Function : unpackEgtpSrvOpenCfm * * Functionality: * Unpacks EGTP server open confirm @@ -330,14 +329,14 @@ S16 cmPkEgtpSrvOpenCfm(Pst *pst, CmStatus cfm) * RFAILED - failure * *******************************************************************/ -S16 cmUnpkEgtpSrvOpenCfm(EgtpSrvOpenCfm func, Buffer *mBuf) +uint8_t unpackEgtpSrvOpenCfm(EgtpSrvOpenCfm func, Buffer *mBuf) { CmStatus cfm; - cmMemset((U8 *)&cfm, 0, sizeof(CmStatus)); - cmUnpkEgtpCfmStatus(&cfm, mBuf); + memset((uint8_t *)&cfm, 0, sizeof(CmStatus)); + unpackEgtpCfmStatus(&cfm, mBuf); - RETVALUE((*func)(cfm)); + return ((*func)(cfm)); } /******************************************************************* @@ -346,7 +345,7 @@ S16 cmUnpkEgtpSrvOpenCfm(EgtpSrvOpenCfm func, Buffer *mBuf) * * @details * - * Function : cmPkEgtpTnlMgmtReq + * Function : packEgtpTnlMgmtReq * * Functionality: * Packs EGTP tunnel management request @@ -359,22 +358,22 @@ S16 cmUnpkEgtpSrvOpenCfm(EgtpSrvOpenCfm func, Buffer *mBuf) * RFAILED - failure * *******************************************************************/ -S16 cmPkEgtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) +uint8_t packEgtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) { Buffer *mBuf; - if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK) + if(ODU_GET_MSG(DFLT_REGION, pst->pool, &mBuf) != ROK) { printf("\nDU_APP : Failed to allocate memory"); - RETVALUE(RFAILED); + return RFAILED; } - SPkU8(tnlEvt.action, mBuf); - SPkU32(tnlEvt.lclTeid, mBuf); - SPkU32(tnlEvt.remTeid, mBuf); + oduUnpackUInt8(tnlEvt.action, mBuf); + oduUnpackUInt32(tnlEvt.lclTeid, mBuf); + oduUnpackUInt32(tnlEvt.remTeid, mBuf); - SPstTsk(pst, mBuf); - RETVALUE(ROK); + ODU_POST_TASK(pst, mBuf); + return ROK; } @@ -384,7 +383,7 @@ S16 cmPkEgtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) * * @details * - * Function : cmUnpkEgtpTnlMgmtReq + * Function : unpackEgtpTnlMgmtReq * * Functionality: * Unpacks EGTP tunnel management request @@ -396,17 +395,17 @@ S16 cmPkEgtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) * RFAILED - failure * * *******************************************************************/ -S16 cmUnpkEgtpTnlMgmtReq(EgtpTnlMgmtReq func, Pst *pst, Buffer *mBuf) +uint8_t unpackEgtpTnlMgmtReq(EgtpTnlMgmtReq func, Pst *pst, Buffer *mBuf) { EgtpTnlEvt tnlEvt; - cmMemset((U8 *)&tnlEvt, 0, sizeof(EgtpTnlEvt)); + memset((uint8_t *)&tnlEvt, 0, sizeof(EgtpTnlEvt)); - SUnpkU32(&(tnlEvt.remTeid), mBuf); - SUnpkU32(&(tnlEvt.lclTeid), mBuf); - SUnpkU8(&(tnlEvt.action), mBuf); + oduPackUInt32(&(tnlEvt.remTeid), mBuf); + oduPackUInt32(&(tnlEvt.lclTeid), mBuf); + oduPackUInt8(&(tnlEvt.action), mBuf); - RETVALUE((* func)(pst, tnlEvt)); + return ((* func)(pst, tnlEvt)); } @@ -416,7 +415,7 @@ S16 cmUnpkEgtpTnlMgmtReq(EgtpTnlMgmtReq func, Pst *pst, Buffer *mBuf) * * @details * - * Function : cmPkEgtpTnlMgmtCfm + * Function : packEgtpTnlMgmtCfm * * Functionality: * Packs EGTP tunnel management cfm @@ -429,24 +428,24 @@ S16 cmUnpkEgtpTnlMgmtReq(EgtpTnlMgmtReq func, Pst *pst, Buffer *mBuf) * ********************************************************************/ -S16 cmPkEgtpTnlMgmtCfm(Pst *pst, EgtpTnlEvt tnlEvt) +uint8_t packEgtpTnlMgmtCfm(Pst *pst, EgtpTnlEvt tnlEvt) { Buffer *mBuf; - if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK) + if(ODU_GET_MSG(DFLT_REGION, pst->pool, &mBuf) != ROK) { printf("\nEGTP : Failed to allocate memory"); - RETVALUE(RFAILED); + return RFAILED; } - SPkU8(tnlEvt.action, mBuf); - SPkU32(tnlEvt.lclTeid, mBuf); - SPkU32(tnlEvt.remTeid, mBuf); + oduUnpackUInt8(tnlEvt.action, mBuf); + oduUnpackUInt32(tnlEvt.lclTeid, mBuf); + oduUnpackUInt32(tnlEvt.remTeid, mBuf); - cmPkEgtpCfmStatus(tnlEvt.cfmStatus, mBuf); + packEgtpCfmStatus(tnlEvt.cfmStatus, mBuf); - SPstTsk(pst, mBuf); - RETVALUE(ROK); + ODU_POST_TASK(pst, mBuf); + return ROK; } @@ -456,7 +455,7 @@ S16 cmPkEgtpTnlMgmtCfm(Pst *pst, EgtpTnlEvt tnlEvt) * * @details * - * Function : cmUnpkEgtpTnlMgmtCfm + * Function : unpackEgtpTnlMgmtCfm * * Functionality: * Unpacks EGTP tunnel management confirm @@ -468,69 +467,69 @@ S16 cmPkEgtpTnlMgmtCfm(Pst *pst, EgtpTnlEvt tnlEvt) * RFAILED - failure * * *******************************************************************/ -S16 cmUnpkEgtpTnlMgmtCfm(EgtpTnlMgmtCfm func, Buffer *mBuf) +uint8_t unpackEgtpTnlMgmtCfm(EgtpTnlMgmtCfm func, Buffer *mBuf) { EgtpTnlEvt tnlEvt; - cmMemset((U8 *)&tnlEvt, 0, sizeof(EgtpTnlEvt)); + memset((uint8_t *)&tnlEvt, 0, sizeof(EgtpTnlEvt)); - cmUnpkEgtpCfmStatus(&(tnlEvt.cfmStatus), mBuf); - SUnpkU32(&(tnlEvt.remTeid), mBuf); - SUnpkU32(&(tnlEvt.lclTeid), mBuf); - SUnpkU8(&(tnlEvt.action), mBuf); + unpackEgtpCfmStatus(&(tnlEvt.cfmStatus), mBuf); + oduPackUInt32(&(tnlEvt.remTeid), mBuf); + oduPackUInt32(&(tnlEvt.lclTeid), mBuf); + oduPackUInt8(&(tnlEvt.action), mBuf); - RETVALUE((* func)(tnlEvt)); + return ((* func)(tnlEvt)); } /******************************************************************* * - * @brief Packs TTI indication and sends to EGTP + * @brief Packs Slot indication and sends to EGTP * * @details * - * Function : cmPkEgtpTTIInd + * Function : packEgtpSlotInd * * Functionality: - * Packs TTI indication and sends tp EGTP + * Packs slot indication and sends tp EGTP * * @params[in] Post structure * @return ROK - success * RFAILED - failure * *******************************************************************/ -S16 cmPkEgtpTTIInd(Pst *pst) +uint8_t packEgtpSlotInd(Pst *pst) { Buffer *mBuf; - if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK) + if(ODU_GET_MSG(DFLT_REGION, pst->pool, &mBuf) != ROK) { printf("\nDU_APP : Failed to allocate memory"); - RETVALUE(RFAILED); + return RFAILED; } - SPstTsk(pst, mBuf); - RETVALUE(ROK); + ODU_POST_TASK(pst, mBuf); + return ROK; } /******************************************************************* * - * @brief Unpacks TTI indication + * @brief Unpacks slot indication * * @details * - * Function : cmUnpkEgtpTTIInd + * Function : unpackEgtpSlotInd * * Functionality: - * Unpacks TTI indication + * Unpacks slot indication * * @params[in] * @return ROK - success * RFAILED - failure * ******************************************************************/ -S16 cmUnpkEgtpTTIInd(EgtpTTIInd func, Pst *pst, Buffer *mBuf) +uint8_t unpackEgtpSlotInd(EgtpSlotInd func, Pst *pst, Buffer *mBuf) { - RETVALUE((*func)()); + return ((*func)()); }