2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Declaration of MActiveBackupDataClient and CActiveBackupClient
28 #ifndef __ACTIVEBACKUPCLIENT_H__
29 #define __ACTIVEBACKUPCLIENT_H__
34 #include <connect/sbdefs.h>
39 class MActiveBackupDataClient
41 MActiveBackupDataClient is a Mixin to be implemented by an Active Backup client.
42 The client connects to the Secure Backup Server using the CActiveBackupClient
43 class and provides an instance of MActiveBackupDataClient to be called for a
46 The bulk transfer of data and snapshots is expected to be by means of shared
47 heaps for performance reasons so the API is expected to change in these areas.
56 Empty virtual destructor to avoid memory leaks
58 virtual ~MActiveBackupDataClient() {}
60 ///// Backup Methods /////
63 This method informs the active backup data client that all snapshots have
64 been supplied. If the client has not received a snapshot then it should
65 perform a base backup.
67 virtual void AllSnapshotsSuppliedL() = 0;
70 This method receives all or part of a snapshot of data to allow calculation of an
71 incremental backup. The snapshot is one that was previously supplied by the data
72 owner. The snapshot data should be read from the location supplied.
73 The snapshot data may be larger than the location supplied in which case the routine will
74 be called repeatedly until all data has been supplied.
76 Snapshot data will also be supplied as part of a restore operation.
78 @param aDrive the drive being backed up
79 @param aBuffer a pointer to the base of the location from whence data can be copied.
80 @param aLastSection ETrue if this is the last section of snapshot data, else EFalse.
81 @leave KErrNotSupported if the data owner does not support incremental backups.
83 virtual void ReceiveSnapshotDataL(TDriveNumber aDrive, TDesC8& aBuffer, TBool aLastSection) = 0;
86 This method returns the expected size of backup data that will be supplied. If an
87 incremental backup is underway then this method will not be called until after
88 ReceiveSnapshotDataL(). The size data will be used for the purpose of tracking progess
89 during a backup. If it is inaccurate then the user may see irregular progress but the
90 actual backup data will not be affected so it is acceptable to return an estimated
93 @param aDrive the drive being backed up.
94 @return the size of the data that will be returned
96 virtual TUint GetExpectedDataSize(TDriveNumber aDrive) = 0;
99 This method returns a snapshot of data to accompany a backup. The snapshot is expected
100 to contain details on files / data being backed up. The format of the snapshot is only
101 meaningful to the data owner. The snapshot will be supplied if the data owner is asked
102 for an incremental backup and for a restore operation. The snapshot data should be
103 copied to the location supplied.
104 The snapshot data may be larger than the location supplied in which case the routine will
105 be called repeatedly until all data has been retrieved.
107 @param aDrive the drive being backed up
108 @param aBuffer a pointer to the base of the location where data can be copied.
109 @param aFinished on return ETrue if all data has been returned for this drive, else EFalse.
110 @leave KErrNotSupported if the data owner does not support incremental backups.
112 virtual void GetSnapshotDataL(TDriveNumber aDrive, TPtr8& aBuffer, TBool& aFinished) = 0;
115 This method prepares the implementor to return backup data. It will be followed by a
116 sequence of calls to request the actual data.
118 @param aDrive the drive being backed up.
120 virtual void InitialiseGetBackupDataL(TDriveNumber aDrive) = 0;
123 This method requests a section of backup data. InitialiseGetBackupDataL() will have been
124 called prevously to specify the drive concerned. The data returned may be base or
125 incremental depending on the type of backup and the capability of the data owner.
127 @param aBuffer a pointer to the base of the location where data can be copied.
128 @param aFinished on return ETrue if all data has been returned for this drive, else EFalse.
130 virtual void GetBackupDataSectionL(TPtr8& aBuffer, TBool& aFinished) = 0;
132 ///// Restore Methods /////
135 This method prepares the implementor to receive base restore data for a drive.
136 It will be followed by a sequence of calls to supply the actual data.
138 @param aDrive the drive being restored.
140 virtual void InitialiseRestoreBaseDataL(TDriveNumber aDrive) = 0;
143 This method receives a section of base restore data.
144 InitialiseRestoreBaseDataL() will have been called prevously to specify the drive concerned.
146 @param aBuffer a pointer to the base of the location whence data can be read.
147 @param aFinished ETrue if all data has been returned for this drive, else EFalse.
149 virtual void RestoreBaseDataSectionL(TDesC8& aBuffer, TBool aFinished) = 0;
152 This method prepares the implementor to receive incremental restore data for a drive.
153 It will be followed by a sequence of calls to supply the actual data. If multiple
154 increments are supplied then this methid will be called before each increment.
156 @param aDrive the drive being restored.
158 virtual void InitialiseRestoreIncrementDataL(TDriveNumber aDrive) = 0;
161 This method receives a section of increment restore data.
162 InitialiseRestoreIncrementDataL() will have been called prevously to specify the
165 @param aBuffer a pointer to the base of the location whence data can be read.
166 @param aFinished ETrue if all data has been returned for this increment, else EFalse.
168 virtual void RestoreIncrementDataSectionL(TDesC8& aBuffer, TBool aFinished) = 0;
171 This method is called when all data to be restored has been supplied.
173 @param aDrive the drive being restored.
175 virtual void RestoreComplete(TDriveNumber aDrive) = 0;
178 This method prepares the implementor to return backup data on behalf of another data owner.
179 It will be followed by a sequence of calls to request the actual data. This method is only
180 for use by a proxy data manager that backs up data on behalf of other data owners. There
181 is no corresponding method for snapshots as it is assumed that a proxy data manager will
182 only handle base data.
184 @param aSID the data owner whose data is to be backed up
185 @param aDrive the drive being backed up.
187 virtual void InitialiseGetProxyBackupDataL(TSecureId aSID, TDriveNumber aDrive);
190 This method prepares the implementor to receive base restore data for another data owner
191 for a drive. It will be followed by a sequence of calls to supply the actual data.
192 This method is only for use by a proxy data manager that restores up data on behalf of
193 other data owners. There is no corresponding method for incremental data as it is assumed
194 that a proxy data manager will only handle base data.
196 @param aSID the data owner whose data is to be restored
197 @param aDrive the drive being restored.
199 virtual void InitialiseRestoreProxyBaseDataL(TSecureId aSID, TDriveNumber aDrive);
201 ///// General Methods /////
204 This method is called if copying of data is terminated prematurely to allow the
205 implementor to tidy up. The same method applies to all types of data and to backup
208 virtual void TerminateMultiStageOperation() = 0;
211 Gets an extended interface based on a supplied uid.
213 @param aUid Uid which identifies an extended interface
214 @return Pointer to an extended interface
216 virtual TAny* GetExtendedInterface(const TInt32 aUid);
218 ///// Test Methods /////
220 Gets a 32-bit checksum for its private data.
221 This routine is for test purposes. It must be implemented but an invariant checksum
222 value can be provided. Some tests may cause checksum values to be compared.
224 @param aDrive the drive containing data being checksummed
225 @return the 32-bit checksum
227 virtual TUint GetDataChecksum(TDriveNumber aDrive) = 0;
230 inline void MActiveBackupDataClient::InitialiseGetProxyBackupDataL(TSecureId /*aSID*/, TDriveNumber /*aDrive*/)
231 /** Initialises the proxy backup data
233 This is not supported here.
235 @param aSID the secure Id
236 @param aDrive the driver number
237 @leave KErrNotSupported Always.
240 User::Leave(KErrNotSupported);
243 inline void MActiveBackupDataClient::InitialiseRestoreProxyBaseDataL(TSecureId /*aSID*/, TDriveNumber /*aDrive*/)
245 /** Initialises the proxy backup base data
247 This is not supported here.
249 @param aSID the secure Id
250 @param aDrive the driver number
251 @leave KErrNotSupported Always.
253 User::Leave(KErrNotSupported);
256 inline TAny* MActiveBackupDataClient::GetExtendedInterface(const TInt32 /*aUid*/)
262 class RABClientSession;
263 class CActiveBackupCallbackHandler;
265 class CActiveBackupClient : public CBase
267 CActiveBackupClient provides a connection to the Secure Backup Server for a data owning
270 It can be used to obtain information about an active backup or restore operation.
271 It can also be used to signal to the Secure Backup Server when the data owner is ready
272 for backup or restore.
274 It is also used by data owners that implement active backup or restore to provide a
275 MActiveBackupDataClient implementation.
277 This class owns a RActiveBackupSessionImpl instance and publishes the
278 public API to the outside world. The reason for this facade class is twofold:
280 @li Hiding the implementation details of RActiveBackupSessionImpl
282 @li Future binary compatibility
289 IMPORT_C static CActiveBackupClient* NewL();
291 IMPORT_C static CActiveBackupClient* NewL(MActiveBackupDataClient* aClient);
292 IMPORT_C ~CActiveBackupClient();
293 IMPORT_C void BURModeInfoL(TDriveList& aDriveList, TBURPartType& aBackupType, TBackupIncType& aIncBackupType);
294 IMPORT_C TBool DoesPartialBURAffectMeL();
295 IMPORT_C void ConfirmReadyForBURL(TInt aErrorCode);
298 CActiveBackupClient();
300 void ConstructL(MActiveBackupDataClient* aClient);
303 /** Pointer to the client session R class that's wrapped up by this class */
304 RABClientSession* iClientSession;
306 /** Pointer to the Active Backup Callback Handler */
307 CActiveBackupCallbackHandler* iABCallbackHandler;
312 #endif // __ACTIVEBACKUPCLIENT_H__