pkiutilities/CTSecurityDialogs/ClientInc/CTSecurityDialogRequestor.h
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2003 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:   Dialog Requestor for RNotifier
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __CTSECURITYDIALOGREQUESTOR_H
       
    20 #define __CTSECURITYDIALOGREQUESTOR_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <ct.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 
       
    28 // CLASS DECLARATION
       
    29 
       
    30 /**
       
    31 * This class should be derived by every class
       
    32 * which uses CCTSecurityDialogRequestor.
       
    33 *
       
    34 *  @lib CTSecDlgs.lib
       
    35 *  @since Series60_2.6
       
    36 */
       
    37 
       
    38 class MSecurityDialogResponse
       
    39     {
       
    40     public:
       
    41         /**
       
    42 	    *   CWimSecurityDialogRequestor calls this function
       
    43         *   when it gets response from the notifier.
       
    44 	    *	@param aResult      Result of the notifier	
       
    45 	    */
       
    46         virtual void HandleResponse(TInt aResult) = 0;
       
    47     };
       
    48 
       
    49 /**
       
    50 *  Active object that sends requests to notifier. 
       
    51 *
       
    52 *  @lib 
       
    53 *  @since 
       
    54 */
       
    55 
       
    56 NONSHARABLE_CLASS( CCTSecurityDialogRequestor ): public CActive
       
    57     {
       
    58     private:
       
    59     	enum TState { EFillingVariableInputBuffer, EMakingRequest };
       
    60 
       
    61     public:
       
    62         
       
    63         /**
       
    64         * Two-phased constructor.
       
    65         */
       
    66 	    static CCTSecurityDialogRequestor* NewL(MSecurityDialogResponse& aSecurityDialogs);
       
    67         
       
    68         /**
       
    69         * Destructor.
       
    70         */
       
    71 	    ~CCTSecurityDialogRequestor();
       
    72 
       
    73     public: // New functions
       
    74         
       
    75 	    /**
       
    76 	    *	RequestDialog Requests a dialog through RNotifier API
       
    77 	    *	@param aData	Stream to be sent through RNotifier
       
    78 	    *	@param aResponse	Reference to memory where the response from Notifier is to be saved to
       
    79 	    */
       
    80 	    void RequestDialog(const TDesC8& aData, TDes8& aResponse);
       
    81 	    
       
    82 	    void RequestVariableBufferDialog( const TDesC8& aOperationData,
       
    83 										const TDesC8& aVariableData,
       
    84 										const RArray<TCTTokenObjectHandle>& aCertHandleList,
       
    85 										TDes8& aResponse );
       
    86 
       
    87 
       
    88     private:
       
    89         
       
    90         /**
       
    91         * C++ default constructor.
       
    92         */
       
    93 	    CCTSecurityDialogRequestor(MSecurityDialogResponse& aSecurityDialogs);
       
    94         
       
    95         /**
       
    96         * By default Symbian 2nd phase constructor is private.
       
    97         */
       
    98 	    void ConstructL();
       
    99 
       
   100     private:  // Functions from CActive
       
   101         /**
       
   102         *
       
   103         */
       
   104 	    void DoCancel();
       
   105         /**
       
   106         *
       
   107         */
       
   108 	    void RunL();
       
   109         /**
       
   110         *
       
   111         * @param aError
       
   112         */
       
   113         TInt RunError(TInt aError);
       
   114 
       
   115     private:    // Data
       
   116         
       
   117 	    MSecurityDialogResponse&	iSecurityDialogs;
       
   118 	    RNotifier	iNotifier;
       
   119 	    
       
   120 	    TState iState;
       
   121 	    const TDesC8* iOperationDataPtr;
       
   122 	    const TDesC8* iVariableDataPtr;
       
   123 	    const RArray<TCTTokenObjectHandle>* iCertHandleListPtr;
       
   124 	    HBufC8* iInputBuffer;
       
   125 	    TDes8* iResponsePtr;
       
   126     };
       
   127 
       
   128 #endif  // __CTSECURITYDIALOGREQUESTOR_H
       
   129 
       
   130 // End of File