# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1268649703 -7200 # Node ID 8a03a285ab14521e12ff9ee293b74a718cba243b # Parent e16d72588c2877a1696cf7f4cc4fc9a2bc36f6a8 Revision: 201009 Kit: 201010 diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmencryptor/inc/DRMEncryptorDocument.h --- a/commondrm/drmencryptor/inc/DRMEncryptorDocument.h Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmencryptor/inc/DRMEncryptorDocument.h Mon Mar 15 12:41:43 2010 +0200 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: * */ @@ -20,8 +20,8 @@ #define DRMEncryptorDOCUMENT_H // INCLUDES -#include - +#include + // CONSTANTS // FORWARD DECLARATIONS diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmencryptor/src/DRMEncryptorContainer.cpp --- a/commondrm/drmencryptor/src/DRMEncryptorContainer.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmencryptor/src/DRMEncryptorContainer.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: * */ @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmencryptor/src/DrmBb5KeyStorage.cpp --- a/commondrm/drmencryptor/src/DrmBb5KeyStorage.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmencryptor/src/DrmBb5KeyStorage.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: * */ @@ -25,7 +25,7 @@ #include #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif #include "DrmKeyStorage.h" diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmencryptor/src/DrmEncryptor.cpp --- a/commondrm/drmencryptor/src/DrmEncryptor.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmencryptor/src/DrmEncryptor.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -30,18 +30,18 @@ #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif -#include +#include #include #include #include -#include +#include #include "DRMClockClient.h" -#include -#include +#include +#include #include @@ -371,14 +371,14 @@ } fs.Close(); - + TRequestStatus status; CDcfRep* rep = CDcfRep::NewL(); CleanupStack::PushL(rep); rep->RefreshDcf(status); User::WaitForRequest( status ); CleanupStack::PopAndDestroy( rep ); - + delete files; return (aEncryptedCount*aMultiplier + aRightsCount + aMessagesProcessed); diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmencryptor/src/DrmKeyStorage.cpp --- a/commondrm/drmencryptor/src/DrmKeyStorage.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmencryptor/src/DrmKeyStorage.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: * */ @@ -25,10 +25,10 @@ #include #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif -#include +#include #include #include "DrmKeyStorage.h" diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmencryptor/src/Performance.cpp --- a/commondrm/drmencryptor/src/Performance.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmencryptor/src/Performance.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -18,19 +18,20 @@ // INCLUDE FILES #include +#include #include #include #include -#include -#include +#include +#include #include #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif -#include "base64.h" -#include "performance.h" +#include "Base64.h" +#include "Performance.h" #include "DRMEncryptor.hrh" _LIT(KLogDir, "DRM"); diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmrightsmanagerui/data/DRMRightsManager_reg.rss --- a/commondrm/drmrightsmanagerui/data/DRMRightsManager_reg.rss Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmrightsmanagerui/data/DRMRightsManager_reg.rss Mon Mar 15 12:41:43 2010 +0200 @@ -17,7 +17,7 @@ #include -#include +#include #include @@ -32,13 +32,13 @@ localisable_resource_file = APP_RESOURCE_DIR"\\DRMRightsManager"; localisable_resource_id = R_DRMUI_LOCALISABLE_APP_INFO; - + #ifdef RD_DRM_RIGHTS_MANAGER_REMOVAL hidden = KAppIsHidden; - + #endif //RD_DRM_RIGHTS_MANAGER_REMOVAL - + embeddability = KAppEmbeddableUiNotStandAlone; newfile = KAppDoesNotSupportNewFile; } diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmrightsmanagerui/inc/DRMRightsMgrAppUi.h --- a/commondrm/drmrightsmanagerui/inc/DRMRightsMgrAppUi.h Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmrightsmanagerui/inc/DRMRightsMgrAppUi.h Mon Mar 15 12:41:43 2010 +0200 @@ -21,14 +21,14 @@ #define DRMRIGHTSMGRAPPUI_H // INCLUDES -#include -#include +#include +#include #include -#include +#include -#include "drmviewitems.h" +#include "DrmViewItems.h" -#include "drmrightsmanager.hrh" +#include "DRMRightsManager.hrh" // FORWARD DECLARATIONS @@ -347,7 +347,7 @@ public: // From MCoeForegroundObserver /** - * Handles the application coming to the foreground + * Handles the application coming to the foreground * */ void HandleGainingForeground(); @@ -379,13 +379,13 @@ // The DRM protection of the given file. TInt iDrmScheme; - + // The local ID of the rights TUint32 iLocalID; - + // Content URI of the file for which the details view has been opened - HBufC8* iContentURI; - + HBufC8* iContentURI; + // The details view has been opened once. This information is used to // update the details view when returning to details view from another // application @@ -394,7 +394,7 @@ }; // Include inline functions -#include "drmrightsmgrappui.inl" +#include "DRMRightsMgrAppUi.inl" #endif diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmrightsmanagerui/inc/DRMRightsMgrDetailsContainer.h --- a/commondrm/drmrightsmanagerui/inc/DRMRightsMgrDetailsContainer.h Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmrightsmanagerui/inc/DRMRightsMgrDetailsContainer.h Mon Mar 15 12:41:43 2010 +0200 @@ -33,8 +33,6 @@ #include #include -#include "drmrightsmgrdetailscontainer.h" - // FORWARD DECLARATIONS class CDRMRightsConstraints; diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmrightsmanagerui/inc/DRMRightsMgrDetailsView.h --- a/commondrm/drmrightsmanagerui/inc/DRMRightsMgrDetailsView.h Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmrightsmanagerui/inc/DRMRightsMgrDetailsView.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,7 +22,7 @@ // INCLUDES #include -#include "drmrightsmgrdetailscontainer.h" +#include "DRMRightsMgrDetailsContainer.h" // FORWARD DECLARATIONS class CDRMRightsMgrDetailsContainer; diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmrightsmanagerui/inc/DRMRightsMgrDocument.h --- a/commondrm/drmrightsmanagerui/inc/DRMRightsMgrDocument.h Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmrightsmanagerui/inc/DRMRightsMgrDocument.h Mon Mar 15 12:41:43 2010 +0200 @@ -21,11 +21,11 @@ #define DRMRIGHTSMGRDOCUMENT_H // INCLUDES -#include +#include -#include +#include -#include "drmrightsmanager.hrh" +#include "DRMRightsManager.hrh" // FORWARD DECLARATIONS diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmrightsmanagerui/inc/DrmViewItems.h --- a/commondrm/drmrightsmanagerui/inc/DrmViewItems.h Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmrightsmanagerui/inc/DrmViewItems.h Mon Mar 15 12:41:43 2010 +0200 @@ -28,11 +28,11 @@ * Class containing data for the items to be showed in the view */ class TItemData - { + { public: // Constructor /** * C++ default constructor. - */ + */ TItemData(); /** @@ -49,14 +49,14 @@ * @param aUnlimitedRights Rights unlimited or not * @param aIndividualConstraint Individual constraint exists or not * @param aUsageAllowed Content usage allowed or not with current SIM - */ + */ TItemData( const TInt aIndexInArray, - const TDesC& aItemName, - const TDesC& aItemFullName, - const TInt aIndexIcon, + const TDesC& aItemName, + const TDesC& aItemFullName, + const TInt aIndexIcon, const TInt aTypeOfObject, const TBool aContentCanBeSent, - const TDesC8& aContentURI, + const TDesC8& aContentURI, const TTime& aFutureActivationTime, const TBool aUnlimitedRights, const TBool aIndividualConstraint, @@ -74,19 +74,19 @@ * @param aFutureActivationTime Time in the future when the RO will be * activated. * @param aUnlimitedRights Rights unlimited or not - */ + */ TItemData( const TInt aIndexInArray, - const TDesC& aItemName, - const TDesC& aItemFullName, - const TInt aIndexIcon, + const TDesC& aItemName, + const TDesC& aItemFullName, + const TInt aIndexIcon, const TInt aTypeOfObject, const TUint32 aLocalID, - const TDesC8& aContentURI, + const TDesC8& aContentURI, const TTime& aFutureActivationTime, const TBool aUnlimitedRights, const TBool aIndividualConstraint, const TBool aUsageAllowed ); - + public: // New functions @@ -204,7 +204,7 @@ * @param aUnlimitedRights ETrue if unlimited rights. */ inline void SetUnlimitedRights( const TBool aUnlimitedRights ); - + /** * Sets the individual constraint attribute. * @param aIndividualConstraint ETrue if individual constraint @@ -243,22 +243,22 @@ TBuf8 iContentURI; // Time in the future when the RO will be activated - TTime iFutureActivationTime; - + TTime iFutureActivationTime; + // ETrue if unlimited rights TBool iUnlimitedRights; - + // ETrue if individual constraint exists TBool iIndividualConstraint; - + // ETrue if content usage is allowed with current SIM TBool iUsageAllowed; - - }; + + }; // Include inline functions -#include "DRMViewItems.inl" +#include "DrmViewItems.inl" #endif diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmrightsmanagerui/src/DRMCommonUtilities.cpp --- a/commondrm/drmrightsmanagerui/src/DRMCommonUtilities.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmrightsmanagerui/src/DRMCommonUtilities.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -17,20 +17,20 @@ // INCLUDE FILES -#include -#include +#include +#include #include -#include +#include -#include +#include #include #include -#include "drmcommonutilities.h" -#include "drmrightsmgrapp.h" -#include "drmuilogger.h" -#include "drmrightsmgrappui.h" +#include "DRMCommonUtilities.h" +#include "DRMRightsMgrApp.h" +#include "DRMUILogger.h" +#include "DRMRightsMgrAppUi.h" #include "drmutilityinternaltypes.h" // CONSTANTS @@ -308,18 +308,18 @@ TUint32 drmScheme( EDrmSchemeUnknownDrm ); params = new( ELeave )CArrayFixFlat( sizeof( TPtrC ) ); CleanupStack::PushL( params ); - TChar ch; - - aLex.Mark(); + TChar ch; + + aLex.Mark(); while ( !aLex.Eos() ) // Extract the parameters { ch = aLex.Get(); if ( ch == '\x00' ) { - aLex.UnGet(); + aLex.UnGet(); params->AppendL( aLex.MarkedToken() ); - aLex.Get(); + aLex.Get(); aLex.Mark(); - } + } } TInt startParam = KMaxTInt; diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmrightsmanagerui/src/DRMRightsMgrApp.cpp --- a/commondrm/drmrightsmanagerui/src/DRMRightsMgrApp.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmrightsmanagerui/src/DRMRightsMgrApp.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,8 +19,8 @@ // INCLUDE FILES #include -#include "drmrightsmgrapp.h" -#include "drmrightsmgrdocument.h" +#include "DRMRightsMgrApp.h" +#include "DRMRightsMgrDocument.h" // ================= MEMBER FUNCTIONS ======================= diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmrightsmanagerui/src/DRMRightsMgrAppUi.cpp --- a/commondrm/drmrightsmanagerui/src/DRMRightsMgrAppUi.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmrightsmanagerui/src/DRMRightsMgrAppUi.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -17,19 +17,19 @@ // INCLUDE FILES -#include -#include -#include -#include +#include +#include +#include +#include #include // for WMDRM file details view -#include +#include -#include +#include #include -#include +#include #include -#include +#include #include // for resource reader #include #include @@ -43,16 +43,16 @@ #include #include -#include "drmrightsmgrappui.h" -#include "drmrightsmgrdetailsview.h" -#include "drmrightsmgrdocument.h" -#include "drmcommonutilities.h" -#include "drmuilogger.h" -#include "drmrightsmanagerprivatecrkeys.h" -#include "drmclockclient.h" +#include "DRMRightsMgrAppUi.h" +#include "DRMRightsMgrDetailsView.h" +#include "DRMRightsMgrDocument.h" +#include "DRMCommonUtilities.h" +#include "DRMUILogger.h" +#include "DRMRightsManagerPrivateCRKeys.h" +#include "DRMClockClient.h" #include "drmutilityinternaltypes.h" -#include "oma1dcf.h" +#include "Oma1Dcf.h" #include "oma2dcf.h" // CONSTANTS _LIT8( Kflk, "flk:" ); @@ -83,13 +83,13 @@ void CDRMRightsMgrAppUi::ConstructL() { CLOG_WRITE( "-->ConstructL" ); - + iCoeEnv->AddForegroundObserverL( *this ); - + CDRMRightsMgrDetailsView* detailsView( NULL ); - BaseConstructL( EAknEnableSkin | EAppOrientationAutomatic | - EAknEnableMSK | EAknSingleClickCompatible ); + BaseConstructL( EAknEnableSkin | EAppOrientationAutomatic | + EAknEnableMSK | EAknSingleClickCompatible ); User::LeaveIfError( iRightsClient.Connect() ); iDRMCommon = DRMCommon::NewL(); @@ -121,9 +121,9 @@ // CDRMRightsMgrAppUi::~CDRMRightsMgrAppUi() { - + iCoeEnv->RemoveForegroundObserver( *this ); - + delete iWaitDialog; delete iDRMCommon; @@ -134,12 +134,12 @@ { iDoorObserver->NotifyExit( MApaEmbeddedDocObserver::ENoChanges ); } - + if ( iContentURI ) { delete iContentURI; } - + } @@ -200,7 +200,7 @@ const TInt aDrmScheme ) { - // Store the content related information when the details view + // Store the content related information when the details view // is to be shown for the first time so that the information will be // available for details view refreshing in the future. if ( !iContentURI ) @@ -209,7 +209,7 @@ iLocalID = aLocalID; iContentURI = aContentURI.AllocL(); } - + // For storing WM DRM rights information ContentAccess::RStreamablePtrArray array; CleanupClosePushL( array ); @@ -231,7 +231,7 @@ { case EDrmSchemeOmaDrm: CheckOmaDrmRightsL( aContentURI, aLocalID, rights, status ); - if ( status < 0 ) + if ( status < 0 ) { rights = NULL; } @@ -360,20 +360,20 @@ // Do not show name if group rights or forward lock if ( !aIsGroup ) { - if ( ( iRightsClient.ForwardLockURI( buffer ) == - KErrNone ) && buffer ) + if ( ( iRightsClient.ForwardLockURI( buffer ) == + KErrNone ) && buffer ) { - + // Not forward lock - if ( aID.Compare( *buffer ) != 0 ) + if ( aID.Compare( *buffer ) != 0 ) { parse.Set( aFullName, NULL, NULL ); aItemName = parse.NameAndExt(); - } + } delete buffer; buffer = NULL; - - } + + } else { parse.Set( aFullName, NULL, NULL ); @@ -395,7 +395,7 @@ } delete buffer; } - else + else { // Do not show name if having group rights if ( !aIsGroup ) @@ -557,7 +557,7 @@ // from the background to the foreground. if ( iForegroundHasBeenActive && iContentURI ) { - StartOnlyForDetailsL( iContentURI->Des(), iLocalID, + StartOnlyForDetailsL( iContentURI->Des(), iLocalID, iStartEmbedded, iDrmScheme ); } } @@ -757,18 +757,18 @@ SetSelectedItemFullName( fullName ); TFileName itemName; - + if ( entry->GroupId().Length() > 0 ) { GetItemNameL( fullName, itemName, aContentURI, ETrue ); - } - else + } + else { GetItemNameL( fullName, itemName, aContentURI, EFalse ); } - + delete entry; - + SetSelectedItemName( itemName ); if ( GetItemDataL( fullName, aContentURI, listable, diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmrightsmanagerui/src/DRMRightsMgrDetailsContainer.cpp --- a/commondrm/drmrightsmanagerui/src/DRMRightsMgrDetailsContainer.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmrightsmanagerui/src/DRMRightsMgrDetailsContainer.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -17,15 +17,15 @@ // INCLUDE FILES -#include +#include #include -#include -#include +#include +#include -#include +#include -#include "drmrightsmgrdetailscontainer.h" -#include "drmcommonutilities.h" +#include "DRMRightsMgrDetailsContainer.h" +#include "DRMCommonUtilities.h" #include "drmutilityinternaltypes.h" // CONSTANTS diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmrightsmanagerui/src/DRMRightsMgrDetailsView.cpp --- a/commondrm/drmrightsmanagerui/src/DRMRightsMgrDetailsView.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmrightsmanagerui/src/DRMRightsMgrDetailsView.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -21,16 +21,16 @@ #include #include #include -#include -#include +#include +#include #include -#include +#include -#include "drmrightsmgrdetailsview.h" -#include "drmcommonutilities.h" -#include "drmrightsmgrappui.h" -#include "drmrightsmanager.hrh" +#include "DRMRightsMgrDetailsView.h" +#include "DRMCommonUtilities.h" +#include "DRMRightsMgrAppUi.h" +#include "DRMRightsManager.hrh" #include "drmutilitywmdrmutilities.h" #include "drmutilityinternaltypes.h" diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmrightsmanagerui/src/DRMRightsMgrDocument.cpp --- a/commondrm/drmrightsmanagerui/src/DRMRightsMgrDocument.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmrightsmanagerui/src/DRMRightsMgrDocument.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -17,14 +17,14 @@ // INCLUDE FILES -#include -#include +#include +#include -#include "drmrightsmgrdocument.h" -#include "drmrightsmgrappui.h" -#include "drmcommonutilities.h" +#include "DRMRightsMgrDocument.h" +#include "DRMRightsMgrAppUi.h" +#include "DRMCommonUtilities.h" -#include "drmuilogger.h" +#include "DRMUILogger.h" // ================= MEMBER FUNCTIONS ======================= diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmrightsmanagerui/src/DRMViewItems.cpp --- a/commondrm/drmrightsmanagerui/src/DRMViewItems.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmrightsmanagerui/src/DRMViewItems.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,7 +19,7 @@ // INCLUDE FILES #include -#include "DRMViewItems.h" +#include "DrmViewItems.h" // ================= MEMBER FUNCTIONS ======================= @@ -30,9 +30,9 @@ // TItemData::TItemData() : iIndexInArray( -1 ), - iItemName( NULL ), - iItemFullName( NULL ), - iIndexIcon( -1 ), + iItemName( NULL ), + iItemFullName( NULL ), + iIndexIcon( -1 ), iTypeOfObject( -1 ), iContentCanBeSent( EFalse ), iLocalID( 0 ), @@ -50,20 +50,20 @@ // ----------------------------------------------------------------------------- // TItemData::TItemData( const TInt aIndexInArray, - const TDesC& aItemName, - const TDesC& aItemFullName, - const TInt aIndexIcon, + const TDesC& aItemName, + const TDesC& aItemFullName, + const TInt aIndexIcon, const TInt aTypeOfObject, - const TBool aContentCanBeSent, - const TDesC8& aContentURI, - const TTime& aFutureActivationTime, + const TBool aContentCanBeSent, + const TDesC8& aContentURI, + const TTime& aFutureActivationTime, const TBool aUnlimitedRights, const TBool aIndividualConstraint, const TBool aUsageAllowed ) : iIndexInArray( aIndexInArray ), - iItemName( aItemName ), - iItemFullName( aItemFullName ), - iIndexIcon( aIndexIcon ), + iItemName( aItemName ), + iItemFullName( aItemFullName ), + iIndexIcon( aIndexIcon ), iTypeOfObject( aTypeOfObject ), iContentCanBeSent( aContentCanBeSent ), iLocalID( 0 ), @@ -81,20 +81,20 @@ // ----------------------------------------------------------------------------- // TItemData::TItemData( const TInt aIndexInArray, - const TDesC& aItemName, - const TDesC& aItemFullName, - const TInt aIndexIcon, + const TDesC& aItemName, + const TDesC& aItemFullName, + const TInt aIndexIcon, const TInt aTypeOfObject, const TUint32 aLocalID, - const TDesC8& aContentURI, - const TTime& aFutureActivationTime, + const TDesC8& aContentURI, + const TTime& aFutureActivationTime, const TBool aUnlimitedRights, const TBool aIndividualConstraint, const TBool aUsageAllowed ) : iIndexInArray( aIndexInArray ), - iItemName( aItemName ), - iItemFullName( aItemFullName ), - iIndexIcon( aIndexIcon ), + iItemName( aItemName ), + iItemFullName( aItemFullName ), + iIndexIcon( aIndexIcon ), iTypeOfObject( aTypeOfObject ), iContentCanBeSent( EFalse ), iLocalID( aLocalID ), @@ -107,4 +107,4 @@ } -// End of File +// End of File diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmsettingsplugin/data/drmsettingspluginrsc.rss --- a/commondrm/drmsettingsplugin/data/drmsettingspluginrsc.rss Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmsettingsplugin/data/drmsettingspluginrsc.rss Mon Mar 15 12:41:43 2010 +0200 @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -218,7 +218,7 @@ { items = { -#ifdef __DRM_OMA2 +#ifdef __DRM_OMA2 #ifdef RD_DRM_SILENT_RIGHTS_ACQUISITION DRM_SETTINGS_FEATURE { @@ -226,7 +226,7 @@ item = EDRMSettingsIdAutomaticActivation; }, #endif // RD_DRM_SILENT_RIGHTS_ACQUISITION - + #ifdef RD_DRM_METERING DRM_SETTINGS_FEATURE { @@ -234,7 +234,7 @@ item = EDRMSettingsIdUsageReporting; }, #endif // RD_DRM_METERING - + DRM_SETTINGS_FEATURE { txt = " \t"qtn_set_transaction_tracking"\t\t"; @@ -247,7 +247,7 @@ txt = " \t"qtn_drm_set_license_deletion"\t\t"; item = EDRMSettingsIdWMDRMLicenseDeletion; } - }; + }; } diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmsettingsplugin/inc/drmsettingsmodel.h --- a/commondrm/drmsettingsplugin/inc/drmsettingsmodel.h Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmsettingsplugin/inc/drmsettingsmodel.h Mon Mar 15 12:41:43 2010 +0200 @@ -21,7 +21,7 @@ // INCLUDES #include #include -#include "roapstorageclient.h" +#include "RoapStorageClient.h" // FORWARD DECLARATIONS class CDRMRIContext; @@ -32,7 +32,7 @@ const TInt KDRMAutomaticActivationNotAllowed = 0; const TInt KDRMAutomaticActivationAllowed = 1; - + // CLASS DEFINITIONS @@ -42,7 +42,7 @@ */ class CDRMSettingsModel : public CBase { - + public: // Constructor and destructor /** * Two-phased constructor @@ -54,8 +54,8 @@ */ ~CDRMSettingsModel(); - public: // New - + public: // New + /** * Get transaction tracking state * @return KDRMTransactionTrackingDisabled @@ -68,7 +68,7 @@ * @param aValue updated value */ void SetTransactionTrackingStateL( TInt aValue ); - + /** * Get automatic activation state * @return KDRMAutomaticActivationNotAllowed @@ -81,7 +81,7 @@ * @param aValue updated value */ void SetAutomaticActivationStateL( TInt aValue ); - + /** * Get usage reporting state * @return count of services for which reporting is allowed @@ -96,50 +96,50 @@ * @return RI alias name or RI url if no alias available */ HBufC* GetSingleRIAliasL( TInt aIndex ); - + /** - * Get the first RI alias, where metering is allowed + * Get the first RI alias, where metering is allowed * @return RI alias name or RI url if no alias available */ HBufC* GetFirstAllowedMeteringRIAliasL(); - + /** - * Get number of RI contexts + * Get number of RI contexts * @return number of RIContexts */ TInt GetRiContextCount(); - + /** * Get metering status of RI Context - * + * * @param aIndex : Index of the RI context * * @return Status of metering */ TBool IsMeteringAllowed( TInt aIndex ); - + /** * Find out if metering is allowed for all RI Contexts - * + * * @return Status of metering */ TBool IsMeteringAllowedForAll(); - + /** * Sets the value for metering to be enabled or disabled * * @param aIndex : Index of the RI context * @param aIsAllowed : ETrue if set to allowed, EFalse if not allowed - */ + */ void SetMeteringStatus( TInt aIndex, TBool aIsAllowed ); - + /** * Save the changes done to RI Contexs */ void SaveMeteringChanges(); - + private: // Private constructors - + /** * Default C++ contructor */ @@ -150,9 +150,9 @@ * @return void */ void ConstructL(); - + private: // Data - + // DRM Settings Central Repository. CRepository* iDRMSettingsRepository; @@ -161,9 +161,9 @@ // List of service providers with which device has been registered RPointerArray iRIContextList; - + }; - -#endif // DRMSETTINGSMODEL_H + +#endif // DRMSETTINGSMODEL_H // End of File diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmsettingsplugin/inc/drmsettingsplugin.h --- a/commondrm/drmsettingsplugin/inc/drmsettingsplugin.h Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmsettingsplugin/inc/drmsettingsplugin.h Mon Mar 15 12:41:43 2010 +0200 @@ -21,7 +21,7 @@ // INCLUDES #include -#include +#include #include #include #include @@ -54,7 +54,7 @@ */ class CDRMSettingsPlugin : public CGSBaseView { - + public: // Constructors and destructor /** @@ -71,7 +71,7 @@ private: /** * Symbian OS default constructor. - * + * */ void ConstructL(); @@ -81,19 +81,19 @@ CDRMSettingsPlugin(); public: // from CAknView - + /** * Returns view id. * @return An unsigned integer (view id). */ TUid Id() const; - public: // from MEikCommandObserver + public: // from MEikCommandObserver /** * Handles commands. * @param aCommand Command to be handled. - * + * */ void HandleCommandL( TInt aCommand ); @@ -102,7 +102,7 @@ /** * Updates listbox's item's value. * @param aItemId An item which is updated. - * + * */ void UpdateListBoxL( TInt aItemId ); @@ -112,7 +112,7 @@ * @see CGSPluginInterface header file. */ void GetCaptionL( TDes& aCaption ) const; - + /** * @see CGSPluginInterface header file. */ @@ -130,7 +130,7 @@ void HandleListBoxSelectionL(); private: // new - + /** * Update transaction tracking setting */ @@ -175,11 +175,11 @@ protected: // From MEikMenuObserver void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - + private: // data //resource loader RConeResourceLoader iResourceLoader; - + TBool iWmdrmSupported; }; diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmsettingsplugin/src/drmsettingsmodel.cpp --- a/commondrm/drmsettingsplugin/src/drmsettingsmodel.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmsettingsplugin/src/drmsettingsmodel.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -23,7 +23,7 @@ #include "drmsettingsmodel.h" #include "drmsettingsplugininternalcrkeys.h" -#include "drmricontext.h" +#include "DRMRIContext.h" // CONSTANTS #ifdef _DEBUG diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmsettingsplugin/src/drmsettingsplugin.cpp --- a/commondrm/drmsettingsplugin/src/drmsettingsplugin.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmsettingsplugin/src/drmsettingsplugin.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -22,8 +22,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -653,8 +653,8 @@ usageList, model, this ) ); - - isValueUpdated = + + isValueUpdated = usageCheckBox->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ); CleanupStack::PopAndDestroy( usageList ); diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmsettingsplugin/src/drmsettingsplugincontainer.cpp --- a/commondrm/drmsettingsplugin/src/drmsettingsplugincontainer.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmsettingsplugin/src/drmsettingsplugincontainer.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -18,10 +18,10 @@ // INCLUDE FILES #include -#include +#include #include #include -#include +#include #include #include "drmsettingsplugincontainer.h" @@ -34,7 +34,7 @@ // --------------------------------------------------------------------------- // CDRMSettingsPluginContainer::ConstructL() -// +// // Symbian OS two phased constructor // --------------------------------------------------------------------------- // @@ -47,19 +47,19 @@ // --------------------------------------------------------------------------- // CDRMSettingsPluginContainer::CDRMSettingsPluginContainer() -// -// Constructor +// +// Constructor // --------------------------------------------------------------------------- // -CDRMSettingsPluginContainer::CDRMSettingsPluginContainer( +CDRMSettingsPluginContainer::CDRMSettingsPluginContainer( TBool aWmdrmSupported ) : iWmdrmSupported( aWmdrmSupported ) { } // --------------------------------------------------------------------------- // CDRMSettingsPluginContainer::~CDRMSettingsPluginContainer() -// -// Destructor +// +// Destructor // --------------------------------------------------------------------------- // CDRMSettingsPluginContainer::~CDRMSettingsPluginContainer() @@ -78,16 +78,16 @@ // --------------------------------------------------------------------------- // CDRMSettingsPluginContainer::ConstructListBoxL() -// +// // Construct the listbox from resource array. // --------------------------------------------------------------------------- // void CDRMSettingsPluginContainer::ConstructListBoxL( TInt aResLbxId ) { - iListBox->ConstructL( this, EAknListBoxSelectionList /* | + iListBox->ConstructL( this, EAknListBoxSelectionList /* | EAknListBoxItemSpecificMenuDisabled */ ); - iListboxItemArray = CGSListBoxItemTextArray::NewL( aResLbxId, - *iListBox, + iListboxItemArray = CGSListBoxItemTextArray::NewL( aResLbxId, + *iListBox, *iCoeEnv ); iListBox->Model()->SetItemTextArray( iListboxItemArray ); iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); @@ -97,7 +97,7 @@ // --------------------------------------------------------------------------- // CDRMSettingsPluginContainer::CreateListBoxItemsL() -// +// // Create listbox items. // --------------------------------------------------------------------------- // @@ -105,7 +105,7 @@ { #ifdef __DRM_OMA2 MakeTransactionTrackingItemL(); - + #ifdef RD_DRM_SILENT_RIGHTS_ACQUISITION MakeAutomaticActivationItemL(); #endif // RD_DRM_SILENT_RIGHTS_ACQUISITION @@ -122,7 +122,7 @@ // --------------------------------------------------------------------------- // CDRMSettingsPluginContainer::UpdateListBoxL() -// +// // Update listbox item. // --------------------------------------------------------------------------- // @@ -134,26 +134,26 @@ case EDRMSettingsIdTransactionTracking: MakeTransactionTrackingItemL(); break; - + #ifdef RD_DRM_SILENT_RIGHTS_ACQUISITION case EDRMSettingsIdAutomaticActivation: MakeAutomaticActivationItemL(); break; #endif // RD_DRM_SILENT_RIGHTS_ACQUISITION - + #ifdef RD_DRM_METERING case EDRMSettingsIdUsageReporting: MakeUsageReportingItemL(); break; -#endif // RD_DRM_METERING +#endif // RD_DRM_METERING #endif // __DRM_OMA2 - + case EDRMSettingsIdWMDRMLicenseDeletion: - + MakeWMDRMLicenseDeletionItemL(); - + break; - + default: break; } @@ -164,15 +164,15 @@ // --------------------------------------------------------------------------- // CDRMSettingsPluginContainer::MakeTransactionTrackingItemL() -// -// Create Transaction tracking list item +// +// Create Transaction tracking list item // --------------------------------------------------------------------------- // void CDRMSettingsPluginContainer::MakeTransactionTrackingItemL() { HBufC* dynamicText( NULL ); TInt trxTrState( iModel->TransactionTrackingStateL() ); - + switch ( trxTrState ) { case KDRMTransactionTrackingEnabled: @@ -182,33 +182,33 @@ dynamicText = StringLoader::LoadLC( R_DRM_SETTINGS_TTRACKING_OFF ); break; } - + TPtr ptrBuffer ( dynamicText->Des() ); - + // Finally, set the dynamic text iListboxItemArray->SetDynamicTextL( EDRMSettingsIdTransactionTracking, ptrBuffer ); CleanupStack::PopAndDestroy( dynamicText ); // And add to listbox - iListboxItemArray->SetItemVisibilityL( EDRMSettingsIdTransactionTracking, + iListboxItemArray->SetItemVisibilityL( EDRMSettingsIdTransactionTracking, CGSListBoxItemTextArray::EVisible ); } // --------------------------------------------------------------------------- // CDRMSettingsPluginContainer::MakeAutomaticActivationItemL() -// -// Create Automatic activation list item +// +// Create Automatic activation list item // --------------------------------------------------------------------------- // void CDRMSettingsPluginContainer::MakeAutomaticActivationItemL() { TInt automActivState( iModel->AutomaticActivationStateL() ); - + HBufC* dynamicText( NULL ); - + switch ( automActivState ) { case KDRMTransactionTrackingEnabled: @@ -218,32 +218,32 @@ dynamicText = StringLoader::LoadLC( R_DRM_SETTINGS_AUTOM_ACTIV_OFF ); break; } - + TPtr ptrBuffer ( dynamicText->Des() ); // Finally, set the dynamic text - iListboxItemArray->SetDynamicTextL( EDRMSettingsIdAutomaticActivation, + iListboxItemArray->SetDynamicTextL( EDRMSettingsIdAutomaticActivation, ptrBuffer ); CleanupStack::PopAndDestroy( dynamicText ); // And add to listbox - iListboxItemArray->SetItemVisibilityL( EDRMSettingsIdAutomaticActivation, + iListboxItemArray->SetItemVisibilityL( EDRMSettingsIdAutomaticActivation, CGSListBoxItemTextArray::EVisible ); } // --------------------------------------------------------------------------- // CDRMSettingsPluginContainer::MakeUsageReportingItemL() -// -// Create Usage reporting list item +// +// Create Usage reporting list item // --------------------------------------------------------------------------- // void CDRMSettingsPluginContainer::MakeUsageReportingItemL() { TInt count( iModel->UsageReportingCount() ); - + HBufC* dynamicText( NULL ); - + switch ( count ) { case 0: @@ -257,24 +257,24 @@ break; } CleanupStack::PushL( dynamicText ); - + TPtr ptrBuffer ( dynamicText->Des() ); // Finally, set the dynamic text - iListboxItemArray->SetDynamicTextL( EDRMSettingsIdUsageReporting, + iListboxItemArray->SetDynamicTextL( EDRMSettingsIdUsageReporting, ptrBuffer ); CleanupStack::PopAndDestroy( dynamicText ); // And add to listbox - iListboxItemArray->SetItemVisibilityL( EDRMSettingsIdUsageReporting, + iListboxItemArray->SetItemVisibilityL( EDRMSettingsIdUsageReporting, CGSListBoxItemTextArray::EVisible ); } // --------------------------------------------------------------------------- // CDRMSettingsPluginContainer::MakeWMDRMLicenseDeletionItemL() -// -// Create WMDRM license deletion list item +// +// Create WMDRM license deletion list item // --------------------------------------------------------------------------- // void CDRMSettingsPluginContainer::MakeWMDRMLicenseDeletionItemL() @@ -283,26 +283,26 @@ { // Add to listbox iListboxItemArray-> - SetItemVisibilityL( EDRMSettingsIdWMDRMLicenseDeletion, + SetItemVisibilityL( EDRMSettingsIdWMDRMLicenseDeletion, CGSListBoxItemTextArray::EVisible ); } else { // Add to listbox iListboxItemArray-> - SetItemVisibilityL( EDRMSettingsIdWMDRMLicenseDeletion, + SetItemVisibilityL( EDRMSettingsIdWMDRMLicenseDeletion, CGSListBoxItemTextArray::EInvisible ); - + } } // --------------------------------------------------------------------------- // CDRMSettingsPluginContainer::GetHelpContext() const -// -// Gets Help +// +// Gets Help // --------------------------------------------------------------------------- // -void CDRMSettingsPluginContainer::GetHelpContext( +void CDRMSettingsPluginContainer::GetHelpContext( TCoeHelpContext& aContext ) const { aContext.iMajor = KUidRightsManager; @@ -313,7 +313,7 @@ // --------------------------------------------------------------------------- // CDRMSettingsPluginContainer::CurrentFeatureId() // -// Return the feature id of selected listitem +// Return the feature id of selected listitem // --------------------------------------------------------------------------- // TInt CDRMSettingsPluginContainer::CurrentFeatureId( ) const @@ -332,5 +332,5 @@ { return iModel; } - + // End of File diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmsettingsplugin/src/drmsettingsusagecheckbox.cpp --- a/commondrm/drmsettingsplugin/src/drmsettingsusagecheckbox.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmsettingsplugin/src/drmsettingsusagecheckbox.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -17,9 +17,9 @@ // INCLUDE FILES -#include -#include -#include +#include +#include +#include #include #include "drmsettingsusagecheckbox.h" @@ -34,7 +34,7 @@ // Default constructor. // ----------------------------------------------------------------------------- // -CDrmSettingUsageCheckBox::CDrmSettingUsageCheckBox( +CDrmSettingUsageCheckBox::CDrmSettingUsageCheckBox( TInt aResourceId, CDRMSettingUsageList* aList, CDRMSettingsModel* aModel, @@ -43,7 +43,7 @@ iModel( aModel ), iDrmSettingsPlugin( aPlugin ) { - } + } // ---------------------------------------------------------------------------- // CDrmSettingUsageCheckBox::~CDrmSettingUsageCheckBox @@ -60,7 +60,7 @@ // CDrmSettingUsageCheckBox::OfferKeyEventL // ----------------------------------------------------------------------------- // -TKeyResponse CDrmSettingUsageCheckBox::OfferKeyEventL( +TKeyResponse CDrmSettingUsageCheckBox::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) { @@ -69,17 +69,17 @@ { response = this->ListBoxControl()->OfferKeyEventL( aKeyEvent, aType ); } - + if ( aType == EEventKeyUp ) { ShowInfoPopupL(); } - + if ( ( aType == EEventKey ) && ( aKeyEvent.iCode == EKeyEscape ) ) { iDrmSettingsPlugin->HandleCommandL( EEikCmdExit ); } - + return response; } @@ -91,9 +91,9 @@ { HBufC* emptyText( StringLoader::LoadLC( R_USAGE_REPORTING_LIST_EMPTY, iEikonEnv ) ); - this->ListBoxControl()->View()->SetListEmptyTextL( *emptyText ); - CleanupStack::PopAndDestroy( emptyText ); - } + this->ListBoxControl()->View()->SetListEmptyTextL( *emptyText ); + CleanupStack::PopAndDestroy( emptyText ); + } // ----------------------------------------------------------------------------- // CDrmSettingUsageCheckBox::OkToExitL @@ -102,29 +102,29 @@ TBool CDrmSettingUsageCheckBox::OkToExitL( TBool aAccept ) { TBool exit( ETrue ); - + if ( aAccept ) { iList->UpdateContexts(); - + if ( !iModel->IsMeteringAllowedForAll() ) { HBufC* query( StringLoader::LoadLC( R_DRM_CONF_QUERY_METERING, iEikonEnv ) ); - + CAknQueryDialog* queryDialog( CAknQueryDialog::NewL() ); - + TBool retVal( queryDialog->ExecuteLD( R_DRM_CONFIRMATION_QUERY_METERING, *query ) ); CleanupStack::PopAndDestroy( query ); - + if ( !retVal ) { exit = EFalse; } } } - + return exit; } @@ -151,7 +151,7 @@ if ( index != -1 ) { iPopupController->SetTextL( iList->At(index)->ItemText() ); - iPopupController->ShowInfoPopupNote(); + iPopupController->ShowInfoPopupNote(); } } diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/inc/DrmAutomatedUsageImpl.h --- a/commondrm/drmutility/inc/DrmAutomatedUsageImpl.h Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/inc/DrmAutomatedUsageImpl.h Mon Mar 15 12:41:43 2010 +0200 @@ -23,12 +23,12 @@ #include #include #include -#include +#include #include #include #include "rdrmhelperclient.h" -#include "drmqueue.h" +#include "DrmQueue.h" //forward declarations class CDRMConstraint; @@ -607,7 +607,7 @@ * From CActive Called if RunL leaves */ TInt RunError( TInt aError ); - + private: // Member functions @@ -615,7 +615,7 @@ CDrmUtility* aDrmUtility ); void ConstructL(); - + void Activate( TRequestStatus*& aStatus ); // Checks whether there exists suitable oma RO for automated use @@ -661,10 +661,10 @@ // own CDrmUtilityUI* iDrmUtilityUi; - // Async observer and current operation id for async operations - // not own + // Async observer and current operation id for async operations + // not own MDrmAsyncObserver* iObserver; - // not own + // not own TInt iOperationId; }; } diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/inc/DrmQueue.h --- a/commondrm/drmutility/inc/DrmQueue.h Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/inc/DrmQueue.h Mon Mar 15 12:41:43 2010 +0200 @@ -83,11 +83,11 @@ C* PopFront(); /** - * Checks + * Checks * implementation * @param[in] aId : ID representing data to be popped from queue - * @return Pointer to data object in queue, NULL if not found - * + * @return Pointer to data object in queue, NULL if not found + * */ C* PopItem( TInt aId ); @@ -119,6 +119,6 @@ } // Since it's a template class include the implementation -#include "drmqueue.inl" +#include "DrmQueue.inl" #endif // CDRMAUTOMATEDUSAGE_H diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/inc/DrmRightsInfoImpl.h --- a/commondrm/drmutility/inc/DrmRightsInfoImpl.h Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/inc/DrmRightsInfoImpl.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,17 +22,17 @@ //*** system include files go here: #include #include -#include -#include +#include +#include #include -namespace DRM +namespace DRM { //*** Forward declarations class CDrmRightsInfoData; class MDrmAsyncObserver; class CDrmUtilityCommon; - + /** * Utility class for DRM related rights information handling * @@ -43,7 +43,7 @@ { public: - + IMPORT_C static CDrmRightsInfoImpl* NewL(); IMPORT_C static CDrmRightsInfoImpl* NewLC(); @@ -56,12 +56,12 @@ * * @param[in] aUniqueId : The unique identifier or the content * @param[in] aIntent : The intent for the rights to check - * @param[out] aDetails : Details of the rights status + * @param[out] aDetails : Details of the rights status * @return none * @leave System wide error code - */ - IMPORT_C void CheckRightsL( - const TDesC& aUniqueId, + */ + IMPORT_C void CheckRightsL( + const TDesC& aUniqueId, ContentAccess::TIntent aIntent, TDrmRightsInfo& aDetails ); @@ -70,16 +70,16 @@ * * @param[in] aUniqueId The unique identifier or the content * @param[in] aIntent The intent for the rights to check - * @param[out] aDetails Details of the rights status + * @param[out] aDetails Details of the rights status * @param[in] aObserver Observer which gets reported of * the async operation * * @return Operation identifier * * @leave System wide error code - */ - IMPORT_C TInt CheckRightsAsyncL( - const TDesC& aUniqueId, + */ + IMPORT_C TInt CheckRightsAsyncL( + const TDesC& aUniqueId, ContentAccess::TIntent aIntent, TDrmRightsInfo& aDetails, MDrmAsyncObserver& aObserver ); @@ -90,18 +90,18 @@ * * @since S60 v5.0 * @param[in] aOperationId identifier of the async operation - * to be cancelled + * to be cancelled * @return KErrNotFound if the operation has already been executed * or it does not exist */ - IMPORT_C TInt CancelOperation( TInt aOperationId ); - + IMPORT_C TInt CancelOperation( TInt aOperationId ); + public: // From base classes protected: // Functions from base classes - + /** * From CActive Cancels async request. */ @@ -115,7 +115,7 @@ /** * From CActive Called when RunL leaves */ - TInt RunError( TInt aError ); + TInt RunError( TInt aError ); private: @@ -126,7 +126,7 @@ void PerformCheckRightsL( CDrmRightsInfoData& aData ); void AppendToQueue( CDrmRightsInfoData* aData ); - + CDrmRightsInfoData* PopFront(); @@ -134,25 +134,25 @@ // DrmUtilityCommon CDrmUtilityCommon* iDrmUtilityCommon; - + // Oma Drm client RDRMRightsClient iOmaClient; - + // WM Drm Client // RWMDrmClient iWmClient; - + // current request status: MDrmAsyncObserver* iObserver; TInt iOperationId; - + // Operation Queue: CDrmRightsInfoData* iFirst; CDrmRightsInfoData* iLast; - + // To prevent queue handling from being messed up by threads RSemaphore iSemaphore; }; - + } #endif // CDRMRIGHTSINFOIMPL_H diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/inc/DrmUiHandlingImpl.h --- a/commondrm/drmutility/inc/DrmUiHandlingImpl.h Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/inc/DrmUiHandlingImpl.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,11 +22,11 @@ //*** system include files go here: #include #include -#include +#include #include #include #include -#include +#include #include //*** forward declarations go here: @@ -518,12 +518,12 @@ /** * From CActive Called when async request completes. */ - void RunL(); + void RunL(); /** * From CActive Called when RunL leaves */ - TInt RunError( TInt aError ); + TInt RunError( TInt aError ); private: @@ -768,7 +768,7 @@ TBool LaunchBrowserL( const HBufC* aUrl ); /** - * Get rights silently, if notes are not intended to be shown, put aShowNotes to EFalse + * Get rights silently, if notes are not intended to be shown, put aShowNotes to EFalse */ TInt GetSilentRightsL( const TDesC8& aUrl, const TBool aShowNotes ); @@ -791,7 +791,7 @@ * Handles exit from service * from MAknServerAppExitObserver */ - void HandleServerAppExit(TInt aReason); + void HandleServerAppExit(TInt aReason); /** * Appends new async request data to async operation queue. @@ -813,7 +813,7 @@ /** * Gets SilentRights and - * checks status after + * checks status after * CallSilentAvailble after right * @return Etrue, if silent RO rerieval led to usable content */ diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/inc/DrmUtilityDmgrWrapper.h --- a/commondrm/drmutility/inc/DrmUtilityDmgrWrapper.h Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/inc/DrmUtilityDmgrWrapper.h Mon Mar 15 12:41:43 2010 +0200 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: * */ @@ -19,8 +19,8 @@ #ifndef CDRMUTILITYDMGRWRAPPER_H #define CDRMUTILITYDMGRWRAPPER_H -#include -#include +#include +#include #include /** @@ -50,8 +50,8 @@ * @lib DrmUtilityDmgrWrapper * @since S60 v5.0 */ -class CDrmUtilityDmgrWrapper : CBase, - public MHttpDownloadMgrObserver, +class CDrmUtilityDmgrWrapper : CBase, + public MHttpDownloadMgrObserver, public MDrmUtilityDmgrWrapper, public MProgressDialogCallback { @@ -71,7 +71,7 @@ */ void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ); - void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl, + void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl, CCoeEnv& aCoeEnv ); HBufC8* GetErrorUrlL(); diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/inc/DrmUtilityInfoNoteWrapper.h --- a/commondrm/drmutility/inc/DrmUtilityInfoNoteWrapper.h Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/inc/DrmUtilityInfoNoteWrapper.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,9 +22,9 @@ // INCLUDES #include -#include +#include -namespace DRM +namespace DRM { /** @@ -33,14 +33,14 @@ NONSHARABLE_CLASS ( CDrmUtilityInfoNoteWrapper ) : public CActive { public: // Constructors and destructor - + /** * Two-phased constructor. */ static CDrmUtilityInfoNoteWrapper* NewL(); - + static CDrmUtilityInfoNoteWrapper* NewLC(); - + /** * Destructor. */ @@ -52,31 +52,31 @@ /** * Synchronous wrapper for showing global note. * @param aType type of Info note to be displayed - * @param aNoteText string containing note text + * @param aNoteText string containing note text * @param aResource resource identifier - * @param aString is transferred for CoverUi string data + * @param aString is transferred for CoverUi string data * @param aValue is transferred for CoverUi numerical data * @return button code */ - void ShowNoteL( TAknGlobalNoteType aType, + void ShowNoteL( TAknGlobalNoteType aType, const TDesC& aNoteText, - TInt aResourceId = -1, + TInt aResourceId = -1, const TDesC& aString = KNullDesC, TInt aValue = -1 ); /** * Synchronous wrapper for showing global note. * @param[inout] aResourceId takes primary display - * resource ID and returns CoverUiId + * resource ID and returns CoverUiId * @return boolean if ID was valid CoverUiId */ static TBool EvaluateCoverResourceId( TInt& aResourceId ); - + private: // From CActive - - void DoCancel(); - void RunL(); - + + void DoCancel(); + void RunL(); + private: /** @@ -87,16 +87,16 @@ /** * By default Symbian 2nd phase constructor is private. */ - void ConstructL(); - + void ConstructL(); + private: // Data - - CAknGlobalNote* iNote; + + CAknGlobalNote* iNote; }; } -#endif // __DRMUTILITYINFONOTEWRAPPER_H__ - +#endif // __DRMUTILITYINFONOTEWRAPPER_H__ + // End of File diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/inc/drmutilitycommon.h --- a/commondrm/drmutility/inc/drmutilitycommon.h Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/inc/drmutilitycommon.h Mon Mar 15 12:41:43 2010 +0200 @@ -21,16 +21,16 @@ //*** system include files go here: #include -#include -#include +#include +#include #include //*** forward declarations go here: class CDRMConstraint; -namespace DRM +namespace DRM { - + /** * Utility class for DRM related common functions * @@ -47,7 +47,7 @@ * * @return A functional CDrmUtilityCommon -object * @leave System wide error code - */ + */ IMPORT_C static CDrmUtilityCommon* NewL(); /** @@ -56,14 +56,14 @@ * * @return A functional CDrmUtilityCommon -object * @leave System wide error code - */ + */ IMPORT_C static CDrmUtilityCommon* NewLC(); /** * Destructor */ virtual ~CDrmUtilityCommon(); - + /** * Checks the rights and their status for a specific unique id * implementation @@ -72,16 +72,16 @@ * @param[in] aIntent The intent for the rights to check * @param[out] aConstraint A Constraint of the future rights, * must be initialized - * + * * @return Rights status * @leave System wide error code * @see ContentAccess:TIntent - */ - IMPORT_C TDrmRightsInfo GetOmaRightsStatusL( - HBufC8*& aContentUri, + */ + IMPORT_C TDrmRightsInfo GetOmaRightsStatusL( + HBufC8*& aContentUri, ContentAccess::TIntent aIntent, CDRMConstraint* aConstraint ); - + protected: @@ -90,9 +90,9 @@ CDrmUtilityCommon(); void ConstructL(); - + private: // Data members - + // Oma Drm client RDRMRightsClient iOmaClient; diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/inc/drmutilityui.h --- a/commondrm/drmutility/inc/drmutilityui.h Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/inc/drmutilityui.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,7 +22,7 @@ //*** system include files go here: #include #include -#include +#include //*** forward declarations go here: class CDRMConstraint; @@ -37,12 +37,12 @@ class CData; } -namespace DRM +namespace DRM { - + //*** forward declarations go here: class CDrmUtilityInfoNoteWrapper; - + /** * Utility class for DRM utility related graphic functions * @@ -59,7 +59,7 @@ * * @return A functional CDrmUtilityUI -object * @leave System wide error code - */ + */ IMPORT_C static CDrmUtilityUI* NewL( CCoeEnv* aCoeEnv = NULL ); /** @@ -68,36 +68,36 @@ * * @return A functional CDrmUtilityUI -object * @leave System wide error code - */ + */ IMPORT_C static CDrmUtilityUI* NewLC( CCoeEnv* aCoeEnv = NULL ); /** * Destructor */ virtual ~CDrmUtilityUI(); - + /** * Display query dialog */ - IMPORT_C TInt DisplayQueryWithIdL( TInt aTextResourceId, + IMPORT_C TInt DisplayQueryWithIdL( TInt aTextResourceId, TInt aQueryResourceId ); - - IMPORT_C TInt DisplayQueryWithIdValueL( TInt aTextResourceId, - TInt aQueryResourceId, + + IMPORT_C TInt DisplayQueryWithIdValueL( TInt aTextResourceId, + TInt aQueryResourceId, const TDesC& aString ); - + IMPORT_C TInt DisplayQueryL( TInt aTextResourceId, TInt aValue ); - + IMPORT_C TInt DisplayQueryL( TInt aTextResourceId, const TDesC& aString ); - - IMPORT_C TInt DisplayQueryL( TInt aTextResourceId, - const TDesC& aString, + + IMPORT_C TInt DisplayQueryL( TInt aTextResourceId, + const TDesC& aString, TInt aValue, - TInt aStringPos = -1, - TInt aValuePos = -1 ); - + TInt aStringPos = -1, + TInt aValuePos = -1 ); + IMPORT_C TInt DisplayQueryL( TDesC& aPromptText, TInt aQueryResourceId ); - + IMPORT_C TInt SetAutomatedQueryL( CDRMConstraint* aConstraint ); /** @@ -106,22 +106,22 @@ IMPORT_C void ShowFutureRightsNoteL( CDRMConstraint* aConstraint ); IMPORT_C void DisplayNoteL( TInt aTextResourceId ); - + IMPORT_C void DisplayNoteL( TInt aTextResourceId, const TDesC& aString ); - + IMPORT_C void DisplayNoteL( TInt aTextResourceId, TInt aValue ); - - IMPORT_C void DisplayNoteL( TDesC& aPromptText, - TInt aResourceId, - const TDesC& aString = KNullDesC, - TInt aValue = -1 ); - + + IMPORT_C void DisplayNoteL( TDesC& aPromptText, + TInt aResourceId, + const TDesC& aString = KNullDesC, + TInt aValue = -1 ); + /** * Display list query */ - IMPORT_C TInt DisplayPopupWindowsForPreviewL( + IMPORT_C TInt DisplayPopupWindowsForPreviewL( ContentAccess::CData& aContent, - TInt aPreviewType, + TInt aPreviewType, TInt aMediaType ); @@ -132,21 +132,21 @@ CDrmUtilityUI( CCoeEnv* aCoeEnv ); void ConstructL(); - + CAknResourceNoteDialog* CreateNoteForResourceL( TInt aResId ); - + TAknGlobalNoteType GlobalNoteTypeForResource( TInt aResId ); - + TInt GetOmaStartTime( CDRMConstraint* aConstraint, TTime& aStartTime ); - + TInt EvaluatePreviewMediaTypeL( ContentAccess::CData& aContent, TInt aPreviewType ); - - void PrepareSecondaryDisplayL( CEikDialog& aDialog, + + void PrepareSecondaryDisplayL( CEikDialog& aDialog, TInt aResourceId, - const TDesC& aString = KNullDesC, + const TDesC& aString = KNullDesC, TInt aValue = -1 ); - + void CancelSecondaryDisplayL( TInt aResourceId ); @@ -154,7 +154,7 @@ // Control environment, not owned CCoeEnv* iCoeEnv; - + // Paths of the resource files HBufC* iUtilityResourceFile; HBufC* iAvkonResourceFile; @@ -166,10 +166,10 @@ // Used to read resources when CoeEnv is not available CStringResourceReader* iUtilityStringResourceReader; CStringResourceReader* iAvkonStringResourceReader; - + // File server RFs iFs; - + // Used to queue up global notes RPointerArray iNoteList; diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/inc/drmutilitywmdrmwrapper.h --- a/commondrm/drmutility/inc/drmutilitywmdrmwrapper.h Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/inc/drmutilitywmdrmwrapper.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,8 +22,9 @@ //*** system include files go here: #include #include -#include +#include #include +#include #include //*** user include files go here: diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/src/DrmAutomatedUsage.cpp --- a/commondrm/drmutility/src/DrmAutomatedUsage.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/src/DrmAutomatedUsage.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -22,7 +22,7 @@ #include #include -#include "drmautomatedusageimpl.h" +#include "DrmAutomatedUsageImpl.h" #include "drmautomatedusageerrorhandling.h" // ============================ MEMBER FUNCTIONS =============================== @@ -164,9 +164,9 @@ const DRM::TDrmAutomatedServiceType aServiceType ) { iUtility->CheckFileHandleL( aFile ); - iImplementation->SetAutomatedL( aFile, - aIntent, - aAutomatedType, + iImplementation->SetAutomatedL( aFile, + aIntent, + aAutomatedType, aServiceType ); } @@ -184,10 +184,10 @@ const DRM::TDrmAutomatedServiceType aServiceType ) { iUtility->CheckFileHandleL( aFile ); - return iImplementation->SetAutomatedAsyncL( aFile, - aIntent, - aAutomatedType, - aObserver, + return iImplementation->SetAutomatedAsyncL( aFile, + aIntent, + aAutomatedType, + aObserver, aServiceType ); } @@ -203,8 +203,8 @@ const DRM::TDrmAutomatedType aAutomatedType, const DRM::TDrmAutomatedServiceType aServiceType ) { - iImplementation->SetAutomatedL( aData, - aIntent, + iImplementation->SetAutomatedL( aData, + aIntent, aAutomatedType, aServiceType ); } @@ -222,10 +222,10 @@ DRM::MDrmAsyncObserver& aObserver, const DRM::TDrmAutomatedServiceType aServiceType ) { - return iImplementation->SetAutomatedAsyncL( aData, - aIntent, - aAutomatedType, - aObserver, + return iImplementation->SetAutomatedAsyncL( aData, + aIntent, + aAutomatedType, + aObserver, aServiceType ); } @@ -242,9 +242,9 @@ const DRM::TDrmAutomatedServiceType aServiceType ) { iUtility->CheckFileHandleL( aFile ); - iImplementation->RemoveAutomatedL( aFile, - aIntent, - aAutomatedType, + iImplementation->RemoveAutomatedL( aFile, + aIntent, + aAutomatedType, aServiceType ); } @@ -262,10 +262,10 @@ const DRM::TDrmAutomatedServiceType aServiceType ) { iUtility->CheckFileHandleL( aFile ); - return iImplementation->RemoveAutomatedAsyncL( aFile, - aIntent, - aAutomatedType, - aObserver, + return iImplementation->RemoveAutomatedAsyncL( aFile, + aIntent, + aAutomatedType, + aObserver, aServiceType ); } @@ -281,9 +281,9 @@ const DRM::TDrmAutomatedType aAutomatedType, const DRM::TDrmAutomatedServiceType aServiceType ) { - iImplementation->RemoveAutomatedL( aData, - aIntent, - aAutomatedType, + iImplementation->RemoveAutomatedL( aData, + aIntent, + aAutomatedType, aServiceType ); } @@ -300,10 +300,10 @@ DRM::MDrmAsyncObserver& aObserver, const DRM::TDrmAutomatedServiceType aServiceType ) { - return iImplementation->RemoveAutomatedAsyncL( aData, - aIntent, - aAutomatedType, - aObserver, + return iImplementation->RemoveAutomatedAsyncL( aData, + aIntent, + aAutomatedType, + aObserver, aServiceType ); } @@ -319,9 +319,9 @@ const DRM::TDrmAutomatedType aAutomatedType, const DRM::TDrmAutomatedServiceType aServiceType ) { - iImplementation->RemoveAutomatedL( aUniqueId, - aIntent, - aAutomatedType, + iImplementation->RemoveAutomatedL( aUniqueId, + aIntent, + aAutomatedType, aServiceType ); } @@ -338,10 +338,10 @@ DRM::MDrmAsyncObserver& aObserver, const DRM::TDrmAutomatedServiceType aServiceType ) { - return iImplementation->RemoveAutomatedAsyncL( aUniqueId, - aIntent, - aAutomatedType, - aObserver, + return iImplementation->RemoveAutomatedAsyncL( aUniqueId, + aIntent, + aAutomatedType, + aObserver, aServiceType ); } diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/src/DrmAutomatedUsageImpl.cpp --- a/commondrm/drmutility/src/DrmAutomatedUsageImpl.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/src/DrmAutomatedUsageImpl.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,14 +19,14 @@ // INCLUDE FILES #include #include -#include +#include #include -#include +#include #include #include #include -#include "drmautomatedusageimpl.h" +#include "DrmAutomatedUsageImpl.h" #include "drmautomatedusagedata.h" #include "drmutilityui.h" @@ -68,16 +68,16 @@ const CDRMConstraint *aSecond ) { TBool equal( EFalse ); - TInt64 startDifference( + TInt64 startDifference( aFirst->iIntervalStart.Int64() - aSecond->iIntervalStart.Int64() ); - if( aFirst->iInterval == aSecond->iInterval && - -KTimeMarginal <= startDifference && + if( aFirst->iInterval == aSecond->iInterval && + -KTimeMarginal <= startDifference && startDifference <= KTimeMarginal ) { equal = ETrue; } - return equal; + return equal; } @@ -105,7 +105,7 @@ // constraint has counters, timed counters or accumulated if ( aConstraint->iActiveConstraints & ( EConstraintCounter | EConstraintTimedCounter | - EConstraintAccumulated ) ) + EConstraintAccumulated ) ) { return ETrue; } @@ -128,7 +128,7 @@ iCoeEnv( aCoeEnv ), iDrmUtility( aDrmUtility ) { - + } // ----------------------------------------------------------------------------- @@ -155,11 +155,11 @@ // ----------------------------------------------------------------------------- // EXPORT_C DRM::CDrmAutomatedUsageImpl* DRM::CDrmAutomatedUsageImpl::NewL( - CCoeEnv* aCoeEnv, + CCoeEnv* aCoeEnv, DRM::CDrmUtility* aDrmUtility ) { - DRM::CDrmAutomatedUsageImpl* self( - DRM::CDrmAutomatedUsageImpl::NewLC( aCoeEnv, + DRM::CDrmAutomatedUsageImpl* self( + DRM::CDrmAutomatedUsageImpl::NewLC( aCoeEnv, aDrmUtility ) ); CleanupStack::Pop( self ); return self; @@ -175,7 +175,7 @@ CCoeEnv* aCoeEnv, DRM::CDrmUtility* aDrmUtility ) { DRM::CDrmAutomatedUsageImpl* self( - new( ELeave ) DRM::CDrmAutomatedUsageImpl( aCoeEnv, + new( ELeave ) DRM::CDrmAutomatedUsageImpl( aCoeEnv, aDrmUtility ) ); CleanupStack::PushL( self ); self->ConstructL(); @@ -187,7 +187,7 @@ DRM::CDrmAutomatedUsageImpl::~CDrmAutomatedUsageImpl() { DRM::CDrmAutomatedUsageData* data( iDrmQueue->PopFront() ); - + // Empty the queue: while ( data ) { @@ -196,17 +196,17 @@ delete data; data = iDrmQueue->PopFront(); } - + delete iDrmQueue; - + delete iDrmUtilityUi; - + iDrmHelperClient.Close(); - + //iWmClient.Close(); - + iOmaClient.Close(); - + // Remove the object from active scheduler etc. if ( IsAdded() ) { @@ -244,11 +244,11 @@ return EFalse; } - ContentAccess::CData* data( - ContentAccess::CData::NewLC( aFile, + ContentAccess::CData* data( + ContentAccess::CData::NewLC( aFile, ContentAccess::KDefaultContentObject, ContentAccess::EPeek ) ); - + returnValue = CanSetAutomatedL( *data, aIntent, aAutomatedType ); CleanupStack::PopAndDestroy( data ); return returnValue; @@ -272,7 +272,7 @@ TBool canSetAutomated( EFalse ); TBool protectedFile( EFalse ); - User::LeaveIfError( aData.GetAttribute( ContentAccess::EIsProtected, + User::LeaveIfError( aData.GetAttribute( ContentAccess::EIsProtected, protectedFile ) ); if ( !protectedFile ) { @@ -281,13 +281,13 @@ } User::LeaveIfError( aData.GetAttribute( DRM::EDrmAgentUid, agentUid ) ); - + if ( agentUid == DRM::EDrmWmAgent ) { //WMDRM not supported as automated. So no need to continue. return EFalse; } - + uniqueId8 = GetContentIdL( aData ); CleanupStack::PushL( uniqueId8 ); @@ -343,8 +343,8 @@ const DRM::TDrmAutomatedServiceType aServiceType ) { ContentAccess::CData* data = - ContentAccess::CData::NewLC( aFile, - ContentAccess::KDefaultContentObject, + ContentAccess::CData::NewLC( aFile, + ContentAccess::KDefaultContentObject, ContentAccess::EPeek ); SetAutomatedL( *data, aIntent, aAutomatedType, aServiceType); CleanupStack::PopAndDestroy( data ); @@ -366,14 +366,14 @@ TInt ret( KErrNone ); ContentAccess::CData* data = - ContentAccess::CData::NewLC( aFile, - ContentAccess::KDefaultContentObject, + ContentAccess::CData::NewLC( aFile, + ContentAccess::KDefaultContentObject, ContentAccess::EPeek ); ret = SetAutomatedAsyncL( *data, aIntent, aAutomatedType, aObserver, aServiceType ); - + CleanupStack::PopAndDestroy( data ); - + return ret; } @@ -394,17 +394,17 @@ User::Leave( KErrArgument ); } - DRM::CDrmAutomatedUsageData* data( - DRM::CDrmAutomatedUsageData::NewLC( + DRM::CDrmAutomatedUsageData* data( + DRM::CDrmAutomatedUsageData::NewLC( aData, aIntent, - aAutomatedType, - NULL, + aAutomatedType, + NULL, aServiceType, DRM::CDrmAutomatedUsageData::ESetAutomated ) ); - + User::LeaveIfError ( DoSetAutomatedL( data ) ); - + CleanupStack::PopAndDestroy( data ); } @@ -426,21 +426,21 @@ User::Leave( KErrArgument ); } - DRM::CDrmAutomatedUsageData* data( + DRM::CDrmAutomatedUsageData* data( DRM::CDrmAutomatedUsageData::NewL( - aData, - aIntent, - aAutomatedType, - &aObserver, + aData, + aIntent, + aAutomatedType, + &aObserver, aServiceType, DRM::CDrmAutomatedUsageData::ESetAutomated ) ); iDrmQueue->AppendToQueueL( data ); - + TRequestStatus* status( &iStatus ); - + Activate( status ); - + return data->iOperationId; } @@ -457,9 +457,9 @@ const DRM::TDrmAutomatedType aAutomatedType, const DRM::TDrmAutomatedServiceType aServiceType ) { - ContentAccess::CData* data( - ContentAccess::CData::NewLC( aFile, - ContentAccess::KDefaultContentObject, + ContentAccess::CData* data( + ContentAccess::CData::NewLC( aFile, + ContentAccess::KDefaultContentObject, ContentAccess::EPeek ) ); RemoveAutomatedL( *data, aIntent, aAutomatedType, aServiceType ); @@ -480,18 +480,18 @@ const DRM::TDrmAutomatedServiceType aServiceType ) { TInt ret( KErrNone ); - - ContentAccess::CData* data( - ContentAccess::CData::NewLC( aFile, - ContentAccess::KDefaultContentObject, + + ContentAccess::CData* data( + ContentAccess::CData::NewLC( aFile, + ContentAccess::KDefaultContentObject, ContentAccess::EPeek ) ); - - ret = RemoveAutomatedAsyncL( *data, - aIntent, - aAutomatedType, - aObserver, + + ret = RemoveAutomatedAsyncL( *data, + aIntent, + aAutomatedType, + aObserver, aServiceType ); - + CleanupStack::PopAndDestroy( data ); return ret; } @@ -508,17 +508,17 @@ const DRM::TDrmAutomatedType aAutomatedType, const DRM::TDrmAutomatedServiceType aServiceType ) { - DRM::CDrmAutomatedUsageData* data ( + DRM::CDrmAutomatedUsageData* data ( DRM::CDrmAutomatedUsageData::NewLC( aData, - aIntent, - aAutomatedType, - NULL, + aIntent, + aAutomatedType, + NULL, aServiceType, DRM::CDrmAutomatedUsageData::ERemoveAutomated ) ); - + User::LeaveIfError( DoRemoveAutomated( data ) ); - + CleanupStack::PopAndDestroy( data ); } @@ -535,21 +535,21 @@ DRM::MDrmAsyncObserver& aObserver, const DRM::TDrmAutomatedServiceType aServiceType ) { - DRM::CDrmAutomatedUsageData* data( + DRM::CDrmAutomatedUsageData* data( DRM::CDrmAutomatedUsageData::NewL( - aData, - aIntent, - aAutomatedType, - &aObserver, + aData, + aIntent, + aAutomatedType, + &aObserver, aServiceType, DRM::CDrmAutomatedUsageData::ERemoveAutomated ) ); iDrmQueue->AppendToQueueL( data ); - + TRequestStatus* status( &iStatus ); - + Activate( status ); - + return data->iOperationId; } @@ -565,7 +565,7 @@ const DRM::TDrmAutomatedType aAutomatedType, const DRM::TDrmAutomatedServiceType aServiceType ) { - DRM::CDrmAutomatedUsageData* data( + DRM::CDrmAutomatedUsageData* data( DRM::CDrmAutomatedUsageData::NewLC( aUniqueId, aIntent, @@ -573,9 +573,9 @@ NULL, aServiceType, DRM::CDrmAutomatedUsageData::ERemoveAutomated ) ); - + User::LeaveIfError( DoRemoveAutomated( data ) ); - + CleanupStack::PopAndDestroy( data ); } @@ -592,21 +592,21 @@ MDrmAsyncObserver& aObserver, const TDrmAutomatedServiceType aServiceType ) { - DRM::CDrmAutomatedUsageData* data( + DRM::CDrmAutomatedUsageData* data( DRM::CDrmAutomatedUsageData::NewL( - aUniqueId, - aIntent, - aAutomatedType, - &aObserver, + aUniqueId, + aIntent, + aAutomatedType, + &aObserver, aServiceType, DRM::CDrmAutomatedUsageData::ERemoveAutomated ) ); iDrmQueue->AppendToQueueL( data ); - + TRequestStatus* status( &iStatus ); - + Activate( status ); - + return data->iOperationId; } @@ -651,14 +651,14 @@ { TInt returnValue( KErrNotFound ); DRM::CDrmAutomatedUsageData* data( iDrmQueue->PopItem( aOperationId ) ); - + if ( data ) { data->iObserver->OperationCompleted( aOperationId, KErrCancel ); delete data; returnValue = KErrNone; } - + return returnValue; } #pragma mark - @@ -948,49 +948,49 @@ { DRM::CDrmAutomatedUsageData* data( iDrmQueue->PopFront() ); TRequestStatus *status( &iStatus ); - + if ( !data ) { return; } - - CleanupStack::PushL( data ); - + + CleanupStack::PushL( data ); + // Take this into the "current" variable in case an error occurs iObserver = data->iObserver; iOperationId = data->iOperationId; - + TInt err( KErrNone ); - + switch ( data->iOperation ) { case DRM::CDrmAutomatedUsageData::ESetAutomated: - + err = DoSetAutomatedL( data ); - + break; - + case DRM::CDrmAutomatedUsageData::ERemoveAutomated: - + err = DoRemoveAutomated( data ); - + break; - + default: - + err = KErrArgument; - + break; } - + iObserver->OperationCompleted( iOperationId, err ); - + CleanupStack::PopAndDestroy( data ); - - // Get ready for another round: + + // Get ready for another round: SetActive(); - - // complete internal request: + + // complete internal request: User::RequestComplete( status, KErrNone ); } @@ -998,7 +998,7 @@ // DRM::CDrmAutomatedUsageImpl::RunError // ----------------------------------------------------------------------------- // -TInt DRM::CDrmAutomatedUsageImpl::RunError( +TInt DRM::CDrmAutomatedUsageImpl::RunError( TInt aError ) { iObserver->OperationCompleted( iOperationId, aError ); @@ -1017,13 +1017,13 @@ { CActiveScheduler::Add( this ); } - - if ( !IsActive() ) + + if ( !IsActive() ) { - SetActive(); - - // complete internal request: - User::RequestComplete( aStatus, KErrNone ); + SetActive(); + + // complete internal request: + User::RequestComplete( aStatus, KErrNone ); } } diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/src/DrmRightsInfo.cpp --- a/commondrm/drmutility/src/DrmRightsInfo.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/src/DrmRightsInfo.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -21,7 +21,7 @@ #include #include -#include "drmrightsinfoimpl.h" +#include "DrmRightsInfoImpl.h" // ============================= LOCAL FUNCTIONS =============================== @@ -56,7 +56,7 @@ EXPORT_C DRM::CDrmRightsInfo* DRM::CDrmRightsInfo::NewL() { DRM::CDrmRightsInfo* self( NewLC() ); - + CleanupStack::Pop( self ); return self; @@ -71,14 +71,14 @@ EXPORT_C DRM::CDrmRightsInfo* DRM::CDrmRightsInfo::NewLC() { DRM::CDrmRightsInfo* self( new( ELeave ) CDrmRightsInfo ); - + CleanupStack::PushL( self ); self->ConstructL(); - + return self; } - + // Destructor DRM::CDrmRightsInfo::~CDrmRightsInfo() { @@ -90,7 +90,7 @@ // CDrmRightsInfo::GetUtility // (other items were commented in a header). // ----------------------------------------------------------------------------- -// +// EXPORT_C DRM::CDrmUtility& DRM::CDrmRightsInfo::GetUtility() const { return *iUtility; @@ -101,31 +101,31 @@ // CDrmRightsInfo::CheckRightsL // Syncronous method // ----------------------------------------------------------------------------- -// -EXPORT_C void DRM::CDrmRightsInfo::CheckRightsL( - const TDesC& aUniqueId, +// +EXPORT_C void DRM::CDrmRightsInfo::CheckRightsL( + const TDesC& aUniqueId, ContentAccess::TIntent aIntent, DRM::TDrmRightsInfo& aDetails ) { - iImplementation->CheckRightsL( aUniqueId, aIntent, aDetails ); + iImplementation->CheckRightsL( aUniqueId, aIntent, aDetails ); } // ----------------------------------------------------------------------------- // CDrmRightsInfo::CheckRightsL // Asyncronous method // ----------------------------------------------------------------------------- -// -EXPORT_C TInt DRM::CDrmRightsInfo::CheckRightsAsyncL( - const TDesC& aUniqueId, +// +EXPORT_C TInt DRM::CDrmRightsInfo::CheckRightsAsyncL( + const TDesC& aUniqueId, ContentAccess::TIntent aIntent, DRM::TDrmRightsInfo& aDetails, DRM::MDrmAsyncObserver& aObserver ) { - TInt operation = iImplementation->CheckRightsAsyncL( aUniqueId, - aIntent, - aDetails, + TInt operation = iImplementation->CheckRightsAsyncL( aUniqueId, + aIntent, + aDetails, aObserver ); - return operation; + return operation; } // ----------------------------------------------------------------------------- @@ -137,6 +137,6 @@ EXPORT_C TInt DRM::CDrmRightsInfo::CancelOperation( TInt aOperationId ) { return iImplementation->CancelOperation( aOperationId ); - } + } // End of File diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/src/DrmRightsInfoData.cpp --- a/commondrm/drmutility/src/DrmRightsInfoData.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/src/DrmRightsInfoData.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -17,7 +17,7 @@ // INCLUDE FILES -#include "drmrightsinfodata.h" +#include "DrmRightsInfoData.h" // ============================= LOCAL FUNCTIONS =============================== @@ -27,7 +27,7 @@ // CDrmRightsInfoData::NewLC // Two-Phase constructor // ----------------------------------------------------------------------------- -// +// DRM::CDrmRightsInfoData* DRM::CDrmRightsInfoData::NewL() { DRM::CDrmRightsInfoData* self( NewLC() ); @@ -40,41 +40,41 @@ // CDrmRightsInfoData::NewLC // Two-Phase constructor // ----------------------------------------------------------------------------- -// +// DRM::CDrmRightsInfoData* DRM::CDrmRightsInfoData::NewLC() { DRM::CDrmRightsInfoData* self( new (ELeave) CDrmRightsInfoData ); CleanupStack::PushL( self ); self->ConstructL(); - return self; + return self; } // ----------------------------------------------------------------------------- // Constructor // ----------------------------------------------------------------------------- -// +// DRM::CDrmRightsInfoData::CDrmRightsInfoData() - { - } - + { + } + // ----------------------------------------------------------------------------- // Destructor // ----------------------------------------------------------------------------- -// +// DRM::CDrmRightsInfoData::~CDrmRightsInfoData() - { - delete iUniqueId; - delete iUniqueId8; - } - + { + delete iUniqueId; + delete iUniqueId8; + } + // ----------------------------------------------------------------------------- // CDrmRightsInfoData::ConstructL // Second phase constructor // ----------------------------------------------------------------------------- -// +// void DRM::CDrmRightsInfoData::ConstructL() { } - - + + // End of File diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/src/DrmRightsInfoImpl.cpp --- a/commondrm/drmutility/src/DrmRightsInfoImpl.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/src/DrmRightsInfoImpl.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,13 +19,13 @@ // INCLUDE FILES #include -#include +#include #include #include #include -#include "drmrightsinfoimpl.h" -#include "drmrightsinfodata.h" +#include "DrmRightsInfoImpl.h" +#include "DrmRightsInfoData.h" #include "drmutilitycommon.h" // CONSTANTS diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/src/DrmUiHandling.cpp --- a/commondrm/drmutility/src/DrmUiHandling.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/src/DrmUiHandling.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -22,7 +22,7 @@ #include #include "drmuierrorhandling.h" -#include "drmuihandlingimpl.h" +#include "DrmUiHandlingImpl.h" // ============================= LOCAL FUNCTIONS =============================== diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/src/DrmUiHandlingImpl.cpp --- a/commondrm/drmutility/src/DrmUiHandlingImpl.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/src/DrmUiHandlingImpl.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -27,7 +27,7 @@ // publish & subscribe #include -#include +#include #include // coeenv @@ -46,8 +46,8 @@ #include // launching embedded details view -#include -#include +#include +#include #include // character conversions @@ -61,11 +61,11 @@ #include // drm -#include +#include #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -77,21 +77,21 @@ #include "drmutilitycommon.h" #include "drmutilityui.h" -#include "drmuihandlingimpl.h" +#include "DrmUiHandlingImpl.h" #include "drmuihandlingdata.h" -#include "drmutilitydownloadmanager.h" +#include "DrmUtilityDownloadManager.h" #include "drmutilityinternaltypes.h" #include "drmuicheckrightsobserver.h" #include "drmutilitywmdrm.h" #include "drmutilitywmdrmwrapper.h" -#include "roapstorageclient.h" -#include "drmtypes.h" +#include "RoapStorageClient.h" +#include "DRMTypes.h" #include "drmsettingsplugininternalcrkeys.h" -#include "drmricontext.h" -#include "drmdomaincontext.h" - -#include "drmutilityinternalcrkeys.h" // Cenrep extension for OmaBased +#include "DRMRIContext.h" +#include "DRMDomainContext.h" + +#include "DrmUtilityInternalcrkeys.h" // Cenrep extension for OmaBased // CONSTANTS const TInt KCommandHandleErrorFile( 1 ); @@ -1612,12 +1612,12 @@ { permission = iOmaClient.GetActiveRightsL( aIntent, *aContentUri, reason ); - + if( !permission ) { User::Leave( KErrCANoPermission); //coverity check } - + CleanupStack::PushL( permission ); toplevel = permission->TopLevelConstraint(); diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/src/DrmUtility.cpp --- a/commondrm/drmutility/src/DrmUtility.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/src/DrmUtility.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -17,11 +17,11 @@ // INCLUDE FILES -#include +#include #include #include #include -#include +#include #include "Oma1Dcf.h" @@ -65,7 +65,7 @@ { copyGUID[i] = aGUID[13 - i]; } - for ( i = 8; i < 16 ; i++) + for ( i = 8; i < 16 ; i++) { copyGUID[i] = aGUID[i]; } @@ -97,26 +97,26 @@ // ----------------------------------------------------------------------------- // Default constructor // ----------------------------------------------------------------------------- -// +// DRM::CDrmUtility::CDrmUtility() { } - + // ----------------------------------------------------------------------------- // Destructor // ----------------------------------------------------------------------------- -// +// DRM::CDrmUtility::~CDrmUtility() { delete iOmaBasedAgentName; delete iOmaBasedMimeType; } - + // ----------------------------------------------------------------------------- // CDrmUtility::NewLC // First phase constructor // ----------------------------------------------------------------------------- -// +// EXPORT_C DRM::CDrmUtility* DRM::CDrmUtility::NewLC() { DRM::CDrmUtility* self( new( ELeave ) CDrmUtility ); @@ -129,7 +129,7 @@ // CDrmUtility::NewL // First phase constructor // ----------------------------------------------------------------------------- -// +// EXPORT_C DRM::CDrmUtility* DRM::CDrmUtility::NewL() { DRM::CDrmUtility* self( NewLC() ); @@ -140,7 +140,7 @@ void DRM::CDrmUtility::ConstructL() { TInt err( KErrNone ); - + TRAP(err, FetchOmaBasedInfoL() ); if( err) { @@ -154,7 +154,7 @@ delete iOmaBasedMimeType; } iOmaBasedMimeType = NULL; - } + } } // ----------------------------------------------------------------------------- @@ -167,23 +167,23 @@ CRepository* repository( NULL ); RBuf bOmaBasedAgentName; RBuf bOmaBasedMimeType; - + CleanupClosePushL(bOmaBasedAgentName); CleanupClosePushL(bOmaBasedMimeType); bOmaBasedAgentName.CreateL( KCenRepDataLength ); bOmaBasedMimeType.CreateL( KCenRepDataLength ); - + TRAP( err, repository = CRepository::NewL( KCRUidOmaBased ) ); if ( !err ) { CleanupStack::PushL( repository ); - + err = repository->Get( KDrmOmaBasedName, bOmaBasedAgentName ); if( !err ) { - iOmaBasedAgentName = bOmaBasedAgentName.AllocL(); + iOmaBasedAgentName = bOmaBasedAgentName.AllocL(); } - + err = repository->Get( KOmaBasedMimeType, bOmaBasedMimeType ); if( !err ) { @@ -191,9 +191,9 @@ } CleanupStack::PopAndDestroy( repository ); } - + CleanupStack::PopAndDestroy(2); - + User::LeaveIfError( err ); } @@ -201,8 +201,8 @@ // ----------------------------------------------------------------------------- // CDrmUtility::GetDrmInfoL // ----------------------------------------------------------------------------- -// -EXPORT_C TBool DRM::CDrmUtility::GetDrmInfoL( +// +EXPORT_C TBool DRM::CDrmUtility::GetDrmInfoL( RFile& aFileHandle, TPtrC& aAgent, DRM::TDrmProtectionStatus& aProtected ) const @@ -215,44 +215,44 @@ TInt64 headerSize( 0 ); TBool isDrmFile( EFalse ); TPtr8 headerPtr( NULL, 0 ); - + aProtected = DRM::EUUnprotected; aAgent.Set( KNullDesC ); - + CheckFileHandleL( aFileHandle ); User::LeaveIfError( file.Duplicate( aFileHandle ) ); CleanupClosePushL( file ); User::LeaveIfError( file.Seek( ESeekStart, pos ) ); - + // Check if the file is an ASF file // To be Checked on runtime wether WM DRM is supporeted or not User::LeaveIfError( file.Read( 0, header, KMinContentLength ) ); if ( header.Length() < KMinContentLength ) { - User::Leave( KErrArgument ); - } - + User::Leave( KErrArgument ); + } + FormatGUID( header ); - + if ( header == KASFHeaderObject ) { // It's ASF, check still whether it's WM DRM protected or not file.Read( header, KWMHeaderObjectLength ); headerSize = ConvertToInt64( header ); - if( headerSize <= KWMTopLevelHeaderObjectLength || + if( headerSize <= KWMTopLevelHeaderObjectLength || headerSize > KMaxWMHeaderLength ) { User::Leave( KErrArgument ); } buffer = HBufC8::NewLC( headerSize ); - headerPtr.Set( buffer->Des() ); - User::LeaveIfError( file.Read( headerPtr, + headerPtr.Set( buffer->Des() ); + User::LeaveIfError( file.Read( headerPtr, headerSize - ( KMinContentLength + KWMHeaderObjectLength ) ) ); - + r = headerPtr.Find( KWrmHeader ); - if ( r == KErrNotFound ) + if ( r == KErrNotFound ) { aProtected = DRM::EUUnprotected; } @@ -260,33 +260,33 @@ { isDrmFile = ETrue; aProtected = DRM::EUProtected; - aAgent.Set( DRM::KDrmWMAgentName ); + aAgent.Set( DRM::KDrmWMAgentName ); } - CleanupStack::PopAndDestroy( buffer ); // buffer + CleanupStack::PopAndDestroy( buffer ); // buffer } else { // Check whether it's OMA DRM protected or not buffer = HBufC8::NewLC( KOmaHeaderLength ); - + headerPtr.Set( buffer->Des() ); User::LeaveIfError( file.Read( 0, headerPtr )); - + if ( COma1Dcf::IsValidDcf( headerPtr ) ) { isDrmFile = ETrue; - aProtected = DRM::EUProtected; - aAgent.Set( DRM::KDrmOmaAgentName ); + aProtected = DRM::EUProtected; + aAgent.Set( DRM::KDrmOmaAgentName ); } else if ( COma2Dcf::IsValidDcf( headerPtr ) ) { isDrmFile = ETrue; _LIT8( KCommonHeadersBox, "ohdr" ); pos = headerPtr.Find( KCommonHeadersBox ); - + // If no box can be found or if there isn't enough data // set protection as unknown - if( pos == KErrNotFound || + if( pos == KErrNotFound || headerPtr.Length() < pos + KOma2EncryptionFieldOffset ) { aProtected = DRM::EUUnknown; @@ -299,31 +299,31 @@ else { aProtected = DRM::EUProtected; - } - aAgent.Set( DRM::KDrmOmaAgentName ); - } + } + aAgent.Set( DRM::KDrmOmaAgentName ); + } else if ( (buffer->Des())[0] == 1) { // set the mimetype from the buffer which is in the beginning - // starting from byte 3 with the length specified at position 2 + // starting from byte 3 with the length specified at position 2 TPtrC8 mimeType( buffer->Des().Mid(3, (buffer->Des())[1]) ); - if( !mimeType.CompareF( *iOmaBasedMimeType ) ) - { + if( !mimeType.CompareF( *iOmaBasedMimeType ) ) + { aAgent.Set( *DRM::CDrmUtility::iOmaBasedAgentName ); isDrmFile = ETrue; } } CleanupStack::PopAndDestroy( buffer ); - } + } CleanupStack::PopAndDestroy( &file ); // file return isDrmFile; - } - + } + // ----------------------------------------------------------------------------- // CDrmUtility::GetDrmInfoL // ----------------------------------------------------------------------------- -// -EXPORT_C TBool DRM::CDrmUtility::GetDrmInfoL( +// +EXPORT_C TBool DRM::CDrmUtility::GetDrmInfoL( const TDesC8& aContent, TPtrC& aAgent, DRM::TDrmProtectionStatus& aProtected ) const @@ -333,44 +333,44 @@ TPtr8 asfPtr( NULL, 0 ); TBuf8< 32 > asfGuidHex; TBool isDrmFile( EFalse ); - + aProtected = DRM::EUUnprotected; aAgent.Set( KNullDesC ); if ( aContent.Length() < KMinContentLength ) { - User::Leave( KErrArgument ); + User::Leave( KErrArgument ); } - + // Check if the file is an ASF file - asfPtr.Set( + asfPtr.Set( const_cast( asfGuidHex.Ptr() ), 0, KMinContentLength * 2 ); - asfPtr.Copy( aContent.Left( KMinContentLength ) ); + asfPtr.Copy( aContent.Left( KMinContentLength ) ); FormatGUID( asfPtr ); - + if ( asfPtr == KASFHeaderObject ) { // It's ASF, check still whether it's WM DRM protected or not r = aContent.Find( KWrmHeader ); - if ( r == KErrNotFound ) + if ( r == KErrNotFound ) { - aProtected = DRM::EUUnprotected; + aProtected = DRM::EUUnprotected; } else { isDrmFile = ETrue; - aProtected = DRM::EUProtected; - aAgent.Set( DRM::KDrmWMAgentName ); - } + aProtected = DRM::EUProtected; + aAgent.Set( DRM::KDrmWMAgentName ); + } } else { // Check whether it's OMA DRM protected or not. - if ( ( aContent.Length() >= KMinContentLengthOma1Based ) && + if ( ( aContent.Length() >= KMinContentLengthOma1Based ) && ( COma1Dcf::IsValidDcf( aContent ) ) ) { isDrmFile = ETrue; - aProtected = DRM::EUProtected; + aProtected = DRM::EUProtected; aAgent.Set( DRM::KDrmOmaAgentName ); } else if ( COma2Dcf::IsValidDcf( aContent ) ) @@ -378,32 +378,32 @@ isDrmFile = ETrue; _LIT8( KCommonHeadersBox, "ohdr" ); TInt pos( aContent.Find( KCommonHeadersBox ) ); - + // If no box can be found or if there isn't enough data // set protection as unknown - if ( pos == KErrNotFound || + if ( pos == KErrNotFound || aContent.Length() < pos + KOma2EncryptionFieldOffset ) { aProtected = DRM::EUUnknown; } - // If encryption field is 0, then content isn't protected + // If encryption field is 0, then content isn't protected else if ( !aContent[pos + KOma2EncryptionFieldOffset] ) { - aProtected = DRM::EUUnprotected; + aProtected = DRM::EUUnprotected; } else { - aProtected = DRM::EUProtected; - } - aAgent.Set( DRM::KDrmOmaAgentName ); + aProtected = DRM::EUProtected; + } + aAgent.Set( DRM::KDrmOmaAgentName ); } else if ( (aContent)[0] == 1) { // set the mimetype from the buffer which is in the beginning - // starting from byte 3 with the length specified at position 2 + // starting from byte 3 with the length specified at position 2 TPtrC8 mimeType( aContent.Mid(3, (aContent)[1]) ); if( !mimeType.CompareF( *iOmaBasedMimeType ) ) - { + { aAgent.Set( *DRM::CDrmUtility::iOmaBasedAgentName ); isDrmFile = ETrue; aProtected = DRM::EUProtected; @@ -411,21 +411,21 @@ } } return isDrmFile; - } + } // ----------------------------------------------------------------------------- // CDrmUtility::IsProtectedL // ----------------------------------------------------------------------------- -// +// EXPORT_C TBool DRM::CDrmUtility::IsProtectedL( RFile& aFileHandle ) const { DRM::TDrmProtectionStatus protection( DRM::EUUnknown ); TPtrC agent( KNullDesC ); TBool isDrmFile( EFalse ); TBool isProtected( EFalse ); - + isDrmFile = GetDrmInfoL( aFileHandle, agent, protection ); - + if ( isDrmFile && protection == DRM::EUProtected ) { isProtected = ETrue; @@ -433,20 +433,20 @@ return isProtected; } - + // ----------------------------------------------------------------------------- // CDrmUtility::IsProtectedL // ----------------------------------------------------------------------------- -// +// EXPORT_C TBool DRM::CDrmUtility::IsProtectedL( const TDesC8& aContent ) const { DRM::TDrmProtectionStatus protection( DRM::EUUnknown ); TPtrC agent( KNullDesC ); TBool isDrmFile( EFalse ); TBool isProtected( EFalse ); - + isDrmFile = GetDrmInfoL( aContent, agent, protection ); - + if( isDrmFile && protection == DRM::EUProtected ) { isProtected = ETrue; @@ -458,8 +458,8 @@ // ----------------------------------------------------------------------------- // CDrmUtility::GetAgentL // ----------------------------------------------------------------------------- -// -EXPORT_C TBool DRM::CDrmUtility::GetAgentL( +// +EXPORT_C TBool DRM::CDrmUtility::GetAgentL( RFile& aFileHandle, TPtrC& aAgent ) const { @@ -470,12 +470,12 @@ return isDrmFile; } - + // ----------------------------------------------------------------------------- // CDrmUtility::GetAgentL // ----------------------------------------------------------------------------- -// -EXPORT_C TBool DRM::CDrmUtility::GetAgentL( +// +EXPORT_C TBool DRM::CDrmUtility::GetAgentL( const TDesC8& aContent, TPtrC& aAgent ) const { @@ -486,14 +486,14 @@ return isDrmFile; } - + // ----------------------------------------------------------------------------- // CDrmUtility::CheckFileHandlerL // Checks whether given filehandle is valid if not leaves with KErrArgument // (other items were commented in a header). // ----------------------------------------------------------------------------- -// +// EXPORT_C void DRM::CDrmUtility::CheckFileHandleL( RFile& aFileHandle ) const { if ( !aFileHandle.SubSessionHandle() ) @@ -501,5 +501,5 @@ User::Leave( KErrBadHandle ); } } - + // End of File diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/src/DrmUtilityDmgrWrapper.cpp --- a/commondrm/drmutility/src/DrmUtilityDmgrWrapper.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/src/DrmUtilityDmgrWrapper.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -30,19 +30,19 @@ #include #endif -#include +#include #include -#include +#include #include -#include +#include -#include "roapeng.h" -#include "roapsyncwrapper.h" -#include "roapdef.h" +#include "RoapEng.h" +#include "RoapSyncWrapper.h" +#include "RoapDef.h" -#include "drmutilitydmgrwrapper.h" -#include "drmutilitydmgrwrapperlogger.h" +#include "DrmUtilityDmgrWrapper.h" +#include "DrmUtilityDmgrWrapperLogger.h" // DEBUG macros #ifdef _DEBUG diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/src/DrmUtilityDownloadManager.cpp --- a/commondrm/drmutility/src/DrmUtilityDownloadManager.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/src/DrmUtilityDownloadManager.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -17,8 +17,8 @@ // INCLUDE FILES -#include "drmutilitydownloadmanager.h" -#include "drmutilitydmgrwrapper.h" +#include "DrmUtilityDownloadManager.h" +#include "DrmUtilityDmgrWrapper.h" // CONSTANTS _LIT( KDrmUtilityDmgrHandlerName, "\\system\\libs\\DrmUtilityDmgrWrapper.dll" ); @@ -63,9 +63,9 @@ // CDrmUtilityDownloadManager* CDrmUtilityDownloadManager::NewL() { - CDrmUtilityDownloadManager* self( + CDrmUtilityDownloadManager* self( new( ELeave ) CDrmUtilityDownloadManager() ); - + CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop(); @@ -84,7 +84,7 @@ // CDrmUtilityDownloadManager::DownloadAndHandleRoapTriggerL // // ----------------------------------------------------------------------------- -// +// void CDrmUtilityDownloadManager::DownloadAndHandleRoapTriggerL( const HBufC8* aUrl, CCoeEnv& aCoeEnv ) { @@ -104,7 +104,7 @@ // ----------------------------------------------------------------------------- // CDrmUtilityDownloadManager::GetErrorUrlL -// +// // ----------------------------------------------------------------------------- // HBufC8* CDrmUtilityDownloadManager::GetErrorUrlL() diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/src/DrmUtilityGlobalNoteWrapper.cpp --- a/commondrm/drmutility/src/DrmUtilityGlobalNoteWrapper.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/src/DrmUtilityGlobalNoteWrapper.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -18,20 +18,20 @@ // INCLUDE FILES -#include -#include -#include +#include +#include +#include #include #include // EAknSoftkeyNo #include -#include -#include +#include +#include #include #include "drmutilitysecondarydisplay.h" -#include "drmutilityglobalnotewrapper.h" -#include "drmutilityinfonotewrapper.h" +#include "DrmUtilityGlobalNoteWrapper.h" +#include "DrmUtilityInfoNoteWrapper.h" // ============================= LOCAL FUNCTIONS =============================== @@ -43,7 +43,7 @@ // might leave. // ----------------------------------------------------------------------------- // -DRM::CDrmUtilityGlobalNoteWrapper::CDrmUtilityGlobalNoteWrapper() +DRM::CDrmUtilityGlobalNoteWrapper::CDrmUtilityGlobalNoteWrapper() : CActive( EPriorityStandard ) { CActiveScheduler::Add( this ); @@ -54,7 +54,7 @@ // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // -void DRM::CDrmUtilityGlobalNoteWrapper::ConstructL( +void DRM::CDrmUtilityGlobalNoteWrapper::ConstructL( CStringResourceReader* aResourceReader ) { iResourceReader = aResourceReader; @@ -66,10 +66,10 @@ // Two-phased constructor. // ----------------------------------------------------------------------------- // -DRM::CDrmUtilityGlobalNoteWrapper* DRM::CDrmUtilityGlobalNoteWrapper::NewLC( +DRM::CDrmUtilityGlobalNoteWrapper* DRM::CDrmUtilityGlobalNoteWrapper::NewLC( CStringResourceReader* aResourceReader ) { - DRM::CDrmUtilityGlobalNoteWrapper* self( + DRM::CDrmUtilityGlobalNoteWrapper* self( new (ELeave) CDrmUtilityGlobalNoteWrapper() ); CleanupStack::PushL( self ); self->ConstructL( aResourceReader ); @@ -84,7 +84,7 @@ return self; } - + // Destructor DRM::CDrmUtilityGlobalNoteWrapper::~CDrmUtilityGlobalNoteWrapper() { @@ -95,15 +95,15 @@ // CDrmUtilityGlobalNoteWrapper::ShowNoteL // ----------------------------------------------------------------------------- // -TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteWithButtonsL( - TInt aResourceId, +TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteWithButtonsL( + TInt aResourceId, TInt aButtonsId ) { TInt ret( 0 ); - + iTextBuffer = iResourceReader->ReadResourceString( aResourceId ); - - iButtonsId = aButtonsId; + + iButtonsId = aButtonsId; ret = DoShowNoteL( aResourceId ); iButtonsId = R_AVKON_SOFTKEYS_YES_NO__YES; return ret; @@ -113,35 +113,35 @@ // CDrmUtilityGlobalNoteWrapper::ShowNoteWithButtonsL // ----------------------------------------------------------------------------- // -TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteWithButtonsL( - TInt aResourceId, +TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteWithButtonsL( + TInt aResourceId, TInt aButtonsId, const TDesC& aString ) { TInt ret( 0 ); - - TBuf srcBuffer( + + TBuf srcBuffer( iResourceReader->ReadResourceString( aResourceId ) ); - + StringLoader::Format( iTextBuffer, srcBuffer, -1, aString ); - - iButtonsId = aButtonsId; + + iButtonsId = aButtonsId; ret = DoShowNoteL( aResourceId, aString ); iButtonsId = R_AVKON_SOFTKEYS_YES_NO__YES; return ret; } - + // ----------------------------------------------------------------------------- // CDrmUtilityGlobalNoteWrapper::ShowNoteL // ----------------------------------------------------------------------------- // -TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteL( - TInt aResourceId, +TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteL( + TInt aResourceId, TInt aValue ) { - TBuf srcBuffer( + TBuf srcBuffer( iResourceReader->ReadResourceString( aResourceId ) ); - + StringLoader::Format( iTextBuffer, srcBuffer, -1, aValue ); return DoShowNoteL( aResourceId, KNullDesC, aValue ); } @@ -150,13 +150,13 @@ // CDrmUtilityGlobalNoteWrapper::ShowNoteL // ----------------------------------------------------------------------------- // -TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteL( - TInt aResourceId, +TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteL( + TInt aResourceId, const TDesC& aString ) { - TBuf srcBuffer( + TBuf srcBuffer( iResourceReader->ReadResourceString( aResourceId ) ); - + StringLoader::Format( iTextBuffer, srcBuffer, -1, aString ); return DoShowNoteL( aResourceId, aString ); } @@ -165,16 +165,16 @@ // CDrmUtilityGlobalNoteWrapper::ShowNoteL // ----------------------------------------------------------------------------- // -TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteL( - TInt aResourceId, +TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteL( + TInt aResourceId, const TDesC& aString, - TInt aValue, + TInt aValue, TInt aStringPos, TInt aValuePos) { - TBuf srcBuffer( + TBuf srcBuffer( iResourceReader->ReadResourceString( aResourceId ) ); - + StringLoader::Format( iTextBuffer, srcBuffer, aValuePos, aValue ); srcBuffer = iTextBuffer; StringLoader::Format( iTextBuffer, srcBuffer, aStringPos, aString ); @@ -187,62 +187,62 @@ // #ifdef RD_DRM_PREVIEW_RIGHT_FOR_AUDIO -TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowPreviewListQueryL( +TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowPreviewListQueryL( TInt aResourceId ) { TInt index( 0 ); CAknGlobalListQuery* listQuery( CAknGlobalListQuery::NewLC() ); HBufC* buffer( HBufC::NewLC( DRM::KDRMNoteBufferMaxSize ) ); TPtr bufPtr( buffer->Des() ); - + bufPtr = iResourceReader->ReadResourceString( R_DRMUTILITY_ACTIVATE_PREVIEW ); listQuery->SetHeadingL( bufPtr ); - + CDesCArray* listArray( new( ELeave ) CDesCArrayFlat( 2 ) ); CleanupStack::PushL( listArray ); - + bufPtr = iResourceReader->ReadResourceString( R_DRMUTILITY_ACTIVATE ); listArray->AppendL( bufPtr ); - + switch( aResourceId ) { case R_DRMUTILITY_PREV_AUDIO_GET_LIST_QUERY: - - bufPtr = iResourceReader->ReadResourceString( + + bufPtr = iResourceReader->ReadResourceString( R_DRMUTILITY_GET_PREVIEW ); - - + + break; - + case R_DRMUTILITY_PREV_VIDEO_GET_LIST_QUERY: - - bufPtr = iResourceReader->ReadResourceString( + + bufPtr = iResourceReader->ReadResourceString( R_DRMUTILITY_GET_PREVIEW_VIDEO ); - + break; - + case R_DRMUTILITY_PREV_AUDIO_PLAY_LIST_QUERY: - - bufPtr = iResourceReader->ReadResourceString( + + bufPtr = iResourceReader->ReadResourceString( R_DRMUTILITY_PLAY_PREVIEW ); - + break; - + case R_DRMUTILITY_PREV_VIDEO_PLAY_LIST_QUERY: - - bufPtr = iResourceReader->ReadResourceString( + + bufPtr = iResourceReader->ReadResourceString( R_DRMUTILITY_PLAY_PREVIEW_VIDEO ); - + break; - + default: - + return 0; } - + listArray->AppendL( bufPtr ); - + if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) && DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId( aResourceId ) ) { @@ -250,39 +250,39 @@ TUid myProcessUid( KNullUid ); RThread().Process( myProcess ); myProcessUid = myProcess.Identity(); - + TUtilitySDData utilityData; // First field is DrmUtility's Uid utilityData.iUtilityUid = KUidCoverUiCategoryDrmUtility; // ProcessId which uses DrmUtility - utilityData.iHandlerProcessId = myProcessUid; - TUtilitySDDataPckg pckg( utilityData ); - CAknSDData* sd( CAknSDData::NewL( KUidCoverUiCategoryDrmUtility, - aResourceId, + utilityData.iHandlerProcessId = myProcessUid; + TUtilitySDDataPckg pckg( utilityData ); + CAknSDData* sd( CAknSDData::NewL( KUidCoverUiCategoryDrmUtility, + aResourceId, pckg ) ); - - // ownership to notifier client + + // ownership to notifier client listQuery->SetSecondaryDisplayData( sd ); } - + iStatus = KRequestPending; listQuery->ShowListQueryL( listArray, iStatus ); SetActive(); iWait.Start(); - + CleanupStack::PopAndDestroy( 3, listQuery ); //listArray, buffer, listQuery - + if ( iStatus.Int() != EAknSoftkeyNo ) { index = iStatus.Int() + 1; } - + return index; } #else -TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowPreviewListQueryL( +TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowPreviewListQueryL( TInt /*aResourceId*/ ) { return 0; @@ -311,22 +311,22 @@ // CDrmUtilityGlobalNoteWrapper::DoShowNoteL // ----------------------------------------------------------------------------- // -TInt DRM::CDrmUtilityGlobalNoteWrapper::DoShowNoteL( - TInt aResourceId, - const TDesC& aString, +TInt DRM::CDrmUtilityGlobalNoteWrapper::DoShowNoteL( + TInt aResourceId, + const TDesC& aString, TInt aValue ) { TPtr bufPtr( NULL, 0 ); - TInt animation( iButtonsId == R_AVKON_SOFTKEYS_YES_NO__YES ? + TInt animation( iButtonsId == R_AVKON_SOFTKEYS_YES_NO__YES ? 0 : R_QGN_NOTE_INFO_ANIM ); - + CAknGlobalConfirmationQuery* globalNote( CAknGlobalConfirmationQuery::NewLC() ); - - bufPtr.Set( const_cast ( iTextBuffer.Ptr() ), - iTextBuffer.Length(), + + bufPtr.Set( const_cast ( iTextBuffer.Ptr() ), + iTextBuffer.Length(), iTextBuffer.Length() ); - + AknTextUtils::LanguageSpecificNumberConversion( bufPtr ); @@ -337,12 +337,12 @@ TUid myProcessUid( KNullUid ); RThread().Process( myProcess ); myProcessUid = myProcess.Identity(); - + TUtilitySDData utilityData; // First field is DrmUtility's Uid utilityData.iUtilityUid = KUidCoverUiCategoryDrmUtility; // ProcessId which uses DrmUtility - utilityData.iHandlerProcessId = myProcessUid; + utilityData.iHandlerProcessId = myProcessUid; if ( aString.Compare( KNullDesC ) ) { // If there is filename given, it's always in the PrimaryString @@ -354,27 +354,27 @@ utilityData.iNumParam.AppendNum( aValue ); } - TUtilitySDDataPckg pckg( utilityData ); - CAknSDData* sd( CAknSDData::NewL( KUidCoverUiCategoryDrmUtility, - aResourceId, + TUtilitySDDataPckg pckg( utilityData ); + CAknSDData* sd( CAknSDData::NewL( KUidCoverUiCategoryDrmUtility, + aResourceId, pckg ) ); - - // ownership to notifier client + + // ownership to notifier client globalNote->SetSecondaryDisplayData( sd ); } iStatus = KRequestPending; - globalNote->ShowConfirmationQueryL( iStatus, - iTextBuffer, + globalNote->ShowConfirmationQueryL( iStatus, + iTextBuffer, iButtonsId, animation ); - + SetActive(); iWait.Start(); CleanupStack::PopAndDestroy( globalNote ); if ( iStatus.Int() != EAknSoftkeyNo ) { - return iStatus.Int(); + return iStatus.Int(); } else { @@ -382,4 +382,4 @@ } } -// End of File +// End of File diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/src/DrmUtilityInfoNoteWrapper.cpp --- a/commondrm/drmutility/src/DrmUtilityInfoNoteWrapper.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/src/DrmUtilityInfoNoteWrapper.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -17,18 +17,18 @@ // INCLUDE FILES -#include -#include +#include +#include #include // EAknSoftkeyNo -#include +#include -#include +#include #include -#include +#include #include #include "drmutilitysecondarydisplay.h" -#include "drmutilityinfonotewrapper.h" +#include "DrmUtilityInfoNoteWrapper.h" // ============================= LOCAL FUNCTIONS =============================== @@ -40,7 +40,7 @@ // might leave. // ----------------------------------------------------------------------------- // -DRM::CDrmUtilityInfoNoteWrapper::CDrmUtilityInfoNoteWrapper() +DRM::CDrmUtilityInfoNoteWrapper::CDrmUtilityInfoNoteWrapper() : CActive( EPriorityStandard ) { CActiveScheduler::Add( this ); @@ -63,7 +63,7 @@ // DRM::CDrmUtilityInfoNoteWrapper* DRM::CDrmUtilityInfoNoteWrapper::NewLC() { - DRM::CDrmUtilityInfoNoteWrapper* self( + DRM::CDrmUtilityInfoNoteWrapper* self( new (ELeave) CDrmUtilityInfoNoteWrapper() ); CleanupStack::PushL( self ); self->ConstructL(); @@ -82,7 +82,7 @@ return self; } - + // Destructor DRM::CDrmUtilityInfoNoteWrapper::~CDrmUtilityInfoNoteWrapper() { @@ -95,7 +95,7 @@ // CDrmUtilityInfoNoteWrapper::ShowNoteL // ----------------------------------------------------------------------------- // -void DRM::CDrmUtilityInfoNoteWrapper::ShowNoteL( TAknGlobalNoteType aType , +void DRM::CDrmUtilityInfoNoteWrapper::ShowNoteL( TAknGlobalNoteType aType , const TDesC& aNoteText, TInt aResourceId, const TDesC& aString, @@ -103,20 +103,20 @@ { RProcess myProcess; TUid myProcessUid( KNullUid ); - + // Convert primary display resource ID to Cover Ui - // do nothing if not found + // do nothing if not found if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) && EvaluateCoverResourceId( aResourceId ) ) - { + { RThread().Process( myProcess ); - myProcessUid = myProcess.Identity(); - + myProcessUid = myProcess.Identity(); + TUtilitySDData utilityData; // First field is DrmUtility's Uid utilityData.iUtilityUid = KUidCoverUiCategoryDrmUtility; // ProcessId which uses DrmUtility - utilityData.iHandlerProcessId = myProcessUid; + utilityData.iHandlerProcessId = myProcessUid; if ( aNoteText.Compare( KNullDesC ) ) { // If there is filename given, it's always in the PrimaryString @@ -126,13 +126,13 @@ { // If there is filename given, it's always in the PrimaryString utilityData.iStringParam.Append( aValue ); - } + } - TUtilitySDDataPckg pckg( utilityData ); - CAknSDData* sd( CAknSDData::NewL( KUidCoverUiCategoryDrmUtility, - aResourceId, + TUtilitySDDataPckg pckg( utilityData ); + CAknSDData* sd( CAknSDData::NewL( KUidCoverUiCategoryDrmUtility, + aResourceId, pckg ) ); - iNote->SetSecondaryDisplayData( sd ); // ownership to notifier client + iNote->SetSecondaryDisplayData( sd ); // ownership to notifier client } iNote->ShowNoteL( iStatus , aType , aNoteText ); @@ -158,10 +158,10 @@ // --------------------------------------------------------- // CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId // --------------------------------------------------------- -// -TBool DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId( +// +TBool DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId( TInt& aResourceId ) - { + { switch ( aResourceId ) { case R_DRMUTILITY_CONFIRMATION_QUERY: @@ -386,9 +386,9 @@ } break; */ - -#ifdef RD_DRM_PREVIEW_RIGHT_FOR_AUDIO - + +#ifdef RD_DRM_PREVIEW_RIGHT_FOR_AUDIO + case R_DRMUTILITY_PREV_AUDIO_GET_LIST_QUERY: { aResourceId = ECover_prev_audio_get_list_query; @@ -429,13 +429,13 @@ aResourceId = ECover_video_prev_play_list; } break; - + #endif // RD_DRM_PREVIEW_RIGHT_FOR_AUDIO - + default: return EFalse; // No proper dialog found, skipping - } + } return ETrue; // Dialog found } -// End of File +// End of File diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/src/drmautomatedusageerrorhandling.cpp --- a/commondrm/drmutility/src/drmautomatedusageerrorhandling.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/src/drmautomatedusageerrorhandling.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -18,7 +18,7 @@ #include "drmautomatedusageerrorhandling.h" -#include "drmautomatedusageimpl.h" +#include "DrmAutomatedUsageImpl.h" // ======== MEMBER FUNCTIONS ======== @@ -46,7 +46,7 @@ // Two-phased constructor // --------------------------------------------------------------------------- // -EXPORT_C DRM::CDrmAutomatedUsageErrorHandling* +EXPORT_C DRM::CDrmAutomatedUsageErrorHandling* DRM::CDrmAutomatedUsageErrorHandling::NewL( DRM::CDrmAutomatedUsageImpl* aImplementation ) { @@ -86,15 +86,15 @@ // RFile based asynchronous method // --------------------------------------------------------------------------- // -EXPORT_C TInt DRM::CDrmAutomatedUsageErrorHandling::HandleErrorAsyncL( +EXPORT_C TInt DRM::CDrmAutomatedUsageErrorHandling::HandleErrorAsyncL( RFile& aFile, - ContentAccess::TIntent aIntent, - TInt aError, + ContentAccess::TIntent aIntent, + TInt aError, DRM::MDrmHandleErrorObserver& aObserver ) { - return iImplementation->HandleErrorAsyncL( aFile, - aIntent, - aError, + return iImplementation->HandleErrorAsyncL( aFile, + aIntent, + aError, aObserver ); } @@ -103,10 +103,10 @@ // RFile based method // --------------------------------------------------------------------------- // -EXPORT_C void DRM::CDrmAutomatedUsageErrorHandling::HandleErrorL( +EXPORT_C void DRM::CDrmAutomatedUsageErrorHandling::HandleErrorL( RFile& aFile, - ContentAccess::TIntent aIntent, - TInt aError, + ContentAccess::TIntent aIntent, + TInt aError, DRM::MDrmHandleErrorObserver* aObserver ) { iImplementation->HandleErrorL( aFile, aIntent, aError, aObserver ); @@ -117,15 +117,15 @@ // CData based asynchronous method // --------------------------------------------------------------------------- // -EXPORT_C TInt DRM::CDrmAutomatedUsageErrorHandling::HandleErrorAsyncL( +EXPORT_C TInt DRM::CDrmAutomatedUsageErrorHandling::HandleErrorAsyncL( ContentAccess::CData& aFile, ContentAccess::TIntent aIntent, - TInt aError, + TInt aError, DRM::MDrmHandleErrorObserver& aObserver ) { - return iImplementation->HandleErrorAsyncL( aFile, - aIntent, - aError, + return iImplementation->HandleErrorAsyncL( aFile, + aIntent, + aError, aObserver); } @@ -134,13 +134,13 @@ // CData based method // --------------------------------------------------------------------------- // -EXPORT_C void DRM::CDrmAutomatedUsageErrorHandling::HandleErrorL( +EXPORT_C void DRM::CDrmAutomatedUsageErrorHandling::HandleErrorL( ContentAccess::CData& aData, ContentAccess::TIntent aIntent, - TInt aError, + TInt aError, DRM::MDrmHandleErrorObserver* aObserver ) { - iImplementation->HandleErrorL( aData, aIntent, aError, aObserver ); + iImplementation->HandleErrorL( aData, aIntent, aError, aObserver ); } // End of File diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/src/drmuierrorhandling.cpp --- a/commondrm/drmutility/src/drmuierrorhandling.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/src/drmuierrorhandling.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -18,7 +18,7 @@ #include "drmuierrorhandling.h" -#include "drmuihandlingimpl.h" +#include "DrmUiHandlingImpl.h" // --------------------------------------------------------------------------- // Constructor @@ -78,33 +78,33 @@ // RFile based method // --------------------------------------------------------------------------- // -EXPORT_C TInt DRM::CDrmUiErrorHandling::HandleErrorAsyncL( +EXPORT_C TInt DRM::CDrmUiErrorHandling::HandleErrorAsyncL( RFile& aFile, - ContentAccess::TIntent aIntent, - TInt aError, + ContentAccess::TIntent aIntent, + TInt aError, DRM::MDrmHandleErrorObserver& aObserver ) { - TInt operation = iImplementation->HandleErrorAsyncL( aFile, - aIntent, - aError, + TInt operation = iImplementation->HandleErrorAsyncL( aFile, + aIntent, + aError, aObserver); - return operation; + return operation; } - + // --------------------------------------------------------------------------- // CDrmUiErrorHandling::HandleErrorL // RFile based method // --------------------------------------------------------------------------- // -EXPORT_C void DRM::CDrmUiErrorHandling::HandleErrorL( +EXPORT_C void DRM::CDrmUiErrorHandling::HandleErrorL( RFile& aFile, - ContentAccess::TIntent aIntent, - TInt aError, + ContentAccess::TIntent aIntent, + TInt aError, DRM::MDrmHandleErrorObserver* aObserver ) { - iImplementation->HandleErrorL( aFile, - aIntent, - aError, + iImplementation->HandleErrorL( aFile, + aIntent, + aError, aObserver); } @@ -113,34 +113,34 @@ // ContentAccess::CData based method // --------------------------------------------------------------------------- // -EXPORT_C TInt DRM::CDrmUiErrorHandling::HandleErrorAsyncL( +EXPORT_C TInt DRM::CDrmUiErrorHandling::HandleErrorAsyncL( ContentAccess::CData& aFile, ContentAccess::TIntent aIntent, - TInt aError, + TInt aError, DRM::MDrmHandleErrorObserver& aObserver ) { - TInt operation = iImplementation->HandleErrorAsyncL( aFile, - aIntent, - aError, + TInt operation = iImplementation->HandleErrorAsyncL( aFile, + aIntent, + aError, aObserver); - return operation; + return operation; } - + // --------------------------------------------------------------------------- // CDrmUiErrorHandling::HandleErrorL // ContentAccess::CData based method // --------------------------------------------------------------------------- // -EXPORT_C void DRM::CDrmUiErrorHandling::HandleErrorL( +EXPORT_C void DRM::CDrmUiErrorHandling::HandleErrorL( ContentAccess::CData& aFile, ContentAccess::TIntent aIntent, - TInt aError, + TInt aError, DRM::MDrmHandleErrorObserver* aObserver ) { - iImplementation->HandleErrorL( aFile, - aIntent, - aError, - aObserver); + iImplementation->HandleErrorL( aFile, + aIntent, + aError, + aObserver); } diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/src/drmutilitycommon.cpp --- a/commondrm/drmutility/src/drmutilitycommon.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/src/drmutilitycommon.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -17,12 +17,12 @@ // INCLUDE FILES -#include -#include +#include +#include #include "drmutilitycommon.h" -#include "drmclockclient.h" -#include "drmpointerarray.h" +#include "DRMClockClient.h" +#include "DRMPointerArray.h" // ============================= LOCAL FUNCTIONS =============================== @@ -57,10 +57,10 @@ EXPORT_C DRM::CDrmUtilityCommon* DRM::CDrmUtilityCommon::NewLC() { DRM::CDrmUtilityCommon* self( new( ELeave ) CDrmUtilityCommon() ); - + CleanupStack::PushL( self ); self->ConstructL(); - + return self; } @@ -72,9 +72,9 @@ EXPORT_C DRM::CDrmUtilityCommon* DRM::CDrmUtilityCommon::NewL() { DRM::CDrmUtilityCommon* self( NewLC() ); - + CleanupStack::Pop( self ); - + return self; } @@ -88,8 +88,8 @@ // CDrmUtilityCommon::GetOmaRightsStatusL // // ----------------------------------------------------------------------------- -// -EXPORT_C DRM::TDrmRightsInfo DRM::CDrmUtilityCommon::GetOmaRightsStatusL( +// +EXPORT_C DRM::TDrmRightsInfo DRM::CDrmUtilityCommon::GetOmaRightsStatusL( HBufC8*& aContentUri, ContentAccess::TIntent aIntent, CDRMConstraint* aConstraint ) @@ -103,30 +103,30 @@ CDRMConstraint* constraint( NULL ); CDRMConstraint* toplevel( NULL ); TUint32 retval( 0 ); - TInt r( KErrNone ); - + TInt r( KErrNone ); + r = clockClient.Connect(); CleanupClosePushL( clockClient ); if ( !r ) { - TInt timeZone( 0 ); + TInt timeZone( 0 ); clockClient.GetSecureTime( drmTime, timeZone, secLevel ); } - + uriList = CDRMPointerArray::NewLC(); uriList->SetAutoCleanup( ETrue ); - TRAP_IGNORE( iOmaClient.GetDBEntriesL( *aContentUri, *uriList ) ); - + TRAP_IGNORE( iOmaClient.GetDBEntriesL( *aContentUri, *uriList ) ); + if ( !uriList->Count() ) { CleanupStack::PopAndDestroy( 2, &clockClient ); //clockClient, uriList return DRM::EURightsInfoMissing; } - + individuals = CDRMPointerArray::NewLC(); individuals->SetAutoCleanup( ETrue ); - TRAP_IGNORE( iOmaClient.GetSupportedIndividualsL( *individuals ) ); - + TRAP_IGNORE( iOmaClient.GetSupportedIndividualsL( *individuals ) ); + // Now we have the time, rights and the individual constraints do the // checking. The rights are never valid if we get here so we don't have // to check for that @@ -134,12 +134,12 @@ { toplevel = NULL; constraint = NULL; - + // If the toplevel constraint is defined, get it: toplevel = (*uriList)[i]->TopLevelConstraint(); // If constraint for the intent is defined, get it constraint = (*uriList)[i]->ConstraintForIntent( aIntent ); - + // Top level constraint and constraint for intent, merge them if ( toplevel && constraint ) { @@ -150,11 +150,11 @@ { } // Only top level constraint or no constraints at all, continue - else + else { continue; } - + // If the constraint is rejected due to non time reasons or there is no // time it can't be future constraint->Valid( drmTime, *individuals, retval ); @@ -166,9 +166,9 @@ { continue; } - + drmTime.HomeTime(); - + // If the constrain has active start time and it is not valid, // it must be future if ( constraint->iActiveConstraints & EConstraintStartTime ) @@ -176,11 +176,11 @@ possiblefuture = ETrue; if ( aConstraint ) { - aConstraint->DuplicateL( *constraint ); + aConstraint->DuplicateL( *constraint ); } } - - // If the constrain has active interval and it´s start time is in + + // If the constrain has active interval and it´s start time is in // future, it must be future else if ( constraint->iActiveConstraints & EConstraintInterval && constraint->iIntervalStart > drmTime ) @@ -188,14 +188,14 @@ possiblefuture = ETrue; if ( aConstraint ) { - aConstraint->DuplicateL( *constraint ); + aConstraint->DuplicateL( *constraint ); } } } // End of for loop - - CleanupStack::PopAndDestroy( 3, &clockClient ); //individuals, urilist, + + CleanupStack::PopAndDestroy( 3, &clockClient ); //individuals, urilist, //clockClient - return possiblefuture ? DRM::EURightsInfoFuture : DRM::EURightsInfoExpired; - } - + return possiblefuture ? DRM::EURightsInfoFuture : DRM::EURightsInfoExpired; + } + // End of File diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/src/drmutilityui.cpp --- a/commondrm/drmutility/src/drmutilityui.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/src/drmutilityui.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -20,25 +20,25 @@ // multiple drive support #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif // notes and queries #include #include -#include +#include #include #include -#include -#include +#include +#include #include // secondary display support -#include +#include #include -#include -#include -#include +#include +#include +#include // caf #include @@ -49,20 +49,20 @@ #include // drm -#include -#include +#include +#include #include #include "drmutilityui.h" #include "drmutilitysecondarydisplay.h" -#include "drmutilityglobalnotewrapper.h" -#include "drmutilityinfonotewrapper.h" +#include "DrmUtilityGlobalNoteWrapper.h" +#include "DrmUtilityInfoNoteWrapper.h" // CONSTANTS #ifndef RD_MULTIPLE_DRIVE _LIT( KDriveZ, "z:" ); #else -_LIT( KRomDriveFormatter, "%c:" ); +_LIT( KRomDriveFormatter, "%c:" ); #endif _LIT( KCDrmUtilityResFileName,"drmutility.rsc" ); @@ -91,7 +91,7 @@ // might leave. // ----------------------------------------------------------------------------- // -DRM::CDrmUtilityUI::CDrmUtilityUI( +DRM::CDrmUtilityUI::CDrmUtilityUI( CCoeEnv* aCoeEnv ) : iCoeEnv( aCoeEnv ) { } @@ -106,55 +106,55 @@ if ( !iCoeEnv ) { User::LeaveIfError( iFs.Connect() ); - User::LeaveIfError( iFs.ShareAuto() ); + User::LeaveIfError( iFs.ShareAuto() ); } - + TPtr utilityResourcePtr( NULL, 0 ); iUtilityResourceFile = HBufC::NewL( KMaxFileName ); utilityResourcePtr.Set( iUtilityResourceFile->Des() ); - + TPtr avkonResourcePtr( NULL, 0 ); iAvkonResourceFile = HBufC::NewL( KMaxFileName ); avkonResourcePtr.Set( iAvkonResourceFile->Des() ); #ifndef RD_MULTIPLE_DRIVE - + utilityResourcePtr.Append( KDriveZ ); avkonResourcePtr.Append( KDriveZ ); - + #else //RD_MULTIPLE_DRIVE TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber ); - + if ( iCoeEnv ) { iCoeEnv->FsSession().DriveToChar( driveNumber, driveLetter ); } else { - iFs.DriveToChar( driveNumber, driveLetter ); + iFs.DriveToChar( driveNumber, driveLetter ); } - + utilityResourcePtr.AppendFormat( KRomDriveFormatter, (TUint)driveLetter ); avkonResourcePtr.AppendFormat( KRomDriveFormatter, (TUint)driveLetter ); - + #endif - + utilityResourcePtr.Append( KDC_RESOURCE_FILES_DIR ); utilityResourcePtr.Append( KCDrmUtilityResFileName ); - + avkonResourcePtr.Append( KDC_RESOURCE_FILES_DIR ); avkonResourcePtr.Append( KAvkonResFileName ); - + TFileName resourceFile; if ( iCoeEnv ) { resourceFile = *iUtilityResourceFile; BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), resourceFile ); iUtilityResourceFileOffset = iCoeEnv->AddResourceFileL( resourceFile ); - + resourceFile = *iAvkonResourceFile; BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), resourceFile ); iAvkonResourceFileOffset = iCoeEnv->AddResourceFileL( resourceFile ); @@ -163,16 +163,16 @@ { resourceFile = *iUtilityResourceFile; iUtilityStringResourceReader = CStringResourceReader::NewL( resourceFile, iFs ); - + resourceFile = *iAvkonResourceFile; iAvkonStringResourceReader = CStringResourceReader::NewL( resourceFile, iFs ); } FeatureManager::InitializeLibL(); - + if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) ) { - iEventProvider = CMediatorEventProvider::NewL(); + iEventProvider = CMediatorEventProvider::NewL(); } } @@ -182,14 +182,14 @@ // Two-phased constructor. // ----------------------------------------------------------------------------- // -EXPORT_C DRM::CDrmUtilityUI* DRM::CDrmUtilityUI::NewLC( +EXPORT_C DRM::CDrmUtilityUI* DRM::CDrmUtilityUI::NewLC( CCoeEnv* aCoeEnv ) { DRM::CDrmUtilityUI* self( new( ELeave ) CDrmUtilityUI( aCoeEnv ) ); - + CleanupStack::PushL( self ); self->ConstructL(); - + return self; } @@ -198,13 +198,13 @@ // Two-phased constructor. // ----------------------------------------------------------------------------- // -EXPORT_C DRM::CDrmUtilityUI* DRM::CDrmUtilityUI::NewL( +EXPORT_C DRM::CDrmUtilityUI* DRM::CDrmUtilityUI::NewL( CCoeEnv* aCoeEnv ) { DRM::CDrmUtilityUI* self( NewLC( aCoeEnv ) ); - + CleanupStack::Pop( self ); - + return self; } @@ -222,14 +222,14 @@ delete iAvkonStringResourceReader; iFs.Close(); } - + delete iUtilityResourceFile; delete iAvkonResourceFile; delete iEventProvider; - + iNoteList.ResetAndDestroy(); iNoteList.Close(); - + FeatureManager::UnInitializeLib(); } @@ -242,7 +242,7 @@ TInt aQueryResourceId ) { TInt button( 0 ); - + if ( iCoeEnv ) { HBufC* msgText( StringLoader::LoadLC( aTextResourceId, iCoeEnv ) ); @@ -253,17 +253,17 @@ { TInt buttonsId( aQueryResourceId == R_DRMUTILITY_WAITING_RIGHTS_CONFIRMATION_QUERY ? - R_AVKON_SOFTKEYS_OK_EMPTY__OK : + R_AVKON_SOFTKEYS_OK_EMPTY__OK : R_AVKON_SOFTKEYS_YES_NO__YES ); - + DRM::CDrmUtilityGlobalNoteWrapper* noteWrapper( DRM::CDrmUtilityGlobalNoteWrapper::NewLC( iUtilityStringResourceReader ) ); button = noteWrapper->ShowNoteWithButtonsL( aTextResourceId, buttonsId ); - + CleanupStack::PopAndDestroy( noteWrapper ); } - + return button; } @@ -277,11 +277,11 @@ const TDesC& aString ) { TInt button( 0 ); - + if ( iCoeEnv ) { - HBufC* msgText( StringLoader::LoadLC( aTextResourceId, - aString, + HBufC* msgText( StringLoader::LoadLC( aTextResourceId, + aString, iCoeEnv ) ); button = DisplayQueryL( *msgText, aQueryResourceId ); CleanupStack::PopAndDestroy( msgText ); @@ -290,18 +290,18 @@ { TInt buttonsId( aQueryResourceId == R_DRMUTILITY_WAITING_RIGHTS_CONFIRMATION_QUERY ? - R_AVKON_SOFTKEYS_OK_EMPTY__OK : + R_AVKON_SOFTKEYS_OK_EMPTY__OK : R_AVKON_SOFTKEYS_YES_NO__YES ); - + DRM::CDrmUtilityGlobalNoteWrapper* noteWrapper( DRM::CDrmUtilityGlobalNoteWrapper::NewLC( iUtilityStringResourceReader ) ); - button = noteWrapper->ShowNoteWithButtonsL( aTextResourceId, - buttonsId, + button = noteWrapper->ShowNoteWithButtonsL( aTextResourceId, + buttonsId, aString ); CleanupStack::PopAndDestroy( noteWrapper ); } - + return button; } @@ -309,29 +309,29 @@ // CDrmUtilityUI::DisplayQueryL // ----------------------------------------------------------------------------- // -EXPORT_C TInt DRM::CDrmUtilityUI::DisplayQueryL( - TInt aTextResourceId, +EXPORT_C TInt DRM::CDrmUtilityUI::DisplayQueryL( + TInt aTextResourceId, TInt aValue ) { TInt buttonCode( 0 ); - + if ( iCoeEnv ) { TPtr bufPtr( NULL, 0 ); - HBufC* stringholder( StringLoader::LoadLC( aTextResourceId, + HBufC* stringholder( StringLoader::LoadLC( aTextResourceId, aValue, iCoeEnv ) ); - CAknQueryDialog* dlg( + CAknQueryDialog* dlg( CAknQueryDialog::NewL( CAknQueryDialog::ENoTone ) ); bufPtr.Set( stringholder->Des() ); AknTextUtils::LanguageSpecificNumberConversion( bufPtr ); PrepareSecondaryDisplayL( *dlg, aTextResourceId, KNullDesC, aValue ); - buttonCode = dlg->ExecuteLD( R_DRMUTILITY_CONFIRMATION_QUERY, + buttonCode = dlg->ExecuteLD( R_DRMUTILITY_CONFIRMATION_QUERY, *stringholder ); - + CancelSecondaryDisplayL( aTextResourceId ); CleanupStack::PopAndDestroy( stringholder ); } @@ -339,9 +339,9 @@ { DRM::CDrmUtilityGlobalNoteWrapper* noteWrapper( DRM::CDrmUtilityGlobalNoteWrapper::NewLC( iUtilityStringResourceReader ) ); - + buttonCode = noteWrapper->ShowNoteL( aTextResourceId, aValue ); - + CleanupStack::PopAndDestroy( noteWrapper ); } return buttonCode; @@ -351,29 +351,29 @@ // CDrmUtilityUI::DisplayQueryL // ----------------------------------------------------------------------------- // -EXPORT_C TInt DRM::CDrmUtilityUI::DisplayQueryL( - TInt aTextResourceId, +EXPORT_C TInt DRM::CDrmUtilityUI::DisplayQueryL( + TInt aTextResourceId, const TDesC& aString ) { TInt buttonCode( 0 ); - + if ( iCoeEnv ) { TPtr bufPtr( NULL, 0 ); - HBufC* stringholder( StringLoader::LoadLC( aTextResourceId, + HBufC* stringholder( StringLoader::LoadLC( aTextResourceId, aString, iCoeEnv ) ); - CAknQueryDialog* dlg( + CAknQueryDialog* dlg( CAknQueryDialog::NewL( CAknQueryDialog::ENoTone ) ); bufPtr.Set( stringholder->Des() ); AknTextUtils::LanguageSpecificNumberConversion( bufPtr ); PrepareSecondaryDisplayL( *dlg, aTextResourceId, aString, -1 ); - buttonCode = dlg->ExecuteLD( R_DRMUTILITY_CONFIRMATION_QUERY, + buttonCode = dlg->ExecuteLD( R_DRMUTILITY_CONFIRMATION_QUERY, *stringholder ); - + CancelSecondaryDisplayL( aTextResourceId ); CleanupStack::PopAndDestroy( stringholder ); } @@ -381,12 +381,12 @@ { DRM::CDrmUtilityGlobalNoteWrapper* noteWrapper( DRM::CDrmUtilityGlobalNoteWrapper::NewLC( iUtilityStringResourceReader ) ); - + buttonCode = noteWrapper->ShowNoteL( aTextResourceId, aString ); - + CleanupStack::PopAndDestroy( noteWrapper ); } - + return buttonCode; } @@ -402,7 +402,7 @@ TInt aValuePos ) { TInt buttonCode( 0 ); - + if ( iCoeEnv ) { TPtr bufPtr( NULL, 0 ); @@ -414,36 +414,36 @@ textBuffer = textBuffer2; StringLoader::Format( textBuffer2, textBuffer, aStringPos, aString ); - bufPtr.Set( const_cast ( textBuffer2.Ptr() ), + bufPtr.Set( const_cast ( textBuffer2.Ptr() ), textBuffer2.Length(), textBuffer2.Length() ); - + AknTextUtils::LanguageSpecificNumberConversion( bufPtr ); CAknQueryDialog* dlg( CAknQueryDialog::NewL( CAknQueryDialog::ENoTone ) ); - + PrepareSecondaryDisplayL( *dlg, aTextResourceId, aString, aValue ); - + buttonCode = dlg->ExecuteLD( R_DRMUTILITY_CONFIRMATION_QUERY, textBuffer2 ); - + CancelSecondaryDisplayL( aTextResourceId ); } else { DRM::CDrmUtilityGlobalNoteWrapper* noteWrapper( DRM::CDrmUtilityGlobalNoteWrapper::NewLC( iUtilityStringResourceReader ) ); - - buttonCode = noteWrapper->ShowNoteL( aTextResourceId, + + buttonCode = noteWrapper->ShowNoteL( aTextResourceId, aString, - aValue, - aStringPos, + aValue, + aStringPos, aValuePos ); - + CleanupStack::PopAndDestroy( noteWrapper ); } - + return buttonCode; } @@ -451,52 +451,52 @@ // CDrmUtilityUI::DisplayQueryL // ----------------------------------------------------------------------------- // -EXPORT_C TInt DRM::CDrmUtilityUI::DisplayQueryL( - TDesC& aPromptText, +EXPORT_C TInt DRM::CDrmUtilityUI::DisplayQueryL( + TDesC& aPromptText, TInt aQueryResourceId ) { - CAknQueryDialog* dlg( new (ELeave) CAknQueryDialog( - aPromptText, + CAknQueryDialog* dlg( new (ELeave) CAknQueryDialog( + aPromptText, CAknQueryDialog::ENoTone ) ); TPtr bufPtr( NULL, 0 ); - bufPtr.Set( const_cast ( aPromptText.Ptr() ), + bufPtr.Set( const_cast ( aPromptText.Ptr() ), aPromptText.Length(), aPromptText.Length() ); - + AknTextUtils::LanguageSpecificNumberConversion( bufPtr ); PrepareSecondaryDisplayL( *dlg, aQueryResourceId, aPromptText, -1 ); - + TInt ret( dlg->ExecuteLD( aQueryResourceId ) ); - + CancelSecondaryDisplayL( aQueryResourceId ); - + return ret; } // ----------------------------------------------------------------------------- // CDrmUtilityUI::SetAutomatedQuery // ----------------------------------------------------------------------------- -// -EXPORT_C TInt DRM::CDrmUtilityUI::SetAutomatedQueryL( +// +EXPORT_C TInt DRM::CDrmUtilityUI::SetAutomatedQueryL( CDRMConstraint* aConstraint ) { - __ASSERT_DEBUG( aConstraint, User::Panic( KDRMUtilityDebugPanicMessage, + __ASSERT_DEBUG( aConstraint, User::Panic( KDRMUtilityDebugPanicMessage, KDRMUtilityDebugPanicCode ) ); - + TInt buttonCode( 1 ); - - if ( aConstraint->iActiveConstraints & EConstraintEndTime ) + + if ( aConstraint->iActiveConstraints & EConstraintEndTime ) { TBuf dateFormat; TBuf endDate; TTime endTime( aConstraint->iEndTime ); - + if ( iCoeEnv ) { - StringLoader::Load( dateFormat, - R_QTN_DATE_USUAL_WITH_ZERO, + StringLoader::Load( dateFormat, + R_QTN_DATE_USUAL_WITH_ZERO, iCoeEnv ); } else @@ -504,7 +504,7 @@ dateFormat = iAvkonStringResourceReader->ReadResourceString( R_QTN_DATE_USUAL_WITH_ZERO ); } - + endTime.FormatL( endDate, dateFormat ); buttonCode = DisplayQueryL(R_DRM_QUERY_SET_AUTOMATED, endDate ); } @@ -514,28 +514,28 @@ R_DRMUTILITY_CONFIRMATION_QUERY ); } - return buttonCode; + return buttonCode; } // ----------------------------------------------------------------------------- // CDrmUtilityUI::ShowFutureRightsNoteL // ----------------------------------------------------------------------------- // -EXPORT_C void DRM::CDrmUtilityUI::ShowFutureRightsNoteL( +EXPORT_C void DRM::CDrmUtilityUI::ShowFutureRightsNoteL( CDRMConstraint* aConstraint) { - __ASSERT_DEBUG( aConstraint, User::Panic( KDRMUtilityDebugPanicMessage, + __ASSERT_DEBUG( aConstraint, User::Panic( KDRMUtilityDebugPanicMessage, KDRMUtilityDebugPanicCode ) ); _LIT( KSpace, " " ); TTime startTime( Time::NullTTime() ); - + User::LeaveIfError( GetOmaStartTime( aConstraint, startTime ) ); TBuf dateFormat; TBuf timeFormat; TBuf startDateBuf; TBuf startTimeBuf; - + if ( iCoeEnv ) { StringLoader::Load( dateFormat, R_QTN_DATE_USUAL_WITH_ZERO, iCoeEnv ); @@ -543,12 +543,12 @@ } else { - dateFormat = iAvkonStringResourceReader->ReadResourceString( + dateFormat = iAvkonStringResourceReader->ReadResourceString( R_QTN_DATE_USUAL_WITH_ZERO ); - timeFormat = iAvkonStringResourceReader->ReadResourceString( + timeFormat = iAvkonStringResourceReader->ReadResourceString( R_QTN_TIME_USUAL_WITH_ZERO ); } - + // format date and time startTime.FormatL( startDateBuf, dateFormat ); startTime.FormatL( startTimeBuf, timeFormat ); @@ -571,7 +571,7 @@ DisplayNoteL( *msgText, aTextResourceId ); CleanupStack::PopAndDestroy( msgText ); } - + else { TBuf buffer( @@ -585,13 +585,13 @@ // CDrmUtilityUI::DisplayNoteL // ----------------------------------------------------------------------------- // -EXPORT_C void DRM::CDrmUtilityUI::DisplayNoteL( - TInt aTextResourceId, +EXPORT_C void DRM::CDrmUtilityUI::DisplayNoteL( + TInt aTextResourceId, const TDesC& aString ) { if ( iCoeEnv ) { - HBufC* msgText( StringLoader::LoadLC( aTextResourceId, + HBufC* msgText( StringLoader::LoadLC( aTextResourceId, aString, iCoeEnv ) ); DisplayNoteL( *msgText, aTextResourceId ); @@ -615,16 +615,16 @@ // CDrmUtilityUI::DisplayNoteL // ----------------------------------------------------------------------------- // -EXPORT_C void DRM::CDrmUtilityUI::DisplayNoteL( - TInt aTextResourceId, +EXPORT_C void DRM::CDrmUtilityUI::DisplayNoteL( + TInt aTextResourceId, TInt aValue ) { if ( iCoeEnv ) { - HBufC* msgText( StringLoader::LoadLC( aTextResourceId, + HBufC* msgText( StringLoader::LoadLC( aTextResourceId, aValue, iCoeEnv ) ); - + DisplayNoteL( *msgText, aTextResourceId, KNullDesC, aValue ); CleanupStack::PopAndDestroy( msgText ); } @@ -645,17 +645,17 @@ // CDrmUtilityUI::DisplayNoteL // ----------------------------------------------------------------------------- // -EXPORT_C void DRM::CDrmUtilityUI::DisplayNoteL( - TDesC& aPromptText, - TInt aResourceId, - const TDesC& aString, +EXPORT_C void DRM::CDrmUtilityUI::DisplayNoteL( + TDesC& aPromptText, + TInt aResourceId, + const TDesC& aString, TInt aValue ) { TPtr bufPtr( NULL, 0 ); - bufPtr.Set( const_cast ( aPromptText.Ptr() ), - aPromptText.Length(), + bufPtr.Set( const_cast ( aPromptText.Ptr() ), + aPromptText.Length(), aPromptText.Length() ); - + AknTextUtils::LanguageSpecificNumberConversion( bufPtr ); if ( iCoeEnv ) @@ -667,16 +667,16 @@ } else { - DRM::CDrmUtilityInfoNoteWrapper* note( + DRM::CDrmUtilityInfoNoteWrapper* note( DRM::CDrmUtilityInfoNoteWrapper::NewL() ); - + //a list for simultanous notes User::LeaveIfError( iNoteList.Append( note ) ); - + note->ShowNoteL( GlobalNoteTypeForResource( aResourceId ), - aPromptText, - aResourceId, - aString, + aPromptText, + aResourceId, + aString, aValue ); } } @@ -738,7 +738,7 @@ PrepareSecondaryDisplayL( *dlg, resourceId ); answer = dlg->ExecuteLD( resourceId ); CancelSecondaryDisplayL( resourceId ); - + if ( answer ) { buttonCode = index + 1; @@ -748,20 +748,20 @@ { DRM::CDrmUtilityGlobalNoteWrapper* noteWrapper( DRM::CDrmUtilityGlobalNoteWrapper::NewLC( iUtilityStringResourceReader ) ); - + buttonCode = noteWrapper->ShowPreviewListQueryL( resourceId ); - + CleanupStack::PopAndDestroy( noteWrapper ); } return buttonCode; } - + #else EXPORT_C TInt DRM::CDrmUtilityUI::DisplayPopupWindowsForPreviewL( ContentAccess::CData& /*aContent*/, - TInt /*aPreviewType*/, + TInt /*aPreviewType*/, TInt /*aMediaType*/ ) { return 0; @@ -777,61 +777,61 @@ TInt aResId ) { CAknResourceNoteDialog* resourceDialog( NULL ); - + switch ( aResId ) { case R_DRM_ERR_OPENING_FAIL_PERM: - + resourceDialog = new ( ELeave ) CAknErrorNote( ETrue ); - + break; - + case R_DRM_WARN_NO_CONN_DEFINED: case R_DRM_WARN_INVALID_OR_NO_AP: - + resourceDialog = new ( ELeave ) CAknWarningNote( ETrue ); - + break; - + default: - + resourceDialog = new ( ELeave ) CAknInformationNote( ETrue ); - + break; } - + return resourceDialog; } // ----------------------------------------------------------------------------- // CDrmUtilityUI::GlobalNoteTypeForResource // ----------------------------------------------------------------------------- -/// -TAknGlobalNoteType DRM::CDrmUtilityUI::GlobalNoteTypeForResource( +/// +TAknGlobalNoteType DRM::CDrmUtilityUI::GlobalNoteTypeForResource( TInt aResId ) { TAknGlobalNoteType noteType( EAknGlobalInformationNote ); - + switch ( aResId ) { case R_DRM_ERR_OPENING_FAIL_PERM: - + noteType = EAknGlobalErrorNote; - + break; - + case R_DRM_WARN_NO_CONN_DEFINED: case R_DRM_WARN_INVALID_OR_NO_AP: - + noteType = EAknGlobalWarningNote; - + break; - + default: - + break; } - + return noteType; } @@ -839,21 +839,21 @@ // CDrmUtilityUI::GetOmaStartTime // ----------------------------------------------------------------------------- // -TInt DRM::CDrmUtilityUI::GetOmaStartTime( - CDRMConstraint* aConstraint, +TInt DRM::CDrmUtilityUI::GetOmaStartTime( + CDRMConstraint* aConstraint, TTime& aStartTime) { - __ASSERT_DEBUG( aConstraint, User::Panic( KDRMUtilityDebugPanicMessage, + __ASSERT_DEBUG( aConstraint, User::Panic( KDRMUtilityDebugPanicMessage, KDRMUtilityDebugPanicCode ) ); TInt err( KErrNone ); - + // Activated interval is always the same or later than // the start time of the start-end if ( aConstraint->iActiveConstraints & EConstraintInterval && (aConstraint->iIntervalStart != Time::NullTTime() ) ) { aStartTime = aConstraint->iIntervalStart; - } + } else if ( aConstraint->iActiveConstraints & EConstraintStartTime ) { aStartTime = aConstraint->iStartTime; @@ -862,7 +862,7 @@ { err = KErrCANoPermission; } - + return err; } @@ -872,19 +872,19 @@ // #ifdef RD_DRM_PREVIEW_RIGHT_FOR_AUDIO -TInt DRM::CDrmUtilityUI::EvaluatePreviewMediaTypeL( +TInt DRM::CDrmUtilityUI::EvaluatePreviewMediaTypeL( ContentAccess::CData& aContent, TInt aPreviewType ) - { + { _LIT( KDRMUtilityMimeTypeVideo, "Video" ); _LIT( KDRMUtilityMimeTypeRealMedia, "Application/x-pn-realmedia" ); _LIT( KDRMUtilityMimeTypeVndRealMedia, "Application/vnd.rn-realmedia" ); TInt mediaType( 0 ); HBufC* mimeType( HBufC::NewLC( KMaxDataTypeLength ) ); TPtr mimePtr( mimeType->Des() ); - + User::LeaveIfError( aContent.GetStringAttribute( ContentAccess::EMimeType, mimePtr ) ); - + if( mimePtr.FindF( KDRMUtilityMimeTypeVideo ) == KErrNotFound && mimePtr.FindF( KDRMUtilityMimeTypeRealMedia ) == KErrNotFound && mimePtr.FindF( KDRMUtilityMimeTypeVndRealMedia ) == KErrNotFound ) @@ -909,54 +909,54 @@ mediaType = DRM::EUEmbeddedPreviewActionDefaultVideo; } } - + CleanupStack::PopAndDestroy( mimeType ); return mediaType; } - + #else -TInt DRM::CDrmUtilityUI::EvaluatePreviewMediaTypeL( +TInt DRM::CDrmUtilityUI::EvaluatePreviewMediaTypeL( ContentAccess::CData& /*aContent*/, TInt /*aPreviewType*/ ) { return 0; } -#endif // RD_DRM_PREVIEW_RIGHT_FOR_AUDIO +#endif // RD_DRM_PREVIEW_RIGHT_FOR_AUDIO // ----------------------------------------------------------------------------- // CDrmUtilityUI::PrepareSecondaryDisplayL // ----------------------------------------------------------------------------- // -void DRM::CDrmUtilityUI::PrepareSecondaryDisplayL( - CEikDialog& aDialog, +void DRM::CDrmUtilityUI::PrepareSecondaryDisplayL( + CEikDialog& aDialog, TInt aResourceId, - const TDesC& aString, + const TDesC& aString, TInt aValue ) { // Check if we have cover display and shall we display something if ( !FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) || - !DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId( + !DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId( aResourceId ) ) { return; } - + RProcess myProcess; TUid myProcessUid( KNullUid ); - + RThread().Process( myProcess ); myProcessUid = myProcess.Identity(); aDialog.PublishDialogL( aResourceId, KUidCoverUiCategoryDrmUtility ); // fetch akn utility for mediator support - CAknMediatorFacade* covercl( AknMediatorFacade( &aDialog ) ); + CAknMediatorFacade* covercl( AknMediatorFacade( &aDialog ) ); if ( covercl ) // returns null if cover display is not available { - // Package dialog data + // Package dialog data // TUtilitySDData utilityData; @@ -975,10 +975,10 @@ utilityData.iNumParam.AppendNum( aValue ); } TUtilitySDDataPckg pckg( utilityData ); - + covercl->BufStream() << pckg; // Write the package data covercl->BufStream().CommitL(); // no more data to send so commit buf - } + } } // ----------------------------------------------------------------------------- @@ -987,41 +987,41 @@ // void DRM::CDrmUtilityUI::CancelSecondaryDisplayL( TInt aResourceId ) { - + // Check if we have cover display and shall we display something if( !FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) || - !DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId( + !DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId( aResourceId ) ) { return; } - + RProcess myProcess; TUid myProcessUid( KNullUid ); - + RThread().Process( myProcess ); myProcessUid = myProcess.Identity(); - + TUtilitySDDataCancel cancelData; cancelData.iHandlerProcessId = myProcessUid; cancelData.iNoteId = aResourceId; - + TPckgBuf cancel( cancelData ); - - HBufC8* buf( + + HBufC8* buf( HBufC8::NewLC( sizeof( TUtilitySDDataCancel ) + sizeof( TInt ) ) ); TPtr8 ptr( buf->Des() ); - + RDesWriteStream stream( ptr ); stream << cancel; stream.CommitL(); - + iEventProvider->RaiseEvent( KMediatorSecondaryDisplayDomain, KUidCoverUiCategoryDrmUtility, ECover_dialog_cancel, TVersion( 0, 0, 0 ), *buf ); - + stream.Close(); CleanupStack::PopAndDestroy( buf ); } diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/src/drmutilitywmdrmutilities.cpp --- a/commondrm/drmutility/src/drmutilitywmdrmutilities.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/src/drmutilitywmdrmutilities.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,9 +19,9 @@ #include #include -#include "drmclockclient.h" +#include "DRMClockClient.h" #include "drmutilitywmdrmutilities.h" -#include "drmrights.h" +#include "DRMRights.h" // CONSTANTS _LIT( KLicenseType, "licensetype=" ); @@ -63,7 +63,7 @@ { TBool found( EFalse ); aLex.Mark(); - + while ( !aLex.Eos() && found == EFalse ) { TChar ch; @@ -77,7 +77,7 @@ aPtr.Set( aLex.MarkedToken() ); aLex.Get(); } - else + else { aPtr.Set( aLex.MarkedToken() ); } @@ -98,134 +98,134 @@ TTime localTime( Time::NullTTime() ); TTime universalTime( Time::NullTTime() ); TTimeIntervalSeconds timeDifference( 0 ); // local time - secure time - TInt years, months, days, hours, minutes, secs; + TInt years, months, days, hours, minutes, secs; TChar ch; TLex lex; TTime drmTime; TInt timeZone; - + DRMClock::ESecurityLevel secLevel = DRMClock::KInsecure; - + // The format of the start and end time strings is the following: // "starttime=yy-mm-ddThh:mins:ssZ // "endtime=yy-mm-ddThh:mins:ssZ - // where yy = years, mm = months, dd = days, hh = hours, - // mins = minutes and ss = seconds, "-", "T", ":" and "Z" - // are separators. + // where yy = years, mm = months, dd = days, hh = hours, + // mins = minutes and ss = seconds, "-", "T", ":" and "Z" + // are separators. while ( !aLex.Eos() && ( aLex.Peek() != 0 ) ) { // The next string should be start time, end time or then // it does not exist. ParseString( '=', aLex, token ); - + if ( token.CompareF( KStartTime ) == 0 ) { times |= KFoundStartTime; - } + } else if ( token.CompareF( KEndTime ) == 0 ) { times |= KFoundEndTime; } - else + else { - // No start time ("starttime=") or end time ("endtime=") - // string was found -> return + // No start time ("starttime=") or end time ("endtime=") + // string was found -> return return; } - + if ( ( times & KFoundStartTime ) || ( times & KFoundEndTime ) ) - { - // Search for years, months, days, hours, minutes, secs + { + // Search for years, months, days, hours, minutes, secs if ( ParseString( '-', aLex, token ) ) { TLex lexYear( token ); User::LeaveIfError( lexYear.Val( years ) ); } - else + else { - User::Leave( KErrNotFound ); + User::Leave( KErrNotFound ); } - + if ( ParseString( '-', aLex, token ) ) { TLex lexMonths( token ); User::LeaveIfError( lexMonths.Val( months ) ); } - else + else { - User::Leave( KErrNotFound ); + User::Leave( KErrNotFound ); } - + if ( ParseString( 'T', aLex, token ) ) { TLex lexDays( token ); User::LeaveIfError( lexDays.Val( days ) ); } - else + else { - User::Leave( KErrNotFound ); + User::Leave( KErrNotFound ); } - + if( ParseString( ':', aLex, token ) ) { TLex lexHours( token ); User::LeaveIfError( lexHours.Val( hours ) ); } - else + else { User::Leave( KErrNotFound ); } - + if ( ParseString( ':', aLex, token ) ) { TLex lexMinutes( token ); User::LeaveIfError( lexMinutes.Val( minutes ) ); } - else + else { User::Leave( KErrNotFound ); } - + if( ParseString( 'Z', aLex, token ) ) { TLex lexSeconds( token ); User::LeaveIfError( lexSeconds.Val( secs ) ); } - else + else { User::Leave( KErrNotFound ); - } - + } + ParseString( ';', aLex, token ); token.Set( NULL, 0 ); - - TDateTime date( years, (TMonth)( months - 1 ), days - 1, hours, + + TDateTime date( years, (TMonth)( months - 1 ), days - 1, hours, minutes, secs, 0 ); TTime dateTime( date ); - - // Get secure time from DRM clock + + // Get secure time from DRM clock RDRMClockClient client; - + User::LeaveIfError( client.Connect() ); client.GetSecureTime( drmTime, timeZone, secLevel ); client.Close(); - - localTime.HomeTime(); - - if ( secLevel == DRMClock::KSecure ) - { - // Calculate the difference between local time and secure time - localTime.SecondsFrom( drmTime, timeDifference ); - } - else - { - // Calculate the difference between local and universal time - universalTime.UniversalTime(); - localTime.SecondsFrom( universalTime, timeDifference ); - } - - dateTime += timeDifference; - + + localTime.HomeTime(); + + if ( secLevel == DRMClock::KSecure ) + { + // Calculate the difference between local time and secure time + localTime.SecondsFrom( drmTime, timeDifference ); + } + else + { + // Calculate the difference between local and universal time + universalTime.UniversalTime(); + localTime.SecondsFrom( universalTime, timeDifference ); + } + + dateTime += timeDifference; + if ( times & KFoundStartTime ) { aStartTime = dateTime; @@ -248,12 +248,12 @@ TUint32& aCounts ) { TPtrC16 token( NULL, 0 ); - TInt counts( 0 ); + TInt counts( 0 ); TChar ch; TLex lex; - + ParseString( '=', aLex, token ); - + if ( token.CompareF( KCountLeft ) == 0 ) { ParseString( ';', aLex, token ); @@ -261,8 +261,8 @@ User::LeaveIfError( lexCount.Val( counts ) ); aCounts = counts; return ETrue; - } - else + } + else { // No counts left ("countleft=") string was found. // -> No count information was found, return EFalse @@ -274,15 +274,15 @@ // DrmUtilityWmDrmUtilities::ParseWmDrmDurationRightsL // ---------------------------------------------------------------------------- // -EXPORT_C TBool DrmUtilityWmDrmUtilities::ParseWmDrmDurationRightsL( TLex& aLex, +EXPORT_C TBool DrmUtilityWmDrmUtilities::ParseWmDrmDurationRightsL( TLex& aLex, TTimeIntervalSeconds& aDuration ) { TPtrC16 token( NULL, 0 ); TChar ch; TInt duration( 0 ); - + ParseString( '=', aLex, token ); - + if ( token.CompareF( KDurationLeft ) == 0 ) { ParseString( ';', aLex, token ); @@ -291,12 +291,12 @@ aDuration = duration; return ETrue; } - else + else { // No duration left ("durationleft=") string was found. // -> No duration information was found, return EFalse return EFalse; - } + } } // ---------------------------------------------------------------------------- @@ -307,49 +307,49 @@ ContentAccess::CRightsInfo& aRights, CDRMRightsConstraints*& aRightsConstraint ) { - - __ASSERT_DEBUG( !aRightsConstraint, + + __ASSERT_DEBUG( !aRightsConstraint, User::Panic( KWmDrmUtilitiesDebugPanicMessage, KWmDrmUtilitiesDebugPanicCode ) ); - + TChar ch; TTime startTime( Time::NullTTime() ); TTime endTime( Time::NullTTime() ); TTimeIntervalSeconds duration( 0 ); TUint32 counter( 0 ); - + TPtrC16 token( NULL, 0 ); - + // Parse the WM DRM rights string TLex lex( aRights.Description() ); - - // First, find the license type format string ("licensetype=") + + // First, find the license type format string ("licensetype=") ParseString( '=', lex, token ); - + if ( token.CompareF( KLicenseType ) != 0 ) { - // License type format string was not found + // License type format string was not found User::Leave( KErrArgument ); } - - // Peek for the end of string (eos) in case of (licensetype="") + + // Peek for the end of string (eos) in case of (licensetype="") ch = lex.Peek(); - if ( ch == 0 ) + if ( ch == 0 ) { return; } - + // Check the license type ParseString( ';', lex, token ); - + aRightsConstraint = CDRMRightsConstraints::NewL(); CleanupStack::PushL( aRightsConstraint ); - + // Check what kind of rights are in question by parsing the string // onward. The possible rights are date time (start time and/or end time), // count, duration, time count (count and/or date time) and unlimited // rights. The substrings for certain rights are further parsed in - // specific methods. + // specific methods. if ( token.CompareF( KTime ) == 0 ) { ParseWmDrmTimeRightsL( lex, startTime, endTime ); @@ -395,24 +395,24 @@ } else if ( token.CompareF( KUnlimited ) != 0 ) { - // Unknown license type + // Unknown license type User::Leave( KErrArgument ); } - + CleanupStack::Pop( aRightsConstraint ); - + } // ----------------------------------------------------------------------------- // DrmUtilityWmDrmUtilities::CheckWmDrmRightsL // ----------------------------------------------------------------------------- // -EXPORT_C void DrmUtilityWmDrmUtilities::CheckWmDrmRightsL( TBool& aUnconstrained, +EXPORT_C void DrmUtilityWmDrmUtilities::CheckWmDrmRightsL( TBool& aUnconstrained, TTimeIntervalSeconds& aTime, - TInt& aCounts, + TInt& aCounts, ContentAccess::CRightsInfo& aRights ) { - + TChar ch; TPtrC16 token( NULL, 0 ); TInt constraints( 0 ); @@ -424,34 +424,34 @@ // End time of rights when duration is taken into account. TTime durationEndTime( Time::NullTTime() ); TTimeIntervalSeconds secondsLeft( 0 ); // seconds to end of time based rights - - // Parse WM DRM rights string + + // Parse WM DRM rights string TLex lex( aRights.Description() ); - - // First, find the license type format string ("licensetype=") + + // First, find the license type format string ("licensetype=") ParseString( '=', lex, token ); - + if ( token.CompareF( KLicenseType ) != 0 ) { - // License type format string was not found + // License type format string was not found User::Leave( KErrArgument ); } - - // Peek for the end of string (Eos) in case of (licensetype="") + + // Peek for the end of string (Eos) in case of (licensetype="") ch = lex.Peek(); - if ( ch == 0 ) + if ( ch == 0 ) { return; } - + // Check the license type ParseString( ';', lex, token ); - + // Check what kind of rights are in question by parsing the string // onward. The possible rights are date time (start time and/or end time), // count, duration, time count (count and/or date time) and unlimited // rights. The substrings for certain rights are further parsed in - // specific methods. + // specific methods. if ( token.CompareF( KTime ) == 0 ) { ParseWmDrmTimeRightsL( lex, startTime, endTime ); @@ -470,7 +470,7 @@ { aCounts = counter; constraints |= KWmDrmConstraintCount; - } + } } else if ( token.CompareF( KDuration ) == 0 ) { @@ -499,69 +499,69 @@ { constraints |= KWmDrmConstraintEndTime; } - } - else if ( token.CompareF( KUnlimited ) == 0 ) + } + else if ( token.CompareF( KUnlimited ) == 0 ) { aUnconstrained = ETrue; return; } - else + else { // Unknown license type User::Leave( KErrArgument ); } - + // Get current time now.HomeTime(); - + // The rights are not constrained if ( !constraints ) { aUnconstrained = ETrue; } - + if ( constraints & KWmDrmConstraintStartTime ) { // The start time is in the past or the current time - if ( ( now >= startTime ) && + if ( ( now >= startTime ) && !( constraints & KWmDrmConstraintEndTime ) && !( constraints & KWmDrmConstraintCount ) ) { aUnconstrained = ETrue; } - + // This use case is unclear and should be specified later. // There are counts for the content, but the start time has - // not been reached. + // not been reached. if ( ( constraints & KWmDrmConstraintCount ) && - ( now < startTime ) ) + ( now < startTime ) ) { aCounts = 0; - } + } } - + // Find out the amount of time that the rights have left in // case the rights have end time constraint. if ( constraints & KWmDrmConstraintEndTime ) { error = endTime.SecondsFrom( now, secondsLeft ); - + // The difference between current time and the end time does not // fit to 32-bit number, the start time has been reached and there // are no count constraints defined. - if ( ( error == KErrOverflow ) && - ( !( constraints & KWmDrmConstraintStartTime ) || + if ( ( error == KErrOverflow ) && + ( !( constraints & KWmDrmConstraintStartTime ) || ( now >= startTime ) ) && !( constraints & KWmDrmConstraintCount ) ) { aUnconstrained = ETrue; } - + // End time has not been reached and start time has been reached if ( ( secondsLeft > (TTimeIntervalSeconds)0 ) && ( now >= startTime ) ) { aTime = secondsLeft; } - + // This use case is unclear and should be specified later. // There are counts for the content, but the end time has // been reached. @@ -571,10 +571,9 @@ aCounts = 0; } } - + return; - + } - + // End of File - \ No newline at end of file diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/src/drmutilitywmdrmwrapper.cpp --- a/commondrm/drmutility/src/drmutilitywmdrmwrapper.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/src/drmutilitywmdrmwrapper.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,8 +19,8 @@ // INCLUDE FILES // launching embedded details view -#include -#include +#include +#include #include #include #include @@ -52,7 +52,7 @@ #include "drmutilityui.h" #include "drmagents.h" -#include "drmclockclient.h" +#include "DRMClockClient.h" #include "drmutilityinternaltypes.h" #include "drmutilitywmdrmutilities.h" @@ -383,7 +383,7 @@ // Check the duration, counts and whether the rights // are unlimited or not case ContentAccess::ERightsStatusValid: - DrmUtilityWmDrmUtilities::CheckWmDrmRightsL( + DrmUtilityWmDrmUtilities::CheckWmDrmRightsL( aUnconstrained, aTime, aCounts, *aArray[0] ); break; } @@ -702,7 +702,7 @@ ptr.Append( KMarker ); // WM DRM protection scheme ptr.AppendNum( EDrmSchemeWmDrm ); - ptr.Append( KMarker ); + ptr.Append( KMarker ); CleanupStack::Pop( aLaunchParam ); } @@ -736,7 +736,7 @@ // CDrmUtilityWMDrmWrapper::GetRFileFromCDataL // ----------------------------------------------------------------------------- // -void DRM::CDrmUtilityWMDrmWrapper::GetRFileFromCDataL( +void DRM::CDrmUtilityWMDrmWrapper::GetRFileFromCDataL( ContentAccess::CData& aContent, RFile& aFile ) { @@ -749,7 +749,7 @@ // CDrmUtilityWMDrmWrapper::IsDlaLicenseAcquisitionSilentL // ----------------------------------------------------------------------------- // -TBool DRM::CDrmUtilityWMDrmWrapper::IsDlaLicenseAcquisitionSilentL( +TBool DRM::CDrmUtilityWMDrmWrapper::IsDlaLicenseAcquisitionSilentL( RFile& aFile ) { LoadDlaWrapperL(); @@ -760,7 +760,7 @@ // CDrmUtilityWMDrmWrapper::DlaLicenseAcquisitionL // ----------------------------------------------------------------------------- // -void DRM::CDrmUtilityWMDrmWrapper::DlaLicenseAcquisitionL( +void DRM::CDrmUtilityWMDrmWrapper::DlaLicenseAcquisitionL( RFile& aFile ) { TInt iapId( 0 ); @@ -810,7 +810,7 @@ repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk ); repository->Get( KBrowserNGDefaultSnapId, defaultSnap ); CleanupStack::PopAndDestroy( repository ); - + if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound ) { alwaysAsk = ETrue; @@ -821,8 +821,8 @@ cmManager.OpenLC(); if ( !alwaysAsk ) { - iapd32 = - cmManager.GetConnectionMethodInfoIntL( ap, + iapd32 = + cmManager.GetConnectionMethodInfoIntL( ap, CMManager::ECmIapId ); } else if ( alwaysAsk == KDestinationSelectionMode ) diff -r e16d72588c28 -r 8a03a285ab14 commondrm/drmutility/src/rdrmhelperclient.cpp --- a/commondrm/drmutility/src/rdrmhelperclient.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/commondrm/drmutility/src/rdrmhelperclient.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -20,8 +20,8 @@ // INCLUDE FILES #include #include -#include "drmhelpercommon.h" -#include "drmhelperserver.h" +#include "DRMHelperCommon.h" +#include "DRMHelperServer.h" #include "rdrmhelperclient.h" // LOCAL CONSTANTS AND MACROS @@ -81,7 +81,7 @@ if ( !error ) { - error = CreateSession( KDRMHelperServerName, + error = CreateSession( KDRMHelperServerName, Version(), KDefaultMessageSlots ); } @@ -96,7 +96,7 @@ // TVersion RDrmHelperClient::Version() const { - return ( TVersion( KDRMHSMajorVersionNumber, + return ( TVersion( KDRMHSMajorVersionNumber, KDRMHSMinorVersionNumber, KDRMHSBuildVersionNumber ) ); } @@ -115,7 +115,7 @@ { TInt ret( KErrNone ); TInt drmHsServiceType( 0 ); - + ret = AutomatedServiceTypeToHs( aServiceType, drmHsServiceType ); if ( ret ) { @@ -130,10 +130,10 @@ // This call waits for the server to complete the request before // proceeding. - return SendReceive( ERegister, - TIpcArgs( aIntent, - drmHsServiceType, - aAutomatedType, + return SendReceive( ERegister, + TIpcArgs( aIntent, + drmHsServiceType, + aAutomatedType, &descriptor ) ); } @@ -151,13 +151,13 @@ { TInt ret( KErrNone ); TInt drmHsServiceType( 0 ); - + ret = AutomatedServiceTypeToHs( aServiceType, drmHsServiceType ); if( ret ) { return ret; } - + // Create descriptor to enable copying data between // client and server. Note: This can be local since // this is a synchronous call. @@ -166,10 +166,10 @@ // This call waits for the server to complete the request before // proceeding. - ret = SendReceive( ERemove, - TIpcArgs( aIntent, - drmHsServiceType, - aAutomatedType, + ret = SendReceive( ERemove, + TIpcArgs( aIntent, + drmHsServiceType, + aAutomatedType, &descriptor ) ); if ( ret == KErrNotFound ) @@ -195,38 +195,38 @@ TPtrC8 descriptor( aUri ); TInt ret( KErrNone ); TInt drmHsServiceType( 0 ); - + ret = AutomatedServiceTypeToHs( aServiceType, drmHsServiceType ); if ( ret ) { return ret; } - + TBool automated( EFalse ); // This call waits for the server to complete the request before // proceeding. - ret = SendReceive( ERemove, - TIpcArgs( aIntent, + ret = SendReceive( ERemove, + TIpcArgs( aIntent, drmHsServiceType, - aAutomatedType, + aAutomatedType, &descriptor ) ); - - ret = IsAutomated( aUri, - aAutomatedType, - aIntent, - aServiceType, + + ret = IsAutomated( aUri, + aAutomatedType, + aIntent, + aServiceType, automated ); - + while ( automated ) { // unregister all - ret = SendReceive( ERemove, - TIpcArgs( aIntent, - drmHsServiceType, - aAutomatedType, + ret = SendReceive( ERemove, + TIpcArgs( aIntent, + drmHsServiceType, + aAutomatedType, &descriptor ) ); - + IsAutomated( aUri, aAutomatedType, aIntent, aServiceType, automated ); } @@ -260,13 +260,13 @@ TPtr8 flag( reinterpret_cast< TUint8* >( &aAutomated ), 0, sizeof( TInt ) ); TInt ret( KErrNone ); TInt drmHsServiceType( 0 ); - + ret = AutomatedServiceTypeToHs( aServiceType, drmHsServiceType ); if ( ret ) { return ret; } - + TInt type( CDRMHelperServer::EActive ); // Create descriptor to enable copying data between @@ -278,18 +278,18 @@ // This call waits for the server to complete the request before // proceeding. ret = SendReceive( EIsRegistered, - TIpcArgs( aIntent, - type, - aAutomatedType, + TIpcArgs( aIntent, + type, + aAutomatedType, &descriptor ) ); if ( !ret ) { type = CDRMHelperServer::EPassive; - + ret = SendReceive( EIsRegistered, - TIpcArgs( aIntent, - type, - aAutomatedType, + TIpcArgs( aIntent, + type, + aAutomatedType, &descriptor ) ); } aAutomated = ret ? ETrue : EFalse; @@ -341,7 +341,7 @@ { TInt result( 0 ); const TUidType serverUid( KNullUid, KNullUid, KServerUid3 ); - + RProcess server; result = server.Create( KDRMHSServerFileName, _L(""), serverUid ); if ( result ) diff -r e16d72588c28 -r 8a03a285ab14 inc/DRMClockClient.h --- a/inc/DRMClockClient.h Fri Mar 12 15:43:46 2010 +0200 +++ b/inc/DRMClockClient.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,8 +22,7 @@ // INCLUDES #include -#include -//#include "DRMClock.h" +#include // CONSTANTS // MACROS @@ -48,79 +47,79 @@ * C++ default constructor. */ IMPORT_C RDRMClockClient(); - - /** + + /** * Destructor. */ IMPORT_C virtual ~RDRMClockClient(); - - /** + + /** * This method opens the connection between the client and the server. * @since 2.5 * @return Error code. KErrNone if the operation is successful. */ IMPORT_C TInt Connect(); - + /** * This function closes the connection between the client and the server. * It is safe to call this method even if connection is not established. * @since S60Rel2.5 - */ + */ IMPORT_C void Close(); - + public: // New functions - + /** * Get the secure time. * @since 2.6 - * @param aTime Output parameter containing the + * @param aTime Output parameter containing the * secure time in UTC. * @param aTimeZone Time zone information including summer/winter time * in +/- 15 minutes * @param aSecurityLevel Output parameter Securiry level. * @return Symbian OS error code if any. */ - IMPORT_C TInt GetSecureTime( TTime& aTime, + IMPORT_C TInt GetSecureTime( TTime& aTime, TInt& aTimeZone, DRMClock::ESecurityLevel& aSecurityLevel ) const; - + /** * Update the secure time. * @since 2.6 - * @param aTime Input parameter containing the + * @param aTime Input parameter containing the * secure time in UTC. * @param aTimeZone Time zone information including summer/winter time - * in +/- 15 minutes + * in +/- 15 minutes * @return Symbian OS error code if any. */ IMPORT_C TInt UpdateSecureTime( const TTime& aTime, const TInt& aTimeZone ); - - + + public: // Functions from base classes - + protected: // New functions - + protected: // Functions from base classes - + private: // Prohibit copy constructor if not deriving from CBase. RDRMClockClient( const RDRMClockClient& ); // Prohibit assigment operator if not deriving from CBase. RDRMClockClient& operator=( const RDRMClockClient& ); - + public: // Data - + protected: // Data - + private: // Data - + public: // Friend classes - + protected: // Friend classes - + private: // Friend classes }; - -#endif // RDRMCLOCKCLIENT_H + +#endif // RDRMCLOCKCLIENT_H // End of File diff -r e16d72588c28 -r 8a03a285ab14 inc/DRMEventTimeChange.h --- a/inc/DRMEventTimeChange.h Fri Mar 12 15:43:46 2010 +0200 +++ b/inc/DRMEventTimeChange.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,8 +22,8 @@ // INCLUDES #include -#include -#include +#include +#include // CONSTANTS @@ -45,7 +45,7 @@ * @since S60Rel2.8 */ -class CDRMEventTimeChange : public MDRMEvent, public CBase +class CDRMEventTimeChange : public MDRMEvent, public CBase { public: // Constructors and destructor @@ -72,10 +72,10 @@ * @since S60Rel3.0 */ IMPORT_C static CDRMEventTimeChange* NewL(); - + /** * Destructor - */ + */ IMPORT_C virtual ~CDRMEventTimeChange(); public: // new functions @@ -96,7 +96,7 @@ /** * GetOldTime * - * Returns what the time was before the time changed + * Returns what the time was before the time changed * * @since S60Rel2.8 */ @@ -117,7 +117,7 @@ /** * GetNewTime * - * Returns what the time is after the time changed + * Returns what the time is after the time changed * * @since S60Rel2.8 */ @@ -161,7 +161,7 @@ /** * GetNewTimeZone * - * Returns what the timezone is after the time changed + * Returns what the timezone is after the time changed * * @since S60Rel2.8 */ @@ -204,7 +204,7 @@ /** * GetNewSecurityLevel * - * Returns what the security level is after the time changed + * Returns what the security level is after the time changed * * @since S60Rel2.8 */ @@ -235,7 +235,7 @@ /** * WriteInt64L - * + * * Writes the 64 bit integer to the stream * * @since 3.0 @@ -248,7 +248,7 @@ /** * ReadInt64L - * + * * Reads the 64 bit integer from the stream * * @since 3.0 @@ -257,10 +257,10 @@ * @return The function leaves with Symbian OS error code if an * error occurs */ - void ReadInt64L( TInt64& aRead, RReadStream& aStream ); + void ReadInt64L( TInt64& aRead, RReadStream& aStream ); private: - + /** * C++ default constructor. */ @@ -270,7 +270,7 @@ * First Phase constructor */ void ConstructL(); - + // Prohibit copy constructor CDRMEventTimeChange( const CDRMEventTimeChange& ); @@ -282,21 +282,21 @@ // The new time after the change TTime iNewTime; - + // The old timezone before the change TInt iOldTimeZone; - + // The new timezone after the change TInt iNewTimeZone; - + // The old security level before the change DRMClock::ESecurityLevel iOldSecurityLevel; - + // The new security level after the change DRMClock::ESecurityLevel iNewSecurityLevel; - + }; #endif // CDRMEVENTTIMECHANGE_H - + // End of File diff -r e16d72588c28 -r 8a03a285ab14 inc/drmserviceapiwrapper.h --- a/inc/drmserviceapiwrapper.h Fri Mar 12 15:43:46 2010 +0200 +++ b/inc/drmserviceapiwrapper.h Mon Mar 15 12:41:43 2010 +0200 @@ -20,7 +20,7 @@ #define CDRMSERVICEAPIWRAPPER_H #include -#include "drmtypes.h" +#include "DRMTypes.h" /** * Environment gate function @@ -37,28 +37,28 @@ * Get the secure time * * @since S60 v3.2 - * @param aTime Output parameter containing the + * @param aTime Output parameter containing the * secure time in UTC. * @param aTimeZone Time zone information including summer/winter time * in +/- 15 minutes * @param aSecurityLevel Output parameter Securiry level. * @return Symbian OS error code if any. */ - virtual TInt GetSecureTime( TTime& aTime, + virtual TInt GetSecureTime( TTime& aTime, TInt& aTimeZone, DRMClock::ESecurityLevel& aSecurityLevel ) const = 0; - + /** * Update the secure time * * Requires DRM Capability * * @since S60 v3.2 - * @param aTime Input parameter containing the + * @param aTime Input parameter containing the * secure time in UTC. - * @param aTimeZone Time zone information including + * @param aTimeZone Time zone information including * summer/winter time - * in +/- 15 minutes + * in +/- 15 minutes * @return Symbian OS error code if any. */ virtual TInt UpdateSecureTime( const TTime& aTime, const TInt& aTimeZone ) = 0; @@ -89,13 +89,13 @@ }; -namespace DRM +namespace DRM { // forward declaration -class CDrmServiceApi; - - +class CDrmServiceApi; + + /** * Class for connecting to the WmDrmServer * @@ -118,28 +118,28 @@ * Get the secure time * * @since S60 v3.2 - * @param aTime Output parameter containing the + * @param aTime Output parameter containing the * secure time in UTC. * @param aTimeZone Time zone information including summer/winter time * in +/- 15 minutes * @param aSecurityLevel Output parameter Securiry level. * @return Symbian OS error code if any. */ - virtual TInt GetSecureTime( TTime& aTime, + virtual TInt GetSecureTime( TTime& aTime, TInt& aTimeZone, DRMClock::ESecurityLevel& aSecurityLevel ) const; - + /** * Update the secure time * * Requires DRM Capability * * @since S60 v3.2 - * @param aTime Input parameter containing the + * @param aTime Input parameter containing the * secure time in UTC. - * @param aTimeZone Time zone information including + * @param aTimeZone Time zone information including * summer/winter time - * in +/- 15 minutes + * in +/- 15 minutes * @return Symbian OS error code if any. */ virtual TInt UpdateSecureTime( const TTime& aTime, const TInt& aTimeZone ); @@ -167,7 +167,7 @@ * @leave Symbian OS error code */ virtual void SignL( const TDesC8& aHash, HBufC8*& aSignature ); - + protected: private: @@ -186,9 +186,9 @@ * Download manager session */ CDrmServiceApi* iServiceApi; - + }; - + } // namespace DRM - + #endif // CDRMSERVICEAPIWRAPPER_H diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/agentv2/inc/DcfCache.h --- a/omadrm/drmengine/agentv2/inc/DcfCache.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/agentv2/inc/DcfCache.h Mon Mar 15 12:41:43 2010 +0200 @@ -21,7 +21,7 @@ #define DCFCACHE_H // INCLUDES -#include +#include #include #include #include diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/agentv2/inc/Oma2AgentAttributes.h --- a/omadrm/drmengine/agentv2/inc/Oma2AgentAttributes.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/agentv2/inc/Oma2AgentAttributes.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,10 +22,10 @@ #include #include -#include -#include +#include +#include #include "Oma2Agent.h" -#include "Oma2Dcf.h" +#include "oma2dcf.h" using namespace ContentAccess; @@ -38,32 +38,32 @@ */ class TOma2AgentAttributes - { + { public: - static TInt GetAttribute( - CDcfCommon& aDcfFile, - TInt aAttribute, - const TVirtualPathPtr& aVirtualPath, - RDRMRightsClient* aRightsClient = NULL); - - static TInt GetAttributeSet( - CDcfCommon& aDcfFile, - RAttributeSet& aAttributeSet, - const TVirtualPathPtr& aVirtualPath, - RDRMRightsClient* aRightsClient = NULL); - - static TInt GetStringAttribute( - CDcfCommon& aDcfFile, - TInt aAttribute, - TDes& aValue, - const TVirtualPathPtr& aVirtualPath, - RDRMRightsClient* aRightsClient = NULL); - - static TInt GetStringAttributeSet( - CDcfCommon& aDcfFile, - RStringAttributeSet& aStringAttributeSet, - const TVirtualPathPtr& aVirtualPath, - RDRMRightsClient* aRightsClient = NULL); - }; + static TInt GetAttribute( + CDcfCommon& aDcfFile, + TInt aAttribute, + const TVirtualPathPtr& aVirtualPath, + RDRMRightsClient* aRightsClient = NULL); + + static TInt GetAttributeSet( + CDcfCommon& aDcfFile, + RAttributeSet& aAttributeSet, + const TVirtualPathPtr& aVirtualPath, + RDRMRightsClient* aRightsClient = NULL); + + static TInt GetStringAttribute( + CDcfCommon& aDcfFile, + TInt aAttribute, + TDes& aValue, + const TVirtualPathPtr& aVirtualPath, + RDRMRightsClient* aRightsClient = NULL); + + static TInt GetStringAttributeSet( + CDcfCommon& aDcfFile, + RStringAttributeSet& aStringAttributeSet, + const TVirtualPathPtr& aVirtualPath, + RDRMRightsClient* aRightsClient = NULL); + }; #endif // __Oma2AGENTATTRIBUTES_H__ diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/agentv2/inc/Oma2AgentContent.h --- a/omadrm/drmengine/agentv2/inc/Oma2AgentContent.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/agentv2/inc/Oma2AgentContent.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,10 +22,11 @@ // INCLUDES #include #include +#include #include -#include -#include -#include +#include +#include +#include // FORWARD DECLARATIONS class CAESDecryptor; @@ -43,117 +44,117 @@ class COma2AgentContent : public CAgentContent, public MDRMEventObserver { public: - static COma2AgentContent* NewL( - const TDesC& aUri, - TContentShareMode aShareMode); - - static COma2AgentContent* NewLC( - const TDesC& aUri, - TContentShareMode aShareMode); - - static COma2AgentContent* NewL( - RFile& aFile); - - static COma2AgentContent* NewLC( - RFile& aFile); + static COma2AgentContent* NewL( + const TDesC& aUri, + TContentShareMode aShareMode); + + static COma2AgentContent* NewLC( + const TDesC& aUri, + TContentShareMode aShareMode); + + static COma2AgentContent* NewL( + RFile& aFile); + + static COma2AgentContent* NewLC( + RFile& aFile); void EmbedDomainRoL(); - - virtual ~COma2AgentContent(); + + virtual ~COma2AgentContent(); + +public: + // From CAgentContent + virtual TInt OpenContainer( + const TDesC& aUniqueId); + + virtual TInt CloseContainer(); + + virtual void GetEmbeddedObjectsL( + RStreamablePtrArray& aArray); + + virtual void GetEmbeddedObjectsL( + RStreamablePtrArray& aArray, + TEmbeddedType aType); + + virtual TInt Search( + RStreamablePtrArray& aArray, + const TDesC8& aMimeType, + TBool aRecursive); + + virtual TInt GetAttribute( + TInt aAttribute, + TInt& aValue, + const TDesC& aUniqueId); + + virtual TInt GetAttributeSet( + RAttributeSet& aAttributeSet, + const TDesC& aUniqueId); + + virtual TInt GetStringAttribute( + TInt aAttribute, + TDes& aValue, + const TDesC& aUniqueId); -public: - // From CAgentContent - virtual TInt OpenContainer( - const TDesC& aUniqueId); - - virtual TInt CloseContainer(); - - virtual void GetEmbeddedObjectsL( - RStreamablePtrArray& aArray); - - virtual void GetEmbeddedObjectsL( - RStreamablePtrArray& aArray, - TEmbeddedType aType); - - virtual TInt Search( - RStreamablePtrArray& aArray, - const TDesC8& aMimeType, - TBool aRecursive); - - virtual TInt GetAttribute( - TInt aAttribute, - TInt& aValue, - const TDesC& aUniqueId); - - virtual TInt GetAttributeSet( - RAttributeSet& aAttributeSet, - const TDesC& aUniqueId); - - virtual TInt GetStringAttribute( - TInt aAttribute, - TDes& aValue, - const TDesC& aUniqueId); - - virtual TInt GetStringAttributeSet( - RStringAttributeSet& aStringAttributeSet, - const TDesC& aUniqueId); - - virtual TInt AgentSpecificCommand( - TInt aCommand, - const TDesC8& aInputBuffer, - TDes8& aOutputBuffer); - - virtual void AgentSpecificCommand( - TInt aCommand, - const TDesC8& aInputBuffer, - TDes8& aOutputBuffer, - TRequestStatus& aStatus); - - virtual void NotifyStatusChange( - TEventMask aMask, - TRequestStatus& aStatus, - const TDesC& aUniqueId); - - virtual TInt CancelNotifyStatusChange( - TRequestStatus& aStatus, - const TDesC& aUniqueId); - - virtual void RequestRights( - TRequestStatus& aStatus, - const TDesC& aUniqueId); - - virtual TInt CancelRequestRights( - TRequestStatus& aStatus, - const TDesC& aUniqueId); - - virtual void DisplayInfoL( - TDisplayInfo aInfo, - const TDesC& aUniqueId); - - virtual TInt SetProperty( - TAgentProperty aProperty, - TInt aValue); + virtual TInt GetStringAttributeSet( + RStringAttributeSet& aStringAttributeSet, + const TDesC& aUniqueId); + + virtual TInt AgentSpecificCommand( + TInt aCommand, + const TDesC8& aInputBuffer, + TDes8& aOutputBuffer); + + virtual void AgentSpecificCommand( + TInt aCommand, + const TDesC8& aInputBuffer, + TDes8& aOutputBuffer, + TRequestStatus& aStatus); + + virtual void NotifyStatusChange( + TEventMask aMask, + TRequestStatus& aStatus, + const TDesC& aUniqueId); + + virtual TInt CancelNotifyStatusChange( + TRequestStatus& aStatus, + const TDesC& aUniqueId); + + virtual void RequestRights( + TRequestStatus& aStatus, + const TDesC& aUniqueId); + + virtual TInt CancelRequestRights( + TRequestStatus& aStatus, + const TDesC& aUniqueId); + + virtual void DisplayInfoL( + TDisplayInfo aInfo, + const TDesC& aUniqueId); + + virtual TInt SetProperty( + TAgentProperty aProperty, + TInt aValue); public: // From MDRMEventObserver virtual void HandleEventL( MDRMEvent* aEvent); - + private: - COma2AgentContent(); + COma2AgentContent(); - void NotifyStatusChangeL( - TEventMask aMask, - TRequestStatus& aStatus, - const TDesC& aUniqueId); + void NotifyStatusChangeL( + TEventMask aMask, + TRequestStatus& aStatus, + const TDesC& aUniqueId); - - void ConstructL( - const TDesC& aUri, - TContentShareMode aShareMode); - - void ConstructL( - RFile& aFile); - + + void ConstructL( + const TDesC& aUri, + TContentShareMode aShareMode); + + void ConstructL( + RFile& aFile); + protected: // Data CDcfCommon* iDcf; RFs iFs; @@ -161,29 +162,29 @@ TInt iFilePosition; TInt iDataPosition; HBufC* iUri; - + // Content ID of the currently open container, // NULL for the outermost file HBufC* iCurrentContainer; - + // Request status for change notifications TRequestStatus* iStatus; - + // Notifier for change notifications CDRMNotifier* iNotifier; - + // Watched events TEventMask iWatchedEvents; - + // Watched content ID HBufC8* iWatchedId; - + // Rights client RDRMRightsClient iRdb; }; } -#endif // OMA2AGENTCONTENT_H - +#endif // OMA2AGENTCONTENT_H + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/agentv2/inc/Oma2AgentData.h --- a/omadrm/drmengine/agentv2/inc/Oma2AgentData.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/agentv2/inc/Oma2AgentData.h Mon Mar 15 12:41:43 2010 +0200 @@ -23,12 +23,13 @@ // INCLUDES #include #include +#include #include -#include -#include +#include +#include //this header can be removed when ASYNC_READ flag is removed -#include "dcfcache.h" +#include "DcfCache.h" // FORWARD DECLARATIONS diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/agentv2/inc/Oma2AgentFactory.h --- a/omadrm/drmengine/agentv2/inc/Oma2AgentFactory.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/agentv2/inc/Oma2AgentFactory.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,11 +22,11 @@ // INCLUDES #include -#include "oma2agentcontent.h" -#include "oma2agentdata.h" -#include "oma2agentmanager.h" -#include "oma2agentrightsmanager.h" -#include "oma2agentimportfile.h" +#include "Oma2AgentContent.h" +#include "Oma2AgentData.h" +#include "Oma2AgentManager.h" +#include "Oma2AgentRightsManager.h" +#include "Oma2AgentImportFile.h" // CONSTANTS //const ?type ?constant_var = ?constant; @@ -60,19 +60,19 @@ class COma2AgentFactory : public CAgentFactory { public: // Constructors and destructor - + /** * Two-phased constructor. */ static COma2AgentFactory* NewL(); - + /** * Destructor. */ virtual ~COma2AgentFactory(); public: // New functions - + /** * ?member_description. * @since Series ?XX ?SeriesXX_version @@ -89,17 +89,17 @@ * @param ?arg1 ?description * @return ?description */ - CAgentContent* CreateContentBrowserL(const TDesC& aURI, TContentShareMode aShareMode); - CAgentContent* CreateContentBrowserL(RFile& aFile); - CAgentData* CreateDataConsumerL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode); - CAgentData* CreateDataConsumerL(RFile& aFile, const TDesC& aUniqueId); - CAgentManager* CreateManagerL(); - CAgentImportFile* CreateImporterL(const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray, const TDesC& aOutputDirectory, const TDesC& aSuggestedFileName); - CAgentImportFile* CreateImporterL(const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray); - CAgentRightsManager* CreateRightsManagerL(); + CAgentContent* CreateContentBrowserL(const TDesC& aURI, TContentShareMode aShareMode); + CAgentContent* CreateContentBrowserL(RFile& aFile); + CAgentData* CreateDataConsumerL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode); + CAgentData* CreateDataConsumerL(RFile& aFile, const TDesC& aUniqueId); + CAgentManager* CreateManagerL(); + CAgentImportFile* CreateImporterL(const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray, const TDesC& aOutputDirectory, const TDesC& aSuggestedFileName); + CAgentImportFile* CreateImporterL(const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray); + CAgentRightsManager* CreateRightsManagerL(); protected: // New functions - + /** * ?member_description. * @since Series ?XX ?SeriesXX_version @@ -109,7 +109,7 @@ //?type ?member_function( ?type ?arg1 ); protected: // Functions from base classes - + /** * From ?base_class ?member_description */ @@ -135,7 +135,7 @@ public: // Data // ?one_line_short_description_of_data //?data_declaration; - + protected: // Data // ?one_line_short_description_of_data //?data_declaration; @@ -143,7 +143,7 @@ private: // Data // ?one_line_short_description_of_data //?data_declaration; - + // Reserved pointer for future extension //TAny* iReserved; @@ -158,6 +158,6 @@ } -#endif // OMA2AGENTFACTORY_H - +#endif // OMA2AGENTFACTORY_H + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/agentv2/inc/Oma2AgentImportFile.h --- a/omadrm/drmengine/agentv2/inc/Oma2AgentImportFile.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/agentv2/inc/Oma2AgentImportFile.h Mon Mar 15 12:41:43 2010 +0200 @@ -21,7 +21,7 @@ #include #include -#include +#include using namespace ContentAccess; @@ -47,11 +47,11 @@ const CMetaDataArray& aMetaDataArray, const TDesC& aOutputDirectory, const TDesC& aSuggestedFileName); - + static COma2AgentImportFile* NewL( const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray); - + virtual ~COma2AgentImportFile(); public: @@ -59,59 +59,59 @@ // From CAgentImportFile virtual TInt WriteData( const TDesC8& aData); - + virtual void WriteData( const TDesC8& aData, TRequestStatus& aStatus); - + virtual TInt WriteDataComplete(); - + virtual void WriteDataComplete( TRequestStatus& aStatus); - + virtual TInt OutputFileCountL() const; - + virtual CSupplierOutputFile& OutputFileL( TInt aIndex); - + virtual TImportStatus GetImportStatus() const; - + virtual TInt GetSuggestedOutputFileExtension( TDes& aFileExtension); - + virtual TInt GetSuggestedOutputFileName( TDes& aFileName); - + virtual TInt ContinueWithNewOutputFile( - RFile& aFile, + RFile& aFile, const TDesC& aFileName); - + virtual void ContinueWithNewOutputFile( - RFile& aFile, - const TDesC& aFileName, + RFile& aFile, + const TDesC& aFileName, TRequestStatus& aStatus); - + virtual void NewMimePartL( - const TDesC8& aMimeType, + const TDesC8& aMimeType, const CMetaDataArray& aImportMetaData); - + virtual void EndMimePartL(); private: COma2AgentImportFile( TBool aAgentCreatesOutputFiles); - + void ConstructL( - const TDesC8& aMimeType, - const CMetaDataArray& aMetaDataArray, - const TDesC& aOutputDirectory, + const TDesC8& aMimeType, + const CMetaDataArray& aMetaDataArray, + const TDesC& aOutputDirectory, const TDesC& aSuggestedFileName); - + TInt OpenOutputFile(); - + void WriteDataL(const TDesC8& aData); - + private: TImportType iImportType; @@ -130,5 +130,5 @@ CDRMRights* iDcfRights; HBufC8* iDcfMimeType; }; - + #endif // __OMA2AGENTIMPORTFILE_H__ diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/agentv2/inc/Oma2AgentManager.h --- a/omadrm/drmengine/agentv2/inc/Oma2AgentManager.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/agentv2/inc/Oma2AgentManager.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,8 +22,9 @@ // INCLUDES #include +#include #include -#include +#include class CFileMan; @@ -35,20 +36,20 @@ class COma2AgentManager : public CAgentManager, public MDRMEventObserver { public: // Constructors and destructor - + /** * Two-phased constructor. */ static COma2AgentManager* NewL(); static COma2AgentManager* NewLC(); - + /** * Destructor. */ ~COma2AgentManager(); public: // New functions - + /** * ?member_description. * @since Series ?XX ?SeriesXX_version @@ -66,48 +67,48 @@ * @return ?description */ - // From CAgentManagerBase - TInt DeleteFile(const TDesC &aFileName); - TInt CopyFile(const TDesC& aSource, const TDesC& aDestination); - TInt CopyFile(RFile& aSource, const TDesC& aDestination); - TInt RenameFile(const TDesC& aSource, const TDesC& aDestination); - TInt MkDir(const TDesC& aPath); - TInt MkDirAll(const TDesC& aPath); - TInt RmDir(const TDesC& aPath); - TInt GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey, CDir*& anEntryList) const; - TInt GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey, CDir*& anEntryList,CDir*& aDirList) const; - TInt GetDir(const TDesC& aName,const TUidType& anEntryUid,TUint anEntrySortKey, CDir*& aFileList) const; - TInt GetAttribute(TInt aAttribute, TInt& aValue, const TVirtualPathPtr& aVirtualPath); - TInt GetAttributeSet(RAttributeSet& aAttributeSet, const TVirtualPathPtr& aVirtualPath); - TInt GetStringAttributeSet(RStringAttributeSet& aAttributeSet, const TVirtualPathPtr& aVirtualPath); - TInt GetStringAttribute(TInt aAttribute, TDes& aValue, const TVirtualPathPtr& aVirtualPath); - void NotifyStatusChange(const TDesC& aURI, TEventMask aMask, TRequestStatus& aStatus); - TInt CancelNotifyStatusChange(const TDesC& aURI, TRequestStatus& aStatus); - TInt SetProperty(TAgentProperty aProperty, TInt aValue); - void DisplayInfoL(TDisplayInfo aInfo, const TVirtualPathPtr& aVirtualPath); - - // From CAgentManager - TBool IsRecognizedL(const TDesC& aURI, TContentShareMode aShareMode) const; - TBool IsRecognizedL(RFile& aFile) const; - TBool RecognizeFileL(const TDesC& aFileName, const TDesC8& aBuffer, TDes8& aFileMimeType, TDes8& aContentMimeType) const; - TInt AgentSpecificCommand(TInt aCommand, const TDesC8& aInputBuffer, TDes8& aOutputBuffer); - void AgentSpecificCommand(TInt aCommand, const TDesC8& aInputBuffer, TDes8& aOutputBuffer, TRequestStatus& aStatus); + // From CAgentManagerBase + TInt DeleteFile(const TDesC &aFileName); + TInt CopyFile(const TDesC& aSource, const TDesC& aDestination); + TInt CopyFile(RFile& aSource, const TDesC& aDestination); + TInt RenameFile(const TDesC& aSource, const TDesC& aDestination); + TInt MkDir(const TDesC& aPath); + TInt MkDirAll(const TDesC& aPath); + TInt RmDir(const TDesC& aPath); + TInt GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey, CDir*& anEntryList) const; + TInt GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey, CDir*& anEntryList,CDir*& aDirList) const; + TInt GetDir(const TDesC& aName,const TUidType& anEntryUid,TUint anEntrySortKey, CDir*& aFileList) const; + TInt GetAttribute(TInt aAttribute, TInt& aValue, const TVirtualPathPtr& aVirtualPath); + TInt GetAttributeSet(RAttributeSet& aAttributeSet, const TVirtualPathPtr& aVirtualPath); + TInt GetStringAttributeSet(RStringAttributeSet& aAttributeSet, const TVirtualPathPtr& aVirtualPath); + TInt GetStringAttribute(TInt aAttribute, TDes& aValue, const TVirtualPathPtr& aVirtualPath); + void NotifyStatusChange(const TDesC& aURI, TEventMask aMask, TRequestStatus& aStatus); + TInt CancelNotifyStatusChange(const TDesC& aURI, TRequestStatus& aStatus); + TInt SetProperty(TAgentProperty aProperty, TInt aValue); + void DisplayInfoL(TDisplayInfo aInfo, const TVirtualPathPtr& aVirtualPath); + + // From CAgentManager + TBool IsRecognizedL(const TDesC& aURI, TContentShareMode aShareMode) const; + TBool IsRecognizedL(RFile& aFile) const; + TBool RecognizeFileL(const TDesC& aFileName, const TDesC8& aBuffer, TDes8& aFileMimeType, TDes8& aContentMimeType) const; + TInt AgentSpecificCommand(TInt aCommand, const TDesC8& aInputBuffer, TDes8& aOutputBuffer); + void AgentSpecificCommand(TInt aCommand, const TDesC8& aInputBuffer, TDes8& aOutputBuffer, TRequestStatus& aStatus); void PrepareHTTPRequestHeaders(RStringPool& aStringPool, RHTTPHeaders& aRequestHeaders) const; - void DisplayManagementInfoL(); - + void DisplayManagementInfoL(); + public: // From MDRMEventObserver virtual void HandleEventL( MDRMEvent* aEvent); - - private: - RFs iFs; - + + private: + RFs iFs; + // File manager CFileMan* iFileManager; - + // Oma based extensions HBufC8* iOmaBasedMimeType; - + private: /** @@ -119,27 +120,27 @@ * By default Symbian 2nd phase constructor is private. */ void ConstructL(); - + void FetchOmaBasedInfoL(); void PrepareHTTPRequestHeadersL(RStringPool& aStringPool, RHTTPHeaders& aRequestHeaders) const; - + protected: // Data // Request status for change notifications TRequestStatus* iStatus; - + // Notifier for change notifications CDRMNotifier* iNotifier; - + // Watched events TEventMask iWatchedEvents; - + // Watched content ID HBufC8* iWatchedId; }; } -#endif // OMA2AGENTMANAGER_H - +#endif // OMA2AGENTMANAGER_H + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/agentv2/src/DcfCache.cpp --- a/omadrm/drmengine/agentv2/src/DcfCache.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/agentv2/src/DcfCache.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -22,7 +22,7 @@ #include #include "DcfCache.h" #include "DcfCommon.h" -#include "DrmRightsClient.h" +#include "DRMRightsClient.h" // ============================ MEMBER FUNCTIONS =============================== diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/agentv2/src/Oma2Agent.cpp --- a/omadrm/drmengine/agentv2/src/Oma2Agent.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/agentv2/src/Oma2Agent.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,29 +19,29 @@ // INCLUDE FILES #include #include -#include "oma2agentfactory.h" +#include "Oma2AgentFactory.h" // EXTERNAL DATA STRUCTURES //extern ?external_data; -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES //extern ?external_function( ?arg_type,?arg_type ); // CONSTANTS /** Implementation table is required by ECom. Allows alternative - New methods to be specified. + New methods to be specified. */ const TImplementationProxy ImplementationTable[] = - { + { #ifdef __EABI__ - IMPLEMENTATION_PROXY_ENTRY(0x101F6DB4, + IMPLEMENTATION_PROXY_ENTRY(0x101F6DB4, ContentAccess::COma2AgentFactory::NewL) #else - { {0x101F6DB4}, ContentAccess::COma2AgentFactory::NewL} + { {0x101F6DB4}, ContentAccess::COma2AgentFactory::NewL} #endif - }; + }; // MACROS @@ -69,10 +69,10 @@ // ----------------------------------------------------------------------------- // EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - return ImplementationTable; - } + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } -// End of File +// End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/agentv2/src/Oma2AgentAttributes.cpp --- a/omadrm/drmengine/agentv2/src/Oma2AgentAttributes.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/agentv2/src/Oma2AgentAttributes.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -22,18 +22,19 @@ #include #include +#include #include #include #include #include #include #include -#include "oma2agent.h" -#include "oma2agentattributes.h" -#include "oma1dcf.h" +#include "Oma2Agent.h" +#include "Oma2AgentAttributes.h" +#include "Oma1Dcf.h" #include "oma2dcf.h" -#include "drmrightsclient.h" -#include "DrmProtectedRoParser.h" +#include "DRMRightsClient.h" +#include "DRMProtectedRoParser.h" using namespace ContentAccess; diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/agentv2/src/Oma2AgentContent.cpp --- a/omadrm/drmengine/agentv2/src/Oma2AgentContent.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/agentv2/src/Oma2AgentContent.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,6 +19,7 @@ // INCLUDE FILES #include +#include #include #include #include @@ -28,14 +29,14 @@ #include -#include "oma2agentcontent.h" -#include "oma2agentattributes.h" -#include "oma1dcf.h" +#include "Oma2AgentContent.h" +#include "Oma2AgentAttributes.h" +#include "Oma1Dcf.h" #include "oma2dcf.h" #include "symmetric.h" -#include "DrmRights.h" +#include "DRMRights.h" #include "Oma2DcfPartInfo.h" -#include "DrmProtectedRoParser.h" +#include "DRMProtectedRoParser.h" using namespace ContentAccess; @@ -546,7 +547,7 @@ // COma2AgentContent::NotifyStatusChange // // ----------------------------------------------------------------------------- -// +// void COma2AgentContent::NotifyStatusChange( TEventMask aEventMask, TRequestStatus& aStatus, diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/agentv2/src/Oma2AgentData.cpp --- a/omadrm/drmengine/agentv2/src/Oma2AgentData.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/agentv2/src/Oma2AgentData.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -17,18 +17,19 @@ // INCLUDE FILES #include +#include #include #include #include -#include "drmcommon.h" -#include "oma2agentdata.h" -#include "oma2agentattributes.h" -#include "oma1dcf.h" +#include "DRMCommon.h" +#include "Oma2AgentData.h" +#include "Oma2AgentAttributes.h" +#include "Oma1Dcf.h" #include "oma2dcf.h" #include "symmetric.h" -#include "drmrightsclient.h" -#include "drmprotectedroparser.h" -#include "dcfcache.h" +#include "DRMRightsClient.h" +#include "DRMProtectedRoParser.h" +#include "DcfCache.h" #include "cleanupresetanddestroy.h" using namespace ContentAccess; diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/agentv2/src/Oma2AgentFactory.cpp --- a/omadrm/drmengine/agentv2/src/Oma2AgentFactory.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/agentv2/src/Oma2AgentFactory.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,14 +19,15 @@ // INCLUDE FILES #include -#include "oma2agentfactory.h" +#include +#include "Oma2AgentFactory.h" using namespace ContentAccess; // EXTERNAL DATA STRUCTURES //extern ?external_data; -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES //extern ?external_function( ?arg_type,?arg_type ); // CONSTANTS @@ -101,7 +102,7 @@ COma2AgentFactory* COma2AgentFactory::NewL() { COma2AgentFactory* self = new( ELeave ) COma2AgentFactory; - + CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop(); @@ -109,7 +110,7 @@ return self; } - + // Destructor COma2AgentFactory::~COma2AgentFactory() { @@ -123,42 +124,42 @@ // ----------------------------------------------------------------------------- // CAgentContent* COma2AgentFactory::CreateContentBrowserL(const TDesC& aURI, TContentShareMode aShareMode) - { - return COma2AgentContent::NewL(aURI, aShareMode); - } + { + return COma2AgentContent::NewL(aURI, aShareMode); + } CAgentContent* COma2AgentFactory::CreateContentBrowserL(RFile& aFile) - { - return COma2AgentContent::NewL(aFile); - } + { + return COma2AgentContent::NewL(aFile); + } CAgentData* COma2AgentFactory::CreateDataConsumerL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode) - { - return COma2AgentData::NewL(aVirtualPath, aShareMode); - } + { + return COma2AgentData::NewL(aVirtualPath, aShareMode); + } CAgentData* COma2AgentFactory::CreateDataConsumerL(RFile& aFile, const TDesC& aUniqueId) - { - return COma2AgentData::NewL(aFile, aUniqueId); - } + { + return COma2AgentData::NewL(aFile, aUniqueId); + } CAgentManager* COma2AgentFactory::CreateManagerL() - { - return COma2AgentManager::NewL(); - } + { + return COma2AgentManager::NewL(); + } CAgentImportFile* COma2AgentFactory::CreateImporterL(const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray, const TDesC& aOutputDirectory, const TDesC& aSuggestedFileName) - { - return COma2AgentImportFile::NewL(aMimeType, aMetaDataArray, aOutputDirectory, aSuggestedFileName); - } + { + return COma2AgentImportFile::NewL(aMimeType, aMetaDataArray, aOutputDirectory, aSuggestedFileName); + } CAgentImportFile* COma2AgentFactory::CreateImporterL(const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray) - { - return COma2AgentImportFile::NewL(aMimeType, aMetaDataArray); - } + { + return COma2AgentImportFile::NewL(aMimeType, aMetaDataArray); + } CAgentRightsManager* COma2AgentFactory::CreateRightsManagerL() - { - return COma2AgentRightsManager::NewL(); - } + { + return COma2AgentRightsManager::NewL(); + } diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/agentv2/src/Oma2AgentImportFile.cpp --- a/omadrm/drmengine/agentv2/src/Oma2AgentImportFile.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/agentv2/src/Oma2AgentImportFile.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -21,16 +21,17 @@ #include #include #include +#include #include -#include +#include #include "Oma2Agent.h" -#include "Oma2AgentImportfile.h" +#include "Oma2AgentImportFile.h" #include "DcfCommon.h" -#include "DrmRights.h" -#include "DrmMessageParser.h" +#include "DRMRights.h" +#include "DRMMessageParser.h" #include "Oma1DcfCreator.h" #include "DrmRightsParser.h" -#include "DrmProtectedRoParser.h" +#include "DRMProtectedRoParser.h" using namespace ContentAccess; @@ -59,7 +60,7 @@ // ----------------------------------------------------------------------------- // COma2AgentImportFile:: -// +// // ----------------------------------------------------------------------------- // COma2AgentImportFile* COma2AgentImportFile::NewL( @@ -67,34 +68,34 @@ const CMetaDataArray& aMetaDataArray, const TDesC& aOutputDirectory, const TDesC& aSuggestedFileName) - { - COma2AgentImportFile* self=new(ELeave) COma2AgentImportFile(EFalse); - CleanupStack::PushL(self); - self->ConstructL(aMimeType, aMetaDataArray, aOutputDirectory, - aSuggestedFileName); - CleanupStack::Pop(self); - return self; - } + { + COma2AgentImportFile* self=new(ELeave) COma2AgentImportFile(EFalse); + CleanupStack::PushL(self); + self->ConstructL(aMimeType, aMetaDataArray, aOutputDirectory, + aSuggestedFileName); + CleanupStack::Pop(self); + return self; + } // ----------------------------------------------------------------------------- // COma2AgentImportFile:: -// +// // ----------------------------------------------------------------------------- // COma2AgentImportFile* COma2AgentImportFile::NewL( const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray) - { - COma2AgentImportFile* self=new(ELeave) COma2AgentImportFile(EFalse); - CleanupStack::PushL(self); - self->ConstructL(aMimeType, aMetaDataArray, KNullDesC(), KNullDesC()); - CleanupStack::Pop(self); - return self; - } - + { + COma2AgentImportFile* self=new(ELeave) COma2AgentImportFile(EFalse); + CleanupStack::PushL(self); + self->ConstructL(aMimeType, aMetaDataArray, KNullDesC(), KNullDesC()); + CleanupStack::Pop(self); + return self; + } + // ----------------------------------------------------------------------------- // COma2AgentImportFile:: -// +// // ----------------------------------------------------------------------------- // COma2AgentImportFile::COma2AgentImportFile( @@ -108,38 +109,38 @@ iDcfCreator(NULL), iDcfRights(NULL), iDcfMimeType(NULL) - { - iImportStatus = EInProgress; - } + { + iImportStatus = EInProgress; + } // ----------------------------------------------------------------------------- // COma2AgentImportFile:: -// +// // ----------------------------------------------------------------------------- // COma2AgentImportFile::~COma2AgentImportFile() - { - if (iFileOpen) - { - iFile.Close(); - iFileOpen = EFalse; - } - iFs.Close(); - delete iOutputDirectory; - delete iSuggestedFileName; + { + if (iFileOpen) + { + iFile.Close(); + iFileOpen = EFalse; + } + iFs.Close(); + delete iOutputDirectory; + delete iSuggestedFileName; delete iOutputFileName; - delete iLastWriteData; - iOutputFiles.ResetAndDestroy(); - iOutputFiles.Close(); - delete iMessageParser; - delete iDcfCreator; - delete iDcfRights; - delete iDcfMimeType; - } - + delete iLastWriteData; + iOutputFiles.ResetAndDestroy(); + iOutputFiles.Close(); + delete iMessageParser; + delete iDcfCreator; + delete iDcfRights; + delete iDcfMimeType; + } + // ----------------------------------------------------------------------------- // COma2AgentImportFile:: -// +// // ----------------------------------------------------------------------------- // void COma2AgentImportFile::ConstructL( @@ -147,129 +148,129 @@ const CMetaDataArray& aMetaDataArray, const TDesC& aOutputDirectory, const TDesC& aSuggestedFileName) - { - RMemReadStream rights; - - if (aMimeType.CompareF(KOma1DrmMessageContentType) == 0 || - aMimeType.CompareF(KOmaImportContentType) == 0) - { - if (aMimeType.CompareF(KOma1DrmMessageContentType) == 0) - { + { + RMemReadStream rights; + + if (aMimeType.CompareF(KOma1DrmMessageContentType) == 0 || + aMimeType.CompareF(KOmaImportContentType) == 0) + { + if (aMimeType.CompareF(KOma1DrmMessageContentType) == 0) + { iMessageParser = CDRMMessageParser::NewL(); - iImportType = EOma1DrmMessage; - } - else - { - iDcfCreator = COma1DcfCreator::NewL(); - iImportType = EPlainContent; + iImportType = EOma1DrmMessage; + } + else + { + iDcfCreator = COma1DcfCreator::NewL(); + iImportType = EPlainContent; const TDesC8& mimeDes = aMetaDataArray.SearchL( KOmaImportMimeTypeField); if (mimeDes.Length() == 0) { User::Leave(KErrArgument); } - iDcfMimeType = mimeDes.AllocL(); - const TDesC8& rightsDes = aMetaDataArray.SearchL( - KOmaImportRightsField); + iDcfMimeType = mimeDes.AllocL(); + const TDesC8& rightsDes = aMetaDataArray.SearchL( + KOmaImportRightsField); if (rightsDes.Length() > 0) - { - rights.Open(rightsDes.Ptr(), rightsDes.Length()); - CleanupClosePushL(rights); - iDcfRights = CDRMRights::NewL(); - iDcfRights->InternalizeL(rights); - CleanupStack::PopAndDestroy(); // rights - } - } - iOutputDirectory = aOutputDirectory.AllocL(); - iSuggestedFileName = aSuggestedFileName.AllocL(); - iOutputFileName = HBufC::NewL(iOutputDirectory->Des().Length() + + { + rights.Open(rightsDes.Ptr(), rightsDes.Length()); + CleanupClosePushL(rights); + iDcfRights = CDRMRights::NewL(); + iDcfRights->InternalizeL(rights); + CleanupStack::PopAndDestroy(); // rights + } + } + iOutputDirectory = aOutputDirectory.AllocL(); + iSuggestedFileName = aSuggestedFileName.AllocL(); + iOutputFileName = HBufC::NewL(iOutputDirectory->Des().Length() + iSuggestedFileName->Des().Length()); - iAgentCreatesOutputFiles = ETrue; - } + iAgentCreatesOutputFiles = ETrue; + } else if (aMimeType.CompareF(KOma1XmlRoContentType) == 0) - { - iImportType = EOma1XmlRo; - } + { + iImportType = EOma1XmlRo; + } else if (aMimeType.CompareF(KOma1WbxmlRoContentType) == 0) - { - iImportType = EOma1WbxmlRo; - } + { + iImportType = EOma1WbxmlRo; + } else if (aMimeType.CompareF(KOma2RoContentType) == 0) - { - iImportType = EOma2Ro; - } + { + iImportType = EOma2Ro; + } else { - User::Leave(KErrCANotSupported); - } - User::LeaveIfError(iFs.Connect()); - User::LeaveIfError(iFs.ShareAuto()); - } + User::Leave(KErrCANotSupported); + } + User::LeaveIfError(iFs.Connect()); + User::LeaveIfError(iFs.ShareAuto()); + } // ----------------------------------------------------------------------------- // COma2AgentImportFile:: -// +// // ----------------------------------------------------------------------------- // TInt COma2AgentImportFile::OpenOutputFile() - { - TInt r = KErrNone; - TPtr fileNamePtr = iOutputFileName->Des(); - - fileNamePtr.Copy(*iOutputDirectory); - fileNamePtr.Append(*iSuggestedFileName); + { + TInt r = KErrNone; + TPtr fileNamePtr = iOutputFileName->Des(); + + fileNamePtr.Copy(*iOutputDirectory); + fileNamePtr.Append(*iSuggestedFileName); - r = iFile.Create(iFs, fileNamePtr, EFileShareAny | EFileStream | - EFileWrite); - if (r == KErrNone) - { - iFileOpen = ETrue; - if (iImportType == EOma1DrmMessage) - { - TRAP(r, iMessageParser->InitializeMessageParserL(iFile)); - } - else - { - TRAP(r, iDcfCreator->EncryptInitializeL(iFile, *iDcfMimeType, - iDcfRights)); - } - } + r = iFile.Create(iFs, fileNamePtr, EFileShareAny | EFileStream | + EFileWrite); + if (r == KErrNone) + { + iFileOpen = ETrue; + if (iImportType == EOma1DrmMessage) + { + TRAP(r, iMessageParser->InitializeMessageParserL(iFile)); + } + else + { + TRAP(r, iDcfCreator->EncryptInitializeL(iFile, *iDcfMimeType, + iDcfRights)); + } + } else { r = KErrCANewFileHandleRequired; } return r; - } + } // ----------------------------------------------------------------------------- // COma2AgentImportFile:: -// +// // ----------------------------------------------------------------------------- // void COma2AgentImportFile::WriteDataL(const TDesC8& aData) { - CDrmRightsParser* oma1Parser = NULL; - CDrmProtectedRoParser* oma2Parser = NULL; - RPointerArray rights; + CDrmRightsParser* oma1Parser = NULL; + CDrmProtectedRoParser* oma2Parser = NULL; + RPointerArray rights; TCleanupItem listCleanup(PointerArrayResetDestroyAndClose, &rights); - TInt r; - + TInt r; + switch (iImportType) { case EOma1DrmMessage: - if (!iFileOpen) - { - r = OpenOutputFile(); - if (r == KErrNone) - { + if (!iFileOpen) + { + r = OpenOutputFile(); + if (r == KErrNone) + { iMessageParser->ProcessMessageDataL(aData); - } - else - { + } + else + { iLastWriteData = aData.AllocL(); User::Leave(r); - } + } } else { @@ -277,18 +278,18 @@ } break; case EPlainContent: - if (!iFileOpen) - { - r = OpenOutputFile(); - if (r == KErrNone) - { + if (!iFileOpen) + { + r = OpenOutputFile(); + if (r == KErrNone) + { iDcfCreator->EncryptUpdateL(aData); - } - else - { + } + else + { iLastWriteData = aData.AllocL(); User::Leave(r); - } + } } else { @@ -314,231 +315,231 @@ break; } } - + // ----------------------------------------------------------------------------- // COma2AgentImportFile:: -// +// // ----------------------------------------------------------------------------- // TInt COma2AgentImportFile::WriteData(const TDesC8& aData) - { - TInt r = KErrNone; - TRAP(r, WriteDataL(aData)); - return r; - } + { + TInt r = KErrNone; + TRAP(r, WriteDataL(aData)); + return r; + } // ----------------------------------------------------------------------------- // COma2AgentImportFile:: -// +// // ----------------------------------------------------------------------------- // TInt COma2AgentImportFile::WriteDataComplete() - { - TInt r = KErrNone; - CSupplierOutputFile *temp = NULL; - TPtrC8 type(NULL, 0); - - if (iFileOpen) - { - if (iImportType == EOma1DrmMessage) - { - TRAP(r, iMessageParser->FinalizeMessageParserL()); - } - else - { - TRAP(r, iDcfCreator->EncryptFinalizeL()); - } - iFile.Close(); - iFileOpen = EFalse; - } - if( r ) - { - return r; + { + TInt r = KErrNone; + CSupplierOutputFile *temp = NULL; + TPtrC8 type(NULL, 0); + + if (iFileOpen) + { + if (iImportType == EOma1DrmMessage) + { + TRAP(r, iMessageParser->FinalizeMessageParserL()); + } + else + { + TRAP(r, iDcfCreator->EncryptFinalizeL()); + } + iFile.Close(); + iFileOpen = EFalse; + } + if( r ) + { + return r; } - if (iOutputFileName) - { - switch (iImportType) - { - case EPlainContent: + if (iOutputFileName) + { + switch (iImportType) + { + case EPlainContent: case EOma1DrmMessage: type.Set(KOma1DcfContentType()); break; default: return KErrGeneral;; - } - TRAP(r, temp = CSupplierOutputFile::NewL(iOutputFileName->Des(), - EContent, type)); - if (r == KErrNone) - { - r = iOutputFiles.Append(temp); - if (r != KErrNone) - { - delete temp; - } - } - } - return r; - } - + } + TRAP(r, temp = CSupplierOutputFile::NewL(iOutputFileName->Des(), + EContent, type)); + if (r == KErrNone) + { + r = iOutputFiles.Append(temp); + if (r != KErrNone) + { + delete temp; + } + } + } + return r; + } + // ----------------------------------------------------------------------------- // COma2AgentImportFile:: -// +// // ----------------------------------------------------------------------------- // void COma2AgentImportFile::WriteData( const TDesC8& aData, TRequestStatus &aStatus) - { - TRequestStatus *ptr = &aStatus; - TInt r = WriteData(aData); - User::RequestComplete(ptr,r); - } + { + TRequestStatus *ptr = &aStatus; + TInt r = WriteData(aData); + User::RequestComplete(ptr,r); + } // ----------------------------------------------------------------------------- // COma2AgentImportFile:: -// +// // ----------------------------------------------------------------------------- // void COma2AgentImportFile::WriteDataComplete( TRequestStatus &aStatus) - { - TRequestStatus *ptr = &aStatus; - TInt r = WriteDataComplete(); - User::RequestComplete(ptr,r); - } - + { + TRequestStatus *ptr = &aStatus; + TInt r = WriteDataComplete(); + User::RequestComplete(ptr,r); + } + // ----------------------------------------------------------------------------- // COma2AgentImportFile:: -// +// // ----------------------------------------------------------------------------- // TInt COma2AgentImportFile::OutputFileCountL() const - { - return iOutputFiles.Count(); - } + { + return iOutputFiles.Count(); + } // ----------------------------------------------------------------------------- // COma2AgentImportFile:: -// +// // ----------------------------------------------------------------------------- // CSupplierOutputFile& COma2AgentImportFile::OutputFileL( TInt aIndex) - { - return *iOutputFiles[aIndex]; - } + { + return *iOutputFiles[aIndex]; + } // ----------------------------------------------------------------------------- // COma2AgentImportFile:: -// +// // ----------------------------------------------------------------------------- // TImportStatus COma2AgentImportFile::GetImportStatus() const - { - return iImportStatus; - } + { + return iImportStatus; + } // ----------------------------------------------------------------------------- // COma2AgentImportFile:: -// +// // ----------------------------------------------------------------------------- // TInt COma2AgentImportFile::GetSuggestedOutputFileExtension( TDes& aFileExtension) - { - aFileExtension.Copy(_L(".dcf")); - return KErrNone; - } + { + aFileExtension.Copy(_L(".dcf")); + return KErrNone; + } // ----------------------------------------------------------------------------- // COma2AgentImportFile:: -// +// // ----------------------------------------------------------------------------- // TInt COma2AgentImportFile::GetSuggestedOutputFileName( TDes& aFileName) - { - aFileName.Append(_L(".dcf")); - return KErrNone; - } + { + aFileName.Append(_L(".dcf")); + return KErrNone; + } // ----------------------------------------------------------------------------- // COma2AgentImportFile:: -// +// // ----------------------------------------------------------------------------- // TInt COma2AgentImportFile::ContinueWithNewOutputFile( RFile& aFile, const TDesC& aFileName) - { - RFile file; - TInt r = KErrNone; + { + RFile file; + TInt r = KErrNone; - if (iOutputFileName != NULL) - { - delete iOutputFileName; - iOutputFileName = NULL; - } - TRAP(r, iOutputFileName = aFileName.AllocL()); - if (r == KErrNone) - { - file.Duplicate(aFile); + if (iOutputFileName != NULL) + { + delete iOutputFileName; + iOutputFileName = NULL; + } + TRAP(r, iOutputFileName = aFileName.AllocL()); + if (r == KErrNone) + { + file.Duplicate(aFile); iFile.Attach(file); iFileOpen = ETrue; - if (iImportType == EOma1DrmMessage) - { - TRAP(r, iMessageParser->InitializeMessageParserL(iFile)); - } - else - { - TRAP(r, iDcfCreator->EncryptInitializeL(iFile, *iDcfMimeType, - iDcfRights)); - } + if (iImportType == EOma1DrmMessage) + { + TRAP(r, iMessageParser->InitializeMessageParserL(iFile)); + } + else + { + TRAP(r, iDcfCreator->EncryptInitializeL(iFile, *iDcfMimeType, + iDcfRights)); + } if (r == KErrNone) { r = WriteData(*iLastWriteData); } delete iLastWriteData; iLastWriteData = NULL; - } - return r; - } + } + return r; + } // ----------------------------------------------------------------------------- // COma2AgentImportFile:: -// +// // ----------------------------------------------------------------------------- // void COma2AgentImportFile::ContinueWithNewOutputFile( RFile& aFile, const TDesC& aFileName, TRequestStatus& aStatus) - { - TRequestStatus *ptr = &aStatus; - TInt r = ContinueWithNewOutputFile(aFile, aFileName); - User::RequestComplete(ptr,r); - } + { + TRequestStatus *ptr = &aStatus; + TInt r = ContinueWithNewOutputFile(aFile, aFileName); + User::RequestComplete(ptr,r); + } // ----------------------------------------------------------------------------- // COma2AgentImportFile:: -// +// // ----------------------------------------------------------------------------- // void COma2AgentImportFile::NewMimePartL( const TDesC8& /*aMimeType*/, const CMetaDataArray& /*aImportMetaData*/) - { - User::Leave(KErrCANotSupported); - } + { + User::Leave(KErrCANotSupported); + } // ----------------------------------------------------------------------------- // COma2AgentImportFile:: -// +// // ----------------------------------------------------------------------------- // void COma2AgentImportFile::EndMimePartL() - { - User::Leave(KErrCANotSupported); - } + { + User::Leave(KErrCANotSupported); + } // End of file diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/agentv2/src/Oma2AgentManager.cpp --- a/omadrm/drmengine/agentv2/src/Oma2AgentManager.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/agentv2/src/Oma2AgentManager.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -18,6 +18,7 @@ // INCLUDE FILES #include +#include #include #include #include @@ -32,13 +33,13 @@ #include #include -#include "oma2agentmanager.h" -#include "oma2agentattributes.h" -#include "oma1dcf.h" +#include "Oma2AgentManager.h" +#include "Oma2AgentAttributes.h" +#include "Oma1Dcf.h" #include "oma2dcf.h" -#include "drmrightsclient.h" +#include "DRMRightsClient.h" -#include "drmutilityinternalcrkeys.h" // Cenrep extension for OmaBased +#include "DrmUtilityInternalcrkeys.h" // Cenrep extension for OmaBased using namespace ContentAccess; @@ -117,9 +118,9 @@ User::LeaveIfError(iFs.Connect()); User::LeaveIfError(iFs.ShareAuto()); iFileManager = CFileMan::NewL(iFs); - + TInt err( KErrNone ); - + TRAP(err, FetchOmaBasedInfoL() ); if( err) { @@ -129,7 +130,7 @@ } iOmaBasedMimeType = NULL; } - + } // ----------------------------------------------------------------------------- @@ -141,26 +142,26 @@ TInt err = KErrNone; CRepository* repository( NULL ); RBuf bOmaBasedMimeType; - + CleanupClosePushL(bOmaBasedMimeType); bOmaBasedMimeType.CreateL( KCenRepDataLength ); - + TRAP( err, repository = CRepository::NewL( KCRUidOmaBased ) ); if ( !err ) { CleanupStack::PushL( repository ); - + err = repository->Get( KOmaBasedMimeType, bOmaBasedMimeType ); if( !err ) { - iOmaBasedMimeType = CnvUtfConverter::ConvertFromUnicodeToUtf8L( bOmaBasedMimeType ); + iOmaBasedMimeType = CnvUtfConverter::ConvertFromUnicodeToUtf8L( bOmaBasedMimeType ); } CleanupStack::PopAndDestroy( repository ); } - + CleanupStack::PopAndDestroy(); - - User::LeaveIfError( err ); + + User::LeaveIfError( err ); } // ----------------------------------------------------------------------------- @@ -197,7 +198,7 @@ delete iNotifier; } delete iWatchedId; - + delete iOmaBasedMimeType; } @@ -227,34 +228,34 @@ TInt err = KErrNone; TBool retval = KErrNone; - + // Check the destination drive letter - result = iFs.CharToDrive(drive,driveNumber); - + result = iFs.CharToDrive(drive,driveNumber); + if( result ) { return result; } - - // open the file to read the size + + // open the file to read the size result = file.Open(iFs, aSource, EFileShareReadersOrWriters|EFileRead); - - if( result ) - { - return result; - } - - // read the size - result = file.Size( size ); - - // close the file - file.Close(); - + if( result ) { return result; } - + + // read the size + result = file.Size( size ); + + // close the file + file.Close(); + + if( result ) + { + return result; + } + // check that the drive has enough space for the copy operation TRAP( err, retval = SysUtil::DiskSpaceBelowCriticalLevelL( &iFs, @@ -263,21 +264,21 @@ if( retval ) { return KErrDiskFull; - } - - + } + + return iFileManager->Copy( aSource, aDestination); } // ----------------------------------------------------------------------------- // CWmDrmAgentManager::CopyFile -// +// // ----------------------------------------------------------------------------- // -TInt COma2AgentManager::CopyFile(RFile& aSource, +TInt COma2AgentManager::CopyFile(RFile& aSource, const TDesC& aDestination) - { + { TInt driveNumber = 0; TChar drive( aDestination[0] ); TInt size = 0; @@ -288,32 +289,32 @@ TInt err = KErrNone; TBool retval = KErrNone; - + // Same file, do not even try to copy - // And since they are the same don't return an error + // And since they are the same don't return an error aSource.FullName( fileName ); - + if( !aDestination.CompareF( fileName ) ) { return KErrNone; } - + // Check the destination drive letter - result = iFs.CharToDrive(drive,driveNumber); - + result = iFs.CharToDrive(drive,driveNumber); + if( result ) { return result; } - + // read the size result = aSource.Size( size ); - + if( result ) { return result; } - + // check that the drive has enough space for the copy operation TRAP( err, retval = SysUtil::DiskSpaceBelowCriticalLevelL( &iFs, @@ -323,21 +324,21 @@ { return KErrDiskFull; - } + } // Perform the copy: - + // Rewind just in case: size = 0; result = aSource.Seek(ESeekStart, size); - + if( !result ) { - result = iFileManager->Copy(aSource, aDestination); + result = iFileManager->Copy(aSource, aDestination); } - + return result; - } + } // ----------------------------------------------------------------------------- // COma2AgentManager::RenameFile @@ -355,39 +356,39 @@ TInt err = KErrNone; TBool retval = KErrNone; - + TInt result( iFileManager->Rename(aSource, aDestination) ); // If the files are on a different drive, Rename will fail // Therefore we simulate the Move by doing a Copy, followed by Delete if ( result != KErrNone ) { // Check the destination drive letter - result = iFs.CharToDrive(drive,driveNumber); - + result = iFs.CharToDrive(drive,driveNumber); + if( result ) { return result; } - - // open the file to read the size + + // open the file to read the size result = file.Open(iFs, aSource, EFileShareReadersOrWriters|EFileRead); - - if( result ) - { - return result; - } - - // read the size - result = file.Size( size ); - - // close the file - file.Close(); - + if( result ) { return result; } - + + // read the size + result = file.Size( size ); + + // close the file + file.Close(); + + if( result ) + { + return result; + } + // check that the drive has enough space for the copy operation TRAP( err, retval = SysUtil::DiskSpaceBelowCriticalLevelL( &iFs, @@ -397,9 +398,9 @@ { return KErrDiskFull; - } - - + } + + result = iFileManager->Copy(aSource,aDestination); if (result == KErrNone) { @@ -609,7 +610,7 @@ { iStatus = &aStatus; iWatchedEvents = aEventMask; - TRAP_IGNORE( iWatchedId = dcf->iContentID->AllocL() ); + TRAP_IGNORE( iWatchedId = dcf->iContentID->AllocL() ); TRAP(r, iNotifier->RegisterEventObserverL(*this, KEventAddRemove, *iWatchedId)); TRAP(r, iNotifier->RegisterEventObserverL(*this, KEventModify, *iWatchedId)); *iStatus = KRequestPending; @@ -760,9 +761,9 @@ aContentMimeType.Copy(*dcf->iMimeType); r = ETrue; // file was recognized as OMA1 DCF } - CleanupStack::PopAndDestroy(); + CleanupStack::PopAndDestroy(); } - + } #ifdef __DRM_OMA2 } diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/agentv2/src/Oma2AgentRightsManager.cpp --- a/omadrm/drmengine/agentv2/src/Oma2AgentRightsManager.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/agentv2/src/Oma2AgentRightsManager.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,12 +19,13 @@ // INCLUDE FILES #include +#include #include -#include "drmrights.h" -#include "oma2agentrightsmanager.h" -#include "drmrightsclient.h" -#include "dcfrep.h" -#include "dcfentry.h" +#include "DRMRights.h" +#include "Oma2AgentRightsManager.h" +#include "DRMRightsClient.h" +#include "DcfRep.h" +#include "DcfEntry.h" using namespace ContentAccess; @@ -39,7 +40,7 @@ User::LeaveIfError(client.Connect()); CleanupClosePushL(client); User::LeaveIfError(fs.Connect()); - User::LeaveIfError(fs.ShareAuto()); + User::LeaveIfError(fs.ShareAuto()); CleanupClosePushL(fs); dcf = CDcfCommon::NewL(aVirtualPath.URI(), &fs); CleanupStack::PushL(dcf); @@ -50,7 +51,7 @@ void DoDeleteAllRightsObjects( const TVirtualPathPtr& aVirtualPath ) { - TRAP_IGNORE( DoDeleteAllRightsObjectsL( aVirtualPath ) ); + TRAP_IGNORE( DoDeleteAllRightsObjectsL( aVirtualPath ) ); } void DoDeleteRightsObjectL( @@ -83,11 +84,11 @@ } CleanupStack::PopAndDestroy(2); // contentId, client } - + void DoDeleteRightsObject( const CRightsInfo& aRightsInfo) { - TRAP_IGNORE( DoDeleteRightsObjectL( aRightsInfo ) ); + TRAP_IGNORE( DoDeleteRightsObjectL( aRightsInfo ) ); } @@ -105,7 +106,7 @@ { TBool r = EFalse; CDRMConstraint* constraint; - + constraint = aPermission->ConstraintForIntent(aIntent); if (constraint != NULL && !constraint->Expired(aTime)) { @@ -119,13 +120,13 @@ { TRightsStatus r = ERightsStatusNone; TTime time; - + time.HomeTime(); if ((!(aPermission->iAvailableRights & ERightsTopLevel) || !aPermission->iTopLevel->Expired(time)) - + && - + (IsValid(aPermission, EPlay, time) || IsValid(aPermission, EView, time) || IsValid(aPermission, EPrint, time) || @@ -144,7 +145,7 @@ TPtr ptr(NULL, 0); HBufC* id = NULL; CRightsInfo* r = NULL; - + id = HBufC::NewLC(aContentId.Length() + 20); ptr.Set(id->Des()); ptr.Copy(aContentId); @@ -193,7 +194,7 @@ COma2AgentRightsManager* COma2AgentRightsManager::NewL() { COma2AgentRightsManager* self = new( ELeave ) COma2AgentRightsManager; - + CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop(); @@ -201,7 +202,7 @@ return self; } - + // Destructor COma2AgentRightsManager::~COma2AgentRightsManager() { @@ -240,12 +241,12 @@ { aArray.AppendL(ConvertToRightsInfoL(permissions[i], *idList[j])); } - + CleanupStack::PopAndDestroy(1); // permCleanup } CleanupStack::PopAndDestroy(2); // idCleanup, client } - + void COma2AgentRightsManager::ListRightsL( RStreamablePtrArray& aArray, const TDesC& aUri) const @@ -253,9 +254,9 @@ TVirtualPathPtr ptr(aUri, KDefaultContentObject); ListRightsL(aArray, ptr); } - + void COma2AgentRightsManager::ListRightsL( - RStreamablePtrArray& aArray, + RStreamablePtrArray& aArray, TVirtualPathPtr& aVirtualPath) const { RPointerArray permissions; @@ -272,7 +273,7 @@ User::LeaveIfError(client.Connect()); CleanupClosePushL(client); User::LeaveIfError(fs.Connect()); - User::LeaveIfError(fs.ShareAuto()); + User::LeaveIfError(fs.ShareAuto()); CleanupClosePushL(fs); dcf = CDcfCommon::NewL(aVirtualPath.URI(), &fs); if (dcf == NULL) @@ -281,7 +282,7 @@ } CleanupStack::PushL(dcf); User::LeaveIfError(dcf->OpenPart(aVirtualPath.UniqueId())); - + TRAP(error, permission = client.GetActiveRightsL(EUnknown, *dcf->iContentID, reason)); if (permission != NULL) { @@ -289,7 +290,7 @@ aArray.AppendL(ConvertToRightsInfoL(permission, *dcf->iContentID)); CleanupStack::PopAndDestroy(); // permission } - + TRAP(error, client.GetDBEntriesL(*dcf->iContentID, permissions)); CleanupStack::PushL(listCleanup); @@ -297,10 +298,10 @@ { aArray.AppendL(ConvertToRightsInfoL(permissions[i], *dcf->iContentID)); } - + CleanupStack::PopAndDestroy(4); // listCleanup, dcf, fs, client } - + void COma2AgentRightsManager::ListContentL( RStreamablePtrArray& aArray, CRightsInfo& aRightsInfo) const @@ -323,7 +324,7 @@ aRightsInfo.UniqueId().Left(n)); CleanupStack::PushL(contentId); rep = CDcfRep::NewL(); - CleanupStack::PushL(rep); + CleanupStack::PushL(rep); rep->OrderListL(); entry = rep->NextL(); while (entry != NULL) @@ -335,10 +336,10 @@ CleanupStack::PopAndDestroy(); // entry entry = rep->NextL(); } - + CleanupStack::PopAndDestroy(3); // rep, contentId, client } - + MAgentRightsBase* COma2AgentRightsManager::GetRightsDataL( const CRightsInfo& aRightsInfo) const { @@ -378,26 +379,26 @@ } CleanupStack::Pop(); // rights CleanupStack::PopAndDestroy(2); // contentId, client - + return rights; } - + TInt COma2AgentRightsManager::DeleteRightsObject( const CRightsInfo& aRightsInfo) { TInt error = KErrNone; - TRAP( error, DoDeleteRightsObject(aRightsInfo)); - return error; + TRAP( error, DoDeleteRightsObject(aRightsInfo)); + return error; } - + TInt COma2AgentRightsManager::DeleteAllRightsObjects( const TVirtualPathPtr& aVirtualPath) { TInt error = KErrNone; - TRAP( error, DoDeleteAllRightsObjectsL(aVirtualPath)); - return error; + TRAP( error, DoDeleteAllRightsObjectsL(aVirtualPath)); + return error; } - + TInt COma2AgentRightsManager::SetProperty( TAgentProperty /*aProperty*/, TInt /*aValue*/) diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/dcf/src/DcfCommon.cpp --- a/omadrm/drmengine/dcf/src/DcfCommon.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/dcf/src/DcfCommon.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -22,13 +22,13 @@ #include #include "DcfCommon.h" #include "Oma1Dcf.h" -#include "Oma2Dcf.h" +#include "oma2dcf.h" // ============================ MEMBER FUNCTIONS =============================== // ----------------------------------------------------------------------------- // CDcfCommon::CDcfCommon -// +// // ----------------------------------------------------------------------------- // CDcfCommon::CDcfCommon(): @@ -46,7 +46,7 @@ // ----------------------------------------------------------------------------- // CDcfCommon::ConstructL -// +// // ----------------------------------------------------------------------------- // void CDcfCommon::ConstructL( @@ -58,7 +58,7 @@ // ----------------------------------------------------------------------------- // CDcfCommon::NewL -// +// // ----------------------------------------------------------------------------- // EXPORT_C CDcfCommon* CDcfCommon::NewL( @@ -84,7 +84,7 @@ // ----------------------------------------------------------------------------- // CDcfCommon::NewL -// +// // ----------------------------------------------------------------------------- // EXPORT_C CDcfCommon* CDcfCommon::NewL( @@ -95,7 +95,7 @@ RFile file; TInt r = KErrNone; CDcfCommon* self = NULL; - + if (aFs == NULL) { fs = new RFs(); @@ -103,28 +103,28 @@ CleanupStack::PushL(fs); User::LeaveIfError(fs->Connect()); } - else + else { fs = aFs; } - - r = file.Open(*fs, aFileName, EFileStream | EFileRead | EFileShareReadersOrWriters ); + + r = file.Open(*fs, aFileName, EFileStream | EFileRead | EFileShareReadersOrWriters ); if( r == KErrInUse ) { - r = file.Open(*fs, aFileName, EFileStream | EFileRead | EFileShareAny); + r = file.Open(*fs, aFileName, EFileStream | EFileRead | EFileShareAny); - if (r == KErrInUse) - { - r = file.Open(*fs, aFileName, EFileStream | EFileRead | - EFileShareReadersOnly); - } + if (r == KErrInUse) + { + r = file.Open(*fs, aFileName, EFileStream | EFileRead | + EFileShareReadersOnly); + } } - if(r == KErrNone) - { - CleanupClosePushL(file); - self = NewL(file); - CleanupStack::PopAndDestroy(); - } + if(r == KErrNone) + { + CleanupClosePushL(file); + self = NewL(file); + CleanupStack::PopAndDestroy(); + } if (aFs == NULL) { @@ -136,7 +136,7 @@ // ----------------------------------------------------------------------------- // CDcfCommon::NewL -// +// // ----------------------------------------------------------------------------- // EXPORT_C CDcfCommon::~CDcfCommon() @@ -156,19 +156,19 @@ // ----------------------------------------------------------------------------- // CDcfCommon:: -// +// // ----------------------------------------------------------------------------- // TInt CDcfCommon::CheckUniqueId(const TDesC& aUniqueId) - { - if (aUniqueId.Compare(KDefaultContentObject) == 0) - { - return 0; - } - else - { - return KErrNotFound; - } - } + { + if (aUniqueId.Compare(KDefaultContentObject) == 0) + { + return 0; + } + else + { + return KErrNotFound; + } + } -// End of File +// End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/dcf/src/Oma1Dcf.cpp --- a/omadrm/drmengine/dcf/src/Oma1Dcf.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/dcf/src/Oma1Dcf.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -21,11 +21,10 @@ #include #include #include -#include +#include #include "Oma1Dcf.h" #include "DRMRightsClient.h" #include -#include #include "DrmUtilityInternalcrkeys.h" // Cenrep extension for OmaBased @@ -87,8 +86,8 @@ HBufC8* mimetype = NULL; CleanupClosePushL(bOmaBasedMimeType); - bOmaBasedMimeType.CreateL( KCenRepDataLength ); - + bOmaBasedMimeType.CreateL( KCenRepDataLength ); + repository = CRepository::NewL( KCRUidOmaBased ); CleanupStack::PushL( repository ); @@ -96,11 +95,11 @@ User::LeaveIfError(repository->Get( KOmaBasedMimeType, bOmaBasedMimeType )); mimetype = CnvUtfConverter::ConvertFromUnicodeToUtf8L( bOmaBasedMimeType ); CleanupStack::PopAndDestroy( repository ); - + CleanupStack::PopAndDestroy(); - + return mimetype; - + } // ----------------------------------------------------------------------------- @@ -111,7 +110,7 @@ EXPORT_C COma1Dcf* COma1Dcf::NewL(const RFile& aFile) { COma1Dcf* self = new(ELeave) COma1Dcf; - + CleanupStack::PushL(self); self->ConstructL(aFile); CleanupStack::Pop(); @@ -121,13 +120,13 @@ // ----------------------------------------------------------------------------- // COma1Dcf:: -// +// // ----------------------------------------------------------------------------- // EXPORT_C COma1Dcf* COma1Dcf::NewL(const TDesC8& aMemoryBlock) { COma1Dcf* self = new(ELeave) COma1Dcf; - + CleanupStack::PushL(self); self->ConstructL(aMemoryBlock); CleanupStack::Pop(); @@ -137,7 +136,7 @@ // ----------------------------------------------------------------------------- // COma1Dcf:: -// +// // ----------------------------------------------------------------------------- // EXPORT_C COma1Dcf::~COma1Dcf() @@ -147,7 +146,7 @@ // ----------------------------------------------------------------------------- // COma1Dcf:: -// +// // ----------------------------------------------------------------------------- // TInt COma1Dcf::ReadHeaderL(const TDesC8& aMemoryBlock) @@ -159,29 +158,29 @@ TBuf8<10> lengthFields; TUint32 length; TPtr8 ptr(NULL,0,0); - + if (aMemoryBlock.Length()<3) { User::Leave(KErrArgument); } - + iVersion = aMemoryBlock[0]; - + if (iVersion!=1) { // for OMA Version 1, DCF version must be 1 User::Leave(KErrArgument); } - + mimeLength = aMemoryBlock[1]; cidLength = aMemoryBlock[2]; - + if (mimeLength + cidLength + 3 + 5 + 5 > aMemoryBlock.Length()) { User::Leave(KErrArgument); } - + if (mimeLength!=0) { iMimeType = aMemoryBlock.Mid(3, mimeLength).AllocL(); @@ -196,22 +195,22 @@ { User::Leave(KErrArgument); } - - + + if (cidLength!=0) { iContentID = aMemoryBlock.Mid(3 + mimeLength, cidLength).AllocL(); } else { - User::Leave(KErrArgument); + User::Leave(KErrArgument); } lengthFields.Copy(aMemoryBlock.Mid(3 + mimeLength + cidLength, 10)); TWspPrimitiveDecoder decoder(lengthFields); fieldLength = decoder.UintVar(length); - if( fieldLength < 0 ) + if( fieldLength < 0 ) { User::Leave(KErrArgument); } @@ -221,7 +220,7 @@ { User::Leave(KErrArgument); } - + iDataLength = length; iOffset = 3 + mimeLength + cidLength + fieldLength + iHeaderLength; if (iDataLength == 0) @@ -244,13 +243,13 @@ // ----------------------------------------------------------------------------- // COma1Dcf::ReadHeaderValuesL -// +// // ----------------------------------------------------------------------------- // void COma1Dcf::ReadHeaderValuesL(void) { TPtrC8 ptr(NULL, 0); - + if (GetHeaderL(KRightsIssuer, ptr) == KErrNone) { if( iRightsIssuerURL ) @@ -262,11 +261,11 @@ } if (GetHeaderL(KContentName, ptr) == KErrNone) { - if( iTitle ) + if( iTitle ) { delete iTitle; iTitle = NULL; - } + } iTitle = ptr.AllocL(); } if (GetHeaderL(KContentDescription, ptr) == KErrNone) @@ -275,7 +274,7 @@ { delete iDescription; iDescription = NULL; - } + } iDescription = ptr.AllocL(); } if (GetHeaderL(KIconURI, ptr) == KErrNone) @@ -284,14 +283,14 @@ { delete iIconUri; iIconUri = NULL; - } + } iIconUri = ptr.AllocL(); } } // ----------------------------------------------------------------------------- // COma1Dcf:: -// +// // ----------------------------------------------------------------------------- // TInt COma1Dcf::ReadHeaderL(void) @@ -351,7 +350,7 @@ User::LeaveIfNull(iContentID); p.Set(iContentID->Des()); iFile.Read(p, cidLength); - + pos = 0; iFile.Seek(ESeekCurrent, pos); iFile.Read(lengthFields); @@ -367,7 +366,7 @@ { User::Leave(KErrArgument); } - + iDataLength = length; iOffset = pos + fieldLength + iHeaderLength; if (iDataLength == 0) @@ -390,7 +389,7 @@ // ----------------------------------------------------------------------------- // COma1Dcf:: -// +// // ----------------------------------------------------------------------------- // EXPORT_C TBool COma1Dcf::IsValidDcf(const TDesC8& aDcfFragment) @@ -419,15 +418,15 @@ { r = ETrue; // Check for specific mimetype - + TRAP( error, omaBasedBuf = FetchOmaBasedInfoL() ); - + if( !error ) { - mimeType.Set(aDcfFragment.Mid(3, + mimeType.Set(aDcfFragment.Mid(3, omaBasedBuf->Length())); - - + + if (mimeType.CompareF( *omaBasedBuf ) == 0) { r = EFalse; @@ -442,63 +441,63 @@ // ----------------------------------------------------------------------------- // COma1Dcf:: -// +// // ----------------------------------------------------------------------------- // TInt COma1Dcf::CheckUniqueId(const TDesC& aUniqueId) - { - TInt r = CDcfCommon::CheckUniqueId(aUniqueId); - - if (r == KErrNotFound) - { - HBufC8* id = NULL; - TRAPD(err, id = CnvUtfConverter::ConvertFromUnicodeToUtf8L(aUniqueId)); - if (err == KErrNone) - { - if (iContentID->Compare(*id) == 0) - { - r = 0; - } + { + TInt r = CDcfCommon::CheckUniqueId(aUniqueId); + + if (r == KErrNotFound) + { + HBufC8* id = NULL; + TRAPD(err, id = CnvUtfConverter::ConvertFromUnicodeToUtf8L(aUniqueId)); + if (err == KErrNone) + { + if (iContentID->Compare(*id) == 0) + { + r = 0; + } } else { r = err; } - delete id; - } - return r; - } - + delete id; + } + return r; + } + // ----------------------------------------------------------------------------- // COma1Dcf:: -// +// // ----------------------------------------------------------------------------- // TInt COma1Dcf::OpenPart(const TDesC& aUniqueId) - { - return OpenPart(CheckUniqueId(aUniqueId)); - } - + { + return OpenPart(CheckUniqueId(aUniqueId)); + } + // ----------------------------------------------------------------------------- // COma1Dcf:: -// +// // ----------------------------------------------------------------------------- // TInt COma1Dcf::OpenPart(TInt aPart) - { - if (aPart == 0) - { - return KErrNone; - } - else - { - return KErrNotFound; - } - } - + { + if (aPart == 0) + { + return KErrNone; + } + else + { + return KErrNotFound; + } + } + // ----------------------------------------------------------------------------- // COma1Dcf:: -// +// // ----------------------------------------------------------------------------- // void COma1Dcf::GetPartIdsL(RPointerArray& aPartList) @@ -506,10 +505,10 @@ aPartList.ResetAndDestroy(); aPartList.AppendL(iContentID->Des().AllocL()); } - + // ----------------------------------------------------------------------------- // COma1Dcf::GetHeaderL -// +// // ----------------------------------------------------------------------------- // EXPORT_C TInt COma1Dcf::GetHeaderL( @@ -519,22 +518,22 @@ TInt i; TInt j; TPtrC8 ptr( iHeaders->Des() ); - + // Add Room for CRLF and Semicolon: - HBufC8* buffer = HBufC8::NewMaxLC( aHeaderName.Length() + 3 ); - TPtr8 searchBuf( const_cast(buffer->Ptr()), 0, buffer->Des().MaxSize() ); + HBufC8* buffer = HBufC8::NewMaxLC( aHeaderName.Length() + 3 ); + TPtr8 searchBuf( const_cast(buffer->Ptr()), 0, buffer->Des().MaxSize() ); searchBuf.Copy(aHeaderName); searchBuf.Append(KColon); - - // First see if the + + // First see if the i = ptr.Find(searchBuf); if( i < 0 ) { CleanupStack::PopAndDestroy(); // buffer - return KErrNotFound; + return KErrNotFound; } - + if( i > 0 ) { // if it's not the first one, use the search buffer: @@ -542,29 +541,29 @@ searchBuf.Copy(KEndLine); searchBuf.Append(aHeaderName); searchBuf.Append(KColon); - - // First see if the + + // First see if the i = ptr.Find(searchBuf); if ( i < 0 ) { - CleanupStack::PopAndDestroy(); // buffer + CleanupStack::PopAndDestroy(); // buffer return KErrNotFound; - } + } } - // Move search buffer - i += searchBuf.Length(); - + // Move search buffer + i += searchBuf.Length(); + j = ptr.Mid(i).Find(KEndLine); if( j < 0 ) { - CleanupStack::PopAndDestroy(); // buffer + CleanupStack::PopAndDestroy(); // buffer return KErrNotFound; } - - aHeaderValue.Set( ptr.Mid(i, j) ); - + + aHeaderValue.Set( ptr.Mid(i, j) ); + CleanupStack::PopAndDestroy(); // buffer return KErrNone; } -// End of File +// End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/dcf/src/Oma2Dcf.cpp --- a/omadrm/drmengine/dcf/src/Oma2Dcf.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/dcf/src/Oma2Dcf.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -24,8 +24,9 @@ #include #include #include +#include #include "Oma2Agent.h" -#include "Oma2Dcf.h" +#include "oma2dcf.h" #include "Oma2DcfPartInfo.h" // LOCAL CONSTANTS AND MACROS diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/dcf/src/Oma2DcfPartInfo.cpp --- a/omadrm/drmengine/dcf/src/Oma2DcfPartInfo.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/dcf/src/Oma2DcfPartInfo.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -22,14 +22,15 @@ #include #include #include +#include #include "Oma2Agent.h" -#include "Oma2Dcf.h" +#include "oma2dcf.h" #include "Oma2DcfPartInfo.h" // EXTERNAL DATA STRUCTURES //extern ?external_data; -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES //extern ?external_function( ?arg_type,?arg_type); // CONSTANTS @@ -93,7 +94,7 @@ // ----------------------------------------------------------------------------- // COma2Dcf::NewL -// +// // ----------------------------------------------------------------------------- // COma2DcfPartInfo* COma2DcfPartInfo::NewL() @@ -111,4 +112,4 @@ } -// End of File +// End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/dcfrepository/client/src/DcfRep.cpp --- a/omadrm/drmengine/dcfrepository/client/src/DcfRep.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/dcfrepository/client/src/DcfRep.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -25,7 +25,7 @@ #include #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif // EXTERNAL DATA STRUCTURES diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/dcfrepository/server/inc/DcfRepSrv.h --- a/omadrm/drmengine/dcfrepository/server/inc/DcfRepSrv.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/dcfrepository/server/inc/DcfRepSrv.h Mon Mar 15 12:41:43 2010 +0200 @@ -21,7 +21,7 @@ #define CDCFREPSRV_H // INCLUDES -#include +#include #include #include "Pair.h" #include "procwatcher.h" @@ -40,7 +40,7 @@ EStateIdle = 0, EStateSetTtid, EStateFullScan, - EStateScan + EStateScan }; // FUNCTION PROTOTYPES // FORWARD DECLARATIONS @@ -52,25 +52,25 @@ * Server implementation. * DCF Repository * -* @lib -* @since Series 60 3.0 +* @lib +* @since Series 60 3.0 */ class CDcfRepSrv : public CServer2, public MWatcherObserver { public: // Constructors and destructor - + /** * Two-phased constructor. */ static CDcfRepSrv* NewLC(); - + /** * Destructor. */ virtual ~CDcfRepSrv(); public: // New functions - + /** * Startup starts the actual server after initializing * the cleanup stack and active scheduler. @@ -84,9 +84,9 @@ * @since Series 60 3.0 * @param aFile file name * @KErrNotSupported if file is not protected file - */ + */ void AddFileL( const TDesC& aFile ); - + /** * ProcessFile * @since Series 60 3.0 @@ -102,89 +102,89 @@ * @return state of the server */ TInt State() const; - + /** * SetState * @since Series 60 3.0 * @param aMode server state - * @return + * @return */ void SetState(TServerState aMode); - + /** * CompleteScanning * @since Series 60 3.0 * @param aRet return code */ - void CompleteScanning(TInt err); - - + void CompleteScanning(TInt err); + + /** * SetMessage * @since Series 60 3.0 * @param aMessage Message from client */ - RMessage2* SetMessageL(const RMessage2& aMessage); - + RMessage2* SetMessageL(const RMessage2& aMessage); + /** * Scan * @since Series 60 3.0 * @return error code - */ + */ TInt Scan(); - + /** * SetCidList * @since Series 60 3.0 * @param aList content ID list */ void SetCidList(RPointerArray*& aList); - - + + /** * SetPairList * @since Series 60 3.0 * @param aList list of pairs for content ID and transaction ID */ void SetPairList(RPointerArray*& aList); - + /** * Stop watching the Rights Server * @since Series 60 3.1 */ void StopWatchingL(); - + /** * RemoveMessageL * Called by destructor of the session class */ void RemoveMessageL( const RMessage2* aMessage ); - - + + public: // Functions from base classes - + //class MWatcherObserver - - /** + + /** * Called when the peer process died * * @since S60 3.0 * @param aObject Changed object */ void WatchedObjectChangedL( const TDesC& aObject ); - + protected: // New functions - + protected: // Functions from base classes - + // Class CServer - /** + /** * NewSessionL * @since S60Rel3.0 */ CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const; - + private: @@ -200,86 +200,86 @@ /** * StartupL called by StartUp - * @since S60 Rel 3.0 + * @since S60 Rel 3.0 */ static void StartupL(); /** * PanicServer will panic with panic code - * @since S60 Rel 3.0 + * @since S60 Rel 3.0 */ static void PanicServer(TDcfRepSrvPanic aPanic); - + /** * CleanScanInternal will clean list for Scan - * @since S60 Rel 3.0 - */ + * @since S60 Rel 3.0 + */ void CleanScanInternal(); /** * CleanDatabase will close database connection - * @since S60 Rel 3.0 - */ + * @since S60 Rel 3.0 + */ void CleanDatabase(); /** * OpenDatabaseL will open database connection - * @since S60 Rel 3.0 - */ + * @since S60 Rel 3.0 + */ void OpenDatabaseL(); /** * CleanTableL will clean all items in the table - * @since S60 Rel 3.0 - */ + * @since S60 Rel 3.0 + */ void CleanTableL(); /** * AddDomainRoL will add domain RO into file if there is any. - * @since S60 Rel 3.0 - */ + * @since S60 Rel 3.0 + */ void AddDomainRoL( const TDesC& aFile ); /** * CheckFileL will check the file type: dcf1,dcf2,plain - * @since S60 Rel 3.0 - */ + * @since S60 Rel 3.0 + */ void CheckFileL(const TDesC& aFile , TInt& aType); /** * StoreFileL will store file info - * @since S60 Rel 3.0 - */ + * @since S60 Rel 3.0 + */ void StoreFileL(const TDesC& aFile , TInt aType); - + /** * UpdateDatabaseL will store info into database - * @since S60 Rel 3.0 - */ + * @since S60 Rel 3.0 + */ void UpdateDatabaseL( - const TDesC& aFile, - TInt aPos, + const TDesC& aFile, + TInt aPos, const TDesC& aCid , - const TDesC& aGroupId , + const TDesC& aGroupId , const TDesC& aTtid); /** * ResetTtidL will write new ttid into file - * @since S60 Rel 3.0 + * @since S60 Rel 3.0 */ void ResetTtidL( - const TDesC& aFile, + const TDesC& aFile, const TDesC8& aTtid ); /** * ResetTtidL will write new ttid into file - * @since S60 Rel 3.0 + * @since S60 Rel 3.0 */ void ResetTtidL( - COma2Dcf* aDcf, + COma2Dcf* aDcf, const TDesC8& aTtid - ); + ); // Prohibit copy constructor if not deriving from CBase. CDcfRepSrv( const CDcfRepSrv& ); // Prohibit assigment operator if not deriving from CBase. @@ -299,7 +299,7 @@ TInt iState; CProcWatcher* iProcWatcher; TBool iArmed; - + // Reserved pointer for future extension TAny* iReserved; @@ -309,6 +309,6 @@ }; -#endif // CDCFREPSRV_H - +#endif // CDCFREPSRV_H + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/dcfrepository/server/inc/drmlog.h --- a/omadrm/drmengine/dcfrepository/server/inc/drmlog.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/dcfrepository/server/inc/drmlog.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,7 +22,7 @@ // INCLUDES #if (defined _DEBUG || defined _LOGGING) -#include +#include #include // CONSTANTS @@ -35,18 +35,18 @@ #define DRMLOG( a ) \ RFileLogger::Write(_L("drm"), DRMFLOGFILE, EFileLoggingModeAppend, a); \ RDebug::Print( a ); - + #define DRMLOG2( a, b ) \ RFileLogger::WriteFormat(_L("drm"), DRMFLOGFILE, EFileLoggingModeAppend, a, b); \ RDebug::Print( a, b ); - + #define DRMLOGHEX( a ) \ RFileLogger::HexDump(_L("drm"), DRMFLOGFILE, EFileLoggingModeAppend, _S(""), _S(""), (a).Ptr(), (a).Size()); #else -#define DRMLOG( a ) -#define DRMLOG2( a, b ) +#define DRMLOG( a ) +#define DRMLOG2( a, b ) #define DRMLOGHEX( a ) #endif // _DEBUG @@ -56,8 +56,8 @@ // FORWARD DECLARATIONS // CLASS DECLARATION -#endif // DRMLOG_H - +#endif // DRMLOG_H + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/dcfrepository/server/src/DcfRepSrv.cpp --- a/omadrm/drmengine/dcfrepository/server/src/DcfRepSrv.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/dcfrepository/server/src/DcfRepSrv.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -28,13 +28,13 @@ #include #include #include // oma2agent -#include "Oma2Dcf.h" +#include "oma2dcf.h" #include "Oma1Dcf.h" #include "drmlog.h" #include #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif // EXTERNAL DATA STRUCTURES @@ -205,7 +205,7 @@ #endif { #ifdef _DRM_TESTING - TRAP_IGNORE( WriteL(_L8("DataFile")) ); + TRAP_IGNORE( WriteL(_L8("DataFile")) ); #endif TParse p; diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/dcfrepository/server/src/FileScan.cpp --- a/omadrm/drmengine/dcfrepository/server/src/FileScan.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/dcfrepository/server/src/FileScan.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -17,22 +17,22 @@ // INCLUDE FILES -#include -#include -#include -#include +#include +#include +#include +#include #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif #include "DcfRepSrv.h" #include "SearchLeaf.h" -#include "FileScan.h" +#include "FileScan.h" // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS @@ -69,7 +69,7 @@ #ifndef RD_MULTIPLE_DRIVE LOCAL_C TBool IgnoreDir( TFileName& aDir ) { - if ( !aDir.CompareF( KIgnoreDir1 ) || + if ( !aDir.CompareF( KIgnoreDir1 ) || !aDir.CompareF( KIgnoreDir2 ) ) { return ETrue; @@ -82,15 +82,15 @@ TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); - aFs.DriveToChar( driveNumber, driveLetter ); - - TFileName ignore1; - TFileName ignore2; - - ignore1.Format( KIgnoreDir1, (TUint)driveLetter ); + aFs.DriveToChar( driveNumber, driveLetter ); + + TFileName ignore1; + TFileName ignore2; + + ignore1.Format( KIgnoreDir1, (TUint)driveLetter ); ignore2.Format( KIgnoreDir2, (TUint)driveLetter ); - - if ( !aDir.CompareF( ignore1 ) || + + if ( !aDir.CompareF( ignore1 ) || !aDir.CompareF( ignore2 ) ) { return ETrue; @@ -98,7 +98,7 @@ return EFalse; } #endif - + // ============================ MEMBER FUNCTIONS =============================== // ----------------------------------------------------------------------------- @@ -107,10 +107,10 @@ // might leave. // ----------------------------------------------------------------------------- // -CFileScan::CFileScan( RFs& aFs ) : +CFileScan::CFileScan( RFs& aFs ) : CActive( CActive::EPriorityStandard ),iServer(NULL),iFs(&aFs),iCurrentLeaf(NULL) - { - CleanInternal(); + { + CleanInternal(); } // ----------------------------------------------------------------------------- @@ -120,17 +120,17 @@ // void CFileScan::ConstructL() { - TInt err = 0; - if ( !iFs ) - { - err = KErrArgument; - } - else - { - err = KErrNone; - } - User::LeaveIfError( err ); - } + TInt err = 0; + if ( !iFs ) + { + err = KErrArgument; + } + else + { + err = KErrNone; + } + User::LeaveIfError( err ); + } // ----------------------------------------------------------------------------- // CFileScan::NewL @@ -139,20 +139,20 @@ // CFileScan* CFileScan::NewL( RFs& aFs ) { - CFileScan* self = new( ELeave ) CFileScan( aFs ); - CleanupStack::PushL( self ); + CFileScan* self = new( ELeave ) CFileScan( aFs ); + CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop(self); return self; } - + // Destructor CFileScan::~CFileScan() { - CleanInternal(); - iServer = NULL; - iFs = NULL; + CleanInternal(); + iServer = NULL; + iFs = NULL; } @@ -164,28 +164,28 @@ // ----------------------------------------------------------------------------- // void CFileScan::DoCancel() - { - CleanInternal(); - } + { + CleanInternal(); + } // ----------------------------------------------------------------------------- // CFileScan::IsProtected -// Function returns whether the specific file is protected or not +// Function returns whether the specific file is protected or not // (other items were commented in a header). // ----------------------------------------------------------------------------- // TInt CFileScan::IsProtected( const TDesC& aFileName , TBool& aIsDCF ) - { - TInt err = KErrNone; - aIsDCF = EFalse; - err = iServer->ProcessFile( aFileName , aIsDCF ); - if ( err && err != KErrNoMemory ) - { - err = KErrNone; - } - return err; - } + { + TInt err = KErrNone; + aIsDCF = EFalse; + err = iServer->ProcessFile( aFileName , aIsDCF ); + if ( err && err != KErrNoMemory ) + { + err = KErrNone; + } + return err; + } // ----------------------------------------------------------------------------- @@ -195,62 +195,62 @@ // ----------------------------------------------------------------------------- // void CFileScan::RunL() - { - TInt err = KErrNone; - if ( iSearching && iServer->State()!=EStateIdle ) - { - err = SearchNext(); - if ( err == KErrCancel ) - { - err = KErrNone; - } - if ( !err ) - { - SetActive(); - TRequestStatus* status = &iStatus; - User::RequestComplete( status , err ); - } - } - else - { - CleanInternal(); - iServer->CompleteScanning(err); - Deque(); - } - if ( err ) - { - CleanInternal(); - iServer->CompleteScanning(err); - Deque(); - } - } + { + TInt err = KErrNone; + if ( iSearching && iServer->State()!=EStateIdle ) + { + err = SearchNext(); + if ( err == KErrCancel ) + { + err = KErrNone; + } + if ( !err ) + { + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status , err ); + } + } + else + { + CleanInternal(); + iServer->CompleteScanning(err); + Deque(); + } + if ( err ) + { + CleanInternal(); + iServer->CompleteScanning(err); + Deque(); + } + } // ----------------------------------------------------------------------------- // CFileScan::SearchContent -// Function starts the active objects to search protected file through whole file system +// Function starts the active objects to search protected file through whole file system // (other items were commented in a header). // ----------------------------------------------------------------------------- // TInt CFileScan::SearchContent( CDcfRepSrv* aServer ) - { + { TInt err = KErrNone; - - iServer = aServer; - CActiveScheduler::Add( this ); - - iSearching = ETrue; - err = SearchNext(); - if ( err ) - { - return err; - } - SetActive(); - TRequestStatus* status = &iStatus; - User::RequestComplete( status , KErrNone ); - return err; - } + + iServer = aServer; + CActiveScheduler::Add( this ); + + iSearching = ETrue; + err = SearchNext(); + if ( err ) + { + return err; + } + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status , KErrNone ); + return err; + } // ----------------------------------------------------------------------------- // CFileScan::SearchDrive @@ -259,16 +259,16 @@ // ----------------------------------------------------------------------------- // TInt CFileScan::SearchDrive() - { - _LIT( KDrive, "%c:"); - TDriveList drivelist; - TChar driveLetter; - TInt driveNumber = EDriveA - 1; - TInt err = KErrNone; + { + _LIT( KDrive, "%c:"); + TDriveList drivelist; + TChar driveLetter; + TInt driveNumber = EDriveA - 1; + TInt err = KErrNone; #ifdef RD_MULTIPLE_DRIVE - - TInt ramDrive( -1 ); + + TInt ramDrive( -1 ); TInt romDrive( -1 ); DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRam, ramDrive ); @@ -276,44 +276,44 @@ #endif - err = iFs->DriveList( drivelist ); + err = iFs->DriveList( drivelist ); - if ( iLastPosition != KNullDesC ) - { - driveLetter = iLastPosition[0]; - err = iFs->CharToDrive( driveLetter, driveNumber ); - } - - driveNumber++; - + if ( iLastPosition != KNullDesC ) + { + driveLetter = iLastPosition[0]; + err = iFs->CharToDrive( driveLetter, driveNumber ); + } + + driveNumber++; + for ( ; driveNumber < KMaxDrives ; driveNumber++ ) { - + #ifndef RD_MULTIPLE_DRIVE - - if ( driveNumber == EDriveD || driveNumber == EDriveZ ) - { - } - + + if ( driveNumber == EDriveD || driveNumber == EDriveZ ) + { + } + #else // RD_MULTIPLE_DRIVE - if ( driveNumber == ramDrive || driveNumber == romDrive ) - { - } + if ( driveNumber == ramDrive || driveNumber == romDrive ) + { + } #endif - - else if ( drivelist[driveNumber] ) - { - err = iFs->DriveToChar( driveNumber, driveLetter ); - iLastPosition.Format( KDrive, (TUint)driveLetter ); - iDeeper = ETrue; - return err; - } + + else if ( drivelist[driveNumber] ) + { + err = iFs->DriveToChar( driveNumber, driveLetter ); + iLastPosition.Format( KDrive, (TUint)driveLetter ); + iDeeper = ETrue; + return err; + } } - CleanInternal(); - return err; - } + CleanInternal(); + return err; + } @@ -324,46 +324,46 @@ // ----------------------------------------------------------------------------- // TInt CFileScan::SearchFolder( CDir*& aFolderList ) - { - TInt err = KErrNone; - TRAP( err , iCurrentLeaf->SetLeafL( aFolderList ) ); - return err; - } + { + TInt err = KErrNone; + TRAP( err , iCurrentLeaf->SetLeafL( aFolderList ) ); + return err; + } // ----------------------------------------------------------------------------- // CFileScan::SearchFile -// This function searches for the DCF files under specific folder +// This function searches for the DCF files under specific folder // (other items were commented in a header). // ----------------------------------------------------------------------------- // TInt CFileScan::SearchFile( CDir*& aFileList ) - { - TInt err = KErrNone; - TInt i = 0; - TBool isDCF; - _LIT ( KFullFileName , "%S\\%S"); - TFileName fileName; + { + TInt err = KErrNone; + TInt i = 0; + TBool isDCF; + _LIT ( KFullFileName , "%S\\%S"); + TFileName fileName; - for ( ; i < aFileList->Count() && !err ; i++ ) - { - if (!( *aFileList )[i].IsDir()) - { - TPtrC extension = (*aFileList)[i].iName.Right( 4 ); - if( !extension.CompareF( KWma ) || - !extension.CompareF( KWmv ) || - !extension.CompareF( KAsf ) ) - { - - } - else - { - fileName.Format( KFullFileName , &iLastPosition , &( *aFileList )[i].iName ); - err = IsProtected( fileName , isDCF ); - } - } - } - return err; - } + for ( ; i < aFileList->Count() && !err ; i++ ) + { + if (!( *aFileList )[i].IsDir()) + { + TPtrC extension = (*aFileList)[i].iName.Right( 4 ); + if( !extension.CompareF( KWma ) || + !extension.CompareF( KWmv ) || + !extension.CompareF( KAsf ) ) + { + + } + else + { + fileName.Format( KFullFileName , &iLastPosition , &( *aFileList )[i].iName ); + err = IsProtected( fileName , isDCF ); + } + } + } + return err; + } // ----------------------------------------------------------------------------- // CFileScan::SearchNext @@ -372,155 +372,155 @@ // ----------------------------------------------------------------------------- // TInt CFileScan::SearchNext() - { - TInt err = KErrNone; + { + TInt err = KErrNone; - err = CheckDrive(); - if ( !err && iSearching ) - { - if ( iDeeper ) - { - err = CheckFolder(); - } - if ( !err && iSearching ) - { - err = ToNextLeaf(); - } - } - return err; - } + err = CheckDrive(); + if ( !err && iSearching ) + { + if ( iDeeper ) + { + err = CheckFolder(); + } + if ( !err && iSearching ) + { + err = ToNextLeaf(); + } + } + return err; + } TInt CFileScan::CheckDrive() - { - // check if current drive is end of searching - TInt err = KErrNone; + { + // check if current drive is end of searching + TInt err = KErrNone; - if( !iCurrentLeaf ) - { - err = SearchDrive(); - if ( err || !iSearching ) - { - return err; - } - CSearchLeaf* root = NULL; - TRAP( err , iCurrentLeaf = CSearchLeaf::NewL( root , iLastPosition ) ); - } - return err; - } + if( !iCurrentLeaf ) + { + err = SearchDrive(); + if ( err || !iSearching ) + { + return err; + } + CSearchLeaf* root = NULL; + TRAP( err , iCurrentLeaf = CSearchLeaf::NewL( root , iLastPosition ) ); + } + return err; + } -TInt CFileScan::CheckFolder() - { - // check current folder - _LIT ( KSearchDir , "%S\\*"); +TInt CFileScan::CheckFolder() + { + // check current folder + _LIT ( KSearchDir , "%S\\*"); - TInt err = KErrNone; - CDir* fileList = NULL; - CDir* dirList = NULL; - TFileName temp; - + TInt err = KErrNone; + CDir* fileList = NULL; + CDir* dirList = NULL; + TFileName temp; + #ifndef RD_MULTIPLE_DRIVE if ( IgnoreDir( iLastPosition ) ) #else // RD_MULTIPLE_DRIVE - if ( IgnoreDir( *iFs, iLastPosition ) ) + if ( IgnoreDir( *iFs, iLastPosition ) ) #endif { return err; } - + if( iLastPosition.Length() + KSearchDir().Length() < iLastPosition.MaxLength() ) { - temp.Format( KSearchDir , &iLastPosition ); - err = iFs->GetDir( temp - , KEntryAttMaskSupported - , ESortByName - , fileList , dirList ); - - if ( !err ) - { - err = SearchFolder( dirList ); - if ( !err ) - { - err = SearchFile( fileList ); - } - } - delete fileList; - fileList = NULL; - delete dirList; - dirList = NULL; + temp.Format( KSearchDir , &iLastPosition ); + err = iFs->GetDir( temp + , KEntryAttMaskSupported + , ESortByName + , fileList , dirList ); + + if ( !err ) + { + err = SearchFolder( dirList ); + if ( !err ) + { + err = SearchFile( fileList ); + } + } + delete fileList; + fileList = NULL; + delete dirList; + dirList = NULL; } - return err; - } + return err; + } TInt CFileScan::ToNextLeaf() - { - _LIT ( KChildDir , "%S\\%S"); - TInt err = KErrNone; - TFileName file; - CSearchLeaf* temp = NULL; + { + _LIT ( KChildDir , "%S\\%S"); + TInt err = KErrNone; + TFileName file; + CSearchLeaf* temp = NULL; - file.Format( iLastPosition ); + file.Format( iLastPosition ); - if ( iCurrentLeaf->LeafList().Count() > 0 ) - { - iDeeper = ETrue; - iCurrentLeaf = iCurrentLeaf->LeafList()[0]; - iLastPosition.Format( KChildDir , &file , &iCurrentLeaf->FolderName() ); - } - else - { - iDeeper = EFalse; - temp = iCurrentLeaf; - iCurrentLeaf = iCurrentLeaf->Root(); - if ( iCurrentLeaf ) - { - iCurrentLeaf->RemoveLeaf( temp ); - } - delete temp; - temp = NULL; - err = UpFolder(); - } - return err; - } + if ( iCurrentLeaf->LeafList().Count() > 0 ) + { + iDeeper = ETrue; + iCurrentLeaf = iCurrentLeaf->LeafList()[0]; + iLastPosition.Format( KChildDir , &file , &iCurrentLeaf->FolderName() ); + } + else + { + iDeeper = EFalse; + temp = iCurrentLeaf; + iCurrentLeaf = iCurrentLeaf->Root(); + if ( iCurrentLeaf ) + { + iCurrentLeaf->RemoveLeaf( temp ); + } + delete temp; + temp = NULL; + err = UpFolder(); + } + return err; + } TInt CFileScan::UpFolder() - { - TInt err = KErrNone; - TParse file; - if ( iLastPosition.Length()<3 ) - { - return err; - } - err = file.Set( iLastPosition , NULL , NULL ); - iLastPosition.Format( file.DriveAndPath() ); - iLastPosition.SetLength( iLastPosition.Length() - 1 ); - return err; - } + { + TInt err = KErrNone; + TParse file; + if ( iLastPosition.Length()<3 ) + { + return err; + } + err = file.Set( iLastPosition , NULL , NULL ); + iLastPosition.Format( file.DriveAndPath() ); + iLastPosition.SetLength( iLastPosition.Length() - 1 ); + return err; + } void CFileScan::CleanInternal() - { - CSearchLeaf* root = iCurrentLeaf; - iLastPosition = KNullDesC; - iSearching = EFalse; - root = GetRootLeaf(); - delete root; - root = NULL; - iCurrentLeaf = NULL; - iDeeper = ETrue; - } + { + CSearchLeaf* root = iCurrentLeaf; + iLastPosition = KNullDesC; + iSearching = EFalse; + root = GetRootLeaf(); + delete root; + root = NULL; + iCurrentLeaf = NULL; + iDeeper = ETrue; + } CSearchLeaf* CFileScan::GetRootLeaf() - { - CSearchLeaf* root = iCurrentLeaf; - if ( iCurrentLeaf ) - { - while ( root->Root() ) - { - root = root->Root(); - } - } - return root; - } + { + CSearchLeaf* root = iCurrentLeaf; + if ( iCurrentLeaf ) + { + while ( root->Root() ) + { + root = root->Root(); + } + } + return root; + } // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/dm/src/DRMMessageParser.cpp --- a/omadrm/drmengine/dm/src/DRMMessageParser.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/dm/src/DRMMessageParser.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -26,20 +26,20 @@ #include #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif -#include "DrmRights.h" +#include "DRMRights.h" #include "Oma1DcfCreator.h" #include "b64.h" #include "DRMMessageParser.h" -#include "DRMRightsParser.h" +#include "DrmRightsParser.h" #include "DRMRightsClient.h" #include "DrmKeyStorage.h" // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS // MACROS // LOCAL CONSTANTS AND MACROS @@ -54,7 +54,7 @@ _LIT8( KFLSuffix, "@localhost"); LOCAL_C const TUint8 KCDContentIDLength = 25; // 4 + 11 + 10 -LOCAL_C const TUint8 KCDPlainIDLength = 11; +LOCAL_C const TUint8 KCDPlainIDLength = 11; LOCAL_C const TInt KInputBufferSize = 2048; LOCAL_C const TInt KBoundaryMarkLength = 2; @@ -108,7 +108,7 @@ RFs aFs; TFileName aName; }; - + // LOCAL FUNCTION PROTOTYPES LOCAL_C void DoResetAndDestroy( TAny* aPtr ); LOCAL_C void DoResetAndDestroy2( TAny* aPtr ); @@ -126,14 +126,14 @@ void DoResetAndDestroy( TAny* aPtr ) { __ASSERT_DEBUG( aPtr, User::Invariant() ); - + reinterpret_cast< RPointerArray< CDRMRights >* >( aPtr )->ResetAndDestroy(); } void DoResetAndDestroy2( TAny* aPtr ) { __ASSERT_DEBUG( aPtr, User::Invariant() ); - + reinterpret_cast< RPointerArray< CDRMPermission >* >( aPtr )->ResetAndDestroy(); } // ----------------------------------------------------------------------------- @@ -153,28 +153,28 @@ { CDRMAsset* asset( NULL ); CDRMRights* rights( NULL ); - + aRights = NULL; - + rights = CDRMRights::NewL(); CleanupStack::PushL( rights ); - + asset = CDRMAsset::NewL(); CleanupStack::PushL( asset ); - + asset->iUid = aURI.AllocL(); - + if ( aPermission.iParentUID ) { asset->iParentRights = aPermission.iParentUID->AllocL(); } - + rights->SetPermissionL( aPermission ); rights->SetAssetL( *asset ); - + CleanupStack::PopAndDestroy(); // asset CleanupStack::Pop(), // rights - + aRights = rights; } @@ -187,11 +187,11 @@ EXPORT_C CDRMMessageParser* CDRMMessageParser::NewL( void ) { CDRMMessageParser* self = new( ELeave ) CDRMMessageParser(); - + CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop(); - + return self; } @@ -219,23 +219,23 @@ { TInt error = KErrNone; TRAP( error, FinalizeMessageParserL() ); - + Reset(); - + User::Free( const_cast< TUint8* >( iInputBuffer.Ptr() ) ); } // ----------------------------------------------------------------------------- // CDRMMessageParser:: -// +// // ----------------------------------------------------------------------------- // EXPORT_C void CDRMMessageParser::InitializeMessageParserL( RWriteStream& aStream ) { Reset(); - + iDcfCreator = COma1DcfCreator::NewL(); - + iOutputStream = aStream; } @@ -250,8 +250,8 @@ * - a boundary string is located and extracted * - MIME header is read, and based on content-type field the internal * state is set to either EReadingRightsPart or EReadingContentPart. - * - after processing the MIME part, internal state is updated again to - * EReadingHeaderPart if there are several MIME parts in the DRM + * - after processing the MIME part, internal state is updated again to + * EReadingHeaderPart if there are several MIME parts in the DRM * message. * - data is consumed from iInputData in each phase. * - after everything is done, internal state is set to EAllDone. @@ -260,14 +260,14 @@ { User::Leave( KErrNotReady ); } - + if ( iState & EAllDone ) { return; } - + iInputData.Set( aMessageData ); - + while( iInputData.Length() ) { if ( iState & EReadingHeaderPart ) @@ -302,7 +302,7 @@ EXPORT_C void CDRMMessageParser::FinalizeMessageParserL() { TInt error( KErrNone ); - + if ( iState & EEncryptStreamOk ) { if ( iInputBuffer.Length() ) @@ -312,15 +312,15 @@ DeletePermission(); error = KDRMMessageMalformed; } - + ClearBit( EEncryptStreamOk ); iDcfCreator->EncryptFinalizeL(); - + iOutputStream.CommitL(); } Reset(); - + User::LeaveIfError( error ); } @@ -332,9 +332,9 @@ void CDRMMessageParser::ConstructL() { // Make some extra room for crazy b64decode(). - iInputBuffer.Set( reinterpret_cast< TUint8* >( - User::AllocL( KInputBufferSize + 2 ) ), - 0, + iInputBuffer.Set( reinterpret_cast< TUint8* >( + User::AllocL( KInputBufferSize + 2 ) ), + 0, KInputBufferSize ); } @@ -351,30 +351,30 @@ TPtrC8 res( NULL, 0 ); TBool cont( ETrue ); TInt remainder( 0 ); - - // Loop until + + // Loop until // - PrepareContentDataL leaves // - boundary end marker is found // - iInputBuffer is not updated anymore. - for ( PrepareContentDataL(); - iInputBuffer.Length() && - ( remainder != iInputBuffer.Length() ) && + for ( PrepareContentDataL(); + iInputBuffer.Length() && + ( remainder != iInputBuffer.Length() ) && cont; PrepareContentDataL() ) { TInt pos = iInputBuffer.Find( *iBoundary ); - + if ( pos >= 0 ) { - if ( pos < KBoundaryMarkLength + 1 ) + if ( pos < KBoundaryMarkLength + 1 ) { SetBrokenStateL( KDRMMessageMalformed ); } - + res.Set( iInputBuffer.Left( pos - KBoundaryMarkLength ) ); - + StripEndLineL( res ); - + cont = EFalse; } else @@ -383,33 +383,33 @@ // there may be only a part of boundary string in this buffer // and the rest is got from the next input descriptor. remainder = iBoundary->Length() + KBoundaryMarkLength + 1; - + if ( iInputBuffer.Length() <= remainder ) { return; } - - res.Set( iInputBuffer.Left( iInputBuffer.Length() - + + res.Set( iInputBuffer.Left( iInputBuffer.Length() - remainder ) ); } - + if ( iState & EBase64 ) { iUsedFromInput = HandleBase64DataL( res ); } - + else { iUsedFromInput = res.Length(); } - + ProcessContentDataL( res ); - + CompressInputBuffer(); - remainder = iInputBuffer.Length(); + remainder = iInputBuffer.Length(); } - + if ( !cont ) { // Discard all the remaining data. @@ -431,34 +431,34 @@ void CDRMMessageParser::HandleRightsDataL() { TPtrC8 res( NULL, 0 ); - + do { res.Set( GetLineL() ); - + TInt pos = res.Find( *iBoundary ); - + if ( pos >= KBoundaryMarkLength ) { if ( res.Left( KBoundaryMarkLength ) == KBoundaryMark ) { - // Allow empty RO here. If it is not allowed by + // Allow empty RO here. If it is not allowed by // HandleRightsMessagePart(), an error is thrown. TBool last = EFalse; - + // Returns always true. IsBoundary( res, last ); - + if ( last ) { TInt error( KErrNone ); RPointerArray< CDRMRights > rights; - TPtrC8 ptr( iInputBuffer.Ptr(), + TPtrC8 ptr( iInputBuffer.Ptr(), pos - KBoundaryMarkLength ); - + error = ProcessRightsObject(ptr, rights); rights.ResetAndDestroy(); - + if ( !error ) { SetBit( EAllDone ); @@ -470,25 +470,25 @@ } else { - // Save the RO since the CID needs to be either changed + // Save the RO since the CID needs to be either changed // or created. - iRightsData = iInputBuffer.Left( iUsedFromInput - + iRightsData = iInputBuffer.Left( iUsedFromInput - res.Length() ).AllocL(); } - + CompressInputBuffer(); - + ClearBit( EReadingRightsPart ); ClearBit( EGotContentType ); ClearBit( EGotContentEncoding ); SetBit( EGotRightsPart ); SetBit( EReadingHeaderPart ); - + res.Set( NULL, 0 ); #ifndef __DRM_FULL User::Leave(KErrNotSupported); -#endif +#endif } else { @@ -514,31 +514,31 @@ void CDRMMessageParser::FindBoundaryL() { TPtrC8 line( NULL, 0 ); - + FOREVER { line.Set( GetLineL() ); - + if ( line.Length() > KBoundaryMarkLength ) { TInt size = 0; - + if ( line.Left( KBoundaryMarkLength ) == KBoundaryMark ) { size = line.Length() - KBoundaryMarkLength - 1; - + if ( line[ line.Length() - 2 ] == '\r' ) { --size; } - + iBoundary = line.Mid( KBoundaryMarkLength, size ).AllocL(); - + SetBit( EGotBoundary ); SetBit( EReadingHeaderPart ); - + CompressInputBuffer(); - + return; } } @@ -549,7 +549,7 @@ return; } } - + // Something else, not interested. CompressInputBuffer(); } @@ -558,8 +558,8 @@ // ---------------------------------------------------------------------------- // CDRMMessageParser::ReadHeaderL // The boundary is read and the following part is (should be) either a RO part -// or content part. The data is kept in iInputBuffer until the whole header -// part of the MIME header part is received. After plain "\r\n" line is +// or content part. The data is kept in iInputBuffer until the whole header +// part of the MIME header part is received. After plain "\r\n" line is // received and content-type is defined, iState is updated. // ---------------------------------------------------------------------------- // @@ -567,16 +567,16 @@ { TPtrC8 line( NULL, 0 ); TPtrC8 ptr( NULL, 0 ); - + FOREVER { /////////////////////////////////////////////////////////////////// // Process the MIME header line-by-line. Process the lines if they - // contain some information that is found useful. Update the + // contain some information that is found useful. Update the // internal state according to findings. /////////////////////////////////////////////////////////////////// line.Set( GetLineL() ); - + if ( line.Length() ) { if ( line == KEndLine || line == KNewLine ) @@ -586,18 +586,18 @@ /////////////////////////////////////////////// if ( iState & EGotContentType ) { - // Sanity check: Either EReadingRightsPart or + // Sanity check: Either EReadingRightsPart or // EReadingContentPart must defined. __ASSERT_DEBUG( ( iState & EReadingRightsPart ) || - ( iState & EReadingContentPart ), + ( iState & EReadingContentPart ), User::Invariant() ); - + ClearBit( EReadingHeaderPart ); - + CompressInputBuffer(); - + // Check which part was read. - // If content part is being processed, some checkings + // If content part is being processed, some checkings // need to be made. if ( iState & EReadingContentPart ) { @@ -608,53 +608,53 @@ // CD DCF. SetBrokenStateL( KErrCANotSupported ); } - + InitDCFBufferL(); SetBit( EDCFFile ); } else { - // Non-DCF FL content or normal CD content. + // Non-DCF FL content or normal CD content. // Create or modify the CID, save the RO. HandleFlContentL(); - + iDcfCreator->EncryptInitializeL( iOutputStream, *iContentType, iRightsObject ); SetBit( EEncryptStreamOk ); - - // The RO handle iRightsObject is kept in order - // to delete the rights in case of content - // encryption error. In that case, this will + + // The RO handle iRightsObject is kept in order + // to delete the rights in case of content + // encryption error. In that case, this will // generate unnecessary "RO Added / RO Deleted" // notifications, but so what. "More correct" - // way of doing would be modifying - // EncryptInitialize not to + // way of doing would be modifying + // EncryptInitialize not to // save the RO, but then the key would have to // be given to it by other means. Since we are - // not their "friend" class, we cannot access + // not their "friend" class, we cannot access // their members, and making them to ask our // members when doing EncryptInitialize/Finalize // might cause some problems perhaps. } - + delete iContentType; iContentType = NULL; } - + return; } - + // Empty MIME header. SetBrokenStateL( KDRMMessageMalformed ); } - + /////////////////////////////////// // Check the line for content-type. /////////////////////////////////// - if ( line.Length() > KContentType().Length() && + if ( line.Length() > KContentType().Length() && !( line.Left( KContentType().Length() ).CompareF( KContentType ) ) ) { if ( iState & EGotContentType ) @@ -662,11 +662,11 @@ // Content-type given twice. SetBrokenStateL( KDRMMessageMalformed ); } - + ptr.Set( HeaderValueL( line ) ); - + SetBit( EGotContentType ); - + // Which part this is: rights or the actual content? if ( ( ptr.CompareF( KDRMXMLRightsType ) == 0 ) || ( ptr.CompareF( KDRMWBXMLRightsType ) == 0 ) ) @@ -676,7 +676,7 @@ // Rights are given twice. SetBrokenStateL( KDRMMessageMalformed ); } - + SetBit( EReadingRightsPart ); } else @@ -685,9 +685,9 @@ { SetBrokenStateL( KDRMMessageMalformed ); } - + SetBit( EReadingContentPart ); - + // Content-type is saved for future use. iContentType = ptr.AllocL(); } @@ -706,12 +706,12 @@ // Double line. SetBrokenStateL( KDRMMessageMalformed ); } - + ptr.Set( HeaderValueL( line ) ); - + SetBit( EGotContentEncoding ); - // Throw an error if content-transfer-encoding + // Throw an error if content-transfer-encoding // is something we don't support. if ( ptr.CompareF( KEncoding8bit ) && ptr.CompareF( KEncoding7bit) && @@ -721,7 +721,7 @@ { SetBrokenStateL( KErrCANotSupported ); } - + // So it has to be Base64. SetBit( EBase64 ); } @@ -732,20 +732,20 @@ // Check the line for end boundary marker. ////////////////////////////////////////// TBool final( EFalse ); - + if ( IsBoundary( line, final ) ) { SetBrokenStateL( KDRMMessageMalformed ); } - - // Else: some X-field, parameter or something else. + + // Else: some X-field, parameter or something else. // The line is ignored. } } - + CompressInputBuffer(); } - + else { // No line available yet. @@ -763,32 +763,32 @@ { TInt pos = 0; TPtrC8 res( NULL, 0 ); - + if ( iInputBuffer.Length() > iUsedFromInput ) { pos = iInputBuffer.Mid( iUsedFromInput ).Find( KNewLine ); - + if ( pos >= 0 ) { res.Set( iInputBuffer.Mid( iUsedFromInput, pos - iUsedFromInput + 1 ) ); iUsedFromInput = pos + 1; } } - + if ( res.Length() == 0 ) { if ( iInputData.Length() ) { pos = iInputData.Find( KNewLine ); - + if ( pos < 0 ) { - if ( iInputBuffer.MaxSize() - iInputBuffer.Length() < + if ( iInputBuffer.MaxSize() - iInputBuffer.Length() < iInputData.Length() ) { SetBrokenStateL( KDRMMessageMalformed ); } - + iInputBuffer.Append( iInputData ); iInputData.Set( NULL, 0 ); } @@ -799,16 +799,16 @@ { SetBrokenStateL( KDRMMessageMalformed ); } - + iInputBuffer.Append( iInputData.Left( pos + 1 ) ); res.Set( iInputBuffer.Mid( iUsedFromInput ) ); iUsedFromInput = iInputBuffer.Length(); - + iInputData.Set( iInputData.Mid( pos + 1 ) ); } } } - + return res; } @@ -821,23 +821,23 @@ { TInt pos( 0 ); TPtrC8 res( NULL, 0 ); - + pos = aLine.Find( KColon ); - + if ( pos <= 0 ) { SetBrokenStateL( KDRMMessageMalformed ); } - + pos += 1; - - while ( pos < aLine.Length() && + + while ( pos < aLine.Length() && TChar( aLine[ pos ] ).IsSpace() ) { ++pos; } - // Don't overindex. + // Don't overindex. if ( pos == aLine.Length() ) { // Full of whitespaces. @@ -847,27 +847,27 @@ // Drop possible parameters. res.Set( aLine.Mid( pos ) ); pos = res.Find( KSemiColon ); - + if ( pos >= 0 ) { res.Set( res.Left( pos ) ); } - + pos = res.Length(); - + if ( !pos ) { // Just parameters, no actual value. SetBrokenStateL( KDRMMessageMalformed ); } - // This can't underflow, since otherwise there would be only + // This can't underflow, since otherwise there would be only // semicolon & parameters (checked earlier). while( TChar( res[ pos - 1 ] ).IsSpace() ) { --pos; } - + return res.Left( pos ); } @@ -881,11 +881,11 @@ if ( iUsedFromInput ) { const TInt size = iInputBuffer.Length() - iUsedFromInput; - + Mem::Copy( const_cast< TUint8* >( iInputBuffer.Ptr() ), iInputBuffer.Ptr() + iUsedFromInput, size ); - + iInputBuffer.SetLength( size ); iUsedFromInput = 0; } @@ -904,20 +904,20 @@ { SetBrokenStateL( KDRMMessageMalformed ); } - - const TInt size = Min( iInputBuffer.MaxSize() - iInputBuffer.Length(), + + const TInt size = Min( iInputBuffer.MaxSize() - iInputBuffer.Length(), iInputData.Length() ); - + iInputBuffer.Append( iInputData.Left( size ) ); - + iInputData.Set( iInputData.Mid( size ) ); } } - + // ----------------------------------------------------------------------------- // CDRMMessageParser::HandleBase64DataL // Decode base64 encoded data from and to aData descriptor. -// +// // ----------------------------------------------------------------------------- // TInt CDRMMessageParser::HandleBase64DataL( TPtrC8& aData ) @@ -938,19 +938,19 @@ } } } - + if ( consumed != aData.Ptr() ) { - User::LeaveIfError( b64decode( const_cast< TUint8* >( aData.Ptr() ), + User::LeaveIfError( b64decode( const_cast< TUint8* >( aData.Ptr() ), consumed - aData.Ptr() + 1, - const_cast< TUint8* >( aData.Ptr() ), + const_cast< TUint8* >( aData.Ptr() ), &temp1 ) ); - + aData.Set( aData.Ptr(), temp1 ); temp1 = consumed - aData.Ptr() + 1; } - + else { aData.Set( aData.Ptr(), 0 ); @@ -970,17 +970,17 @@ void CDRMMessageParser::StripEndLineL( TPtrC8& aBuf ) { TInt newSize( aBuf.Length() ); - + if ( aBuf.Right( 1 ) == KNewLine ) { --newSize; - - if ( ( aBuf.Length() > 1 ) && + + if ( ( aBuf.Length() > 1 ) && ( aBuf.Right( 2 ) == KEndLine ) ) { --newSize; } - + aBuf.Set( aBuf.Left( newSize ) ); } else @@ -995,28 +995,28 @@ // the end boundary. // ----------------------------------------------------------------------------- // -TBool CDRMMessageParser::IsBoundary( const TDesC8& aLine, TBool& aLast ) const +TBool CDRMMessageParser::IsBoundary( const TDesC8& aLine, TBool& aLast ) const { TBool res = EFalse; - + __ASSERT_DEBUG( iBoundary, User::Invariant() ); - + if ( iState & EGotBoundary ) { if ( aLine.Length() > KBoundaryMarkLength + iBoundary->Length() ) { TPtrC8 tmp( NULL, 0 ); - + if ( ( aLine.Left( KBoundaryMarkLength ) == KBoundaryMark ) && ( aLine.Mid( KBoundaryMarkLength, iBoundary->Length() ). Compare( *iBoundary ) == 0 ) ) { res = ETrue; - - tmp.Set( aLine.Right( aLine.Length() - - KBoundaryMarkLength - + + tmp.Set( aLine.Right( aLine.Length() - + KBoundaryMarkLength - iBoundary->Length() ) ); - + if ( ( tmp.Length() >= KBoundaryMarkLength ) && ( tmp.Left( KBoundaryMarkLength ) == KBoundaryMark ) ) { @@ -1025,7 +1025,7 @@ } } } - + return res; } @@ -1037,23 +1037,23 @@ void CDRMMessageParser::HandleFlContentL() { __ASSERT_DEBUG( !( iState & EDCFFile ), User::Invariant() ); - + if ( iRightsData ) { HBufC8* cid( NULL ); HBufC8* buf( NULL ); - + // RO was found from DRM message. CreateCDCIDL( cid ); CleanupStack::PushL( cid ); - + buf = iRightsData; CleanupStack::PushL( buf ); iRightsData = NULL; - - ProcessRightsDataL( *cid, + + ProcessRightsDataL( *cid, *buf ); - + CleanupStack::PopAndDestroy(); // buf CleanupStack::PopAndDestroy(); // cid } @@ -1069,19 +1069,19 @@ // ----------------------------------------------------------------------------- // CDRMMessageParser::ProcessRightsData -// Process DRM message -style rights object and fetch it to iRightsObject if +// Process DRM message -style rights object and fetch it to iRightsObject if // necessary. // ----------------------------------------------------------------------------- // -void CDRMMessageParser::ProcessRightsDataL( +void CDRMMessageParser::ProcessRightsDataL( const TDesC8& aCID, const TDesC8& aData ) { __ASSERT_DEBUG( !iRightsObject, User::Invariant() ); - + TInt start = aData.Find(KRightsStartTag); TInt end = aData.LocateReverse('>'); - + if ( start >= 0 && end > start ) { TDRMUniqueID localID( 0 ); @@ -1092,39 +1092,39 @@ TBuf8< KDCFKeySize > key; key.SetLength(KDCFKeySize); RPointerArray< CDRMRights > rights; - + TCleanupItem cleanup( DoResetAndDestroy, &rights ); CleanupStack::PushL( cleanup ); - + User::LeaveIfError( client.Connect() ); CleanupClosePushL( client ); - + parser = CDrmRightsParser::NewL(); CleanupStack::PushL( parser ); - + parser->ParseL( ptr, rights ); - + if (rights.Count()==0) - { - User::Leave(KErrCorrupt); - } - + { + User::Leave(KErrCorrupt); + } + client.GetRandomDataL(key); User::LeaveIfError( client.AddRecord( - key, - rights[0]->GetPermission(), - aCID, + key, + rights[0]->GetPermission(), + aCID, localID) ); - + iRightsObject = CDRMRights::NewL(); - + asset = CDRMAsset::NewLC(); asset->iUid = aCID.AllocL(); - + iRightsObject->SetAssetL(*asset); iRightsObject->SetPermissionL(rights[0]->GetPermission()); - + CleanupStack::PopAndDestroy( 4 ); // asset, parser, client, rights } else @@ -1135,7 +1135,7 @@ // ----------------------------------------------------------------------------- // CDRMMessageParser::ProcessContentDataL -// Handle DCF file's CID manipulation in "DCF in DRM message" case. +// Handle DCF file's CID manipulation in "DCF in DRM message" case. // Send the data to EncryptUpdateL if encryption is needed. // ----------------------------------------------------------------------------- // @@ -1165,9 +1165,9 @@ TBool CDRMMessageParser::ValidB64CharL( const TUint8 aChar ) { // Allowed characters are '0'...'9', 'A'...'Z', 'a'...'z', '+', '/', '=' - if ( ( aChar >= 48 && aChar <= 57 ) || + if ( ( aChar >= 48 && aChar <= 57 ) || ( aChar >= 65 && aChar <= 90 ) || - ( aChar >= 97 && aChar <= 122 ) || + ( aChar >= 97 && aChar <= 122 ) || ( aChar == 43 ) || ( aChar == 47 ) || ( aChar == 61 ) ) @@ -1177,7 +1177,7 @@ if ( ( aChar != 0x0D ) && ( aChar != 0x0A ) ) { - SetBrokenStateL( KDRMMessageMalformed ); + SetBrokenStateL( KDRMMessageMalformed ); } return EFalse; @@ -1185,29 +1185,29 @@ // ----------------------------------------------------------------------------- // DRMCommon::ProcessMessage -// +// // ----------------------------------------------------------------------------- EXPORT_C TInt CDRMMessageParser::ProcessMessage( HBufC8*& aDRMMessage) { TInt error( KErrNone ); TRAP( error, DoProcessMessageL( aDRMMessage ) ); - + return error; } - + // ----------------------------------------------------------------------------- // DRMCommon::ProcessRightsObject // Processes a rights objects and saves it in the rights database. // ----------------------------------------------------------------------------- EXPORT_C TInt CDRMMessageParser::ProcessRightsObject( - const TDesC8& aRightsObject, + const TDesC8& aRightsObject, RPointerArray& aRightsDetail) { TInt error( KErrNone ); TRAP( error, DoProcessRightsObjectL( aRightsObject, aRightsDetail ) ); - + return error; } @@ -1215,7 +1215,7 @@ { iState |= aBit; } - + void CDRMMessageParser::ClearBit( TUint32 aBit ) { iState &= ~aBit; @@ -1225,24 +1225,24 @@ { delete iDCFBuffer; iDCFBuffer = NULL; - + delete iDcfCreator; iDcfCreator = NULL; - + delete iRightsData; iRightsData = NULL; - + delete iRightsObject; iRightsObject = NULL; - + delete iBoundary; iBoundary = NULL; - + delete iContentType; iContentType = NULL; - + iInputBuffer.SetLength( 0 ); - + iState = ESearchingBoundary; iDCFHeaderSize[ 0 ] = KMaxTUint32; iDCFHeaderSize[ 1 ] = KMaxTUint32; @@ -1254,63 +1254,63 @@ RFileWriteStream output; RFile file; TInt size( 0 ); - + User::LeaveIfError( fileData.aFs.Connect() ); CleanupClosePushL( fileData.aFs ); TCleanupItem cleanup( DoDeleteFile, &fileData ); CleanupStack::PushL( cleanup ); - + #ifndef RD_MULTIPLE_DRIVE - User::LeaveIfError( output.Temp( fileData.aFs, - KTempPath, - fileData.aName, + User::LeaveIfError( output.Temp( fileData.aFs, + KTempPath, + fileData.aName, EFileWrite ) ); - + #else //RD_MULTIPLE_DRIVE - + TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); - fileData.aFs.DriveToChar( driveNumber, driveLetter ); - - TFileName tempPath; - tempPath.Format( KTempPath, (TUint)driveLetter ); + fileData.aFs.DriveToChar( driveNumber, driveLetter ); + + TFileName tempPath; + tempPath.Format( KTempPath, (TUint)driveLetter ); - User::LeaveIfError( output.Temp( fileData.aFs, - tempPath, - fileData.aName, + User::LeaveIfError( output.Temp( fileData.aFs, + tempPath, + fileData.aName, EFileWrite ) ); - + #endif - + CleanupClosePushL( output ); - + InitializeMessageParserL( output ); ProcessMessageDataL( *aDRMMessage ); FinalizeMessageParserL(); - + CleanupStack::PopAndDestroy(); // output - + User::LeaveIfError( file.Open( fileData.aFs, fileData.aName, EFileRead ) ); CleanupClosePushL( file ); - + User::LeaveIfError( file.Size( size ) ); - + if ( size > aDRMMessage->Des().MaxSize() ) { HBufC8* tmp( NULL ); - - delete aDRMMessage; + + delete aDRMMessage; aDRMMessage = NULL; - + tmp = HBufC8::NewLC( size ); TPtr8 data( tmp->Des() ); - + User::LeaveIfError( file.Read( data ) ); CleanupStack::Pop(); // tmp - + aDRMMessage = tmp; } else @@ -1318,22 +1318,22 @@ TPtr8 data( aDRMMessage->Des() ); User::LeaveIfError( file.Read( data ) ); } - + CleanupStack::PopAndDestroy( 3 ); // file, cleanup, fileData.aFs } -void CDRMMessageParser::DoProcessRightsObjectL( - const TDesC8& aRightsObject, +void CDRMMessageParser::DoProcessRightsObjectL( + const TDesC8& aRightsObject, RPointerArray& aRightsDetail ) { CDrmRightsParser* parser = NULL; TInt start; TInt end; TPtrC8 ptr(0, 0); - + start = aRightsObject.Find(KRightsStartTag); end = aRightsObject.LocateReverse('>'); - + TCleanupItem cleanup( DoResetAndDestroy, &aRightsDetail ); CleanupStack::PushL( cleanup ); @@ -1342,16 +1342,16 @@ // xml parser = CDrmRightsParser::NewL(); CleanupStack::PushL(parser); - - ptr.Set(&aRightsObject[start], end - start + 1); - + + ptr.Set(&aRightsObject[start], end - start + 1); + parser->ParseAndStoreL(ptr, aRightsDetail); - + if (aRightsDetail.Count() == 0) { User::Leave( KErrArgument ); } - + CleanupStack::PopAndDestroy(); // parser } else if (start == KErrNotFound ) @@ -1359,23 +1359,23 @@ // wbxml parser = CDrmRightsParser::NewL(CDrmRightsParser::EWbxmlParser); CleanupStack::PushL(parser); - + parser->ParseAndStoreL(aRightsObject, aRightsDetail); if (aRightsDetail.Count() == 0) { User::Leave( KErrArgument ); } - + CleanupStack::PopAndDestroy(); // parser } else { User::Leave( KErrArgument ); } - + CleanupStack::Pop(); // cleanup } - + void CDRMMessageParser::DeletePermission() { if ( iRightsObject ) @@ -1383,28 +1383,28 @@ if ( !( iState & EFLContent ) ) { HBufC8* URI = NULL; - + if ( !( iRightsObject->GetContentURI( URI ) ) ) { __ASSERT_DEBUG( URI, User::Invariant() ); - + RDRMRightsClient client; - + TInt error = client.Connect(); - + if ( !error ) { // Don't care if it fails. client.DeleteDbEntry( *URI, iRightsObject->GetLocalID() ); - + client.Close(); } - + delete URI; URI = NULL; } } - + delete iRightsObject; iRightsObject = NULL; } @@ -1414,7 +1414,7 @@ { SetBit( EBroken ); DeletePermission(); - + User::Leave( aError ); } @@ -1442,7 +1442,7 @@ CleanupStack::PopAndDestroy(); des = KFLPrefix; - + for (TInt i = 0; i < KCDPlainIDLength; i++) { des.AppendNumFixedWidth( id[i], EDecimal, 1 ); @@ -1450,28 +1450,28 @@ des.Append( KFLSuffix ); } - + TInt CDRMMessageParser::RetrieveFlRights() { __ASSERT_DEBUG( !iRightsObject, User::Invariant() ); - + RDRMRightsClient client; TInt error( client.Connect() ); - + if ( !error ) { TRAP( error, EnsureFLRightsExistL( client, &iRightsObject ) ); - + client.Close(); } - + return error; } void CDRMMessageParser::ProcessDCFDataL( TPtrC8& aDCFData ) { TBool doCommit( EFalse ); - + // Loop until all available data is either cached or processed. // What happens is // - modify Content-URI @@ -1485,52 +1485,52 @@ // Modify ContentURI. ////////////////////////////////////////////////////////////////// FillDCFBufferL( aDCFData ); - + if ( iDCFBuffer->Length() > 3 ) { TInt pos = 0; TUint8* data = const_cast< TUint8* > ( iDCFBuffer->Ptr() ); - + if ( data[ 0 ] != 1 ) { SetBrokenStateL( KDRMMessageMalformed ); } - - // Cache the data until - // - version, - // - ContentTypeLen, - // - ContentURILen, - // - ContentType and - // - ContentURI + + // Cache the data until + // - version, + // - ContentTypeLen, + // - ContentURILen, + // - ContentType and + // - ContentURI // have been received. pos = data[ 1 ] + 3; if ( iDCFBuffer->Length() < pos + data[ 2 ] ) { return; } - + // Sanity check. URI has to be more than four ("cid:") octets. if ( data[ 2 ] < 5 ) { SetBrokenStateL( KDRMMessageMalformed ); } - - if ( Mem::CompareF( &data[ pos ], + + if ( Mem::CompareF( &data[ pos ], KCIDStringLength, - KCIDString().Ptr(), + KCIDString().Ptr(), KCIDStringLength ) == 0 ) { // The data length doesn't change, so Mem::Copy() is safe. - Mem::Copy( &data[ pos ], - KFLPrefix().Ptr(), + Mem::Copy( &data[ pos ], + KFLPrefix().Ptr(), KFLKPrefixLength ); - + iOutputStream.WriteL( iDCFBuffer->Left( pos + data[ 2 ] ) ); - + doCommit = ETrue; CompressDCFBuffer( pos + data[ 2 ] ); - + SetBit( EDCFURIModified ); } else @@ -1553,52 +1553,52 @@ if ( !( iState & EDCFHeadersModified ) ) { FillDCFBufferL( aDCFData ); - + // Figure out how much data there is in the header part and/or // in the data part. if ( ( iDCFHeaderSize[ 0 ] == KMaxTUint32 ) && ( iDCFHeaderSize[ 1 ] == KMaxTUint32 ) ) { TUint8 used( 0 ); - + // uintvar has 1...5 octets and we need two uintvars before - // anything can be done. Still, there has to be at least + // anything can be done. Still, there has to be at least // 12 octets of data in total to make the DCF legal. But here // we just check the two uintvars. if ( iDCFBuffer->Length() < 10 ) { // Not enough data yet. - // No need to flush aDCFData at this point, since it + // No need to flush aDCFData at this point, since it // simply cannot contain anything at this point. __ASSERT_DEBUG( !aDCFData.Length(), User::Invariant() ); break; } - + // Read header field length & data length. for ( TUint8 count = 0; count < 2; ++count ) { TInt size( 0 ); - - TWspPrimitiveDecoder decoder( + + TWspPrimitiveDecoder decoder( iDCFBuffer->Mid( used ) ); size = decoder.UintVar( iDCFHeaderSize[ count ] ); - + // Sanity check. if ( size < 1 || iDCFHeaderSize[ count ] >= KMaxTInt ) { SetBrokenStateL( KDRMMessageMalformed ); } - + used += size; } - + CompressDCFBuffer( used ); } else { // We know the original header size now. // Wait until the whole header is read. - if ( static_cast< TUint32 >( iDCFBuffer->Length() ) < + if ( static_cast< TUint32 >( iDCFBuffer->Length() ) < iDCFHeaderSize[ 0 ] ) { if ( !aDCFData.Length() ) @@ -1613,78 +1613,78 @@ TUint length( 0 ); HBufC8* newHeader = NULL; - if ( FindDCFHeader( KRightsIssuer, - offset, + if ( FindDCFHeader( KRightsIssuer, + offset, length ) ) { // The header field exists. TInt pos( 0 ); - TPtr8 trim( const_cast< TUint8* >( + TPtr8 trim( const_cast< TUint8* >( iDCFBuffer->Ptr() ) + offset, - length, + length, length ); iDCFHeaderSize[ 0 ] -= length; // remove old data. - - // No colon, no header value. + + // No colon, no header value. pos = trim.Find( KColon ); if ( pos > 0 ) { - trim.Set( const_cast< TUint8* >( trim.Ptr() ) + pos + 1, + trim.Set( const_cast< TUint8* >( trim.Ptr() ) + pos + 1, trim.Length() - pos - 1, trim.Length() - pos - 1 ); // Skip whitespaces trim.TrimLeft(); trim.TrimRight(); - + if ( trim.Length() ) { // Something to process newHeader = EncryptDCFFieldLC( trim ); - + iDCFHeaderSize[ 0 ] += KRightsIssuer().Length(); iDCFHeaderSize[ 0 ] += newHeader->Length(); iDCFHeaderSize[ 0 ] += 3; // ":" and CRLF } } } - + // Write the uintvars to output. for ( TUint8 loop = 0; loop < 2; ++loop ) { TWspPrimitiveEncoder encoder; HBufC8* var( encoder.UintVarL( iDCFHeaderSize[ loop ] ) ); - + CleanupStack::PushL( var ); - + iOutputStream.WriteL( *var ); - + CleanupStack::PopAndDestroy(); // var } - + // Dump the header data to output stream. iOutputStream.WriteL( iDCFBuffer->Left( offset ) ); - + if ( newHeader ) { iOutputStream.WriteL( KRightsIssuer ); iOutputStream.WriteL( KColon ); iOutputStream.WriteL( *newHeader ); - + CleanupStack::PopAndDestroy(); // newHeader newHeader = NULL; - + iOutputStream.WriteL( KEndLine ); } - iOutputStream.WriteL( - iDCFBuffer->Right( iDCFBuffer->Length() - - offset - + iOutputStream.WriteL( + iDCFBuffer->Right( iDCFBuffer->Length() - + offset - length ) ); - + doCommit = ETrue; - + CompressDCFBuffer( iDCFBuffer->Length() ); SetBit( EDCFHeadersModified ); } @@ -1696,9 +1696,9 @@ __ASSERT_DEBUG( !( iDCFBuffer->Length() ), User::Invariant() ); iOutputStream.WriteL( aDCFData ); - + aDCFData.Set( NULL, 0 ); - + doCommit = ETrue; } } @@ -1718,7 +1718,7 @@ if ( iDCFBuffer->Length() == iDCFBuffer->Des().MaxSize() ) { - HBufC8* ptr = iDCFBuffer->ReAlloc( iDCFBuffer->Length() + + HBufC8* ptr = iDCFBuffer->ReAlloc( iDCFBuffer->Length() + KDefaultInputBufferSize ); if ( !ptr ) @@ -1728,16 +1728,16 @@ iDCFBuffer = ptr; } - - size = Min( iDCFBuffer->Des().MaxSize() - iDCFBuffer->Length(), + + size = Min( iDCFBuffer->Des().MaxSize() - iDCFBuffer->Length(), aData.Length() ); - + iDCFBuffer->Des().Append( aData.Left( size ) ); - + aData.Set( aData.Right( aData.Length() - size ) ); } } - + void CDRMMessageParser::CompressDCFBuffer( const TInt aHowMuch ) { __ASSERT_DEBUG( aHowMuch <= iDCFBuffer->Des().MaxSize(), User::Invariant() ); @@ -1748,7 +1748,7 @@ TUint& aOffset, TUint& aLength ) { - TPtrC8 des( const_cast< TUint8* >( iDCFBuffer->Ptr() ), + TPtrC8 des( const_cast< TUint8* >( iDCFBuffer->Ptr() ), Min( iDCFBuffer->Length(), iDCFHeaderSize[ 0 ] ) ); aOffset = 0; @@ -1770,43 +1770,43 @@ { pos += KEndLineLength; } - - if ( ( pos < aString.Length() ) || + + if ( ( pos < aString.Length() ) || ( des.Left( aString.Length() ).CompareF( aString ) != 0 ) ) { // Skip the line, since this can't be the one we're looking for. - des.Set( des.Right( des.Length() - + des.Set( des.Right( des.Length() - pos ) ); } else { aOffset = des.Ptr() - iDCFBuffer->Ptr(); aLength = pos; - + return ETrue; } } - + // Never reached. return EFalse; } - -void CDRMMessageParser::EnsureFLRightsExistL( - RDRMRightsClient& aClient, + +void CDRMMessageParser::EnsureFLRightsExistL( + RDRMRightsClient& aClient, CDRMRights** aOutput ) { HBufC8* cid( NULL ); CDRMRights* perm( NULL ); RPointerArray< CDRMPermission > rights( 1 ); - + TCleanupItem cleanup( DoResetAndDestroy2, &rights ); CleanupStack::PushL( cleanup ); - + User::LeaveIfError( aClient.ForwardLockURI( cid ) ); CleanupStack::PushL( cid ); - + TRAPD( error, aClient.GetDBEntriesL( *cid, rights ) ); - + if ( !error ) { ConvertPermissionL( perm, *( rights[ 0 ] ), *cid ); @@ -1816,28 +1816,28 @@ { HBufC8* fl( NULL ); RPointerArray< CDRMRights > rightslist( 1 ); - + TCleanupItem cleanup2( DoResetAndDestroy, &rightslist ); CleanupStack::PushL( cleanup2 ); - + fl = HBufC8::NewLC( KFLROSize + cid->Length() ); - + *fl = KROPart1; fl->Des().Append( *cid ); fl->Des().Append( KROPart2 ); - + User::LeaveIfError( ProcessRightsObject( *fl, rightslist ) ); - + CleanupStack::PopAndDestroy(); // fl perm = rightslist[ 0 ]; rightslist.Remove( 0 ); - + CleanupStack::PopAndDestroy(); // cleanup2 - + error = KErrNone; } - + CleanupStack::PopAndDestroy(); // cid if ( !error ) @@ -1852,7 +1852,7 @@ delete perm; perm = NULL; } } - + CleanupStack::PopAndDestroy(); // cleanup } @@ -1861,23 +1861,23 @@ { HBufC8* res = NULL; RDRMRightsClient client; - + User::LeaveIfError( client.Connect() ); CleanupClosePushL( client ); // Make sure FL rights exists. EnsureFLRightsExistL( client, NULL ); - User::LeaveIfError( + User::LeaveIfError( client.EncodeRightsIssuerField( aOldHeader, res ) ); - + CleanupStack::PopAndDestroy(); // client CleanupStack::PushL( res ); return res; } - + // ========================== OTHER EXPORTED FUNCTIONS ========================= // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/dm/src/Oma1DcfCreator.cpp --- a/omadrm/drmengine/dm/src/Oma1DcfCreator.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/dm/src/Oma1DcfCreator.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -30,19 +30,19 @@ #include #include "Oma1DcfCreator.h" #include "DRMRightsClient.h" -#include "DRMPermission.h" -#include "DRMConstraint.h" +#include "DrmPermission.h" +#include "DrmConstraint.h" #include "DRMCommon.h" #include "DrmKeyStorage.h" // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS -static const TInt KMaxEncryptionSize = 2048; +static const TInt KMaxEncryptionSize = 2048; // MACROS @@ -64,7 +64,7 @@ { iEncryptionStream = NULL; iEncryptionBuffer = NULL; - } + } // ----------------------------------------------------------------------------- // COma1DcfCreator::ConstructL @@ -83,13 +83,13 @@ EXPORT_C COma1DcfCreator* COma1DcfCreator::NewL() { COma1DcfCreator* self = new COma1DcfCreator(); - + User::LeaveIfNull(self); - + CleanupStack::PushL(self); self->ConstructL(); CleanupStack::Pop(); - + return self; } @@ -105,11 +105,11 @@ // ----------------------------------------------------------------------------- // COma1DcfCreator:: -// +// // ----------------------------------------------------------------------------- EXPORT_C void COma1DcfCreator::EncryptInitializeL( RWriteStream& anOutput, - const TDesC8& aMIMEType, + const TDesC8& aMIMEType, CDRMRights* aRightsObject) { const TUint KVersion = 1; @@ -130,7 +130,7 @@ if (err == KErrCANoRights) { key.SetLength(KDCFKeySize); - iRdb.GetRandomDataL(key); + iRdb.GetRandomDataL(key); User::LeaveIfError(iRdb.AddRecord(key, aRightsObject->GetPermission(), uri, id)); User::LeaveIfError(iRdb.InitializeKey(uri)); @@ -181,9 +181,9 @@ anOutput.CommitL(); iBytesWritten += 3 + aMIMEType.Size() + 2 + KLDFHeader().Size() + iIv.Size(); - + CleanupStack::PopAndDestroy(); // rights - } + } // ----------------------------------------------------------------------------- // COma1DcfCreator::EncryptUpdateL @@ -196,7 +196,7 @@ TInt size; TPtr8 ptr(iEncryptionBuffer->Des()); TPtrC8 data; - + data.Set(aMessageData); if (iRemainder.Size() > 0 && iRemainder.Size() + data.Size() >= KDCFKeySize) { @@ -210,7 +210,7 @@ data.Set(data.Right(data.Size() - n)); iRemainder.SetLength(0); } - + size = data.Size(); for (i = 0; size > KDCFKeySize; i += KMaxEncryptionSize) { @@ -233,7 +233,7 @@ EXPORT_C void COma1DcfCreator::EncryptFinalizeL() { TPtr8 ptr(iEncryptionBuffer->Des()); - + ptr.Copy(iRemainder); iRdb.Encrypt(iIv, ptr, ETrue); iEncryptionStream->WriteL(ptr); @@ -249,8 +249,8 @@ // content with the DCF. // ----------------------------------------------------------------------------- EXPORT_C void COma1DcfCreator::EncryptContentL( - HBufC8*& aContent, - const TDesC8& aMIMEType, + HBufC8*& aContent, + const TDesC8& aMIMEType, CDRMRights* aRightsObject) { RMemWriteStream output; @@ -259,7 +259,7 @@ size = aContent->Length() + aMIMEType.Length() + - KLDContentURI().Length() + + KLDContentURI().Length() + KLDFHeader().Length() + 256; buffer = User::Alloc(size); User::LeaveIfNull(buffer); @@ -282,18 +282,18 @@ // Turn a plain content file into a DCF. // ----------------------------------------------------------------------------- EXPORT_C void COma1DcfCreator::EncryptFileL( - const TDesC& aFileName, - const TDesC& aDCFFileName, - const TDesC8& aMIMEType, + const TDesC& aFileName, + const TDesC& aDCFFileName, + const TDesC8& aMIMEType, CDRMRights* aRightsObject) { - TInt r = KErrNone; + TInt r = KErrNone; RFs fs; RFile input; RFileWriteStream output; HBufC8* buf = HBufC8::NewLC(8000); TPtr8 buffer(const_cast(buf->Ptr()),0,8000); - + User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); @@ -302,26 +302,26 @@ if(r == KErrInUse) { r = input.Open(fs, aFileName, EFileRead | EFileShareAny); - + if(r == KErrInUse) { - User::LeaveIfError(input.Open(fs, aFileName, EFileRead | + User::LeaveIfError(input.Open(fs, aFileName, EFileRead | EFileShareReadersOnly)); - r = KErrNone; + r = KErrNone; } } - - User::LeaveIfError( r ); - + + User::LeaveIfError( r ); + CleanupClosePushL(input); - + User::LeaveIfError(output.Replace(fs, aDCFFileName, EFileWrite)); - CleanupClosePushL(output); - - + CleanupClosePushL(output); + + EncryptInitializeL(output, aMIMEType, aRightsObject); - + do { input.Read(buffer, buffer.MaxSize()); @@ -333,7 +333,7 @@ } } while (buffer.Size() > 0); - + EncryptFinalizeL(); CleanupStack::PopAndDestroy(4); // output, input, fs, buf @@ -344,9 +344,9 @@ // Encrypt plain content to a DCF and stores it in a file. // ----------------------------------------------------------------------------- EXPORT_C void COma1DcfCreator::EncryptContentToFileL( - const TDesC8& aContent, - const TDesC& aFileName, - const TDesC8& aMIMEType, + const TDesC8& aContent, + const TDesC& aFileName, + const TDesC8& aMIMEType, CDRMRights* aRightsObject) { RFs fs; diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/dm/src/b64.cpp --- a/omadrm/drmengine/dm/src/b64.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/dm/src/b64.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -17,7 +17,7 @@ #include -#include "base64.h" +#include "Base64.h" /* 6 LOCAL DEFINITIONS */ @@ -25,19 +25,19 @@ /* 6.2 Local constants */ -LOCAL_C const TUint8 pBase64[] = - { - 0x3e, 0x7f, 0x7f, 0x7f, 0x3f, 0x34, 0x35, 0x36, - 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x7f, - 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x01, - 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, - 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, - 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, - 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x1a, 0x1b, - 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, - 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, - 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33 - }; +LOCAL_C const TUint8 pBase64[] = + { + 0x3e, 0x7f, 0x7f, 0x7f, 0x3f, 0x34, 0x35, 0x36, + 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x7f, + 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x01, + 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, + 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, + 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, + 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x1a, 0x1b, + 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, + 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, + 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33 + }; /* 6.3 Local macros */ #define b64blocks(l) (((l) + 2) / 3 * 4) @@ -59,7 +59,7 @@ /* Functional description * - * This function does base64 decoding. As the outputted buffer is always 33% shorter than + * This function does base64 decoding. As the outputted buffer is always 33% shorter than * the input buffer, the caller may want to reallocate the buffer after calling this function. * * Parameters @@ -84,145 +84,145 @@ * * Return values * - * byte 0 if OK else > 0 + * byte 0 if OK else > 0 */ /* ---------------------------------------------------------------------- */ TInt b64decode(TUint8 *source, TUint32 length, TUint8 *destination, TUint32 *destination_length) - { - /* Data structures */ + { + /* Data structures */ + + /* Code */ - /* Code */ - - TUint8 *buf/*, *pbuf*/; /* Decoding buffer pointers. */ - register TUint32 x = 0; /* General purpose integers. */ - TUint32 buf_index = 0; /* current index in destination buffer */ + TUint8 *buf/*, *pbuf*/; /* Decoding buffer pointers. */ + register TUint32 x = 0; /* General purpose integers. */ + TUint32 buf_index = 0; /* current index in destination buffer */ + - - /* buffer to avoid allocating wholly new buffer for output */ - TUint8 localBuffer[4] = {0,0,0,0}; - TUint8* pLocalBufferOutPointer = 0; - - register TUint32 i = 0; - TUint32 num; + /* buffer to avoid allocating wholly new buffer for output */ + TUint8 localBuffer[4] = {0,0,0,0}; + TUint8* pLocalBufferOutPointer = 0; + + register TUint32 i = 0; + TUint32 num; TUint8 c = 0; /* Character to decode. */ TUint8 localBufferIndex = 0; - /* int32 buf_length = 0; */ /* new length of destination buf */ - const TUint8 pad = 0x3d; /* '=' */ + /* int32 buf_length = 0; */ /* new length of destination buf */ + const TUint8 pad = 0x3d; /* '=' */ - if(!source || length == 0 || !destination || !destination_length) - { - return KErrArgument; - } + if(!source || length == 0 || !destination || !destination_length) + { + return KErrArgument; + } - /* Collating sequence independant "===". */ + /* Collating sequence independant "===". */ - /* Calculate the amount of '=' in the end of the source */ - for(x=0, buf=source + (length-1); *buf == pad; buf --) - { - x++; - } + /* Calculate the amount of '=' in the end of the source */ + for(x=0, buf=source + (length-1); *buf == pad; buf --) + { + x++; + } - /* max allow 3 "===" in the end of content */ - if (x > 3) - { - return KErrArgument; - } + /* max allow 3 "===" in the end of content */ + if (x > 3) + { + return KErrArgument; + } - /* Save the encoded string pointer. */ - // pbuf = destination; + /* Save the encoded string pointer. */ + // pbuf = destination; - /* save address for first output block */ - pLocalBufferOutPointer = destination; - x = 0; /* Initialize index. */ + /* save address for first output block */ + pLocalBufferOutPointer = destination; + x = 0; /* Initialize index. */ - localBufferIndex = 0; + localBufferIndex = 0; - Mem::Copy(localBuffer, source, 4); + Mem::Copy(localBuffer, source, 4); - for (i = length; i != 0; i-- ) /* Decode every byte of the base 64 string */ - { - /* c = *pbuf++; */ - c = localBuffer[localBufferIndex++]; + for (i = length; i != 0; i-- ) /* Decode every byte of the base 64 string */ + { + /* c = *pbuf++; */ + c = localBuffer[localBufferIndex++]; + + if(localBufferIndex == 4) + { + localBufferIndex = 0; + + source = source + 4; - if(localBufferIndex == 4) - { - localBufferIndex = 0; - - source = source + 4; + /* INPUT: copy next input block to local buffer */ + num = i > 4 ? 4 : i - 1; + if(num > 0) + { + Mem::Copy(localBuffer, source, num); + } + } - /* INPUT: copy next input block to local buffer */ - num = i > 4 ? 4 : i - 1; - if(num > 0) - { - Mem::Copy(localBuffer, source, num); - } - } + /* Ignore "=". */ + if (c == pad) + { + break; /* this must be the end of the buffer, or else ve have a invalid character */ + } + + if (c == '\n' || c == '\r' || c == '\t') /* ignore linefeed tab and cr */ + { + continue; + } - /* Ignore "=". */ - if (c == pad) - { - break; /* this must be the end of the buffer, or else ve have a invalid character */ - } - - if (c == '\n' || c == '\r' || c == '\t') /* ignore linefeed tab and cr */ - { - continue; - } - - /* Valid Base64 Index? */ - if (!b64valid(&c)) - { - /* b64free(buf); */ - return KErrArgument; - } - - /* Decode 4 byte words into 3 byte octets.*/ - switch(x % 4) - { - case 0: /* Byte 0 of word.*/ - pLocalBufferOutPointer[buf_index] = (TInt8)(c << 2); - break; - case 1: /* Byte 1 of word. */ - pLocalBufferOutPointer[buf_index] |= c >> 4; - buf_index ++; - pLocalBufferOutPointer[buf_index] = (TInt8)( (c & 0x0f) << 4 ); - break; - case 2: /* Byte 2 of word. */ - pLocalBufferOutPointer[buf_index] |= c >> 2; - buf_index ++; - pLocalBufferOutPointer[buf_index] = (TInt8)( (c & 0x03) << 6 ); - break; - case 3: /* Byte 3 of word. */ - pLocalBufferOutPointer[buf_index] |= c; - buf_index ++; - break; - default: /* useless, just to depress warnings */ - break; - } - - x++; /* Increment word byte. */ - + /* Valid Base64 Index? */ + if (!b64valid(&c)) + { + /* b64free(buf); */ + return KErrArgument; + } - } /* while */ + /* Decode 4 byte words into 3 byte octets.*/ + switch(x % 4) + { + case 0: /* Byte 0 of word.*/ + pLocalBufferOutPointer[buf_index] = (TInt8)(c << 2); + break; + case 1: /* Byte 1 of word. */ + pLocalBufferOutPointer[buf_index] |= c >> 4; + buf_index ++; + pLocalBufferOutPointer[buf_index] = (TInt8)( (c & 0x0f) << 4 ); + break; + case 2: /* Byte 2 of word. */ + pLocalBufferOutPointer[buf_index] |= c >> 2; + buf_index ++; + pLocalBufferOutPointer[buf_index] = (TInt8)( (c & 0x03) << 6 ); + break; + case 3: /* Byte 3 of word. */ + pLocalBufferOutPointer[buf_index] |= c; + buf_index ++; + break; + default: /* useless, just to depress warnings */ + break; + } + + x++; /* Increment word byte. */ - /* make sure that there is zero at the end of the buffer - though buf[buf_index] shoule be zero after decoding - */ + } /* while */ + + + /* make sure that there is zero at the end of the buffer + though buf[buf_index] shoule be zero after decoding + */ + - - /* pbuf[buf_index+1] = 0; */ + /* pbuf[buf_index+1] = 0; */ - /*buf[buf_index+1]=0*/ - /* don't return the size of the buffer (buf_length), but the data size we put in (buf_index)*/ - *destination_length = buf_index; - return KErrNone; - } + /*buf[buf_index+1]=0*/ + /* don't return the size of the buffer (buf_length), but the data size we put in (buf_index)*/ + *destination_length = buf_index; + return KErrNone; + } /* 7.3 */ @@ -239,30 +239,30 @@ * * Return values * - * TRUE if character is valid else FALSE. + * TRUE if character is valid else FALSE. */ /* ---------------------------------------------------------------------- */ LOCAL_C TInt b64valid(TUint8 *c) - { - /* Data structures */ + { + /* Data structures */ - /* Code */ + /* Code */ - /* If not within the range of the table, return false. */ - if ((*c < 0x2b) || (*c > 0x7a)) - { - return 0; - } - /* If it falls within one of the gaps, return false. */ - if ((*c = pBase64[*c - 0x2b]) == 0x7f) - { - return 0; - } - - return 1; /* Otherwise, return true. */ - } + /* If not within the range of the table, return false. */ + if ((*c < 0x2b) || (*c > 0x7a)) + { + return 0; + } + /* If it falls within one of the gaps, return false. */ + if ((*c = pBase64[*c - 0x2b]) == 0x7f) + { + return 0; + } + + return 1; /* Otherwise, return true. */ + } /* 7.4 */ @@ -278,29 +278,29 @@ * * Return values * - * pointer to buffer + * pointer to buffer */ /* ---------------------------------------------------------------------- */ #ifdef BUILD_BASE64_ENCODE LOCAL TUint8 *b64buffer(TUint32 length) - { - /* Data structures */ + { + /* Data structures */ - /* Code */ + /* Code */ + + TUint8 *buf; /* buffer pointers. */ - TUint8 *buf; /* buffer pointers. */ - - if (!length) /* dont allow buf size 0 */ - { - return NULL; - } - - buf = (TUint8 *) DRM_BLOCK_ALLOC(length); - - return buf; /* Return the pointer or null. */ - } + if (!length) /* dont allow buf size 0 */ + { + return NULL; + } + + buf = (TUint8 *) DRM_BLOCK_ALLOC(length); + + return buf; /* Return the pointer or null. */ + } #endif /* #ifdef BUILD_BASE64_ENCODE */ /* End of File */ diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/drmbackup/src/DRMBackup.cpp --- a/omadrm/drmengine/drmbackup/src/DRMBackup.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/drmbackup/src/DRMBackup.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -22,14 +22,14 @@ #include #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif #include "DRMBackup.h" -#include "DRMLog.h" +#include "drmlog.h" #include "RoapStorageClient.h" -#include "DRMRightsDB.h" -#include "drmbackupinterface.h" +#include "drmrightsdb.h" +#include "DRMBackupInterface.h" /* #include "flogger.h" @@ -40,7 +40,7 @@ // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS const TInt KDoBackup = 0x00000001; @@ -74,7 +74,7 @@ LOCAL_C void CleanupData( TAny* aPtr ) { CDRMBackup* backup = reinterpret_cast( aPtr ); - + backup->PerformCleanup(); } @@ -88,16 +88,16 @@ // might leave. // ----------------------------------------------------------------------------- // -CDRMBackup::CDRMBackup( CDRMRightsDB* aRightsDatabase, +CDRMBackup::CDRMBackup( CDRMRightsDB* aRightsDatabase, RFs& aFileServer ) : - iFileServer( aFileServer ), + iFileServer( aFileServer ), iDRMRightsDB( aRightsDatabase ), iRightsFileSize( 0 ), iContextFileSize( 0 ), iPosition( 0 ), iReadData( 0 ), iStatus( 0 ) - { + { }; // ----------------------------------------------------------------------------- @@ -108,44 +108,44 @@ void CDRMBackup::ConstructL() { TInt error = KErrNone; - + #ifndef RD_MULTIPLE_DRIVE - + // Create the backup directory if needed error = iFileServer.MkDirAll( KBackupDirectory ); - + #else //RD_MULTIPLE_DRIVE - + TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); - iFileServer.DriveToChar( driveNumber, driveLetter ); - - TFileName backupDir; - backupDir.Format( KBackupDir, (TUint)driveLetter ); - + iFileServer.DriveToChar( driveNumber, driveLetter ); + + TFileName backupDir; + backupDir.Format( KBackupDir, (TUint)driveLetter ); + // Create the backup directory if needed error = iFileServer.MkDirAll( backupDir ); - + #endif - + if( error != KErrAlreadyExists ) { User::LeaveIfError( error ); } - + #ifndef RD_MULTIPLE_DRIVE - + iRightsFileName.Copy( KBackupDirectory ); - + #else //RD_MULTIPLE_DRIVE iRightsFileName.Copy( backupDir ); - + #endif - + iRightsFileName.Append( KRightsDbBackupFile ); - iSizeBuffer.SetLength( 4 ); + iSizeBuffer.SetLength( 4 ); }; // ----------------------------------------------------------------------------- @@ -153,14 +153,14 @@ // Two-phased constructor // ----------------------------------------------------------------------------- // -CDRMBackup* CDRMBackup::NewLC( CDRMRightsDB* aRightsDatabase, +CDRMBackup* CDRMBackup::NewLC( CDRMRightsDB* aRightsDatabase, RFs& aFileServer ) { - CDRMBackup* self = new(ELeave) CDRMBackup( aRightsDatabase, + CDRMBackup* self = new(ELeave) CDRMBackup( aRightsDatabase, aFileServer ); CleanupStack::PushL( self ); self->ConstructL(); - + return self; }; @@ -169,21 +169,21 @@ // Two-phased constructor // ----------------------------------------------------------------------------- // -CDRMBackup* CDRMBackup::NewL( CDRMRightsDB* aRightsDatabase, +CDRMBackup* CDRMBackup::NewL( CDRMRightsDB* aRightsDatabase, RFs& aFileServer ) { - CDRMBackup* self = NewLC( aRightsDatabase, + CDRMBackup* self = NewLC( aRightsDatabase, aFileServer ); CleanupStack::Pop(); return self; }; - + // --------------------------------------------------------- // CDRMBackup::~CDRMBackup // Destructor // --------------------------------------------------------- -// +// CDRMBackup::~CDRMBackup() { }; @@ -192,70 +192,70 @@ // --------------------------------------------------------- // CDRMBackup::AllSnapshotsSuppliedL // --------------------------------------------------------- -// +// void CDRMBackup::AllSnapshotsSuppliedL() { - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("AllSnapshotsSuppliedL\n\r")); + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("AllSnapshotsSuppliedL\n\r")); return; }; // --------------------------------------------------------- // CDRMBackup::ReceiveSnapshotDataL // --------------------------------------------------------- -// -void CDRMBackup::ReceiveSnapshotDataL(TDriveNumber /* aDrive */, - TDesC8& /* aBuffer */, +// +void CDRMBackup::ReceiveSnapshotDataL(TDriveNumber /* aDrive */, + TDesC8& /* aBuffer */, TBool /* aLastSection */) { - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RecieveSnapshotdataL\n\r")); + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RecieveSnapshotdataL\n\r")); User::Leave( KErrNotSupported ); }; // --------------------------------------------------------- // CDRMBackup::GetExpectedDataSize // --------------------------------------------------------- -// +// TUint CDRMBackup::GetExpectedDataSize(TDriveNumber /* aDrive */) { - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetExpectedDataSize\n\r")); + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetExpectedDataSize\n\r")); return 0; }; // --------------------------------------------------------- // CDRMBackup::GetSnapshotDataL // --------------------------------------------------------- -// -void CDRMBackup::GetSnapshotDataL(TDriveNumber /* aDrive */, - TPtr8& /* aBuffer */, +// +void CDRMBackup::GetSnapshotDataL(TDriveNumber /* aDrive */, + TPtr8& /* aBuffer */, TBool& /* aFinished */) { - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetSnapShopDataL\n\r")); + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetSnapShopDataL\n\r")); User::Leave( KErrNotSupported ); }; // --------------------------------------------------------- // CDRMBackup::InitialiseGetBackupDataL // --------------------------------------------------------- -// +// void CDRMBackup::InitialiseGetBackupDataL(TDriveNumber aDrive) { - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Init backup data\n\r")); + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Init backup data\n\r")); // Clean up existing data: PerformCleanup(); - + #ifndef RD_MULTIPLE_DRIVE - + // Only do a backup when backing up drive C if( aDrive == EDriveC ) - + #else //RD_MULTIPLE_DRIVE - + TInt driveNumber( -1 ); DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); - - // Only do a backup when backing up system drive + + // Only do a backup when backing up system drive if( aDrive == driveNumber ) - + #endif { iStatus |= KDoBackup; @@ -265,20 +265,20 @@ iStatus &= ~KDoBackup; return; } - - // Add the cleanup item to the cleanup stack + + // Add the cleanup item to the cleanup stack TCleanupItem resetAndDestroy( CleanupData, reinterpret_cast(this) ); CleanupStack::PushL( resetAndDestroy ); - + // This function needs to write the two files required to be backed up. - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Init: create rights file\n\r")); + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Init: create rights file\n\r")); // create the rights database backup file CreateRightsBackupFileL(); - - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Init: create context file\n\r")); + + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Init: create context file\n\r")); // create the context database backup file CreateContextBackupFileL(); - + // If everything went properly, pop CleanupStack::Pop(); }; @@ -286,110 +286,110 @@ // --------------------------------------------------------- // CDRMBackup::GetBackupDataSectionL // --------------------------------------------------------- -// +// void CDRMBackup::GetBackupDataSectionL(TPtr8& aBuffer, TBool& aFinished) { - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetBackupDataSectionL\n\r")); + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetBackupDataSectionL\n\r")); TInt seekAmount = 0; - + // if we are not supposed to do anything, just return if( !(iStatus & KDoBackup ) ) { - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetBackupDataSectionL: no Do Backup\n\r")); + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetBackupDataSectionL: no Do Backup\n\r")); aFinished = ETrue; return; } - + // Make sure that the buffer is empty and starts from the beginning aBuffer.SetLength(0); - - // Add the cleanup item to the cleanup stack + + // Add the cleanup item to the cleanup stack TCleanupItem resetAndDestroy( CleanupData, reinterpret_cast(this) ); CleanupStack::PushL( resetAndDestroy ); - + if( iPosition < iRightsFileSize ) - { - // Find the right position + { + // Find the right position iRightsBackupFile.Seek( ESeekStart,iPosition ); // Read data User::LeaveIfError( iRightsBackupFile.Read( aBuffer ) ); - + iPosition += aBuffer.Length(); - + if( iPosition == iRightsFileSize ) { aFinished = ETrue; } else - { - aFinished = EFalse; - } - + { + aFinished = EFalse; + } + } else if( iPosition < iRightsFileSize + iContextFileSize ) - { + { // Find the right position - seekAmount = iPosition-iRightsFileSize; + seekAmount = iPosition-iRightsFileSize; iContextBackupFile.Seek( ESeekStart, seekAmount ); - + // Read data User::LeaveIfError( iContextBackupFile.Read( aBuffer ) ); - + iPosition += aBuffer.Length(); - + if( iPosition-iRightsFileSize == iContextFileSize ) { aFinished = ETrue; } else - { - aFinished = EFalse; + { + aFinished = EFalse; } } else { - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetBackupDataSectionL - Error\n\r")); + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetBackupDataSectionL - Error\n\r")); User::Leave( KErrGeneral ); } - - // if we are finished, we can clean up the stuff otherwise not + + // if we are finished, we can clean up the stuff otherwise not if( aFinished ) { - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetBackupDataSectionL - Finished\n\r")); - CleanupStack::PopAndDestroy(); + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetBackupDataSectionL - Finished\n\r")); + CleanupStack::PopAndDestroy(); } else { - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetBackupDataSectionL - Continues\n\r")); - CleanupStack::Pop(); - } + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetBackupDataSectionL - Continues\n\r")); + CleanupStack::Pop(); + } }; // --------------------------------------------------------- // CDRMBackup::InitialiseRestoreBaseDataL // --------------------------------------------------------- -// +// void CDRMBackup::InitialiseRestoreBaseDataL(TDriveNumber aDrive) { - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("InitializeRestoreBaseDataL\n\r")); - + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("InitializeRestoreBaseDataL\n\r")); + // Clean up existing data: PerformCleanup(); - + #ifndef RD_MULTIPLE_DRIVE - + // Only do a restore when restoring drive C if( aDrive == EDriveC ) - + #else //RD_MULTIPLE_DRIVE - + TInt driveNumber( -1 ); DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); - + // Only do a restore when restoring drive C if( aDrive == driveNumber ) - + #endif { iStatus |= KDoBackup; @@ -404,25 +404,25 @@ // CDRMBackup::RestoreBaseDataSectionL // Create the files where the restore is performed from // --------------------------------------------------------- -// +// void CDRMBackup::RestoreBaseDataSectionL(TDesC8& aBuffer, TBool aFinished) { - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL\n\r")); - + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL\n\r")); + TInt seekAmount = 0; Roap::RRoapStorageClient client; TFileName tempFileName; TPtrC8 buffer( aBuffer ); - + if( !(iStatus & KDoBackup ) ) { return; } - - // Add the cleanup item to the cleanup stack + + // Add the cleanup item to the cleanup stack TCleanupItem resetAndDestroy( CleanupData, reinterpret_cast(this) ); - CleanupStack::PushL( resetAndDestroy ); - + CleanupStack::PushL( resetAndDestroy ); + // Read the size of the first file, even if it comes in one byte chunks if( iPosition == 0 && iReadData < 4 && !( iStatus & KRightsSizeRead ) ) { @@ -434,12 +434,12 @@ CleanupClosePushL( stream ); iRightsFileSize = stream.ReadInt32L(); CleanupStack::PopAndDestroy(); - + // Remove the 'used' data from the beginning of the data block buffer.Set( buffer.Mid( 4-iReadData ) ); - + iStatus |= KRightsSizeRead; - + iReadData = 0; } else @@ -448,17 +448,17 @@ { CleanupStack::PopAndDestroy(); return; - } + } // copy the data to the temp buffer Mem::Copy( const_cast( iSizeBuffer.Ptr() ) + iReadData, buffer.Ptr(), buffer.Length() ); iReadData += buffer.Length(); - CleanupStack::Pop(); - return; + CleanupStack::Pop(); + return; } } - - // Read the size of the 2nd file when it's needed: + + // Read the size of the 2nd file when it's needed: if( iPosition == iRightsFileSize && iReadData < 4 && !(iStatus & KContextSizeRead) ) { if( iReadData + buffer.Length() >= 4 ) @@ -469,10 +469,10 @@ CleanupClosePushL( stream ); iContextFileSize = stream.ReadInt32L(); CleanupStack::PopAndDestroy(); - + // Remove the 'used' data from the beginning of the data block buffer.Set( buffer.Mid( 4-iReadData ) ); - + iStatus |= KContextSizeRead; iReadData = 0; @@ -481,88 +481,88 @@ { if( aFinished ) { - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : buggy file(1)\n\r")); + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : buggy file(1)\n\r")); CleanupStack::PopAndDestroy(); return; - } + } // copy the data to the temp buffer Mem::Copy( const_cast( iSizeBuffer.Ptr()) + iReadData, buffer.Ptr(), buffer.Length() ); iReadData += buffer.Length(); - CleanupStack::Pop(); - return; - } + CleanupStack::Pop(); + return; + } } - + // Restore the two files: // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : before restore\n\r")); - + if( iPosition < iRightsFileSize ) { // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : restore starts\n\r")); if( !( iStatus & KRightsFileOpen ) ) { - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : replace the file\n\r")); + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : replace the file\n\r")); User::LeaveIfError( iRightsBackupFile.Replace( iFileServer, iRightsFileName, EFileRead|EFileWrite ) ); iStatus |= KRightsFileOpen; - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : write startn\r")); + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : write startn\r")); iRightsBackupFile.Write( iSizeBuffer, 4 ); - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : write end\n\r")); + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : write end\n\r")); iPosition += 4; } - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : before seek\n\r")); - // Find the right position + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : before seek\n\r")); + // Find the right position User::LeaveIfError( iRightsBackupFile.Seek( ESeekStart,iPosition ) ); - - - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : after seek\n\r")); + + + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : after seek\n\r")); // Read data User::LeaveIfError( iRightsBackupFile.Write( buffer ) ); - - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : after write\n\r")); + + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : after write\n\r")); iPosition += buffer.Length(); } else if( iPosition < iRightsFileSize + iContextFileSize ) { - + // Open the file if it's not open if( !( iStatus & KContextFileOpen ) ) { User::LeaveIfError( iContextBackupFile.Replace( iFileServer, - iContextFileName, + iContextFileName, EFileRead|EFileWrite ) ); - iStatus |= KContextFileOpen; + iStatus |= KContextFileOpen; iContextBackupFile.Write( iSizeBuffer, 4 ); iPosition += 4; } - + // Find the right position - seekAmount = iPosition-iRightsFileSize; + seekAmount = iPosition-iRightsFileSize; iContextBackupFile.Seek( ESeekStart, seekAmount ); - + // Read data User::LeaveIfError( iContextBackupFile.Write( buffer ) ); - + iPosition += buffer.Length(); } else { - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : error\n\r")); + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : error\n\r")); User::Leave( KErrGeneral ); } - - CleanupStack::Pop(); + + CleanupStack::Pop(); }; // --------------------------------------------------------- // CDRMBackup::InitialiseRestoreIncrementDataL // --------------------------------------------------------- -// +// void CDRMBackup::InitialiseRestoreIncrementDataL(TDriveNumber /* aDrive */) { - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("init incremental restore\n\r")); + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("init incremental restore\n\r")); User::Leave( KErrNotSupported ); }; @@ -572,7 +572,7 @@ // void CDRMBackup::RestoreIncrementDataSectionL(TDesC8& /* aBuffer */, TBool /* aFinished */) { - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("restore incremenetal\n\r")); + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("restore incremenetal\n\r")); User::Leave( KErrNotSupported ); }; @@ -580,64 +580,64 @@ // CDRMBackup::RestoreComplete // This function performs the actual restoring // --------------------------------------------------------- -// +// void CDRMBackup::RestoreComplete(TDriveNumber aDrive) { - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreComplete\n\r")); + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreComplete\n\r")); TInt error = KErrNone; TBool doUdt = EFalse; - + #ifndef RD_MULTIPLE_DRIVE - + // Only do a backup when backing up drive C if( aDrive != EDriveC ) - + #else //RD_MULTIPLE_DRIVE - + TInt driveNumber( -1 ); DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); - + // Only do a backup when backing up drive C if( aDrive != driveNumber ) - + #endif { - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreComplete : not Drive C\n\r")); + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreComplete : not Drive C\n\r")); return; } - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("PerformRightsMergeL\n\r")); + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("PerformRightsMergeL\n\r")); + - - // Merge the rights + // Merge the rights TRAP( error, PerformRightsMergeL() ); if( error ) { if( error == KErrPermissionDenied ) { - doUdt = ETrue; + doUdt = ETrue; } // Log some error error = KErrNone; } - - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("PerformContextMergeL\n\r")); + + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("PerformContextMergeL\n\r")); // Merge the Contexts TRAP( error, PerformContextMergeL() ); if( error ) { // Log some error - error = KErrNone; + error = KErrNone; } - - PerformCleanup( doUdt ); + + PerformCleanup( doUdt ); }; // --------------------------------------------------------- // CDRMBackup::TerminateMultiStageOperation // --------------------------------------------------------- -// +// void CDRMBackup::TerminateMultiStageOperation() { PerformCleanup(); @@ -646,35 +646,35 @@ // --------------------------------------------------------- // CDRMBackup::GetDataChecksum // --------------------------------------------------------- -// +// TUint CDRMBackup::GetDataChecksum(TDriveNumber /* aDrive */) { return 0; }; - + // --------------------------------------------------------- // CDRMBackup::CreateRightsBackupFileL // --------------------------------------------------------- -// +// void CDRMBackup::CreateRightsBackupFileL() { - // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Create backup file\n\r")); - + // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Create backup file\n\r")); + // Open the file and get the filename User::LeaveIfError( iRightsBackupFile.Replace( iFileServer, iRightsFileName, - EFileRead|EFileWrite ) ); - iStatus |= KRightsFileOpen; - + EFileRead|EFileWrite ) ); + iStatus |= KRightsFileOpen; + iDRMRightsDB->BackupContentToFileL( iRightsBackupFile, KNullDesC8 ); - + User::LeaveIfError( iRightsBackupFile.Size( iRightsFileSize ) ); }; // --------------------------------------------------------- // CDRMBackup::CreateContextBackupFileL // --------------------------------------------------------- -// +// void CDRMBackup::CreateContextBackupFileL() { //Roap::RRoapStorageClient client; @@ -682,88 +682,88 @@ // Open the file and get the filename /* User::LeaveIfError( iContextBackupFile.Replace( iFileServer, iContextFileName, - EFileRead|EFileWrite ) ); + EFileRead|EFileWrite ) ); iStatus |= KContextFileOpen; -*/ - // Connect to the roap storage server +*/ + // Connect to the roap storage server //User::LeaveIfError( client.Connect() ); //CleanupClosePushL( client ); - + //client.BackupContentToFileL( iContextBackupFile, KNullDesC8 ); }; // --------------------------------------------------------- // CDRMBackup::PerformRightsMergeL // --------------------------------------------------------- -// +// void CDRMBackup::PerformRightsMergeL() { if( iStatus & KRightsFileOpen ) { - iDRMRightsDB->RestoreContentFromFileL( iRightsBackupFile, KNullDesC8, + iDRMRightsDB->RestoreContentFromFileL( iRightsBackupFile, KNullDesC8, KDRMNormalBackup ); } - else + else { - User::Leave(KErrNotReady); + User::Leave(KErrNotReady); } }; // --------------------------------------------------------- // CDRMBackup::PerformContextMergeL // --------------------------------------------------------- -// +// void CDRMBackup::PerformContextMergeL() { //Roap::RRoapStorageClient client; - - // Connect to the roap storage server + + // Connect to the roap storage server //User::LeaveIfError( client.Connect() ); //CleanupClosePushL( client ); //client.RestoreContentFromFileL( iContextBackupFile, KNullDesC8 ); - + //CleanupStack::PopAndDestroy();// client }; // --------------------------------------------------------- // CDRMBackup::PerformCleanup // --------------------------------------------------------- -// +// void CDRMBackup::PerformCleanup( TBool aUdt ) { iRightsFileSize = 0; iContextFileSize = 0; - - if( iStatus & KRightsFileOpen ) + + if( iStatus & KRightsFileOpen ) { - if( !aUdt ) + if( !aUdt ) { - iRightsBackupFile.SetSize(0); + iRightsBackupFile.SetSize(0); } iRightsBackupFile.Close(); - + if( !aUdt ) { - iFileServer.Delete( iRightsFileName ); + iFileServer.Delete( iRightsFileName ); } } - - if( iStatus & KContextFileOpen ) + + if( iStatus & KContextFileOpen ) { if( !aUdt ) { - iContextBackupFile.SetSize(0); + iContextBackupFile.SetSize(0); } - iContextBackupFile.Close(); - + iContextBackupFile.Close(); + if( !aUdt ) { - iFileServer.Delete( iContextFileName ); - } + iFileServer.Delete( iContextFileName ); + } } iPosition = 0; diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/drmclock/Inc/DRMClock.h --- a/omadrm/drmengine/drmclock/Inc/DRMClock.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/drmclock/Inc/DRMClock.h Mon Mar 15 12:41:43 2010 +0200 @@ -26,7 +26,7 @@ #include // Type definitions #include #include -#include +#include #include // CONSTANTS @@ -40,6 +40,7 @@ // FORWARD DECLARATIONS class CDRMNitzObserver; class CDRMNotifier; +class CGPSWatcher; // CLASS DECLARATION @@ -52,6 +53,14 @@ NONSHARABLE_CLASS( CDRMClock ) { public: + // Notifications: + enum + { + ENotifyNone = 0, + ENotifyGPSTimeReceived = 1 + }; + + public: /** * NewLC @@ -106,6 +115,18 @@ */ void ResetSecureTimeL( const TTime& aSecureTime, const TInt& aTimeZone ); + + /** + * Notify + * + * Notifies about an event to the DRM Clock + * + * @since 9.2 + * @param Message The notification event + * + */ + void Notify( TInt aMessage ); + protected: private: /** @@ -140,6 +161,9 @@ RTelServer iEtelServer; RMobilePhone iPhone; CDRMNitzObserver* iObserver; + + // GPS watcher component, updates DRM time from GPS if available + CGPSWatcher* iGpsWatcher; }; #endif // DRMCLOCK_H diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/drmclock/Inc/GPSTimeUpdater.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadrm/drmengine/drmclock/Inc/GPSTimeUpdater.h Mon Mar 15 12:41:43 2010 +0200 @@ -0,0 +1,60 @@ + +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the GPS Watcher +* +*/ + + +#ifndef GPSTIMEUPDATER_H_ +#define GPSTIMEUPDATER_H_ + +#include +#include + +class CDRMClock; + +class CGPSTimeUpdater : public CActive + { +public: + ~CGPSTimeUpdater(); + static CGPSTimeUpdater* New( RPositionServer &aPosServer, + const TPositionModuleId& aModuleId, + CDRMClock* aClock ); + + inline const TPositionModuleId& ModuleId() { return iModuleId; } + + inline const TBool TimeReceived() { return iTimeReceived; } + +private: + CGPSTimeUpdater( RPositionServer &aPosServer, + const TPositionModuleId& aModuleId, + CDRMClock* aClock ); + void ConstructL(); + + void RunL(); + void DoCancel(); + TInt RunError( TInt aError ); + +private: + RPositionServer &iPosServer; + RPositioner iPositioner; + TPositionModuleId iModuleId; + + TPositionSatelliteInfo iSatelliteInfo; + CDRMClock* iClock; + TBool iTimeReceived; + }; + +#endif diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/drmclock/Inc/GPSWatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadrm/drmengine/drmclock/Inc/GPSWatcher.h Mon Mar 15 12:41:43 2010 +0200 @@ -0,0 +1,56 @@ + +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the GPS Watcher +* +*/ + + +#ifndef GPSWATCHER_H_ +#define GPSWATCHER_H_ + +#include + + +class CGPSTimeUpdater; +class CDRMClock; + +class CGPSWatcher : public CActive + { +public: + ~CGPSWatcher(); + static CGPSWatcher* NewL( CDRMClock* aClock ); + +private: + CGPSWatcher( CDRMClock* aClock ); + void ConstructL(); + + void CheckModules(); + void Subscribe(); + void RunL(); + void DoCancel(); + TInt RunError( TInt aError ); + +private: + RPositionServer iPosServer; + TPositionModuleStatusEvent iStatusEvent; + + // owned + CGPSTimeUpdater *iTimeUpdater; + + // not owned + CDRMClock* iClock; + }; + +#endif /* GPSWATCHER_H_ */ diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/drmclock/Src/DRMClock.cpp --- a/omadrm/drmengine/drmclock/Src/DRMClock.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/drmclock/Src/DRMClock.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -21,7 +21,7 @@ #include #include "DRMClock.h" -#include "DRMLog.h" +#include "drmlog.h" #include "DRMEventTimeChange.h" #include "wmdrmfileserverclient.h" @@ -32,10 +32,11 @@ #include #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif #include "DRMNitzObserver.h" +#include "GPSWatcher.h" // EXTERNAL DATA STRUCTURES @@ -85,6 +86,7 @@ void CDRMClock::ConstructL() { DRMLOG( _L( "DRM Clock Starting: " ) ); + TInt error = KErrNone; // Create a notifier instance iNotifier = CDRMNotifier::NewL(); @@ -95,9 +97,11 @@ iObserver = CDRMNitzObserver::NewL( iPhone, const_cast(this)); iObserver->Start(); + + TRAP( error, iGpsWatcher = CGPSWatcher::NewL( const_cast(this) )); + DRMLOG2( _L("DRMClock: GPS watcher started: %d"), error ); #endif - DRMLOG( _L( "DRM Clock started" ) ); }; @@ -158,6 +162,13 @@ delete iObserver; iObserver = 0; } + + if( iGpsWatcher ) + { + iGpsWatcher->Cancel(); + delete iGpsWatcher; + iGpsWatcher = 0; + } #endif // __WINS__ }; @@ -189,7 +200,7 @@ aTime.UniversalTime(); - aSecurityLevel = DRMClock::KInsecure; + aSecurityLevel = DRMClock::KInsecure; DRMLOG( _L( "CDRMClock::GetSecureTime: DRMClock is Insecure" ) ); } @@ -308,6 +319,31 @@ DRMLOG( _L( "CDRMClock::ResetSecureTimeL ok" ) ); }; +// --------------------------------------------------------- +// CDRMClock::Notify +// Notify DRM clock about an event +// --------------------------------------------------------- +// +void CDRMClock::Notify( TInt aNotify ) + { + switch( aNotify ) + { + case ENotifyGPSTimeReceived: + // GPS time received, listen again after the next boot, destroy GPS watcher: + DRMLOG(_L("Notify: ENotifyGPSTimeReceived, Deleting GPS watcher")); + delete iGpsWatcher; + iGpsWatcher = NULL; + DRMLOG(_L("Notify: GPS Watcher deleted")); + break; + case ENotifyNone: + default: + break; // Do nothing + } + } + + + + // --------------------------------------------------------- // CDRMClock::ConnectToPhoneL(const TDateTime& aDateTime) diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/drmclock/Src/DRMClockClient2.cpp --- a/omadrm/drmengine/drmclock/Src/DRMClockClient2.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/drmclock/Src/DRMClockClient2.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -18,14 +18,14 @@ // INCLUDE FILES #include "DRMClockClient.h" -#include "DRMclockClientServer.h" +#include "drmclockclientserver.h" #include "DRMTypes.h" -#include "DRMLog.h" +#include "drmlog.h" // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS // MACROS @@ -57,7 +57,7 @@ EXPORT_C RDRMClockClient::RDRMClockClient() { } - + // ----------------------------------------------------------------------------- // RDRMClockClient::~RDRMClockClient // Destructor. @@ -65,7 +65,7 @@ // EXPORT_C RDRMClockClient::~RDRMClockClient() { - } + } // ----------------------------------------------------------------------------- // RDRMClockClient::Connect @@ -75,23 +75,23 @@ EXPORT_C TInt RDRMClockClient::Connect() { TInt ret = KErrNone; -#ifdef __DRM_CLOCK +#ifdef __DRM_CLOCK DRMLOG( _L( "RDRMClockClient::Connect" ) ); - const TVersion requiredVersion( + const TVersion requiredVersion( DRMClock::KServerMajorVersion, DRMClock::KServerMinorVersion, DRMClock::KServerBuildVersion ); - + DRMLOG( _L("RDRMClockClient: Create a new session" ) ); ret = CreateSession( DRMClock::KServerName, - requiredVersion, + requiredVersion, KMaxMessageSlots ); DRMLOG2( _L( "Result: %d") , ret ); #else DRMLOG( _L( "RDRMClockClient: No Session Created, DRMClock is off") ); #endif // __DRM_CLOCK - + return ret; } @@ -100,7 +100,7 @@ // Closes the connection to the server. // ----------------------------------------------------------------------------- // -EXPORT_C void RDRMClockClient::Close() +EXPORT_C void RDRMClockClient::Close() { DRMLOG( _L( "RDRMClockClient::Close" ) ); @@ -115,38 +115,38 @@ EXPORT_C TInt RDRMClockClient::GetSecureTime( TTime& aTime, TInt& aTimeZone, DRMClock::ESecurityLevel& aSecurityLevel ) const { -#ifdef __DRM_CLOCK +#ifdef __DRM_CLOCK TPckg package(aTime); TPckg package2(aTimeZone); TPckg package3(aSecurityLevel); - + DRMLOG( _L( "RDRMClockClient::GetSecureTime" ) ); TInt error = KErrNone; - + // Send the message. error = SendReceive( DRMClock::EGetDRMTime, TIpcArgs( &package, &package2, &package3 ) ); - + DRMLOG2( _L( "RDRMClockClient::GetSecureTime: %d" ), error ); return error; #else DRMLOG( _L( "RDRMClockClient::GetSecureTime, UI Time is returned, DRMClock is off" ) ); - TTime currentLocal; + TTime currentLocal; TInt64 result = 0; - - // aTime: - aTime.UniversalTime(); - currentLocal.HomeTime(); - + + // aTime: + aTime.UniversalTime(); + currentLocal.HomeTime(); + result = currentLocal.Int64() - aTime.Int64(); result /= KMinuteInMicroseconds; result /= KTimeZoneIncrement; - + // aTimeZone: aTimeZone = I64INT(result); - // aSecurityLevel: - aSecurityLevel = DRMClock::KSecure; - return KErrNone; + // aSecurityLevel: + aSecurityLevel = DRMClock::KSecure; + return KErrNone; #endif // __DRM_CLOCK } @@ -162,11 +162,11 @@ #ifdef __DRM_CLOCK TPckg package(aTime); TPckg package2(aTimeZone); - + DRMLOG( _L( "RDRMClockClient::UpdateSecureTime" ) ); - + error = SendReceive( DRMClock::EUpdateDRMTime, TIpcArgs( &package, &package2 ) ); - + DRMLOG2( _L( "RDRMClockClient::UpdateSecureTime: " ), error ); #else DRMLOG( _L("RDRMClockClient::UpdateSecureTime, Did nothing DRMClock is off") ); @@ -177,4 +177,4 @@ // ========================== OTHER EXPORTED FUNCTIONS ========================= -// End of File +// End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/drmclock/Src/DRMClockSession.cpp --- a/omadrm/drmengine/drmclock/Src/DRMClockSession.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/drmclock/Src/DRMClockSession.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,11 +19,11 @@ // INCLUDE FILES #include #include -#include "drmcommon.h" +#include "DRMCommon.h" #include "DRMClockSession.h" #include "drmclockclientserver.h" #include "DRMClockServer.h" -#include +#include #include @@ -33,7 +33,7 @@ using namespace DRMClock; // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS @@ -58,7 +58,7 @@ // Two-phased constructor. // ----------------------------------------------------------------------------- // -CDRMClockSession* CDRMClockSession::NewL( CDRMClock* aClock) +CDRMClockSession* CDRMClockSession::NewL( CDRMClock* aClock) { CDRMClockSession* self = new( ELeave ) CDRMClockSession( aClock ); CleanupStack::PushL( self ); @@ -88,9 +88,9 @@ { DRMLOG( _L( "CDRMClockSession::ServiceL called" ) ); // Trap possible errors... - + TRAPD( error, DispatchL( aMessage ) ); - + if ( error ) { DRMLOG2( _L( "CDRMClockSession::DispatcL threw an exception %d" ), error ); @@ -108,13 +108,13 @@ // Default constructor. // ----------------------------------------------------------------------------- // -CDRMClockSession::CDRMClockSession( CDRMClock* aClock ) : +CDRMClockSession::CDRMClockSession( CDRMClock* aClock ) : // Base class' constructor is called first. iDRMClock( aClock ) { // Nothing. } - + // ----------------------------------------------------------------------------- // CDRMClockSession::ConstructL // Second phase constructor. Initializes the log tool in DRM internal testing. @@ -126,11 +126,11 @@ // ----------------------------------------------------------------------------- // CDRMClockSession::DispatchL -// Checks which command the user requested, and forwards the request to +// Checks which command the user requested, and forwards the request to // appropriate private method. This helps to keep the code more readable. // ----------------------------------------------------------------------------- // -void CDRMClockSession::DispatchL( const RMessage2& aMessage ) +void CDRMClockSession::DispatchL( const RMessage2& aMessage ) { switch ( aMessage.Function() ) { @@ -156,13 +156,13 @@ TTime drmTime; TInt timeZone; DRMClock::ESecurityLevel level; - + iDRMClock->GetSecureTime( drmTime, timeZone, level ); TPckg package(drmTime); - TPckg package2(timeZone); + TPckg package2(timeZone); TPckg package3(level); - + IPCWRITE0L( package ); IPCWRITE1L( package2 ); IPCWRITE2L( package3 ); @@ -178,19 +178,19 @@ { DRMLOG( _L( "CDRMClockSession::UpdateDRMTimeL" ) ); TInt error = KErrNone; - TTime drmTime; + TTime drmTime; TInt timeZone; TPckg package( drmTime ); TPckg package2( timeZone ); TInt r = KErrAccessDenied; - + // Add a check for the vendor id - _LIT_SECURITY_POLICY_V0(vidCheck, VID_DEFAULT); // Check Default VID - _LIT_SECURITY_POLICY_C1(drmCheck, ECapabilityDRM); + _LIT_SECURITY_POLICY_V0(vidCheck, VID_DEFAULT); // Check Default VID + _LIT_SECURITY_POLICY_C1(drmCheck, ECapabilityDRM); RThread client; - - aMessage.ClientL( client ); - + + aMessage.ClientL( client ); + if( vidCheck.CheckPolicy( client ) || drmCheck().CheckPolicy(client) ) { r = KErrNone; @@ -198,7 +198,7 @@ client.Close(); User::LeaveIfError( r ); - + IPCREAD0L( package ); IPCREAD1L( package2 ); diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/drmclock/Src/DRMNitzObserver.cpp --- a/omadrm/drmengine/drmclock/Src/DRMNitzObserver.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/drmclock/Src/DRMNitzObserver.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -20,11 +20,11 @@ // INCLUDE FILES #include "DRMNitzObserver.h" #include "DRMClock.h" -#include "DRMLog.h" +#include "drmlog.h" // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS const TInt KTimeZoneValidBit(0x3F); // Time zone difference @@ -50,47 +50,47 @@ // CDRMNitzObserver::CDRMNitzObserver // Default Constructor // --------------------------------------------------------- -// +// CDRMNitzObserver::CDRMNitzObserver( RMobilePhone& aMobilePhone, CDRMClock* aDRMClock) : CActive(EPriorityNormal) ,iDRMClock( aDRMClock ), iMobilePhone( &aMobilePhone ), iError( KErrNone ) - { + { } // --------------------------------------------------------- // CDRMNitzObserver::~CDRMNitzObserver // Destructor // --------------------------------------------------------- -// +// CDRMNitzObserver::~CDRMNitzObserver() { - Cancel(); - }; - - + Cancel(); + }; + + // --------------------------------------------------------- // CDRMNitzObserver::ConstructL // Two-phase Constructor // --------------------------------------------------------- -// +// void CDRMNitzObserver::ConstructL() { DRMLOG( _L("ConstructL ")); - + // Get the NITZ info on the creation, might not be available yet iError = iMobilePhone->GetNITZInfo(iNitzInfo); - - + + DRMLOG2( _L("ConstructL: Error = %d"), iError ); - + } - + // --------------------------------------------------------- // CDRMNitzObserver::NewL // Two-phase constructor // --------------------------------------------------------- -// +// CDRMNitzObserver* CDRMNitzObserver::NewL( RMobilePhone& aMobilePhone, CDRMClock* aDRMClock) { @@ -100,21 +100,21 @@ CleanupStack::Pop(); return self; } - + // --------------------------------------------------------- // CDRMNitzObserver::Start // Adds the active object into the ActiveScheduler // and sets the object active, makes sure RunL is called // atleast once // --------------------------------------------------------- -// -void CDRMNitzObserver::Start() +// +void CDRMNitzObserver::Start() { TRequestStatus* status = 0; - - DRMLOG2( _L("iError == %d "), iError ); - - if( iError == KErrNotSupported ) + + DRMLOG2( _L("iError == %d "), iError ); + + if( iError == KErrNotSupported ) { // NITZ never supported, kill the observer if( IsAdded() ) @@ -123,64 +123,64 @@ return; } return; - } - - if( !IsAdded() ) + } + + if( !IsAdded() ) { - CActiveScheduler::Add(this); + CActiveScheduler::Add(this); } - if ( !IsActive() ) + if ( !IsActive() ) { - SetActive(); + SetActive(); } status = &iStatus; User::RequestComplete(status,KErrNone); } - - -// Ignore the error: + + +// Ignore the error: TInt CDRMNitzObserver::RunError( TInt /*aError*/ ) { SetActive(); return KErrNone; } - - + + // --------------------------------------------------------- // CDRMNitzObserver::RunL // Active object RunL // --------------------------------------------------------- -// +// void CDRMNitzObserver::RunL() { TTime timeData; TInt timeZone( 0 ); - + // Check if the nitz has changed and is available, if so call update // otherwise just wait - - DRMLOG( _L("ObserverRunL Called\n\r ") ); + + DRMLOG( _L("ObserverRunL Called\n\r ") ); iStatus = KRequestPending; - + iMobilePhone->NotifyNITZInfoChange(iStatus, iNitzInfo); - - DRMLOG( _L("NotifyNITZInfoChange:")); + + DRMLOG( _L("NotifyNITZInfoChange:")); if( GetNitzTime( timeData, timeZone ) ) { - DRMLOG( _L("Resetting secure time from NITZ observer:")); + DRMLOG( _L("Resetting secure time from NITZ observer:")); TRAPD(error, iDRMClock->ResetSecureTimeL( timeData, timeZone ) ); if( error ) { - DRMLOG( _L("Resetting secure time from NITZ observer returned an error.")); + DRMLOG( _L("Resetting secure time from NITZ observer returned an error.")); } - DRMLOG( _L("Resetting secure time from NITZ observer successful.")); - + DRMLOG( _L("Resetting secure time from NITZ observer successful.")); + if( error != KErrArgument ) { if( error ) { - DRMLOG( _L("ObserverRunL Called error \n\r ") ); + DRMLOG( _L("ObserverRunL Called error \n\r ") ); } User::LeaveIfError( error ); } @@ -194,7 +194,7 @@ // CDRMNitzObserver::DoCancel // Cancels the active object // --------------------------------------------------------- -// +// void CDRMNitzObserver::DoCancel() { // cancel the notify change @@ -227,8 +227,8 @@ TBool CDRMNitzObserver::GetNitzTime(TTime& aNitzTime, TInt& aTimeZone) { TInt32 nitzCaps(iNitzInfo.iNitzFieldsUsed); - - if (nitzCaps & RMobilePhone::KCapsTimezoneAvailable) + + if (nitzCaps & RMobilePhone::KCapsTimezoneAvailable) { TInt timezone(iNitzInfo.iTimeZone & KTimeZoneValidBit); @@ -237,30 +237,30 @@ // Changes sign timezone = - timezone; } - + // TimeZone info aTimeZone = timezone; } - - if (nitzCaps & RMobilePhone::KCapsTimeAvailable) + + if (nitzCaps & RMobilePhone::KCapsTimeAvailable) { TDateTime dateTime; TInt fourDigitYear(iNitzInfo.Year()); //Check if our TSY returns 2 digits in stead of 4 digits for the year value - if (fourDigitYear <= KMaximumTwoDigitValue) // The maximum year value in UI applications is 2060 - { + if (fourDigitYear <= KMaximumTwoDigitValue) // The maximum year value in UI applications is 2060 + { //The year received from TSY is 2 digits we make it 4 digits - fourDigitYear = fourDigitYear + KNitzYearOffset; // 2000 - } + fourDigitYear = fourDigitYear + KNitzYearOffset; // 2000 + } dateTime.Set(fourDigitYear, - TMonth(iNitzInfo.Month()), - iNitzInfo.Day(), - iNitzInfo.Hour(), - iNitzInfo.Minute(), - iNitzInfo.Second(), - iNitzInfo.MicroSecond()); + TMonth(iNitzInfo.Month()), + iNitzInfo.Day(), + iNitzInfo.Hour(), + iNitzInfo.Minute(), + iNitzInfo.Second(), + iNitzInfo.MicroSecond()); DRMLOG2( _L( "CDRMNitzObserver::GetNitzTime: DateTime: %d" ), fourDigitYear ); DRMLOG2( _L( ":%d" ), iNitzInfo.Month() ); @@ -273,11 +273,11 @@ { return EFalse; } - // Transfer the time into a TTime object, UTC + // Transfer the time into a TTime object, UTC aNitzTime = dateTime; return ETrue; } - + return EFalse; - + }; diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/drmclock/Src/GPSTimeUpdater.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadrm/drmengine/drmclock/Src/GPSTimeUpdater.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -0,0 +1,183 @@ + +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the GPS time updater +* +*/ + +// INCLUDE FILES +#include +#include +#include "GPSTimeUpdater.h" +#include "DRMClock.h" +#include "drmlog.h" + + +_LIT(KDRMClockServerName, "DRMClockServer"); + +// ============================ MEMBER FUNCTIONS =============================== + + +// ----------------------------------------------------------------------------- +// CGPSTimeUpdater::CGPSTimeUpdater +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CGPSTimeUpdater::CGPSTimeUpdater( RPositionServer &aPosServer, + const TPositionModuleId& aModuleId, + CDRMClock* aClock ) : + CActive(EPriorityHigh), + iPosServer(aPosServer), + iModuleId(aModuleId), + iClock( aClock ), + iTimeReceived( EFalse ) + { + CActiveScheduler::Add(this); + } + +// ----------------------------------------------------------------------------- +// CGPSTimeUpdater::~CGPSTimeUpdater +// C++ destructor +// ----------------------------------------------------------------------------- +// +CGPSTimeUpdater::~CGPSTimeUpdater() + { + DRMLOG(_L("CGPSTimeUpdater::~CGPSTimeUpdater")); + Cancel(); + + iPositioner.Close(); + } + +// ----------------------------------------------------------------------------- +// CGPSTimeUpdater::New +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +CGPSTimeUpdater* CGPSTimeUpdater::New( RPositionServer &aPosServer, + const TPositionModuleId& aModuleId, + CDRMClock* aClock ) + { + CGPSTimeUpdater* self = new CGPSTimeUpdater(aPosServer, aModuleId, aClock); + if(self) + { + TRAPD(err, self->ConstructL()); + if(err!=KErrNone) + { + delete self; + self = 0; + } + } + return self; + } + + +// ----------------------------------------------------------------------------- +// CGPSTimeUpdater::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CGPSTimeUpdater::ConstructL() + { + DRMLOG(_L("CGPSTimeUpdater::ConstructL >>")); + + // Open positioner + User::LeaveIfError(iPositioner.Open(iPosServer, iModuleId)); + User::LeaveIfError(iPositioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, + KDRMClockServerName)); + + // Set update options + TPositionUpdateOptions updateOptions; + updateOptions.SetAcceptPartialUpdates(ETrue); + updateOptions.SetMaxUpdateAge(0); + updateOptions.SetUpdateInterval(TTimeIntervalMicroSeconds(0)); + updateOptions.SetUpdateTimeOut(TTimeIntervalMicroSeconds(30*1000*1000)); + User::LeaveIfError(iPositioner.SetUpdateOptions(updateOptions)); + + // Request position update + iPositioner.NotifyPositionUpdate(iSatelliteInfo, iStatus); + SetActive(); + + DRMLOG(_L("CGPSTimeUpdater::ConstructL <<")); + } + +// ----------------------------------------------------------------------------- +// CGPSTimeUpdater::RunL +// Inherited from CActive +// ----------------------------------------------------------------------------- +// +void CGPSTimeUpdater::RunL() + { + DRMLOG(_L("CGPSTimeUpdater::RunL >>")); + + DRMLOG2(_L("CGPSTimeUpdater::RunL: iStatus=%d"), iStatus.Int()); + + if( iStatus == KErrNone || iStatus == KPositionPartialUpdate ) + { + DRMLOG(_L("CGPSTimeUpdater::RunL: position updated!")); + + DRMLOG2(_L("CGPSTimeUpdater::RunL: satellites used = %d"), iSatelliteInfo.NumSatellitesUsed()); + TTime satelliteTime = iSatelliteInfo.SatelliteTime(); + + TDateTime dt = satelliteTime.DateTime(); + DRMLOG7(_L("CGPSTimeUpdater::RunL: satellite time = %02d-%02d-%04d, %02d:%02d:%02d"), dt.Day(), dt.Month(), dt.Year(), dt.Hour(), dt.Minute(), dt.Second()); + + // If the time has not been received yet this function will leave and we re-issue the request from run error: + iClock->ResetSecureTimeL( satelliteTime, 0 ); + + // Mark time as received + iTimeReceived = ETrue; + } + + // if the call timed out try again + if( iStatus == KErrTimedOut ) + { + // Request position update + iPositioner.NotifyPositionUpdate(iSatelliteInfo, iStatus); + SetActive(); + } + else + { + iPositioner.Close(); + } + + DRMLOG(_L("CGPSTimeUpdater::RunL <<")); + } + +// ----------------------------------------------------------------------------- +// CGPSTimeUpdater::DoCancel +// Inherited from CActive +// ----------------------------------------------------------------------------- +// +void CGPSTimeUpdater::DoCancel() + { + iPositioner.CancelRequest(EPositionerNotifyPositionUpdate); + } + + +// ----------------------------------------------------------------------------- +// CGPSTimeUpdater::RunError +// Inherited from CActive +// ----------------------------------------------------------------------------- +// +TInt CGPSTimeUpdater::RunError( TInt /*aError*/ ) + { + // Time received was invalid, wait for more updates + iPositioner.NotifyPositionUpdate(iSatelliteInfo, iStatus); + SetActive(); + + // ignore errors + return KErrNone; + } diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/drmclock/Src/GPSWatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadrm/drmengine/drmclock/Src/GPSWatcher.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -0,0 +1,237 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the GPS Watcher +* +*/ + + +// INCLUDE FILES +#include +#include + +#include "GPSWatcher.h" +#include "GPSTimeUpdater.h" +#include "DRMClock.h" +#include "drmlog.h" + + +// ============================ MEMBER FUNCTIONS =============================== + + +// ----------------------------------------------------------------------------- +// CGPSWatcher::CGPSWatcher +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CGPSWatcher::CGPSWatcher( CDRMClock* aClock ) : + CActive(EPriorityHigh), + iClock( aClock ) + { + CActiveScheduler::Add(this); + } + +// ----------------------------------------------------------------------------- +// CGPSWatcher::~CGPSWatcher +// C++ destructor +// ----------------------------------------------------------------------------- +// +CGPSWatcher::~CGPSWatcher() + { + Cancel(); + + delete iTimeUpdater; + iTimeUpdater = 0; + + iPosServer.Close(); + } + +// ----------------------------------------------------------------------------- +// CGPSWatcher::NewL +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +CGPSWatcher* CGPSWatcher::NewL( CDRMClock* aClock ) + { + CGPSWatcher* self = new (ELeave) CGPSWatcher( aClock ); + + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; + } + +// ----------------------------------------------------------------------------- +// CGPSWatcher::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CGPSWatcher::ConstructL() + { + User::LeaveIfError(iPosServer.Connect()); + + // Immediately subscribe for module status events + iStatusEvent.SetRequestedEvents(TPositionModuleStatusEventBase::EEventDeviceStatus); + Subscribe(); + + // Check initial state + CheckModules(); + } + +// ----------------------------------------------------------------------------- +// CGPSWatcher::Subscribe +// Subscribe to position events +// ----------------------------------------------------------------------------- +// +void CGPSWatcher::Subscribe() + { + iPosServer.NotifyModuleStatusEvent(iStatusEvent, iStatus); + SetActive(); + } + +// ----------------------------------------------------------------------------- +// CGPSWatcher::RunL +// Inherited from CActive +// ----------------------------------------------------------------------------- +// +void CGPSWatcher::RunL() + { + // If we already updated the time: + if( iTimeUpdater && iTimeUpdater->TimeReceived() ) + { + DRMLOG( _L("CGPSWatcher::RunL: time updater exists, time received, deleting")); + iClock->Notify( CDRMClock::ENotifyGPSTimeReceived ); + DRMLOG( _L("CGPSWatcher::RunL: object deleted, returning")); + return; + } + + Subscribe(); + TPositionModuleStatusEventBase::TModuleEvent occurredEvents = iStatusEvent.OccurredEvents(); + DRMLOG2(_L("CGPSWatcher::RunL: occurredEvents = 0x%X"), occurredEvents); + + // If time updater is not running, check module statuses + if(!iTimeUpdater) + CheckModules(); + } + + +// ----------------------------------------------------------------------------- +// CGPSWatcher::DoCancel +// Inherited from CActive +// ----------------------------------------------------------------------------- +// +void CGPSWatcher::DoCancel() + { + iPosServer.CancelRequest(EPositionServerNotifyModuleStatusEvent); + } + +// ----------------------------------------------------------------------------- +// CGPSWatcher::RunError +// Inherited from CActive +// ----------------------------------------------------------------------------- +// +TInt CGPSWatcher::RunError( TInt /*aError*/ ) + { + // ignore errors + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CGPSWatcher::CheckModules +// Check what modules are present and act accordingly +// ----------------------------------------------------------------------------- +// +void CGPSWatcher::CheckModules() + { + // Get number of modules + TUint numModules; + if(iPosServer.GetNumModules(numModules)!=KErrNone || !numModules) + return; + + // Collect all active and satellite capable modules + TFullName moduleName; + RPointerArray satelliteModules; + + TPositionModuleInfo *moduleInfo(0); + + for(TUint i=0; iDeviceLocation() & TPositionModuleInfo::EDeviceInternal) || + ! (moduleInfo->Capabilities() & TPositionModuleInfo::ECapabilitySatellite) ) + { + // Not internal or satellite capable + continue; + } + + // Get module status + TPositionModuleStatus moduleStatus; + if(iPosServer.GetModuleStatus(moduleStatus, moduleInfo->ModuleId()) != KErrNone) + { + continue; + } + // Check if the module is active + if(moduleStatus.DeviceStatus() != TPositionModuleStatus::EDeviceActive) + { + continue; + } + + moduleInfo->GetModuleName(moduleName); + + DRMLOG6( _L("Module %d: id=0x%08X, name = %S, cap=0x%08X, status=%d"), i, moduleInfo->ModuleId().iUid, &moduleName, moduleInfo->Capabilities(), moduleStatus.DeviceStatus()); + + // Active internal satellite device, try to append in the array + if(satelliteModules.Append(moduleInfo) == KErrNone) + { + moduleInfo = 0; + } + } + + delete moduleInfo; + + if(satelliteModules.Count()) + { + DRMLOG( _L("Active satellite module available") ); + // We have an active satellite module available + TPositionModuleId moduleId = satelliteModules[0]->ModuleId(); + + // Just allocating/deleting the time updater will do the trick + iTimeUpdater = CGPSTimeUpdater::New(iPosServer, moduleId, iClock); + } + else + { + DRMLOG( _L("No active satellite modules available") ); + // Delete time updater since no active GPS anymore + delete iTimeUpdater; iTimeUpdater = 0; + } + + satelliteModules.ResetAndDestroy(); + satelliteModules.Close(); + } diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/drmserviceapi/src/drmserviceapi.cpp --- a/omadrm/drmengine/drmserviceapi/src/drmserviceapi.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/drmserviceapi/src/drmserviceapi.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,8 +19,8 @@ #include -#include "roapstorageclient.h" -#include "drmclockclient.h" +#include "RoapStorageClient.h" +#include "DRMClockClient.h" // ======== LOCAL FUNCTIONS ======== @@ -65,7 +65,7 @@ delete iClockClient; iClockClient = NULL; } - + // Roap storage client if( iRoapStorageClient ) { @@ -79,14 +79,14 @@ // CDrmServiceApi::GetSecureTime // --------------------------------------------------------------------------- // -EXPORT_C TInt DRM::CDrmServiceApi::GetSecureTime( - TTime& aTime, +EXPORT_C TInt DRM::CDrmServiceApi::GetSecureTime( + TTime& aTime, TInt& aTimeZone, DRMClock::ESecurityLevel& aSecurityLevel ) const { - return iClockClient->GetSecureTime( aTime, aTimeZone, aSecurityLevel); + return iClockClient->GetSecureTime( aTime, aTimeZone, aSecurityLevel); }; - + // --------------------------------------------------------------------------- // CDrmServiceApi::UpdateSecureTime // --------------------------------------------------------------------------- @@ -132,10 +132,10 @@ { // Create an instance of the clock client iClockClient = new (ELeave) RDRMClockClient; - + // Connect to the server User::LeaveIfError( iClockClient->Connect() ); - + // Create and instance of the roap storage client iRoapStorageClient = new (ELeave) Roap::RRoapStorageClient; diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/group/RightsServer.mmp --- a/omadrm/drmengine/group/RightsServer.mmp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/group/RightsServer.mmp Mon Mar 15 12:41:43 2010 +0200 @@ -22,7 +22,7 @@ TARGETTYPE EXE UID 0x1000008d 0x101F51F2 -CAPABILITY CAP_SERVER DRM CommDD ProtServ PowerMgmt +CAPABILITY CAP_SERVER DRM CommDD ProtServ PowerMgmt Location VENDORID VID_DEFAULT // Default system include paths for middleware layer modules. @@ -103,6 +103,9 @@ SOURCE DRMClockSession.cpp SOURCE DRMNitzObserver.cpp +SOURCE GPSWatcher.cpp +SOURCE GPSTimeUpdater.cpp + #else #ifdef __DRM_OMA2 SOURCEPATH ../DRMClock/src @@ -144,6 +147,7 @@ LIBRARY flogger.lib LIBRARY featmgr.lib // Feature Manager LIBRARY wmdrmfileserverclient.lib +LIBRARY lbs.lib // GPS libraries #ifdef RD_DRM_METERING LIBRARY random.lib #endif diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/keystorage/src/DrmStdKeyStorage.cpp --- a/omadrm/drmengine/keystorage/src/DrmStdKeyStorage.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/keystorage/src/DrmStdKeyStorage.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -27,7 +27,7 @@ #include #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif #include "DrmKeyStorage.h" @@ -50,7 +50,7 @@ buffer.Ptr(), buffer.Length()); #else #define LOG(string) -#define LOGHEX(buffer) +#define LOGHEX(buffer) #endif #pragma message("Compiling DRM Std KeyStorage..") @@ -100,17 +100,17 @@ LOCAL_C void WriteFileL(RFs& aFs, const TDesC& aName, const TDesC8& aData) { RFile file; - + User::LeaveIfError(file.Replace(aFs, aName, EFileWrite)); User::LeaveIfError(file.Write(aData)); file.Close(); } - + LOCAL_C void ReadFileL(RFs& aFs, const TDesC& aName, HBufC8*& aContent) - { + { RFile file; TInt size = 0; - + User::LeaveIfError(file.Open(aFs, aName, EFileRead)); CleanupClosePushL(file); User::LeaveIfError(file.Size(size)); @@ -150,7 +150,7 @@ { RInteger r; TInt i; - + r = RInteger::NewL(0); for (i = 0; i < aOctetStream.Length(); i++) { @@ -172,7 +172,7 @@ // ----------------------------------------------------------------------------- // CDrmStdKeyStorage* CDrmStdKeyStorage::NewL -// +// // ----------------------------------------------------------------------------- // EXPORT_C CDrmStdKeyStorage* CDrmStdKeyStorage::NewL(RLibrary aLibrary) @@ -186,9 +186,9 @@ // ----------------------------------------------------------------------------- // CDrmStdKeyStorage::CDrmStdKeyStorage -// +// // ----------------------------------------------------------------------------- -// +// CDrmStdKeyStorage::CDrmStdKeyStorage(RLibrary aLibrary): iFileMan(NULL), iRootSelected(EFalse), @@ -200,18 +200,18 @@ // ----------------------------------------------------------------------------- // CDrmStdKeyStorage::ConstructL -// +// // ----------------------------------------------------------------------------- -// +// void CDrmStdKeyStorage::ConstructL() { - + LOG(_L("CDrmStdKeyStorage::ConstructL ->")); User::LeaveIfError(iFs.Connect()); iFileMan = CFileMan::NewL(iFs); -#ifdef __DRM_OMA2 - SelectDefaultRootL(); +#ifdef __DRM_OMA2 + SelectDefaultRootL(); #endif iDeviceSpecificKey.Copy(KDefaultKey); @@ -221,7 +221,7 @@ // ----------------------------------------------------------------------------- // MDrmKeyStorage::~MDrmKeyStorage -// +// // ----------------------------------------------------------------------------- // @@ -230,7 +230,7 @@ } // ----------------------------------------------------------------------------- // DrmStdKeyStorage::~CDrmStdKeyStorage -// +// // ----------------------------------------------------------------------------- // @@ -247,10 +247,10 @@ // ----------------------------------------------------------------------------- // DrmStdKeyStorage::ModulusSize -// +// // ----------------------------------------------------------------------------- // - + TInt CDrmStdKeyStorage::ModulusSize() { LOG(_L("CDrmStdKeyStorage::ModulusSize ->")); @@ -265,7 +265,7 @@ // ----------------------------------------------------------------------------- // DrmStdKeyStorage::SelectTrustedRootL -// +// // ----------------------------------------------------------------------------- // void CDrmStdKeyStorage::SelectTrustedRootL( @@ -274,30 +274,30 @@ TFileName fileName; TEntry entry; TInt i; - + LOG(_L("CDrmStdKeyStorage::SelectTrustedRootL ->")); LOG(aRootKeyHash); if (aRootKeyHash.Length() != 0) { - + #ifndef RD_MULTIPLE_DRIVE - + fileName.Copy(KKeyStoragePath); - + #else //RD_MULTIPLE_DRIVE - + TFileName tempPath; TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); - iFs.DriveToChar( driveNumber, driveLetter ); - - tempPath.Format( KKeyStoragePath, (TUint)driveLetter ); - + iFs.DriveToChar( driveNumber, driveLetter ); + + tempPath.Format( KKeyStoragePath, (TUint)driveLetter ); + fileName.Copy(tempPath); - + #endif - + for (i = 0; i < SHA1_HASH; i++) { fileName.AppendNumFixedWidth(aRootKeyHash[i], EHex, 2); @@ -305,22 +305,22 @@ fileName.Append('\\'); if (iFs.Entry(fileName, entry) != KErrNone) { - + #ifndef RD_MULTIPLE_DRIVE - + fileName.Copy(KRomKeyStoragePath); - + #else //RD_MULTIPLE_DRIVE - + DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber ); - iFs.DriveToChar( driveNumber, driveLetter ); - - tempPath.Format( KRomKeyStoragePath, (TUint)driveLetter ); - + iFs.DriveToChar( driveNumber, driveLetter ); + + tempPath.Format( KRomKeyStoragePath, (TUint)driveLetter ); + fileName.Copy(tempPath); - + #endif - + for (i = 0; i < SHA1_HASH; i++) { fileName.AppendNumFixedWidth(aRootKeyHash[i], EHex, 2); @@ -332,7 +332,7 @@ User::LeaveIfError(iFs.SetSessionPath(fileName)); InitializeKeyL(); CheckRootForCmlaL(); - iRootSelected = ETrue; + iRootSelected = ETrue; } else { @@ -340,10 +340,10 @@ } LOG(_L("CDrmStdKeyStorage::SelectTrustedRootL <-")); } - + // ----------------------------------------------------------------------------- // DrmStdKeyStorage::SelectDefaultRootL -// +// // ----------------------------------------------------------------------------- // void CDrmStdKeyStorage::SelectDefaultRootL() @@ -351,44 +351,44 @@ CDir* dir = NULL; TFileName dirName; TBool found = EFalse; - + LOG(_L("CDrmStdKeyStorage::SelectDefaultRootL ->")); - + #ifndef RD_MULTIPLE_DRIVE - + if (iFs.GetDir(KKeyStoragePath, KEntryAttDir, ESortByName, dir) == KErrNone) - + #else //RD_MULTIPLE_DRIVE - + TFileName tempPath; TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); iFs.DriveToChar( driveNumber, driveLetter ); - + tempPath.Format( KKeyStoragePath, (TUint)driveLetter ); - + if (iFs.GetDir(tempPath, KEntryAttDir, ESortByName, dir) == KErrNone) - + #endif - + { __UHEAP_MARK; LOG(_L(" Checking keys on C:")); CleanupStack::PushL(dir); if (dir->Count() >= 1) { - + #ifndef RD_MULTIPLE_DRIVE - + dirName.Copy(KKeyStoragePath); - + #else //RD_MULTIPLE_DRIVE - + dirName.Copy(tempPath); - + #endif - + dirName.Append((*dir)[0].iName); dirName.Append('\\'); User::LeaveIfError(iFs.SetSessionPath(dirName)); @@ -397,39 +397,39 @@ CleanupStack::PopAndDestroy(dir); __UHEAP_MARKEND; } - + #ifndef RD_MULTIPLE_DRIVE if (!found && iFs.GetDir(KRomKeyStoragePath, KEntryAttDir, ESortByName, dir) == KErrNone) - + #else //RD_MULTIPLE_DRIVE - + DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber ); iFs.DriveToChar( driveNumber, driveLetter ); - + tempPath.Format( KRomKeyStoragePath, (TUint)driveLetter ); - + if (!found && iFs.GetDir(tempPath, KEntryAttDir, ESortByName, dir) == KErrNone) - + #endif { - LOG(_L(" Checking keys on Z:")); + LOG(_L(" Checking keys on Z:")); CleanupStack::PushL(dir); if (dir->Count() < 1) { User::Leave(KErrGeneral); } - + #ifndef RD_MULTIPLE_DRIVE - + dirName.Copy(KRomKeyStoragePath); - + #else //RD_MULTIPLE_DRIVE - + dirName.Copy(tempPath); - + #endif - + dirName.Append((*dir)[0].iName); dirName.Append('\\'); User::LeaveIfError(iFs.SetSessionPath(dirName)); @@ -438,14 +438,14 @@ } if (!found) { - User::Leave(KErrGeneral); + User::Leave(KErrGeneral); } InitializeKeyL(); CheckRootForCmlaL(); iRootSelected = ETrue; LOG(_L("CDrmStdKeyStorage::SelectDefaultRootL <-")); } - + TBool CDrmStdKeyStorage::SelectedRootIsCmla() { return iRootIsCmla; @@ -453,10 +453,10 @@ // ----------------------------------------------------------------------------- // DrmStdKeyStorage::GetTrustedRootsL -// +// // ----------------------------------------------------------------------------- // - + void CDrmStdKeyStorage::GetTrustedRootsL( RPointerArray& aRootList) { @@ -467,26 +467,26 @@ TEntry entry; TUint8 c; TInt r = KErrNone; - + LOG(_L("CDrmStdKeyStorage::GetTrustedRootsL ->")); aRootList.ResetAndDestroy(); - + #ifndef RD_MULTIPLE_DRIVE - + if (iFs.GetDir(KKeyStoragePath, KEntryAttDir, ESortByName, dir) == KErrNone) - + #else //RD_MULTIPLE_DRIVE - + TFileName tempPath; TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); iFs.DriveToChar( driveNumber, driveLetter ); - + tempPath.Format( KKeyStoragePath, (TUint)driveLetter ); - + if (iFs.GetDir(tempPath, KEntryAttDir, ESortByName, dir) == KErrNone) - + #endif { LOG(_L(" Getting roots on C:")); @@ -510,20 +510,20 @@ } CleanupStack::PopAndDestroy(dir); } - + #ifndef RD_MULTIPLE_DRIVE - + if (iFs.GetDir(KRomKeyStoragePath, KEntryAttDir, ESortByName, dir) == KErrNone) - + #else //RD_MULTIPLE_DRIVE - + DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber ); iFs.DriveToChar( driveNumber, driveLetter ); - + tempPath.Format( KRomKeyStoragePath, (TUint)driveLetter ); - + if (iFs.GetDir(tempPath, KEntryAttDir, ESortByName, dir) == KErrNone) - + #endif { LOG(_L(" Getting roots on Z:")); @@ -552,7 +552,7 @@ // ----------------------------------------------------------------------------- // DrmStdKeyStorage::GetCertificateChainL -// +// // ----------------------------------------------------------------------------- // void CDrmStdKeyStorage::GetCertificateChainL( @@ -562,7 +562,7 @@ TInt i; CDir* dir = NULL; HBufC8* cert = NULL; - + LOG(_L("CDrmStdKeyStorage::GetCertificateChainL ->")); if (!iRootSelected) { @@ -617,7 +617,7 @@ CSHA1* hasher = NULL; TBuf8 publicKeyHash; TFileName fileName; - + LOG(_L("CDrmStdKeyStorage::ImportDataL ->")); n = aCertificateChain.Count(); cert = CX509Certificate::NewLC(aCertificateChain[n - 1]); @@ -628,25 +628,25 @@ CleanupStack::PushL(hasher); hasher->Update(*publicKey); publicKeyHash.Copy(hasher->Final()); - + #ifndef RD_MULTIPLE_DRIVE - + fileName.Copy(KKeyStoragePath); - + #else //RD_MULTIPLE_DRIVE - + TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); iFs.DriveToChar( driveNumber, driveLetter ); - + TFileName keyStorageDir; keyStorageDir.Format( KKeyStoragePath, (TUint)driveLetter ); - + fileName.Copy(keyStorageDir); - + #endif - + for (i = 0; i < SHA1_HASH; i++) { fileName.AppendNumFixedWidth(publicKeyHash[i], EHex, 2); @@ -675,17 +675,17 @@ void CDrmStdKeyStorage::GetDeviceSpecificKeyL( TBuf8& aKey) { - + HBufC8* key = NULL; - TInt n; - CSHA1* hasher = NULL; + TInt n; + CSHA1* hasher = NULL; TBuf8 hash; - + if (iDeviceSpecificKey.Compare(KDefaultKey) == 0) { - + GetImeiL(); - + HBufC8* buf = HBufC8::NewLC( iImei->Size() + sizeof(VID_DEFAULT) ); TPtr8 ptr( buf->Des() ); ptr.Copy( *iImei ); @@ -708,7 +708,7 @@ n--; } } - + aKey.Copy(iDeviceSpecificKey); } @@ -760,7 +760,7 @@ RInteger input; HBufC8* output; TInt keyLength = KKeyLength; - + LOG(_L("CDrmStdKeyStorage::ModularExponentiateWithKeyL ->")); input = OS2IPL(aInput); CleanupClosePushL(input); @@ -782,7 +782,7 @@ HBufC8* buffer = NULL; HBufC* name = NULL; CX509Certificate* cert = NULL; - + LOG(_L("CDrmStdKeyStorage::CheckRootForCmlaL ->")); __UHEAP_MARK; iFs.GetDir(KSingingCertPattern, KEntryAttNormal, ESortByName, dir); @@ -805,7 +805,7 @@ LOG(_L("CDrmStdKeyStorage::CheckRootForCmlaL <-")); __UHEAP_MARKEND; } - + // ----------------------------------------------------------------------------- // CDrmStdKeyStorage::GetRdbSerialNumberL // ----------------------------------------------------------------------------- @@ -815,42 +815,42 @@ { HBufC8* buffer = NULL; TUint att; - + #ifndef RD_MULTIPLE_DRIVE if (iFs.Att(KSerialNumberFile, att) != KErrNone) - + #else //RD_MULTIPLE_DRIVE - + TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); iFs.DriveToChar( driveNumber, driveLetter ); - + TFileName serialNoFile; serialNoFile.Format( KSerialNumberFile, (TUint)driveLetter ); - + if (iFs.Att(serialNoFile, att) != KErrNone) - + #endif { GenerateNewRdbSerialNumberL(); } - + #ifndef RD_MULTIPLE_DRIVE ReadFileL(iFs, KSerialNumberFile, buffer); - + #else //RD_MULTIPLE_DRIVE - + ReadFileL(iFs, serialNoFile, buffer); - + #endif - + aSerialNumber.Copy(*buffer); delete buffer; } - + // ----------------------------------------------------------------------------- // CDrmStdKeyStorage::GenerateNewRdbSerialNumberL // ----------------------------------------------------------------------------- @@ -861,29 +861,29 @@ TPtr8 random( const_cast(serialNumber.Ptr()), KRdbSerialNumberLength, KRdbSerialNumberLength ); - + RandomDataGetL(random,KRdbSerialNumberLength); - + #ifndef RD_MULTIPLE_DRIVE - + WriteFileL(iFs, KSerialNumberFile, random); - + #else //RD_MULTIPLE_DRIVE - + TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); iFs.DriveToChar( driveNumber, driveLetter ); - + TFileName serialNoFile; serialNoFile.Format( KSerialNumberFile, (TUint)driveLetter ); - + WriteFileL(iFs, serialNoFile, random); - + #endif - + } - + // ----------------------------------------------------------------------------- // CDrmStdKeyStorage::UdtEncryptL // ----------------------------------------------------------------------------- @@ -898,31 +898,31 @@ TX509KeyFactory factory; CRSAPKCS1v15Encryptor* encryptor = NULL; TPtr8 result(const_cast(output->Ptr()), 0, 256); - + #ifndef RD_MULTIPLE_DRIVE - + ReadFileL(iFs, KUdtCertFileName, buffer); - + #else //RD_MULTIPLE_DRIVE - + TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber ); iFs.DriveToChar( driveNumber, driveLetter ); - + TFileName udtCertFile; udtCertFile.Format( KUdtCertFileName, (TUint)driveLetter ); - + ReadFileL(iFs, udtCertFile, buffer); - + #endif - + CleanupStack::PushL(buffer); cert = CX509Certificate::NewL(*buffer); CleanupStack::PushL(cert); key = factory.RSAPublicKeyL(cert->PublicKey().KeyData()); CleanupStack::PushL(key); - + encryptor = CRSAPKCS1v15Encryptor::NewLC(*key); encryptor->EncryptL(aInput, result); @@ -950,19 +950,19 @@ #ifndef RD_MULTIPLE_DRIVE if (iFs.GetDir(KKeyStoragePath, KEntryAttDir, ESortByName, dir) == KErrNone) - + #else //RD_MULTIPLE_DRIVE - + TFileName tempPath; TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); iFs.DriveToChar( driveNumber, driveLetter ); - + tempPath.Format( KKeyStoragePath, (TUint)driveLetter ); - + if (iFs.GetDir(tempPath, KEntryAttDir, ESortByName, dir) == KErrNone) - + #endif { CleanupStack::PushL(dir); @@ -970,17 +970,17 @@ { if ((*dir)[i].IsDir()) { - + #ifndef RD_MULTIPLE_DRIVE - + dirName.Copy(KKeyStoragePath); - + #else //RD_MULTIPLE_DRIVE - + dirName.Copy(tempPath); - + #endif - + dirName.Append((*dir)[i].iName); dirName.Append('\\'); User::LeaveIfError(iFs.SetSessionPath(dirName)); @@ -995,20 +995,20 @@ } CleanupStack::PopAndDestroy(dir); } - + #ifndef RD_MULTIPLE_DRIVE if (iFs.GetDir(KRomKeyStoragePath, KEntryAttDir, ESortByName, dir) == KErrNone) - + #else //RD_MULTIPLE_DRIVE - + DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber ); iFs.DriveToChar( driveNumber, driveLetter ); - + tempPath.Format( KRomKeyStoragePath, (TUint)driveLetter ); - + if (iFs.GetDir(tempPath, KEntryAttDir, ESortByName, dir) == KErrNone) - + #endif { CleanupStack::PushL(dir); @@ -1016,17 +1016,17 @@ { if ((*dir)[i].IsDir()) { - + #ifndef RD_MULTIPLE_DRIVE - + dirName.Copy(KRomKeyStoragePath); - + #else //RD_MULTIPLE_DRIVE - + dirName.Copy(tempPath); - + #endif - + dirName.Append((*dir)[i].iName); dirName.Append('\\'); User::LeaveIfError(iFs.SetSessionPath(dirName)); @@ -1043,7 +1043,7 @@ } iFs.SetSessionPath( path ); } - + // ----------------------------------------------------------------------------- // CDrmStdKeyStorage::GetIMEIL // ----------------------------------------------------------------------------- @@ -1056,24 +1056,24 @@ } #if (defined __WINS__ || defined WINSCW) - // Default IMEI used for emulator + // Default IMEI used for emulator _LIT( KDefaultSerialNumber, "123456789123456789" ); iImei = KDefaultSerialNumber().AllocL(); - + return *iImei; #else - + TInt error( KErrNone ); TInt count( 0 ); TInt count2( 0 ); TUint32 caps( 0 ); TBool found (EFalse); - + RTelServer etelServer; RMobilePhone phone; - + TUint KMaxImeiTries = 5; - + for ( TUint8 i = 0; i < KMaxImeiTries; ++i ) { error = etelServer.Connect(); @@ -1081,31 +1081,31 @@ { User::After( TTimeIntervalMicroSeconds32( KWaitingTime ) ); } - else + else { break; } } - + User::LeaveIfError( error ); CleanupClosePushL( etelServer ); - - User::LeaveIfError( etelServer.LoadPhoneModule( KMmTsyModuleName ) ); - + + User::LeaveIfError( etelServer.LoadPhoneModule( KMmTsyModuleName ) ); + TUnloadModule unload; unload.iServer = &etelServer; unload.iName = &KMmTsyModuleName; - + TCleanupItem item( DoUnloadPhoneModule, &unload ); CleanupStack::PushL( item ); User::LeaveIfError( etelServer.EnumeratePhones( count ) ); - + for ( count2 = 0; count2 < count && !found; ++count2 ) { RTelServer::TPhoneInfo phoneInfo; User::LeaveIfError( etelServer.GetTsyName( count2, phoneInfo.iName ) ); - - if ( phoneInfo.iName.CompareF(KMmTsyModuleName()) == 0 ) + + if ( phoneInfo.iName.CompareF(KMmTsyModuleName()) == 0 ) { User::LeaveIfError( etelServer.GetPhoneInfo( count2, phoneInfo ) ); User::LeaveIfError( phone.Open( etelServer, phoneInfo.iName ) ); @@ -1119,45 +1119,45 @@ // Not found. User::Leave( KErrNotFound ); } - + User::LeaveIfError( phone.GetIdentityCaps( caps ) ); if (!( caps & RMobilePhone::KCapsGetSerialNumber )) { User::Leave( KErrNotFound ); } - + RMobilePhone::TMobilePhoneIdentityV1 id; TRequestStatus status; - + phone.GetPhoneId( status, id ); - + User::WaitForRequest( status ); - + User::LeaveIfError( status.Int() ); - + iImei = id.iSerialNumber.AllocL(); - + CleanupStack::PopAndDestroy( 3 ); // phone, item, etelServer - + HBufC8* buf = HBufC8::NewL( iImei->Size() ); TPtr8 ptr( buf->Des() ); ptr.Copy( *iImei ); - + LOG(_L("IMEI:")); LOGHEX(ptr); delete buf; - + return *iImei; -#endif /* __WINS__ , WINSCW */ - +#endif /* __WINS__ , WINSCW */ + } - - + + // ----------------------------------------------------------------------------- // CDrmStdKeyStorage::RandomDataGetL // ----------------------------------------------------------------------------- // - + void CDrmStdKeyStorage::RandomDataGetL( TDes8& aData, const TInt aLength ) { if ( aLength <= 0 ) diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/legacy/src/DRMCommon.cpp --- a/omadrm/drmengine/legacy/src/DRMCommon.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/legacy/src/DRMCommon.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,30 +19,30 @@ // INCLUDE FILES #include -#include +#include #include -#include -#include +#include +#include #include -#include +#include #include #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif #include "DRMCommon.h" #include "DRMRightsClient.h" #include "DcfCommon.h" #include "Oma1Dcf.h" -#include "Oma2Dcf.h" -#include "DRMPermission.h" +#include "oma2dcf.h" +#include "DrmPermission.h" // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS @@ -90,25 +90,25 @@ /* LOCAL_C TInt CheckContentRightsL( - const TDesC8& aContentURI, + const TDesC8& aContentURI, TUint32 aRightsSpec); LOCAL_C TInt IsProtectedContentL( - const TDesC8& aContent, + const TDesC8& aContent, TBool& aProtection); LOCAL_C TInt GetNewHeaderBuffer( - HBufC8*& aOldHeaderBuf, - const TDesC8& aHeaderName, - const TDesC8& aHeaderValue, + HBufC8*& aOldHeaderBuf, + const TDesC8& aHeaderName, + const TDesC8& aHeaderValue, HBufC8*& aNewHeaderBuf ); LOCAL_C TInt WriteNewFile( - TFileName aFileName, - HBufC8*& aHeaderBuf, - TUint32& aFirstPartLength, - TUint32& aDataLength, + TFileName aFileName, + HBufC8*& aHeaderBuf, + TUint32& aFirstPartLength, + TUint32& aDataLength, TUint32& aDataPartPos ); @@ -133,92 +133,92 @@ */ LOCAL_C void GetActiveRightsL( - const TDesC8& aContentURI, - TUint32 aRightsSpec, + const TDesC8& aContentURI, + TUint32 aRightsSpec, CDRMRights*& aRightsObject); LOCAL_C TInt CheckFileRightsL( - const TDesC& aFileName, + const TDesC& aFileName, TUint32 aRightsSpec); LOCAL_C TInt CheckFileRightsL( - RFile& aFileHandle, + RFile& aFileHandle, TUint32 aRightsSpec); LOCAL_C TInt IsProtectedFileL( - const TDesC& aFileName, + const TDesC& aFileName, TBool& aProtection); LOCAL_C TInt IsProtectedFileL( - RFile& aFileHandle, + RFile& aFileHandle, TBool& aProtection); LOCAL_C TInt GetContentInfoL( - const TDesC8& aContent, - DRMCommon::TContentProtection& aProtection, - HBufC8*& aMIMEType, - HBufC8*& aContentURI, + const TDesC8& aContent, + DRMCommon::TContentProtection& aProtection, + HBufC8*& aMIMEType, + HBufC8*& aContentURI, TUint& aDataLength); LOCAL_C TInt GetFileInfoL( - const TDesC& aFileName, - DRMCommon::TContentProtection& aProtection, - HBufC8*& aMIMEType, - HBufC8*& aContentURI, + const TDesC& aFileName, + DRMCommon::TContentProtection& aProtection, + HBufC8*& aMIMEType, + HBufC8*& aContentURI, TUint& aDataLength); LOCAL_C TInt GetFileInfoL( - RFile& aFileHandle, - DRMCommon::TContentProtection& aProtection, - HBufC8*& aMIMEType, - HBufC8*& aContentURI, + RFile& aFileHandle, + DRMCommon::TContentProtection& aProtection, + HBufC8*& aMIMEType, + HBufC8*& aContentURI, TUint& aDataLength); LOCAL_C void GetContentHeaderL( - const TDesC8& aContent, - const TDesC8& aHeaderName, + const TDesC8& aContent, + const TDesC8& aHeaderName, HBufC8*& aHeaderValue); LOCAL_C void GetFileHeaderL( - const TFileName& aFileName, - const TDesC8& aHeaderName, + const TFileName& aFileName, + const TDesC8& aHeaderName, HBufC8*& aHeaderValue); LOCAL_C void GetFileHeaderL( - RFile& aFileHandle, - const TDesC8& aHeaderName, + RFile& aFileHandle, + const TDesC8& aHeaderName, HBufC8*& aHeaderValue); LOCAL_C void SetContentHeaderL( - HBufC8*& aContent, - const TDesC8& aHeaderName, + HBufC8*& aContent, + const TDesC8& aHeaderName, const TDesC8& aHeaderValue); LOCAL_C void SetFileHeaderL( - const TDesC16& aFileName, - const TDesC8& aHeaderName, + const TDesC16& aFileName, + const TDesC8& aHeaderName, const TDesC8& aHeaderValue); LOCAL_C void SetFileHeaderL( - RFile& aFileHandle, - const TDesC8& aHeaderName, + RFile& aFileHandle, + const TDesC8& aHeaderName, const TDesC8& aHeaderValue); LOCAL_C void GetSingleRightsObjectL( - const TDesC8& aContentURI, - TUint32 aLocalID, + const TDesC8& aContentURI, + TUint32 aLocalID, CDRMRights*& aRightsObject); LOCAL_C void GetDetailedContentRightsL( - const TDesC8& aContentURI, + const TDesC8& aContentURI, RPointerArray*& aRightsList); LOCAL_C void GetDetailedFileRightsL( - const TDesC& aFileName, + const TDesC& aFileName, RPointerArray*& aRightsList); LOCAL_C void GetDetailedFileRightsL( - RFile& aFileHandle, + RFile& aFileHandle, RPointerArray*& aRightsList); LOCAL_C TInt RegisterDynamicDataTypeL( @@ -230,18 +230,18 @@ LOCAL_C TInt CalculatePaddingL( COma1Dcf* dcf); -LOCAL_C void DoResetAndDestroy( TAny* aPtr ); +LOCAL_C void DoResetAndDestroy( TAny* aPtr ); LOCAL_C TInt GetFileHandleRead( - RFs& aFileServer, - RFile& aFile, + RFs& aFileServer, + RFile& aFile, const TDesC& aFileName ); -LOCAL_C void AddParents( - DRMCommon* aDrmCommon, +LOCAL_C void AddParents( + DRMCommon* aDrmCommon, RPointerArray& aRights ); - + // FORWARD DECLARATIONS using namespace ContentAccess; @@ -258,13 +258,13 @@ ( reinterpret_cast< RPointerArray< CDRMPermission >* >( aPtr ) )-> ResetAndDestroy(); } - - + + // ----------------------------------------------------------------------------- // GetPermission // ----------------------------------------------------------------------------- LOCAL_C void GetPermission( - RDRMRightsClient& aClient, + RDRMRightsClient& aClient, const TDesC8& aUri, TIntent aIntent, CDRMPermission*& aPermission ) @@ -272,19 +272,19 @@ TInt r = KErrNone; CDRMPermission* permission = NULL; TUint32 reason = 0; - + TRAP( r, permission = aClient.GetActiveRightsL( aIntent, aUri, reason ) ); if ( permission != NULL ) { if ( aPermission == NULL ) { - TRAP_IGNORE( aPermission = CDRMPermission::NewL() ); + TRAP_IGNORE( aPermission = CDRMPermission::NewL() ); } aPermission->Merge( *permission ); delete permission; } } - + // ----------------------------------------------------------------------------- // GetActiveRightsL // Returns a possible active rights object. Adopts to broken callers who still @@ -298,7 +298,7 @@ CDRMPermission* permission = NULL; RDRMRightsClient client; HBufC8* uri = NULL; - + User::LeaveIfError( client.Connect() ); CleanupClosePushL( client ); @@ -336,14 +336,14 @@ } // ----------------------------------------------------------------------------- -// +// // // Parameters: // // Returns: // ----------------------------------------------------------------------------- LOCAL_C TInt IsProtectedFileL( - const TDesC& aFileName, + const TDesC& aFileName, TBool& aProtection) { RFs fs; @@ -353,11 +353,11 @@ User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); - - + + r = GetFileHandleRead( fs, file, aFileName ); User::LeaveIfError(r); - + CleanupClosePushL(file); dcf = CDcfCommon::NewL(file); if (dcf != NULL) @@ -374,14 +374,14 @@ } // ----------------------------------------------------------------------------- -// +// // // Parameters: // // Returns: // ----------------------------------------------------------------------------- LOCAL_C TInt IsProtectedFileL( - RFile& aFileHandle, + RFile& aFileHandle, TBool& aProtection) { TInt r = KErrNone; @@ -401,17 +401,17 @@ } // ----------------------------------------------------------------------------- -// +// // // Parameters: // // Returns: // ----------------------------------------------------------------------------- TInt GetContentInfoL( - const TDesC8& aContent, - DRMCommon::TContentProtection& aProtection, - HBufC8*& aMIMEType, - HBufC8*& aContentURI, + const TDesC8& aContent, + DRMCommon::TContentProtection& aProtection, + HBufC8*& aMIMEType, + HBufC8*& aContentURI, TUint& aDataLength) { TInt r = KErrNone; @@ -420,7 +420,7 @@ if (dcf != NULL) { CleanupStack::PushL( dcf ); - + if (dcf->iContentID->Left(4).Compare(KLDPrefix) == 0 || dcf->iContentID->Left(4).Compare(KFLPrefix) == 0 || dcf->iRightsIssuerURL == NULL) @@ -466,17 +466,17 @@ } // ----------------------------------------------------------------------------- -// +// // // Parameters: // // Returns: // ----------------------------------------------------------------------------- TInt GetFileInfoL( - const TDesC& aFileName, - DRMCommon::TContentProtection& aProtection, - HBufC8*& aMIMEType, - HBufC8*& aContentURI, + const TDesC& aFileName, + DRMCommon::TContentProtection& aProtection, + HBufC8*& aMIMEType, + HBufC8*& aContentURI, TUint& aDataLength) { RFs fs; @@ -489,11 +489,11 @@ aProtection = DRMCommon::ENoDCFFile; User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); - + r = GetFileHandleRead( fs, file, aFileName ); User::LeaveIfError(r); CleanupClosePushL(file); - + dcf = CDcfCommon::NewL(file); if (dcf != NULL) { @@ -502,7 +502,7 @@ { dcf2 = static_cast(dcf); } - + if (dcf->iContentID->Left(4).Compare(KLDPrefix) == 0 || dcf->iContentID->Left(4).Compare(KFLPrefix) == 0 || dcf->iRightsIssuerURL == NULL) @@ -529,7 +529,7 @@ { aMIMEType = NULL; } - + // Insert domain RO if it exists if (dcf2 != NULL && dcf2->iRightsObjects.Count() > 0) { @@ -537,7 +537,7 @@ data = CData::NewL(file, KDefaultContentObject); delete data; } - + if (dcf->iVersion == EOma1Dcf && !dcf->iPlainTextLengthValid) { CalculatePaddingL(static_cast(dcf)); @@ -551,17 +551,17 @@ } // ----------------------------------------------------------------------------- -// +// // // Parameters: // // Returns: // ----------------------------------------------------------------------------- TInt GetFileInfoL( - RFile& aFileHandle, - DRMCommon::TContentProtection& aProtection, - HBufC8*& aMIMEType, - HBufC8*& aContentURI, + RFile& aFileHandle, + DRMCommon::TContentProtection& aProtection, + HBufC8*& aMIMEType, + HBufC8*& aContentURI, TUint& aDataLength) { TInt r = KErrNone; @@ -571,7 +571,7 @@ TInt initialPos = 0; // Store the initial filePos - User::LeaveIfError(aFileHandle.Seek(ESeekCurrent, initialPos)); + User::LeaveIfError(aFileHandle.Seek(ESeekCurrent, initialPos)); aProtection = DRMCommon::ENoDCFFile; @@ -618,7 +618,7 @@ data = CData::NewL(aFileHandle, KDefaultContentObject); delete data; } - + if (dcf->iVersion == EOma1Dcf && !dcf->iPlainTextLengthValid) { CalculatePaddingL(static_cast(dcf)); @@ -633,14 +633,14 @@ } // ----------------------------------------------------------------------------- -// +// // // Parameters: // // Returns: // ----------------------------------------------------------------------------- TInt CheckFileRightsL( - const TDesC& aFileName, + const TDesC& aFileName, TUint32 aRightsSpec) { RFs fs; @@ -649,14 +649,14 @@ TInt r = DRMCommon::ENoRights; RDRMRightsClient client; TUint32 reason = 0; - + User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); - + r = GetFileHandleRead(fs, file, aFileName); User::LeaveIfError(r); CleanupClosePushL(file); - + dcf = CDcfCommon::NewL(file); if ( dcf == NULL ) { @@ -671,21 +671,21 @@ } // ----------------------------------------------------------------------------- -// +// // // Parameters: // // Returns: // ----------------------------------------------------------------------------- TInt CheckFileRightsL( - RFile& aFileHandle, + RFile& aFileHandle, TUint32 aRightsSpec) { CDcfCommon* dcf = NULL; TInt r = DRMCommon::ENoRights; RDRMRightsClient client; TUint32 reason = 0; - + dcf = CDcfCommon::NewL(aFileHandle); if ( dcf == NULL ) { @@ -700,28 +700,28 @@ } // ----------------------------------------------------------------------------- -// +// // // Parameters: // // Returns: // ----------------------------------------------------------------------------- void GetSingleRightsObjectL( - const TDesC8& aContentURI, - TUint32 aLocalID, + const TDesC8& aContentURI, + TUint32 aLocalID, CDRMRights*& aRightsObject) { RDRMRightsClient client; CDRMPermission* p = NULL; CDRMAsset* a = NULL; - + aRightsObject = NULL; User::LeaveIfError(client.Connect()); CleanupClosePushL(client); - - aRightsObject = CDRMRights::NewL(); + + aRightsObject = CDRMRights::NewL(); CleanupStack::PushL(aRightsObject); - + p = client.GetDbEntryL(aContentURI, aLocalID); CleanupStack::PushL(p); aRightsObject->SetPermissionL(*p); @@ -730,21 +730,21 @@ a = CDRMAsset::NewLC(); aRightsObject->SetAssetL(*a); CleanupStack::PopAndDestroy(); - + aRightsObject->SetContentURIAndLocalID(aContentURI.AllocL(), aLocalID); CleanupStack::Pop(); // aRightsObject CleanupStack::PopAndDestroy(); // client } // ----------------------------------------------------------------------------- -// +// // // Parameters: // // Returns: // ----------------------------------------------------------------------------- void GetDetailedContentRightsL( - const TDesC8& aContentURI, + const TDesC8& aContentURI, RPointerArray*& aRightsList) { RDRMRightsClient client; @@ -754,7 +754,7 @@ TInt i; // Need a temporary pointer HBufC8* contentId = NULL; - + aRightsList = NULL; User::LeaveIfError(client.Connect()); CleanupClosePushL(client); @@ -809,30 +809,30 @@ } // ----------------------------------------------------------------------------- -// +// // // Parameters: // // Returns: // ----------------------------------------------------------------------------- void GetDetailedFileRightsL( - const TDesC& aFileName, + const TDesC& aFileName, RPointerArray*& aRightsList) { - + CDcfCommon* dcf = NULL; RFile file; RFs fs; TInt r = KErrNone; - + User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); r = GetFileHandleRead( fs, file, aFileName ); User::LeaveIfError(r); CleanupClosePushL(file); - - + + dcf = CDcfCommon::NewL(file); if (dcf == NULL) { @@ -841,22 +841,22 @@ CleanupStack::PushL(dcf); GetDetailedContentRightsL(*dcf->iContentID, aRightsList); CleanupStack::PopAndDestroy(3); // dcf, file, client - + } // ----------------------------------------------------------------------------- -// +// // // Parameters: // // Returns: // ----------------------------------------------------------------------------- void GetDetailedFileRightsL( - RFile& aFileHandle, + RFile& aFileHandle, RPointerArray*& aRightsList) { CDcfCommon* dcf = NULL; - + dcf = CDcfCommon::NewL(aFileHandle); if (dcf == NULL) { @@ -868,16 +868,16 @@ } // ----------------------------------------------------------------------------- -// +// // // Parameters: // // Returns: // ----------------------------------------------------------------------------- LOCAL_C void GetNewHeaderBufferL( - HBufC8*& aOldHeaderBuf, - const TDesC8& aHeaderName, - const TDesC8& aHeaderValue, + HBufC8*& aOldHeaderBuf, + const TDesC8& aHeaderName, + const TDesC8& aHeaderValue, HBufC8*& aNewHeaderBuf ) { @@ -886,7 +886,7 @@ TPtr8 headerPtr(aOldHeaderBuf->Des()); TPtr8 headerNamePtr(NULL, 0, 0); TPtr8 newHeaderPtr(NULL, 0, 0); - + HBufC8* headerName = HBufC8::NewL(aHeaderName.Length() + 1); // Find the position of the text in the header headerNamePtr.Set(headerName->Des()); @@ -909,7 +909,7 @@ newHeaderPtr.Copy(headerPtr.Left(offset + aHeaderName.Length() + 1)); newHeaderPtr.Append(aHeaderValue); newHeaderPtr.Append(headerPtr.Right(headerPtr.Length() - - (offset + aHeaderName.Length() + 1 + oldHeaderValueLength))); + (offset + aHeaderName.Length() + 1 + oldHeaderValueLength))); } else { @@ -921,11 +921,11 @@ newHeaderPtr.Append(KHeaderNameEnding); newHeaderPtr.Append(aHeaderValue); newHeaderPtr.Append(KHeaderEnding); - } + } } // ----------------------------------------------------------------------------- -// +// // // Parameters: // @@ -943,14 +943,14 @@ RFileWriteStream temp; TPtr8 ptr(NULL, 0, 0); TInt offset = 0; - + // Find the path of the file to be modified and put the tempfile // into that directory tempFilePath.Set(aOriginalFileName.Left( aOriginalFileName.LocateReverse('\\') + 1)); User::LeaveIfError(temp.Temp(aFs, tempFilePath, aTempFileName, EFileWrite)); CleanupClosePushL( temp ); - + temp.WriteUint8L(1); temp.WriteUint8L(aDcf.iMimeType->Length()); temp.WriteUint8L(aDcf.iContentID->Length()); @@ -973,20 +973,20 @@ { ptr.Set(buffer->Des()); ptr.SetLength(0); - aOriginalFile.Read(ptr); + aOriginalFile.Read(ptr); if (ptr.Length() > 0) { temp.WriteL(ptr); } } while (ptr.Length() > 0); - temp.CommitL(); + temp.CommitL(); CleanupStack::PopAndDestroy(); // temp CleanupStack::PopAndDestroy(); //buffer } // ----------------------------------------------------------------------------- -// +// // // Parameters: // @@ -1006,14 +1006,14 @@ TPtr8 ptr(NULL, 0, 0); TInt offset = 0; TInt fileSize = 0; - + // Find the path of the file to be modified and put the tempfile // into that directory tempFilePath.Set(_L("C:\\")); - User::LeaveIfError( temp.Temp( aFs, tempFilePath, tempFile, + User::LeaveIfError( temp.Temp( aFs, tempFilePath, tempFile, EFileWrite)); CleanupClosePushL( temp ); - + temp.WriteUint8L(1); temp.WriteUint8L(aDcf.iMimeType->Length()); temp.WriteUint8L(aDcf.iContentID->Length()); @@ -1036,7 +1036,7 @@ { ptr.Set(buffer->Des()); ptr.SetLength(0); - aOriginalFile.Read(ptr); + aOriginalFile.Read(ptr); if (ptr.Length() > 0) { temp.WriteL(ptr); @@ -1044,57 +1044,57 @@ } while (ptr.Length() > 0); temp.CommitL(); - + CleanupStack::PopAndDestroy(2); //buffer, temp // Get the size of the temp file User::LeaveIfError( tempFileHandle.Open( aFs, tempFile, EFileRead )); - CleanupClosePushL( tempFileHandle ); - tempFileHandle.Size( fileSize ); - - + CleanupClosePushL( tempFileHandle ); + tempFileHandle.Size( fileSize ); + + // Set the fileSize of the original file User::LeaveIfError( aOriginalFile.SetSize( fileSize ) ); offset = 0; User::LeaveIfError( tempFileHandle.Seek( ESeekStart, offset ) ); orig.Attach( aOriginalFile ); CleanupClosePushL( orig ); - - buffer = HBufC8::NewLC(KBufferSize); + + buffer = HBufC8::NewLC(KBufferSize); // Copy the file over because we can't use other copy things: do { ptr.Set(buffer->Des()); ptr.SetLength(0); - tempFileHandle.Read(ptr); + tempFileHandle.Read(ptr); if (ptr.Length() > 0) { orig.WriteL(ptr); } } while (ptr.Length() > 0); - - // Write the changes + + // Write the changes orig.CommitL(); - + // close the tempfile CleanupStack::PopAndDestroy(3); // buffer, tempFileHandle, orig - + // Delete the temp file User::LeaveIfError( aFs.Delete( tempFile ) ); } // ----------------------------------------------------------------------------- -// +// // // Parameters: // // Returns: // ----------------------------------------------------------------------------- LOCAL_C void SetFileHeaderL( - const TDesC16& aFileName, - const TDesC8& aHeaderName, + const TDesC16& aFileName, + const TDesC8& aHeaderName, const TDesC8& aHeaderValue) { __UHEAP_MARK; @@ -1110,7 +1110,7 @@ CleanupClosePushL(file); dcf = COma1Dcf::NewL(file); - + CleanupStack::PushL(dcf); GetNewHeaderBufferL(dcf->iHeaders, aHeaderName, aHeaderValue, newHeaderBuf); delete dcf->iHeaders; @@ -1120,29 +1120,29 @@ CleanupStack::PopAndDestroy(2); // file, dcf User::LeaveIfError( fs.Replace( tempFileName, aFileName ) ); CleanupStack::PopAndDestroy(); // fs - + __UHEAP_MARKEND; } // ----------------------------------------------------------------------------- -// +// // // Parameters: // // Returns: // ----------------------------------------------------------------------------- LOCAL_C void SetFileHeaderL( - RFile& aFileHandle, - const TDesC8& aHeaderName, + RFile& aFileHandle, + const TDesC8& aHeaderName, const TDesC8& aHeaderValue) { HBufC8* newHeaderBuf = NULL; COma1Dcf* dcf = NULL; RFs fs; - + User::LeaveIfError(fs.Connect()); CleanupClosePushL( fs ); - + dcf = COma1Dcf::NewL(aFileHandle); if (dcf == NULL) { @@ -1158,15 +1158,15 @@ } // ----------------------------------------------------------------------------- -// +// // // Parameters: // // Returns: // ----------------------------------------------------------------------------- void SetContentHeaderL( - HBufC8*& aContent, - const TDesC8& aHeaderName, + HBufC8*& aContent, + const TDesC8& aHeaderName, const TDesC8& aHeaderValue) { HBufC8* newHeaderBuf = NULL; @@ -1211,33 +1211,33 @@ } // ----------------------------------------------------------------------------- -// +// // // Parameters: // // Returns: // ----------------------------------------------------------------------------- void GetHeaderL( - const TDesC8& aContent, - const TDesC8& aHeaderName, + const TDesC8& aContent, + const TDesC8& aHeaderName, HBufC8*& aHeaderValue) { - + TInt i; TInt j; TPtrC8 ptr( aContent ); - + // Add Room for CRLF and Semicolon: - HBufC8* buffer = HBufC8::NewMaxLC( aHeaderName.Length() + 3 ); - TPtr8 searchBuf( const_cast(buffer->Ptr()), 0, buffer->Des().MaxSize() ); + HBufC8* buffer = HBufC8::NewMaxLC( aHeaderName.Length() + 3 ); + TPtr8 searchBuf( const_cast(buffer->Ptr()), 0, buffer->Des().MaxSize() ); searchBuf.Copy(aHeaderName); searchBuf.Append(KHeaderNameEnding); - - // First see if the + + // First see if the i = ptr.Find(searchBuf); User::LeaveIfError( i ); - + if( i > 0 ) { // if it's not the first one, use the search buffer: @@ -1245,31 +1245,31 @@ searchBuf.Copy(KHeaderEnding); searchBuf.Append(aHeaderName); searchBuf.Append(KHeaderNameEnding); - - // First see if the + + // First see if the i = ptr.Find(searchBuf); - User::LeaveIfError( i ); + User::LeaveIfError( i ); } - // Move search buffer - i += searchBuf.Length(); - + // Move search buffer + i += searchBuf.Length(); + j = ptr.Mid(i).Find(KHeaderEnding); User::LeaveIfError( j ); - - aHeaderValue = ptr.Mid(i, j).AllocL(); - CleanupStack::PopAndDestroy(); // buffer + + aHeaderValue = ptr.Mid(i, j).AllocL(); + CleanupStack::PopAndDestroy(); // buffer } // ----------------------------------------------------------------------------- -// +// // // Parameters: // // Returns: // ----------------------------------------------------------------------------- void GetContentHeaderL( - const TDesC8& aContent, - const TDesC8& aHeaderName, + const TDesC8& aContent, + const TDesC8& aHeaderName, HBufC8*& aHeaderValue) { COma1Dcf* dcf = NULL; @@ -1280,15 +1280,15 @@ CleanupStack::PopAndDestroy(); // dcf } // ----------------------------------------------------------------------------- -// +// // // Parameters: // // Returns: // ----------------------------------------------------------------------------- void GetFileHeaderL( - const TFileName& aFileName, - const TDesC8& aHeaderName, + const TFileName& aFileName, + const TDesC8& aHeaderName, HBufC8*& aHeaderValue) { RFs fs; @@ -1304,15 +1304,15 @@ } // ----------------------------------------------------------------------------- -// +// // // Parameters: // // Returns: // ----------------------------------------------------------------------------- void GetFileHeaderL( - RFile& aFileHandle, - const TDesC8& aHeaderName, + RFile& aFileHandle, + const TDesC8& aHeaderName, HBufC8*& aHeaderValue) { CDcfCommon* dcf = NULL; @@ -1355,31 +1355,31 @@ TInt err = 0; TDataType type; RFs fs; - RFileReadStream reader; - + RFileReadStream reader; + aCount = 0; err = fs.Connect(); - if (!err) + if (!err) { - + #ifndef RD_MULTIPLE_DRIVE - + err = reader.Open(fs, KDataTypesFile, EFileRead); - + #else //RD_MULTIPLE_DRIVE - + TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); fs.DriveToChar( driveNumber, driveLetter ); - + TFileName dataTypesFile; - dataTypesFile.Format( KDataTypesFile, (TUint)driveLetter ); - + dataTypesFile.Format( KDataTypesFile, (TUint)driveLetter ); + err = reader.Open(fs, dataTypesFile, EFileRead); - + #endif - + if (err == KErrNotFound) { err = DRMCommon::EOk; @@ -1391,19 +1391,19 @@ TRAP(err, (reader >> type)); if (err == KErrNone) aCount++; } - + if (err == KErrEof) { err = DRMCommon::EOk; } - + reader.Release(); reader.Close(); } } - + fs.Close(); - + return err; } @@ -1419,7 +1419,7 @@ // KErrEof: Data type not found // ----------------------------------------------------------------------------- LOCAL_C TInt SupportedDynamicDataType( - const TInt aIndex, + const TInt aIndex, TDataType& aDataType) { TInt err = KErrNone; @@ -1427,50 +1427,50 @@ RFs fs; TDataType type; RFileReadStream reader; - + err = fs.Connect(); - if (!err) + if (!err) { - + #ifndef RD_MULTIPLE_DRIVE - + err = reader.Open(fs, KDataTypesFile, EFileRead); - + #else //RD_MULTIPLE_DRIVE - + TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); - fs.DriveToChar( driveNumber, driveLetter ); - - TFileName dataTypesFile; - dataTypesFile.Format( KDataTypesFile, (TUint)driveLetter ); - + fs.DriveToChar( driveNumber, driveLetter ); + + TFileName dataTypesFile; + dataTypesFile.Format( KDataTypesFile, (TUint)driveLetter ); + err = reader.Open(fs, dataTypesFile, EFileRead); - + #endif - - if (!err) + + if (!err) { i = -1; - while (err == 0 && i != aIndex) + while (err == 0 && i != aIndex) { TRAP(err, (reader >> type)); i++; } - + if (!err) { - aDataType = type; + aDataType = type; } - + reader.Release(); reader.Close(); } } - + fs.Close(); - + return err; } @@ -1486,7 +1486,7 @@ // KErrEof: Data type not found // ----------------------------------------------------------------------------- LOCAL_C TInt SupportedStaticDataType( - const TInt aIndex, + const TInt aIndex, TDataType& aDataType) { TInt err = 0; @@ -1497,51 +1497,51 @@ RResourceFile resourceFile; HBufC8* res = NULL; TResourceReader theReader; - + err = fs.Connect(); if (err) { fs.Close(); return err; } - + #ifndef RD_MULTIPLE_DRIVE - + TRAP(err, resourceFile.OpenL(fs, KResourceFile)); - + #else //RD_MULTIPLE_DRIVE - + TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber ); fs.DriveToChar( driveNumber, driveLetter ); - + TFileName resFile; - resFile.Format( KResourceFile, (TUint)driveLetter ); - + resFile.Format( KResourceFile, (TUint)driveLetter ); + TRAP(err, resourceFile.OpenL(fs, resFile)); - + #endif if (err) { fs.Close(); return err; } - - TRAP(err, (res = resourceFile.AllocReadL(DATATYPE))); + + TRAP(err, (res = resourceFile.AllocReadL(DATATYPE))); if (err) { resourceFile.Close(); fs.Close(); return err; } - + theReader.SetBuffer(res); index = aIndex + 1; TPtrC temp16(theReader.ReadTPtrC(index, res)); length = temp16.Length(); HBufC8* temp = NULL; - temp = HBufC8::NewMax(length); + temp = HBufC8::NewMax(length); if (temp) { TPtr8 ptr(temp->Des()); @@ -1556,19 +1556,19 @@ { err = KErrNoMemory; } - - if (temp) + + if (temp) { delete temp; } - + temp = NULL; resourceFile.Close(); - if (res) + if (res) { delete res; } - + res = NULL; fs.Close(); return err; @@ -1593,52 +1593,52 @@ RFileWriteStream writer; RFileReadStream reader; RFs fs; - + User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); - + // Open the data types file - + #ifndef RD_MULTIPLE_DRIVE User::LeaveIfError(reader.Open(fs, KDataTypesFile, EFileRead)); - + #else //RD_MULTIPLE_DRIVE - + TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); fs.DriveToChar( driveNumber, driveLetter ); - + TFileName dataTypesFile; - dataTypesFile.Format( KDataTypesFile, (TUint)driveLetter ); - + dataTypesFile.Format( KDataTypesFile, (TUint)driveLetter ); + User::LeaveIfError(reader.Open(fs, dataTypesFile, EFileRead)); - + #endif - + CleanupReleasePushL(reader); - + // Create and open a replacement file - + #ifndef RD_MULTIPLE_DRIVE - + User::LeaveIfError(writer.Replace(fs, KTempFile, EFileWrite)); - + #else //RD_MULTIPLE_DRIVE - + TFileName tempFile; tempFile.Format( KTempFile, (TUint)driveLetter ); - + User::LeaveIfError(writer.Replace(fs, tempFile, EFileWrite)); - + #endif - + CleanupReleasePushL(writer); - + // Write all dynamic types into the replacement file, excluding the // data type to be removed - + r = KErrNone; for (i = 0; r == KErrNone; i++) { @@ -1651,22 +1651,22 @@ } CleanupStack::PopAndDestroy(); CleanupStack::PopAndDestroy(); - + // Replace the data type file with the replacement file - + #ifndef RD_MULTIPLE_DRIVE fs.Replace(KTempFile, KDataTypesFile); - + #else //RD_MULTIPLE_DRIVE - + fs.Replace(tempFile, dataTypesFile); - + #endif - - + + CleanupStack::PopAndDestroy(); - + return DRMCommon::EOk; } @@ -1686,52 +1686,52 @@ RFileWriteStream writer; RFileReadStream reader; RFs fs; - + User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); - + // Create and open a replacement file - + #ifndef RD_MULTIPLE_DRIVE - + User::LeaveIfError(writer.Replace(fs, KTempFile, EFileWrite)); - + #else //RD_MULTIPLE_DRIVE - + TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); fs.DriveToChar( driveNumber, driveLetter ); - + TFileName tempFile; - tempFile.Format( KTempFile, (TUint)driveLetter ); - + tempFile.Format( KTempFile, (TUint)driveLetter ); + User::LeaveIfError(writer.Replace(fs, tempFile, EFileWrite)); - + #endif - + CleanupReleasePushL(writer); - + // Write the new data type into the replacement file - + writer << aDataType; writer.CommitL(); - + // Write all other dynamic types into the replacement file - + #ifndef RD_MULTIPLE_DRIVE - + err = reader.Open(fs, KDataTypesFile, EFileRead); - + #else //RD_MULTIPLE_DRIVE - + TFileName dataTypesFile; dataTypesFile.Format( KDataTypesFile, (TUint)driveLetter ); - + err = reader.Open(fs, dataTypesFile, EFileRead); - + #endif - + if (err == KErrNone) { CleanupReleasePushL(reader); @@ -1741,23 +1741,23 @@ } CleanupStack::PopAndDestroy(); } - + CleanupStack::PopAndDestroy(); - + // Replace the data type file with the replacement file - + #ifndef RD_MULTIPLE_DRIVE - + fs.Replace(KTempFile, KDataTypesFile); - + #else //RD_MULTIPLE_DRIVE - + fs.Replace(tempFile, dataTypesFile); - + #endif - + CleanupStack::PopAndDestroy(); - + return DRMCommon::EOk; } @@ -1803,7 +1803,7 @@ return dcf->iPadding; } - + // ============================ MEMBER FUNCTIONS =============================== // ----------------------------------------------------------------------------- @@ -1813,7 +1813,7 @@ // ----------------------------------------------------------------------------- EXPORT_C DRMCommon::DRMCommon(void) { - } + } // ----------------------------------------------------------------------------- // DRMCommon::ConstructL @@ -1821,7 +1821,7 @@ // ----------------------------------------------------------------------------- EXPORT_C void DRMCommon::ConstructL() { - } + } // ----------------------------------------------------------------------------- // DRMCommon::NewL @@ -1847,13 +1847,13 @@ // Checks if the give rights for a specific content URI are available. // ----------------------------------------------------------------------------- EXPORT_C TInt DRMCommon::CheckContentRights( - const TDesC8& aContentID, + const TDesC8& aContentID, TUint32 aRightsSpec) { TInt r = ENoRights; RDRMRightsClient client; TUint32 reason = 0; - + if (client.Connect() == KErrNone) { r = client.CheckRights(aRightsSpec, aContentID, reason); @@ -1868,7 +1868,7 @@ // opening a given file and reading the content URI from there. // ----------------------------------------------------------------------------- EXPORT_C TInt DRMCommon::CheckFileRights( - const TDesC& aFileName, + const TDesC& aFileName, TUint32 aRightsSpec) { TInt r = KErrNone; @@ -1887,7 +1887,7 @@ // opening a given file and reading the content URI from there. // ----------------------------------------------------------------------------- EXPORT_C TInt DRMCommon::CheckFileRights( - RFile& aFileHandle, + RFile& aFileHandle, TUint32 aRightsSpec) { TInt r = KErrNone; @@ -1906,7 +1906,7 @@ // predefined header string. // ----------------------------------------------------------------------------- EXPORT_C TInt DRMCommon::IsProtectedContent( - const TDesC8& aContent, + const TDesC8& aContent, TBool& aProtection) { if (COma1Dcf::IsValidDcf(aContent) || COma2Dcf::IsValidDcf(aContent)) @@ -1926,7 +1926,7 @@ // predefined header string. // ----------------------------------------------------------------------------- EXPORT_C TInt DRMCommon::IsProtectedFile( - const TDesC& aFileName, + const TDesC& aFileName, TBool& aProtection) { TInt r = KErrNone; @@ -1940,27 +1940,27 @@ // predefined header string. // ----------------------------------------------------------------------------- EXPORT_C TInt DRMCommon::IsProtectedFile( - RFile& aFileHandle, + RFile& aFileHandle, TBool& aProtection) { TInt r = KErrNone; TRAP(r, IsProtectedFileL(aFileHandle, aProtection)); return r; } - + // ----------------------------------------------------------------------------- // DRMCommon::GetContentInfo // Returns DRM information about a memory buffer. // ----------------------------------------------------------------------------- EXPORT_C TInt DRMCommon::GetContentInfo( - const TDesC8& aContent, - TContentProtection& aProtection, - HBufC8*& aMIMEType, - HBufC8*& aContentURI, + const TDesC8& aContent, + TContentProtection& aProtection, + HBufC8*& aMIMEType, + HBufC8*& aContentURI, TUint& aDataLength) { TInt r = KErrNone; - TRAP(r, GetContentInfoL(aContent, aProtection, aMIMEType, aContentURI, + TRAP(r, GetContentInfoL(aContent, aProtection, aMIMEType, aContentURI, aDataLength)); return r; } @@ -1970,14 +1970,14 @@ // Returns DRM information about a file. // ----------------------------------------------------------------------------- EXPORT_C TInt DRMCommon::GetFileInfo( - const TDesC& aFileName, - TContentProtection& aProtection, - HBufC8*& aMIMEType, - HBufC8*& aContentURI, + const TDesC& aFileName, + TContentProtection& aProtection, + HBufC8*& aMIMEType, + HBufC8*& aContentURI, TUint& aDataLength) { TInt r = KErrNone; - TRAP(r, GetFileInfoL(aFileName, aProtection, aMIMEType, aContentURI, + TRAP(r, GetFileInfoL(aFileName, aProtection, aMIMEType, aContentURI, aDataLength)); return r; } @@ -1987,14 +1987,14 @@ // Returns DRM information about a file. // ----------------------------------------------------------------------------- EXPORT_C TInt DRMCommon::GetFileInfo( - RFile& aFileHandle, - TContentProtection& aProtection, - HBufC8*& aMIMEType, - HBufC8*& aContentURI, + RFile& aFileHandle, + TContentProtection& aProtection, + HBufC8*& aMIMEType, + HBufC8*& aContentURI, TUint& aDataLength) { TInt r = KErrNone; - TRAP(r, GetFileInfoL(aFileHandle, aProtection, aMIMEType, aContentURI, + TRAP(r, GetFileInfoL(aFileHandle, aProtection, aMIMEType, aContentURI, aDataLength)); return r; } @@ -2004,8 +2004,8 @@ // Returns an optional header from a memory buffer containing encrypted content. // ----------------------------------------------------------------------------- EXPORT_C TInt DRMCommon::GetContentHeader( - const TDesC8& aContent, - const TDesC8& aHeaderName, + const TDesC8& aContent, + const TDesC8& aHeaderName, HBufC8*& aHeaderValue) { TInt r = KErrNone; @@ -2019,8 +2019,8 @@ // Returns an optional header from a file containing encrypted content. // ----------------------------------------------------------------------------- EXPORT_C TInt DRMCommon::GetFileHeader( - const TFileName& aFileName, - const TDesC8& aHeaderName, + const TFileName& aFileName, + const TDesC8& aHeaderName, HBufC8*& aHeaderValue) { TInt r = KErrNone; @@ -2034,8 +2034,8 @@ // Returns an optional header from a file containing encrypted content. // ----------------------------------------------------------------------------- EXPORT_C TInt DRMCommon::GetFileHeader( - RFile& aFileHandle, - const TDesC8& aHeaderName, + RFile& aFileHandle, + const TDesC8& aHeaderName, HBufC8*& aHeaderValue) { TInt r = KErrNone; @@ -2049,8 +2049,8 @@ // Sets the specified optional header field of a DCF buffer. // ----------------------------------------------------------------------------- EXPORT_C TInt DRMCommon::SetContentHeader( - HBufC8*& aContent, - const TDesC8& aHeaderName, + HBufC8*& aContent, + const TDesC8& aHeaderName, const TDesC8& aHeaderValue) { TInt r = KErrNone; @@ -2064,8 +2064,8 @@ // Sets the specified optional header field of a DCF buffer. // ----------------------------------------------------------------------------- EXPORT_C TInt DRMCommon::SetFileHeader( - const TDesC16& aFileName, - const TDesC8& aHeaderName, + const TDesC16& aFileName, + const TDesC8& aHeaderName, const TDesC8& aHeaderValue) { TInt r = KErrNone; @@ -2079,8 +2079,8 @@ // Sets the specified optional header field of a DCF buffer. // ----------------------------------------------------------------------------- EXPORT_C TInt DRMCommon::SetFileHeader( - RFile& aFileHandle, - const TDesC8& aHeaderName, + RFile& aFileHandle, + const TDesC8& aHeaderName, const TDesC8& aHeaderValue) { TInt r = KErrNone; @@ -2094,8 +2094,8 @@ // Looks up the rights object using the content URI and the local ID. // ----------------------------------------------------------------------------- EXPORT_C TInt DRMCommon::GetSingleRightsObject( - const TDesC8& aContentURI, - TUint32 aLocalID, + const TDesC8& aContentURI, + TUint32 aLocalID, CDRMRights*& aRightsObject) { TInt r = KErrNone; @@ -2108,7 +2108,7 @@ // Returns all rights objects for a content URI // ----------------------------------------------------------------------------- EXPORT_C TInt DRMCommon::GetDetailedContentRights( - const TDesC8& aContentURI, + const TDesC8& aContentURI, RPointerArray*& aRightsList) { TInt r = KErrNone; @@ -2126,7 +2126,7 @@ // Returns all rights objects for a content URI from a given file // ----------------------------------------------------------------------------- EXPORT_C TInt DRMCommon::GetDetailedFileRights( - const TDesC& aFileName, + const TDesC& aFileName, RPointerArray*& aRightsList) { TInt r = KErrNone; @@ -2138,13 +2138,13 @@ } return r; } - + // ----------------------------------------------------------------------------- // DRMCommon::GetDetailedFileRights // Returns all rights objects for a content URI from a given file // ----------------------------------------------------------------------------- EXPORT_C TInt DRMCommon::GetDetailedFileRights( - RFile& aFileHandle, + RFile& aFileHandle, RPointerArray*& aRightsList) { TInt r = KErrNone; @@ -2155,7 +2155,7 @@ AddParents( const_cast(this), *aRightsList ); } return r; - } + } // ----------------------------------------------------------------------------- // DRMCommon::GetActiveRights @@ -2167,13 +2167,13 @@ CDRMRights*& aRightsObject) { TInt r = KErrNone; - + TRAP( r, GetActiveRightsL( aContentURI, aConstraints, aRightsObject ) ); if(r != KErrNone) { - return DRMCommon::ENoRights; + return DRMCommon::ENoRights; } - else + else { CDRMRights::TRestriction restriction; CDRMRights::TExpiration expiration; @@ -2192,7 +2192,7 @@ { RDRMRightsClient client; TInt error = client.Connect(); - + aURIList = NULL; if (!error) { @@ -2214,7 +2214,7 @@ } client.Close(); } - + return error; } @@ -2225,16 +2225,16 @@ EXPORT_C TInt DRMCommon::Connect() { RDRMRightsClient client; // Used to start RightsServer in bootup - TInt ignore = 0; // error will be ignored, if it fails to start the + TInt ignore = 0; // error will be ignored, if it fails to start the // rights server there is nothing we can really // do about it, and normally this would work and // return AOk, just used because of the SkinSrv // Bootup thing ignore = client.Connect(); // Called by SkinSrv during bootup - if( ignore ) - { - // The error shouldn't matter since it will be retried - } + if( ignore ) + { + // The error shouldn't matter since it will be retried + } client.Close(); return EOk; } @@ -2274,8 +2274,8 @@ // ----------------------------------------------------------------------------- EXPORT_C TVersion DRMCommon::Version() { - return TVersion(KClientVersionMajor, - KClientVersionMinor, + return TVersion(KClientVersionMajor, + KClientVersionMinor, KClientVersionBuild); } @@ -2285,8 +2285,8 @@ // ----------------------------------------------------------------------------- EXPORT_C TVersion DRMCommon::ServerVersion() { - return TVersion(KServerVersionMajor, - KServerVersionMinor, + return TVersion(KServerVersionMajor, + KServerVersionMinor, KServerVersionBuild); } @@ -2300,19 +2300,19 @@ TInt err = 0; TInt staticTotal = 0; TInt dynamicTotal = 0; - - err = StaticDataTypesCount(staticTotal); + + err = StaticDataTypesCount(staticTotal); if (err) { - return err; + return err; } - + err = DynamicDataTypesCount(dynamicTotal); if (err) { - return err; + return err; } - + aCount = staticTotal + dynamicTotal; return err; } @@ -2322,13 +2322,13 @@ // Returns a specific DRM enabled MIME type. // ----------------------------------------------------------------------------- EXPORT_C TInt DRMCommon::SupportedDataType( - const TInt aIndex, + const TInt aIndex, TDataType& aDataType) { TInt err = KErrNone; TInt total = 0; TInt stat = 0; - + err = DataTypesCount(total); if (!err) err = StaticDataTypesCount(stat); if (!err) @@ -2346,7 +2346,7 @@ err = KErrArgument; } } - + return err; } @@ -2361,51 +2361,51 @@ RFs fs; RResourceFile resourceFile; TResourceReader theReader; - + err = fs.Connect(); - + if (err) { fs.Close(); return err; } - + #ifndef RD_MULTIPLE_DRIVE - + TRAP(err, resourceFile.OpenL(fs, KResourceFile)); - + #else //RD_MULTIPLE_DRIVE - + TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber ); fs.DriveToChar( driveNumber, driveLetter ); - + TFileName resFile; - resFile.Format( KResourceFile, (TUint)driveLetter ); - + resFile.Format( KResourceFile, (TUint)driveLetter ); + TRAP(err, resourceFile.OpenL(fs, resFile)); - + #endif if (err) { fs.Close(); return err; } - + HBufC8* res = NULL; - TRAP(err, (res = resourceFile.AllocReadL(DATATYPE))); + TRAP(err, (res = resourceFile.AllocReadL(DATATYPE))); if (err) { resourceFile.Close(); fs.Close(); return err; } - - + + theReader.SetBuffer(res); aCount = theReader.ReadInt8(); - + delete res; res = NULL; resourceFile.Close(); @@ -2424,7 +2424,7 @@ TInt err = KErrNone; TInt i; TDataType type; - + if (aDataType.Des().Length() > 0) { err = DataTypesCount(total); @@ -2433,10 +2433,10 @@ err = SupportedDataType(i, type); if (type == aDataType) { - err = KErrAlreadyExists; + err = KErrAlreadyExists; } } - + if (!err) { TRAP(err, RegisterDynamicDataTypeL(aDataType)); @@ -2444,7 +2444,7 @@ } else { - err = KErrArgument; + err = KErrArgument; } return err; } @@ -2459,7 +2459,7 @@ TInt r; TInt count; TInt total; - + StaticDataTypesCount(count); r = DataTypesCount(total); if (r == KErrNone && aIndex >= count && aIndex < total) @@ -2495,7 +2495,7 @@ CDRMRights::TRestriction restriction; CDRMRights::TExpiration expiration; TUint32 constraints; - aRights->GetRightsInfo(EUnknown, restriction, expiration, + aRights->GetRightsInfo(EUnknown, restriction, expiration, constraints); if ( expiration == CDRMRights::EValidRights) { @@ -2507,11 +2507,11 @@ delete parents; } } - */ + */ } - - - + + + // ----------------------------------------------------------------------------- // GetFileHandle @@ -2521,8 +2521,8 @@ // 3) EFileShareReadersOnly // ----------------------------------------------------------------------------- LOCAL_C TInt GetFileHandleRead( - RFs& aFileServer, - RFile& aFile, + RFs& aFileServer, + RFile& aFile, const TDesC& aFileName ) { TInt error = KErrNone; @@ -2536,10 +2536,10 @@ if( error != KErrNone ) { // 3) Try to open in EFileShareReadersOnly - error = aFile.Open( aFileServer, aFileName, EFileRead | EFileShareReadersOnly ); + error = aFile.Open( aFileServer, aFileName, EFileRead | EFileShareReadersOnly ); } } - return error; + return error; }; // ----------------------------------------------------------------------------- @@ -2549,19 +2549,19 @@ // 2) EFileShareAny // 3) EFileShareReadersOnly // ----------------------------------------------------------------------------- -LOCAL_C void AddParents( DRMCommon* aDrmCommon, - RPointerArray& aRights ) +LOCAL_C void AddParents( DRMCommon* aDrmCommon, + RPointerArray& aRights ) { HBufC8* parent = NULL; RPointerArray* parents = NULL; TInt error = KErrNone; RPointerArray usedParents; - - + + for( TInt i = 0; i < aRights.Count(); i++ ) { parent = aRights[i]->GetPermission().iParentUID; - + for(TInt counter = 0; counter < usedParents.Count(); counter++ ) { if( parent && !usedParents[counter]->Compare( *parent ) ) @@ -2569,28 +2569,28 @@ parent = NULL; } } - + if( parent != NULL ) { TRAP( error, usedParents.AppendL( parent ) ); - + if( aDrmCommon->GetDetailedContentRights(parent->Des(), parents) == KErrNone ) { for( TInt j = parents->Count()-1; j >= 0;j-- ) - { + { TRAP( error, aRights.AppendL( (*parents)[j] ) ); (*parents)[j] = NULL; parents->Remove(j); } - parents->ResetAndDestroy(); + parents->ResetAndDestroy(); delete parents; - parents = NULL; + parents = NULL; } - + } } usedParents.Reset(); - usedParents.Close(); + usedParents.Close(); } // ----------------------------------------------------------------------------- diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/notifier/inc/DRMNotifierClient.h --- a/omadrm/drmengine/notifier/inc/DRMNotifierClient.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/notifier/inc/DRMNotifierClient.h Mon Mar 15 12:41:43 2010 +0200 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: This class handles communications between a notifier client & +* Description: This class handles communications between a notifier client & * DRM server in DRM notifier. * */ @@ -22,7 +22,7 @@ #define RDRMNOTIFIERCLIENT_H // INCLUDES -#include +#include #include // CONSTANTS @@ -36,7 +36,7 @@ /** * This class handles all client/server communications. -* +* * @lib DRMCommon.dll * @since S60Rel2.6 */ @@ -46,16 +46,16 @@ /** * C++ default constructor. */ - RDRMNotifierClient(TDRMEventType* aEventType, TDRMEventType* aEventTypeWait, + RDRMNotifierClient(TDRMEventType* aEventType, TDRMEventType* aEventTypeWait, TPtr8* aPtr, TPtr8* aWaitPtr); - + /** * Destructor. */ virtual ~RDRMNotifierClient(); - + public: // New functions - + /** * This method opens a connection to the server. * @since S60Rel2.6 @@ -72,7 +72,7 @@ * @since S60Rel2.6 * @param aStatus the status will be updated when the a notification * has been received - * @return none + * @return none */ void WaitForCompletion( TRequestStatus& aStatus ); @@ -86,7 +86,7 @@ * @since S60Rel2.6 * @param aStatus the status will be updated when all notifications have * been forwarded - * @return none + * @return none */ void SendEvent( TRequestStatus& aStatus ); @@ -100,7 +100,7 @@ * @since S60Rel2.6 * @param aEventType the event type to listen to * @param aURI optional URI to limit the C/S communication - * @return none + * @return none */ void RegisterForType( TDRMEventType aEventType, HBufC8* aURI = 0 ); @@ -108,14 +108,14 @@ /** * UnRegisterFromType * - * Unregister from the server from listening to specific event types, - * if a URI is provided notifications of the type that have that URI + * Unregister from the server from listening to specific event types, + * if a URI is provided notifications of the type that have that URI * as affected URI will get unregistered * * @since S60Rel2.6 * @param aEventType the event type to listen to * @param aURI optional URI to limit the C/S communication - * @return none + * @return none */ void UnRegisterFromType( TDRMEventType aEventType, HBufC8* aURI = 0 ); @@ -131,13 +131,13 @@ */ void CancelRequest(); - + public: // Functions from base classes - void Close(); + void Close(); protected: // New functions - + protected: // Functions from base classes - + private: // Prohibit copy constructor @@ -153,12 +153,12 @@ TPtr8* iData; TPtr8* iWaitData; TPckg numdata; - + public: // Friend classes protected: // Friend classes private: // Friend classes }; #endif // RDRMNOTIFIERCLIENT_H - + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/notifier/src/DRMNotifierClient.cpp --- a/omadrm/drmengine/notifier/src/DRMNotifierClient.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/notifier/src/DRMNotifierClient.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -20,9 +20,9 @@ // INCLUDE FILES #include "DRMNotifierClient.h" #include "drmnotifierclientserver.h" -#include "drmrightsclient.h" +#include "DRMRightsClient.h" // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS // MACROS // LOCAL CONSTANTS AND MACROS @@ -38,7 +38,7 @@ // might leave. // ----------------------------------------------------------------------------- // -RDRMNotifierClient::RDRMNotifierClient(TDRMEventType* aEventType, TDRMEventType* aEventTypeWait, +RDRMNotifierClient::RDRMNotifierClient(TDRMEventType* aEventType, TDRMEventType* aEventTypeWait, TPtr8* aPtr, TPtr8* aWaitPtr) : iEventType( aEventType ), iEventTypeWait( aEventTypeWait ), @@ -48,7 +48,7 @@ { // Nothing } - + // Destructor RDRMNotifierClient::~RDRMNotifierClient() { @@ -64,15 +64,15 @@ // TInt RDRMNotifierClient::Connect( void ) { - const TVersion requiredVersion( + const TVersion requiredVersion( DRMNotifier::KServerMajorVersion, DRMNotifier::KServerMinorVersion, DRMNotifier::KServerBuildVersion ); - + TInt ret = KErrNotFound; TUint8 count( 0 ); TUint8 cont( 1 ); - + do { ret = CreateSession( DRMNotifier::KServerName, @@ -91,7 +91,7 @@ } } while ( cont && ( count < 2 ) ); - + return ret; } @@ -101,7 +101,7 @@ // (other items were commented in a header). // ----------------------------------------------------------------------------- // -void RDRMNotifierClient::Close() +void RDRMNotifierClient::Close() { RHandleBase::Close(); } @@ -113,11 +113,11 @@ // (other items were commented in a header). // ----------------------------------------------------------------------------- // -void RDRMNotifierClient::SendEvent(TRequestStatus& aStatus) +void RDRMNotifierClient::SendEvent(TRequestStatus& aStatus) { // Send the message. SendReceive( DRMNotifier::ENotifyClients, TIpcArgs(iData, *iEventType), - aStatus ); + aStatus ); }; // ----------------------------------------------------------------------------- @@ -126,13 +126,13 @@ // (other items were commented in a header). // ----------------------------------------------------------------------------- // -void RDRMNotifierClient::WaitForCompletion(TRequestStatus& aStatus) - { +void RDRMNotifierClient::WaitForCompletion(TRequestStatus& aStatus) + { numdata.Set(reinterpret_cast(iEventTypeWait),sizeof(TDRMEventType),sizeof(TDRMEventType)); - + // Send the message. SendReceive( DRMNotifier::ERecieveNotification, TIpcArgs(iWaitData, &numdata), - aStatus ); + aStatus ); }; // ----------------------------------------------------------------------------- @@ -141,7 +141,7 @@ // (other items were commented in a header). // ----------------------------------------------------------------------------- // -void RDRMNotifierClient::RegisterForType( TDRMEventType aEventType, +void RDRMNotifierClient::RegisterForType( TDRMEventType aEventType, HBufC8* aURI ) { TPckg eventType(0); @@ -155,7 +155,7 @@ // Send the message. SendReceive( DRMNotifier::ERegisterURI, TIpcArgs(&uriPkg, &eventType)); } - else + else { // Send the message. SendReceive( DRMNotifier::ERegister, TIpcArgs(&eventType)); @@ -168,7 +168,7 @@ // (other items were commented in a header). // ----------------------------------------------------------------------------- // -void RDRMNotifierClient::UnRegisterFromType( TDRMEventType aEventType, +void RDRMNotifierClient::UnRegisterFromType( TDRMEventType aEventType, HBufC8* aURI) { TPckg eventType(0); @@ -182,7 +182,7 @@ // Send the message. SendReceive( DRMNotifier::EUnRegisterURI, TIpcArgs(&uriPkg, &eventType)); } - else + else { // Send the message. SendReceive( DRMNotifier::EUnRegister, TIpcArgs(&eventType)); @@ -202,4 +202,4 @@ SendReceive( DRMNotifier::ECancelNotification); }; -// End of File +// End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/notifier/src/DRMNotifierSession.cpp --- a/omadrm/drmengine/notifier/src/DRMNotifierSession.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/notifier/src/DRMNotifierSession.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,7 +19,7 @@ // INCLUDE FILES #include #include -#include "drmcommon.h" +#include "DRMCommon.h" #include "DRMNotifierSession.h" #include "DRMNotifierServer.h" #include "drmnotifierclientserver.h" @@ -29,7 +29,7 @@ using namespace DRMNotifier; // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS @@ -70,7 +70,7 @@ // Two-phased constructor. // ----------------------------------------------------------------------------- // -CDRMNotifierSession* CDRMNotifierSession::NewL( CDRMMessageStorage* aStorage) +CDRMNotifierSession* CDRMNotifierSession::NewL( CDRMMessageStorage* aStorage) { CDRMNotifierSession* self = new( ELeave ) CDRMNotifierSession( aStorage ); CleanupStack::PushL( self ); @@ -102,7 +102,7 @@ for( i = 0; i < iMessageQueue.Count(); i++ ) { if( this->iStorage ) // coverity check - { + { iStorage->UpdateMessage(iMessageQueue[i]); } } @@ -159,9 +159,9 @@ { LOG( _L8( "ServiceL called" ) ); // Trap possible errors... - + TRAPD( error, DispatchL( aMessage ) ); - + if ( error ) { LOG( _L8( "DispatcL threw an exception" ) ); @@ -179,7 +179,7 @@ // Default constructor. // ----------------------------------------------------------------------------- // -CDRMNotifierSession::CDRMNotifierSession( CDRMMessageStorage* aStorage ) : +CDRMNotifierSession::CDRMNotifierSession( CDRMMessageStorage* aStorage ) : // Base class' constructor is called first. iStorage( aStorage ) { @@ -197,16 +197,16 @@ // ----------------------------------------------------------------------------- // CDRMNotifierSession::DispatchL -// Checks which command the user requested, and forwards the request to +// Checks which command the user requested, and forwards the request to // appropriate private method. This helps to keep the code more readable. // ----------------------------------------------------------------------------- // -void CDRMNotifierSession::DispatchL( const RMessage2& aMessage ) +void CDRMNotifierSession::DispatchL( const RMessage2& aMessage ) { #ifdef _DEBUG - RDebug::Printf(">>> [%s] %d", _S8(__PRETTY_FUNCTION__), aMessage.Function()); + RDebug::Printf(">>> [%s] %d", _S8(__PRETTY_FUNCTION__), aMessage.Function()); #endif - + switch ( aMessage.Function() ) { case ENotifyClients: @@ -283,7 +283,7 @@ { NotifyL( iMessageQueue[0], ETrue ); } - + // Message complete will be set elsewhere. // All done. } @@ -324,18 +324,18 @@ iIsInStorage = EFalse; - iIsListening = EFalse; - - if ( !iListener.IsNull() ) - { - iListener.Complete( KErrCancel ); - } - + iIsListening = EFalse; + + if ( !iListener.IsNull() ) + { + iListener.Complete( KErrCancel ); + } + aMessage.Complete( KErrNone ); } // ----------------------------------------------------------------------------- // CDRMNotifierSession::RegisterURIL -// Get the information from the client, construct a rights object, and add +// Get the information from the client, construct a rights object, and add // it to the database. // ----------------------------------------------------------------------------- // @@ -361,7 +361,7 @@ // ----------------------------------------------------------------------------- // CDRMNotifierSession::UnRegisterURIL -// Get the information from the client, construct a rights object, and add +// Get the information from the client, construct a rights object, and add // it to the database. // ----------------------------------------------------------------------------- // @@ -487,7 +487,7 @@ TPtr8 data( reinterpret_cast(&aMessage->iEventType), sizeof(TDRMEventType), sizeof(TDRMEventType)); - TPtr8 event( aMessage->iMessageData, DRMNotifier::KDRMSizeOfMessage, + TPtr8 event( aMessage->iMessageData, DRMNotifier::KDRMSizeOfMessage, DRMNotifier::KDRMSizeOfMessage ); iListener.WriteL(0, event); @@ -524,4 +524,4 @@ } // ========================== OTHER EXPORTED FUNCTIONS ========================= -// End of File +// End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/ro/inc/DRMProtectedRoParser.h --- a/omadrm/drmengine/ro/inc/DRMProtectedRoParser.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/ro/inc/DRMProtectedRoParser.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,11 +22,11 @@ // INCLUDES #include -#include -#include -#include -#include -#include "DrmRightsClient.h" +#include +#include +#include +#include +#include "DRMRightsClient.h" using namespace Xml; @@ -52,24 +52,24 @@ EXmlParser, EWbxmlParser }; - + static const TInt KMaxElementCount = 40; static const TInt KMaxElementNesting = 16; - + public: // Constructors and destructor - + /** * Two-phased constructor. */ IMPORT_C static CDrmProtectedRoParser* NewL(); - + /** * Destructor. */ IMPORT_C ~CDrmProtectedRoParser(); public: // New functions - + /** * ?member_description. * @since Series ?XX ?SeriesXX_version @@ -83,7 +83,7 @@ IMPORT_C void ParseAndStoreL( const TDesC8& aProtectedRo, RPointerArray& aResultRights); - + IMPORT_C HBufC8* GetRiUrlL( const TDesC8& aProtectedRo); @@ -99,7 +99,7 @@ * From ?base_class ?member_description. * @param aDocParam Specifies the various parameters of the document. * @arg aDocParam.iCharacterSetName The character encoding of the document. - * @param aErrorCode is the error code. + * @param aErrorCode is the error code. * If this is not KErrNone then special action may be required. */ void OnStartDocumentL( @@ -108,7 +108,7 @@ /** * From ?base_class ?member_description. - * @param aErrorCode is the error code. + * @param aErrorCode is the error code. * If this is not KErrNone then special action may be required. */ void OnEndDocumentL( @@ -123,8 +123,8 @@ */ void OnStartElementL( const RTagInfo& aElement, - const RAttributeArray& aAttributes, - TInt aErrorCode); + const RAttributeArray& aAttributes, + TInt aErrorCode); /** * From ?base_class ?member_description. @@ -138,8 +138,8 @@ /** * From ?base_class ?member_description. - * @param aBytes is the raw content data for the element. - * The client is responsible for converting the data to the + * @param aBytes is the raw content data for the element. + * The client is responsible for converting the data to the * required character set if necessary. * In some instances the content may be binary and must not be converted. * @param aErrorCode is the error code. @@ -158,8 +158,8 @@ */ void OnStartPrefixMappingL( const RString& aPrefix, - const RString& aUri, - TInt aErrorCode); + const RString& aUri, + TInt aErrorCode); /** * From ?base_class ?member_description. @@ -200,8 +200,8 @@ */ void OnProcessingInstructionL( const TDesC8& aTarget, - const TDesC8& aData, - TInt aErrorCode); + const TDesC8& aData, + TInt aErrorCode); /** * From ?base_class ?member_description. @@ -218,7 +218,7 @@ /** * From ?base_class ?member_description. - * @return 0 if no interface matching the uid is found. + * @return 0 if no interface matching the uid is found. Otherwise, the this pointer cast to that interface. * @param aUid the uid identifying the required interface. */ @@ -226,7 +226,7 @@ const TInt32 aUid); protected: // New functions - + /** * ?member_description. * @since Series ?XX ?SeriesXX_version @@ -260,7 +260,7 @@ const TDesC8& aData, TInt& aStart, TInt& aEnd); - + /** * Handle a parsed domain RO which could not be added to the rights DB * because the device is not part of the domain. @@ -272,13 +272,13 @@ const TDesC8& aContentId, const TDesC8& aDomainRoData, CParsedProtectedRo* aDomainRo); - + /** * Adds ROAP namespace URI to aProtectedRo if not already present * @since Series 60 3.0 * @param aProtectedRo protected RO element * @return protected RO element, if namespace was not added NULL - */ + */ HBufC8* CDrmProtectedRoParser::AddRoapNamespaceL( TDesC8& aProtectedRo ) const; @@ -294,24 +294,24 @@ private: // Data // The XML parser CParser* iParser; - + // Result of parsing the protected RO element CParsedProtectedRo* iRights; - + // Expected element names RString iElements[KMaxElementCount]; - + // Parsing stack TInt iElementStack[KMaxElementNesting]; - + // Depth of the parsing stack TInt iElementStackDepth; - + // Content between elements HBufC8* iContent; }; -#endif // DRMPROTECTEDROPARSER_H - +#endif // DRMPROTECTEDROPARSER_H + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/ro/inc/DrmRel1_0StringDict00.h --- a/omadrm/drmengine/ro/inc/DrmRel1_0StringDict00.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/ro/inc/DrmRel1_0StringDict00.h Mon Mar 15 12:41:43 2010 +0200 @@ -24,50 +24,50 @@ #include #include -#include +#include class CDrmRel1_0StringDict00 : public CBase, public Xml::MStringDictionary /** -The DrmRel1_0StringDict00 class is a derived class defining the API of a single string dictionary. +The DrmRel1_0StringDict00 class is a derived class defining the API of a single string dictionary. Derived classes must add all elements, attributes names, and attribute values that belong -to this string dictionary as static string tables to the StringPool. WBXML token mappings between +to this string dictionary as static string tables to the StringPool. WBXML token mappings between strings and WBXML tokens should also be maintained. @internalTechnology @interim This is the first drop of this component. */ - { + { public: - static Xml::MStringDictionary* NewL(TAny* aStringPool); - virtual ~CDrmRel1_0StringDict00(); - void ConstructL(); + static Xml::MStringDictionary* NewL(TAny* aStringPool); + virtual ~CDrmRel1_0StringDict00(); + void ConstructL(); - void ElementL(TInt aToken, RString& aElement) const; - void AttributeL(TInt aToken, RString& aAttribute) const; - void AttributeValuePairL(TInt aToken, RString& aAttribute, RString& aValue) const; - void AttributeValueL(TInt aToken, RString& aValue) const; + void ElementL(TInt aToken, RString& aElement) const; + void AttributeL(TInt aToken, RString& aAttribute) const; + void AttributeValuePairL(TInt aToken, RString& aAttribute, RString& aValue) const; + void AttributeValueL(TInt aToken, RString& aValue) const; - TBool CompareThisDictionary(const RString& aDictionaryDescription) const; + TBool CompareThisDictionary(const RString& aDictionaryDescription) const; - TInt SwitchCodePage(TInt aCodePage); - void PublicIdentifier(RString& aPubId); - void NamespaceUri(RString& aUri); + TInt SwitchCodePage(TInt aCodePage); + void PublicIdentifier(RString& aPubId); + void NamespaceUri(RString& aUri); - void Release(); + void Release(); public: - // CodePage tokens. - // - // Note: There will be correlation between these token values and their - // strings via the CDictionaryCodePage using the RStringPool. + // CodePage tokens. + // + // Note: There will be correlation between these token values and their + // strings via the CDictionaryCodePage using the RStringPool. - enum TTagToken + enum TTagToken { - // CodePage 00 - // -//OMA//DTD DRMREL 1.0//EN + // CodePage 00 + // -//OMA//DTD DRMREL 1.0//EN ERights = 0x05, EContext = 0x06, EVersion = 0x07, @@ -87,37 +87,37 @@ EStart = 0x15, EEnd = 0x16, EInterval = 0x17 - }; + }; - enum TAttributeToken + enum TAttributeToken { - // CodePage 00 - // -//OMA//DTD DRMREL 1.0//EN + // CodePage 00 + // -//OMA//DTD DRMREL 1.0//EN EXmlnsOEx = 0x05, EXmlnsODd = 0x06, EXmlnsDs = 0x07 - }; + }; - enum TAttributeValueToken + enum TAttributeValueToken { - // CodePage 00 - // -//OMA//DTD DRMREL 1.0//EN + // CodePage 00 + // -//OMA//DTD DRMREL 1.0//EN EValueXmlnsOEx = 0x05, EValueXmlnsODd = 0x06, EValueXmlnsDs = 0x07, EOdrlEx = 0x85, EOdrlDd = 0x86, EXmlDsig = 0x87 - }; + }; private: - CDrmRel1_0StringDict00(RStringPool* aStringPool); + CDrmRel1_0StringDict00(RStringPool* aStringPool); private: @@ -125,17 +125,17 @@ The StringPool for this string dictionary. We don't own this. */ - RStringPool iStringPool; + RStringPool iStringPool; - Xml::CDictionaryCodePage* iCodepage00Table; + Xml::CDictionaryCodePage* iCodepage00Table; - TInt iCodePage; + TInt iCodePage; - }; + }; -const TInt iTagCodePage00[] = - { +const TInt iTagCodePage00[] = + { CDrmRel1_0StringDict00::ERights, CDrmRel1_0StringDict00::EContext, CDrmRel1_0StringDict00::EVersion, @@ -155,30 +155,30 @@ CDrmRel1_0StringDict00::EStart, CDrmRel1_0StringDict00::EEnd, CDrmRel1_0StringDict00::EInterval, - 0 // ok to end with zero as this is used by a global token - }; + 0 // ok to end with zero as this is used by a global token + }; -const TInt iAttributeCodePage00[] = - { +const TInt iAttributeCodePage00[] = + { CDrmRel1_0StringDict00::EXmlnsOEx, CDrmRel1_0StringDict00::EXmlnsODd, CDrmRel1_0StringDict00::EXmlnsDs, - 0 // ok to end with zero as this is used by a global token + 0 // ok to end with zero as this is used by a global token }; -const TInt iAttributeValueCodePage00[] = - { +const TInt iAttributeValueCodePage00[] = + { CDrmRel1_0StringDict00::EXmlnsOEx, CDrmRel1_0StringDict00::EXmlnsODd, CDrmRel1_0StringDict00::EXmlnsDs, CDrmRel1_0StringDict00::EOdrlEx, CDrmRel1_0StringDict00::EOdrlDd, CDrmRel1_0StringDict00::EXmlDsig, - 0 // ok to end with zero as this is used by a global token - }; + 0 // ok to end with zero as this is used by a global token + }; #endif //__SISTRINGDICT00_H__ diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/ro/inc/DrmRel1_0StringDict00AttributeTable.h --- a/omadrm/drmengine/ro/inc/DrmRel1_0StringDict00AttributeTable.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/ro/inc/DrmRel1_0StringDict00AttributeTable.h Mon Mar 15 12:41:43 2010 +0200 @@ -21,27 +21,27 @@ #ifndef STRINGTABLE_DrmRel1_0StringDict00AttributeTable #define STRINGTABLE_DrmRel1_0StringDict00AttributeTable -#include "StringPool.h" +#include "stringpool.h" struct TStringTable; /** A String table */ -class DrmRel1_0StringDict00AttributeTable - { +class DrmRel1_0StringDict00AttributeTable + { public: - enum TStrings - { - // Element names - // CodePage 00 - /** xmlns:o-ex */ - EXmlnsOEx, - /** xmlns:o-dd */ - EXmlnsODd, - /** xmlns:ds */ - EXmlnsDs - }; - static const TStringTable Table; - }; + enum TStrings + { + // Element names + // CodePage 00 + /** xmlns:o-ex */ + EXmlnsOEx, + /** xmlns:o-dd */ + EXmlnsODd, + /** xmlns:ds */ + EXmlnsDs + }; + static const TStringTable Table; + }; #endif // STRINGTABLE_DrmRel1_0StringDict00AttributeTable diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/ro/inc/DrmRel1_0StringDict00AttributeValueTable.h --- a/omadrm/drmengine/ro/inc/DrmRel1_0StringDict00AttributeValueTable.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/ro/inc/DrmRel1_0StringDict00AttributeValueTable.h Mon Mar 15 12:41:43 2010 +0200 @@ -21,31 +21,31 @@ #ifndef STRINGTABLE_DrmRel1_0StringDict00AttributeValueTable #define STRINGTABLE_DrmRel1_0StringDict00AttributeValueTable -#include "StringPool.h" +#include "stringpool.h" struct TStringTable; /** A String table */ -class DrmRel1_0StringDict00AttributeValueTable - { +class DrmRel1_0StringDict00AttributeValueTable + { public: - enum TStrings - { - /** */ - EXmlnsOEx, - /** */ - EXmlnsODd, - /** */ - EXmlnsDs, - /** http://odrl.net/1.1/ODRL-EX */ - EOdrlEx, - /** http://odrl.net/1.1/ODRL-DD */ - EOdrlDd, - /** http://www.w3.org/2000/09/xmldsig/ */ - EXmlDsig - }; - static const TStringTable Table; - }; + enum TStrings + { + /** */ + EXmlnsOEx, + /** */ + EXmlnsODd, + /** */ + EXmlnsDs, + /** http://odrl.net/1.1/ODRL-EX */ + EOdrlEx, + /** http://odrl.net/1.1/ODRL-DD */ + EOdrlDd, + /** http://www.w3.org/2000/09/xmldsig/ */ + EXmlDsig + }; + static const TStringTable Table; + }; #endif // STRINGTABLE_DrmRel1_0StringDict00AttributeValueTable diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/ro/inc/DrmRel1_0StringDict00TagTable.h --- a/omadrm/drmengine/ro/inc/DrmRel1_0StringDict00TagTable.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/ro/inc/DrmRel1_0StringDict00TagTable.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,65 +22,65 @@ #ifndef STRINGTABLE_DrmRel1_0StringDict00TagTable #define STRINGTABLE_DrmRel1_0StringDict00TagTable -#include "StringPool.h" +#include "stringpool.h" struct TStringTable; /** A String table */ -class DrmRel1_0StringDict00TagTable - { +class DrmRel1_0StringDict00TagTable + { public: - enum TStrings - { - // Element names - // CodePage 00 - /** rights */ - ERights, - /** context */ - EContext, - /** version */ - EVersion, - /** uid */ - EUid, - /** agreement */ - EAgreement, - /** asset */ - EAsset, - /** KeyInfo */ - EKeyInfo, - /** KeyValue */ - EKeyValue, - /** permission */ - EPermission, - /** play */ - EPlay, - /** display */ - EDisplay, - /** execute */ - EExecute, - /** print */ - EPrint, - /** constraint */ - EConstraint, - /** count */ - ECount, - /** datetime */ - EDateTime, - /** start */ - EStart, - /** end */ - EEnd, - /** interval */ - EInterval, - /** -//OMA//DTD DRMREL 1.0//EN */ - EUri, - /** 14~0 */ - EPublicId, - /** -//OMA//DTD DRMREL 1.0//EN~0 */ - EFormalPublicId - }; - static const TStringTable Table; - }; + enum TStrings + { + // Element names + // CodePage 00 + /** rights */ + ERights, + /** context */ + EContext, + /** version */ + EVersion, + /** uid */ + EUid, + /** agreement */ + EAgreement, + /** asset */ + EAsset, + /** KeyInfo */ + EKeyInfo, + /** KeyValue */ + EKeyValue, + /** permission */ + EPermission, + /** play */ + EPlay, + /** display */ + EDisplay, + /** execute */ + EExecute, + /** print */ + EPrint, + /** constraint */ + EConstraint, + /** count */ + ECount, + /** datetime */ + EDateTime, + /** start */ + EStart, + /** end */ + EEnd, + /** interval */ + EInterval, + /** -//OMA//DTD DRMREL 1.0//EN */ + EUri, + /** 14~0 */ + EPublicId, + /** -//OMA//DTD DRMREL 1.0//EN~0 */ + EFormalPublicId + }; + static const TStringTable Table; + }; #endif // STRINGTABLE_DrmRel1_0StringDict00TagTable diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/ro/inc/DrmRightsParser.h --- a/omadrm/drmengine/ro/inc/DrmRightsParser.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/ro/inc/DrmRightsParser.h Mon Mar 15 12:41:43 2010 +0200 @@ -20,9 +20,9 @@ #define DRMRIGHTSPARSER_H // INCLUDES -#include -#include -#include +#include +#include +#include using namespace Xml; @@ -50,7 +50,7 @@ EXmlParser, EWbxmlParser }; - + enum TSoftwareSchemaType { ESymbianSid, @@ -61,7 +61,7 @@ static const TInt KMaxElementNesting = 16; public: // Constructors and destructor - + /** * Create a parser object * @since Series 60 3.0 @@ -70,14 +70,14 @@ */ IMPORT_C static CDrmRightsParser* NewL( TParserType aType = EXmlParser); - + /** * Destructor. */ IMPORT_C ~CDrmRightsParser(); public: // New functions - + /** * Parse one rights object * @since Series 60 3.0 @@ -104,7 +104,7 @@ * From MContentHandler * @param aDocParam Specifies the various parameters of the document. * @arg aDocParam.iCharacterSetName The character encoding of the document. - * @param aErrorCode is the error code. + * @param aErrorCode is the error code. * If this is not KErrNone then special action may be required. */ void OnStartDocumentL( @@ -113,7 +113,7 @@ /** * From MContentHandler - * @param aErrorCode is the error code. + * @param aErrorCode is the error code. * If this is not KErrNone then special action may be required. */ void OnEndDocumentL( @@ -128,8 +128,8 @@ */ void OnStartElementL( const RTagInfo& aElement, - const RAttributeArray& aAttributes, - TInt aErrorCode); + const RAttributeArray& aAttributes, + TInt aErrorCode); /** * From MContentHandler @@ -143,8 +143,8 @@ /** * From MContentHandler - * @param aBytes is the raw content data for the element. - * The client is responsible for converting the data to the + * @param aBytes is the raw content data for the element. + * The client is responsible for converting the data to the * required character set if necessary. * In some instances the content may be binary and must not be converted. * @param aErrorCode is the error code. @@ -163,8 +163,8 @@ */ void OnStartPrefixMappingL( const RString& aPrefix, - const RString& aUri, - TInt aErrorCode); + const RString& aUri, + TInt aErrorCode); /** * From MContentHandler @@ -205,8 +205,8 @@ */ void OnProcessingInstructionL( const TDesC8& aTarget, - const TDesC8& aData, - TInt aErrorCode); + const TDesC8& aData, + TInt aErrorCode); /** * From MContentHandler @@ -232,7 +232,7 @@ const TInt32 aUid); protected: // New functions - + /** * Match the state of the current stack to the predefined states * @since Series 60 3.0 @@ -248,7 +248,7 @@ */ void TransformRightsObjectL( RPointerArray& aResult); - + /** * Return the value of an attribute as a buffer * @since Series 60 3.0 @@ -275,10 +275,10 @@ * Parse the time string and return the TTime */ TTime ParseRelTimeL(TDesC8& aRelTimeString); - + /** * Parse the interval string and return the interval - */ + */ TTimeIntervalSeconds ParseRelInterval(TDesC8& aRelTimeString); @@ -298,25 +298,25 @@ protected: // Data // XML Parser CParser* iParser; - + // Parsed rigths object CParsedRightsObject* iRights; - + // Predefined XML element names RString iElements[KMaxElementCount]; - + // Current parsing stack TInt iElementStack[KMaxElementNesting]; - + // Depth of the current parsing stack TInt iElementStackDepth; - + // Content between elements HBufC8* iContent; - + // Determines if the input is XML or WBXML TParserType iParserType; - + // Determines what kind of software constraint the RO contains TSoftwareSchemaType iSoftwareSchemeType; @@ -327,6 +327,6 @@ HBufC8* iUnknownTag; }; -#endif // DRMRIGHTSPARSER_H - +#endif // DRMRIGHTSPARSER_H + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/ro/src/DRMConstraint.cpp --- a/omadrm/drmengine/ro/src/DRMConstraint.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/ro/src/DRMConstraint.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,18 +19,18 @@ // INCLUDE FILES #include #include -#include "DRMConstraint.h" +#include "DrmConstraint.h" // CONSTANTS // Synchronizing marker in the beginning of the stream in order to synchronize -// to an externalized Constraint object having the new structure. +// to an externalized Constraint object having the new structure. const TInt32 KSyncMark = 0xAFCE; // Old and new version number of the Constraint object const TInt8 KVersion3_2_0 = 0; -const TInt8 KVersion3_2_1 = 1; - +const TInt8 KVersion3_2_1 = 1; + const TInt KSanityDataLengthLow = 0; const TInt KSanityDataLengthHigh = 32768; @@ -55,17 +55,17 @@ // Appends the strings of array aFrom to array aTo // ----------------------------------------------------------------------------- // -LOCAL_C void AppendToArrayL( RPointerArray& aTo, +LOCAL_C void AppendToArrayL( RPointerArray& aTo, const RPointerArray& aFrom ) { HBufC8* addData = NULL; - + for( TInt i = 0; i < aFrom.Count(); i++ ) { addData = aFrom[i]->AllocLC(); aTo.AppendL( addData ); - CleanupStack::Pop( addData ); - } + CleanupStack::Pop( addData ); + } } // ----------------------------------------------------------------------------- @@ -76,13 +76,13 @@ LOCAL_C TInt CountArrayStoreSize( const RPointerArray& aArray ) { TInt size = 0; - + for(TInt i = 0; i < aArray.Count(); i++ ) { size += sizeof(TInt); size += aArray[i]->Size(); } - return size; + return size; } // ----------------------------------------------------------------------------- // WriteArrayToStreamL @@ -98,12 +98,12 @@ aStream.WriteL( aArray[i]->Des() ); } } - + // ----------------------------------------------------------------------------- // ReadArrayFromStringL // Reads the array from the string // ----------------------------------------------------------------------------- -// +// LOCAL_C void ReadArrayFromStringL( const TDesC8& aString, RPointerArray& aArray ) { @@ -112,29 +112,29 @@ HBufC8* addData = NULL; TPtr8 dataBuffer(NULL,0,0); CleanupClosePushL( inRead ); - - + + aArray.ResetAndDestroy(); - - + + for( TInt i = 0; i < aString.Size();) { - // If there is not enough data to read the integer + // If there is not enough data to read the integer // it means that it's an old version and the whole thing is the - // string since in previous versions only one string is stored + // string since in previous versions only one string is stored if(( aString.Size() - i) < sizeof(TInt) ) { aArray.ResetAndDestroy(); addData = aString.AllocLC(); aArray.AppendL( addData ); CleanupStack::Pop(); - CleanupStack::PopAndDestroy(); // inRead - return; + CleanupStack::PopAndDestroy(); // inRead + return; } - + size = inRead.ReadInt32L(); i += sizeof(TInt); - + // If the size is negative or the size left is not large enough // it means that it's an old version and the whole thing is the // string since in previous versions only one string is stored. @@ -144,35 +144,35 @@ addData = aString.AllocLC(); aArray.AppendL( addData ); CleanupStack::Pop(); - CleanupStack::PopAndDestroy(); // inRead + CleanupStack::PopAndDestroy(); // inRead return; } - addData = HBufC8::NewMaxLC( size ); + addData = HBufC8::NewMaxLC( size ); // Set the read buffer: dataBuffer.Set(const_cast(addData->Ptr()), 0, size); - + // Read the data: inRead.ReadL( dataBuffer ); - + aArray.AppendL( addData ); CleanupStack::Pop( addData ); i += size; } - CleanupStack::PopAndDestroy(); + CleanupStack::PopAndDestroy(); return; } - + // ----------------------------------------------------------------------------- // IsIndividualConstraintValid // ----------------------------------------------------------------------------- // -LOCAL_C TBool IsIndividualConstraintValid( const RPointerArray& aConstraint, +LOCAL_C TBool IsIndividualConstraintValid( const RPointerArray& aConstraint, const RPointerArray& aValidConstraints) { TInt retVal = 0; - + for( TInt i = 0; i < aConstraint.Count(); i++ ) { for( TInt j = 0; j < aValidConstraints.Count(); j++ ) @@ -184,7 +184,7 @@ } } } - return EFalse; + return EFalse; }; // ============================ MEMBER FUNCTIONS =============================== @@ -200,8 +200,8 @@ CDRMConstraint* self = new( ELeave ) CDRMConstraint(); CleanupStack::PushL( self ); self->ConstructL(); - - return self; + + return self; }; // ----------------------------------------------------------------------------- @@ -213,9 +213,9 @@ { CDRMConstraint* self = NewLC(); CleanupStack::Pop(); - + return self; - }; + }; // ----------------------------------------------------------------------------- // Default Constructor - First phase. @@ -224,8 +224,8 @@ // EXPORT_C CDRMConstraint::CDRMConstraint() : iSyncMark( KSyncMark ), - iVersion( KVersion3_2_1 ), // Version number for differentiation - // in InternalizeL. + iVersion( KVersion3_2_1 ), // Version number for differentiation + // in InternalizeL. iStartTime( Time::NullTTime() ), iEndTime( Time::NullTTime() ), iIntervalStart( Time::NullTTime() ), @@ -233,38 +233,38 @@ iCounter( 0 ), iOriginalCounter( 0 ), iTimedCounter( 0 ), - iTimedInterval( 0 ), - iAccumulatedTime( 0 ), - iVendorId( TUid::Null() ), - iSecureId( TUid::Null() ), + iTimedInterval( 0 ), + iAccumulatedTime( 0 ), + iVendorId( TUid::Null() ), + iSecureId( TUid::Null() ), iActiveConstraints( 0 ), iDrmMeteringInfo( NULL ), - iOriginalTimedCounter( 0 ) + iOriginalTimedCounter( 0 ) { } - + // ----------------------------------------------------------------------------- // Destructor // ----------------------------------------------------------------------------- -// +// EXPORT_C CDRMConstraint::~CDRMConstraint() { iIndividual.ResetAndDestroy(); iIndividual.Close(); - + iSystem.ResetAndDestroy(); - iSystem.Close(); - -#ifdef RD_DRM_METERING + iSystem.Close(); + +#ifdef RD_DRM_METERING if( iDrmMeteringInfo ) { delete iDrmMeteringInfo; iDrmMeteringInfo = NULL; } #endif - - }; + + }; // ----------------------------------------------------------------------------- // CDRMConstraint::ExternalizeL @@ -272,43 +272,43 @@ // EXPORT_C void CDRMConstraint::ExternalizeL( RWriteStream& aStream ) const { - + // used for the buffers TInt32 dataLength = 0; - + // write the synchronizing marker aStream.WriteInt32L( iSyncMark ); - + // Write the version number aStream.WriteInt32L( iVersion ); - + // Write the start time WriteInt64L( iStartTime.Int64(), aStream ); - + // Write the end time WriteInt64L( iEndTime.Int64(), aStream ); - + // Write the interval start time - WriteInt64L( iIntervalStart.Int64(), aStream ); - - // Write the interval + WriteInt64L( iIntervalStart.Int64(), aStream ); + + // Write the interval aStream.WriteInt32L( iInterval.Int() ); - + // Write the counter aStream.WriteInt32L( iCounter ); - + // Write the original counter aStream.WriteInt32L( iOriginalCounter ); - + // Write the timed counter aStream.WriteInt32L( iTimedCounter ); // Write the timed interval aStream.WriteInt32L( iTimedInterval.Int() ); - + // Write the accumulated time aStream.WriteInt32L( iAccumulatedTime.Int() ); - + // Write the individual dataLength = 0; if ( iIndividual.Count() ) @@ -319,58 +319,58 @@ if ( dataLength ) { - WriteArrayToStreamL( aStream, iIndividual ); - } - + WriteArrayToStreamL( aStream, iIndividual ); + } + // Software Vendor Id aStream.WriteInt32L( iVendorId.iUid ); - + // Secure Id of the allowed application aStream.WriteInt32L( iSecureId.iUid ); - + // Active constraints aStream.WriteUint32L( iActiveConstraints ); - + // Metering info -#ifdef RD_DRM_METERING +#ifdef RD_DRM_METERING dataLength = 0; if ( iDrmMeteringInfo ) { dataLength = sizeof( TTimeIntervalSeconds ) + sizeof( TUint8 ); } - + aStream.WriteInt32L( dataLength ); - + if ( dataLength ) { aStream.WriteInt32L( iDrmMeteringInfo->iGraceTime.Int() ); aStream.WriteInt8L( iDrmMeteringInfo->iAllowUseWithoutMetering ); } - + #endif - + // Write the system dataLength = 0; if ( iSystem.Count() ) { dataLength = CountArrayStoreSize( iSystem ); } - + aStream.WriteInt32L( dataLength ); - + if ( dataLength ) { WriteArrayToStreamL( aStream, iSystem ); } - + // write the original timed counter aStream.WriteInt32L( iOriginalTimedCounter ); - + // For future use aStream.WriteInt32L( 0 ); - + }; - + // ----------------------------------------------------------------------------- // CDRMConstraint::InternalizeL // ----------------------------------------------------------------------------- @@ -380,271 +380,271 @@ TInt64 timeData = 0; TInt32 temp = 0; - + // used for the buffers TInt dataLength = 0; HBufC8* dataPart = NULL; TPtr8 dataBuffer(NULL,0,0); - + // Read the (possible) synchronizing marker. iSyncMark = aStream.ReadInt32L(); - + if ( iSyncMark != KSyncMark ) { - + // The structure of the externalized Permission object is the old one. // The first four bytes constitute half of the eight bytes of Start time. - // Read another four bytes from the stream (and apply bit modifications) + // Read another four bytes from the stream (and apply bit modifications) // in order to reconstruct the Start time (iStartTime). temp = aStream.ReadInt32L(); - + timeData = temp; timeData <<= 32; - + Mem::Copy( &timeData, &iSyncMark, sizeof(TInt32) ); - + iStartTime = timeData; timeData = 0; - - // The version is marked as old version for differentiation in + + // The version is marked as old version for differentiation in // InternalizeL. iVersion = KVersion3_2_0; - + } - else + else { // The structure of the externalized Permission object is the new one. - // Read the version and Start time. + // Read the version and Start time. iVersion = aStream.ReadInt32L(); - + // Read the start time ReadInt64L( timeData, aStream ); iStartTime = timeData; - + } - + // Read the end time ReadInt64L( timeData, aStream ); iEndTime = timeData; - + // Read the interval start time - ReadInt64L( timeData, aStream ); + ReadInt64L( timeData, aStream ); iIntervalStart = timeData; - - // Read the interval + + // Read the interval iInterval = aStream.ReadInt32L(); - + // Read the counter iCounter = aStream.ReadInt32L(); - + // Read the original counter iOriginalCounter = aStream.ReadInt32L(); - + // Read the timed counter iTimedCounter = aStream.ReadInt32L(); // Read the timed interval iTimedInterval = aStream.ReadInt32L(); - + // Read the accumulated time iAccumulatedTime = aStream.ReadInt32L(); - + // Read the individual dataLength = aStream.ReadInt32L(); - + SanitizeL( dataLength ); - + if( dataLength > 0 ) { // Reserve a new buffer: dataPart = HBufC8::NewMaxLC( dataLength ); - + // Set the read buffer: dataBuffer.Set(const_cast(dataPart->Ptr()), 0, dataLength); - + // Read the data: aStream.ReadL( dataBuffer ); - - + + // Fill the array from the string ReadArrayFromStringL( dataBuffer, iIndividual); - - // Pop the buffer + + // Pop the buffer CleanupStack::PopAndDestroy(); // dataPart - + } else { - iIndividual.ResetAndDestroy(); - } - - - // Read the system + iIndividual.ResetAndDestroy(); + } + + + // Read the system if ( iVersion == KVersion3_2_0 ) // Constraint has the old structure. { - + dataLength = aStream.ReadInt32L(); - + SanitizeL( dataLength ); - + if( dataLength > 0 ) { // Reserve a new buffer: dataPart = HBufC8::NewMaxLC( dataLength ); - + // Set the read buffer: - dataBuffer.Set( const_cast(dataPart->Ptr()), 0, + dataBuffer.Set( const_cast(dataPart->Ptr()), 0, dataLength ); - + // Read the data: aStream.ReadL( dataBuffer ); - - // Pop the buffer + + // Pop the buffer CleanupStack::Pop(); // dataPart - - // If an old content identifier exists delete it + + // If an old content identifier exists delete it + if ( iSystem.Count() ) + { + iSystem.ResetAndDestroy(); + } + + // assign the new content id + iSystem.AppendL( dataPart ); + } + else + { + // If an old system exists delete it if ( iSystem.Count() ) { iSystem.ResetAndDestroy(); } - - // assign the new content id - iSystem.AppendL( dataPart ); } - else - { - // If an old system exists delete it - if ( iSystem.Count() ) - { - iSystem.ResetAndDestroy(); - } - } } - + // Software Vendor Id iVendorId.iUid = aStream.ReadInt32L(); - + // Secure Id of the allowed application - iSecureId.iUid = aStream.ReadInt32L(); - + iSecureId.iUid = aStream.ReadInt32L(); + // Active constraints - iActiveConstraints = aStream.ReadUint32L(); + iActiveConstraints = aStream.ReadUint32L(); -#ifdef RD_DRM_METERING - +#ifdef RD_DRM_METERING + // Do not read metering information if the version // is the old one because Metering is not activated in it. if ( iVersion == KVersion3_2_1 ) { - + // Metering info dataLength = aStream.ReadInt32L(); - + SanitizeL( dataLength ); - + if( dataLength > 0 ) { - + if( !iDrmMeteringInfo ) { // Reserve a new metering information instance iDrmMeteringInfo = new (ELeave)TDrmMeteringInfo; } - else + else { iDrmMeteringInfo->iGraceTime = 0; iDrmMeteringInfo->iAllowUseWithoutMetering = EFalse; } - - // Read grace time + + // Read grace time iDrmMeteringInfo->iGraceTime = aStream.ReadInt32L(); - - // Read whether content can be consumed without + + // Read whether content can be consumed without // metering being used - iDrmMeteringInfo->iAllowUseWithoutMetering = + iDrmMeteringInfo->iAllowUseWithoutMetering = aStream.ReadInt8L(); - + } else { - - // If old metering information exists delete it + + // If old metering information exists delete it if( iDrmMeteringInfo ) { delete iDrmMeteringInfo; iDrmMeteringInfo = NULL; - } + } } } - + #endif //RD_DRM_METERING // Read the system and original timed counter // according to the new structure. if ( iVersion == KVersion3_2_1 ) { - + dataLength = aStream.ReadInt32L(); - + SanitizeL( dataLength ); - + if( dataLength > 0 ) { // Reserve a new buffer: dataPart = HBufC8::NewMaxLC( dataLength ); - + // Set the read buffer: dataBuffer.Set(const_cast(dataPart->Ptr()), 0, dataLength); - + // Read the data: aStream.ReadL( dataBuffer ); - + // Fill the array from the string ReadArrayFromStringL( dataBuffer, iSystem); - - // Pop the buffer + + // Pop the buffer CleanupStack::PopAndDestroy(); // dataPart - + } else { - iSystem.ResetAndDestroy(); - } - + iSystem.ResetAndDestroy(); + } + // Read the original timed counter iOriginalTimedCounter = aStream.ReadInt32L(); - + // For future use or development, reads the data at the end of the stream dataLength = aStream.ReadInt32L(); - + SanitizeL( dataLength ); - + if ( dataLength > 0 ) { - + // Reserve a new buffer: dataPart = HBufC8::NewMaxLC( dataLength ); - + // Set the read buffer: dataBuffer.Set(const_cast(dataPart->Ptr()), 0, dataLength); - + // Read the data: aStream.ReadL( dataBuffer ); - - // Pop the buffer + + // Pop the buffer CleanupStack::PopAndDestroy( dataPart ); } } - - // Constraint can be considered to have the new structure from now on. - if ( iVersion == KVersion3_2_0 ) + + // Constraint can be considered to have the new structure from now on. + if ( iVersion == KVersion3_2_0 ) { iSyncMark = KSyncMark; - iVersion = KVersion3_2_1; + iVersion = KVersion3_2_1; } - + }; - + // ----------------------------------------------------------------------------- // CDRMConstraint::Stateful // ----------------------------------------------------------------------------- @@ -654,35 +654,35 @@ // counters, timed counters and accumulated are stateful if ( iActiveConstraints & (EConstraintCounter | EConstraintTimedCounter | - EConstraintAccumulated ) ) + EConstraintAccumulated ) ) { return ETrue; } - + // Non-Activated interval is stateful if ( ( iActiveConstraints & EConstraintInterval ) && - iIntervalStart == Time::NullTTime() ) + iIntervalStart == Time::NullTTime() ) { return ETrue; } - + return EFalse; }; // ----------------------------------------------------------------------------- // CDRMConstraint::Size // ----------------------------------------------------------------------------- -// +// EXPORT_C TInt CDRMConstraint::Size() const { TInt size = 0; - + // synchronizing marker size += sizeof(TInt32); - + // version number size += sizeof(TInt32); - + // usage start time size += sizeof(TTime); @@ -702,13 +702,13 @@ size += sizeof(TDRMCounter); // timed counter - size += sizeof(TDRMCounter); + size += sizeof(TDRMCounter); // Interval of the timed counter constraint - size += sizeof(TTimeIntervalSeconds); + size += sizeof(TTimeIntervalSeconds); // accumulated time - size += sizeof(TTimeIntervalSeconds); + size += sizeof(TTimeIntervalSeconds); // individual allowed usage size += sizeof(TInt32); @@ -716,114 +716,114 @@ // Software Vendor Id size += sizeof(TUid); - + // Secure Id of the allowed application size += sizeof(TUid); - - // Bitmask of active constraints + + // Bitmask of active constraints size += sizeof(TUint32); - -#ifdef RD_DRM_METERING + +#ifdef RD_DRM_METERING // Metering information size += sizeof(TInt32); - + if (iDrmMeteringInfo) { - size += sizeof(TTimeIntervalSeconds); + size += sizeof(TTimeIntervalSeconds); size += sizeof(TUint8); } - + #endif //RD_DRM_METERING - + // system allowed usage size += sizeof(TInt32); size += CountArrayStoreSize(iSystem); - + // original timed counter value size += sizeof(TDRMCounter); - + // For future use size += sizeof(TInt32); - + return size; - - }; + + }; // ----------------------------------------------------------------------------- // CDRMConstraint::Expired // ----------------------------------------------------------------------------- -// +// EXPORT_C TBool CDRMConstraint::Expired( const TTime& aTime ) const { - // Full Rights do not expire - if ( iActiveConstraints == EConstraintNone ) - { - return EFalse; - } + // Full Rights do not expire + if ( iActiveConstraints == EConstraintNone ) + { + return EFalse; + } - // First check counters, accumulated time and timed counters - // if any of these is expired the whole thing is expired regardless of the - // actual time based constrants or future rights - + // First check counters, accumulated time and timed counters + // if any of these is expired the whole thing is expired regardless of the + // actual time based constrants or future rights + // Counters - if ( ( iActiveConstraints & EConstraintCounter ) && iCounter < 1 ) - { - return ETrue; - } - - // Accumulated time + if ( ( iActiveConstraints & EConstraintCounter ) && iCounter < 1 ) + { + return ETrue; + } + + // Accumulated time if ( ( iActiveConstraints & EConstraintAccumulated ) && iAccumulatedTime.Int() == 0 ) - { - return ETrue; - } - + { + return ETrue; + } + // Timed Counters - if ( ( iActiveConstraints & EConstraintTimedCounter ) && iTimedCounter < 1 ) - { - return ETrue; - } - + if ( ( iActiveConstraints & EConstraintTimedCounter ) && iTimedCounter < 1 ) + { + return ETrue; + } + // Dont check time based rights if ( aTime != Time::NullTTime() ) - { - - // Check for activated intervals - if ( ( iActiveConstraints & EConstraintInterval) && iIntervalStart != Time::NullTTime() ) - { - TTimeIntervalSeconds current; - - aTime.SecondsFrom( iIntervalStart, current ); - - if ( current >= iInterval ) - { - return ETrue; - } - } - - // Check for end time - if ( ( iActiveConstraints & EConstraintEndTime ) && aTime >= iEndTime ) - { - return ETrue; - } - - // Check for start time, future rights - if ( ( iActiveConstraints & EConstraintStartTime ) && aTime < iStartTime ) - { - return EFalse; - } - } + { + + // Check for activated intervals + if ( ( iActiveConstraints & EConstraintInterval) && iIntervalStart != Time::NullTTime() ) + { + TTimeIntervalSeconds current; + + aTime.SecondsFrom( iIntervalStart, current ); + + if ( current >= iInterval ) + { + return ETrue; + } + } + + // Check for end time + if ( ( iActiveConstraints & EConstraintEndTime ) && aTime >= iEndTime ) + { + return ETrue; + } + + // Check for start time, future rights + if ( ( iActiveConstraints & EConstraintStartTime ) && aTime < iStartTime ) + { + return EFalse; + } + } return EFalse; } // ----------------------------------------------------------------------------- // CDRMConstraint::Merge // ----------------------------------------------------------------------------- -// +// EXPORT_C void CDRMConstraint::Merge( const CDRMConstraint& aConstraint ) { TInt error = KErrNone; - + if ( this != &aConstraint ) { if ( aConstraint.iActiveConstraints & EConstraintStartTime ) @@ -838,7 +838,7 @@ iActiveConstraints |= EConstraintStartTime; } } - + if ( aConstraint.iActiveConstraints & EConstraintEndTime ) { if ( iActiveConstraints & EConstraintEndTime ) @@ -851,7 +851,7 @@ iActiveConstraints |= EConstraintEndTime; } } - + if ( aConstraint.iActiveConstraints & EConstraintCounter ) { if ( iActiveConstraints & EConstraintCounter ) @@ -866,7 +866,7 @@ iActiveConstraints |= EConstraintCounter; } } - + if ( aConstraint.iActiveConstraints & EConstraintInterval ) { if ( iActiveConstraints & EConstraintInterval ) @@ -881,7 +881,7 @@ iActiveConstraints |= EConstraintInterval; } } - + if ( aConstraint.iActiveConstraints & EConstraintTimedCounter ) { if ( iActiveConstraints & EConstraintTimedCounter ) @@ -899,7 +899,7 @@ iActiveConstraints |= EConstraintTimedCounter; } } - + if ( aConstraint.iActiveConstraints & EConstraintAccumulated ) { if ( iActiveConstraints & EConstraintAccumulated ) @@ -912,20 +912,20 @@ iActiveConstraints |= EConstraintAccumulated; } } - + if( aConstraint.iActiveConstraints & EConstraintIndividual ) { // Ignore the error since we don't return an error code or leave TRAP( error, AppendToArrayL( iIndividual, aConstraint.iIndividual ) ); } - + } } // ----------------------------------------------------------------------------- -// CDRMConstraint::Consume +// CDRMConstraint::Consume // ----------------------------------------------------------------------------- -// +// EXPORT_C void CDRMConstraint::Consume( const TTime& aCurrentTime ) { if ( ( iActiveConstraints & EConstraintInterval ) && @@ -933,7 +933,7 @@ { iIntervalStart = aCurrentTime; } - + if ( iActiveConstraints & EConstraintCounter ) { --iCounter; @@ -946,13 +946,13 @@ // EXPORT_C void CDRMConstraint::DuplicateL( const CDRMConstraint& aConstraint ) { - + // synchronizing marker iSyncMark = aConstraint.iSyncMark; - + // version number iVersion = aConstraint.iVersion; - + // usage start time iStartTime = aConstraint.iStartTime; @@ -972,50 +972,50 @@ iOriginalCounter = aConstraint.iOriginalCounter; // timed counter - iTimedCounter = aConstraint.iTimedCounter; + iTimedCounter = aConstraint.iTimedCounter; // Interval of the timed counter constraint - iTimedInterval = aConstraint.iTimedInterval; + iTimedInterval = aConstraint.iTimedInterval; // accumulated time - iAccumulatedTime = aConstraint.iAccumulatedTime; + iAccumulatedTime = aConstraint.iAccumulatedTime; // individual allowed usage iIndividual.ResetAndDestroy(); - + AppendToArrayL( iIndividual, aConstraint.iIndividual ); - + // Software Vendor Id iVendorId = aConstraint.iVendorId; - + // Secure Id of the allowed application iSecureId = aConstraint.iSecureId; - - // Bitmask of active constraints - iActiveConstraints = aConstraint.iActiveConstraints; // Bitmask -#ifdef RD_DRM_METERING + // Bitmask of active constraints + iActiveConstraints = aConstraint.iActiveConstraints; // Bitmask + +#ifdef RD_DRM_METERING // Metering information if ( aConstraint.iDrmMeteringInfo ) { - + if( !iDrmMeteringInfo ) { iDrmMeteringInfo = new (ELeave) TDrmMeteringInfo; } - + iDrmMeteringInfo->iGraceTime = aConstraint.iDrmMeteringInfo->iGraceTime; - iDrmMeteringInfo->iAllowUseWithoutMetering = aConstraint.iDrmMeteringInfo->iAllowUseWithoutMetering; + iDrmMeteringInfo->iAllowUseWithoutMetering = aConstraint.iDrmMeteringInfo->iAllowUseWithoutMetering; } #endif - + // system allowed usage iSystem.ResetAndDestroy(); AppendToArrayL( iSystem, aConstraint.iSystem ); - + // original timed counter value iOriginalTimedCounter = aConstraint.iOriginalTimedCounter; - + }; @@ -1026,88 +1026,88 @@ EXPORT_C TBool CDRMConstraint::Valid( const TTime& aTime, const RPointerArray& aIndividual, TUint32& aRejection ) const - { - TBool drmTime = EFalse; - // Null the rejection requirement: - aRejection = EConstraintNone; - - // Full Rights are always valid - if ( iActiveConstraints == EConstraintNone ) - { - return ETrue; - } + { + TBool drmTime = EFalse; + // Null the rejection requirement: + aRejection = EConstraintNone; - // First check counters, accumulated time and timed counters - // if any of these are invalid the whole thing is invalid regardless of the - // actual time based constraints - + // Full Rights are always valid + if ( iActiveConstraints == EConstraintNone ) + { + return ETrue; + } + + // First check counters, accumulated time and timed counters + // if any of these are invalid the whole thing is invalid regardless of the + // actual time based constraints + // Counters - if ( ( iActiveConstraints & EConstraintCounter ) && iCounter < 1 ) - { - aRejection |= EConstraintCounter; - } - - // Accumulated time + if ( ( iActiveConstraints & EConstraintCounter ) && iCounter < 1 ) + { + aRejection |= EConstraintCounter; + } + + // Accumulated time if ( ( iActiveConstraints & EConstraintAccumulated ) && iAccumulatedTime.Int() == 0 ) - { - aRejection |= EConstraintAccumulated; - } - + { + aRejection |= EConstraintAccumulated; + } + // Timed Counters - if ( ( iActiveConstraints & EConstraintTimedCounter ) && iTimedCounter < 1 ) - { - aRejection |= EConstraintTimedCounter; - } - + if ( ( iActiveConstraints & EConstraintTimedCounter ) && iTimedCounter < 1 ) + { + aRejection |= EConstraintTimedCounter; + } + // Dont check time based rights if ( aTime != Time::NullTTime() ) - { - drmTime = ETrue; - // Check for activated intervals - if ( (iActiveConstraints & EConstraintInterval) && iIntervalStart != Time::NullTTime() ) - { - TTimeIntervalSeconds current; - - aTime.SecondsFrom( iIntervalStart, current ); - - if ( ( current >= iInterval ) || ( aTime < iIntervalStart ) ) - { - aRejection |= EConstraintInterval; - } - } - - // Check for end time - if ( ( iActiveConstraints & EConstraintEndTime ) && aTime >= iEndTime ) - { - aRejection |= EConstraintEndTime; - } - - if ( ( iActiveConstraints & EConstraintStartTime ) && aTime < iStartTime ) - { - aRejection |= EConstraintStartTime; - } - } + { + drmTime = ETrue; + // Check for activated intervals + if ( (iActiveConstraints & EConstraintInterval) && iIntervalStart != Time::NullTTime() ) + { + TTimeIntervalSeconds current; + + aTime.SecondsFrom( iIntervalStart, current ); + + if ( ( current >= iInterval ) || ( aTime < iIntervalStart ) ) + { + aRejection |= EConstraintInterval; + } + } + + // Check for end time + if ( ( iActiveConstraints & EConstraintEndTime ) && aTime >= iEndTime ) + { + aRejection |= EConstraintEndTime; + } + + if ( ( iActiveConstraints & EConstraintStartTime ) && aTime < iStartTime ) + { + aRejection |= EConstraintStartTime; + } + } else { drmTime = EFalse; - - // Check for activated intervals - if ( (iActiveConstraints & EConstraintInterval) ) - { - aRejection |= EConstraintInterval; - } - - // Check for end time - if ( ( iActiveConstraints & EConstraintEndTime ) ) - { - aRejection |= EConstraintEndTime; - } - - if( ( iActiveConstraints & EConstraintStartTime ) ) - { - aRejection |= EConstraintStartTime; - } - } + + // Check for activated intervals + if ( (iActiveConstraints & EConstraintInterval) ) + { + aRejection |= EConstraintInterval; + } + + // Check for end time + if ( ( iActiveConstraints & EConstraintEndTime ) ) + { + aRejection |= EConstraintEndTime; + } + + if( ( iActiveConstraints & EConstraintStartTime ) ) + { + aRejection |= EConstraintStartTime; + } + } // IMSI Checking: if( iActiveConstraints & EConstraintIndividual ) @@ -1120,7 +1120,7 @@ { aRejection |= EConstraintIndividual; } - } + } if( aRejection ) { @@ -1128,12 +1128,12 @@ if( !drmTime ) { aRejection |= EConstraintNullDrmTime; - } - return EFalse; + } + return EFalse; } - return ETrue; - }; + return ETrue; + }; // ----------------------------------------------------------------------------- @@ -1144,7 +1144,7 @@ void CDRMConstraint::ConstructL() { }; - + // ----------------------------------------------------------------------------- // CDRMConstraint::WriteInt64L // ----------------------------------------------------------------------------- @@ -1152,10 +1152,10 @@ void CDRMConstraint::WriteInt64L( const TInt64& aWrite, RWriteStream& aStream ) const { TPtr8 output(NULL,0,0); - - output.Set( reinterpret_cast(const_cast(&aWrite)), + + output.Set( reinterpret_cast(const_cast(&aWrite)), sizeof(TInt64), sizeof(TInt64) ); - + aStream.WriteL( output, sizeof(TInt64) ); }; @@ -1166,9 +1166,9 @@ void CDRMConstraint::ReadInt64L( TInt64& aRead, RReadStream& aStream ) { TPtr8 input(NULL,0,0); - + input.Set( reinterpret_cast(&aRead), 0, sizeof(TInt64) ); - - aStream.ReadL( input, sizeof(TInt64) ); - }; + + aStream.ReadL( input, sizeof(TInt64) ); + }; // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/ro/src/DRMPermission.cpp --- a/omadrm/drmengine/ro/src/DRMPermission.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/ro/src/DRMPermission.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -21,24 +21,24 @@ #include #include #include -#include "DRMPermission.h" -#include "DRMConstraint.h" +#include "DrmPermission.h" +#include "DrmConstraint.h" #include "drmlog.h" -#include "OMA2Agent.h" +#include "Oma2Agent.h" // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS // Synchronizing marker in the beginning of the stream in order to synchronize -// to externalized Permission object having the new structure. +// to externalized Permission object having the new structure. const TInt32 KSyncMark = 0xAFCE; // Old and new version number of the Permission object const TInt8 KVersion3_2_0 = 0; -const TInt8 KVersion3_2_1 = 1; +const TInt8 KVersion3_2_1 = 1; const TInt KSanityDataLengthLow = 0; @@ -84,8 +84,8 @@ CDRMPermission* self = new( ELeave ) CDRMPermission(); CleanupStack::PushL( self ); self->ConstructL(); - - return self; + + return self; }; @@ -98,7 +98,7 @@ { CDRMPermission* self = NewLC(); CleanupStack::Pop(); - + return self; }; @@ -108,7 +108,7 @@ // CDRMPermission::CDRMPermission() : iSyncMark( KSyncMark ), - iVersion( KVersion3_2_1 ), // Version number for differentiation in + iVersion( KVersion3_2_1 ), // Version number for differentiation in // InternalizeL. iUniqueID( 0 ), iOriginalInsertTime( Time::NullTTime() ), @@ -128,9 +128,9 @@ iRiId.SetLength( KRiIdSize ); iRiId.Fill( 0 ); }; - - - + + + // ----------------------------------------------------------------------------- // Destructor // ----------------------------------------------------------------------------- @@ -148,31 +148,31 @@ delete iPlay; iPlay = NULL; } - + if( iDisplay ) { delete iDisplay; iDisplay = NULL; } - + if( iExecute ) { delete iExecute; iExecute = NULL; } - + if( iExport ) { delete iExport; iExport = NULL; } - + if( iPrint ) { delete iPrint; iPrint = NULL; } - + if( iParentUID ) { delete iParentUID; @@ -190,88 +190,88 @@ delete iDomainID; iDomainID = NULL; } - + if( iOnExpiredUrl ) { delete iOnExpiredUrl; iOnExpiredUrl = NULL; } }; - + // ----------------------------------------------------------------------------- // CDRMPermission::ExternalizeL // ----------------------------------------------------------------------------- // EXPORT_C void CDRMPermission::ExternalizeL( RWriteStream& aStream ) const { - + // used for the buffers TInt dataLength = 0; - + // Used for mode TUint8 exportMode = 0; - + // Write the synchronizing marker aStream.WriteInt32L( iSyncMark ); - + // Write the version number aStream.WriteInt32L( iVersion ); - + // Unique ID of the permission aStream.WriteUint32L( iUniqueID ); - + // The original insertion time WriteInt64L( iOriginalInsertTime.Int64(), aStream ); - + // Top level constraint - if( !iTopLevel ) + if( !iTopLevel ) { User::Leave( KErrNotReady ); } iTopLevel->ExternalizeL( aStream ); - + // Play constraint if( !iPlay ) { User::Leave( KErrNotReady ); } iPlay->ExternalizeL( aStream ); - + // Display constraint if( !iDisplay ) { User::Leave( KErrNotReady ); } iDisplay->ExternalizeL( aStream ); - + // Execute constraint if( !iExecute ) { User::Leave( KErrNotReady ); } iExecute->ExternalizeL( aStream ); - + // Print constraint if( !iPrint ) { User::Leave( KErrNotReady ); } iPrint->ExternalizeL( aStream ); - + // Export constraint if( !iExport ) { User::Leave( KErrNotReady ); } iExport->ExternalizeL( aStream ); - + // Export mode exportMode = iExportMode; aStream.WriteUint8L( exportMode ); - + // Content id of the parent rights object dataLength = 0; - if( iParentUID ) + if( iParentUID ) { dataLength = iParentUID->Length(); } @@ -279,47 +279,47 @@ if( dataLength ) { - aStream.WriteL( iParentUID->Des() ); - } - + aStream.WriteL( iParentUID->Des() ); + } + // Rights Object if of the rights delivery container - dataLength = 0; + dataLength = 0; if( iRoID ) { dataLength = iRoID->Length(); } aStream.WriteInt32L( dataLength ); - + if( dataLength ) { - aStream.WriteL( iRoID->Des() ); + aStream.WriteL( iRoID->Des() ); } - + // Domain identifier - dataLength = 0; + dataLength = 0; if( iDomainID ) { dataLength = iDomainID->Length(); } aStream.WriteInt32L( dataLength ); - + if( dataLength ) { - aStream.WriteL( iDomainID->Des() ); - } - - // Available rights + aStream.WriteL( iDomainID->Des() ); + } + + // Available rights aStream.WriteUint16L( iAvailableRights ); - // Version number of the rights object + // Version number of the rights object aStream.WriteUint16L( iRightsObjectVersion.iVersionMain ); aStream.WriteUint16L( iRightsObjectVersion.iVersionSub ); - + // Info bits aStream.WriteInt32L( iInfoBits ); - + aStream.WriteL( iRiId ); - + // OnExpiredUrl dataLength = 0; if ( iOnExpiredUrl ) @@ -327,37 +327,37 @@ dataLength = iOnExpiredUrl->Length(); } aStream.WriteInt32L( dataLength ); - + if ( dataLength ) { aStream.WriteL( iOnExpiredUrl->Des() ); } - + // For future use aStream.WriteInt32L( 0 ); - + }; - + // ----------------------------------------------------------------------------- // CDRMPermission::InternalizeL // ----------------------------------------------------------------------------- // EXPORT_C void CDRMPermission::InternalizeL( RReadStream& aStream ) - { - + { + TInt64 timeData = 0; - + // used for the buffers TInt dataLength = 0; TPtr8 dataBuffer(NULL,0,0); HBufC8* dataPart = NULL; - + // (Possible) synchronizing marker iSyncMark = aStream.ReadInt32L(); - + if ( iSyncMark == KSyncMark ) { - + // The internalized Permission object has the new structure if the // synchronizing marker is found in the beginning of the stream. In that // case read version number and Unique ID. @@ -367,276 +367,276 @@ iUniqueID = aStream.ReadUint32L(); } - else + else { - + // The internalized Permission object has the old structure. The // stream information that was read to iSyncMark is actually the // Unique ID. iUniqueID = (TDRMUniqueID)iSyncMark; iVersion = KVersion3_2_0; // Old version, needed for differentation - + } - + // The original insertion time ReadInt64L( timeData, aStream ); iOriginalInsertTime = timeData; - + // Top level constraint if( !iTopLevel ) { iTopLevel = CDRMConstraint::NewL(); } - + iTopLevel->InternalizeL( aStream ); - + // Play constraint if( !iPlay ) { iPlay = CDRMConstraint::NewL(); } - + iPlay->InternalizeL( aStream ); - + // Display constraint if( !iDisplay ) { iDisplay = CDRMConstraint::NewL(); } - + iDisplay->InternalizeL( aStream ); - + // Execute constraint if( !iExecute ) { iExecute = CDRMConstraint::NewL(); } - + iExecute->InternalizeL( aStream ); - + // Print constraint if( !iPrint) { iPrint = CDRMConstraint::NewL(); } - + iPrint->InternalizeL( aStream ); - + // Export constraint - + iExport->InternalizeL( aStream ); - + // Export mode iExportMode = static_cast(aStream.ReadUint8L()); - + // Content id of the parent rights object dataLength = aStream.ReadInt32L(); - + SanitizeL( dataLength ); - + if( dataLength > 0 ) { // Reserve a new buffer: dataPart = HBufC8::NewMaxLC( dataLength ); - + // Set the read buffer: dataBuffer.Set(const_cast(dataPart->Ptr()), 0, dataLength); - + // Read the data: aStream.ReadL( dataBuffer ); - - // Pop the buffer + + // Pop the buffer CleanupStack::Pop(); // dataPart - - // If an old content identifier exists delete it + + // If an old content identifier exists delete it if( iParentUID ) { delete iParentUID; iParentUID = NULL; } - + // assign the new content id - iParentUID = dataPart; + iParentUID = dataPart; } else { - // If an old individual exists delete it + // If an old individual exists delete it if( iParentUID ) { delete iParentUID; iParentUID = NULL; - } - } - - + } + } + + // Rights Object if of the rights delivery container // Read the individual dataLength = aStream.ReadInt32L(); SanitizeL( dataLength ); - + if( dataLength > 0 ) { // Reserve a new buffer: dataPart = HBufC8::NewMaxLC( dataLength ); - + // Set the read buffer: dataBuffer.Set(const_cast(dataPart->Ptr()), 0, dataLength); - + // Read the data: aStream.ReadL( dataBuffer ); - - // Pop the buffer + + // Pop the buffer CleanupStack::Pop(); // dataPart - - // If an old content identifier exists delete it + + // If an old content identifier exists delete it if( iRoID ) { delete iRoID; iRoID = NULL; } - + // assign the new content id - iRoID = dataPart; + iRoID = dataPart; } else { - // If an old individual exists delete it + // If an old individual exists delete it if( iRoID ) { delete iRoID; iRoID = NULL; - } - } - + } + } + // Domain identifier dataLength = aStream.ReadInt32L(); SanitizeL( dataLength ); - + if( dataLength > 0 ) { // Reserve a new buffer: dataPart = HBufC8::NewMaxLC( dataLength ); - + // Set the read buffer: dataBuffer.Set(const_cast(dataPart->Ptr()), 0, dataLength); - + // Read the data: aStream.ReadL( dataBuffer ); - - // Pop the buffer + + // Pop the buffer CleanupStack::Pop(); // dataPart - - // If an old content identifier exists delete it + + // If an old content identifier exists delete it + if( iDomainID ) + { + delete iDomainID; + iDomainID = NULL; + } + + // assign the new content id + iDomainID = dataPart; + } + else + { + // If an old individual exists delete it if( iDomainID ) { delete iDomainID; iDomainID = NULL; } - - // assign the new content id - iDomainID = dataPart; } - else - { - // If an old individual exists delete it - if( iDomainID ) - { - delete iDomainID; - iDomainID = NULL; - } - } - + - // Available rights + // Available rights iAvailableRights = aStream.ReadUint16L(); - // Version number of the rights object + // Version number of the rights object iRightsObjectVersion.iVersionMain = aStream.ReadUint16L(); iRightsObjectVersion.iVersionSub = aStream.ReadUint16L(); - + // Information bits iInfoBits = aStream.ReadInt32L(); - + aStream.ReadL( iRiId ); - + // New structure of Permission object if ( iVersion == KVersion3_2_1 ) { - + // OnExpiredUrl dataLength = aStream.ReadInt32L(); - + SanitizeL( dataLength ); - + if( dataLength > 0 ) { - + // Reserve a new buffer: dataPart = HBufC8::NewMaxLC( dataLength ); - + // Set the read buffer: - dataBuffer.Set(const_cast(dataPart->Ptr()), 0, + dataBuffer.Set(const_cast(dataPart->Ptr()), 0, dataLength); - + // Read the data: aStream.ReadL( dataBuffer ); - - // Pop the buffer + + // Pop the buffer CleanupStack::Pop(); // dataPart - - // If an old OnExpiredUrl exists delete it + + // If an old OnExpiredUrl exists delete it if( iOnExpiredUrl ) { delete iOnExpiredUrl; iOnExpiredUrl = NULL; } - + // assign the new OnExpiredUrl - iOnExpiredUrl = dataPart; + iOnExpiredUrl = dataPart; } else { - // If an old OnExpiredUrl exists delete it + // If an old OnExpiredUrl exists delete it if( iOnExpiredUrl ) { delete iOnExpiredUrl; iOnExpiredUrl = NULL; - } - } - + } + } + // For future use or development, reads the data at the end of the stream dataLength = aStream.ReadInt32L(); - + SanitizeL( dataLength ); - + if ( dataLength > 0 ) { // Reserve a new buffer: dataPart = HBufC8::NewMaxLC( dataLength ); - + // Set the read buffer: dataBuffer.Set(const_cast(dataPart->Ptr()), 0, dataLength); - + // Read the data: aStream.ReadL( dataBuffer ); - - // Delete the buffer + + // Delete the buffer CleanupStack::PopAndDestroy( dataPart ); } } - - // Permission can be considered to have the new structure after - // internalization. - if ( iVersion == KVersion3_2_0 ) + + // Permission can be considered to have the new structure after + // internalization. + if ( iVersion == KVersion3_2_0 ) { iSyncMark = KSyncMark; - iVersion = KVersion3_2_1; + iVersion = KVersion3_2_1; } - + }; - + // ----------------------------------------------------------------------------- // CDRMPermission::Stateful // ----------------------------------------------------------------------------- @@ -653,19 +653,19 @@ } else if( (iAvailableRights & ERightsDisplay) && iDisplay->Stateful() ) { - return ETrue; + return ETrue; } else if( (iAvailableRights & ERightsExecute) && iExecute->Stateful() ) { - return ETrue; + return ETrue; } else if( (iAvailableRights & ERightsPrint) && iPrint->Stateful() ) { return ETrue; } - return EFalse; + return EFalse; }; - + // ----------------------------------------------------------------------------- // CDRMPermission::SoftwareConstrained // ----------------------------------------------------------------------------- @@ -685,25 +685,25 @@ else if ( (iAvailableRights & ERightsDisplay) && iDisplay->iActiveConstraints & ( EConstraintVendor | EConstraintSoftware ) ) { - return ETrue; + return ETrue; } else if ( (iAvailableRights & ERightsExecute) && iExecute->iActiveConstraints & ( EConstraintVendor | EConstraintSoftware ) ) { - return ETrue; + return ETrue; } else if ( (iAvailableRights & ERightsPrint) && iPrint->iActiveConstraints & ( EConstraintVendor | EConstraintSoftware ) ) { return ETrue; } - return EFalse; + return EFalse; }; - + // ----------------------------------------------------------------------------- // CDRMPermission::Child // ----------------------------------------------------------------------------- -// +// EXPORT_C TBool CDRMPermission::Child() const { return iParentUID ? ETrue : EFalse; @@ -712,105 +712,105 @@ // ----------------------------------------------------------------------------- // CDRMPermission::Size // ----------------------------------------------------------------------------- -// +// EXPORT_C TInt CDRMPermission::Size() const { TInt size = 0; - + // synchronizing marker size += sizeof(TInt32); - + // Version number size += sizeof(TInt32); - + // Unique ID of the permission size += sizeof(TDRMUniqueID); - + // The original insertion time size += sizeof(TTime); - + // Top level constraint size += iTopLevel->Size(); - + // Play constraint size += iPlay->Size(); - + // Display constraint size += iDisplay->Size(); - + // Execute constraint size += iExecute->Size(); - + // Print constraint size += iPrint->Size(); - + // Export constraint size += iExport->Size(); - + // Export mode size += sizeof(TUint8); - + // Content id of the parent rights object size += sizeof(TInt32); - + if( iParentUID ) { size += iParentUID->Size(); } - + // Rights Object if of the rights delivery container size += sizeof(TInt32); - + if( iRoID ) { size += iRoID->Size(); } - + // Domain identifier size += sizeof(TInt32); - + if( iDomainID ) { size += iDomainID->Size(); } - + // Available rights size += sizeof(TUint16); - + // Version number of the rights object size += sizeof(TUint16); size += sizeof(TUint16); - + // infobits size += sizeof(TInt32); - + // RI ID size += KRiIdSize; - + // OnExpiredUrl size += sizeof(TInt32); - + if ( iOnExpiredUrl ) { size += iOnExpiredUrl->Size(); } - + // For future use size += sizeof(TInt32); - + return size; - + }; // ----------------------------------------------------------------------------- // CDRMPermission::ConstraintForIntent // ----------------------------------------------------------------------------- -// -EXPORT_C CDRMConstraint* CDRMPermission::ConstraintForIntent( +// +EXPORT_C CDRMConstraint* CDRMPermission::ConstraintForIntent( const ContentAccess::TIntent aIntent ) { CDRMConstraint* r = NULL; - + switch ( aIntent ) { case ContentAccess::EPlay: @@ -838,14 +838,14 @@ } break; } - + return r; } // ----------------------------------------------------------------------------- // CDRMPermission::ConstraintForIntent // ----------------------------------------------------------------------------- -// +// EXPORT_C CDRMConstraint* CDRMPermission::TopLevelConstraint() { if ( iAvailableRights & ERightsTopLevel ) @@ -861,18 +861,18 @@ // ----------------------------------------------------------------------------- // CDRMPermission::ConsumeRights // ----------------------------------------------------------------------------- -// +// EXPORT_C void CDRMPermission::ConsumeRights( const TIntent aIntent, const TTime& aCurrentTime ) { - //__ASSERT_DEBUG( !( aIntent == ERightsTopLevel ), User::Leave( KErrArgument ) ); - + //__ASSERT_DEBUG( !( aIntent == ERightsTopLevel ), User::Leave( KErrArgument ) ); + CDRMConstraint* constraint( TopLevelConstraint() ); - + if ( constraint ) { constraint->Consume( aCurrentTime ); } - + constraint = ConstraintForIntent( aIntent ); if ( constraint ) { @@ -891,8 +891,8 @@ CleanupClosePushL( stream ); InternalizeL( stream ); - - CleanupStack::PopAndDestroy(); // Stream + + CleanupStack::PopAndDestroy(); // Stream }; @@ -909,10 +909,10 @@ CleanupClosePushL( stream ); ExternalizeL( stream ); - + CleanupStack::PopAndDestroy(); // Stream CleanupStack::Pop(); - return data; + return data; }; // ----------------------------------------------------------------------------- @@ -921,64 +921,64 @@ // EXPORT_C void CDRMPermission::DuplicateL( const CDRMPermission& aPermission ) { - + // Synchronizing marker iSyncMark = aPermission.iSyncMark; - + // Version number iVersion = aPermission.iVersion; - + // Unique ID of the permission iUniqueID = aPermission.iUniqueID; - + // The original insertion time iOriginalInsertTime = aPermission.iOriginalInsertTime; - + // Top level constraint if( !iTopLevel ) { iTopLevel = CDRMConstraint::NewL(); } iTopLevel->DuplicateL( *(aPermission.iTopLevel ) ); - + // Play constraint if( !iPlay ) { iPlay = CDRMConstraint::NewL(); } iPlay->DuplicateL( *(aPermission.iPlay ) ); - + // Display constraint if( !iDisplay ) { iDisplay = CDRMConstraint::NewL(); } iDisplay->DuplicateL( *(aPermission.iDisplay ) ); - + // Execute constraint if( !iExecute ) { iExecute = CDRMConstraint::NewL(); } iExecute->DuplicateL( *(aPermission.iExecute ) ); - + // Print constraint if( !iPrint ) { iPrint = CDRMConstraint::NewL(); } iPrint->DuplicateL( *(aPermission.iPrint ) ); - + // Export constraint if( !iExport ) { iExport = CDRMConstraint::NewL(); } - iExport->DuplicateL( *(aPermission.iExport ) ); - + iExport->DuplicateL( *(aPermission.iExport ) ); + // Export mode iExportMode = aPermission.iExportMode; - + // Content id of the parent rights object if( iParentUID ) { @@ -990,52 +990,52 @@ { iParentUID = aPermission.iParentUID->AllocL(); } - + // Rights Object if of the rights delivery container if( iRoID ) { delete iRoID; iRoID = NULL; } - + if( aPermission.iRoID ) { iRoID = aPermission.iRoID->AllocL(); } - + // Domain identifier if( iDomainID ) { delete iDomainID; iDomainID = NULL; } - - if( aPermission.iDomainID ) + + if( aPermission.iDomainID ) { iDomainID = aPermission.iDomainID->AllocL(); } // Available rights - iAvailableRights = aPermission.iAvailableRights; // Bitmask - + iAvailableRights = aPermission.iAvailableRights; // Bitmask + // Version number of the rights object iRightsObjectVersion.iVersionMain = aPermission.iRightsObjectVersion.iVersionMain; iRightsObjectVersion.iVersionSub = aPermission.iRightsObjectVersion.iVersionSub; - + // info bits iInfoBits = aPermission.iInfoBits; - + // OnExpiredUrl if ( iOnExpiredUrl ) { delete iOnExpiredUrl; iOnExpiredUrl = NULL; } - - if ( aPermission.iOnExpiredUrl ) + + if ( aPermission.iOnExpiredUrl ) { iOnExpiredUrl = aPermission.iOnExpiredUrl->AllocL(); } - + }; @@ -1044,57 +1044,57 @@ // ----------------------------------------------------------------------------- // EXPORT_C TBool CDRMPermission::Expired( const TTime& aTime ) - { - if( iTopLevel && iAvailableRights & ERightsTopLevel ) - { - if( iTopLevel->Expired( aTime ) ) - { - return ETrue; - } - } + { + if( iTopLevel && iAvailableRights & ERightsTopLevel ) + { + if( iTopLevel->Expired( aTime ) ) + { + return ETrue; + } + } - if( iPlay && iAvailableRights & ERightsPlay) - { - if( !iPlay->Expired( aTime ) ) - { - return EFalse; - } - } + if( iPlay && iAvailableRights & ERightsPlay) + { + if( !iPlay->Expired( aTime ) ) + { + return EFalse; + } + } - if( iDisplay && iAvailableRights & ERightsDisplay ) - { - if( !iDisplay->Expired( aTime ) ) - { - return EFalse; - } - } + if( iDisplay && iAvailableRights & ERightsDisplay ) + { + if( !iDisplay->Expired( aTime ) ) + { + return EFalse; + } + } - if( iExecute && iAvailableRights & ERightsExecute ) - { - if( !iExecute->Expired( aTime ) ) - { - return EFalse; - } - } + if( iExecute && iAvailableRights & ERightsExecute ) + { + if( !iExecute->Expired( aTime ) ) + { + return EFalse; + } + } - if( iPrint && iAvailableRights & ERightsPrint ) - { - if( !iPrint->Expired( aTime ) ) - { - return EFalse; - } - } + if( iPrint && iAvailableRights & ERightsPrint ) + { + if( !iPrint->Expired( aTime ) ) + { + return EFalse; + } + } - if( iExport && iAvailableRights & ERightsExport ) - { - if( !iExport->Expired( aTime ) ) - { - return EFalse; - } - } - - return ETrue; - }; + if( iExport && iAvailableRights & ERightsExport ) + { + if( !iExport->Expired( aTime ) ) + { + return EFalse; + } + } + + return ETrue; + }; // ----------------------------------------------------------------------------- @@ -1103,15 +1103,15 @@ // EXPORT_C TBool CDRMPermission::Valid( const TTime& aTime, const RPointerArray& aIndividual, - TUint32& aRejection, + TUint32& aRejection, const TRightsType aType ) const - { - // Always check that if the top level rights are present - // that they are valid + { + // Always check that if the top level rights are present + // that they are valid if( iTopLevel && !iTopLevel->Valid( aTime, aIndividual, aRejection ) ) { aRejection |= aRejection; - return EFalse; + return EFalse; } switch( aType ) @@ -1119,90 +1119,90 @@ case ERightsTopLevel: if( !iTopLevel ) { - return EFalse; + return EFalse; } - break; + break; case ERightsPlay: if( !iPlay ) { - return EFalse; + return EFalse; + } + else if( iPlay && !iPlay->Valid( aTime, aIndividual, aRejection ) ) + { + return EFalse; + } + break; + case ERightsDisplay: + if( !iDisplay ) + { + return EFalse; + } + else if( iDisplay && !iDisplay->Valid( aTime, aIndividual, aRejection ) ) + { + return EFalse; + } + break; + case ERightsExecute: + if( !iExecute ) + { + return EFalse; + } + else if( iExecute && !iExecute->Valid( aTime, aIndividual, aRejection ) ) + { + return EFalse; + } + break; + case ERightsPrint: + if( !iPrint ) + { + return EFalse; + } + else if( iPrint && !iPrint->Valid( aTime, aIndividual, aRejection ) ) + { + return EFalse; } - else if( iPlay && !iPlay->Valid( aTime, aIndividual, aRejection ) ) - { - return EFalse; - } - break; - case ERightsDisplay: - if( !iDisplay ) - { - return EFalse; - } - else if( iDisplay && !iDisplay->Valid( aTime, aIndividual, aRejection ) ) - { - return EFalse; - } - break; - case ERightsExecute: - if( !iExecute ) - { - return EFalse; - } - else if( iExecute && !iExecute->Valid( aTime, aIndividual, aRejection ) ) - { - return EFalse; - } - break; - case ERightsPrint: - if( !iPrint ) - { - return EFalse; - } - else if( iPrint && !iPrint->Valid( aTime, aIndividual, aRejection ) ) - { - return EFalse; - } - break; - case ERightsExport: - if( !iExport ) - { - return EFalse; - } - else if( iExport && !iExport->Valid( aTime, aIndividual, aRejection ) ) - { - return EFalse; - } - break; + break; + case ERightsExport: + if( !iExport ) + { + return EFalse; + } + else if( iExport && !iExport->Valid( aTime, aIndividual, aRejection ) ) + { + return EFalse; + } + break; default: - // No constraints are defined, top level doesn't work - // on it's own, the permission is invalid - if( !iPrint && !iDisplay && !iExecute && !iPrint ) - { - return EFalse; - } - else if( iPlay && !iPlay->Valid( aTime, aIndividual, aRejection ) ) - { - return EFalse; - } - else if( iDisplay && !iDisplay->Valid( aTime, aIndividual, aRejection ) ) - { - return EFalse; - } - else if( iPrint && !iPrint->Valid( aTime, aIndividual, aRejection ) ) - { - return EFalse; - } - else if( iExecute && !iExecute->Valid( aTime, aIndividual, aRejection ) ) - { - return EFalse; - } - else if( iExport && !iExport->Valid( aTime, aIndividual, aRejection ) ) - { - return EFalse; - } - break; - } - return ETrue; - }; + // No constraints are defined, top level doesn't work + // on it's own, the permission is invalid + if( !iPrint && !iDisplay && !iExecute && !iPrint ) + { + return EFalse; + } + else if( iPlay && !iPlay->Valid( aTime, aIndividual, aRejection ) ) + { + return EFalse; + } + else if( iDisplay && !iDisplay->Valid( aTime, aIndividual, aRejection ) ) + { + return EFalse; + } + else if( iPrint && !iPrint->Valid( aTime, aIndividual, aRejection ) ) + { + return EFalse; + } + else if( iExecute && !iExecute->Valid( aTime, aIndividual, aRejection ) ) + { + return EFalse; + } + else if( iExport && !iExport->Valid( aTime, aIndividual, aRejection ) ) + { + return EFalse; + } + break; + } + return ETrue; + }; @@ -1217,11 +1217,11 @@ iPlay = CDRMConstraint::NewL(); iDisplay = CDRMConstraint::NewL(); iExecute = CDRMConstraint::NewL(); - iPrint = CDRMConstraint::NewL(); + iPrint = CDRMConstraint::NewL(); iExport = CDRMConstraint::NewL(); - + iRightsObjectVersion.iVersionMain = EOma1Rights; - iRightsObjectVersion.iVersionSub = 0; + iRightsObjectVersion.iVersionSub = 0; }; @@ -1231,9 +1231,9 @@ // void CDRMPermission::WriteInt64L( const TInt64& aWrite, RWriteStream& aStream ) const { - TPtr8 output( reinterpret_cast(const_cast(&aWrite)), + TPtr8 output( reinterpret_cast(const_cast(&aWrite)), sizeof(TInt64), sizeof(TInt64) ); - + aStream.WriteL( output, sizeof(TInt64) ); } @@ -1244,8 +1244,8 @@ void CDRMPermission::ReadInt64L( TInt64& aRead, RReadStream& aStream ) { TPtr8 input( reinterpret_cast(&aRead), 0, sizeof(TInt64) ); - - aStream.ReadL( input, sizeof(TInt64) ); + + aStream.ReadL( input, sizeof(TInt64) ); }; @@ -1254,15 +1254,15 @@ // ----------------------------------------------------------------------------- // EXPORT_C void CDRMPermission::Merge( const CDRMPermission& aPermission ) - { - iTopLevel->Merge( *( aPermission.iTopLevel ) ); - iPlay->Merge( *( aPermission.iPlay ) ); - iDisplay->Merge( *( aPermission.iDisplay ) ); - iExecute->Merge( *( aPermission.iExecute ) ); - iPrint->Merge( *( aPermission.iPrint ) ); - iExport->Merge( *( aPermission.iExport ) ); - iAvailableRights |= aPermission.iAvailableRights; - iInfoBits |= aPermission.iInfoBits; - } - + { + iTopLevel->Merge( *( aPermission.iTopLevel ) ); + iPlay->Merge( *( aPermission.iPlay ) ); + iDisplay->Merge( *( aPermission.iDisplay ) ); + iExecute->Merge( *( aPermission.iExecute ) ); + iPrint->Merge( *( aPermission.iPrint ) ); + iExport->Merge( *( aPermission.iExport ) ); + iAvailableRights |= aPermission.iAvailableRights; + iInfoBits |= aPermission.iInfoBits; + } + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/ro/src/DrmProtectedRoParser.cpp --- a/omadrm/drmengine/ro/src/DrmProtectedRoParser.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/ro/src/DrmProtectedRoParser.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -22,16 +22,16 @@ #include #include #include -#include +#include #ifdef _DEBUG #include #endif // _DEBUG -#include "base64.h" +#include "Base64.h" #include "DcfCommon.h" #include "DrmRightsParser.h" -#include "DrmProtectedRoParser.h" -#include "DrmRightsClient.h" +#include "DRMProtectedRoParser.h" +#include "DRMRightsClient.h" #include "hash.h" #include "DRMCommon.h" #include "OmaCrypto.h" @@ -40,7 +40,7 @@ #include "RoapMessage.h" #include "DcfRep.h" #include "DcfEntry.h" -#include "Oma2Dcf.h" +#include "oma2dcf.h" using namespace Roap; using namespace Xml; @@ -804,7 +804,7 @@ if ( integrityCheck && !r ) { // Only add the rigths which were parsed in this loop - + for ( TInt i( n ); i < aResultRights.Count(); i++) { cid = NULL; diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/ro/src/DrmRel1_0StringDict00AttributeTable.cpp --- a/omadrm/drmengine/ro/src/DrmRel1_0StringDict00AttributeTable.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/ro/src/DrmRel1_0StringDict00AttributeTable.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -18,8 +18,8 @@ // Autogenerated from \epoc32\build\generated\Xml\DrmRel1_0StringDict00AttributeTable.st by the stringtable tool - Do not edit #include -#include "StringPool.h" -#include "StringTableSupport.h" +#include "stringpool.h" +#include "stringtablesupport.h" #include "DrmRel1_0StringDict00AttributeTable.h" #ifdef _DEBUG #undef _DEBUG @@ -31,10 +31,10 @@ // Intermediate const void * const KStringPointers[] = - { - (const void*)&K1, - (const void*)&K2, - (const void*)&K3 - }; + { + (const void*)&K1, + (const void*)&K2, + (const void*)&K3 + }; const TStringTable DrmRel1_0StringDict00AttributeTable::Table = {3, KStringPointers, ETrue}; diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/ro/src/DrmRel1_0StringDict00AttributeValueTable.cpp --- a/omadrm/drmengine/ro/src/DrmRel1_0StringDict00AttributeValueTable.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/ro/src/DrmRel1_0StringDict00AttributeValueTable.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -18,8 +18,8 @@ // Autogenerated from \epoc32\build\generated\Xml\DrmRel1_0StringDict00AttributeValueTable.st by the stringtable tool - Do not edit #include -#include "StringPool.h" -#include "StringTableSupport.h" +#include "stringpool.h" +#include "stringtablesupport.h" #include "DrmRel1_0StringDict00AttributeValueTable.h" #ifdef _DEBUG #undef _DEBUG @@ -34,13 +34,13 @@ // Intermediate const void * const KStringPointers[] = - { - (const void*)&K1, - (const void*)&K2, - (const void*)&K3, - (const void*)&K4, - (const void*)&K5, - (const void*)&K6 - }; + { + (const void*)&K1, + (const void*)&K2, + (const void*)&K3, + (const void*)&K4, + (const void*)&K5, + (const void*)&K6 + }; const TStringTable DrmRel1_0StringDict00AttributeValueTable::Table = {6, KStringPointers, ETrue}; diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/ro/src/DrmRel1_0StringDict00TagTable.cpp --- a/omadrm/drmengine/ro/src/DrmRel1_0StringDict00TagTable.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/ro/src/DrmRel1_0StringDict00TagTable.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -18,8 +18,8 @@ // Autogenerated from \epoc32\build\generated\Xml\DrmRel1_0StringDict00TagTable.st by the stringtable tool - Do not edit #include -#include "StringPool.h" -#include "StringTableSupport.h" +#include "stringpool.h" +#include "stringtablesupport.h" #include "DrmRel1_0StringDict00TagTable.h" #ifdef _DEBUG #undef _DEBUG @@ -50,29 +50,29 @@ // Intermediate const void * const KStringPointers[] = - { - (const void*)&K1, - (const void*)&K2, - (const void*)&K3, - (const void*)&K4, - (const void*)&K5, - (const void*)&K6, - (const void*)&K7, - (const void*)&K8, - (const void*)&K9, - (const void*)&K10, - (const void*)&K11, - (const void*)&K12, - (const void*)&K13, - (const void*)&K14, - (const void*)&K15, - (const void*)&K16, - (const void*)&K17, - (const void*)&K18, - (const void*)&K19, - (const void*)&K20, - (const void*)&K21, - (const void*)&K22 - }; + { + (const void*)&K1, + (const void*)&K2, + (const void*)&K3, + (const void*)&K4, + (const void*)&K5, + (const void*)&K6, + (const void*)&K7, + (const void*)&K8, + (const void*)&K9, + (const void*)&K10, + (const void*)&K11, + (const void*)&K12, + (const void*)&K13, + (const void*)&K14, + (const void*)&K15, + (const void*)&K16, + (const void*)&K17, + (const void*)&K18, + (const void*)&K19, + (const void*)&K20, + (const void*)&K21, + (const void*)&K22 + }; const TStringTable DrmRel1_0StringDict00TagTable::Table = {22, KStringPointers, ETrue}; diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/ro/src/DrmRights.cpp --- a/omadrm/drmengine/ro/src/DrmRights.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/ro/src/DrmRights.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,7 +19,7 @@ // INCLUDE FILES #include "DrmAsset.h" -#include "DrmRights.h" +#include "DRMRights.h" #include "DrmPermission.h" #include "DrmConstraint.h" diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/ro/src/DrmRightsParser.cpp --- a/omadrm/drmengine/ro/src/DrmRightsParser.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/ro/src/DrmRightsParser.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -24,14 +24,14 @@ #include #include #include -#include "DrmRights.h" +#include "DRMRights.h" #include "DcfCommon.h" #include "DrmRightsParser.h" -#include "DrmRightsClient.h" +#include "DRMRightsClient.h" #include "hash.h" -#include "base64.h" -#include "DRMPermission.h" -#include "DRMConstraint.h" +#include "Base64.h" +#include "DrmPermission.h" +#include "DrmConstraint.h" #include "DRMClockClient.h" // MODULE DATA STRUCTURES @@ -1216,7 +1216,7 @@ iRights->iCurrentConstraint->iDrmMeteringInfo->iGraceTime = n; CleanupStack::PopAndDestroy( b ); - b = NULL; + b = NULL; } b = GetAttributeValueL( aAttributes, KContentAccessGrantedAttribute ); // put value to content access granted without metering diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/roap/inc/JoinDomainResp.h --- a/omadrm/drmengine/roap/inc/JoinDomainResp.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/roap/inc/JoinDomainResp.h Mon Mar 15 12:41:43 2010 +0200 @@ -23,7 +23,7 @@ // INCLUDES #include #include "RoapMessage.h" -#include "DrmRightsClient.h" +#include "DRMRightsClient.h" namespace Roap { @@ -57,19 +57,19 @@ class CJoinDomainResp : public CRoapMessage { public: // Constructors and destructor - + /** * Two-phased constructor. */ static CJoinDomainResp* NewL(); - + /** * Destructor. */ virtual ~CJoinDomainResp(); public: // New functions - + /** * ?member_description. * @since Series ?XX ?SeriesXX_version @@ -87,9 +87,9 @@ * @return ?description */ //?type ?member_function( ?type ?arg1 ); - + protected: // New functions - + /** * ?member_description. * @since Series ?XX ?SeriesXX_version @@ -99,7 +99,7 @@ //?type ?member_function( ?type ?arg1 ); protected: // Functions from base classes - + /** * From ?base_class ?member_description */ @@ -129,7 +129,7 @@ TBuf8 iRiId; TBuf8 iDomainKeyRiId; RPointerArray iMacs; - + TTime iDomainExpiration; TBool iHashChainSupport; RPointerArray iDomainKeys; @@ -139,7 +139,7 @@ HBufC8* iErrorUrl; RPointerArray iDomainKeyIDs; TKeyTransportScheme iTransportScheme; - + protected: // Data // ?one_line_short_description_of_data //?data_declaration; @@ -147,7 +147,7 @@ private: // Data // ?one_line_short_description_of_data //?data_declaration; - + // Reserved pointer for future extension //TAny* iReserved; @@ -161,6 +161,6 @@ }; } -#endif // JOINDOMAINRESP_H - +#endif // JOINDOMAINRESP_H + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/roap/inc/MeteringReportReq.h --- a/omadrm/drmengine/roap/inc/MeteringReportReq.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/roap/inc/MeteringReportReq.h Mon Mar 15 12:41:43 2010 +0200 @@ -27,7 +27,7 @@ #include "RoapMessage.h" #include "RoapDef.h" #include "OmaCrypto.h" -#include "CMLACrypto.h" +#include "CmlaCrypto.h" namespace Roap { @@ -44,19 +44,19 @@ NONSHARABLE_CLASS( CMeteringReportReq ): public CRoapMessage { public: // Constructors and destructor - + /** * Two-phased constructor. */ static CMeteringReportReq* NewL(); - + /** * Destructor. */ virtual ~CMeteringReportReq(); public: // New functions - + /** * ?member_description. * @since Series ?XX ?SeriesXX_version @@ -82,9 +82,9 @@ * @return ?description */ virtual HBufC8* MessageAsXmlL(void); - + protected: // New functions - + /** * ?member_description. * @since Series ?XX ?SeriesXX_version @@ -94,7 +94,7 @@ //?type ?member_function( ?type ?arg1 ); protected: // Functions from base classes - + /** * From ?base_class ?member_description */ @@ -130,7 +130,7 @@ HBufC8* iSignature; HBufC8* iCipherValue; HBufC8* iEncryptedMekAndMak; - HBufC8* iMac; + HBufC8* iMac; // Optional nonce from the trigger HBufC8* iTriggerNonce; TKeyTransportScheme iAlgorithmInUse; @@ -142,7 +142,7 @@ private: // Data // ?one_line_short_description_of_data //?data_declaration; - + // Reserved pointer for future extension //TAny* iReserved; @@ -156,6 +156,6 @@ }; } -#endif // METERINGREPORTREQ_H - +#endif // METERINGREPORTREQ_H + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/roap/inc/RespParser.h --- a/omadrm/drmengine/roap/inc/RespParser.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/roap/inc/RespParser.h Mon Mar 15 12:41:43 2010 +0200 @@ -21,9 +21,9 @@ #define RESPPARSER_H // INCLUDES -#include -#include -#include +#include +#include +#include using namespace Xml; @@ -73,6 +73,6 @@ }; } -#endif // ROAPPARSER_H - +#endif // ROAPPARSER_H + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/roap/inc/RoapConnection.h --- a/omadrm/drmengine/roap/inc/RoapConnection.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/roap/inc/RoapConnection.h Mon Mar 15 12:41:43 2010 +0200 @@ -23,7 +23,7 @@ #include #include -#include +#include namespace Roap { diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/roap/inc/RoapParser.h --- a/omadrm/drmengine/roap/inc/RoapParser.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/roap/inc/RoapParser.h Mon Mar 15 12:41:43 2010 +0200 @@ -21,9 +21,9 @@ #define ROAPPARSER_H // INCLUDES -#include -#include -#include +#include +#include +#include #include "RoapMessage.h" using namespace Xml; diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/roap/inc/RoapSyncWrapper.h --- a/omadrm/drmengine/roap/inc/RoapSyncWrapper.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/roap/inc/RoapSyncWrapper.h Mon Mar 15 12:41:43 2010 +0200 @@ -21,7 +21,7 @@ #define CROAPSYNCWRAPPER_H #include -#include +#include /** * Synchronous wrapper for ROAP protocol suite. diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/roap/src/JoinDomainReq.cpp --- a/omadrm/drmengine/roap/src/JoinDomainReq.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/roap/src/JoinDomainReq.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,7 +19,7 @@ // INCLUDE FILES #include -#include "base64.h" +#include "Base64.h" #include "JoinDomainReq.h" #include "RoapDef.h" @@ -100,7 +100,7 @@ CJoinDomainReq* CJoinDomainReq::NewL() { CJoinDomainReq* self = new( ELeave ) CJoinDomainReq; - + CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop(); @@ -108,7 +108,7 @@ return self; } - + // Destructor CJoinDomainReq::~CJoinDomainReq() { @@ -174,7 +174,7 @@ } BufAppendL(b, KReqCertChainEnd); } - + if (iPeerKeyIdentifier.Length() || iOcspResponderKeyId || iOcspInfoStored || @@ -182,19 +182,19 @@ { BufAppendL(b, KReqExtensions); } - + if (iPeerKeyIdentifier.Length()) { BufAppendL(b, KReqPeerKey); BufAppendBase64L(b, iPeerKeyIdentifier); BufAppendL(b, KReqPeerKeyEnd); } - + if (iOcspInfoStored) { BufAppendL(b, KReqNoOcspResponse); } - + if (iOcspResponderKeyId) { BufAppendL(b, KReqOcspResponderKeyId); @@ -206,7 +206,7 @@ { BufAppendL(b, KReqHashChainSupport); } - + if (iPeerKeyIdentifier.Length() || iOcspResponderKeyId || iOcspInfoStored || diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/roap/src/LeaveDomainReq.cpp --- a/omadrm/drmengine/roap/src/LeaveDomainReq.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/roap/src/LeaveDomainReq.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,7 +19,7 @@ // INCLUDE FILES #include -#include "base64.h" +#include "Base64.h" #include "LeaveDomainReq.h" using namespace Roap; @@ -85,7 +85,7 @@ CLeaveDomainReq* CLeaveDomainReq::NewL() { CLeaveDomainReq* self = new( ELeave ) CLeaveDomainReq; - + CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop(); @@ -93,7 +93,7 @@ return self; } - + // Destructor CLeaveDomainReq::~CLeaveDomainReq() { @@ -158,7 +158,7 @@ } BufAppendL(b, KReqCertChainEnd); } - + if ( iNotMember ) { BufAppendL(b, KReqNotDomainMember); diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/roap/src/MeteringReportReq.cpp --- a/omadrm/drmengine/roap/src/MeteringReportReq.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/roap/src/MeteringReportReq.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,7 +19,7 @@ // INCLUDE FILES #include -#include "base64.h" +#include "Base64.h" #include "MeteringReportReq.h" #include "RoapLog.h" @@ -66,7 +66,7 @@ // Note the two versions below are because of different namespace // normalisation of element roap:X509SPKIHash on canonicalisation of -// whole request to be signed and on canonicalisation of element +// whole request to be signed and on canonicalisation of element // to be MAC calculated. // when changing one of these another one must be cahnges too. // @@ -103,9 +103,9 @@ // ---------------------------------------------------------------------------- // MeteringReportElementAsTextL // -// write content of to given flat buffer +// write content of to given flat buffer // Used from MessageAsXmlL and from InsertMacL -// Note content depends on value of +// Note content depends on value of // ---------------------------------------------------------------------------- LOCAL_C inline void MeteringReportElementAsTextL( CBufFlat*& aBuf, @@ -153,7 +153,7 @@ } else { - // used in mac calculation + // used in mac calculation // canonical form requires namespace definition for namespace roap Roap::CRoapMessage::BufAppendL( aBuf, KReqRoapX509AndHashNs ); } @@ -167,7 +167,7 @@ // key wrapping info Roap::CRoapMessage::BufAppendBase64L( aBuf, *aReq.iEncryptedMekAndMak ); - Roap::CRoapMessage::BufAppendL( aBuf, KReqCipherValueEnd ); + Roap::CRoapMessage::BufAppendL( aBuf, KReqCipherValueEnd ); // Insert 128-bit encrypted MAC value if ( aReq.iMac ) diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/roap/src/RegistrationReq.cpp --- a/omadrm/drmengine/roap/src/RegistrationReq.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/roap/src/RegistrationReq.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,7 +19,7 @@ // INCLUDE FILES #include -#include "base64.h" +#include "Base64.h" #include "RegistrationReq.h" using namespace Roap; @@ -107,7 +107,7 @@ CRegistrationReq* CRegistrationReq::NewL() { CRegistrationReq* self = new( ELeave ) CRegistrationReq; - + CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop(); @@ -115,7 +115,7 @@ return self; } - + // Destructor CRegistrationReq::~CRegistrationReq() { @@ -176,7 +176,7 @@ } BufAppendL(b, KReqCertChainEnd); } - + if (iTrustedAuthorities.Count() > 0) { BufAppendL(b, KReqTrustedAuthorities); @@ -186,16 +186,16 @@ BufAppendBase64L(b, *iTrustedAuthorities[i]); BufAppendL(b, KReqTrustedRootEnd); } - BufAppendL(b, KReqTrustedAuthoritiesEnd); + BufAppendL(b, KReqTrustedAuthoritiesEnd); } - + if (iServerInfo) { BufAppendL(b, KReqServerInfo); BufAppendL(b, *iServerInfo); - BufAppendL(b, KReqServerInfoEnd); + BufAppendL(b, KReqServerInfoEnd); } - + if ((iDeviceDetailsManufacturer && iDeviceDetailsModel && iDeviceDetailsVersion) || @@ -205,26 +205,26 @@ { BufAppendL(b, KReqExtensions); } - + if (iPeerKeyIdentifier.Length()) { BufAppendL(b, KReqPeerKey); BufAppendBase64L(b, iPeerKeyIdentifier); BufAppendL(b, KReqPeerKeyEnd); } - + if (iOcspInfoStored) { BufAppendL(b, KReqNoOcspResponse); } - + if (iOcspResponderKeyId) { BufAppendL(b, KReqOcspResponderKeyId); BufAppendBase64L(b, *iOcspResponderKeyId); BufAppendL(b, KReqOcspResponderKeyIdEnd); } - + if (iDeviceDetailsManufacturer != NULL && iDeviceDetailsModel != NULL && iDeviceDetailsVersion != NULL) @@ -237,7 +237,7 @@ BufAppendL(b, *iDeviceDetailsVersion); BufAppendL(b, KReqDevDetailsEnd); } - + if ((iDeviceDetailsManufacturer && iDeviceDetailsModel && iDeviceDetailsVersion) || @@ -256,4 +256,4 @@ return r; } -// End of File +// End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/roap/src/RightsReq.cpp --- a/omadrm/drmengine/roap/src/RightsReq.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/roap/src/RightsReq.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,7 +19,7 @@ // INCLUDE FILES #include -#include "base64.h" +#include "Base64.h" #include "RightsReq.h" using namespace Roap; @@ -108,7 +108,7 @@ CRightsReq* CRightsReq::NewL() { CRightsReq* self = new( ELeave ) CRightsReq; - + CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop(); @@ -116,7 +116,7 @@ return self; } - + // Destructor CRightsReq::~CRightsReq() { @@ -197,7 +197,7 @@ } BufAppendL(b, KReqCertChainEnd); } - + if (iTransTrackIDs.Count() || iPeerKeyIdentifier.Length() || iOcspResponderKeyId || @@ -205,26 +205,26 @@ { BufAppendL(b, KReqExtensions); } - + if (iPeerKeyIdentifier.Length()) { BufAppendL(b, KReqPeerKey); BufAppendBase64L(b, iPeerKeyIdentifier); BufAppendL(b, KReqPeerKeyEnd); } - + if (iOcspInfoStored) { BufAppendL(b, KReqNoOcspResponse); } - + if (iOcspResponderKeyId) { BufAppendL(b, KReqOcspResponderKeyId); BufAppendBase64L(b, *iOcspResponderKeyId); BufAppendL(b, KReqOcspResponderKeyIdEnd); } - + for ( TInt i = 0; i < iTransTrackIDs.Count() && i < iContentIDs.Count(); i++ ) { BufAppendL(b, KReqTransactionContentId); @@ -234,7 +234,7 @@ BufAppendL(b, *iTransTrackIDs[i]); BufAppendL(b, KReqTransactionIdEnd); } - + if (iTransTrackIDs.Count() || iPeerKeyIdentifier.Length() || iOcspResponderKeyId || @@ -251,4 +251,4 @@ return r; } -// End of File +// End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/roap/src/RoapConnection.cpp --- a/omadrm/drmengine/roap/src/RoapConnection.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/roap/src/RoapConnection.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -22,11 +22,11 @@ #include #include #include -#include +#include #include #include #ifdef __SERIES60_NATIVE_BROWSER -#include +#include #endif #include "RoapConnection.h" #include "RoapDef.h" diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/roap/src/RoapEng.cpp --- a/omadrm/drmengine/roap/src/RoapEng.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/roap/src/RoapEng.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -23,10 +23,10 @@ #include #ifdef RD_MULTIPLE_DRIVE -#include -#include +#include +#include #else -#include +#include #endif #ifndef __WINS__ @@ -37,7 +37,7 @@ #include #include -#include +#include #include #include #include @@ -45,7 +45,7 @@ #include // CleanupResetAndDestroyPushL dependencies #include "cleanupresetanddestroy.h" // CleanupResetAndDestroyPushL -#include "DrmRights.h" +#include "DRMRights.h" #include "RoapEng.h" #include "RoapTrigger.h" #include "wbxmlroaptriggerparser.h" @@ -72,12 +72,12 @@ #include "RoapLog.h" #include "RoapObserver.h" #include "CmlaCrypto.h" -#include "DrmRiContext.h" -#include "DrmDomainContext.h" -#include "DrmProtectedRoParser.h" +#include "DRMRIContext.h" +#include "DRMDomainContext.h" +#include "DRMProtectedRoParser.h" #include "DRMClockClient.h" #include "DcfRep.h" -#include "dcfentry.h" +#include "DcfEntry.h" #include "Base64.h" #include "drmsettingsplugininternalcrkeys.h" diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/roap/src/RoapEngBase.cpp --- a/omadrm/drmengine/roap/src/RoapEngBase.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/roap/src/RoapEngBase.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -17,8 +17,8 @@ // INCLUDE FILES -#include -#include +#include +#include // #include // from S60 #include "RoapEngBase.h" #include "RoapHttpHandler.h" @@ -27,7 +27,7 @@ #include "RoapMessage.h" #include "RoapLog.h" #include "RoapObserver.h" -#include "DrmRiContext.h" +#include "DRMRIContext.h" #include "RoapStorageClient.h" using namespace Roap; diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/roap/src/RoapHttpHandler.cpp --- a/omadrm/drmengine/roap/src/RoapHttpHandler.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/roap/src/RoapHttpHandler.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,7 +19,7 @@ // INCLUDE FILES #include #include -#include +#include #include "RoapHttpHandler.h" #include "RoapObserver.h" diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/roap/src/RoapResponse.cpp --- a/omadrm/drmengine/roap/src/RoapResponse.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/roap/src/RoapResponse.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,7 +19,7 @@ #undef _ROAP_TESTING #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif // INCLUDE FILES @@ -30,7 +30,7 @@ // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS @@ -68,7 +68,7 @@ iPdu = HBufC8::NewL( 0 ); iMultipartState = EOther; iMaxSize = -1; - } + } // ----------------------------------------------------------------------------- // CRoapResponse::NewL() @@ -101,7 +101,7 @@ { return *iPdu; } - + // ----------------------------------------------------------------------------- // CRoapResponse::PduFileName() // ----------------------------------------------------------------------------- @@ -110,7 +110,7 @@ { return iDcfFileName; } - + // ----------------------------------------------------------------------------- // CRoapResponse::SetPduFileName() // ----------------------------------------------------------------------------- @@ -119,48 +119,48 @@ const TPath& aPath ) { LOG( _L("CRoapResponse::SetDcfPathL->") ); - + RFs fs; RFile file; User::LeaveIfError( fs.Connect() ); CleanupClosePushL( fs ); - + if ( aPath.Length() > 3 ) { User::LeaveIfError( file.Temp( fs, aPath, iDcfFileName, EFileShareExclusive | EFileWrite ) ); } - else + else { - + #ifndef RD_MULTIPLE_DRIVE - + User::LeaveIfError( file.Temp( fs, KMultipartPduTempPath(), iDcfFileName, EFileShareExclusive | EFileWrite ) ); - + #else //RD_MULTIPLE_DRIVE - + _LIT( KDriveRoot, "%c:\\"); TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); - fs.DriveToChar( driveNumber, driveLetter ); - - TFileName multipartTemp; - multipartTemp.Format( KDriveRoot, (TUint)driveLetter ); - + fs.DriveToChar( driveNumber, driveLetter ); + + TFileName multipartTemp; + multipartTemp.Format( KDriveRoot, (TUint)driveLetter ); + User::LeaveIfError( file.Temp( fs, multipartTemp, iDcfFileName, EFileShareExclusive | EFileWrite ) ); - + #endif } - LOG2( _L("iDcfFileName: %S"), &iDcfFileName ); - + LOG2( _L("iDcfFileName: %S"), &iDcfFileName ); + file.Close(); CleanupStack::PopAndDestroy(); LOG( _L("CRoapResponse::SetDcfFileName <-") ); } - + // ----------------------------------------------------------------------------- // CRoapResponse::AppendPduFileDataL() // ----------------------------------------------------------------------------- @@ -170,7 +170,7 @@ { WriteL( aData ); } - + // --------------------------------------------------------- // CRoapResponse::DataType() // --------------------------------------------------------- @@ -182,7 +182,7 @@ // ----------------------------------------------------------------------------- // CRoapResponse::HandleBodyDataL -// +// // ----------------------------------------------------------------------------- // void CRoapResponse::HandleBodyDataL( @@ -200,7 +200,7 @@ { RFs fs; RFile file; - + LOG( _L(" saving DCF data") ); User::LeaveIfError( fs.Connect() ); CleanupClosePushL( fs ); @@ -215,7 +215,7 @@ // ----------------------------------------------------------------------------- // CRoapResponse::StartBodyPartL -// +// // ----------------------------------------------------------------------------- // void CRoapResponse::StartBodyPartL() @@ -240,7 +240,7 @@ // ----------------------------------------------------------------------------- // CRoapResponse::EndBodyPartL -// +// // ----------------------------------------------------------------------------- // void CRoapResponse::EndBodyPartL() @@ -248,32 +248,32 @@ LOG( _L("CRoapResponse::EndBodyPartL ->") ); LOG( _L("CRoapResponse::EndBodyPartL <-") ); } - + // ----------------------------------------------------------------------------- // CRoapResponse::SetContentNameL -// +// // ----------------------------------------------------------------------------- -// +// void CRoapResponse::SetContentNameL( const TDes& aName ) { LOG( _L("CRoapResponse::SetContentNameL") ); - + delete iContentName; iContentName = NULL; - + iContentName = aName.AllocL(); } // ----------------------------------------------------------------------------- // CRoapResponse::GetContentNameLC -// +// // ----------------------------------------------------------------------------- // void CRoapResponse::GetContentNameLC( HBufC*& aName ) const { LOG( _L("CRoapResponse::GetContentName") ); - + if ( iContentName ) aName = iContentName->AllocLC(); else @@ -281,25 +281,25 @@ } // ----------------------------------------------------------------------------- // CRoapResponse::SetMaxSize -// +// // ----------------------------------------------------------------------------- -// +// void CRoapResponse::SetMaxSize( const TInt& aSize ) { LOG( _L("CRoapResponse::SetMaxSize") ); - + iMaxSize = aSize; } // ----------------------------------------------------------------------------- // CRoapResponse::MaxSize -// +// // ----------------------------------------------------------------------------- // TInt CRoapResponse::MaxSize() const { LOG( _L("CRoapResponse::MaxSize") ); - + return iMaxSize; } diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/roap/src/RoapSigner.cpp --- a/omadrm/drmengine/roap/src/RoapSigner.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/roap/src/RoapSigner.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -26,7 +26,7 @@ #include #include #include -#include "base64.h" +#include "Base64.h" #include "RoapSigner.h" #include "RoapStorageClient.h" #include "RoapLog.h" diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/roapstorage/src/RoapStorageClient.cpp --- a/omadrm/drmengine/roapstorage/src/RoapStorageClient.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/roapstorage/src/RoapStorageClient.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -31,7 +31,7 @@ #include "DRMRIContext.h" #include "DRMDomainContext.h" #include "drmroapclientserver.h" -#include "drmrightsclient.h" +#include "DRMRightsClient.h" #include "cleanupresetanddestroy.h" // CleanupResetAndDestroyPushL // LOCAL CONSTANTS AND MACROS diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/roapstorage/src/RoapStorageServer.cpp --- a/omadrm/drmengine/roapstorage/src/RoapStorageServer.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/roapstorage/src/RoapStorageServer.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: * */ @@ -21,7 +21,7 @@ #include #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif #include "RoapStorageServer.h" @@ -29,10 +29,10 @@ #include "RoapLog.h" #include "drmroapclientserver.h" #include "drmcommonclientserver.h" -#include "drmkeystorage.h" +#include "DrmKeyStorage.h" // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS // MACROS @@ -77,42 +77,42 @@ // This function starts the actual server under TRAP harness and starts // waiting for connections. This function returns only if there has been // errors during server startup or the server is stopped for some reason. -// +// // Returns: TInt: Symbian OS error code. // ----------------------------------------------------------------------------- -LOCAL_C TInt StartRoapServer( RSemaphore& aClientSem ) +LOCAL_C TInt StartRoapServer( RSemaphore& aClientSem ) { TInt error = KErrNone; CRoapStorageServer* server = NULL; TUint8 count = 0; - do + do { ++count; TRAP( error, ( server = CRoapStorageServer::NewL() ) ); - if ( error ) + if ( error ) { User::After( TTimeIntervalMicroSeconds32(KWaitingTime) ); } - + } while( error && ( count <= KMaxStartTries ) ); - - if( error ) + + if( error ) { return error; } - + // Release the semaphore... aClientSem.Signal(); aClientSem.Close(); - + // Start waiting for connections CActiveScheduler::Start(); - + // Delete CRoapStorageServer delete server; - + return KErrNone; } @@ -121,19 +121,19 @@ // Read a file into a buffer // ----------------------------------------------------------------------------- LOCAL_C void ReadFileL( RFs& aFs, HBufC8*& aContent, const TDesC& aName ) - { - TInt size = 0; - RFile file; - - User::LeaveIfError( file.Open( aFs, aName, EFileRead ) ); - CleanupClosePushL( file ); + { + TInt size = 0; + RFile file; + + User::LeaveIfError( file.Open( aFs, aName, EFileRead ) ); + CleanupClosePushL( file ); User::LeaveIfError( file.Size( size ) ); aContent = HBufC8::NewLC( size ); TPtr8 ptr( aContent->Des() ); User::LeaveIfError( file.Read( ptr, size) ); CleanupStack::Pop(); // aContent - CleanupStack::PopAndDestroy(); // file - } + CleanupStack::PopAndDestroy(); // file + } // ============================ MEMBER FUNCTIONS =============================== @@ -147,14 +147,14 @@ CRoapStorageServer* self = new( ELeave ) CRoapStorageServer(); CleanupStack::PushL( self ); self->ConstructL(); - CleanupStack::Pop( self ); + CleanupStack::Pop( self ); return self; } // ----------------------------------------------------------------------------- // Destructor // ----------------------------------------------------------------------------- -CRoapStorageServer::~CRoapStorageServer() +CRoapStorageServer::~CRoapStorageServer() { iRFs.Close(); delete iRoapStorage; @@ -165,7 +165,7 @@ // From CActive. Complete the request and restart the scheduler. // ----------------------------------------------------------------------------- // -TInt CRoapStorageServer::RunError( TInt aError ) +TInt CRoapStorageServer::RunError( TInt aError ) { // Inform the client. Message().Complete( aError ); @@ -187,8 +187,8 @@ // Check that the versions are compatible. if ( ! User::QueryVersionSupported( TVersion( KServerMajorVersion, KServerMinorVersion, - KServerBuildVersion ), - aVersion ) ) + KServerBuildVersion ), + aVersion ) ) { // Sorry, no can do. User::Leave( KErrNotSupported ); @@ -202,59 +202,59 @@ // might leave. // ----------------------------------------------------------------------------- // -CRoapStorageServer::CRoapStorageServer() : +CRoapStorageServer::CRoapStorageServer() : CServer2( EPriorityStandard ), iRoapStorage( NULL ) { // Nothing } - + // ----------------------------------------------------------------------------- // CRoapStorageServer::ConstructL // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // -void CRoapStorageServer::ConstructL() +void CRoapStorageServer::ConstructL() { TInt err = KErrNone; - + User::RenameThread( KRoapStorageThread ); StartL( Roap::KServerName ); User::LeaveIfError(iRFs.Connect()); - + #ifndef RD_MULTIPLE_DRIVE - - iRoapStorage = CDRMContextDB::NewL( KRIContextFile(), + + iRoapStorage = CDRMContextDB::NewL( KRIContextFile(), KDomainContextFile(), iRFs ); - + #else //RD_MULTIPLE_DRIVE - + TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); - iRFs.DriveToChar( driveNumber, driveLetter ); - - TFileName riContextFile; - riContextFile.Format( KRIContextFileName, (TUint)driveLetter ); - + iRFs.DriveToChar( driveNumber, driveLetter ); + + TFileName riContextFile; + riContextFile.Format( KRIContextFileName, (TUint)driveLetter ); + TFileName domainContextFile; - domainContextFile.Format( KDomainContextFileName, (TUint)driveLetter ); - - iRoapStorage = CDRMContextDB::NewL( riContextFile, + domainContextFile.Format( KDomainContextFileName, (TUint)driveLetter ); + + iRoapStorage = CDRMContextDB::NewL( riContextFile, domainContextFile, iRFs ); - + #endif - + TRAP( err, ImportKeysL() ); } - + // ----------------------------------------------------------------------------- // CRoapStorageServer::ContextDB // Return the internal ROAP storage object // ----------------------------------------------------------------------------- -// +// CDRMContextDB* CRoapStorageServer::ContextDB() { return iRoapStorage; @@ -267,10 +267,10 @@ // at a time. The file names are DevicePrivateKey.der, DeviceCert.der and // SigningCertXX.der. // ----------------------------------------------------------------------------- -// +// void CRoapStorageServer::ImportKeysL() { - MDrmKeyStorage* storage = NULL; + MDrmKeyStorage* storage = NULL; HBufC8* privateKey = NULL; HBufC8* cert = NULL; RArray certChain; @@ -280,96 +280,96 @@ TInt i; CDir* dir = NULL; TInt err = KErrNone; - + __UHEAP_MARK; LOG( _L( "CRoapStorageServer::ImportKeysL" ) ); CleanupClosePushL( buffers ); CleanupClosePushL( certChain ); - + #ifndef RD_MULTIPLE_DRIVE - + ReadFileL( iRFs, privateKey, KDeviceKeyFileName ); - + #else //RD_MULTIPLE_DRIVE - + TFileName tempPath; TFileName tempPath2; TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); - iRFs.DriveToChar( driveNumber, driveLetter ); - - tempPath.Format( KDeviceKeyFileName, (TUint)driveLetter ); - + iRFs.DriveToChar( driveNumber, driveLetter ); + + tempPath.Format( KDeviceKeyFileName, (TUint)driveLetter ); + ReadFileL( iRFs, privateKey, tempPath ); - + #endif - + CleanupStack::PushL( privateKey ); - + #ifndef RD_MULTIPLE_DRIVE - + ReadFileL( iRFs, cert, KDeviceCertFileName ); - + #else //RD_MULTIPLE_DRIVE - - tempPath2.Format( KDeviceCertFileName, (TUint)driveLetter ); - + + tempPath2.Format( KDeviceCertFileName, (TUint)driveLetter ); + ReadFileL( iRFs, cert, tempPath2 ); - + #endif - + CleanupStack::PushL( cert ); buffers.AppendL( cert ); - + #ifndef RD_MULTIPLE_DRIVE - + iRFs.Delete( KDeviceKeyFileName ); iRFs.Delete( KDeviceCertFileName ); - + #else //RD_MULTIPLE_DRIVE - - iRFs.Delete( tempPath ); + + iRFs.Delete( tempPath ); iRFs.Delete( tempPath2 ); - + #endif - + #ifndef RD_MULTIPLE_DRIVE - + User::LeaveIfError( iRFs.GetDir( KInputFilePattern, KEntryAttNormal, ESortByName, dir ) ); - + #else //RD_MULTIPLE_DRIVE - - tempPath.Format( KInputFilePattern, (TUint)driveLetter ); - + + tempPath.Format( KInputFilePattern, (TUint)driveLetter ); + User::LeaveIfError( iRFs.GetDir( tempPath, KEntryAttNormal, ESortByName, dir ) ); - + #endif - + CleanupStack::PushL( dir ); - + for ( i = 0; i < dir->Count(); i++ ) { - + #ifndef RD_MULTIPLE_DRIVE - + fileName.Copy( KImportDir ); - + #else //RD_MULTIPLE_DRIVE - - tempPath.Format( KImportDir, (TUint)driveLetter ); - + + tempPath.Format( KImportDir, (TUint)driveLetter ); + fileName.Copy( tempPath ); - + #endif - + fileName.Append( (*dir)[i].iName ); ReadFileL( iRFs, cert, fileName ); CleanupStack::PushL( cert ); buffers.AppendL( cert ); - + iRFs.Delete( fileName ); } for ( i = 0; i < buffers.Count(); i++ ) @@ -394,21 +394,21 @@ // ----------------------------------------------------------------------------- // -TInt StartupRoapStorage( TAny* ) - { +TInt StartupRoapStorage( TAny* ) + { TInt error = KErrNone; CTrapCleanup* trap = CTrapCleanup::New(); __ASSERT_ALWAYS( trap, User::Invariant() ); - + CActiveScheduler* scheduler = new CActiveScheduler(); __ASSERT_ALWAYS( scheduler, User::Invariant() ); - + CActiveScheduler::Install( scheduler ); RSemaphore clientSem; __ASSERT_ALWAYS( clientSem.OpenGlobal( KDRMEngCommonSemaphore ) == 0, User::Invariant() ); - + error = StartRoapServer( clientSem ); - + if ( error ) { // Server creation failed. Release the semaphore. // In case of successful startup, CRoapStorageServer @@ -416,15 +416,15 @@ clientSem.Signal(); clientSem.Close(); } - - delete scheduler; + + delete scheduler; scheduler = NULL; - + delete trap; trap = NULL; - + // __ASSERT_ALWAYS( !error, User::Invariant() ); - + return KErrNone; } diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/roapstorage/src/RoapStorageSession.cpp --- a/omadrm/drmengine/roapstorage/src/RoapStorageSession.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/roapstorage/src/RoapStorageSession.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -31,7 +31,7 @@ #include #endif //RD_DRM_METERING #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif #include // CleanupResetAndDestroyPushL dependencies #include "drmaescrypto.h" @@ -41,22 +41,22 @@ #include "DRMDomainContext.h" #include "RoapStorageServer.h" #include "CmlaCrypto.h" -#include "DrmAesCrypto.h" +#include "drmaescrypto.h" #include "DrmKeyStorage.h" #include "RoapDef.h" #include "RoapLog.h" #include "drmroapclientserver.h" -#include "drmclockclient.h" -#include "DrmTypes.h" -#include "drmpointerarray.h" +#include "DRMClockClient.h" +#include "DRMTypes.h" +#include "DRMPointerArray.h" //OCSP classes -#include "roapocsp.h" +#include "RoapOcsp.h" #include "responsedecoder.h" #include "certid.h" //drm clock -#include "drmclockclient.h" +#include "DRMClockClient.h" -#include "base64.h" +#include "Base64.h" #include "cleanupresetanddestroy.h" // CleanupResetAndDestroyPushL // NAMESPACES diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/roapstorage/src/response.cpp --- a/omadrm/drmengine/roapstorage/src/response.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/roapstorage/src/response.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -21,7 +21,7 @@ #include #include -#include "roapocsp.h" +#include "RoapOcsp.h" #include "oids.h" #include "certid.h" diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/server/inc/DRMDbSession.h --- a/omadrm/drmengine/server/inc/DRMDbSession.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/server/inc/DRMDbSession.h Mon Mar 15 12:41:43 2010 +0200 @@ -23,11 +23,11 @@ #include #include #include "DRMTypes.h" -#include "DRMConstraint.h" +#include "DrmConstraint.h" #include "DRMEngineClientServer.h" #include "drmcommonclientserver.h" #include "drmenginetypedefs.h" -#include "roapstorageclient.h" +#include "RoapStorageClient.h" // CONSTANTS // MACROS diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/server/inc/DRMDbSession.inl --- a/omadrm/drmengine/server/inc/DRMDbSession.inl Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/server/inc/DRMDbSession.inl Mon Mar 15 12:41:43 2010 +0200 @@ -18,7 +18,7 @@ // INCLUDE FILES -#include "DRMConstraint.h" +#include "DrmConstraint.h" #include "DRMRightsServer.h" // ============================= LOCAL FUNCTIONS =============================== @@ -28,7 +28,7 @@ { if ( ( ( aConstraint.iActiveConstraints & EConstraintCounter ) && ( aConstraint.iCounter < 1 ) ) || - ( ( aConstraint.iActiveConstraints & + ( ( aConstraint.iActiveConstraints & EConstraintInterval ) && ( aConstraint.iIntervalStart != Time::NullTTime() ) ) ) { @@ -37,7 +37,7 @@ return EFalse; } - + // ----------------------------------------------------------------------------- // CDRMDbSession::UpdateSecureTime // Update secure time. @@ -59,4 +59,4 @@ // ========================== OTHER EXPORTED FUNCTIONS ========================= -// End of File +// End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/server/inc/DRMObsoleteFinder.h --- a/omadrm/drmengine/server/inc/DRMObsoleteFinder.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/server/inc/DRMObsoleteFinder.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,7 +22,7 @@ // INCLUDES #include -#include "drmpointerarray.h" +#include "DRMPointerArray.h" // CONSTANTS @@ -35,7 +35,7 @@ class CDir; class CDRMRightsDB; class CDcfRep; - + // FUNCTION PROTOTYPES @@ -52,7 +52,7 @@ NONSHARABLE_CLASS( CDRMObsoleteFinder ) : public CActive { public: // Constructors and destructor - + /** * NewL * @@ -62,7 +62,7 @@ * @since 3.0 * @param aFs : Open file server session * @param aDatabase : CDRMRightsDB object - * @param aStatus : The request status to complete when the operation is + * @param aStatus : The request status to complete when the operation is * fully done * @param aStream : stream to write the result into * @param aPerformScan : if a filesystem scan need to be performed @@ -75,29 +75,29 @@ TRequestStatus& aStatus, RWriteStream& aStream, TBool aPerformScan ); - + /** * Destructor */ virtual ~CDRMObsoleteFinder(); - public: // New functions + public: // New functions /** * ExecuteCleanupLD - * + * * Delete expired permissions. The object is deleted when * the function completes * * @since 3.0 * @return None * - */ + */ void ExecuteFinderLD(); - - + + void DoCleanup(); - + protected: /** * From CActive: RunL. @@ -107,28 +107,28 @@ /** * From CActive: DoCancel performs cancel - */ + */ void DoCancel(); - + /** * From CActive: RunError checks the errors from RunL. */ - TInt RunError( TInt aError ); - + TInt RunError( TInt aError ); + private: /** * Default Constructor - First phase. Prevented. */ - CDRMObsoleteFinder(); - + CDRMObsoleteFinder(); + /** * Default Constructor - First phase. */ CDRMObsoleteFinder( RFs& aFs, CDRMRightsDB* aDatabase, TRequestStatus& aStatus, - RWriteStream& aStream ); - + RWriteStream& aStream ); + /** * ConstructL * @@ -136,18 +136,18 @@ * * @since 3.0 * @return Leaves if an error occurs - */ - void ConstructL( const TBool aPerformScan ); + */ + void ConstructL( const TBool aPerformScan ); /** * Assignment operator - Prevented */ - CDRMObsoleteFinder& operator =( const CDRMObsoleteFinder& ); - + CDRMObsoleteFinder& operator =( const CDRMObsoleteFinder& ); + /** * Copy constructor - Prevented */ - CDRMObsoleteFinder( const CDRMObsoleteFinder& ); + CDRMObsoleteFinder( const CDRMObsoleteFinder& ); /** @@ -171,42 +171,42 @@ * @leave Symbian OS error code */ void ObsoleteToStreamL(); - + private: // Dcf repository client CDcfRep* iDcfClient; - + // List of content id's CDRMPointerArray* iContents; - + // List of content id's CDRMPointerArray* iParents; - + // List of content id's CDRMPointerArray* iNoContents; - + // Index we are going at: TInt iIndex; - + // fileserver session RFs& iFileServer; // output stream RWriteStream& iStream; - + // rights database file, fileserver subsession CDRMRightsDB* iRightsDb; - + // request status to be set complete TRequestStatus& iOperationStatus; - + // State of the active object TInt iState; - + // Cancelling status TInt iCancel; }; -#endif // DRMOBSOLETEFINDER_H - +#endif // DRMOBSOLETEFINDER_H + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/server/inc/DRMPointerArray.h --- a/omadrm/drmengine/server/inc/DRMPointerArray.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/server/inc/DRMPointerArray.h Mon Mar 15 12:41:43 2010 +0200 @@ -29,12 +29,12 @@ inline RDRMPointerArray( TInt aMinGrowBy, TInt aFactor ); inline RDRMPointerArray(); virtual ~RDRMPointerArray(); - - // If set to ETrue, RPointerArray::ResetAndDestroy() is called + + // If set to ETrue, RPointerArray::ResetAndDestroy() is called // automatically in destructor. Otherwise only RPointerArrary::Close() // is called. inline void SetAutoCleanup( const TBool aCleanup ); - + protected: TBool iDoResetAndDestroy; }; @@ -48,21 +48,21 @@ static CDRMPointerArray* NewL( TInt aMinGrowBy, TInt aFactor ); static CDRMPointerArray* NewLC(); static CDRMPointerArray* NewL(); - - // Note: Does not do ResetAndDestroy() by default. + + // Note: Does not do ResetAndDestroy() by default. // Use SetAutoCleanup to do reallyclean. ~CDRMPointerArray(); - - + + protected: explicit CDRMPointerArray( TInt aGranularity ); CDRMPointerArray( TInt aMinGrowBy, TInt aFactor ); - CDRMPointerArray(); - + CDRMPointerArray(); + private: }; -#include "drmpointerarray.inl" +#include "DRMPointerArray.inl" #endif // DRMPOINTERARRAY_H \ No newline at end of file diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/server/inc/DRMReplayCache.h --- a/omadrm/drmengine/server/inc/DRMReplayCache.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/server/inc/DRMReplayCache.h Mon Mar 15 12:41:43 2010 +0200 @@ -21,7 +21,7 @@ // INCLUDES #include -#include +#include // CONSTANTS // MACROS @@ -43,35 +43,35 @@ NONSHARABLE_CLASS( RDRMReplayCache ) { public: // Constructors and destructor - + /** * Constructor. * @since S60Rel3.0 */ RDRMReplayCache( RFs& aFs ); - + /** * Default constructor. * @since S60Rel3.0 */ RDRMReplayCache(); - + public: // New functions - + /** * Sets the ifs according to this reference. * * @since S60Rel3.0 - * @param aFs Reference to open file server session. + * @param aFs Reference to open file server session. */ void Set( RFs& aFs ); - + /** * Closes the cache. * @since S60Rel3.0 */ void Close(); - + /** * Initializes the view. * @since S60Rel3.0 @@ -80,13 +80,13 @@ */ void InitL( const TDesC& aTimedDb, const TDesC& aPlainDb ); - + /** * Destructor. * @since S60Rel3.0 */ ~RDRMReplayCache(); - + /** * Add an entry to the DB. Overloaded. * @since S60Rel3.0 @@ -94,7 +94,7 @@ * @param aaTime Timestamp of the permission. * @param aaTime Insertion time. */ - void AddL( const TDesC8& aID, + void AddL( const TDesC8& aID, const TTime& aTime, const TTime& aInsertionTime ); @@ -104,7 +104,7 @@ * @param aID Content-ID. * @param aaTime Insertion time. */ - void AddL( const TDesC8& aID, + void AddL( const TDesC8& aID, const TTime& aInsertionTime ); /** @@ -114,9 +114,9 @@ * @param aaTime Timestamp of the permission. * @return Boolean. */ - TBool InCacheL( const TDesC8& aCID, + TBool InCacheL( const TDesC8& aCID, const TTime& aTime ); - + /** * Checks whether an entry is in cache. Overloaded. * @since S60Rel3.0 @@ -131,9 +131,9 @@ ETimeDb, EPlainDb }; - + private: // Private functions - + /** * Initializes the database. * @since S60Rel3.0 @@ -141,7 +141,7 @@ * @param aFileName File name. * @param aId Database ID. */ - void InitDbL( RDbNamedDatabase& aDb, + void InitDbL( RDbNamedDatabase& aDb, const TDesC& aFileName, TDatabaseId aId ); @@ -151,7 +151,7 @@ * @param aDb Database. * @param aFileName File name. */ - void OpenDbL( RDbNamedDatabase& aDb, + void OpenDbL( RDbNamedDatabase& aDb, const TDesC& aFileName ); /** @@ -162,7 +162,7 @@ * @param aId Database ID. */ void ReplaceDbL( RDbNamedDatabase& aDb, - const TDesC& aFileName, + const TDesC& aFileName, TDatabaseId aId ); /** @@ -171,10 +171,10 @@ * @param aView View to initialize. * @param aDb Database ID. */ - void InitViewLC( RDbView& aView, + void InitViewLC( RDbView& aView, TDatabaseId aDb, TBool aUpdate ); - + /** * Compare the given ID to the ID in the current position of the view. * @since S60Rel3.0 @@ -183,7 +183,7 @@ * @return Boolean. */ TBool CompareCIDL( RDbRowSet& aView, const TDesC8& aCID ); - + /** * Push a cleanup item to the cleanup stack in order to rollback * the database. @@ -191,7 +191,7 @@ * @param aDb Database. */ void PushL( RDbDatabase& aDb ); - + /** * Pop the cleanup item pushed in by PushL * @since S60Rel3.0 @@ -202,36 +202,36 @@ * Delete items starting from the oldest one. * @since S60Rel3.0 * @param aView View. - * @param aHowMany How many items to delete. + * @param aHowMany How many items to delete. */ void DeleteOldestsL( RDbRowSet& aView, TInt16 aHowMany ); - + /** * Compacts the view to the upper limit of the view capacity. * @since S60Rel3.0 * @param aView View to compact. */ void CompactViewL( RDbRowSet& aView ); - + /** * Insert a content-id to the current position in the view. * @since S60Rel3.0 * @param aView View to which the insertion is made. - * @param aId ID to add. + * @param aId ID to add. */ - void InsertIdL( RDbRowSet& aView, + void InsertIdL( RDbRowSet& aView, const TDesC8& aId ); - + private: // Data // File server session handle. Not owned by this object. RFs* iFs; - + // Database for timestamped items. RDbNamedDatabase iTimeDb; - + // Database for the items without timestamp. RDbNamedDatabase iPlainDb; // RDbView iView; }; -#endif //DRMREPLAYCACHE_H \ No newline at end of file +#endif //DRMREPLAYCACHE_H \ No newline at end of file diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/server/inc/DRMRightsServer.h --- a/omadrm/drmengine/server/inc/DRMRightsServer.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/server/inc/DRMRightsServer.h Mon Mar 15 12:41:43 2010 +0200 @@ -24,9 +24,9 @@ #include #include #include "drmcommonclientserver.h" -#include "drmreplaycache.h" +#include "DRMReplayCache.h" #include "drmmeteringdb.h" -#include "drmclockclient.h" +#include "DRMClockClient.h" #include "dbwatcher.h" #include "procwatcher.h" #include "watcherobserver.h" @@ -39,7 +39,7 @@ class CDRMBackupObserver; class CDRMBackup; class RMobilePhone; - + // CLASS DECLARATION /** @@ -51,46 +51,46 @@ NONSHARABLE_CLASS( CDRMRightsServer ) : public CServer2, public MWatcherObserver { public: // Constructors and destructor - + /** * Two-phased constructor. * @since S60Rel2.5 * @return Pointer to newly created server instance. */ static CDRMRightsServer* NewL(); - + /** * Destructor. * @since S60Rel2.5 */ ~CDRMRightsServer(); - + public: // New functions /** * This method returns a handle to DRM Notifier. * @since S60Rel2.6 * @return Handle to DRM Notifier. - */ + */ CDRMNotifier& Notifier(); /** * This method starts the ROAP storage server - * + * * @since S60Rel3.0 - */ + */ void StartRoapStorageL(); - + /** * This method returns the handle to the rights database. - * + * * @since S60Rel2.6 * @return Handle to the rights database. - */ + */ CDRMRightsDB& Database(); RFs& FileServerSession(); - + /** * This method returns the handle to the metering database. * @@ -98,7 +98,7 @@ * @return Handle to the metering database. */ RDrmMeteringDb& MeteringDatabase(); - + RDRMReplayCache& ReplayCache(); /** @@ -117,23 +117,23 @@ * @return Truth value: Is the time a secure time or not. */ TBool GetSecureTime( TTime& aTime ) const; - + /** - * + * */ const TDesC& GetIMEIL(); /** - * + * */ const CDRMPointerArray& GetIMSIL(); - + /** * This function is used to handle backup restore events for * the DRM system */ - void HandleBackupEventL( TInt aBackupEvent ); - + void HandleBackupEventL( TInt aBackupEvent ); + /** * Checks if a content ID is in the list of currently consumed contents * with count constraints @@ -143,7 +143,7 @@ * @return ETrue if the content ID is in the list */ TBool HasActiveCountConstraint( const TDesC8& aContentId ); - + /** * Removes a content ID from the list of currently consumed contents * with count constraints @@ -152,7 +152,7 @@ * @param aContentId content ID to remove */ void RemoveActiveCountConstraint( const TDesC8& aContentId ); - + /** * Adds a content ID to the list of currently consumed contents * with count constraints @@ -161,7 +161,7 @@ * @param aContentId content ID to add */ void AddActiveCountConstraintL( const TDesC8& aContentId ); - + /** * Import rights objects on startup * @@ -169,7 +169,7 @@ * @param aImportDir Directory to import from */ void ImportRightsObjectsL( const TDesC& aImportDir ); - + /** * Stop watching the DCF repository server and the rights DB * @since 3.1 @@ -177,31 +177,31 @@ void StopWatchingL(); public: // Functions from base classes - + //class MBackupOperationObserver - - /** + + /** * HandleNotifyL * @since S60Rel2.5 * @param aBackupOperationAttributes Event related attributes. */ - void HandleNotifyL(const TUid aUid, const TDesC& aKey, - const TDesC& aValue); + void HandleNotifyL(const TUid aUid, const TDesC& aKey, + const TDesC& aValue); //class MWatcherObserver - - /** + + /** * Called when the RDB has been modified * * @since S60 3.0 * @param aObject Changed directory */ void WatchedObjectChangedL( const TDesC& aObject ); - + protected: // New functions - + protected: // Functions from base classes - + //class CServer /** * RunError. @@ -211,20 +211,20 @@ * error. */ TInt RunError( TInt aError ); - + private: /** * C++ default constructor. * @since S60Rel2.5 */ CDRMRightsServer(); - + /** * By default Symbian 2nd phase constructor is private. * @since S60Rel2.5 */ void ConstructL(); - + /** * This method fetches the database key and stores * it to the given descriptor. @@ -232,81 +232,81 @@ * @param aKey Descriptor where the key is stored. */ void GetDbKeyL( TDRMKey& aKey ); - - /** + + /** * This method generates the actual key from key seed. * @since S60Rel2.5 * @param aKeySeed Key seed. * @param aKey The key produced. */ - void GenerateKeyL( HBufC*& aKeySeed, + void GenerateKeyL( HBufC*& aKeySeed, TDRMKey& aKey ) const; - + void StartThreadL( const TDesC& aThreadName, - TThreadFunction aFunc, + TThreadFunction aFunc, RSemaphore& aSemaphore ); void AppendExtendedIndividualConstraintsL(RMobilePhone* aMobilePhone = NULL); - static void Release(TAny* aIndividualConstraintExtension); + static void Release(TAny* aIndividualConstraintExtension); private: // Functions from base classes // Class CServer - /** + /** * NewSessionL * @since S60Rel2.5 */ CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& aMessage) const; - + public: // Data - + protected: // Data - + private: // Data CDRMRightsDB* iDb; - + CDRMNotifier* iNotifier; - + RFs iFs; RDRMReplayCache iCache; - RDrmMeteringDb iMeteringDb; + RDrmMeteringDb iMeteringDb; RDRMClockClient iClock; RPointerArray* iXOmaHeaders; RPointerArray iActiveCountConstraints; - + HBufC* iIMEI; - + // Backup Observer CDRMBackupObserver* iBackupObserver; - + // BackupHandler CDRMBackup* iBackupHandler; - + // Backup client - conn::CActiveBackupClient* iActiveBackupClient; - + conn::CActiveBackupClient* iActiveBackupClient; + // RDB Watcher CDbWatcher* iDbWatcher; // Peer process watcher CProcWatcher* iProcWatcher; - + // Watching causes a restart TBool iArmed; - + CDRMPointerArray* iIMSI; TBool iGetImsi; - + public: // Friend classes - + protected: // Friend classes - + private: // Friend classes - + }; -#endif // CDRMRIGHTSSERVER_H +#endif // CDRMRIGHTSSERVER_H // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/server/inc/drmenginetypedefs.h --- a/omadrm/drmengine/server/inc/drmenginetypedefs.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/server/inc/drmenginetypedefs.h Mon Mar 15 12:41:43 2010 +0200 @@ -20,7 +20,7 @@ #define DRMENGINETYPEDEFS_H #include "DRMPointerArray.h" -#include "drmpermission.h" +#include "DrmPermission.h" typedef CDRMPointerArray< CDRMPermission > CDRMPermissionList; typedef RDRMPointerArray< CDRMPermission > RDRMPermissionList; diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/server/inc/drmlog.h --- a/omadrm/drmengine/server/inc/drmlog.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/server/inc/drmlog.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,7 +22,7 @@ // INCLUDES #if (defined _DEBUG || defined _LOGGING) -#include +#include #include // CONSTANTS @@ -39,6 +39,14 @@ #define DRMLOG2( a, b ) \ RFileLogger::WriteFormat(_L("drm"), DRMFLOGFILE, EFileLoggingModeAppend, a, b); \ RDebug::Print( a, b ); + +#define DRMLOG6( a, b, c, d, e, f ) \ + RFileLogger::WriteFormat(_L("drm"), DRMFLOGFILE, EFileLoggingModeAppend, a, b, c, d, e, f); \ + RDebug::Print( a, b, c, d, e, f ); + +#define DRMLOG7( a, b, c, d, e, f, g ) \ + RFileLogger::WriteFormat(_L("drm"), DRMFLOGFILE, EFileLoggingModeAppend, a, b, c, d, e, f, g); \ + RDebug::Print( a, b, c, d, e, f, g ); #define DRMLOGHEX( a ) \ RFileLogger::HexDump(_L("drm"), DRMFLOGFILE, EFileLoggingModeAppend, _S(""), _S(""), (a).Ptr(), (a).Size()); @@ -47,6 +55,8 @@ #define DRMLOG( a ) #define DRMLOG2( a, b ) +#define DRMLOG6( a, b, c, d, e, f ) +#define DRMLOG7( a, b, c, d, e, f, g ) #define DRMLOGHEX( a ) #endif // _DEBUG diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/server/inc/drmmeteringdb.h --- a/omadrm/drmengine/server/inc/drmmeteringdb.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/server/inc/drmmeteringdb.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,7 +22,8 @@ // INCLUDES #include #include -#include +#include +#include #include "DRMPointerArray.h" // CONSTANTS @@ -37,103 +38,103 @@ // CLASS DECLARATION /** -* Content metering information database. This class manages storing -* information of Content ID, Rights Issuer ID, metered count and metered -* accumulated time. +* Content metering information database. This class manages storing +* information of Content ID, Rights Issuer ID, metered count and metered +* accumulated time. * * @lib RightsServer.exe * @since 3.2 */ NONSHARABLE_CLASS( RDrmMeteringDb ) { - + public: // Constructors and destructor - + /** * Constructor. * @since S60 3.2 */ RDrmMeteringDb( RFs& aFs ); - + /** * Default constructor. * @since S60 3.2 */ RDrmMeteringDb(); - + public: // New functions - + /** * Sets the iFs according to this reference. * * @since S60 3.2 - * @param aFs Reference to open file server session. + * @param aFs Reference to open file server session. */ void Set( RFs& aFs ); - + /** * Closes the database. * @since S60 3.2 */ void Close(); - + /** * Initializes the database. * @since S60 3.2 * @param aFileName File name of the database */ void InitL( const TDesC& aFileName ); - + /** * Destructor. * @since S60 3.2 */ ~RDrmMeteringDb(); - + /** * Add a metering data entry to the database. * @since S60 3.2 * @param aMeteringData One metering data entry */ void AddL( const CDrmMeteringDbData* aMeteringData ); - - /** - * Get the metering data list based on the Rights Issuer Id from the - * metering database. Return value is ETrue if at least one entry was - * found corresponding to the given Rights Issuer Id. Return value is - * EFalse if no entry was found. The function will leave if an error - * happens in the handling of the database or if the Rights Issuer Id + + /** + * Get the metering data list based on the Rights Issuer Id from the + * metering database. Return value is ETrue if at least one entry was + * found corresponding to the given Rights Issuer Id. Return value is + * EFalse if no entry was found. The function will leave if an error + * happens in the handling of the database or if the Rights Issuer Id * is empty or too long. * @since S60 3.2 * @param aRiId Rights Issuer Id * @param aMeteringDataList Metering data list for a Rights Issuer * @return Boolean */ - TBool GetL( const TDesC8& aRiId, + TBool GetL( const TDesC8& aRiId, CDRMPointerArray< CDrmMeteringDbData >& aMeteringDataList ); - + /** - * Delete all the metering data information associated to the given + * Delete all the metering data information associated to the given * Rights Issuer Id from the metering database. Return value is ETrue - * if at least one entry was found corresponding to the given Rights - * Issuer Id. Return value is EFalse if no entry was found. The function - * will leave if an error happens in the handling of the database or if - * the Rights Issuer Id is empty or too long. + * if at least one entry was found corresponding to the given Rights + * Issuer Id. Return value is EFalse if no entry was found. The function + * will leave if an error happens in the handling of the database or if + * the Rights Issuer Id is empty or too long. * @since S60 3.2 - * @param aRiId Rights Issuer Id + * @param aRiId Rights Issuer Id * @return Boolean */ TBool DeleteL( const TDesC8& aRiId ); - + private: // Private functions - + /** * Opens a database. * @since S60 3.2 * @param aDb Database. * @param aFileName File name. */ - void OpenDbL( RDbNamedDatabase& aDb, + void OpenDbL( RDbNamedDatabase& aDb, const TDesC& aFileName ); /** @@ -151,34 +152,34 @@ * @param aView View to initialize. */ void InitViewLC( RDbView& aView ); - + /** * Compare the Rights Issuer Id and Content Id to their counterparts in - * the current row of the view. Return value is ETrue only if both the + * the current row of the view. Return value is ETrue only if both the * Content Id and the Rights Issuer Id match their counterpart Ids in - * the view. Overloaded. - * + * the view. Overloaded. + * * @since S60 3.2 * @param aView View. * @param aCID Content Id * @param aRiId Rights Issuer Id * @return Boolean */ - TBool CompareIDL( RDbRowSet& aView, - const TDesC8& aCID, + TBool CompareIDL( RDbRowSet& aView, + const TDesC8& aCID, const TDesC8& aRiId ); - + /** - * Compare the Rights Issuer Id to its counterpart in the current row - * of the view. Overloaded. - * + * Compare the Rights Issuer Id to its counterpart in the current row + * of the view. Overloaded. + * * @since S60 3.2 * @param aView View. * @param aRiId Rights Issuer Id * @return Boolean */ TBool CompareIDL( RDbRowSet& aView, const TDesC8& aRiId ); - + /** * Push a cleanup item to the cleanup stack in order to rollback * the database. @@ -186,7 +187,7 @@ * @param aDb Database. */ void PushL( RDbDatabase& aDb ); - + /** * Pop the cleanup item pushed in by PushL * @since S60 3.2 @@ -196,10 +197,10 @@ private: // Data // File server session handle. Not owned by this object. RFs* iFs; - - // Metering database + + // Metering database RDbNamedDatabase iDb; - + }; -#endif //DRMMETERINGDB_H \ No newline at end of file +#endif //DRMMETERINGDB_H \ No newline at end of file diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/server/src/DRMActiveOperation.cpp --- a/omadrm/drmengine/server/src/DRMActiveOperation.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/server/src/DRMActiveOperation.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -17,15 +17,15 @@ // INCLUDE FILES -#include "drmactiveoperation.h" +#include "DRMActiveOperation.h" #include "drmrightsdb.h" -#include "drmrightscleaner.h" -#include "drmobsoletefinder.h" -#include "drmdbsession.h" +#include "DRMRightsCleaner.h" +#include "DRMObsoleteFinder.h" +#include "DRMDbSession.h" // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS @@ -42,7 +42,7 @@ // ============================= LOCAL FUNCTIONS =============================== - + // ============================ MEMBER FUNCTIONS =============================== // ----------------------------------------------------------------------------- @@ -59,7 +59,7 @@ aSession, aOperation ); CleanupStack::PushL( self ); - + return self; } @@ -73,30 +73,30 @@ { // Close the stream iFileStream.Close(); - + if( iFileName ) { - if( iFileServer ) - { - iFileServer->Delete( *iFileName ); + if( iFileServer ) + { + iFileServer->Delete( *iFileName ); } delete iFileName; - iFileName = NULL; + iFileName = NULL; } - + if ( iActiveOperation ) { - // Construction was successful, but + // Construction was successful, but // something has went wrong. - + iActiveOperation->Cancel(); if( !iMessage.IsNull() ) { - iMessage.Complete( KErrCancel ); + iMessage.Complete( KErrCancel ); } } } - + // ----------------------------------------------------------------------------- // CDRMActiveOperation::ActivateL // @@ -107,15 +107,15 @@ const TTime& aTime ) { CActiveScheduler::Add( this ); - + - CDRMRightsCleaner* cleaner = + CDRMRightsCleaner* cleaner = aDb.DeleteExpiredPermissionsL( aTime, iStatus ); CleanupStack::PushL( cleaner ); cleaner->ExecuteCleanupLD(); CleanupStack::Pop(); SetActive(); - iActiveOperation = cleaner; + iActiveOperation = cleaner; } // ----------------------------------------------------------------------------- @@ -126,31 +126,31 @@ // void CDRMActiveOperation::ActivateL( CDRMRightsDB& aDb, RFs& aFileServer, - const TDesC& aTempPath, + const TDesC& aTempPath, const TBool aPerformScan ) { CActiveScheduler::Add( this ); iFileName = new (ELeave) TFileName; iFileServer = &aFileServer; - - User::LeaveIfError( - iFileStream.Temp( aFileServer, - aTempPath, - *iFileName, + + User::LeaveIfError( + iFileStream.Temp( aFileServer, + aTempPath, + *iFileName, EFileWrite | EFileStream ) ); - + CDRMObsoleteFinder* finder = CDRMObsoleteFinder::NewL(aFileServer, &aDb, - iStatus, + iStatus, iFileStream, aPerformScan ); CleanupStack::PushL( finder ); finder->ExecuteFinderLD(); CleanupStack::Pop(); SetActive(); - iActiveOperation = finder; - } + iActiveOperation = finder; + } // ----------------------------------------------------------------------------- // CDRMActiveOperation::Remove @@ -165,12 +165,12 @@ case EOperationExportObsolete: { static_cast(iActiveOperation)->DoCleanup(); - } - break; - default: + } + break; + default: { static_cast(iActiveOperation)->DoCleanup(); - } + } break; } } @@ -184,30 +184,30 @@ void CDRMActiveOperation::RunL() { TFileName* fileName = NULL; - + // All done. if( !iMessage.IsNull() ) { - iMessage.Complete( iStatus.Int() ); - } - + iMessage.Complete( iStatus.Int() ); + } + // iActiveOperation deletes itself. iActiveOperation = NULL; - + Deque(); - + if( iOperation == EOperationExportObsolete ) { fileName = iFileName; iFileName = NULL; - iSession.AsyncOperationDone(fileName); + iSession.AsyncOperationDone(fileName); } - else + else { - iSession.AsyncOperationDone(); + iSession.AsyncOperationDone(); } } - + // ----------------------------------------------------------------------------- // CDRMActiveOperation::DoCancel // @@ -217,8 +217,8 @@ void CDRMActiveOperation::DoCancel() { } - - + + // ----------------------------------------------------------------------------- // CDRMActiveOperation::CDRMActiveOperation @@ -237,5 +237,5 @@ { // Nothing } - + // End of file diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/server/src/DRMDbSession.cpp --- a/omadrm/drmengine/server/src/DRMDbSession.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/server/src/DRMDbSession.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -24,21 +24,21 @@ #include #include #include -#include +#include #include #include -#include // Disk space checking +#include // Disk space checking #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif #include "Oma2Agent.h" -#include "DRMPermission.h" +#include "DrmPermission.h" #include "DRMDbSession.h" -#include "drmengineclientserver.h" +#include "DRMEngineClientServer.h" #include "DRMRightsServer.h" #include "RoapStorageClient.h" #include "OmaCrypto.h" @@ -46,8 +46,8 @@ #include "DrmKeyStorage.h" #include "drmrightsdb.h" #include "drmparentstorage.h" -#include "DrmDomainContext.h" -#include "DrmRiContext.h" +#include "DRMDomainContext.h" +#include "DRMRIContext.h" #include "drmenginetypedefs.h" #include "DRMXOma.h" @@ -58,8 +58,8 @@ #include "DRMActiveOperation.h" #include "drmconsume.h" #include "drmlog.h" -#include "drmpointerarray.h" -#include "base64.h" +#include "DRMPointerArray.h" +#include "Base64.h" #ifdef RD_DRM_METERING #include "drmmeteringdbdata.h" diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/server/src/DRMObsoleteFinder.cpp --- a/omadrm/drmengine/server/src/DRMObsoleteFinder.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/server/src/DRMObsoleteFinder.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -18,26 +18,26 @@ // INCLUDE FILES -#include // RPointerArray -#include // Type definitions +#include // RPointerArray +#include // Type definitions #include -#include -#include "DRMCommon.h" // DRM Error messages +#include +#include "DRMCommon.h" // DRM Error messages #include "DRMObsoleteFinder.h" -#include "DRMRightsDB.h" +#include "drmrightsdb.h" #include "drmlog.h" -#include +#include -#include // Disk space checking +#include // Disk space checking #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS @@ -61,12 +61,12 @@ LOCAL_C TInt CompareHBufC8( const HBufC8& aFirst, const HBufC8& aSecond ) { - return aFirst.Compare( aSecond ); + return aFirst.Compare( aSecond ); }; // ============================ MEMBER FUNCTIONS =============================== - + // ----------------------------------------------------------------------------- // CDRMObsoleteFinder::NewL // Two-phased constructor. @@ -78,74 +78,74 @@ RWriteStream& aStream, TBool aPerformScan ) { - CDRMObsoleteFinder* self = new( ELeave ) CDRMObsoleteFinder( aFs, - aDatabase, aStatus, + CDRMObsoleteFinder* self = new( ELeave ) CDRMObsoleteFinder( aFs, + aDatabase, aStatus, aStream ); CleanupStack::PushL( self ); self->ConstructL( aPerformScan ); CleanupStack::Pop(); - + return self; } - - + + // ----------------------------------------------------------------------------- -// Destructor +// Destructor // ----------------------------------------------------------------------------- // CDRMObsoleteFinder::~CDRMObsoleteFinder() { // just in case Cancel(); - + if( iDcfClient ) { delete iDcfClient; - iDcfClient = NULL; + iDcfClient = NULL; } - + if( iContents ) { delete iContents; - iContents = NULL; + iContents = NULL; } if( iParents ) { delete iParents; - iParents = NULL; + iParents = NULL; } - + if( iNoContents ) { delete iNoContents; - iNoContents = NULL; - } + iNoContents = NULL; + } }; // ----------------------------------------------------------------------------- -// CDRMObsoleteFinder::ExecuteCleanupLD +// CDRMObsoleteFinder::ExecuteCleanupLD // ----------------------------------------------------------------------------- -// +// void CDRMObsoleteFinder::ExecuteFinderLD() { TRequestStatus* status = 0; - - if( !IsAdded() ) + + if( !IsAdded() ) { - CActiveScheduler::Add(this); + CActiveScheduler::Add(this); } - if ( !IsActive() ) + if ( !IsActive() ) { - SetActive(); + SetActive(); } - + iOperationStatus = KRequestPending; status = &iStatus; - User::RequestComplete(status,KErrNone); + User::RequestComplete(status,KErrNone); }; -// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // Default Constructor - First phase. // ----------------------------------------------------------------------------- // @@ -162,66 +162,66 @@ iStream( aStream ), iRightsDb( aDatabase ), iOperationStatus( aStatus ), - iState( KScanFileSystem ) + iState( KScanFileSystem ) { - - }; - + + }; -// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- // CDRMObsoleteFinder::ConstructL // ----------------------------------------------------------------------------- -// +// void CDRMObsoleteFinder::ConstructL( const TBool aPerformScan ) { // if the scan needs to be done, the initial state is different: if( aPerformScan ) { - iState = KScanFileSystem; + iState = KScanFileSystem; } else { - iState = KScanContents; - } - + iState = KScanContents; + } + // connect to dcf repository iDcfClient = CDcfRep::NewL(); - + // Create a new list - iContents = CDRMPointerArray::NewL(); - + iContents = CDRMPointerArray::NewL(); + // Create a new list - iParents = CDRMPointerArray::NewL(); + iParents = CDRMPointerArray::NewL(); // Create a new list - iNoContents = CDRMPointerArray::NewL(); - - }; + iNoContents = CDRMPointerArray::NewL(); -// ----------------------------------------------------------------------------- + }; + +// ----------------------------------------------------------------------------- // CDRMObsoleteFinder::RunError // ----------------------------------------------------------------------------- -// +// TInt CDRMObsoleteFinder::RunError(TInt aError) { TRequestStatus* status = 0; - + if( aError != KErrNone ) { status = &iOperationStatus; - User::RequestComplete( status, aError ); - delete this; + User::RequestComplete( status, aError ); + delete this; } return KErrNone; }; -// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // CDRMObsoleteFinder::RunL // ----------------------------------------------------------------------------- -// +// void CDRMObsoleteFinder::RunL() { - TRequestStatus* status = 0; + TRequestStatus* status = 0; TInt error = KErrNone; HBufC8* buffer = NULL; @@ -232,8 +232,8 @@ { case KScanFileSystem: iState = KScanContents; - iDcfClient->RefreshDcf( iStatus ); - SetActive(); + iDcfClient->RefreshDcf( iStatus ); + SetActive(); break; case KScanContents: if( iIndex == -1 ) @@ -241,94 +241,94 @@ // Get the contents iRightsDb->GetContentIDListL( *iContents ); // Reset the index - iIndex = 0; + iIndex = 0; } - else + else { - iIndex++; - } - + iIndex++; + } + if( iIndex >= iContents->Count() ) { iState = KRemoveUsedParents; - iIndex = -1; + iIndex = -1; } - else + else { // Check if there is content TRAP( error, iDcfClient->OrderListL( *(*iContents)[iIndex] )); - + // If an error occurs, leave if it's ok, continue if( error != KErrNotFound ) { - User::LeaveIfError( error ); - + User::LeaveIfError( error ); + // Get all the parents - if( !error ) + if( !error ) { - GetParentsL( *(*iContents)[iIndex], *iParents ); - } + GetParentsL( *(*iContents)[iIndex], *iParents ); + } } - // If the error is not found, add to the no content list + // If the error is not found, add to the no content list else { buffer = (*iContents)[iIndex]->AllocLC(); iNoContents->AppendL( buffer ); - CleanupStack::Pop(); - } + CleanupStack::Pop(); + } } SetActive(); status = &iStatus; - User::RequestComplete(status,KErrNone); + User::RequestComplete(status,KErrNone); break; case KRemoveUsedParents: if( iIndex == -1 ) { - iIndex = 0; + iIndex = 0; } - else + else { - iIndex++; + iIndex++; } - + if( iIndex >= iParents->Count() ) { iState = KWriteTempFile; - iIndex = -1; + iIndex = -1; } else { // Find the parent - error = iNoContents->FindInOrder( (*iParents)[iIndex], + error = iNoContents->FindInOrder( (*iParents)[iIndex], TLinearOrder(CompareHBufC8)); - + if( error != KErrNotFound ) { buffer = (*iNoContents)[error]; iNoContents->Remove( error ); delete buffer; - buffer = 0; - } + buffer = 0; + } } SetActive(); status = &iStatus; - User::RequestComplete(status,KErrNone); + User::RequestComplete(status,KErrNone); break; case KWriteTempFile: ObsoleteToStreamL(); // we are complete: status = &iOperationStatus; - User::RequestComplete( status, KErrNone ); - delete this; - return; + User::RequestComplete( status, KErrNone ); + delete this; + return; default: // illegal status, return error and delete object status = &iOperationStatus; User::RequestComplete( status, KErrGeneral ); - delete this; - return; + delete this; + return; } - }; + }; // ---------------------------------------------------------------------------- @@ -340,45 +340,45 @@ { HBufC8* parentId = NULL; TInt error = KErrNone; - CDRMPointerArray* permissions = + CDRMPointerArray* permissions = CDRMPointerArray::NewLC(); permissions->SetAutoCleanup( ETrue ); - CDRMPointerArray& perm = *permissions; + CDRMPointerArray& perm = *permissions; TRAP( error, iRightsDb->GetDBEntryByContentIDL( aContentId, *permissions ) ); - + // If there are no keys it means that there is encryption key and such, but // no available permissions if( error == KErrCANoRights ) { CleanupStack::PopAndDestroy(); // permissions - return; + return; } - else + else { - User::LeaveIfError(error); + User::LeaveIfError(error); } - + for( TInt i = 0; i < permissions->Count(); i++, error = KErrNone ) { // Check if the permission has a parent - if( perm[i]->iParentUID ) + if( perm[i]->iParentUID ) { // if it does, insert it to the aParents array - error = aParents.FindInOrder( perm[i]->iParentUID, + error = aParents.FindInOrder( perm[i]->iParentUID, TLinearOrder(CompareHBufC8)); if( error == KErrNotFound ) { parentId = perm[i]->iParentUID->AllocLC(); - User::LeaveIfError( aParents.InsertInOrder(parentId, + User::LeaveIfError( aParents.InsertInOrder(parentId, TLinearOrder(CompareHBufC8)) ); - CleanupStack::Pop(); + CleanupStack::Pop(); } } } - CleanupStack::PopAndDestroy(); // permissions - }; + CleanupStack::PopAndDestroy(); // permissions + }; // ----------------------------------------------------------------------------- @@ -402,25 +402,25 @@ #ifndef RD_MULTIPLE_DRIVE - if ( SysUtil::DiskSpaceBelowCriticalLevelL( &iFileServer, - size, + if ( SysUtil::DiskSpaceBelowCriticalLevelL( &iFileServer, + size, EDriveC ) ) - + #else //RD_MULTIPLE_DRIVE - + TInt driveNumber( -1 ); DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); - if ( SysUtil::DiskSpaceBelowCriticalLevelL( &iFileServer, - size, + if ( SysUtil::DiskSpaceBelowCriticalLevelL( &iFileServer, + size, driveNumber ) ) - + #endif { DRMLOG( _L( "CDRMDbSession::UriListToFileL: KErrDiskFull" ) ); User::Leave( KErrDiskFull ); - } + } // Write the whole stuff into the file. while( count < iNoContents->Count() ) { @@ -428,34 +428,34 @@ iStream.WriteL( *(*iNoContents)[count] ); ++count; } - // Finish with a 0 - iStream.WriteUint16L( 0 ); - + // Finish with a 0 + iStream.WriteUint16L( 0 ); + iStream.CommitL(); } -// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // CDRMObsoleteFinder::DoCancel // ----------------------------------------------------------------------------- -// +// void CDRMObsoleteFinder::DoCancel() - { - }; + { + }; -// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // CDRMObsoleteFinder::DoCleanup // ----------------------------------------------------------------------------- -// +// void CDRMObsoleteFinder::DoCleanup() { - TRequestStatus* status = 0; + TRequestStatus* status = 0; if( iCancel <= 0 ) { iCancel = 1; status = &iStatus; User::RequestComplete(status, KErrCancel); - } - }; + } + }; diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/server/src/DRMReplayCache.cpp --- a/omadrm/drmengine/server/src/DRMReplayCache.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/server/src/DRMReplayCache.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,14 +19,14 @@ // INCLUDE FILES #include -#include -#include -#include "drmreplaycache.h" +#include +#include +#include "DRMReplayCache.h" // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS @@ -46,12 +46,12 @@ LOCAL_C const TUint16 KDbMaxNumOfItems = 100; // MODULE DATA STRUCTURES -NONSHARABLE_STRUCT( TDoDeleteFile ) +NONSHARABLE_STRUCT( TDoDeleteFile ) { RFs* iFs; const TDesC* iFile; }; - + // LOCAL FUNCTION PROTOTYPES LOCAL_C void DoRollBack( TAny* aAny ); LOCAL_C void DoDeleteFile( TAny* aAny ); @@ -63,7 +63,7 @@ // ----------------------------------------------------------------------------- // DoRollBack // -// Do a rollback operation to the RDbDatabase* +// Do a rollback operation to the RDbDatabase* // ----------------------------------------------------------------------------- // LOCAL_C void DoRollBack( TAny* aAny ) @@ -80,8 +80,8 @@ LOCAL_C void DoDeleteFile( TAny* aAny ) { TDoDeleteFile* s = reinterpret_cast< TDoDeleteFile* >( aAny ); - - s->iFs->Delete( *( s->iFile ) ); + + s->iFs->Delete( *( s->iFile ) ); } // ============================ MEMBER FUNCTIONS =============================== @@ -89,7 +89,7 @@ // ----------------------------------------------------------------------------- // RDRMReplayCache::RDRMReplayCache // -// Default constructor +// Default constructor // ----------------------------------------------------------------------------- // RDRMReplayCache::RDRMReplayCache(): @@ -97,13 +97,13 @@ iTimeDb(), iPlainDb() { - // Nothing. + // Nothing. } // ----------------------------------------------------------------------------- // RDRMReplayCache::RDRMReplayCache // -// Constructor +// Constructor // ----------------------------------------------------------------------------- // RDRMReplayCache::RDRMReplayCache( RFs& aFs ) : @@ -113,14 +113,14 @@ { // Nothing. } - + // ----------------------------------------------------------------------------- // RDRMReplayCache::Set // // Set iFs to given aFs. // ----------------------------------------------------------------------------- -// +// void RDRMReplayCache::Set( RFs& aFs ) { iFs = &aFs; @@ -131,7 +131,7 @@ // // Closes the databases. // ----------------------------------------------------------------------------- -// +// void RDRMReplayCache::Close() { // iView.Close(); @@ -144,7 +144,7 @@ // // Initialize the databases. // ----------------------------------------------------------------------------- -// +// void RDRMReplayCache::InitL( const TDesC& aTimedDb, const TDesC& aPlainDb ) { @@ -159,16 +159,16 @@ // Check whether the given entry is in cache. Overloaded. // ----------------------------------------------------------------------------- // -TBool RDRMReplayCache::InCacheL( const TDesC8& aID, +TBool RDRMReplayCache::InCacheL( const TDesC8& aID, const TTime& aTime ) { TBool res = EFalse; - + RDbView view; InitViewLC( view, ETimeDb, EFalse ); - + view.FirstL(); - + while ( view.AtRow() && !res ) { view.GetL(); @@ -180,9 +180,9 @@ } view.NextL(); } - + CleanupStack::PopAndDestroy(); // view - + return res; } @@ -191,27 +191,27 @@ // // Check whether the given entry is in cache. Overloaded. // ----------------------------------------------------------------------------- -// +// TBool RDRMReplayCache::InCacheL( const TDesC8& aID ) { TBool res = EFalse; - + RDbView view; InitViewLC( view, EPlainDb, EFalse ); - + view.FirstL(); - + while ( view.AtRow() && !res ) { view.GetL(); - + res = CompareCIDL( view, aID ); - + view.NextL(); } - + CleanupStack::PopAndDestroy(); // view - + return res; } @@ -220,73 +220,73 @@ // // Add an entry to the database. Overloaded. // ----------------------------------------------------------------------------- -// -void RDRMReplayCache::AddL( const TDesC8& aID, +// +void RDRMReplayCache::AddL( const TDesC8& aID, const TTime& aTime, const TTime& aInsertionTime ) { RDbColWriteStream stream; RDbView view; - + PushL( iTimeDb ); - + InitViewLC( view, ETimeDb, ETrue ); CompactViewL( view ); - // Oldest ones are in the list earlier, and as long as clock works + // Oldest ones are in the list earlier, and as long as clock works // correctly, insertiontime(n-1)Count() != 1 || ( *tables )[ 0 ].Compare( KReplayCacheTable ) ) { User::Leave( KErrCorrupt ); } - + CleanupStack::PopAndDestroy(); // tables CleanupStack::Pop(); // aDb } @@ -360,9 +360,9 @@ // // Replace the database. // ----------------------------------------------------------------------------- -// -void RDRMReplayCache::ReplaceDbL( RDbNamedDatabase& aDb, - const TDesC& aFileName, +// +void RDRMReplayCache::ReplaceDbL( RDbNamedDatabase& aDb, + const TDesC& aFileName, TDatabaseId aId ) { CDbColSet* colSet = NULL; @@ -370,92 +370,92 @@ TDbCol cidCol( KCIDColName, EDbColLongText8 ); TDbCol insertionTimeCol( KInsertionTimeColName, EDbColInt64 ); TDbCol timeCol( KTimeColName, EDbColInt64 ); - + TDoDeleteFile deletefile = { iFs, &aFileName }; - + TCleanupItem item( DoDeleteFile, &deletefile ); CleanupStack::PushL( item ); - + User::LeaveIfError( aDb.Replace( *iFs, aFileName ) ); CleanupClosePushL( aDb ); - + // Add columns colSet = CDbColSet::NewLC(); colSet->AddL( cidCol ); colSet->AddL( insertionTimeCol ); - + if ( aId == ETimeDb ) { colSet->AddL( timeCol ); } - + User::LeaveIfError( aDb.Begin() ); User::LeaveIfError( aDb.CreateTable( KReplayCacheTable, *colSet ) ); User::LeaveIfError( aDb.Commit() ); - + CleanupStack::PopAndDestroy(); // colSet - CleanupStack::Pop(); // aDb + CleanupStack::Pop(); // aDb CleanupStack::Pop(); // item } - + // ----------------------------------------------------------------------------- // RDRMReplayCache::InitViewLC // // Initialize the view. // ----------------------------------------------------------------------------- -// -void RDRMReplayCache::InitViewLC( RDbView& aView, - TDatabaseId aId, +// +void RDRMReplayCache::InitViewLC( RDbView& aView, + TDatabaseId aId, TBool aUpdate ) { RDbDatabase* db = ( aId == ETimeDb ? &iTimeDb : &iPlainDb ); - - User::LeaveIfError( - aView.Prepare( *db, - TDbQuery( KViewInitQuery, EDbCompareCollated ), + + User::LeaveIfError( + aView.Prepare( *db, + TDbQuery( KViewInitQuery, EDbCompareCollated ), aUpdate ? RDbRowSet::EUpdatable : RDbRowSet::EReadOnly ) ); - + CleanupClosePushL( aView ); - + User::LeaveIfError( aView.EvaluateAll() ); } - + // ----------------------------------------------------------------------------- // RDRMReplayCache::CompareCIDL // // Compare whether the rowset's CID matches the given CID. // ----------------------------------------------------------------------------- -// -TBool RDRMReplayCache::CompareCIDL( RDbRowSet& aView, +// +TBool RDRMReplayCache::CompareCIDL( RDbRowSet& aView, const TDesC8& aCID ) { TBool res = EFalse; - + TInt size = aView.ColLength( KDbViewIDOrdinal ); - + RDbColReadStream colData; colData.OpenLC( aView, KDbViewIDOrdinal ); - - // The data contains also the cardinality of the CID data, but anyway... + + // The data contains also the cardinality of the CID data, but anyway... HBufC8* des = HBufC8::NewLC( colData, size ); if ( aCID.CompareC( *des ) == 0 ) { res = ETrue; } - + CleanupStack::PopAndDestroy(); // des CleanupStack::PopAndDestroy(); // colData - + return res; } - + // ----------------------------------------------------------------------------- // RDRMReplayCache::PushL // // Push a cleanup item to cleanup stack. // ----------------------------------------------------------------------------- -// +// void RDRMReplayCache::PushL( RDbDatabase& aDb ) { TCleanupItem item( DoRollBack, &aDb ); @@ -467,7 +467,7 @@ // // Pop a cleanup item pushed in by PushL. // ----------------------------------------------------------------------------- -// +// void RDRMReplayCache::Pop() { CleanupStack::Pop(); @@ -478,11 +478,11 @@ // // Delete aHowMany entries from the view. // ----------------------------------------------------------------------------- -// +// void RDRMReplayCache::DeleteOldestsL( RDbRowSet& aView, TInt16 aHowMany ) { aView.FirstL(); - + while ( aHowMany > 0 ) { aView.DeleteL(); @@ -496,11 +496,11 @@ // // Compact the view, deleting items if necessary. // ----------------------------------------------------------------------------- -// +// void RDRMReplayCache::CompactViewL( RDbRowSet& aView ) { TInt count = aView.CountL(); - + if ( count >= KDbMaxNumOfItems ) { // usually only one item is deleted, no need to use Begin/Commit. @@ -513,17 +513,17 @@ // // Insert content-ID to the view. // ----------------------------------------------------------------------------- -// -void RDRMReplayCache::InsertIdL( RDbRowSet& aView, +// +void RDRMReplayCache::InsertIdL( RDbRowSet& aView, const TDesC8& aId ) { - + RDbColWriteStream stream; stream.OpenLC( aView, KDbViewIDOrdinal ); stream << aId; - + stream.CommitL(); CleanupStack::PopAndDestroy(); // stream } - + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/server/src/DRMRightsCleaner.cpp --- a/omadrm/drmengine/server/src/DRMRightsCleaner.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/server/src/DRMRightsCleaner.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,19 +19,19 @@ // INCLUDE FILES -#include // RPointerArray -#include // Type definitions +#include // RPointerArray +#include // Type definitions #include -#include "DRMCommon.h" // DRM Error messages +#include "DRMCommon.h" // DRM Error messages #include "DRMRightsCleaner.h" -#include "DRMRightsDB.h" +#include "drmrightsdb.h" #include "drmlog.h" // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS @@ -50,7 +50,7 @@ // ============================= LOCAL FUNCTIONS =============================== // ============================ MEMBER FUNCTIONS =============================== - + // ----------------------------------------------------------------------------- // CDRMRightsCleaner::NewL // Two-phased constructor. @@ -62,56 +62,56 @@ const TDesC& aDatabasePath, const TTime& aTime ) { - CDRMRightsCleaner* self = new( ELeave ) CDRMRightsCleaner( aFs, - aDatabase, aStatus, + CDRMRightsCleaner* self = new( ELeave ) CDRMRightsCleaner( aFs, + aDatabase, aStatus, aDatabasePath, aTime ); CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop(); - + return self; } - - + + // ----------------------------------------------------------------------------- -// Destructor +// Destructor // ----------------------------------------------------------------------------- // CDRMRightsCleaner::~CDRMRightsCleaner() { // just in case Deque(); - + if( iCurrentDirectory ) { delete iCurrentDirectory; - iCurrentDirectory = NULL; + iCurrentDirectory = NULL; } }; // ----------------------------------------------------------------------------- -// CDRMRightsCleaner::ExecuteCleanupLD +// CDRMRightsCleaner::ExecuteCleanupLD // ----------------------------------------------------------------------------- -// +// void CDRMRightsCleaner::ExecuteCleanupLD() { TRequestStatus* status = 0; - - if( !IsAdded() ) + + if( !IsAdded() ) { - CActiveScheduler::Add(this); + CActiveScheduler::Add(this); } - if ( !IsActive() ) + if ( !IsActive() ) { - SetActive(); + SetActive(); } - + iOperationStatus = KRequestPending; status = &iStatus; - User::RequestComplete(status,KErrNone); + User::RequestComplete(status,KErrNone); }; -// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // Default Constructor - First phase. // ----------------------------------------------------------------------------- // @@ -128,52 +128,52 @@ iExpirationTime( aTime ), iCurrentDirectory( NULL ), iDirIndex( 0 ), - iCurrentFile( 0 ) + iCurrentFile( 0 ) { - - }; - + + }; -// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- // CDRMRightsCleaner::ConstructL // ----------------------------------------------------------------------------- -// +// void CDRMRightsCleaner::ConstructL() - { - }; + { + }; -// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // CDRMRightsCleaner::RunError // More or less just ignore all errors and call RunL again // ----------------------------------------------------------------------------- -// +// TInt CDRMRightsCleaner::RunError(TInt aError) { - TRequestStatus* status = 0; - + TRequestStatus* status = 0; + if( aError == KErrCancel ) { // we are complete: status = &iOperationStatus; - User::RequestComplete( status, KErrNone ); - delete this; + User::RequestComplete( status, KErrNone ); + delete this; return KErrNone; } - + SetActive(); status = &iStatus; - User::RequestComplete(status,KErrNone); - + User::RequestComplete(status,KErrNone); + return KErrNone; }; -// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // CDRMRightsCleaner::RunL // ----------------------------------------------------------------------------- -// +// void CDRMRightsCleaner::RunL() { - TRequestStatus* status = 0; + TRequestStatus* status = 0; TInt error = KErrNone; TFileName path; TInt modIndex = 0; @@ -181,7 +181,7 @@ // If the status of the cleaning is other than KErrNone User::LeaveIfError( iStatus.Int() ); - + if( !iCurrentDirectory || iCurrentFile >= iCurrentDirectory->Count() ) { @@ -190,58 +190,58 @@ { // we are complete: status = &iOperationStatus; - User::RequestComplete( status, KErrNone ); - delete this; - return; + User::RequestComplete( status, KErrNone ); + delete this; + return; } - + // if it exists, delete it if( iCurrentDirectory ) { delete iCurrentDirectory; iCurrentDirectory = 0; } - + TFileName path = iDatabasePath; - - + + path.Append(iDirIndex < 10 ? iDirIndex + '0' : iDirIndex + 'a' - 10); path.Append('\\'); - + error = iFileServer.GetDir(path, KEntryAttDir, ESortNone, iCurrentDirectory); DRMLOG(_L("Entering directory:")); DRMLOG( path ); - // increase the dir counter + // increase the dir counter iDirIndex++; - iCurrentFile = 0; + iCurrentFile = 0; } if( !error && iCurrentDirectory->Count() ) { modIndex = iDirIndex-1; - + path = iDatabasePath; path.Append(modIndex < 10 ? modIndex + '0' : modIndex + 'a' - 10); - path.Append('\\'); - + path.Append('\\'); + path.Append((*iCurrentDirectory)[iCurrentFile].iName); - + DRMLOG(_L("Checking file:")); DRMLOG( path ); - + // increase the file counter iCurrentFile++; - + TRAP( error, removeFile = iRightsDb->DeleteExpiredL( path, iExpirationTime ) ); if( error != KErrNone ) { DRMLOG2( _L( "CDRMRightsCleaner: error %d cleaning:" ), error ); DRMLOG( path ); } - else + else { if ( removeFile ) { @@ -249,30 +249,30 @@ DRMLOG( path ); iFileServer.Delete( path ); } - } + } } - + SetActive(); status = &iStatus; - User::RequestComplete(status, KErrNone); - }; + User::RequestComplete(status, KErrNone); + }; -// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // CDRMRightsCleaner::DoCancel // ----------------------------------------------------------------------------- -// +// void CDRMRightsCleaner::DoCancel() - { - }; + { + }; -// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // CDRMRightsCleaner::DoCleanup // ----------------------------------------------------------------------------- -// +// void CDRMRightsCleaner::DoCleanup() { - TRequestStatus* status = 0; + TRequestStatus* status = 0; if( iCancel <= 0 ) { Cancel(); @@ -280,8 +280,8 @@ SetActive(); status = &iStatus; User::RequestComplete(status, KErrCancel); - } - }; + } + }; diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/server/src/DRMRightsClient.cpp --- a/omadrm/drmengine/server/src/DRMRightsClient.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/server/src/DRMRightsClient.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -21,16 +21,16 @@ #include #include "DRMRightsClient.h" #include "DRMEngineClientServer.h" -#include "DRMPermission.h" -#include "DRMAsset.h" +#include "DrmPermission.h" +#include "DrmAsset.h" #include "drmlog.h" #ifdef __DRM_FULL -#include "RDRMHelper.h" +#include "rdrmhelper.h" #endif // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS // MACROS @@ -51,45 +51,45 @@ struct TDRMFileDeletion { TDRMFileDeletion() : iName( KNullDesC ) {}; - ~TDRMFileDeletion() + ~TDRMFileDeletion() { if ( iName.Length() ) { iFs.Delete( iName ); } - + iFs.Close(); } - + RFs iFs; TFileName iName; }; template< class T > struct RDRMArrayReset { - RDRMArrayReset( T& aItem ) : iItem( aItem ), + RDRMArrayReset( T& aItem ) : iItem( aItem ), iCleanup( ResetAndDestroy, ( TAny* )this ) {}; ~RDRMArrayReset() { }; - void PushL() + void PushL() { CleanupStack::PushL( iCleanup ); }; - - static void ResetAndDestroy( TAny* aSelf ) + + static void ResetAndDestroy( TAny* aSelf ) { - ( ( RDRMArrayReset< T >* )( aSelf ) )->iItem.ResetAndDestroy(); + ( ( RDRMArrayReset< T >* )( aSelf ) )->iItem.ResetAndDestroy(); ( ( RDRMArrayReset< T >* )( aSelf ) )->iItem.Close(); }; - - private: + + private: RDRMArrayReset(); // prohibit - + private: T& iItem; TCleanupItem iCleanup; - + }; - + // LOCAL FUNCTION PROTOTYPES // FORWARD DECLARATIONS @@ -108,7 +108,7 @@ iPtr( NULL ) { } - + // ----------------------------------------------------------------------------- // RDRMRightsClient::~RDRMRightsClient // Destructor. @@ -116,7 +116,7 @@ // EXPORT_C RDRMRightsClient::~RDRMRightsClient() { - } + } // ----------------------------------------------------------------------------- // RDRMRightsClient::Connect @@ -126,45 +126,45 @@ EXPORT_C TInt RDRMRightsClient::Connect() { TInt ret = KErrNone; - TUint8 count = 0; - - const TVersion requiredVersion( + TUint8 count = 0; + + const TVersion requiredVersion( DRMEngine::KServerMajorVersion, DRMEngine::KServerMinorVersion, DRMEngine::KServerBuildVersion ); - + FOREVER { DRMLOG( _L( "RDRMRightsClient::Connect(): Create a new session" ) ); ret = CreateSession( DRMEngine::KServerName, - requiredVersion, + requiredVersion, KMaxMessageSlots ); - + if ( ret == KErrNotFound && count < KStartupCount ) { ret = StartServer(); if ( ret ) { - break; + break; } - + ++count; } else { - break; + break; } } #ifdef __DRM_FULL - // startup code, if it starts it starts if not it will be tried again. + // startup code, if it starts it starts if not it will be tried again. RDRMHelper helper; TInt ignore = helper.Connect(); // Start HelperServer - helper.Close(); -#endif + helper.Close(); +#endif DRMLOG2( _L( "RDRMRightsClient::Connect(): Result: %d" ), ret ); - + return ret; } @@ -173,7 +173,7 @@ // Closes the connection to the server. // ----------------------------------------------------------------------------- // -EXPORT_C void RDRMRightsClient::Close() +EXPORT_C void RDRMRightsClient::Close() { DRMLOG( _L( "RDRMRightsClient::Close()" ) ); RHandleBase::Close(); @@ -182,14 +182,14 @@ EXPORT_C TInt RDRMRightsClient::StartServer() { DRMLOG( _L( "RDRMRightsClient::StartServer()" ) ); - + RSemaphore semaphore; RSemaphore semaphore2; TFindServer server( DRMEngine::KServerName ); TFullName name; RProcess process; TInt error = KErrNone; - + // "local" semaphore error = semaphore2.CreateGlobal( KRightsServerStarterSemaphore, // name 1 , // count @@ -198,7 +198,7 @@ if ( error == KErrAlreadyExists ) { error = semaphore2.OpenGlobal( KRightsServerStarterSemaphore ); - } + } // Semaphore not created or opened, don't need to close @@ -206,61 +206,61 @@ { return error; } - - // Server updated semaphore + + // Server updated semaphore error = semaphore.CreateGlobal( DRMEngine::KDRMSemaphore, // name 0 , // count EOwnerThread ); // owner - + if ( error == KErrAlreadyExists ) { error = semaphore.OpenGlobal( DRMEngine::KDRMSemaphore ); - } - + } + // Semaphore not created or opened, don't need to close if( error ) { semaphore2.Close(); return error; } - + // Wait until server has done all its things. semaphore2.Wait(); - + // Check if the server is already running. error = server.Next( name ); - + if ( !error ) { // Yep, it's already running. error = KErrNone; } - else + else { error = process.Create( KServerFileName, KNullDesC ); - + if ( !error ) { User::After( 1000 ); - + process.Resume(); process.Close(); - + // Wait here for the server process startup to complete // server will signal the global semaphore semaphore.Wait(); } } - - // Close both semaphores and signal the "local" one. - semaphore.Close(); + + // Close both semaphores and signal the "local" one. + semaphore.Close(); semaphore2.Signal(); - semaphore2.Close(); - + semaphore2.Close(); + DRMLOG2( _L( "RDRMRightsClient::StartServer(): %d" ), error ); - return error; - + return error; + } // ----------------------------------------------------------------------------- @@ -270,21 +270,21 @@ // EXPORT_C TInt RDRMRightsClient::AddRecord( const TDesC8& aCEK, // Content encryption key // The rights object which is to be added - const CDRMPermission& aRightsObject, - const TDesC8& aCID, // Content-ID + const CDRMPermission& aRightsObject, + const TDesC8& aCID, // Content-ID TDRMUniqueID& aID ) // Unique ID, out-parameter { DRMLOG( _L( "RDRMRightsClient::AddRecord" ) ); TInt error = KErrArgument; - + // Check the parameters. if ( aCEK.Length() ) { - + HBufC8* rightsData = NULL; TRAP( error, rightsData = aRightsObject.ExportL() ); TInt size = aRightsObject.Size(); - + if ( rightsData && size > 0 ) { // For C/S communications. @@ -292,21 +292,21 @@ TPtr8 uid( reinterpret_cast< TUint8* >( &aID ), 0, sizeof( TDRMUniqueID ) ); - + rightsObject.Set( const_cast< TUint8* >( rightsData->Ptr() ), size, size ); - - + + // Send the message. - error = SendReceive( DRMEngine::EAddRecord, + error = SendReceive( DRMEngine::EAddRecord, TIpcArgs( &aCID, &rightsObject, &aCEK, &uid ) ); - + delete rightsData; rightsData = NULL; } } - + DRMLOG2( _L( "RDRMRightsClient::AddRecord: %d" ), error ); return error; } @@ -325,33 +325,33 @@ TDRMUniqueID& aID ) // Unique ID, out-parameter { DRMLOG( _L( "RDRMRightsClient::AddProtectedRecord" ) ); - - TInt error = KErrNone; - TInt message = DRMEngine::EAddProtectedRecord; - HBufC8* rightsData = NULL; - TInt size = aRightsObject.Size(); - TPtr8 rightsObject( NULL, 0 ); - TPtr8 uid( reinterpret_cast< TUint8* >( &aID ), 0, - sizeof( TDRMUniqueID ) ); - TPtr8 key( NULL, 0 ); - - TRAP( error, rightsData = aRightsObject.ExportL() ); - if ( !error ) - { - rightsObject.Set( const_cast< TUint8* >( rightsData->Ptr() ), size, + + TInt error = KErrNone; + TInt message = DRMEngine::EAddProtectedRecord; + HBufC8* rightsData = NULL; + TInt size = aRightsObject.Size(); + TPtr8 rightsObject( NULL, 0 ); + TPtr8 uid( reinterpret_cast< TUint8* >( &aID ), 0, + sizeof( TDRMUniqueID ) ); + TPtr8 key( NULL, 0 ); + + TRAP( error, rightsData = aRightsObject.ExportL() ); + if ( !error ) + { + rightsObject.Set( const_cast< TUint8* >( rightsData->Ptr() ), size, size ); - - if ( aDomainRecord ) + + if ( aDomainRecord ) { message = DRMEngine::EAddDomainRecord; - } + } error = SendReceive( message, TIpcArgs( &aCID, &rightsObject, &aProtectedCek, &uid ) ); delete rightsData; rightsData = NULL; } - DRMLOG2( _L( "RDRMRightsClient::AddProtectedRecord: %d" ), error ); - return error; + DRMLOG2( _L( "RDRMRightsClient::AddProtectedRecord: %d" ), error ); + return error; } // ----------------------------------------------------------------------------- @@ -365,28 +365,28 @@ { DRMLOG( _L( "RDRMRightsClient::GetDBEntries" ) ); if( aId.Length() ) - { + { // Temporary file name from the server. TDRMFileDeletion item; - + // Make sure that the array is empty. aRightsList.ResetAndDestroy(); - + // For file operations. Destructor of TDRMFileDeletion // deletes the file & closes the session. - User::LeaveIfError( item.iFs.Connect() ); - - User::LeaveIfError( SendReceive( DRMEngine::EGetEntryList, + User::LeaveIfError( item.iFs.Connect() ); + + User::LeaveIfError( SendReceive( DRMEngine::EGetEntryList, TIpcArgs( &item.iName, &aId ) ) ); - + // Convert the file to a list. FileToListL( item.iFs, item.iName, aRightsList ); - - DRMLOG( _L( "RDRMRightsClient::GetDBEntries ok" ) ); - + + DRMLOG( _L( "RDRMRightsClient::GetDBEntries ok" ) ); + return; } - + // Invalid parameter. User::Leave( KErrArgument ); } @@ -400,7 +400,7 @@ const TDRMUniqueID& aUniqueID ) { DRMLOG( _L( "RDRMRightsClient::GetDbEntryL" ) ); - + CDRMPermission* permission = NULL; TInt size = 0; TPckg package( size ); @@ -414,12 +414,12 @@ size ); User::LeaveIfError( SendReceive( DRMEngine::EGetPreparedData, TIpcArgs( &objectPkg) ) ); - + permission = CDRMPermission::NewLC(); permission->ImportL( rightsData->Des() ); CleanupStack::Pop(); // permission CleanupStack::PopAndDestroy(); // Rights data - + DRMLOG( _L( "RDRMRightsClient::GetDbEntryL ok" ) ); return permission; } @@ -432,16 +432,16 @@ EXPORT_C TInt RDRMRightsClient::DeleteDbEntry( const TDesC8& aContentID ) { DRMLOG( _L( "RDRMRightsClient::DeleteDbEntry with CID" ) ); - + TInt error = KErrArgument; - + // Check the parameter. if ( aContentID.Length() ) { - return SendReceive( DRMEngine::EDeleteWithCID, + return SendReceive( DRMEngine::EDeleteWithCID, TIpcArgs( NULL, NULL, &aContentID ) ); } - + return error; } @@ -454,26 +454,26 @@ const TDRMUniqueID& aUniqueID ) { DRMLOG( _L( "RDRMRightsClient::DeleteDbEntry with CID & UID" ) ); - + if ( aContentID.Length() ) { // Something to do. // Put aUniqueID inside a descriptor. // Works even if its typedef is changed. - TPtrC8 uid( reinterpret_cast< TUint8* >( + TPtrC8 uid( reinterpret_cast< TUint8* >( const_cast< TDRMUniqueID* >( &aUniqueID ) ), sizeof( TDRMUniqueID ) ); - - return SendReceive( DRMEngine::EDeleteRO, + + return SendReceive( DRMEngine::EDeleteRO, TIpcArgs( &uid, NULL, NULL, &aContentID ) ); } - + return KErrArgument; } // ----------------------------------------------------------------------------- // RDRMRightsClient::ExportContentIDList -// Overloaded method: requests all content IDs to be put to a file. +// Overloaded method: requests all content IDs to be put to a file. // Assumes that the given descriptor represents a buffer large enough to // contain the file name. // ----------------------------------------------------------------------------- @@ -481,15 +481,15 @@ EXPORT_C TInt RDRMRightsClient::ExportContentIDList( TDes& aFileName ) { DRMLOG( _L( "RDRMRightsClient::ExportContentIDLis" ) ); - - return SendReceive( DRMEngine::EExportCIDs, + + return SendReceive( DRMEngine::EExportCIDs, TIpcArgs( &aFileName ) ); - + } // ----------------------------------------------------------------------------- // RDRMRightsClient::ExportContentIDList -// Overloaded method: requests all content IDs to be put to a file, +// Overloaded method: requests all content IDs to be put to a file, // and then converts the file into RPointerArray. // ----------------------------------------------------------------------------- // @@ -498,7 +498,7 @@ DRMLOG( _L( "RDRMRightsClient::ExportContentIDList to array" ) ); TFileName name; aCIDList.ResetAndDestroy(); - + TInt error = ExportContentIDList( name ); if ( !error ) { @@ -511,14 +511,14 @@ { aCIDList.ResetAndDestroy(); } - + fs.Delete( name ); fs.Close(); } } - + DRMLOG2( _L( "RDRMRightsClient::ExportContentIDList: %d" ), error ); - + return error; } @@ -540,11 +540,11 @@ SendReceive( DRMEngine::EGetKey, TIpcArgs( aIntent, const_cast(&aContentID), &aKey ), status ); - + User::WaitForRequest( status ); DRMLOG2( _L( "RDRMRightsClient::GetDecryptionKey: %d" ), status.Int() ); - + return status.Int(); } @@ -560,16 +560,16 @@ { TInt error = KErrNone; TInt size = 0; - + TPckg package( size ); TPckg package2( aRejection ); - + DRMLOG( _L( "RDRMRightsClient::CheckRights" ) ); error = SendReceive( DRMEngine::ECheckRights, TIpcArgs( aIntent, &aContentID, &package, &package2 ) ); - + DRMLOG2( _L( "RDRMRightsClient::CheckRights: %d" ), error ); - + return error; } @@ -587,10 +587,10 @@ TInt r; TInt size = 0; TPckg package( size ); - TPckg package2( aRejection ); + TPckg package2( aRejection ); CDRMPermission* permission = NULL; HBufC8* buffer = NULL; - + DRMLOG( _L( "RDRMRightsClient::GetActiveRightsL" ) ); r = SendReceive( DRMEngine::ECheckRights, TIpcArgs( aIntent, &aContentID, &package, &package2 ) ); @@ -613,7 +613,7 @@ { User::Leave( r ); } - + DRMLOG( _L( "RDRMRightsClient::GetActiveRightsL: done" ) ); return permission; } @@ -631,21 +631,21 @@ TInt count = 0; TInt error = KErrNone; - + TPtr8 ptr( reinterpret_cast< TUint8* >( &count ), - 0, + 0, sizeof( TInt ) ); - - error = SendReceive( DRMEngine::ECount, + + error = SendReceive( DRMEngine::ECount, TIpcArgs( &ptr ) ); - + if ( !error ) { error = count; } - + DRMLOG2( _L( "RDRMRightsClient::Count: %d" ), error ); - + return error; } @@ -657,11 +657,11 @@ EXPORT_C TInt RDRMRightsClient::DeleteAll() { DRMLOG( _L( "RDRMRightsClient::DeleteAll" ) ); - - TInt error = SendReceive( DRMEngine::EDeleteAll, TIpcArgs( NULL ) ); + + TInt error = SendReceive( DRMEngine::EDeleteAll, TIpcArgs( NULL ) ); DRMLOG2( _L( "RDRMRightsClient::DeleteAll: %d" ), error ); - + return error; } @@ -670,13 +670,13 @@ // Consume the right with specific intent and contentID // ----------------------------------------------------------------------------- // -EXPORT_C TInt RDRMRightsClient::Consume( const TInt aIntent, +EXPORT_C TInt RDRMRightsClient::Consume( const TInt aIntent, const TDesC8& aContentID ) { TInt error = KErrNone; DRMLOG( _L( "RDRMRightsClient::Consume" ) ); - - error = SendReceive( DRMEngine::EConsume, + + error = SendReceive( DRMEngine::EConsume, TIpcArgs( aIntent, &aContentID ) ); DRMLOG2( _L( "RDRMRightsClient::Consume: %d" ), error ); @@ -688,13 +688,13 @@ // Check if Consume is possibke // ----------------------------------------------------------------------------- // -EXPORT_C TInt RDRMRightsClient::CheckConsume( const TInt aIntent, +EXPORT_C TInt RDRMRightsClient::CheckConsume( const TInt aIntent, const TDesC8& aContentID ) { TInt error = KErrNone; DRMLOG( _L( "RDRMRightsClient::CheckConsume" ) ); - - error = SendReceive( DRMEngine::ECheckConsume, + + error = SendReceive( DRMEngine::ECheckConsume, TIpcArgs( aIntent, &aContentID ) ); DRMLOG2( _L( "RDRMRightsClient::CheckConsume: %d" ), error ); @@ -717,7 +717,7 @@ // ----------------------------------------------------------------------------- // RDRMRightsClient:: -// +// // ----------------------------------------------------------------------------- // EXPORT_C TInt RDRMRightsClient::ForwardLockURI( HBufC8*& aURI ) @@ -726,20 +726,20 @@ TBuf8< DRMEngine::KMaxOmaV1CIDLength > buf; TInt error = SendReceive( DRMEngine::EGetFLUri, TIpcArgs( &buf ) ); - + if ( error ) { aURI = NULL; return error; } - + aURI = buf.Alloc(); if ( aURI ) { return KErrNone; } - + return KErrNoMemory; } @@ -749,23 +749,23 @@ // Add domain rights object xml representation to the rdb // ----------------------------------------------------------------------------- // -EXPORT_C TInt RDRMRightsClient::AddDomainRO( const TDesC8& aRoId, +EXPORT_C TInt RDRMRightsClient::AddDomainRO( const TDesC8& aRoId, const TDesC8& aXmlData ) { DRMLOG( _L( "RDRMRightsClient::AddDomainRO" ) ); TInt error = KErrArgument; - + // Check the parameters. if ( aRoId.Length() && aXmlData.Length() ) - { + { // Send the message. - error = SendReceive( DRMEngine::EAddDomainRO, + error = SendReceive( DRMEngine::EAddDomainRO, TIpcArgs( &aRoId, &aXmlData) ); } - + DRMLOG2( _L( "RDRMRightsClient::AddDomainRO: %d" ), error ); - return error; - }; + return error; + }; // ----------------------------------------------------------------------------- // RDRMRightsClient::GetDomainROL @@ -775,37 +775,37 @@ EXPORT_C HBufC8* RDRMRightsClient::GetDomainROL( const TDesC8& aRoId ) { DRMLOG( _L( "RDRMRightsClient::GetDomainROL" ) ); - + // Check the parameter. if ( aRoId.Length() ) { TInt size = 0; TPckg package( size ); - + // Call the server. Throw an exception in case of an error. - User::LeaveIfError( - SendReceive( DRMEngine::EGetDomainRO, + User::LeaveIfError( + SendReceive( DRMEngine::EGetDomainRO, TIpcArgs( &package, &aRoId ) ) ); HBufC8* roData = HBufC8::NewMaxLC( size ); - + // Package 'object' into TPtr8. TPtr8 objectPkg( const_cast< TUint8* >( roData->Ptr() ), size, size ); - User::LeaveIfError( - SendReceive( DRMEngine::EGetPreparedData, + User::LeaveIfError( + SendReceive( DRMEngine::EGetPreparedData, TIpcArgs( &objectPkg) ) ); - CleanupStack::Pop( roData ); // roData + CleanupStack::Pop( roData ); // roData return roData; } - + User::Leave( KErrArgument ); - + // Never reached. - return NULL; - }; + return NULL; + }; // ----------------------------------------------------------------------------- // RDRMRightsClient::GetDomainROL @@ -823,7 +823,7 @@ TInt roSize; TInt offset; - + DRMLOG(_L("RDRMRightsClient::GetDomainRoForCidL")); User::LeaveIfError(SendReceive(DRMEngine::EGetDomainRoForCid, TIpcArgs(&aContentId, &pkg))); @@ -839,64 +839,64 @@ while (offset < size) { Mem::Copy( &roSize, ptr.Ptr()+offset, sizeof(TInt) ); - offset += sizeof (TInt); + offset += sizeof (TInt); ro = ptr.Mid(offset, roSize).AllocL(); aRoList.Append(ro); offset += roSize; } CleanupStack::PopAndDestroy(); } - }; + }; // ----------------------------------------------------------------------------- // RDRMRightsClient:: -// +// // ----------------------------------------------------------------------------- // EXPORT_C TInt RDRMRightsClient::Encrypt( const TDesC8& aIv, TPtr8& aData, TBool aAddPadding ) { - return SendReceive( DRMEngine::EEncrypt, + return SendReceive( DRMEngine::EEncrypt, TIpcArgs( &aIv, &aData, aAddPadding ) ); - } + } // ----------------------------------------------------------------------------- // RDRMRightsClient:: -// +// // ----------------------------------------------------------------------------- // EXPORT_C TInt RDRMRightsClient::Decrypt( const TDesC8& aIv, TPtr8& aData, TBool aRemovePadding ) { - return SendReceive( DRMEngine::EDecrypt, + return SendReceive( DRMEngine::EDecrypt, TIpcArgs( &aIv, &aData, aRemovePadding ) ); - } + } // ----------------------------------------------------------------------------- // RDRMRightsClient:: -// +// // ----------------------------------------------------------------------------- // EXPORT_C TInt RDRMRightsClient::InitializeKey( const TDesC8& aContentId ) { - return SendReceive( DRMEngine::EInitializeKey, + return SendReceive( DRMEngine::EInitializeKey, TIpcArgs( &aContentId ) ); } // ----------------------------------------------------------------------------- // RDRMRightsClient:: -// +// // ----------------------------------------------------------------------------- // EXPORT_C TInt RDRMRightsClient::InitializeGroupKey( const TDesC8& aGroupId, const TDesC8& aGroupKey, TEncryptionMethod aMethod ) { - return SendReceive( DRMEngine::EInitializeGroupKey, + return SendReceive( DRMEngine::EInitializeGroupKey, TIpcArgs( &aGroupId, &aGroupKey, aMethod ) ); - } + } // ----------------------------------------------------------------------------- // RDRMRightsClient::DeleteDomainRO @@ -906,21 +906,21 @@ EXPORT_C TInt RDRMRightsClient::DeleteDomainRO( const TDesC8& aRoId ) { DRMLOG( _L( "RDRMRightsClient::DeleteDomainRO" ) ); - + // Check the parameter. if ( aRoId.Length() ) { - return SendReceive( DRMEngine::EDeleteDomainRO, + return SendReceive( DRMEngine::EDeleteDomainRO, TIpcArgs( &aRoId ) ); } - - return KErrArgument; - }; + + return KErrArgument; + }; // ----------------------------------------------------------------------------- // RDRMRightsClient:: -// +// // ----------------------------------------------------------------------------- // EXPORT_C TInt RDRMRightsClient::IsInCache( const TDesC8& aID, @@ -930,68 +930,68 @@ DRMLOG( _L( "RDRMRightsClient::IsInCache" ) ); TPckgC< TTime > timePckg( aTime ); TPckg< TBool > inCache( aInCache ); - + return SendReceive( DRMEngine::EIsInCache, TIpcArgs( &aID, &timePckg, &inCache ) ); } - + // ----------------------------------------------------------------------------- // RDRMRightsClient:: -// +// // ----------------------------------------------------------------------------- // EXPORT_C TInt RDRMRightsClient::IsInCache( const TDesC8& aID, TBool& aInCache ) { DRMLOG( _L( "RDRMRightsClient::IsInCache" ) ); - + TPckg< TBool > inCache( aInCache ); - + return SendReceive( DRMEngine::EIsInCache, TIpcArgs( &aID, NULL, &inCache ) ); } - + // ----------------------------------------------------------------------------- // RDRMRightsClient:: -// +// // ----------------------------------------------------------------------------- // EXPORT_C TInt RDRMRightsClient::AddToCache( const TDesC8& aID, const TTime& aTime ) { DRMLOG( _L( "RDRMRightsClient::AddToCache" ) ); - + TPckgC< TTime > timePckg( aTime ); - + return SendReceive( DRMEngine::EAddToCache, TIpcArgs( &aID, &timePckg ) ); } // ----------------------------------------------------------------------------- // RDRMRightsClient:: -// +// // ----------------------------------------------------------------------------- // EXPORT_C TInt RDRMRightsClient::AddToCache( const TDesC8& aID ) { DRMLOG( _L( "RDRMRightsClient::AddToCache" ) ); - + return SendReceive( DRMEngine::EAddToCache, TIpcArgs( &aID, NULL ) ); } // ----------------------------------------------------------------------------- // RDRMRightsClient::DeleteExpiredPermissions -// +// // ----------------------------------------------------------------------------- // EXPORT_C void RDRMRightsClient::DeleteExpiredPermissions( TRequestStatus& aStatus ) { DRMLOG( _L( "RDRMRightsClient::DeleteExpiredPermissions" ) ); - + SendReceive( DRMEngine::EDeleteExpired, aStatus ); } - + // ----------------------------------------------------------------------------- // RDRMRightsClient::SetEstimatedArrival // sets the estimated RO arrival time to the given delta @@ -1004,13 +1004,13 @@ TInt error = KErrNone; TPckg< TTimeIntervalSeconds > delta( aDeltaSeconds ); - - error = SendReceive( DRMEngine::ESetEstimatedArrival, + + error = SendReceive( DRMEngine::ESetEstimatedArrival, TIpcArgs( &aContentID, &delta ) ); - - return error; + + return error; }; - + // ----------------------------------------------------------------------------- // RDRMRightsClient::GetEstimatedArrival // sets the amount of time in which the RO should arrive in @@ -1023,14 +1023,14 @@ TInt error = KErrNone; TPckg< TTimeIntervalSeconds > delta( aDeltaSeconds ); - - error = SendReceive( DRMEngine::EGetEstimatedArrival, + + error = SendReceive( DRMEngine::EGetEstimatedArrival, TIpcArgs( &aContentID, &delta ) ); - - return error; - }; - - + + return error; + }; + + // ----------------------------------------------------------------------------- // RDRMRightsClient::SetName // sets the name. @@ -1043,18 +1043,18 @@ return SendReceive( DRMEngine::ESetName, TIpcArgs( &aContentID, &aName ) ); } - + // ----------------------------------------------------------------------------- // RDRMRightsClient::GetName // Gets the name. Two-phase operation. // ----------------------------------------------------------------------------- -// +// EXPORT_C TInt RDRMRightsClient::GetName( const TDesC8& aContentID, HBufC*& aName ) { DRMLOG( _L( "RDRMRightsClient::GetName" ) ); TPckgBuf< TInt > size( 0 ); - + TInt error = SendReceive( DRMEngine::EGetName, TIpcArgs( &aContentID, &size ) ); if ( !error ) @@ -1073,10 +1073,10 @@ if ( aName ) { TPtr data( aName->Des() ); - + error = SendReceive( DRMEngine::EGetWideData, TIpcArgs( &data ) ); - + if ( error ) { delete aName; aName = NULL; @@ -1088,47 +1088,47 @@ } } } - + return error; } // ----------------------------------------------------------------------------- // RDRMRightsClient::Cancel // ----------------------------------------------------------------------------- -// +// EXPORT_C void RDRMRightsClient::Cancel() { DRMLOG( _L(" RDRMRightsClient::Cancel" ) ); SendReceive( DRMEngine::ECancel ); } - - + + // ----------------------------------------------------------------------------- // RDRMRightsClient::GetUdtData // ----------------------------------------------------------------------------- -// +// EXPORT_C TInt RDRMRightsClient::GetUdtData( TDes8& aUdtData ) { DRMLOG( _L( "RDRMRightsClient::GetUdtData" ) ); - + TInt error = SendReceive( DRMEngine::EGetUdtData, TIpcArgs( &aUdtData ) ); - - return error; - }; + + return error; + }; // ----------------------------------------------------------------------------- // RDRMRightsClient::InitializeUdt // ----------------------------------------------------------------------------- -// +// EXPORT_C TInt RDRMRightsClient::InitiateUdt( const TDesC8& aKey ) { DRMLOG( _L( "RDRMRightsClient::InitiateUdt" ) ); - + TInt error = SendReceive( DRMEngine::EInitiateUdt, - TIpcArgs( &aKey ) ); - return error; - }; + TIpcArgs( &aKey ) ); + return error; + }; // ----------------------------------------------------------------------------- // RDRMRightsClient::InitOrphanedContentIdList @@ -1138,38 +1138,38 @@ TRequestStatus& aStatus ) { DRMLOG( _L( "RDRMRightsClient::ExportOrphanedContentIdList" ) ); - - SendReceive( DRMEngine::EInitOrphanedList, + + SendReceive( DRMEngine::EInitOrphanedList, TIpcArgs( aPerformScan ), aStatus ); - - DRMLOG( _L( "RDRMRightsClient::ExportOrphanedContentIdList done" ) ); + + DRMLOG( _L( "RDRMRightsClient::ExportOrphanedContentIdList done" ) ); }; // ----------------------------------------------------------------------------- // RDRMRightsClient::ExportOrphanedContentIdList // ----------------------------------------------------------------------------- -// +// EXPORT_C TInt RDRMRightsClient::ExportOrphanedContentIdList( TDes& aFileName ) { DRMLOG( _L( "RDRMRightsClient::ExportOrphanedContentIdList" ) ); - - return SendReceive( DRMEngine::EGetOrphanedList, + + return SendReceive( DRMEngine::EGetOrphanedList, TIpcArgs( &aFileName ) ); - - }; - + + }; + // ----------------------------------------------------------------------------- // RDRMRightsClient::ExportOrphanedContentIdList // ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMRightsClient::ExportOrphanedContentIdList( +// +EXPORT_C TInt RDRMRightsClient::ExportOrphanedContentIdList( RPointerArray& aContentIdList ) { DRMLOG( _L( "RDRMRightsClient::ExportOrphanedContentIdList to array" ) ); TFileName name; aContentIdList.ResetAndDestroy(); - + TInt error = ExportOrphanedContentIdList( name ); if ( !error ) { @@ -1182,16 +1182,16 @@ { aContentIdList.ResetAndDestroy(); } - + fs.Delete( name ); fs.Close(); } } - + DRMLOG2( _L( "RDRMRightsClient::ExportOrphanedContentIdList to array: %d" ), error ); - - return error; - }; + + return error; + }; // ----------------------------------------------------------------------------- // RDRMRightsClient::EncodeRightsIssuerField @@ -1201,28 +1201,28 @@ // - base64encode(AES IV + AES encoded original field incl. padding) // ----------------------------------------------------------------------------- // -EXPORT_C TInt RDRMRightsClient::EncodeRightsIssuerField( +EXPORT_C TInt RDRMRightsClient::EncodeRightsIssuerField( const TDesC8& aOldValue, HBufC8*& aNewValue ) { DRMLOG( _L( "RDRMRightsClient::EncodeRightsIssuerField" ) ); TInt error( KErrNone ); - + TInt size( aOldValue.Length() ); // original length size += KDCFKeySize - ( size % KDCFKeySize ); // padding size += KDCFKeySize; // IV size += ( size + 2 ) / 3 * 4; // base64 size += RMobilePhone::KPhoneSerialNumberSize; size += 3; // "flk" - + aNewValue = HBufC8::New( size ); if ( aNewValue ) { TPtr8 des( aNewValue->Des() ); - + des = aOldValue; - + error = SendReceive( DRMEngine::EEncodeRightsIssuerField, TIpcArgs( &des ) ); if ( error ) @@ -1235,25 +1235,25 @@ { error = KErrNoMemory; } - + DRMLOG2( _L( "RDRMRightsClient::EncodeRightsIssuerField> %d" ), error ); - + return error; } - -EXPORT_C TInt RDRMRightsClient::DecodeRightsIssuerField( + +EXPORT_C TInt RDRMRightsClient::DecodeRightsIssuerField( const TDesC8& aEncoded, HBufC8*& aDecoded ) { DRMLOG( _L( "DRMRightsClient::DecodeRightsIssuerField" ) ); - + TInt error( KErrNone ); - + aDecoded = HBufC8::New( aEncoded.Length() ); if ( aDecoded ) { TPtr8 des( aDecoded->Des() ); - + error = SendReceive( DRMEngine::EDecodeRightsIssuerField, TIpcArgs( &aEncoded, &des ) ); @@ -1272,15 +1272,15 @@ { error = KErrNoMemory; } - + DRMLOG2( _L( "DRMRightsClient::DecodeRightsIssuerField: error %d" ), error ); - + return error; } - + // ----------------------------------------------------------------------------- // RDRMRightsClient::SetAuthenticationSeed -// +// // ----------------------------------------------------------------------------- // EXPORT_C TInt RDRMRightsClient::SetAuthenticationSeed( const TDesC8& aContentID, @@ -1290,10 +1290,10 @@ return SendReceive( DRMEngine::ESetAuthenticationSeed, TIpcArgs( &aContentID, &aSeed ) ); } - + // ----------------------------------------------------------------------------- // RDRMRightsClient::GetAuthenticationSeed -// +// // ----------------------------------------------------------------------------- // EXPORT_C TInt RDRMRightsClient::GetAuthenticationSeed( const TDesC8& aContentID, @@ -1302,7 +1302,7 @@ DRMLOG( _L( "RDRMRightsClient::GetAuthenticationSeed" ) ); return SendReceive( DRMEngine::EGetAuthenticationSeed, TIpcArgs( &aContentID, &aSeed ) ); - } + } // ----------------------------------------------------------------------------- // RDRMRightsClient::FileToListL @@ -1315,52 +1315,52 @@ { DRMLOG( _L( "RDRMRightsClient::FileToListL" ) ); TInt error = KErrNone; - + // Temporary storage. CDRMPermission* tmpObject; - + // To access the file data. RFileReadStream fileStream; - + // How many objects there is in the file. TInt size = 0; - + // Temporary counter. TInt count = 0; - - + + // Open the file. User::LeaveIfError( fileStream.Open( aFs, aFileName, EFileRead | EFileStream ) ); CleanupClosePushL( fileStream ); - + size = fileStream.ReadInt32L(); - + while( count < size ) { // Allocate a new RO. tmpObject = CDRMPermission::NewL(); - + // Read the object. TRAP( error, tmpObject->InternalizeL( fileStream ) ); - + if ( !error ) { // Add the object into the list. error = aList.Append( tmpObject ); } - + if ( error ) { delete tmpObject; User::Leave( error ); } - - // Now tmpObject is under responsibility of aList. + + // Now tmpObject is under responsibility of aList. ++count; } - + // All done. - CleanupStack::PopAndDestroy(); // fileStream + CleanupStack::PopAndDestroy(); // fileStream } // ----------------------------------------------------------------------------- @@ -1376,10 +1376,10 @@ RFileReadStream stream; TUint16 size = 0; TPtr8 data( NULL, 0, 0 ); - + User::LeaveIfError( stream.Open( aFs, aFile, EFileRead | EFileStream ) ); CleanupClosePushL( stream ); - + size = stream.ReadUint16L(); while( size > 0 ) { @@ -1390,22 +1390,22 @@ CleanupStack::Pop(); // tmp size = stream.ReadUint16L(); } - + // All read, return. - + CleanupStack::PopAndDestroy(); // stream } // ----------------------------------------------------------------------------- // RDRMRightsClient::VerifyMacL -// Verifies the MAC. +// Verifies the MAC. // ----------------------------------------------------------------------------- -// +// EXPORT_C TInt RDRMRightsClient::VerifyMacL(const TDesC8& aSignedInfoElement, const TDesC8& aMacValue ) const { DRMLOG( _L( "RDRMRightsClient::VerifyMacL" ) ); - + TInt error = SendReceive( DRMEngine::EVerifyMac, TIpcArgs( &aSignedInfoElement, &aMacValue) ); return error; @@ -1416,19 +1416,19 @@ // RDRMRightsClient::GetSupportedIndividualsL // retrieves the supported individuals list // ----------------------------------------------------------------------------- -// +// EXPORT_C TInt RDRMRightsClient::GetSupportedIndividualsL( RPointerArray& aIndividuals) const { DRMLOG( _L( "RDRMRightsClient::GetSupportedIndividualsL" ) ); - TPckgBuf< TInt > size( 0 ); + TPckgBuf< TInt > size( 0 ); TInt error = SendReceive( DRMEngine::EGetSupportedIndividuals, TIpcArgs( &size) ); HBufC8* dataBuf = NULL; HBufC8* individual = NULL; TInt indivSize; TInt offset; - + if ( !error ) { if ( !size() ) @@ -1441,17 +1441,17 @@ if ( dataBuf ) { TPtr8 data( dataBuf->Des() ); - + error = SendReceive( DRMEngine::EGetPreparedData, TIpcArgs( &data ) ); - + if ( !error ) - { + { offset = 0; while (offset < size()) { Mem::Copy( &indivSize, data.Ptr()+offset, sizeof(TInt) ); - offset += sizeof (TInt); + offset += sizeof (TInt); individual = data.Mid(offset, indivSize).AllocLC(); aIndividuals.AppendL(individual); CleanupStack::Pop(); // individual @@ -1459,16 +1459,16 @@ } } } - CleanupStack::PopAndDestroy(); + CleanupStack::PopAndDestroy(); } - } + } return KErrNone; } - + // ----------------------------------------------------------------------------- // RDRMRightsClient::StopWatching // ----------------------------------------------------------------------------- -// +// EXPORT_C void RDRMRightsClient::StopWatching() const { SendReceive( DRMEngine::EStopWatching ); @@ -1477,7 +1477,7 @@ // ----------------------------------------------------------------------------- // RDRMRightsClient::UnwrapMacAndRek // ----------------------------------------------------------------------------- -// +// EXPORT_C TInt RDRMRightsClient::UnwrapMacAndRek( const TDesC8& aMacAndRek, TKeyTransportScheme aTransportScheme, const TDesC8& aRightsIssuerId, @@ -1486,16 +1486,16 @@ HBufC8* data = NULL; TPtr8 dataPtr( NULL, 0 ); TInt err = KErrNone; - + data = HBufC8::New( 1 + aMacAndRek.Size() ); - + if ( data ) { dataPtr.Set( data->Des() ); - dataPtr.SetLength( 1 ); + dataPtr.SetLength( 1 ); dataPtr[0] = aTransportScheme; dataPtr.Append( aMacAndRek ); - + if( aDomainId.Length() ) { err = SendReceive( DRMEngine::EUnwrapDomainMacAndRek, TIpcArgs( &dataPtr, @@ -1511,18 +1511,18 @@ delete data; data = NULL; } - else + else { err = KErrNoMemory; } - + return err; } - + // ----------------------------------------------------------------------------- // RDRMRightsClient::GetRandomDataL // ----------------------------------------------------------------------------- -// +// EXPORT_C void RDRMRightsClient::GetRandomDataL( TDes8& aRandomData ) const { if( !aRandomData.Length() ) @@ -1535,7 +1535,7 @@ // ----------------------------------------------------------------------------- // RDRMRightsClient::GetMeteringData() // ----------------------------------------------------------------------------- -// +// #ifndef RD_DRM_METERING EXPORT_C HBufC8* RDRMRightsClient::GetMeteringDataL( const TDesC8& /*aRiId*/ ) { @@ -1546,24 +1546,24 @@ { TInt error = KErrNone; HBufC8* meteringData = NULL; - + if ( aRiId.Length() ) { TInt size = 0; TPckg package( size ); - - error = SendReceive( DRMEngine::EGetMeteringData, + + error = SendReceive( DRMEngine::EGetMeteringData, TIpcArgs( &package, &aRiId ) ); - + if ( error == KErrNotFound ) { return NULL; } - + User::LeaveIfError( error ); meteringData = HBufC8::NewMaxLC( size ); - + // Package 'object' into TPtr8. TPtr8 objectPkg( const_cast< TUint8* >( meteringData->Ptr() ), size, @@ -1571,26 +1571,26 @@ User::LeaveIfError( SendReceive( DRMEngine::EGetPreparedData, TIpcArgs( &objectPkg) ) ); - + CleanupStack::Pop(); // meteringData return meteringData; } - + User::Leave( KErrArgument ); return NULL; } #endif //RD_DRM_METERING - + // ----------------------------------------------------------------------------- // RDRMRightsClient::DeleteMeteringDataL // ----------------------------------------------------------------------------- -// +// #ifndef RD_DRM_METERING EXPORT_C TInt RDRMRightsClient::DeleteMeteringDataL( const TDesC8& /*aRiId*/ ) { return KErrNotSupported; } -#else +#else EXPORT_C TInt RDRMRightsClient::DeleteMeteringDataL( const TDesC8& aRiId ) { if ( aRiId.Length() ) @@ -1604,9 +1604,9 @@ return KErrArgument; } } -#endif +#endif // ========================== OTHER EXPORTED FUNCTIONS ========================= - - -// End of File + + +// End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/server/src/DRMRightsData.cpp --- a/omadrm/drmengine/server/src/DRMRightsData.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/server/src/DRMRightsData.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -24,12 +24,12 @@ #include "DRMPointerArray.h" #include "DRMCommonData.h" -#include "DRMPermission.h" +#include "DrmPermission.h" #include "DRMRightsData.h" // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS const TInt KEncryptionKeySize = 16; @@ -44,16 +44,16 @@ // FORWARD DECLARATIONS -class TPermData +class TPermData { public: // Constructor TPermData( HBufC8* aParentId, const TInt aIndex, TBool aIsValid ) : iParentId( aParentId ), iIndex( aIndex ), iIsValid( aIsValid ) { }; - - public: // Member variables - HBufC8* iParentId; + + public: // Member variables + HBufC8* iParentId; TInt iIndex; TBool iIsValid; }; @@ -67,7 +67,7 @@ // ----------------------------------------------------------------------------- // CDRMRightsData* CDRMRightsData::NewLC( CDRMCommonData* aData, - const TDesC8& aKey, + const TDesC8& aKey, const TFileName& aRightsFile, RFs& aFileServer ) { @@ -75,24 +75,24 @@ CleanupStack::PushL( self ); self->ConstructL( aRightsFile, aKey ); - return self; + return self; }; - + // ----------------------------------------------------------------------------- // CDRMRightsData::NewL // ----------------------------------------------------------------------------- // -CDRMRightsData* CDRMRightsData::NewL( CDRMCommonData* aData, +CDRMRightsData* CDRMRightsData::NewL( CDRMCommonData* aData, const TDesC8& aKey, const TFileName& aRightsFile, RFs& aFileServer ) { CDRMRightsData* self = NewLC( aData, aKey, aRightsFile, aFileServer ); - CleanupStack::Pop(); - - return self; + CleanupStack::Pop(); + + return self; }; - + // ----------------------------------------------------------------------------- // CDRMRightsData::OpenLC // ----------------------------------------------------------------------------- @@ -103,12 +103,12 @@ CDRMCommonData* common = CDRMCommonData::NewL(); CDRMRightsData* self = new( ELeave ) CDRMRightsData( common, aFileServer ); - CleanupStack::PushL( self ); + CleanupStack::PushL( self ); self->ConstructL( aRightsFile ); - + return self; - }; - + }; + // ----------------------------------------------------------------------------- // CDRMRightsData::OpenL // ----------------------------------------------------------------------------- @@ -118,14 +118,14 @@ { CDRMRightsData* self = OpenLC( aRightsFile, aFileServer ); CleanupStack::Pop(); - - return self; - }; - + + return self; + }; + // ----------------------------------------------------------------------------- // Destructor // ----------------------------------------------------------------------------- -// +// CDRMRightsData::~CDRMRightsData() { // Permanent File Store @@ -134,17 +134,17 @@ delete iStore; iStore = NULL; } - - // index array + + // index array iArray.Close(); - + // Common Data if( iData ) { delete iData; iData = NULL; } - }; + }; // ----------------------------------------------------------------------------- @@ -169,35 +169,35 @@ { User::Leave( KErrArgument ); } - - // Open the stream + + // Open the stream stream.ReplaceLC( *iStore, iCommonId ); - + // Delete the old data if it's around // if the old data has been modified, write it as such if( iData != aData ) - { + { if( iData ) - { - delete iData; - iData = NULL; - } - iData = aData; + { + delete iData; + iData = NULL; + } + iData = aData; } - + // Write the data to the stream iData->ExternalizeL( stream ); - + // commit the stream stream.CommitL(); - + // commit the store iStore->CommitL(); - + // pop the stream CleanupStack::PopAndDestroy(); - }; - + }; + // ----------------------------------------------------------------------------- // CDRMRightsData::StoreNewPermissionL // ----------------------------------------------------------------------------- @@ -209,40 +209,40 @@ TStreamId rootId; RStoreWriteStream stream; RStoreWriteStream rootStream; - + // Create a new stream to the store: sid = stream.CreateLC( *iStore ); - - aPermission.iUniqueID = sid.Value(); + + aPermission.iUniqueID = sid.Value(); aStream = sid.Value(); - + // Externalize the permission data aPermission.ExternalizeL( stream ); stream.CommitL(); - + // add the id to the array iArray.InsertInUnsignedKeyOrder( aStream ); // Get the stream id of the root rootId = iStore->Root(); - + // Open the root stream rootStream.ReplaceLC( *iStore, rootId ); - + // Store the changed index - StoreIndexL( rootStream ); + StoreIndexL( rootStream ); rootStream.CommitL(); // Commit the store iStore->CommitL(); - + CleanupStack::PopAndDestroy(); // root stream CleanupStack::PopAndDestroy(); // stream - + iStore->CompactL(); iStore->CommitL(); - }; - + }; + // ----------------------------------------------------------------------------- // CDRMRightsData::UpdatePermissionL // ----------------------------------------------------------------------------- @@ -252,30 +252,30 @@ TStreamId sid( aPermission.iUniqueID ); RStoreWriteStream stream; TInt index = 0; - + // get the id from the array if it doesn't exist, error index = iArray.FindInUnsignedKeyOrder( aPermission.iUniqueID ); - + if( index == KErrNotFound ) { User::Leave( KErrCANoPermission ); } - + // Replace the existing stream stream.ReplaceLC( *iStore, sid ); - + // Externalize the permission data aPermission.ExternalizeL( stream ); - + // Required by the ReplaceLC stream.CommitL(); - // Commit the store + // Commit the store iStore->CommitL(); - + CleanupStack::PopAndDestroy(); }; - + // ----------------------------------------------------------------------------- // CDRMRightsData::FetchPermissionL // ----------------------------------------------------------------------------- @@ -283,28 +283,28 @@ void CDRMRightsData::FetchPermissionL( CDRMPermission& aPermission, const TDRMUniqueID& aStream ) const { - TStreamId sid( aStream ); + TStreamId sid( aStream ); RStoreReadStream stream; TInt index = 0; // get the id from the array if it doesn't exist, error index = iArray.FindInUnsignedKeyOrder( aStream ); - + if( index == KErrNotFound ) { User::Leave( KErrCANoPermission ); } - + // Open the root stream stream.OpenLC( *iStore, sid ); // Read the common id aPermission.InternalizeL( stream ); - + // Close the stream - CleanupStack::PopAndDestroy(); + CleanupStack::PopAndDestroy(); }; - + // ----------------------------------------------------------------------------- // CDRMRightsData::DeletePermissionL // ----------------------------------------------------------------------------- @@ -315,10 +315,10 @@ TStreamId rootId; TInt index = 0; RStoreWriteStream rootStream; - + // get the id from the array if it doesn't exist, error index = iArray.FindInUnsignedKeyOrder( aStream ); - + if( index == KErrNotFound ) { User::Leave( KErrCANoPermission ); @@ -326,52 +326,52 @@ // Delete the stream from the store iStore->DeleteL( sid ); - - iArray.Remove( index ); - - + + iArray.Remove( index ); + + // Get the stream id of the root rootId = iStore->Root(); - + // Open the root stream rootStream.ReplaceLC( *iStore, rootId ); - + // Store the changed index - StoreIndexL( rootStream ); + StoreIndexL( rootStream ); rootStream.CommitL(); // Commit the store iStore->CommitL(); - + CleanupStack::PopAndDestroy(); // root stream - + // Compact and commit the changes iStore->CompactL(); - iStore->CommitL(); + iStore->CommitL(); }; - + // ----------------------------------------------------------------------------- // CDRMRightsData::FetchAllPermissionsL // ----------------------------------------------------------------------------- // -void CDRMRightsData::FetchAllPermissionsL( RPointerArray& +void CDRMRightsData::FetchAllPermissionsL( RPointerArray& aPointerArray) { CDRMPermission* perm = NULL; - if ( iArray.Count() == 0) + if ( iArray.Count() == 0) { User::Leave( KErrCANoPermission ); } - + for( TInt count = 0; count < iArray.Count(); count++ ) { perm = CDRMPermission::NewLC(); FetchPermissionL( *perm, iArray[ count ] ); aPointerArray.AppendL( perm ); - CleanupStack::Pop(); + CleanupStack::Pop(); } - }; + }; // ----------------------------------------------------------------------------- // CDRMRightsData::DeleteAllPermissionsL @@ -381,35 +381,35 @@ { TStreamId rootId; RStoreWriteStream rootStream; - + // Delete all permissions from the store for( TInt i = 0; i < iArray.Count(); i++ ) { TStreamId sid( iArray[i] ); iStore->DeleteL( sid ); } - - // Reset the array + + // Reset the array iArray.Reset(); - + // Get the stream id of the root rootId = iStore->Root(); - + // Open the root stream rootStream.ReplaceLC( *iStore, rootId ); - + // Store the changed index - StoreIndexL( rootStream ); + StoreIndexL( rootStream ); rootStream.CommitL(); // Commit the store iStore->CommitL(); - + CleanupStack::PopAndDestroy(); // root stream - + // Compact and Commit the store iStore->CompactL(); - iStore->CommitL(); + iStore->CommitL(); }; // ----------------------------------------------------------------------------- @@ -420,21 +420,21 @@ // ----------------------------------------------------------------------------- // TInt CDRMRightsData::DeleteExpiredPermissionsL( const TTime& aTime, TBool& aParents ) - { - CDRMPermission* permission = NULL; - RStoreReadStream stream; + { + CDRMPermission* permission = NULL; + RStoreReadStream stream; TStreamId rootId; RStoreWriteStream rootStream; TBool remove = EFalse; TInt k = 0; TBool performDelete = ETrue; - + // A list for the permissions: CDRMPointerArray* permList = CDRMPointerArray::NewLC(); permList->SetAutoCleanup( ETrue ); CDRMPointerArray* permDataList = CDRMPointerArray::NewLC(); permDataList->SetAutoCleanup( ETrue ); - + // Fill the array: for( TInt j = 0 ; j < iArray.Count(); j++ ) { @@ -442,27 +442,27 @@ // Create the sid: TStreamId psid( iArray[j] ); - // Open the correct stream - stream.OpenLC( *iStore, psid ); + // Open the correct stream + stream.OpenLC( *iStore, psid ); - permission = CDRMPermission::NewLC(); + permission = CDRMPermission::NewLC(); - // Read the permission - permission->InternalizeL( stream ); - + // Read the permission + permission->InternalizeL( stream ); + permList->AppendL( permission ); - CleanupStack::Pop(); // permission - + CleanupStack::Pop(); // permission + // if the permission has a parent check if we found now or have found an // expired one or a valid one, - // store info if required + // store info if required if( permission->iParentUID ) { - if( !aParents ) + if( !aParents ) { aParents = ETrue; } - + for( k = 0; k < permDataList->Count(); k++ ) { if( !(*permDataList)[k]->iParentId->Compare( *permission->iParentUID ) ) @@ -476,7 +476,7 @@ break; } } - + // if it's not found, add it: if( k == permDataList->Count() ) { @@ -484,99 +484,99 @@ { perm = new(ELeave) TPermData( permission->iParentUID, j, ETrue); } - else + else { - perm = new(ELeave) TPermData( permission->iParentUID, j, EFalse); + perm = new(ELeave) TPermData( permission->iParentUID, j, EFalse); } CleanupStack::PushL( perm ); permDataList->AppendL( perm ); - CleanupStack::Pop(); // perm + CleanupStack::Pop(); // perm } } - + // Close the stream - CleanupStack::PopAndDestroy(); // stream + CleanupStack::PopAndDestroy(); // stream } - + // Delete all expired permissions from the store for( TInt i = iArray.Count() - 1 ; i >= 0; i-- ) { permission = (*permList)[i]; - - // Check if the permission is expired - // if it is, check if it has a parent and if it can be deleted - if( permission->Expired( aTime ) ) - { - // if it has a parent go through the list and see if this can be deleted - // or not - if( permission->iParentUID ) - { - performDelete = EFalse; - for( k = 0; k < permDataList->Count(); k++ ) - { - TPermData* aData = (*permDataList)[k]; - - // since it's set up like this a pointer comparison is enough: - if( !(*permDataList)[k]->iParentId->Compare( *permission->iParentUID ) ) - { - if( i != (*permDataList)[k]->iIndex ) - { - performDelete = ETrue; - } - } - } - } - - if( performDelete ) - { + + // Check if the permission is expired + // if it is, check if it has a parent and if it can be deleted + if( permission->Expired( aTime ) ) + { + // if it has a parent go through the list and see if this can be deleted + // or not + if( permission->iParentUID ) + { + performDelete = EFalse; + for( k = 0; k < permDataList->Count(); k++ ) + { + TPermData* aData = (*permDataList)[k]; + + // since it's set up like this a pointer comparison is enough: + if( !(*permDataList)[k]->iParentId->Compare( *permission->iParentUID ) ) + { + if( i != (*permDataList)[k]->iIndex ) + { + performDelete = ETrue; + } + } + } + } + + if( performDelete ) + { // Create the sid: TStreamId sid( iArray[i] ); - - iStore->Delete( sid ); - - // remove from the array - iArray.Remove( i ); - - if( !remove ) - { - remove = ETrue; - } - } - } - performDelete = ETrue; + + iStore->Delete( sid ); + + // remove from the array + iArray.Remove( i ); + + if( !remove ) + { + remove = ETrue; + } + } + } + performDelete = ETrue; } - CleanupStack::PopAndDestroy( 2 ); // permDataList, permList - - // Write the data into the the file + CleanupStack::PopAndDestroy( 2 ); // permDataList, permList + + // Write the data into the the file // if some of the rights have been removed - if( remove ) + if( remove ) { // Get the stream id of the root rootId = iStore->Root(); - + // Open the root stream rootStream.ReplaceLC( *iStore, rootId ); - + // Store the changed index - StoreIndexL( rootStream ); + StoreIndexL( rootStream ); rootStream.CommitL(); // Commit the store iStore->CommitL(); - + CleanupStack::PopAndDestroy(); // root stream - + // Compact and Commit the store iStore->CompactL(); - iStore->CommitL(); + iStore->CommitL(); } - - return iArray.Count(); - } - + return iArray.Count(); + } + + // ----------------------------------------------------------------------------- // CDRMRightsData::StoreKeyL // ----------------------------------------------------------------------------- @@ -585,24 +585,24 @@ { RStoreWriteStream stream; TUint32 size = 0; - + stream.OpenLC( *iStore, iKeyId ); - - if( iKeyExists ) + + if( iKeyExists ) { size = KEncryptionKeySize; } - - stream.WriteUint32L( size ); - + + stream.WriteUint32L( size ); + if( size ) { - stream.WriteL( iKey, KEncryptionKeySize ); + stream.WriteL( iKey, KEncryptionKeySize ); } - + stream.CommitL(); iStore->CommitL(); - + CleanupStack::PopAndDestroy(); }; @@ -613,16 +613,16 @@ HBufC8* CDRMRightsData::GetKeyL() const { HBufC8* key = NULL; - + if( iKeyExists ) { key = HBufC8::NewL( KEncryptionKeySize ); *key = iKey; } - + return key; } - + // ----------------------------------------------------------------------------- // CDRMRightsData::FetchKeyL // ----------------------------------------------------------------------------- @@ -631,23 +631,23 @@ { RStoreReadStream stream; TUint32 size = 0; - + // Open the root stream stream.OpenLC( *iStore, iKeyId ); - - size = stream.ReadUint32L(); - - if( !size ) + + size = stream.ReadUint32L(); + + if( !size ) { iKeyExists = EFalse; } - else + else { stream.ReadL( iKey, KEncryptionKeySize ); iKeyExists = ETrue; } - - CleanupStack::PopAndDestroy(); + + CleanupStack::PopAndDestroy(); }; // ----------------------------------------------------------------------------- @@ -658,35 +658,35 @@ { TStreamId rootId; RStoreWriteStream stream; - RStoreWriteStream stream2; + RStoreWriteStream stream2; RStoreWriteStream rootStream; - TUint32 size = 0; - + TUint32 size = 0; + // Create and initialize the permanent file store iStore = CPermanentFileStore::ReplaceL( iFileServer, aRightsStore, - EFileRead|EFileWrite ); + EFileRead|EFileWrite ); iStore->SetTypeL( KPermanentFileStoreLayoutUid ); - iStore->CommitL(); - - // Create the root stream: + iStore->CommitL(); + + // Create the root stream: rootId = rootStream.CreateLC( *iStore ); rootStream.CommitL(); - iStore->SetRootL( rootId ); - iStore->CommitL(); - + iStore->SetRootL( rootId ); + iStore->CommitL(); + // Create the common data iCommonId = stream.CreateLC( *iStore ); iData->ExternalizeL( stream ); stream.CommitL(); - iStore->CommitL(); - + iStore->CommitL(); + CleanupStack::PopAndDestroy(); // stream - + // Create the key iKeyId = stream2.CreateLC( *iStore ); // if the key exists set the key size accordingly - if( iKeyExists ) + if( iKeyExists ) { size = KEncryptionKeySize; } @@ -697,21 +697,21 @@ stream2.WriteL( iKey, KEncryptionKeySize ); } stream2.CommitL(); - iStore->CommitL(); - - CleanupStack::PopAndDestroy(); // stream2 - CleanupStack::PopAndDestroy(); // rootStream - + iStore->CommitL(); + + CleanupStack::PopAndDestroy(); // stream2 + CleanupStack::PopAndDestroy(); // rootStream + // Create the index now that we have all the data - rootId = iStore->Root(); - + rootId = iStore->Root(); + rootStream.ReplaceLC(*iStore, rootId); StoreIndexL( rootStream ); rootStream.CommitL(); - iStore->CommitL(); - + iStore->CommitL(); + // Commit the changes to the store as well - CleanupStack::PopAndDestroy(); // rootStream + CleanupStack::PopAndDestroy(); // rootStream }; @@ -723,19 +723,19 @@ { // Write the common id to the stream iCommonId.ExternalizeL( aStream ); - + // Write the key id to the stream iKeyId.ExternalizeL( aStream ); - + // Write the array size and possibly the array to the stream aStream.WriteInt32L( iArray.Count() ); - + for( TInt count = 0; count < iArray.Count(); count++ ) { aStream.WriteUint32L( iArray[ count ] ); } }; - + // ----------------------------------------------------------------------------- // CDRMRightsData::FetchIndexL // ----------------------------------------------------------------------------- @@ -746,36 +746,36 @@ RStoreReadStream stream; TInt count = 0; TDRMUniqueID id; - + // Get the stream id of the root rootId = iStore->Root(); - + // Open the root stream stream.OpenLC( *iStore, rootId ); - + // Do the actual reading, reading also the key id and the common id // Read the common id iCommonId.InternalizeL( stream ); - - // Read the key id + + // Read the key id iKeyId.InternalizeL( stream ); - + // read the count of the array: iArray.Reset(); - + count = stream.ReadInt32L(); - + for( ; count > 0; count-- ) { id = stream.ReadUint32L(); iArray.InsertInUnsignedKeyOrder( id ); } - + // Close the stream - CleanupStack::PopAndDestroy(); + CleanupStack::PopAndDestroy(); }; - + // ----------------------------------------------------------------------------- // CDRMRightsData::FetchCommonDataL // ----------------------------------------------------------------------------- @@ -783,15 +783,15 @@ void CDRMRightsData::FetchCommonDataL() { RStoreReadStream stream; - + // Open the root stream stream.OpenLC( *iStore, iCommonId ); - + iData->InternalizeL( stream ); - + CleanupStack::PopAndDestroy(); }; - + // ----------------------------------------------------------------------------- // Default Constructor - First phase. @@ -811,13 +811,13 @@ { // Open the file store iStore = CPermanentFileStore::OpenL( iFileServer, aRightsStore, EFileRead|EFileWrite ); - + // Get the index FetchIndexL(); - + // Get the common data FetchCommonDataL(); - + // Get the key FetchKeyL(); }; @@ -829,9 +829,9 @@ void CDRMRightsData::ConstructL( const TFileName& aRightsStore, const TDesC8& aKey ) { - + // Check if the key is given or a null desc - if( aKey.Length() ) + if( aKey.Length() ) { iKey = aKey; iKeyExists = ETrue; @@ -839,11 +839,11 @@ else { iKeyExists = EFalse; - } - + } + // Creates the required stores and indexes CreateAndInitializeStoreL( aRightsStore ); }; - - + + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/server/src/DRMRightsServer.cpp --- a/omadrm/drmengine/server/src/DRMRightsServer.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/server/src/DRMRightsServer.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -20,32 +20,32 @@ #include #include #include -#include +#include #include #include #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif #include "DRMRightsServer.h" -#include "DRMRightsDb.h" +#include "drmrightsdb.h" #include "DRMDbSession.h" #include "DRMEngineClientServer.h" -#include "DRMLog.h" +#include "drmlog.h" #include "DRMNotifier.h" #include "DrmKeyStorage.h" -#include "drmnotifierserver.h" -#include "roapstorageserver.h" +#include "DRMNotifierServer.h" +#include "RoapStorageServer.h" #include "drmnotifierclientserver.h" #include "drmroapclientserver.h" #include "DRMXOma.h" #include "DRMBackupObserver.h" #include "DRMBackup.h" #include "flogger.h" -#include "drmrightsparser.h" -#include "drmrights.h" -#include "drmhelpercommon.h" +#include "DrmRightsParser.h" +#include "DRMRights.h" +#include "DRMHelperCommon.h" #include "wmdrmclientwrapper.h" @@ -65,7 +65,7 @@ */ // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS LOCAL_C const TUint KMaxHeapsize = 0x7A120; @@ -159,16 +159,16 @@ // Returns: TInt: Symbian OS error code. // ----------------------------------------------------------------------------- // -LOCAL_C TInt Startup( void ) +LOCAL_C TInt Startup( void ) { TInt error = KErrNone; CTrapCleanup* trap = CTrapCleanup::New(); CActiveScheduler* scheduler = new CActiveScheduler(); - + if ( trap && scheduler ) { CActiveScheduler::Install( scheduler ); - + error = StartDBServer(); } else @@ -176,23 +176,23 @@ error = KErrNoMemory; } - delete scheduler; + delete scheduler; scheduler = NULL; - + delete trap; trap = NULL; - + if ( error ) { // Something went wrong. Release the client (if any). SignalClient(); - + if ( error == KErrAlreadyExists ) { error = KErrNone; } } - + return error; } @@ -216,50 +216,50 @@ // This function starts the actual server under TRAP harness and starts // waiting for connections. This function returns only if there has been // errors during server startup or the server is stopped for some reason. -// +// // Returns: TInt: Symbian OS error code. // ----------------------------------------------------------------------------- -TInt StartDBServer( void ) +TInt StartDBServer( void ) { TInt error = KErrNone; CDRMRightsServer* server = NULL; TUint8 count = 0; - + do { DRMLOG2( _L( "RightsServer.exe: StartDBServer: %d" ), error ); - + ++count; - + TRAP( error, ( server = CDRMRightsServer::NewL() ) ); - - if ( error ) + + if ( error ) { User::After( TTimeIntervalMicroSeconds32(KWaitingTime) ); } - + } while( error && ( count <= KMaxStartTries ) ); - - if( error ) + + if( error ) { DRMLOG2( _L( "RightsServer.exe: CDRMRightsServer::NewL failed: %d " ), error ); // Failed return error; } - + // Release the semaphore if necessary. SignalClient(); - + // Start waiting for connections CActiveScheduler::Start(); - + // Dying... // Delete CDRMRigntsServer - + DRMLOG( _L( "RightsServer.exe: DB server dying..." ) ); delete server; - + return KErrNone; } @@ -290,7 +290,7 @@ (reinterpret_cast*>(aPtr))->ResetAndDestroy(); (reinterpret_cast*>(aPtr))->Close(); } -#endif +#endif // ============================ MEMBER FUNCTIONS =============================== @@ -302,46 +302,46 @@ CDRMRightsServer* CDRMRightsServer::NewL() { CDRMRightsServer* self = new( ELeave ) CDRMRightsServer(); - + CleanupStack::PushL( self ); - + self->ConstructL(); - + CleanupStack::Pop( self ); - + return self; } // ----------------------------------------------------------------------------- // Destructor // ----------------------------------------------------------------------------- -CDRMRightsServer::~CDRMRightsServer() +CDRMRightsServer::~CDRMRightsServer() { DRMLOG( _L( "CDRMRightsServer::~" ) ); - + delete iIMEI; iIMEI = NULL; - + delete iIMSI; iIMSI = NULL; - + delete iDb; iDb = NULL; - + iClock.Close(); iCache.Close(); - + iMeteringDb.Close(); - + iFs.Close(); iActiveCountConstraints.ResetAndDestroy(); iActiveCountConstraints.Close(); - + delete iBackupObserver; - delete iBackupHandler; + delete iBackupHandler; delete iActiveBackupClient; delete iDbWatcher; -#if 0 +#if 0 // Close and delete the shared data client - if( iSharedDataClient ) + if( iSharedDataClient ) { iSharedDataClient->Close(); delete iSharedDataClient; @@ -353,7 +353,7 @@ { delete iNotifier; iNotifier = NULL; } - + //An empty semaphore RSemaphore semaphore; } @@ -366,18 +366,18 @@ TBool CDRMRightsServer::GetSecureTime( TTime& aTime ) const { DRMClock::ESecurityLevel secLevel = DRMClock::KInsecure; - - TInt timezone( 0 ); - + + TInt timezone( 0 ); + iClock.GetSecureTime( aTime, timezone, secLevel ); - + if( secLevel == DRMClock::KSecure ) { DRMLOG( _L( "CDRMRightsServer::GetSecureTime: Time is secure\r\n" ) ); - return ETrue; - } - - DRMLOG( _L( "CDRMRightsServer::GetSecureTime: Time is not secure\r\n" ) ); + return ETrue; + } + + DRMLOG( _L( "CDRMRightsServer::GetSecureTime: Time is not secure\r\n" ) ); return EFalse; } @@ -406,8 +406,8 @@ { return iFs; } - - + + RDRMReplayCache& CDRMRightsServer::ReplayCache() { return iCache; @@ -426,8 +426,8 @@ // void CDRMRightsServer::HandleNotifyL(const TUid /*aUid*/, const TDesC& /*aKey*/, - const TDesC& /*aValue*/) - { + const TDesC& /*aValue*/) + { /* XXX Backup via Publish/Subscribe __ASSERT_DEBUG( iDb, User::Invariant() ); TInt value = -1; @@ -453,12 +453,12 @@ if( value == 1 ) // PrepareForBackup { - TRAPD( error, iDb->BackupDBL( KNullDesC, + TRAPD( error, iDb->BackupDBL( KNullDesC, KNullDesC8 ) ); // Notify that it's done User::LeaveIfError( iSharedDataClient->AssignToTemporaryFile( KSDUidSystem ) ); - User::LeaveIfError( iSharedDataClient->SetInt( + User::LeaveIfError( iSharedDataClient->SetInt( KDRMBackupRestoreStatus, 0 ) ); iSharedDataClient->Flush(); } @@ -473,7 +473,7 @@ // From CActive. Complete the request and restart the scheduler. // ----------------------------------------------------------------------------- // -TInt CDRMRightsServer::RunError( TInt aError ) +TInt CDRMRightsServer::RunError( TInt aError ) { DRMLOG2( _L( "CDRMRightsServer::RunError: %d" ), aError ); @@ -482,10 +482,10 @@ { Message().Complete( aError ); } - + // Restart the scheduler. ReStart(); - + // Error handled. return KErrNone; } @@ -501,8 +501,8 @@ if ( ! User::QueryVersionSupported( TVersion( DRMEngine::KServerMajorVersion, DRMEngine::KServerMinorVersion, - DRMEngine::KServerBuildVersion ), - aVersion ) ) + DRMEngine::KServerBuildVersion ), + aVersion ) ) { // Sorry, no can do. User::Leave( KErrNotSupported ); @@ -518,40 +518,40 @@ // might leave. // ----------------------------------------------------------------------------- // -CDRMRightsServer::CDRMRightsServer() : +CDRMRightsServer::CDRMRightsServer() : CServer2( EPriorityStandard ), iIMEI( NULL ), - iArmed( EFalse ), + iArmed( EFalse ), iIMSI( NULL ), iGetImsi( ETrue ) { // Nothing } - + // ----------------------------------------------------------------------------- // CDRMRightsServer::ConstructL // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // -void CDRMRightsServer::ConstructL() +void CDRMRightsServer::ConstructL() { DRMLOG( _L( "CDRMRightsServer::ConstructL" ) ); TDRMKey key; RSemaphore semaphore; RProcess currentprocess; - + // Ignore errors User::RenameThread( KRightsServerThread ); User::LeaveIfError( iFs.Connect() ); - + #ifndef RD_MULTIPLE_DRIVE - + // Ignore errors iFs.MkDirAll( KDRMDbTempPath ); - + #else //RD_MULTIPLE_DRIVE - + TFileName tempPath; TFileName tempPath2; TFileName tempRemovablePath; @@ -559,15 +559,15 @@ TChar driveLetter; TChar driveLetterRemovable; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); - iFs.DriveToChar( driveNumber, driveLetter ); - - tempPath.Format( KDbTempPath, (TUint)driveLetter ); - + iFs.DriveToChar( driveNumber, driveLetter ); + + tempPath.Format( KDbTempPath, (TUint)driveLetter ); + // Ignore errors iFs.MkDirAll( tempPath ); - + #endif - + DRMLOG( _L( "CDRMRightsServer::ConstructL: SharedDataClient" ) ); // Create and instance of the shared data client @@ -581,134 +581,134 @@ KSDUidSystem, &KBackupRestoreStatus ) ); User::LeaveIfError(iSharedDataClient->NotifyChange( KSDUidSystem, &KDRMBackupRestoreStatus) ); - */ - - + */ + + GetDbKeyL( key ); - - + + DRMLOG( _L( "CDRMRightsServer::ConstructL: database" ) ); GetIMEIL(); - + // Create the imsi pointer array: iIMSI = CDRMPointerArray::NewL(); iIMSI->SetAutoCleanup(ETrue); - + GetIMSIL(); - + #ifndef RD_MULTIPLE_DRIVE - + iDb = CDRMRightsDB::NewL( iFs, KRightsDir, key, *iIMEI ); - + #else //RD_MULTIPLE_DRIVE - + tempPath.Format( KRightsDir, (TUint)driveLetter ); - + iDb = CDRMRightsDB::NewL( iFs, tempPath, key, *iIMEI ); - + #endif - + key.FillZ(); - + DRMLOG( _L( "CDRMRightsServer::ConstructL: DB started." ) ); DRMLOG( _L( "CDRMRightsServer::ConstructL: Starting Notifier ." ) ); - + User::LeaveIfError( semaphore.CreateGlobal( KDRMEngCommonSemaphore, 0 ) ); CleanupClosePushL( semaphore ); - + StartThreadL( DRMNotifier::KServerName, StartupNotifier, semaphore ); DRMLOG( _L( "CDRMRightsServer::ConstructL: Notifier thread created." ) ); - + StartThreadL( Roap::KServerName, StartupRoapStorage, semaphore ); DRMLOG( _L( "CDRMRightsServer::ConstructL: ROAP thread created." ) ); - + #ifdef __DRM_CLOCK StartThreadL( DRMClock::KServerName, StartupClock, semaphore ); DRMLOG( _L( "CDRMRightsServer::ConstructL: clock thread created." ) ); #endif - + CleanupStack::PopAndDestroy(); // semaphore - + iNotifier = CDRMNotifier::NewL(); - + iCache.Set( iFs ); #ifndef RD_MULTIPLE_DRIVE - + iCache.InitL( KTimedReplayCacheFile, KPlainReplayCacheFile ); -#ifdef RD_DRM_METERING +#ifdef RD_DRM_METERING iMeteringDb.Set( iFs ); iMeteringDb.InitL( KMeteringDataBaseFile ); #endif - + #else //RD_MULTIPLE_DRIVE - + tempPath.Format( KTimedReplayCacheFile, (TUint)driveLetter ); tempPath2.Format( KPlainReplayCacheFile, (TUint)driveLetter ); - + iCache.InitL( tempPath, tempPath2 ); - -#ifdef RD_DRM_METERING - + +#ifdef RD_DRM_METERING + tempPath.Format( KMeteringDataBaseFile, (TUint)driveLetter ); - + iMeteringDb.Set( iFs ); iMeteringDb.InitL( tempPath ); #endif - + #endif - + User::LeaveIfError( iClock.Connect() ); // xoma header list creation iXOmaHeaders = new (ELeave) RPointerArray< CDRMXOma >(); - + // p/s iBackupObserver = CDRMBackupObserver::NewL( *(const_cast(this))); iBackupObserver->Start(); - + #ifdef USE_RO_IMPORT // Import any OMA DRM 1.0 RO in the import directory, ignore all errors (except // when checking the default removable mass storage) TInt r = KErrNone; - + #ifndef RD_MULTIPLE_DRIVE - + TRAP( r, ImportRightsObjectsL( KInternalImportDir ) ); TRAP( r, ImportRightsObjectsL( KUserDiskImportDir ) ); - + #else //RD_MULTIPLE_DRIVE - + tempPath.Format( KInternalImportDir, (TUint)driveLetter ); - + DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, driveNumber ); - iFs.DriveToChar( driveNumber, driveLetter ); - - // Default mass storage is usually eMMC + iFs.DriveToChar( driveNumber, driveLetter ); + + // Default mass storage is usually eMMC tempPath2.Format( KUserDiskImportDir, (TUint)driveLetter ); - + // Find out if a removable mass storage also exists r = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, driveNumber ); iFs.DriveToChar( driveNumber, driveLetterRemovable ); - - // Import is not needed from the default removable mass storage drive if the drive - // letter of the default mass storage and the default removable mass storage are + + // Import is not needed from the default removable mass storage drive if the drive + // letter of the default mass storage and the default removable mass storage are // the same or the removable mass storage is not supported - if ( ( driveLetter != driveLetterRemovable ) && ( r == KErrNone ) ) + if ( ( driveLetter != driveLetterRemovable ) && ( r == KErrNone ) ) { tempRemovablePath.Format( KUserRemovableDiskImportDir, (TUint)driveLetterRemovable ); TRAP( r, ImportRightsObjectsL( tempRemovablePath ) ); } - + TRAP( r, ImportRightsObjectsL( tempPath ) ); TRAP( r, ImportRightsObjectsL( tempPath2 ) ); - + #endif - + #endif // Add the server to the scheduler. @@ -717,17 +717,17 @@ // Start watching our RDB iDbWatcher = CDbWatcher::NewL( *this ); iDbWatcher->StartWatching(); - + // Start watching the helper server iProcWatcher = CProcWatcher::NewL( *this, _L( "*DcfRepSrv*" ), _L( "DcfRepSrv" ) ); iProcWatcher->StartWatching(); - + // Ready to watch iArmed = ETrue; __UHEAP_MARK; TRAP( r, FeatureManager::InitializeLibL() ); - if( !r && FeatureManager::FeatureSupported( KFeatureIdWindowsMediaDrm ) ) + if( !r && FeatureManager::FeatureSupported( KFeatureIdWindowsMediaDrm ) ) { static const TInt KGateOrdinal = 1; RLibrary library; @@ -748,47 +748,47 @@ __UHEAP_MARKEND; } } - library.Close(); + library.Close(); } FeatureManager::UnInitializeLib(); - __UHEAP_MARKEND; + __UHEAP_MARKEND; } - -// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- // CDRMRightsServer::StartThreadL // Start a new thread. -// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- void CDRMRightsServer::StartThreadL( const TDesC& aThreadName, TThreadFunction aFunc, RSemaphore& aSemaphore ) { RThread thread; - - User::LeaveIfError( + + User::LeaveIfError( thread.Create( aThreadName, - aFunc, + aFunc, KDefaultStackSize, - KMinHeapSize, + KMinHeapSize, KMaxHeapsize, NULL ) ); - + thread.Resume(); - + aSemaphore.Wait(); - + thread.Close(); } - + // ----------------------------------------------------------------------------- // CDRMRightsServer::GetDbKeyL -// Fetches the rights database key from Wallet or uses a constant +// Fetches the rights database key from Wallet or uses a constant // key if Wallet is not supported. // ----------------------------------------------------------------------------- // -void CDRMRightsServer::GetDbKeyL( TDRMKey& aKey ) +void CDRMRightsServer::GetDbKeyL( TDRMKey& aKey ) { TInt r = KErrNone; - + DRMLOG( _L( "CDRMRightsServer::GetDbKey" ) ); MDrmKeyStorage* storage = DrmKeyStorageNewL(); TRAP( r, storage->GetDeviceSpecificKeyL( aKey ) ); @@ -801,28 +801,28 @@ // Generates the actual key based on the given key seed. // ----------------------------------------------------------------------------- // -void CDRMRightsServer::GenerateKeyL( HBufC*& aKeySeed, +void CDRMRightsServer::GenerateKeyL( HBufC*& aKeySeed, TDRMKey& aKey ) const { - __ASSERT_ALWAYS( aKeySeed->Size() >= KDRMKeyLength, + __ASSERT_ALWAYS( aKeySeed->Size() >= KDRMKeyLength, User::Leave( KErrUnderflow ) ); - + TPtrC8 key( reinterpret_cast< TUint8* >( const_cast< TUint16* >( aKeySeed->Ptr() ) ), KDRMKeyLength ); - + aKey = key; } // ----------------------------------------------------------------------------- // CDRMRightsServer::XOmaHeaders() -// return the pointer of the X-Oma headers list +// return the pointer of the X-Oma headers list // ----------------------------------------------------------------------------- // RPointerArray< CDRMXOma >& CDRMRightsServer::XOmaHeaders( void ) - { - return *iXOmaHeaders; - } + { + return *iXOmaHeaders; + } @@ -836,19 +836,19 @@ { return *iIMEI; } - + #ifdef DRM_USE_SERIALNUMBER_URI TInt error( KErrNone ); TInt count( 0 ); TInt count2( 0 ); TUint32 caps( 0 ); TBool found (EFalse); - + RTelServer etelServer; RMobilePhone phone; - + TUint KMaxImeiTries = 5; - + for ( TUint8 i = 0; i < KMaxImeiTries; ++i ) { error = etelServer.Connect(); @@ -856,31 +856,31 @@ { User::After( TTimeIntervalMicroSeconds32( KWaitingTime ) ); } - else + else { break; } } - + User::LeaveIfError( error ); CleanupClosePushL( etelServer ); - - User::LeaveIfError( etelServer.LoadPhoneModule( KMmTsyModuleName ) ); - + + User::LeaveIfError( etelServer.LoadPhoneModule( KMmTsyModuleName ) ); + TUnloadModule unload; unload.iServer = &etelServer; unload.iName = &KMmTsyModuleName; - + TCleanupItem item( DoUnloadPhoneModule, &unload ); CleanupStack::PushL( item ); User::LeaveIfError( etelServer.EnumeratePhones( count ) ); - + for ( count2 = 0; count2 < count && !found; ++count2 ) { RTelServer::TPhoneInfo phoneInfo; User::LeaveIfError( etelServer.GetTsyName( count2, phoneInfo.iName ) ); - - if ( phoneInfo.iName.CompareF(KMmTsyModuleName()) == 0 ) + + if ( phoneInfo.iName.CompareF(KMmTsyModuleName()) == 0 ) { User::LeaveIfError( etelServer.GetPhoneInfo( count2, phoneInfo ) ); User::LeaveIfError( phone.Open( etelServer, phoneInfo.iName ) ); @@ -894,43 +894,43 @@ // Not found. User::Leave( KErrNotFound ); } - + User::LeaveIfError( phone.GetIdentityCaps( caps ) ); if ( caps & RMobilePhone::KCapsGetSerialNumber ) { RMobilePhone::TMobilePhoneIdentityV1 id; TRequestStatus status; - + phone.GetPhoneId( status, id ); - + User::WaitForRequest( status ); - + User::LeaveIfError( status.Int() ); - + iIMEI = id.iSerialNumber.AllocL(); - + CleanupStack::PopAndDestroy( 3 ); // phone, item, etelServer - + HBufC8* buf = HBufC8::NewL( iIMEI->Size() ); TPtr8 ptr( buf->Des() ); ptr.Copy( *iIMEI ); - + DRMLOG(_L("IMEI:")); DRMLOGHEX(ptr); delete buf; - + return *iIMEI; } - + User::Leave( KErrNotFound ); - + // Never happens... - return *iIMEI; - + return *iIMEI; + #else _LIT( KDefaultSerialNumber, "123456789123456789" ); iIMEI = KDefaultSerialNumber().AllocL(); - + return *iIMEI; #endif } @@ -941,13 +941,13 @@ // const CDRMPointerArray& CDRMRightsServer::GetIMSIL() { - + if ( !iGetImsi ) { return *iIMSI; } -#ifndef __WINS__ +#ifndef __WINS__ TInt error( KErrNone ); TInt count( 0 ); TInt count2( 0 ); @@ -955,11 +955,11 @@ TBool found (EFalse); HBufC8* imsi = NULL; HBufC8* imsiNumber = NULL; - + RTelServer etelServer; RMobilePhone phone; - - TUint KMaxImeiTries = 5; + + TUint KMaxImeiTries = 5; for ( TUint8 i = 0; i < KMaxImeiTries; ++i ) { error = etelServer.Connect(); @@ -967,31 +967,31 @@ { User::After( TTimeIntervalMicroSeconds32( KWaitingTime ) ); } - else + else { break; } } - + User::LeaveIfError( error ); - CleanupClosePushL( etelServer ); - User::LeaveIfError( etelServer.LoadPhoneModule( KMmTsyModuleName ) ); - + CleanupClosePushL( etelServer ); + User::LeaveIfError( etelServer.LoadPhoneModule( KMmTsyModuleName ) ); + TUnloadModule unload; unload.iServer = &etelServer; unload.iName = &KMmTsyModuleName; - + TCleanupItem item( DoUnloadPhoneModule, &unload ); CleanupStack::PushL( item ); - + User::LeaveIfError( etelServer.EnumeratePhones( count ) ); - + for ( count2 = 0; count2 < count && !found; ++count2 ) { RTelServer::TPhoneInfo phoneInfo; User::LeaveIfError( etelServer.GetTsyName( count2, phoneInfo.iName ) ); - - if ( phoneInfo.iName.CompareF(KMmTsyModuleName()) == 0 ) + + if ( phoneInfo.iName.CompareF(KMmTsyModuleName()) == 0 ) { User::LeaveIfError( etelServer.GetPhoneInfo( count2, phoneInfo ) ); User::LeaveIfError( phone.Open( etelServer, phoneInfo.iName ) ); @@ -1005,127 +1005,127 @@ // Not found. User::Leave( KErrNotFound ); } - - + + User::LeaveIfError( phone.GetIdentityCaps( caps ) ); if( caps & RMobilePhone::KCapsGetSubscriberId ) { - RMobilePhone::TMobilePhoneSubscriberId imsiId; + RMobilePhone::TMobilePhoneSubscriberId imsiId; TRequestStatus status; - + phone.GetSubscriberId( status, imsiId ); - + User::WaitForRequest( status ); - + if( ! status.Int() ) - { + { imsi = HBufC8::NewMaxLC( imsiId.Length() + KImsiId().Size() ); TPtr8 imsiPtr(const_cast(imsi->Ptr()), 0, imsi->Size()); - + imsiNumber = CnvUtfConverter::ConvertFromUnicodeToUtf8L( imsiId ); CleanupStack::PushL( imsiNumber ); - + imsiPtr.Copy( KImsiId() ); imsiPtr.Append( *imsiNumber ); CleanupStack::PopAndDestroy(); // imsiNumber } else - { + { imsi = NULL; } } else - { + { imsi = NULL; - } - - + } + + // Clean up whatever is in there iIMSI->ResetAndDestroy(); - - if( imsi ) - { - // if we got it we wont try again + + if( imsi ) + { + // if we got it we wont try again iIMSI->AppendL( imsi ); CleanupStack::Pop(); // imsi - iGetImsi = EFalse; + iGetImsi = EFalse; } // Check for possible extra IMSI individual constraints AppendExtendedIndividualConstraintsL(&phone); - + CleanupStack::PopAndDestroy(); // phone CleanupStack::PopAndDestroy(); // cleanup item CleanupStack::PopAndDestroy(); // etel server - return *iIMSI; - + return *iIMSI; + #else HBufC8* imsi = NULL; - - if( iGetImsi ) + + if( iGetImsi ) { iGetImsi = EFalse; _LIT8( KDefaultSerialNumber, "IMSI:123456789123456789" ); imsi = KDefaultSerialNumber().AllocLC(); iIMSI->AppendL( imsi ); - CleanupStack::Pop(); + CleanupStack::Pop(); AppendExtendedIndividualConstraintsL(); } - + return *iIMSI; #endif // __WINS__ } -// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // CDRMRightsServer::AppendExtendedIndividualConstraintsL // If the extension DLL exists it is loaded and used to obtain additional // valid individual constraints -// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- void CDRMRightsServer::AppendExtendedIndividualConstraintsL(RMobilePhone* aMobilePhone) - { + { // Load the externsion DLL RLibrary lib; - + #ifndef RD_MULTIPLE_DRIVE - + if (lib.LoadRomLibrary(KDRMIndividualConstraintExtensionDll,KNullDesC)==KErrNone) - + #else //RD_MULTIPLE_DRIVE - + TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber ); - iFs.DriveToChar( driveNumber, driveLetter ); - - TFileName individualConstraindExtensionDll; - individualConstraindExtensionDll.Format( - KIndividualConstraintExtensionDll, (TUint)driveLetter ); - + iFs.DriveToChar( driveNumber, driveLetter ); + + TFileName individualConstraindExtensionDll; + individualConstraindExtensionDll.Format( + KIndividualConstraintExtensionDll, (TUint)driveLetter ); + if ( lib.LoadRomLibrary( individualConstraindExtensionDll, KNullDesC ) == KErrNone ) - + #endif - - { + + { CleanupClosePushL(lib); - // Get first exported ordinal - factory method returning + // Get first exported ordinal - factory method returning // MDRMIndividualConstraintExtension* - TLibraryFunction factory = lib.Lookup(1); + TLibraryFunction factory = lib.Lookup(1); if (factory) { // Instantiate object - MDRMIndividualConstraintExtension* extendedConstraints = + MDRMIndividualConstraintExtension* extendedConstraints = reinterpret_cast(factory()); if (extendedConstraints) { - CleanupStack::PushL(TCleanupItem(Release,extendedConstraints)); + CleanupStack::PushL(TCleanupItem(Release,extendedConstraints)); extendedConstraints->AppendConstraintsL(*iIMSI,aMobilePhone); - CleanupStack::PopAndDestroy(extendedConstraints); //calls Release + CleanupStack::PopAndDestroy(extendedConstraints); //calls Release } } @@ -1139,8 +1139,8 @@ // ----------------------------------------------------------------------------- void CDRMRightsServer::Release(TAny* aIndividualConstraintExtension) { - MDRMIndividualConstraintExtension* extendedConstraints = - reinterpret_cast(aIndividualConstraintExtension); + MDRMIndividualConstraintExtension* extendedConstraints = + reinterpret_cast(aIndividualConstraintExtension); extendedConstraints->Release(); //free resources } @@ -1152,14 +1152,14 @@ void CDRMRightsServer::HandleBackupEventL( TInt aBackupEvent ) { - //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::BackupCalled\n\r")); + //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::BackupCalled\n\r")); //conn::TBURPartType eventType; //conn::TBackupIncType incType; TDriveList aDriveList; - - //RFileLogger::WriteFormat(KLogDir, KLogName, EFileLoggingModeAppend, _L8("backupevent: %d"), aBackupEvent); - + + //RFileLogger::WriteFormat(KLogDir, KLogName, EFileLoggingModeAppend, _L8("backupevent: %d"), aBackupEvent); + // If there is no operation going or state is normal // Delete the client and handler @@ -1169,73 +1169,73 @@ /* if( aBackupEvent == conn::EBURUnset ) { - RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Unset\n\r")); + RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Unset\n\r")); } - else + else { - RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Normal\n\r")); - } - */ + RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Normal\n\r")); + } + */ if( iActiveBackupClient ) { delete iActiveBackupClient; - iActiveBackupClient = NULL; + iActiveBackupClient = NULL; } - + if( iBackupHandler ) { delete iBackupHandler; - iBackupHandler = NULL; + iBackupHandler = NULL; } - } + } else if( aBackupEvent & conn::EBURBackupFull || aBackupEvent & conn::EBURRestoreFull ) { - //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Full\n\r")); + //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Full\n\r")); // ab handler iBackupHandler = CDRMBackup::NewL( iDb, iFs ); - + // ab client iActiveBackupClient = conn::CActiveBackupClient::NewL( iBackupHandler ); - + // Confirm that we have done everything if there even was anything to do - //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Confirm F \n\r")); - iActiveBackupClient->ConfirmReadyForBURL( KErrNone ); + //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Confirm F \n\r")); + iActiveBackupClient->ConfirmReadyForBURL( KErrNone ); } else if( aBackupEvent & conn::EBURBackupPartial || aBackupEvent & conn::EBURRestorePartial ) { - //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Partial\n\r")); + //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Partial\n\r")); // ab handler iBackupHandler = CDRMBackup::NewL( iDb, iFs ); - + // ab client - iActiveBackupClient = conn::CActiveBackupClient::NewL( iBackupHandler ); + iActiveBackupClient = conn::CActiveBackupClient::NewL( iBackupHandler ); - if( !iActiveBackupClient->DoesPartialBURAffectMeL() ) + if( !iActiveBackupClient->DoesPartialBURAffectMeL() ) { - //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::NotMe\n\r")); + //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::NotMe\n\r")); delete iActiveBackupClient; - iActiveBackupClient = NULL; + iActiveBackupClient = NULL; delete iBackupHandler; - iBackupHandler = NULL; + iBackupHandler = NULL; } else { - //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Confirm P \n\r")); + //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Confirm P \n\r")); // Confirm that we have done everything if there even was anything to do iActiveBackupClient->ConfirmReadyForBURL( KErrNone ); - //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Confirm P Done \n\r")); - } + //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Confirm P Done \n\r")); + } } - else + else { - //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Argument\n\r")); + //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Argument\n\r")); // Unknown operation - User::Leave(KErrArgument); + User::Leave(KErrArgument); } - }; + }; // ----------------------------------------------------------------------------- // CDRMRightsServer::WatchedObjectChangedL @@ -1246,7 +1246,7 @@ { DRMLOG( _L( "CDRMRightsServer::WatchedObjectChangedL ->" ) ); DRMLOG( aObject ); - + if ( aObject.Left( KDirIdentifier().Length() ) == KDirIdentifier && !iDb->Updating() && iArmed ) { @@ -1259,7 +1259,7 @@ User::LeaveIfError( starter.Connect() ); starter.Reset( RStarterSession::EDRMReset ); starter.Close(); -#endif +#endif } else if ( aObject.Left( KProcIdentifier().Length() ) == KProcIdentifier && iArmed ) { @@ -1273,10 +1273,10 @@ starter.Close(); #endif } - + DRMLOG( _L( "CDRMRightsServer::WatchedObjectChangedL <-" ) ); } - + // ----------------------------------------------------------------------------- // CDRMRightsServer::HasActiveCountConstraint // Check ID for active count constraint @@ -1286,7 +1286,7 @@ { TInt i; TBool r = EFalse; - + for ( i = 0; r == EFalse && i < iActiveCountConstraints.Count(); i++ ) { if ( iActiveCountConstraints[i]->CompareF( aContentId ) == 0 ) @@ -1307,7 +1307,7 @@ TInt i; TInt r = KErrNotFound; HBufC8* id = NULL; - + for ( i = 0; r == KErrNotFound && i < iActiveCountConstraints.Count(); i++ ) { if ( iActiveCountConstraints[i]->CompareF( aContentId ) == 0 ) @@ -1317,7 +1317,7 @@ } if ( r != KErrNotFound ) { - id = iActiveCountConstraints[r]; + id = iActiveCountConstraints[r]; iActiveCountConstraints.Remove( r ); delete id; id = NULL; @@ -1373,7 +1373,7 @@ &rights); TDRMUniqueID id; TTime time; - + DRMLOG( _L( "CDRMRightsServer::ImportRightsObjectsL" ) ); DRMLOG( aImportDir ); __UHEAP_MARK; @@ -1402,7 +1402,7 @@ CleanupStack::PushL( listCleanup ); CDRMPermission& permission = rights[0]->GetPermission(); CDRMAsset& asset = rights[0]->GetAsset(); - + // Add RO only if no rights are available at all for this content TRAP( r, k = iDb->GetDecryptionKeyL( *asset.iUid ) ); if (k == NULL ) @@ -1423,14 +1423,14 @@ __UHEAP_MARKEND; DRMLOG( _L( "CDRMRightsServer::ImportRightsObjectsL done" ) ); } -#endif - +#endif + // ========================== OTHER EXPORTED FUNCTIONS ========================= -TInt E32Main() +TInt E32Main() { - return Startup(); + return Startup(); } diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/server/src/drmconsume.cpp --- a/omadrm/drmengine/server/src/drmconsume.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/server/src/drmconsume.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -20,16 +20,16 @@ #include "drmconsume.h" #include "drmenginetypedefs.h" #include "drmrightsdb.h" -#include "drmrightsserver.h" -#include "drmdbsession.h" +#include "DRMRightsServer.h" +#include "DRMDbSession.h" #include "drmlog.h" -#include "drmeventmodify.h" -#include "drmnotifier.h" +#include "DRMEventModify.h" +#include "DRMNotifier.h" #ifdef RD_DRM_METERING #include "drmmeteringdb.h" #include "drmmeteringdbdata.h" -#include "roapstorageclient.h" -#include "drmricontext.h" +#include "RoapStorageClient.h" +#include "DRMRIContext.h" #endif // EXTERNAL DATA STRUCTURES @@ -42,17 +42,17 @@ #define DB static_cast< CDRMRightsServer* >( const_cast< CServer2* >( \ iSession.Server() ) )->Database() - + #define SECURETIME( a ) static_cast< CDRMRightsServer* >\ ( const_cast< CServer2* >( \ iSession.Server() ) )->GetSecureTime( a ) - + #define SERVER static_cast< CDRMRightsServer* >( const_cast< CServer2* >( \ iSession.Server() ) ) - + #ifdef RD_DRM_METERING #define METERINGDB static_cast< CDRMRightsServer* >( const_cast< CServer2* >( \ - iSession.Server() ) )->MeteringDatabase() + iSession.Server() ) )->MeteringDatabase() #endif #define SETBIT( a, b ) ( a ) |= ( b ) @@ -69,7 +69,7 @@ // These keep track whether to decrease timed counters when consuming time // based stuff (iTimedCounts member). A used timed count bit is set to zero. // In the beginning all of these are set to one. -//static const TUint8 KParentToplevelCount = 0x01; +//static const TUint8 KParentToplevelCount = 0x01; //static const TUint8 KParentPermCount = 0x02; static const TUint8 KChildToplevelCount = 0x04; static const TUint8 KChildPermCount = 0x08; @@ -96,7 +96,7 @@ aFirst = aSecond; } } - + // ------------------------------------------------------------------------ // PickSmaller (overloaded) // @@ -111,7 +111,7 @@ aFirst = aSecond; } } - + // ============================ MEMBER FUNCTIONS ========================== // ------------------------------------------------------------------------ @@ -124,13 +124,13 @@ { DRMLOG( _L( "CDRMConsume::NewLC" ) ); CDRMConsume* self = new( ELeave ) CDRMConsume( aSession ); - + CleanupStack::PushL( self ); - + self->ConstructL( aURI, aParentId ); - + DRMLOG( _L( "CDRMConsume::NewLC ok" ) ); - return self; + return self; } // ------------------------------------------------------------------------ @@ -141,10 +141,10 @@ { DRMLOG( _L( "CDRMConsume::~" ) ); TInt error( KErrNone ); - - if( IsActive() ) + + if( IsActive() ) { - Cancel(); + Cancel(); } else { @@ -156,7 +156,7 @@ #endif // ignore errors //TRAP( error, UpdateDBL() ); - + delete iURI; iURI = NULL; delete iParentId; iParentId = NULL; delete iChild; iChild = NULL; @@ -185,7 +185,7 @@ iCumulativeDelayTop( 0 ), iCumulativeDelayChild( 0 ), iTotalCumulativeTime( 0 ), - iUsingTimedCount( 0 ) + iUsingTimedCount( 0 ) { } @@ -201,7 +201,7 @@ iURI = aURI.AllocL(); if( aParentId ) { - iParentId = aParentId->AllocL(); + iParentId = aParentId->AllocL(); } } @@ -212,11 +212,11 @@ void CDRMConsume::HandleL( ContentAccess::TIntent aIntent ) { DRMLOG( _L( "CDRMConsume::HandleL" ) ); - + TTime time; TBool secure( SECURETIME( time ) ); InitializeL( aIntent, secure, time ); - + DRMLOG( _L( "CDRMConsume::HandleL ok" ) ); } @@ -227,9 +227,9 @@ void CDRMConsume::Pause() { DRMLOG( _L( "CDRMConsume::Pause" ) ); - + Cancel(); - + DRMLOG( _L( "CDRMConsume::Pause ok" ) ); } @@ -240,15 +240,15 @@ void CDRMConsume::ContinueL() { DRMLOG( _L( "CDRMConsume::ContinueL" ) ); - + Cancel(); - + TInt error = KErrNone; TUint32 reason = 0; - + CDRMPermission* child = NULL; HBufC8* parent = NULL; - + // This got removed by Pause() if( iCountConstraintActive ) { @@ -256,48 +256,48 @@ DoContinueL(); return; } - - /* Fetch the RO again in order to manage a situation when another + + /* Fetch the RO again in order to manage a situation when another instance has used the same RO (content has been consumed) while the - other instance has not been used (player is paused) but will be - used again (content consumption is to be continued). */ + other instance has not been used (player is paused) but will be + used again (content consumption is to be continued). */ error = iSession.FindRightsObject( iIntent, *iURI, child, parent, reason ); - + /* Check if the RO found from the database matches with the one that was used in the original consumption of the content. If the ROs match, use the (possibly updated) one from the database. */ - if ( !error && child && iChild && + if ( !error && child && iChild && ( iChild->iUniqueID == child->iUniqueID ) && ( iChild->iOriginalInsertTime == child->iOriginalInsertTime ) ) { if ( iParentId ) { - delete iParentId; + delete iParentId; iParentId = parent; } - + delete iChild; iChild = child; - } - else + } + else { /* The original RO was not found. Delete temporary objects and also delete the iChild and iCombined because the RO is no longer valid and - need to be re-fetched using InitializeL method (in DoContinueL). - (in DoContinueL). */ + need to be re-fetched using InitializeL method (in DoContinueL). + (in DoContinueL). */ if ( iChild ) { delete iChild; iChild = NULL; } - + if ( iCombined ) { delete iCombined; iCombined = NULL; } - - if ( child ) + + if ( child ) { delete child; child = NULL; @@ -307,12 +307,12 @@ delete parent; parent = NULL; } - } - + } + DoContinueL(); - + //HandleL( iIntent ); - + DRMLOG( _L( "CDRMConsume::ContinueL ok" ) ); } @@ -323,16 +323,16 @@ void CDRMConsume::Stop() { DRMLOG( _L( "CDRMConsume::Stop" ) ); - + Cancel(); - + DRMLOG( _L( "CDRMConsume::Stop ok" ) ); - } + } // ------------------------------------------------------------------------ // CDRMConsume:: ActivateL // -// Calculate the smallest end time based on interval, end time, +// Calculate the smallest end time based on interval, end time, // accumulated time & timed count. // ------------------------------------------------------------------------ // @@ -340,33 +340,33 @@ const TTime& aTrustedTime ) { DRMLOG( _L( "CDRMConsume::ActivateL" ) ); - + __ASSERT_DEBUG( iChild && iCombined, User::Invariant() ); TTime endTime( Time::MaxTTime() ); TTimeIntervalSeconds timed( KMaxTInt32 ); TBool timeUsed( EFalse ); TBool endTimeUsed( EFalse ); - + iCurrentDelay = 0; - + if ( iCombined->iActiveConstraints & EConstraintTimedCounter ) { - // Take this, even if timed counts have been updated. - // This might cause unnecessary RunL's to be called, but it + // Take this, even if timed counts have been updated. + // This might cause unnecessary RunL's to be called, but it // ensures both child & parent will be consumed when needed. - // If e.g. it would be checked that iTimedCounts == 0xf, + // If e.g. it would be checked that iTimedCounts == 0xf, // either one (child or parent) might not get updated in case of - // "Child expired, but parent didn't -> find new child". + // "Child expired, but parent didn't -> find new child". PickSmaller( timed, iCombined->iTimedInterval ); timeUsed = ETrue; } - + if ( iCombined->iActiveConstraints & EConstraintAccumulated ) { PickSmaller( timed, iCombined->iAccumulatedTime ); timeUsed = ETrue; } - + if ( iCombined->iActiveConstraints & EConstraintInterval ) { if ( iCombined->iIntervalStart != Time::NullTTime() ) @@ -378,46 +378,46 @@ else { TInt64 tmp( iCombined->iInterval.Int() ); - + PickSmaller( timed, tmp ); timeUsed = ETrue; } } - + if ( iCombined->iActiveConstraints & EConstraintEndTime ) { PickSmaller( endTime, iCombined->iEndTime ); endTimeUsed = ETrue; } - + // Put the "smallest time" information to "endTime". if ( timeUsed ) { TTime current( aTrustedTime ); - + current += timed; - + PickSmaller( endTime, current ); endTimeUsed = ETrue; } - + // Interval gets initialised immediately, and so do count constraints. - // Timed/accumulated won't: those are consumed after the + // Timed/accumulated won't: those are consumed after the // interval if secure time exists. Consume( ETrue, ETrue, EFalse, 0, aSecureTime, aTrustedTime ); - + // In case something was modified, update the db also. UpdateDBL(); - + if ( endTimeUsed ) - { + { // Something exists. TTimeIntervalSeconds secs( 0 ); TTime current( aTrustedTime ); TInt err( KErrNone ); - + // SecondsFrom returns an error if the difference is too great. err = endTime.SecondsFrom( current, secs ); if ( err ) @@ -436,45 +436,45 @@ { iCurrentDelay = KConsumeDefaultTimer; } - + if ( !IsAdded() ) { CActiveScheduler::Add( this ); } - - DRMLOG2( _L( "CDRMConsume::ActivateL: using interval %d" ), + + DRMLOG2( _L( "CDRMConsume::ActivateL: using interval %d" ), ( TInt )iCurrentDelay ); - + // secs -> microsecs. The method sets the AO active. After( TTimeIntervalMicroSeconds32( iCurrentDelay * 1000000 ) ); - + iTime = current; - - // If we see timed things here, we also have secure time. + + // If we see timed things here, we also have secure time. //SETBIT( iMask, KConsumeHasSecureTime ); } else // For metering we always need to have this: { iCurrentDelay = KConsumeDefaultTimer; iTime = aTrustedTime; - + if ( !IsAdded() ) { CActiveScheduler::Add( this ); } - - DRMLOG2( _L( "CDRMConsume::ActivateL: using interval %d" ), + + DRMLOG2( _L( "CDRMConsume::ActivateL: using interval %d" ), ( TInt )iCurrentDelay ); - + // secs -> microsecs. The method sets the AO active. - After( TTimeIntervalMicroSeconds32( iCurrentDelay * 1000000 ) ); - } - - // If we see timed things here, we also have secure time. + After( TTimeIntervalMicroSeconds32( iCurrentDelay * 1000000 ) ); + } + + // If we see timed things here, we also have secure time. if( aTrustedTime != Time::NullTTime()) { - SETBIT( iMask, KConsumeHasSecureTime ); - } + SETBIT( iMask, KConsumeHasSecureTime ); + } DRMLOG( _L( "CDRMConsume::ActivateL ok" ) ); } @@ -482,7 +482,7 @@ // CDRMConsume:: Consume // // Consume child & parent. Whether to consume parent's explicit -// usage permission: the information is returned earlier by +// usage permission: the information is returned earlier by // FindRightsObjectL. // ------------------------------------------------------------------------ // @@ -494,22 +494,22 @@ const TTime& aTrustedTime ) { DRMLOG( _L( "CDRMConsume::Consume" ) ); - + __ASSERT_DEBUG( iChild && iCombined, User::Invariant() ); - + // Decrease timed counters & regular counters only once. - // In the beginning the bitmasks are both 0xF. + // In the beginning the bitmasks are both 0xF. if ( iChild->TopLevelConstraint() ) { if ( ConsumeConstraint( *( iChild->TopLevelConstraint() ), - ( aUpdateCounter && + ( aUpdateCounter && ISSET( iCounters, KChildToplevelCount ) ), aInitInterval, - ( aUpdateTimedCount && - ISSET( iTimedCounts, + ( aUpdateTimedCount && + ISSET( iTimedCounts, KChildToplevelCount ) ), aElapsedTime, - aSecureTime, + aSecureTime, aTrustedTime, iCumulativeDelayTop ) ) { @@ -524,12 +524,12 @@ } } } - + if ( ConsumeConstraint( *( iChild->ConstraintForIntent( iIntent ) ), - ( aUpdateCounter && + ( aUpdateCounter && ISSET( iCounters, KChildPermCount ) ), aInitInterval, - ( aUpdateTimedCount && + ( aUpdateTimedCount && ISSET( iTimedCounts, KChildPermCount ) ), aElapsedTime, aSecureTime, @@ -546,7 +546,7 @@ CLRBIT( iCounters, KChildPermCount ); } } - + DRMLOG( _L( "CDRMConsume::Consume ok" ) ); } @@ -557,15 +557,15 @@ void CDRMConsume::RunL() { DRMLOG2( _L( "CDRMConsume::RunL with %d" ), iStatus.Int() ); - + switch ( iStatus.Int() ) { case KErrNone: // Normal completition. - + case KErrUnderflow: // Time already passed. - + case KErrAbort: // System time changed ==> consume. DoContinueL(); @@ -576,7 +576,7 @@ // Handled in RunError. User::Leave( iStatus.Int() ); }; - + DRMLOG( _L( "CDRMConsume::RunL ok" ) ); } @@ -591,9 +591,9 @@ #endif { DRMLOG2( _L( "CDRMConsume::RunError: %d" ), aError ); - + Deque(); - + DRMLOG( _L( "CDRMConsume::RunError ok" ) ); return 0; } @@ -605,10 +605,10 @@ void CDRMConsume::DoCancel() { DRMLOG( _L( "CDRMConsume::DoCancel" ) ); - + TInt error( KErrNone ); TRAP( error, DoCancelL() ); - + DRMLOG2( _L( "CDRMConsume::DoCancel: %d" ), error ); } @@ -619,51 +619,51 @@ void CDRMConsume::DoCancelL() { DRMLOG( _L( "CDRMConsume::DoCancelL" ) ); - + if ( iCurrentDelay ) { TTimeIntervalSeconds secs; TTime trustedTime; TBool secureTime; - + CTimer::DoCancel(); - + secureTime = SECURETIME( trustedTime ); trustedTime.SecondsFrom( iTime, secs ); - + #ifdef RD_DRM_METERING // Update total cumulative time for content metering purposes iTotalCumulativeTime = iTotalCumulativeTime.Int() + secs.Int(); #endif - + // If the top level timed counter has not been activated yet // increment the counter if( ISSET( iTimedCounts, KChildToplevelCount ) ) { - iCumulativeDelayTop = iCumulativeDelayTop.Int() + secs.Int(); + iCumulativeDelayTop = iCumulativeDelayTop.Int() + secs.Int(); } // If the child timed counter has not been activated yet - // increment the counter + // increment the counter if( ISSET( iTimedCounts, KChildPermCount ) ) { iCumulativeDelayChild = iCumulativeDelayChild.Int() + secs.Int(); } - + // Always >= 0. ConsumeTimedItemsL( secs, - secureTime, + secureTime, trustedTime ); iCurrentDelay = 0; } - + UpdateDBL(); - + if ( SERVER->HasActiveCountConstraint( *iURI ) ) { SERVER->RemoveActiveCountConstraint( *iURI ); } - + DRMLOG( _L( "CDRMConsume::DoCancel ok" ) ); } @@ -677,20 +677,20 @@ void CDRMConsume::CombinePermissionsL() { DRMLOG( _L( "CDRMConsume::CombinePermissions" ) ); - + __ASSERT_DEBUG( iChild, User::Invariant() ); - + // Reset delete iCombined; iCombined = NULL; iCombined = CDRMConstraint::NewL(); - + if ( iChild->TopLevelConstraint() ) { iCombined->Merge( *( iChild->TopLevelConstraint() ) ); } - + iCombined->Merge( *( iChild->ConstraintForIntent( iIntent ) ) ); - + DRMLOG( _L( "CDRMConsume::CombinePermissions ok" ) ); } @@ -704,20 +704,20 @@ { DRMLOG( _L( "CDRMConsume::UpdateDBL" ) ); // __ASSERT_DEBUG( iChild, User::Invariant() ); - + CDRMEventModify* event = NULL; TRequestStatus status; - - if( ISSET( iMask, KConsumeChildModified ) ) + + if( ISSET( iMask, KConsumeChildModified ) ) { event = CDRMEventModify::NewL(); } - CleanupStack::PushL( event ); + CleanupStack::PushL( event ); if ( ISSET( iMask, KConsumeChildModified ) ) { DRMLOG( _L( "CDRMConsume: commiting child to DB" ) ); - + if( iParentId ) { DB.UpdateDBEntryL( *iParentId, *iChild ); @@ -727,30 +727,30 @@ } else { - DB.UpdateDBEntryL( *iURI, *iChild ); + DB.UpdateDBEntryL( *iURI, *iChild ); // Notify event->SetContentIDL(*iURI); event->SetUniqueID(iChild->iUniqueID); - } - + } + // Notify event->SetContentIDL(*iURI); event->SetUniqueID(iChild->iUniqueID); - + NOTIFIER.SendEventL(*event,status); - User::WaitForRequest(status); - + User::WaitForRequest(status); + CLRBIT( iMask, KConsumeChildModified ); } - - CleanupStack::PopAndDestroy(); + + CleanupStack::PopAndDestroy(); DRMLOG( _L( "CDRMConsume::UpdateDBL ok" ) ); } // ------------------------------------------------------------------------ // CDRMConsume::ConsumeConstraint // // Consume child & parent. Whether to consume parent's explicit -// usage permission: the information is returned earlier by +// usage permission: the information is returned earlier by // FindRightsObjectL. // ------------------------------------------------------------------------ // @@ -764,18 +764,18 @@ TTimeIntervalSeconds& aCumulativeTime ) { DRMLOG( _L( "CDRMConsume::ConsumeConstraints" ) ); - + TBool res( EFalse ); - - if ( aUpdateCounter && + + if ( aUpdateCounter && ( aConstraint.iActiveConstraints & EConstraintCounter ) ) { --( aConstraint.iCounter); res = ETrue; iCountConstraintActive = ETrue; - TRAP_IGNORE( SERVER->AddActiveCountConstraintL( *iURI ) ); + TRAP_IGNORE( SERVER->AddActiveCountConstraintL( *iURI ) ); } - + if ( aInitInterval && ( aConstraint.iActiveConstraints & EConstraintInterval ) && aSecureTime && @@ -784,10 +784,10 @@ aConstraint.iIntervalStart = aTrustedTime; res = ETrue; } - + /* change to timed counter, we don't check the latest time, we check the - cumulated time */ - + cumulated time */ + if ( aUpdateTimedCount && ( aConstraint.iActiveConstraints & EConstraintTimedCounter && ( aCumulativeTime >= aConstraint.iTimedInterval || @@ -796,7 +796,7 @@ --( aConstraint.iTimedCounter ); res = ETrue; iCountConstraintActive = ETrue; - TRAP_IGNORE( SERVER->AddActiveCountConstraintL( *iURI ) ); + TRAP_IGNORE( SERVER->AddActiveCountConstraintL( *iURI ) ); aCumulativeTime = TTimeIntervalSeconds( 0 ); } else if ( aUpdateTimedCount && @@ -804,26 +804,26 @@ { iUsingTimedCount = ETrue; } - - + + if ( aElapsedTime.Int() != 0 && ( aConstraint.iActiveConstraints & EConstraintAccumulated ) ) { __ASSERT_DEBUG( aElapsedTime.Int() > 0, User::Invariant() ); - + if ( aConstraint.iAccumulatedTime < aElapsedTime ) { aConstraint.iAccumulatedTime = 0; } else { - aConstraint.iAccumulatedTime = aConstraint.iAccumulatedTime.Int() - - aElapsedTime.Int(); + aConstraint.iAccumulatedTime = aConstraint.iAccumulatedTime.Int() - + aElapsedTime.Int(); } - + res = ETrue; } - + if ( !iCountConstraintActive && aConstraint.Expired( aTrustedTime ) ) { iExpired = ETrue; @@ -832,11 +832,11 @@ { iExpired = EFalse; } - - DRMLOG2( - _L( "CDRMConsume::ConsumeConstraints ok, returning %d" ), + + DRMLOG2( + _L( "CDRMConsume::ConsumeConstraints ok, returning %d" ), ( TInt )res ); - + return res; } @@ -849,7 +849,7 @@ const TTime& aTrustedTime ) { DRMLOG( _L( "CDRMConsume::ConsumeTimedItemsL" ) ); - + // Update accumulated constraints & timed count. Consume( EFalse, ETrue, @@ -857,7 +857,7 @@ aDelay, aSecureTime, aTrustedTime ); - + DRMLOG( _L( "CDRMConsume::ConsumeTimedItems ok" ) ); } @@ -868,29 +868,29 @@ void CDRMConsume::DoContinueL() { DRMLOG( _L( "CDRMConsume::DoContinueL" ) ); - + TTime time; TBool secureTime( EFalse ); secureTime = SECURETIME( time ); - + if ( !iChild || !iCombined ) { InitializeL( iIntent, secureTime, time ); // User::Leave( KErrCANoRights ); return; } - + ConsumeTimedItemsL( iCurrentDelay, secureTime, time ); UpdateDBL(); iCurrentDelay = 0; - + CombinePermissionsL(); - + // If the content has expired, find new permissions, unless the expired // constraint was a timed count. In that case, the constraint // did not really expire. if ( SecurityLevelChanged( secureTime ) || - ( iCombined->Expired( time ) && + ( iCombined->Expired( time ) && !SERVER->HasActiveCountConstraint( *iURI ) ) ) { InitializeL( iIntent, secureTime, time ); @@ -899,7 +899,7 @@ { ActivateL( secureTime, time ); } - + DRMLOG( _L( "CDRMConsume::DoContinueL ok" ) ); } @@ -910,13 +910,13 @@ TBool CDRMConsume::SecurityLevelChanged( TBool aSecureTime ) const { DRMLOG( _L( "CDRMConsume::SecurityLevelChanged" ) ); - + if ( ( ISSET( iMask, KConsumeHasSecureTime ) && aSecureTime ) || !( ISSET( iMask, KConsumeHasSecureTime ) || aSecureTime ) ) { return EFalse; } - + return ETrue; } @@ -929,73 +929,73 @@ const TTime& aTrustedTime ) { DRMLOG( _L( "CDRMConsume::InitializeL" ) ); - + // aIntent is either EPlay, EView, EExecute or EPrint. - // Store the old consumption information in case this is + // Store the old consumption information in case this is // called in case of "ran out of permissions, find new ones" CDRMPermission* child( iChild ); TUint8 timedCounts( iTimedCounts ); TUint8 counters( iCounters ); TUint32 reason = 0; - + // Reset. iTimedCounts = 0xf; iCounters = 0xf; iMask = 0x0; iCurrentDelay = 0; - + iExpired = ETrue; - + delete iCombined; iCombined = NULL; - - // Previous child & parent need to be stored in case the internal + + // Previous child & parent need to be stored in case the internal // counter states need to be restored. if ( child ) { CleanupStack::PushL( child ); iChild = NULL; } - + // If the next call won't leave, we have permissions. - User::LeaveIfError( iSession.FindRightsObject( aIntent, + User::LeaveIfError( iSession.FindRightsObject( aIntent, *iURI, iChild, iParentId, reason ) ); - + User::LeaveIfError( iSession.VerifyCredentials( iURI, iChild, aIntent ) ); - + iExpired = EFalse; // Check whether to restore the internal state. - if ( iIntent == aIntent ) + if ( iIntent == aIntent ) { - if ( child && + if ( child && ( child->iUniqueID == iChild->iUniqueID ) ) { DRMLOG( _L( "CDRMConsume: using the previous child" ) ); - - CLRBIT( iTimedCounts, + + CLRBIT( iTimedCounts, ( KChildToplevelCount | KChildPermCount ) & ~timedCounts ); - + CLRBIT( iCounters, ( KChildToplevelCount | KChildPermCount ) & ~counters ); } } - + if ( child ) { CleanupStack::PopAndDestroy(); } - + iIntent = aIntent; - + CombinePermissionsL(); ActivateL( aSecureTime, aTrustedTime ); DRMLOG( _L( "CDRMConsume::InitializeL ok" ) ); } - + // ------------------------------------------------------------------------ // CDRMConsume::CountConstraintActive // ------------------------------------------------------------------------ @@ -1031,65 +1031,65 @@ // void CDRMConsume::UpdateMeteringDbL() { - DRMLOG( _L( "CDRMConsume::UpdateMeteringDbL" ) ); + DRMLOG( _L( "CDRMConsume::UpdateMeteringDbL" ) ); TTimeIntervalSeconds graceTime = 0; CDRMConstraint* constraint = NULL; - + if ( iChild ) { - constraint = iChild->ConstraintForIntent( iIntent ); - if ( constraint && constraint->iDrmMeteringInfo ) - { - + constraint = iChild->ConstraintForIntent( iIntent ); + if ( constraint && constraint->iDrmMeteringInfo ) + { + graceTime = constraint->iDrmMeteringInfo->iGraceTime; - - // Grace time exceeded, increase metering count and metering - // accumulated time - if ( iTotalCumulativeTime >= graceTime ) + + // Grace time exceeded, increase metering count and metering + // accumulated time + if ( iTotalCumulativeTime >= graceTime ) { // Check Rights Issuer rights from Roap storage - if ( !CheckRiContextRightsL( iChild->iRiId ) ) + if ( !CheckRiContextRightsL( iChild->iRiId ) ) { return; } - + // Update database only if Rights Issuer Id is available - if ( ( iChild->iRiId.Length() > 0 ) && - ( iChild->iRiId.Length() <= KRiIdSize ) ) + if ( ( iChild->iRiId.Length() > 0 ) && + ( iChild->iRiId.Length() <= KRiIdSize ) ) { - + if ( iURI ) { - CDrmMeteringDbData* meteringData = + CDrmMeteringDbData* meteringData = CDrmMeteringDbData::NewLC(); meteringData->iContentId = iURI->AllocL(); - meteringData->iRiId = iChild->iRiId; - if( iUsingTimedCount && !iCountConstraintActive ) + meteringData->iRiId = iChild->iRiId; + if( iUsingTimedCount && !iCountConstraintActive ) { - meteringData->iCount = 0; + meteringData->iCount = 0; } else { meteringData->iCount = 1; } - + meteringData->iAccumulatedTime = iTotalCumulativeTime; - - if ( iParentId ) + + if ( iParentId ) { meteringData->iParentUid = iParentId->AllocL(); } - + METERINGDB.AddL( meteringData ); CleanupStack::PopAndDestroy(); // meteringData - } + } } - } - } + } + } } DRMLOG( _L( "CDRMConsume::UpdateMeteringDbL ok" ) ); } - + // ------------------------------------------------------------------------ // CDRMConsume::CheckRiContextRightsL // ------------------------------------------------------------------------ @@ -1097,40 +1097,40 @@ TBool CDRMConsume::CheckRiContextRightsL( const TDesC8& aRiId ) { - + DRMLOG( _L( "CDRMConsume::CheckRiContextRightsL" ) ); - + CDRMRIContext* riContext = NULL; - TBool haveRights = EFalse; - - // Connect to the storage of the registered Rights Issuers - + TBool haveRights = EFalse; + + // Connect to the storage of the registered Rights Issuers + if( iSession.ConnectRoapClient() == KErrNone ) { riContext = iSession.RoapClient().GetRIContextL( aRiId ); - + if ( riContext == NULL ) { DRMLOG( _L ( "RI not registered" ) ); User::Leave( KErrRightsServerRiNotRegistered ); } - - // Check (via the Rights Issuer context) whether Rights Issuer + + // Check (via the Rights Issuer context) whether Rights Issuer // is allowed to use metering or not if ( riContext->IsMeteringAllowed() ) { haveRights = ETrue; } - - if ( riContext ) + + if ( riContext ) { delete riContext; - riContext = NULL; + riContext = NULL; } } - + return haveRights; - + } #endif diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/server/src/drmmeteringdb.cpp --- a/omadrm/drmengine/server/src/drmmeteringdb.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/server/src/drmmeteringdb.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,8 +19,8 @@ // INCLUDE FILES #include -#include -#include +#include +#include #include "drmlog.h" #include "drmmeteringdb.h" #ifdef RD_DRM_METERING @@ -651,5 +651,5 @@ } #endif - + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/server/src/drmparentstorage.cpp --- a/omadrm/drmengine/server/src/drmparentstorage.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/server/src/drmparentstorage.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -18,13 +18,13 @@ // INCLUDE FILES #include "drmparentstorage.h" -#include "drmpermission.h" +#include "DrmPermission.h" #include "drmlog.h" // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS @@ -42,20 +42,20 @@ // ============================= LOCAL FUNCTIONS =============================== - + // ============================ MEMBER FUNCTIONS =============================== // ----------------------------------------------------------------------------- // CDRMParentStorage::CDRMParentStorage // -// Default constructor +// Default constructor // ----------------------------------------------------------------------------- // CDRMParentStorage::CDRMParentStorage(): iParents( 1 ) { } - + // ----------------------------------------------------------------------------- // CDRMParentStorage::~CDRMParentStorage // @@ -69,12 +69,12 @@ iParentIDs->Reset(); delete iParentIDs; } - + // The lists inside are autocleaning, so deletion causes - // the contents to also be deleted + // the contents to also be deleted iParents.ResetAndDestroy(); } - + // ----------------------------------------------------------------------------- // CDRMParentStorage::NewLC // @@ -85,26 +85,26 @@ { CDRMParentStorage* self = new( ELeave ) CDRMParentStorage; CleanupStack::PushL( self ); - + self->ConstructL(); - + return self; } - + // ----------------------------------------------------------------------------- // CDRMParentStorage::NewL // // Two-phase constructor // ----------------------------------------------------------------------------- -// +// CDRMParentStorage* CDRMParentStorage::NewL() { CDRMParentStorage* self = CDRMParentStorage::NewLC(); CleanupStack::Pop(); // sefl - + return self; } - + // ----------------------------------------------------------------------------- // CDRMParentStorage::ConstructL // @@ -115,30 +115,30 @@ { iParentIDs = new( ELeave ) CDesC8ArraySeg( KDefaultGranularity ); } - + // ----------------------------------------------------------------------------- // CDRMParentStorage::NewListL // // Insert a new list to the storage, and return a handle to it. // ----------------------------------------------------------------------------- -// +// CDRMPermissionList& CDRMParentStorage::NewListL() { __ASSERT_DEBUG( iParents.Count() >= iParentIDs->Count(), User::Invariant() ); - + if ( iParents.Count() == iParentIDs->Count() ) { // Balanced lists. CDRMPermissionList* newList = CDRMPermissionList::NewLC(); newList->SetAutoCleanup( ETrue ); - + iParents.AppendL( newList ); CleanupStack::Pop(); } - + return *( iParents[ iParents.Count() - 1 ] ); } - + // ----------------------------------------------------------------------------- // CDRMParentStorage::AddL // @@ -162,12 +162,12 @@ // // Check the count of the stored permissions for an id // ----------------------------------------------------------------------------- -// +// TBool CDRMParentStorage::HasPermissions( const TDesC8& aCID ) { TBool r = EFalse; TInt pos; - + if ( iParentIDs->FindIsq( aCID, pos ) == KErrNone ) { r = ETrue; @@ -180,13 +180,13 @@ // // Operator. // ----------------------------------------------------------------------------- -// +// CDRMPermissionList& CDRMParentStorage::operator[]( const TDesC8& aCID ) { TInt pos; - + iParentIDs->FindIsq( aCID, pos ); return *( iParents[ pos ] ); } - + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/server/src/drmrightsdb.cpp --- a/omadrm/drmengine/server/src/drmrightsdb.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/server/src/drmrightsdb.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -26,19 +26,20 @@ #include #include #include +#include #include // AES128CBC -#include +#include #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif #include "DRMCommon.h" // DRM Error messages -#include "DRMRightsDB.h" +#include "drmrightsdb.h" #include "DRMRightsData.h" #include "DRMCommonData.h" -#include "DRMPermission.h" -#include "DRMConstraint.h" +#include "DrmPermission.h" +#include "DrmConstraint.h" #include "DRMRightsCleaner.h" #include "DRMRightsServer.h" #include "DrmKeyStorage.h" @@ -46,7 +47,7 @@ #include "drmlog.h" #ifdef RD_DRM_RIGHTS_MANAGER_REMOVAL -#include "drmclockclient.h" +#include "DRMClockClient.h" #endif // RD_DRM_RIGHTS_MANAGER_REMOVAL /* @@ -292,9 +293,9 @@ TInt timeZone = 0; DRMClock::ESecurityLevel securityLevel; #endif // RD_DRM_RIGHTS_MANAGER_REMOVAL - + GetRightsFileNameL( aContentID, path); - + #ifdef RD_DRM_RIGHTS_MANAGER_REMOVAL // Get the secure time: RDRMClockClient client; @@ -315,13 +316,13 @@ // Delete expired: TRAP_IGNORE( deleteAllowed = DeleteExpiredL( path, time ) ); - - // Check if it's possible to delete the file as well + + // Check if it's possible to delete the file as well if( deleteAllowed ) { iFileServer.Delete( path ); } - + error = KErrNone; #endif // RD_DRM_RIGHTS_MANAGER_REMOVAL @@ -419,7 +420,7 @@ { User::Leave(KErrArgument); } - + TBuf8<16> keyStore = aEncryptionKey; // TBuf8<16> authStore = aAuthenticationSeed diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/utils/src/Base64.cpp --- a/omadrm/drmengine/utils/src/Base64.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/utils/src/Base64.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,10 +19,10 @@ // INCLUDE FILES #include -#include "base64.h" +#include "Base64.h" // LOCAL CONSTANTS AND MACROS -LOCAL_C const TUint8* const KBase64Chars = +LOCAL_C const TUint8* const KBase64Chars = _S8("ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789+/"); @@ -72,7 +72,7 @@ TUint8 charArray3[3]; TUint8 charArray4[4]; TInt l = 0; - + ret = HBufC8::NewL((aInput.Length() * 4 + 1) / 3); TPtr8 des = ret->Des(); while (l < aInput.Length()) @@ -87,7 +87,7 @@ charArray4[2] = static_cast( ((charArray3[1] & 0x0f) << 2) + ((charArray3[2] & 0xc0) >> 6)); charArray4[3] = static_cast(charArray3[2] & 0x3f); - + for (i = 0; i <4; i++) { des.Append(KBase64Chars[charArray4[i]]); @@ -95,32 +95,32 @@ i = 0; } } - + if (i != 0) { for (j = i; j < 3; j++) { charArray3[j] = '\0'; } - + charArray4[0] = static_cast((charArray3[0] & 0xfc) >> 2); charArray4[1] = static_cast( ((charArray3[0] & 0x03) << 4) +((charArray3[1] & 0xf0) >> 4)); charArray4[2] = static_cast( ((charArray3[1] & 0x0f) << 2) +((charArray3[2] & 0xc0) >> 6)); charArray4[3] = static_cast(charArray3[2] & 0x3f); - + for (j = 0; j < i + 1; j++) { des.Append(KBase64Chars[charArray4[j]]); } - + while ((i++ < 3)) { des.Append('='); } } - + return ret; } @@ -141,7 +141,7 @@ TInt in = 0; TUint8 charArray4[4], charArray3[3]; HBufC8* ret; - + ret = HBufC8::NewL((aInput.Length() * 3 + 1) / 4); TPtr8 des = ret->Des(); while (len-- && aInput[in] != '=') @@ -154,21 +154,21 @@ { in++; } - + if (i == 4) { for (i = 0; i < 4; i++) { charArray4[i] = FindBase64Char(charArray4[i]); } - + charArray3[0] = static_cast( (charArray4[0] << 2) + ((charArray4[1] & 0x30) >> 4)); charArray3[1] = static_cast( ((charArray4[1] & 0xf) << 4) + ((charArray4[2] & 0x3c) >> 2)); charArray3[2] = static_cast( ((charArray4[2] & 0x3) << 6) + charArray4[3]); - + for (i = 0; i < 3; i++) { des.Append(charArray3[i]); @@ -176,33 +176,33 @@ i = 0; } } - + if (i != 0) { for (j = i; j < 4; j++) { charArray4[j] = 0; } - + for (j = 0; j < 4; j++) { charArray4[j] = FindBase64Char(charArray4[j]); } - + charArray3[0] = static_cast( (charArray4[0] << 2) + ((charArray4[1] & 0x30) >> 4)); charArray3[1] = static_cast( ((charArray4[1] & 0xf) << 4) + ((charArray4[2] & 0x3c) >> 2)); charArray3[2] = static_cast( ((charArray4[2] & 0x3) << 6) + charArray4[3]); - + for (j = 0; j < i - 1; j++) { des.Append(charArray3[j]); } } - + return ret; } -// End of File +// End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/utils/src/dbwatcher.cpp --- a/omadrm/drmengine/utils/src/dbwatcher.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/utils/src/dbwatcher.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -22,7 +22,7 @@ #include #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif #include "dbwatcher.h" @@ -36,9 +36,9 @@ #endif _LIT( KDomainRoDir, "DomainROs" ); -static const TChar KDirs[CDbWatcher::KNumDirs] = +static const TChar KDirs[CDbWatcher::KNumDirs] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; - + // ======== MEMBER FUNCTIONS ======== void CDbWatcher::ConstructL( MWatcherObserver& aObserver ) @@ -47,42 +47,42 @@ TFileName file; DRMLOG( _L( "CDbWatcher::ConstructL <-" ) ); - + User::LeaveIfError( iFs.Connect() ); for ( i = 0; i < KNumDirs; i++ ) { - + #ifndef RD_MULTIPLE_DRIVE - + // Ignore errors file.Copy( KRdbBaseDir ); - + #else //RD_MULTIPLE_DRIVE - + TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); - iFs.DriveToChar( driveNumber, driveLetter ); - - TFileName dbBaseDir; - dbBaseDir.Format( KRdbBaseDir, (TUint)driveLetter ); - + iFs.DriveToChar( driveNumber, driveLetter ); + + TFileName dbBaseDir; + dbBaseDir.Format( KRdbBaseDir, (TUint)driveLetter ); + // Ignore errors file.Copy( dbBaseDir ); - + #endif - + if ( i < KNumDirs - 1 ) { - file.Append( KDirs[i] ); + file.Append( KDirs[i] ); } else { - file.Append( KDomainRoDir ); + file.Append( KDomainRoDir ); } iDirWatcher[i] = CDirWatcher::NewL( aObserver, iFs, file ); } - + DRMLOG( _L( "CDbWatcher::ConstructL ->" ) ); } @@ -102,28 +102,28 @@ CDbWatcher::~CDbWatcher() { TInt i; - + DRMLOG( _L( "CDbWatcher::~CDbWatcher ->" ) ); for ( i = 0; i < KNumDirs; i++ ) { delete iDirWatcher[i]; - } + } iFs.Close(); - + DRMLOG( _L( "CDbWatcher::~CDbWatcher <-" ) ); } void CDbWatcher::StartWatching() { TInt i; - + DRMLOG( _L( "CDbWatcher::StartWatching ->" ) ); - + for ( i = 0; i < KNumDirs; i++ ) { iDirWatcher[i]->StartWatching(); - } + } DRMLOG( _L( "CDbWatcher::StartWatching <-" ) ); } diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/utils/src/drmaescrypto.cpp --- a/omadrm/drmengine/utils/src/drmaescrypto.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/utils/src/drmaescrypto.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -23,7 +23,7 @@ #include #include -#include +#include #include "drmaescrypto.h" diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmhelper/drmhelperserver/src/DRMHelperServer.cpp --- a/omadrm/drmhelper/drmhelperserver/src/DRMHelperServer.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmhelper/drmhelperserver/src/DRMHelperServer.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -18,8 +18,8 @@ // INCLUDE FILES #include -#include // CDRMPermission -#include // CDRMConstraint +#include // CDRMPermission +#include // CDRMConstraint #include #include #include @@ -28,7 +28,7 @@ #include // link against centralrepository.lib #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif #include "DRMEventModify.h" diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmhelper/drmhelperserver/src/IdleObserver.cpp --- a/omadrm/drmhelper/drmhelperserver/src/IdleObserver.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmhelper/drmhelperserver/src/IdleObserver.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -21,13 +21,13 @@ #include #include #include -#include +#include #include //for RProperty #include "IdleObserver.h" #include "DRMHelperServer.h" // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS // MACROS // LOCAL CONSTANTS AND MACROS @@ -35,24 +35,24 @@ #ifdef _DRM_TESTING LOCAL_C void WriteFileL( const TDesC8& text , RFs &aFs , const TDesC& aName ) - { + { RFile file; - TInt size; + TInt size; User::LeaveIfError( file.Open( aFs, aName , EFileWrite ) ); CleanupClosePushL( file ); User::LeaveIfError( file.Size( size ) ); - User::LeaveIfError( file.Write( size, text ) ); + User::LeaveIfError( file.Write( size, text ) ); CleanupStack::PopAndDestroy(&file); //file - } + } LOCAL_C void WriteLogL( const TDesC8& text , RFs &aFs ) - { - _LIT( KLogFile , "c:\\IOLog.txt" ); - WriteFileL( text , aFs , KLogFile ); - } + { + _LIT( KLogFile , "c:\\IOLog.txt" ); + WriteFileL( text , aFs , KLogFile ); + } LOCAL_C void CreateLogL() - { + { RFs fs; User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); @@ -60,47 +60,47 @@ User::LeaveIfError( file.Replace( fs , _L("c:\\IOLog.txt") , EFileWrite ) ); file.Close(); CleanupStack::PopAndDestroy(&fs); //fs - } + } LOCAL_C void WriteL( const TDesC& aText ) - { + { RFs fs; User::LeaveIfError( fs.Connect() ); CleanupClosePushL(fs); - HBufC8* text = HBufC8::NewLC(1000); - TPtr8 textptr(text->Des() ); - textptr.Append( aText ); + HBufC8* text = HBufC8::NewLC(1000); + TPtr8 textptr(text->Des() ); + textptr.Append( aText ); textptr.Append(_L( "\r\n" )); - WriteLogL(textptr , fs); + WriteLogL(textptr , fs); CleanupStack::PopAndDestroy(text); CleanupStack::PopAndDestroy(&fs); //fs - } + } LOCAL_C void WriteCurrentTimeL() - { + { RFs fs; User::LeaveIfError( fs.Connect() ); CleanupClosePushL(fs); - HBufC8* text = HBufC8::NewLC(100); - TPtr8 textptr(text->Des() ); + HBufC8* text = HBufC8::NewLC(100); + TPtr8 textptr(text->Des() ); // Date and Time display TTime time; time.HomeTime(); - TBuf<256> dateString; - _LIT(KDate,"%*E%*D%X%*N%*Y %1 %2 '%3"); - time.FormatL(dateString,KDate); - textptr.Append(_L( "\r\n\t\tData:\t" ) ); - textptr.Append( dateString ); - _LIT(KTime,"%-B%:0%J%:1%T%:2%S%:3%+B"); - time.FormatL(dateString,KTime); - textptr.Append(_L( "\r\n\t\tTime:\t" ) ); - textptr.Append( dateString ); - textptr.Append(_L( "\r\n" ) ); - textptr.Append(_L( "\r\n" ) ); - WriteLogL(textptr , fs); + TBuf<256> dateString; + _LIT(KDate,"%*E%*D%X%*N%*Y %1 %2 '%3"); + time.FormatL(dateString,KDate); + textptr.Append(_L( "\r\n\t\tData:\t" ) ); + textptr.Append( dateString ); + _LIT(KTime,"%-B%:0%J%:1%T%:2%S%:3%+B"); + time.FormatL(dateString,KTime); + textptr.Append(_L( "\r\n\t\tTime:\t" ) ); + textptr.Append( dateString ); + textptr.Append(_L( "\r\n" ) ); + textptr.Append(_L( "\r\n" ) ); + WriteLogL(textptr , fs); CleanupStack::PopAndDestroy(text); CleanupStack::PopAndDestroy(&fs); //fs - } + } #endif // MODULE DATA STRUCTURES // LOCAL FUNCTION PROTOTYPES @@ -136,7 +136,7 @@ #endif User::LeaveIfError( iProperty.Attach( KPSUidAiInformation, KActiveIdleState ) ); } - + // ----------------------------------------------------------------------------- // CIdleObserver::NewL // Two-phased constructor. @@ -145,7 +145,7 @@ CIdleObserver* CIdleObserver::NewL(CDRMHelperServer& aServer) { CIdleObserver* self = new( ELeave ) CIdleObserver(aServer); - + CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop(self); @@ -153,12 +153,12 @@ return self; } - + // Destructor CIdleObserver::~CIdleObserver() { #ifdef _DRM_TESTING - TRAPD( err , WriteL(_L("CIdleObserver-Destruct")) ); + TRAPD( err , WriteL(_L("CIdleObserver-Destruct")) ); TRAP( err , WriteCurrentTimeL() ); #endif Cancel(); @@ -192,23 +192,23 @@ // void CIdleObserver::RunL() { -#ifdef _DRM_TESTING +#ifdef _DRM_TESTING //test code start WriteL(_L("RunL")); WriteCurrentTimeL(); //test code end #endif - + // Resubscribe before processing new value to prevent missing updates TInt idleStauts = 0; TInt err( iStatus.Int() ); if (err == KErrNone) { StartL(); - User::LeaveIfError( iProperty.Get( - KPSUidAiInformation, + User::LeaveIfError( iProperty.Get( + KPSUidAiInformation, KActiveIdleState, idleStauts ) ); - if ( idleStauts == EPSAiForeground ) + if ( idleStauts == EPSAiForeground ) { iServer.HandleIdleL(); } @@ -216,7 +216,7 @@ else if ( err != KErrCancel ) { StartL(); - } + } } // ----------------------------------------------------------------------------- @@ -235,4 +235,4 @@ } // ========================== OTHER EXPORTED FUNCTIONS ========================= -// End of File +// End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmhelper/group/Drmhelper.mmp --- a/omadrm/drmhelper/group/Drmhelper.mmp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmhelper/group/Drmhelper.mmp Mon Mar 15 12:41:43 2010 +0200 @@ -100,13 +100,13 @@ #if defined(ARMCC) -deffile ../EABI/ +deffile ../EABI/ #elif defined( WINSCW ) -deffile ../bwinscw/ +deffile ../BWINSCW/ #elif defined( WINS ) -deffile ../bwins/ +deffile ../bwins/ #else -deffile ../bmarm/ +deffile ../bmarm/ #endif SMPSAFE diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmhelper/group/drmhelperdmgrwrapper.mmp --- a/omadrm/drmhelper/group/drmhelperdmgrwrapper.mmp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmhelper/group/drmhelperdmgrwrapper.mmp Mon Mar 15 12:41:43 2010 +0200 @@ -69,7 +69,7 @@ #if defined(ARMCC) deffile ../EABI/ #elif defined( WINSCW ) -deffile ../bwinscw/ +deffile ../BWINSCW/ #elif defined( WINS ) deffile ../bwins/ #else diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmhelper/inc/ConsumeData.h --- a/omadrm/drmhelper/inc/ConsumeData.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmhelper/inc/ConsumeData.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,7 +22,7 @@ // INCLUDES #include #include -#include +#include // DATA TYPES @@ -40,56 +40,56 @@ NONSHARABLE_CLASS( CConsumeData ) : public CBase { public: // Constructors and destructor - - /** + + /** * NewLC * - * Created a new instance of the CConsumeData class and leaves - * it into the cleanup stack - * + * Created a new instance of the CConsumeData class and leaves + * it into the cleanup stack + * * @param aUri: Content identifier of the content in question - * @return Functional CConsumeData -object + * @return Functional CConsumeData -object */ static CConsumeData* NewLC( const TDesC8& aUri ); - - /** + + /** * NewL * - * Created a new instance of the CConsumeData class - * + * Created a new instance of the CConsumeData class + * * @param aUri: Content identifier of the content in question - * @return Functional CConsumeData -object + * @return Functional CConsumeData -object */ static CConsumeData* NewL( const TDesC8& aUri ); - + /** * Destructor */ ~CConsumeData(); - + public: // New functions - - /** + + /** * Consume * - * Calls client consumption, if you call this with stop, the session - * is deleted - * + * Calls client consumption, if you call this with stop, the session + * is deleted + * * @param aIntent: Intent to be used for consumption - * @return Symbian OS error code - */ + * @return Symbian OS error code + */ TInt Consume( const ContentAccess::TIntent& aIntent ); - /** + /** * CompateUri(); * - * Compares the uri as if compared with string compare - * + * Compares the uri as if compared with string compare + * * @param aIntent: Intent to be used for consumption - * @return Symbian OS error code - */ - TInt CompareUri( const TDesC8& aUri ) const; + * @return Symbian OS error code + */ + TInt CompareUri( const TDesC8& aUri ) const; private: /** @@ -104,16 +104,16 @@ // Content uri of the content being used HBufC8* iContentURI8; - + // Rights Client instance - RDRMRightsClient iRdb; - - // Connection status - TBool iConnectionStatus; + RDRMRightsClient iRdb; + + // Connection status + TBool iConnectionStatus; }; -#endif // CONSUMEDATA_H - +#endif // CONSUMEDATA_H + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmhelper/inc/DRMHelperDMgrWrapper.h --- a/omadrm/drmhelper/inc/DRMHelperDMgrWrapper.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmhelper/inc/DRMHelperDMgrWrapper.h Mon Mar 15 12:41:43 2010 +0200 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: * */ @@ -19,8 +19,8 @@ #ifndef CDRMHELPERDMGRWRAPPER_H #define CDRMHELPERDMGRWRAPPER_H -#include -#include +#include +#include #include /** diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmhelper/inc/DRMHelperGlobalNoteWrapper.h --- a/omadrm/drmhelper/inc/DRMHelperGlobalNoteWrapper.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmhelper/inc/DRMHelperGlobalNoteWrapper.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,7 +22,7 @@ // INCLUDES #include -#include +#include // CONSTANTS const TInt KDRMNoteBufferMaxSize ( 256 ); diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmhelper/inc/DRMHelperInfoNoteWrapper.h --- a/omadrm/drmhelper/inc/DRMHelperInfoNoteWrapper.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmhelper/inc/DRMHelperInfoNoteWrapper.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,7 +22,7 @@ // INCLUDES #include -#include +#include // CONSTANTS // MACROS @@ -44,14 +44,14 @@ NONSHARABLE_CLASS ( CDRMHelperInfoNoteWrapper ) : public CActive { public: // Constructors and destructor - + /** * Two-phased constructor. */ static CDRMHelperInfoNoteWrapper* NewL(); - + static CDRMHelperInfoNoteWrapper* NewLC(); - + /** * Destructor. */ @@ -63,31 +63,31 @@ /** * Synchronous wrapper for showing global note. * @param aType type of Info note to be displayed - * @param aNoteText string containing note text + * @param aNoteText string containing note text * @param aResource resource identifier - * @param aString is transferred for CoverUi string data + * @param aString is transferred for CoverUi string data * @param aValue is transferred for CoverUi numerical data * @return button code */ - void ShowNoteL( TAknGlobalNoteType aType, + void ShowNoteL( TAknGlobalNoteType aType, const TDesC& aNoteText, - TInt aResourceId = -1, + TInt aResourceId = -1, const TDesC& aString = KNullDesC, TInt aValue = -1 ); /** * Synchronous wrapper for showing global note. * @param[inout] aResourceId takes primary display - * resource ID and returns CoverUiId + * resource ID and returns CoverUiId * @return boolean if ID was valid CoverUiId */ static TBool EvaluateCoverResourceId( TInt& aResourceId ); - + private: // From CActive - - void DoCancel(); - void RunL(); - + + void DoCancel(); + void RunL(); + private: /** @@ -98,14 +98,14 @@ /** * By default Symbian 2nd phase constructor is private. */ - void ConstructL(); - + void ConstructL(); + private: // Data - CAknGlobalNote* iNote; + CAknGlobalNote* iNote; }; -#endif // __DRMHELPERINFONOTEWRAPPER_H__ - +#endif // __DRMHELPERINFONOTEWRAPPER_H__ + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmhelper/src/ConsumeData.cpp --- a/omadrm/drmhelper/src/ConsumeData.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmhelper/src/ConsumeData.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -18,7 +18,7 @@ // INCLUDE FILES #include -#include "consumedata.h" +#include "ConsumeData.h" // LOCAL CONSTANTS AND MACROS @@ -32,34 +32,34 @@ CConsumeData::CConsumeData() : CBase() { } - + // ----------------------------------------------------------------------------- // CConsumeData::~ConsumeData // C++ default destructor // ----------------------------------------------------------------------------- -// +// CConsumeData::~CConsumeData() { // If the connection is still open call finish - if( iConnectionStatus && iContentURI8 ) + if( iConnectionStatus && iContentURI8 ) { - iRdb.Consume( ContentAccess::EStop, *iContentURI8 ); + iRdb.Consume( ContentAccess::EStop, *iContentURI8 ); } - + // Close the connection to the server: iRdb.Close(); - + // Reset the connection status iConnectionStatus = EFalse; - + // Delete the content id if( iContentURI8 ) { delete iContentURI8; - iContentURI8 = NULL; + iContentURI8 = NULL; } } - + // ----------------------------------------------------------------------------- // CConsumeData::NewLC @@ -73,7 +73,7 @@ self->ConstructL( aUri ); return self; } - + // ----------------------------------------------------------------------------- // CConsumeData::NewL // 2-phase constructor @@ -83,8 +83,8 @@ { CConsumeData* self = NewLC( aUri ); CleanupStack::Pop( self ); - return self; - } + return self; + } // ----------------------------------------------------------------------------- // CConsumeData::Consume @@ -93,21 +93,21 @@ TInt CConsumeData::Consume( const ContentAccess::TIntent& aIntent ) { TInt retVal = KErrNone; - + if( !iConnectionStatus ) { - return KErrNotReady; + return KErrNotReady; } - + retVal = iRdb.Consume( aIntent, *iContentURI8 ); if( aIntent == ContentAccess::EStop ) { iRdb.Close(); - iConnectionStatus = EFalse; + iConnectionStatus = EFalse; } - - return retVal; + + return retVal; } // ----------------------------------------------------------------------------- // CConsumeData::CompareUri @@ -117,9 +117,9 @@ { if( !iContentURI8 ) { - return KErrNotReady; + return KErrNotReady; } - + return iContentURI8->Des().Compare( aUri ); } @@ -135,9 +135,9 @@ // Set the connection status iConnectionStatus = ETrue; - + // copy the url for internal use - iContentURI8 = aUri.AllocL(); + iContentURI8 = aUri.AllocL(); } // ========================== OTHER EXPORTED FUNCTIONS ========================= diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmhelper/src/DRMHelperDMgrWrapper.cpp --- a/omadrm/drmhelper/src/DRMHelperDMgrWrapper.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmhelper/src/DRMHelperDMgrWrapper.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -31,19 +31,19 @@ #include #endif -#include +#include #include -#include +#include #include #include -#include "roapeng.h" -#include "roapsyncwrapper.h" -#include "roapdef.h" -#include "drmhelperdmgrwrapper.h" -#include "drmhelperdmgrwrapperlogger.h" +#include "RoapEng.h" +#include "RoapSyncWrapper.h" +#include "RoapDef.h" +#include "DRMHelperDMgrWrapper.h" +#include "DRMHelperDMgrWrapperLogger.h" // DEBUG macros #ifdef _DEBUG diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmhelper/src/DRMHelperDownloadManager.cpp --- a/omadrm/drmhelper/src/DRMHelperDownloadManager.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmhelper/src/DRMHelperDownloadManager.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -18,7 +18,7 @@ // INCLUDE FILES #include "DRMHelperDownloadManager.h" -#include "drmhelperdmgrwrapper.h" +#include "DRMHelperDMgrWrapper.h" // CONSTANTS _LIT( KDRMHelperDMgrHandlerName, "\\system\\libs\\drmhelperdmgrwrapper.dll" ); @@ -48,7 +48,7 @@ CDrmHelperDownloadManager* CDrmHelperDownloadManager::NewL() { CDrmHelperDownloadManager* self = new( ELeave ) CDrmHelperDownloadManager(); - + CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop(); @@ -61,7 +61,7 @@ delete iDMgrHandler; iDMgrDll.Close(); } - + void CDrmHelperDownloadManager::DownloadAndHandleRoapTriggerL( const HBufC8* aUrl, CCoeEnv& aCoeEnv ) { diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmhelper/src/DRMHelperGlobalNoteWrapper.cpp --- a/omadrm/drmhelper/src/DRMHelperGlobalNoteWrapper.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmhelper/src/DRMHelperGlobalNoteWrapper.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -21,13 +21,13 @@ #include "DRMHelperGlobalNoteWrapper.h" #include "DRMHelperInfoNoteWrapper.h" -#include +#include #include #include // EAknSoftkeyNo #include -#include -#include +#include +#include #include // EXTERNAL DATA STRUCTURES diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmhelper/src/DRMHelperInfoNoteWrapper.cpp --- a/omadrm/drmhelper/src/DRMHelperInfoNoteWrapper.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmhelper/src/DRMHelperInfoNoteWrapper.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -20,17 +20,17 @@ // INCLUDE FILES #include "DRMHelperInfoNoteWrapper.h" -#include +#include #include #include // EAknSoftkeyNo -#include +#include #include -#include +#include #include -#include -#include -#include +#include +#include +#include // EXTERNAL DATA STRUCTURES diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmhelper/src/RDRMHelper.cpp --- a/omadrm/drmhelper/src/RDRMHelper.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmhelper/src/RDRMHelper.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,10 +19,10 @@ // INCLUDE FILES #include #include -#include -#include "drmhelpercommon.h" -#include "drmhelperserver.h" -#include "RDRMHelper.h" +#include +#include "DRMHelperCommon.h" +#include "DRMHelperServer.h" +#include "rdrmhelper.h" // LOCAL CONSTANTS AND MACROS diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmhelper/src/drmhelper.cpp --- a/omadrm/drmhelper/src/drmhelper.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmhelper/src/drmhelper.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -25,51 +25,52 @@ #include "DcfCommon.h" #include "DRMHelperDownloadManager.h" -#include -#include +#include +#include #include #include -#include +#include #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif #include #include //CEikProcess #include //CEikDocument -#include // KDRMErr* +#include // KDRMErr* #include // information note -#include // global info note - -#include +#include // global info note + +#include #include #include #include #include -#include +#include #include #include +#include #include // for launching RMUI embedded #include #include // for handling URLs -#include "drmhelperserver.h" -#include "consumedata.h" -#include "drmtypes.h" -#include "drmclockclient.h" +#include "DRMHelperServer.h" +#include "ConsumeData.h" +#include "DRMTypes.h" +#include "DRMClockClient.h" #include "DRMPointerArray.h" #include // for secondary display support -#include -#include -#include +#include +#include +#include #include #include "RoapStorageClient.h" @@ -88,8 +89,8 @@ #include // publish & subrscibe -#include -#include +#include +#include #ifdef __SERIES60_NATIVE_BROWSER #include @@ -3596,7 +3597,7 @@ CleanupStack::PushL( localIDBuf ); // length of startparam is always 1 and some markers are needed - TInt length = 1 + aUrl->Length() + localIDBuf->Des().Length() + 4; + TInt length = 1 + aUrl->Length() + localIDBuf->Des().Length() + 3; aLaunchParam = HBufC::NewMaxL( length ); @@ -3626,8 +3627,8 @@ { ptr[index++] = ( unsigned char ) (*aUrl)[i]; } - - ptr.Append( KMarker() ); + + ptr[index] = ( unsigned char ) KMarker()[0]; CleanupStack::PopAndDestroy( localIDBuf ); } diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmlicensemanager/group/DRMLicenseChecker.mmp --- a/omadrm/drmlicensemanager/group/DRMLicenseChecker.mmp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmlicensemanager/group/DRMLicenseChecker.mmp Mon Mar 15 12:41:43 2010 +0200 @@ -29,7 +29,7 @@ SYSTEMINCLUDE /epoc32/include/libc USERINCLUDE ../inc -USERINCLUDE ../../../inc // ADo level inc dir +USERINCLUDE ../../../inc // ADo level inc dir SOURCEPATH ../src SOURCE DRMLicenseChecker.cpp @@ -46,13 +46,13 @@ LIBRARY DRMCommon.lib #if defined(ARMCC) -deffile ../eabi/ +deffile ../eabi/ #elif defined( WINSCW ) -deffile ../bwinscw/ +deffile ../BWINSCW/ #elif defined( WINS ) -deffile ../bwins/ +deffile ../bwins/ #else -deffile ../bmarm/ +deffile ../bmarm/ #endif SMPSAFE diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmlicensemanager/group/DRMLicenseManager.mmp --- a/omadrm/drmlicensemanager/group/DRMLicenseManager.mmp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmlicensemanager/group/DRMLicenseManager.mmp Mon Mar 15 12:41:43 2010 +0200 @@ -52,7 +52,7 @@ #if defined(ARMCC) deffile ../eabi/ #elif defined( WINSCW ) -deffile ../bwinscw/ +deffile ../BWINSCW/ #elif defined( WINS ) deffile ../bwins/ #else diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmlicensemanager/src/DRMLicenseManager.cpp --- a/omadrm/drmlicensemanager/src/DRMLicenseManager.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmlicensemanager/src/DRMLicenseManager.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -26,13 +26,13 @@ #include #include #include -#include -#include +#include +#include #include -#include // Disk space checking +#include // Disk space checking -#include "ZipFile.h" -#include "ZipFileMemberIterator.h" +#include "zipfile.h" +#include "zipfilememberiterator.h" #include "DRMLicenseManager.h" // LOCAL CONSTANTS AND MACROS @@ -491,9 +491,9 @@ members = iZipFile->GetMembersL(); CleanupStack::PushL(members); - + member = members->NextL(); - + while (member && !sisFile) { if (member->Name()->Right(4).CompareF(KSISSuffix) == 0) @@ -511,14 +511,14 @@ member = members->NextL(); } } - + CleanupStack::PopAndDestroy(members); if(!sisFile) { User::Leave(KErrNotFound); } - + return sisFile; } diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmplugins/drmfilter/inc/HTTPFilterDRM.h --- a/omadrm/drmplugins/drmfilter/inc/HTTPFilterDRM.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmplugins/drmfilter/inc/HTTPFilterDRM.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,9 +22,9 @@ #include #include #include -#include +#include -#include "httpfilterdrmdatasupplier.h" +#include "HTTPFilterDRMDataSupplier.h" #ifndef DEBUG_LOGGING #undef _LOGGING diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmplugins/drmfilter/inc/HTTPFilterDRMDataSupplier.h --- a/omadrm/drmplugins/drmfilter/inc/HTTPFilterDRMDataSupplier.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmplugins/drmfilter/inc/HTTPFilterDRMDataSupplier.h Mon Mar 15 12:41:43 2010 +0200 @@ -21,7 +21,7 @@ #include #include -#include +#include //----------------------------------------------------------------------------- class CDRMMessageParser; @@ -46,7 +46,7 @@ * HeapArray8 - the helper class for memory re-allocation * * @lib DRMFilter.lib - * @since 2.6 + * @since 2.6 */ class HeapArray8 { @@ -77,7 +77,7 @@ * TDRMMemBuf - the helper class for memory re-allocation * * @lib DRMFilter.lib - * @since 2.6 + * @since 2.6 */ class TDRMMemBuf : public TMemBuf { @@ -102,7 +102,7 @@ * a data supplier used for replace the default supplier in response data * * @lib DRMFilter.lib - * @since 2.6 + * @since 2.6 */ class CHTTPFilterDRMDataSupplier : public CBase, public MHTTPDataSupplier, @@ -113,7 +113,7 @@ static CHTTPFilterDRMDataSupplier* NewL( TInt, MHTTPDataSupplier* iDataBody, CHTTPFilterDRM* aOwner ); /** Support for Hutchinson's content protection scheme, CFM - * + * */ static CHTTPFilterDRMDataSupplier* NewL( TInt, MHTTPDataSupplier* iDataBody, TProcessedContentType aType, @@ -150,7 +150,7 @@ void ConstructL( TInt aSize ); /** Support for Hutchinson's content protection scheme, CFM - * + * */ void ConstructL( TInt aSize, TProcessedContentType /*aType*/); /** @@ -188,4 +188,4 @@ //------------------------------------------------------------------------- }; //----------------------------------------------------------------------------- -#endif // !_HTTPFILTERDRMDATASUPPLIER_H_ +#endif // !_HTTPFILTERDRMDATASUPPLIER_H_ diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmplugins/drmfilter/src/HTTPFilterDRM.cpp --- a/omadrm/drmplugins/drmfilter/src/HTTPFilterDRM.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmplugins/drmfilter/src/HTTPFilterDRM.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -21,9 +21,9 @@ #include #include #include -#include +#include -#include "httpfilterdrm.h" +#include "HTTPFilterDRM.h" // LOCAL CONSTANTS _LIT8( KDRMString1, "application/vnd.oma.drm.message" ); @@ -464,7 +464,7 @@ // void CHTTPFilterDRM::CheckHeadersL( const RHTTPTransaction& aTrans ) { - // read the header data and check the MIME type here + // read the header data and check the MIME type here // check the status and body RHTTPResponse response = aTrans.Response(); TInt status = response.StatusCode(); @@ -630,7 +630,7 @@ // Do not encrypt JAD files: if ( headers.GetField( fieldNameStr, 0, fieldVal ) == KErrNone ) { - // If it is a JAD always ignore any of the above: + // If it is a JAD always ignore any of the above: const TBuf8 JADStringBuf( KJADString ); RStringF JADValue = strP.OpenFStringL( JADStringBuf ); CleanupClosePushL( JADValue ); @@ -665,7 +665,7 @@ iDataSups.Append( drmData ); response.SetBody( *drmData ); - /// + /// RStringF DRMValue1 = strP.OpenFStringL( DRMStringBuf1 ); CleanupClosePushL( DRMValue1 ); diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmplugins/drmfilter/src/HTTPFilterDRMDataSupplier.cpp --- a/omadrm/drmplugins/drmfilter/src/HTTPFilterDRMDataSupplier.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmplugins/drmfilter/src/HTTPFilterDRMDataSupplier.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -17,15 +17,16 @@ #include #include -#include +#include #include #include -#include +#include #include -#include +#include +#include -#include "httpfilterdrmdatasupplier.h" -#include "httpfilterdrm.h" +#include "HTTPFilterDRMDataSupplier.h" +#include "HTTPFilterDRM.h" //------------------------------------------------------------------------ @@ -57,7 +58,7 @@ // CHTTPFilterDRMDataSupplier::NewL // Two-phase constructor, CFM // ----------------------------------------------------------------------------- -// +// CHTTPFilterDRMDataSupplier* CHTTPFilterDRMDataSupplier::NewL( TInt aTransId, MHTTPDataSupplier* iDataBody, TProcessedContentType aType, CHTTPFilterDRM* aOwner ) @@ -269,9 +270,9 @@ permission->iAvailableRights = ERightsPlay | ERightsDisplay | ERightsExecute | ERightsPrint; - permission->iRightsObjectVersion.iVersionMain = 1; // major version for Oma 1 Rights Objects + permission->iRightsObjectVersion.iVersionMain = 1; // major version for Oma 1 Rights Objects - // "ringtone=no" present + // "ringtone=no" present permission->iInfoBits = ENoRingingTone; // Set the permission to the rights class, it will duplicate the permission @@ -366,10 +367,10 @@ aDataPart.Set( iMemBuf->iBuf->GetPtr().Left( iDataPartSize ) ); } - // this check did not work, as in this phase the iDataPartSize is never + // this check did not work, as in this phase the iDataPartSize is never // KWholeDataPart //return ( iDataPartSize == KWholeDataPart ) ? iSendReady : EFalse; - + // Always return info if this is the last part, this is only true // if iSendReady has been true when ReleaseData() has been called return iLastPart; @@ -382,7 +383,7 @@ // void CHTTPFilterDRMDataSupplier::ReleaseData() { - if ( iDataPartSize == KWholeDataPart || + if ( iDataPartSize == KWholeDataPart || ( iLastPart && iSendReady ) ) { TRAP_IGNORE( Sink()->SeekL( MStreamBuf::EWrite, TStreamPos(0) ) ); @@ -570,7 +571,7 @@ } } CleanupStack::Pop( manager ); - CleanupStack::PopAndDestroy( &agents ); + CleanupStack::PopAndDestroy( &agents ); return manager; } diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmplugins/drmrecognizer/src/RecDRM.cpp --- a/omadrm/drmplugins/drmrecognizer/src/RecDRM.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmplugins/drmrecognizer/src/RecDRM.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -22,7 +22,7 @@ #include #include -#include "recdrm.h" +#include "RecDRM.h" #define RECOGNIZE_KEY_CHAIN @@ -47,14 +47,14 @@ _LIT8(KFTypPrefix, "ftyp"); _LIT8(KODFPrefix, "odcf"); -_LIT8(KRoapTriggerElement, "roap-trigger:roapTrigger"); // before OMA spec CR, ROAP Trigger namespace prefix was roap-trigger +_LIT8(KRoapTriggerElement, "roap-trigger:roapTrigger"); // before OMA spec CR, ROAP Trigger namespace prefix was roap-trigger _LIT8(KRoapTriggerElement2, "roap:roapTrigger"); _LIT8(KRoapTriggerType, "application/vnd.oma.drm.roap-trigger+xml"); -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY(0x101F6DB8, CApaDRMRecognizer::CreateRecognizerL) - }; +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x101F6DB8, CApaDRMRecognizer::CreateRecognizerL) + }; #ifdef DRM_OMA2_ENABLED TUint32 ReadUint32FromBlock(const TDesC8& aBlock, TInt aOffset) @@ -80,11 +80,11 @@ #endif CApaDRMRecognizer::CApaDRMRecognizer(): - CApaDataRecognizerType( KUidDRMRecognizer,CApaDataRecognizerType::ENormal ) + CApaDataRecognizerType( KUidDRMRecognizer,CApaDataRecognizerType::ENormal ) { - - iCountDataTypes = 0; - return; + + iCountDataTypes = 0; + return; } CApaDRMRecognizer::~CApaDRMRecognizer() @@ -94,13 +94,13 @@ CApaDataRecognizerType* CApaDRMRecognizer::CreateRecognizerL() { - return new (ELeave) CApaDRMRecognizer (); + return new (ELeave) CApaDRMRecognizer (); } - + TUint CApaDRMRecognizer::PreferredBufSize() { - return KMaxBufferLength; + return KMaxBufferLength; } #ifdef _DEBUG @@ -110,68 +110,68 @@ #endif { __ASSERT_DEBUG( aIndex >= 0 && aIndex < iCountDataTypes, User::Invariant() ); - return TDataType( _L8("application/vdn.omd.drm.content") ); // this should never be run + return TDataType( _L8("application/vdn.omd.drm.content") ); // this should never be run } void CApaDRMRecognizer::DoRecognizeL( const TDesC& aName, const TDesC8& aBuffer ) { - if ( aBuffer.Size() < 3) + if ( aBuffer.Size() < 3) { return; } - -#ifdef RECOGNIZE_KEY_CHAIN - // Recognize device key chain - if ( aName.Length() > 3 && aName.Right(4).CompareF(_L(".dkc")) == 0) + +#ifdef RECOGNIZE_KEY_CHAIN + // Recognize device key chain + if ( aName.Length() > 3 && aName.Right(4).CompareF(_L(".dkc")) == 0) { iConfidence = ECertain; iDataType = TDataType( _L8("application/x-device-key-chain") ); return; } -#endif - +#endif + #ifdef DRM_OMA2_ENABLED - // Recognize ROAP Trigger - if ( RecognizeRoapTrigger( aBuffer ) ) + // Recognize ROAP Trigger + if ( RecognizeRoapTrigger( aBuffer ) ) + { + return; + } + + // Recognize DCFv2 + if ( RecognizeODF( aBuffer ) ) { return; } - - // Recognize DCFv2 - if ( RecognizeODF( aBuffer ) ) - { +#endif + // Recognize DCFv1 + TUint8 version = aBuffer[0]; + TUint8 contentTypeLen = aBuffer[1]; + TUint8 contentURILen = aBuffer[2]; + + if ( contentTypeLen < KMinContentTypeLen || contentURILen == 0 ) + { return; - } -#endif - // Recognize DCFv1 - TUint8 version = aBuffer[0]; - TUint8 contentTypeLen = aBuffer[1]; - TUint8 contentURILen = aBuffer[2]; + } + if ( version != KDCFVersionSupported ) + { + return; + } - if ( contentTypeLen < KMinContentTypeLen || contentURILen == 0 ) - { - return; - } - if ( version != KDCFVersionSupported ) - { - return; - } + // Too little data received + if ( aBuffer.Size() < ( contentTypeLen + KDCFHeaderLength ) ) + { + return; + } - // Too little data received - if ( aBuffer.Size() < ( contentTypeLen + KDCFHeaderLength ) ) - { - return; - } + TPtrC8 mimeType = aBuffer.Mid( KDCFHeaderLength, contentTypeLen ); + if ( mimeType.Locate( '/' ) != KErrNotFound ) + { + iConfidence = ECertain; + iDataType=TDataType( mimeType ); + } - TPtrC8 mimeType = aBuffer.Mid( KDCFHeaderLength, contentTypeLen ); - if ( mimeType.Locate( '/' ) != KErrNotFound ) - { - iConfidence = ECertain; - iDataType=TDataType( mimeType ); - } - - - return; + + return; } #ifdef DRM_OMA2_ENABLED @@ -184,59 +184,59 @@ iDataType=TDataType( KRoapTriggerType() ); return ETrue; } - return EFalse; + return EFalse; } TBool CApaDRMRecognizer::RecognizeODF( const TDesC8& aBuffer ) { - if ( aBuffer.Size() < 24 ) return EFalse; - TPtrC8 ftypPrefix = aBuffer.Mid( 4, KFTypPrefix().Length() ); - if ( KFTypPrefix().CompareF( ftypPrefix ) == KErrNone ) - { - TPtrC8 odfPrefix = aBuffer.Mid( 8, KODFPrefix().Length() ); - if ( KODFPrefix().CompareF( odfPrefix ) == KErrNone ) - { - TBuf8<4> buffer; - TUint32 size; - TPtr8 ptr(NULL, 0); - TUint32 offset(20); - - // ODRM box header - buffer.Zero(); - buffer.Copy( aBuffer.Mid( offset, 4 )); - size = ReadUint32FromBlock( buffer, 0 ); - offset += KLengthBoxSize + KLengthBoxType + KLengthVersion + KLengthFlags; - - if (size == 1) - { - offset += KLengthBoxSize64; - } - if ( aBuffer.Size() < offset+4 ) return EFalse; - - // Discrete headers box header - buffer.Zero(); - buffer.Copy( aBuffer.Mid( offset, 4 )); - size = ReadUint32FromBlock( buffer, 0 ); - offset += KLengthBoxSize + KLengthBoxType + KLengthVersion + KLengthFlags; - if ( size == 1 ) - { - offset += KLengthBoxSize64; - } - if ( aBuffer.Size() < offset+1 ) return EFalse; - - // Content type - buffer.Zero(); - buffer.Copy( aBuffer.Mid( offset, 1 )); - if ( aBuffer.Size() < offset + 1 + buffer[0] ) return EFalse; - TPtrC8 mimeType = aBuffer.Mid( offset+1, buffer[0] ); - - iConfidence = ECertain; - iDataType=TDataType( mimeType ); - return ETrue; - } - - } - return EFalse; + if ( aBuffer.Size() < 24 ) return EFalse; + TPtrC8 ftypPrefix = aBuffer.Mid( 4, KFTypPrefix().Length() ); + if ( KFTypPrefix().CompareF( ftypPrefix ) == KErrNone ) + { + TPtrC8 odfPrefix = aBuffer.Mid( 8, KODFPrefix().Length() ); + if ( KODFPrefix().CompareF( odfPrefix ) == KErrNone ) + { + TBuf8<4> buffer; + TUint32 size; + TPtr8 ptr(NULL, 0); + TUint32 offset(20); + + // ODRM box header + buffer.Zero(); + buffer.Copy( aBuffer.Mid( offset, 4 )); + size = ReadUint32FromBlock( buffer, 0 ); + offset += KLengthBoxSize + KLengthBoxType + KLengthVersion + KLengthFlags; + + if (size == 1) + { + offset += KLengthBoxSize64; + } + if ( aBuffer.Size() < offset+4 ) return EFalse; + + // Discrete headers box header + buffer.Zero(); + buffer.Copy( aBuffer.Mid( offset, 4 )); + size = ReadUint32FromBlock( buffer, 0 ); + offset += KLengthBoxSize + KLengthBoxType + KLengthVersion + KLengthFlags; + if ( size == 1 ) + { + offset += KLengthBoxSize64; + } + if ( aBuffer.Size() < offset+1 ) return EFalse; + + // Content type + buffer.Zero(); + buffer.Copy( aBuffer.Mid( offset, 1 )); + if ( aBuffer.Size() < offset + 1 + buffer[0] ) return EFalse; + TPtrC8 mimeType = aBuffer.Mid( offset+1, buffer[0] ); + + iConfidence = ECertain; + iDataType=TDataType( mimeType ); + return ETrue; + } + + } + return EFalse; } #endif diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmplugins/drmrohandler/src/CRoHandler.cpp --- a/omadrm/drmplugins/drmrohandler/src/CRoHandler.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmplugins/drmrohandler/src/CRoHandler.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -18,15 +18,15 @@ // INCLUDE FILES #include // for CRichText -#include // for CDrmMessageParser -#include // for CDRMRights +#include // for CDrmMessageParser +#include // for CDRMRights #include // for TImplementationProxy #include // for CPushHandlerBase #include // for CPluginKiller #include // for CPushMessage -#include // for CRoapEng -#include -#include +#include // for CRoapEng +#include +#include #include // link against centralrepository.lib #include #include @@ -39,15 +39,15 @@ #include // TUriParser16 #include // KDC_MTM_RESOURCE_DIR #include // UriUtils and so on -#include // for R_PUSHMISC_UNK_SENDER -#include // for R_QTN_DRM_MGR_INB_TITLE +#include // for R_PUSHMISC_UNK_SENDER +#include // for R_QTN_DRM_MGR_INB_TITLE #include // Disk space checking -#include "crohandler.h" -#include "romtmcli.h" // for CRightsObjectMtmClient -#include "roapsyncwrapper.h" +#include "CRoHandler.h" +#include "RoMtmCli.h" // for CRightsObjectMtmClient +#include "RoapSyncWrapper.h" -#include "stringresourcereader.h" +#include "StringResourceReader.h" #include "rohandlerdmgrwrapper.h" #include "rohandlerinternalcrkeys.h" diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmplugins/drmrohandler/src/rohandlerdmgrwrapper.cpp --- a/omadrm/drmplugins/drmrohandler/src/rohandlerdmgrwrapper.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmplugins/drmrohandler/src/rohandlerdmgrwrapper.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -40,10 +40,10 @@ #include // tconnectioninfo #include // rconnection rsocket -#include -#include -#include -#include "roapsyncwrapper.h" +#include +#include +#include +#include "RoapSyncWrapper.h" #include "rohandlerdmgrwrapper.h" diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmplugins/drmromtm/client/src/RoMtmCli.cpp --- a/omadrm/drmplugins/drmromtm/client/src/RoMtmCli.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmplugins/drmromtm/client/src/RoMtmCli.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -31,9 +31,9 @@ #include // kuidmsvmessageentry #include // disk space checking -#include "romtmcli.h" -#include "romtmcc.h" -#include "romtmcommon.h" +#include "RoMtmCli.h" +#include "RoMTMCC.h" +#include "RoMTMCommon.h" GLREF_C void Panic( TRoMtmCliPanic aPanic ); // EXTERNAL DATA STRUCTURES diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmplugins/drmromtm/server/inc/RoMtmSer.h --- a/omadrm/drmplugins/drmromtm/server/inc/RoMtmSer.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmplugins/drmromtm/server/inc/RoMtmSer.h Mon Mar 15 12:41:43 2010 +0200 @@ -23,9 +23,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include @@ -40,180 +40,180 @@ // CLASS DECLARATION /** -* CRightsObjectServerMtm -* +* CRightsObjectServerMtm +* * @lib RoMtmSer.lib * @since 2.5 */ // -// CRightsObjectServerMtm: The Server-side MTM implementation +// CRightsObjectServerMtm: The Server-side MTM implementation // class CRightsObjectServerMtm : public CBaseServerMtm - { - public: + { + public: - // Constructor, initialisation, and destructor + // Constructor, initialisation, and destructor /** * Two-phased constructor. */ - IMPORT_C static CRightsObjectServerMtm* NewL( CRegisteredMtmDll& aRegisteredMtmDll , CMsvServerEntry* aInitialEntry ); - + IMPORT_C static CRightsObjectServerMtm* NewL( CRegisteredMtmDll& aRegisteredMtmDll , CMsvServerEntry* aInitialEntry ); + /** * Destructor. - */ - ~CRightsObjectServerMtm(); + */ + ~CRightsObjectServerMtm(); - /************************************* - * - * from CBaseMtm - * - **************************************/ - // Copy and move - - /** + /************************************* + * + * from CBaseMtm + * + **************************************/ + // Copy and move + + /** * CopyToLocalL * @since 2.5 - * - * Not Supported - * + * + * Not Supported + * */ - void CopyToLocalL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus ); + void CopyToLocalL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus ); - /** + /** * CopyFromLocalL * @since 2.5 - * - * Not Supported - * + * + * Not Supported + * */ - void CopyFromLocalL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus ); + void CopyFromLocalL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus ); - /** + /** * CopyToLocalL * @since 2.5 - * - * Not Supported - * - */ - void CopyWithinServiceL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus ); - - /** + * + * Not Supported + * + */ + void CopyWithinServiceL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus ); + + /** * MoveToLocalL * @since 2.5 - * - * Not Supported - * - */ - void MoveToLocalL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus ); - - /** + * + * Not Supported + * + */ + void MoveToLocalL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus ); + + /** * MoveFromLocalL * @since 2.5 - * - * Not Supported - * + * + * Not Supported + * */ - void MoveFromLocalL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus ); - - /** + void MoveFromLocalL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus ); + + /** * MoveWithinServiceL * @since 2.5 - * - * Not Supported - * + * + * Not Supported + * */ - void MoveWithinServiceL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus ); + void MoveWithinServiceL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus ); - // Create, change, delete - - /** + // Create, change, delete + + /** * DeleteAllL * @since 2.5 - * - * Not Supported - * + * + * Not Supported + * */ - void DeleteAllL( const CMsvEntrySelection& aSelection , TRequestStatus& aStatus ); - - /** + void DeleteAllL( const CMsvEntrySelection& aSelection , TRequestStatus& aStatus ); + + /** * CreateL * @since 2.5 - * - * Not Supported - * + * + * Not Supported + * */ - void CreateL( TMsvEntry aNewEntry , TRequestStatus& aStatus ); - - /** + void CreateL( TMsvEntry aNewEntry , TRequestStatus& aStatus ); + + /** * ChangeL * @since 2.5 - * - * Not Supported - * + * + * Not Supported + * */ - void ChangeL( TMsvEntry aNewEntry , TRequestStatus& aStatus ); + void ChangeL( TMsvEntry aNewEntry , TRequestStatus& aStatus ); - // Command and progress - - /** + // Command and progress + + /** * StartCommandL * @since 2.5 - * - * Not Supported - * + * + * Not Supported + * */ - void StartCommandL( CMsvEntrySelection& aSelection , TInt aCommand , - const TDesC8& aParameter , TRequestStatus& aStatus ); - - /** + void StartCommandL( CMsvEntrySelection& aSelection , TInt aCommand , + const TDesC8& aParameter , TRequestStatus& aStatus ); + + /** * CommandExpected * @since 2.5 - * - * Not Supported - * + * + * Not Supported + * */ - TBool CommandExpected(); - - - /** + TBool CommandExpected(); + + + /** * Progress * @since 2.5 - * - * Not Supported - * + * + * Not Supported + * */ - const TDesC8& Progress(); + const TDesC8& Progress(); + + // void RunL() + // void SetInitialEntry(CMsvServerEntry* aEntry)=0; + protected: - // void RunL() - // void SetInitialEntry(CMsvServerEntry* aEntry)=0; - protected: - - /************************************* - * - * from CActive - * - **************************************/ - void DoCancel(); - /************************************* - * - * from CBaseMtm - * - **************************************/ - void DoRunL(); - void DoComplete(TInt aError); + /************************************* + * + * from CActive + * + **************************************/ + void DoCancel(); + /************************************* + * + * from CBaseMtm + * + **************************************/ + void DoRunL(); + void DoComplete(TInt aError); - private: - CRightsObjectServerMtm( CRegisteredMtmDll& aRegisteredMtmDll , CMsvServerEntry* aInitialEntry ); - void ConstructL(); + private: + CRightsObjectServerMtm( CRegisteredMtmDll& aRegisteredMtmDll , CMsvServerEntry* aInitialEntry ); + void ConstructL(); - private: - }; + private: + }; #endif // RIGHTSOBJECTSERVERMTM_H - + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmplugins/drmromtm/ui/inc/RoMtmUi.h --- a/omadrm/drmplugins/drmromtm/ui/inc/RoMtmUi.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmplugins/drmromtm/ui/inc/RoMtmUi.h Mon Mar 15 12:41:43 2010 +0200 @@ -22,8 +22,8 @@ // INCLUDES #include #include -#include - +#include + // CONSTANTS // MACRightsObjectS // DATA TYPES @@ -43,8 +43,8 @@ // CLASS DECLARATION /** -* CRightsObjectMtmUi -* +* CRightsObjectMtmUi +* * @lib romtmui.lib * @since 2.5 */ @@ -52,169 +52,169 @@ // CRightsObjectMtmUi: User Interface MTM // class CRightsObjectMtmUi : public CBaseMtmUi , public MAknServerAppExitObserver , public MApaServerAppExitObserver - { - public: - // Construction + { + public: + // Construction /** * Two-phased constructor. */ - static CRightsObjectMtmUi* NewL( CBaseMtm& aBaseMtm , CRegisteredMtmDll& aRegisteredMtmDll ); + static CRightsObjectMtmUi* NewL( CBaseMtm& aBaseMtm , CRegisteredMtmDll& aRegisteredMtmDll ); - // Destruction + // Destruction /** * Destructor. */ - ~CRightsObjectMtmUi(); + ~CRightsObjectMtmUi(); - /************************************* - * - * from CBaseMtmUi - * - **************************************/ + /************************************* + * + * from CBaseMtmUi + * + **************************************/ /** * CancelL. * @since 2.5 - * - * Not Supported - * + * + * Not Supported + * */ - CMsvOperation* CancelL( TRequestStatus& aStatus, const CMsvEntrySelection& aSelection ); + CMsvOperation* CancelL( TRequestStatus& aStatus, const CMsvEntrySelection& aSelection ); - // Context-specific + // Context-specific /** * OpenL. * @since 2.5 - * - * @param aStatus The request status to be completed when the operation has finished - * @return If successful, this is an asynchronously completing open operation. - * If failed, this is a completed operation, with status set to the relevant error code. + * + * @param aStatus The request status to be completed when the operation has finished + * @return If successful, this is an asynchronously completing open operation. + * If failed, this is a completed operation, with status set to the relevant error code. */ - CMsvOperation* OpenL( TRequestStatus& aStatus ); - + CMsvOperation* OpenL( TRequestStatus& aStatus ); + /** * OpenL. * @since 2.5 - * - * @param aStatus The request status to be completed when the operation has finished - * @param aSelection Selection of message entries - * @return If successful, this is an asynchronously completing open operation. - * If failed, this is a completed operation, with status set to the relevant error code. + * + * @param aStatus The request status to be completed when the operation has finished + * @param aSelection Selection of message entries + * @return If successful, this is an asynchronously completing open operation. + * If failed, this is a completed operation, with status set to the relevant error code. */ - CMsvOperation* OpenL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection ); + CMsvOperation* OpenL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection ); + + /** + * CloseL. + * @since 2.5 + * + * Not Supported + * + */ + CMsvOperation* CloseL( TRequestStatus& aStatus ); /** * CloseL. * @since 2.5 - * - * Not Supported - * + * + * Not Supported + * */ - CMsvOperation* CloseL( TRequestStatus& aStatus ); - - /** - * CloseL. - * @since 2.5 - * - * Not Supported - * - */ - CMsvOperation* CloseL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection ); + CMsvOperation* CloseL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection ); - // Launches editor/settings dialog as appropriate - /** + // Launches editor/settings dialog as appropriate + /** * EditL. * @since 2.5 - * - * Not Supported - * + * + * Not Supported + * */ - CMsvOperation* EditL( TRequestStatus& aStatus ); - - /** + CMsvOperation* EditL( TRequestStatus& aStatus ); + + /** * EditL. * @since 2.5 - * - * Not Supported - * + * + * Not Supported + * */ - CMsvOperation* EditL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection ) ; + CMsvOperation* EditL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection ) ; - // Launches viewer/settings dialog as appropriate + // Launches viewer/settings dialog as appropriate /** * ViewL. * @since 2.5 - * - * @param aStatus The request status to be completed when the operation has finished - * @return If successful, this is an asynchronously completing open operation. - * If failed, this is a completed operation, with status set to the relevant error code. + * + * @param aStatus The request status to be completed when the operation has finished + * @return If successful, this is an asynchronously completing open operation. + * If failed, this is a completed operation, with status set to the relevant error code. */ - CMsvOperation* ViewL( TRequestStatus& aStatus ); - + CMsvOperation* ViewL( TRequestStatus& aStatus ); + /** * ViewL. * @since 2.5 - * - * @param aStatus The request status to be completed when the operation has finished - * @param aSelection Selection of message entries - * @return If successful, this is an asynchronously completing open operation. - * If failed, this is a completed operation, with status set to the relevant error code. - */ - CMsvOperation* ViewL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection ); + * + * @param aStatus The request status to be completed when the operation has finished + * @param aSelection Selection of message entries + * @return If successful, this is an asynchronously completing open operation. + * If failed, this is a completed operation, with status set to the relevant error code. + */ + CMsvOperation* ViewL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection ); - // Reply/forward - /** + // Reply/forward + /** * ReplyL. * @since 2.5 - * - * Not Supported - * + * + * Not Supported + * */ - CMsvOperation* ReplyL( TMsvId aDestination , TMsvPartList aPartList , TRequestStatus& aCompletionStatus ); - - /** + CMsvOperation* ReplyL( TMsvId aDestination , TMsvPartList aPartList , TRequestStatus& aCompletionStatus ); + + /** * ForwardL. * @since 2.5 - * - * Not Supported - * + * + * Not Supported + * */ - CMsvOperation* ForwardL( TMsvId aDestination , TMsvPartList aPartList , TRequestStatus& aCompletionStatus ); + CMsvOperation* ForwardL( TMsvId aDestination , TMsvPartList aPartList , TRequestStatus& aCompletionStatus ); - public: - void HandleServerAppExit(TInt aReason); + public: + void HandleServerAppExit(TInt aReason); - protected: - /************************************* - * - * from CBaseMtm - * - **************************************/ - void GetResourceFileName( TFileName& aFileName ) const; + protected: + /************************************* + * + * from CBaseMtm + * + **************************************/ + void GetResourceFileName( TFileName& aFileName ) const; - protected: - CRightsObjectMtmUi( CBaseMtm& aBaseMtm , CRegisteredMtmDll& aRegisteredMtmDll ); - void ConstructL(); + protected: + CRightsObjectMtmUi( CBaseMtm& aBaseMtm , CRegisteredMtmDll& aRegisteredMtmDll ); + void ConstructL(); - private: - void CheckMessageTypeL(); - CMsvOperation* LaunchEditorApplicationL( TRequestStatus& aStatus , TMsvId aId , TBool aReadOnly ); - void SetProgressSuccess( TPckgBuf& aProgress , TMsvId aId ); - CMsvOperation* CompletedOperationL( TRequestStatus& aObserverStatus ); + private: + void CheckMessageTypeL(); + CMsvOperation* LaunchEditorApplicationL( TRequestStatus& aStatus , TMsvId aId , TBool aReadOnly ); + void SetProgressSuccess( TPckgBuf& aProgress , TMsvId aId ); + CMsvOperation* CompletedOperationL( TRequestStatus& aObserverStatus ); TBool ShowQueryL( TDesC16& aFile ); TInt CheckTriggerTypeL( TDesC16& aFile ); - private: - TMessageType iType; - CDocumentHandler* iDocHandler; - RFs iFs; - CEikProcess* iHostProcess; + private: + TMessageType iType; + CDocumentHandler* iDocHandler; + RFs iFs; + CEikProcess* iHostProcess; CAknLaunchAppService* iOpenService; - }; + }; #endif // RIGHTSOBJECTMTMUI_H - + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmplugins/drmromtm/ui/src/RoMtmUi.cpp --- a/omadrm/drmplugins/drmromtm/ui/src/RoMtmUi.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmplugins/drmromtm/ui/src/RoMtmUi.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,7 +19,7 @@ // INCLUDE FILES #include //CRichText -#include // CEikRichTextEditor +#include // CEikRichTextEditor #include //CEikonEnv #include @@ -27,18 +27,18 @@ #include // Messaging includes -#include +#include #include #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif #include #include -#include +#include #include "RoMtmUi.h" -#include "RoMtmUiC.h" +#include "RoMTMUiC.h" #include // document handler @@ -48,10 +48,10 @@ #include // KDC_RESOURCE_FILES_DIR #include // CAknQueryDialog #include //StringLoader -#include //rconeresloader +#include //rconeresloader #include // test // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS _LIT(KRoAcquisitionPrefix, "ROA:"); _LIT(KTriggerPrefix, "TRI:"); @@ -59,7 +59,7 @@ #ifndef RD_MULTIPLE_DRIVE _LIT( KDriveZ, "z:" ); #endif - + _LIT( KRoMtmUiResFileName,"RoMtmUi.rsc" ); // MACROS // LOCAL CONSTANTS AND MACROS @@ -145,7 +145,7 @@ CleanupStack::PopAndDestroy(); //fs WriteCurrentTimeL(); } - + LOCAL_C void WriteL( const TDesC8& aText , TInt aErr ) { _LIT8(KErr,": %d"); @@ -158,7 +158,7 @@ WriteL(textptr); CleanupStack::PopAndDestroy(text); } - + LOCAL_C void WriteL( const TDesC& aText , TInt aErr ) { _LIT8(KErr,": %d"); @@ -200,15 +200,15 @@ #endif /************************************* * -* Global function declarations +* Global function declarations * **************************************/ EXPORT_C CBaseMtmUi* NewMtmUiL( CBaseMtm& aMtm , CRegisteredMtmDll& aRegisteredDll ) // Factory function - { - return CRightsObjectMtmUi::NewL( aMtm , aRegisteredDll ); - } + { + return CRightsObjectMtmUi::NewL( aMtm , aRegisteredDll ); + } // // CRightsObjectMtmUi: User Interface MTM // @@ -217,7 +217,7 @@ /************************************* * -* Construction and destruction +* Construction and destruction * **************************************/ @@ -228,13 +228,13 @@ // ----------------------------------------------------------------------------- // CRightsObjectMtmUi::CRightsObjectMtmUi( CBaseMtm& aBaseMtm , CRegisteredMtmDll& aRegisteredMtmDll ) - : CBaseMtmUi( aBaseMtm , aRegisteredMtmDll ) - { - iOpenService = NULL; - iDocHandler = NULL; - iHostProcess = NULL; - iType = ERo; - } + : CBaseMtmUi( aBaseMtm , aRegisteredMtmDll ) + { + iOpenService = NULL; + iDocHandler = NULL; + iHostProcess = NULL; + iType = ERo; + } // ----------------------------------------------------------------------------- // CRightsObjectMtmUi::ConstructL @@ -242,14 +242,14 @@ // ----------------------------------------------------------------------------- // void CRightsObjectMtmUi::ConstructL() - { + { #ifdef _DRM_TESTING - CreateLogL(); - WriteL(_L8("ConstructL")); + CreateLogL(); + WriteL(_L8("ConstructL")); #endif - CBaseMtmUi::ConstructL(); - User::LeaveIfError(iFs.Connect()); - } + CBaseMtmUi::ConstructL(); + User::LeaveIfError(iFs.Connect()); + } // ----------------------------------------------------------------------------- // CRightsObjectMtmUi::NewL @@ -257,32 +257,32 @@ // ----------------------------------------------------------------------------- // CRightsObjectMtmUi* CRightsObjectMtmUi::NewL( CBaseMtm& aBaseMtm , CRegisteredMtmDll& aRegisteredMtmDll ) - { - CRightsObjectMtmUi* self=new ( ELeave ) CRightsObjectMtmUi( aBaseMtm , aRegisteredMtmDll ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); - return self; - } + { + CRightsObjectMtmUi* self=new ( ELeave ) CRightsObjectMtmUi( aBaseMtm , aRegisteredMtmDll ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } // Destructor CRightsObjectMtmUi::~CRightsObjectMtmUi() - { + { #ifdef _DRM_TESTING - TRAP(err,WriteL(_L8("~CRightsObjectMtmUi"))); + TRAP(err,WriteL(_L8("~CRightsObjectMtmUi"))); #endif - iFs.Close(); + iFs.Close(); delete iOpenService; - delete iDocHandler; - } + delete iDocHandler; + } /************************************* * -* from CBaseMtm +* from CBaseMtm * **************************************/ @@ -294,56 +294,56 @@ // ----------------------------------------------------------------------------- // CMsvOperation* CRightsObjectMtmUi::CancelL( TRequestStatus& /*aStatus*/ , const CMsvEntrySelection& /*aSelection*/ ) - { + { #ifdef _DRM_TESTING - WriteL(_L8("CancelL")); + WriteL(_L8("CancelL")); #endif - - User::Leave( KErrNotSupported ); // no cancelling - return NULL; - } + + User::Leave( KErrNotSupported ); // no cancelling + return NULL; + } // ----------------------------------------------------------------------------- // CRightsObjectMtmUi::GetResourceFileName // -// Implementations provide this function to set the full path -// and name of the resource file associated with the User Interface MTM. +// Implementations provide this function to set the full path +// and name of the resource file associated with the User Interface MTM. // // ----------------------------------------------------------------------------- // void CRightsObjectMtmUi::GetResourceFileName( TFileName& aFileName ) const -// Resource file loading - { +// Resource file loading + { #ifdef _DRM_TESTING - TRAPD(err,WriteL(_L8("GetResourceFileName"))); -#endif - aFileName = KRoMtmResourceFile; - } + TRAPD(err,WriteL(_L8("GetResourceFileName"))); +#endif + aFileName = KRoMtmResourceFile; + } // -// Entry manipulation +// Entry manipulation // // ----------------------------------------------------------------------------- // CRightsObjectMtmUi::OpenL // -// Opens an entry. +// Opens an entry. // // ----------------------------------------------------------------------------- // CMsvOperation* CRightsObjectMtmUi::OpenL( TRequestStatus& aStatus ) -// Open - { +// Open + { #ifdef _DRM_TESTING - WriteL(_L8("OpenL(1)")); -#endif + WriteL(_L8("OpenL(1)")); +#endif TMsvEntry tEntry = BaseMtm().Entry().Entry(); TMsvEntry newEntry( tEntry ); - const TUid type( tEntry.iType ); - CMsvOperation* operation = NULL; - if ( type == KUidMsvMessageEntry ) + const TUid type( tEntry.iType ); + CMsvOperation* operation = NULL; + if ( type == KUidMsvMessageEntry ) { operation = ViewL( aStatus ); newEntry.SetUnread( EFalse ); @@ -353,25 +353,25 @@ { User::Leave( KErrNotSupported ); } - return operation; - } + return operation; + } // ----------------------------------------------------------------------------- // CRightsObjectMtmUi::OpenL // -// Opens the first entry in the selections. +// Opens the first entry in the selections. // // ----------------------------------------------------------------------------- // CMsvOperation* CRightsObjectMtmUi::OpenL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection ) // Open selection - { + { #ifdef _DRM_TESTING - WriteL(_L8("OpenL(2)")); -#endif + WriteL(_L8("OpenL(2)")); +#endif BaseMtm().SwitchCurrentEntryL( aSelection.At( 0 ) ); return OpenL( aStatus ); - } + } // ----------------------------------------------------------------------------- // CRightsObjectMtmUi::CloseL @@ -381,14 +381,14 @@ // ----------------------------------------------------------------------------- // CMsvOperation* CRightsObjectMtmUi::CloseL( TRequestStatus& /*aStatus*/ ) - { -// Close + { +// Close #ifdef _DRM_TESTING - WriteL(_L8("CloseL(1)")); -#endif + WriteL(_L8("CloseL(1)")); +#endif User::Leave( KErrNotSupported ); return NULL; - } + } // ----------------------------------------------------------------------------- // CRightsObjectMtmUi::CloseL @@ -398,15 +398,15 @@ // ----------------------------------------------------------------------------- // CMsvOperation* CRightsObjectMtmUi::CloseL( TRequestStatus& /*aStatus*/ , const CMsvEntrySelection& /*aSelection*/ ) - { + { // Close selection #ifdef _DRM_TESTING - WriteL(_L8("CloseL(2)")); -#endif + WriteL(_L8("CloseL(2)")); +#endif User::Leave( KErrNotSupported ); return NULL; - } + } // ----------------------------------------------------------------------------- // CRightsObjectMtmUi::EditL @@ -416,14 +416,14 @@ // ----------------------------------------------------------------------------- // CMsvOperation* CRightsObjectMtmUi::EditL( TRequestStatus& /*aStatus*/ ) -// Edit - { +// Edit + { #ifdef _DRM_TESTING - WriteL(_L8("EditL(1)")); -#endif - User::Leave( KErrNotSupported ); - return NULL; - } + WriteL(_L8("EditL(1)")); +#endif + User::Leave( KErrNotSupported ); + return NULL; + } // ----------------------------------------------------------------------------- // CRightsObjectMtmUi::EditL @@ -434,13 +434,13 @@ // CMsvOperation* CRightsObjectMtmUi::EditL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection ) // Edit selection - { + { #ifdef _DRM_TESTING - WriteL(_L8("EditL(2)")); -#endif - iBaseMtm.SwitchCurrentEntryL( aSelection.At( 0 ) ); - return EditL( aStatus ); - } + WriteL(_L8("EditL(2)")); +#endif + iBaseMtm.SwitchCurrentEntryL( aSelection.At( 0 ) ); + return EditL( aStatus ); + } // ----------------------------------------------------------------------------- // CRightsObjectMtmUi::ViewL @@ -451,14 +451,14 @@ // CMsvOperation* CRightsObjectMtmUi::ViewL( TRequestStatus& aStatus ) // View - { + { #ifdef _DRM_TESTING - WriteL(_L8("ViewL(1)")); + WriteL(_L8("ViewL(1)")); #endif - - CheckMessageTypeL(); - return LaunchEditorApplicationL( aStatus , iBaseMtm.Entry().Entry().Id() , ETrue ); - } + + CheckMessageTypeL(); + return LaunchEditorApplicationL( aStatus , iBaseMtm.Entry().Entry().Id() , ETrue ); + } // ----------------------------------------------------------------------------- // CRightsObjectMtmUi::ViewL @@ -469,18 +469,18 @@ // CMsvOperation* CRightsObjectMtmUi::ViewL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection ) // View selection - { + { #ifdef _DRM_TESTING - WriteL(_L8("ViewL(2)")); + WriteL(_L8("ViewL(2)")); #endif - - iBaseMtm.SwitchCurrentEntryL( aSelection.At( 0 ) ); - return ViewL( aStatus ); - } + + iBaseMtm.SwitchCurrentEntryL( aSelection.At( 0 ) ); + return ViewL( aStatus ); + } // -// Message responding +// Message responding // // ----------------------------------------------------------------------------- @@ -492,10 +492,10 @@ // CMsvOperation* CRightsObjectMtmUi::ReplyL( TMsvId /*aDestination*/ , TMsvPartList /*aPartlist*/ , TRequestStatus& /*aCompletionStatus*/ ) // Reply to message - no UI support - { - User::Leave( KErrNotSupported ); - return NULL; - } + { + User::Leave( KErrNotSupported ); + return NULL; + } // ----------------------------------------------------------------------------- // CRightsObjectMtmUi::ForwardL @@ -506,10 +506,10 @@ // CMsvOperation* CRightsObjectMtmUi::ForwardL( TMsvId /*aDestination*/ , TMsvPartList /*aPartlist*/ , TRequestStatus& /*aCompletionStatus*/ ) // Forwarded message - no UI support - { - User::Leave( KErrNotSupported ); - return NULL; - } + { + User::Leave( KErrNotSupported ); + return NULL; + } // @@ -525,31 +525,31 @@ // ----------------------------------------------------------------------------- // void CRightsObjectMtmUi::CheckMessageTypeL() - { + { #ifdef _DRM_TESTING - WriteL(_L8("CheckMessageTypeL")); -#endif - BaseMtm().LoadMessageL(); - CRichText& body = BaseMtm().Body(); - TPtrC ptr16( body.Read(0) ); + WriteL(_L8("CheckMessageTypeL")); +#endif + BaseMtm().LoadMessageL(); + CRichText& body = BaseMtm().Body(); + TPtrC ptr16( body.Read(0) ); #ifdef _DRM_TESTING - WriteL(ptr16); -#endif - if ( ptr16.Length()>4 && ptr16.Left(4).Compare(KRoAcquisitionPrefix())==0 ) - { - iType = ERoapTriggerRoAcquisition; - } - else if ( ptr16.Length()>4 && ptr16.Left(4).Compare(KTriggerPrefix())==0 ) - { - iType = ERoapTrigger; - } - else - { - iType = ERo; - } - - } + WriteL(ptr16); +#endif + if ( ptr16.Length()>4 && ptr16.Left(4).Compare(KRoAcquisitionPrefix())==0 ) + { + iType = ERoapTriggerRoAcquisition; + } + else if ( ptr16.Length()>4 && ptr16.Left(4).Compare(KTriggerPrefix())==0 ) + { + iType = ERoapTrigger; + } + else + { + iType = ERo; + } + + } // ----------------------------------------------------------------------------- // CRightsObjectMtmUi::LaunchEditorApplicationL @@ -558,123 +558,123 @@ // // ----------------------------------------------------------------------------- // -CMsvOperation* CRightsObjectMtmUi::LaunchEditorApplicationL( TRequestStatus& aStatus , TMsvId /*aId*/ , - TBool /*aReadOnly*/ ) - { +CMsvOperation* CRightsObjectMtmUi::LaunchEditorApplicationL( TRequestStatus& aStatus , TMsvId /*aId*/ , + TBool /*aReadOnly*/ ) + { #ifdef _DRM_TESTING - WriteL(_L8("LaunchEditorApplicationL-Start")); -#endif - // get message context - BaseMtm().LoadMessageL(); - CRichText& body = BaseMtm().Body(); - TPtrC ptr16( body.Read(0) ); + WriteL(_L8("LaunchEditorApplicationL-Start")); +#endif + // get message context + BaseMtm().LoadMessageL(); + CRichText& body = BaseMtm().Body(); + TPtrC ptr16( body.Read(0) ); const TUid KUidDRMUI = { 0x101f85c7 }; - if ( iType == ERoapTrigger || iType == ERoapTriggerRoAcquisition ) - { - + if ( iType == ERoapTrigger || iType == ERoapTriggerRoAcquisition ) + { + #ifdef _DRM_TESTING - WriteL(_L8("LaunchEditorApplicationL-iDocHandler")); + WriteL(_L8("LaunchEditorApplicationL-iDocHandler")); #endif - + _LIT8( KRoapTriggerMimeType, "application/vnd.oma.drm.roap-trigger+xml" ); TDataType type = TDataType( KRoapTriggerMimeType ); HBufC* filename = NULL; - TPtr ptr(NULL,0); - TBool show; - filename = HBufC::NewLC(ptr16.Length()-4); - ptr.Set(filename->Des()); - ptr.Append(ptr16.Right(ptr16.Length()-4)); - - show = ShowQueryL(ptr); - if (!show) - { - CleanupStack::PopAndDestroy(filename); - return CompletedOperationL( aStatus ); - } - -#ifdef _DRM_TESTING - WriteL(ptr,ptr.Length()); -#endif - if (iDocHandler) - { - delete iDocHandler; - iDocHandler = NULL; - } -#ifdef _DRM_TESTING - WriteL(_L8("LaunchEditorApplicationL-iDocHandler-NewL")); -#endif - iDocHandler = CDocumentHandler::NewL(); -#ifdef _DRM_TESTING - WriteL(_L8("LaunchEditorApplicationL-iDocHandler-SetExitObserver")); -#endif - iDocHandler->SetExitObserver(this); -#ifdef _DRM_TESTING - WriteL(_L8("LaunchEditorApplicationL-iDocHandler-OpenFileEmbeddedL")); -#endif - iDocHandler->OpenFileEmbeddedL(ptr,type); - CleanupStack::PopAndDestroy(filename); -#ifdef _DRM_TESTING - WriteL(_L8("LaunchEditorApplicationL-iDocHandler-End")); -#endif - } - else - { - if ( iOpenService ) - { - delete iOpenService; - iOpenService = NULL; - } -#ifdef _DRM_TESTING - WriteL(_L8("LaunchEditorApplicationL-CAknOpenFileService::NewL")); -#endif + TPtr ptr(NULL,0); + TBool show; + filename = HBufC::NewLC(ptr16.Length()-4); + ptr.Set(filename->Des()); + ptr.Append(ptr16.Right(ptr16.Length()-4)); - CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC(); - TAiwVariant variantObject( ptr16 ); - TAiwGenericParam param( EGenericParamFile, variantObject ); - paramList->AppendL( param ); - - TRAPD( err, iOpenService = CAknLaunchAppService::NewL( KUidDRMUI, this, paramList ) ); - if (err != KErrNone) - { - // just return to Inbox - } - - CleanupStack::PopAndDestroy( paramList ); // paramList - } + show = ShowQueryL(ptr); + if (!show) + { + CleanupStack::PopAndDestroy(filename); + return CompletedOperationL( aStatus ); + } #ifdef _DRM_TESTING - WriteL(_L8("LaunchEditorApplicationL-End")); -#endif + WriteL(ptr,ptr.Length()); +#endif + if (iDocHandler) + { + delete iDocHandler; + iDocHandler = NULL; + } +#ifdef _DRM_TESTING + WriteL(_L8("LaunchEditorApplicationL-iDocHandler-NewL")); +#endif + iDocHandler = CDocumentHandler::NewL(); +#ifdef _DRM_TESTING + WriteL(_L8("LaunchEditorApplicationL-iDocHandler-SetExitObserver")); +#endif + iDocHandler->SetExitObserver(this); +#ifdef _DRM_TESTING + WriteL(_L8("LaunchEditorApplicationL-iDocHandler-OpenFileEmbeddedL")); +#endif + iDocHandler->OpenFileEmbeddedL(ptr,type); + CleanupStack::PopAndDestroy(filename); +#ifdef _DRM_TESTING + WriteL(_L8("LaunchEditorApplicationL-iDocHandler-End")); +#endif + } + else + { + if ( iOpenService ) + { + delete iOpenService; + iOpenService = NULL; + } +#ifdef _DRM_TESTING + WriteL(_L8("LaunchEditorApplicationL-CAknOpenFileService::NewL")); +#endif + + CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC(); + TAiwVariant variantObject( ptr16 ); + TAiwGenericParam param( EGenericParamFile, variantObject ); + paramList->AppendL( param ); + + TRAPD( err, iOpenService = CAknLaunchAppService::NewL( KUidDRMUI, this, paramList ) ); + if (err != KErrNone) + { + // just return to Inbox + } + + CleanupStack::PopAndDestroy( paramList ); // paramList + } + +#ifdef _DRM_TESTING + WriteL(_L8("LaunchEditorApplicationL-End")); +#endif return CompletedOperationL( aStatus ); - } + } void CRightsObjectMtmUi::HandleServerAppExit(TInt aReason) - { + { #ifdef _DRM_TESTING - TRAP(err,WriteL(_L8("HandleServerAppExit"))); -#endif - MAknServerAppExitObserver::HandleServerAppExit(aReason); - } - + TRAP(err,WriteL(_L8("HandleServerAppExit"))); +#endif + MAknServerAppExitObserver::HandleServerAppExit(aReason); + } + // ----------------------------------------------------------------------------- // CRightsObjectMtmUi::CompletedOperationL // -// return completed operation to UI +// return completed operation to UI // // ----------------------------------------------------------------------------- // CMsvOperation* CRightsObjectMtmUi::CompletedOperationL( TRequestStatus& aObserverStatus ) { #ifdef _DRM_TESTING - WriteL(_L8("CompletedOperationL")); -#endif - //return completed operation pointer + WriteL(_L8("CompletedOperationL")); +#endif + //return completed operation pointer TPckgBuf progress; SetProgressSuccess( progress, BaseMtm().Entry().Entry().Id() ); - CMsvCompletedOperation* operation = - CMsvCompletedOperation::NewL( Session() , Type() , progress , + CMsvCompletedOperation* operation = + CMsvCompletedOperation::NewL( Session() , Type() , progress , KMsvLocalServiceIndexEntryId , aObserverStatus ); return operation; } @@ -690,31 +690,31 @@ TBool CRightsObjectMtmUi::ShowQueryL( TDesC16& aFile ) { #ifdef _DRM_TESTING - WriteL(_L8("ShowQueryL")); -#endif + WriteL(_L8("ShowQueryL")); +#endif TBool show = ETrue; TInt type = 0; HBufC* msgText = NULL; - type = CheckTriggerTypeL(aFile); - + type = CheckTriggerTypeL(aFile); + #ifndef RD_MULTIPLE_DRIVE - + TFileName fileName( KDriveZ ); - + #else //RD_MULTIPLE_DRIVE - + _LIT( KDrive, "%c:"); TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber ); - iFs.DriveToChar( driveNumber, driveLetter ); - - TFileName fileName; - + iFs.DriveToChar( driveNumber, driveLetter ); + + TFileName fileName; + fileName.Format( KDrive, (TUint)driveLetter ); - + #endif - + fileName.Append( KDC_MTM_RESOURCE_DIR ); fileName.Append( KRoMtmUiResFileName ); RConeResourceLoader loader( *iCoeEnv ); @@ -724,60 +724,60 @@ case Roap::ERegistrationTrigger: { #ifdef _DRM_TESTING - WriteL(_L8("ShowQueryL->ERegistrationTrigger")); -#endif + WriteL(_L8("ShowQueryL->ERegistrationTrigger")); +#endif loader.Close(); - return ETrue; + return ETrue; } case Roap::ERoAcquisitionTrigger: { #ifdef _DRM_TESTING - WriteL(_L8("ShowQueryL->ERoAcquisitionTrigger")); + WriteL(_L8("ShowQueryL->ERoAcquisitionTrigger")); #endif - msgText = StringLoader::LoadLC( R_ROMTMUI_QUERY_RIGHTS_ACQ_MSG , iCoeEnv ); + msgText = StringLoader::LoadLC( R_ROMTMUI_QUERY_RIGHTS_ACQ_MSG , iCoeEnv ); }break; case Roap::EJoinDomainTrigger: { #ifdef _DRM_TESTING - WriteL(_L8("ShowQueryL->EJoinDomainTrigger")); -#endif - msgText = StringLoader::LoadLC( R_ROMTMUI_QUERY_JOIN_DOMAIN_MSG , iCoeEnv ); + WriteL(_L8("ShowQueryL->EJoinDomainTrigger")); +#endif + msgText = StringLoader::LoadLC( R_ROMTMUI_QUERY_JOIN_DOMAIN_MSG , iCoeEnv ); }break; case Roap::ELeaveDomainTrigger: { #ifdef _DRM_TESTING - WriteL(_L8("ShowQueryL->ELeaveDomainTrigger")); -#endif - msgText = StringLoader::LoadLC( R_ROMTMUI_QUERY_LEAVE_DOMAIN_MSG , iCoeEnv ); + WriteL(_L8("ShowQueryL->ELeaveDomainTrigger")); +#endif + msgText = StringLoader::LoadLC( R_ROMTMUI_QUERY_LEAVE_DOMAIN_MSG , iCoeEnv ); }break; default: { #ifdef _DRM_TESTING - WriteL(_L8("ShowQueryL->default")); -#endif + WriteL(_L8("ShowQueryL->default")); +#endif loader.Close(); - return EFalse; + return EFalse; } } #ifdef _DRM_TESTING - WriteL(*msgText); -#endif + WriteL(*msgText); +#endif loader.Close(); CAknQueryDialog* dlg = new (ELeave) CAknQueryDialog( *msgText, CAknQueryDialog::ENoTone ); - show = dlg->ExecuteLD( R_ROMTMUI_TRIGGER_CONFIRMATION_QUERY ); + show = dlg->ExecuteLD( R_ROMTMUI_TRIGGER_CONFIRMATION_QUERY ); CleanupStack::PopAndDestroy( msgText ); #ifdef _DRM_TESTING - WriteL(_L8("ShowQueryL->End"),show); -#endif + WriteL(_L8("ShowQueryL->End"),show); +#endif return show; } TInt CRightsObjectMtmUi::CheckTriggerTypeL( TDesC16& aFile ) { #ifdef _DRM_TESTING - WriteL(_L8("CheckTriggerTypeL")); -#endif + WriteL(_L8("CheckTriggerTypeL")); +#endif Roap::CRoapEng* roap = NULL; RFile file; TInt size = 0; @@ -785,7 +785,7 @@ Roap::TRiContextStatus status; Roap::TDomainOperation op; RPointerArray array; - + HBufC8* buf =NULL; TPtr8 ptr(NULL,0); User::LeaveIfError(file.Open(iFs, aFile, EFileShareReadersOrWriters)); @@ -804,13 +804,13 @@ array.Close(); CleanupStack::PopAndDestroy(roap); CleanupStack::PopAndDestroy(buf); - + #ifdef _DRM_TESTING - WriteL(_L8("CheckTriggerTypeL-End"),type); -#endif + WriteL(_L8("CheckTriggerTypeL-End"),type); +#endif return type; } - + diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmplugins/drmromtm/uiData/inc/RoMtmDat.h --- a/omadrm/drmplugins/drmromtm/uiData/inc/RoMtmDat.h Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmplugins/drmromtm/uiData/inc/RoMtmDat.h Mon Mar 15 12:41:43 2010 +0200 @@ -25,7 +25,7 @@ #endif #if !defined(__MTUDBAS_H__) -#include +#include #endif // CONSTANTS @@ -38,34 +38,34 @@ // CLASS DECLARATION /** -* CRightsObjectMtmUiDataSessionObserver -* +* CRightsObjectMtmUiDataSessionObserver +* * CMsvSession Observer * * @lib RoMtmDat.lib * @since 2.5 */ class CRightsObjectMtmUiDataSessionObserver : public CBase, public MMsvSessionObserver - { - public: + { + public: /** - * Two-phased constructor. - */ - static CRightsObjectMtmUiDataSessionObserver* NewL(); + * Two-phased constructor. + */ + static CRightsObjectMtmUiDataSessionObserver* NewL(); - /** - * Destructor. - */ - ~CRightsObjectMtmUiDataSessionObserver(); + /** + * Destructor. + */ + ~CRightsObjectMtmUiDataSessionObserver(); /** * From MMsvSessionObserver */ - void HandleSessionEventL( - TMsvSessionEvent aEvent, - TAny* aArg1, - TAny* aArg2, + void HandleSessionEventL( + TMsvSessionEvent aEvent, + TAny* aArg1, + TAny* aArg2, TAny* aArg3 ); private: @@ -76,210 +76,210 @@ // CLASS DECLARATION /** -* CRightsObjectMtmUiData -* +* CRightsObjectMtmUiData +* * @lib RoMtmDat.lib * @since 2.5 */ class CRightsObjectMtmUiData : public CBaseMtmUiData - { - public: - // Construction, initialisation, and destruction - - /** - * Two-phased constructor. - */ - static CRightsObjectMtmUiData* NewL( CRegisteredMtmDll& aRegisteredDll ); + { + public: + // Construction, initialisation, and destruction + + /** + * Two-phased constructor. + */ + static CRightsObjectMtmUiData* NewL( CRegisteredMtmDll& aRegisteredDll ); - /** - * Destructor. - */ - ~CRightsObjectMtmUiData(); + /** + * Destructor. + */ + ~CRightsObjectMtmUiData(); - /************************************* - * - * from CBaseMtm - * - **************************************/ + /************************************* + * + * from CBaseMtm + * + **************************************/ - // Context-specific information + // Context-specific information - /** + /** * CanEditEntryL * @since 2.5 - * - * Not supported - * + * + * Not supported + * */ - TBool CanEditEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const; - - /** + TBool CanEditEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const; + + /** * CanViewEntryL * @since 2.5 - * - * @param aContext The entry to which the operation applies. - * @param aReasonResourceId On return, a resource string ID or 0. - * - * @return KErrNone: the operation is appropriate on the entry. KErrNotSupported: the operation is not appropriate on the entry. - */ - TBool CanViewEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const; - - /** + * + * @param aContext The entry to which the operation applies. + * @param aReasonResourceId On return, a resource string ID or 0. + * + * @return KErrNone: the operation is appropriate on the entry. KErrNotSupported: the operation is not appropriate on the entry. + */ + TBool CanViewEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const; + + /** * CanOpenEntryL * @since 2.5 - * - * @param aContext The entry to which the operation applies. - * @param aReasonResourceId On return, a resource string ID or 0. - * - * @return KErrNone: the operation is appropriate on the entry. KErrNotSupported: the operation is not appropriate on the entry. - */ - TBool CanOpenEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const; - - /** + * + * @param aContext The entry to which the operation applies. + * @param aReasonResourceId On return, a resource string ID or 0. + * + * @return KErrNone: the operation is appropriate on the entry. KErrNotSupported: the operation is not appropriate on the entry. + */ + TBool CanOpenEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const; + + /** * CanCloseEntryL * @since 2.5 - * - * Not supported - * - */ - TBool CanCloseEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const; - - /** + * + * Not supported + * + */ + TBool CanCloseEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const; + + /** * CanDeleteFromEntryL * @since 2.5 - * - * Not supported - * - */ - TBool CanDeleteFromEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const; - - /** + * + * Not supported + * + */ + TBool CanDeleteFromEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const; + + /** * CanCopyMoveToEntryL * @since 2.5 - * - * Not supported - * - */ - TBool CanCopyMoveToEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const; - - /** + * + * Not supported + * + */ + TBool CanCopyMoveToEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const; + + /** * CanCopyMoveFromEntryL * @since 2.5 - * - * Not supported - * - */ - TBool CanCopyMoveFromEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const; - - /** + * + * Not supported + * + */ + TBool CanCopyMoveFromEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const; + + /** * CanReplyToEntryL * @since 2.5 - * - * Not supported - * - */ - TBool CanReplyToEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const; - - /** + * + * Not supported + * + */ + TBool CanReplyToEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const; + + /** * CanForwardEntryL * @since 2.5 - * - * Not supported - * - */ - TBool CanForwardEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const; - - /** + * + * Not supported + * + */ + TBool CanForwardEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const; + + /** * CanCreateEntryL * @since 2.5 - * - * Not supported - * - */ - TBool CanCreateEntryL( const TMsvEntry& aContext , TMsvEntry& aNewEntry , TInt& aReasonResourceId ) const; - - /** + * + * Not supported + * + */ + TBool CanCreateEntryL( const TMsvEntry& aContext , TMsvEntry& aNewEntry , TInt& aReasonResourceId ) const; + + /** * CanDeleteServiceL * @since 2.5 - * - * Not supported - * - */ - TBool CanDeleteServiceL( const TMsvEntry& aService , TInt& aReasonResourceId ) const; - - /** + * + * Not supported + * + */ + TBool CanDeleteServiceL( const TMsvEntry& aService , TInt& aReasonResourceId ) const; + + /** * CanCancelL * @since 2.5 - * - * Not supported - * - */ - TBool CanCancelL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const; + * + * Not supported + * + */ + TBool CanCancelL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const; - // Context-specific icons + // Context-specific icons - /** + /** * ContextIcon * @since 2.5 - * - * @param aContext Context entry to return the icons for. - * @param aStateFlags Flasgs indicating the user interface state of the entry. - * - * @return Bitmap array for the given context.. - */ - const CBitmapArray& ContextIcon( const TMsvEntry& aContext , TInt aStateFlags ) const; + * + * @param aContext Context entry to return the icons for. + * @param aStateFlags Flasgs indicating the user interface state of the entry. + * + * @return Bitmap array for the given context.. + */ + const CBitmapArray& ContextIcon( const TMsvEntry& aContext , TInt aStateFlags ) const; - /** + /** * GetResourceFileName * @since 2.5 - * - * @param aFileName Filename buffer to be filled with the resource file path and name - */ - void GetResourceFileName( TFileName& aFileName ) const; - - /** + * + * @param aFileName Filename buffer to be filled with the resource file path and name + */ + void GetResourceFileName( TFileName& aFileName ) const; + + /** * PopulateArraysL * @since 2.5 - * - */ - void PopulateArraysL(); + * + */ + void PopulateArraysL(); - - /** + + /** * StatusTextL * @since 2.5 - * - * Not supported - * - */ - HBufC* StatusTextL( const TMsvEntry& aContext ) const; + * + * Not supported + * + */ + HBufC* StatusTextL( const TMsvEntry& aContext ) const; - // MTM-specific functionality + // MTM-specific functionality - /** + /** * OperationSupportedL * @since 2.5 - * - * Not supported - * - */ - TInt OperationSupportedL( - TInt aOperationId , + * + * Not supported + * + */ + TInt OperationSupportedL( + TInt aOperationId , const TMsvEntry& aContext ) const; - - /** + + /** * QueryCapability * @since 2.5 - * - * @param aCapability UID of capability to be queried - * @param aResponse Response value. The format of the response varies + * + * @param aCapability UID of capability to be queried + * @param aResponse Response value. The format of the response varies * according to the capability - * - * @return KErrNone if aCapability is a recognised value and a response is - * returned KErrNotSupported if aCapability is not a recognised value - */ - TInt QueryCapability( TUid aCapability , TInt& aResponse ) const; + * + * @return KErrNone if aCapability is a recognised value and a response is + * returned KErrNotSupported if aCapability is not a recognised value + */ + TInt QueryCapability( TUid aCapability , TInt& aResponse ) const; protected: @@ -291,27 +291,27 @@ */ void CreateSkinnedBitmapsL( TInt aNumZoomStates ); - private: + private: void ConstructL(); - CRightsObjectMtmUiData( CRegisteredMtmDll& aRegisteredDll ); + CRightsObjectMtmUiData( CRegisteredMtmDll& aRegisteredDll ); void SetDescriptionL( const TMsvEntry& aContext ) const; - + - public: // Data + public: // Data protected: // Data private: // Data CRightsObjectMtmUiDataSessionObserver* iObserver; CMsvSession* iSession; - + public: // Friend classes protected: // Friend classes private: // Friend classes - }; + }; #endif // RIGHTSOBJECTMTMUIDATA_H - + // End of File diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmplugins/drmromtm/uiData/src/RoMtmDat.cpp --- a/omadrm/drmplugins/drmromtm/uiData/src/RoMtmDat.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmplugins/drmromtm/uiData/src/RoMtmDat.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -42,22 +42,22 @@ #include #include #include -#include -#include +#include +#include #include #include -#include -#include -#include //skinned icon ids +#include +#include +#include //skinned icon ids #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif #include "RoMtmDat.h" -#include "RoMtmDaC.h" -#include "RoMtmCommon.h" +#include "RoMTMDaC.h" +#include "RoMTMCommon.h" // EXTERNAL DATA STRUCTURES // EXTERNAL FUNCTION PROTOTYPES diff -r e16d72588c28 -r 8a03a285ab14 wmdrm/camese/inc/cameselog.inl --- a/wmdrm/camese/inc/cameselog.inl Fri Mar 12 15:43:46 2010 +0200 +++ b/wmdrm/camese/inc/cameselog.inl Mon Mar 15 12:41:43 2010 +0200 @@ -17,7 +17,7 @@ // INCLUDE FILES -#include +#include // ---------------------------------------------------------------------------- // Write a string to the log - 16 bit version @@ -35,7 +35,7 @@ EFileLoggingModeAppend, msgPtr.Left(100)); offSet += 100; //set to 100 }; - RDebug::Print(aFmt); + RDebug::Print(aFmt); } // ---------------------------------------------------------------------------- @@ -71,11 +71,11 @@ EFileLoggingModeAppend, msgPtr.Left(100)); offSet += 100; //set to 100 }; - + HBufC* buf16 = HBufC::NewLC(aFmt.Length()); buf16->Des().Copy(aFmt); RDebug::Print(*buf16); - CleanupStack::PopAndDestroy(buf16); + CleanupStack::PopAndDestroy(buf16); } // ---------------------------------------------------------------------------- diff -r e16d72588c28 -r 8a03a285ab14 wmdrm/camese/wmdrmdlaapp/data/wmdrmdlaapp_reg.rss --- a/wmdrm/camese/wmdrmdlaapp/data/wmdrmdlaapp_reg.rss Fri Mar 12 15:43:46 2010 +0200 +++ b/wmdrm/camese/wmdrmdlaapp/data/wmdrmdlaapp_reg.rss Mon Mar 15 12:41:43 2010 +0200 @@ -26,7 +26,6 @@ RESOURCE APP_REGISTRATION_INFO { app_file = "wmdrmdlaapp"; - localisable_resource_file = APP_RESOURCE_DIR"\\wmdrmdlaapp"; hidden = KAppIsHidden; embeddability = KAppEmbeddableOnly; service_list = diff -r e16d72588c28 -r 8a03a285ab14 wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlaappdocument.h --- a/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlaappdocument.h Fri Mar 12 15:43:46 2010 +0200 +++ b/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlaappdocument.h Mon Mar 15 12:41:43 2010 +0200 @@ -20,7 +20,7 @@ #define C_WMDRMDLAAPPDOCUMENT_H // INCLUDES -#include +#include class CWmDrmDlaAppDocument : public CAknDocument { @@ -46,7 +46,7 @@ * @return Pointer to App Ui. */ CEikAppUi* CreateAppUiL(); - + public: // Constructors /** diff -r e16d72588c28 -r 8a03a285ab14 wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlaappserver.h --- a/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlaappserver.h Fri Mar 12 15:43:46 2010 +0200 +++ b/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlaappserver.h Mon Mar 15 12:41:43 2010 +0200 @@ -20,15 +20,15 @@ #define C_WMDRMDLAAPPSERVER_H // INCLUDES -#include +#include class CWmDrmDlaAppServer : public CAknAppServer { - + public: // from CAknAppServer - + CApaAppServiceBase* CreateServiceL( TUid aServiceType ) const; - + }; #endif // C_WMDRMDLAAPPSERVER_H diff -r e16d72588c28 -r 8a03a285ab14 wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlaappservicesession.h --- a/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlaappservicesession.h Fri Mar 12 15:43:46 2010 +0200 +++ b/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlaappservicesession.h Mon Mar 15 12:41:43 2010 +0200 @@ -20,29 +20,29 @@ #define C_WMDRMDLAAPPSERVICESESSION_H // INCLUDES -#include +#include #include "wmdrmdlaappui.h" #include "wmdrmdlabrowserview.h" /** * WMDRM DLA Application. */ -class CWmDrmDlaAppServiceSession : public CAknAppServiceBase, +class CWmDrmDlaAppServiceSession : public CAknAppServiceBase, public MBrowserViewLicenseReceivedCallback { - + public: - + CWmDrmDlaAppServiceSession(); virtual ~CWmDrmDlaAppServiceSession(); - + public: // from MBrowserViewLicenseReceivedCallback - + /** * Called when license is received */ void LicenseReceived(); - + protected: // from CSession2 /** @@ -53,18 +53,18 @@ void ServiceL( const RMessage2& aMessage ); private: - + void SetIapL( const RMessage2& aMessage ); void PostL( const RMessage2& aMessage ); void LicenseResponseSizeL( const RMessage2& aMessage ); void LicenseResponseL( const RMessage2& aMessage ); void CompleteMessage( const RMessage2& aMessage, TInt aError ); CWmDrmDlaBrowserView* BrowserView(); - + private: //data - + CActiveSchedulerWait* iWait; - + }; #endif // C_WMDRMDLAAPPSERVICESESSION_H diff -r e16d72588c28 -r 8a03a285ab14 wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlaappui.h --- a/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlaappui.h Fri Mar 12 15:43:46 2010 +0200 +++ b/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlaappui.h Mon Mar 15 12:41:43 2010 +0200 @@ -20,8 +20,8 @@ #define C_WMDRMDLAAPPUI_H // INCLUDES -#include -#include +#include +#include class CWmDrmDlaBrowserView; @@ -32,19 +32,19 @@ /** * Constructor. - */ + */ CWmDrmDlaAppUi(); - + /** * Second phase constructor. Leaves on failure. - */ + */ void ConstructL(); /** * Destructor. - */ + */ virtual ~CWmDrmDlaAppUi(); - + /** * Get browser view */ @@ -56,13 +56,13 @@ * From CEikAppUi, takes care of command handling. * @param aCommand command to be handled */ - void HandleCommandL( TInt aCommand ); - + void HandleCommandL( TInt aCommand ); + private: // data //Not owned CWmDrmDlaBrowserView* iBrowserView; - + }; #endif // C_WMDRMDLAAPPUI_H diff -r e16d72588c28 -r 8a03a285ab14 wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowsercontainer.cpp --- a/wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowsercontainer.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowsercontainer.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -17,7 +17,7 @@ // INCLUDE FILES -#include +#include #include #include #include "wmdrmdlabrowserview.h" @@ -35,7 +35,7 @@ CreateWindowL(); SetRect( iView->ClientRect() ); ActivateL(); - + iBrCtlInterface = CreateBrowserControlL( this, // parent control iView->ClientRect(), // client rect @@ -53,11 +53,11 @@ NULL // Download observer ); - iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsAutoLoadImages, - ETrue ); - iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsCookiesEnabled, + iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsAutoLoadImages, ETrue ); - iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsEmbedded, + iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsCookiesEnabled, + ETrue ); + iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsEmbedded, ETrue ); } @@ -78,7 +78,7 @@ CAknView* aView, MBrCtlSpecialLoadObserver* aObserver ) { - CWmDrmDlaBrowserContainer* self + CWmDrmDlaBrowserContainer* self = CWmDrmDlaBrowserContainer::NewLC( aView, aObserver ); CleanupStack::Pop( self ); return self; @@ -89,11 +89,11 @@ // CWmDrmDlaBrowserContainer::NewLC // --------------------------------------------------------------------------- // -CWmDrmDlaBrowserContainer* CWmDrmDlaBrowserContainer::NewLC( +CWmDrmDlaBrowserContainer* CWmDrmDlaBrowserContainer::NewLC( CAknView* aView, MBrCtlSpecialLoadObserver* aObserver ) { - CWmDrmDlaBrowserContainer* self + CWmDrmDlaBrowserContainer* self = new( ELeave ) CWmDrmDlaBrowserContainer( aView ); CleanupStack::PushL( self ); self->ConstructL( aObserver ); @@ -139,7 +139,7 @@ void CWmDrmDlaBrowserContainer::SizeChanged() { if ( iBrCtlInterface ) - { + { iBrCtlInterface->SetRect( Rect() ); } } @@ -152,20 +152,20 @@ TInt aIndex ) const { switch ( aIndex ) - { + { case 0: return iBrCtlInterface; - + default: return NULL; } } - + // --------------------------------------------------------------------------- // CWmDrmDlaBrowserContainer::OfferKeyEventL // --------------------------------------------------------------------------- // -TKeyResponse CWmDrmDlaBrowserContainer::OfferKeyEventL( +TKeyResponse CWmDrmDlaBrowserContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) { @@ -180,7 +180,7 @@ // CWmDrmDlaBrowserContainer::FocusChanged // --------------------------------------------------------------------------- // -void CWmDrmDlaBrowserContainer::FocusChanged( +void CWmDrmDlaBrowserContainer::FocusChanged( TDrawNow aDrawNow ) { iBrCtlInterface->SetFocus( IsFocused() ); diff -r e16d72588c28 -r 8a03a285ab14 wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowserview.cpp --- a/wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowserview.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowserview.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -19,7 +19,7 @@ // INCLUDE FILES #include #include -#include +#include #include #include #include @@ -112,10 +112,10 @@ const TDesC8& aPostContentBoundary ) { iCallback = aCallback; - iContainer->BrCtlInterface()->PostUrlL( aPostUrl, - aPostContentType, - aPostData, - &aPostContentBoundary, + iContainer->BrCtlInterface()->PostUrlL( aPostUrl, + aPostContentType, + aPostData, + &aPostContentBoundary, (TAny*)iContainer ); iContainer->BrCtlInterface()->SetFocus( ETrue, EDrawNow ); } @@ -146,9 +146,9 @@ void CWmDrmDlaBrowserView::HandleCommandL( TInt aCommand ) { - if ( aCommand >= TBrCtlDefs::ECommandIdBase + + if ( aCommand >= TBrCtlDefs::ECommandIdBase + TBrCtlDefs::ECommandIdWMLBase && - aCommand <= TBrCtlDefs::ECommandIdBase + + aCommand <= TBrCtlDefs::ECommandIdBase + TBrCtlDefs::ECommandIdRange ) { BrCtlHandleCommandL( aCommand ); @@ -167,7 +167,7 @@ const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/ ) - { + { CreateContainerL(); AppUi()->AddToStackL( *this, iContainer ); HandleClientRectChange(); @@ -202,7 +202,7 @@ { RemoveContainer(); iContainer = CWmDrmDlaBrowserContainer::NewL( this, this ); - iContainer->SetMopParent( this ); + iContainer->SetMopParent( this ); } // --------------------------------------------------------------------------- @@ -232,10 +232,10 @@ // CWmDrmDlaBrowserView::NetworkConnectionNeededL // --------------------------------------------------------------------------- // -void CWmDrmDlaBrowserView::NetworkConnectionNeededL( - TInt* aConnectionPtr, - TInt* aSockSvrHandle, - TBool* aNewConn, +void CWmDrmDlaBrowserView::NetworkConnectionNeededL( + TInt* aConnectionPtr, + TInt* aSockSvrHandle, + TBool* aNewConn, TApBearerType* aBearerType ) { TInt ret( 0 ); @@ -245,7 +245,7 @@ iConMgr->SetRequestedAP( iIap ); ret = iConMgr->StartConnectionL( ETrue ); } - + // If connected, return needed info to framework if ( !ret ) { @@ -254,7 +254,7 @@ *aNewConn = EFalse; *aBearerType = EApBearerTypeAllBearers; } - else + else { User::Leave( KErrCancel ); } @@ -264,8 +264,8 @@ // CWmDrmDlaBrowserView::HandleRequestL // --------------------------------------------------------------------------- // -TBool CWmDrmDlaBrowserView::HandleRequestL( - RArray* /*aTypeArray*/, +TBool CWmDrmDlaBrowserView::HandleRequestL( + RArray* /*aTypeArray*/, CDesCArrayFlat* /*aDesArray*/ ) { return EFalse; @@ -275,16 +275,16 @@ // CWmDrmDlaBrowserView::HandleDownloadL // --------------------------------------------------------------------------- // -TBool CWmDrmDlaBrowserView::HandleDownloadL( - RArray* aTypeArray, +TBool CWmDrmDlaBrowserView::HandleDownloadL( + RArray* aTypeArray, CDesCArrayFlat* aDesArray ) { //Check that content type and local file name exists - //There must be both, because download manager downloads POST-content + //There must be both, because download manager downloads POST-content //in advance calling this function - TInt contentTypeIndex( aTypeArray->Find( EParamReceivedContentType ) ); + TInt contentTypeIndex( aTypeArray->Find( EParamReceivedContentType ) ); TInt fileNameIndex( aTypeArray->Find( EParamLocalFileName ) ); - if ( contentTypeIndex != KErrNotFound && + if ( contentTypeIndex != KErrNotFound && fileNameIndex != KErrNotFound && contentTypeIndex < aDesArray->Count() && fileNameIndex < aDesArray->Count() ) @@ -294,7 +294,7 @@ if ( dataTypePtr.CompareF( KDataTypeLicenseResponse ) == 0 ) { //Get the path to the license response, - //read the response, delete the file and + //read the response, delete the file and //make a license received - callback TPtrC16 filePathPtr( (*aDesArray)[fileNameIndex] ); RFs fs; diff -r e16d72588c28 -r 8a03a285ab14 wmdrm/camese/wmdrmdlautils/data/wmdrmdlautils.rss --- a/wmdrm/camese/wmdrmdlautils/data/wmdrmdlautils.rss Fri Mar 12 15:43:46 2010 +0200 +++ b/wmdrm/camese/wmdrmdlautils/data/wmdrmdlautils.rss Mon Mar 15 12:41:43 2010 +0200 @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -39,7 +39,7 @@ RESOURCE TBUF { buf = ""; } -// RESOURCE DEFINITIONS +// RESOURCE DEFINITIONS // ----------------------------------------------------------------------------- // r_wmdrmdla_list_query @@ -77,7 +77,7 @@ // r_wmdrmdla_wait_note_acquiring_license // Note displayed when the license is being acquired for a song // --------------------------------------------------------------------------- -// +// RESOURCE TBUF r_wmdrmdla_wait_note_acquiring_license { buf = qtn_drm_wait_getting_key; @@ -87,7 +87,7 @@ // r_wmdrmdla_wait_note_metering // Note displayed when the metering is being done // --------------------------------------------------------------------------- -// +// RESOURCE TBUF r_wmdrmdla_wait_note_metering { buf = qtn_drm_wait_getting_key; diff -r e16d72588c28 -r 8a03a285ab14 wmdrm/camese/wmdrmdlautils/inc/wmdrmdlaappclient.h --- a/wmdrm/camese/wmdrmdlautils/inc/wmdrmdlaappclient.h Fri Mar 12 15:43:46 2010 +0200 +++ b/wmdrm/camese/wmdrmdlautils/inc/wmdrmdlaappclient.h Mon Mar 15 12:41:43 2010 +0200 @@ -20,7 +20,7 @@ #define R_WMDRMDLAAPPCLIENT_H #include -#include +#include /** * WMDRM DLA App Client Interface @@ -34,7 +34,7 @@ public: virtual ~RWmDrmDlaAppClient(); - + /** * Sets IAP to browser view * @@ -42,7 +42,7 @@ * @return Error code */ TInt SetIAP( TInt aIap ); - + /** * Makes a POST request to browser view * @@ -56,7 +56,7 @@ const TDesC8& aPostContentType, const TDesC8& aPostData, const TDesC8& aPostContentBoundary ); - + /** * Gets the license response from the browser view * @@ -65,9 +65,9 @@ * @return Error code */ TInt LicenseResponse( HBufC8*& aLicenseResponse ); - + private: // from RApaAppServiceBase - + TUid ServiceUid() const; private: // data diff -r e16d72588c28 -r 8a03a285ab14 wmdrm/camese/wmdrmdlautils/src/wmdrmdlaui.cpp --- a/wmdrm/camese/wmdrmdlautils/src/wmdrmdlaui.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/wmdrm/camese/wmdrmdlautils/src/wmdrmdlaui.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -27,9 +27,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include @@ -46,7 +46,7 @@ #ifndef RD_MULTIPLE_DRIVE _LIT( KDriveZ, "z:" ); #else -_LIT( KRomDriveFormatter, "%c:" ); +_LIT( KRomDriveFormatter, "%c:" ); #endif _LIT( KWmdrmDlaUtilsResFileName, "wmdrmdlautils.rsc" ); @@ -67,7 +67,7 @@ { User::Leave( KErrNotSupported ); } - + //Create resource file path TPtr wmdrmDlaUtilsResourcePtr( NULL, 0 ); iWmdrmDlaUtilsResourceFile = HBufC::NewL( KMaxFileName ); @@ -83,14 +83,14 @@ TInt driveNumber( -1 ); TChar driveLetter; //Get rom drive number - User::LeaveIfError( - DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, + User::LeaveIfError( + DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber ) ); //Get drive letter from the drive number - User::LeaveIfError( - iCoeEnv->FsSession().DriveToChar( driveNumber, + User::LeaveIfError( + iCoeEnv->FsSession().DriveToChar( driveNumber, driveLetter ) ); - wmdrmDlaUtilsResourcePtr.AppendFormat( KRomDriveFormatter, + wmdrmDlaUtilsResourcePtr.AppendFormat( KRomDriveFormatter, (TUint)driveLetter ); #endif @@ -103,13 +103,13 @@ TFileName resourceFile; resourceFile = *iWmdrmDlaUtilsResourceFile; //Find the correct language file for the resource - BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), + BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), resourceFile ); - //Add resource file to the CCoeEnv. + //Add resource file to the CCoeEnv. //Resource file must be removed from the CCoeEnv when we are done - iWmdrmDlaUtilsResourceFileOffset + iWmdrmDlaUtilsResourceFileOffset = iCoeEnv->AddResourceFileL( resourceFile ); - + iGlobalNote = CAknGlobalNote::NewL(); } @@ -168,7 +168,7 @@ // CWmDrmDlaUi::ShowErrorNoteL // --------------------------------------------------------------------------- // -EXPORT_C void CWmDrmDlaUi::ShowErrorNoteL( +EXPORT_C void CWmDrmDlaUi::ShowErrorNoteL( TInt aTextResourceId ) { LOGFN( "CWmDrmDlaUi::ShowErrorNoteL" ); @@ -182,7 +182,7 @@ // CWmDrmDlaUi::ShowWaitNoteL // --------------------------------------------------------------------------- // -EXPORT_C void CWmDrmDlaUi::ShowWaitNoteL( +EXPORT_C void CWmDrmDlaUi::ShowWaitNoteL( TInt aTextResourceId, MWmDrmDlaWaitNoteCallback* aCallback ) { @@ -192,8 +192,8 @@ User::Leave( KErrInUse ); } iGlobalNoteText = StringLoader::LoadL( aTextResourceId, iCoeEnv ); - iGlobalNoteId = iGlobalNote->ShowNoteL( iStatus, - EAknGlobalWaitNote, + iGlobalNoteId = iGlobalNote->ShowNoteL( iStatus, + EAknGlobalWaitNote, *iGlobalNoteText ); iCallback = aCallback; SetActive(); @@ -213,30 +213,30 @@ // CWmDrmDlaUi::ShowListQueryL // --------------------------------------------------------------------------- // -EXPORT_C TInt CWmDrmDlaUi::ShowListQueryL( +EXPORT_C TInt CWmDrmDlaUi::ShowListQueryL( MDesCArray* aItems, CArrayPtr* aIcons ) { LOGFN( "CWmDrmDlaUi::ShowListQueryL" ); - + //This method takes the ownership of the input parameters //Push the input parameters to the cleanupstack to make sure we won't leak //memory CleanupStack::PushL( aIcons ); CleanupStack::PushL( aItems ); - + //Check that both inputs really exist. if ( !aItems || !aIcons ) { User::Leave( KErrArgument ); } - + //Create the query with index parameter //Query will take the ownership of the items and icons TInt index( 0 ); CAknListQueryDialog* dlg = new (ELeave) CAknListQueryDialog( &index ); dlg->PrepareLC( R_WMDRMDLA_LIST_QUERY ); - + //Arrange cleanupstack in a way that query can take the ownership of the //items and icons CleanupStack::Pop( 2, aItems ); //dlg, aItems @@ -248,13 +248,13 @@ dlg->SetIconArrayL( aIcons ); CleanupStack::Pop( 2, aIcons ); //dlg, aIcons CleanupStack::PushL( dlg ); - + //Enable marquee scrolling for the text items - CEikFormattedCellListBox* listbox( + CEikFormattedCellListBox* listbox( static_cast( dlg->ListBox() ) /* , EAknListBoxItemSpecificMenuDisabled */ ); listbox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); - + //Launch the query TInt key( dlg->RunLD() ); LOG2( "key: %d", key ); @@ -290,7 +290,7 @@ { iCallback->UserWaitNoteCancellation(); } - } + } // --------------------------------------------------------------------------- // CWmDrmDlaUi::RunError @@ -301,7 +301,7 @@ return KErrNone; } - + // --------------------------------------------------------------------------- // CWmDrmDlaUi::CancelWaitNote // --------------------------------------------------------------------------- diff -r e16d72588c28 -r 8a03a285ab14 wmdrm/wmdrmengine/wmdrmserver/clientwrapper/src/wmdrmclientwrapper.cpp --- a/wmdrm/wmdrmengine/wmdrmserver/clientwrapper/src/wmdrmclientwrapper.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/wmdrm/wmdrmengine/wmdrmserver/clientwrapper/src/wmdrmclientwrapper.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -16,7 +16,7 @@ */ -#include "WmDrmClientWrapper.h" +#include "wmdrmclientwrapper.h" // CONSTANTS @@ -57,7 +57,7 @@ // CWmDrmClientWrapper* CWmDrmClientWrapper::NewLC() { - CWmDrmClientWrapper* self = new( ELeave ) CWmDrmClientWrapper(); + CWmDrmClientWrapper* self = new( ELeave ) CWmDrmClientWrapper(); CleanupStack::PushL( self ); self->ConstructL(); return self; @@ -90,14 +90,14 @@ // DRM gate function //------------------------------------------------------------------------------ EXPORT_C TAny* GateFunctionWmDrmClientWrapper() - { - CWmDrmClientWrapper* launcher = NULL; - TRAPD( err, launcher = CWmDrmClientWrapper::NewL() ); - if( err != KErrNone ) - { - return NULL; - } + { + CWmDrmClientWrapper* launcher = NULL; + TRAPD( err, launcher = CWmDrmClientWrapper::NewL() ); + if( err != KErrNone ) + { + return NULL; + } - return launcher; - } + return launcher; + } diff -r e16d72588c28 -r 8a03a285ab14 wmdrm/wmdrmengine/wmdrmserver/server/src/wmdrmdatastore.cpp --- a/wmdrm/wmdrmengine/wmdrmserver/server/src/wmdrmdatastore.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/wmdrm/wmdrmengine/wmdrmserver/server/src/wmdrmdatastore.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -20,10 +20,10 @@ #include #include #include -#include +#include #include "wmdrmdatastore.h" -#include "wmdrmprivatecrkeys.h" +#include "WMDRMPrivateCRKeys.h" #include "wmdrmkeystorage.h" #include "slotdatacache.h" #include "wmdrmdb.h" @@ -56,7 +56,7 @@ return self; } -CWmDrmDataStore::CWmDrmDataStore( CWmDrmServer* aServer ) +CWmDrmDataStore::CWmDrmDataStore( CWmDrmServer* aServer ) : iServer( aServer ), iMinFreeSpace2( 0 ) { LOGFN( "CWmDrmDataStore::CWmDrmDataStore" ); @@ -67,23 +67,23 @@ TDrmScheme drmScheme( EDrmSchemeWmDrm ); TFileName tempFile, tempFile2; TChar driveLetter; - + LOGFN( "CWmDrmDataStore::ConstructL" ); - + // Check which drive is configured in the Central Repository Key // for the desired storing location of WM DRM rights (license store). - iWmDrmRightsConfigFound = DrmRightsStoringLocation::CheckDrmRightsStorageDriveL( - iServer->Fs(), drmScheme, driveLetter ); - - // If the storing location is configured to other drive than the default - // system drive, prepare utility files for that drive, too. + iWmDrmRightsConfigFound = DrmRightsStoringLocation::CheckDrmRightsStorageDriveL( + iServer->Fs(), drmScheme, driveLetter ); + + // If the storing location is configured to other drive than the default + // system drive, prepare utility files for that drive, too. if ( iWmDrmRightsConfigFound ) { PrepareInfoFilesL( ETrue, driveLetter, iDummyDb2 ); } - + // Prepare the utility files for the default system drive - PrepareInfoFilesL( EFalse, (TUint)iServer->Fs().GetSystemDriveChar(), + PrepareInfoFilesL( EFalse, (TUint)iServer->Fs().GetSystemDriveChar(), iDummyDb ); } @@ -111,53 +111,53 @@ CAESDecryptor* aesDecryptor = NULL; CPaddingPKCS7* padding = NULL; TInt size = 0; - + LOGFN( "CWmDrmDataStore::ReadInitialFreeSpaceL" ); User::LeaveIfError( file.Open( iServer->Fs(), aFileName, EFileRead ) ); CleanupClosePushL( file ); - + User::LeaveIfError( file.Size( size ) ); - - if( size != ( 2 * KAESKeyLength ) ) - { - User::Leave(KErrCorrupt); - } + + if( size != ( 2 * KAESKeyLength ) ) + { + User::Leave(KErrCorrupt); + } User::LeaveIfError( file.Read( iv ) ); - User::LeaveIfError( file.Read( encryptedData ) ); + User::LeaveIfError( file.Read( encryptedData ) ); #if defined(FF_PLATFORM_SIMULATOR) || defined(__WINSCW__) - key.Copy( KDummyKey ); + key.Copy( KDummyKey ); #else - iServer->Cache()->iKeyStorage->GetDeviceSpecificKeyL( key ); + iServer->Cache()->iKeyStorage->GetDeviceSpecificKeyL( key ); #endif - aesDecryptor = CAESDecryptor::NewL( key ); + aesDecryptor = CAESDecryptor::NewL( key ); CleanupStack::PushL( aesDecryptor ); - + cbcDecryptor = CModeCBCDecryptor::NewL( aesDecryptor, iv ); CleanupStack::Pop( aesDecryptor ); CleanupStack::PushL( cbcDecryptor ); - + padding = CPaddingPKCS7::NewL( KAESKeyLength ); CleanupStack::PushL( padding ); - + decryptor = CBufferedDecryptor::NewL( cbcDecryptor, padding ); CleanupStack::Pop( 2, cbcDecryptor ); //padding, cbcDecryptor CleanupStack::PushL( decryptor ); - - decryptor->ProcessFinalL( encryptedData, decryptedData ); - CleanupStack::PopAndDestroy( 2, &file ); //decryptor, file - TLex8 lex( decryptedData ); - - if ( aConfiguredDrive ) - { - User::LeaveIfError( lex.Val( iInitialFreeSpace2 ) ); - } - else - { - User::LeaveIfError( lex.Val( iInitialFreeSpace ) ); - } + + decryptor->ProcessFinalL( encryptedData, decryptedData ); + CleanupStack::PopAndDestroy( 2, &file ); //decryptor, file + TLex8 lex( decryptedData ); + + if ( aConfiguredDrive ) + { + User::LeaveIfError( lex.Val( iInitialFreeSpace2 ) ); + } + else + { + User::LeaveIfError( lex.Val( iInitialFreeSpace ) ); + } } - + void CWmDrmDataStore::WriteInitialFreeSpaceL( const TDesC& aFileName, TBool& aConfiguredDrive ) { @@ -170,7 +170,7 @@ CModeCBCEncryptor* cbcEncryptor = NULL; CAESEncryptor* aesEncryptor = NULL; CPaddingPKCS7* padding = NULL; - + LOGFN( "CWmDrmDataStore::WriteInitialFreeSpaceL" ); User::LeaveIfError( file.Create( iServer->Fs(), aFileName, EFileWrite ) ); CleanupClosePushL( file ); @@ -181,7 +181,7 @@ else { iInitialFreeSpace = iServer->FreeSpaceL( aConfiguredDrive ); - } + } iv.SetLength( KAESKeyLength ); TRandom::RandomL( iv ); #if defined(FF_PLATFORM_SIMULATOR) || defined(__WINSCW__) @@ -191,18 +191,18 @@ #endif aesEncryptor = CAESEncryptor::NewL( key ); CleanupStack::PushL( aesEncryptor ); - + cbcEncryptor = CModeCBCEncryptor::NewL( aesEncryptor, iv ); CleanupStack::Pop( aesEncryptor ); CleanupStack::PushL( cbcEncryptor ); - + padding = CPaddingPKCS7::NewL( KAESKeyLength ); CleanupStack::PushL( padding ); - + encryptor = CBufferedEncryptor::NewL( cbcEncryptor, padding ); CleanupStack::Pop( 2, cbcEncryptor ); //padding, cbcEncryptor CleanupStack::PushL( encryptor ); - + if ( aConfiguredDrive ) { decryptedData.AppendNum( iInitialFreeSpace2 ); @@ -210,8 +210,8 @@ else { decryptedData.AppendNum( iInitialFreeSpace ); - } - + } + encryptor->ProcessFinalL( decryptedData, encryptedData ); User::LeaveIfError( file.Write( iv ) ); User::LeaveIfError( file.Write( encryptedData ) ); @@ -228,25 +228,25 @@ TInt ratio( 0 ); TInt ratio2( 0 ); TBool internalMassDriveNotFull( ETrue ); - + LOGFN( "CWmDrmDataStore::DataStoreStateL" ); freeSpace = iServer->FreeSpaceL( EFalse ); - + if ( iWmDrmRightsConfigFound ) { // Check free space from the configured drive, too. freeSpace2 = iServer->FreeSpaceL( ETrue ); - - if ( freeSpace2 < iMinFreeSpace2 ) + + if ( freeSpace2 < iMinFreeSpace2 ) { internalMassDriveNotFull = EFalse; } - + dummyDbSize = DummyDBSizeL( ETrue ); dataStoreSize = DataStoreSizeL( ETrue ); ratio2 = dataStoreSize * 100 / iInitialFreeSpace2; freeSpace2 += dummyDbSize; -#ifdef _LOGGING +#ifdef _LOGGING TBuf free2; LOG1( "CWmDrmDataStore::DataStoreStateL: Free space (2): "); free2.AppendNumUC( freeSpace2, EDecimal ); @@ -255,15 +255,15 @@ LOG1( "CWmDrmDataStore::DataStoreStateL: Minimum free space (2): "); free2Min.AppendNumUC( iMinFreeSpace2, EDecimal ); LOG( free2Min ); -#endif +#endif } - - // Check the system drive storage space next. + + // Check the system drive storage space next. dummyDbSize = DummyDBSizeL( EFalse ); dataStoreSize = DataStoreSizeL( EFalse ); ratio = dataStoreSize * 100 / iInitialFreeSpace; freeSpace += dummyDbSize; -#ifdef _LOGGING +#ifdef _LOGGING TBuf free; LOG1( "CWmDrmDataStore::DataStoreStateL: Free space: "); free.AppendNumUC( freeSpace, EDecimal ); @@ -272,21 +272,21 @@ LOG1( "CWmDrmDataStore::DataStoreStateL: Minimum free space: "); freeMin.AppendNumUC( iMinFreeSpace, EDecimal ); LOG( freeMin ); -#endif - - // Select the state of the storage space. - if ( ( freeSpace > iMinFreeSpace ) && internalMassDriveNotFull ) +#endif + + // Select the state of the storage space. + if ( ( freeSpace > iMinFreeSpace ) && internalMassDriveNotFull ) { LOG1( "CWmDrmDataStore::DataStoreStateL: Store space Ok" ); state = EStoreSpaceOK; } else { - // The configured drive is running out of space. The system drive + // The configured drive is running out of space. The system drive // may also be running out of storage space, but calculate // the ratio of database size to initial free drive space and the // state of the drive storage space from the configured drive because - // it is likely to fill up faster since the media files may be synced to it. + // it is likely to fill up faster since the media files may be synced to it. if ( !internalMassDriveNotFull ) { LOG2( "Ratio (2): %d", ratio2 ); @@ -302,7 +302,7 @@ } } else - // Only the system drive is running out of storage space. + // Only the system drive is running out of storage space. { LOG2( "Ratio: %d", ratio ); if ( ratio <= iMaxSpaceRatio ) @@ -315,9 +315,9 @@ LOG1( "CWmDrmDataStore::DataStoreStateL Store space full" ); state = EStoreSpaceFull; } - } + } } - + LOG2( "DataStoreState: %d", state ); return state; } @@ -326,13 +326,13 @@ RFile& aDummyDb, TBool& aConfiguredDrive ) { TInt r( KErrNone ); - + LOGFN( "CWmDrmDataStore::InitializeDummyDbFileL" ); - + r = aDummyDb.Create( iServer->Fs(), aFileName, EFileWrite ); if ( r == KErrAlreadyExists ) { - User::LeaveIfError( + User::LeaveIfError( aDummyDb.Open( iServer->Fs(), aFileName, EFileWrite ) ); } else if( !r ) @@ -342,7 +342,7 @@ { if ( dataStoreSize <= iDummyDbInitialSize2 ) { - User::LeaveIfError( + User::LeaveIfError( aDummyDb.SetSize( iDummyDbInitialSize2 - dataStoreSize ) ); } else @@ -350,18 +350,18 @@ User::LeaveIfError( aDummyDb.SetSize( 0 ) ); } } - else + else { if ( dataStoreSize <= iDummyDbInitialSize ) { - User::LeaveIfError( + User::LeaveIfError( aDummyDb.SetSize( iDummyDbInitialSize - dataStoreSize ) ); } else { User::LeaveIfError( aDummyDb.SetSize( 0 ) ); } - } + } } else { @@ -379,26 +379,26 @@ LOG2( "dummyDbSize: %d", dummyDbSize ); if ( aSize <= dummyDbSize ) { - if ( aConfiguredDrive ) + if ( aConfiguredDrive ) { - User::LeaveIfError( iDummyDb2.SetSize( dummyDbSize - aSize ) ); - } + User::LeaveIfError( iDummyDb2.SetSize( dummyDbSize - aSize ) ); + } else - { - User::LeaveIfError( iDummyDb.SetSize( dummyDbSize - aSize ) ); - } - } + { + User::LeaveIfError( iDummyDb.SetSize( dummyDbSize - aSize ) ); + } + } else { if ( aConfiguredDrive ) - { - User::LeaveIfError( iDummyDb2.SetSize( 0 ) ); - } - else - { - User::LeaveIfError( iDummyDb.SetSize( 0 ) ); - } - } + { + User::LeaveIfError( iDummyDb2.SetSize( 0 ) ); + } + else + { + User::LeaveIfError( iDummyDb.SetSize( 0 ) ); + } + } } else { @@ -408,27 +408,27 @@ { if ( dataStoreSize <= iDummyDbInitialSize2 ) { - User::LeaveIfError( + User::LeaveIfError( iDummyDb2.SetSize( iDummyDbInitialSize2 - dataStoreSize ) ); - } - else - { - User::LeaveIfError( iDummyDb2.SetSize( 0 ) ); - } + } + else + { + User::LeaveIfError( iDummyDb2.SetSize( 0 ) ); + } } - else + else { if ( dataStoreSize <= iDummyDbInitialSize ) { - User::LeaveIfError( + User::LeaveIfError( iDummyDb.SetSize( iDummyDbInitialSize - dataStoreSize ) ); - } - else - { - User::LeaveIfError( iDummyDb.SetSize( 0 ) ); - } + } + else + { + User::LeaveIfError( iDummyDb.SetSize( 0 ) ); + } } - } + } } TInt CWmDrmDataStore::DataStoreSizeL( TBool aConfiguredDrive ) @@ -448,35 +448,35 @@ else { User::LeaveIfError( iDummyDb.Size( dummyDbSize ) ); - } + } return dummyDbSize; } -void CWmDrmDataStore::PrepareInfoFilesL( TBool aConfiguredDrive, +void CWmDrmDataStore::PrepareInfoFilesL( TBool aConfiguredDrive, TChar aDriveLetter, RFile& aDummyDb ) { LOGFN( "CWmDrmDataStore::PrepareInfoFilesL" ); CRepository* repository( NULL ); TInt r( KErrNone ); - TFileName dummyDbFile; + TFileName dummyDbFile; TFileName initialFreeSpaceFile; - + initialFreeSpaceFile.Format( KPrivateDir, (TUint)aDriveLetter ); iServer->Fs().MkDirAll( initialFreeSpaceFile ); initialFreeSpaceFile.Format( KInitialFreeSpaceFile, (TUint)aDriveLetter ); dummyDbFile.Format( KDummyDbFile, (TUint)aDriveLetter ); - - TRAP( r, WriteInitialFreeSpaceL( initialFreeSpaceFile, + + TRAP( r, WriteInitialFreeSpaceL( initialFreeSpaceFile, aConfiguredDrive ) ); if ( r ) { r = KErrNone; - + // catch the read error - TRAP( r, ReadInitialFreeSpaceL( initialFreeSpaceFile, + TRAP( r, ReadInitialFreeSpaceL( initialFreeSpaceFile, aConfiguredDrive ) ); - - // if an error occurs, this means that we are unable to read the info, + + // if an error occurs, this means that we are unable to read the info, // thus we need to delete the file and run write again. // hopefully this being a temporary error, but if we fail again we fail // until next ConstructL @@ -484,60 +484,60 @@ { // delete the file: iServer->Fs().Delete( initialFreeSpaceFile ); - + // Calc & Write the new info WriteInitialFreeSpaceL( initialFreeSpaceFile, aConfiguredDrive ); } } - + if ( aConfiguredDrive ) { -#ifdef _LOGGING +#ifdef _LOGGING TBuf freeSpace2; LOG1( "CWmDrmDataStore::DataStoreStateL: Initial free space (2): "); freeSpace2.AppendNumUC( iInitialFreeSpace2, EDecimal ); LOG( freeSpace2 ); -#endif +#endif if ( iInitialFreeSpace2 <= 0 ) { User::Leave( KErrNotReady ); } } - else + else { -#ifdef _LOGGING +#ifdef _LOGGING TBuf freeSpace; LOG1( "CWmDrmDataStore::DataStoreStateL: Initial free space: "); freeSpace.AppendNumUC( iInitialFreeSpace, EDecimal ); LOG( freeSpace ); -#endif +#endif if ( iInitialFreeSpace <= 0 ) { User::Leave( KErrNotReady ); } } - + //LOG1( "CWmDrmDataStore::PrepareInfoFilesL Check Cenrep" ); - + TRAP( r, repository = CRepository::NewL( KCRUidWMDRM ) ); if ( repository ) { TInt rate( 0 ); - + // Check the cenrep key parameters either for the default system drive // or for the internal mass drive depending whether the WMDRM rights // are configured to be partially stored to the internal mass drive or - // not. + // not. if ( !aConfiguredDrive ) - { + { r = repository->Get( KWMDRMLicStoreLowMem, rate ); if ( r ) { - iMinFreeSpace = KMegaByte; + iMinFreeSpace = KMegaByte; } else { - iMinFreeSpace = rate * KMegaByte; + iMinFreeSpace = rate * KMegaByte; } r = repository->Get( KWMDRMLicStoreSizeRatio, iMaxSpaceRatio ); if ( r ) @@ -547,19 +547,19 @@ r = repository->Get( KWMDRMLicStoreReservedSpace, rate ); if ( r ) { - iDummyDbInitialSize = KDummyDbInitialSize; + iDummyDbInitialSize = KDummyDbInitialSize; } else { - iDummyDbInitialSize = rate * KMegaByte; + iDummyDbInitialSize = rate * KMegaByte; } } - else + else { r = repository->Get( KWMDRM2LicStoreLowMem, rate ); if ( r ) { - iMinFreeSpace2 = KTwoHundredMegaBytes; + iMinFreeSpace2 = KTwoHundredMegaBytes; } else { @@ -573,31 +573,31 @@ r = repository->Get( KWMDRM2LicStoreReservedSpace, rate ); if ( r ) { - iDummyDbInitialSize2 = KDummyDbInitialSize; + iDummyDbInitialSize2 = KDummyDbInitialSize; } else { - iDummyDbInitialSize2 = rate * KMegaByte; + iDummyDbInitialSize2 = rate * KMegaByte; } - } + } delete repository; } else { if ( !aConfiguredDrive ) { - iMinFreeSpace = KMegaByte; + iMinFreeSpace = KMegaByte; iMaxSpaceRatio = KMaxSpaceRatio; iDummyDbInitialSize = KDummyDbInitialSize; } - else + else { - iMinFreeSpace2 = KTwoHundredMegaBytes; + iMinFreeSpace2 = KTwoHundredMegaBytes; iMaxSpaceRatio2 = KMaxSpaceRatio2; - iDummyDbInitialSize2 = KDummyDbInitialSize; + iDummyDbInitialSize2 = KDummyDbInitialSize; } } - + InitializeDummyDbFileL( dummyDbFile, aDummyDb, aConfiguredDrive ); - + } diff -r e16d72588c28 -r 8a03a285ab14 wmdrm/wmdrmengine/wmdrmserver/server/src/wmdrmserver.cpp --- a/wmdrm/wmdrmengine/wmdrmserver/server/src/wmdrmserver.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/wmdrm/wmdrmengine/wmdrmserver/server/src/wmdrmserver.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -16,7 +16,7 @@ */ #include -#include +#include #include "wmdrmsession.h" #include "wmdrmserver.h" #include "clock.h" @@ -32,23 +32,23 @@ #include "logfn.h" CWmDrmServer::CWmDrmServer(): - CServer2( CActive::EPriorityStandard, ESharableSessions ), - iCache( NULL ), iDriveNumber( -1 ), iWmDrmRightsConfigFound( EFalse ) - { - } + CServer2( CActive::EPriorityStandard, ESharableSessions ), + iCache( NULL ), iDriveNumber( -1 ), iWmDrmRightsConfigFound( EFalse ) + { + } CServer2* CWmDrmServer::NewLC() - { - LOGFN( "CWmDrmServer::NewLC" ); - CWmDrmServer* self = new( ELeave ) CWmDrmServer; - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } + { + LOGFN( "CWmDrmServer::NewLC" ); + CWmDrmServer* self = new( ELeave ) CWmDrmServer; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } CWmDrmServer::~CWmDrmServer() { - LOGFN( "CWmDrmServer::~CWmDrmServer" ); + LOGFN( "CWmDrmServer::~CWmDrmServer" ); delete iCache; delete iEnumeratorCache; delete iClock; @@ -58,34 +58,34 @@ } void CWmDrmServer::ConstructL() - { - LOGFN( "CWmDrmServer::ConstructL" ); - TDrmScheme drmScheme( EDrmSchemeWmDrm ); - TChar driveLetter; - - StartL( KWmDrmServerName ); - User::LeaveIfError( iFs.Connect() ); + { + LOGFN( "CWmDrmServer::ConstructL" ); + TDrmScheme drmScheme( EDrmSchemeWmDrm ); + TChar driveLetter; + + StartL( KWmDrmServerName ); + User::LeaveIfError( iFs.Connect() ); iCache = NULL; - iEnumeratorCache = NULL; - ResetCacheL(); - iClock = CClock::NewL( this ); - iClock->Start(); - + iEnumeratorCache = NULL; + ResetCacheL(); + iClock = CClock::NewL( this ); + iClock->Start(); + // Check which drive is configured in the Central Repository Key - // for the desired storing location of license and sync stores. - // Convert the drive letter to drive number and store it. - iWmDrmRightsConfigFound = - DrmRightsStoringLocation::CheckDrmRightsStorageDriveL( iFs, - drmScheme, driveLetter ); - - // Check also the system drive - DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, iSystemDriveNumber ); - + // for the desired storing location of license and sync stores. + // Convert the drive letter to drive number and store it. + iWmDrmRightsConfigFound = + DrmRightsStoringLocation::CheckDrmRightsStorageDriveL( iFs, + drmScheme, driveLetter ); + + // Check also the system drive + DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, iSystemDriveNumber ); + iFs.CharToDrive( driveLetter, iDriveNumber ); - - iDb = CWmDrmDb::NewL( this ); - iDataStore = CWmDrmDataStore::NewL( this ); - } + + iDb = CWmDrmDb::NewL( this ); + iDataStore = CWmDrmDataStore::NewL( this ); + } void CWmDrmServer::ResetCacheL() { @@ -94,43 +94,43 @@ { delete iCache; iCache = NULL; - } + } iCache = CSlotDataCache::NewL( this ); - if ( iEnumeratorCache ) - { - delete iEnumeratorCache; - iEnumeratorCache = NULL; - } - iEnumeratorCache = CSlotEnumeratorCache::NewL( this ); + if ( iEnumeratorCache ) + { + delete iEnumeratorCache; + iEnumeratorCache = NULL; + } + iEnumeratorCache = CSlotEnumeratorCache::NewL( this ); } CSession2* CWmDrmServer::NewSessionL( const TVersion& /*aVersion*/, const RMessage2& /*aMessage*/ ) const - { - LOGFN( "CWmDrmServer::NewSessionL" ); - return new( ELeave ) CWmDrmSession(); - } + { + LOGFN( "CWmDrmServer::NewSessionL" ); + return new( ELeave ) CWmDrmSession(); + } CSlotDataCache* CWmDrmServer::Cache() - { - return iCache; - } + { + return iCache; + } CSlotEnumeratorCache* CWmDrmServer::EnumeratorCache() - { + { return iEnumeratorCache; - } + } CClock* CWmDrmServer::Clock() - { - return iClock; - } + { + return iClock; + } RFs& CWmDrmServer::Fs() - { - return iFs; - } + { + return iFs; + } CWmDrmDataStore* CWmDrmServer::DataStore() { @@ -150,38 +150,38 @@ // Check the disk space from the configured drive User::LeaveIfError( iFs.Volume( info, iDriveNumber ) ); } - else + else { // Check the disk space from the system drive - User::LeaveIfError( iFs.Volume( info, iSystemDriveNumber ) ); + User::LeaveIfError( iFs.Volume( info, iSystemDriveNumber ) ); } - return info.iFree; - } + return info.iFree; + } static void RunServerL() - { - LOGFN( "RunServerL" ); + { + LOGFN( "RunServerL" ); - User::LeaveIfError( RThread::RenameMe( KWmDrmServerName ) ); - CActiveScheduler* s = new( ELeave ) CActiveScheduler; - CleanupStack::PushL( s ); - CActiveScheduler::Install( s ); + User::LeaveIfError( RThread::RenameMe( KWmDrmServerName ) ); + CActiveScheduler* s = new( ELeave ) CActiveScheduler; + CleanupStack::PushL( s ); + CActiveScheduler::Install( s ); CWmDrmServer::NewLC(); - RProcess::Rendezvous( KErrNone ); - CActiveScheduler::Start(); - CleanupStack::PopAndDestroy( 2 ); // server, s - } + RProcess::Rendezvous( KErrNone ); + CActiveScheduler::Start(); + CleanupStack::PopAndDestroy( 2 ); // server, s + } TInt E32Main() - { - __UHEAP_MARK; - CTrapCleanup* cleanup = CTrapCleanup::New(); - TInt r = KErrNoMemory; - if ( cleanup ) - { - TRAP( r, RunServerL() ); - delete cleanup; - } - __UHEAP_MARKEND; - return r; - } + { + __UHEAP_MARK; + CTrapCleanup* cleanup = CTrapCleanup::New(); + TInt r = KErrNoMemory; + if ( cleanup ) + { + TRAP( r, RunServerL() ); + delete cleanup; + } + __UHEAP_MARKEND; + return r; + }