epoc32/include/siphttpdigest.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- a/epoc32/include/siphttpdigest.h	Tue Mar 16 16:12:26 2010 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,312 +0,0 @@
     1.4 -/*
     1.5 -* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 -* All rights reserved.
     1.7 -* This component and the accompanying materials are made available
     1.8 -* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.9 -* which accompanies this distribution, and is available
    1.10 -* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 -*
    1.12 -* Initial Contributors:
    1.13 -* Nokia Corporation - initial contribution.
    1.14 -*
    1.15 -* Contributors:
    1.16 -*
    1.17 -* Description:
    1.18 -* Name        : siphttpdigest.h
    1.19 -* Part of     : SIP Client
    1.20 -* Interface   : SDK API, SIP Client API
    1.21 -* Version     : 2.0
    1.22 -*
    1.23 -*/
    1.24 -
    1.25 -
    1.26 -
    1.27 -#ifndef CSIPHTTPDIGEST_H
    1.28 -#define CSIPHTTPDIGEST_H
    1.29 -
    1.30 -// INCLUDES 
    1.31 -#include <e32base.h>
    1.32 -#include "_sipcodecdefs.h"
    1.33 -
    1.34 -// FORWARD DECLARATIONS
    1.35 -class CSIP;
    1.36 -class MSIPHttpDigestChallengeObserver;
    1.37 -class MSIPHttpDigestChallengeObserver2;
    1.38 -class CSIPClientTransaction;
    1.39 -class CSIPRefresh;
    1.40 -
    1.41 -// CLASS DECLARATION
    1.42 -
    1.43 -/**
    1.44 -* @publishedAll
    1.45 -* @released
    1.46 -*
    1.47 -* Class for managing SIP HTTP Digest security settings.
    1.48 -* Class provides functions for setting/removing
    1.49 -* HTTP Digest security mechanism related parameters.
    1.50 -* If the user does not use the class for the providing credentials for the
    1.51 -* received challenges, an error will be returned to the original request in
    1.52 -* case it was challenged.
    1.53 -* 
    1.54 -* Note that the user will be asked to provide credentials one realm
    1.55 -* at the time.
    1.56 -*
    1.57 -*  @lib sipclient.lib
    1.58 -*/
    1.59 -class CSIPHttpDigest : public CBase
    1.60 -	{
    1.61 -	public: // Constructors and destructor
    1.62 -	
    1.63 -		/**
    1.64 -		* Two-phased constructor.
    1.65 -		* @param aSIP a handle to SIP server
    1.66 -		* @param aObserver an observer for the received challenges
    1.67 -		* @return New object, ownership is transferred.
    1.68 -		*/
    1.69 -		IMPORT_C static CSIPHttpDigest*
    1.70 -			NewL(CSIP& aSIP,
    1.71 -				 MSIPHttpDigestChallengeObserver& aObserver);
    1.72 -				 
    1.73 -		/**
    1.74 -		* Two-phased constructor.
    1.75 -		* @param aSIP a handle to SIP server
    1.76 -		* @param aObserver an observer for the received challenges
    1.77 -		* @return New object, ownership is transferred.
    1.78 -		*/
    1.79 -		IMPORT_C static CSIPHttpDigest*
    1.80 -			NewLC(CSIP& aSIP,
    1.81 -				  MSIPHttpDigestChallengeObserver& aObserver);
    1.82 -
    1.83 -		/**
    1.84 -		* Two-phased constructor.
    1.85 -		* @param aSIP a handle to SIP server
    1.86 -		* @param aObserver2 an observer for the received challenges
    1.87 -		* @return New object, ownership is transferred.
    1.88 -		*/
    1.89 -		IMPORT_C static CSIPHttpDigest*
    1.90 -			NewL(CSIP& aSIP,
    1.91 -				 MSIPHttpDigestChallengeObserver2& aObserver2);
    1.92 -				 
    1.93 -		/**
    1.94 -		* Two-phased constructor.
    1.95 -		* @param aSIP a handle to SIP server
    1.96 -		* @param aObserver2 an observer for the received challenges
    1.97 -		* @return New object, ownership is transferred.
    1.98 -		*/
    1.99 -		IMPORT_C static CSIPHttpDigest*
   1.100 -			NewLC(CSIP& aSIP,
   1.101 -				  MSIPHttpDigestChallengeObserver2& aObserver2);
   1.102 -				  
   1.103 -		IMPORT_C ~CSIPHttpDigest();
   1.104 -
   1.105 -	public: // New functions
   1.106 -
   1.107 -        /**
   1.108 -		* Sets credentials for the realm of the outbound proxy.
   1.109 -		* Must be used in case the realm is the realm of the outbound proxy and
   1.110 -		* the request for credentials was received from callback
   1.111 -		* MSIPHttpDigestChallengeObserver::ChallengeReceived.		
   1.112 -		* The user can set credentials only upon request from the
   1.113 -		* SIP implementation.
   1.114 -		* @pre aOutboundProxy, aRealm, aUsername and aPasswd must not be empty
   1.115 -		*	   descriptors.
   1.116 -		* @param aOutboundProxy an outbound proxy (FQDN or IP address)
   1.117 -		* @param aRealm servers's realm
   1.118 -		* @param aUsername user's name
   1.119 -		* @param aPasswd user's password for the given server's realm
   1.120 -		* @leave KErrNoMemory if out of memory
   1.121 -		* @leave KErrArgument if some of the parameters is an empty descriptor
   1.122 -		* @leave KErrSIPResourceNotAvailable if a required object has been
   1.123 -		*		 deleted
   1.124 -		*/
   1.125 -		IMPORT_C void SetCredentialsL(const TDesC8& aOutboundProxy,
   1.126 -			                          const TDesC8& aRealm,
   1.127 -			                          const TDesC8& aUsername,
   1.128 -			                          const TDesC8& aPasswd);
   1.129 -        /**
   1.130 -		* Sets parameters for the realm.
   1.131 -		* Should be used in case the realm is not a realm of an outbound proxy 
   1.132 -		* and the request for credentials was received from callback
   1.133 -		* MSIPHttpDigestChallengeObserver::ChallengeReceived.		
   1.134 -		* The user can set credentials only upon request from the
   1.135 -		* SIP implementation.
   1.136 -		* @pre aRealm, aUsername and aPasswd must not be empty descriptors.
   1.137 -		* @param aRealm servers's realm
   1.138 -		* @param aUsername user's name
   1.139 -		* @param aPasswd user's password for the given server's realm
   1.140 -		* @leave KErrNoMemory if out of memory
   1.141 -		* @leave KErrArgument if some of the parameters is an empty descriptor
   1.142 -		* @leave KErrSIPResourceNotAvailable if a required object has been
   1.143 -		*		 deleted
   1.144 -		*/
   1.145 -		IMPORT_C void SetCredentialsL(const TDesC8& aRealm,
   1.146 -			                          const TDesC8& aUsername,
   1.147 -			                          const TDesC8& aPasswd);
   1.148 -
   1.149 -        /**
   1.150 -		* Sets credentials for the realm for the specific transaction.
   1.151 -		* Must be used when the request for credentials was received 
   1.152 -		* from callback MSIPHttpDigestChallengeObserver2::ChallengeReceived with 
   1.153 -		* CSIPClientTransaction as the parameter.
   1.154 -		* @pre aRealm, aUsername and aPasswd must not be empty descriptors.
   1.155 -		* @param aTransaction the transaction that was passed as a parameter
   1.156 -		*        to MSIPHttpDigestChallengeObserver2::ChallengeReceived
   1.157 -		* @param aOutboundProxy an outbound proxy (FQDN or IP address) if
   1.158 -		*        the challenge received had Proxy-Authenticate-header(s).
   1.159 -		*        Otherwise KNullDesC8 should passed.
   1.160 -		* @param aRealm servers's realm
   1.161 -		* @param aUsername user's name
   1.162 -		* @param aPasswd user's password for the given server's realm
   1.163 -		* @leave KErrNoMemory if out of memory
   1.164 -		* @leave KErrArgument if some of the parameters is an empty descriptor
   1.165 -		* @leave KErrSIPResourceNotAvailable if a required object has been
   1.166 -		*		 deleted
   1.167 -		*/
   1.168 -		IMPORT_C void SetCredentialsL(const CSIPClientTransaction& aTransaction,
   1.169 -		                              const TDesC8& aOutboundProxy,
   1.170 -			                          const TDesC8& aRealm,
   1.171 -			                          const TDesC8& aUsername,
   1.172 -			                          const TDesC8& aPasswd);
   1.173 -
   1.174 -        /**
   1.175 -		* Sets credentials for the realm for the specific refresh.
   1.176 -		* Must be used when the request for credentials was received 
   1.177 -		* from callback MSIPHttpDigestChallengeObserver2::ChallengeReceived with 
   1.178 -		* CSIPRefresh as the parameter.
   1.179 -		* @pre aRealm, aUsername and aPasswd must not be empty descriptors.
   1.180 -		* @param aRefresh the refresh that was passed as a parameter
   1.181 -		*        to MSIPHttpDigestChallengeObserver2::ChallengeReceived
   1.182 -		* @param aOutboundProxy an outbound proxy (FQDN or IP address) if
   1.183 -		*        the challenge received had Proxy-Authenticate-header(s).
   1.184 -		*        Otherwise KNullDesC8 should passed.
   1.185 -		* @param aRealm servers's realm
   1.186 -		* @param aUsername user's name
   1.187 -		* @param aPasswd user's password for the given server's realm
   1.188 -		* @leave KErrNoMemory if out of memory
   1.189 -		* @leave KErrArgument if some of the parameters is an empty descriptor
   1.190 -		* @leave KErrSIPResourceNotAvailable if a required object has been
   1.191 -		*		 deleted
   1.192 -		*/
   1.193 -		IMPORT_C void SetCredentialsL(const CSIPRefresh& aRefresh,
   1.194 -		                              const TDesC8& aOutboundProxy,
   1.195 -			                          const TDesC8& aRealm,
   1.196 -			                          const TDesC8& aUsername,
   1.197 -			                          const TDesC8& aPasswd);
   1.198 -			            
   1.199 -        /**
   1.200 -		* Removes all set credentials for the realm.
   1.201 -		* Must not be used if the user implements 
   1.202 -		* MSIPHttpDigestChallengeObserver2.
   1.203 -		* @pre aRealm must not be an empty descriptor
   1.204 -		* @param aRealm servers's realm
   1.205 -		* @return KErrNone if no error
   1.206 -		*		  KErrArgument if aRealm is an empty descriptor
   1.207 -		*		  KErrNoMemory if out of memory
   1.208 -		*		  KErrNotFound if the given realm was not found
   1.209 -        */
   1.210 -		IMPORT_C TInt RemoveCredentials(const TDesC8& aRealm);
   1.211 -		
   1.212 -        /**
   1.213 -		* Removes all set credentials by the user.
   1.214 -		* Must not be used if the user implements 
   1.215 -		* MSIPHttpDigestChallengeObserver2.		
   1.216 -		* @return KErrNone if succesful; KErrNoMemory if out of memory 
   1.217 -        */
   1.218 -		IMPORT_C TInt RemoveCredentials();
   1.219 -					                                                        
   1.220 -		/**
   1.221 -		* Sets the observer	to listen for the possible received challenges. 
   1.222 -		* Replaces the existing MSIPHttpDigestChallengeObserver or
   1.223 -		* MSIPHttpDigestChallengeObserver2.
   1.224 -		* @param aObserver an observer for the received challenges. 
   1.225 -		*/
   1.226 -		IMPORT_C void SetObserver(MSIPHttpDigestChallengeObserver& aObserver);
   1.227 -		
   1.228 -		/**
   1.229 -		* Sets the observer	to listen for the possible received challenges. 
   1.230 -		* Replaces the existing MSIPHttpDigestChallengeObserver or
   1.231 -		* MSIPHttpDigestChallengeObserver2.
   1.232 -		* @param aObserver an observer for the received challenges. 
   1.233 -		*/
   1.234 -		IMPORT_C void SetObserver(MSIPHttpDigestChallengeObserver2& aObserver);		
   1.235 -		
   1.236 -		/**
   1.237 -		* Ignores the challenge for the realm. As a result the error will be
   1.238 -		* generated to the original SIP request. 
   1.239 -		* @pre aRealm must not be an empty descriptor
   1.240 -		* @param aRealm a realm for which the challenge was ignored
   1.241 -		* @return KErrNone if no error
   1.242 -		*		  KErrNotFound if the given realm was not found
   1.243 -		*		  KErrArgument if aRealm is an empty descriptor
   1.244 -		*/
   1.245 -		IMPORT_C TInt IgnoreChallenge(const TDesC8& aRealm);
   1.246 -
   1.247 -		/**
   1.248 -		* Ignores the challenge for the realm for the specific transaction.
   1.249 -		* As a result KErrForbidden will be generated 
   1.250 -		* to the original SIP request.
   1.251 -		* @pre aRealm must not be an empty descriptor
   1.252 -		* @param aTransaction the transaction that was passed as a parameter
   1.253 -		*        to MSIPHttpDigestChallengeObserver2::ChallengeReceived		
   1.254 -		* @param aRealm a realm for which the challenge was ignored
   1.255 -		* @return KErrNone if no error
   1.256 -		*		  KErrNotFound if the given realm was not found
   1.257 -		*		  KErrArgument if aRealm is an empty descriptor
   1.258 -		*/
   1.259 -		IMPORT_C TInt IgnoreChallenge(const CSIPClientTransaction& aTransaction,
   1.260 -		                              const TDesC8& aRealm);
   1.261 -
   1.262 -		/**
   1.263 -		* Ignores the challenge for the realm for the specific refresh.
   1.264 -		* As a result the error will be generated 
   1.265 -		* to the original SIP request.
   1.266 -		* @pre aRealm must not be an empty descriptor
   1.267 -		* @param aRefresh the refresh that was passed as a parameter
   1.268 -		*        to MSIPHttpDigestChallengeObserver2::ChallengeReceived		
   1.269 -		* @param aRealm a realm for which the challenge was ignored
   1.270 -		* @return KErrNone if no error
   1.271 -		*		  KErrNotFound if the given realm was not found
   1.272 -		*		  KErrArgument if aRealm is an empty descriptor
   1.273 -		*/
   1.274 -		IMPORT_C TInt IgnoreChallenge(const CSIPRefresh& aRefresh,
   1.275 -		                              const TDesC8& aRealm);
   1.276 -
   1.277 -	public: // New functions, for internal use
   1.278 -
   1.279 -		void CSIPDeleted();
   1.280 -
   1.281 -	private: // Constructors
   1.282 -
   1.283 -        CSIPHttpDigest(CSIP& aSIP);
   1.284 -		CSIPHttpDigest(const CSIPHttpDigest& aHttpDigest);
   1.285 -		CSIPHttpDigest& operator=(const CSIPHttpDigest& aHttpDigest);
   1.286 -
   1.287 -		void ConstructL(MSIPHttpDigestChallengeObserver& aObserver);
   1.288 -		
   1.289 -		void ConstructL(MSIPHttpDigestChallengeObserver2& aObserver2);
   1.290 -       
   1.291 -    private: // New functions
   1.292 -    
   1.293 -		TInt RemoveCredentialParams(const TDesC8& aRealm) const;
   1.294 -
   1.295 -		void SetCredentialParamsL(TUint32 aRequestId,
   1.296 -		                          TUint32 aRefreshId,
   1.297 -		                          const TDesC8& aOutboundProxy,
   1.298 -		                          const TDesC8& aRealm,
   1.299 -				                  const TDesC8& aUsername,
   1.300 -				                  const TDesC8& aPasswd) const;		
   1.301 -		
   1.302 -		TInt IgnoreChallenge(TUint32 aRequestId,
   1.303 -		                     TUint32 aRefreshId,
   1.304 -		                     const TDesC8& aRealm);       
   1.305 -          
   1.306 -    private: // Data
   1.307 -
   1.308 -        CSIP* iSIP;
   1.309 -
   1.310 -	private: // For testing purposes
   1.311 -
   1.312 -	    UNIT_TEST(CSIP_Test)
   1.313 -	};
   1.314 -
   1.315 -#endif // CSIPHTTPDIGEST_H