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
     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 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".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:
    15 * Declaration of MActiveBackupDataClient and CActiveBackupClient
    16 * 
    17 *
    18 */
    19 
    20 
    21 
    22 
    23 
    24 /**
    25  @file
    26  @released
    27 */
    28 #ifndef __ACTIVEBACKUPCLIENT_H__
    29 #define __ACTIVEBACKUPCLIENT_H__
    30 
    31 #include <e32base.h>
    32 #include <f32file.h>
    33 #include <e32cmn.h>
    34 #include <connect/sbdefs.h>
    35 
    36 namespace conn
    37 	{
    38 	
    39 	class MActiveBackupDataClient
    40 		/**
    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
    44 		range of functions.
    45 
    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.
    48 
    49 		@released
    50 		@publishedAll
    51 		*/
    52 		{
    53 	public:
    54 
    55 		/** 
    56 		Empty virtual destructor to avoid memory leaks
    57 		*/
    58 		virtual ~MActiveBackupDataClient() {}
    59 
    60 		///// Backup Methods /////
    61 
    62 		/**
    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.
    66 		*/
    67 		virtual void AllSnapshotsSuppliedL() = 0;
    68 
    69 		/**
    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.
    75 
    76 		Snapshot data will also be supplied as part of a restore operation.
    77 
    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.
    82 		*/
    83 		virtual void ReceiveSnapshotDataL(TDriveNumber aDrive, TDesC8& aBuffer, TBool aLastSection) = 0;
    84 
    85 		/**
    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
    91 		value.
    92 
    93 		@param aDrive the drive being backed up.
    94 		@return the size of the data that will be returned
    95 		*/
    96 		virtual TUint GetExpectedDataSize(TDriveNumber aDrive) = 0;
    97 
    98 		/**
    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.
   106 
   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.
   111 		*/
   112 		virtual void GetSnapshotDataL(TDriveNumber aDrive, TPtr8& aBuffer, TBool& aFinished) = 0;
   113 
   114 		/**
   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.
   117 
   118 		@param aDrive the drive being backed up.
   119 		*/
   120 		virtual void InitialiseGetBackupDataL(TDriveNumber aDrive) = 0;
   121 
   122 		/**
   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.
   126 
   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.
   129 		*/
   130 		virtual void GetBackupDataSectionL(TPtr8& aBuffer, TBool& aFinished) = 0;
   131 
   132 		///// Restore Methods /////
   133 
   134 		/**
   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.
   137 
   138 		@param aDrive the drive being restored.
   139 		*/
   140 		virtual void InitialiseRestoreBaseDataL(TDriveNumber aDrive) = 0;
   141 
   142 		/**
   143 		This method receives a section of base restore data.
   144 		InitialiseRestoreBaseDataL() will have been called prevously to specify the drive concerned.
   145 
   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.
   148 		*/
   149 		virtual void RestoreBaseDataSectionL(TDesC8& aBuffer, TBool aFinished) = 0;
   150 
   151 		/**
   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.
   155 
   156 		@param aDrive the drive being restored.
   157 		*/
   158 		virtual void InitialiseRestoreIncrementDataL(TDriveNumber aDrive) = 0;
   159 
   160 		/**
   161 		This method receives a section of increment restore data.
   162 		InitialiseRestoreIncrementDataL() will have been called prevously to specify the 
   163 		drive concerned.
   164 
   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.
   167 		*/
   168 		virtual void RestoreIncrementDataSectionL(TDesC8& aBuffer, TBool aFinished) = 0;
   169 
   170 		/**
   171 		This method is called when all data to be restored has been supplied.
   172 
   173 		@param aDrive the drive being restored.
   174 		*/
   175 		virtual void RestoreComplete(TDriveNumber aDrive) = 0;
   176 
   177 		/**
   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.
   183 
   184 		@param aSID the data owner whose data is to be backed up
   185 		@param aDrive the drive being backed up.
   186 		*/
   187 		virtual void InitialiseGetProxyBackupDataL(TSecureId aSID, TDriveNumber aDrive);
   188 
   189 		/**
   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.
   195 
   196 		@param aSID the data owner whose data is to be restored
   197 		@param aDrive the drive being restored.
   198 		*/
   199 		virtual void InitialiseRestoreProxyBaseDataL(TSecureId aSID, TDriveNumber aDrive);
   200 		
   201 		///// General Methods /////
   202 
   203 		/**
   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
   206 		and restore
   207 		*/
   208 		virtual void TerminateMultiStageOperation() = 0;
   209 		
   210 		/**
   211 		Gets an extended interface based on a supplied uid.
   212 		
   213 		@param aUid Uid which identifies an extended interface
   214 		@return Pointer to an extended interface
   215 		*/
   216 		virtual TAny* GetExtendedInterface(const TInt32 aUid);
   217 
   218 		///// Test Methods /////
   219 		/**
   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.
   223     
   224 		@param aDrive the drive containing data being checksummed
   225 		@return the 32-bit checksum
   226 		*/
   227 		virtual TUint GetDataChecksum(TDriveNumber aDrive) = 0;
   228 		};
   229 
   230 	inline void MActiveBackupDataClient::InitialiseGetProxyBackupDataL(TSecureId /*aSID*/, TDriveNumber /*aDrive*/)
   231 	/** Initialises the proxy backup data
   232 	
   233 	This is not supported here.
   234 	
   235 	@param aSID the secure Id
   236 	@param aDrive the driver number
   237 	@leave KErrNotSupported Always.
   238 	*/
   239 		{
   240 		User::Leave(KErrNotSupported);
   241 		}
   242 
   243 	inline void MActiveBackupDataClient::InitialiseRestoreProxyBaseDataL(TSecureId /*aSID*/, TDriveNumber /*aDrive*/)
   244 		{
   245 	/** Initialises the proxy backup base data
   246 	
   247 	This is not supported here.
   248 	
   249 	@param aSID the secure Id
   250 	@param aDrive the driver number
   251 	@leave KErrNotSupported Always.
   252 	*/
   253 		User::Leave(KErrNotSupported);
   254 		}
   255 		
   256 	inline TAny* MActiveBackupDataClient::GetExtendedInterface(const TInt32 /*aUid*/)
   257 		{
   258 		return NULL;
   259 		}
   260 				
   261 	
   262 	class RABClientSession;
   263 	class CActiveBackupCallbackHandler;
   264 	
   265 	class CActiveBackupClient : public CBase
   266 		/**
   267 		CActiveBackupClient provides a connection to the Secure Backup Server for a data owning
   268 		process.
   269 
   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.
   273 
   274 		It is also used by data owners that implement active backup or restore to provide a
   275 		MActiveBackupDataClient implementation.
   276 
   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:
   279 
   280 		@li Hiding the implementation details of RActiveBackupSessionImpl 
   281 
   282 		@li Future binary compatibility
   283 
   284 		@released
   285 		@publishedAll
   286 		*/
   287 		{
   288 	public:
   289 		IMPORT_C static CActiveBackupClient* NewL();
   290 
   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);
   296 
   297 	private:
   298 		CActiveBackupClient();
   299 		void ConstructL();
   300 		void ConstructL(MActiveBackupDataClient* aClient);
   301 
   302 	private:
   303 		/** Pointer to the client session R class that's wrapped up by this class */
   304 		RABClientSession* iClientSession;
   305 		
   306 		/** Pointer to the Active Backup Callback Handler */
   307 		CActiveBackupCallbackHandler* iABCallbackHandler;
   308 		};
   309 
   310 	} // end namespace
   311 
   312 #endif // __ACTIVEBACKUPCLIENT_H__