wmdrm/camese/wmdrmdla/inc/wmdrmdlaparser.h
changeset 0 95b198f216e5
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 2008 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 "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:  DRM Header and License Response Parser
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_WMDRMDLAPARSER_H
       
    20 #define C_WMDRMDLAPARSER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <xml/contenthandler.h>
       
    24 #include <xml/parser.h>
       
    25 
       
    26 /**
       
    27 *  CWmDrmDlaParser
       
    28 *  DRM Header and License Response Parser for the WMDRM DLA
       
    29 *
       
    30 *  @lib wmdrmdla.dll
       
    31 *  @since 9.1
       
    32 */
       
    33 NONSHARABLE_CLASS( CWmDrmDlaParser ) 
       
    34     : public CBase, public Xml::MContentHandler
       
    35     {
       
    36     public:
       
    37         /**
       
    38          * Two-phased constructor.
       
    39          * @return address of an instance of this class
       
    40          */
       
    41         static CWmDrmDlaParser* NewL();
       
    42 
       
    43         /**
       
    44          * Destructor.
       
    45          */
       
    46         virtual ~CWmDrmDlaParser();
       
    47 
       
    48         /**
       
    49          * Extract the TID and content URL from the license response
       
    50          * @param aLicenseResponse The license response to parse
       
    51          * @param aTID The TID that was extracted and returned. 
       
    52          *             If no TID found the parameter is set to NULL
       
    53          * @param aContentUrl The content URL that was extracted and returned. 
       
    54          *                    If no content URL found the parameter is set to NULL
       
    55          */
       
    56         TInt ProcessLicenseResponse( const TDesC8& aLicenseResponse, 
       
    57                                      HBufC8*& aTID, HBufC8*& aContentURL );
       
    58         /**
       
    59          * Extract the server Url from the DRM Heasder
       
    60          * @param aDrmHeader The DRM Header to parse
       
    61          * @param aServerUrl The server URL that was extracted and returned. 
       
    62          *                   If no server URL found the parameter is set to NULL
       
    63          */
       
    64         TInt GetLicenseServerURLFromDRMHeader( const TDesC8& aDrmHeader, 
       
    65                                                HBufC8*& aServerURL );
       
    66 
       
    67     private:  // From Xml::MContentHandler
       
    68         virtual void OnStartDocumentL( const Xml::RDocumentParameters& aDocParam, 
       
    69                                        TInt aErrorCode );
       
    70         virtual void OnEndDocumentL( TInt aErrorCode );
       
    71         virtual void OnStartElementL( const Xml::RTagInfo& aElement, 
       
    72                                       const Xml::RAttributeArray& aAttributes,
       
    73                                       TInt aErrorCode );
       
    74         virtual void OnEndElementL( const Xml::RTagInfo& aElement, TInt aErrorCode);
       
    75         virtual void OnContentL( const TDesC8& aBytes, TInt aErrorCode);
       
    76         virtual void OnStartPrefixMappingL( const RString& aPrefix, 
       
    77                                             const RString& aUri, TInt aErrorCode );
       
    78         virtual void OnEndPrefixMappingL( const RString& aPrefix, TInt aErrorCode);
       
    79         virtual void OnIgnorableWhiteSpaceL( const TDesC8& aBytes, TInt aErrorCode);
       
    80         virtual void OnSkippedEntityL( const RString& aName, TInt aErrorCode );
       
    81         virtual void OnProcessingInstructionL( const TDesC8& aTarget, 
       
    82                                                const TDesC8& aData, TInt aErrorCode );
       
    83         virtual void OnError( TInt aErrorCode );
       
    84         virtual TAny* GetExtendedInterface( const TInt32 aUid );
       
    85 
       
    86     private:
       
    87         /**
       
    88          * Constructor
       
    89          */
       
    90         CWmDrmDlaParser();
       
    91         /**
       
    92          * Symbian OS 2nd phase constructor.
       
    93          */
       
    94         void ConstructL();
       
    95 
       
    96     private:
       
    97         // This member is used when parsing a DRM Header and is not owned by this class 
       
    98         // and should NOT be deleted
       
    99         // If this memebers is filled when parsing a license response it WILL be deleted
       
   100         HBufC8**      iServerUrl;
       
   101 
       
   102         // These members are used when parsing a license response and are owned by this 
       
   103         // class and should NOT be deleted
       
   104         // If these memebers are filled when parsing a DRM Header they WILL be deleted
       
   105         HBufC8**      iContentUrl;
       
   106         HBufC8**      iTID;
       
   107 
       
   108         // These members are owned by this class and should be deleted
       
   109         Xml::CParser* iParser;
       
   110         HBufC8*       iBuffer;
       
   111         
       
   112         TInt          iErrorCode;
       
   113     };
       
   114 
       
   115 #endif // C_WMDRMDLAPARSER_H
       
   116 
       
   117 // End of File