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