{
switch(pst->event)
{
- case EVTSTRTPOLL:
+ case EVTSTARTPOLL:
{
sctpSockPoll();
break;
SExitTsk();
return ROK;
}
+/*******************************************************************
+ *
+ * @brief Checks the status of the received information
+ *
+ * @details
+ *
+ * Function : duCheckReqStatus
+ *
+ * Functionality:
+ * Checks the status of the received information
+ *
+ * @params[in] Confirm status
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ ******************************************************************/
+S16 duCheckReqStatus(CmStatus *cfm)
+{
+ S16 ret = ROK;
+ if(cfm->status != LCM_PRIM_OK)
+ {
+ DU_LOG("\nDU_APP : Failed to process the request successfully");
+ ret = RFAILED;
+ }
+ RETVALUE(ret);
+}
/**************************************************************************
* @brief Function to configure the Sctp Params during config Request
*
***************************************************************************/
-S16 duSctpCfgReq(SctpParams sctpCfg, CmStatus *cfm)
+S16 duSctpCfgReq(SctpParams sctpCfg)
{
+ S16 ret = ROK;
+ CmStatus cfm;
+
/* Fill F1 Params */
f1Params.destIpAddr.ipV4Pres = sctpCfg.cuIpAddr.ipV4Pres;
f1Params.destIpAddr.ipV4Addr = sctpCfg.cuIpAddr.ipV4Addr;
f1Params.destPort = sctpCfg.cuPort;
f1Params.itfState = DU_SCTP_DOWN;
- f1Params.srcPort = sctpCfg.duPort[0];
- f1Params.recvMsgSet = ROK;
+ f1Params.srcPort = sctpCfg.duPort[F1_INTERFACE];
+ f1Params.recvMsgSet = ROK;
cmMemset ((U8 *)&f1Params.sockFd, -1, sizeof(CmInetFd));
fillDestNetAddr(&f1Params.destIpNetAddr, &f1Params.destIpAddr);
fillAddrLst(&f1Params.destAddrLst, &f1Params.destIpAddr);
ricParams.destIpAddr.ipV4Addr = sctpCfg.ricIpAddr.ipV4Addr;
ricParams.destPort = sctpCfg.ricPort;
ricParams.itfState = DU_SCTP_DOWN;
- ricParams.srcPort = sctpCfg.duPort[1];
- ricParams.recvMsgSet = ROK;
+ ricParams.srcPort = sctpCfg.duPort[E2_INTERFACE];
+ ricParams.recvMsgSet = ROK;
cmMemset ((U8 *)&ricParams.sockFd, -1, sizeof(CmInetFd));
fillDestNetAddr(&ricParams.destIpNetAddr, &ricParams.destIpAddr);
fillAddrLst(&ricParams.destAddrLst, &ricParams.destIpAddr);
pollingState = FALSE;
/* Fill Cfm Status */
- cfm->status = LCM_PRIM_OK;
- cfm->reason = LCM_REASON_NOT_APPL;
+ cfm.status = LCM_PRIM_OK;
+ cfm.reason = LCM_REASON_NOT_APPL;
- RETVALUE(ROK);
+ ret = duCheckReqStatus(&cfm);
+
+ RETVALUE(ret);
}
/*******************************************************************
}
if((ret == ROK) & (paramPtr->itfState == DU_SCTP_DOWN))
{
- paramPtr->itfState = DU_SCTP_UP;
+ paramPtr->itfState = DU_SCTP_CONNECTING;
}
- /* Post the EVTSTRTPOLL Msg */
+ /* Post the EVTSTARTPOLL Msg */
if(!pollingState)
{
pollingState = TRUE;
- duFillSctpPst(&pst, EVTSTRTPOLL);
+ duFillSctpPst(&pst, EVTSTARTPOLL);
}
RETVALUE(ret);
*
*******************************************************************************/
-S16 duSctpAssocReq(U8 itfType, CmStatus *cfm)
+S16 duSctpAssocReq(U8 itfType)
{
S16 ret = ROK;
+ CmStatus cfm;
DuSctpDestCb *paramPtr = NULLP;
+
if(SGetSBuf(DU_APP_MEM_REGION, DU_POOL, (Data **)¶mPtr, (Size)sizeof(DuSctpDestCb)) != ROK)
{
printf("\nDU_APP : Failed to allocate memory");
if(ret != ROK)
{
DU_LOG("\nSCTP : ASSOC Req Failed.");
- cfm->status = LCM_PRIM_NOK;
- cfm->reason = LCM_REASON_NOT_APPL;
+ cfm.status = LCM_PRIM_NOK;
+ cfm.reason = LCM_REASON_NOT_APPL;
}
else
{
- cfm->status = LCM_PRIM_OK;
- cfm->reason = LCM_REASON_NOT_APPL;
+ cfm.status = LCM_PRIM_OK;
+ cfm.reason = LCM_REASON_NOT_APPL;
}
+ ret = duCheckReqStatus(&cfm);
RETVALUE(ret);
}
* RFAILED - failure
*
* ****************************************************************/
-S16 sctpNtfyHdlr(CmInetSctpNotification *ntfy)
+S16 sctpNtfyHdlr(CmInetSctpNotification *ntfy, U8 *itfState)
{
Pst pst;
{
case CM_INET_SCTP_COMM_UP:
DU_LOG("Event : COMMUNICATION UP");
- connUp = TRUE;
+ *itfState = DU_SCTP_UP;
break;
case CM_INET_SCTP_COMM_LOST:
DU_LOG("Event : COMMUNICATION LOST");
- connUp = FALSE;
+ *itfState = DU_SCTP_DOWN;
break;
case CM_INET_SCTP_RESTART:
DU_LOG("Event : SCTP RESTART");
- connUp = FALSE;
+ *itfState = DU_SCTP_DOWN;
break;
case CM_INET_SCTP_SHUTDOWN_COMP: /* association gracefully shutdown */
DU_LOG("Event : SHUTDOWN COMPLETE");
- connUp = FALSE;
+ *itfState = DU_SCTP_DOWN;
break;
case CM_INET_SCTP_CANT_STR_ASSOC:
DU_LOG("Event : CANT START ASSOC");
- connUp = FALSE;
+ *itfState = DU_SCTP_DOWN;
break;
default:
DU_LOG("\nInvalid event");
break;
case CM_INET_SCTP_SHUTDOWN_EVENT : /* peer socket gracefully closed */
DU_LOG("\nSCTP : Shutdown Event notification received\n");
- connUp = FALSE;
+ *itfState = DU_SCTP_DOWN;
exit(0);
break;
case CM_INET_SCTP_ADAPTATION_INDICATION :
pst.dstEnt = (Ent)ENTDUAPP;
pst.dstInst = (Inst)DU_INST;
pst.dstProcId = pst.srcProcId;
- pst.event = EVTSCTPNTFY;
+ pst.event = EVENT_SCTP_NTFY;
pst.selector = DU_SELECTOR_LC;
pst.pool= DU_POOL;
pst.region = DFLT_REGION;
{
U16 ret = ROK;
CM_INET_FD_SET(sockFd, &pollParams->readFd);
- ret = cmInetSelect(&pollParams->readFd, NULLP, timeoutPtr, &pollParams->numFds);
+ ret = cmInetSelect(&pollParams->readFd, NULLP, timeoutPtr, &pollParams->numFd);
if(CM_INET_FD_ISSET(sockFd, &pollParams->readFd))
{
CM_INET_FD_CLR(sockFd, &pollParams->readFd);
ret = cmInetSctpRecvMsg(sockFd, &pollParams->addr, &pollParams->port, memInfo, &(pollParams->mBuf), &pollParams->bufLen, &pollParams->info, &pollParams->flag, &pollParams->ntfy);
- if(connUp && ret != ROK)
+ if(ret != ROK)
{
DU_LOG("\n SCTP: Failed to receive sctp msg for sockFd[%d]\n", sockFd->fd);
recvMsgSet = RFAILED;
{
f1Params.assocId = pollParams->ntfy.u.assocChange.assocId;
DU_LOG("\nSCTP : AssocId assigned to F1Params from PollParams [%d]\n", f1Params.assocId);
+ ret = sctpNtfyHdlr(&pollParams->ntfy, &f1Params.itfState);
}
else if(pollParams->port == ricParams.destPort)
{
ricParams.assocId = pollParams->ntfy.u.assocChange.assocId;
DU_LOG("\nSCTP : AssocId assigned to ricParams from PollParams [%d]\n", ricParams.assocId);
+ ret = sctpNtfyHdlr(&pollParams->ntfy, &ricParams.itfState);
}
else
{
DU_LOG("\nSCTP : Failed to fill AssocId\n");
- }
- ret = sctpNtfyHdlr(&pollParams->ntfy);
+ RETVALUE(RFAILED);
+ }
if(ret != ROK)
{
DU_LOG("\nSCTP : Failed to process sctp notify msg\n");
}
}
- else if(connUp & (pollParams->port == f1Params.destPort))
+ else if(f1Params.itfState & (pollParams->port == f1Params.destPort))
{
- sendToDuApp(pollParams->mBuf, EVTSCTPDATA);
+ sendToDuApp(pollParams->mBuf, EVENT_CU_DATA);
}
- else if(connUp & (pollParams->port == ricParams.destPort))
+ else if(ricParams.itfState & (pollParams->port == ricParams.destPort))
{
- sendToDuApp(pollParams->mBuf, EVTRICDATA);
+ sendToDuApp(pollParams->mBuf, EVENT_RIC_DATA);
}
else