ANSC_STATUS
HttpAuthcoClearAllAuthInfo
    (
        ANSC_HANDLE                 hThisObject
    )
{
    PHTTP_AUTH_CLIENT_OBJECT        pMyObject    = (PHTTP_AUTH_CLIENT_OBJECT)hThisObject;
    PHTTP_AUTHO_INFO                pAuthInfo    = NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry  = NULL;

    AnscAcquireLock(&pMyObject->AuthInfoListLock);

    /* remove auth info */
    pSLinkEntry = AnscSListPopEntry(&pMyObject->AuthInfoList);
    while (pSLinkEntry)
    {
        pAuthInfo   = ACCESS_HTTP_AUTHO_INFO_OBJECT(pSLinkEntry);
        pSLinkEntry = AnscSListPopEntry(&pMyObject->AuthInfoList);

        HttpAuthInfoRemove(pAuthInfo);
    }

    AnscReleaseLock(&pMyObject->AuthInfoListLock);

    return ANSC_STATUS_SUCCESS;
}
ANSC_STATUS
HttpWcsoDelAllWctos
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus  = ANSC_STATUS_SUCCESS;
    PHTTP_WEBC_SESSION_OBJECT       pMyObject     = (PHTTP_WEBC_SESSION_OBJECT )hThisObject;
    PHTTP_SIMPLE_CLIENT_OBJECT      pSimpleClient = (PHTTP_SIMPLE_CLIENT_OBJECT)pMyObject->hOwnerContext;
    PHTTP_BSP_INTERFACE             pBspIf        = (PHTTP_BSP_INTERFACE       )pMyObject->hBspIf;
    PHTTP_HFP_INTERFACE             pHfpIf        = (PHTTP_HFP_INTERFACE       )pMyObject->hHfpIf;
    PHTTP_WEBC_TRANS_OBJECT         pWebcTrans    = NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry   = NULL;

    AnscAcquireLock(&pMyObject->WctoSListLock);

    pSLinkEntry = AnscSListPopEntry(&pMyObject->WctoSList);

    while ( pSLinkEntry )
    {
        pWebcTrans  = ACCESS_HTTP_WEBC_TRANS_OBJECT(pSLinkEntry);
        pSLinkEntry = AnscSListPopEntry(&pMyObject->WctoSList);

        pWebcTrans->AcquireAccess((ANSC_HANDLE)pWebcTrans);
        pWebcTrans->ReleaseAccess((ANSC_HANDLE)pWebcTrans);
        pWebcTrans->Close        ((ANSC_HANDLE)pWebcTrans);
        pWebcTrans->Return       ((ANSC_HANDLE)pWebcTrans);
    }

    AnscReleaseLock(&pMyObject->WctoSListLock);

    return  ANSC_STATUS_SUCCESS;
}
ANSC_STATUS
BbhmDiagipCalculateResult
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PBBHM_DIAG_IP_PING_OBJECT       pMyObject    = (PBBHM_DIAG_IP_PING_OBJECT)hThisObject;
    PBBHM_IP_PING_PROPERTY          pProperty    = (PBBHM_IP_PING_PROPERTY        )&pMyObject->Property;
    PBBHM_IP_PING_TDO_OBJECT        pStateTimer  = (PBBHM_IP_PING_TDO_OBJECT      )pMyObject->hStateTimer;
    PBBHM_IP_PING_SINK_OBJECT       pSink        = (PBBHM_IP_PING_SINK_OBJECT     )pMyObject->hSinkObject;
    PSINGLE_LINK_ENTRY              pSLinkEntry  = NULL;
    PBBHM_IP_PING_ECHO_ENTRY        pEchoEntry   = NULL;
    PBBHM_IP_PING_ECHO_ENTRY        pMEchoEntry  = NULL;
    ULONG                           i            = 0;

    AnscAcquireLock(&pMyObject->EchoTableLock);

    for ( i = 0; i < MAX_ECHO_TABLE_SIZE; i++ )
    {
        pSLinkEntry = AnscSListPopEntry(&pMyObject->EchoTable[i]);

        while ( pSLinkEntry )
        {
            pEchoEntry = (PBBHM_IP_PING_ECHO_ENTRY)ACCESS_BBHM_IP_PING_ECHO_ENTRY(pSLinkEntry);
            pSLinkEntry = AnscSListPopEntry(&pMyObject->EchoTable[i]);
            AnscFreeMemory(pEchoEntry);
        }
    }

    AnscReleaseLock(&pMyObject->EchoTableLock);

    return  returnStatus;
}
ANSC_STATUS
HttpSpoDestroyBmoRepPool
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PHTTP_SIMPLE_PROXY_OBJECT       pMyObject    = (PHTTP_SIMPLE_PROXY_OBJECT  )hThisObject;
    PHTTP_SIMPLE_PROXY_PROPERTY     pProperty    = (PHTTP_SIMPLE_PROXY_PROPERTY)&pMyObject->Property;
    PHTTP_BMO_REP_OBJECT            pBmoRep      = NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry  = NULL;

    AnscAcquireLock(&pMyObject->BmoRepSListLock);

    pSLinkEntry = AnscSListPopEntry(&pMyObject->BmoRepSList);

    while ( pSLinkEntry )
    {
        pBmoRep     = ACCESS_HTTP_BMO_REP_OBJECT(pSLinkEntry);
        pSLinkEntry = AnscSListPopEntry(&pMyObject->BmoRepSList);

        pBmoRep->Remove((ANSC_HANDLE)pBmoRep);
    }

    AnscReleaseLock(&pMyObject->BmoRepSListLock);

    return  ANSC_STATUS_SUCCESS;
}
ANSC_STATUS
HttpSpoDestroyPsoPool
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PHTTP_SIMPLE_PROXY_OBJECT       pMyObject    = (PHTTP_SIMPLE_PROXY_OBJECT  )hThisObject;
    PHTTP_SIMPLE_PROXY_PROPERTY     pProperty    = (PHTTP_SIMPLE_PROXY_PROPERTY)&pMyObject->Property;
    PHTTP_PROXY_SESSION_OBJECT      pSession     = NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry  = NULL;

    AnscAcquireLock(&pMyObject->PsoSListLock);

    pSLinkEntry = AnscSListPopEntry(&pMyObject->PsoSList);

    while ( pSLinkEntry )
    {
        pSession    = ACCESS_HTTP_PROXY_SESSION_OBJECT(pSLinkEntry);
        pSLinkEntry = AnscSListPopEntry(&pMyObject->PsoSList);

        pSession->Remove((ANSC_HANDLE)pSession);
    }

    AnscReleaseLock(&pMyObject->PsoSListLock);

    return  ANSC_STATUS_SUCCESS;
}
ANSC_STATUS
HttpScoDelAllWcsos
(
    ANSC_HANDLE                 hThisObject
)
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PHTTP_SIMPLE_CLIENT_OBJECT      pMyObject    = (PHTTP_SIMPLE_CLIENT_OBJECT  )hThisObject;
    PHTTP_SIMPLE_CLIENT_PROPERTY    pProperty    = (PHTTP_SIMPLE_CLIENT_PROPERTY)&pMyObject->Property;
    PHTTP_WEBC_SESSION_OBJECT       pWebcSession = NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry  = NULL;
    ULONG                           i            = 0;

    AnscAcquireLock(&pMyObject->WcsoTableLock);

    for ( i = 0; i < HTTP_SCO_WCSO_TABLE_SIZE; i++ )
    {
        pSLinkEntry = AnscSListPopEntry(&pMyObject->WcsoTable[i]);

        while ( pSLinkEntry )
        {
            pWebcSession = ACCESS_HTTP_WEBC_SESSION_OBJECT(pSLinkEntry);
            pSLinkEntry  = AnscSListPopEntry(&pMyObject->WcsoTable[i]);

            pWebcSession->AcquireAccess((ANSC_HANDLE)pWebcSession);
            pWebcSession->ReleaseAccess((ANSC_HANDLE)pWebcSession);
            pWebcSession->Close        ((ANSC_HANDLE)pWebcSession);
            pWebcSession->Return       ((ANSC_HANDLE)pWebcSession);
        }
    }

    AnscReleaseLock(&pMyObject->WcsoTableLock);

    return  ANSC_STATUS_SUCCESS;
}
ANSC_STATUS
SlapScoGalDelAllVariables
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus    = ANSC_STATUS_SUCCESS;
    PSLAP_SCO_GALLERY_OBJECT        pMyObject       = (PSLAP_SCO_GALLERY_OBJECT)hThisObject;
    PANSC_ATOM_TABLE_OBJECT         pAtoVariable    = (PANSC_ATOM_TABLE_OBJECT )pMyObject->hAtoVariable;
    PANSC_ATOM_DESCRIPTOR           pAtomDescriptor = (PANSC_ATOM_DESCRIPTOR   )NULL;
    PSLAP_VARIABLE                  pSlapVariable   = (PSLAP_VARIABLE          )NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry     = NULL;
    ULONG                           i               = 0;

    /*AnscAcquireSpinLock(&pAtoVariable->AdoStrTableSpinLock);*/

    for ( i = 0; i < pAtoVariable->AdoStrTableSize; i++ )
    {
        pSLinkEntry = AnscSListPopEntry(&pAtoVariable->AdoStrTable[i]);

        while ( pSLinkEntry )
        {
            pAtomDescriptor = ACCESS_ANSC_ATOM_DESCRIPTOR(pSLinkEntry);
            pSLinkEntry     = AnscSListPopEntry(&pAtoVariable->AdoStrTable[i]);
            pSlapVariable   = pAtomDescriptor->hContext;

            returnStatus =
                pMyObject->QuitGallery
                    (
                        (ANSC_HANDLE)pMyObject,
                        pSlapVariable
                    );

            if ( pSlapVariable )
            {
                SlapFreeVariable(pSlapVariable);
            }

            if ( pAtomDescriptor->AtomName )
            {
                AnscFreeMemory(pAtomDescriptor->AtomName);
            }

            AnscFreeMemory(pAtomDescriptor);
        }
    }

    /*AnscReleaseSpinLock(&pAtoVariable->AdoStrTableSpinLock);*/

    return  ANSC_STATUS_SUCCESS;
}
ANSC_STATUS
HttpPsoVer2DelAllTros
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus   = ANSC_STATUS_SUCCESS;
    PHTTP_PSO_VER2_OBJECT           pMyObject      = (PHTTP_PSO_VER2_OBJECT      )hThisObject;
    PHTTP_ADVANCED_PROXY_OBJECT     pAdvancedProxy = (PHTTP_ADVANCED_PROXY_OBJECT)pMyObject->hOwnerContext;
    PHTTP_WAM_INTERFACE             pWamIf         = (PHTTP_WAM_INTERFACE        )pMyObject->hWamIf;
    PHTTP_TRANS_RECORD_OBJECT       pTransRecord   = NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry    = NULL;
    PANSC_BROKER_SOCKET_TCP_OBJECT  pServerSocket  = NULL;

    AnscAcquireLock(&pMyObject->TroSListLock);

    pSLinkEntry = AnscSListPopEntry(&pMyObject->TroSList);

    while ( pSLinkEntry )
    {
        pTransRecord = ACCESS_HTTP_TRANS_RECORD_OBJECT(pSLinkEntry);
        pSLinkEntry  = AnscSListPopEntry(&pMyObject->TroSList);

        returnStatus =
            pWamIf->Close
                (
                    pWamIf->hOwnerContext,
                    (ANSC_HANDLE)pTransRecord
                );

        pTransRecord->AcquireAccess((ANSC_HANDLE)pTransRecord);

        pServerSocket = (PANSC_BROKER_SOCKET_TCP_OBJECT)pTransRecord->GetServerSocket((ANSC_HANDLE)pTransRecord);

        if ( pServerSocket )
        {
            pServerSocket->SetClientContext((ANSC_HANDLE)pServerSocket, (ANSC_HANDLE)NULL        );
            pServerSocket->ToClean         ((ANSC_HANDLE)pServerSocket, TRUE, HTTP_APO_SOCKET_TTC);
        }

        pTransRecord->ReleaseAccess((ANSC_HANDLE)pTransRecord);
        pTransRecord->Close        ((ANSC_HANDLE)pTransRecord);
        pTransRecord->Return       ((ANSC_HANDLE)pTransRecord);
    }

    AnscReleaseLock(&pMyObject->TroSListLock);

    return  ANSC_STATUS_SUCCESS;
}
Esempio n. 9
0
ANSC_STATUS
CosaNatRemove
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PCOSA_DATAMODEL_NAT             pMyObject    = (PCOSA_DATAMODEL_NAT)hThisObject;
    PSINGLE_LINK_ENTRY              pLink        = NULL;
    PCOSA_CONTEXT_LINK_OBJECT       pNat         = NULL;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFo  = (PPOAM_IREP_FOLDER_OBJECT)pMyObject->hIrepFolderNat;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepPt  = (PPOAM_IREP_FOLDER_OBJECT)pMyObject->hIrepFolderNatPt;



    /* Remove resource of writable entry link */
    for( pLink = AnscSListPopEntry(&pMyObject->NatPMappingList); pLink; )
    {
        pNat = (PCOSA_CONTEXT_LINK_OBJECT)ACCESS_COSA_CONTEXT_LINK_OBJECT(pLink);
        pLink = AnscSListGetNextEntry(pLink);

        AnscFreeMemory(pNat->hContext);
        AnscFreeMemory(pNat);
    }

    for( pLink = AnscSListPopEntry(&pMyObject->NatPTriggerList); pLink; )
    {
        pNat = (PCOSA_CONTEXT_LINK_OBJECT)ACCESS_COSA_CONTEXT_LINK_OBJECT(pLink);
        pLink = AnscSListGetNextEntry(pLink);

        AnscFreeMemory(pNat->hContext);
        AnscFreeMemory(pNat);
    }

    if ( pPoamIrepPt )
    {
        pPoamIrepPt->Remove( (ANSC_HANDLE)pPoamIrepPt);
    }

    if ( pPoamIrepFo )
    {
        pPoamIrepFo->Remove( (ANSC_HANDLE)pPoamIrepFo);
    }

    /* Remove self */
    AnscFreeMemory((ANSC_HANDLE)pMyObject);

    return returnStatus;
}
ANSC_STATUS
BbhmDiagipClose
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PBBHM_DIAG_IP_PING_OBJECT       pMyObject    = (PBBHM_DIAG_IP_PING_OBJECT     )hThisObject;
    PBBHM_IP_PING_PROPERTY          pProperty    = (PBBHM_IP_PING_PROPERTY        )&pMyObject->Property;
    PBBHM_IP_PING_TDO_OBJECT        pStateTimer  = (PBBHM_IP_PING_TDO_OBJECT      )pMyObject->hStateTimer;
    PBBHM_IP_PING_SINK_OBJECT       pSink        = (PBBHM_IP_PING_SINK_OBJECT     )pMyObject->hSinkObject;
    PSINGLE_LINK_ENTRY              pSLinkEntry  = NULL;
    PBBHM_IP_PING_ECHO_ENTRY        pEchoEntry   = NULL;
    ULONG                           i            = 0;

    if ( !pMyObject->bActive )
    {
        return  ANSC_STATUS_SUCCESS;
    }

    if ( pSink )
    {
        pSink->Detach((ANSC_HANDLE)pSink);
        pSink->Remove((ANSC_HANDLE)pSink);
        pMyObject->hSinkObject = NULL;
    }

    AnscAcquireLock(&pMyObject->EchoTableLock);

    for ( i = 0; i < MAX_ECHO_TABLE_SIZE; i ++ )
    {
        pSLinkEntry = AnscSListPopEntry(&pMyObject->EchoTable[i]);

        while ( pSLinkEntry )
        {
            pEchoEntry  = ACCESS_BBHM_IP_PING_ECHO_ENTRY(pSLinkEntry);
            pSLinkEntry = AnscSListPopEntry(&pMyObject->EchoTable[i]);

            AnscFreeMemory(pEchoEntry);
        }
    }

    AnscReleaseLock(&pMyObject->EchoTableLock);

    pMyObject->bActive = FALSE;

    return  returnStatus;
}
ANSC_STATUS
BreeSrmoRemove
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PBREE_SRM_OBJECT                pMyObject    = (PBREE_SRM_OBJECT)hThisObject;
    PBREE_SRM_RES_ITEM              pRes;
    ULONG                           i;
    PSINGLE_LINK_ENTRY              pEntry;

    for (i = 0; i < BREE_SRM_RES_TABLE_SIZE; i ++)
    {
        while (TRUE)
        {
            pEntry = AnscSListPopEntry(&pMyObject->ResList[i]);

            if (!pEntry)
            {
                break;
            }

            pRes = ACCESS_BREE_SRM_RES_ITEM_OBJECT(pEntry);

            AnscFreeMemory(pRes);
        }
    }

    AnscCoRemove((ANSC_HANDLE)pMyObject);

    return  ANSC_STATUS_SUCCESS;
}
Esempio n. 12
0
ANSC_STATUS
CosaUsersRemove
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus        = ANSC_STATUS_SUCCESS;
    PCOSA_DATAMODEL_USERS           pMyObject           = (PCOSA_DATAMODEL_USERS)hThisObject;
    PSINGLE_LINK_ENTRY              pSListEntry         = NULL;
    PCOSA_CONTEXT_LINK_OBJECT       pCxtLink            = NULL;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFo         = (PPOAM_IREP_FOLDER_OBJECT)pMyObject->hIrepFolderUser;

    /* Remove necessary resource */
    pSListEntry         = AnscSListPopEntry(&pMyObject->UserList);
    while( pSListEntry != NULL)
    {
        pCxtLink         = ACCESS_COSA_CONTEXT_LINK_OBJECT(pSListEntry);
        pSListEntry       = AnscSListGetNextEntry(pSListEntry);

        AnscFreeMemory(pCxtLink->hContext);
        AnscFreeMemory(pCxtLink);   
    }

    if ( pPoamIrepFo )
    {
        pPoamIrepFo->Remove( (ANSC_HANDLE)pPoamIrepFo);
    }

    /* Remove self */
    AnscFreeMemory((ANSC_HANDLE)pMyObject);

    return returnStatus;
}
ANSC_STATUS
BwrmPmoDelAllPages
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus      = ANSC_STATUS_SUCCESS;
    PBWRM_PAGE_MANAGER_OBJECT       pMyObject         = (PBWRM_PAGE_MANAGER_OBJECT    )hThisObject;
    PBWRM_PAGE_MANAGER_PROPERTY     pProperty         = (PBWRM_PAGE_MANAGER_PROPERTY  )&pMyObject->Property;
    PANSC_TIMER_DESCRIPTOR_OBJECT   pCacheTimerObject = (PANSC_TIMER_DESCRIPTOR_OBJECT)pMyObject->hCacheTimerObject;
    PBWRM_COOKED_PAGE_OBJECT        pCookedPage       = (PBWRM_COOKED_PAGE_OBJECT     )NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry       = (PSINGLE_LINK_ENTRY           )NULL;
    ULONG                           i                 = 0;
    ULONG                           ulPageInUse       = 0;

    AnscAcquireLock(&pMyObject->CpoTableLock);

    for ( i = 0; i < BWRM_PMO_CPO_TABLE_SIZE; i++ )
    {
        pSLinkEntry = AnscSListPopEntry(&pMyObject->CpoTable[i]);

        while ( pSLinkEntry )
        {
            pCookedPage = ACCESS_BWRM_COOKED_PAGE_OBJECT(pSLinkEntry);
            pSLinkEntry = AnscSListPopEntry(&pMyObject->CpoTable[i]);

            if ( 0 == pCookedPage->GetRefCount((ANSC_HANDLE)pCookedPage) )
            {
                pCookedPage->Remove((ANSC_HANDLE)pCookedPage);
            }
            else
            {
                ulPageInUse ++;
            }
        }
    }

    AnscReleaseLock(&pMyObject->CpoTableLock);

    if ( 0 == ulPageInUse )
    {
        pCacheTimerObject->Stop((ANSC_HANDLE)pCacheTimerObject);
    }

    return  ANSC_STATUS_SUCCESS;
}
ANSC_STATUS
WebVhoDelAllGsos
(
    ANSC_HANDLE                 hThisObject
)
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PWEB_VIRTUAL_HOST_OBJECT        pMyObject    = (PWEB_VIRTUAL_HOST_OBJECT  )hThisObject;
    PWEB_VIRTUAL_HOST_PROPERTY      pProperty    = (PWEB_VIRTUAL_HOST_PROPERTY)&pMyObject->Property;
    PHTTP_HFP_INTERFACE             pHfpIf       = (PHTTP_HFP_INTERFACE       )pMyObject->hHfpIf;
    PWEB_LSM_INTERFACE              pLsmIf       = (PWEB_LSM_INTERFACE        )pMyObject->hLsmIf;
    PWEB_GENERAL_SESSION_OBJECT     pSession     = NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry  = NULL;
    ULONG                           i            = 0;

    AnscAcquireLock(&pMyObject->GsoTableLock);

    for ( i = 0; i < WEB_VHO_GSO_TABLE_SIZE; i++ )
    {
        pSLinkEntry = AnscSListPopEntry(&pMyObject->GsoTable[i]);

        while ( pSLinkEntry )
        {
            pSession    = ACCESS_WEB_GENERAL_SESSION_OBJECT(pSLinkEntry);
            pSLinkEntry = AnscSListPopEntry(&pMyObject->GsoTable[i]);

            pSession->AcquireAccess((ANSC_HANDLE)pSession);

            returnStatus =
                pLsmIf->ExpireSession
                (
                    pLsmIf->hOwnerContext,
                    (ANSC_HANDLE)pSession
                );

            pSession->ReleaseAccess((ANSC_HANDLE)pSession);
            pSession->Cancel       ((ANSC_HANDLE)pSession);
            pSession->Remove       ((ANSC_HANDLE)pSession);
        }
    }

    AnscReleaseLock(&pMyObject->GsoTableLock);

    return  ANSC_STATUS_SUCCESS;
}
ANSC_HANDLE
HttpSpoAcquireBmoRep
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PHTTP_SIMPLE_PROXY_OBJECT       pMyObject    = (PHTTP_SIMPLE_PROXY_OBJECT  )hThisObject;
    PHTTP_SIMPLE_PROXY_PROPERTY     pProperty    = (PHTTP_SIMPLE_PROXY_PROPERTY)&pMyObject->Property;
    PHTTP_HFP_INTERFACE             pHfpIf       = (PHTTP_HFP_INTERFACE        )pMyObject->hHfpIf;
    PHTTP_BMO_REP_OBJECT            pBmoRep      = NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry  = NULL;

    AnscAcquireLock(&pMyObject->BmoRepSListLock);
    pSLinkEntry = AnscSListPopEntry(&pMyObject->BmoRepSList);
    AnscReleaseLock(&pMyObject->BmoRepSListLock);

    if ( pSLinkEntry )
    {
        pBmoRep = ACCESS_HTTP_BMO_REP_OBJECT(pSLinkEntry);

        return  (ANSC_HANDLE)pBmoRep;
    }

    pBmoRep =
        (PHTTP_BMO_REP_OBJECT)HttpCreateBmoRep
            (
                pMyObject->hContainerContext,
                (ANSC_HANDLE)pMyObject,
                (ANSC_HANDLE)NULL
            );

    if ( !pBmoRep )
    {
        return  (ANSC_HANDLE)NULL;
    }
    else
    {
        pBmoRep->SetHfpIf      ((ANSC_HANDLE)pBmoRep, (ANSC_HANDLE)pHfpIf);
        pBmoRep->SetRecvContext((ANSC_HANDLE)pBmoRep, (ANSC_HANDLE)NULL  );
        pBmoRep->SetSendContext((ANSC_HANDLE)pBmoRep, (ANSC_HANDLE)NULL  );
    }

    return  (ANSC_HANDLE)pBmoRep;
}
ANSC_HANDLE
HttpSpoAcquirePso
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PHTTP_SIMPLE_PROXY_OBJECT       pMyObject    = (PHTTP_SIMPLE_PROXY_OBJECT  )hThisObject;
    PHTTP_SIMPLE_PROXY_PROPERTY     pProperty    = (PHTTP_SIMPLE_PROXY_PROPERTY)&pMyObject->Property;
    PHTTP_PROXY_SESSION_OBJECT      pSession     = NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry  = NULL;

    AnscAcquireLock(&pMyObject->PsoSListLock);
    pSLinkEntry = AnscSListPopEntry(&pMyObject->PsoSList);
    AnscReleaseLock(&pMyObject->PsoSListLock);

    if ( pSLinkEntry )
    {
        pSession = ACCESS_HTTP_PROXY_SESSION_OBJECT(pSLinkEntry);

        return  (ANSC_HANDLE)pSession;
    }

    pSession =
        (PHTTP_PROXY_SESSION_OBJECT)HttpCreateProxySession
            (
                pMyObject->hContainerContext,
                (ANSC_HANDLE)pMyObject,
                (ANSC_HANDLE)NULL
            );

    if ( !pSession )
    {
        return  (ANSC_HANDLE)NULL;
    }
    else
    {
        pSession->SetClientSocket((ANSC_HANDLE)pSession, (ANSC_HANDLE)NULL);
        pSession->SetServerSocket((ANSC_HANDLE)pSession, (ANSC_HANDLE)NULL);
        pSession->SetSbcContext  ((ANSC_HANDLE)pSession, (ANSC_HANDLE)NULL);
        pSession->SetCbcContext  ((ANSC_HANDLE)pSession, (ANSC_HANDLE)NULL);
    }

    return  (ANSC_HANDLE)pSession;
}
ANSC_STATUS
BbhmDiagipStop
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PBBHM_DIAG_IP_PING_OBJECT       pMyObject    = (PBBHM_DIAG_IP_PING_OBJECT     )hThisObject;
    PBBHM_IP_PING_PROPERTY          pProperty    = (PBBHM_IP_PING_PROPERTY        )&pMyObject->Property;
    PBBHM_IP_PING_TDO_OBJECT        pStateTimer  = (PBBHM_IP_PING_TDO_OBJECT      )pMyObject->hStateTimer;
    PBBHM_IP_PING_SINK_OBJECT       pSink        = (PBBHM_IP_PING_SINK_OBJECT     )pMyObject->hSinkObject;
    PANSC_XSOCKET_OBJECT            pSocket      = NULL;
    PDSLH_PING_INFO                 pDslhDiagInfo= (PDSLH_PING_INFO               )pMyObject->hDslhDiagInfo;
    PSINGLE_LINK_ENTRY              pSLinkEntry  = NULL;
    PBBHM_IP_PING_ECHO_ENTRY        pMEchoEntry  = NULL;
    SLIST_HEADER                    MiddleResult;
    ULONG                           i            = 0;
    ULONG                           MaxRetrieve  = 10;
    ULONG                           nRead        = 0;

    if ( pMyObject->bActive )
    {
        ULONG                       ulMin = 0;
        ULONG                       ulMax = 0;
        ULONG                       ulSum = 0;
        ULONG                       ulTime;

        pStateTimer->Stop((ANSC_HANDLE)pStateTimer);
        pStateTimer->SetStopTime((ANSC_HANDLE)pStateTimer, AnscGetTickInMilliSeconds());

        returnStatus =
            pMyObject->CalculateResult
                (
                    (ANSC_HANDLE)pMyObject
                );

        for (i = 0; i < MaxRetrieve; i++)
        {
            AnscAcquireLock(&pMyObject->MiddleResultLock);
            MiddleResult = pMyObject->MiddleResult;
            AnscReleaseLock(&pMyObject->MiddleResultLock);
            if (MiddleResult.Depth == 0)
            {
                break;
            }
            AnscSleep(100);
        }

        AnscAcquireLock(&pMyObject->MiddleResultLock);

        nRead = pMyObject->MiddleResult.Depth;
        pSLinkEntry = AnscSListPopEntry(&pMyObject->MiddleResult);
        while ( pSLinkEntry )
        {
            pMEchoEntry = (PBBHM_IP_PING_ECHO_ENTRY)ACCESS_BBHM_IP_PING_ECHO_ENTRY(pSLinkEntry);
            pSLinkEntry = AnscSListPopEntry(&pMyObject->MiddleResult);

            ulTime = pMEchoEntry->StopTime - pMEchoEntry->StartTime;

            /* calculate min, max, sum */
            if ( ulSum == 0 )
            {
                ulMin = ulMax = ulSum = ulTime;
            }
            else
            {
                if ( ulMin > ulTime )
                {
                    ulMin = ulTime;
                }

                if ( ulMax < ulTime )
                {
                    ulMax = ulTime;
                }

                ulSum += ulTime;
            }

            AnscFreeMemory(pMEchoEntry);
        }

        AnscReleaseLock(&pMyObject->MiddleResultLock);

        if ( nRead != 0 )
        {
            pProperty->AvgRTT   = ulSum/nRead;
            pProperty->MinRTT   = ulMin;
            pProperty->MaxRTT   = ulMax;
        }

        if ( pSink )
        {
            pSocket = (PANSC_XSOCKET_OBJECT             )pSink->GetXsocket((ANSC_HANDLE)pSink);
            pSocket->Close((ANSC_HANDLE)pSocket);
        }
    }

    switch ( pMyObject->GetStatus((ANSC_HANDLE)pMyObject) )
    {
        case  BBHM_IP_PING_STATUS_COMPLETE:

                pDslhDiagInfo->DiagnosticState = DSLH_DIAG_STATE_TYPE_Complete;

                break;

        case  BBHM_IP_PING_STATUS_ABORT:

                pDslhDiagInfo->DiagnosticState = DSLH_DIAG_STATE_TYPE_PING_Error_Internal;

                break;

        case  BBHM_IP_PING_STATUS_STOP:

                pDslhDiagInfo->DiagnosticState = DSLH_DIAG_STATE_TYPE_Complete;

                break;

        case  BBHM_IP_PING_STATUS_ERROR_HostName:

                pDslhDiagInfo->DiagnosticState = DSLH_DIAG_STATE_TYPE_Error_HostName;

                break;

        case  BBHM_IP_PING_STATUS_TIMEOUT:

                pMyObject->SetMaxRTT((ANSC_HANDLE)pMyObject, 0);
                pMyObject->SetMinRTT((ANSC_HANDLE)pMyObject, 0);
                pDslhDiagInfo->DiagnosticState = DSLH_DIAG_STATE_TYPE_Complete;

                break;

        default:

                return  returnStatus;
    }

    pMyObject->bResultQueryRunning     = FALSE;
    pDslhDiagInfo->SuccessCount        = nRead;
    pDslhDiagInfo->FailureCount        = pProperty->PktsSent - nRead;
    pDslhDiagInfo->AverageResponseTime = pProperty->AvgRTT;
    pDslhDiagInfo->MinimumResponseTime = pProperty->MinRTT;
    pDslhDiagInfo->MaximumResponseTime = pProperty->MaxRTT;

    return  returnStatus;
}