os/security/contentmgmt/contentaccessfwfordrm/inc/attribute.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) 2003-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  @deprecated
    23 */
    24 
    25 #ifndef __CAF_ATTRIBUTE_H__
    26 #define __CAF_ATTRIBUTE_H__
    27 
    28 #ifndef REMOVE_CAF1
    29 
    30 #include <e32base.h>
    31 #include <f32file.h>
    32 #include <caf/caftypes.h>
    33 
    34 
    35 namespace ContentAccess
    36 {
    37 	class CAgentContent;
    38 	class CAgentFactory;
    39 	class CBitset;
    40 	
    41 	/**
    42 	 * Encapsulates the attributes of a piece of content. 
    43 	 *
    44 	 * These attributes will be required by DRM-aware
    45 	 * applications in order that they can uphold DRM policies in a
    46 	 * well-behaved manner. In general, clients set one or more attributes
    47 	 * in the <i>Query</i> set, make a <i>GetL</i> call, and then
    48 	 * read the agent's reponse from the <i>Response</i> set.
    49 	 *
    50 	 * CAttribute is a container for a number of separate
    51 	 * ContentAccess::CBitset objects. These individual bitsets contain:
    52 	 * -# Queries - what the client is interested in knowing.
    53 	 * -# Responses - the answers to the queries.
    54 	 * -# Capabilities - which attributes the system is able to support.
    55 	 *
    56 	 * Access to the bitset operations themselves can be achieved via the
    57 	 * ContentAccess::CAttribute::AttributeSetL operation.
    58 	 *
    59 	 * @publishedPartner
    60 	 * @deprecated 
    61 	 */
    62 	class CAttribute : public CBase
    63 		{
    64 	public:
    65 		/**
    66 		 Constructs a new attribute given an agent and file handle.
    67 		 
    68 		 @param aAgentUid	The agent Uid
    69 		 @param aFile		A file handle 
    70 		 @return			The new CAttribute.
    71 		 
    72 		 @internalComponent
    73 		 @released		 
    74 		 */
    75 		static CAttribute* NewLC(TUid aAgentUid, RFile& aFile);
    76 		
    77 		/**
    78 		 Constructs a new attribute given an agent and content.
    79 		 
    80 		 @param aAgentUid	The agent Uid
    81 		 @param aURI		The pathname of the target content.
    82 		 @param aShareMode Optional share mode for opening attributes of this content, defaults to EContentShareReadOnly. This parameter has no effect unless the content is a local file on the device.
    83 		 @return			The new CAttribute.
    84 		 
    85 		 @internalComponent
    86 		 @released
    87 		 */
    88 		static CAttribute* NewLC(TUid aAgentUid, const TDesC& aURI, TContentShareMode aShareMode=EContentShareReadOnly);
    89 
    90 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT		
    91 		/**
    92 		 Constructs a new attribute given an agent and WMDRM header data.
    93 		 
    94 		 @param aAgentUid	The agent Uid
    95 		 @param aHeaderData	Header data of WMDRM content
    96 		 @return			The new CAttribute.
    97 		 
    98 		 @internalComponent
    99 		 @released		 
   100 		 */
   101 		static CAttribute* NewLC(TUid aAgentUid, const TDesC8& aHeaderData);
   102 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   103 		
   104 		virtual ~CAttribute();
   105 
   106 		/**
   107 		 * Returns a reference to the query set
   108 		 *
   109 		 * The bits of the query-set should be set or cleared prior to the "GetL()" 
   110 		 * call to specify which attributes the client is interested in.
   111 		 *
   112 		 * @note	Set is probably best used inline to access some of the 
   113 		 * 			CBitset operations directly.
   114 		 * 			@code 
   115 		 * 			// Set EIsProtected in the Query set.
   116 		 * 			MyAttr->QuerySet(EQuerySet).Set(EIsProtected);
   117 		 * 			@endcode
   118 		 *
   119 		 * @return	A CBitset refererence.
   120 		 */
   121 		IMPORT_C CBitset& QuerySet();
   122 
   123 		/**
   124 		 * Returns a reference to the response set. 
   125 		 * 
   126 		 * The response set will only be valid after a call to the "GetL()" operation.
   127 		 *
   128 		 * @return	A CBitset refererence.
   129 		 */
   130 		IMPORT_C const CBitset& ResponseSet() const;
   131 		
   132 		/**
   133 		 * Resets the attribute object completely. 
   134 		 */ 
   135 		IMPORT_C void Reset();
   136 		
   137 		/**
   138 		 * Delivers the attribute object to the relevant agent for
   139 		 * querying. 
   140 		 * 
   141 		 * The agent will set or reset the ResponseSet() bits for any QuerySet() bits 
   142 		 * that are set
   143 		 */
   144 		IMPORT_C void GetL();
   145 		
   146 	private:
   147 		void ConstructL(TUid aAgentUid, RFile& aFile);
   148 		void ConstructL(TUid aAgentUid, const TDesC& aURI, TContentShareMode aShareMode=EContentShareReadOnly);
   149 
   150 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   151 		void ConstructL(TUid aAgentUid, const TDesC8& aHeaderData);
   152 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   153 	
   154 		CAttribute();
   155 				
   156 	private:
   157 		/** The real object used to retrieve attributes. */
   158 		CAgentContent* iAgentContent;
   159 		CAgentFactory* iAgentFactory;
   160 
   161 		CBitset* iQuerySet;
   162 		CBitset* iResponseSet;
   163 		};
   164 	}
   165 
   166 #endif // REMOVE_CAF1
   167 
   168 #endif // __ATTRIBUTE_H__
   169