/* This accepts a new session, and, if all goes well, constructs a new * session object and adds it to the engine's list of sessions. * rgerhards, 2008-03-17 */ relpRetVal relpSessAcceptAndConstruct(relpSess_t **ppThis, relpSrv_t *pSrv, int sock) { relpSess_t *pThis; ENTER_RELPFUNC; assert(ppThis != NULL); RELPOBJ_assert(pSrv, Srv); assert(sock >= 0); CHKRet(relpSessConstruct(&pThis, pSrv->pEngine, pSrv)); CHKRet(relpTcpAcceptConnReq(&pThis->pTcp, sock, pThis->pEngine)); /* TODO: check hostname against ACL (callback?) */ /* TODO: check against max# sessions */ *ppThis = pThis; finalize_it: pSrv->pEngine->dbgprint("relp session accepted with state %d\n", iRet); if(iRet != RELP_RET_OK) { if(pThis != NULL) relpSessDestruct(&pThis); } LEAVE_RELPFUNC; }
/* This accepts a new session, and, if all goes well, constructs a new * session object and adds it to the engine's list of sessions. * rgerhards, 2008-03-17 */ relpRetVal relpSessAcceptAndConstruct(relpSess_t **ppThis, relpSrv_t *pSrv, int sock) { relpSess_t *pThis; ENTER_RELPFUNC; assert(ppThis != NULL); RELPOBJ_assert(pSrv, Srv); assert(sock >= 0); CHKRet(relpSessConstruct(&pThis, pSrv->pEngine, RELP_SRV_CONN, pSrv)); CHKRet(relpTcpAcceptConnReq(&pThis->pTcp, sock, pSrv)); *ppThis = pThis; finalize_it: if(iRet != RELP_RET_OK) { if(pThis != NULL) relpSessDestruct(&pThis); } LEAVE_RELPFUNC; }