|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Implementation of CABSession class. |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 */ |
|
21 |
|
22 #include <e32base.h> |
|
23 #include "abserver.h" |
|
24 #include "absession.h" |
|
25 #include <connect/abclientserver.h> |
|
26 #include "sbedataownermanager.h" |
|
27 #include "sbedataowner.h" |
|
28 #include <connect/sbtypes.h> |
|
29 #include <connect/panic.h> |
|
30 #include "sblog.h" |
|
31 |
|
32 namespace conn |
|
33 { |
|
34 CABSession* CABSession::NewL(TSecureId aSecureId) |
|
35 /** |
|
36 Symbian first phase constructor |
|
37 |
|
38 @param aSecureId The SID of the client that's connecting to this session |
|
39 */ |
|
40 { |
|
41 CABSession* self = new (ELeave) CABSession(aSecureId); |
|
42 CleanupStack::PushL(self); |
|
43 self->ConstructL(); |
|
44 CleanupStack::Pop(self); |
|
45 return self; |
|
46 } |
|
47 |
|
48 void CABSession::ConstructL() |
|
49 /** |
|
50 Symbian second phase constructor. Initialise some more of the data members |
|
51 */ |
|
52 { |
|
53 iActiveSchedulerWait = new (ELeave) CActiveSchedulerWait; |
|
54 __LOG1("CABSession::ConstructL() [0x%08x]", iClientSID.iId); |
|
55 } |
|
56 |
|
57 CABSession::CABSession(TSecureId aSecureId) : iClientSID(aSecureId), |
|
58 iCallbackWatchdog(NULL), iActiveSchedulerWait(NULL), iABClientLeaveCode(KErrNone), |
|
59 iReceiveFromClientFinished(ETrue), iSendToClientBuffer(NULL, 0), |
|
60 iWatchdogHandler(ABSessionStaticWatchdogCaller, static_cast<TAny*>(this)), iMisbehavingClient(EFalse), |
|
61 iInvalid(EFalse) |
|
62 /** |
|
63 Class Constructor |
|
64 |
|
65 @param aSecureId The SID of the client that's connecting to this session |
|
66 */ |
|
67 { |
|
68 } |
|
69 |
|
70 CDataOwner& CABSession::DataOwnerL() const |
|
71 /** |
|
72 Return the active data owner |
|
73 |
|
74 @return A reference to the active data owner |
|
75 */ |
|
76 { |
|
77 return Server().DataOwnerManager().DataOwnerL(iClientSID); |
|
78 } |
|
79 |
|
80 TInt CABSession::ABSessionStaticWatchdogCaller(TAny* aWatchdoggingObject) |
|
81 /** |
|
82 CPeriodic only accepts a TCallBack style function pointer which must be a pointer to a static or |
|
83 non-member function. As we need to have watchdogs per session object instead of per class, we |
|
84 must make the call to the particular object from within this static method. |
|
85 |
|
86 @param aWatchdoggingObject CABSession* to the object that watchdogged |
|
87 @return Any error code - enforced return, not necessarily used by this function |
|
88 @see TCallBack |
|
89 */ |
|
90 { |
|
91 return (static_cast<CABSession*>(aWatchdoggingObject))->WatchdogExpired(); |
|
92 } |
|
93 |
|
94 TInt CABSession::WatchdogExpired() |
|
95 /** |
|
96 Called by ABSessionStaticWatchdogCaller to indicate that the watchdog has expired on this particular |
|
97 session as a result of the callback not being returned from by the client |
|
98 |
|
99 @return An error code |
|
100 */ |
|
101 { |
|
102 __LOG1("CABSession::WatchdogExpired() - [0x%08x] Watchdog expired on session", iClientSID.iId); |
|
103 |
|
104 iMisbehavingClient = ETrue; // Flag the client as having not responded |
|
105 |
|
106 // Inform the Data Owner of the new status |
|
107 TRAP_IGNORE(DataOwnerL().SetReadyState(EDataOwnerFailed)); |
|
108 |
|
109 if (iActiveSchedulerWait->IsStarted()) |
|
110 { |
|
111 iABClientLeaveCode = KErrTimedOut; |
|
112 ReturnFromCallback(); |
|
113 } |
|
114 else |
|
115 { |
|
116 // We should never get here - only a callback call should time out |
|
117 Panic(KErrTimedOut); |
|
118 } |
|
119 |
|
120 return KErrTimedOut; |
|
121 } |
|
122 |
|
123 TBool CABSession::ConfirmedReadyForBUR() const |
|
124 /** Accessor to get the state from an already existing connection |
|
125 |
|
126 @return ETrue if the active client has previously confirmed that it's ready for a backup or restore |
|
127 */ |
|
128 { |
|
129 return iConfirmedReadyForBUR; |
|
130 } |
|
131 |
|
132 TBool CABSession::CallbackInterfaceAvailable() const |
|
133 /** Accessor to indicate whether or not the client has enabled the callback interface or not |
|
134 |
|
135 @return ETrue if the callback interface is available |
|
136 */ |
|
137 { |
|
138 return !iMessage.IsNull(); |
|
139 } |
|
140 |
|
141 CABSession::~CABSession() |
|
142 /** |
|
143 Class destructor |
|
144 */ |
|
145 { |
|
146 __LOG1("~CABSession for sid:0x%08x", iClientSID.iId); |
|
147 delete iCallbackWatchdog; |
|
148 iCallbackWatchdog = NULL; |
|
149 |
|
150 // Remove this session from the server's session map |
|
151 Server().RemoveElement(iClientSID); |
|
152 |
|
153 // Clear up any outstanding message |
|
154 HandleIPCClosingDownCallback(); |
|
155 |
|
156 delete iActiveSchedulerWait; |
|
157 |
|
158 // |
|
159 // If the client has detached properly, they should |
|
160 // have done this - but just in case. |
|
161 //DoCancelWaitForCallback(); |
|
162 Server().DropSession(); |
|
163 } |
|
164 |
|
165 void CABSession::CreateL() |
|
166 /** |
|
167 Creates a connection between active backup server and the active backup session. |
|
168 Increments the server's session count |
|
169 */ |
|
170 { |
|
171 // |
|
172 // Increase the servers session count. |
|
173 Server().AddSession(); |
|
174 } |
|
175 |
|
176 void CABSession::RestoreCompleteL(TDriveNumber aDriveNumber) |
|
177 /** |
|
178 Signal the client that the restore operation is complete |
|
179 |
|
180 @param aDriveNumber The drive that has finished being backed up |
|
181 */ |
|
182 { |
|
183 MakeCallbackRestoreCompleteL(aDriveNumber); |
|
184 } |
|
185 |
|
186 void CABSession::AllSnapshotsSuppliedL() |
|
187 /** |
|
188 Lets the session know that all snapshots have been supplied. |
|
189 |
|
190 */ |
|
191 { |
|
192 MakeCallbackAllSnapshotsSuppliedL(); |
|
193 } |
|
194 |
|
195 void CABSession::GetExpectedDataSizeL(TDriveNumber aDriveNumber, TUint& aSize) |
|
196 /** |
|
197 Get the expected data size from the active backup client |
|
198 |
|
199 @param aDriveNumber The drive number of the data |
|
200 @param aSize Upon exit, this parameter will indicate the expected data size |
|
201 */ |
|
202 { |
|
203 aSize = MakeCallbackGetExpectedDataSizeL(aDriveNumber); |
|
204 } |
|
205 |
|
206 void CABSession::SupplyDataL(TDriveNumber aDriveNumber, TTransferDataType aTransferType, TDesC8& aBuffer, |
|
207 TBool aLastSection, TBool aSuppressInitDataOwner, TSecureId aProxySID) |
|
208 /** |
|
209 Supply data to the active backup client |
|
210 |
|
211 @param aDriveNumber The drive number of the data |
|
212 @param aTransferType Specifies the type of data to get the expected data size of |
|
213 @param aBuffer The data to send to the Active Backup Client |
|
214 @param aLastSection Specifies whether or not additional SupplyDataL calls will be made (multi-part) |
|
215 @param aSuppressInitDataOwner Suppress the initialisation of Data Owner |
|
216 @param aProxySID The secure ID of the proxy |
|
217 */ |
|
218 { |
|
219 TInt dataSizeTransferred = 0; |
|
220 TInt remainingBlockSize = 0; |
|
221 TBool lastSection; |
|
222 TPtrC8 transferBlock; |
|
223 |
|
224 // Repeat the data transfer until all data has been sent |
|
225 while (dataSizeTransferred < aBuffer.Size()) |
|
226 { |
|
227 remainingBlockSize = aBuffer.Size() - dataSizeTransferred; |
|
228 |
|
229 if (remainingBlockSize > KIPCMessageSize) |
|
230 { |
|
231 remainingBlockSize = KIPCMessageSize; |
|
232 lastSection = EFalse; |
|
233 } |
|
234 else |
|
235 { |
|
236 lastSection = aLastSection; |
|
237 } |
|
238 |
|
239 // Create a temporary descriptor representing the next block to send |
|
240 transferBlock.Set(aBuffer.Mid(dataSizeTransferred, remainingBlockSize)); |
|
241 |
|
242 dataSizeTransferred += transferBlock.Size(); |
|
243 |
|
244 // If we're sending |
|
245 if ((transferBlock.Size() <= KIPCMessageSize) && (dataSizeTransferred != aBuffer.Size())) |
|
246 { |
|
247 lastSection = EFalse; |
|
248 } |
|
249 else |
|
250 { |
|
251 lastSection = aLastSection; |
|
252 } |
|
253 |
|
254 __LOG2("CABSession::SupplyDataL() - [0x%08x] Supplying data to ABClient, %d bytes transferred", iClientSID.iId, dataSizeTransferred); |
|
255 |
|
256 switch(aTransferType) |
|
257 { |
|
258 case EActiveSnapshotData: |
|
259 { |
|
260 MakeCallbackReceiveSnapshotDataL(aDriveNumber, transferBlock, lastSection); |
|
261 } break; |
|
262 case EActiveBaseData: |
|
263 { |
|
264 if (!aSuppressInitDataOwner) |
|
265 { |
|
266 if (aProxySID != KNullABSid) |
|
267 { |
|
268 MakeCallbackInitialiseRestoreProxyBaseDataL(aProxySID, aDriveNumber); |
|
269 } |
|
270 else |
|
271 { |
|
272 MakeCallbackInitialiseRestoreBaseDataL(aDriveNumber); |
|
273 } |
|
274 } |
|
275 MakeCallbackRestoreBaseDataSectionL(transferBlock, lastSection); |
|
276 } break; |
|
277 case EActiveIncrementalData: |
|
278 { |
|
279 if (!aSuppressInitDataOwner) |
|
280 { |
|
281 MakeCallbackInitialiseRestoreIncrementDataL(aDriveNumber); |
|
282 } |
|
283 MakeCallbackRestoreIncrementDataSectionL(transferBlock, lastSection); |
|
284 } break; |
|
285 default: |
|
286 { |
|
287 User::Leave(KErrNotSupported); |
|
288 } |
|
289 } |
|
290 |
|
291 // Even if we were supposed to suppress it first time round, for a multipart supply, it |
|
292 // shouldn't be sent again |
|
293 aSuppressInitDataOwner = ETrue; |
|
294 } |
|
295 } |
|
296 |
|
297 void CABSession::RequestDataL(TDriveNumber aDriveNumber, TTransferDataType aTransferType, TPtr8& aBuffer, |
|
298 TBool& aLastSection, TBool aSuppressInitDataOwner, TSecureId aProxySID) |
|
299 /** |
|
300 Request data from the active backup client |
|
301 |
|
302 @param aDriveNumber The drive number of the data |
|
303 @param aTransferType Specifies the type of data to get the expected data size of |
|
304 @param aBuffer This buffer will be filled by the Active Backup Client upon return |
|
305 @param aLastSection Upon return indicates whether or not additional RequestDataL calls will be made (multi-part) |
|
306 @param aSuppressInitDataOwner Suppress the initialisation of Data Owner |
|
307 @param aProxySID The secure ID of the proxy |
|
308 */ |
|
309 { |
|
310 __LOG5("CABSession::RequestDataL() - START - aDrive: %c, aTType: %d, aBuffer.Ptr(): 0x%08x, aBuffer.Length(): %d, aProxySID: 0x%08x", |
|
311 aDriveNumber + 'A', aTransferType, aBuffer.Ptr(), aBuffer.Length(), aProxySID.iId ); |
|
312 |
|
313 TInt dataSizeTransferred = 0; |
|
314 TInt remainingBlockSize = 0; |
|
315 TBool lastSection = EFalse; |
|
316 TPtr8 transferBlock(NULL, 0); |
|
317 |
|
318 // While there is space left in aBuffer and the client hasn't finished, keep requesting data |
|
319 do |
|
320 { |
|
321 // Set max for the MidTPtr call to work. Length of this buffer is reset after each data transfer |
|
322 aBuffer.SetMax(); |
|
323 |
|
324 remainingBlockSize = aBuffer.MaxSize() - dataSizeTransferred; |
|
325 __LOG2("CABSession::RequestDataL() - dataSizeTransferred: %d, remainingBlockSize: %d", dataSizeTransferred, remainingBlockSize); |
|
326 |
|
327 if (remainingBlockSize > KIPCMessageSize) |
|
328 { |
|
329 remainingBlockSize = KIPCMessageSize; |
|
330 } |
|
331 |
|
332 transferBlock.Set(aBuffer.MidTPtr(dataSizeTransferred, remainingBlockSize)); |
|
333 __LOG2("CABSession::RequestDataL() - transferBlock: 0x%08x (%d)", transferBlock.Ptr(), transferBlock.Length()); |
|
334 |
|
335 switch(aTransferType) |
|
336 { |
|
337 case EActiveSnapshotData: |
|
338 { |
|
339 MakeCallbackGetSnapshotDataL(aDriveNumber, transferBlock, lastSection); |
|
340 } break; |
|
341 case EActiveBaseData: |
|
342 case EActiveIncrementalData: |
|
343 { |
|
344 if (!aSuppressInitDataOwner) |
|
345 { |
|
346 if (aProxySID != KNullABSid) |
|
347 { |
|
348 MakeCallbackInitialiseGetProxyBackupDataL(aProxySID, aDriveNumber); |
|
349 } |
|
350 else |
|
351 { |
|
352 MakeCallbackInitialiseGetBackupDataL(aDriveNumber); |
|
353 } |
|
354 } |
|
355 MakeCallbackGetBackupDataSectionL(transferBlock, lastSection); |
|
356 } break; |
|
357 default: |
|
358 { |
|
359 User::Leave(KErrNotSupported); |
|
360 } |
|
361 } |
|
362 |
|
363 // Even if we were supposed to suppress it first time round, for a multipart get, it |
|
364 // shouldn't be sent again |
|
365 aSuppressInitDataOwner = ETrue; |
|
366 |
|
367 // update our count to reflect the new data supplied by the client |
|
368 dataSizeTransferred += transferBlock.Size(); |
|
369 |
|
370 __LOG2("CABSession::RequestDataL() - received data so far: %d, buffer start address: 0x%08x", dataSizeTransferred, aBuffer.Ptr()); |
|
371 //__LOGDATA("CABSession::RequestDataL() - total received data - %S", aBuffer.Ptr(), dataSizeTransferred); |
|
372 |
|
373 __LOG2("CABSession::RequestDataL() - [0x%08x] Requesting data from ABClient %d bytes so far)", iClientSID.iId, dataSizeTransferred); |
|
374 |
|
375 aBuffer.SetLength(dataSizeTransferred); |
|
376 } while (!lastSection && (dataSizeTransferred < aBuffer.MaxSize())); |
|
377 |
|
378 aLastSection = lastSection; |
|
379 } |
|
380 |
|
381 void CABSession::TerminateMultiStageOperationL() |
|
382 /** |
|
383 Instruct the client that copying of data has been aborted and it should clean up |
|
384 */ |
|
385 { |
|
386 MakeCallbackTerminateMultiStageOperationL(); |
|
387 } |
|
388 |
|
389 TUint CABSession::GetDataChecksumL(TDriveNumber aDrive) |
|
390 /** |
|
391 Test method for validating data |
|
392 |
|
393 @param aDrive The drive from which the data is backed up from |
|
394 @return The checksum |
|
395 */ |
|
396 { |
|
397 return MakeCallbackGetDataChecksumL(aDrive); |
|
398 } |
|
399 |
|
400 void CABSession::CleanupClientSendState() |
|
401 /** |
|
402 Delete the client sending buffer and reset multipart flag |
|
403 */ |
|
404 { |
|
405 iReceiveFromClientFinished = ETrue; |
|
406 } |
|
407 |
|
408 void CABSession::MadeCallback() |
|
409 /** |
|
410 Start the CActiveSchedulerWait() object. The ABServer will stop this wait object when it's callback |
|
411 has returned, this way the thread's AS still processes ABServer ServiceL's etc. but it appears as |
|
412 though the request to the ABClient is synchronous. This method will be called from the ABServer inside |
|
413 the call from the Data Owner requesting an operation |
|
414 |
|
415 @see CDataOwner::ReturnFromActiveCall() |
|
416 */ |
|
417 { |
|
418 // Reset the leave flag |
|
419 iABClientLeaveCode = KErrNone; |
|
420 |
|
421 |
|
422 #ifndef _DEBUG |
|
423 // Start the callback timer only in release builds |
|
424 delete iCallbackWatchdog; |
|
425 iCallbackWatchdog = NULL; |
|
426 iCallbackWatchdog = CPeriodic::NewL(EPriorityHigh); |
|
427 TTimeIntervalMicroSeconds32 KWatchdogIntervalNone = 0; |
|
428 iCallbackWatchdog->Start(KABCallbackWatchdogTimeout, KWatchdogIntervalNone, iWatchdogHandler); |
|
429 #endif |
|
430 |
|
431 // Send the message back to the callback handler |
|
432 iMessage.Complete(KErrNone); |
|
433 |
|
434 __LOG1("CABSession::MadeCallback() - [0x%08x] Calling ABClient to process callback", iClientSID.iId); |
|
435 |
|
436 // Set the timeout for the callback |
|
437 iActiveSchedulerWait->Start(); |
|
438 } |
|
439 |
|
440 void CABSession::ReturnFromCallback() |
|
441 /** |
|
442 This method is called by the ABServer once it's completed it's request from the Active Backup Client |
|
443 so that the Data Owner appears to have made a synchronous call into the ABServer |
|
444 */ |
|
445 { |
|
446 if (iCallbackWatchdog) |
|
447 { |
|
448 if (iCallbackWatchdog->IsActive()) |
|
449 { |
|
450 iCallbackWatchdog->Cancel(); |
|
451 |
|
452 delete iCallbackWatchdog; |
|
453 iCallbackWatchdog = NULL; |
|
454 } |
|
455 } |
|
456 |
|
457 if (iActiveSchedulerWait->IsStarted()) |
|
458 { |
|
459 __LOG1("CABSession::MadeCallback() - [0x%08x] has returned from callback - CASW::AsyncStop()", iClientSID.iId); |
|
460 iActiveSchedulerWait->AsyncStop(); |
|
461 } |
|
462 } |
|
463 |
|
464 void CABSession::TakeOwnershipOfIPCMessage(const RMessage2& aMessage) |
|
465 /** |
|
466 Take ownership of the IPC message so that we're able to signal the Active Backup Callback Handler |
|
467 |
|
468 @param aMessage The IPC message that we're going to take ownership of |
|
469 */ |
|
470 { |
|
471 iMessage = aMessage; |
|
472 } |
|
473 |
|
474 void CABSession::HandleIPCBURModeInfoL(const RMessage2& aMessage) |
|
475 /** |
|
476 Return information about the backup and restore mode to the active backup client |
|
477 |
|
478 @param aMessage The IPC message |
|
479 */ |
|
480 { |
|
481 __LOG1("CABSession::HandleIPCBURModeInfoL() - [0x%08x] Received IPC IPCBURModeInfo", iClientSID.iId); |
|
482 |
|
483 TPckgC<TBURPartType> partType(Server().DataOwnerManager().BURType()); |
|
484 TPckgC<TBackupIncType> incType(Server().DataOwnerManager().IncType()); |
|
485 |
|
486 // Return the backup and restore settings to the client |
|
487 aMessage.WriteL(0, Server().DataOwnerManager().DriveList()); |
|
488 aMessage.WriteL(1, partType); |
|
489 aMessage.WriteL(2, incType); |
|
490 } |
|
491 |
|
492 void CABSession::HandleIPCDoesPartialBURAffectMeL(const RMessage2& aMessage) |
|
493 /** |
|
494 Return information about the backup and restore mode to the active backup client |
|
495 |
|
496 @param aMessage The IPC message |
|
497 */ |
|
498 { |
|
499 __LOG1("CABSession::HandleIPCDoesPartialBURAffectMeL() - [0x%08x] Received IPC DoesPartialBURAffectMe", iClientSID.iId); |
|
500 |
|
501 TPckgC<TBool> resultPkg(Server().DataOwnerManager().IsSetForPartialL(iClientSID)); |
|
502 aMessage.WriteL(0, resultPkg); |
|
503 } |
|
504 |
|
505 void CABSession::HandleIPCConfirmReadyForBURL(const RMessage2& aMessage) |
|
506 /** |
|
507 Respond to an event from abclient informing us that it's prepared it's data and is ready for backup |
|
508 |
|
509 @param aMessage The IPC message |
|
510 */ |
|
511 { |
|
512 TInt errorCode = aMessage.Int0(); |
|
513 __LOG2("CABSession::HandleIPCConfirmReadyForBURL() - [0x%08x] Received IPC ConfirmReadyForBUR, errorCode: %d", iClientSID.iId, errorCode); |
|
514 |
|
515 // Set our internal state to indicate that the client has confirmed ready for BUR |
|
516 iConfirmedReadyForBUR = ETrue; |
|
517 |
|
518 TDataOwnerStatus status; |
|
519 |
|
520 if (errorCode == KErrNone) |
|
521 { |
|
522 if (CallbackInterfaceAvailable()) |
|
523 { |
|
524 status = EDataOwnerReady; |
|
525 } |
|
526 else |
|
527 { |
|
528 status = EDataOwnerReadyNoImpl; |
|
529 } |
|
530 } |
|
531 else |
|
532 { |
|
533 status = EDataOwnerFailed; |
|
534 } |
|
535 |
|
536 // Inform the Data Owner of the new status |
|
537 TRAP_IGNORE(DataOwnerL().SetReadyState(status)); |
|
538 } |
|
539 |
|
540 void CABSession::HandleIPCPropagateLeaveL(const RMessage2& aMessage) |
|
541 /** Leave with the propagated leave code |
|
542 |
|
543 @param aMessage The IPC message |
|
544 */ |
|
545 { |
|
546 // Leave with the propagated leave code, but not inside this ServiceL, it'll leave to the client again |
|
547 // We need to ensure that it leaves through SBEngine back to SBEClient. Leave code will be checked |
|
548 // after the callback has been made and leave will be made then if necessary |
|
549 iABClientLeaveCode = aMessage.Int0(); |
|
550 |
|
551 __LOG2("CABSession::HandleIPCPropagateLeaveL() - [0x%08x] Received IPC Leave(%d)", iClientSID.iId, iABClientLeaveCode); |
|
552 } |
|
553 |
|
554 TInt CABSession::HandleIPCGetDataSyncL(const RMessage2& aMessage) |
|
555 /** |
|
556 Handles the synchronous method called by the client to get it's data transferred |
|
557 |
|
558 @param aMessage The IPC message |
|
559 @return KErrNone if OK, standard error code otherwise |
|
560 */ |
|
561 { |
|
562 __LOG1("CABSession::HandleIPCGetDataSyncL() - [0x%08x] has requested data over IPC", iClientSID.iId); |
|
563 |
|
564 TInt completionCode = KErrNone; |
|
565 |
|
566 if (iCallbackInProgress == static_cast<TABCallbackCommands>(aMessage.Int0())) |
|
567 { |
|
568 // Write the clients data into the buffer |
|
569 aMessage.WriteL(1, iSendToClientBuffer); |
|
570 } |
|
571 else |
|
572 { |
|
573 completionCode = KErrCorrupt; |
|
574 } |
|
575 |
|
576 __LOG2("CABSession::HandleIPCGetDataSyncL() - [0x%08x] completion code: %d", iClientSID.iId, completionCode); |
|
577 return completionCode; |
|
578 } |
|
579 |
|
580 TInt CABSession::HandleIPCSendDataLengthL(const RMessage2& aMessage) |
|
581 /** |
|
582 Synchronous IPC call from the ABClient to inform the server about the data that is being returned from it |
|
583 |
|
584 @param aMessage The IPC message |
|
585 @return KErrNone if OK, standard error code otherwise |
|
586 */ |
|
587 { |
|
588 __LOG1("CABSession::HandleIPCSendDataLengthL() - [0x%08x] is informing server of the data length coming back", iClientSID.iId); |
|
589 |
|
590 TInt completionCode = KErrNone; |
|
591 |
|
592 // Check that this operation is as part of our expected callback |
|
593 if (iCallbackInProgress == static_cast<TABCallbackCommands>(aMessage.Int2())) |
|
594 { |
|
595 CleanupClientSendState(); |
|
596 // Ignore the size returned from the client (Int0()) because we've told it how much it can send |
|
597 iReceiveFromClientFinished = static_cast<TBool>(aMessage.Int1()); |
|
598 } |
|
599 else |
|
600 { |
|
601 completionCode = KErrCorrupt; |
|
602 } |
|
603 |
|
604 return completionCode; |
|
605 } |
|
606 |
|
607 TInt CABSession::HandleIPCClosingDownCallback() |
|
608 /** |
|
609 Respond to the client, informing it that the server is closing down the callback interface |
|
610 |
|
611 @return KErrNone if OK, standard error code otherwise |
|
612 */ |
|
613 { |
|
614 TInt completionCode = KErrNotFound; |
|
615 __LOG1("CABSession::HandleIPCClosingDownCallback() - [0x%08x] is closing down the callback interface", iClientSID.iId); |
|
616 if (!iMessage.IsNull()) |
|
617 { |
|
618 completionCode = KErrNone; |
|
619 iMessage.Complete(KErrCancel); |
|
620 } |
|
621 |
|
622 return completionCode; |
|
623 } |
|
624 |
|
625 void CABSession::ServiceL(const RMessage2& aMessage) |
|
626 /** |
|
627 Called by the client server framework to service a message request |
|
628 from a client. |
|
629 |
|
630 @param aMessage Reference to a RMessage2 object |
|
631 */ |
|
632 { |
|
633 const TInt ipcMessageFn = aMessage.Function(); |
|
634 TInt completionCode = KErrNone; // Complete the aMessage with this code |
|
635 |
|
636 #if defined(SBE_LOGGING_ENABLED) |
|
637 RThread client; |
|
638 aMessage.Client(client); |
|
639 const TFullName name(client.FullName()); |
|
640 client.Close(); |
|
641 __LOG5("CABSession::ServiceL() - START - [0x%08x] function: %d from client: %S, iMisbehavingClient: %d, iConfirmedReadyForBUR: %d", iClientSID.iId, ipcMessageFn, &name, iMisbehavingClient, iConfirmedReadyForBUR); |
|
642 #endif |
|
643 |
|
644 switch(ipcMessageFn) |
|
645 { |
|
646 case EABMsgBURModeInfo: |
|
647 __LOG("CABSession::ServiceL() - EABMsgBURModeInfo"); |
|
648 { |
|
649 HandleIPCBURModeInfoL(aMessage); |
|
650 break; |
|
651 } |
|
652 case EABMsgDoesPartialAffectMe: |
|
653 __LOG("CABSession::ServiceL() - EABMsgDoesPartialAffectMe"); |
|
654 { |
|
655 HandleIPCDoesPartialBURAffectMeL(aMessage); |
|
656 break; |
|
657 } |
|
658 case EABMsgConfirmReadyForBUR: |
|
659 __LOG("CABSession::ServiceL() - EABMsgConfirmReadyForBUR"); |
|
660 { |
|
661 if (iMisbehavingClient) |
|
662 { |
|
663 completionCode = KErrTimedOut; |
|
664 } |
|
665 else |
|
666 { |
|
667 HandleIPCConfirmReadyForBURL(aMessage); |
|
668 } |
|
669 |
|
670 break; |
|
671 } |
|
672 case EABMsgPrimeForCallback: |
|
673 case EABMsgPrimeForCallbackAndResponse: |
|
674 case EABMsgPrimeForCallbackAndResponseDes: |
|
675 __LOG("CABSession::ServiceL() - EABMsgPrimeForCallback/EABMsgPrimeForCallbackAndResponse/EABMsgPrimeForCallbackAndResponseDes"); |
|
676 { |
|
677 CDataOwner* dataOwner = NULL; |
|
678 TRAPD(err, dataOwner = &DataOwnerL()); |
|
679 // Close down the entire callback interface on a misbehaving client |
|
680 if (iMisbehavingClient) |
|
681 { |
|
682 completionCode = KErrTimedOut; |
|
683 if (err == KErrNone) |
|
684 { |
|
685 dataOwner->SetReadyState(EDataOwnerNotConnected); |
|
686 } |
|
687 else |
|
688 { |
|
689 if (err != KErrNotFound) |
|
690 { |
|
691 User::Leave(err); |
|
692 } |
|
693 } |
|
694 } |
|
695 else |
|
696 { |
|
697 TakeOwnershipOfIPCMessage(aMessage); |
|
698 if (err == KErrNone) |
|
699 { |
|
700 if (dataOwner->ReadyState() == EDataOwnerNotConnected) |
|
701 { |
|
702 dataOwner->SetReadyState(EDataOwnerNotReady); |
|
703 } |
|
704 } |
|
705 else |
|
706 { |
|
707 if (err != KErrNotFound) |
|
708 { |
|
709 User::Leave(err); |
|
710 } |
|
711 } |
|
712 |
|
713 // Return to the method that initiated the callback |
|
714 ReturnFromCallback(); |
|
715 } |
|
716 |
|
717 break; |
|
718 } |
|
719 case EABMsgPropagateLeave: |
|
720 __LOG("CABSession::ServiceL() - EABMsgPropagateLeave"); |
|
721 { |
|
722 if (iMisbehavingClient) |
|
723 { |
|
724 completionCode = KErrTimedOut; |
|
725 } |
|
726 else |
|
727 { |
|
728 HandleIPCPropagateLeaveL(aMessage); |
|
729 } |
|
730 break; |
|
731 } |
|
732 case EABMsgGetDataSync: |
|
733 __LOG("CABSession::ServiceL() - EABMsgGetDataSync"); |
|
734 { |
|
735 if (iMisbehavingClient) |
|
736 { |
|
737 completionCode = KErrTimedOut; |
|
738 } |
|
739 else |
|
740 { |
|
741 completionCode = HandleIPCGetDataSyncL(aMessage); |
|
742 } |
|
743 break; |
|
744 } |
|
745 case EABMsgSendDataLength: |
|
746 __LOG("CABSession::ServiceL() - EABMsgSendDataLength"); |
|
747 { |
|
748 if (iMisbehavingClient) |
|
749 { |
|
750 completionCode = KErrTimedOut; |
|
751 } |
|
752 else |
|
753 { |
|
754 completionCode = HandleIPCSendDataLengthL(aMessage); |
|
755 } |
|
756 break; |
|
757 } |
|
758 case EABMsgClosingDownCallback: |
|
759 __LOG("CABSession::ServiceL() - EABMsgClosingDownCallback"); |
|
760 { |
|
761 completionCode = HandleIPCClosingDownCallback(); |
|
762 |
|
763 CDataOwner* dataOwner = NULL; |
|
764 TRAPD(err, dataOwner = &DataOwnerL()); |
|
765 if (err == KErrNone && ( dataOwner->ReadyState() == EDataOwnerReady || dataOwner->ReadyState() == EDataOwnerReadyNoImpl )) |
|
766 { |
|
767 dataOwner->SetReadyState(EDataOwnerNotConnected); |
|
768 } |
|
769 break; |
|
770 } |
|
771 case EABMsgGetDriveNumForSuppliedSnapshot: |
|
772 __LOG("CABSession::ServiceL() - EABMsgGetDriveNumForSuppliedSnapshot"); |
|
773 { |
|
774 // Return the drive number to the client |
|
775 completionCode = static_cast<TInt>(iSuppliedSnapshotDriveNum); |
|
776 break; |
|
777 } |
|
778 // |
|
779 // Connection config getting/setting. |
|
780 default: |
|
781 { |
|
782 Panic(KErrNotSupported); |
|
783 break; |
|
784 } |
|
785 } |
|
786 |
|
787 if ((ipcMessageFn != EABMsgPrimeForCallback) && |
|
788 (ipcMessageFn != EABMsgPrimeForCallbackAndResponse) && |
|
789 (ipcMessageFn != EABMsgPrimeForCallbackAndResponseDes)) |
|
790 { |
|
791 // If the message was a synchrnous one and has not already been completed, then complete |
|
792 if (!aMessage.IsNull()) |
|
793 { |
|
794 aMessage.Complete(completionCode); |
|
795 __LOG3("CABSession::ServiceL() - END - function: %d from client: %S - COMPLETED (%d)", aMessage.Function(), &name, completionCode); |
|
796 } |
|
797 } |
|
798 |
|
799 #if defined(SBE_LOGGING_ENABLED) |
|
800 if (!aMessage.IsNull()) |
|
801 { |
|
802 __LOG2("CABSession::ServiceL() - END - function: %d from client: %S - ASYNCH -> NOT COMPLETED", aMessage.Function(), &name); |
|
803 } |
|
804 #endif |
|
805 } |
|
806 |
|
807 inline CABServer& CABSession::Server() const |
|
808 /** |
|
809 Returns a non-cost reference to this CServer object. |
|
810 |
|
811 @return The non-const reference to this. |
|
812 */ |
|
813 { |
|
814 return *static_cast<CABServer*>(const_cast<CServer2*>(CSession2::Server())); |
|
815 } |
|
816 |
|
817 void CABSession::CheckCallbackAvailableL() |
|
818 /** |
|
819 Leave if the callback is not available |
|
820 |
|
821 @leave KErrNotReady if the callback hasn't been primed |
|
822 */ |
|
823 { |
|
824 TBool primed = !iMessage.IsNull(); |
|
825 |
|
826 __LOG2("CABSession::CheckCallbackAvailableL() - [0x%08x] primed: %d", iClientSID.iId, static_cast<TInt>(primed)); |
|
827 |
|
828 if (iMisbehavingClient) |
|
829 { |
|
830 User::Leave(KErrAccessDenied); |
|
831 } |
|
832 |
|
833 if (!primed) |
|
834 { |
|
835 User::Leave(KErrNotReady); |
|
836 } |
|
837 } |
|
838 |
|
839 void CABSession::MakeCallbackAllSnapshotsSuppliedL() |
|
840 /** |
|
841 Synchronous call to make the callback on the active backup client |
|
842 |
|
843 */ |
|
844 { |
|
845 __LOG1("CABSession::MakeCallbackAllSnapshotsSuppliedL() - [0x%08x] Calling AllSnapshotsSuppliedL", iClientSID.iId); |
|
846 |
|
847 TPckgC<TABCallbackCommands> callbackPkg(EABCallbackAllSnapshotsSupplied); |
|
848 |
|
849 CheckCallbackAvailableL(); |
|
850 |
|
851 // Make the callback |
|
852 iMessage.WriteL(0, callbackPkg); |
|
853 MadeCallback(); |
|
854 } |
|
855 |
|
856 void CABSession::MakeCallbackReceiveSnapshotDataL(TDriveNumber aDrive, TDesC8& aBuffer, |
|
857 TBool aLastSection) |
|
858 /** |
|
859 Synchronous call to make the callback on the active backup client |
|
860 |
|
861 @param aDrive Drive number that the snapshot relates to |
|
862 @param aBuffer The snapshot |
|
863 @param aLastSection Flag to indicate to the client whether this is the last of a multipart snapshot |
|
864 */ |
|
865 { |
|
866 __LOG1("CABSession::MakeCallbackReceiveSnapshotDataL() - [0x%08x] Calling ReceiveSnapshotData", iClientSID.iId); |
|
867 |
|
868 iSuppliedSnapshotDriveNum = aDrive; |
|
869 |
|
870 TPckgC<TABCallbackCommands> callbackPkg(EABCallbackReceiveSnapshotData); |
|
871 TPckgC<TInt> sizePkg(aBuffer.Size()); |
|
872 TPckgC<TBool> lastSectionPkg(aLastSection); |
|
873 |
|
874 iCallbackInProgress = EABCallbackReceiveSnapshotData; |
|
875 |
|
876 iSendToClientBuffer.Set(aBuffer); |
|
877 |
|
878 CheckCallbackAvailableL(); |
|
879 iMessage.WriteL(0, callbackPkg); |
|
880 iMessage.WriteL(1, sizePkg); |
|
881 iMessage.WriteL(2, lastSectionPkg); |
|
882 MadeCallback(); |
|
883 |
|
884 User::LeaveIfError(iABClientLeaveCode); |
|
885 } |
|
886 |
|
887 TUint CABSession::MakeCallbackGetExpectedDataSizeL(TDriveNumber aDrive) |
|
888 /** |
|
889 Synchronous call to make the callback on the active backup client |
|
890 |
|
891 @param aDrive The drive to get the expected data size for |
|
892 @return The size of the data that will be transferred |
|
893 */ |
|
894 { |
|
895 __LOG1("CABSession::MakeCallbackGetExpectedDataSizeL() - [0x%08x] Calling GetExpectedDataSize", iClientSID.iId); |
|
896 |
|
897 TPckgC<TABCallbackCommands> callbackPkg(EABCallbackGetExpectedDataSize); |
|
898 TPckgC<TDriveNumber> drivePkg(aDrive); |
|
899 TUint returnedSize; |
|
900 |
|
901 iCallbackInProgress = EABCallbackGetExpectedDataSize; |
|
902 |
|
903 CheckCallbackAvailableL(); |
|
904 iMessage.WriteL(0, callbackPkg); |
|
905 iMessage.WriteL(1, drivePkg); |
|
906 MadeCallback(); |
|
907 |
|
908 // Check that a response has been received |
|
909 CheckCallbackAvailableL(); |
|
910 returnedSize = iMessage.Int3(); |
|
911 |
|
912 return returnedSize; |
|
913 } |
|
914 |
|
915 void CABSession::MakeCallbackGetSnapshotDataL(TDriveNumber aDrive, TPtr8& aBuffer, TBool& aFinished) |
|
916 /** |
|
917 Synchronous call to make the callback on the active backup client |
|
918 |
|
919 @param aDrive Drive number that the snapshot is required for |
|
920 @param aBuffer The snapshot |
|
921 @param aFinished Flag to indicate to the client whether this is the last of a multipart snapshot |
|
922 */ |
|
923 { |
|
924 __LOG1("CABSession::MakeCallbackGetSnapshotDataL() - [0x%08x] Calling GetSnapshotData", iClientSID.iId); |
|
925 |
|
926 TPckgC<TABCallbackCommands> callbackPkg(EABCallbackGetSnapshotData); |
|
927 TPckgC<TDriveNumber> drivePkg(aDrive); |
|
928 TPckgC<TInt> size(aBuffer.Size()); |
|
929 |
|
930 iCallbackInProgress = EABCallbackGetSnapshotData; |
|
931 |
|
932 CheckCallbackAvailableL(); |
|
933 iMessage.WriteL(0, callbackPkg); |
|
934 iMessage.WriteL(1, size); |
|
935 iMessage.WriteL(2, drivePkg); |
|
936 MadeCallback(); |
|
937 |
|
938 User::LeaveIfError(iABClientLeaveCode); |
|
939 |
|
940 // Read the buffer from the client |
|
941 CheckCallbackAvailableL(); |
|
942 |
|
943 TInt bufLength = iMessage.GetDesLengthL(3); |
|
944 aBuffer.SetLength(bufLength); |
|
945 |
|
946 iMessage.ReadL(3, aBuffer); |
|
947 aFinished = iReceiveFromClientFinished; |
|
948 } |
|
949 |
|
950 void CABSession::MakeCallbackInitialiseGetBackupDataL(TDriveNumber aDrive) |
|
951 /** |
|
952 Synchronous call to make the callback on the active backup client |
|
953 |
|
954 @param aDrive the Drive Number |
|
955 */ |
|
956 { |
|
957 __LOG1("CABSession::MakeCallbackInitialiseGetBackupDataL() - [0x%08x] Calling InitGetBackupData", iClientSID.iId); |
|
958 |
|
959 TPckgC<TABCallbackCommands> callbackPkg(EABCallbackInitialiseGetBackupData); |
|
960 TPckgC<TDriveNumber> drivePkg(aDrive); |
|
961 |
|
962 iCallbackInProgress = EABCallbackInitialiseGetBackupData; |
|
963 |
|
964 CheckCallbackAvailableL(); |
|
965 iMessage.WriteL(0, callbackPkg); |
|
966 iMessage.WriteL(1, drivePkg); |
|
967 MadeCallback(); |
|
968 |
|
969 User::LeaveIfError(iABClientLeaveCode); |
|
970 } |
|
971 |
|
972 void CABSession::MakeCallbackGetBackupDataSectionL(TPtr8& aBuffer, TBool& aFinished) |
|
973 /** |
|
974 Synchronous call to make the callback on the active backup client |
|
975 |
|
976 @param aBuffer Data returned from the client |
|
977 @param aFinished Does the client have more data to send? |
|
978 */ |
|
979 { |
|
980 __LOG2("CABSession::MakeCallbackGetBackupDataSectionL() - START - aBuffer.Ptr(): 0x%08x, aBuffer.Length(): %d", aBuffer.Ptr(), aBuffer.Length()); |
|
981 |
|
982 __LOG1("CABSession::MakeCallbackGetBackupDataSectionL() - [0x%08x] Calling GetBackupDataSection", iClientSID.iId); |
|
983 |
|
984 TPckgC<TABCallbackCommands> callbackPkg(EABCallbackGetBackupDataSection); |
|
985 TPckgC<TInt> sizePkg(aBuffer.Size()); |
|
986 |
|
987 iCallbackInProgress = EABCallbackGetBackupDataSection; |
|
988 |
|
989 CheckCallbackAvailableL(); |
|
990 iMessage.WriteL(0, callbackPkg); |
|
991 iMessage.WriteL(1, sizePkg); |
|
992 MadeCallback(); |
|
993 |
|
994 User::LeaveIfError(iABClientLeaveCode); |
|
995 CheckCallbackAvailableL(); |
|
996 |
|
997 TInt bufLength = iMessage.GetDesLengthL(3); |
|
998 aBuffer.SetLength(bufLength); |
|
999 iMessage.ReadL(3, aBuffer); |
|
1000 aFinished = iReceiveFromClientFinished; |
|
1001 |
|
1002 //__LOGDATA("CABSession::MakeCallbackGetBackupDataSectionL() - received %S", aBuffer.Ptr(), aBuffer.Length()); |
|
1003 |
|
1004 __LOG2("CABSession::MakeCallbackGetBackupDataSectionL() - END - aBuffer.Ptr(): 0x%08x, aBuffer.Length(): %d", aBuffer.Ptr(), aBuffer.Length()); |
|
1005 } |
|
1006 |
|
1007 void CABSession::MakeCallbackInitialiseRestoreBaseDataL(TDriveNumber aDrive) |
|
1008 /** |
|
1009 Synchronous call to make the callback on the active backup client |
|
1010 |
|
1011 @param aDrive The drive that's affected by the operation |
|
1012 */ |
|
1013 { |
|
1014 __LOG1("CABSession::MakeCallbackInitialiseRestoreBaseDataL() - [0x%08x] Calling InitRestoreBaseData", iClientSID.iId); |
|
1015 |
|
1016 TPckgC<TABCallbackCommands> callbackPkg(EABCallbackInitialiseRestoreBaseDataSection); |
|
1017 TPckgC<TDriveNumber> drivePkg(aDrive); |
|
1018 |
|
1019 iCallbackInProgress = EABCallbackInitialiseRestoreBaseDataSection; |
|
1020 |
|
1021 CheckCallbackAvailableL(); |
|
1022 iMessage.WriteL(0, callbackPkg); |
|
1023 iMessage.WriteL(1, drivePkg); |
|
1024 MadeCallback(); |
|
1025 |
|
1026 User::LeaveIfError(iABClientLeaveCode); |
|
1027 } |
|
1028 |
|
1029 void CABSession::MakeCallbackRestoreBaseDataSectionL(TDesC8& aBuffer, TBool aFinished) |
|
1030 /** |
|
1031 Synchronous call to make the callback on the active backup client |
|
1032 |
|
1033 @param aBuffer The data to restore |
|
1034 @param aFinished Is this the last of a multi-part data call |
|
1035 */ |
|
1036 { |
|
1037 __LOG1("CABSession::MakeCallbackRestoreBaseDataSectionL() - [0x%08x] Calling RestoreBaseDataSection", iClientSID.iId); |
|
1038 |
|
1039 TPckgC<TABCallbackCommands> callbackPkg(EABCallbackRestoreBaseDataSection); |
|
1040 TPckgC<TInt> sizePkg(aBuffer.Size()); |
|
1041 TPckgC<TBool> lastSectionPkg(aFinished); |
|
1042 |
|
1043 iCallbackInProgress = EABCallbackRestoreBaseDataSection; |
|
1044 |
|
1045 iSendToClientBuffer.Set(aBuffer); |
|
1046 |
|
1047 CheckCallbackAvailableL(); |
|
1048 iMessage.WriteL(0, callbackPkg); |
|
1049 iMessage.WriteL(1, sizePkg); |
|
1050 iMessage.WriteL(2, lastSectionPkg); |
|
1051 MadeCallback(); |
|
1052 |
|
1053 User::LeaveIfError(iABClientLeaveCode); |
|
1054 } |
|
1055 |
|
1056 void CABSession::MakeCallbackInitialiseRestoreIncrementDataL(TDriveNumber aDrive) |
|
1057 /** |
|
1058 Synchronous call to make the callback on the active backup client |
|
1059 |
|
1060 @param aDrive The drive that's affected by the operation |
|
1061 */ |
|
1062 { |
|
1063 __LOG1("CABSession::MakeCallbackInitialiseRestoreIncrementDataL() - [0x%08x] Calling InitRestoreIncrementData", iClientSID.iId); |
|
1064 |
|
1065 TPckgC<TABCallbackCommands> callbackPkg(EABCallbackInitialiseRestoreIncrementData); |
|
1066 TPckgC<TDriveNumber> drivePkg(aDrive); |
|
1067 |
|
1068 iCallbackInProgress = EABCallbackInitialiseRestoreIncrementData; |
|
1069 |
|
1070 CheckCallbackAvailableL(); |
|
1071 iMessage.WriteL(0, callbackPkg); |
|
1072 iMessage.WriteL(1, drivePkg); |
|
1073 MadeCallback(); |
|
1074 |
|
1075 User::LeaveIfError(iABClientLeaveCode); |
|
1076 } |
|
1077 |
|
1078 void CABSession::MakeCallbackRestoreIncrementDataSectionL(TDesC8& aBuffer, TBool aFinished) |
|
1079 /** |
|
1080 Synchronous call to make the callback on the active backup client |
|
1081 |
|
1082 @param aBuffer The data to restore |
|
1083 @param aFinished Is this the last of a multi-part data call |
|
1084 */ |
|
1085 { |
|
1086 __LOG1("CABSession::MakeCallbackRestoreIncrementDataSectionL() - [0x%08x] Calling RestoreIncrementData", iClientSID.iId); |
|
1087 |
|
1088 TPckgC<TABCallbackCommands> callbackPkg(EABCallbackRestoreIncrementDataSection); |
|
1089 TPckgC<TInt> sizePkg(aBuffer.Size()); |
|
1090 TPckgC<TBool> lastSectionPkg(aFinished); |
|
1091 |
|
1092 iCallbackInProgress = EABCallbackRestoreIncrementDataSection; |
|
1093 |
|
1094 iSendToClientBuffer.Set(aBuffer); |
|
1095 |
|
1096 CheckCallbackAvailableL(); |
|
1097 iMessage.WriteL(0, callbackPkg); |
|
1098 iMessage.WriteL(1, sizePkg); |
|
1099 iMessage.WriteL(2, lastSectionPkg); |
|
1100 MadeCallback(); |
|
1101 |
|
1102 User::LeaveIfError(iABClientLeaveCode); |
|
1103 } |
|
1104 |
|
1105 void CABSession::MakeCallbackRestoreCompleteL(TDriveNumber aDrive) |
|
1106 /** |
|
1107 Synchronous call to make the callback on the active backup client |
|
1108 |
|
1109 @param aDrive The drive that's affected by the operation |
|
1110 */ |
|
1111 { |
|
1112 __LOG1("CABSession::MakeCallbackRestoreCompleteL() - [0x%08x] Calling RestoreComplete", iClientSID.iId); |
|
1113 |
|
1114 TPckgC<TABCallbackCommands> callbackPkg(EABCallbackRestoreComplete); |
|
1115 TPckgC<TDriveNumber> drivePkg(aDrive); |
|
1116 |
|
1117 iCallbackInProgress = EABCallbackRestoreComplete; |
|
1118 |
|
1119 CheckCallbackAvailableL(); |
|
1120 iMessage.WriteL(0, callbackPkg); |
|
1121 iMessage.WriteL(1, drivePkg); |
|
1122 MadeCallback(); |
|
1123 } |
|
1124 |
|
1125 void CABSession::MakeCallbackInitialiseGetProxyBackupDataL(TSecureId aSID, TDriveNumber aDrive) |
|
1126 /** |
|
1127 Synchronous call to make the callback on the active backup client |
|
1128 |
|
1129 @param aSID The SecureId of the Proxy |
|
1130 @param aDrive The drive that's affected by the operation |
|
1131 */ |
|
1132 { |
|
1133 __LOG1("CABSession::MakeCallbackInitialiseGetProxyBackupDataL() - [0x%08x] Calling InitGetProxyBackupData", iClientSID.iId); |
|
1134 |
|
1135 TPckgC<TABCallbackCommands> callbackPkg(EABCallbackInitialiseGetProxyBackupData); |
|
1136 TPckgC<TSecureId> sidPkg(aSID); |
|
1137 TPckgC<TDriveNumber> drivePkg(aDrive); |
|
1138 |
|
1139 iCallbackInProgress = EABCallbackInitialiseGetProxyBackupData; |
|
1140 |
|
1141 CheckCallbackAvailableL(); |
|
1142 iMessage.WriteL(0, callbackPkg); |
|
1143 iMessage.WriteL(1, sidPkg); |
|
1144 iMessage.WriteL(2, drivePkg); |
|
1145 MadeCallback(); |
|
1146 |
|
1147 User::LeaveIfError(iABClientLeaveCode); |
|
1148 } |
|
1149 |
|
1150 void CABSession::MakeCallbackInitialiseRestoreProxyBaseDataL(TSecureId aSID, TDriveNumber aDrive) |
|
1151 /** |
|
1152 Synchronous call to make the callback on the active backup client |
|
1153 |
|
1154 @param aSID The SecureId of the Proxy |
|
1155 @param aDrive The drive that's affected by the operation |
|
1156 */ |
|
1157 { |
|
1158 __LOG1("CABSession::MakeCallbackInitialiseRestoreProxyBaseDataL() - [0x%08x] Calling InitRestoreProxyBaseData", iClientSID.iId); |
|
1159 |
|
1160 TPckgC<TABCallbackCommands> callbackPkg(EABCallbackInitialiseRestoreProxyBaseData); |
|
1161 TPckgC<TSecureId> sidPkg(aSID); |
|
1162 TPckgC<TDriveNumber> drivePkg(aDrive); |
|
1163 |
|
1164 iCallbackInProgress = EABCallbackInitialiseRestoreProxyBaseData; |
|
1165 |
|
1166 CheckCallbackAvailableL(); |
|
1167 iMessage.WriteL(0, callbackPkg); |
|
1168 iMessage.WriteL(1, sidPkg); |
|
1169 iMessage.WriteL(2, drivePkg); |
|
1170 MadeCallback(); |
|
1171 |
|
1172 User::LeaveIfError(iABClientLeaveCode); |
|
1173 } |
|
1174 |
|
1175 void CABSession::MakeCallbackTerminateMultiStageOperationL() |
|
1176 /** |
|
1177 Synchronous call to make the callback on the active backup client |
|
1178 |
|
1179 */ |
|
1180 { |
|
1181 __LOG1("CABSession::MakeCallbackTerminateMultiStageOperationL() - [0x%08x] Calling TermiateMultiStageOp", iClientSID.iId); |
|
1182 |
|
1183 TPckgC<TABCallbackCommands> callbackPkg(EABCallbackTerminateMultiStageOperation); |
|
1184 |
|
1185 iCallbackInProgress = EABCallbackTerminateMultiStageOperation; |
|
1186 |
|
1187 CheckCallbackAvailableL(); |
|
1188 iMessage.WriteL(0, callbackPkg); |
|
1189 MadeCallback(); |
|
1190 } |
|
1191 |
|
1192 TUint CABSession::MakeCallbackGetDataChecksumL(TDriveNumber aDrive) |
|
1193 /** |
|
1194 Synchronous call to make the callback on the active backup client |
|
1195 |
|
1196 @param aDrive The drive that's affected by the operation |
|
1197 @return The checksum of the data |
|
1198 */ |
|
1199 { |
|
1200 __LOG1("CABSession::MakeCallbackGetDataChecksumL() - [0x%08x] Calling GetDataChecksum", iClientSID.iId); |
|
1201 |
|
1202 TPckgC<TABCallbackCommands> callbackPkg(EABCallbackGetDataChecksum); |
|
1203 TPckgC<TDriveNumber> drivePkg(aDrive); |
|
1204 TPckgBuf<TUint> returnPkg; |
|
1205 |
|
1206 iCallbackInProgress = EABCallbackGetDataChecksum; |
|
1207 |
|
1208 CheckCallbackAvailableL(); |
|
1209 iMessage.WriteL(0, callbackPkg); |
|
1210 iMessage.WriteL(1, drivePkg); |
|
1211 MadeCallback(); |
|
1212 |
|
1213 iMessage.ReadL(3, returnPkg); |
|
1214 |
|
1215 return returnPkg(); |
|
1216 } |
|
1217 |
|
1218 void CABSession::SetInvalid() |
|
1219 /** |
|
1220 Invalidate this session, so that this session can not be |
|
1221 used in sequent backup/restore event |
|
1222 */ |
|
1223 { |
|
1224 iInvalid = ETrue; |
|
1225 } |
|
1226 |
|
1227 TBool CABSession::Invalidated() |
|
1228 /** |
|
1229 Return whether this session has been invalidated |
|
1230 |
|
1231 @Return ETrue if this session aleady be invalidated;otherwise EFalse |
|
1232 */ |
|
1233 { |
|
1234 return iInvalid; |
|
1235 } |
|
1236 } |
|
1237 |
|
1238 |