111 CMSRPServerSubSession::~CMSRPServerSubSession() |
122 CMSRPServerSubSession::~CMSRPServerSubSession() |
112 { |
123 { |
113 MSRPLOG("CMSRPServerSubSession::~CMSRPServerSubSession Entered"); |
124 MSRPLOG("CMSRPServerSubSession::~CMSRPServerSubSession Entered"); |
114 |
125 |
115 iState = NULL; |
126 iState = NULL; |
|
127 |
|
128 QueueLog(); |
116 |
129 |
117 iOutMsgQ.Destroy(); |
130 iOutMsgQ.Destroy(); |
118 iInCommingMsgQ.Destroy(); |
131 iInCommingMsgQ.Destroy(); |
119 iPendingSendMsgQ.Destroy(); |
132 iPendingSendMsgQ.Destroy(); |
120 iPendingForDeletionQ.Destroy(); |
133 iPendingForDeletionQ.Destroy(); |
121 |
134 iPendingDataSendCompleteQ.Destroy(); |
|
135 iPendingDataIncCompleteQ.Destroy(); |
|
136 |
122 QueueLog(); |
137 QueueLog(); |
123 |
138 |
124 if(iCurrentMsgHandler) |
139 delete iCurrentMsgHandler; |
125 { |
|
126 delete iCurrentMsgHandler; |
|
127 iCurrentMsgHandler = NULL; |
|
128 } |
|
129 |
|
130 if(iConnection) |
140 if(iConnection) |
131 { |
141 { |
132 iConnection->ReleaseConnection(*this); |
142 iConnection->ReleaseConnection(*this); |
133 iConnection = NULL; |
143 iConnection = NULL; |
134 } |
144 } |
135 |
145 delete iLocalSessionID; |
136 if(iLocalSessionID) |
146 delete iRemoteSessionID; |
137 { |
147 delete iReceivedResp; |
138 delete iLocalSessionID; |
148 delete iReceiveFileMsgHdler; |
139 iLocalSessionID = NULL; |
|
140 } |
|
141 |
|
142 if( iRemoteSessionID ) |
|
143 { |
|
144 delete iRemoteSessionID; |
|
145 iRemoteSessionID = NULL; |
|
146 } |
|
147 |
|
148 if( iReceivedResp ) |
|
149 { |
|
150 delete iReceivedResp; |
|
151 iReceivedResp = NULL; |
|
152 } |
|
153 if( iReceiveFileMsgHdler ) |
|
154 { |
|
155 delete iReceiveFileMsgHdler; |
|
156 iReceiveFileMsgHdler = NULL; |
|
157 } |
|
158 |
149 |
159 MSRPLOG("CMSRPServerSubSession::~CMSRPServerSubSession Exit"); |
150 MSRPLOG("CMSRPServerSubSession::~CMSRPServerSubSession Exit"); |
160 } |
151 } |
161 |
152 |
162 |
153 |
163 void CMSRPServerSubSession::ConstructL( ) |
154 void CMSRPServerSubSession::ConstructL( const TDesC8& aSessionId ) |
164 { |
155 { |
165 // Not the place where this should be done!! |
156 // Not the place where this should be done!! |
166 MSRPLOG("CMSRPServerSubSession::ConstructL"); |
157 MSRPLOG("CMSRPServerSubSession::ConstructL"); |
167 iState = iStateFactory.getStateL( EIdle ); |
158 iState = iStateFactory.getStateL( EIdle ); |
168 iLocalSessionID = CreateSubSessionIDL(); |
159 iLocalSessionID = HBufC8::NewL( aSessionId.Length() ); |
169 } |
160 *iLocalSessionID = aSessionId; |
170 |
161 } |
171 |
162 |
|
163 |
|
164 #if 0 |
172 HBufC8* CMSRPServerSubSession::CreateSubSessionIDL( ) |
165 HBufC8* CMSRPServerSubSession::CreateSubSessionIDL( ) |
173 { |
166 { |
174 MSRPLOG("CMSRPServerSubSession::CreateSubSessionIDL"); |
167 MSRPLOG("CMSRPServerSubSession::CreateSubSessionIDL"); |
175 HBufC8 *sessID = HBufC8::NewLC(KMSRPSessIdLength); |
168 HBufC8 *sessID = HBufC8::NewLC(KMSRPSessIdLength); |
176 TInt64 randSeed(Math::Random()); |
169 TInt64 randSeed(Math::Random()); |
251 |
262 |
252 if( (aMsg->MessageType() == MMSRPIncomingMessage::EMSRPMessage || |
263 if( (aMsg->MessageType() == MMSRPIncomingMessage::EMSRPMessage || |
253 aMsg->MessageType() == MMSRPIncomingMessage::EMSRPNotDefined ) |
264 aMsg->MessageType() == MMSRPIncomingMessage::EMSRPNotDefined ) |
254 && EFalse == matchSessionIDL(aMsg->GetIncomingMessage()->ToPathHeader())) |
265 && EFalse == matchSessionIDL(aMsg->GetIncomingMessage()->ToPathHeader())) |
255 { |
266 { |
256 TBool sendToClient = aMsg->SendResponseL(this, *iConnection, |
267 aMsg->SendResponseL(this, *iConnection, ESessionDoesNotExist ); |
257 CMSRPResponse::ESessionDoesNotExist); |
268 if ( aMsg->IsMessageComplete() ) |
258 iPendingForDeletionQ.Queue(*aMsg); |
269 { |
|
270 // no response was needed, must check report also |
|
271 aMsg->SendReportL( this, *iConnection, ESessionDoesNotExist ); |
|
272 if ( aMsg->IsMessageComplete() ) |
|
273 { |
|
274 delete aMsg; |
|
275 } |
|
276 else |
|
277 { |
|
278 iPendingForDeletionQ.Queue(*aMsg); |
|
279 } |
|
280 } |
|
281 else |
|
282 { |
|
283 iPendingForDeletionQ.Queue(*aMsg); |
|
284 } |
259 } |
285 } |
260 else |
286 else |
261 { |
287 { |
262 delete aMsg; |
288 delete aMsg; |
263 } |
289 } |
264 } |
290 } |
265 |
291 |
266 |
|
267 // Implementation of interface from MMSRPMsgObserver. |
292 // Implementation of interface from MMSRPMsgObserver. |
268 |
293 |
269 void CMSRPServerSubSession::MessageSendCompleteL() |
294 void CMSRPServerSubSession::MessageSendCompleteL( CMSRPMessageHandler* aMessageHandler ) |
270 { |
295 { |
271 // Called when a message is fully sent out. |
296 // Called when a message is fully sent out. |
272 ProcessEventL(EMSRPDataSendCompleteEvent); |
297 iCurrentMsgHandler = aMessageHandler; |
|
298 ProcessEventL( EMSRPDataSendCompleteEvent ); |
273 } |
299 } |
274 |
300 |
275 void CMSRPServerSubSession::MessageResponseSendCompleteL(CMSRPMessageHandler& aMsg) |
301 void CMSRPServerSubSession::MessageResponseSendCompleteL(CMSRPMessageHandler& aMsg) |
276 { |
302 { |
277 // Called when a message is fully sent out. |
303 // Called when a message is fully sent out. |
278 // Common event handling. |
304 // Common event handling. |
|
305 if ( iPendingForDeletionQ.FindElement( &aMsg ) ) |
|
306 { |
|
307 // no need to handle, this message did not belong to this session |
|
308 iPendingForDeletionQ.explicitRemove( &aMsg ); |
|
309 delete &aMsg; |
|
310 return; |
|
311 } |
279 iReceivedResp = &aMsg; |
312 iReceivedResp = &aMsg; |
280 if(iFileShare) |
313 ProcessEventL( EMSRPResponseSendCompleteEvent ); |
281 { |
314 delete iReceivedResp; |
282 ProcessEventL(EMSRPResponseSendCompleteEvent); |
315 iReceivedResp = NULL; |
283 } |
316 } |
284 if(iPendingForDeletionQ.explicitRemove(iReceivedResp)) |
317 |
|
318 void CMSRPServerSubSession::MessageReportSendCompleteL( CMSRPMessageHandler& aMsg ) |
|
319 { |
|
320 if ( iPendingForDeletionQ.FindElement( &aMsg ) ) |
|
321 { |
|
322 // no need to handle, this message did not belong to this session |
|
323 iPendingForDeletionQ.explicitRemove( &aMsg ); |
|
324 delete &aMsg; |
|
325 return; |
|
326 } |
|
327 iReceivedReport = &aMsg; |
|
328 ProcessEventL( EMSRPReportSendCompleteEvent ); |
|
329 delete iReceivedReport; |
|
330 iReceivedReport = NULL; |
|
331 } |
|
332 |
|
333 void CMSRPServerSubSession::MessageSendProgressL( CMSRPMessageHandler* aMessageHandler ) |
|
334 { |
|
335 MSRPLOG2( "CMSRPServerSubSession::MessageSendProgressL, instance = %d", aMessageHandler ) |
|
336 if ( iSendProgressReports ) |
|
337 { |
|
338 iSendProgressMsg = aMessageHandler; |
|
339 ProcessEventL( EMSRPSendProgressEvent ); |
|
340 } |
|
341 } |
|
342 |
|
343 void CMSRPServerSubSession::MessageReceiveProgressL( CMSRPMessageHandler* aMessageHandler ) |
|
344 { |
|
345 MSRPLOG2( "CMSRPServerSubSession::MessageReceiveProgressL, instance = %d", aMessageHandler ) |
|
346 if ( iSendProgressReports ) |
|
347 { |
|
348 if ( CheckMessageSessionIdL( aMessageHandler ) ) |
285 { |
349 { |
286 delete iReceivedResp; |
350 if ( !iCurrentlyReceivingMsgQ.FindElement( aMessageHandler ) ) |
287 iReceivedResp = NULL; |
351 { |
|
352 iCurrentlyReceivingMsgQ.Queue( *aMessageHandler ); |
|
353 } |
|
354 iReceiveProgressMsg = aMessageHandler; |
|
355 ProcessEventL( EMSRPReceiveProgressEvent ); |
288 } |
356 } |
289 |
357 } |
290 } |
358 } |
291 |
359 |
292 |
360 void CMSRPServerSubSession::MessageCancelledL( ) |
293 void CMSRPServerSubSession::MessageSendProgressL(TInt aBytesSent, TInt aTotalBytes) |
361 { |
294 { |
362 MSRPLOG( "CMSRPServerSubSession::MessageCancelledL enter" ) |
295 iBytesTransferred = aBytesSent; |
363 ProcessEventL( EMSRPDataCancelledEvent ); |
296 iTotalBytes = aTotalBytes; |
364 MSRPLOG( "CMSRPServerSubSession::MessageCancelledL exit" ) |
297 ProcessEventL(EMSRPSendProgressEvent); |
365 } |
298 } |
|
299 |
|
300 |
|
301 void CMSRPServerSubSession::MessageReceiveProgressL(TInt aBytesRecvd, TInt aTotalBytes) |
|
302 { |
|
303 iBytesTransferred = aBytesRecvd; |
|
304 iTotalBytes = aTotalBytes; |
|
305 ProcessEventL(EMSRPReceiveProgressEvent); |
|
306 } |
|
307 |
|
308 |
366 |
309 void CMSRPServerSubSession::WriterError() |
367 void CMSRPServerSubSession::WriterError() |
310 { |
368 { |
311 |
369 MSRPLOG( "CMSRPServerSubSession::WriterError!!" ) |
312 } |
370 } |
313 |
371 |
314 |
372 |
315 // Utility Stuff - Common functions used often by States. |
373 // Utility Stuff - Common functions used often by States. |
316 void CMSRPServerSubSession::CompleteClient(TInt aReason) |
374 void CMSRPServerSubSession::CompleteClient(TInt aReason) |
345 aMessage->Complete( KErrNone ); |
403 aMessage->Complete( KErrNone ); |
346 return TRUE; |
404 return TRUE; |
347 } |
405 } |
348 |
406 |
349 |
407 |
350 void CMSRPServerSubSession::NotifyFileReceiveResultToClientL(CMSRPMessageHandler */*msgHandler*/) |
408 void CMSRPServerSubSession::SendProgressToClientL( CMSRPMessageHandler* aMessageHandler ) |
351 { |
409 { |
352 //TODO |
410 MSRPLOG2("CMSRPServerSubSession::SendProgressToClientL enter, instance = %d", aMessageHandler ); |
353 MSRPLOG("CMSRPServerSubSession::NotifyFileReceiveResultToClientL enter"); |
411 TInt bytesTransferred; |
354 iSendResultListenMSRPDataPckg().iStatus = 200; |
412 TInt totalBytes; |
355 iSendResultListenMSRPDataPckg().iIsProgress = FALSE; |
413 aMessageHandler->CurrentSendProgress( bytesTransferred, totalBytes ); |
|
414 MSRPLOG2( "CMSRPServerSubSession::SendProgressToClientL, bytesr = %d", bytesTransferred ) |
|
415 MSRPLOG2( "CMSRPServerSubSession::SendProgressToClientL, total = %d", totalBytes ) |
|
416 HBufC8* messageId = aMessageHandler->MessageIdLC(); |
|
417 iSendResultListenMSRPDataPckg().iStatus = EAllOk; |
|
418 iSendResultListenMSRPDataPckg().iIsProgress = TRUE; |
|
419 iSendResultListenMSRPDataPckg().iBytesSent = bytesTransferred; |
|
420 iSendResultListenMSRPDataPckg().iTotalBytes = totalBytes; |
|
421 if ( messageId->Length() < KMaxLengthOfSessionId ) |
|
422 { |
|
423 iSendResultListenMSRPDataPckg().iMessageId = *messageId; |
|
424 } |
|
425 CleanupStack::PopAndDestroy(); // messageId |
356 iResponseListner.Write(0,iSendResultListenMSRPDataPckg); |
426 iResponseListner.Write(0,iSendResultListenMSRPDataPckg); |
357 iResponseListner.Complete( KErrNone ); |
427 iResponseListner.Complete( KErrNone ); |
358 MSRPLOG("CMSRPServerSubSession::NotifyFileReceiveResultToClientL exit"); |
|
359 } |
|
360 |
|
361 |
|
362 void CMSRPServerSubSession::NotifyFileSendResultToClientL(CMSRPMessageHandler */*msgHandler*/) |
|
363 { |
|
364 //TODO |
|
365 MSRPLOG("CMSRPServerSubSession::NotifyFileSendResultToClientL enter"); |
|
366 iSendResultListenMSRPDataPckg().iStatus = 200; |
|
367 iSendResultListenMSRPDataPckg().iIsProgress = FALSE; |
|
368 iResponseListner.Write(0,iSendResultListenMSRPDataPckg); |
|
369 iResponseListner.Complete( KErrNone ); |
|
370 MSRPLOG("CMSRPServerSubSession::NotifyFileSendResultToClientL exit"); |
|
371 } |
|
372 |
|
373 |
|
374 TBool CMSRPServerSubSession::SendProgressToClientL(CMSRPMessageHandler */*msgHandler*/) |
|
375 { |
|
376 MSRPLOG("CMSRPServerSubSession::SendProgressToClientL enter"); |
|
377 iSendResultListenMSRPDataPckg().iStatus = KErrNone; |
|
378 iSendResultListenMSRPDataPckg().iIsProgress = TRUE; |
|
379 iSendResultListenMSRPDataPckg().iBytesSent = iBytesTransferred; |
|
380 iSendResultListenMSRPDataPckg().iTotalBytes = iTotalBytes; |
|
381 |
|
382 iResponseListner.Write(0,iSendResultListenMSRPDataPckg); |
|
383 iResponseListner.Complete( KErrNone ); |
|
384 |
428 |
385 MSRPLOG("CMSRPServerSubSession::SendProgressToClientL exit"); |
429 MSRPLOG("CMSRPServerSubSession::SendProgressToClientL exit"); |
386 return TRUE; |
430 } |
387 } |
431 |
388 |
432 |
389 |
433 void CMSRPServerSubSession::ReceiveProgressToClientL( CMSRPMessageHandler* aMessageHandler ) |
390 TBool CMSRPServerSubSession::ReceiveProgressToClientL(CMSRPMessageHandler */*msgHandler*/) |
434 { |
391 { |
435 MSRPLOG2("CMSRPServerSubSession::ReceiveProgressToClientL enter, instance = %d", aMessageHandler ); |
392 MSRPLOG("CMSRPServerSubSession::ReceiveProgressToClientL enter"); |
436 TInt bytesReceived; |
|
437 TInt totalBytes; |
|
438 aMessageHandler->CurrentReceiveProgress( bytesReceived, totalBytes ); |
|
439 MSRPLOG2( "CMSRPServerSubSession::ReceiveProgressToClientL, bytesr = %d", bytesReceived ) |
|
440 MSRPLOG2( "CMSRPServerSubSession::ReceiveProgressToClientL, total = %d", totalBytes ) |
|
441 HBufC8* messageId = aMessageHandler->MessageIdLC(); |
393 iListenMSRPdataPckg().iStatus = KErrNone; |
442 iListenMSRPdataPckg().iStatus = KErrNone; |
394 iListenMSRPdataPckg().iIsProgress = TRUE; |
443 iListenMSRPdataPckg().iIsProgress = TRUE; |
395 iListenMSRPdataPckg().iBytesRecvd = iBytesTransferred; |
444 iListenMSRPdataPckg().iBytesRecvd = bytesReceived; |
396 iListenMSRPdataPckg().iTotalBytes = iTotalBytes; |
445 iListenMSRPdataPckg().iTotalBytes = totalBytes; |
397 |
446 if ( messageId->Length() < KMaxLengthOfSessionId ) |
|
447 { |
|
448 iListenMSRPdataPckg().iMessageId = *messageId; |
|
449 } |
|
450 CleanupStack::PopAndDestroy(); // messageId |
398 iIncommingMessageListner.Write(0,iListenMSRPdataPckg); |
451 iIncommingMessageListner.Write(0,iListenMSRPdataPckg); |
399 iIncommingMessageListner.Complete( KErrNone ); |
452 iIncommingMessageListner.Complete( KErrNone ); |
400 MSRPLOG("CMSRPServerSubSession::ReceiveProgressToClientL exit"); |
453 MSRPLOG("CMSRPServerSubSession::ReceiveProgressToClientL exit"); |
401 return TRUE; |
454 } |
402 } |
455 |
403 |
456 |
404 |
457 void CMSRPServerSubSession::sendResultToClientL(CMSRPMessageHandler *msgHandler) |
405 TBool CMSRPServerSubSession::sendResultToClientL(CMSRPMessageHandler *msgHandler) |
|
406 { |
458 { |
407 MSRPLOG("CMSRPServerSubSession::sendResultToClientL"); |
459 MSRPLOG("CMSRPServerSubSession::sendResultToClientL"); |
408 HBufC8* messageId = NULL; |
460 HBufC8* messageId = NULL; |
409 TUint i=0; |
|
410 |
461 |
411 // Allocates memory. |
462 // Allocates memory. |
412 TBool error = msgHandler->GetSendResultL( i, messageId ); |
463 TUint errorCode = msgHandler->GetSendResultL( messageId ); |
413 |
464 |
414 iSendResultListenMSRPDataPckg().iIsProgress = FALSE; |
465 iSendResultListenMSRPDataPckg().iIsProgress = FALSE; |
415 iSendResultListenMSRPDataPckg().iMessageId = *messageId; |
466 iSendResultListenMSRPDataPckg().iMessageId = *messageId; |
416 iSendResultListenMSRPDataPckg().iStatus = i; |
467 iSendResultListenMSRPDataPckg().iStatus = errorCode; |
417 iResponseListner.Write(0,iSendResultListenMSRPDataPckg); |
468 iResponseListner.Write(0,iSendResultListenMSRPDataPckg); |
418 |
469 |
419 delete messageId; |
470 delete messageId; |
420 iResponseListner.Complete( KErrNone ); |
471 iResponseListner.Complete( KErrNone ); |
421 return error; |
|
422 } |
472 } |
423 |
473 |
424 |
474 |
425 TBool CMSRPServerSubSession::sendMsgToClientL(CMSRPMessageHandler *incommingMsgHandler) |
475 TBool CMSRPServerSubSession::sendMsgToClientL(CMSRPMessageHandler *incommingMsgHandler) |
426 { |
476 { |
427 // Use the client send result listner to respond. |
477 // Use the client send result listner to respond. |
428 // Extract the data and complete the iIncommingMessageListner. |
478 // Extract the data and complete the iIncommingMessageListner. |
429 MSRPLOG("CMSRPServerSubSession::sendMsgToClientL"); |
479 MSRPLOG("CMSRPServerSubSession::sendMsgToClientL"); |
430 CMSRPMessage* inMsg = incommingMsgHandler->GetIncomingMessage(); |
480 CMSRPMessage* inMsg = incommingMsgHandler->GetIncomingMessage(); |
431 |
481 |
432 CBufSeg* buf1 = CBufSeg::NewL( 256 ); // expandsize 256 |
482 if ( inMsg ) |
433 CleanupStack::PushL( buf1 ); |
483 { |
434 RBufWriteStream writeStream( *buf1 ); |
484 CBufSeg* buf1 = CBufSeg::NewL( 256 ); // expandsize 256 |
435 CleanupClosePushL( writeStream ); |
485 CleanupStack::PushL( buf1 ); |
436 |
486 RBufWriteStream writeStream( *buf1 ); |
437 inMsg->ExternalizeL( writeStream ); |
487 CleanupClosePushL( writeStream ); |
438 writeStream.CommitL(); |
488 |
439 |
489 inMsg->ExternalizeL( writeStream ); |
440 iListenMSRPdataPckg().iIsProgress = FALSE; |
490 writeStream.CommitL(); |
441 if ( buf1->Size() > KMaxLengthOfIncomingMessageExt ) |
491 |
442 { |
492 iListenMSRPdataPckg().iIsProgress = FALSE; |
443 // invalid message size |
493 if ( buf1->Size() > KMaxLengthOfIncomingMessageExt ) |
444 iListenMSRPdataPckg().iStatus = KErrArgument; |
494 { |
445 } |
495 // invalid message size |
446 else |
496 iListenMSRPdataPckg().iStatus = KErrArgument; |
447 { |
497 } |
448 buf1->Read( 0, iListenMSRPdataPckg().iExtMessageBuffer, buf1->Size() ); |
498 else |
449 iListenMSRPdataPckg().iStatus = KErrNone; |
499 { |
450 } |
500 buf1->Read( 0, iListenMSRPdataPckg().iExtMessageBuffer, buf1->Size() ); |
451 |
501 iListenMSRPdataPckg().iStatus = KErrNone; |
452 CleanupStack::PopAndDestroy(2); // buf1, writestream |
502 } |
453 |
503 |
454 iIncommingMessageListner.Write(0,iListenMSRPdataPckg); |
504 CleanupStack::PopAndDestroy(2); // buf1, writestream |
455 iIncommingMessageListner.Complete(KErrNone); |
505 |
456 |
506 iIncommingMessageListner.Write(0,iListenMSRPdataPckg); |
457 return TRUE; |
507 iIncommingMessageListner.Complete(KErrNone); |
|
508 |
|
509 return ETrue; |
|
510 } |
|
511 |
|
512 return EFalse; |
|
513 } |
|
514 |
|
515 TBool CMSRPServerSubSession::sendReportToClientL( CMSRPMessageHandler *incommingMsgHandler ) |
|
516 { |
|
517 // Use the client send result listner to respond. |
|
518 // Extract the data and complete the iIncommingMessageListner. |
|
519 MSRPLOG("CMSRPServerSubSession::sendReportToClientL"); |
|
520 CMSRPReport* inMsg = incommingMsgHandler->GetIncomingReport(); |
|
521 |
|
522 if ( inMsg ) |
|
523 { |
|
524 CBufSeg* buf1 = CBufSeg::NewL( 256 ); // expandsize 256 |
|
525 CleanupStack::PushL( buf1 ); |
|
526 RBufWriteStream writeStream( *buf1 ); |
|
527 CleanupClosePushL( writeStream ); |
|
528 |
|
529 inMsg->ExternalizeL( writeStream ); |
|
530 writeStream.CommitL(); |
|
531 |
|
532 iListenMSRPdataPckg().iIsProgress = FALSE; |
|
533 if ( buf1->Size() > KMaxLengthOfIncomingMessageExt ) |
|
534 { |
|
535 // invalid message size |
|
536 iListenMSRPdataPckg().iStatus = KErrArgument; |
|
537 } |
|
538 else |
|
539 { |
|
540 buf1->Read( 0, iListenMSRPdataPckg().iExtMessageBuffer, buf1->Size() ); |
|
541 iListenMSRPdataPckg().iStatus = KErrNone; |
|
542 } |
|
543 |
|
544 CleanupStack::PopAndDestroy(2); // buf1, writestream |
|
545 |
|
546 iIncommingMessageListner.Write(0,iListenMSRPdataPckg); |
|
547 iIncommingMessageListner.Complete(KErrNone); |
|
548 |
|
549 return ETrue; |
|
550 } |
|
551 |
|
552 return EFalse; |
458 } |
553 } |
459 |
554 |
460 void CMSRPServerSubSession::ReadSendDataPckgL() |
555 void CMSRPServerSubSession::ReadSendDataPckgL() |
461 { |
556 { |
462 iClientMessage->ReadL( 0, iSendMSRPdataPckg); |
557 iClientMessage->ReadL( 0, iSendMSRPdataPckg); |
463 return; |
558 return; |
464 } |
559 } |
465 |
560 |
466 TBool CMSRPServerSubSession::listnerSetupComplete() |
561 TBool CMSRPServerSubSession::listnerSetupComplete() |
467 { |
562 { |
468 if(iIncommingMessageListner.Check() && iResponseListner.Check()) |
563 if( iIncommingMessageListner.Check() && iResponseListner.Check() ) |
469 return TRUE; |
564 { |
470 |
565 return ETrue; |
471 return FALSE; |
566 } |
|
567 |
|
568 return EFalse; |
472 } |
569 } |
473 |
570 |
474 CMSRPServerSubSession::TQueueType CMSRPServerSubSession::getQToProcess() |
571 CMSRPServerSubSession::TQueueType CMSRPServerSubSession::getQToProcess() |
475 { |
572 { |
476 // Check the pending incomming message queue and client request queue and |
573 // Priority 0, progress reports |
477 // decides which to process. |
574 if ( iPendingSendProgressQ.Length( ) ) |
478 // The longer queue is given a priority. If queues are equal incomming message queue |
575 { |
479 // is given priority. |
576 return TSendProgressQueue; |
480 |
577 } |
481 if(iPendingSendMsgQ.Length() > iInCommingMsgQ.Length()) |
578 if ( iPendingReceiveProgressQ.Length( ) ) |
|
579 { |
|
580 return TReceiveProgressQueue; |
|
581 } |
|
582 |
|
583 // priority 1, completed send messages |
|
584 if ( iPendingDataSendCompleteQ.Length() ) |
|
585 { |
|
586 return TCompletedSendQueue; |
|
587 } |
|
588 |
|
589 // priority 2, completed receive message |
|
590 if ( iPendingDataIncCompleteQ.Length() ) |
|
591 { |
|
592 return TCompletedIncQueue; |
|
593 } |
|
594 |
|
595 // priority 3, incoming messages and client requests |
|
596 if( iPendingSendMsgQ.Length() > iInCommingMsgQ.Length() ) |
|
597 { |
482 return TClientQueue; |
598 return TClientQueue; |
|
599 } |
483 else |
600 else |
484 return TInCommingMsgQueue; |
601 { |
|
602 return TInCommingMsgQueue; |
|
603 } |
485 } |
604 } |
486 |
605 |
487 |
606 |
488 TBool CMSRPServerSubSession::QueuesEmpty() |
607 TBool CMSRPServerSubSession::QueuesEmpty() |
489 { |
608 { |
490 // Returns TRUE if there are no messages to process. |
609 // Returns TRUE if there are no messages to process. |
491 if(iPendingSendMsgQ.isEmpty() && iInCommingMsgQ.isEmpty()) |
610 if( iPendingSendProgressQ.isEmpty() && |
492 return TRUE; |
611 iPendingReceiveProgressQ.isEmpty() && |
|
612 iPendingDataSendCompleteQ.isEmpty() && |
|
613 iPendingDataIncCompleteQ.isEmpty() && |
|
614 iPendingSendMsgQ.isEmpty() && |
|
615 iInCommingMsgQ.isEmpty() ) |
|
616 { |
|
617 return ETrue; |
|
618 } |
493 else |
619 else |
494 return FALSE; |
620 { |
|
621 return EFalse; |
|
622 } |
495 } |
623 } |
496 |
624 |
497 TBool CMSRPServerSubSession::informConnectionReadyToClient() |
625 TBool CMSRPServerSubSession::informConnectionReadyToClient() |
498 { |
626 { |
499 // The function informs the Client side that the pending connection request(Connect or Listen) |
627 // The function informs the Client side that the pending connection request(Connect or Listen) |
527 MSRPLOG2("CMSRPServerSubSession::ProcessEventL() Queue iPendingSendMsgQ %d", |
657 MSRPLOG2("CMSRPServerSubSession::ProcessEventL() Queue iPendingSendMsgQ %d", |
528 iPendingSendMsgQ.Length()); |
658 iPendingSendMsgQ.Length()); |
529 |
659 |
530 MSRPLOG2("CMSRPServerSubSession::ProcessEventL() Queue iPendingForDeletionQ %d", |
660 MSRPLOG2("CMSRPServerSubSession::ProcessEventL() Queue iPendingForDeletionQ %d", |
531 iPendingForDeletionQ.Length()); |
661 iPendingForDeletionQ.Length()); |
|
662 |
|
663 MSRPLOG2("CMSRPServerSubSession::ProcessEventL() Queue iPendingDataSendCompleteQ %d", |
|
664 iPendingDataSendCompleteQ.Length()); |
|
665 |
|
666 MSRPLOG2("CMSRPServerSubSession::ProcessEventL() Queue iPendingDataIncCompleteQ %d", |
|
667 iPendingDataIncCompleteQ.Length()); |
|
668 |
|
669 MSRPLOG2("CMSRPServerSubSession::ProcessEventL() Queue iPendingSendProgressQ %d", |
|
670 iPendingSendProgressQ.Length() ); |
|
671 |
|
672 MSRPLOG2("CMSRPServerSubSession::ProcessEventL() Queue iPendingReceiveProgressQ %d", |
|
673 iPendingReceiveProgressQ.Length() ); |
532 } |
674 } |
533 else |
675 else |
534 { |
676 { |
535 MSRPLOG("CMSRPServerSubSession::ProcessEventL() Queue All Empty"); |
677 MSRPLOG("CMSRPServerSubSession::ProcessEventL() Queue All Empty"); |
536 } |
678 } |
537 } |
679 } |
538 |
680 |
539 |
681 |
540 TBool CMSRPServerSubSession::checkMessageForSelfL(CMSRPMessageHandler *aMsgHandler) |
682 // ----------------------------------------------------------------------------- |
541 { |
683 // CMSRPServerSubSession::CheckMessageSessionIdL |
542 MSRPLOG("CMSRPServerSubSession::checkMessageForSelfL"); |
684 // ----------------------------------------------------------------------------- |
|
685 // |
|
686 TBool CMSRPServerSubSession::CheckMessageSessionIdL( CMSRPMessageHandler *aMsgHandler ) |
|
687 { |
|
688 MSRPLOG( "-> CMSRPServerSubSession::CheckMessageSessionIdL" ); |
543 CMSRPMessageBase *message = aMsgHandler->GetIncomingResponse(); |
689 CMSRPMessageBase *message = aMsgHandler->GetIncomingResponse(); |
544 if(!message) |
690 if(!message) |
545 { |
691 { |
546 message = aMsgHandler->GetIncomingMessage(); |
692 message = aMsgHandler->GetIncomingMessage(); |
547 } |
693 } |
548 |
694 |
549 if(!message) |
695 if( !message ) |
550 return FALSE; |
696 { |
|
697 message = aMsgHandler->GetIncomingReport(); |
|
698 } |
|
699 |
|
700 if( !message ) |
|
701 { |
|
702 return EFalse; |
|
703 } |
551 |
704 |
552 // Check if the sessionID in the 'To' path matches the LocalSessionID. |
705 // Check if the sessionID in the 'To' path matches the LocalSessionID. |
553 if(FALSE == matchSessionIDL(message->ToPathHeader())) |
706 if( !matchSessionIDL(message->ToPathHeader()) || |
554 return FALSE; |
707 !matchSessionIDL(message->FromPathHeader(), EFalse ) ) |
555 |
708 { |
556 // Check if the sessionID in the 'From' path matches the known RemoteSessionID. |
709 return EFalse; |
557 return matchSessionIDL(message->FromPathHeader(), FALSE); |
710 } |
558 } |
711 |
559 |
712 return ETrue; |
560 |
713 } |
|
714 |
561 TBool CMSRPServerSubSession::matchSessionIDL(const CMSRPHeaderBase *aPathHeader, TBool local) |
715 TBool CMSRPServerSubSession::matchSessionIDL(const CMSRPHeaderBase *aPathHeader, TBool local) |
562 { |
716 { |
563 TBool retVal = FALSE; |
717 TBool retVal( EFalse ); |
564 |
718 |
565 HBufC8* textValue = aPathHeader->ToTextValueLC(); |
719 HBufC8* textValue = aPathHeader->ToTextValueLC(); |
566 TPtrC8 receivedSessionID = extractSessionID(*textValue); |
720 TPtrC8 receivedSessionID = extractSessionID(*textValue); |
567 |
721 |
568 if(local && receivedSessionID == *iLocalSessionID) |
722 if(local && receivedSessionID == *iLocalSessionID) |
569 retVal = TRUE; |
723 { |
|
724 retVal = ETrue; |
|
725 } |
570 |
726 |
571 |
727 |
572 if(!local && receivedSessionID == *iRemoteSessionID) |
728 if(!local && receivedSessionID == *iRemoteSessionID) |
573 retVal = TRUE; |
729 { |
|
730 retVal = ETrue; |
|
731 } |
574 |
732 |
575 CleanupStack::PopAndDestroy(textValue); |
733 CleanupStack::PopAndDestroy(textValue); |
576 |
734 |
577 return retVal; |
735 return retVal; |
578 } |
736 } |