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 handler for DU APP and SCTP interface functions */
23 /*******************************************************************
25 * @brief Packs SCTP notification
29 * Function : cmPkSctpNtfy
32 * Packs SCTP notification
34 * @params[in] Notification
35 * @return ROK - success
38 * ****************************************************************/
40 S16 cmPkSctpNtfy(CmInetSctpNotification *ntfy)
44 if(SGetMsg(DU_APP_MEM_REGION, DU_POOL, &mBuf) != ROK)
46 printf("\nFailed to allocate memory");
50 if(ntfy->header.nType == CM_INET_SCTP_ASSOC_CHANGE)
52 SPkU16(ntfy->u.assocChange.state, mBuf);
54 SPkU16(ntfy->header.nType, mBuf);
56 sendToDuApp(mBuf, EVTSCTPNTFY);
60 /*******************************************************************
62 * @brief Unpacks SCTP notification
66 * Function : cmUnpkSctpNtfy
69 * Unpacks SCTP notification
72 * @return ROK - success
75 * ****************************************************************/
77 S16 cmUnpkSctpNtfy(SctpNtfy func, Pst *pst, Buffer *mBuf)
79 CmInetSctpNotification ntfy;
80 cmMemset((U8*)&ntfy, 0, sizeof(CmInetSctpNotification));
82 SUnpkU16(&(ntfy.header.nType), mBuf);
83 if(ntfy.header.nType == CM_INET_SCTP_ASSOC_CHANGE)
85 SUnpkU16(&(ntfy.u.assocChange.state), mBuf);
88 RETVALUE((*func)(mBuf, &ntfy));
91 /**********************************************************************
93 **********************************************************************/