os/security/contentmgmt/contentaccessfwfordrm/inc/rightsinfo.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/contentmgmt/contentaccessfwfordrm/inc/rightsinfo.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,127 @@
     1.4 +/*
     1.5 +* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +/**
    1.23 + @file
    1.24 + @publishedPartner
    1.25 + @released
    1.26 +*/
    1.27 +
    1.28 +
    1.29 +#ifndef __RIGHTSINFO_H__
    1.30 +#define __RIGHTSINFO_H__
    1.31 +
    1.32 +#include <e32base.h>
    1.33 +#include <caf/caftypes.h>
    1.34 +
    1.35 +class RWriteStream;
    1.36 +class RReadStream;
    1.37 +
    1.38 +namespace ContentAccess
    1.39 +{
    1.40 +
    1.41 +	/** Rights class to store a summary description of the rights and a unique 
    1.42 +	reference to the rights object within an Agent
    1.43 +
    1.44 +	*/
    1.45 +	class CRightsInfo : public CBase
    1.46 +		{
    1.47 +	public:
    1.48 +
    1.49 +		/** Construct a new CRightsInfo
    1.50 +		
    1.51 +		@param aDescription A generic text description of the rights supplied by the agent "Content XYZ Expiry date mm/dd/yy" etc
    1.52 +		@param aUniqueId A uniqueId used to refer to this particular rights object within the agent it came from
    1.53 +		@param aRightsTypeMask A bitmask of TRightsType entries applicable to this rights object
    1.54 +		@param aRightsStatus The current status of this rights object
    1.55 +		@return A CRightsInfo object
    1.56 +		*/
    1.57 +		IMPORT_C static CRightsInfo* NewL(const TDesC& aDescription, const TDesC& aUniqueId, TInt aRightsTypeMask, TRightsStatus aRightsStatus);
    1.58 +		
    1.59 +		/** Construct a new CRightsInfo from a stream */
    1.60 +		IMPORT_C static CRightsInfo* NewL(RReadStream& aStream);
    1.61 +
    1.62 +		virtual ~CRightsInfo();
    1.63 +
    1.64 +		/** returns a string describing the rights object
    1.65 +		@capability DRM Access to DRM rights is not permitted for processes without DRM capability. 
    1.66 +		*/
    1.67 +		IMPORT_C const TDesC& Description() const;
    1.68 +
    1.69 +		/** returns a string with a unique Id used to identify a particular rights object
    1.70 +		@capability DRM Access to DRM rights is not permitted for processes without DRM capability. 
    1.71 +		*/
    1.72 +		IMPORT_C const TDesC& UniqueId() const;
    1.73 +
    1.74 +		/** Returns a bit mask of TRightsTypeMask flags. A rights object can be stateless and/or consumable
    1.75 +		
    1.76 +		@see ContentAccess::TRightsTypeMask
    1.77 +
    1.78 +		@capability DRM Access to DRM rights is not permitted for processes without DRM capability. 		
    1.79 +		*/
    1.80 +		IMPORT_C TInt RightsType() const;
    1.81 +
    1.82 +		/** The state of the rights
    1.83 +
    1.84 +		@see ContentAccess::TRightsStatus
    1.85 +
    1.86 +		@capability DRM Access to DRM rights is not permitted for processes without DRM capability. 		
    1.87 +		*/
    1.88 +		IMPORT_C TRightsStatus RightsStatus() const;
    1.89 +
    1.90 +		/** Write this CRightsInfo object to a stream
    1.91 +
    1.92 +		@param aStream The stream
    1.93 +		*/
    1.94 +		IMPORT_C void ExternalizeL(RWriteStream &aStream) const;
    1.95 +
    1.96 +	private:
    1.97 +		CRightsInfo();
    1.98 +		
    1.99 +		CRightsInfo(TInt aRightsType, TRightsStatus aRightsStatus);
   1.100 +		void ConstructL(const TDesC& aDescription, const TDesC& aUniqueId);
   1.101 +		
   1.102 +		void InternalizeL(RReadStream& aStream);
   1.103 +		
   1.104 +	private:
   1.105 +		
   1.106 +		HBufC* iDescription;
   1.107 +		HBufC* iUniqueId;
   1.108 +
   1.109 +		TInt iRightsType;
   1.110 +		TRightsStatus iRightsStatus;
   1.111 +		};
   1.112 +
   1.113 +	/** Interface used by agents as a base class for their own rights objects
   1.114 +
   1.115 +	Agent derived classes will contain a complete object capable of describing
   1.116 +	rights for content managed by that agent.
   1.117 +
   1.118 +	All derived classes must implement the serialization functions InternalizeL() 
   1.119 +	and ExternalizeL()
   1.120 +
   1.121 +	*/
   1.122 +	class MAgentRightsBase 
   1.123 +		{
   1.124 +	public:
   1.125 +		virtual void ExternalizeL(RWriteStream& aStream) const = 0;
   1.126 +		virtual void InternalizeL(RReadStream& aStream) = 0;
   1.127 +		};	
   1.128 +	}
   1.129 +
   1.130 +#endif