contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/source/server/srasession.cpp
equal
deleted
inserted
replaced
21 #include "sraserver.h" |
21 #include "sraserver.h" |
22 #include "srarightsobject.h" |
22 #include "srarightsobject.h" |
23 #include "sraprocessor.h" |
23 #include "sraprocessor.h" |
24 #include "srautils.h" |
24 #include "srautils.h" |
25 #include <s32file.h> |
25 #include <s32file.h> |
|
26 #ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY |
26 #include <sdpconnectionfield.h> |
27 #include <sdpconnectionfield.h> |
|
28 #endif |
27 |
29 |
28 CSraSession::CSraSession() |
30 CSraSession::CSraSession() |
29 //constructor |
31 //constructor |
30 { |
32 { |
31 //empty |
33 //empty |
38 CSraServer* server = GetServerHandle(); |
40 CSraServer* server = GetServerHandle(); |
39 server->RemoveSession(); |
41 server->RemoveSession(); |
40 |
42 |
41 delete iKeyStreamSink; |
43 delete iKeyStreamSink; |
42 delete iRo; |
44 delete iRo; |
|
45 #ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY |
43 delete iSdp; |
46 delete iSdp; |
44 delete iSdpDoc; |
47 delete iSdpDoc; |
|
48 #endif |
45 delete iProcessor; |
49 delete iProcessor; |
46 iMutex.Close(); |
50 iMutex.Close(); |
47 } |
51 } |
48 |
52 |
49 CSraServer* CSraSession::GetServerHandle() |
53 CSraServer* CSraSession::GetServerHandle() |
325 Sets the SDP key stream field coming from the client. |
329 Sets the SDP key stream field coming from the client. |
326 |
330 |
327 @param aMessage Standard server-side handle to message. |
331 @param aMessage Standard server-side handle to message. |
328 */ |
332 */ |
329 { |
333 { |
|
334 #ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY |
330 TInt len = aMessage.GetDesMaxLengthL(0); |
335 TInt len = aMessage.GetDesMaxLengthL(0); |
331 HBufC8* des = HBufC8::NewLC(len); |
336 HBufC8* des = HBufC8::NewLC(len); |
332 TPtr8 ptr(des->Des()); |
337 TPtr8 ptr(des->Des()); |
333 aMessage.ReadL(0,ptr); |
338 aMessage.ReadL(0,ptr); |
334 |
339 |
348 { |
353 { |
349 User::Leave(KErrCANoRights); |
354 User::Leave(KErrCANoRights); |
350 } |
355 } |
351 StartProcessorL(); |
356 StartProcessorL(); |
352 aMessage.Complete(KErrNone); |
357 aMessage.Complete(KErrNone); |
|
358 #else |
|
359 (void) aMessage; |
|
360 User::Leave(KErrCANoRights); |
|
361 #endif |
353 } |
362 } |
354 |
363 |
355 |
364 |
356 void CSraSession::SetSdpDocumentL(const RMessage2& aMessage) |
365 void CSraSession::SetSdpDocumentL(const RMessage2& aMessage) |
357 /** |
366 /** |
358 Sets the SDP document object coming from the client. |
367 Sets the SDP document object coming from the client. |
359 |
368 |
360 @param aMessage Standard server-side handle to message. |
369 @param aMessage Standard server-side handle to message. |
361 */ |
370 */ |
362 { |
371 { |
|
372 #ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY |
363 TInt len = aMessage.GetDesMaxLengthL(0); |
373 TInt len = aMessage.GetDesMaxLengthL(0); |
364 HBufC8* des = HBufC8::NewLC(len); |
374 HBufC8* des = HBufC8::NewLC(len); |
365 TPtr8 ptr(des->Des()); |
375 TPtr8 ptr(des->Des()); |
366 aMessage.ReadL(0,ptr); |
376 aMessage.ReadL(0,ptr); |
367 |
377 |
372 // Decode the SDP document object from the encoded data |
382 // Decode the SDP document object from the encoded data |
373 iSdpDoc = CSdpDocument::DecodeL(*des); |
383 iSdpDoc = CSdpDocument::DecodeL(*des); |
374 CleanupStack::PopAndDestroy(des); |
384 CleanupStack::PopAndDestroy(des); |
375 |
385 |
376 aMessage.Complete(KErrNone); |
386 aMessage.Complete(KErrNone); |
|
387 #else |
|
388 (void) aMessage; |
|
389 #endif |
377 } |
390 } |
378 |
391 |
379 |
392 |
380 void CSraSession::StartProcessorL() |
393 void CSraSession::StartProcessorL() |
381 /** |
394 /** |
382 Start the key processor which creates key associations from the received key information |
395 Start the key processor which creates key associations from the received key information |
383 and then process that by using the key stream sink. |
396 and then process that by using the key stream sink. |
384 */ |
397 */ |
385 { |
398 { |
|
399 #ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY |
386 // Mutex is used to synchronise the agent with the test harness. |
400 // Mutex is used to synchronise the agent with the test harness. |
387 // A real-life agent should not need to use a mutex object. |
401 // A real-life agent should not need to use a mutex object. |
388 User::LeaveIfError(iMutex.CreateGlobal(KSraMutexName)); |
402 User::LeaveIfError(iMutex.CreateGlobal(KSraMutexName)); |
389 // Mutex has been created and now it is acquired. |
403 // Mutex has been created and now it is acquired. |
390 iMutex.Wait(); |
404 iMutex.Wait(); |
417 iProcessor = CSraProcessor::NewL(*this, _L("0.0.0.0"), iSdp->Port()); |
431 iProcessor = CSraProcessor::NewL(*this, _L("0.0.0.0"), iSdp->Port()); |
418 CleanupStack::PopAndDestroy(addr16); |
432 CleanupStack::PopAndDestroy(addr16); |
419 |
433 |
420 // Launch the processor |
434 // Launch the processor |
421 iProcessor->StartProcessing(); |
435 iProcessor->StartProcessing(); |
422 } |
436 #endif |
|
437 } |