multimediacommsengine/tsrc/testdriver/siptester/src/CTcSIPHttpDigestContainer.h
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:  See class definition below.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CTCSIPHTTPDIGESTCONTAINER_H__
       
    19 #define __CTCSIPHTTPDIGESTCONTAINER_H__
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32base.h>
       
    23 #include <badesca.h>
       
    24 
       
    25 #include <siphttpdigestchallengeobserver.h>
       
    26 #include <siphttpdigestchallengeobserver2.h>
       
    27 #include <siphttpdigest.h>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CTcSIPContext;
       
    31 class CSIP;
       
    32 
       
    33 // CLASS DEFINITION
       
    34 /**
       
    35  * CTcSIPHttpDigestContainer implements a container for a single TSIPHttpDigest
       
    36  * object. Its task is also to observe and queue httpdigest challenges
       
    37  */
       
    38 class CTcSIPHttpDigestContainer
       
    39 	: public CBase,
       
    40 	  public MSIPHttpDigestChallengeObserver,
       
    41 	  public MSIPHttpDigestChallengeObserver2
       
    42 	{
       
    43 	public:	// Constructors and destructor
       
    44 
       
    45 		/**
       
    46 		 * Static constructor.
       
    47 		 *
       
    48 		 * @param aContext Reference to test context object.
       
    49 		 * @param aIAPName Internet Access Point name to be used.
       
    50 		 * @return An initialized instance of this class.
       
    51 		 */
       
    52 		static CTcSIPHttpDigestContainer* NewL( CTcSIPContext& aContext,
       
    53 		                                        CSIP& aSip );
       
    54 
       
    55 		/// Destructor
       
    56 		~CTcSIPHttpDigestContainer();
       
    57 
       
    58 	private:
       
    59 
       
    60 		/**
       
    61 		 * Constructor.
       
    62 		 *
       
    63 		 * @param aContext Reference to test context object.
       
    64 		 * @param aSip
       
    65 		 */
       
    66 		CTcSIPHttpDigestContainer( CTcSIPContext& aContext );
       
    67 
       
    68        /**
       
    69         * Second phase constructor
       
    70         *
       
    71         * @param aSip
       
    72         */
       
    73         void ConstructL( CSIP& aSip );
       
    74         
       
    75 		/// Default constructor. Not implemented.
       
    76 		CTcSIPHttpDigestContainer();
       
    77 
       
    78 	public: // From MSIPHttpDigestChallengeObserver
       
    79 
       
    80         void ChallengeReceived( const TDesC8& aRealm );
       
    81 
       
    82     public: //From MSIPHttpDigestChallengeObserver2
       
    83 
       
    84         void ChallengeReceived( const CSIPClientTransaction& aTransaction );
       
    85         
       
    86         void ChallengeReceived( const CSIPRefresh& aRefresh );
       
    87 
       
    88 	public: // New methods
       
    89 
       
    90 		/**
       
    91 		 * Returns the first challenge off the received challenges queue (FIFO). 
       
    92 		 * items are present, the function will wait for aTimeout seconds
       
    93 		 * and then try fetching again. Leaves with error if still unavailable
       
    94 		 * to fetch 
       
    95 		 *
       
    96 		 * @param aTimeOut Time in seconds waited for items to arrive.
       
    97 		 * @return challenge which ownership is transferred
       
    98 		 */
       
    99 		HBufC8* ReceivedChallengeL( TInt aTimeout );
       
   100 
       
   101 		/// @return Reference to the contained TSIPHttpDigest object.
       
   102 		inline CSIPHttpDigest& HttpDigest() { return *iSipHttpDigest; }
       
   103 
       
   104     private:
       
   105     
       
   106 	   /**
       
   107 		 * Add the specified realm to the received challenges queue.
       
   108 		 * The item is copied to the internal array.
       
   109 		 *
       
   110 		 * @param aRealm Referece to a received challenge.
       
   111 		 */
       
   112 		void QueueReceivedChallengeL( const TDesC8& aRealm );
       
   113 		
       
   114     	/**
       
   115 		 * CDeltaTimer callback. Called when the timer entry expires.
       
   116 		 *
       
   117 		 * @param aSelf Pointer to self
       
   118 		 * @return KErrNone
       
   119 		 */
       
   120 		static TInt ReceiveTimeout( TAny* aSelf );
       
   121 
       
   122 
       
   123 	private: // data
       
   124 	
       
   125 	    /// Active scheduler wrapper for async waiting. Owned.
       
   126 		CActiveSchedulerWait iActiveWait;
       
   127 		
       
   128 		/// Timeout timer. Owned.
       
   129 		CDeltaTimer* iTimer;
       
   130 		
       
   131 		/// Timeout entry. Owned.
       
   132 		TDeltaTimerEntry iReceiveTimeout;
       
   133 
       
   134 		/// Reference to the test context. Not owned.
       
   135 		CTcSIPContext& iContext;
       
   136 
       
   137 		/// Array of received challenges. Owned.
       
   138 		RPointerArray<HBufC8> iReceivedChallengesQueue;
       
   139 
       
   140 		/// SIP HttpDigest. Owned.
       
   141 		CSIPHttpDigest* iSipHttpDigest;
       
   142 	};
       
   143 
       
   144 #endif // __CTCSIPHTTPDIGESTCONTAINER_H__