epoc32/include/connect/abclient.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/**
williamr@2
     2
* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     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
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:
williamr@2
    15
* Declaration of MActiveBackupDataClient and CActiveBackupClient
williamr@2
    16
* 
williamr@2
    17
*
williamr@2
    18
*/
williamr@2
    19
williamr@2
    20
williamr@2
    21
williamr@2
    22
williamr@2
    23
williamr@2
    24
/**
williamr@2
    25
 @file
williamr@2
    26
 @released
williamr@2
    27
*/
williamr@2
    28
#ifndef __ACTIVEBACKUPCLIENT_H__
williamr@2
    29
#define __ACTIVEBACKUPCLIENT_H__
williamr@2
    30
williamr@2
    31
#include <e32base.h>
williamr@2
    32
#include <f32file.h>
williamr@2
    33
#include <e32cmn.h>
williamr@2
    34
#include <connect/sbdefs.h>
williamr@2
    35
williamr@2
    36
namespace conn
williamr@2
    37
	{
williamr@2
    38
	
williamr@2
    39
	class MActiveBackupDataClient
williamr@2
    40
		/**
williamr@2
    41
		MActiveBackupDataClient is a Mixin to be implemented by an Active Backup client.
williamr@2
    42
		The client connects to the Secure Backup Server using the CActiveBackupClient
williamr@2
    43
		class and provides an instance of MActiveBackupDataClient to be called for a
williamr@2
    44
		range of functions.
williamr@2
    45
williamr@2
    46
		The bulk transfer of data and snapshots is expected to be by means of shared
williamr@2
    47
		heaps for performance reasons so the API is expected to change in these areas.
williamr@2
    48
williamr@2
    49
		@released
williamr@2
    50
		@publishedAll
williamr@2
    51
		*/
williamr@2
    52
		{
williamr@2
    53
	public:
williamr@2
    54
williamr@2
    55
		/** 
williamr@2
    56
		Empty virtual destructor to avoid memory leaks
williamr@2
    57
		*/
williamr@2
    58
		virtual ~MActiveBackupDataClient() {}
williamr@2
    59
williamr@2
    60
		///// Backup Methods /////
williamr@2
    61
williamr@2
    62
		/**
williamr@2
    63
		This method informs the active backup data client that all snapshots have
williamr@2
    64
		been supplied. If the client has not received a snapshot then it should
williamr@2
    65
		perform a base backup.
williamr@2
    66
		*/
williamr@2
    67
		virtual void AllSnapshotsSuppliedL() = 0;
williamr@2
    68
williamr@2
    69
		/**
williamr@2
    70
		This method receives all or part of a snapshot of data to allow calculation of an
williamr@2
    71
		incremental backup.  The snapshot is one that was previously supplied by the data
williamr@2
    72
		owner.  The snapshot data should be read from the location supplied.
williamr@2
    73
		The snapshot data may be larger than the location supplied in which case the routine will
williamr@2
    74
		be called repeatedly until all data has been supplied.
williamr@2
    75
williamr@2
    76
		Snapshot data will also be supplied as part of a restore operation.
williamr@2
    77
williamr@2
    78
		@param aDrive the drive being backed up
williamr@2
    79
		@param aBuffer a pointer to the base of the location from whence data can be copied.
williamr@2
    80
		@param aLastSection ETrue if this is the last section of snapshot data, else EFalse.
williamr@2
    81
		@leave KErrNotSupported if the data owner does not support incremental backups.
williamr@2
    82
		*/
williamr@2
    83
		virtual void ReceiveSnapshotDataL(TDriveNumber aDrive, TDesC8& aBuffer, TBool aLastSection) = 0;
williamr@2
    84
williamr@2
    85
		/**
williamr@2
    86
		This method returns the expected size of backup data that will be supplied.   If an
williamr@2
    87
		incremental backup is underway then this method will not be called until after
williamr@2
    88
		ReceiveSnapshotDataL().  The size data will be used for the purpose of tracking progess
williamr@2
    89
		during a backup.  If it is inaccurate then the user may see irregular progress but the
williamr@2
    90
		actual backup data will not be affected so it is acceptable to return an estimated
williamr@2
    91
		value.
williamr@2
    92
williamr@2
    93
		@param aDrive the drive being backed up.
williamr@2
    94
		@return the size of the data that will be returned
williamr@2
    95
		*/
williamr@2
    96
		virtual TUint GetExpectedDataSize(TDriveNumber aDrive) = 0;
williamr@2
    97
williamr@2
    98
		/**
williamr@2
    99
		This method returns a snapshot of data to accompany a backup.  The snapshot is expected
williamr@2
   100
		to contain details on files / data being backed up.  The format of the snapshot is only
williamr@2
   101
		meaningful to the data owner.  The snapshot will be supplied if the data owner is asked
williamr@2
   102
		for an incremental backup and for a restore operation.  The snapshot data should be
williamr@2
   103
		copied to the location supplied.
williamr@2
   104
		The snapshot data may be larger than the location supplied in which case the routine will
williamr@2
   105
		be called repeatedly until all data has been retrieved.
williamr@2
   106
williamr@2
   107
		@param aDrive the drive being backed up
williamr@2
   108
		@param aBuffer a pointer to the base of the location where data can be copied.
williamr@2
   109
		@param aFinished on return ETrue if all data has been returned for this drive, else EFalse.
williamr@2
   110
		@leave KErrNotSupported if the data owner does not support  incremental backups.
williamr@2
   111
		*/
williamr@2
   112
		virtual void GetSnapshotDataL(TDriveNumber aDrive, TPtr8& aBuffer, TBool& aFinished) = 0;
williamr@2
   113
williamr@2
   114
		/**
williamr@2
   115
		This method prepares the implementor to return backup data.  It will be followed by a
williamr@2
   116
		sequence of calls to request the actual data.
williamr@2
   117
williamr@2
   118
		@param aDrive the drive being backed up.
williamr@2
   119
		*/
williamr@2
   120
		virtual void InitialiseGetBackupDataL(TDriveNumber aDrive) = 0;
williamr@2
   121
williamr@2
   122
		/**
williamr@2
   123
		This method requests a section of backup data.  InitialiseGetBackupDataL() will have been
williamr@2
   124
		called prevously to specify the drive concerned.  The data returned may be base or
williamr@2
   125
		incremental depending on the type of backup and the capability of the data owner.
williamr@2
   126
williamr@2
   127
		@param aBuffer a pointer to the base of the location where data can be copied.
williamr@2
   128
		@param aFinished on return ETrue if all data has been returned for this drive, else EFalse.
williamr@2
   129
		*/
williamr@2
   130
		virtual void GetBackupDataSectionL(TPtr8& aBuffer, TBool& aFinished) = 0;
williamr@2
   131
williamr@2
   132
		///// Restore Methods /////
williamr@2
   133
williamr@2
   134
		/**
williamr@2
   135
		This method prepares the implementor to receive base restore data for a drive.
williamr@2
   136
		It will be followed by a sequence of calls to supply the actual data.
williamr@2
   137
williamr@2
   138
		@param aDrive the drive being restored.
williamr@2
   139
		*/
williamr@2
   140
		virtual void InitialiseRestoreBaseDataL(TDriveNumber aDrive) = 0;
williamr@2
   141
williamr@2
   142
		/**
williamr@2
   143
		This method receives a section of base restore data.
williamr@2
   144
		InitialiseRestoreBaseDataL() will have been called prevously to specify the drive concerned.
williamr@2
   145
williamr@2
   146
		@param aBuffer a pointer to the base of the location whence data can be read.
williamr@2
   147
		@param aFinished ETrue if all data has been returned for this drive, else EFalse.
williamr@2
   148
		*/
williamr@2
   149
		virtual void RestoreBaseDataSectionL(TDesC8& aBuffer, TBool aFinished) = 0;
williamr@2
   150
williamr@2
   151
		/**
williamr@2
   152
		This method prepares the implementor to receive incremental restore data for a drive.
williamr@2
   153
		It will be followed by a sequence of calls to supply the actual data.  If multiple
williamr@2
   154
		increments are supplied then this methid will be called before each increment.
williamr@2
   155
williamr@2
   156
		@param aDrive the drive being restored.
williamr@2
   157
		*/
williamr@2
   158
		virtual void InitialiseRestoreIncrementDataL(TDriveNumber aDrive) = 0;
williamr@2
   159
williamr@2
   160
		/**
williamr@2
   161
		This method receives a section of increment restore data.
williamr@2
   162
		InitialiseRestoreIncrementDataL() will have been called prevously to specify the 
williamr@2
   163
		drive concerned.
williamr@2
   164
williamr@2
   165
		@param aBuffer a pointer to the base of the location whence data can be read.
williamr@2
   166
		@param aFinished ETrue if all data has been returned for this increment, else EFalse.
williamr@2
   167
		*/
williamr@2
   168
		virtual void RestoreIncrementDataSectionL(TDesC8& aBuffer, TBool aFinished) = 0;
williamr@2
   169
williamr@2
   170
		/**
williamr@2
   171
		This method is called when all data to be restored has been supplied.
williamr@2
   172
williamr@2
   173
		@param aDrive the drive being restored.
williamr@2
   174
		*/
williamr@2
   175
		virtual void RestoreComplete(TDriveNumber aDrive) = 0;
williamr@2
   176
williamr@2
   177
		/**
williamr@2
   178
		This method prepares the implementor to return backup data on behalf of another data owner.
williamr@2
   179
		It will be followed by a sequence of calls to request the actual data. This method is only
williamr@2
   180
		for use by a proxy data manager that backs up data on behalf of other data owners.  There
williamr@2
   181
		is no corresponding method for snapshots as it is assumed that a proxy data manager will
williamr@2
   182
		only handle base data.
williamr@2
   183
williamr@2
   184
		@param aSID the data owner whose data is to be backed up
williamr@2
   185
		@param aDrive the drive being backed up.
williamr@2
   186
		*/
williamr@2
   187
		virtual void InitialiseGetProxyBackupDataL(TSecureId aSID, TDriveNumber aDrive);
williamr@2
   188
williamr@2
   189
		/**
williamr@2
   190
		This method prepares the implementor to receive base restore data for another data owner
williamr@2
   191
		for a drive. It will be followed by a sequence of calls to supply the actual data.
williamr@2
   192
		This method is only for use by a proxy data manager that restores up data on behalf of
williamr@2
   193
		other data owners.  There is no corresponding method for incremental data as it is assumed
williamr@2
   194
		that a proxy data manager will only handle base data.
williamr@2
   195
williamr@2
   196
		@param aSID the data owner whose data is to be restored
williamr@2
   197
		@param aDrive the drive being restored.
williamr@2
   198
		*/
williamr@2
   199
		virtual void InitialiseRestoreProxyBaseDataL(TSecureId aSID, TDriveNumber aDrive);
williamr@2
   200
		
williamr@2
   201
		///// General Methods /////
williamr@2
   202
williamr@2
   203
		/**
williamr@2
   204
		This method is called if copying of data is terminated prematurely to allow the 
williamr@2
   205
		implementor to tidy up.  The same method applies to all types of data and to backup
williamr@2
   206
		and restore
williamr@2
   207
		*/
williamr@2
   208
		virtual void TerminateMultiStageOperation() = 0;
williamr@2
   209
		
williamr@2
   210
		/**
williamr@2
   211
		Gets an extended interface based on a supplied uid.
williamr@2
   212
		
williamr@2
   213
		@param aUid Uid which identifies an extended interface
williamr@2
   214
		@return Pointer to an extended interface
williamr@2
   215
		*/
williamr@2
   216
		virtual TAny* GetExtendedInterface(const TInt32 aUid);
williamr@2
   217
williamr@2
   218
		///// Test Methods /////
williamr@2
   219
		/**
williamr@2
   220
		Gets a 32-bit checksum for its private data.
williamr@2
   221
		This routine is for test purposes.  It must be implemented but an invariant checksum 
williamr@2
   222
		value can be provided.  Some tests may cause checksum values to be compared.
williamr@2
   223
    
williamr@2
   224
		@param aDrive the drive containing data being checksummed
williamr@2
   225
		@return the 32-bit checksum
williamr@2
   226
		*/
williamr@2
   227
		virtual TUint GetDataChecksum(TDriveNumber aDrive) = 0;
williamr@2
   228
		};
williamr@2
   229
williamr@2
   230
	inline void MActiveBackupDataClient::InitialiseGetProxyBackupDataL(TSecureId /*aSID*/, TDriveNumber /*aDrive*/)
williamr@2
   231
	/** Initialises the proxy backup data
williamr@2
   232
	
williamr@2
   233
	This is not supported here.
williamr@2
   234
	
williamr@2
   235
	@param aSID the secure Id
williamr@2
   236
	@param aDrive the driver number
williamr@2
   237
	@leave KErrNotSupported Always.
williamr@2
   238
	*/
williamr@2
   239
		{
williamr@2
   240
		User::Leave(KErrNotSupported);
williamr@2
   241
		}
williamr@2
   242
williamr@2
   243
	inline void MActiveBackupDataClient::InitialiseRestoreProxyBaseDataL(TSecureId /*aSID*/, TDriveNumber /*aDrive*/)
williamr@2
   244
		{
williamr@2
   245
	/** Initialises the proxy backup base data
williamr@2
   246
	
williamr@2
   247
	This is not supported here.
williamr@2
   248
	
williamr@2
   249
	@param aSID the secure Id
williamr@2
   250
	@param aDrive the driver number
williamr@2
   251
	@leave KErrNotSupported Always.
williamr@2
   252
	*/
williamr@2
   253
		User::Leave(KErrNotSupported);
williamr@2
   254
		}
williamr@2
   255
		
williamr@2
   256
	inline TAny* MActiveBackupDataClient::GetExtendedInterface(const TInt32 /*aUid*/)
williamr@2
   257
		{
williamr@2
   258
		return NULL;
williamr@2
   259
		}
williamr@2
   260
				
williamr@2
   261
	
williamr@2
   262
	class RABClientSession;
williamr@2
   263
	class CActiveBackupCallbackHandler;
williamr@2
   264
	
williamr@2
   265
	class CActiveBackupClient : public CBase
williamr@2
   266
		/**
williamr@2
   267
		CActiveBackupClient provides a connection to the Secure Backup Server for a data owning
williamr@2
   268
		process.
williamr@2
   269
williamr@2
   270
		It can be used to obtain information about an active backup or restore operation. 
williamr@2
   271
		It can also be used to signal to the Secure Backup Server when the data owner is ready
williamr@2
   272
		for backup or restore.
williamr@2
   273
williamr@2
   274
		It is also used by data owners that implement active backup or restore to provide a
williamr@2
   275
		MActiveBackupDataClient implementation.
williamr@2
   276
williamr@2
   277
		This class owns a RActiveBackupSessionImpl instance and publishes the 
williamr@2
   278
		public API to the outside world. The reason for this facade class is twofold:
williamr@2
   279
williamr@2
   280
		@li Hiding the implementation details of RActiveBackupSessionImpl 
williamr@2
   281
williamr@2
   282
		@li Future binary compatibility
williamr@2
   283
williamr@2
   284
		@released
williamr@2
   285
		@publishedAll
williamr@2
   286
		*/
williamr@2
   287
		{
williamr@2
   288
	public:
williamr@2
   289
		IMPORT_C static CActiveBackupClient* NewL();
williamr@2
   290
williamr@2
   291
		IMPORT_C static CActiveBackupClient* NewL(MActiveBackupDataClient* aClient);
williamr@2
   292
		IMPORT_C ~CActiveBackupClient();
williamr@2
   293
		IMPORT_C void BURModeInfoL(TDriveList& aDriveList, TBURPartType& aBackupType, TBackupIncType& aIncBackupType);
williamr@2
   294
		IMPORT_C TBool DoesPartialBURAffectMeL();
williamr@2
   295
		IMPORT_C void ConfirmReadyForBURL(TInt aErrorCode);
williamr@2
   296
williamr@2
   297
	private:
williamr@2
   298
		CActiveBackupClient();
williamr@2
   299
		void ConstructL();
williamr@2
   300
		void ConstructL(MActiveBackupDataClient* aClient);
williamr@2
   301
williamr@2
   302
	private:
williamr@2
   303
		/** Pointer to the client session R class that's wrapped up by this class */
williamr@2
   304
		RABClientSession* iClientSession;
williamr@2
   305
		
williamr@2
   306
		/** Pointer to the Active Backup Callback Handler */
williamr@2
   307
		CActiveBackupCallbackHandler* iABCallbackHandler;
williamr@2
   308
		};
williamr@2
   309
williamr@2
   310
	} // end namespace
williamr@2
   311
williamr@2
   312
#endif // __ACTIVEBACKUPCLIENT_H__