backupandrestore/backupengine/inc/sbeclient.h
changeset 0 d0791faffa3f
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 /**
       
     2 * Copyright (c) 2004-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 * Declaration of CSBEClient
       
    16 * 
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 /**
       
    23  @file
       
    24  @released
       
    25 */
       
    26 
       
    27 #ifndef __SBECLIENT_H__
       
    28 #define __SBECLIENT_H__
       
    29 
       
    30 #include <e32base.h>
       
    31 #include <e32cmn.h>
       
    32 #include <connect/sbtypes.h>
       
    33 
       
    34 namespace conn
       
    35 	{ 
       
    36 	class RSBEClientSession;
       
    37 
       
    38 	class CSBEClient : public CBase
       
    39 		/** The client to the Secure Backup Engine.
       
    40 		This class is for use by a Secure Backup Server.  It provides backup data and receives
       
    41 		restore data.  It encapsulates some state information as backup or restore operations require
       
    42 		a range of actions to be undertaken in the correct order.
       
    43 
       
    44 		It is loaded into the same process as the Secure Backup Server - this is the client interface
       
    45 		of the server that is the Secure Backup Engine.
       
    46 
       
    47 		Methods that transfer large amounts of data are asynchronous (to allow the Secure Backup Engine
       
    48 		to carry out asynchronous operations) but synchronous versions are included for the benefit of
       
    49 		clients that cannot handle asynchronous methods.  The asynchronous methods should be used if 
       
    50 		possible.
       
    51 
       
    52 		Because of the potential large size of backup data it is not copied into descriptors
       
    53 		but is located in a transfer buffer.
       
    54 
       
    55 		When requesting backup data the asynchronous call is made and the relevant AO (whose
       
    56 		TRequestStatus was supplied) will be activated when the data is available and the
       
    57 		completion code will indicate success or failure.  If successful, the data can be 
       
    58 		accessed by means of the GetTransferDataInfo() method and the SignalTransferDataComplete() 
       
    59 		method is used to indicate that the transfer is complete and the transfer buffer can be re-used.
       
    60 
       
    61 		When supplying snapshot data or restore data the data is copied into a transfer buffer
       
    62 		and the asynchronous call is made.  Then the relevant AO will be activated when the data
       
    63 		has been absorbed by the Secure Backup Engine.  An error completion code is supplied.
       
    64 		The Secure Backup Server must assume that the transfer buffer is in use until the AO
       
    65 		is completed.
       
    66 
       
    67 		During a backup operation, all snapshot data should be provided (or data owners told that
       
    68 		they will be doing a base backup) before any data is requested.  This is because providing
       
    69 		snapshots allows data owners to calculate their data and their data sizes.  We cannot provide
       
    70 		the expected data sizes until we have received all snapshots.
       
    71  
       
    72 		Once all snapshots have been provided, the order in which backup data is requested is not
       
    73 		constrained (except that one multi-chunk set of data must be fully retrieved before the next
       
    74 		is requested.
       
    75 
       
    76 		During a restore operation, the Secure Backup Engine expects data in the following order:
       
    77 
       
    78 		1) Registration files
       
    79 
       
    80 		2) Hash data for signed system files.
       
    81 
       
    82 		3) System files for all required data owners.
       
    83 
       
    84 		4) Data for data owners.
       
    85     
       
    86 		Stages (1) through (3) are required in a fixed order.  Once stage (4) has been reached
       
    87 		the SBE does not impose an order between data owners and does not require that all data
       
    88 		from a specific data owner be restored before the next one be started, i.e. it is possible
       
    89 		to send base data to all data owners and then increments (but this is not recommended).
       
    90 
       
    91 		@released
       
    92 		@publishedPartner
       
    93 		*/
       
    94 		{
       
    95 	public:
       
    96 		IMPORT_C static CSBEClient* NewL();
       
    97 		IMPORT_C ~CSBEClient();
       
    98 		IMPORT_C void ListOfDataOwnersL(RPointerArray<CDataOwnerInfo>& aDataOwners);
       
    99 		IMPORT_C void PublicFileListL(TDriveNumber aDrive, CSBGenericDataType& aGenericDataType, RFileArray& aFiles);
       
   100 		IMPORT_C void RawPublicFileListL(TDriveNumber aDrive, CSBGenericDataType& aGenericDataType,
       
   101 										 RRestoreFileFilterArray& aFileFilter);
       
   102 		IMPORT_C void PublicFileListXMLL(TDriveNumber aDrive, TSecureId aSID, HBufC*& aFileList);
       
   103 		IMPORT_C void SetBURModeL(const TDriveList& aDriveList, TBURPartType aBURType, 
       
   104 								  TBackupIncType aBackupIncType);
       
   105 		IMPORT_C void SetSIDListForPartialBURL(RSIDArray& aSIDs);
       
   106 		IMPORT_C void SIDStatusL(RSIDStatusArray& aSIDStatus);		
       
   107 		IMPORT_C TPtr8& TransferDataAddressL();
       
   108 		IMPORT_C TPtrC8& TransferDataInfoL(CSBGenericTransferType*& aGenericTransferType,
       
   109 										   TBool& aFinished);
       
   110 		IMPORT_C void RequestDataL(CSBGenericTransferType& aGenericTransferType,
       
   111 								   TRequestStatus& aStatus);
       
   112 		IMPORT_C void RequestDataL(CSBGenericTransferType& aGenericTransferType);
       
   113 		IMPORT_C void SupplyDataL(CSBGenericTransferType& aGenericTransferType,
       
   114 								  TBool aFinished, TRequestStatus& aStatus);
       
   115 		IMPORT_C void SupplyDataL(CSBGenericTransferType& aGenericTransferType,
       
   116 								  TBool aFinished);
       
   117 		IMPORT_C void AllSnapshotsSuppliedL();								  
       
   118 		IMPORT_C TUint ExpectedDataSizeL(CSBGenericTransferType& aGenericTransferType);
       
   119 		IMPORT_C void AllSystemFilesRestored();
       
   120 		IMPORT_C TUint DataChecksum(TDriveNumber aDrive, TSecureId aSID);
       
   121 		
       
   122 		IMPORT_C void ListOfDataOwnersL(RPointerArray<CDataOwnerInfo>& aDataOwners, TRequestStatus& aStatus);
       
   123 		IMPORT_C void PublicFileListL(TDriveNumber aDrive, CSBGenericDataType& aGenericDataType, RFileArray& aFiles, TRequestStatus& aStatus);
       
   124 		IMPORT_C void SetBURModeL(const TDriveList& aDriveList, TBURPartType aBURType, 
       
   125 								  TBackupIncType aBackupIncType, TRequestStatus& aStatus);
       
   126 		IMPORT_C void AllSnapshotsSuppliedL(TRequestStatus& aStatus);
       
   127 		IMPORT_C void AllSystemFilesRestoredL(TRequestStatus& aStatus);
       
   128 
       
   129 		IMPORT_C void PublicFileListL(TDriveNumber aDrive, CSBGenericDataType& aGenericDataType, 
       
   130 										RPointerArray<CSBEFileEntry>& aFileList, TBool& aFinished,
       
   131 										TInt aTotalListCursor, TInt aMaxResponseSize, TRequestStatus& aStatus);
       
   132 
       
   133 	private:
       
   134 		CSBEClient();
       
   135 		void ConstructL();
       
   136 
       
   137 	private:
       
   138 		/** Pointer to the client session R class wrapped by this class */
       
   139 		RSBEClientSession* iClientSession;
       
   140 		};
       
   141 
       
   142 	} // end namespace
       
   143 
       
   144 #endif // __SBECLIENT_H__