void sbSessAbort(sbSessObj *pThis) { sbNVTEObj *pEntry; sbSessCHECKVALIDOBJECT(pThis); /* First of all, we must indicate on all channels * that they are being aborted. This will instruct * the sbChanTeardown() callback to just delete the * channel object but not try to close them correctly. */ pEntry = sbNVTSearchKeySZ(pThis->pChannels, NULL, NULL); while(pEntry != NULL) { if(pEntry->pUsr != NULL) { sbChanCHECKVALIDOBJECT((sbChanObj*) pEntry->pUsr); ((sbChanObj*) pEntry->pUsr)->iState = sbChan_STATE_ERR_FREE_NEEDED; } pEntry = sbNVTSearchKeySZ(pThis->pChannels, pEntry, NULL); } /* we now need to tear down the TCP stream */ sbSockExit(pThis->pSock); sbSessDestroy(pThis); }
srRetVal sbSockAcceptConnection(sbSockObj* pThis, sbSockObj** pNew) { srRetVal iRet; struct sockaddr_in sa; int iLenSA; sbSockCHECKVALIDOBJECT(pThis); assert(pNew != NULL); if((iRet = sbSockConstruct(pNew)) != SR_RET_OK) return iRet; /* for now, we do not deliver back the address of the remote host */ iLenSA = sizeof(struct sockaddr_in); if((iRet = sbSockAccept(pThis, *pNew, (struct sockaddr*) &sa, &iLenSA)) != SR_RET_OK) { sbSockExit(*pNew); return iRet; } memcpy(&((*pNew)->RemoteHostAddr), &sa, sizeof(struct sockaddr_in)); return SR_RET_OK; }