backupandrestore/backupengine/src/sbesession.cpp
changeset 47 63cf70d3ecd8
parent 33 883e91c086aa
equal deleted inserted replaced
44:a5deb6b96675 47:63cf70d3ecd8
    25 #include "sbesession.h"
    25 #include "sbesession.h"
    26 #include "sbeclientserver.h"
    26 #include "sbeclientserver.h"
    27 #include "sbepanic.h"
    27 #include "sbepanic.h"
    28 #include "sbedataownermanager.h"
    28 #include "sbedataownermanager.h"
    29 #include <connect/sbtypes.h>
    29 #include <connect/sbtypes.h>
    30 #include "sblog.h"
       
    31 #include <apgcli.h>
    30 #include <apgcli.h>
       
    31 #include "OstTraceDefinitions.h"
       
    32 #include "sbtrace.h"
       
    33 #ifdef OST_TRACE_COMPILER_IN_USE
       
    34 #include "sbesessionTraces.h"
       
    35 #endif
    32 
    36 
    33 namespace conn
    37 namespace conn
    34 	{
    38 	{	
    35 	
       
    36 	/** This block size for the internal buffer
    39 	/** This block size for the internal buffer
    37 	@internalTechnology
    40 	@internalTechnology
    38 	*/
    41 	*/
    39 	const TInt KSBBufferBlockSize = 4096;
    42 	const TInt KSBBufferBlockSize = 4096;
    40 	
    43 	
    41 	CSBESession::CSBESession() : iTransferBuf(NULL), iTransferTextBuf(NULL), iArrayCount(0)
    44 	CSBESession::CSBESession() : iTransferBuf(NULL), iTransferTextBuf(NULL), iArrayCount(0)
    42     /**
    45     /**
    43     Class Constructor
    46     Class Constructor
    44     */
    47     */
    45 		{
    48 		{
       
    49 		OstTraceFunctionEntry0( CSBESESSION_CSBESESSION_CONS_ENTRY );
       
    50 		OstTraceFunctionExit0( CSBESESSION_CSBESESSION_CONS_EXIT );
    46 		}
    51 		}
    47 
    52 
    48 	CSBESession::~CSBESession()
    53 	CSBESession::~CSBESession()
    49     /**
    54     /**
    50     Class destructor
    55     Class destructor
    51     */
    56     */
    52 		{
    57 		{
       
    58 		OstTraceFunctionEntry0( CSBESESSION_CSBESESSION_DES_ENTRY );
    53 		//
    59 		//
    54 		// If the client has detached properly, they should
    60 		// If the client has detached properly, they should
    55 		// have done this - but just in case.
    61 		// have done this - but just in case.
    56 		Server().DropSession();
    62 		Server().DropSession();
    57 		ResetTransferBuf();
    63 		ResetTransferBuf();
    58 		delete iExtCurEntry;
    64 		delete iExtCurEntry;
       
    65 		OstTraceFunctionExit0( CSBESESSION_CSBESESSION_DES_EXIT );
    59 		}
    66 		}
    60 
    67 
    61 	void CSBESession::CreateL()
    68 	void CSBESession::CreateL()
    62 	/**
    69 	/**
    63 	Creates a connection between the Secure Backup Engine server and the Secure
    70 	Creates a connection between the Secure Backup Engine server and the Secure
    64 	Backup Engine session.  Increments the server's session count
    71 	Backup Engine session.  Increments the server's session count
    65 	*/
    72 	*/
    66 		{
    73 		{
       
    74 		OstTraceFunctionEntry0( CSBESESSION_CREATEL_ENTRY );
    67 		//
    75 		//
    68 		// Increase the servers session count.
    76 		// Increase the servers session count.
    69 		Server().AddSession();
    77 		Server().AddSession();
       
    78 		OstTraceFunctionExit0( CSBESESSION_CREATEL_EXIT );
    70 		}
    79 		}
    71 
    80 
    72 	void CSBESession::ServiceL(const RMessage2& aMessage)
    81 	void CSBESession::ServiceL(const RMessage2& aMessage)
    73 	/**
    82 	/**
    74 	Called by the client server framework to service a message request
    83 	Called by the client server framework to service a message request
    75 	from a client.
    84 	from a client.
    76 
    85 
    77     @param aMessage  Reference to a RMessage2 object
    86     @param aMessage  Reference to a RMessage2 object
    78 	*/
    87 	*/
    79 		{
    88 		{
    80 	#ifdef SBE_LOGGING_ENABLED
    89 	    OstTraceFunctionEntry0( CSBESESSION_SERVICEL_ENTRY );
       
    90 	
    81 		RThread thread;
    91 		RThread thread;
    82 		aMessage.Client(thread);
    92 		aMessage.Client(thread);
    83 		const TFullName threadName( thread.FullName() );
    93 		const TFullName threadName( thread.FullName() );
    84 		thread.Close();
    94 		thread.Close();
    85 	#endif		
    95 			
    86 		
       
    87 		switch(aMessage.Function())
    96 		switch(aMessage.Function())
    88 			{
    97 			{
    89 			//
    98 			//
    90 			// Connection config getting/setting.
    99 			// Connection config getting/setting.
    91 			case ESBEMsgGetGSHHandle:
   100 			case ESBEMsgGetGSHHandle:
    92 				{
   101 				{
    93         		__LOG1("CSBESession::ServiceL() - ESBEMsgGetGSHHandle for thread: %S", &threadName);
   102 				OstTraceExt1(TRACE_NORMAL, CSBESESSION_SERVICEL, "ESBEMsgGetGSHHandle for thread: %S", threadName);
    94 				aMessage.Complete(Server().GlobalSharedHeap());
   103 				aMessage.Complete(Server().GlobalSharedHeap());
    95 				break;
   104 				break;
    96 				}
   105 				}
    97 			case ESBEMsgPrepDataOwnerInfo:
   106 			case ESBEMsgPrepDataOwnerInfo:
    98 				{
   107 				{
    99         		__LOG1("CSBESession::ServiceL() - ESBEMsgPrepDataOwnerInfo for thread: %S", &threadName);
   108 				OstTraceExt1(TRACE_NORMAL, DUP1_CSBESESSION_SERVICEL, "ESBEMsgPrepDataOwnerInfo for thread: %S", threadName);
   100 				PrepDataOwnerInfoL(aMessage);
   109 				PrepDataOwnerInfoL(aMessage);
   101 				break;
   110 				break;
   102 				}
   111 				}
   103 			case ESBEMsgGetDataOwnerInfo:
   112 			case ESBEMsgGetDataOwnerInfo:
   104 				{
   113 				{
   105         		__LOG1("CSBESession::ServiceL() - ESBEMsgGetDataOwnerInfo for thread: %S", &threadName);
   114 				OstTraceExt1(TRACE_NORMAL, DUP2_CSBESESSION_SERVICEL, "ESBEMsgGetDataOwnerInfo for thread: %S", threadName);
   106 				ReturnDataOwnerInfoL(aMessage);
   115 				ReturnDataOwnerInfoL(aMessage);
   107 				break;
   116 				break;
   108 				}
   117 				}
   109 			case ESBEMsgPrepPublicFiles:
   118 			case ESBEMsgPrepPublicFiles:
   110 				{
   119 				{
   111         		__LOG1("CSBESession::ServiceL() - ESBEMsgPrepPublicFiles for thread: %S", &threadName);
   120 				OstTraceExt1(TRACE_NORMAL, DUP3_CSBESESSION_SERVICEL, "ESBEMsgPrepPublicFiles for thread: %S", threadName);
   112 				PrepPublicFileListL(aMessage);
   121 				PrepPublicFileListL(aMessage);
   113 				break;
   122 				break;
   114 				}
   123 				}
   115 			case ESBEMsgGetPublicFiles:
   124 			case ESBEMsgGetPublicFiles:
   116 				{
   125 				{
   117         		__LOG1("CSBESession::ServiceL() - ESBEMsgGetPublicFiles for thread: %S", &threadName);
   126 				OstTraceExt1(TRACE_NORMAL, DUP4_CSBESESSION_SERVICEL, "ESBEMsgGetPublicFiles for thread: %S", threadName);
   118 				ReturnPublicFileListL(aMessage);
   127 				ReturnPublicFileListL(aMessage);
   119 				break;
   128 				break;
   120 				}
   129 				}
   121 			case ESBEMsgPrepPublicFilesRaw:
   130 			case ESBEMsgPrepPublicFilesRaw:
   122 				{
   131 				{
   123         		__LOG1("CSBESession::ServiceL() - ESBEMsgPrepPublicFilesRaw for thread: %S", &threadName);
   132 				OstTraceExt1(TRACE_NORMAL, DUP5_CSBESESSION_SERVICEL, "ESBEMsgPrepPublicFilesRaw for thread: %S", threadName);
   124 				PrepPublicFileListRawL(aMessage);
   133 				PrepPublicFileListRawL(aMessage);
   125 				break;
   134 				break;
   126 				}
   135 				}
   127 			case ESBEMsgGetPublicFilesRaw:
   136 			case ESBEMsgGetPublicFilesRaw:
   128 				{
   137 				{
   129         		__LOG1("CSBESession::ServiceL() - ESBEMsgGetPublicFilesRaw for thread: %S", &threadName);
   138 				OstTraceExt1(TRACE_NORMAL, DUP6_CSBESESSION_SERVICEL, "ESBEMsgGetPublicFilesRaw for thread: %S", threadName);
   130 				ReturnPublicFileListRawL(aMessage);
   139 				ReturnPublicFileListRawL(aMessage);
   131 				break;
   140 				break;
   132 				}
   141 				}
   133 			case ESBEMsgPrepPublicFilesXML:
   142 			case ESBEMsgPrepPublicFilesXML:
   134 				{
   143 				{
   135         		__LOG1("CSBESession::ServiceL() - ESBEMsgPrepPublicFilesXML for thread: %S", &threadName);
   144 				OstTraceExt1(TRACE_NORMAL, DUP7_CSBESESSION_SERVICEL, "ESBEMsgPrepPublicFilesXML for thread: %S", threadName);
   136 				PrepPublicFileListXMLL(aMessage);
   145 				PrepPublicFileListXMLL(aMessage);
   137 				break;
   146 				break;
   138 				}
   147 				}
   139 			case ESBEMsgGetPublicFilesXML:
   148 			case ESBEMsgGetPublicFilesXML:
   140 				{
   149 				{
   141         		__LOG1("CSBESession::ServiceL() - ESBEMsgGetPublicFilesXML for thread: %S", &threadName);
   150 				OstTraceExt1(TRACE_NORMAL, DUP8_CSBESESSION_SERVICEL, "ESBEMsgGetPublicFilesXML for thread: %S", threadName);
   142 				ReturnPublicFileListXMLL(aMessage);
   151 				ReturnPublicFileListXMLL(aMessage);
   143 				break;
   152 				break;
   144 				}
   153 				}
   145 			case ESBEMsgSetBURMode:
   154 			case ESBEMsgSetBURMode:
   146 				{
   155 				{
   147         		__LOG1("CSBESession::ServiceL() - ESBEMsgSetBURMode for thread: %S", &threadName);
   156 				OstTraceExt1(TRACE_NORMAL, DUP9_CSBESESSION_SERVICEL, "ESBEMsgSetBURMode for thread: %S", threadName);
   148 				SetBURModeL(aMessage);
   157 				SetBURModeL(aMessage);
   149 				break;
   158 				break;
   150 				}
   159 				}
   151 			case ESBEMsgSetSIDListPartial:
   160 			case ESBEMsgSetSIDListPartial:
   152 				{
   161 				{
   153         		__LOG1("CSBESession::ServiceL() - ESBEMsgSetSIDListPartial for thread: %S", &threadName);
   162 				OstTraceExt1(TRACE_NORMAL, DUP10_CSBESESSION_SERVICEL, "ESBEMsgSetSIDListPartial for thread: %S", threadName);
   154 				SetSIDListForPartialBURL(aMessage);
   163 				SetSIDListForPartialBURL(aMessage);
   155 				break;
   164 				break;
   156 				}
   165 				}
   157 			case ESBEMsgPrepSIDStatus:
   166 			case ESBEMsgPrepSIDStatus:
   158 				{
   167 				{
   159         		__LOG1("CSBESession::ServiceL() - ESBEMsgPrepSIDStatus for thread: %S", &threadName);
   168 				OstTraceExt1(TRACE_NORMAL, DUP11_CSBESESSION_SERVICEL, "ESBEMsgPrepSIDStatus for thread: %S", threadName);
   160 				PrepSIDStatusL(aMessage);
   169 				PrepSIDStatusL(aMessage);
   161 				break;
   170 				break;
   162 				}
   171 				}
   163 			case ESBEMsgGetSIDStatus:
   172 			case ESBEMsgGetSIDStatus:
   164 				{
   173 				{
   165         		__LOG1("CSBESession::ServiceL() - ESBEMsgGetSIDStatus for thread: %S", &threadName);
   174 				OstTraceExt1(TRACE_NORMAL, DUP12_CSBESESSION_SERVICEL, "ESBEMsgGetSIDStatus for thread: %S", threadName);
   166 				ReturnSIDStatusL(aMessage);
   175 				ReturnSIDStatusL(aMessage);
   167 				break;
   176 				break;
   168 				}
   177 				}
   169 			case ESBEMsgRequestDataSync:
   178 			case ESBEMsgRequestDataSync:
   170 			case ESBEMsgRequestDataAsync:
   179 			case ESBEMsgRequestDataAsync:
   171 				{
   180 				{
   172         		__LOG1("CSBESession::ServiceL() - ESBEMsgRequestDataSync / ESBEMsgRequestDataAsync for thread: %S", &threadName);
   181 				OstTraceExt1(TRACE_NORMAL, DUP13_CSBESESSION_SERVICEL, "ESBEMsgRequestDataSync / ESBEMsgRequestDataAsync for thread: %S", threadName);
   173 				TRAPD(reqDataErr, RequestDataAsyncL(aMessage));
   182 				TRAPD(reqDataErr, RequestDataAsyncL(aMessage));
   174 				if (reqDataErr != KErrNone)
   183 				if (reqDataErr != KErrNone)
   175 					{
   184 					{
   176 					Server().GSHInterface().Header(Server().GlobalSharedHeap()).SetLockedFlag(EFalse);
   185 					Server().GSHInterface().Header(Server().GlobalSharedHeap()).SetLockedFlag(EFalse);
       
   186 					OstTrace1(TRACE_ERROR, DUP22_CSBESESSION_SERVICEL, "Leave: %d", reqDataErr);
   177 					User::Leave(reqDataErr);
   187 					User::Leave(reqDataErr);
   178 					}
   188 					}
   179 				break;
   189 				break;
   180 				}
   190 				}
   181 			case ESBEMsgSupplyDataSync:
   191 			case ESBEMsgSupplyDataSync:
   182 				{
   192 				{
   183         		__LOG1("CSBESession::ServiceL() - ESBEMsgSupplyDataSync for thread: %S", &threadName);
   193 				OstTraceExt1(TRACE_NORMAL, DUP14_CSBESESSION_SERVICEL, "ESBEMsgSupplyDataSync for thread: %S", threadName);
   184 				TRAPD(supDataErr, SupplyDataSyncL(aMessage));
   194 				TRAPD(supDataErr, SupplyDataSyncL(aMessage));
   185 				if (supDataErr != KErrNone)
   195 				if (supDataErr != KErrNone)
   186 					{
   196 					{
   187 					Server().GSHInterface().Header(Server().GlobalSharedHeap()).SetLockedFlag(EFalse);
   197 					Server().GSHInterface().Header(Server().GlobalSharedHeap()).SetLockedFlag(EFalse);
       
   198 					OstTrace1(TRACE_ERROR, DUP23_CSBESESSION_SERVICEL, "Leave: %d", supDataErr);
   188 					User::Leave(supDataErr);
   199 					User::Leave(supDataErr);
   189 					}
   200 					}
   190 				break;
   201 				break;
   191 				}
   202 				}
   192 			case ESBEMsgAllSnapshotsSupplied:
   203 			case ESBEMsgAllSnapshotsSupplied:
   193 				{
   204 				{
   194         		__LOG1("CSBESession::ServiceL() - ESBEMsgAllSnapshotsSupplied for thread: %S", &threadName);
   205 				OstTraceExt1(TRACE_NORMAL, DUP15_CSBESESSION_SERVICEL, "ESBEMsgAllSnapshotsSupplied for thread: %S", threadName);
   195 				AllSnapshotsSuppliedL(aMessage);
   206 				AllSnapshotsSuppliedL(aMessage);
   196 				break;
   207 				break;
   197 				}
   208 				}
   198 			case ESBEMsgGetExpectedDataSize:
   209 			case ESBEMsgGetExpectedDataSize:
   199 				{
   210 				{
   200         		__LOG1("CSBESession::ServiceL() - ESBEMsgGetExpectedDataSize for thread: %S", &threadName);
   211 				OstTraceExt1(TRACE_NORMAL, DUP16_CSBESESSION_SERVICEL, "ESBEMsgGetExpectedDataSize for thread: %S", threadName);
   201 				GetExpectedDataSizeL(aMessage);
   212 				GetExpectedDataSizeL(aMessage);
   202 				break;
   213 				break;
   203 				}
   214 				}
   204 			case ESBEMsgAllSystemFilesRestored:
   215 			case ESBEMsgAllSystemFilesRestored:
   205 				{
   216 				{
   206         		__LOG1("CSBESession::ServiceL() - ESBEMsgAllSystemFilesRestored for thread: %S", &threadName);
   217 				OstTraceExt1(TRACE_NORMAL, DUP17_CSBESESSION_SERVICEL, "ESBEMsgAllSystemFilesRestored for thread: %S", threadName);
   207 				AllSystemFilesRestoredL();
   218 				AllSystemFilesRestoredL();
   208 				aMessage.Complete(KErrNone);
   219 				aMessage.Complete(KErrNone);
   209 				break;
   220 				break;
   210 				}
   221 				}
   211 			case ESBEMsgPrepLargePublicFiles:
   222 			case ESBEMsgPrepLargePublicFiles:
   212 				{
   223 				{
   213         		__LOG1("CSBESession::ServiceL() - ESBEMsgPrepPublicFiles for thread: %S", &threadName);
   224 				OstTraceExt1(TRACE_NORMAL, DUP18_CSBESESSION_SERVICEL, "ESBEMsgPrepPublicFiles for thread: %S", threadName);
   214 				PrepLargePublicFileListL(aMessage);
   225 				PrepLargePublicFileListL(aMessage);
   215 				break;
   226 				break;
   216 				}
   227 				}
   217 			case ESBEMsgGetLargePublicFiles:
   228 			case ESBEMsgGetLargePublicFiles:
   218 				{
   229 				{
   219         		__LOG1("CSBESession::ServiceL() - ESBEMsgGetPublicFiles for thread: %S", &threadName);
   230 				OstTraceExt1(TRACE_NORMAL, DUP19_CSBESESSION_SERVICEL, "ESBEMsgGetPublicFiles for thread: %S", threadName);
   220 				ReturnLargePublicFileListL(aMessage);
   231 				ReturnLargePublicFileListL(aMessage);
   221 				break;
   232 				break;
   222 				}
   233 				}
   223 			default:
   234 			default:
   224 				{
   235 				{
   225         		__LOG1("CSBESession::ServiceL() - UNKNOWN OP CODE for thread: %S", &threadName);
   236 				OstTraceExt1(TRACE_ERROR, DUP20_CSBESESSION_SERVICEL, "UNKNOWN OP CODE for thread: %S", threadName);
   226 				User::Leave(KErrNotSupported);
   237 				User::Leave(KErrNotSupported);
   227 				}
   238 				}
   228 			}
   239 			}
   229 
   240 
   230 		__LOG1("CSBESession::ServiceL() - Completed OK for thread: %S", &threadName);
   241 		OstTraceExt1(TRACE_NORMAL, DUP21_CSBESESSION_SERVICEL, "Completed OK for thread: %S", threadName);
       
   242 		OstTraceFunctionExit0( CSBESESSION_SERVICEL_EXIT );
   231 		}
   243 		}
   232 
   244 
   233 	inline CSBEServer& CSBESession::Server() const
   245 	inline CSBEServer& CSBESession::Server() const
   234 	/**
   246 	/**
   235 	Returns a non-cost reference to this CServer object.
   247 	Returns a non-cost reference to this CServer object.
   243 	void CSBESession::PrepDataOwnerInfoL(const RMessage2& aMessage)
   255 	void CSBESession::PrepDataOwnerInfoL(const RMessage2& aMessage)
   244 	/**
   256 	/**
   245 	Prepares the 
   257 	Prepares the 
   246 	*/
   258 	*/
   247 		{
   259 		{
       
   260 		OstTraceFunctionEntry0( CSBESESSION_PREPDATAOWNERINFOL_ENTRY );
   248 		TInt err = KErrNone;
   261 		TInt err = KErrNone;
   249 		ResetTransferBuf();
   262 		ResetTransferBuf();
   250 		RPointerArray<CDataOwnerInfo> doiArray;
   263 		RPointerArray<CDataOwnerInfo> doiArray;
   251 		TRAP(err,
   264 		TRAP(err,
   252 			{
   265 			{
   277 			); // TRAP
   290 			); // TRAP
   278 		
   291 		
   279 		doiArray.ResetAndDestroy();
   292 		doiArray.ResetAndDestroy();
   280 		doiArray.Close();
   293 		doiArray.Close();
   281 
   294 
   282 		User::LeaveIfError(err);
   295 		LEAVEIFERROR(err, OstTrace1(TRACE_ERROR, CSBESESSION_PREPDATAOWNERINFOL, "error = %d", err));
   283 		
   296 		
   284 		// complete the message with the total size of the buffer so that the 
   297 		// complete the message with the total size of the buffer so that the 
   285 		// client can create the appropriate sized descriptor for receiving the data
   298 		// client can create the appropriate sized descriptor for receiving the data
   286 		aMessage.Complete(iTransferBuf->Des().Size());
   299 		aMessage.Complete(iTransferBuf->Des().Size());
       
   300 		OstTraceFunctionExit0( CSBESESSION_PREPDATAOWNERINFOL_EXIT );
   287 		}
   301 		}
   288 		
   302 		
   289 	void CSBESession::ReturnDataOwnerInfoL(const RMessage2& aMessage)
   303 	void CSBESession::ReturnDataOwnerInfoL(const RMessage2& aMessage)
   290 	/**
   304 	/**
   291 	Return the previously populated buffer to the client
   305 	Return the previously populated buffer to the client
   292 	@param aMessage The message sent by the client to the server
   306 	@param aMessage The message sent by the client to the server
   293 	*/
   307 	*/
   294 		{
   308 		{
       
   309 		OstTraceFunctionEntry0( CSBESESSION_RETURNDATAOWNERINFOL_ENTRY );
   295 		__ASSERT_DEBUG(iTransferBuf, Panic(KErrNotFound));
   310 		__ASSERT_DEBUG(iTransferBuf, Panic(KErrNotFound));
   296 		
   311 		
   297 		// return the previously allocated transfer buffer
   312 		// return the previously allocated transfer buffer
   298 		aMessage.WriteL(0, *iTransferBuf);		
   313 		aMessage.WriteL(0, *iTransferBuf);		
   299 		aMessage.Complete(iArrayCount);
   314 		aMessage.Complete(iArrayCount);
   300 		
   315 		
   301 		ResetTransferBuf();
   316 		ResetTransferBuf();
       
   317 		OstTraceFunctionExit0( CSBESESSION_RETURNDATAOWNERINFOL_EXIT );
   302 		}
   318 		}
   303 		
   319 		
   304 	void CSBESession::PrepPublicFileListL(const RMessage2& aMessage)
   320 	void CSBESession::PrepPublicFileListL(const RMessage2& aMessage)
   305 	/**
   321 	/**
   306 	Compile a list of public files owned by a particular SID to be backed up
   322 	Compile a list of public files owned by a particular SID to be backed up
   307 	@param aMessage The message sent by the client to the server
   323 	@param aMessage The message sent by the client to the server
   308 	*/
   324 	*/
   309 		{
   325 		{
       
   326 		OstTraceFunctionEntry0( CSBESESSION_PREPPUBLICFILELISTL_ENTRY );
   310 		RFileArray fileArray;
   327 		RFileArray fileArray;
   311 		CleanupClosePushL(fileArray);
   328 		CleanupClosePushL(fileArray);
   312 		HBufC8* pGenericDataTypeBuffer = HBufC8::NewLC(aMessage.GetDesLengthL(1));
   329 		HBufC8* pGenericDataTypeBuffer = HBufC8::NewLC(aMessage.GetDesLengthL(1));
   313 		
   330 		
   314 		TPtr8 genericDataTypeBuffer(pGenericDataTypeBuffer->Des());
   331 		TPtr8 genericDataTypeBuffer(pGenericDataTypeBuffer->Des());
   327 		CleanupStack::PopAndDestroy(&fileArray);
   344 		CleanupStack::PopAndDestroy(&fileArray);
   328 
   345 
   329 		// complete the message with the total size of the buffer so that the 
   346 		// complete the message with the total size of the buffer so that the 
   330 		// client can create the appropriate sized descriptor for receiving the data
   347 		// client can create the appropriate sized descriptor for receiving the data
   331 		aMessage.Complete(iTransferBuf->Des().MaxSize());
   348 		aMessage.Complete(iTransferBuf->Des().MaxSize());
       
   349 		OstTraceFunctionExit0( CSBESESSION_PREPPUBLICFILELISTL_EXIT );
   332 		}
   350 		}
   333 		
   351 		
   334 	void CSBESession::ReturnPublicFileListL(const RMessage2& aMessage)
   352 	void CSBESession::ReturnPublicFileListL(const RMessage2& aMessage)
   335 	/** Return the previously populated buffer to the client
   353 	/** Return the previously populated buffer to the client
   336 	@param aMessage The message sent by the client to the server */
   354 	@param aMessage The message sent by the client to the server */
   337 		{
   355 		{
       
   356 		OstTraceFunctionEntry0( CSBESESSION_RETURNPUBLICFILELISTL_ENTRY );
   338 		__ASSERT_DEBUG(iTransferBuf, Panic(KErrArgument));
   357 		__ASSERT_DEBUG(iTransferBuf, Panic(KErrArgument));
   339 		
   358 		
   340 		// return the previously allocated transfer buffer
   359 		// return the previously allocated transfer buffer
   341 		aMessage.WriteL(0, *iTransferBuf);
   360 		aMessage.WriteL(0, *iTransferBuf);
   342 		
   361 		
   343 		aMessage.Complete(KErrNone);
   362 		aMessage.Complete(KErrNone);
   344 		
   363 		
   345 		ResetTransferBuf();
   364 		ResetTransferBuf();
       
   365 		OstTraceFunctionExit0( CSBESESSION_RETURNPUBLICFILELISTL_EXIT );
   346 		}
   366 		}
   347 
   367 
   348 	void CSBESession::PrepPublicFileListRawL(const RMessage2& aMessage)
   368 	void CSBESession::PrepPublicFileListRawL(const RMessage2& aMessage)
   349 	/**
   369 	/**
   350 	Compile a raw list of public files owned by a particular SID to be backed up
   370 	Compile a raw list of public files owned by a particular SID to be backed up
   351 	@param aMessage The message sent by the client to the server
   371 	@param aMessage The message sent by the client to the server
   352 	*/
   372 	*/
   353 		{
   373 		{
       
   374 		OstTraceFunctionEntry0( CSBESESSION_PREPPUBLICFILELISTRAWL_ENTRY );
   354 		RRestoreFileFilterArray fileFilterArray;
   375 		RRestoreFileFilterArray fileFilterArray;
   355 		CleanupClosePushL(fileFilterArray);
   376 		CleanupClosePushL(fileFilterArray);
   356 		TPckgBuf<TDriveNumber> driveNumPkg;
   377 		TPckgBuf<TDriveNumber> driveNumPkg;
   357 		HBufC8* pGenericDataTypeBuffer = HBufC8::NewLC(aMessage.GetDesLengthL(1));
   378 		HBufC8* pGenericDataTypeBuffer = HBufC8::NewLC(aMessage.GetDesLengthL(1));
   358 		
   379 		
   373 		CleanupStack::PopAndDestroy(&fileFilterArray);
   394 		CleanupStack::PopAndDestroy(&fileFilterArray);
   374 
   395 
   375 		// complete the message with the total size of the buffer so that the 
   396 		// complete the message with the total size of the buffer so that the 
   376 		// client can create the appropriate sized descriptor for receiving the data
   397 		// client can create the appropriate sized descriptor for receiving the data
   377 		aMessage.Complete(iTransferBuf->Des().MaxSize());
   398 		aMessage.Complete(iTransferBuf->Des().MaxSize());
       
   399 		OstTraceFunctionExit0( CSBESESSION_PREPPUBLICFILELISTRAWL_EXIT );
   378 		}
   400 		}
   379 		
   401 		
   380 	void CSBESession::ReturnPublicFileListRawL(const RMessage2& aMessage)
   402 	void CSBESession::ReturnPublicFileListRawL(const RMessage2& aMessage)
   381 	/** Return the previously populated buffer to the client
   403 	/** Return the previously populated buffer to the client
   382 	@param aMessage The message sent by the client to the server */
   404 	@param aMessage The message sent by the client to the server */
   383 		{
   405 		{
       
   406 		OstTraceFunctionEntry0( CSBESESSION_RETURNPUBLICFILELISTRAWL_ENTRY );
   384 		__ASSERT_DEBUG(iTransferBuf, Panic(KErrArgument));
   407 		__ASSERT_DEBUG(iTransferBuf, Panic(KErrArgument));
   385 		
   408 		
   386 		// return the previously allocated transfer buffer
   409 		// return the previously allocated transfer buffer
   387 		aMessage.WriteL(0, *iTransferBuf);
   410 		aMessage.WriteL(0, *iTransferBuf);
   388 		
   411 		
   389 		aMessage.Complete(KErrNone);
   412 		aMessage.Complete(KErrNone);
   390 		
   413 		
   391 		ResetTransferBuf();
   414 		ResetTransferBuf();
       
   415 		OstTraceFunctionExit0( CSBESESSION_RETURNPUBLICFILELISTRAWL_EXIT );
   392 		}
   416 		}
   393 
   417 
   394 	void CSBESession::PrepPublicFileListXMLL(const RMessage2& aMessage)
   418 	void CSBESession::PrepPublicFileListXMLL(const RMessage2& aMessage)
   395 	/**
   419 	/**
   396 	*/
   420 	*/
   397 		{
   421 		{
       
   422 		OstTraceFunctionEntry0( CSBESESSION_PREPPUBLICFILELISTXMLL_ENTRY );
   398 		TPckgBuf<TDriveNumber> driveNumPkg;
   423 		TPckgBuf<TDriveNumber> driveNumPkg;
   399 		TPckgBuf<TSecureId> sidPkg;
   424 		TPckgBuf<TSecureId> sidPkg;
   400 
   425 
   401 		ResetTransferBuf();
   426 		ResetTransferBuf();
   402 
   427 
   405 		Server().DataOwnerManager().GetXMLPublicFileListL(sidPkg(), driveNumPkg(), iTransferTextBuf);
   430 		Server().DataOwnerManager().GetXMLPublicFileListL(sidPkg(), driveNumPkg(), iTransferTextBuf);
   406 		
   431 		
   407 		iTransferBuf = HBufC8::NewL(0);
   432 		iTransferBuf = HBufC8::NewL(0);
   408 		
   433 		
   409 		aMessage.Complete(iTransferBuf->Des().MaxSize());
   434 		aMessage.Complete(iTransferBuf->Des().MaxSize());
       
   435 		OstTraceFunctionExit0( CSBESESSION_PREPPUBLICFILELISTXMLL_EXIT );
   410 		}
   436 		}
   411 		
   437 		
   412 	void CSBESession::ReturnPublicFileListXMLL(const RMessage2& aMessage)
   438 	void CSBESession::ReturnPublicFileListXMLL(const RMessage2& aMessage)
   413 	/**
   439 	/**
   414 	Return the previously populated buffer to the client
   440 	Return the previously populated buffer to the client
   415 	@param aMessage The message sent by the client to the server
   441 	@param aMessage The message sent by the client to the server
   416 	*/
   442 	*/
   417 		{
   443 		{
       
   444 		OstTraceFunctionEntry0( CSBESESSION_RETURNPUBLICFILELISTXMLL_ENTRY );
   418 		__ASSERT_DEBUG(iTransferBuf, Panic(KErrArgument));
   445 		__ASSERT_DEBUG(iTransferBuf, Panic(KErrArgument));
   419 		
   446 		
   420 		// return the previously allocated transfer buffer
   447 		// return the previously allocated transfer buffer
   421 		aMessage.WriteL(0, *iTransferTextBuf);
   448 		aMessage.WriteL(0, *iTransferTextBuf);
   422 
   449 
   423 		aMessage.Complete(KErrNone);
   450 		aMessage.Complete(KErrNone);
   424 		
   451 		
   425 		ResetTransferBuf();
   452 		ResetTransferBuf();
       
   453 		OstTraceFunctionExit0( CSBESESSION_RETURNPUBLICFILELISTXMLL_EXIT );
   426 		}
   454 		}
   427 		
   455 		
   428 	void CSBESession::SetBURModeL(const RMessage2& aMessage)
   456 	void CSBESession::SetBURModeL(const RMessage2& aMessage)
   429 	/**	
   457 	/**	
   430 	Set the Backup and Restore mode on/off and configure the BUR options
   458 	Set the Backup and Restore mode on/off and configure the BUR options
   431 
   459 
   432 	@param aMessage The message sent by the client to the server
   460 	@param aMessage The message sent by the client to the server
   433 	*/
   461 	*/
   434 		{
   462 		{
       
   463 		OstTraceFunctionEntry0( CSBESESSION_SETBURMODEL_ENTRY );
   435 		TDriveList driveList;
   464 		TDriveList driveList;
   436 		
   465 		
   437 		aMessage.ReadL(0, driveList);
   466 		aMessage.ReadL(0, driveList);
   438 		TBURPartType burType = static_cast<TBURPartType>(aMessage.Int1());
   467 		TBURPartType burType = static_cast<TBURPartType>(aMessage.Int1());
   439 		TBackupIncType incType = static_cast<TBackupIncType>(aMessage.Int2());
   468 		TBackupIncType incType = static_cast<TBackupIncType>(aMessage.Int2());
   443 		Server().GSHInterface().ResetHeap(Server().GlobalSharedHeap());
   472 		Server().GSHInterface().ResetHeap(Server().GlobalSharedHeap());
   444 
   473 
   445 		Server().DataOwnerManager().SetBURModeL(driveList, burType, incType);
   474 		Server().DataOwnerManager().SetBURModeL(driveList, burType, incType);
   446 		
   475 		
   447 		aMessage.Complete(KErrNone);
   476 		aMessage.Complete(KErrNone);
       
   477 		OstTraceFunctionExit0( CSBESESSION_SETBURMODEL_EXIT );
   448 		}
   478 		}
   449 
   479 
   450 	void CSBESession::SetSIDListForPartialBURL(const RMessage2& aMessage)
   480 	void CSBESession::SetSIDListForPartialBURL(const RMessage2& aMessage)
   451 	/**
   481 	/**
   452 	Set a list of SID's that require base backup regardless of the device backup mode
   482 	Set a list of SID's that require base backup regardless of the device backup mode
   453 	
   483 	
   454 	@param aMessage The message sent by the client to the server
   484 	@param aMessage The message sent by the client to the server
   455 	*/
   485 	*/
   456 		{
   486 		{
       
   487 		OstTraceFunctionEntry0( CSBESESSION_SETSIDLISTFORPARTIALBURL_ENTRY );
   457 		HBufC8* flatArray = HBufC8::NewLC(aMessage.GetDesLengthL(0));	
   488 		HBufC8* flatArray = HBufC8::NewLC(aMessage.GetDesLengthL(0));	
   458 		TPtr8 flatArrayPtr(flatArray->Des());
   489 		TPtr8 flatArrayPtr(flatArray->Des());
   459 		
   490 		
   460 		aMessage.ReadL(0, flatArrayPtr);
   491 		aMessage.ReadL(0, flatArrayPtr);
   461 
   492 
   462 		Server().DataOwnerManager().SetSIDListForPartialBURL(flatArrayPtr);
   493 		Server().DataOwnerManager().SetSIDListForPartialBURL(flatArrayPtr);
   463 
   494 
   464 		CleanupStack::PopAndDestroy(flatArray);
   495 		CleanupStack::PopAndDestroy(flatArray);
   465 		
   496 		
   466 		aMessage.Complete(KErrNone);
   497 		aMessage.Complete(KErrNone);
       
   498 		OstTraceFunctionExit0( CSBESESSION_SETSIDLISTFORPARTIALBURL_EXIT );
   467 		}
   499 		}
   468 
   500 
   469 	void CSBESession::PrepSIDStatusL(const RMessage2& aMessage)
   501 	void CSBESession::PrepSIDStatusL(const RMessage2& aMessage)
   470 	/**
   502 	/**
   471 	Extract the array of SID's of which the status is required
   503 	Extract the array of SID's of which the status is required
   472 	
   504 	
   473 	@param aMessage The message sent from the client to the server
   505 	@param aMessage The message sent from the client to the server
   474 	*/
   506 	*/
   475 		{
   507 		{
       
   508 		OstTraceFunctionEntry0( CSBESESSION_PREPSIDSTATUSL_ENTRY );
   476 		ResetTransferBuf();
   509 		ResetTransferBuf();
   477 		iTransferBuf = HBufC8::NewL(aMessage.GetDesLengthL(0));
   510 		iTransferBuf = HBufC8::NewL(aMessage.GetDesLengthL(0));
   478 		
   511 		
   479 		TPtr8 transBuf(iTransferBuf->Des());
   512 		TPtr8 transBuf(iTransferBuf->Des());
   480 		// Copy the IPC'd buffer into our transfer buffer
   513 		// Copy the IPC'd buffer into our transfer buffer
   481 		aMessage.ReadL(0, transBuf);
   514 		aMessage.ReadL(0, transBuf);
   482 		
   515 		
   483 		aMessage.Complete(KErrNone);
   516 		aMessage.Complete(KErrNone);
       
   517 		OstTraceFunctionExit0( CSBESESSION_PREPSIDSTATUSL_EXIT );
   484 		}
   518 		}
   485 		
   519 		
   486 	void CSBESession::ReturnSIDStatusL(const RMessage2& aMessage)
   520 	void CSBESession::ReturnSIDStatusL(const RMessage2& aMessage)
   487 	/**
   521 	/**
   488 	Populate and return the array of SID's complete with their statuses
   522 	Populate and return the array of SID's complete with their statuses
   489 	
   523 	
   490 	@param aMessage The message sent from the client to the server
   524 	@param aMessage The message sent from the client to the server
   491 	*/
   525 	*/
   492 		{
   526 		{
       
   527 		OstTraceFunctionEntry0( CSBESESSION_RETURNSIDSTATUSL_ENTRY );
   493 		RSIDStatusArray* pStatusArray = RSIDStatusArray::InternaliseL(*iTransferBuf);
   528 		RSIDStatusArray* pStatusArray = RSIDStatusArray::InternaliseL(*iTransferBuf);
   494 		CleanupStack::PushL(pStatusArray);
   529 		CleanupStack::PushL(pStatusArray);
   495 		CleanupClosePushL(*pStatusArray);
   530 		CleanupClosePushL(*pStatusArray);
   496 		
   531 		
   497 		// We're finished with the received externalised SIDStatusArray for now, delete it
   532 		// We're finished with the received externalised SIDStatusArray for now, delete it
   506 		
   541 		
   507 		aMessage.WriteL(0, *iTransferBuf);		
   542 		aMessage.WriteL(0, *iTransferBuf);		
   508 		aMessage.Complete(KErrNone);
   543 		aMessage.Complete(KErrNone);
   509 
   544 
   510 		ResetTransferBuf();
   545 		ResetTransferBuf();
       
   546 		OstTraceFunctionExit0( CSBESESSION_RETURNSIDSTATUSL_EXIT );
   511 		}
   547 		}
   512 		
   548 		
   513 	void CSBESession::RequestDataAsyncL(const RMessage2& aMessage)
   549 	void CSBESession::RequestDataAsyncL(const RMessage2& aMessage)
   514 	/**
   550 	/**
   515 	Handle the client's asynchronous request for data from the SBE
   551 	Handle the client's asynchronous request for data from the SBE
   516 	*/
   552 	*/
   517 		{
   553 		{
       
   554 		OstTraceFunctionEntry0( CSBESESSION_REQUESTDATAASYNCL_ENTRY );
   518 		iMessage = aMessage;
   555 		iMessage = aMessage;
   519 		
   556 		
   520         __LOG("CSBESession::RequestDataAsyncL() - START");
       
   521 		TBool finished = EFalse;	// Set by DOM, initialised to eliminate warning
   557 		TBool finished = EFalse;	// Set by DOM, initialised to eliminate warning
   522 		HBufC8* pTransferredBuf = HBufC8::NewLC(iMessage.GetDesLengthL(0));
   558 		HBufC8* pTransferredBuf = HBufC8::NewLC(iMessage.GetDesLengthL(0));
   523 		
   559 		
   524 		TPtr8 transBuf(pTransferredBuf->Des());
   560 		TPtr8 transBuf(pTransferredBuf->Des());
   525 		// Copy the IPC'd buffer into our transfer buffer
   561 		// Copy the IPC'd buffer into our transfer buffer
   540 		Server().DataOwnerManager().RequestDataL(pGenericType, writeBuf, finished);
   576 		Server().DataOwnerManager().RequestDataL(pGenericType, writeBuf, finished);
   541 		
   577 		
   542 		CleanupStack::PopAndDestroy(pGenericType);
   578 		CleanupStack::PopAndDestroy(pGenericType);
   543 		
   579 		
   544 		Server().GSHInterface().Header(Server().GlobalSharedHeap()).iFinished = finished;
   580 		Server().GSHInterface().Header(Server().GlobalSharedHeap()).iFinished = finished;
   545         __LOG2("CSBESession::RequestDataAsyncL() - Server-side data length: %d, address: 0x%08x", writeBuf.Length(), writeBuf.Ptr());
   581 		OstTraceExt2(TRACE_NORMAL, CSBESESSION_REQUESTDATAASYNCL, "Server-side data length: %d, address: 0x%08x", static_cast<TInt32>(writeBuf.Length()), reinterpret_cast<TInt32>(writeBuf.Ptr()));
   546         //__LOGDATA("CSBESession::RequestDataAsyncL() -       %S", writeBuf.Ptr(), writeBuf.Length());
       
   547 
   582 
   548 		Server().GSHInterface().Header(Server().GlobalSharedHeap()).SetLockedFlag(EFalse);
   583 		Server().GSHInterface().Header(Server().GlobalSharedHeap()).SetLockedFlag(EFalse);
   549 		
   584 		
   550 		if (!iMessage.IsNull())
   585 		if (!iMessage.IsNull())
   551 			{
   586 			{
   552 			iMessage.Complete(KErrNone);
   587 			iMessage.Complete(KErrNone);
   553 			}
   588 			}
   554 		
   589 		
   555         __LOG("CSBESession::RequestDataAsyncL() - END");
   590 		OstTraceFunctionExit0( CSBESESSION_REQUESTDATAASYNCL_EXIT );
   556 		}
   591 		}
   557 		
   592 		
   558 	void CSBESession::RequestDataSyncL(const RMessage2& aMessage)
   593 	void CSBESession::RequestDataSyncL(const RMessage2& aMessage)
   559 	/**
   594 	/**
   560 	Handle the client's synchronous request for data from the SBE
   595 	Handle the client's synchronous request for data from the SBE
   561 	*/
   596 	*/
   562 		{
   597 		{
   563         __LOG("CSBESession::RequestDataSyncL() - START");
   598         OstTraceFunctionEntry0( CSBESESSION_REQUESTDATASYNCL_ENTRY );
       
   599         
   564 		TBool finished = EFalse;	// Set by DOM, initialised to eliminate warning
   600 		TBool finished = EFalse;	// Set by DOM, initialised to eliminate warning
   565 		HBufC8* pTransferredBuf = HBufC8::NewLC(aMessage.GetDesLengthL(0));
   601 		HBufC8* pTransferredBuf = HBufC8::NewLC(aMessage.GetDesLengthL(0));
   566 		
   602 		
   567 		TPtr8 transBuf(pTransferredBuf->Des());
   603 		TPtr8 transBuf(pTransferredBuf->Des());
   568 		// Copy the IPC'd buffer into our transfer buffer
   604 		// Copy the IPC'd buffer into our transfer buffer
   585 		CleanupStack::PopAndDestroy(pGenericType);
   621 		CleanupStack::PopAndDestroy(pGenericType);
   586 		
   622 		
   587 		Server().GSHInterface().Header(Server().GlobalSharedHeap()).iFinished = finished;
   623 		Server().GSHInterface().Header(Server().GlobalSharedHeap()).iFinished = finished;
   588 
   624 
   589 		Server().GSHInterface().Header(Server().GlobalSharedHeap()).SetLockedFlag(EFalse);
   625 		Server().GSHInterface().Header(Server().GlobalSharedHeap()).SetLockedFlag(EFalse);
   590         __LOG2("CSBESession::RequestDataSyncL() - Server-side data length: %d, address: 0x%08x", writeBuf.Length(), writeBuf.Ptr());
   626 		OstTraceExt2(TRACE_NORMAL, CSBESESSION_REQUESTDATASYNCL, "Server-side data length: %d, address: 0x%08x", static_cast<TInt32>(writeBuf.Length()), reinterpret_cast<TInt32>(writeBuf.Ptr()));
   591         //__LOGDATA("CSBESession::RequestDataSyncL()        - %S", writeBuf.Ptr(), writeBuf.Length());
   627 
   592 
   628 		aMessage.Complete(KErrNone);
   593 		aMessage.Complete(KErrNone);
   629         
   594         __LOG("CSBESession::RequestDataSyncL() - END");
   630 		OstTraceFunctionExit0( CSBESESSION_REQUESTDATASYNCL_EXIT );
   595 		}
   631 		}
   596 	
   632 	
   597 	void CSBESession::SupplyDataSyncL(const RMessage2& aMessage)
   633 	void CSBESession::SupplyDataSyncL(const RMessage2& aMessage)
   598 	/**
   634 	/**
   599 	Handle the client's synchronous request to supply data to the SBE
   635 	Handle the client's synchronous request to supply data to the SBE
   600 	*/
   636 	*/
   601 		{
   637 		{
   602         __LOG("CSBESession::SupplyDataSyncL() - START");
   638         OstTraceFunctionEntry0( CSBESESSION_SUPPLYDATASYNCL_ENTRY );
       
   639         
   603 		TBool finished = aMessage.Int0();
   640 		TBool finished = aMessage.Int0();
   604 
   641 
   605 		CSBGenericTransferType* pGenericType = CSBGenericTransferType::NewL(
   642 		CSBGenericTransferType* pGenericType = CSBGenericTransferType::NewL(
   606 			Server().GSHInterface().Header(Server().GlobalSharedHeap())
   643 			Server().GSHInterface().Header(Server().GlobalSharedHeap())
   607 			.GenericTransferTypeBuffer());
   644 			.GenericTransferTypeBuffer());
   608 		CleanupStack::PushL(pGenericType);
   645 		CleanupStack::PushL(pGenericType);
   609 
   646 
   610 		TPtrC8& readBuf = Server().GSHInterface().ReadBufferL(Server().GlobalSharedHeap());
   647 		TPtrC8& readBuf = Server().GSHInterface().ReadBufferL(Server().GlobalSharedHeap());
   611 
   648 
   612 		Server().GSHInterface().Header(Server().GlobalSharedHeap()).SetLockedFlag(ETrue);
   649 		Server().GSHInterface().Header(Server().GlobalSharedHeap()).SetLockedFlag(ETrue);
   613         __LOG2("CSBESession::SupplyDataSyncL() - Server-side data length: %d, address: 0x%08x", readBuf.Length(), readBuf.Ptr());
   650 		OstTraceExt2(TRACE_NORMAL, CSBESESSION_SUPPLYDATASYNCL, "Server-side data length: %d, address: 0x%08x", static_cast<TInt32>(readBuf.Length()), reinterpret_cast<TInt32>(readBuf.Ptr()));
   614         //__LOGDATA("CSBESession::SupplyDataSyncL()         - %S", readBuf.Ptr(), readBuf.Length());
       
   615 
   651 
   616 		Server().DataOwnerManager().SupplyDataL(pGenericType, readBuf, finished);
   652 		Server().DataOwnerManager().SupplyDataL(pGenericType, readBuf, finished);
   617 
   653 
   618 		
   654 		
   619 		CleanupStack::PopAndDestroy(pGenericType);
   655 		CleanupStack::PopAndDestroy(pGenericType);
   620 
   656 
   621 		Server().GSHInterface().Header(Server().GlobalSharedHeap()).SetLockedFlag(EFalse);
   657 		Server().GSHInterface().Header(Server().GlobalSharedHeap()).SetLockedFlag(EFalse);
   622 
   658 
   623 		aMessage.Complete(KErrNone);
   659 		aMessage.Complete(KErrNone);
   624         __LOG("CSBESession::SupplyDataSyncL() - END");
   660         
       
   661 		OstTraceFunctionExit0( CSBESESSION_SUPPLYDATASYNCL_EXIT );
   625 		}
   662 		}
   626 		
   663 		
   627 	void CSBESession::GetExpectedDataSizeL(const RMessage2& aMessage)
   664 	void CSBESession::GetExpectedDataSizeL(const RMessage2& aMessage)
   628 	/**
   665 	/**
   629 	Return the size of data that the DOM expects to send back to the PC
   666 	Return the size of data that the DOM expects to send back to the PC
   630 	*/
   667 	*/
   631 		{
   668 		{
       
   669 		OstTraceFunctionEntry0( CSBESESSION_GETEXPECTEDDATASIZEL_ENTRY );
   632 		TUint size;
   670 		TUint size;
   633 		TPckg<TUint> sizePkg(size);
   671 		TPckg<TUint> sizePkg(size);
   634 
   672 
   635 		TInt bufferLen = aMessage.GetDesLengthL(0);
   673 		TInt bufferLen = aMessage.GetDesLengthL(0);
   636 		HBufC8* transTypeBuf = HBufC8::NewL(bufferLen);
   674 		HBufC8* transTypeBuf = HBufC8::NewL(bufferLen);
   649 		CleanupStack::PopAndDestroy(pGenericType);	
   687 		CleanupStack::PopAndDestroy(pGenericType);	
   650 	
   688 	
   651 		aMessage.WriteL(1, sizePkg);
   689 		aMessage.WriteL(1, sizePkg);
   652 
   690 
   653 		aMessage.Complete(KErrNone);
   691 		aMessage.Complete(KErrNone);
       
   692 		OstTraceFunctionExit0( CSBESESSION_GETEXPECTEDDATASIZEL_EXIT );
   654 		}
   693 		}
   655 		
   694 		
   656 	void CSBESession::AllSnapshotsSuppliedL(const RMessage2& aMessage)
   695 	void CSBESession::AllSnapshotsSuppliedL(const RMessage2& aMessage)
   657 	/**
   696 	/**
   658 	*/
   697 	*/
   659 		{
   698 		{
       
   699 		OstTraceFunctionEntry0( CSBESESSION_ALLSNAPSHOTSSUPPLIEDL_ENTRY );
   660 		Server().DataOwnerManager().AllSnapshotsSuppliedL();
   700 		Server().DataOwnerManager().AllSnapshotsSuppliedL();
   661 
   701 
   662 		aMessage.Complete(KErrNone);
   702 		aMessage.Complete(KErrNone);
       
   703 		OstTraceFunctionExit0( CSBESESSION_ALLSNAPSHOTSSUPPLIEDL_EXIT );
   663 		}
   704 		}
   664 		
   705 		
   665 	void CSBESession::AllSystemFilesRestoredL()
   706 	void CSBESession::AllSystemFilesRestoredL()
   666 	/**
   707 	/**
   667 	Sent by the client to indicate that all registration files 
   708 	Sent by the client to indicate that all registration files 
   668 	@param aMessage IPC message sent from the client
   709 	@param aMessage IPC message sent from the client
   669 	*/
   710 	*/
   670 		{
   711 		{
       
   712 		OstTraceFunctionEntry0( CSBESESSION_ALLSYSTEMFILESRESTOREDL_ENTRY );
   671 		Server().DataOwnerManager().AllSystemFilesRestoredL();
   713 		Server().DataOwnerManager().AllSystemFilesRestoredL();
       
   714 		OstTraceFunctionExit0( CSBESESSION_ALLSYSTEMFILESRESTOREDL_EXIT );
   672 		}
   715 		}
   673 
   716 
   674 	void CSBESession::PrepLargePublicFileListL(const RMessage2& aMessage)
   717 	void CSBESession::PrepLargePublicFileListL(const RMessage2& aMessage)
   675 	/**
   718 	/**
   676 	Compile a list of public files owned by a particular SID to be backed up
   719 	Compile a list of public files owned by a particular SID to be backed up
   677 	@param aMessage The message sent by the client to the server
   720 	@param aMessage The message sent by the client to the server
   678 	*/
   721 	*/
   679 		{
   722 		{
       
   723 		OstTraceFunctionEntry0( CSBESESSION_PREPLARGEPUBLICFILELISTL_ENTRY );
   680 		HBufC8* pGenericDataTypeBuffer = HBufC8::NewLC(aMessage.GetDesLengthL(1));		
   724 		HBufC8* pGenericDataTypeBuffer = HBufC8::NewLC(aMessage.GetDesLengthL(1));		
   681 		TPtr8 genericDataTypeBuffer(pGenericDataTypeBuffer->Des());
   725 		TPtr8 genericDataTypeBuffer(pGenericDataTypeBuffer->Des());
   682 		
   726 		
   683 		TDriveNumber drive = static_cast<TDriveNumber>(aMessage.Int0());
   727 		TDriveNumber drive = static_cast<TDriveNumber>(aMessage.Int0());
   684 		aMessage.ReadL(1, genericDataTypeBuffer);
   728 		aMessage.ReadL(1, genericDataTypeBuffer);
   719 				CleanupStack::PopAndDestroy(java);
   763 				CleanupStack::PopAndDestroy(java);
   720 				break;
   764 				break;
   721 				}
   765 				}
   722 			default:
   766 			default:
   723 				{
   767 				{
   724 				__LOG1("Unknown generic data type supplied, leaving with KErrUnknown (%d)", KErrUnknown);
   768 				OstTrace1(TRACE_ERROR, CSBESESSION_PREPLARGEPUBLICFILELISTL, "Unknown generic data type supplied, leaving with KErrUnknown (%d)", KErrUnknown);
   725 				User::Leave(KErrUnknown);
   769 				User::Leave(KErrUnknown);
   726 				}
   770 				}
   727 			}
   771 			}
   728 		CleanupStack::PushL(transType);
   772 		CleanupStack::PushL(transType);
   729 		
   773 		
   732 		Server().GSHInterface().Header(Server().GlobalSharedHeap()).SetLockedFlag(ETrue);
   776 		Server().GSHInterface().Header(Server().GlobalSharedHeap()).SetLockedFlag(ETrue);
   733 		Server().GSHInterface().Header(Server().GlobalSharedHeap()).GenericTransferTypeBuffer() = transType->Externalise();
   777 		Server().GSHInterface().Header(Server().GlobalSharedHeap()).GenericTransferTypeBuffer() = transType->Externalise();
   734 
   778 
   735 		// This is required to look up the MIME type of the file entry and convert it into a textual representation	
   779 		// This is required to look up the MIME type of the file entry and convert it into a textual representation	
   736 		RApaLsSession apaSession;
   780 		RApaLsSession apaSession;
   737 		User::LeaveIfError(apaSession.Connect());
   781 		TInt err = apaSession.Connect();
       
   782 		LEAVEIFERROR(err, OstTrace1(TRACE_ERROR, DUP2_CSBESESSION_PREPLARGEPUBLICFILELISTL, "error = %d", err));
   738 		CleanupClosePushL(apaSession);
   783 		CleanupClosePushL(apaSession);
   739 
   784 
   740 		// Copy file entries from the cursor until either the end of the list is reached or the 
   785 		// Copy file entries from the cursor until either the end of the list is reached or the 
   741 		// max response size ceiling is reached. Store the number added for the call to ReturnLargePublicFileListL
   786 		// max response size ceiling is reached. Store the number added for the call to ReturnLargePublicFileListL
   742 		iFinished = EFalse;
   787 		iFinished = EFalse;
   792 				iFinished = ETrue;
   837 				iFinished = ETrue;
   793 				break;					
   838 				break;					
   794 				}
   839 				}
   795 			}
   840 			}
   796 		CleanupStack::PopAndDestroy(&apaSession);
   841 		CleanupStack::PopAndDestroy(&apaSession);
   797         __LOG2("CSBESession::PrepLargePublicFileListL() - Server-side data length: %d, address: 0x%08x", writeBuf.Length(), writeBuf.Ptr());
   842 		OstTraceExt2(TRACE_NORMAL, DUP1_CSBESESSION_PREPLARGEPUBLICFILELISTL, "Server-side data length: %d, address: 0x%08x", static_cast<TInt32>(writeBuf.Length()), reinterpret_cast<TInt32>(writeBuf.Ptr()));
   798 		
   843 		
   799 		Server().GSHInterface().Header(Server().GlobalSharedHeap()).iFinished = iFinished;
   844 		Server().GSHInterface().Header(Server().GlobalSharedHeap()).iFinished = iFinished;
   800 
   845 
   801 		Server().GSHInterface().Header(Server().GlobalSharedHeap()).SetLockedFlag(EFalse);
   846 		Server().GSHInterface().Header(Server().GlobalSharedHeap()).SetLockedFlag(EFalse);
   802 
   847 
   803 		CleanupStack::PopAndDestroy(transType);
   848 		CleanupStack::PopAndDestroy(transType);
   804 		CleanupStack::PopAndDestroy(pGenericDataType);
   849 		CleanupStack::PopAndDestroy(pGenericDataType);
   805 
   850 
   806 		aMessage.Complete(KErrNone);
   851 		aMessage.Complete(KErrNone);
       
   852 		OstTraceFunctionExit0( CSBESESSION_PREPLARGEPUBLICFILELISTL_EXIT );
   807 		}
   853 		}
   808 		
   854 		
   809 	void CSBESession::ReturnLargePublicFileListL(const RMessage2& aMessage)
   855 	void CSBESession::ReturnLargePublicFileListL(const RMessage2& aMessage)
   810 	/** Return the previously populated buffer to the client
   856 	/** Return the previously populated buffer to the client
   811 	@param aMessage The message sent by the client to the server */
   857 	@param aMessage The message sent by the client to the server */
   812 		{
   858 		{
       
   859 		OstTraceFunctionEntry0( CSBESESSION_RETURNLARGEPUBLICFILELISTL_ENTRY );
   813 		TPckg<TBool> finPkg(iFinished);
   860 		TPckg<TBool> finPkg(iFinished);
   814 		TPckg<TInt> totalPkg(iTotalEntries);
   861 		TPckg<TInt> totalPkg(iTotalEntries);
   815 		aMessage.WriteL(0, finPkg);
   862 		aMessage.WriteL(0, finPkg);
   816 		aMessage.WriteL(1, totalPkg);
   863 		aMessage.WriteL(1, totalPkg);
   817 		aMessage.Complete(KErrNone);
   864 		aMessage.Complete(KErrNone);
       
   865 		OstTraceFunctionExit0( CSBESESSION_RETURNLARGEPUBLICFILELISTL_EXIT );
   818 		}
   866 		}
   819 				
   867 				
   820 	void CSBESession::ResetTransferBuf()
   868 	void CSBESession::ResetTransferBuf()
   821 	/**
   869 	/**
   822 	*/
   870 	*/
   823 		{
   871 		{
       
   872 		OstTraceFunctionEntry0( CSBESESSION_RESETTRANSFERBUF_ENTRY );
   824 		if (iTransferBuf != NULL)
   873 		if (iTransferBuf != NULL)
   825 			{
   874 			{
   826 			delete iTransferBuf;
   875 			delete iTransferBuf;
   827 			iTransferBuf = NULL;
   876 			iTransferBuf = NULL;
   828 			}
   877 			}
   832 			delete iTransferTextBuf;
   881 			delete iTransferTextBuf;
   833 			iTransferTextBuf = NULL;	
   882 			iTransferTextBuf = NULL;	
   834 			}
   883 			}
   835 			
   884 			
   836 		iArrayCount = 0;
   885 		iArrayCount = 0;
       
   886 		OstTraceFunctionExit0( CSBESESSION_RESETTRANSFERBUF_EXIT );
   837 		}
   887 		}
   838 	}
   888 	}