syncmlfw/common/syncagent/inc/NSmlAuth.h
changeset 0 b497e44ab2fc
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Server authentication
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __NSMLAUTH_H
       
    21 #define __NSMLAUTH_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include "nsmlerror.h"
       
    25 
       
    26 class CNSmlAgentBase;
       
    27 class CNSmlFutureReservation;
       
    28 
       
    29 
       
    30 class CNSmlAuth : public CBase 
       
    31 	{
       
    32 	public:  // New functions
       
    33 	IMPORT_C static CNSmlAuth* NewL();
       
    34 	~CNSmlAuth();    //from CBase
       
    35 	IMPORT_C void SetSyncAgent( CNSmlAgentBase* aAgent ); 
       
    36 	IMPORT_C void SetCredentialL( const TDesC8& aCredential );
       
    37 	void SetTypeL( const TDesC8& aType );
       
    38 	void SetFormatL( const TDesC8& aFormat );
       
    39 	IMPORT_C void SetAuthRequiredL();
       
    40 	void SetChallenced();
       
    41 	void CreateAndSaveNewNonceL();
       
    42 	TPtrC8 NonceL();
       
    43 	TBool ChallengeNeeded() const;
       
    44 	IMPORT_C TBool Challenged() const;
       
    45 	TNSmlError::TNSmlSyncMLStatusCode StatusCodeL();
       
    46 	
       
    47 	private:
       
    48 	void ConstructL();
       
    49 	CNSmlAuth();
       
    50 	CNSmlAuth( const CNSmlAuth& aOther );
       
    51 	CNSmlAuth& operator=( const CNSmlAuth& aOther );
       
    52 	TNSmlError::TNSmlSyncMLStatusCode CheckCredentialL();
       
    53 	
       
    54 	// Private variables
       
    55 	private:
       
    56 	enum TAuthState
       
    57 		{
       
    58 		ENotInUse,
       
    59 		ENotAuthenticated,
       
    60 		EAuthChallenced,
       
    61 		EAuthenticated,
       
    62 		EChallencedForNext
       
    63 		};
       
    64 	
       
    65 	TAuthState iAuthState;
       
    66 	HBufC8* iCredential;
       
    67 	HBufC8* iType;
       
    68 	HBufC8* iFormat;
       
    69 	HBufC8* iNonce;
       
    70 	HBufC8* iB64Nonce;
       
    71 	
       
    72 	CNSmlAgentBase* iAgent;
       
    73 	// Reserved to maintain binary compability
       
    74 	CNSmlFutureReservation* iReserved;
       
    75 	};
       
    76 
       
    77 #endif // __NSMLAUTH_H