188 if( iDomainID ) |
188 if( iDomainID ) |
189 { |
189 { |
190 delete iDomainID; |
190 delete iDomainID; |
191 iDomainID = NULL; |
191 iDomainID = NULL; |
192 } |
192 } |
193 |
193 |
194 if( iOnExpiredUrl ) |
194 if( iOnExpiredUrl ) |
195 { |
195 { |
196 delete iOnExpiredUrl; |
196 delete iOnExpiredUrl; |
197 iOnExpiredUrl = NULL; |
197 iOnExpiredUrl = NULL; |
198 } |
198 } |
199 }; |
199 }; |
200 |
200 |
201 // ----------------------------------------------------------------------------- |
201 // ----------------------------------------------------------------------------- |
202 // CDRMPermission::ExternalizeL |
202 // CDRMPermission::ExternalizeL |
203 // ----------------------------------------------------------------------------- |
203 // ----------------------------------------------------------------------------- |
204 // |
204 // |
205 EXPORT_C void CDRMPermission::ExternalizeL( RWriteStream& aStream ) const |
205 EXPORT_C void CDRMPermission::ExternalizeL( RWriteStream& aStream ) const |
206 { |
206 { |
207 |
207 |
208 // used for the buffers |
208 // used for the buffers |
209 TInt dataLength = 0; |
209 TInt dataLength = 0; |
210 |
210 |
211 // Used for mode |
211 // Used for mode |
212 TUint8 exportMode = 0; |
212 TUint8 exportMode = 0; |
213 |
213 |
214 // Write the synchronizing marker |
214 // Write the synchronizing marker |
215 aStream.WriteInt32L( iSyncMark ); |
215 aStream.WriteInt32L( iSyncMark ); |
216 |
216 |
217 // Write the version number |
217 // Write the version number |
218 aStream.WriteInt32L( iVersion ); |
218 aStream.WriteInt32L( iVersion ); |
219 |
219 |
220 // Unique ID of the permission |
220 // Unique ID of the permission |
221 aStream.WriteUint32L( iUniqueID ); |
221 aStream.WriteUint32L( iUniqueID ); |
222 |
222 |
223 // The original insertion time |
223 // The original insertion time |
224 WriteInt64L( iOriginalInsertTime.Int64(), aStream ); |
224 WriteInt64L( iOriginalInsertTime.Int64(), aStream ); |
225 |
225 |
226 // Top level constraint |
226 // Top level constraint |
227 if( !iTopLevel ) |
227 if( !iTopLevel ) |
228 { |
228 { |
229 User::Leave( KErrNotReady ); |
229 User::Leave( KErrNotReady ); |
230 } |
230 } |
231 iTopLevel->ExternalizeL( aStream ); |
231 iTopLevel->ExternalizeL( aStream ); |
232 |
232 |
233 // Play constraint |
233 // Play constraint |
234 if( !iPlay ) |
234 if( !iPlay ) |
235 { |
235 { |
236 User::Leave( KErrNotReady ); |
236 User::Leave( KErrNotReady ); |
237 } |
237 } |
238 iPlay->ExternalizeL( aStream ); |
238 iPlay->ExternalizeL( aStream ); |
239 |
239 |
240 // Display constraint |
240 // Display constraint |
241 if( !iDisplay ) |
241 if( !iDisplay ) |
242 { |
242 { |
243 User::Leave( KErrNotReady ); |
243 User::Leave( KErrNotReady ); |
244 } |
244 } |
245 iDisplay->ExternalizeL( aStream ); |
245 iDisplay->ExternalizeL( aStream ); |
246 |
246 |
247 // Execute constraint |
247 // Execute constraint |
248 if( !iExecute ) |
248 if( !iExecute ) |
249 { |
249 { |
250 User::Leave( KErrNotReady ); |
250 User::Leave( KErrNotReady ); |
251 } |
251 } |
252 iExecute->ExternalizeL( aStream ); |
252 iExecute->ExternalizeL( aStream ); |
253 |
253 |
254 // Print constraint |
254 // Print constraint |
255 if( !iPrint ) |
255 if( !iPrint ) |
256 { |
256 { |
257 User::Leave( KErrNotReady ); |
257 User::Leave( KErrNotReady ); |
258 } |
258 } |
259 iPrint->ExternalizeL( aStream ); |
259 iPrint->ExternalizeL( aStream ); |
260 |
260 |
261 // Export constraint |
261 // Export constraint |
262 if( !iExport ) |
262 if( !iExport ) |
263 { |
263 { |
264 User::Leave( KErrNotReady ); |
264 User::Leave( KErrNotReady ); |
265 } |
265 } |
266 iExport->ExternalizeL( aStream ); |
266 iExport->ExternalizeL( aStream ); |
267 |
267 |
268 // Export mode |
268 // Export mode |
269 exportMode = iExportMode; |
269 exportMode = iExportMode; |
270 aStream.WriteUint8L( exportMode ); |
270 aStream.WriteUint8L( exportMode ); |
271 |
271 |
272 // Content id of the parent rights object |
272 // Content id of the parent rights object |
273 dataLength = 0; |
273 dataLength = 0; |
274 if( iParentUID ) |
274 if( iParentUID ) |
275 { |
275 { |
276 dataLength = iParentUID->Length(); |
276 dataLength = iParentUID->Length(); |
277 } |
277 } |
278 aStream.WriteInt32L( dataLength ); |
278 aStream.WriteInt32L( dataLength ); |
279 |
279 |
280 if( dataLength ) |
280 if( dataLength ) |
281 { |
281 { |
282 aStream.WriteL( iParentUID->Des() ); |
282 aStream.WriteL( iParentUID->Des() ); |
283 } |
283 } |
284 |
284 |
285 // Rights Object if of the rights delivery container |
285 // Rights Object if of the rights delivery container |
286 dataLength = 0; |
286 dataLength = 0; |
287 if( iRoID ) |
287 if( iRoID ) |
288 { |
288 { |
289 dataLength = iRoID->Length(); |
289 dataLength = iRoID->Length(); |
290 } |
290 } |
291 aStream.WriteInt32L( dataLength ); |
291 aStream.WriteInt32L( dataLength ); |
292 |
292 |
293 if( dataLength ) |
293 if( dataLength ) |
294 { |
294 { |
295 aStream.WriteL( iRoID->Des() ); |
295 aStream.WriteL( iRoID->Des() ); |
296 } |
296 } |
297 |
297 |
298 // Domain identifier |
298 // Domain identifier |
299 dataLength = 0; |
299 dataLength = 0; |
300 if( iDomainID ) |
300 if( iDomainID ) |
301 { |
301 { |
302 dataLength = iDomainID->Length(); |
302 dataLength = iDomainID->Length(); |
303 } |
303 } |
304 aStream.WriteInt32L( dataLength ); |
304 aStream.WriteInt32L( dataLength ); |
305 |
305 |
306 if( dataLength ) |
306 if( dataLength ) |
307 { |
307 { |
308 aStream.WriteL( iDomainID->Des() ); |
308 aStream.WriteL( iDomainID->Des() ); |
309 } |
309 } |
310 |
310 |
311 // Available rights |
311 // Available rights |
312 aStream.WriteUint16L( iAvailableRights ); |
312 aStream.WriteUint16L( iAvailableRights ); |
313 |
313 |
314 // Version number of the rights object |
314 // Version number of the rights object |
315 aStream.WriteUint16L( iRightsObjectVersion.iVersionMain ); |
315 aStream.WriteUint16L( iRightsObjectVersion.iVersionMain ); |
316 aStream.WriteUint16L( iRightsObjectVersion.iVersionSub ); |
316 aStream.WriteUint16L( iRightsObjectVersion.iVersionSub ); |
317 |
317 |
318 // Info bits |
318 // Info bits |
319 aStream.WriteInt32L( iInfoBits ); |
319 aStream.WriteInt32L( iInfoBits ); |
320 |
320 |
321 aStream.WriteL( iRiId ); |
321 aStream.WriteL( iRiId ); |
322 |
322 |
323 // OnExpiredUrl |
323 // OnExpiredUrl |
324 dataLength = 0; |
324 dataLength = 0; |
325 if ( iOnExpiredUrl ) |
325 if ( iOnExpiredUrl ) |
326 { |
326 { |
327 dataLength = iOnExpiredUrl->Length(); |
327 dataLength = iOnExpiredUrl->Length(); |
328 } |
328 } |
329 aStream.WriteInt32L( dataLength ); |
329 aStream.WriteInt32L( dataLength ); |
330 |
330 |
331 if ( dataLength ) |
331 if ( dataLength ) |
332 { |
332 { |
333 aStream.WriteL( iOnExpiredUrl->Des() ); |
333 aStream.WriteL( iOnExpiredUrl->Des() ); |
334 } |
334 } |
335 |
335 |
336 // For future use |
336 // For future use |
337 aStream.WriteInt32L( 0 ); |
337 aStream.WriteInt32L( 0 ); |
338 |
338 |
339 }; |
339 }; |
340 |
340 |
341 // ----------------------------------------------------------------------------- |
341 // ----------------------------------------------------------------------------- |
342 // CDRMPermission::InternalizeL |
342 // CDRMPermission::InternalizeL |
343 // ----------------------------------------------------------------------------- |
343 // ----------------------------------------------------------------------------- |
344 // |
344 // |
345 EXPORT_C void CDRMPermission::InternalizeL( RReadStream& aStream ) |
345 EXPORT_C void CDRMPermission::InternalizeL( RReadStream& aStream ) |
346 { |
346 { |
347 |
347 |
348 TInt64 timeData = 0; |
348 TInt64 timeData = 0; |
349 |
349 |
350 // used for the buffers |
350 // used for the buffers |
351 TInt dataLength = 0; |
351 TInt dataLength = 0; |
352 TPtr8 dataBuffer(NULL,0,0); |
352 TPtr8 dataBuffer(NULL,0,0); |
353 HBufC8* dataPart = NULL; |
353 HBufC8* dataPart = NULL; |
354 |
354 |
355 // (Possible) synchronizing marker |
355 // (Possible) synchronizing marker |
356 iSyncMark = aStream.ReadInt32L(); |
356 iSyncMark = aStream.ReadInt32L(); |
357 |
357 |
358 if ( iSyncMark == KSyncMark ) |
358 if ( iSyncMark == KSyncMark ) |
359 { |
359 { |
360 |
360 |
361 // The internalized Permission object has the new structure if the |
361 // The internalized Permission object has the new structure if the |
362 // synchronizing marker is found in the beginning of the stream. In that |
362 // synchronizing marker is found in the beginning of the stream. In that |
363 // case read version number and Unique ID. |
363 // case read version number and Unique ID. |
364 iVersion = aStream.ReadInt32L(); |
364 iVersion = aStream.ReadInt32L(); |
365 |
365 |
366 // Unique ID of the permission |
366 // Unique ID of the permission |
367 iUniqueID = aStream.ReadUint32L(); |
367 iUniqueID = aStream.ReadUint32L(); |
368 |
368 |
369 } |
369 } |
370 else |
370 else |
371 { |
371 { |
372 |
372 |
373 // The internalized Permission object has the old structure. The |
373 // The internalized Permission object has the old structure. The |
374 // stream information that was read to iSyncMark is actually the |
374 // stream information that was read to iSyncMark is actually the |
375 // Unique ID. |
375 // Unique ID. |
376 iUniqueID = (TDRMUniqueID)iSyncMark; |
376 iUniqueID = (TDRMUniqueID)iSyncMark; |
377 iVersion = KVersion3_2_0; // Old version, needed for differentation |
377 iVersion = KVersion3_2_0; // Old version, needed for differentation |
378 |
378 |
379 } |
379 } |
380 |
380 |
381 // The original insertion time |
381 // The original insertion time |
382 ReadInt64L( timeData, aStream ); |
382 ReadInt64L( timeData, aStream ); |
383 iOriginalInsertTime = timeData; |
383 iOriginalInsertTime = timeData; |
384 |
384 |
385 // Top level constraint |
385 // Top level constraint |
386 if( !iTopLevel ) |
386 if( !iTopLevel ) |
387 { |
387 { |
388 iTopLevel = CDRMConstraint::NewL(); |
388 iTopLevel = CDRMConstraint::NewL(); |
389 } |
389 } |
390 |
390 |
391 iTopLevel->InternalizeL( aStream ); |
391 iTopLevel->InternalizeL( aStream ); |
392 |
392 |
393 // Play constraint |
393 // Play constraint |
394 if( !iPlay ) |
394 if( !iPlay ) |
395 { |
395 { |
396 iPlay = CDRMConstraint::NewL(); |
396 iPlay = CDRMConstraint::NewL(); |
397 } |
397 } |
398 |
398 |
399 iPlay->InternalizeL( aStream ); |
399 iPlay->InternalizeL( aStream ); |
400 |
400 |
401 // Display constraint |
401 // Display constraint |
402 if( !iDisplay ) |
402 if( !iDisplay ) |
403 { |
403 { |
404 iDisplay = CDRMConstraint::NewL(); |
404 iDisplay = CDRMConstraint::NewL(); |
405 } |
405 } |
406 |
406 |
407 iDisplay->InternalizeL( aStream ); |
407 iDisplay->InternalizeL( aStream ); |
408 |
408 |
409 // Execute constraint |
409 // Execute constraint |
410 if( !iExecute ) |
410 if( !iExecute ) |
411 { |
411 { |
412 iExecute = CDRMConstraint::NewL(); |
412 iExecute = CDRMConstraint::NewL(); |
413 } |
413 } |
414 |
414 |
415 iExecute->InternalizeL( aStream ); |
415 iExecute->InternalizeL( aStream ); |
416 |
416 |
417 // Print constraint |
417 // Print constraint |
418 if( !iPrint) |
418 if( !iPrint) |
419 { |
419 { |
420 iPrint = CDRMConstraint::NewL(); |
420 iPrint = CDRMConstraint::NewL(); |
421 } |
421 } |
422 |
422 |
423 iPrint->InternalizeL( aStream ); |
423 iPrint->InternalizeL( aStream ); |
424 |
424 |
425 // Export constraint |
425 // Export constraint |
426 |
426 |
427 iExport->InternalizeL( aStream ); |
427 iExport->InternalizeL( aStream ); |
428 |
428 |
429 // Export mode |
429 // Export mode |
430 iExportMode = static_cast<TExportMode>(aStream.ReadUint8L()); |
430 iExportMode = static_cast<TExportMode>(aStream.ReadUint8L()); |
431 |
431 |
432 // Content id of the parent rights object |
432 // Content id of the parent rights object |
433 dataLength = aStream.ReadInt32L(); |
433 dataLength = aStream.ReadInt32L(); |
434 |
434 |
435 SanitizeL( dataLength ); |
435 SanitizeL( dataLength ); |
436 |
436 |
437 if( dataLength > 0 ) |
437 if( dataLength > 0 ) |
438 { |
438 { |
439 // Reserve a new buffer: |
439 // Reserve a new buffer: |
440 dataPart = HBufC8::NewMaxLC( dataLength ); |
440 dataPart = HBufC8::NewMaxLC( dataLength ); |
441 |
441 |
442 // Set the read buffer: |
442 // Set the read buffer: |
443 dataBuffer.Set(const_cast<TUint8*>(dataPart->Ptr()), 0, dataLength); |
443 dataBuffer.Set(const_cast<TUint8*>(dataPart->Ptr()), 0, dataLength); |
444 |
444 |
445 // Read the data: |
445 // Read the data: |
446 aStream.ReadL( dataBuffer ); |
446 aStream.ReadL( dataBuffer ); |
447 |
447 |
448 // Pop the buffer |
448 // Pop the buffer |
449 CleanupStack::Pop(); // dataPart |
449 CleanupStack::Pop(); // dataPart |
450 |
450 |
451 // If an old content identifier exists delete it |
451 // If an old content identifier exists delete it |
452 if( iParentUID ) |
452 if( iParentUID ) |
453 { |
453 { |
454 delete iParentUID; |
454 delete iParentUID; |
455 iParentUID = NULL; |
455 iParentUID = NULL; |
456 } |
456 } |
457 |
457 |
458 // assign the new content id |
458 // assign the new content id |
459 iParentUID = dataPart; |
459 iParentUID = dataPart; |
460 } |
460 } |
461 else |
461 else |
462 { |
462 { |
463 // If an old individual exists delete it |
463 // If an old individual exists delete it |
464 if( iParentUID ) |
464 if( iParentUID ) |
465 { |
465 { |
466 delete iParentUID; |
466 delete iParentUID; |
467 iParentUID = NULL; |
467 iParentUID = NULL; |
468 } |
468 } |
469 } |
469 } |
470 |
470 |
471 |
471 |
472 // Rights Object if of the rights delivery container |
472 // Rights Object if of the rights delivery container |
473 // Read the individual |
473 // Read the individual |
474 dataLength = aStream.ReadInt32L(); |
474 dataLength = aStream.ReadInt32L(); |
475 |
475 |
476 SanitizeL( dataLength ); |
476 SanitizeL( dataLength ); |
477 |
477 |
478 if( dataLength > 0 ) |
478 if( dataLength > 0 ) |
479 { |
479 { |
480 // Reserve a new buffer: |
480 // Reserve a new buffer: |
481 dataPart = HBufC8::NewMaxLC( dataLength ); |
481 dataPart = HBufC8::NewMaxLC( dataLength ); |
482 |
482 |
483 // Set the read buffer: |
483 // Set the read buffer: |
484 dataBuffer.Set(const_cast<TUint8*>(dataPart->Ptr()), 0, dataLength); |
484 dataBuffer.Set(const_cast<TUint8*>(dataPart->Ptr()), 0, dataLength); |
485 |
485 |
486 // Read the data: |
486 // Read the data: |
487 aStream.ReadL( dataBuffer ); |
487 aStream.ReadL( dataBuffer ); |
488 |
488 |
489 // Pop the buffer |
489 // Pop the buffer |
490 CleanupStack::Pop(); // dataPart |
490 CleanupStack::Pop(); // dataPart |
491 |
491 |
492 // If an old content identifier exists delete it |
492 // If an old content identifier exists delete it |
493 if( iRoID ) |
493 if( iRoID ) |
494 { |
494 { |
495 delete iRoID; |
495 delete iRoID; |
496 iRoID = NULL; |
496 iRoID = NULL; |
497 } |
497 } |
498 |
498 |
499 // assign the new content id |
499 // assign the new content id |
500 iRoID = dataPart; |
500 iRoID = dataPart; |
501 } |
501 } |
502 else |
502 else |
503 { |
503 { |
504 // If an old individual exists delete it |
504 // If an old individual exists delete it |
505 if( iRoID ) |
505 if( iRoID ) |
506 { |
506 { |
507 delete iRoID; |
507 delete iRoID; |
508 iRoID = NULL; |
508 iRoID = NULL; |
509 } |
509 } |
510 } |
510 } |
511 |
511 |
512 // Domain identifier |
512 // Domain identifier |
513 dataLength = aStream.ReadInt32L(); |
513 dataLength = aStream.ReadInt32L(); |
514 |
514 |
515 SanitizeL( dataLength ); |
515 SanitizeL( dataLength ); |
516 |
516 |
517 if( dataLength > 0 ) |
517 if( dataLength > 0 ) |
518 { |
518 { |
519 // Reserve a new buffer: |
519 // Reserve a new buffer: |
520 dataPart = HBufC8::NewMaxLC( dataLength ); |
520 dataPart = HBufC8::NewMaxLC( dataLength ); |
521 |
521 |
522 // Set the read buffer: |
522 // Set the read buffer: |
523 dataBuffer.Set(const_cast<TUint8*>(dataPart->Ptr()), 0, dataLength); |
523 dataBuffer.Set(const_cast<TUint8*>(dataPart->Ptr()), 0, dataLength); |
524 |
524 |
525 // Read the data: |
525 // Read the data: |
526 aStream.ReadL( dataBuffer ); |
526 aStream.ReadL( dataBuffer ); |
527 |
527 |
528 // Pop the buffer |
528 // Pop the buffer |
529 CleanupStack::Pop(); // dataPart |
529 CleanupStack::Pop(); // dataPart |
530 |
530 |
531 // If an old content identifier exists delete it |
531 // If an old content identifier exists delete it |
532 if( iDomainID ) |
532 if( iDomainID ) |
533 { |
533 { |
534 delete iDomainID; |
534 delete iDomainID; |
535 iDomainID = NULL; |
535 iDomainID = NULL; |
536 } |
536 } |
537 |
537 |
538 // assign the new content id |
538 // assign the new content id |
539 iDomainID = dataPart; |
539 iDomainID = dataPart; |
540 } |
540 } |
541 else |
541 else |
542 { |
542 { |
543 // If an old individual exists delete it |
543 // If an old individual exists delete it |
544 if( iDomainID ) |
544 if( iDomainID ) |
545 { |
545 { |
546 delete iDomainID; |
546 delete iDomainID; |
547 iDomainID = NULL; |
547 iDomainID = NULL; |
548 } |
548 } |
549 } |
549 } |
550 |
550 |
551 |
551 |
552 // Available rights |
552 // Available rights |
553 iAvailableRights = aStream.ReadUint16L(); |
553 iAvailableRights = aStream.ReadUint16L(); |
554 |
554 |
555 // Version number of the rights object |
555 // Version number of the rights object |
556 iRightsObjectVersion.iVersionMain = aStream.ReadUint16L(); |
556 iRightsObjectVersion.iVersionMain = aStream.ReadUint16L(); |
557 iRightsObjectVersion.iVersionSub = aStream.ReadUint16L(); |
557 iRightsObjectVersion.iVersionSub = aStream.ReadUint16L(); |
558 |
558 |
559 // Information bits |
559 // Information bits |
560 iInfoBits = aStream.ReadInt32L(); |
560 iInfoBits = aStream.ReadInt32L(); |
561 |
561 |
562 aStream.ReadL( iRiId ); |
562 aStream.ReadL( iRiId ); |
563 |
563 |
564 // New structure of Permission object |
564 // New structure of Permission object |
565 if ( iVersion == KVersion3_2_1 ) |
565 if ( iVersion == KVersion3_2_1 ) |
566 { |
566 { |
567 |
567 |
568 // OnExpiredUrl |
568 // OnExpiredUrl |
569 dataLength = aStream.ReadInt32L(); |
569 dataLength = aStream.ReadInt32L(); |
570 |
570 |
571 SanitizeL( dataLength ); |
571 SanitizeL( dataLength ); |
572 |
572 |
573 if( dataLength > 0 ) |
573 if( dataLength > 0 ) |
574 { |
574 { |
575 |
575 |
576 // Reserve a new buffer: |
576 // Reserve a new buffer: |
577 dataPart = HBufC8::NewMaxLC( dataLength ); |
577 dataPart = HBufC8::NewMaxLC( dataLength ); |
578 |
578 |
579 // Set the read buffer: |
579 // Set the read buffer: |
580 dataBuffer.Set(const_cast<TUint8*>(dataPart->Ptr()), 0, |
580 dataBuffer.Set(const_cast<TUint8*>(dataPart->Ptr()), 0, |
581 dataLength); |
581 dataLength); |
582 |
582 |
583 // Read the data: |
583 // Read the data: |
584 aStream.ReadL( dataBuffer ); |
584 aStream.ReadL( dataBuffer ); |
585 |
585 |
586 // Pop the buffer |
586 // Pop the buffer |
587 CleanupStack::Pop(); // dataPart |
587 CleanupStack::Pop(); // dataPart |
588 |
588 |
589 // If an old OnExpiredUrl exists delete it |
589 // If an old OnExpiredUrl exists delete it |
590 if( iOnExpiredUrl ) |
590 if( iOnExpiredUrl ) |
591 { |
591 { |
592 delete iOnExpiredUrl; |
592 delete iOnExpiredUrl; |
593 iOnExpiredUrl = NULL; |
593 iOnExpiredUrl = NULL; |
594 } |
594 } |
595 |
595 |
596 // assign the new OnExpiredUrl |
596 // assign the new OnExpiredUrl |
597 iOnExpiredUrl = dataPart; |
597 iOnExpiredUrl = dataPart; |
598 } |
598 } |
599 else |
599 else |
600 { |
600 { |
601 // If an old OnExpiredUrl exists delete it |
601 // If an old OnExpiredUrl exists delete it |
602 if( iOnExpiredUrl ) |
602 if( iOnExpiredUrl ) |
603 { |
603 { |
604 delete iOnExpiredUrl; |
604 delete iOnExpiredUrl; |
605 iOnExpiredUrl = NULL; |
605 iOnExpiredUrl = NULL; |
606 } |
606 } |
607 } |
607 } |
608 |
608 |
609 // For future use or development, reads the data at the end of the stream |
609 // For future use or development, reads the data at the end of the stream |
610 dataLength = aStream.ReadInt32L(); |
610 dataLength = aStream.ReadInt32L(); |
611 |
611 |
612 SanitizeL( dataLength ); |
612 SanitizeL( dataLength ); |
613 |
613 |
614 if ( dataLength > 0 ) |
614 if ( dataLength > 0 ) |
615 { |
615 { |
616 // Reserve a new buffer: |
616 // Reserve a new buffer: |
617 dataPart = HBufC8::NewMaxLC( dataLength ); |
617 dataPart = HBufC8::NewMaxLC( dataLength ); |
618 |
618 |
619 // Set the read buffer: |
619 // Set the read buffer: |
620 dataBuffer.Set(const_cast<TUint8*>(dataPart->Ptr()), 0, dataLength); |
620 dataBuffer.Set(const_cast<TUint8*>(dataPart->Ptr()), 0, dataLength); |
621 |
621 |
622 // Read the data: |
622 // Read the data: |
623 aStream.ReadL( dataBuffer ); |
623 aStream.ReadL( dataBuffer ); |
624 |
624 |
625 // Delete the buffer |
625 // Delete the buffer |
626 CleanupStack::PopAndDestroy( dataPart ); |
626 CleanupStack::PopAndDestroy( dataPart ); |
627 } |
627 } |
628 } |
628 } |
629 |
629 |
630 // Permission can be considered to have the new structure after |
630 // Permission can be considered to have the new structure after |
631 // internalization. |
631 // internalization. |
632 if ( iVersion == KVersion3_2_0 ) |
632 if ( iVersion == KVersion3_2_0 ) |
633 { |
633 { |
634 iSyncMark = KSyncMark; |
634 iSyncMark = KSyncMark; |
635 iVersion = KVersion3_2_1; |
635 iVersion = KVersion3_2_1; |
636 } |
636 } |
637 |
637 |
638 }; |
638 }; |
639 |
639 |
640 // ----------------------------------------------------------------------------- |
640 // ----------------------------------------------------------------------------- |
641 // CDRMPermission::Stateful |
641 // CDRMPermission::Stateful |
642 // ----------------------------------------------------------------------------- |
642 // ----------------------------------------------------------------------------- |
643 // |
643 // |
644 EXPORT_C TBool CDRMPermission::Stateful() const |
644 EXPORT_C TBool CDRMPermission::Stateful() const |
683 return ETrue; |
683 return ETrue; |
684 } |
684 } |
685 else if ( (iAvailableRights & ERightsDisplay) && |
685 else if ( (iAvailableRights & ERightsDisplay) && |
686 iDisplay->iActiveConstraints & ( EConstraintVendor | EConstraintSoftware ) ) |
686 iDisplay->iActiveConstraints & ( EConstraintVendor | EConstraintSoftware ) ) |
687 { |
687 { |
688 return ETrue; |
688 return ETrue; |
689 } |
689 } |
690 else if ( (iAvailableRights & ERightsExecute) && |
690 else if ( (iAvailableRights & ERightsExecute) && |
691 iExecute->iActiveConstraints & ( EConstraintVendor | EConstraintSoftware ) ) |
691 iExecute->iActiveConstraints & ( EConstraintVendor | EConstraintSoftware ) ) |
692 { |
692 { |
693 return ETrue; |
693 return ETrue; |
694 } |
694 } |
695 else if ( (iAvailableRights & ERightsPrint) && |
695 else if ( (iAvailableRights & ERightsPrint) && |
696 iPrint->iActiveConstraints & ( EConstraintVendor | EConstraintSoftware ) ) |
696 iPrint->iActiveConstraints & ( EConstraintVendor | EConstraintSoftware ) ) |
697 { |
697 { |
698 return ETrue; |
698 return ETrue; |
699 } |
699 } |
700 return EFalse; |
700 return EFalse; |
701 }; |
701 }; |
702 |
702 |
703 // ----------------------------------------------------------------------------- |
703 // ----------------------------------------------------------------------------- |
704 // CDRMPermission::Child |
704 // CDRMPermission::Child |
705 // ----------------------------------------------------------------------------- |
705 // ----------------------------------------------------------------------------- |
706 // |
706 // |
707 EXPORT_C TBool CDRMPermission::Child() const |
707 EXPORT_C TBool CDRMPermission::Child() const |
708 { |
708 { |
709 return iParentUID ? ETrue : EFalse; |
709 return iParentUID ? ETrue : EFalse; |
710 }; |
710 }; |
711 |
711 |
712 // ----------------------------------------------------------------------------- |
712 // ----------------------------------------------------------------------------- |
713 // CDRMPermission::Size |
713 // CDRMPermission::Size |
714 // ----------------------------------------------------------------------------- |
714 // ----------------------------------------------------------------------------- |
715 // |
715 // |
716 EXPORT_C TInt CDRMPermission::Size() const |
716 EXPORT_C TInt CDRMPermission::Size() const |
717 { |
717 { |
718 TInt size = 0; |
718 TInt size = 0; |
719 |
719 |
720 // synchronizing marker |
720 // synchronizing marker |
721 size += sizeof(TInt32); |
721 size += sizeof(TInt32); |
722 |
722 |
723 // Version number |
723 // Version number |
724 size += sizeof(TInt32); |
724 size += sizeof(TInt32); |
725 |
725 |
726 // Unique ID of the permission |
726 // Unique ID of the permission |
727 size += sizeof(TDRMUniqueID); |
727 size += sizeof(TDRMUniqueID); |
728 |
728 |
729 // The original insertion time |
729 // The original insertion time |
730 size += sizeof(TTime); |
730 size += sizeof(TTime); |
731 |
731 |
732 // Top level constraint |
732 // Top level constraint |
733 size += iTopLevel->Size(); |
733 size += iTopLevel->Size(); |
734 |
734 |
735 // Play constraint |
735 // Play constraint |
736 size += iPlay->Size(); |
736 size += iPlay->Size(); |
737 |
737 |
738 // Display constraint |
738 // Display constraint |
739 size += iDisplay->Size(); |
739 size += iDisplay->Size(); |
740 |
740 |
741 // Execute constraint |
741 // Execute constraint |
742 size += iExecute->Size(); |
742 size += iExecute->Size(); |
743 |
743 |
744 // Print constraint |
744 // Print constraint |
745 size += iPrint->Size(); |
745 size += iPrint->Size(); |
746 |
746 |
747 // Export constraint |
747 // Export constraint |
748 size += iExport->Size(); |
748 size += iExport->Size(); |
749 |
749 |
750 // Export mode |
750 // Export mode |
751 size += sizeof(TUint8); |
751 size += sizeof(TUint8); |
752 |
752 |
753 // Content id of the parent rights object |
753 // Content id of the parent rights object |
754 size += sizeof(TInt32); |
754 size += sizeof(TInt32); |
755 |
755 |
756 if( iParentUID ) |
756 if( iParentUID ) |
757 { |
757 { |
758 size += iParentUID->Size(); |
758 size += iParentUID->Size(); |
759 } |
759 } |
760 |
760 |
761 // Rights Object if of the rights delivery container |
761 // Rights Object if of the rights delivery container |
762 size += sizeof(TInt32); |
762 size += sizeof(TInt32); |
763 |
763 |
764 if( iRoID ) |
764 if( iRoID ) |
765 { |
765 { |
766 size += iRoID->Size(); |
766 size += iRoID->Size(); |
767 } |
767 } |
768 |
768 |
769 // Domain identifier |
769 // Domain identifier |
770 size += sizeof(TInt32); |
770 size += sizeof(TInt32); |
771 |
771 |
772 if( iDomainID ) |
772 if( iDomainID ) |
773 { |
773 { |
774 size += iDomainID->Size(); |
774 size += iDomainID->Size(); |
775 } |
775 } |
776 |
776 |
777 // Available rights |
777 // Available rights |
778 size += sizeof(TUint16); |
778 size += sizeof(TUint16); |
779 |
779 |
780 // Version number of the rights object |
780 // Version number of the rights object |
781 size += sizeof(TUint16); |
781 size += sizeof(TUint16); |
782 size += sizeof(TUint16); |
782 size += sizeof(TUint16); |
783 |
783 |
784 // infobits |
784 // infobits |
785 size += sizeof(TInt32); |
785 size += sizeof(TInt32); |
786 |
786 |
787 // RI ID |
787 // RI ID |
788 size += KRiIdSize; |
788 size += KRiIdSize; |
789 |
789 |
790 // OnExpiredUrl |
790 // OnExpiredUrl |
791 size += sizeof(TInt32); |
791 size += sizeof(TInt32); |
792 |
792 |
793 if ( iOnExpiredUrl ) |
793 if ( iOnExpiredUrl ) |
794 { |
794 { |
795 size += iOnExpiredUrl->Size(); |
795 size += iOnExpiredUrl->Size(); |
796 } |
796 } |
797 |
797 |
798 // For future use |
798 // For future use |
799 size += sizeof(TInt32); |
799 size += sizeof(TInt32); |
800 |
800 |
801 return size; |
801 return size; |
802 |
802 |
803 }; |
803 }; |
804 |
804 |
805 // ----------------------------------------------------------------------------- |
805 // ----------------------------------------------------------------------------- |
806 // CDRMPermission::ConstraintForIntent |
806 // CDRMPermission::ConstraintForIntent |
807 // ----------------------------------------------------------------------------- |
807 // ----------------------------------------------------------------------------- |
808 // |
808 // |
809 EXPORT_C CDRMConstraint* CDRMPermission::ConstraintForIntent( |
809 EXPORT_C CDRMConstraint* CDRMPermission::ConstraintForIntent( |
810 const ContentAccess::TIntent aIntent ) |
810 const ContentAccess::TIntent aIntent ) |
811 { |
811 { |
812 CDRMConstraint* r = NULL; |
812 CDRMConstraint* r = NULL; |
813 |
813 |
814 switch ( aIntent ) |
814 switch ( aIntent ) |
815 { |
815 { |
816 case ContentAccess::EPlay: |
816 case ContentAccess::EPlay: |
817 if ( iAvailableRights & ERightsPlay ) |
817 if ( iAvailableRights & ERightsPlay ) |
818 { |
818 { |
988 |
988 |
989 if( aPermission.iParentUID ) |
989 if( aPermission.iParentUID ) |
990 { |
990 { |
991 iParentUID = aPermission.iParentUID->AllocL(); |
991 iParentUID = aPermission.iParentUID->AllocL(); |
992 } |
992 } |
993 |
993 |
994 // Rights Object if of the rights delivery container |
994 // Rights Object if of the rights delivery container |
995 if( iRoID ) |
995 if( iRoID ) |
996 { |
996 { |
997 delete iRoID; |
997 delete iRoID; |
998 iRoID = NULL; |
998 iRoID = NULL; |
999 } |
999 } |
1000 |
1000 |
1001 if( aPermission.iRoID ) |
1001 if( aPermission.iRoID ) |
1002 { |
1002 { |
1003 iRoID = aPermission.iRoID->AllocL(); |
1003 iRoID = aPermission.iRoID->AllocL(); |
1004 } |
1004 } |
1005 |
1005 |
1006 // Domain identifier |
1006 // Domain identifier |
1007 if( iDomainID ) |
1007 if( iDomainID ) |
1008 { |
1008 { |
1009 delete iDomainID; |
1009 delete iDomainID; |
1010 iDomainID = NULL; |
1010 iDomainID = NULL; |
1011 } |
1011 } |
1012 |
1012 |
1013 if( aPermission.iDomainID ) |
1013 if( aPermission.iDomainID ) |
1014 { |
1014 { |
1015 iDomainID = aPermission.iDomainID->AllocL(); |
1015 iDomainID = aPermission.iDomainID->AllocL(); |
1016 } |
1016 } |
1017 // Available rights |
1017 // Available rights |
1018 iAvailableRights = aPermission.iAvailableRights; // Bitmask |
1018 iAvailableRights = aPermission.iAvailableRights; // Bitmask |
1019 |
1019 |
1020 // Version number of the rights object |
1020 // Version number of the rights object |
1021 iRightsObjectVersion.iVersionMain = aPermission.iRightsObjectVersion.iVersionMain; |
1021 iRightsObjectVersion.iVersionMain = aPermission.iRightsObjectVersion.iVersionMain; |
1022 iRightsObjectVersion.iVersionSub = aPermission.iRightsObjectVersion.iVersionSub; |
1022 iRightsObjectVersion.iVersionSub = aPermission.iRightsObjectVersion.iVersionSub; |
1023 |
1023 |
1024 // info bits |
1024 // info bits |
1025 iInfoBits = aPermission.iInfoBits; |
1025 iInfoBits = aPermission.iInfoBits; |
1026 |
1026 |
1027 // OnExpiredUrl |
1027 // OnExpiredUrl |
1028 if ( iOnExpiredUrl ) |
1028 if ( iOnExpiredUrl ) |
1029 { |
1029 { |
1030 delete iOnExpiredUrl; |
1030 delete iOnExpiredUrl; |
1031 iOnExpiredUrl = NULL; |
1031 iOnExpiredUrl = NULL; |
1032 } |
1032 } |
1033 |
1033 |
1034 if ( aPermission.iOnExpiredUrl ) |
1034 if ( aPermission.iOnExpiredUrl ) |
1035 { |
1035 { |
1036 iOnExpiredUrl = aPermission.iOnExpiredUrl->AllocL(); |
1036 iOnExpiredUrl = aPermission.iOnExpiredUrl->AllocL(); |
1037 } |
1037 } |
1038 |
1038 |
1039 }; |
1039 }; |
1040 |
1040 |
1041 |
1041 |
1042 // ----------------------------------------------------------------------------- |
1042 // ----------------------------------------------------------------------------- |
1043 // CDRMPermission::Expired |
1043 // CDRMPermission::Expired |
1044 // ----------------------------------------------------------------------------- |
1044 // ----------------------------------------------------------------------------- |
1045 // |
1045 // |
1046 EXPORT_C TBool CDRMPermission::Expired( const TTime& aTime ) |
1046 EXPORT_C TBool CDRMPermission::Expired( const TTime& aTime ) |
1047 { |
1047 { |
1048 if( iTopLevel && iAvailableRights & ERightsTopLevel ) |
1048 if( iTopLevel && iAvailableRights & ERightsTopLevel ) |
1049 { |
1049 { |
1050 if( iTopLevel->Expired( aTime ) ) |
1050 if( iTopLevel->Expired( aTime ) ) |
1051 { |
1051 { |
1052 return ETrue; |
1052 return ETrue; |
1053 } |
1053 } |
1054 } |
1054 } |
1055 |
1055 |
1056 if( iPlay && iAvailableRights & ERightsPlay) |
1056 if( iPlay && iAvailableRights & ERightsPlay) |
1057 { |
1057 { |
1058 if( !iPlay->Expired( aTime ) ) |
1058 if( !iPlay->Expired( aTime ) ) |
1059 { |
1059 { |
1060 return EFalse; |
1060 return EFalse; |
1061 } |
1061 } |
1062 } |
1062 } |
1063 |
1063 |
1064 if( iDisplay && iAvailableRights & ERightsDisplay ) |
1064 if( iDisplay && iAvailableRights & ERightsDisplay ) |
1065 { |
1065 { |
1066 if( !iDisplay->Expired( aTime ) ) |
1066 if( !iDisplay->Expired( aTime ) ) |
1067 { |
1067 { |
1068 return EFalse; |
1068 return EFalse; |
1069 } |
1069 } |
1070 } |
1070 } |
1071 |
1071 |
1072 if( iExecute && iAvailableRights & ERightsExecute ) |
1072 if( iExecute && iAvailableRights & ERightsExecute ) |
1073 { |
1073 { |
1074 if( !iExecute->Expired( aTime ) ) |
1074 if( !iExecute->Expired( aTime ) ) |
1075 { |
1075 { |
1076 return EFalse; |
1076 return EFalse; |
1077 } |
1077 } |
1078 } |
1078 } |
1079 |
1079 |
1080 if( iPrint && iAvailableRights & ERightsPrint ) |
1080 if( iPrint && iAvailableRights & ERightsPrint ) |
1081 { |
1081 { |
1082 if( !iPrint->Expired( aTime ) ) |
1082 if( !iPrint->Expired( aTime ) ) |
1083 { |
1083 { |
1084 return EFalse; |
1084 return EFalse; |
1085 } |
1085 } |
1086 } |
1086 } |
1087 |
1087 |
1088 if( iExport && iAvailableRights & ERightsExport ) |
1088 if( iExport && iAvailableRights & ERightsExport ) |
1089 { |
1089 { |
1090 if( !iExport->Expired( aTime ) ) |
1090 if( !iExport->Expired( aTime ) ) |
1091 { |
1091 { |
1092 return EFalse; |
1092 return EFalse; |
1093 } |
1093 } |
1094 } |
1094 } |
1095 |
1095 |
1096 return ETrue; |
1096 return ETrue; |
1097 }; |
1097 }; |
1098 |
1098 |
1099 |
1099 |
1100 // ----------------------------------------------------------------------------- |
1100 // ----------------------------------------------------------------------------- |
1101 // CDRMPermission::Expired |
1101 // CDRMPermission::Expired |
1102 // ----------------------------------------------------------------------------- |
1102 // ----------------------------------------------------------------------------- |
1103 // |
1103 // |
1104 EXPORT_C TBool CDRMPermission::Valid( const TTime& aTime, |
1104 EXPORT_C TBool CDRMPermission::Valid( const TTime& aTime, |
1105 const RPointerArray<HBufC8>& aIndividual, |
1105 const RPointerArray<HBufC8>& aIndividual, |
1106 TUint32& aRejection, |
1106 TUint32& aRejection, |
1107 const TRightsType aType ) const |
1107 const TRightsType aType ) const |
1108 { |
1108 { |
1109 // Always check that if the top level rights are present |
1109 // Always check that if the top level rights are present |
1110 // that they are valid |
1110 // that they are valid |
1111 if( iTopLevel && !iTopLevel->Valid( aTime, aIndividual, aRejection ) ) |
1111 if( iTopLevel && !iTopLevel->Valid( aTime, aIndividual, aRejection ) ) |
1112 { |
1112 { |
1113 aRejection |= aRejection; |
1113 aRejection |= aRejection; |
1114 return EFalse; |
1114 return EFalse; |
1115 } |
1115 } |
1116 |
1116 |
1117 switch( aType ) |
1117 switch( aType ) |
1118 { |
1118 { |
1119 case ERightsTopLevel: |
1119 case ERightsTopLevel: |
1120 if( !iTopLevel ) |
1120 if( !iTopLevel ) |
1121 { |
1121 { |
1122 return EFalse; |
1122 return EFalse; |
1123 } |
1123 } |
1124 break; |
1124 break; |
1125 case ERightsPlay: |
1125 case ERightsPlay: |
1126 if( !iPlay ) |
1126 if( !iPlay ) |
1127 { |
1127 { |
1128 return EFalse; |
1128 return EFalse; |
1129 } |
1129 } |
1130 else if( iPlay && !iPlay->Valid( aTime, aIndividual, aRejection ) ) |
1130 else if( iPlay && !iPlay->Valid( aTime, aIndividual, aRejection ) ) |
1131 { |
1131 { |
1132 return EFalse; |
1132 return EFalse; |
1133 } |
1133 } |
1134 break; |
1134 break; |
1135 case ERightsDisplay: |
1135 case ERightsDisplay: |
1136 if( !iDisplay ) |
1136 if( !iDisplay ) |
1137 { |
1137 { |
1138 return EFalse; |
1138 return EFalse; |
1139 } |
1139 } |
1140 else if( iDisplay && !iDisplay->Valid( aTime, aIndividual, aRejection ) ) |
1140 else if( iDisplay && !iDisplay->Valid( aTime, aIndividual, aRejection ) ) |
1141 { |
1141 { |
1142 return EFalse; |
1142 return EFalse; |
1143 } |
1143 } |
1144 break; |
1144 break; |
1145 case ERightsExecute: |
1145 case ERightsExecute: |
1146 if( !iExecute ) |
1146 if( !iExecute ) |
1147 { |
1147 { |
1148 return EFalse; |
1148 return EFalse; |
1149 } |
1149 } |
1150 else if( iExecute && !iExecute->Valid( aTime, aIndividual, aRejection ) ) |
1150 else if( iExecute && !iExecute->Valid( aTime, aIndividual, aRejection ) ) |
1151 { |
1151 { |
1152 return EFalse; |
1152 return EFalse; |
1153 } |
1153 } |
1154 break; |
1154 break; |
1155 case ERightsPrint: |
1155 case ERightsPrint: |
1156 if( !iPrint ) |
1156 if( !iPrint ) |
1157 { |
1157 { |
1158 return EFalse; |
1158 return EFalse; |
1159 } |
1159 } |
1160 else if( iPrint && !iPrint->Valid( aTime, aIndividual, aRejection ) ) |
1160 else if( iPrint && !iPrint->Valid( aTime, aIndividual, aRejection ) ) |
1161 { |
1161 { |
1162 return EFalse; |
1162 return EFalse; |
1163 } |
1163 } |
1164 break; |
1164 break; |
1165 case ERightsExport: |
1165 case ERightsExport: |
1166 if( !iExport ) |
1166 if( !iExport ) |
1167 { |
1167 { |
1168 return EFalse; |
1168 return EFalse; |
1169 } |
1169 } |
1170 else if( iExport && !iExport->Valid( aTime, aIndividual, aRejection ) ) |
1170 else if( iExport && !iExport->Valid( aTime, aIndividual, aRejection ) ) |
1171 { |
1171 { |
1172 return EFalse; |
1172 return EFalse; |
1173 } |
1173 } |
1174 break; |
1174 break; |
1175 default: |
1175 default: |
1176 // No constraints are defined, top level doesn't work |
1176 // No constraints are defined, top level doesn't work |
1177 // on it's own, the permission is invalid |
1177 // on it's own, the permission is invalid |
1178 if( !iPrint && !iDisplay && !iExecute && !iPrint ) |
1178 if( !iPrint && !iDisplay && !iExecute && !iPrint ) |
1179 { |
1179 { |
1180 return EFalse; |
1180 return EFalse; |
1181 } |
1181 } |
1182 else if( iPlay && !iPlay->Valid( aTime, aIndividual, aRejection ) ) |
1182 else if( iPlay && !iPlay->Valid( aTime, aIndividual, aRejection ) ) |
1183 { |
1183 { |
1184 return EFalse; |
1184 return EFalse; |
1185 } |
1185 } |
1186 else if( iDisplay && !iDisplay->Valid( aTime, aIndividual, aRejection ) ) |
1186 else if( iDisplay && !iDisplay->Valid( aTime, aIndividual, aRejection ) ) |
1187 { |
1187 { |
1188 return EFalse; |
1188 return EFalse; |
1189 } |
1189 } |
1190 else if( iPrint && !iPrint->Valid( aTime, aIndividual, aRejection ) ) |
1190 else if( iPrint && !iPrint->Valid( aTime, aIndividual, aRejection ) ) |
1191 { |
1191 { |
1192 return EFalse; |
1192 return EFalse; |
1193 } |
1193 } |
1194 else if( iExecute && !iExecute->Valid( aTime, aIndividual, aRejection ) ) |
1194 else if( iExecute && !iExecute->Valid( aTime, aIndividual, aRejection ) ) |
1195 { |
1195 { |
1196 return EFalse; |
1196 return EFalse; |
1197 } |
1197 } |
1198 else if( iExport && !iExport->Valid( aTime, aIndividual, aRejection ) ) |
1198 else if( iExport && !iExport->Valid( aTime, aIndividual, aRejection ) ) |
1199 { |
1199 { |
1200 return EFalse; |
1200 return EFalse; |
1201 } |
1201 } |
1202 break; |
1202 break; |
1203 } |
1203 } |
1204 return ETrue; |
1204 return ETrue; |
1205 }; |
1205 }; |
1206 |
1206 |
1207 |
1207 |
1208 |
1208 |
1209 // ----------------------------------------------------------------------------- |
1209 // ----------------------------------------------------------------------------- |
1210 // CDRMPermission::ConstructL |
1210 // CDRMPermission::ConstructL |
1215 { |
1215 { |
1216 iTopLevel = CDRMConstraint::NewL(); |
1216 iTopLevel = CDRMConstraint::NewL(); |
1217 iPlay = CDRMConstraint::NewL(); |
1217 iPlay = CDRMConstraint::NewL(); |
1218 iDisplay = CDRMConstraint::NewL(); |
1218 iDisplay = CDRMConstraint::NewL(); |
1219 iExecute = CDRMConstraint::NewL(); |
1219 iExecute = CDRMConstraint::NewL(); |
1220 iPrint = CDRMConstraint::NewL(); |
1220 iPrint = CDRMConstraint::NewL(); |
1221 iExport = CDRMConstraint::NewL(); |
1221 iExport = CDRMConstraint::NewL(); |
1222 |
1222 |
1223 iRightsObjectVersion.iVersionMain = EOma1Rights; |
1223 iRightsObjectVersion.iVersionMain = EOma1Rights; |
1224 iRightsObjectVersion.iVersionSub = 0; |
1224 iRightsObjectVersion.iVersionSub = 0; |
1225 }; |
1225 }; |
1226 |
1226 |
1227 |
1227 |
1228 // ----------------------------------------------------------------------------- |
1228 // ----------------------------------------------------------------------------- |
1229 // CDRMPermission::WriteInt64L |
1229 // CDRMPermission::WriteInt64L |
1230 // ----------------------------------------------------------------------------- |
1230 // ----------------------------------------------------------------------------- |
1231 // |
1231 // |
1232 void CDRMPermission::WriteInt64L( const TInt64& aWrite, RWriteStream& aStream ) const |
1232 void CDRMPermission::WriteInt64L( const TInt64& aWrite, RWriteStream& aStream ) const |
1233 { |
1233 { |
1234 TPtr8 output( reinterpret_cast<TUint8*>(const_cast<TInt64*>(&aWrite)), |
1234 TPtr8 output( reinterpret_cast<TUint8*>(const_cast<TInt64*>(&aWrite)), |
1235 sizeof(TInt64), sizeof(TInt64) ); |
1235 sizeof(TInt64), sizeof(TInt64) ); |
1236 |
1236 |
1237 aStream.WriteL( output, sizeof(TInt64) ); |
1237 aStream.WriteL( output, sizeof(TInt64) ); |
1238 } |
1238 } |
1239 |
1239 |
1240 // ----------------------------------------------------------------------------- |
1240 // ----------------------------------------------------------------------------- |
1241 // CDRMPermission::ReadInt64L |
1241 // CDRMPermission::ReadInt64L |
1242 // ----------------------------------------------------------------------------- |
1242 // ----------------------------------------------------------------------------- |
1243 // |
1243 // |
1244 void CDRMPermission::ReadInt64L( TInt64& aRead, RReadStream& aStream ) |
1244 void CDRMPermission::ReadInt64L( TInt64& aRead, RReadStream& aStream ) |
1245 { |
1245 { |
1246 TPtr8 input( reinterpret_cast<TUint8*>(&aRead), 0, sizeof(TInt64) ); |
1246 TPtr8 input( reinterpret_cast<TUint8*>(&aRead), 0, sizeof(TInt64) ); |
1247 |
1247 |
1248 aStream.ReadL( input, sizeof(TInt64) ); |
1248 aStream.ReadL( input, sizeof(TInt64) ); |
1249 }; |
1249 }; |
1250 |
1250 |
1251 |
1251 |
1252 // ----------------------------------------------------------------------------- |
1252 // ----------------------------------------------------------------------------- |
1253 // CDRMPermission::Merge |
1253 // CDRMPermission::Merge |
1254 // ----------------------------------------------------------------------------- |
1254 // ----------------------------------------------------------------------------- |
1255 // |
1255 // |
1256 EXPORT_C void CDRMPermission::Merge( const CDRMPermission& aPermission ) |
1256 EXPORT_C void CDRMPermission::Merge( const CDRMPermission& aPermission ) |
1257 { |
1257 { |
1258 iTopLevel->Merge( *( aPermission.iTopLevel ) ); |
1258 iTopLevel->Merge( *( aPermission.iTopLevel ) ); |
1259 iPlay->Merge( *( aPermission.iPlay ) ); |
1259 iPlay->Merge( *( aPermission.iPlay ) ); |
1260 iDisplay->Merge( *( aPermission.iDisplay ) ); |
1260 iDisplay->Merge( *( aPermission.iDisplay ) ); |
1261 iExecute->Merge( *( aPermission.iExecute ) ); |
1261 iExecute->Merge( *( aPermission.iExecute ) ); |
1262 iPrint->Merge( *( aPermission.iPrint ) ); |
1262 iPrint->Merge( *( aPermission.iPrint ) ); |
1263 iExport->Merge( *( aPermission.iExport ) ); |
1263 iExport->Merge( *( aPermission.iExport ) ); |
1264 iAvailableRights |= aPermission.iAvailableRights; |
1264 iAvailableRights |= aPermission.iAvailableRights; |
1265 iInfoBits |= aPermission.iInfoBits; |
1265 iInfoBits |= aPermission.iInfoBits; |
1266 } |
1266 } |
1267 |
1267 |
1268 // End of File |
1268 // End of File |