epoc32/include/caf/data.h
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
     1 /*
     1 /*
     2 * Copyright (c) 2003-2007 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    18 
    18 
    19 
    19 
    20 /** 
    20 /** 
    21 @file
    21 @file
    22 
    22 
    23 @publishedPartner
    23 @publishedAll
    24 @released
    24 @released
    25 */
    25 */
    26 
    26 
    27 
    27 
    28 #ifndef __DATA_H__
    28 #ifndef __DATA_H__
    46  	Allows clients to read data from a content object. 
    46  	Allows clients to read data from a content object. 
    47 	 
    47 	 
    48  	This class is initialised with an agent implementation that is
    48  	This class is initialised with an agent implementation that is
    49  	responsible for this content object.
    49  	responsible for this content object.
    50  
    50  
    51  	@publishedPartner
       
    52  	@released
       
    53  	*/
    51  	*/
    54 	class CData : public CBase
    52 	class CData : public CBase
    55 		{
    53 		{
    56 	public:
    54 	public:
    57 		/** 
    55 		/** 
   245 		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
   243 		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
   246 		 @leave KErrAccessDenied	The content is already in use.
   244 		 @leave KErrAccessDenied	The content is already in use.
   247 		 @leave ...				One of the other CAF error codes defined in \c caferr.h  
   245 		 @leave ...				One of the other CAF error codes defined in \c caferr.h  
   248 		 						or one of the other system-wide error codes 
   246 		 						or one of the other system-wide error codes 
   249 								for any other errors.
   247 								for any other errors.
   250 		
       
   251 		@internalComponent
       
   252 		@released
       
   253 		 */
   248 		 */
   254 		static CData* NewLC(TUid aAgentUid, const TVirtualPathPtr& aVirtualPath,
   249 		static CData* NewLC(TUid aAgentUid, const TVirtualPathPtr& aVirtualPath,
   255 							TIntent aIntent, TContentShareMode aShareMode); 
   250 							TIntent aIntent, TContentShareMode aShareMode); 
   256 		
   251 		
   257 		/** 
   252 		/** 
   273 		 @leave KErrAccessDenied	The content is already in use.
   268 		 @leave KErrAccessDenied	The content is already in use.
   274 		 @leave ...				One of the other CAF error codes defined in \c caferr.h  
   269 		 @leave ...				One of the other CAF error codes defined in \c caferr.h  
   275 		 						or one of the other system-wide error codes for 
   270 		 						or one of the other system-wide error codes for 
   276 								any other errors.
   271 								any other errors.
   277 
   272 
   278 		@internalComponent
       
   279 		@released
       
   280 		 */
   273 		 */
   281 		static CData* NewLC(TUid aAgentUid, RFile& aFile, const TDesC& aUniqueId, TIntent aIntent);
   274 		static CData* NewLC(TUid aAgentUid, RFile& aFile, const TDesC& aUniqueId, TIntent aIntent);
   282 		
   275 
       
   276 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   277 		
       
   278 		/** 
       
   279 		 Creates a new CData object. 
       
   280 		 @param aHeaderData				Header data of WMDRM file/stream content. 
       
   281 		 @return 						CData object.
       
   282 		 @leave							One of the CAF error codes defined in caferr.h or one of the 
       
   283 										system-wide error for any other errors.
       
   284 		 @capability 					DRM Access to DRM protected content is not permitted for processes without DRM capability.
       
   285 										Access to unprotected content is unrestricted.
       
   286 		*/
       
   287 			
       
   288 		IMPORT_C static CData* NewL(const TDesC8& aHeaderData);
       
   289 		
       
   290 		/** 
       
   291 		 Creates a new CData object. 
       
   292 		 @param aHeaderData				Header data of WMDRM file/stream content.
       
   293 		 @param aIntent					The intended use of the content.
       
   294 		 @return 						CData object.
       
   295 		 @leave							One of the CAF error codes defined in caferr.h or one of the 
       
   296 										system-wide error for any other errors.
       
   297 		 @capability 					DRM Access to DRM protected content is not permitted for processes without DRM capability.
       
   298 										Access to unprotected content is unrestricted.
       
   299 		*/		
       
   300 		
       
   301 		IMPORT_C static CData* NewL(const TDesC8& aHeaderData, TIntent aIntent);
       
   302 		
       
   303 		/** 
       
   304 		 Creates a new CData object. 
       
   305 		 @param aHeaderData				Header data of WMDRM file/stream content. 
       
   306 		 @return 						CData object.
       
   307 		 @leave							One of the CAF error codes defined in caferr.h or one of the 
       
   308 										system-wide error for any other errors.
       
   309 		 @capability 					DRM Access to DRM protected content is not permitted for processes without DRM capability.
       
   310 										Access to unprotected content is unrestricted.
       
   311 		*/
       
   312 		
       
   313 		IMPORT_C static CData* NewLC(const TDesC8& aHeaderData);
       
   314 		
       
   315 		/** 
       
   316 		 Creates a new CData object. 
       
   317 		 @param aHeaderData				Header data of WMDRM file/stream content.
       
   318 		 @param aIntent					The intended use of the content. 
       
   319 		 @return 						CData object.
       
   320 		 @leave							One of the CAF error codes defined in caferr.h or one of the 
       
   321 										system-wide error for any other errors.
       
   322 		 @capability 					DRM Access to DRM protected content is not permitted for processes without DRM capability.
       
   323 										Access to unprotected content is unrestricted.
       
   324 		*/
       
   325 		
       
   326 		IMPORT_C static CData* NewLC(const TDesC8& aHeaderData, TIntent aIntent);
       
   327 		
       
   328 		/** 
       
   329 		 Creates a new CData object.
       
   330 		 @param	aAgentUid				UID of an agent which supports this content. 
       
   331 		 @param aHeaderData				Header data of WMDRM file/stream content.
       
   332 		 @param aIntent					The intended use of the content.
       
   333 		 @return 						CData object.
       
   334 		 @leave							One of the CAF error codes defined in caferr.h or one of the 
       
   335 										system-wide error for any other errors.
       
   336 		 @capability 					DRM Access to DRM protected content is not permitted for processes without DRM capability.
       
   337 										Access to unprotected content is unrestricted.
       
   338 		 
       
   339 		*/
       
   340 		
       
   341 		static CData* NewLC(TUid aAgentUid, const TDesC8& aHeaderData, TIntent aIntent);
       
   342 		
       
   343 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   344 
   283 		/** destructor */
   345 		/** destructor */
   284 		virtual ~CData();
   346 		virtual ~CData();
   285 		
   347 		
   286 		/** 
   348 		/** 
   287 		 Reads from a content object up to the maximum length of the
   349 		 Reads from a content object up to the maximum length of the
   373 		 					this function will not have any effect.
   435 		 					this function will not have any effect.
   374 		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
   436 		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
   375 		*/
   437 		*/
   376 		IMPORT_C void ReadCancel(TRequestStatus &aStatus) const;		
   438 		IMPORT_C void ReadCancel(TRequestStatus &aStatus) const;		
   377 
   439 
       
   440 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   378 		/**
   441 		/**
   379 		 Reads content asynchronously. The data is read from a specified offset 
   442 		 Reads content asynchronously. The data is read from a specified offset 
   380 		 up to a specified number of bytes or until the end of the content object 
   443 		 up to a specified number of bytes or until the end of the content object 
   381 		 is reached. The data is read into the descriptor buffer supplied.
   444 		 is reached. The data is read into the descriptor buffer supplied.
   382 		 NB: It is important that the descriptor passed to 
   445 		 NB: It is important that the descriptor passed to 
   383 		 aDes remains in scope until the request has completed.			
   446 		 aDes remains in scope until the request has completed.
   384 		 
   447 		 If agent does not support 64bit, fallback to 32bit Read is provided automatically by CAF			
       
   448 				 
   385 		 @see Read(TDes8& aDes)
   449 		 @see Read(TDes8& aDes)
   386 		 
   450 				 
   387 		 @param aPos		Position of first byte to be read. 
   451 		 @param aPos		Position of first byte to be read. 
   388 		 					This is an offset from the start of the file. 
   452 							This is an offset from the start of the file. 
   389 		 @param aDes 		Descriptor into which binary data is read. Any
   453 		 @param aDes 		Descriptor into which binary data is read. Any
   390 		  					existing contents are overwritten. On return,
   454 		  					existing contents are overwritten. On return,
   391 		 					its length is set to the number of bytes read. 
   455 		 					its length is set to the number of bytes read. 
   392 		 @param aLength		The number of bytes to read from the file,
   456 		 @param aLength		The number of bytes to read from the file,
   393 		 					or to the end of the file, whichever is encountered first. 
   457 		 					or to the end of the file, whichever is encountered first. 
   399 							error codes for any other errors.
   463 							error codes for any other errors.
   400 		 @return KErrNone if the async read request was successfully submitted.
   464 		 @return KErrNone if the async read request was successfully submitted.
   401 		 @return KErrArgument if a negative offset is supplied.
   465 		 @return KErrArgument if a negative offset is supplied.
   402 		 @return KErrCANotSupported if the agent does not support this operation.
   466 		 @return KErrCANotSupported if the agent does not support this operation.
   403 		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
   467 		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
   404 		 */
   468 		*/
       
   469 		IMPORT_C TInt Read(TInt64 aPos, TDes8& aDes, TInt aLength, TRequestStatus& aStatus) const;
       
   470 #else
       
   471 			/**
       
   472 		 Reads content asynchronously. The data is read from a specified offset 
       
   473 		 up to a specified number of bytes or until the end of the content object 
       
   474 		 is reached. The data is read into the descriptor buffer supplied.
       
   475 				 
       
   476 		 @see Read(TDes8& aDes)
       
   477 				 
       
   478 		 @param aPos		Position of first byte to be read. 
       
   479 							This is an offset from the start of the file. 
       
   480 		 @param aDes 		Descriptor into which binary data is read. Any
       
   481 		  					existing contents are overwritten. On return,
       
   482 		 					its length is set to the number of bytes read. 
       
   483 		 @param aLength		The number of bytes to read from the file,
       
   484 		 					or to the end of the file, whichever is encountered first. 
       
   485 		 					The length of the buffer is set to the number of bytes actually read.
       
   486 		 @param aStatus		Asynchronous request status. On completion this will contain one 
       
   487 		 					of the following error codes: KErrNone if the data was 
       
   488 							successfully read. Otherwise one of the CAF error codes defined in 
       
   489 							\c caferr.h  or one of the other standard system-wide
       
   490 							error codes for any other errors.
       
   491 		 @return KErrNone if the async read request was successfully submitted.
       
   492 		 @return KErrArgument if a negative offset is supplied.
       
   493 		 @return KErrCANotSupported if the agent does not support this operation.
       
   494 		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
       
   495 		*/
   405 		IMPORT_C TInt Read(TInt aPos, TDes8& aDes, TInt aLength, TRequestStatus& aStatus) const;
   496 		IMPORT_C TInt Read(TInt aPos, TDes8& aDes, TInt aLength, TRequestStatus& aStatus) const;
   406 		
   497 #endif //SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
       
   498 
   407 		/**
   499 		/**
   408 		 Gets the data size in bytes.
   500 		 Gets the data size in bytes.
   409 		 
   501 		 
   410 		 @param aSize	On return this will contain the size of the plaintext data in bytes.
   502 		 @param aSize	On return this will contain the size of the plaintext data in bytes.
   411 		 @leave KErrCASizeNotDetermined	Size could not be determined by the managing agent.
   503 		 @leave KErrCASizeNotDetermined	Size could not be determined by the managing agent.
   413 						system-wide error codes for any other errors.		 
   505 						system-wide error codes for any other errors.		 
   414 		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted
   506 		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted
   415 		 */
   507 		 */
   416 		IMPORT_C void DataSizeL(TInt& aSize);
   508 		IMPORT_C void DataSizeL(TInt& aSize);
   417 
   509 
       
   510 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
       
   511 		/**
       
   512 		 This is the 64bit version of CData::DataSizeL
       
   513 		 Client can call this function instead of CData::DataSizeL. If it's not implemented by the agent,
       
   514 		 fallback to 32bit counterpart will be provided automatically
       
   515 		 
       
   516 		 @see DataSizeL(TInt& aSize)
       
   517 		*/
       
   518 		IMPORT_C void DataSize64L(TInt64& aSize);
       
   519 #endif //SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
       
   520 				
   418 		/**
   521 		/**
   419 		 Changes or retrieves the location of the file pointer within 
   522 		 Changes or retrieves the location of the file pointer within 
   420 		 the content object.
   523 		 the content object.
   421 		 
   524 		 
   422  		 NOTE: Some operations may fail if the content data is sourced over a network connection.		 
   525  		 NOTE: Some operations may fail if the content data is sourced over a network connection.		 
   450 		 				of the other system-wide error codes.
   553 		 				of the other system-wide error codes.
   451 		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
   554 		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
   452 		*/
   555 		*/
   453 		IMPORT_C TInt Seek(TSeek aMode,TInt& aPos) const;
   556 		IMPORT_C TInt Seek(TSeek aMode,TInt& aPos) const;
   454 		
   557 		
       
   558 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
       
   559 		/**
       
   560 		 This is the 64bit version of CData::Seek
       
   561 		 Client can call this function instead of CData::Seek. If it's not implemented by the agent,
       
   562 		 fallback to 32bit counterpart will be provided automatically
       
   563 		 
       
   564 		 @see Seek(TSeek aMode,TInt& aPos)
       
   565 		*/
       
   566 		IMPORT_C TInt Seek64(TSeek aMode,TInt64& aPos) const;
       
   567 #endif //SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   455 
   568 
   456 		/** Request the agent handling this content to set a property value. If the property is set
   569 		/** Request the agent handling this content to set a property value. If the property is set
   457 		it is only set for this CData session and does not impact other CAF	users.
   570 		it is only set for this CData session and does not impact other CAF	users.
   458 
   571 
   459 		 For example setting the buffer-size to 256 bytes can be achieved as follows:
   572 		 For example setting the buffer-size to 256 bytes can be achieved as follows:
   676 		@return Otherwise one of the CAF error codes defined in \c caferr.h  or one of the 
   789 		@return Otherwise one of the CAF error codes defined in \c caferr.h  or one of the 
   677 				other system-wide error codes for any other errors.				 
   790 				other system-wide error codes for any other errors.				 
   678 		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
   791 		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
   679 		*/
   792 		*/
   680 		IMPORT_C TInt GetStringAttributeSet(RStringAttributeSet& aStringAttributeSet) const;
   793 		IMPORT_C TInt GetStringAttributeSet(RStringAttributeSet& aStringAttributeSet) const;
   681 
   794 				
       
   795 				
   682 #ifndef REMOVE_CAF1
   796 #ifndef REMOVE_CAF1
   683 		/** Set Qos attribute
   797 		/** Set Qos attribute
   684 		@param aQosAttr The Qos attribute to set.
   798 		@param aQosAttr The Qos attribute to set.
   685 		@param aValue The value of the attribute.
   799 		@param aValue The value of the attribute.
   686 		@deprecated 
   800 		@deprecated 
   693 		@deprecated 
   807 		@deprecated 
   694 		*/
   808 		*/
   695 		IMPORT_C TBool GetMimeTypeL(TDes8& aMimeType) const;
   809 		IMPORT_C TBool GetMimeTypeL(TDes8& aMimeType) const;
   696 #endif	// REMOVE_CAF1
   810 #endif	// REMOVE_CAF1
   697 
   811 
       
   812 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   813 		/**
       
   814 		Decrypts the encrypted input data packet.
       
   815 		
       
   816 		@param aEncryptedInputDataPacket	Buffer descriptor containing the encrypted data packet supplied by client application. 
       
   817 		@param aDecryptedOutputDataPacket	Buffer descriptor supplied by the client application into which the decrypted data is written.
       
   818 											The length of this descriptor must be equal to or greater than the input packet.
       
   819 		@return								KErrNone if successful.KErrInsufficientDataPacketLength if a part of input packet is provided,
       
   820 											otherwise one of the CAF error codes defined in \c caferr.h  or 
       
   821 		 									one of the other system-wide error codes.
       
   822 		@capability 						DRM Access to DRM protected content is not permitted for processes without DRM capability.
       
   823 											Access to unprotected content is unrestricted.
       
   824 		*/
       
   825 
       
   826 		IMPORT_C TInt Read(const TDesC8& aEncryptedInputDataPacket, TDes8& aDecryptedOutputDataPacket) const;
       
   827 		
       
   828 		/**
       
   829 		Decrypts the encrypted input data packet asynchronously.
       
   830 		@param aEncryptedInputDataPacket	Buffer descriptor containing the encrypted data packet supplied by client application. 
       
   831 		@param aDecryptedOutputDataPacket	Buffer descriptor supplied by the client application into which the decrypted data is written.
       
   832 											The length of this descriptor must be equal to or greater than the input packet.
       
   833 		@param aStatus						Asynchronous request status. On completion this will contain one of the following error codes:
       
   834 											KErrNone if the data packet was successfully decrypted.KErrInsufficientDataPacketLength if a 
       
   835 											part of input packet is provided, otherwise one of the CAF error codes defined in \c caferr.h or 
       
   836 		 									one of the other system-wide error codes.
       
   837 		@capability 						DRM Access to DRM protected content is not permitted for processes without DRM capability.
       
   838 										    Access to unprotected content is unrestricted. 
       
   839 		*/
       
   840 		IMPORT_C void Read(const TDesC8& aEncryptedInputDataPacket, TDes8& aDecryptedOutputDataPacket, TRequestStatus& aStatus) const;
       
   841 
       
   842 #endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   698 	
   843 	
   699 	private:
   844 	private:
   700 		CData();
   845 		CData();
   701 		void ConstructL(RFile& aFile, const TDesC& aUniqueId, TIntent aIntent);
   846 		void ConstructL(RFile& aFile, const TDesC& aUniqueId, TIntent aIntent);
   702 		void ConstructL(const TVirtualPathPtr& aVirtualPath, TIntent aIntent, TContentShareMode aShareMode);
   847 		void ConstructL(const TVirtualPathPtr& aVirtualPath, TIntent aIntent, TContentShareMode aShareMode);
   706 		void ConstructL(RFile& aFile, const TDesC& aUniqueId);
   851 		void ConstructL(RFile& aFile, const TDesC& aUniqueId);
   707 		void ConstructL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode);
   852 		void ConstructL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode);
   708 		void ConstructL(TUid aAgentUid, RFile& aFile, const TDesC& aUniqueId);
   853 		void ConstructL(TUid aAgentUid, RFile& aFile, const TDesC& aUniqueId);
   709 		void ConstructL(TUid aAgentUid, const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode); 
   854 		void ConstructL(TUid aAgentUid, const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode); 
   710 
   855 
       
   856 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   857 		
       
   858 		void ConstructL(TUid aAgentUid, const TDesC8& aHeaderData, TIntent aIntent);
       
   859 		void ConstructL(const TDesC8& aHeaderData);
       
   860 		void ConstructL(const TDesC8& aHeaderData, TIntent aIntent);
       
   861 		void ConstructL(TUid aAgentUid, const TDesC8& aHeaderData);
       
   862 		
       
   863 #endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   864 
       
   865 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
       
   866 		/*
       
   867 		 * This is the obselete 32bit Read and replaced by its 64bit counterpart
       
   868 		 * TInt Read(TInt64 aPos, TDes8& aDes, TInt aLength, TRequestStatus& aStatus) const
       
   869 		 * However, this function still exits at its original ordinal to avoid BC break. 
       
   870 		 * Upgrade to 64bit Read is done automatically upon recompling the client code which uses CAF interfaces 
       
   871 		*/
       
   872 		IMPORT_C TInt Read_Unused(TInt aPos, TDes8& aDes, TInt aLength, TRequestStatus& aStatus) const;
       
   873 #endif //SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   711 
   874 
   712 	private:
   875 	private:
   713 		// The agent handling this content
   876 		// The agent handling this content
   714 		CAgentData* iAgentData; 
   877 		CAgentData* iAgentData; 
   715 
   878