wim/inc/WimTrustSettingsAPI.h
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Interface for WIM Trust Settings Store
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef WIMTRUSTSETTINGSAPI_H
       
    21 #define WIMTRUSTSETTINGSAPI_H
       
    22 
       
    23 
       
    24 //INCLUDES
       
    25 #include <e32base.h>
       
    26 
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class RWimTrustSettingsMgmt;
       
    30 class CWimCertInfo;
       
    31 
       
    32 
       
    33 //CLASS DECLARATION
       
    34 /**
       
    35 *  Interface which handles Trust Settings Store related operations 
       
    36 *  with WimServer.
       
    37 *
       
    38 *  @lib WimClient.lib
       
    39 *  @since Series60 3.0
       
    40 */
       
    41 class CWimTrustSettingsAPI : public CActive
       
    42     {
       
    43     public:  // Constructor and destructor
       
    44         
       
    45         /**
       
    46         * Two-phased constructor.
       
    47         */
       
    48         IMPORT_C static CWimTrustSettingsAPI* NewL();
       
    49         
       
    50         /**
       
    51         * Destructor.
       
    52         */
       
    53         IMPORT_C virtual ~CWimTrustSettingsAPI();
       
    54 
       
    55     public: // New functions
       
    56         
       
    57         /**
       
    58         * Fetches trust settings for given certificate. 
       
    59         * Acts like an asynchronous for caller but not activates itself.
       
    60         * @param  aCert (IN) Certificate
       
    61         * @param  aTrusted  (OUT) Is certificate trusted
       
    62         * @param  aApplications  (OUT) Array of applications supported 
       
    63         *         by certificate
       
    64         * @param  aStatus (IN/OUT) Request Status of asynchronous call
       
    65         * @return void
       
    66         */
       
    67         IMPORT_C void GetTrustSettings( const CWimCertInfo& aCert,
       
    68                                         TBool& aTrusted,
       
    69                                         RArray<TUid>& aApplications, 
       
    70                                         TRequestStatus& aStatus );
       
    71 
       
    72         /**
       
    73         * Set applicability for given certificate. Calls DoSetApplicabilityL,
       
    74         * which handles actual operation. New certificate entry is set if
       
    75         * one not found from database (trust flag is set to EFalse).
       
    76         * Acts like an asynchronous for caller but not activates itself.
       
    77         * @param aCert (IN) Certificate
       
    78         * @param aApplications (IN) Array of applications supported by 
       
    79         *        certificate
       
    80         * @param aStatus Request (IN/OUT) Status of asynchronous call.
       
    81         * @return void
       
    82         */
       
    83         IMPORT_C void SetApplicability( const CWimCertInfo& aCert,
       
    84                                         const RArray<TUid>& aApplications,
       
    85                                         TRequestStatus& aStatus );
       
    86 
       
    87         /**
       
    88         * Set trust flag for given certificate. Calls DoSetTrustL,
       
    89         * which handles actual operation. New certificate entry is set if
       
    90         * one not found from database.
       
    91         * Acts like an asynchronous for caller but not activates itself.
       
    92         * @param aCert (IN) Certificate
       
    93         * @param aTrusted (IN) Is certificate trusted
       
    94         * @param aStatus (IN/OUT) Request Status of asynchronous call.
       
    95         * @return void
       
    96         */
       
    97         IMPORT_C void SetTrust( const CWimCertInfo& aCert,
       
    98                                 TBool aTrusted,
       
    99                                 TRequestStatus& aStatus );
       
   100 
       
   101         /**
       
   102         * Set default trust settings for given certificate. If certificate not
       
   103         * found from database new entry is inserted.
       
   104         * Acts like an asynchronous for caller but not activate itself.
       
   105         * @param aCert (IN) Certificate
       
   106         * @param aAddApps (IN) Are default applications inserted 
       
   107         *        (ETrue means yes)
       
   108         * @param aStatus (IN/OUT) Request Status of asynchronous call
       
   109         * @return void
       
   110         */
       
   111         IMPORT_C void SetDefaultTrustSettings( const CWimCertInfo& aCert,
       
   112                                                TBool aAddApps,
       
   113                                                TRequestStatus& aStatus );
       
   114 
       
   115         /**
       
   116         * Remove trust settings of given certificate. If certificate
       
   117         * is not found, return with status.Int() = KErrNotFound
       
   118         * Acts like an asynchronous for caller but not activates itself.
       
   119         * @param aCert (IN) Certificate
       
   120         * @param aStatus (IN/OUT) Request Status of asynchronous call
       
   121         * @return void
       
   122         */
       
   123         IMPORT_C void RemoveTrustSettings( const CWimCertInfo& aCert,
       
   124                                            TRequestStatus& aStatus );
       
   125 
       
   126         /**
       
   127         * Delete TrustSettingsStore instance and release all resources
       
   128         * @return void
       
   129         */
       
   130         IMPORT_C void Close();
       
   131 
       
   132         /**
       
   133         * Cancel any issued asynchronous call
       
   134         * @return void
       
   135         */
       
   136         IMPORT_C void CancelDoing();
       
   137 
       
   138     private:
       
   139 
       
   140         /**
       
   141         * Default constructor.
       
   142         */
       
   143         CWimTrustSettingsAPI();
       
   144 
       
   145         /**
       
   146         * 2nd phase constructor
       
   147         */
       
   148         void ConstructL();
       
   149 
       
   150         /**
       
   151         * Handle trapped leave. Completes client request in case leave
       
   152         * has occurred.
       
   153         * @return void
       
   154         */
       
   155         void HandleLeaveError( TInt aError ); 
       
   156 
       
   157 
       
   158     private: // From base class CActive 
       
   159 
       
   160         /**
       
   161         * Handle asyncronous response
       
   162         * @return void
       
   163         */
       
   164         void RunL();
       
   165 
       
   166         /**
       
   167         * Handle asyncronous call cancel
       
   168         * @return void
       
   169         */
       
   170         void DoCancel();
       
   171 
       
   172     private:
       
   173               
       
   174         //Client status is stored here while operation
       
   175         //on the server side is done.
       
   176         TRequestStatus*                 iClientStatus;
       
   177         
       
   178         // Used for saving caller status. Not owned
       
   179         TRequestStatus*                 iOriginalRequestStatus;
       
   180 
       
   181         //Handle to connection with server. Owned.
       
   182         RWimTrustSettingsMgmt*          iConnectionHandle;
       
   183 
       
   184         // Pointer to client array for applications. Not owned.
       
   185         RArray<TUid>*                   iApplications;
       
   186 
       
   187         // Pointer to flag telling if certificate is trusted or not. Not owned.
       
   188         TBool*                          iTrusted;
       
   189 
       
   190         // Different phases of Trust Settings Store operation
       
   191         enum TPhase
       
   192             {
       
   193             EGetTrustSettings,
       
   194             ESetDefaultTrustSettings,
       
   195             ESetApplicability,
       
   196             ESetTrust,
       
   197             ERemoveTrustSettings
       
   198             };
       
   199 
       
   200         // Current phase of Trust Settings Store operation
       
   201         TPhase                          iPhase;
       
   202  
       
   203     };
       
   204 
       
   205 #endif  //WIMTRUSTSETTINGSAPI_H
       
   206 
       
   207 // End of File