コード例 #1
0
/**********************************************************************

    caller:     owner of this object

    prototype:

        ANSC_STATUS
        CcspCwmpAcscoHttpGetCredential
            (      
                ANSC_HANDLE                 hThisObject,
                PUCHAR                      pHostName,
                USHORT                      HostPort,
                PUCHAR                      pUriPath,
                PUCHAR*                     ppUserName,
                PUCHAR*                     ppPassword
            );

    description:

        This function is called to return the http authentication information
        before sending out.

    argument:   ANSC_HANDLE                 hThisObject
                This handle is actually the pointer of this object
                itself.

                PUCHAR                      pHostName,
                The input host name;

                USHORT                      HostPort,
                The input host port;

                PUCHAR                      pUriPath,
                The input url path;

                PUCHAR*                     ppUserName,
                The output user name informaiton

                PUCHAR*                     ppPassword
                The output password information

    return:     status of operation.

**********************************************************************/
ANSC_STATUS
CcspCwmpAcscoHttpGetCredential
    (      
        ANSC_HANDLE                 hThisObject,
        PUCHAR                      pHostName,
        USHORT                      HostPort,
        PUCHAR                      pUriPath,
        PUCHAR*                     ppUserName,
        PUCHAR*                     ppPassword
    )
{
    ANSC_STATUS                      returnStatus        = ANSC_STATUS_SUCCESS;
    PCCSP_CWMP_ACS_CONNECTION_OBJECT pMyObject           = (PCCSP_CWMP_ACS_CONNECTION_OBJECT)hThisObject;
    PCCSP_CWMP_SESSION_OBJECT        pCcspCwmpSession = (PCCSP_CWMP_SESSION_OBJECT       )pMyObject->hCcspCwmpSession;

    if ( pCcspCwmpSession )
    {
        PCCSP_CWMP_PROCESSOR_OBJECT  pCcspCwmpProcessor  = (PCCSP_CWMP_PROCESSOR_OBJECT)pCcspCwmpSession->GetCcspCwmpProcessor((ANSC_HANDLE)pCcspCwmpSession);
        char*                        pAcsUsername           =  pCcspCwmpProcessor->GetAcsUsername((ANSC_HANDLE)pCcspCwmpProcessor);
        char*                        pAcsPassword           =  pCcspCwmpProcessor->GetAcsPassword((ANSC_HANDLE)pCcspCwmpProcessor);

        *ppUserName = (PUCHAR)pAcsUsername;
        *ppPassword = (PUCHAR)pAcsPassword;
    }
    else
    {
        *ppUserName = (PUCHAR)CcspTr069PaCloneString(pMyObject->Username);
        *ppPassword = (PUCHAR)CcspTr069PaCloneString(pMyObject->Password);
    }

    return returnStatus;
}
コード例 #2
0
ANSC_STATUS
CcspCwmpsoConnectToAcs
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus       = ANSC_STATUS_SUCCESS;
    PCCSP_CWMP_SESSION_OBJECT        pMyObject          = (PCCSP_CWMP_SESSION_OBJECT   )hThisObject;
    PCCSP_CWMP_ACS_CONNECTION_OBJECT     pCcspCwmpAcsConnection = (PCCSP_CWMP_ACS_CONNECTION_OBJECT)pMyObject->hCcspCwmpAcsConnection;
    PCCSP_CWMP_CPE_CONTROLLER_OBJECT     pCcspCwmpCpeController = (PCCSP_CWMP_CPE_CONTROLLER_OBJECT)pMyObject->hCcspCwmpCpeController;
    PCCSP_CWMP_PROCESSOR_OBJECT      pCcspCwmpProcessor  = (PCCSP_CWMP_PROCESSOR_OBJECT )pMyObject->hCcspCwmpProcessor;
    char*                           pAcsUrl            = (char*                      )NULL;
    char*                           pAcsUsername       = (char*                      )NULL;
    char*                           pAcsPassword       = (char*                      )NULL;

    pAcsUrl      = pCcspCwmpProcessor->GetAcsUrl     ((ANSC_HANDLE)pCcspCwmpProcessor);
    pAcsUsername = pCcspCwmpProcessor->GetAcsUsername((ANSC_HANDLE)pCcspCwmpProcessor);
    pAcsPassword = pCcspCwmpProcessor->GetAcsPassword((ANSC_HANDLE)pCcspCwmpProcessor);

	if ( !pAcsUrl )
	{
		returnStatus = ANSC_STATUS_NOT_READY;

		goto  EXIT1;
	}
	else
	{
		pCcspCwmpAcsConnection->SetAcsUrl  ((ANSC_HANDLE)pCcspCwmpAcsConnection, pAcsUrl     );
		pCcspCwmpAcsConnection->SetUsername((ANSC_HANDLE)pCcspCwmpAcsConnection, pAcsUsername);
		pCcspCwmpAcsConnection->SetPassword((ANSC_HANDLE)pCcspCwmpAcsConnection, pAcsPassword);
	}

    if ( pAcsUrl ) 
    {
        CcspTr069PaFreeMemory(pAcsUrl);
    }

    if ( pAcsUsername )
    {
        CcspTr069PaFreeMemory(pAcsUsername);
    }

    if ( pAcsPassword )
    {
        CcspTr069PaFreeMemory(pAcsPassword);
    }

    if (!pCcspCwmpAcsConnection->bActive )
    {
		returnStatus = pCcspCwmpAcsConnection->Connect((ANSC_HANDLE)pCcspCwmpAcsConnection);
	}

    if ( returnStatus == ANSC_STATUS_SUCCESS )
    {
        /*
         * Bin update on 07/08/2007
         *
         * We don't want to lock write access at the beginning of the session, we
         * are supposed to do it after we get a success InformResponse.
         */
        if( FALSE )
        {
            pMyObject->SessionState = CCSP_CWMPSO_SESSION_STATE_abort;
            returnStatus            =
                pCcspCwmpProcessor->SignalSession
                    (
                        (ANSC_HANDLE)pCcspCwmpProcessor,
                        (ANSC_HANDLE)pMyObject
                    );

            return  ANSC_STATUS_NOT_READY;
        }

        pMyObject->bActive      = TRUE;
        pMyObject->SessionState = CCSP_CWMPSO_SESSION_STATE_connected;
        returnStatus            =
            pCcspCwmpProcessor->SignalSession
                (
                    (ANSC_HANDLE)pCcspCwmpProcessor,
                    (ANSC_HANDLE)pMyObject
                );
    }


    /******************************************************************
                GRACEFUL ROLLBACK PROCEDURES AND EXIT DOORS
    ******************************************************************/

EXIT1:

    return  returnStatus;
}