realtimenetprots/sipfw/SIP/SIPSec/DigestPlugin/inc/CSIPSecDigestObserver.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2006-2009 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:
       
    15 * Name          : CSIPSecDigestObserver.h
       
    16 * Part of       : SIPSec
       
    17 * Version       : SIP/5.0
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 #ifndef __SIPSEC_DIGESTOBSERVER_H__
       
    29 #define __SIPSEC_DIGESTOBSERVER_H__
       
    30 
       
    31 #include <e32base.h>
       
    32 #include "MSIPSecSecurityMechanismObserver.h"
       
    33 
       
    34 
       
    35 /**
       
    36  * @brief Class represents SIP security observer listening cache update
       
    37  * 		  completion
       
    38  * 
       
    39  * @class CSIPSecDigestObserver CSIPSecDigestObserver.h
       
    40  *		  "CSIPSecDigestObserver.h"
       
    41  *
       
    42  * This class provides functions to
       
    43  * - indicate (OperationStarted) that user credentials were not ready but they
       
    44  *	 have been requested
       
    45  * - indicate (OperationCompleted) that user credentials have arrived
       
    46  *
       
    47  */
       
    48 class CSIPSecDigestObserver : public CBase
       
    49 	{
       
    50 public: // Enums
       
    51 
       
    52     enum TStatus
       
    53         {
       
    54         EWaiting,
       
    55         EComplete,
       
    56         EFailure,
       
    57         ECancelled
       
    58         };
       
    59 
       
    60 public: // Constructor and destructor
       
    61 
       
    62     /**
       
    63     * Constructor
       
    64     * @param aObserver SIPSec Observer
       
    65     */	
       
    66     CSIPSecDigestObserver( MSIPSecSecurityMechanismObserver& aObserver );
       
    67 
       
    68     /**
       
    69     * Destructor
       
    70     */	
       
    71     ~CSIPSecDigestObserver();
       
    72 
       
    73 public: // New functions
       
    74 
       
    75     /**
       
    76     * Request has been started
       
    77     */	
       
    78     void OperationStarted();
       
    79 
       
    80     /**
       
    81     * Called when credentials has been arrived
       
    82     * @param aReason Reason why operaion completes
       
    83     * @param aAuthenticated ETrue if authentication has completed successfully
       
    84     *		 				EFalse otherwise
       
    85     */
       
    86     virtual void OperationCompleted( TStatus aReason, TBool aAuthenticated );
       
    87 
       
    88     /**
       
    89     * Checks if this object is associated with the specified SIPSec observer.
       
    90     * @param aObserver the SIPSec observer
       
    91     * @return ETrue if associated with the SIPSec observer, EFalse otherwise
       
    92     */
       
    93     TBool HasObserver(
       
    94     	const MSIPSecSecurityMechanismObserver& aObserver ) const;
       
    95 
       
    96     /**
       
    97     * Checks if the observer has completed.
       
    98     * @return ETrue if completed, EFalse otherwise
       
    99     */
       
   100     TBool IsCompleted() const;
       
   101 
       
   102 protected:
       
   103 
       
   104     /**
       
   105     * Called when credentials has been arrived
       
   106     */	
       
   107     virtual void DoCompleted();
       
   108 
       
   109 protected: // Data
       
   110 
       
   111     // Count of pending operations
       
   112     TInt iPendingOperations;
       
   113 
       
   114 	// ETrue if at least one operation ended succesfully
       
   115 	TBool iAtLeastOneSuccessfulOperation;
       
   116 
       
   117     // SIPSec Observer, not owned    	
       
   118     MSIPSecSecurityMechanismObserver* iObserver;
       
   119 
       
   120     TStatus iStatus;
       
   121 
       
   122 
       
   123 	// For testing purposes
       
   124 #ifdef CPPUNIT_TEST
       
   125 	friend class CSIPSecObserverTest;
       
   126 	friend class CSIPSecDigestTest;
       
   127 #endif
       
   128 	};
       
   129 	
       
   130 #endif // __SIPSEC_DIGESTOBSERVER_H__
       
   131 
       
   132 // End of File