os/security/contentmgmt/contentaccessfwfordrm/inc/rightsinfo.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *
    16 */
    17 
    18 
    19 /**
    20  @file
    21  @publishedPartner
    22  @released
    23 */
    24 
    25 
    26 #ifndef __RIGHTSINFO_H__
    27 #define __RIGHTSINFO_H__
    28 
    29 #include <e32base.h>
    30 #include <caf/caftypes.h>
    31 
    32 class RWriteStream;
    33 class RReadStream;
    34 
    35 namespace ContentAccess
    36 {
    37 
    38 	/** Rights class to store a summary description of the rights and a unique 
    39 	reference to the rights object within an Agent
    40 
    41 	*/
    42 	class CRightsInfo : public CBase
    43 		{
    44 	public:
    45 
    46 		/** Construct a new CRightsInfo
    47 		
    48 		@param aDescription A generic text description of the rights supplied by the agent "Content XYZ Expiry date mm/dd/yy" etc
    49 		@param aUniqueId A uniqueId used to refer to this particular rights object within the agent it came from
    50 		@param aRightsTypeMask A bitmask of TRightsType entries applicable to this rights object
    51 		@param aRightsStatus The current status of this rights object
    52 		@return A CRightsInfo object
    53 		*/
    54 		IMPORT_C static CRightsInfo* NewL(const TDesC& aDescription, const TDesC& aUniqueId, TInt aRightsTypeMask, TRightsStatus aRightsStatus);
    55 		
    56 		/** Construct a new CRightsInfo from a stream */
    57 		IMPORT_C static CRightsInfo* NewL(RReadStream& aStream);
    58 
    59 		virtual ~CRightsInfo();
    60 
    61 		/** returns a string describing the rights object
    62 		@capability DRM Access to DRM rights is not permitted for processes without DRM capability. 
    63 		*/
    64 		IMPORT_C const TDesC& Description() const;
    65 
    66 		/** returns a string with a unique Id used to identify a particular rights object
    67 		@capability DRM Access to DRM rights is not permitted for processes without DRM capability. 
    68 		*/
    69 		IMPORT_C const TDesC& UniqueId() const;
    70 
    71 		/** Returns a bit mask of TRightsTypeMask flags. A rights object can be stateless and/or consumable
    72 		
    73 		@see ContentAccess::TRightsTypeMask
    74 
    75 		@capability DRM Access to DRM rights is not permitted for processes without DRM capability. 		
    76 		*/
    77 		IMPORT_C TInt RightsType() const;
    78 
    79 		/** The state of the rights
    80 
    81 		@see ContentAccess::TRightsStatus
    82 
    83 		@capability DRM Access to DRM rights is not permitted for processes without DRM capability. 		
    84 		*/
    85 		IMPORT_C TRightsStatus RightsStatus() const;
    86 
    87 		/** Write this CRightsInfo object to a stream
    88 
    89 		@param aStream The stream
    90 		*/
    91 		IMPORT_C void ExternalizeL(RWriteStream &aStream) const;
    92 
    93 	private:
    94 		CRightsInfo();
    95 		
    96 		CRightsInfo(TInt aRightsType, TRightsStatus aRightsStatus);
    97 		void ConstructL(const TDesC& aDescription, const TDesC& aUniqueId);
    98 		
    99 		void InternalizeL(RReadStream& aStream);
   100 		
   101 	private:
   102 		
   103 		HBufC* iDescription;
   104 		HBufC* iUniqueId;
   105 
   106 		TInt iRightsType;
   107 		TRightsStatus iRightsStatus;
   108 		};
   109 
   110 	/** Interface used by agents as a base class for their own rights objects
   111 
   112 	Agent derived classes will contain a complete object capable of describing
   113 	rights for content managed by that agent.
   114 
   115 	All derived classes must implement the serialization functions InternalizeL() 
   116 	and ExternalizeL()
   117 
   118 	*/
   119 	class MAgentRightsBase 
   120 		{
   121 	public:
   122 		virtual void ExternalizeL(RWriteStream& aStream) const = 0;
   123 		virtual void InternalizeL(RReadStream& aStream) = 0;
   124 		};	
   125 	}
   126 
   127 #endif