+
+ /* Establish SCTP association at XN interface */
+ if(sctpCb.sctpCfg.xnSctpInfo.numDestNode)
+ {
+ if(sctpCb.localXnNodeType == SERVER)
+ {
+ if((ret = cmInetSocket(socket_type, &sctpCb.xnLstnSockFd, IPPROTO_SCTP) != ROK))
+ {
+ DU_LOG("\nERROR --> SCTP : Socket[%d] coudnt open for listening", sctpCb.f1LstnSockFd.fd);
+ }
+ else if((ret = cmInetSctpBindx(&sctpCb.xnLstnSockFd, &sctpCb.localAddrLst, sctpCb.sctpCfg.xnSctpInfo.port)) != ROK)
+ {
+ DU_LOG("\nERROR --> SCTP: Binding failed at CU");
+ }
+ else if(ret = cmInetListen(&sctpCb.xnLstnSockFd, 1) != ROK)
+ {
+ DU_LOG("\nERROR --> SCTP : Listening on socket failed");
+ cmInetClose(&sctpCb.xnLstnSockFd);
+ return RFAILED;
+ }
+ else
+ {
+ for(assocIdx=0; assocIdx < sctpCb.numAssoc; assocIdx++)
+ {
+ if(sctpCb.assocCb[assocIdx].intf == XN_INTERFACE)
+ {
+ if((ret = sctpAccept(&sctpCb.xnLstnSockFd, &sctpCb.assocCb[assocIdx])) != ROK)
+ {
+ DU_LOG("\nERROR --> SCTP: Unable to accept the connection at CU");
+ }
+ }
+ }
+ }
+ }
+ else if(sctpCb.localXnNodeType == CLIENT)
+ {
+ for(assocIdx=0; assocIdx < sctpCb.numAssoc; assocIdx++)
+ {
+ if(sctpCb.assocCb[assocIdx].intf == XN_INTERFACE)
+ {
+ if((ret = cmInetSocket(socket_type, &sctpCb.assocCb[assocIdx].sockFd, IPPROTO_SCTP)) != ROK)
+ {
+ DU_LOG("\nERROR --> SCTP : Failed while opening a socket in ODU");
+ }
+ else if((ret = cmInetSctpBindx(&sctpCb.assocCb[assocIdx].sockFd, &sctpCb.localAddrLst, sctpCb.sctpCfg.xnSctpInfo.port)) != ROK)
+ {
+ DU_LOG("\nERROR --> SCTP: Failed during Binding in ODU");
+ }
+ else if((ret = sctpSetSockOpts(&sctpCb.assocCb[assocIdx].sockFd)) != ROK)
+ {
+ DU_LOG("\nERROR --> SCTP : Failed to set Socket Opt in ODU");
+ }
+ else
+ {
+ if(ret != ROK)
+ {
+ DU_LOG("\nERROR --> SCTP : Failed while establishing Req at DU");
+ ret = RFAILED;
+ }
+ else
+ {
+ ret = cmInetSctpConnectx(&sctpCb.assocCb[assocIdx].sockFd, &sctpCb.assocCb[assocIdx].destIpNetAddr, \
+ &sctpCb.assocCb[assocIdx].destAddrLst, sctpCb.assocCb[assocIdx].destPort);
+ /* 115 error_code indicates that Operation is in progress and hence ignored if SctpConnect failed due to this */
+ if(ret == 18)
+ {
+ ret = ROK;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* Establish SCTP association at F1 interface */
+ if(sctpCb.sctpCfg.f1SctpInfo.numDestNode)