ANSC_STATUS AnscLpccoTcpBwoNotify ( ANSC_HANDLE hThisObject, ANSC_HANDLE hSocket, ULONG ulEvent, ANSC_HANDLE hReserved ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PANSC_LPCCO_TCP_OBJECT pMyObject = (PANSC_LPCCO_TCP_OBJECT )hThisObject; PANSC_DAEMON_SERVER_TCP_OBJECT pDaemonServer = (PANSC_DAEMON_SERVER_TCP_OBJECT)pMyObject->hDaemonServer; PANSC_BROKER_SERVER_TCP_OBJECT pBrokerServer = (PANSC_BROKER_SERVER_TCP_OBJECT)pMyObject->hBrokerServer; PANSC_BROKER_SOCKET_TCP_OBJECT pBrokerSocket = (PANSC_BROKER_SOCKET_TCP_OBJECT)hSocket; switch ( ulEvent ) { case ANSC_BSTOWO_EVENT_SOCKET_ERROR : pBrokerSocket->ToClean((ANSC_HANDLE)pBrokerSocket, TRUE, 2); break; case ANSC_BSTOWO_EVENT_SOCKET_CLOSED : pBrokerSocket->Finish((ANSC_HANDLE)pBrokerSocket); break; case ANSC_BSTOWO_EVENT_RESOURCES : break; case ANSC_BSTOWO_EVENT_TIME_OUT : break; default : break; } return ANSC_STATUS_SUCCESS; }
ANSC_STATUS HttpApoPubwoNotify ( ANSC_HANDLE hThisObject, ANSC_HANDLE hSocket, ULONG ulEvent, ANSC_HANDLE hReserved ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PHTTP_ADVANCED_PROXY_OBJECT pMyObject = (PHTTP_ADVANCED_PROXY_OBJECT )hThisObject; PHTTP_ADVANCED_PROXY_PROPERTY pProperty = (PHTTP_ADVANCED_PROXY_PROPERTY )&pMyObject->Property; PANSC_SIMPLE_PROXY_TCP_OBJECT pSimpleProxy = (PANSC_SIMPLE_PROXY_TCP_OBJECT )pMyObject->hSimpleProxy; PANSC_BROKER_SOCKET_TCP_OBJECT pServerSocket = (PANSC_BROKER_SOCKET_TCP_OBJECT)hSocket; PANSC_BUFFER_DESCRIPTOR pBufferDesp = (PANSC_BUFFER_DESCRIPTOR )pServerSocket->GetBufferContext((ANSC_HANDLE)pServerSocket); PHTTP_PSO_VER2_OBJECT pPsoVer2 = NULL; PHTTP_TRANS_RECORD_OBJECT pTransRecord = NULL; AnscTrace ( "Event = %d is indicated on server connection of %d.%d.%d.%d / TCP %d\n", ulEvent, pServerSocket->PeerAddress.Dot[0], pServerSocket->PeerAddress.Dot[1], pServerSocket->PeerAddress.Dot[2], pServerSocket->PeerAddress.Dot[3], pServerSocket->PeerPort ); switch ( ulEvent ) { case ANSC_SPTOWO_EVENT_SOCKET_ERROR : pServerSocket->ToClean((ANSC_HANDLE)pServerSocket, TRUE, HTTP_APO_SOCKET_TTC); break; case ANSC_SPTOWO_EVENT_SOCKET_CLOSED : AnscAcquireLock(&pMyObject->SyncLock); pPsoVer2 = (PHTTP_PSO_VER2_OBJECT)pServerSocket->GetClientContext((ANSC_HANDLE)pServerSocket); if ( pPsoVer2 ) { pPsoVer2->AcquireAccess((ANSC_HANDLE)pPsoVer2); pTransRecord = (PHTTP_TRANS_RECORD_OBJECT)pPsoVer2->AskTroBySocket ( (ANSC_HANDLE)pPsoVer2, (ANSC_HANDLE)pServerSocket ); pPsoVer2->ReleaseAccess((ANSC_HANDLE)pPsoVer2); } else { AnscReleaseLock(&pMyObject->SyncLock); pServerSocket->Finish((ANSC_HANDLE)pServerSocket); return ANSC_STATUS_SUCCESS; } if ( !pTransRecord ) { AnscReleaseLock(&pMyObject->SyncLock); pServerSocket->Finish((ANSC_HANDLE)pServerSocket); return ANSC_STATUS_SUCCESS; } AnscReleaseLock(&pMyObject->SyncLock); pBufferDesp->BlockSize += pServerSocket->RecvPacketSize; returnStatus = pServerSocket->SetBufferContext ( (ANSC_HANDLE)pServerSocket, NULL, 0, (ANSC_HANDLE)NULL ); returnStatus = pTransRecord->FinishedByServer ( (ANSC_HANDLE)pTransRecord, AnscBdoGetBlock (pBufferDesp), AnscBdoGetBlockSize(pBufferDesp), (ANSC_HANDLE)pBufferDesp ); pTransRecord->ReleaseAccess((ANSC_HANDLE)pTransRecord); pServerSocket->Finish((ANSC_HANDLE)pServerSocket); break; case ANSC_SPTOWO_EVENT_RESOURCES : break; case ANSC_SPTOWO_EVENT_TIME_OUT : break; default : break; } return ANSC_STATUS_SUCCESS; }
ANSC_STATUS HttpApoPubwoProcessSync ( ANSC_HANDLE hThisObject, ANSC_HANDLE hSocket, PVOID buffer, ULONG ulSize, ANSC_HANDLE hQueryContext ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PHTTP_ADVANCED_PROXY_OBJECT pMyObject = (PHTTP_ADVANCED_PROXY_OBJECT )hThisObject; PHTTP_ADVANCED_PROXY_PROPERTY pProperty = (PHTTP_ADVANCED_PROXY_PROPERTY )&pMyObject->Property; PANSC_SIMPLE_PROXY_TCP_OBJECT pSimpleProxy = (PANSC_SIMPLE_PROXY_TCP_OBJECT )pMyObject->hSimpleProxy; PANSC_BROKER_SOCKET_TCP_OBJECT pServerSocket = (PANSC_BROKER_SOCKET_TCP_OBJECT)hSocket; PANSC_DAEMON_SOCKET_TCP_OBJECT pClientSocket = (PANSC_DAEMON_SOCKET_TCP_OBJECT)NULL; PANSC_BUFFER_DESCRIPTOR pBufferDesp = (PANSC_BUFFER_DESCRIPTOR )pServerSocket->GetBufferContext((ANSC_HANDLE)pServerSocket); PHTTP_PSO_VER2_OBJECT pPsoVer2 = NULL; PHTTP_TRANS_RECORD_OBJECT pTransRecord = NULL; ULONG ulTroQmode = (ULONG)hQueryContext; BOOL bFinishSocket = FALSE; AnscAcquireLock(&pMyObject->SyncLock); pPsoVer2 = (PHTTP_PSO_VER2_OBJECT)pServerSocket->GetClientContext((ANSC_HANDLE)pServerSocket); if ( pPsoVer2 ) { pPsoVer2->AcquireAccess((ANSC_HANDLE)pPsoVer2); pTransRecord = (PHTTP_TRANS_RECORD_OBJECT)pPsoVer2->AskTroBySocket ( (ANSC_HANDLE)pPsoVer2, (ANSC_HANDLE)pServerSocket ); pPsoVer2->ReleaseAccess((ANSC_HANDLE)pPsoVer2); } else { AnscReleaseLock(&pMyObject->SyncLock); pServerSocket->Finish((ANSC_HANDLE)pServerSocket); return ANSC_STATUS_SUCCESS; } if ( !pTransRecord ) { AnscReleaseLock(&pMyObject->SyncLock); pServerSocket->Finish((ANSC_HANDLE)pServerSocket); return ANSC_STATUS_SUCCESS; } AnscReleaseLock(&pMyObject->SyncLock); switch ( ulTroQmode ) { case HTTP_TRO_QMODE_FORWARD : pClientSocket = (PANSC_DAEMON_SOCKET_TCP_OBJECT)pTransRecord->GetClientSocket((ANSC_HANDLE)pTransRecord); if ( !pClientSocket) { bFinishSocket = TRUE; returnStatus = ANSC_STATUS_INTERNAL_ERROR; break; } else { returnStatus = pClientSocket->Send ( (ANSC_HANDLE)pClientSocket, buffer, ulSize, (ANSC_HANDLE)NULL ); } pBufferDesp->BlockSize = 0; break; case HTTP_TRO_QMODE_PROCESS : pServerSocket->SetBufferContext ( (ANSC_HANDLE)pServerSocket, NULL, 0, (ANSC_HANDLE)NULL ); returnStatus = pTransRecord->RecvFromServer ( (ANSC_HANDLE)pTransRecord, buffer, ulSize, (ANSC_HANDLE)pBufferDesp ); if ( pTransRecord->GetTransState((ANSC_HANDLE)pTransRecord) == HTTP_TRO_STATE_FINISHED ) { bFinishSocket = TRUE; break; } break; default : returnStatus = ANSC_STATUS_UNAPPLICABLE; break; } pTransRecord->ReleaseAccess((ANSC_HANDLE)pTransRecord); if ( bFinishSocket ) { pServerSocket->Finish((ANSC_HANDLE)pServerSocket); } return returnStatus; }