wmdrm/camese/wmdrmdladefaulthttpplugin/inc/wmdrmdladefaulthttpplugin.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:  WMDRM DLA Default HTTP Plugin
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_WMDRMDLADEFAULTHTTPPLUGIN_H
       
    20 #define C_WMDRMDLADEFAULTHTTPPLUGIN_H
       
    21 
       
    22 #include <wmdrmdlahttpplugin.h>
       
    23 
       
    24 class CWmDrmDlaDefaultLicAcq;
       
    25 class CWmDrmDlaDefaultMetering;
       
    26 class CWmDrmDlaDefaultPlayReady;
       
    27 class CWmDrmDlaUiNotifier;
       
    28 class CGulIcon;
       
    29 
       
    30 /**
       
    31  * WMDRM DLA Default HTTP Plugin
       
    32  * Reference implementation that only supports MS test server
       
    33  *
       
    34  * @lib wmdrmdladefaulthttpplugin.lib
       
    35  * @since S60 v9.1
       
    36  */
       
    37 NONSHARABLE_CLASS( CWmDrmDlaDefaultHttpPlugin ) : public CWmDrmDlaHttpPluginIf
       
    38     {
       
    39 
       
    40 public:
       
    41 
       
    42     static CWmDrmDlaDefaultHttpPlugin* NewL();
       
    43     ~CWmDrmDlaDefaultHttpPlugin();
       
    44 
       
    45 public: //From CWmDrmDlaHttpPluginIf
       
    46 
       
    47     /**
       
    48      * Get service icon to be used in service selection query, if
       
    49      * more than one service is recognized to support content.
       
    50      * Will be deleted by the caller.
       
    51      *
       
    52      * @return Service icon or NULL
       
    53      */
       
    54     CGulIcon* ServiceIcon();
       
    55     
       
    56     /**
       
    57      * Check if file is supported by this plugin
       
    58      *
       
    59      * @param aFile WMDRM file
       
    60      * @param aUiNotifer If file is supported, contains initialized UI Notifier
       
    61      *                   upon completion. Will be deleted by the caller after 
       
    62      *                   the plugin has been deleted.
       
    63      * @return ETrue if file is supported by this plugin
       
    64      * @leave with standard Symbian error code in case of error
       
    65      */
       
    66      TBool SupportedFileL( const RFile& aFile, 
       
    67                            CWmDrmDlaUiNotifier*& aUiNotifier );
       
    68 
       
    69     /**
       
    70      * Check if DRM Header is supported by this plugin
       
    71      *
       
    72      * @param aHeader DRM Header
       
    73      * @param aUiNotifer If header is supported, contains initialized UI 
       
    74      *                   Notifier upon completion. Will be deleted by the
       
    75      *                   caller after the plugin has been deleted.
       
    76      * @return ETrue if header is supported by this plugin
       
    77      * @leave with standard Symbian error code in case of error
       
    78      */
       
    79     TBool SupportedDrmHeaderL( const TDesC8& aHeader, 
       
    80                                CWmDrmDlaUiNotifier*& aUiNotifier );
       
    81 
       
    82     /**
       
    83      * Check if metering certificate is supported by this plugin
       
    84      *
       
    85      * @param aCertificate Metering certificate
       
    86      * @param aUiNotifer If certificate is supported, contains initialized UI
       
    87      *                   Notifier upon completion. Will be deleted by the
       
    88      *                   caller after the plugin has been deleted.
       
    89      * @return ETrue if certificate is supported by this plugin
       
    90      * @leave with standard Symbian error code in case of error
       
    91      */
       
    92     TBool SupportedMeteringCertificateL( const TDesC8& aCertificate, 
       
    93                                          CWmDrmDlaUiNotifier*& aUiNotifier );
       
    94 
       
    95     /**
       
    96      * Check if initiator is supported by this plugin
       
    97      * This method is called only for playready content
       
    98      * 
       
    99      * @param aInitiator Initiator
       
   100      * @param aUiNotifer If initiator is supported, contains initialized UI
       
   101      *                   Notifier upon completion. Will be deleted by the
       
   102      *                   caller after the plugin has been deleted.
       
   103      * @return ETrue if initiator is supported by this plugin
       
   104      * @leave with standard Symbian error code in case of error
       
   105      */
       
   106     TBool SupportedInitiatorL( const TDesC8& aInitiator, 
       
   107                                CWmDrmDlaUiNotifier*& aUiNotifier );
       
   108 
       
   109     /**
       
   110      * Check if license acquisition should be silent for this file
       
   111      *
       
   112      * @param aFile WMDRM file
       
   113      * @return ETrue if file is supported by this plugin
       
   114      * @leave with standard Symbian error code in case of error
       
   115      */
       
   116     TBool SilentL( const RFile& aFile );
       
   117 
       
   118     /**
       
   119      * Process DRM Header. This method is used only to pass DRM Header to the
       
   120      * plugin. The framework does not require the plugin to do anything 
       
   121      *
       
   122      * @param aDrmHeader DRM Header
       
   123      * @leave with standard Symbian error code in case of fatal error (the 
       
   124      * framework does not proceed with license acquisition if this method
       
   125      * leaves)
       
   126      */
       
   127     void ProcessDrmHeaderL( const TDesC8& aDrmHeader );
       
   128 
       
   129     /**
       
   130      * Process the initiator. This method is used only to pass initiator to the
       
   131      * plugin. The framework does not require the plugin to do anything. 
       
   132      * This method is called only for playready content
       
   133      *
       
   134      * @param aInitiator Initiator
       
   135      * @leave with standard Symbian error code in case of fatal error (the 
       
   136      * framework does not proceed with license acquisition if this method
       
   137      * leaves)
       
   138      */
       
   139     void ProcessInitiatorL( const TDesC8& aInitiator );
       
   140     
       
   141     /**
       
   142     * Acquire License. 
       
   143     *
       
   144     * @param aLicenseChallenge License challenge based on which license will
       
   145     *                          be acquired.
       
   146     * @param aLicenseServerUrl URL where license challenge is sent
       
   147     * @param aStatus Request status, will contain error code upon completion 
       
   148     * including but not limited to:
       
   149     * - KErrCancel if user cancelled the license acquisition at any point
       
   150     * - KErrCommsBreak if network connection was lost during communication with
       
   151     *                  server
       
   152     * - KErrGeneral if unspecified error happened
       
   153     */
       
   154     void AcquireLicense( const TDesC8& aLicenseChallenge, 
       
   155                          HBufC* aLicenseServerUrl,
       
   156                          TRequestStatus& aStatus );
       
   157 
       
   158     /**
       
   159      * Get downloaded License. 
       
   160      *
       
   161      * @leave standard Symbian error code in case of error.
       
   162      * @return Buffer containing license data. Will be deleted by the caller.
       
   163      */
       
   164     HBufC8* GetLicenseResponseL();
       
   165 
       
   166     /**
       
   167      * Send license storage status. 
       
   168      *
       
   169      * @param aTid Transaction ID parsed from the license response, can be NULL
       
   170      * @param aUrl URL where license storage status is sent
       
   171      * @param aError License storage status.
       
   172      * @param aStatus Request status, will contain error code upon completion
       
   173      * including but not limited to:
       
   174      * - KErrCommsBreak if network connection was lost during communication
       
   175      *                  with server
       
   176      * - KErrGeneral if unspecified error happened
       
   177      */
       
   178     void SendLicenseStorageStatus( HBufC8* aTid, const TDesC& aUrl,
       
   179                                    TInt aError, TRequestStatus& aStatus );
       
   180 
       
   181     /**
       
   182      * Send error code to server if drm header parsing failed.
       
   183      *
       
   184      * @param   aErrorUrl   URL where error code is sent
       
   185      * @param   aError      Error code
       
   186      * @param aStatus Request status, will contain error code upon completion
       
   187      * including but not limited to:
       
   188      * - KErrCommsBreak if network connection was lost during communication
       
   189      *                  with server
       
   190      * - KErrGeneral if unspecified error happened
       
   191      */
       
   192     void SendDrmHeaderError( const TDesC& aErrorUrl, TInt aError, 
       
   193                              TRequestStatus& aStatus );
       
   194     
       
   195     /**
       
   196      * Get content url. Called only if framework fails to parse content URL 
       
   197      * from the license response. Needs to be implemented only if the supported
       
   198      * service uses non-standard way to pass the Content URL, otherwise this can
       
   199      * return NULL.
       
   200      *
       
   201      * @return Content URL, can be NULL. Will be deleted by the caller.
       
   202      */
       
   203     HBufC* GetContentUrlL();
       
   204 
       
   205     /**
       
   206      * Get HTML data returned by license server. 
       
   207      *
       
   208      * @return HTML data, can be NULL. Will be deleted by the caller.
       
   209      */
       
   210     HBufC* GetHtmlDataL();
       
   211 
       
   212     /*
       
   213      * Cancel license acquisition
       
   214      */
       
   215     void CancelLicenseAcquisition();
       
   216     
       
   217     /**
       
   218      * Process metering challenge. 
       
   219      *
       
   220      * @param aMeteringChallenge Metering challenge
       
   221      * @param aUrl Url to be used in metering request
       
   222      * @param aStatus Request status, will contain error code upon completion
       
   223      * including but not limited to:
       
   224      * - KErrCommsBreak if network connection was lost during communication
       
   225      *                  with server
       
   226      * - KErrGeneral if unspecified error happened
       
   227      */
       
   228     void ProcessMeteringChallenge( const TDesC8& aMeteringChallenge, 
       
   229                                    const TDesC& aUrl, 
       
   230                                    TRequestStatus& aStatus );
       
   231 
       
   232     /**
       
   233      * Get metering response. 
       
   234      *
       
   235      * @param aResponse Contains metering response upon completion. Will be
       
   236      *                  deleted by the caller.
       
   237      * @param aStatus Request status, will contain error code upon completion
       
   238      */
       
   239     void GetMeteringResponse( HBufC8*& aResponse, TRequestStatus& aStatus );
       
   240 
       
   241     /**
       
   242      * Inform plugin that metering finished. 
       
   243      *
       
   244      */
       
   245     void MeteringFinished();
       
   246 
       
   247     /*
       
   248      * Cancel metering
       
   249      */
       
   250     void CancelMetering();
       
   251     
       
   252     /*
       
   253      * Process join domain challenge.
       
   254      * This method is called only for playready content
       
   255      *
       
   256      * @param aJoinDomainChallenge Join domain challenge
       
   257      * @param aUrl Url to be used in join domain request
       
   258      * @param aStatus Request status, will contain error code upon completion
       
   259      * including but not limited to:
       
   260      * - KErrCommsBreak if network connection was lost during communication
       
   261      *                  with server
       
   262      * - KErrGeneral if unspecified error happened
       
   263      */
       
   264     void ProcessJoinDomainChallenge( 
       
   265         const TDesC8& aJoinDomainChallenge, 
       
   266         const TDesC& aUrl, 
       
   267         TRequestStatus& aStatus );
       
   268 
       
   269     /*
       
   270      * Process leave domain challenge.
       
   271      * This method is called only for playready content
       
   272      *
       
   273      * @param aLeaveDomainChallenge Leave domain challenge
       
   274      * @param aUrl Url to be used in leave domain request
       
   275      * @param aStatus Request status, will contain error code upon completion
       
   276      * including but not limited to:
       
   277      * - KErrCommsBreak if network connection was lost during communication
       
   278      *                  with server
       
   279      * - KErrGeneral if unspecified error happened
       
   280      */
       
   281     void ProcessLeaveDomainChallenge( 
       
   282         const TDesC8& aLeaveDomainChallenge, 
       
   283         const TDesC& aUrl, 
       
   284         TRequestStatus& aStatus );
       
   285 
       
   286     /**
       
   287      * Sets the IAP to be used in the HTTP transactions
       
   288      *
       
   289      * @param   aIapId  Internet Access Point id
       
   290      */
       
   291     void SetIapId( TInt aIapId );
       
   292 
       
   293     void InitializeUiNotifierL();
       
   294     CWmDrmDlaUiNotifier* UiNotifier();
       
   295     
       
   296     TBool Supported( const TDesC8& aString, const TDesC8& aIdentifier );
       
   297     
       
   298 private:
       
   299 
       
   300     CWmDrmDlaDefaultHttpPlugin();
       
   301     void ConstructL();
       
   302 
       
   303 private: // data
       
   304     
       
   305     CWmDrmDlaDefaultLicAcq* iLicenseAcquisition;
       
   306     CWmDrmDlaDefaultMetering* iMetering;
       
   307     CWmDrmDlaDefaultPlayReady* iPlayReady;
       
   308     
       
   309     //Not owned
       
   310     CWmDrmDlaUiNotifier* iUiNotifier;
       
   311 
       
   312     };
       
   313 
       
   314 #endif // C_WMDRMDLADEFAULTHTTPPLUGIN_H