syncmlfw/common/syncagent/inc/NSmlAuth.h
changeset 0 b497e44ab2fc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/syncmlfw/common/syncagent/inc/NSmlAuth.h	Thu Dec 17 09:07:52 2009 +0200
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Server authentication
+*
+*/
+
+
+
+#ifndef __NSMLAUTH_H
+#define __NSMLAUTH_H
+
+#include <e32base.h>
+#include "nsmlerror.h"
+
+class CNSmlAgentBase;
+class CNSmlFutureReservation;
+
+
+class CNSmlAuth : public CBase 
+	{
+	public:  // New functions
+	IMPORT_C static CNSmlAuth* NewL();
+	~CNSmlAuth();    //from CBase
+	IMPORT_C void SetSyncAgent( CNSmlAgentBase* aAgent ); 
+	IMPORT_C void SetCredentialL( const TDesC8& aCredential );
+	void SetTypeL( const TDesC8& aType );
+	void SetFormatL( const TDesC8& aFormat );
+	IMPORT_C void SetAuthRequiredL();
+	void SetChallenced();
+	void CreateAndSaveNewNonceL();
+	TPtrC8 NonceL();
+	TBool ChallengeNeeded() const;
+	IMPORT_C TBool Challenged() const;
+	TNSmlError::TNSmlSyncMLStatusCode StatusCodeL();
+	
+	private:
+	void ConstructL();
+	CNSmlAuth();
+	CNSmlAuth( const CNSmlAuth& aOther );
+	CNSmlAuth& operator=( const CNSmlAuth& aOther );
+	TNSmlError::TNSmlSyncMLStatusCode CheckCredentialL();
+	
+	// Private variables
+	private:
+	enum TAuthState
+		{
+		ENotInUse,
+		ENotAuthenticated,
+		EAuthChallenced,
+		EAuthenticated,
+		EChallencedForNext
+		};
+	
+	TAuthState iAuthState;
+	HBufC8* iCredential;
+	HBufC8* iType;
+	HBufC8* iFormat;
+	HBufC8* iNonce;
+	HBufC8* iB64Nonce;
+	
+	CNSmlAgentBase* iAgent;
+	// Reserved to maintain binary compability
+	CNSmlFutureReservation* iReserved;
+	};
+
+#endif // __NSMLAUTH_H