wim/WimServer/inc/WimTrustSettingsHandler.h
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2002 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:  WIM Trust Settings Store handler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CWIMTRUSTSETTINGSHANDLER_H
       
    21 #define CWIMTRUSTSETTINGSHANDLER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CWimTrustSettingsStore;
       
    28 class CWimCertInfo;
       
    29 
       
    30 // CLASS DECLARATION
       
    31 
       
    32 /**
       
    33 *  Class for handling certificates in WIM card
       
    34 *  
       
    35 *  @since Series60 3.0
       
    36 */
       
    37 class CWimTrustSettingsHandler : public CActive
       
    38     {
       
    39     public:  // Constructors and destructor
       
    40         
       
    41         /**
       
    42         * Two-phased constructor.
       
    43         */
       
    44         static CWimTrustSettingsHandler* NewL( CWimTrustSettingsStore* aWimTrustSettingsStore );
       
    45         
       
    46         /**
       
    47         * Destructor.
       
    48         */
       
    49         virtual ~CWimTrustSettingsHandler();
       
    50 
       
    51     public: // New functions
       
    52         
       
    53         /**
       
    54         * Fetches trust settings for given certificate. 
       
    55         * 
       
    56         * @return void
       
    57         */
       
    58         void GetTrustSettingsL( const RMessage2& aMessage );
       
    59 
       
    60         /**
       
    61         * Set applicability for given certificate. New certificate entry is
       
    62         * set if one not found from database (trust flag is set to EFalse).
       
    63         * @param aMessage Encapsulates a client request.
       
    64         * @return void
       
    65         */
       
    66         void SetApplicabilityL( const RMessage2& aMessage );
       
    67 
       
    68         /**
       
    69         * Set trust flag for given certificate. New certificate entry is set
       
    70         * @param aMessage Encapsulates a client request.
       
    71         * @return void
       
    72         */
       
    73         void SetTrustL( const RMessage2& aMessage );
       
    74 
       
    75         /**
       
    76         * Set default trust settings for given certificate. If certificate not
       
    77         * found from database new entry is inserted.
       
    78         * @param aMessage Encapsulates a client request.
       
    79         * @return void
       
    80         */
       
    81         void SetDefaultTrustSettingsL( const RMessage2& aMessage );
       
    82 
       
    83         /**
       
    84         * Remove trust settings of given certificate. If certificate
       
    85         * is not found, message is completed with KErrNotFound
       
    86         * @param aMessage Encapsulates a client request.
       
    87         * @return void
       
    88         */
       
    89         void RemoveTrustSettingsL( const RMessage2& aMessage );
       
    90 
       
    91         /**
       
    92         * Cancel any issued asynchronous call
       
    93         * @return void
       
    94         */
       
    95         void CancelDoing();
       
    96 
       
    97     private:  // From CActive
       
    98 
       
    99         /**
       
   100         * From CActive. Handles completion of asynchrounous operation
       
   101         * @return void
       
   102         */
       
   103         void RunL();
       
   104 
       
   105         /**
       
   106         * From CActive. Cancellation function
       
   107         * @return void
       
   108         */
       
   109         void DoCancel();
       
   110 
       
   111         /**
       
   112         * From CActive. Handle trapped leave.
       
   113         * @param aError Leave error code
       
   114         * @return Error code
       
   115         */
       
   116         TInt RunError( TInt aError );
       
   117 
       
   118     private:
       
   119 
       
   120         /**
       
   121         * C++ default constructor.
       
   122         */
       
   123         CWimTrustSettingsHandler( CWimTrustSettingsStore* aWimTrustSettingsStore );
       
   124 
       
   125         /**
       
   126         * By default Symbian 2nd phase constructor is private.
       
   127         */
       
   128         void ConstructL();
       
   129 
       
   130     private:    // Data
       
   131 
       
   132         // Pointer to Trust Settings Store instance. Owned.
       
   133         CWimTrustSettingsStore* iWimTrustSettingsStore;
       
   134         // Pointer CWimCertInfo object. Owned.
       
   135         CWimCertInfo*           iCertInfo;
       
   136         // Saved message.
       
   137         RMessage2               iMessage;
       
   138         // Flag to save trusted flag.
       
   139         TBool                   iTrusted;
       
   140         // Array to save applications.
       
   141         RArray<TUid>            iApplications;
       
   142 
       
   143         // Enumerator for ongoing phase
       
   144         enum TPhase
       
   145             {
       
   146             EGetTrustSettings,
       
   147             ESetDefaultTrustSettings,
       
   148             ESetApplicability,
       
   149             ESetTrust,
       
   150             ERemoveTrustSettings
       
   151             };
       
   152 
       
   153         // Currect phase of Trust Settings Store operation
       
   154         TPhase                  iPhase;
       
   155 
       
   156     };
       
   157 
       
   158 #endif      // CWIMTRUSTSETTINGSHANDLER_H
       
   159     
       
   160 // End of File