232 { |
232 { |
233 TRAPD( err, GetAttributeSetL(aAttributeSet) ); |
233 TRAPD( err, GetAttributeSetL(aAttributeSet) ); |
234 return err; |
234 return err; |
235 } |
235 } |
236 |
236 |
237 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
238 void RRtaData::GetAttributeSetL (RAttributeSet &aAttributeSet, TBool aWmdrmFlag) const |
|
239 #else |
|
240 void RRtaData::GetAttributeSetL (RAttributeSet &aAttributeSet) const |
237 void RRtaData::GetAttributeSetL (RAttributeSet &aAttributeSet) const |
241 #endif // SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
242 { |
238 { |
243 TInt err = KErrOverflow; |
239 TInt err = KErrOverflow; |
244 TInt length = 0; |
240 TInt length = 0; |
245 TPckg <TInt> lengthPckg(length); |
241 TPckg <TInt> lengthPckg(length); |
246 |
242 |
265 { |
261 { |
266 HBufC8* transferBuffer = HBufC8::NewLC(length); |
262 HBufC8* transferBuffer = HBufC8::NewLC(length); |
267 transferBuffer->Des().Copy(bufPtr); |
263 transferBuffer->Des().Copy(bufPtr); |
268 TPtr8 transferPtr = transferBuffer->Des(); |
264 TPtr8 transferPtr = transferBuffer->Des(); |
269 |
265 |
270 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
271 if(aWmdrmFlag) |
|
272 err = SendReceive(EWMDRMGetAttributeSet, TIpcArgs(&transferPtr)); |
|
273 else |
|
274 err = SendReceive(EGetAttributeSet, TIpcArgs(&transferPtr)); |
|
275 #else |
|
276 // attempt to retrieve the attributes |
266 // attempt to retrieve the attributes |
277 err = SendReceive(EGetAttributeSet, TIpcArgs(&transferPtr)); |
267 err = SendReceive(EGetAttributeSet, TIpcArgs(&transferPtr)); |
278 #endif // SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
279 if(err == KErrOverflow) |
268 if(err == KErrOverflow) |
280 { |
269 { |
281 // Find out the length required to receive the resulting attribute set |
270 // Find out the length required to receive the resulting attribute set |
282 lengthPckg.Copy(transferPtr.Left(lengthPckg.MaxLength())); |
271 lengthPckg.Copy(transferPtr.Left(lengthPckg.MaxLength())); |
283 } |
272 } |
305 { |
294 { |
306 TRAPD( err, GetStringAttributeSetL(aStringAttributeSet) ); |
295 TRAPD( err, GetStringAttributeSetL(aStringAttributeSet) ); |
307 return err; |
296 return err; |
308 } |
297 } |
309 |
298 |
310 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
311 void RRtaData::GetStringAttributeSetL (RStringAttributeSet &aStringAttributeSet, TBool aWmdrmFlag) const |
|
312 #else |
|
313 void RRtaData::GetStringAttributeSetL (RStringAttributeSet &aStringAttributeSet) const |
299 void RRtaData::GetStringAttributeSetL (RStringAttributeSet &aStringAttributeSet) const |
314 #endif // SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
315 { |
300 { |
316 TInt err = KErrOverflow; |
301 TInt err = KErrOverflow; |
317 TInt length = 0; |
302 TInt length = 0; |
318 TPckg <TInt> lengthPckg(length); |
303 TPckg <TInt> lengthPckg(length); |
319 |
304 |
338 { |
323 { |
339 HBufC8* transferBuffer = HBufC8::NewLC(length); |
324 HBufC8* transferBuffer = HBufC8::NewLC(length); |
340 transferBuffer->Des().Copy(bufPtr); |
325 transferBuffer->Des().Copy(bufPtr); |
341 TPtr8 transferPtr = transferBuffer->Des(); |
326 TPtr8 transferPtr = transferBuffer->Des(); |
342 |
327 |
343 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
344 if(aWmdrmFlag) |
|
345 err = SendReceive(EWMDRMGetStringAttributeSet, TIpcArgs(&transferPtr)); |
|
346 else |
|
347 err = SendReceive(EGetStringAttributeSet, TIpcArgs(&transferPtr)); |
|
348 #else |
|
349 // attempt to retrieve the attributes |
328 // attempt to retrieve the attributes |
350 err = SendReceive(EGetStringAttributeSet, TIpcArgs(&transferPtr)); |
329 err = SendReceive(EGetStringAttributeSet, TIpcArgs(&transferPtr)); |
351 #endif // SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
352 if(err == KErrOverflow) |
330 if(err == KErrOverflow) |
353 { |
331 { |
354 // Find out the length required to receive the resulting attribute set |
332 // Find out the length required to receive the resulting attribute set |
355 lengthPckg.Copy(transferPtr.Left(lengthPckg.MaxLength())); |
333 lengthPckg.Copy(transferPtr.Left(lengthPckg.MaxLength())); |
356 } |
334 } |
382 err = SendReceive(ENoEnforceDataSetProperty, TIpcArgs(&agentPropertyPckg, &valuePckg)); |
360 err = SendReceive(ENoEnforceDataSetProperty, TIpcArgs(&agentPropertyPckg, &valuePckg)); |
383 } |
361 } |
384 return err; |
362 return err; |
385 } |
363 } |
386 |
364 |
387 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
388 |
|
389 EXPORT_C TInt RRtaData::Open(const TDesC8& aHeaderData) |
|
390 { |
|
391 TInt err = RRtaClient::Connect(); |
|
392 if(err != KErrNone) |
|
393 { |
|
394 return err; |
|
395 } |
|
396 |
|
397 if(IsDrmCapabilityEnforced()) |
|
398 { |
|
399 err = SendReceive(ECreateDataMessageHandler, TIpcArgs()); |
|
400 if(err != KErrNone) |
|
401 return err; |
|
402 |
|
403 err = SendReceive(EReadWMDRMHeaderData, TIpcArgs(&aHeaderData)); |
|
404 } |
|
405 |
|
406 else |
|
407 { |
|
408 err = SendReceive(ENoEnforceCreateDataMessageHandler, TIpcArgs()); |
|
409 if(err != KErrNone) |
|
410 return err; |
|
411 |
|
412 err = SendReceive(ENoEnforceReadWMDRMHeaderData, TIpcArgs(&aHeaderData)); |
|
413 } |
|
414 |
|
415 return err; |
|
416 } |
|
417 |
|
418 EXPORT_C TInt RRtaData::Read(const TDesC8& aEncryptedInputPacket, TDes8& aDecryptedOutputPacket) |
|
419 { |
|
420 TInt err = 0; |
|
421 if(IsDrmCapabilityEnforced()) |
|
422 { |
|
423 err = SendReceive(EReadWMDRMDataPacket, TIpcArgs(&aEncryptedInputPacket, &aDecryptedOutputPacket)); |
|
424 } |
|
425 else |
|
426 { |
|
427 err = SendReceive(ENoEnforceReadWMDRMDataPacket, TIpcArgs(&aEncryptedInputPacket, &aDecryptedOutputPacket)); |
|
428 } |
|
429 |
|
430 return err; |
|
431 } |
|
432 |
|
433 |
|
434 EXPORT_C TInt RRtaData::GetWmdrmAttribute(TInt aAttribute, TInt& aValue) const |
|
435 { |
|
436 TPckg<TInt> valuePkg(aValue); |
|
437 TInt err = SendReceive(EWMDRMGetAttribute, TIpcArgs(aAttribute, &valuePkg)); |
|
438 return err; |
|
439 } |
|
440 |
|
441 EXPORT_C TInt RRtaData::GetWmdrmAttributeSet(ContentAccess::RAttributeSet& aAttributeSet) const |
|
442 { |
|
443 TRAPD( err, GetAttributeSetL(aAttributeSet, ETrue)); |
|
444 return err; |
|
445 } |
|
446 |
|
447 EXPORT_C TInt RRtaData::GetWmdrmStringAttribute(TInt aAttribute, TDes& aValue) const |
|
448 { |
|
449 return SendReceive(EWMDRMGetStringAttribute, TIpcArgs(aAttribute, &aValue)); |
|
450 } |
|
451 |
|
452 EXPORT_C TInt RRtaData::GetWmdrmStringAttributeSet(ContentAccess::RStringAttributeSet& aStringAttributeSet) const |
|
453 { |
|
454 TRAPD( err, GetStringAttributeSetL(aStringAttributeSet, ETrue)); |
|
455 return err; |
|
456 } |
|
457 |
|
458 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
459 |
|
460 |
|