1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /* This file contains DU APP and SCTP interface functions */
20 #include "common_def.h"
30 /*******************************************************************
32 * @brief Packs SCTP notification
36 * Function : cmPkSctpNtfy
39 * Packs SCTP notification
41 * @params[in] Notification
42 * @return ROK - success
45 * ****************************************************************/
47 S16 cmPkSctpNtfy(Pst *pst, CmInetSctpNotification *ntfy)
51 if(SGetMsg(DU_APP_MEM_REGION, DU_POOL, &mBuf) != ROK)
53 printf("\nSCTP : Failed to allocate memory");
57 if(ntfy->header.nType == CM_INET_SCTP_ASSOC_CHANGE)
59 SPkU16(ntfy->u.assocChange.state, mBuf);
60 SPkU32(ntfy->u.assocChange.assocId, mBuf);
62 SPkU16(ntfy->header.nType, mBuf);
64 if (SPstTsk(pst, mBuf) != ROK)
66 printf("\nSCTP : SPstTsk failed while sending SCTP notification");
73 /*******************************************************************
75 * @brief Unpacks SCTP notification
79 * Function : cmUnpkSctpNtfy
82 * Unpacks SCTP notification
85 * @return ROK - success
88 * ****************************************************************/
90 S16 cmUnpkSctpNtfy(SctpNtfy func, Pst *pst, Buffer *mBuf)
92 CmInetSctpNotification ntfy;
93 cmMemset((U8*)&ntfy, 0, sizeof(CmInetSctpNotification));
95 SUnpkU16(&(ntfy.header.nType), mBuf);
96 if(ntfy.header.nType == CM_INET_SCTP_ASSOC_CHANGE)
98 SUnpkU32(&(ntfy.u.assocChange.assocId), mBuf);
99 SUnpkU16(&(ntfy.u.assocChange.state), mBuf);
102 RETVALUE((*func)(mBuf, &ntfy));
105 /**********************************************************************
107 **********************************************************************/