multimediacommsengine/tsrc/testdriver/siptester/src/TCmdSetCredentials.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation
       
    15 *
       
    16 */
       
    17 
       
    18 #include "CTcSIPContext.h"
       
    19 #include "SIPConstants.h"
       
    20 #include "CTcSIPHttpDigestContainer.h"
       
    21 #include "TCmdSetCredentials.h"
       
    22 
       
    23 /**
       
    24  * INPUT:
       
    25  *   Headers:		-
       
    26  *   Parameters:	DigestRealm, DigestUserName, DigestPassword, Proxy*
       
    27  *   IDs:			TransactionId*, RefreshId* 
       
    28  *
       
    29  * OUTPUT:
       
    30  *   Parameters:	-
       
    31  *   IDs:			-
       
    32  */
       
    33 void TCmdSetCredentials::ExecuteL()
       
    34 	{
       
    35 	// Extract mandatory params
       
    36 	TPtrC8 realm = ExtractTextL( KParamDigestRealm );
       
    37 	TPtrC8 username = ExtractTextL( KParamDigestUsername );
       
    38 	TPtrC8 password = ExtractTextL( KParamDigestPassword );
       
    39 	
       
    40 	// Extract optional params
       
    41 	CSIPClientTransaction* clientTransaction = GetClientTransactionL( EFalse );
       
    42 	CSIPRefresh* refresh = GetRefreshL( EFalse );
       
    43 	TPtrC8 proxy = ExtractTextL( KParamProxy, EFalse );
       
    44 	
       
    45 	if ( clientTransaction )
       
    46 	    {
       
    47         iContext.DigestContainerL().HttpDigest().SetCredentialsL( 
       
    48             *clientTransaction, proxy, realm, username, password );	    
       
    49 	    }
       
    50 	else
       
    51 	    {
       
    52 	    if ( refresh )
       
    53 	        {
       
    54             iContext.DigestContainerL().HttpDigest().SetCredentialsL( 
       
    55                 *refresh, proxy, realm, username, password );
       
    56 	        }
       
    57 	    else
       
    58 	        {
       
    59 	        if( proxy != KNullDesC8 )
       
    60 	            {
       
    61 	            iContext.DigestContainerL().HttpDigest().SetCredentialsL( 
       
    62 	                proxy, realm, username, password );
       
    63 	            }
       
    64 	        else
       
    65 	            {
       
    66 	            iContext.DigestContainerL().HttpDigest().SetCredentialsL( 
       
    67 	                realm, username, password );
       
    68 	            }
       
    69 	        }
       
    70 	    }
       
    71 	
       
    72 
       
    73 	}
       
    74 
       
    75 TBool TCmdSetCredentials::Match( const TTcIdentifier& aId )
       
    76 	{
       
    77 	return TTcSIPCommandBase::Match( aId, _L8("SetCredentials") );
       
    78 	}
       
    79 
       
    80 TTcCommandBase* TCmdSetCredentials::CreateL( MTcTestContext& aContext )
       
    81 	{
       
    82 	return new( ELeave ) TCmdSetCredentials( aContext );
       
    83 	}