85 : CPolicyServer(EPriorityNormal,myABPolicy), iDOM(aDOM) |
87 : CPolicyServer(EPriorityNormal,myABPolicy), iDOM(aDOM) |
86 /** |
88 /** |
87 Class constructor |
89 Class constructor |
88 */ |
90 */ |
89 { |
91 { |
|
92 OstTraceFunctionEntry0( CABSERVER_CABSERVER_CONS_ENTRY ); |
90 __ASSERT_DEBUG(iDOM, Panic(KErrArgument)); |
93 __ASSERT_DEBUG(iDOM, Panic(KErrArgument)); |
|
94 OstTraceFunctionExit0( CABSERVER_CABSERVER_CONS_EXIT ); |
91 } |
95 } |
92 |
96 |
93 CABServer::~CABServer() |
97 CABServer::~CABServer() |
94 /** |
98 /** |
95 Class destructor |
99 Class destructor |
96 */ |
100 */ |
97 { |
101 { |
|
102 OstTraceFunctionEntry0( CABSERVER_CABSERVER_DES_ENTRY ); |
98 delete iSessionMap; |
103 delete iSessionMap; |
|
104 OstTraceFunctionExit0( CABSERVER_CABSERVER_DES_EXIT ); |
99 } |
105 } |
100 |
106 |
101 CABServer* CABServer::NewLC(CDataOwnerManager* aDOM) |
107 CABServer* CABServer::NewLC(CDataOwnerManager* aDOM) |
102 /** |
108 /** |
103 Constructs a new instance of the CABServer, calls ConstructL, |
109 Constructs a new instance of the CABServer, calls ConstructL, |
104 and returns it to the caller leaving it on the cleanup stack. |
110 and returns it to the caller leaving it on the cleanup stack. |
105 |
111 |
106 @return The new instance of CABServer. |
112 @return The new instance of CABServer. |
107 */ |
113 */ |
108 { |
114 { |
|
115 OstTraceFunctionEntry0( CABSERVER_NEWLC_ENTRY ); |
109 CABServer* pSelf = new (ELeave) CABServer(aDOM); |
116 CABServer* pSelf = new (ELeave) CABServer(aDOM); |
110 CleanupStack::PushL(pSelf); |
117 CleanupStack::PushL(pSelf); |
111 pSelf->ConstructL(); |
118 pSelf->ConstructL(); |
|
119 OstTraceFunctionExit0( CABSERVER_NEWLC_EXIT ); |
112 return pSelf; |
120 return pSelf; |
113 } |
121 } |
114 |
122 |
115 void CABServer::ConstructL() |
123 void CABServer::ConstructL() |
116 /** |
124 /** |
117 Construct this instance of CABServer. |
125 Construct this instance of CABServer. |
118 */ |
126 */ |
119 { |
127 { |
|
128 OstTraceFunctionEntry0( CABSERVER_CONSTRUCTL_ENTRY ); |
120 iSessionMap = CABSessionMap::NewL(); |
129 iSessionMap = CABSessionMap::NewL(); |
121 // |
130 // |
122 // Start the server |
131 // Start the server |
123 StartL(KABServerName); |
132 StartL(KABServerName); |
|
133 OstTraceFunctionExit0( CABSERVER_CONSTRUCTL_EXIT ); |
124 } |
134 } |
125 |
135 |
126 void CABServer::AddSession() |
136 void CABServer::AddSession() |
127 /** Increments the server session count. |
137 /** Increments the server session count. |
128 |
138 |
165 @param aLastSection Flag to indicate whether this is the last operation in a multi-part transfer |
177 @param aLastSection Flag to indicate whether this is the last operation in a multi-part transfer |
166 @param aSuppressInitDataOwner Suppress the initialisation of Data Owner |
178 @param aSuppressInitDataOwner Suppress the initialisation of Data Owner |
167 @param aProxySID The secure ID of the proxy |
179 @param aProxySID The secure ID of the proxy |
168 */ |
180 */ |
169 { |
181 { |
|
182 OstTraceFunctionEntry0( CABSERVER_SUPPLYDATAL_ENTRY ); |
170 CABSession& session = iSessionMap->SessionL(aSID); |
183 CABSession& session = iSessionMap->SessionL(aSID); |
171 |
184 |
172 session.SupplyDataL(aDriveNumber, aTransferType, aBuffer, aLastSection, aSuppressInitDataOwner, aProxySID); |
185 session.SupplyDataL(aDriveNumber, aTransferType, aBuffer, aLastSection, aSuppressInitDataOwner, aProxySID); |
|
186 OstTraceFunctionExit0( CABSERVER_SUPPLYDATAL_EXIT ); |
173 } |
187 } |
174 |
188 |
175 void CABServer::RequestDataL(TSecureId aSID, TDriveNumber aDriveNumber, TTransferDataType aTransferType, |
189 void CABServer::RequestDataL(TSecureId aSID, TDriveNumber aDriveNumber, TTransferDataType aTransferType, |
176 TPtr8& aBuffer, TBool& aLastSection, TBool aSuppressInitDataOwner, TSecureId aProxySID) |
190 TPtr8& aBuffer, TBool& aLastSection, TBool aSuppressInitDataOwner, TSecureId aProxySID) |
177 /** |
191 /** |
184 @param aLastSection Flag to indicate whether this is the last operation in a multi-part transfer |
198 @param aLastSection Flag to indicate whether this is the last operation in a multi-part transfer |
185 @param aSuppressInitDataOwner Suppress the initialisation of Data Owner |
199 @param aSuppressInitDataOwner Suppress the initialisation of Data Owner |
186 @param aProxySID The secure ID of the proxy |
200 @param aProxySID The secure ID of the proxy |
187 */ |
201 */ |
188 { |
202 { |
|
203 OstTraceFunctionEntry0( CABSERVER_REQUESTDATAL_ENTRY ); |
189 CABSession& session = iSessionMap->SessionL(aSID); |
204 CABSession& session = iSessionMap->SessionL(aSID); |
190 |
205 |
191 session.RequestDataL(aDriveNumber, aTransferType, aBuffer, aLastSection, aSuppressInitDataOwner, aProxySID); |
206 session.RequestDataL(aDriveNumber, aTransferType, aBuffer, aLastSection, aSuppressInitDataOwner, aProxySID); |
|
207 OstTraceFunctionExit0( CABSERVER_REQUESTDATAL_EXIT ); |
192 } |
208 } |
193 |
209 |
194 void CABServer::GetExpectedDataSizeL(TSecureId aSID, TDriveNumber aDriveNumber, TUint& aSize) |
210 void CABServer::GetExpectedDataSizeL(TSecureId aSID, TDriveNumber aDriveNumber, TUint& aSize) |
195 /** |
211 /** |
196 Get the expected size of the data that will be returned |
212 Get the expected size of the data that will be returned |
198 @param aSID The secure ID of the data owner to signal |
214 @param aSID The secure ID of the data owner to signal |
199 @param aDriveNumber The drive number that the data corresponds to |
215 @param aDriveNumber The drive number that the data corresponds to |
200 @param aSize The size of the data owner's data |
216 @param aSize The size of the data owner's data |
201 */ |
217 */ |
202 { |
218 { |
|
219 OstTraceFunctionEntry0( CABSERVER_GETEXPECTEDDATASIZEL_ENTRY ); |
203 CABSession& session = iSessionMap->SessionL(aSID); |
220 CABSession& session = iSessionMap->SessionL(aSID); |
204 |
221 |
205 session.GetExpectedDataSizeL(aDriveNumber, aSize); |
222 session.GetExpectedDataSizeL(aDriveNumber, aSize); |
|
223 OstTraceFunctionExit0( CABSERVER_GETEXPECTEDDATASIZEL_EXIT ); |
206 } |
224 } |
207 |
225 |
208 void CABServer::AllSnapshotsSuppliedL(TSecureId aSID) |
226 void CABServer::AllSnapshotsSuppliedL(TSecureId aSID) |
209 /** Lets the client know that all its snapshots have been supplied |
227 /** Lets the client know that all its snapshots have been supplied |
210 |
228 |
211 @param aSID The secure ID of the data owner to signal |
229 @param aSID The secure ID of the data owner to signal |
212 */ |
230 */ |
213 { |
231 { |
|
232 OstTraceFunctionEntry0( CABSERVER_ALLSNAPSHOTSSUPPLIEDL_ENTRY ); |
214 CABSession& session = iSessionMap->SessionL(aSID); |
233 CABSession& session = iSessionMap->SessionL(aSID); |
215 |
234 |
216 session.AllSnapshotsSuppliedL(); |
235 session.AllSnapshotsSuppliedL(); |
|
236 OstTraceFunctionExit0( CABSERVER_ALLSNAPSHOTSSUPPLIEDL_EXIT ); |
217 } |
237 } |
218 |
238 |
219 void CABServer::InvalidateABSessions() |
239 void CABServer::InvalidateABSessions() |
220 /** Set each CABSession currently hold for each active backup |
240 /** Set each CABSession currently hold for each active backup |
221 * client as invalid, since there maybe some delay for the |
241 * client as invalid, since there maybe some delay for the |
222 * arrival of disconnect request from client. Within this time, |
242 * arrival of disconnect request from client. Within this time, |
223 * this session can not be used for another backup/restore. |
243 * this session can not be used for another backup/restore. |
224 */ |
244 */ |
225 { |
245 { |
|
246 OstTraceFunctionEntry0( CABSERVER_INVALIDATEABSESSIONS_ENTRY ); |
226 iSessionMap->InvalidateABSessions(); |
247 iSessionMap->InvalidateABSessions(); |
|
248 OstTraceFunctionExit0( CABSERVER_INVALIDATEABSESSIONS_EXIT ); |
227 } |
249 } |
228 |
250 |
229 TDataOwnerStatus CABServer::SessionReadyStateL(TSecureId aSID) |
251 TDataOwnerStatus CABServer::SessionReadyStateL(TSecureId aSID) |
230 /** |
252 /** |
231 Returns the status of the active backup client |
253 Returns the status of the active backup client |
232 |
254 |
233 @param aSID The SecureId of the session to query for |
255 @param aSID The SecureId of the session to query for |
234 @return Data owner status of the session |
256 @return Data owner status of the session |
235 */ |
257 */ |
236 { |
258 { |
|
259 OstTraceFunctionEntry0( CABSERVER_SESSIONREADYSTATEL_ENTRY ); |
237 CABSession& session = iSessionMap->SessionL(aSID); |
260 CABSession& session = iSessionMap->SessionL(aSID); |
238 |
261 |
239 TDataOwnerStatus doStatus = EDataOwnerNotConnected; |
262 TDataOwnerStatus doStatus = EDataOwnerNotConnected; |
240 if (session.Invalidated()) |
263 if (session.Invalidated()) |
241 { |
264 { |
242 __LOG1("CABServer::SessionReadyStateL session for 0x%08x has been invalidated, return NotConnected", |
265 OstTrace1(TRACE_NORMAL, CABSERVER_SESSIONREADYSTATEL, "session for 0x%08x has been invalidated, return NotConnected", |
243 aSID.iId); |
266 aSID.iId); |
244 |
267 |
|
268 OstTraceFunctionExit0( CABSERVER_SESSIONREADYSTATEL_EXIT ); |
245 return doStatus; |
269 return doStatus; |
246 } |
270 } |
247 |
271 |
248 if (session.CallbackInterfaceAvailable()) |
272 if (session.CallbackInterfaceAvailable()) |
249 { |
273 { |
250 __LOG2("CABServer::SessionReadyStateL session for 0x%08x already have interface, confirmed:%d ", |
274 OstTraceExt2(TRACE_NORMAL, DUP1_CABSERVER_SESSIONREADYSTATEL, "session for 0x%08x already have interface, confirmed:%d ", |
251 aSID.iId, session.ConfirmedReadyForBUR()); |
275 aSID.iId, static_cast<TInt32>(session.ConfirmedReadyForBUR())); |
252 |
276 |
253 doStatus = EDataOwnerNotReady; |
277 doStatus = EDataOwnerNotReady; |
254 |
278 |
255 if (session.ConfirmedReadyForBUR()) |
279 if (session.ConfirmedReadyForBUR()) |
256 { |
280 { |
257 doStatus = EDataOwnerReady; |
281 doStatus = EDataOwnerReady; |
258 } |
282 } |
259 } |
283 } |
260 else |
284 else |
261 { |
285 { |
262 __LOG2("CABServer::SessionReadyStateL session for 0x%08x does not have interface, confimed:%d", |
286 OstTraceExt2(TRACE_NORMAL, DUP2_CABSERVER_SESSIONREADYSTATEL, "session for 0x%08x does not have interface, confimed:%d", |
263 aSID.iId, session.ConfirmedReadyForBUR()); |
287 aSID.iId, static_cast<TInt32>(session.ConfirmedReadyForBUR())); |
264 |
288 |
265 doStatus = EDataOwnerNotReady; |
289 doStatus = EDataOwnerNotReady; |
266 |
290 |
267 if (session.ConfirmedReadyForBUR()) |
291 if (session.ConfirmedReadyForBUR()) |
268 { |
292 { |
269 doStatus = EDataOwnerReadyNoImpl; |
293 doStatus = EDataOwnerReadyNoImpl; |
270 } |
294 } |
271 } |
295 } |
272 |
296 |
|
297 OstTraceFunctionExit0( DUP1_CABSERVER_SESSIONREADYSTATEL_EXIT ); |
273 return doStatus; |
298 return doStatus; |
274 } |
299 } |
275 |
300 |
276 void CABServer::RestoreCompleteL(TSecureId aSID, TDriveNumber aDrive) |
301 void CABServer::RestoreCompleteL(TSecureId aSID, TDriveNumber aDrive) |
277 /** |
302 /** |
297 @param aMessage Is ignored |
324 @param aMessage Is ignored |
298 @return A new instance of CABSession |
325 @return A new instance of CABSession |
299 @leave KErrNotSupported if the version passed in aVersion is not the same as this one |
326 @leave KErrNotSupported if the version passed in aVersion is not the same as this one |
300 */ |
327 */ |
301 { |
328 { |
|
329 OstTraceFunctionEntry0( CABSERVER_NEWSESSIONL_ENTRY ); |
302 TVersion thisVersion(KABMajorVersionNumber, |
330 TVersion thisVersion(KABMajorVersionNumber, |
303 KABMinorVersionNumber, |
331 KABMinorVersionNumber, |
304 KABBuildVersionNumber); |
332 KABBuildVersionNumber); |
305 |
333 |
306 if (!User::QueryVersionSupported(thisVersion, aVersion)) |
334 if (!User::QueryVersionSupported(thisVersion, aVersion)) |
307 { |
335 { |
|
336 OstTrace0(TRACE_ERROR, CABSERVER_NEWSESSIONL, "Leave: KErrNotSupported"); |
308 User::Leave(KErrNotSupported); |
337 User::Leave(KErrNotSupported); |
309 } |
338 } |
310 |
339 |
311 TSecureId sid = aMessage.SecureId(); |
340 TSecureId sid = aMessage.SecureId(); |
312 |
341 |
313 // The map creates the session and a map entry, then session ownership is passed to the server |
342 // The map creates the session and a map entry, then session ownership is passed to the server |
314 return &(iSessionMap->CreateL(sid)); |
343 CSession2* newSession = &(iSessionMap->CreateL(sid)); |
|
344 OstTraceFunctionExit0( CABSERVER_NEWSESSIONL_EXIT ); |
|
345 return newSession; |
315 } |
346 } |
316 |
347 |
317 TInt CABServer::RunError(TInt aError) |
348 TInt CABServer::RunError(TInt aError) |
318 /** Called when this active objects RunL leaves. |
349 /** Called when this active objects RunL leaves. |
319 |
350 |