/**********************************************************************

    prototype:

        ANSC_STATUS
        CcspCwmpAcscoClose
            (
                ANSC_HANDLE                 hThisObject
            );

    description:

        This function is called to close the connection to ACS

    argument:

                ANSC_HANDLE                 hThisObject
                The caller object.

    return:     the status of the operation;

**********************************************************************/
ANSC_STATUS
CcspCwmpAcscoClose
    (
        ANSC_HANDLE                 hThisObject
    )
{
    PCCSP_CWMP_ACS_CONNECTION_OBJECT pMyObject       = (PCCSP_CWMP_ACS_CONNECTION_OBJECT)hThisObject;
    PHTTP_SIMPLE_CLIENT_OBJECT      pHttpClient     = (PHTTP_SIMPLE_CLIENT_OBJECT)pMyObject->hHttpSimpleClient;
    ANSC_STATUS                     returnStatus    = ANSC_STATUS_SUCCESS;

    returnStatus = pHttpClient->Cancel((ANSC_HANDLE)pHttpClient);

	/*
    pMyObject->RemoveCookies((ANSC_HANDLE)pMyObject);
	*/

    pMyObject->bActive = FALSE;

    return returnStatus;
}
ANSC_STATUS
HttpScoRemove
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus      = ANSC_STATUS_SUCCESS;
    PHTTP_SIMPLE_CLIENT_OBJECT      pMyObject         = (PHTTP_SIMPLE_CLIENT_OBJECT   )hThisObject;
    PHTTP_BSP_INTERFACE             pBspIf            = (PHTTP_BSP_INTERFACE          )pMyObject->hBspIf;
    PHTTP_HFP_INTERFACE             pHfpIf            = (PHTTP_HFP_INTERFACE          )pMyObject->hHfpIf;
    PHTTP_CAS_INTERFACE             pCasIf            = (PHTTP_CAS_INTERFACE          )pMyObject->hCasIf;
    PANSC_TIMER_DESCRIPTOR_OBJECT   pSessionTdo       = (PANSC_TIMER_DESCRIPTOR_OBJECT)pMyObject->hSessionTdo;
    PANSC_TDO_CLIENT_OBJECT         pSessionTdoClient = (PANSC_TDO_CLIENT_OBJECT      )pMyObject->hSessionTdoClient;
    PHTTP_AUTH_CLIENT_OBJECT        pClientAuthObj    = (PHTTP_AUTH_CLIENT_OBJECT     )pMyObject->hClientAuthObj;
    PHTTP_ACM_INTERFACE             pAcmIf            = (PHTTP_ACM_INTERFACE          )pMyObject->hAcmIf;

    pMyObject->Cancel((ANSC_HANDLE)pMyObject);
    pMyObject->Reset ((ANSC_HANDLE)pMyObject);

    if ( pBspIf )
    {
        AnscFreeMemory(pBspIf);
    }

    if ( pHfpIf )
    {
        AnscFreeMemory(pHfpIf);
    }

    if ( pCasIf )
    {
        AnscFreeMemory(pCasIf);
    }

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

    if ( pSessionTdoClient )
    {
        AnscFreeMemory(pSessionTdoClient);
    }

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

    if ( pAcmIf )
    {
        AnscFreeMemory(pAcmIf);
    }

    if ( pMyObject->pAuthUserName )
    {
        AnscFreeMemory(pMyObject->pAuthUserName);
    }

    if ( pMyObject->pAuthPassword )
    {
        AnscFreeMemory(pMyObject->pAuthPassword);
    }

    AnscFreeLock(&pMyObject->WcsoTableLock  );
    AnscFreeLock(&pMyObject->WcsoSListLock  );
    AnscFreeLock(&pMyObject->WctoSListLock  );
    AnscFreeLock(&pMyObject->BmoReqSListLock);
    AnscFreeLock(&pMyObject->BmoRepSListLock);

    AnscCoRemove((ANSC_HANDLE)pMyObject);

    return  ANSC_STATUS_SUCCESS;
}