os/security/contentmgmt/contentaccessfwfordrm/source/reccaf/CafApaRecognizer.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  @internalComponent
    22  @released
    23 */
    24 
    25 #ifndef __CAFAPARECOGNIZER_H__
    26 #define __CAFAPARECOGNIZER_H__
    27 
    28 #include <apmrec.h>
    29 
    30 #include <caf/caf.h>
    31 
    32 const TUid KUidCafApaRecognizer = {0x101ff761};
    33 
    34 class CMimeTypeMapping;
    35 class RFileReadStream;
    36 
    37 /**
    38 This is the apparc recognizer for files handled by the Content Access Framework.
    39 It recognizes protected content and returns a mime type to apparc based upon a
    40 set of rules:
    41 
    42 @li A file containing one or more content object(s) that needs to be be passed 
    43 through the CAF supplier API before it can be used will be recognized as it's 
    44 native file mime type (eg. application/vnd.oma.drm.message).
    45 
    46 @li A file containing more than one content object will be recognized as 
    47 <b>application/x-caf</b> regardless of what type of file it is. If the file 
    48 is recognized the method used to store the content objects inside the file 
    49 is irrelevant. CAF abstracts the process of navigating and reading from those 
    50 objects anyway.
    51 
    52 @li A file containing a single content object will be recognized as a mangled 
    53 version of that content object's mime type regardless of the type of file holding
    54 that content object. The prefix "x-caf-" will be added to the content objects mime 
    55 type to distinguish it from normal content files with that mime type. For instance 
    56 a protected file containing an image/jpeg will be recognized as x-caf-image/jpeg
    57 
    58 @internalComponent
    59 @released
    60 */
    61 
    62 class CApaCafRecognizer : public CApaDataRecognizerType
    63 	{
    64 public:	
    65 	static CApaCafRecognizer* NewL();
    66 	virtual ~CApaCafRecognizer();
    67 
    68 	// From CApaDataRecognizerType
    69 	virtual TUint PreferredBufSize();
    70 	virtual TDataType SupportedDataTypeL(TInt aIndex) const;
    71 	virtual void DoRecognizeL(const TDesC& aName, const TDesC8& aBuffer);
    72 	
    73 private:	
    74 	CApaCafRecognizer();
    75 	void ConstructL();
    76 
    77 	// Build a list of content types
    78 	void SetupContentTypesL();
    79 	TInt ReadLine(RFileReadStream& aFile, TDes8& aBuffer);
    80 	RPointerArray <CMimeTypeMapping> iContentTypes;
    81 
    82 	ContentAccess::CAgentResolver* iResolver;
    83 	};
    84 
    85 #endif
    86