wim/WimClient/inc/WimMgmt.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:  Startup place for client & server, message handling.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef WIMMGMT_H
       
    20 #define WIMMGMT_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include "WimClient.h"
       
    24 #include "WimCertTClassWrappers.h"
       
    25 #include <secdlg.h>
       
    26 
       
    27 /**
       
    28 *  RWimMgmt 
       
    29 *  This class inherits RWimClient and communicates with it.
       
    30 *  @lib WimClient
       
    31 *  @since Series 60 2.1
       
    32 */
       
    33 class RWimMgmt: public RWimClient
       
    34     {
       
    35     public:
       
    36 
       
    37         /**
       
    38         * Destructor 
       
    39         */
       
    40         virtual ~RWimMgmt();
       
    41 
       
    42         /**
       
    43         * Returns  TUint - the number of WIMs
       
    44         * @return TUint
       
    45         */
       
    46         TUint WIMCount();
       
    47         
       
    48         /**
       
    49         * Gets the array of WIM structures.
       
    50         * @param aWimAddrLst - Pointer to a list of allocated WIM structures
       
    51         * @param aCount  - is the number of WIMs
       
    52         * @return TInt -Error code
       
    53         */
       
    54         TInt WIMRefs( TWimAddressList aWimAddrLst, TUint8 aCount );
       
    55 
       
    56 
       
    57         /**
       
    58         * Tests whether WIM is open or not.
       
    59         * @param aWimAddr - Address to the WIM.
       
    60         * @return Boolean
       
    61         */
       
    62         TBool IsOpen( const TWimAddress aWimAddr );
       
    63 
       
    64         /**
       
    65         * Closes the WIM and returns the status of the WIMI_CloseWIM()
       
    66         * @param aWimAddr - Address to the WIM 
       
    67         * @return TInt the return status of Close   
       
    68         */
       
    69         TInt CloseWIM( const TWimAddress aWimAddr );
       
    70 
       
    71         /**
       
    72         * Gets the WIM information in to aTWimSecModuleStruct
       
    73         * @param aWimAddr -Address to the WIM structure (IN)
       
    74         * @param aTWimSecModuleStruct -Reference to the Structure to contain 
       
    75         *                                WIM  information (OUT)
       
    76         * @return TInt -Error code
       
    77         */
       
    78         TInt WIMInfo( const TWimAddress aWimAddr, 
       
    79                       TWimSecModuleStruct& aTWimSecModuleStruct );
       
    80   
       
    81         /**
       
    82         * Returns the time which is set as WIM closing time
       
    83         * @return TUint -closing time
       
    84         */
       
    85         TInt CloseAfter();
       
    86 
       
    87         /**
       
    88         * Returns TUint - the timeout in minutes, which tells how long WIM 
       
    89         * Security Module will be open
       
    90         * @return TUint -timeout
       
    91         */
       
    92         TInt TimeRemaining();
       
    93   
       
    94         /*
       
    95         * Sets closing time for WIM.
       
    96         * @param aCloseAfter
       
    97         * @return void
       
    98         */
       
    99         void SetCloseAfter( const TUint aCloseAfter );
       
   100         
       
   101         /**
       
   102         * Returns the count of PINs
       
   103         * @param aWimAddr- Address to the WIM structure (IN)
       
   104         * @return TUint -the count of PINs
       
   105         */  
       
   106         TUint PINCount( const TWimAddress aWimAddr );
       
   107 
       
   108         /**
       
   109         * Gets the array of PIN structures.
       
   110         * @param aWimAddr -Address to the WIM structure
       
   111         * @param aPinLstAddr -Reference to PIN list
       
   112         * @param aPinAddrLst    -Address to PIN address list
       
   113         * @param aCount -Count of PINs
       
   114         * @return TInt -Error code
       
   115         */
       
   116         TInt PINRefs( const TWimAddress aWimAddr, 
       
   117                       TUint32& aPinLstAddr, 
       
   118                       TPinAddressList aPinAddrLst, 
       
   119                       TUint8 aCount );
       
   120     
       
   121         /**
       
   122         * Get all of the pins information on a given SecMod asynchronously.
       
   123         * @ param aPinInfoLst array to store the PINs information 
       
   124         * return void 
       
   125         */
       
   126         void PINsInfo( const TWimAddress aWimAddr, 
       
   127                         CArrayFixFlat<TWimPinStruct>& aPinInfoLst,
       
   128                         TUint8 aCount,
       
   129                         TRequestStatus& aStatus );
       
   130         /**
       
   131         * Get all of the pins information on a given SecMod synchronously.
       
   132         * @ param aPinInfoLst array to store the PINs information 
       
   133         * return void 
       
   134         */                
       
   135         TInt PINsInfo( const TWimAddress aWimAddr, 
       
   136                CArrayFixFlat<TWimPinStruct>& aPinInfoLst,
       
   137                TUint8 aCount );                
       
   138         
       
   139         /**
       
   140         * Gets the PIN information in to aPinStruct
       
   141         * @param aPinAddr -Address to the PIN structure (IN)
       
   142         * @param aPinStruct -Reference to the Structure to containing PIN 
       
   143         *                    information (OUT)
       
   144         * @return TInt -Error code
       
   145         */  
       
   146         void PINInfo( const TPinAddress aPinAddr,
       
   147                       TWimPinStruct& aPinStruct,
       
   148                       TRequestStatus& aStatus );
       
   149 
       
   150         /**
       
   151         * Used to check is PIN blocked or not.
       
   152         * @param aPinAddr -Address to the PIN struct
       
   153         * @return TInt -Error code
       
   154         */  
       
   155         TInt IsBlocked( const TPinAddress aPinAddr );
       
   156         
       
   157         /**
       
   158         * Used to check is Disabled PIN blocked or not.
       
   159         * @param aPinAddr -Address to the PIN struct
       
   160         * @return TInt -Error code
       
   161         */ 
       
   162         TInt IsDisabledPINBlocked( const TPinAddress aPinAddr );
       
   163 
       
   164         /** 
       
   165         * Handles Enable and Disable PIN requests. Server
       
   166         * knows wanted operation by flag which is set in TPINStateRequest.
       
   167         * @param aPinAddr   -Address to the PIN struct.
       
   168         * @param aPinStateRequest   -Enable/Disable flag
       
   169         * @param aPinParams     -General information about PIN.
       
   170         * @param aStatus    -Caller's status
       
   171         * @return void   
       
   172         */
       
   173         void EnableDisablePinQueryL(
       
   174                             const TPinAddress aPinAddr,
       
   175                             const TPINStateRequest& aPinStateRequest,
       
   176                             const TPINParams& aPinParams,
       
   177                             TRequestStatus& aStatus );
       
   178         
       
   179         /** 
       
   180         * Cancel Enable and Disable PIN requests. Server
       
   181         * knows wanted operation by flag which is set in TPINStateRequest.
       
   182         * @param aPinAddr   -Address to the PIN struct.
       
   183         * @return void   
       
   184         */
       
   185         void CancelEnableDisablePin( const TPinAddress aPinAddr );
       
   186         
       
   187         /** 
       
   188         * PinOperationL handles several PIN operations: it can be
       
   189         * verify PIN request, change PIN request or unblock PIN request. The 
       
   190         * type of request is handled via aOpCode.
       
   191         * @param aPinAddr   -Address to the PIN struct
       
   192         * @param aPinParams -General information about PIN
       
   193         * @param aOpCode    -Code that informs the type of operation
       
   194         * @param aStatus    -Caller's status
       
   195         * @return void
       
   196         */
       
   197         void PinOperationL( const TPinAddress aPinAddr,
       
   198                             const TPINParams aPinParams,
       
   199                             const TWimServRqst aOpCode,
       
   200                             TRequestStatus& aStatus );
       
   201         
       
   202         /** 
       
   203         * Cancel PinOperationL handles several PIN operations: it can be
       
   204         * verify PIN request, change PIN request or unblock PIN request. The 
       
   205         * type of request is handled via aOpCode.
       
   206         * @param aPinAddr   -Address to the PIN struct
       
   207         * @param aOpCode    -Code that informs the type of operation
       
   208         * @return void
       
   209         */
       
   210         void CancelPinOperation( const TPinAddress aPinAddr, const TWimServRqst aOpCode );                     
       
   211 
       
   212         /**
       
   213         * A static method to get the client session.
       
   214         * @Return RWimMgmt*
       
   215         */  
       
   216         static RWimMgmt* ClientSessionL();
       
   217 
       
   218         /** 
       
   219         * Deallocates memory from pckgBuf member variables
       
   220         * @return void
       
   221         */
       
   222         void DeallocMemoryFromEnableDisablePinQuery();
       
   223 
       
   224     private:
       
   225 
       
   226         /**
       
   227         * Constructor 
       
   228         */
       
   229         RWimMgmt();
       
   230 
       
   231         /** 
       
   232         * Copy constructor
       
   233         * @param aSource -Reference to class object.
       
   234         */
       
   235         RWimMgmt( const RWimMgmt& aSource );
       
   236 
       
   237         /** 
       
   238         * Assigment operator
       
   239         * @param aParam -Reference to class object.
       
   240         */
       
   241         RWimMgmt& operator = ( const RWimMgmt& aParam );
       
   242 
       
   243     private:
       
   244 
       
   245         //PckgBuffer to hold PIN state information
       
   246         CWimCertPckgBuf<TPINStateRequest>*  iPinStateRequestBuf;
       
   247 
       
   248         //PckgBuffer to hold PIN parameters information
       
   249         CWimCertPckgBuf<TPINParams>*        iPinParamsBuf;
       
   250 
       
   251         //Indicates whether iPinStateRequestBuf is allocated or not
       
   252         TBool                               iPinStateRequestBufAllocated;
       
   253 
       
   254         //Indicates whether iPinParamsBuf is allocated or not
       
   255         TBool                               iPinParamsBufAllocated;
       
   256         
       
   257         //The pointer descriptor to pin info list
       
   258         TPtr8*                              iPinInfoLstPtr; 
       
   259         
       
   260         TPckg<TWimPinStruct>*               iPinModule;
       
   261 
       
   262 
       
   263     };
       
   264 
       
   265 
       
   266 #endif