backupandrestore/backupengine/inc/abserver.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 CABServer class.
       
    16 * 
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 /**
       
    23  @file
       
    24 */
       
    25 
       
    26 #ifndef __ABSERVER_H__
       
    27 #define __ABSERVER_H__
       
    28 
       
    29 #include <e32base.h>
       
    30 #include <connect/sbtypes.h>
       
    31 
       
    32 namespace conn
       
    33 	{
       
    34 
       
    35 	/** @defgroup ABServer Active Backup Server Documentation
       
    36 	*/
       
    37 
       
    38 	/** Constant for defining an unset Secure ID 
       
    39 	@internalTechnology
       
    40 	*/
       
    41 	const TUint32 KNullABSid = 0;
       
    42 	
       
    43 	class CDataOwnerManager;
       
    44 	class CABSessionMap;
       
    45 
       
    46 	class CABServer :	public CPolicyServer
       
    47 
       
    48 	/**
       
    49     @internalComponent
       
    50 	@ingroup ABServer
       
    51 	
       
    52 	Active Backup Server to support Active Backup sessions
       
    53 	*/
       
    54 		{
       
    55 		public:
       
    56 			~CABServer();
       
    57 			static CABServer* NewLC(CDataOwnerManager* aDOM);
       
    58 			void AddSession();
       
    59 			void DropSession();
       
    60 			void RemoveElement(TSecureId aSecureId);
       
    61 			CDataOwnerManager& DataOwnerManager() const;
       
    62 			void SupplyDataL(TSecureId aSID, TDriveNumber aDriveNumber, TTransferDataType aTransferType, 
       
    63 				TDesC8& aBuffer, TBool aLastSection, TBool aSuppressInitDataOwner = EFalse, 
       
    64 				TSecureId aProxySID = KNullABSid);
       
    65 			void RequestDataL(TSecureId aSID, TDriveNumber aDriveNumber, TTransferDataType aTransferType, 
       
    66 				TPtr8& aBuffer, TBool& aLastSection, TBool aSuppressInitDataOwner = EFalse, 
       
    67 				TSecureId aProxySID = KNullABSid);
       
    68 		    void GetExpectedDataSizeL(TSecureId aSID, TDriveNumber aDriveNumber, TUint& aSize);
       
    69 		    void AllSnapshotsSuppliedL(TSecureId aSID);
       
    70 		    TDataOwnerStatus SessionReadyStateL(TSecureId aSID);
       
    71 		    void RestoreCompleteL(TSecureId aSID, TDriveNumber aDrive);
       
    72 		    void InvalidateABSessions();//Invalidate the CABSession for each ab client
       
    73 		    
       
    74 		private:
       
    75 			CABServer(CDataOwnerManager* aDOM);
       
    76 			void ConstructL();
       
    77 			
       
    78 			//
       
    79 			// From CServer2
       
    80 			virtual CSession2* NewSessionL(const TVersion& aVersion,
       
    81 				const RMessage2& aMessage) const;
       
    82 			
       
    83 			TInt RunError(TInt aError);
       
    84 			void PanicClient(TInt aPanic) const;
       
    85 
       
    86 		private:
       
    87 			/** Active client sessions. */
       
    88 			TInt iSessionCount;
       
    89 			
       
    90 			/** Pointer to the Data Owner Manager */
       
    91 			CDataOwnerManager* iDOM;
       
    92 			
       
    93 			/** Pointer to the session map */
       
    94 			CABSessionMap* iSessionMap;
       
    95 		};
       
    96 		
       
    97 	inline CDataOwnerManager& CABServer::DataOwnerManager() const
       
    98 	/**
       
    99 	Return a reference to the data owner manager
       
   100 	
       
   101 	@return Reference to the data owner manager object
       
   102 	*/
       
   103 		{
       
   104 		return *iDOM;
       
   105 		}
       
   106 		
       
   107 	}
       
   108 
       
   109 #endif //__ABSERVER_H__