X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fcm%2Flsctp.c;h=12f673dcd73fd9b344fbc17c57496074e39de089;hb=cb811f8127971006aa5c345c71cb737e8be8dc10;hp=f96c2b26a177ca752c5aab842aa9736633d14713;hpb=3235ecfc7414aa0b72d0ad50db63ae8b5626045b;p=o-du%2Fl2.git diff --git a/src/cm/lsctp.c b/src/cm/lsctp.c index f96c2b26a..12f673dcd 100644 --- a/src/cm/lsctp.c +++ b/src/cm/lsctp.c @@ -17,90 +17,8 @@ *******************************************************************************/ /* This file contains DU APP and SCTP interface functions */ - -#include "du_sctp.h" - -/******************************************************************* - * - * @brief Packs SCTP configuration - * - * @details - * - * Function : cmPkSctpAssocReq - * - * Functionality: - * Packs SCTP configuration - * - * @params[in] Notification - * @return ROK - success - * RFAILED - failure - * - ******************************************************************/ -S16 cmPkSctpAssocReq(Pst *pst, F1SctpParams sctpCfgParam) -{ - Buffer *mBuf; - - if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK) - { - printf("\nDU_APP : Failed to allocate memory"); - RETVALUE(RFAILED); - } - - if(sctpCfgParam.duIpAddr.ipV4Pres) - { - SPkU32(sctpCfgParam.duIpAddr.ipV4Addr, mBuf); - } - cmPkBool(sctpCfgParam.duIpAddr.ipV4Pres, mBuf); - SPkU16(sctpCfgParam.duPort, mBuf); - - if(sctpCfgParam.cuIpAddr.ipV4Pres) - { - SPkU32(sctpCfgParam.cuIpAddr.ipV4Addr, mBuf); - } - cmPkBool(sctpCfgParam.cuIpAddr.ipV4Pres, mBuf); - SPkU16(sctpCfgParam.cuPort, mBuf); - - SPstTsk(pst, mBuf); - - RETVALUE(ROK); -} - -/******************************************************************* - * - * @brief Unpacks SCTP configuration - * - * @details - * - * Function : cmUnpkSctpAssocReq - * - * Functionality: - * Unpacks SCTP configuration - * - * @params[in] Notification - * @return ROK - success - * RFAILED - failure - * - ******************************************************************/ -S16 cmUnpkSctpAssocReq(Buffer *mBuf) -{ - cmMemset((U8*)&sctpCfg, 0, sizeof(F1SctpParams)); - - SUnpkU16(&(sctpCfg.cuPort), mBuf); - cmUnpkBool(&(sctpCfg.cuIpAddr.ipV4Pres), mBuf); - if(sctpCfg.cuIpAddr.ipV4Pres) - { - SUnpkU32(&(sctpCfg.cuIpAddr.ipV4Addr), mBuf); - } - - SUnpkU16(&(sctpCfg.duPort), mBuf); - cmUnpkBool(&(sctpCfg.duIpAddr.ipV4Pres), mBuf); - if(sctpCfg.duIpAddr.ipV4Pres) - { - SUnpkU32(&(sctpCfg.duIpAddr.ipV4Addr), mBuf); - } - - RETVALUE(ROK); -} +#include "common_def.h" +#include "lsctp.h" /******************************************************************* * @@ -119,29 +37,30 @@ S16 cmUnpkSctpAssocReq(Buffer *mBuf) * * ****************************************************************/ -S16 cmPkSctpNtfy(Pst *pst, CmInetSctpNotification *ntfy) +uint8_t cmPkSctpNtfy(Pst *pst, CmInetSctpNotification *ntfy) { Buffer *mBuf; - if(SGetMsg(DU_APP_MEM_REGION, DU_POOL, &mBuf) != ROK) + if(ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) { - printf("\nSCTP : Failed to allocate memory"); - RETVALUE(RFAILED); + DU_LOG("\nERROR --> SCTP : Failed to allocate memory"); + return RFAILED; } if(ntfy->header.nType == CM_INET_SCTP_ASSOC_CHANGE) { - SPkU16(ntfy->u.assocChange.state, mBuf); + oduUnpackUInt16(ntfy->u.assocChange.state, mBuf); + oduUnpackUInt32(ntfy->u.assocChange.assocId, mBuf); } - SPkU16(ntfy->header.nType, mBuf); + oduUnpackUInt16(ntfy->header.nType, mBuf); - if (SPstTsk(pst, mBuf) != ROK) + if (ODU_POST_TASK(pst, mBuf) != ROK) { - printf("\nSCTP : SPstTsk failed while sending SCTP notification"); - RETVALUE(RFAILED); + DU_LOG("\nERROR --> SCTP : ODU_POST_TASK failed while sending SCTP notification"); + return RFAILED; } - RETVALUE(ROK); + return ROK; } /******************************************************************* @@ -161,18 +80,19 @@ S16 cmPkSctpNtfy(Pst *pst, CmInetSctpNotification *ntfy) * * ****************************************************************/ -S16 cmUnpkSctpNtfy(SctpNtfy func, Pst *pst, Buffer *mBuf) +uint8_t cmUnpkSctpNtfy(SctpNtfy func, Pst *pst, Buffer *mBuf) { CmInetSctpNotification ntfy; - cmMemset((U8*)&ntfy, 0, sizeof(CmInetSctpNotification)); + memset(&ntfy, 0, sizeof(CmInetSctpNotification)); - SUnpkU16(&(ntfy.header.nType), mBuf); + oduPackUInt16(&(ntfy.header.nType), mBuf); if(ntfy.header.nType == CM_INET_SCTP_ASSOC_CHANGE) { - SUnpkU16(&(ntfy.u.assocChange.state), mBuf); + oduPackUInt32(&(ntfy.u.assocChange.assocId), mBuf); + oduPackUInt16(&(ntfy.u.assocChange.state), mBuf); } - RETVALUE((*func)(mBuf, &ntfy)); + return ((*func)(mBuf, &ntfy)); } /**********************************************************************