# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1272879994 -10800 # Node ID 3bdc3b853094158d273c599de024be700e132fcb # Parent 493788a4a8a435d304fb9e515c5fd8aaef8b46d9 Revision: 201015 Kit: 201018 diff -r 493788a4a8a4 -r 3bdc3b853094 commondrm/drmrightsmanagerui/inc/DRMRightsMgrAppUi.h --- a/commondrm/drmrightsmanagerui/inc/DRMRightsMgrAppUi.h Fri Apr 16 15:14:55 2010 +0300 +++ b/commondrm/drmrightsmanagerui/inc/DRMRightsMgrAppUi.h Mon May 03 12:46:34 2010 +0300 @@ -25,7 +25,9 @@ #include #include #include +#include +#include "drmclockclient.h" #include "DrmViewItems.h" #include "DRMRightsManager.hrh" @@ -173,9 +175,42 @@ void CheckIndividualConstraint( const TDesC8& aContentURI, TBool& aIndividualConstraint, TBool& aUsageAllowed ); - + + /** + * Checks the composition of best rights to be shown in the details view. + * Leaves with KErrNotFound if no rights are found. + * @param aContentURI ContentURI for object to be opened when + * application is launched + * @param aRights Pointer to instance of CDRMRights for + * storing the rights + */ + void FindBestCompositionRightsL( const TDesC8& aContentURI, + CDRMRights*& aRights ); - + /** + * Compares the permissions in the the permission list one by one and + * constraint by constraint and stores the best constraint to the given + * composition permission. The function should be called only for a list of + * valid permissions. Puts the composition permission to cleanup stack. + * @param aCompositionPermission Permission which includes a composition of best + * constraints (or full rights information) from + * the given permission list. + * @param aPermissionList List which includes permissions to be checked + * constraint by constraint in order to create the + * best composition permission. + */ + void CheckBetterPermissionsAndStoreCompositionLC( + CDRMPermission*& aCompositionPermission, + RPointerArray& aList ); + /** + * Compares two permissions, and returns ETrue if aNewOne is more suitable + * for the usage. Assumes both are valid, i.e. not expired. + * @param aNewOne New constraint to be compared to the old one + * @param aOldOne Old constraint to be compared to the new one + */ + TBool BetterPermission( const CDRMConstraint& aNewOne, + const CDRMConstraint& aOldOne ); + public: // New functions /** * @param aContentURI ContentURI for object to be opened when @@ -390,7 +425,10 @@ // update the details view when returning to details view from another // application TBool iForegroundHasBeenActive; - + + // Drm clock client + RDRMClockClient iClockClient; + }; // Include inline functions diff -r 493788a4a8a4 -r 3bdc3b853094 commondrm/drmrightsmanagerui/src/DRMRightsMgrAppUi.cpp --- a/commondrm/drmrightsmanagerui/src/DRMRightsMgrAppUi.cpp Fri Apr 16 15:14:55 2010 +0300 +++ b/commondrm/drmrightsmanagerui/src/DRMRightsMgrAppUi.cpp Mon May 03 12:46:34 2010 +0300 @@ -58,7 +58,70 @@ _LIT8( Kflk, "flk:" ); _LIT8( Kldf, "ldf:" ); -// ================= MEMBER FUNCTIONS ======================= +// ============================= LOCAL FUNCTIONS =============================== + +// ---------------------------------------------------------------------------- +// DoResetAndDestroy +// Does RPointerArray< >->ResetAndDestroy() for the given array aPtr. +// ---------------------------------------------------------------------------- +// +LOCAL_C void DoResetAndDestroyPermission( TAny* aPtr ) + { + ( reinterpret_cast< RPointerArray< CDRMPermission >* >( aPtr ) )-> + ResetAndDestroy(); + } + +// ---------------------------------------------------------------------------- +// PrepareRightsObjectL +// Creates rights object based on the given permission. +// ---------------------------------------------------------------------------- +// +LOCAL_C void PrepareRightsObjectL( CDRMRights*& aRights, + CDRMPermission* aPermission ) + { + CDRMAsset* asset( NULL ); + + if ( !aPermission ) + { + User::Leave( KErrArgument ); + } + + aRights = CDRMRights::NewL(); + CleanupStack::PushL( aRights ); + aRights->SetPermissionL( *aPermission ); + + asset = CDRMAsset::NewLC(); + aRights->SetAssetL( *asset ); + CleanupStack::PopAndDestroy( asset ); + CleanupStack::Pop( aRights ); + + // Content URI and Local Id are not set + } + +// ---------------------------------------------------------------------------- +// EndTime +// Calculate the true end time: pick the smaller one of aTime1 & aTime2, +// but ignore Time::NullTTime anyhow. +// ---------------------------------------------------------------------------- +// +LOCAL_C TTime EndTime( const TTime& aTime1, const TTime& aTime2 ) + { + TTime nullTime = Time::NullTTime(); + + if ( aTime1 == nullTime ) + { + return aTime2; + } + + if ( aTime2 == nullTime ) + { + return aTime1; + } + + return Min( aTime1, aTime2 ); + } + +// ================= MEMBER FUNCTIONS ========================================== // // ----------------------------------------------------------------------------- // CDRMRightsMgrAppUi::CDRMRightsMgrAppUi @@ -92,6 +155,7 @@ EAknEnableMSK | EAknSingleClickCompatible ); User::LeaveIfError( iRightsClient.Connect() ); + User::LeaveIfError( iClockClient.Connect() ); iDRMCommon = DRMCommon::NewL(); if ( !iDRMCommon ) { @@ -129,6 +193,8 @@ delete iDRMCommon; iRightsClient.Close(); + + iClockClient.Close(); if ( iStartEmbedded && iDoorObserver ) { @@ -557,8 +623,8 @@ // from the background to the foreground. if ( iForegroundHasBeenActive && iContentURI ) { - StartOnlyForDetailsL( iContentURI->Des(), iLocalID, - iStartEmbedded, iDrmScheme ); + TRAP_IGNORE( StartOnlyForDetailsL( iContentURI->Des(), iLocalID, + iStartEmbedded, iDrmScheme ) ); } } @@ -739,7 +805,10 @@ { TBool listable( EFalse ), sendable( EFalse ); TBool individualConstraint( EFalse ), usageAllowed( EFalse ); + TInt err( KErrNone ); + + aStatus = KErrNone; CDcfRep* dcfRep = CDcfRep::NewL(); CleanupStack::PushL( dcfRep ); @@ -798,23 +867,32 @@ { aStatus = iDRMCommon->GetSingleRightsObject( aContentURI, aLocalID, aRights ); - if ( aStatus ) - { - aRights = NULL; - } + CheckIndividualConstraint( aContentURI, individualConstraint, usageAllowed ); + SetSelectedIndividualConstraint( individualConstraint ); + SetSelectedUsageAllowed( usageAllowed ); } else { - aStatus = iDRMCommon->GetActiveRights( aContentURI, 0, aRights ); + SetSelectedIndividualConstraint( EFalse ); + SetSelectedUsageAllowed( ETrue ); + + // Get active rights if available + err = iDRMCommon->GetActiveRights( aContentURI, 0, aRights ); + + if ( err < 0 ) + { + // Find out the best composition of rights that should be shown in the + // details view. Checks also individual constraint. + TRAP( aStatus, FindBestCompositionRightsL( aContentURI, aRights ) ); + } + } + + if ( aStatus ) + { + aRights = NULL; } - CheckIndividualConstraint( aContentURI, individualConstraint, usageAllowed ); - SetSelectedIndividualConstraint( individualConstraint ); - SetSelectedUsageAllowed( usageAllowed ); - CleanupStack::PopAndDestroy( dcfRep ); - - // Do not show the note, show license information in the details view. } // --------------------------------------------------------- @@ -880,23 +958,18 @@ TBool& aIndividualConstraint, TBool& aUsageAllowed ) { + + TTime time; + RPointerArray individuals; + RPointerArray* uriList = NULL; TInt r = KErrNone; TUint32 retval(0); + TInt timeZone(0); DRMClock::ESecurityLevel secLevel = DRMClock::KInsecure; CDRMRightsConstraints* constraint = NULL; - RDRMClockClient client; - RDRMRightsClient rclient; - TTime time; - RPointerArray individuals; - - r = client.Connect(); - if ( r == KErrNone ) - { - TTime time; - TInt timeZone(0); - client.GetSecureTime(time, timeZone, secLevel); - } + + iClockClient.GetSecureTime(time, timeZone, secLevel); r = iDRMCommon->GetDetailedContentRights(aContentURI, uriList); if ( r ) @@ -909,19 +982,13 @@ if ( !uriList || !uriList->Count() ) { // no rights found - client.Close(); delete uriList; uriList = NULL; } else { // supported IMSI information is provided by rights client - r = rclient.Connect(); - if( r == KErrNone) - { - TRAP( r, r = rclient.GetSupportedIndividualsL( individuals ) ); - rclient.Close(); - } + TRAP( r, r = iRightsClient.GetSupportedIndividualsL( individuals ) ); // Check only the first entry in the list. This is to be expanded to check // all the entries in the list. @@ -959,7 +1026,6 @@ constraint = NULL; } - client.Close(); uriList->ResetAndDestroy(); delete uriList; @@ -969,4 +1035,498 @@ } } +// --------------------------------------------------------- +// CDRMRightsMgrAppUi::FindBestCompositionRightsL +// --------------------------------------------------------- +// +void CDRMRightsMgrAppUi::FindBestCompositionRightsL( const TDesC8& aContentURI, + CDRMRights*& aRights ) + { + TInt i, j, k; + RPointerArray permissionList; + RPointerArray permissionTempList; + RPointerArray parentUidList; + RPointerArray individuals; + + TInt count( 0 ); + TInt status( KErrNone ); + TTime time( Time::NullTTime() ); + TInt err( KErrNone ); + TUint32 reason( EConstraintNone ); + TBool individualConstraintFound( EFalse ); + + // Composition object of best rights to be shown in the + // details view + CDRMPermission* perm( NULL ); + + TCleanupItem cleanupPerm( DoResetAndDestroyPermission, &permissionList ); + CleanupStack::PushL( cleanupPerm ); + + TCleanupItem cleanupPerm2( DoResetAndDestroyPermission, + &permissionTempList ); + CleanupStack::PushL( cleanupPerm2 ); + + CleanupClosePushL( parentUidList ); + + // First get list of child ROs with the given Content URI + iRightsClient.GetDBEntriesL( aContentURI, permissionList ); + + if ( permissionList.Count() > 0 ) + { + // Check the UIDs of the possible parent rights objects + // and store the found ones to another pointer array for evaluation + for ( i = 0; i < permissionList.Count(); i++ ) + { + if ( permissionList[i]->iParentUID ) + { + if ( i == 0 ) + { + // No need to check if the parent UID is a duplicate + parentUidList.Append( permissionList[i]->iParentUID ); + } + else + { + // Check parent UID list whether we have already stored the + // UID or not + for( j = 0; j < parentUidList.Count(); j++ ) + { + if ( parentUidList[j]->Des().Compare( + permissionList[i]->iParentUID->Des() ) != 0 ) + { + parentUidList.Append( + permissionList[i]->iParentUID ); + break; + } + } + } + } + } + + // Get the list of parent rights objects based on the parent UID + // and store the pointers from temporary array to the main list + for ( j = 0; j < parentUidList.Count(); j++ ) + { + // We do not want to leave if nothing is found from the database + TRAP( status, iRightsClient.GetDBEntriesL( parentUidList[j]->Des(), + permissionTempList ) ); + + if ( status ) + { + continue; + } + + for ( k = 0; k < permissionTempList.Count(); k++ ) + { + // Store the pointer to the main list of permissions + permissionList.Append( permissionTempList[k] ); + } + + // Close the temporary pointer array so that the referenced + // objects of it will not be deleted in the next round of the + // loop because the method for getting database entries deletes + // also the objects (by calling reset and destroy to the given + // pointer array) by default. + permissionTempList.Close(); + } + + parentUidList.Close(); + time.HomeTime(); + + // supported IMSI information is provided by rights client + TRAP( err, err = iRightsClient.GetSupportedIndividualsL( individuals ) ); + + // Filter expired parent and child rights from the list + // Index defines the index of the list to be operated (next) + for ( count = permissionList.Count() ; count > 0; count-- ) + { + if ( permissionList[count - 1]->Expired( time ) ) + { + permissionList.Remove( count - 1 ); + } + else if ( !( permissionList[count - 1]->Valid( + time, individuals, reason ) ) ) + { + if ( reason & EConstraintIndividual ) + { + individualConstraintFound = ETrue; + permissionList.Remove( count - 1 ); + } + } + } + + individuals.ResetAndDestroy(); + individuals.Close(); + + if ( permissionList.Count() == 0 ) + { + if ( individualConstraintFound ) + { + SetSelectedIndividualConstraint( ETrue ); + SetSelectedUsageAllowed( EFalse ); + } + User::Leave( KErrNotFound ); + } + else if ( permissionList.Count() == 1 ) + { + // Keep this permission because it is the only valid (left) + PrepareRightsObjectL( aRights, permissionList[0] ); + } + else if ( permissionList.Count() > 1 ) + { + // Compare constraints from successive items of the + // permission list and update the composition permission + // accordingly. + CheckBetterPermissionsAndStoreCompositionLC( perm, permissionList ); + + // Prepare the rights object with the composition permission + PrepareRightsObjectL( aRights, perm ); + CleanupStack::PopAndDestroy( perm ); + } + } + + CleanupStack::PopAndDestroy( 3, &permissionList ); // cleanupPerm, + // cleanupPerm2, + // parentUidList + } + +// ------------------------------------------------------------------- +// CDRMRightsMgrAppUi::CheckBetterPermissionsAndStoreCompositionLC +// ------------------------------------------------------------------- +// +void CDRMRightsMgrAppUi::CheckBetterPermissionsAndStoreCompositionLC( + CDRMPermission*& aCompositionPermission, + RPointerArray& aList ) + { + + TBool firstBetter( EFalse ); + TUint i, j; + + if ( aList.Count() <= 0 ) + { + User::Leave( KErrArgument ); + } + + // create permission if needed and set the first item + // in the permission list as the reference permission. + if ( !aCompositionPermission ) + { + aCompositionPermission = CDRMPermission::NewL(); + } + + CleanupStack::PushL( aCompositionPermission ); + aCompositionPermission->DuplicateL( *aList[0] ); + + // The double loop goes through the permissions and associated + // constraints beginning from the second entry in the permission list. + for ( i = 1; i < aList.Count(); i++ ) + { + // Enumeration for TIntent from Content Access Framework used + for ( j = EPlay; j < EPause; j++ ) + { + switch ( j ) + { + case EPlay: + { + // The constraint from the permission in the list + // is set to composition permission if it is better + // than the "old" best or reference permission. + firstBetter = BetterPermission( *aList[i]->iPlay, + *aCompositionPermission->iPlay ); + if ( firstBetter ) + { + aCompositionPermission->iPlay->DuplicateL( + *aList[i]->iPlay ); + } + break; + } + case EView: + { + firstBetter = BetterPermission( *aList[i]->iDisplay, + *aCompositionPermission->iDisplay ); + if ( firstBetter ) + { + aCompositionPermission->iDisplay->DuplicateL( + *aList[i]->iDisplay ); + } + break; + } + case EExecute: + { + firstBetter = BetterPermission( *aList[i]->iExecute, + *aCompositionPermission->iExecute ); + if ( firstBetter ) + { + aCompositionPermission->iExecute->DuplicateL( + *aList[i]->iExecute ); + } + break; + } + case EPrint: + { + firstBetter = BetterPermission( *aList[i]->iPrint, + *aCompositionPermission->iPrint ); + if ( firstBetter ) + { + aCompositionPermission->iPrint->DuplicateL( + *aList[i]->iPrint ); + } + break; + } + default: + { + User::Leave( KErrArgument ); + } + } + } + } + } + +// ----------------------------------------------------------------------------- +// CDrmRightsMgrAppUi::BetterPermission +// ----------------------------------------------------------------------------- +TBool CDRMRightsMgrAppUi::BetterPermission( const CDRMConstraint& aNewOne, + const CDRMConstraint& aOldOne ) + { + // Check Order: + // 1. Full + // 2. Start End, closest end time first + // 3. Interval, shortest first + // 4. Accumulated, shortest first + // 5. Timed Counter, least counters first, longest time first + // 6. Counter, least counters first or the first one found + + const TTime nullTime = Time::NullTTime(); + TTime oldTime = nullTime; + TTime newTime = nullTime; + TTime oldTimePos = nullTime; + TTime newTimePos = nullTime; + TTime trustedTime = nullTime; + + // 1. Full + // If the old or new one is the ultimate one, don't bother to + // check anything else. + if ( aOldOne.iActiveConstraints == EConstraintNone ) + { + return EFalse; + } + + if ( aNewOne.iActiveConstraints == EConstraintNone ) + { + return ETrue; + } + + // 2. Start & End Time + // Choose the one with the closest end time first + // All RO's to this check are already checked to be valid + // ActiveIntervals Also hit this spot + + trustedTime.HomeTime(); + + // First get the start and end times from the intervals if they are active or inactive: + if ( aOldOne.iActiveConstraints & EConstraintInterval ) + { + if( aOldOne.iIntervalStart == nullTime ) + { + oldTimePos = trustedTime; + oldTimePos += TTimeIntervalSeconds( aOldOne.iInterval ); + } + else + { + oldTime = aOldOne.iIntervalStart; + oldTime += TTimeIntervalSeconds( aOldOne.iInterval ); + } + } + + if( aNewOne.iActiveConstraints & EConstraintInterval ) + { + if( aNewOne.iIntervalStart == nullTime ) + { + newTimePos = trustedTime; + newTimePos += TTimeIntervalSeconds( aNewOne.iInterval ); + } + else + { + newTime = aNewOne.iIntervalStart; + newTime += TTimeIntervalSeconds( aNewOne.iInterval ); + } + } + + if ( aOldOne.iActiveConstraints & EConstraintEndTime || oldTime != nullTime ) + { + oldTime = EndTime( oldTime, aOldOne.iEndTime ); + + if ( aNewOne.iActiveConstraints & EConstraintEndTime || newTime != nullTime ) + { + newTime = EndTime( newTime, aNewOne.iEndTime ); + + if( newTime != oldTime ) + { + return ( newTime < oldTime ); + } + } + else + { + return EFalse; + } + } + else if ( aNewOne.iActiveConstraints & EConstraintEndTime || newTime != nullTime ) + { + return ETrue; + } + + // 3. Inactive Intervals: + // Choose the one with the interval ending first: + // Continue here if the no SE's exist or SE's are the same + if( aOldOne.iActiveConstraints & EConstraintInterval ) + { + if( aNewOne.iActiveConstraints & EConstraintInterval ) + { + oldTimePos = EndTime( oldTime, oldTimePos ); + newTimePos = EndTime( newTime, newTimePos ); + + if( oldTimePos != newTimePos ) + { + return ( newTimePos < oldTimePos ); + } + } + else + { + if( aNewOne.iActiveConstraints & EConstraintAccumulated || + aNewOne.iActiveConstraints & EConstraintTimedCounter || + aNewOne.iActiveConstraints & EConstraintCounter ) + { + return EFalse; + } + else + { + return ETrue; + } + } + } + else if( aNewOne.iActiveConstraints & EConstraintInterval ) + { + if( aOldOne.iActiveConstraints & EConstraintAccumulated || + aOldOne.iActiveConstraints & EConstraintTimedCounter || + aOldOne.iActiveConstraints & EConstraintCounter ) + { + return ETrue; + } + else + { + return EFalse; + } + } + + // 4. Accumulated: + // Choose the shortest accumulated first + // Continue here if SE's or intervals do not exist or they are the same + if( aOldOne.iActiveConstraints & EConstraintAccumulated ) + { + if( aNewOne.iActiveConstraints & EConstraintAccumulated ) + { + if( aNewOne.iAccumulatedTime != aOldOne.iAccumulatedTime ) + { + return ( aNewOne.iAccumulatedTime < aOldOne.iAccumulatedTime ); + } + } + else + { + if( aNewOne.iActiveConstraints & EConstraintTimedCounter || + aNewOne.iActiveConstraints & EConstraintCounter ) + { + return EFalse; + } + else + { + return ETrue; + } + } + } + else if( aNewOne.iActiveConstraints & EConstraintAccumulated ) + { + if( aOldOne.iActiveConstraints & EConstraintTimedCounter || + aOldOne.iActiveConstraints & EConstraintCounter ) + { + return ETrue; + } + else + { + return EFalse; + } + } + + + // 5. Timed Counter + // Choose the one with least counters first. If there is an equal number of counters + // left, use the one with the longest time + // Continue here if SE's or intervals or accumulateds do not exist or they are the same + if( aOldOne.iActiveConstraints & EConstraintTimedCounter ) + { + if( aNewOne.iActiveConstraints & EConstraintTimedCounter ) + { + if( aNewOne.iTimedCounter == aOldOne.iTimedCounter ) + { + if( aNewOne.iTimedInterval != aOldOne.iTimedInterval ) + { + return ( aNewOne.iTimedInterval < aOldOne.iTimedInterval ); + } + else + { + if( aNewOne.iActiveConstraints & EConstraintCounter ) + { + + } + } + } + else + { + return ( aNewOne.iTimedCounter < aOldOne.iTimedCounter ); + } + + } + else + { + if( aNewOne.iActiveConstraints & EConstraintCounter ) + { + return EFalse; + } + else + { + return ETrue; + } + } + } + else if( aNewOne.iActiveConstraints & EConstraintTimedCounter ) + { + if( aOldOne.iActiveConstraints & EConstraintCounter ) + { + return ETrue; + } + else + { + return EFalse; + } + } + + // 6. Counter + // Choose the one with least counters: + // if they are the same choose the first one. + // Continue here if SE's or intervals or accumulateds or timed counters + // do not exist or they are the same + if( aOldOne.iActiveConstraints & EConstraintCounter ) + { + if( aNewOne.iActiveConstraints & EConstraintCounter ) + { + return ( aNewOne.iCounter < aOldOne.iCounter ); + } + else + { + return ETrue; + } + } + + // If all else fails use the old one: + return EFalse; + } + // End of File diff -r 493788a4a8a4 -r 3bdc3b853094 commondrm/drmutility/group/DrmUtilityDmgrWrapper.mmp --- a/commondrm/drmutility/group/DrmUtilityDmgrWrapper.mmp Fri Apr 16 15:14:55 2010 +0300 +++ b/commondrm/drmutility/group/DrmUtilityDmgrWrapper.mmp Mon May 03 12:46:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2007-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" @@ -28,6 +28,7 @@ #ifdef __DRM SOURCE ../src/DrmUtilityDmgrWrapper.cpp +SOURCE ../src/drmutilityconnection.cpp #endif START RESOURCE ../data/DrmUtilityDmgrWrapper.rss @@ -39,13 +40,14 @@ USERINCLUDE ../inc USERINCLUDE ../../../omadrm/drmengine/roap/inc USERINCLUDE ../../../inc // ADo level inc dir - +USERINCLUDE ../traces // OST definitions // Default system include paths for middleware layer modules. -APP_LAYER_SYSTEMINCLUDE +MW_LAYER_SYSTEMINCLUDE LIBRARY euser.lib -LIBRARY centralrepository.lib -LIBRARY cmmanager.lib +LIBRARY cmmanager.lib // RCmManager CCmApplicationSettingsUi +LIBRARY esock.lib // RConnection, RSocketServ +LIBRARY extendedconnpref.lib netmeta.lib // TExtendedConnPref LIBRARY downloadmgr.lib LIBRARY roaphandler.lib LIBRARY efsrv.lib diff -r 493788a4a8a4 -r 3bdc3b853094 commondrm/drmutility/inc/DrmUiHandlingImpl.h --- a/commondrm/drmutility/inc/DrmUiHandlingImpl.h Fri Apr 16 15:14:55 2010 +0300 +++ b/commondrm/drmutility/inc/DrmUiHandlingImpl.h Mon May 03 12:46:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2006-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" @@ -778,16 +778,6 @@ TBool SilentRightsAllowedL(); /** - * Check if browser AP has been defined - */ - TBool BrowserAPDefinedL(); - - /** - * Returns the number of access points on phone - */ - TInt APCountL(); - - /** * Handles exit from service * from MAknServerAppExitObserver */ diff -r 493788a4a8a4 -r 3bdc3b853094 commondrm/drmutility/inc/DrmUtilityDmgrWrapper.h --- a/commondrm/drmutility/inc/DrmUtilityDmgrWrapper.h Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2007 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: -* -*/ - - -#ifndef CDRMUTILITYDMGRWRAPPER_H -#define CDRMUTILITYDMGRWRAPPER_H - -#include -#include -#include - -/** -* Environment gate function -* -* @since S60 v5.0 -* @return pointer to DMgr handler -*/ -IMPORT_C TAny* GateFunctionDMgr(); - -class MDrmUtilityDmgrWrapper - { - -public: - virtual void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ) = 0; - - virtual void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl, - CCoeEnv& aCoeEnv ) = 0; - - virtual HBufC8* GetErrorUrlL() = 0; - - }; - -/** -* Class for downloading ROAP triggers -* -* @lib DrmUtilityDmgrWrapper -* @since S60 v5.0 -*/ -class CDrmUtilityDmgrWrapper : CBase, - public MHttpDownloadMgrObserver, - public MDrmUtilityDmgrWrapper, - public MProgressDialogCallback - { - -public: - - static CDrmUtilityDmgrWrapper* NewL(); - - static CDrmUtilityDmgrWrapper* NewLC(); - - virtual ~CDrmUtilityDmgrWrapper(); - - /** - * Download a ROAP trigger from URL and handle it - * - * @param aUrl URL of ROAP trigger - */ - void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ); - - void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl, - CCoeEnv& aCoeEnv ); - - HBufC8* GetErrorUrlL(); - - - // from base class MHttpDownloadMgrObserver - - /** - * From MHttpDownloadMgrObserver. - * Handle download manager events - * - * @param aDownload the download - * @param aEvent the event - */ - void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent ); - -public: // Call back methods of MAknProgressDialogCallback - - /** - * ProgressDialog call back method. - * Get's called when a dialog is dismissed. - * - * @param aButtonId ID of the button pressed - */ - void DialogDismissedL( TInt aButtonId ); - -protected: - -private: - - /** - * C++ default constructor. - */ - CDrmUtilityDmgrWrapper(); - - void ConstructL(); - - /** - * Set the browser default access point to be used - */ - void SetDefaultAccessPointL(); - - void DoDownloadAndHandleRoapTriggerL( const HBufC8* aUrl ); - - void ShowProgressNoteL( ); - - void RemoveProgressNoteL( ); - - void HandlePostResponseUrlL(); - - -private: // data - - /** - * Download manager session - */ - RHttpDownloadMgr iDlMgr; - - /** - * Used to make downloads synchronous - */ - CActiveSchedulerWait iWait; - - /** - * to store information on download - */ - TBool iDownloadSuccess; - TBool iConnectionError; - - TBool iDialogDismissed; - - /** - * Progess note dialog and progress info - */ - CAknProgressDialog* iProgressNoteDialog; // owned - CEikProgressInfo* iProgressInfo; // not owned - TInt iCurrentProgressValue; // owned - TInt iProgressIncrement; // owned - - /** - * Control environment - */ - CCoeEnv* iCoeEnv; - - /** - * Is CoeEnv given - */ - TBool iUseCoeEnv; - - /** - * Error url for ROAP temporary error - */ - HBufC8* iErrorUrl; - - /** - * Post response url for ROAP prUrl - */ - HBufC8* iPostResponseUrl; - - }; - -#endif // CDRMUTILITYDMGRWRAPPER_H diff -r 493788a4a8a4 -r 3bdc3b853094 commondrm/drmutility/inc/drmutilityconnection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmutility/inc/drmutilityconnection.h Mon May 03 12:46:34 2010 +0300 @@ -0,0 +1,191 @@ +/* +* 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: +* +*/ +#ifndef DRMUTILITYCONNECTION_H +#define DRMUTILITYCONNECTION_H + +#include // CActive +#include // RConnection, RSocketServ + +namespace DRM +{ + + /** + * Utility class for DRMutility dmgr wrapper related common functions + * + * @since S60 v9.2 + */ + + +// CLASS DECLARATION +// Class for handling internal connectivity logic +NONSHARABLE_CLASS( CDrmUtilityConnection ): public CActive + { +public: // Constructors and destructor. + + /** + * + */ + static CDrmUtilityConnection * NewL( const TBool aAllowQueries ); + + /** + * + */ + static CDrmUtilityConnection * NewLC( const TBool aAllowQueries ); + + /** + * Destructor + */ + ~CDrmUtilityConnection(); + +public: // new methods + + /** + * + */ + void ConnectL( TRequestStatus* aStatus ); + + /** + * + */ + void Close(); + + /** + * + */ + TBool HasMoreConnectionAttempts(); + + /** + * + */ + TBool IsConnected( TUint32& aIap ); + + /** + * Check if default connection has been defined + * @see RCmManager::ReadDefConnL + */ + static TBool HasDefaultConnectionL(); + + /** + * Check if system has access points defined + */ + static TBool HasAccessPointsL(); + + + +private: //enumerations + enum TConnectionType + { + EAttachExisting, //0 + EUsingDefault, //1 + EUsingPurposeOperator, // 2 + EUsingPurposeInternet, // 3 + EUsingQuery, // 4 + EFail // 5 + }; + + enum TState + { + EInit, // 0 + EConnecting, // 1 + EConnected, // 2 + EConnectFailed // 3 + }; + +private: // Constructors and destructor. + + /** + * Default constructor (for preventing inheritance) + */ + CDrmUtilityConnection( TBool aAllowQueries ); + + /** + * Second phase constructor + */ + void ConstructL(); + +private: // from CActive + + virtual void DoCancel(); + + virtual void RunL(); + + virtual TInt RunError( TInt aError ); + +private: // new methods + + /** + * + */ + void DoClose(); + + /** + * + */ + void Done(); + + /** + * + */ + void InitL(); + + /** + * + */ + void AttachExistingConnectionL(); + + /** + * + */ + void ConnectUsingDefaultL(); + + /** + * + */ + void ConnectUsingSnapPurposeL( const TUint32 aPurpose ); + + /** + * + */ + void ConnectUsingQueryL(); + + /** + * + */ + void UpdateIapIdL(); + + /** + * + */ + void CompleteSelf( TInt aError ); + + /** + * + */ + void CompleteParent( TInt aError ); + +private: // data + + RSocketServ iSocketServ; + RConnection iConnection; + TState iState; + TConnectionType iType; + TRequestStatus* iParentStatus; + const TBool iAllowQueries; + TUint32 iIapId; + }; +} +#endif /* DRMUTILITYCONNECTION_H */ diff -r 493788a4a8a4 -r 3bdc3b853094 commondrm/drmutility/src/DrmUiHandlingImpl.cpp --- a/commondrm/drmutility/src/DrmUiHandlingImpl.cpp Fri Apr 16 15:14:55 2010 +0300 +++ b/commondrm/drmutility/src/DrmUiHandlingImpl.cpp Mon May 03 12:46:34 2010 +0300 @@ -17,13 +17,6 @@ // INCLUDE FILES -// connection -#include -#include -#include -#include -#include -#include // publish & subscribe #include @@ -36,11 +29,6 @@ #include #include -// browser -#ifdef __SERIES60_NATIVE_BROWSER -#include -#endif - // caf #include #include @@ -71,6 +59,13 @@ #include #include +//connectivity logic +#include // RCmConnectionMethod +#include // RCmDestination +#include // RCmManager + + + #ifdef _DEBUG #include #endif @@ -104,14 +99,6 @@ const TInt KCommandHandleUrlData( 8 ); const TInt KCommandAvailableUrlsFile( 9 ); const TInt KCommandAvailableUrlsData( 10 ); -// browser -#ifndef __SERIES60_NATIVE_BROWSER -const TUid KCRUidBrowser = - {0x10008D39}; -const TUint32 KBrowserDefaultAccessPoint = 0x0000000E; -const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E; -const TUint32 KBrowserNGDefaultSnapId = 0x00000053; -#endif _LIT( KEncryptedRightsIssuerMatchString, "flk*" ); @@ -140,6 +127,67 @@ // ============================= LOCAL FUNCTIONS =============================== // ----------------------------------------------------------------------------- +// HasDefaultConnectionL +// Finds default IAP id +// @return Etrue: valid AP found +// EFalse: valid AP not found +// @leave system wide error codes +// ----------------------------------------------------------------------------- +// +LOCAL_C TBool HasDefaultConnectionL() + { + TBool hasDefault(EFalse); + TCmDefConnValue defConn; + RCmManager cmManager; + cmManager.OpenLC(); + cmManager.ReadDefConnL(defConn); + if (defConn.iType == ECmDefConnConnectionMethod) + { + cmManager.GetConnectionMethodInfoIntL(defConn.iId, + CMManager::ECmIapId); + hasDefault = ETrue; + } + else if (defConn.iType == ECmDefConnDestination) + { + RCmDestination dest(cmManager.DestinationL(defConn.iId)); + CleanupClosePushL(dest); + + if (dest.ConnectionMethodCount() <= 0) + { + User::Leave(KErrNotFound); + } + + RCmConnectionMethod cMeth(dest.ConnectionMethodL(0)); + CleanupClosePushL(cMeth); + + cMeth.GetIntAttributeL(CMManager::ECmIapId); + CleanupStack::PopAndDestroy(&cMeth); + CleanupStack::PopAndDestroy(&dest); + hasDefault = ETrue; + } + CleanupStack::PopAndDestroy(&cmManager); + return hasDefault; + } + +// ----------------------------------------------------------------------------- +// HasAccessPointsL +// ----------------------------------------------------------------------------- +// +LOCAL_C TBool HasAccessPointsL() + { + TInt apCount(0); + RCmManager cmManager; + CleanupClosePushL(cmManager); + cmManager.OpenL(); + RArray aps; + CleanupClosePushL(aps); + cmManager.ConnectionMethodL(aps, EFalse, EFalse, ETrue); + apCount = aps.Count(); + CleanupStack::PopAndDestroy(2, &cmManager); //aps, cmManager + return apCount > 0; + } + +// ----------------------------------------------------------------------------- // MapToCallError // ----------------------------------------------------------------------------- // @@ -154,32 +202,19 @@ } // ----------------------------------------------------------------------------- -// IapIdOfDefaultSnapL -// for trapping purposes only +// HasDefConn // ----------------------------------------------------------------------------- // -LOCAL_C TUint32 IapIdOfDefaultSnapL( - RCmManager& aCmManager, - const TUint32 aDefaultSnap ) +inline TBool HasDefConn() { - RCmDestination dest( aCmManager.DestinationL( aDefaultSnap ) ); - CleanupClosePushL( dest ); - TUint32 iapIdOfDest( 0 ); - - if ( dest.ConnectionMethodCount() <= 0 ) - { - User::Leave( KErrNotFound ); - } - - RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) ); - CleanupClosePushL( cMeth ); - - iapIdOfDest = cMeth.GetIntAttributeL( CMManager::ECmIapId ); - CleanupStack::PopAndDestroy( &cMeth ); - CleanupStack::PopAndDestroy( &dest ); - return iapIdOfDest; + TBool found( EFalse ); + + TRAP_IGNORE( found = HasDefaultConnectionL() ); + + return found; } + // ============================ MEMBER FUNCTIONS =============================== // ----------------------------------------------------------------------------- @@ -3828,21 +3863,8 @@ KDRMUtilityDebugPanicCode ) ); _LIT( KMarker, "\x00" ); - RPointerArray uriList; TPtr ptr( NULL, 0 ); - TInt localId( 0 ); - TInt err( KErrNone ); - - TRAP( err, iOmaClient.GetDBEntriesL( *aUrl, uriList ) ); - - if ( uriList.Count() == 1 ) - { - localId = ( uriList[0] )->iUniqueID; - } - - uriList.ResetAndDestroy(); - uriList.Close(); // MaxInt will fit into 10 characters HBufC* localIDBuf( HBufC::NewLC( KIntegerMaxLen ) ); @@ -4034,7 +4056,7 @@ R_DRMUTILITY_CONFIRMATION_QUERY ); } } - else if ( !BrowserAPDefinedL() ) + else if ( !(HasDefConn()) ) { buttonCode = EAknSoftkeyNo; if ( aShowNotes ) @@ -4047,7 +4069,7 @@ if ( buttonCode == EAknSoftkeyYes || buttonCode == EAknSoftkeyOk ) { - TInt APs( APCountL() ); + TBool APs( HasAccessPointsL() ); if ( !APs ) { // No AP defined @@ -4147,68 +4169,6 @@ } // ----------------------------------------------------------------------------- -// CDrmUiHandlingImpl::BrowserAPDefinedL -// ----------------------------------------------------------------------------- -// -TBool DRM::CDrmUiHandlingImpl::BrowserAPDefinedL() - { - const TInt KDestinationSelectionMode( 2 ); - TInt err( KErrNone ); - TInt ap( 0 ); - TInt alwaysAsk( 0 ); - TInt defaultSnap( 0 ); - - CRepository* repository( CRepository::NewL( KCRUidBrowser ) ); - repository->Get( KBrowserDefaultAccessPoint, ap ); - repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk ); - repository->Get( KBrowserNGDefaultSnapId, defaultSnap ); - delete repository; - if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound ) - { - alwaysAsk = ETrue; - } - else - { - RCmManager cmManager; - CleanupClosePushL( cmManager ); - cmManager.OpenL(); - if ( !alwaysAsk ) - { - TRAP( err, cmManager.GetConnectionMethodInfoIntL( - ap, CMManager::ECmIapId ) ); - } - else if ( alwaysAsk == KDestinationSelectionMode ) - { - TRAP( err, IapIdOfDefaultSnapL( cmManager, defaultSnap ) ); - } - CleanupStack::PopAndDestroy( &cmManager ); - if ( !err && ( !alwaysAsk || alwaysAsk == KDestinationSelectionMode ) ) - { - return ETrue; - } - } - return EFalse; - } - -// ----------------------------------------------------------------------------- -// CDrmUiHandlingImpl::APCountL -// ----------------------------------------------------------------------------- -// -TInt DRM::CDrmUiHandlingImpl::APCountL() - { - TInt apCount( 0 ); - RCmManager cmManager; - CleanupClosePushL( cmManager ); - cmManager.OpenL(); - RArray aps; - CleanupClosePushL( aps ); - cmManager.ConnectionMethodL( aps, EFalse, EFalse, ETrue ); - apCount = aps.Count(); - CleanupStack::PopAndDestroy( 2, &cmManager ); //aps, cmManager - return apCount; - } - -// ----------------------------------------------------------------------------- // CDrmUiHandlingImpl::HandleServerAppExit // ----------------------------------------------------------------------------- // diff -r 493788a4a8a4 -r 3bdc3b853094 commondrm/drmutility/src/DrmUtilityDmgrWrapper.cpp --- a/commondrm/drmutility/src/DrmUtilityDmgrWrapper.cpp Fri Apr 16 15:14:55 2010 +0300 +++ b/commondrm/drmutility/src/DrmUtilityDmgrWrapper.cpp Mon May 03 12:46:34 2010 +0300 @@ -1,68 +1,58 @@ /* -* Copyright (c) 2007-2008 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: Dynamically loadable wrapper for Download manager -* -*/ - + * Copyright (c) 2007-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: Dynamically loadable wrapper for Download manager + * + */ #include #include #include #include #include #include - -#ifdef __SERIES60_NATIVE_BROWSER -#include -#endif - #ifdef RD_MULTIPLE_DRIVE #include #endif - #include #include +#include //download manager +#include // tconnectioninfo +#include // TConnectionInfoV2 +#include // rconnection rsocket +#include // avkon classes +#include + #include #include #include -#include "RoapEng.h" +#include +#include +#include + #include "RoapSyncWrapper.h" #include "RoapDef.h" - #include "DrmUtilityDmgrWrapper.h" #include "DrmUtilityDmgrWrapperLogger.h" +#include "drmutilityconnection.h" +#include "buffercontainers.h" //CnameContainer etc. +#include "cleanupresetanddestroy.h" +#include "buffercontainers.h" -// DEBUG macros -#ifdef _DEBUG -#define DRMDEBUGLIT( a, b ) \ -_LIT( a , b ) -#define DRMDEBUG( a ) \ -RDebug::Print( a ) -#define DRMDEBUG2( a, b ) \ -RDebug::Print( a, b ) -#else -#define DRMDEBUGLIT( a, b ) -#define DRMDEBUG( a ) -#define DRMDEBUG2( a, b ) -#endif - -// CONSTANTS -#ifndef __SERIES60_NATIVE_BROWSER -const TUid KCRUidBrowser = {0x10008D39}; -const TUint32 KBrowserDefaultAccessPoint = 0x0000000E; -const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E; +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "DrmUtilityDmgrWrapperTraces.h" #endif #ifndef RD_MULTIPLE_DRIVE @@ -72,52 +62,64 @@ _LIT( KRomDriveFormatter, "%c:" ); _LIT( KKDrmUtilityTriggerFilePathFormatter, "%c:\\" ); #endif - _LIT( KCDrmUtilityDmgrWrapperResFileName,"DrmUtilityDmgrWrapper.rsc" ); -const TInt KProgressInfoFinalValue( 200 ); -const TInt KProgressInfoIncrementSmall( 5 ); -const TInt KProgressInfoIncrementMedium( 10 ); -const TInt KProgressInfoIncrementLarge( 30 ); +const TInt KProgressInfoFinalValue(200); +const TInt KProgressInfoIncrementSmall(5); +const TInt KProgressInfoIncrementMedium(10); +const TInt KProgressInfoIncrementLarge(30); // ======== LOCAL FUNCTIONS ======== // --------------------------------------------------------------------------- +// ClearIfNotRoapTemporaryError +// --------------------------------------------------------------------------- +// +void ClearIfNotRoapTemporaryError(TInt aError, HBufC8*& aBuffer) + { + // ROAP ERROR CODES + switch (aError) + { + case KErrRoapGeneral: + case KErrRoapServer: + case KErrRoapDomainFull: + case KErrRoapNotRegistered: + break; + default: + delete aBuffer; + aBuffer = NULL; + break; + } + } + + +// --------------------------------------------------------------------------- // DeleteHttpDowload // --------------------------------------------------------------------------- // -LOCAL_C void DeleteHttpDowload( TAny* aDownload ) +LOCAL_C void DeleteHttpDowload(TAny* aDownload) { - reinterpret_cast< RHttpDownload* >( aDownload )->Delete(); + reinterpret_cast (aDownload)->Delete(); } + // --------------------------------------------------------------------------- -// IapIdOfDefaultSnapL -// for trapping purposes only +// UpdateBufferL // --------------------------------------------------------------------------- // -LOCAL_C TUint32 IapIdOfDefaultSnapL( - RCmManager& aCmManager, - const TUint32 aDefaultSnap ) +template +LOCAL_C void UpdateBufferL(bufType*& aTargetBuf, const descType& aSourceBuf) { - RCmDestination dest( aCmManager.DestinationL( aDefaultSnap ) ); - CleanupClosePushL( dest ); - TUint32 iapIdOfDest( 0 ); - - if ( dest.ConnectionMethodCount() <= 0 ) + if (aTargetBuf) { - User::Leave( KErrNotFound ); + delete aTargetBuf; + aTargetBuf = NULL; } - - RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) ); - CleanupClosePushL( cMeth ); - - iapIdOfDest = cMeth.GetIntAttributeL( CMManager::ECmIapId ); - CleanupStack::PopAndDestroy( &cMeth ); - CleanupStack::PopAndDestroy( &dest ); - return iapIdOfDest; + if (aSourceBuf.Length()) + { + aTargetBuf = aSourceBuf.AllocL(); + } } - // ======== MEMBER FUNCTIONS ======== // --------------------------------------------------------------------------- @@ -125,8 +127,10 @@ // --------------------------------------------------------------------------- // CDrmUtilityDmgrWrapper::CDrmUtilityDmgrWrapper() : - iUseCoeEnv( EFalse ) + CActive(CActive::EPriorityStandard), + iUseCoeEnv(EFalse), iIapId(0), iState(EInit) { + CActiveScheduler::Add(this); } // --------------------------------------------------------------------------- @@ -137,14 +141,15 @@ { CLOG_WRITE( "DMgrWrapper::ConstructL" ); const TInt KDrmUtilityDmgrWrapperUid = 0x102830FE; - iDlMgr.ConnectL( TUid::Uid(KDrmUtilityDmgrWrapperUid), *this, EFalse ); + iConnection = DRM::CDrmUtilityConnection::NewL(ETrue); + iDlMgr.ConnectL(TUid::Uid(KDrmUtilityDmgrWrapperUid), *this, EFalse); iProgressInfo = NULL; iProgressNoteDialog = NULL; iDialogDismissed = ETrue; + User::LeaveIfError(iFs.Connect()); + User::LeaveIfError(iFs.ShareProtected()); } - - // --------------------------------------------------------------------------- // CDrmUtilityDmgrWrapper::NewL // --------------------------------------------------------------------------- @@ -152,12 +157,11 @@ CDrmUtilityDmgrWrapper* CDrmUtilityDmgrWrapper::NewL() { CLOG_WRITE( "DMgrWrapper::NewL" ); - CDrmUtilityDmgrWrapper* self( CDrmUtilityDmgrWrapper::NewLC() ); - CleanupStack::Pop( self ); + CDrmUtilityDmgrWrapper* self(CDrmUtilityDmgrWrapper::NewLC()); + CleanupStack::Pop(self); return self; } - // --------------------------------------------------------------------------- // CDrmUtilityDmgrWrapper::NewLC // --------------------------------------------------------------------------- @@ -165,13 +169,12 @@ CDrmUtilityDmgrWrapper* CDrmUtilityDmgrWrapper::NewLC() { CLOG_WRITE( "DMgrWrapper::NewLC" ); - CDrmUtilityDmgrWrapper* self( new( ELeave ) CDrmUtilityDmgrWrapper() ); - CleanupStack::PushL( self ); + CDrmUtilityDmgrWrapper* self(new (ELeave) CDrmUtilityDmgrWrapper()); + CleanupStack::PushL(self); self->ConstructL(); return self; } - // --------------------------------------------------------------------------- // CDrmUtilityDmgrWrapper::~CDrmUtilityDmgrWrapper // --------------------------------------------------------------------------- @@ -179,22 +182,30 @@ CDrmUtilityDmgrWrapper::~CDrmUtilityDmgrWrapper() { CLOG_WRITE( "DMgrWrapper destructor" ); - if ( iProgressNoteDialog ) - { - // deletes the dialog - TRAPD( err, iProgressNoteDialog->ProcessFinishedL() ); - if ( err ) - { - delete iProgressNoteDialog; - } - iProgressNoteDialog = NULL; - } + Cancel(); + if (iProgressNoteDialog) + { + // deletes the dialog + TRAPD( err, iProgressNoteDialog->ProcessFinishedL() ); + if (err) + { + delete iProgressNoteDialog; + } + iProgressNoteDialog = NULL; + } delete iErrorUrl; + delete iPostResponseUrl; + delete iConnection; + + delete iTriggerUrl; + delete iTriggerBuf; + delete iFileName; + delete iRoapEng; #ifdef _DEBUG - if ( iDlMgr.Handle() ) + if (iDlMgr.Handle()) { iDlMgr.Close(); } @@ -204,19 +215,9 @@ iDlMgr.Close(); #endif - } - -// --------------------------------------------------------------------------- -// CDrmUtilityDmgrWrapper::DownloadAndHandleRoapTriggerL -// --------------------------------------------------------------------------- -// -void CDrmUtilityDmgrWrapper::DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ) - { - CLOG_WRITE( "DMgrWrapper::DownloadAndHandleRoapTriggerL" ); - iUseCoeEnv = EFalse; - DoDownloadAndHandleRoapTriggerL( aUrl ); - HandlePostResponseUrlL(); + iFs.Close(); + } @@ -224,447 +225,429 @@ // CDrmUtilityDmgrWrapper::DownloadAndHandleRoapTriggerL // --------------------------------------------------------------------------- // +void CDrmUtilityDmgrWrapper::DownloadAndHandleRoapTriggerL(const HBufC8* aUrl) + { + CLOG_WRITE( "DMgrWrapper::DownloadAndHandleRoapTriggerL" ); + iUseCoeEnv = EFalse; + if (iState != EInit || iWait.IsStarted()) + { + User::Leave(KErrNotReady); + } + + UpdateBufferL (iTriggerUrl, *aUrl); + CompleteToState(EInit, KErrNone); + iWait.Start(); + } + +// --------------------------------------------------------------------------- +// CDrmUtilityDmgrWrapper::DownloadAndHandleRoapTriggerL +// --------------------------------------------------------------------------- +// void CDrmUtilityDmgrWrapper::DownloadAndHandleRoapTriggerL( - const HBufC8* aUrl, CCoeEnv& aCoeEnv ) + const HBufC8* aUrl, CCoeEnv& aCoeEnv) { CLOG_WRITE( "DMgrWrapper::DownloadAndHandleRoapTriggerL" ); iCoeEnv = &aCoeEnv; iUseCoeEnv = ETrue; - DoDownloadAndHandleRoapTriggerL( aUrl ); - HandlePostResponseUrlL(); - } - - -// --------------------------------------------------------------------------- -// CDrmUtilityDmgrWrapper::HandlePostResponseUrlL -// --------------------------------------------------------------------------- -// -void CDrmUtilityDmgrWrapper::HandlePostResponseUrlL() - { - if ( iPostResponseUrl ) + if (iState != EInit || iWait.IsStarted()) { - DoDownloadAndHandleRoapTriggerL( iPostResponseUrl ); - // prevent infinite post response fetches. - delete iPostResponseUrl; - iPostResponseUrl = NULL; - - // Ensure progress note gets deleted. - // It remains open if prUrl initialted ROAP operation has PrUrl - // (unsupported chained metering report) - RemoveProgressNoteL(); - } - } - - -// --------------------------------------------------------------------------- -// CDrmUtilityDmgrWrapper::DoDownloadAndHandleRoapTriggerL -// --------------------------------------------------------------------------- -// -void CDrmUtilityDmgrWrapper::DoDownloadAndHandleRoapTriggerL( - const HBufC8* aUrl ) - { - RFs fs; - RFile roapTrigger; - HBufC8* triggerBuf( NULL ); - TBool result( EFalse ); - TFileName triggerFileName; - - CLOG_WRITE( "DMgrWrapper::DoDownloadAndHandleRoapTriggerL" ); - User::LeaveIfError( fs.Connect() ); - CleanupClosePushL( fs ); - User::LeaveIfError( fs.ShareProtected() ); - -#ifndef RD_MULTIPLE_DRIVE - - User::LeaveIfError( roapTrigger.Temp( - fs, KDrmUtilityTriggerFilePath, triggerFileName, EFileWrite ) ); - -#else //RD_MULTIPLE_DRIVE - - TInt driveNumber( -1 ); - TChar driveLetter; - DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRam, driveNumber ); - fs.DriveToChar( driveNumber, driveLetter ); - - TFileName utilityTriggerFilePath; - - utilityTriggerFilePath.Format( KKDrmUtilityTriggerFilePathFormatter, - (TUint)driveLetter ); - - User::LeaveIfError( roapTrigger.Temp( - fs, utilityTriggerFilePath, triggerFileName, EFileWrite ) ); - -#endif - - - TPtrC8 KNullPtr8( NULL, 0 ); - RHttpDownload* downloadPtr( iDlMgr.FindDownload( *aUrl, KNullPtr8 ) ); - if ( downloadPtr ) - { - // Stale download found. - // Remove it, and re-create a new download. - downloadPtr->Delete(); - downloadPtr = NULL; - } - - // create and start download - RHttpDownload& download = iDlMgr.CreateDownloadL( *aUrl, result ); - // Put download for proper cleanup. - TCleanupItem item( DeleteHttpDowload, &download ); - CleanupStack::PushL( item ); - - CleanupClosePushL( roapTrigger ); - - if ( !iPostResponseUrl ) - { - // No post response retieval. Note must be created. - ShowProgressNoteL(); + User::Leave(KErrNotReady); } - if ( result ) - { - const TInt KReadBufSize( 512 ); - TInt triggerFileSize( 0 ); - - CLOG_WRITE( - "DMgrWrapper::DoDownloadAndHandleRoapTriggerL: download created" ); - iDownloadSuccess = EFalse; - iConnectionError = EFalse; - - SetDefaultAccessPointL(); - - User::LeaveIfError( download.SetFileHandleAttribute( roapTrigger ) ); - User::LeaveIfError( - download.SetBoolAttribute( EDlAttrNoContentTypeCheck, ETrue ) ); - User::LeaveIfError( download.Start() ); - - // wait until download is finished - iWait.Start(); - - // Check success of download - CLOG_WRITE( - "DMgrWrapper::DoDownloadAndHandleRoapTriggerL: download finished" ); - - CleanupStack::Pop( &roapTrigger ); - roapTrigger.Close(); - if ( !iDownloadSuccess ) - { - RemoveProgressNoteL(); - if ( iConnectionError ) - { - User::Leave( KErrCouldNotConnect ); - } - else - { - User::Leave( KErrGeneral ); - } - } - User::LeaveIfError( roapTrigger.Open( fs, - triggerFileName, - EFileShareReadersOrWriters ) ); - CleanupClosePushL( roapTrigger ); - - // Get filehandle of ROAP trigger - // Read file to buffer - User::LeaveIfError( roapTrigger.Size( triggerFileSize ) ); - triggerBuf = HBufC8::NewLC( triggerFileSize ); - - RBuf8 readBuf; - readBuf.CleanupClosePushL(); - readBuf.CreateL( KReadBufSize ); - - User::LeaveIfError( roapTrigger.Read( readBuf, KReadBufSize ) ); - triggerBuf->Des().Copy( readBuf ); - while ( readBuf.Length() == KReadBufSize ) - { - User::LeaveIfError( roapTrigger.Read( readBuf, KReadBufSize ) ); - triggerBuf->Des().Append( readBuf ); - } - - CleanupStack::PopAndDestroy( &readBuf ); - - if ( iUseCoeEnv && iProgressInfo ) - { - iProgressInfo->IncrementAndDraw( KProgressInfoIncrementMedium ); - } - - // And let ROAP handle it... - CRoapSyncWrapper* roapWrapper( CRoapSyncWrapper::NewL() ); - CleanupStack::PushL( roapWrapper ); - TRAPD( err, roapWrapper->HandleTriggerL( *triggerBuf ) ); - if ( err ) - { - TInt errorType( 0 ); - TRAPD( err2, - iErrorUrl = roapWrapper->GetErrorUrlL( err, errorType ) ); - if ( err2 ) - { - RemoveProgressNoteL(); - delete iErrorUrl; - iErrorUrl = NULL; - User::Leave( err2 ); - } - else if ( errorType != KErrRoapTemporary ) - { - RemoveProgressNoteL(); - delete iErrorUrl; - iErrorUrl = NULL; - User::Leave( err ); - } - else - { - RemoveProgressNoteL(); - User::Leave( err ); - } - } - if ( iPostResponseUrl ) - { - delete iPostResponseUrl; - iPostResponseUrl = NULL; - } - iPostResponseUrl = roapWrapper->GetPostResponseUrlL(); - CleanupStack::PopAndDestroy( 2, triggerBuf ); - - if ( iUseCoeEnv && iProgressInfo && !iPostResponseUrl ) - { - // No PrUrl found. Progess is complete. - iProgressInfo->SetAndDraw( KProgressInfoFinalValue ); - } - } - - // Trick to keep note open long enough during prUrl retrieval - if ( !iPostResponseUrl ) - { - RemoveProgressNoteL(); - } - else - { - if ( iUseCoeEnv && iProgressInfo ) - { - iProgressInfo->IncrementAndDraw( KProgressInfoIncrementMedium ); - } - } - - CleanupStack::PopAndDestroy( &roapTrigger ); - CleanupStack::PopAndDestroy( &download ); - - fs.Delete( triggerFileName ); - CleanupStack::PopAndDestroy( &fs ); + UpdateBufferL (iTriggerUrl, *aUrl); + CompleteToState(EInit, KErrNone); + iWait.Start(); } - -// --------------------------------------------------------------------------- -// CDrmUtilityDmgrWrapper::SetDefaultAccessPointL -// --------------------------------------------------------------------------- -// -void CDrmUtilityDmgrWrapper::SetDefaultAccessPointL() - { - const TInt KDestinationSelectionMode( 2 ); - CRepository* repository( NULL ); - TInt ap( 0 ); - TInt alwaysAsk( 0 ); - TUint32 iapd32( 0 ); - TInt defaultSnap( 0 ); - TInt err( KErrNone ); - - CLOG_WRITE( "DMgrWrapper::SetDefaultAccessPointL" ); - DRMDEBUGLIT( KDuiBrApFormat, - "CDrmUtilityDmgrWrapper::SetDefaultAccessPointL %d" ); - DRMDEBUGLIT( KDuiBrApFormat2, " KBrowserDefaultAccessPoint = %d" ); - DRMDEBUGLIT( KDuiBrApFormat3, " KBrowserAccessPointSelectionMode = %d" ); - DRMDEBUGLIT( KDuiBrApFormat4, " KBrowserNGDefaultSnapId = %d" ); - - repository = CRepository::NewL( KCRUidBrowser ); - CleanupStack::PushL( repository ); - repository->Get( KBrowserDefaultAccessPoint, ap ); - repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk ); - repository->Get( KBrowserNGDefaultSnapId, defaultSnap ); - DRMDEBUG2( KDuiBrApFormat(), __LINE__ ); - DRMDEBUG2( KDuiBrApFormat2(), ap ); - DRMDEBUG2( KDuiBrApFormat3(), alwaysAsk ); - DRMDEBUG2( KDuiBrApFormat4(), defaultSnap ); - - if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound ) - { - alwaysAsk = ETrue; - } - else - { - RCmManager cmManager; - cmManager.OpenLC(); - if ( !alwaysAsk ) - { - TRAP( err, iapd32 = cmManager.GetConnectionMethodInfoIntL( - ap, CMManager::ECmIapId ) ); - } - else if ( alwaysAsk == KDestinationSelectionMode ) - { - TRAP( err, iapd32 = - IapIdOfDefaultSnapL( cmManager, defaultSnap ) ); - } - CleanupStack::PopAndDestroy( &cmManager ); - } - if ( !err && ( !alwaysAsk || alwaysAsk == KDestinationSelectionMode ) ) - { - err = iDlMgr.SetIntAttribute( EDlMgrIap, iapd32 ); - } - CleanupStack::PopAndDestroy( repository ); - } - - // --------------------------------------------------------------------------- // CDrmUtilityDmgrWrapper::GetErrorUrlL // --------------------------------------------------------------------------- // HBufC8* CDrmUtilityDmgrWrapper::GetErrorUrlL() { - if( iErrorUrl ) + if (iErrorUrl) { return iErrorUrl->AllocL(); } return NULL; } +// --------------------------------------------------------------------------- +// CDrmUtilityDmgrWrapper::DoConnectL +// --------------------------------------------------------------------------- +// +void CDrmUtilityDmgrWrapper::DoConnectL(TDownloadState aNextState) + { + iConnection->ConnectL(&iStatus); + if (iUseCoeEnv && iProgressInfo) + { + iProgressInfo->SetAndDraw(0); + } + iState = aNextState; + SetActive(); + } +///// +// --------------------------------------------------------------------------- +// CDrmUtilityDmgrWrapper::DoDownloadRoapTriggerL +// --------------------------------------------------------------------------- +// +void CDrmUtilityDmgrWrapper::DoDownloadRoapTriggerL(TDownloadState aNextState) + { + // Fetch name of opend connection to be used as part of DMGR + // initialisation + TUint32 iapId(0); + if (iConnection->IsConnected(iapId)) + { + iDlMgr.SetIntAttribute( EDlMgrIap, iapId ); + } + RFile roapTrigger; + TBool result(EFalse); + DRM::CFileNameContainer* triggerFileName(NULL); + + // If no Trigger URL then nothing to download. So finish transaction + if (!iTriggerUrl || iTriggerUrl->Length() <= 0) + { + if (iUseCoeEnv && iProgressInfo) + { + // No PrUrl found. Progess is complete. + iProgressInfo->SetAndDraw(KProgressInfoFinalValue); + } + CompleteToState(EComplete, KErrNone); + return; + } + + TPtrC8 KNullPtr8(NULL, 0); + RHttpDownload* downloadPtr(iDlMgr.FindDownload(*iTriggerUrl, KNullPtr8)); + if (downloadPtr) + { + // Stale download found. + // Remove it, and re-create a new download. + downloadPtr->Delete(); + downloadPtr = NULL; + if (iFileName) + { + iFs.Delete(*iFileName); + } + } + + triggerFileName=DRM::CFileNameContainer::NewLC(); +#ifndef RD_MULTIPLE_DRIVE + + User::LeaveIfError( roapTrigger.Temp( + iFs, KDrmUtilityTriggerFilePath, triggerFileName->iBuffer, EFileWrite ) ); + +#else //RD_MULTIPLE_DRIVE + TInt driveNumber(-1); + TChar driveLetter; + DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRam, driveNumber); + iFs.DriveToChar(driveNumber, driveLetter); + + DRM::CFileNameContainer* + utilityTriggerFilePath(DRM::CFileNameContainer::NewLC()); + + utilityTriggerFilePath->iBuffer.Format( + KKDrmUtilityTriggerFilePathFormatter, (TUint) driveLetter); + + User::LeaveIfError(roapTrigger.Temp(iFs, utilityTriggerFilePath->iBuffer, + triggerFileName->iBuffer, EFileWrite)); + CleanupStack::PopAndDestroy( utilityTriggerFilePath ); + utilityTriggerFilePath=NULL; + +#endif + UpdateBufferL (iFileName, triggerFileName->iBuffer); + CleanupStack::PopAndDestroy( triggerFileName ); + triggerFileName=NULL; + + // create and start download + RHttpDownload& download = iDlMgr.CreateDownloadL(*iTriggerUrl, result); + // Put download for proper cleanup. + TCleanupItem item(DeleteHttpDowload, &download); + CleanupStack::PushL(item); + + CleanupClosePushL(roapTrigger); + + if (result) + { + iDownloadSuccess = EFalse; + iConnectionError = EFalse; + + User::LeaveIfError(download.SetFileHandleAttribute(roapTrigger)); + User::LeaveIfError(download.SetBoolAttribute( + EDlAttrNoContentTypeCheck, ETrue)); + User::LeaveIfError(download.Start()); + + // wait until download is finished + iState = aNextState; + TRequestStatus* status(&iStatus); + *status = KRequestPending; + SetActive(); + } + CleanupStack::PopAndDestroy(&roapTrigger); + CleanupStack::Pop(&download); // Left open for DoSaveRoapTrigger + } +// --------------------------------------------------------------------------- +// CDrmUtilityDmgrWrapper::DoSaveRoapTriggerL +// --------------------------------------------------------------------------- +// +void CDrmUtilityDmgrWrapper::DoSaveRoapTriggerL(TDownloadState aNextState) + { + // Check success of download + + // Fetch download created in DoDownloadRoapTriggerL + RHttpDownload* download = iDlMgr.FindDownload(*iTriggerUrl, KNullDesC8()); + // Delete trigger URL so that it is possible to check + // whether or not meteringResponse has PrUrl. + delete iTriggerUrl; + iTriggerUrl = NULL; + iStatus = KRequestPending; + // Put download for proper cleanup. + TCleanupItem item(DeleteHttpDowload, download); + CleanupStack::PushL(item); + RFile roapTrigger; + + if (!iDownloadSuccess) + { + RemoveProgressNoteL(); + if (iConnectionError) + { + User::Leave(KErrCouldNotConnect); + } + else + { + User::Leave(KErrGeneral); + } + } + User::LeaveIfError(roapTrigger.Open(iFs, *iFileName, + EFileShareReadersOrWriters)); + CleanupClosePushL(roapTrigger); + // Get filehandle of ROAP trigger + const TInt KReadBufSize = 512; + + RBuf8 readBuf; + readBuf.CleanupClosePushL(); + readBuf.CreateL(KReadBufSize); + + // Read file to buffer + TInt triggerFileSize(0); + User::LeaveIfError(roapTrigger.Size(triggerFileSize)); + if (iTriggerBuf) + { + delete iTriggerBuf; + iTriggerBuf = NULL; + } + iTriggerBuf = HBufC8::NewL(triggerFileSize); + User::LeaveIfError(roapTrigger.Read(readBuf, KReadBufSize)); + iTriggerBuf->Des().Copy(readBuf); + while (readBuf.Length() == KReadBufSize) + { + User::LeaveIfError(roapTrigger.Read(readBuf, KReadBufSize)); + iTriggerBuf->Des().Append(readBuf); + } + + // And let ROAP handle it... + CleanupStack::PopAndDestroy(&readBuf); + CleanupStack::PopAndDestroy(&roapTrigger); + CleanupStack::PopAndDestroy(download); + + iFs.Delete(*iFileName); + delete iFileName; + iFileName = NULL; + if (iUseCoeEnv && iProgressInfo) + { + iProgressInfo->IncrementAndDraw(KProgressInfoIncrementMedium); + } + + CompleteToState(aNextState, KErrNone); + } + +// --------------------------------------------------------------------------- +// CDrmUtilityDmgrWrapper::DoHandleRoapTriggerL +// --------------------------------------------------------------------------- +// +void CDrmUtilityDmgrWrapper::DoHandleRoapTriggerL(TDownloadState aNextState) + { + Roap::TTriggerType triggerType; + Roap::TRiContextStatus contextStatus; + Roap::TDomainOperation domainOperation; + + RPointerArray contentIds; + CleanupResetAndDestroyPushL( contentIds ); + + iRoapEng = Roap::CRoapEng::NewL(); + + iRoapEng->SetTriggerL(*iTriggerBuf, NULL, triggerType, contextStatus, + domainOperation, contentIds); + + CleanupStack::PopAndDestroy(&contentIds); + + iRoapEng->AcceptL(this, &iStatus); + iState = aNextState; + SetActive(); + } + +// --------------------------------------------------------------------------- +// CDrmUtilityDmgrWrapper::CompleteToState +// --------------------------------------------------------------------------- +// +void CDrmUtilityDmgrWrapper::CompleteToState( + CDrmUtilityDmgrWrapper::TDownloadState aNextState, TInt aError) + { + iState = aNextState; + TRequestStatus* ownStatus(&iStatus); + User::RequestComplete(ownStatus, aError); + SetActive(); + } + +// MHttpDownloadMgrObserver methods // --------------------------------------------------------------------------- // From class MHttpDownloadMgrObserver // // CDrmUtilityDmgrWrapper::HandleDMgrEventL // --------------------------------------------------------------------------- // -void CDrmUtilityDmgrWrapper::HandleDMgrEventL( - RHttpDownload& aDownload, - THttpDownloadEvent aEvent ) +void CDrmUtilityDmgrWrapper::HandleDMgrEventL(RHttpDownload& aDownload, + THttpDownloadEvent aEvent) { _LIT8( KDrmUtilityMimeTypeROAPTrigger, - "application/vnd.oma.drm.roap-trigger+xml" ); + "application/vnd.oma.drm.roap-trigger+xml" ); + - CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL" ); - CLOG_WRITE_FORMAT( "iDownLoadState = %d", aEvent.iDownloadState ); - CLOG_WRITE_FORMAT( "iProgressState = %d", aEvent.iProgressState ); - if ( aEvent.iProgressState == EHttpContentTypeReceived ) + if (aEvent.iProgressState == EHttpContentTypeReceived) { // check received mimetype RBuf8 contentType; contentType.CleanupClosePushL(); - contentType.CreateL( KMaxContentTypeLength ); - User::LeaveIfError( - aDownload.GetStringAttribute( EDlAttrContentType, contentType ) ); - if ( !contentType.FindF( KDrmUtilityMimeTypeROAPTrigger ) ) + contentType.CreateL(KMaxContentTypeLength); + User::LeaveIfError(aDownload.GetStringAttribute(EDlAttrContentType, + contentType)); + if (!contentType.FindF(KDrmUtilityMimeTypeROAPTrigger)) { // ROAP trigger found, continue download - User::LeaveIfError( aDownload.Start() ); + User::LeaveIfError(aDownload.Start()); } else { // wrong MIME type, so stop download iDownloadSuccess = EFalse; - User::LeaveIfError( aDownload.Delete() ); + User::LeaveIfError(aDownload.Delete()); } - CleanupStack::PopAndDestroy( &contentType ); + CleanupStack::PopAndDestroy(&contentType); } - if ( aEvent.iDownloadState == EHttpDlCreated ) + if (aEvent.iDownloadState == EHttpDlCreated) { CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlCreated" ); - if ( iUseCoeEnv ) + if (iUseCoeEnv && iProgressInfo) { - iProgressInfo->IncrementAndDraw( KProgressInfoIncrementMedium ); + iProgressInfo->IncrementAndDraw(KProgressInfoIncrementMedium); } } - else if ( aEvent.iProgressState == EHttpProgDisconnected ) + else if (aEvent.iProgressState == EHttpProgDisconnected) { CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpProgDisconnected" ); + // store failure iDownloadSuccess = EFalse; iConnectionError = ETrue; // finished - iWait.AsyncStop(); } - else if ( aEvent.iDownloadState == EHttpDlInprogress ) + else if (aEvent.iDownloadState == EHttpDlInprogress) { CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlInprogress" ); - if ( iUseCoeEnv ) + if (iUseCoeEnv) { - iProgressInfo->IncrementAndDraw( KProgressInfoIncrementSmall ); + iProgressInfo->IncrementAndDraw(KProgressInfoIncrementSmall); } } - else if ( aEvent.iDownloadState == EHttpDlCompleted ) + else if (aEvent.iDownloadState == EHttpDlCompleted) { // store success CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlCompleted" ); iDownloadSuccess = ETrue; - if ( iUseCoeEnv ) + iConnectionError = EFalse; + if (iUseCoeEnv) { - iProgressInfo->IncrementAndDraw( KProgressInfoIncrementLarge ); + iProgressInfo->IncrementAndDraw(KProgressInfoIncrementLarge); } // finished - iWait.AsyncStop(); + TRequestStatus* status(&iStatus); + User::RequestComplete(status, KErrNone); } - else if ( aEvent.iDownloadState == EHttpDlFailed ) + else if (aEvent.iDownloadState == EHttpDlFailed) { - TInt32 err( KErrNone ); + TInt32 err(KErrNone); CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlFailed" ); // store failure iDownloadSuccess = EFalse; - User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrErrorId, err ) ); + User::LeaveIfError(aDownload.GetIntAttribute(EDlAttrErrorId, err)); CLOG_WRITE_FORMAT( "EDlAttrErrorId = %d", err ); - if ( err == EConnectionFailed || - err == ETransactionFailed) + if (err == EConnectionFailed || err == ETransactionFailed) { CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EConnectionFailed" ); iConnectionError = ETrue; } - + User::LeaveIfError(aDownload.Delete()); // remove useless download + User::LeaveIfError(iDlMgr.Disconnect()); // disconnects Dmgr instantly. // finished - iWait.AsyncStop(); + TRequestStatus* status(&iStatus); + if ( iConnection->HasMoreConnectionAttempts() ) + { + iState = EInit; // re-try with another conection + User::RequestComplete(status, KErrNone); + } + else + { + User::RequestComplete(status, KErrCancel); + } } } - // --------------------------------------------------------------------------- // CDrmUtilityDmgrWrapper::ShowProgressNoteL // --------------------------------------------------------------------------- // void CDrmUtilityDmgrWrapper::ShowProgressNoteL() { - TFileName resFileName; + DRM::CFileNameContainer* resFileName(NULL); CLOG_WRITE( "DMgrWrapper::ShowProgressNoteL" ); - if ( iUseCoeEnv ) + if (iUseCoeEnv) { // Initialize the progress note dialog, it's values, // and execute it + resFileName=DRM::CFileNameContainer::NewLC(); #ifndef RD_MULTIPLE_DRIVE - resFileName.Copy( KDriveZ ); + resFileName->iBuffer.Copy( KDriveZ ); #else //RD_MULTIPLE_DRIVE - - TInt driveNumber( -1 ); + TInt driveNumber(-1); TChar driveLetter; - DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber ); + DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRom, driveNumber); - iCoeEnv->FsSession().DriveToChar( driveNumber, driveLetter ); + iCoeEnv->FsSession().DriveToChar(driveNumber, driveLetter); - resFileName.Format( KRomDriveFormatter, (TUint)driveLetter ); + resFileName->iBuffer.Format(KRomDriveFormatter, (TUint) driveLetter); #endif - resFileName.Append( KDC_RESOURCE_FILES_DIR ); - resFileName.Append( KCDrmUtilityDmgrWrapperResFileName ); - RConeResourceLoader loader( *iCoeEnv ); - loader.OpenL( resFileName ); + resFileName->iBuffer.Append(KDC_RESOURCE_FILES_DIR); + resFileName->iBuffer.Append(KCDrmUtilityDmgrWrapperResFileName); + RConeResourceLoader loader(*iCoeEnv); + loader.OpenL(resFileName->iBuffer); + CleanupStack::PopAndDestroy( resFileName ); + resFileName=NULL; iProgressNoteDialog = new (ELeave) CAknProgressDialog( - reinterpret_cast< CEikDialog** >( &iProgressNoteDialog ) ); - iProgressNoteDialog->PrepareLC( R_SILENT_PROGRESS_NOTE ); - iProgressNoteDialog->SetCallback( this ); + reinterpret_cast (&iProgressNoteDialog)); + iProgressNoteDialog->PrepareLC(R_SILENT_PROGRESS_NOTE); + iProgressNoteDialog->SetCallback(this); iProgressInfo = iProgressNoteDialog->GetProgressInfoL(); - iProgressInfo->SetFinalValue( KProgressInfoFinalValue ); + iProgressInfo->SetFinalValue(KProgressInfoFinalValue); iDialogDismissed = EFalse; iProgressNoteDialog->RunLD(); @@ -673,7 +656,6 @@ } - // --------------------------------------------------------------------------- // CDrmUtilityDmgrWrapper::RemoveProgressNoteL // --------------------------------------------------------------------------- @@ -681,7 +663,7 @@ void CDrmUtilityDmgrWrapper::RemoveProgressNoteL() { - if ( iUseCoeEnv ) + if (iUseCoeEnv) { if (iProgressNoteDialog && !iDialogDismissed) { @@ -689,22 +671,22 @@ TRAPD(err, iProgressNoteDialog->ProcessFinishedL()); if (err != KErrNone) { + iProgressNoteDialog->SetCallback(NULL); delete iProgressNoteDialog; + iDialogDismissed = ETrue; } iProgressNoteDialog = NULL; } } - } - // --------------------------------------------------------------------------- // From class MAknProgressDialogCallback // // CDrmUtilityDmgrWrapper::DialogDismissedL // --------------------------------------------------------------------------- // -void CDrmUtilityDmgrWrapper::DialogDismissedL( TInt /*aButtonId*/ ) +void CDrmUtilityDmgrWrapper::DialogDismissedL(TInt aButtonId ) { iDialogDismissed = ETrue; @@ -712,14 +694,193 @@ iProgressNoteDialog = NULL; iProgressInfo = NULL; - if( iWait.IsStarted() ) + if (IsActive() && aButtonId == EAknSoftkeyCancel) + { + if ((iState == EGetMeteringTrigger || iState == EGetPrUrlTrigger)) + { + Cancel(); + } + else + { + TRequestStatus* status(&iStatus); + User::RequestComplete(status, KErrCancel); + } + } + //For avoiding active object deadlock + iDlMgr.DeleteAll(); + + } + +// RoapObserver methods + +// --------------------------------------------------------------------------- +// CDrmUtilityDmgrWrapper::PostResponseUrlL +// --------------------------------------------------------------------------- +// +void CDrmUtilityDmgrWrapper::PostResponseUrlL(const TDesC8& aPostResponseUrl) + { + UpdateBufferL (iTriggerUrl, aPostResponseUrl); + + if (iUseCoeEnv && iProgressInfo) + { + iProgressInfo->IncrementAndDraw(KProgressInfoIncrementMedium); + } + } + +// Trivial RoapObserver methods +TBool CDrmUtilityDmgrWrapper::ConnectionConfL() + { + return ETrue; + } + +TBool CDrmUtilityDmgrWrapper::ContactRiConfL() + { + return ETrue; + } + +TBool CDrmUtilityDmgrWrapper::TransIdConfL() + { + return EFalse; + } + +void CDrmUtilityDmgrWrapper::RightsObjectDetailsL(const RPointerArray< + CDRMRights>& /*aRightsList*/) + { + // do nothing + } + +void CDrmUtilityDmgrWrapper::ContentDownloadInfoL(TPath& /*aTempFolder*/, + TFileName& /*aContentName*/, TInt& aMaxSize) + { + aMaxSize = -1; + } + +void CDrmUtilityDmgrWrapper::ContentDetailsL(const TDesC& /*aPath*/, + const TDesC8& /*aType*/, const TUid& /*aAppUid*/) + { + } + +void CDrmUtilityDmgrWrapper::RoapProgressInfoL(const TInt /*aProgressInfo*/) + { + // do nothing + } + +void CDrmUtilityDmgrWrapper::ErrorUrlL(const TDesC8& aErrorUrl) + { + UpdateBufferL (iErrorUrl, aErrorUrl); + } + +// CActive methods + +// --------------------------------------------------------------------------- +// CDrmUtilityDmgrWrapper::DoCancel +// --------------------------------------------------------------------------- +// +void CDrmUtilityDmgrWrapper::DoCancel() + { + delete iRoapEng; + iRoapEng = NULL; + iConnection->Close(); + if (iWait.IsStarted()) + { + iWait.AsyncStop(); + } + } + +// --------------------------------------------------------------------------- +// CDrmUtilityDmgrWrapper::RunL +// --------------------------------------------------------------------------- +// +void CDrmUtilityDmgrWrapper::RunL() + { + TInt error(iStatus.Int()); + + ClearIfNotRoapTemporaryError(error, iErrorUrl); + User::LeaveIfError(error); + switch (iState) + { + case EInit: + { + if (!iProgressNoteDialog) + { + ShowProgressNoteL(); + } + DoConnectL(EGetMeteringTrigger); + } + break; + case EGetMeteringTrigger: + { + DoDownloadRoapTriggerL(ESaveMeteringTrigger); + } + break; + case ESaveMeteringTrigger: + { + DoSaveRoapTriggerL(EMeteringReportSubmit); + } + break; + + case EMeteringReportSubmit: + { + DoHandleRoapTriggerL(EGetPrUrlTrigger); + } + break; + case EGetPrUrlTrigger: + { + delete iRoapEng; + iRoapEng = NULL; + DoDownloadRoapTriggerL(ESavePrUrlTrigger); + } + break; + case ESavePrUrlTrigger: + { + DoSaveRoapTriggerL(EPrRoapRequest); + } + break; + case EPrRoapRequest: + { + DoHandleRoapTriggerL(EComplete); + } + break; + case EComplete: + { + RemoveProgressNoteL(); + delete iRoapEng; + iRoapEng = NULL; + iWait.AsyncStop(); + } + break; + + default: + User::Leave(KErrNotSupported); + } + } + +// --------------------------------------------------------------------------- +// CDrmUtilityDmgrWrapper::RunError +// --------------------------------------------------------------------------- +// +TInt CDrmUtilityDmgrWrapper::RunError(TInt /* aError */) + { + delete iRoapEng; + iRoapEng = NULL; + iConnection->Close(); + if (iWait.IsStarted()) { iWait.AsyncStop(); } + if (iUseCoeEnv) + { + if (iProgressNoteDialog && !iDialogDismissed) + { + iProgressNoteDialog->SetCallback(NULL); + delete iProgressNoteDialog; + iDialogDismissed = ETrue; + } + iProgressNoteDialog = NULL; + } + return KErrNone; } - - // ======== GLOBAL FUNCTIONS ======== //------------------------------------------------------------------------------ @@ -730,7 +891,7 @@ { CDrmUtilityDmgrWrapper* launcher = NULL; TRAPD( err, launcher = CDrmUtilityDmgrWrapper::NewL() ); - if( err != KErrNone ) + if (err != KErrNone) { return NULL; } diff -r 493788a4a8a4 -r 3bdc3b853094 commondrm/drmutility/src/DrmUtilityDownloadManager.cpp --- a/commondrm/drmutility/src/DrmUtilityDownloadManager.cpp Fri Apr 16 15:14:55 2010 +0300 +++ b/commondrm/drmutility/src/DrmUtilityDownloadManager.cpp Mon May 03 12:46:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2007-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" @@ -21,7 +21,7 @@ #include "DrmUtilityDmgrWrapper.h" // CONSTANTS -_LIT( KDrmUtilityDmgrHandlerName, "\\system\\libs\\DrmUtilityDmgrWrapper.dll" ); +_LIT( KDrmUtilityDmgrHandlerName, "DrmUtilityDmgrWrapper.dll" ); typedef TAny* (*NewDMgrL)(); diff -r 493788a4a8a4 -r 3bdc3b853094 commondrm/drmutility/src/drmutilityconnection.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmutility/src/drmutilityconnection.cpp Mon May 03 12:46:34 2010 +0300 @@ -0,0 +1,562 @@ +/* + * 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: Connection manager for DRM + * + */ + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include // CCmApplicationSettingsUi +#include +#include // IAP, COMMDB_ID +#include "drmutilityconnection.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "drmutilityconnectionTraces.h" +#endif + +// ================= MEMBER FUNCTIONS ======================= + + +// ----------------------------------------------------------------------------- +// HasDefaultConnectionL +// Finds default IAP id +// @return Etrue: valid AP found +// EFalse: valid AP not found +// @leave system wide error codes +// ----------------------------------------------------------------------------- +// +TBool DRM::CDrmUtilityConnection::HasDefaultConnectionL() + { + TBool hasDefault(EFalse); + TCmDefConnValue defConn; + RCmManager cmManager; + cmManager.OpenLC(); + cmManager.ReadDefConnL(defConn); + if (defConn.iType == ECmDefConnConnectionMethod) + { + cmManager.GetConnectionMethodInfoIntL(defConn.iId, + CMManager::ECmIapId); + hasDefault = ETrue; + } + else if (defConn.iType == ECmDefConnDestination) + { + RCmDestination dest(cmManager.DestinationL(defConn.iId)); + CleanupClosePushL(dest); + + if (dest.ConnectionMethodCount() <= 0) + { + User::Leave(KErrNotFound); + } + + RCmConnectionMethod cMeth(dest.ConnectionMethodL(0)); + CleanupClosePushL(cMeth); + + cMeth.GetIntAttributeL(CMManager::ECmIapId); + CleanupStack::PopAndDestroy(&cMeth); + CleanupStack::PopAndDestroy(&dest); + hasDefault = ETrue; + } + CleanupStack::PopAndDestroy(&cmManager); + return hasDefault; + } + +// ----------------------------------------------------------------------------- +// CDrmUtilityConnection::HasAccessPointsL +// ----------------------------------------------------------------------------- +// +TBool DRM::CDrmUtilityConnection::HasAccessPointsL() + { + TInt apCount(0); + RCmManager cmManager; + CleanupClosePushL(cmManager); + cmManager.OpenL(); + RArray aps; + CleanupClosePushL(aps); + cmManager.ConnectionMethodL(aps, EFalse, EFalse, ETrue); + apCount = aps.Count(); + CleanupStack::PopAndDestroy(2, &cmManager); //aps, cmManager + return apCount > 0; + } + +// --------------------------------------------------------------------------- +// DRM::CDrmUtilityConnection::NewLC +// --------------------------------------------------------------------------- +// +DRM::CDrmUtilityConnection* DRM::CDrmUtilityConnection::NewLC( + const TBool aAllowQueries) + { + CDrmUtilityConnection* conn = new (ELeave) CDrmUtilityConnection( + aAllowQueries); + CleanupStack::PushL(conn); + conn->ConstructL(); + return conn; + } +// --------------------------------------------------------------------------- +// DRM::CDrmUtilityConnection::NewL +// --------------------------------------------------------------------------- +// +DRM::CDrmUtilityConnection* DRM::CDrmUtilityConnection::NewL( + const TBool aAllowQueries) + { + CDrmUtilityConnection* conn = CDrmUtilityConnection::NewLC(aAllowQueries); + CleanupStack::Pop(conn); + return conn; + } + +// --------------------------------------------------------------------------- +// DRM::CDrmUtilityConnection::~CDrmUtilityConnection +// --------------------------------------------------------------------------- +// +DRM::CDrmUtilityConnection::~CDrmUtilityConnection() + { + Cancel(); + iConnection.Close(); + iSocketServ.Close(); + } + +// --------------------------------------------------------------------------- +// DRM::CDrmUtilityConnection::ConnectL +// --------------------------------------------------------------------------- +// +void DRM::CDrmUtilityConnection::ConnectL(TRequestStatus* aStatus) + { + TInt error(KErrGeneral); + iStatus = KRequestPending; + + if (iState == EInit) + { + + // Make this part atomic by pushing closes on the stack. + error = iSocketServ.Connect(); + if (!error) + { + error = iConnection.Open(iSocketServ); + } + } + + if (iState == EConnected) + { + error=iConnection.Stop(); + //error=iConnection.Stop(RConnection::EStopAuthoritative); //just in case still does not work + // if autoriative stop does not work then must do something following follow + // TNifProgressBuf iJalla; + // loop iConnection.ProgressNotification(iJalla,iStatus,KConnProgressDefault); SetActive + // at RunL if (iJalla.iStage < KConnectionDown) + // reactiveteWaitClose(); + //iConnection.ProgressNotification(iJalla,iStatus,(KConnectionDown); (should loop till state KConnectionDown seen) + iConnection.Close(); + iState = EInit; + error = KErrNone; + error = iConnection.Open(iSocketServ); + } + + iParentStatus = aStatus; + *iParentStatus = KRequestPending; + + CompleteSelf(error); + } + +// --------------------------------------------------------------------------- +// DRM::CDrmUtilityConnection::HasMoreConnectionAttempts +// --------------------------------------------------------------------------- +// +TBool DRM::CDrmUtilityConnection::HasMoreConnectionAttempts() + { + TBool ret(EFalse); + switch (iType) + { + case EUsingPurposeInternet: + if (iAllowQueries) + { + ret = ETrue; + } + else + { + ret = EFalse; + } + break; + case EUsingQuery: + case EFail: + ret = EFalse; + break; + default: + ret = ETrue; + } + return ret; + } + +// --------------------------------------------------------------------------- +// DRM::CDrmUtilityConnection::IsConnected +// --------------------------------------------------------------------------- +// +TBool DRM::CDrmUtilityConnection::IsConnected(TUint32& aIap) + { + TBool ret(EFalse); + + if (iState == EConnected) + { + aIap = iIapId; + ret = ETrue; + } + return ret; + } + +// --------------------------------------------------------------------------- +// DRM::CDrmUtilityConnection::Close +// --------------------------------------------------------------------------- +// +void DRM::CDrmUtilityConnection::Close() + { + //LOGLIT( "CDrmUtilityConnection::Close" ) + + Cancel(); + iConnection.Close(); + iSocketServ.Close(); + iState = EInit; + } + +// --------------------------------------------------------------------------- +// DRM::CDrmUtilityConnection:CDrmUtilityConnection: +// --------------------------------------------------------------------------- +// +DRM::CDrmUtilityConnection::CDrmUtilityConnection(const TBool aAllowQueries) : + CActive(CActive::EPriorityStandard), iState(EInit), + iType(EAttachExisting), iAllowQueries(aAllowQueries) + { + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------------------------- +// DRM::CDrmUtilityConnection::ConstructL +// --------------------------------------------------------------------------- +// +void DRM::CDrmUtilityConnection::ConstructL() + { + } + +// --------------------------------------------------------------------------- +// DRM::CDrmUtilityConnection::DoCancel +// --------------------------------------------------------------------------- +// +void DRM::CDrmUtilityConnection::DoCancel() + { + iConnection.Close(); + iSocketServ.Close(); + CompleteParent(KErrCancel); + } + +// --------------------------------------------------------------------------- +// DRM::CDrmUtilityConnection::RunL +// --------------------------------------------------------------------------- +// +void DRM::CDrmUtilityConnection::RunL() + { + TInt error(iStatus.Int()); + if (iState == EInit) + { + User::LeaveIfError(error); // Handle errors in RunError(). + if (iType == EAttachExisting) + { + AttachExistingConnectionL(); + } + else + { + iState = EConnecting; + error = KErrNotFound; + CompleteSelf(error); + } + } + else if (iState == EConnecting) + { + if (!error) + { + iState = EConnected; + CompleteSelf(error); + } + else if (error != KErrNotFound) + { + User::LeaveIfError(error); + } + else + { + switch (iType) + { + case EAttachExisting: + iType = EUsingDefault; + ConnectUsingDefaultL(); + break; + case EUsingDefault: + iType = EUsingPurposeOperator; + ConnectUsingSnapPurposeL(CMManager::ESnapPurposeOperator); + break; + case EUsingPurposeOperator: + iType = EUsingPurposeInternet; + ConnectUsingSnapPurposeL(CMManager::ESnapPurposeInternet); + break; + case EUsingPurposeInternet: + iType = EUsingQuery; + if (iAllowQueries) + { + ConnectUsingQueryL(); + break; + } + case EUsingQuery: + iType = EFail; + case EFail: + default: + User::Leave(KErrCouldNotConnect); + break; + } + } + } + else if (iState == EConnected) + { + UpdateIapIdL(); + CompleteParent(iStatus.Int()); + } + } + +// --------------------------------------------------------------------------- +// DRM::CDrmUtilityConnection::RunError +// --------------------------------------------------------------------------- +// +TInt DRM::CDrmUtilityConnection::RunError(TInt aError) + { + //LOGLIT( "CDrmUtilityConnection::RunError" ) + + iConnection.Close(); + iSocketServ.Close(); + + CompleteParent(aError); + iState = EInit; + return KErrNone; + } + +// --------------------------------------------------------------------------- +// DRM::CDrmUtilityConnection::AttachExistingConnectionL +// --------------------------------------------------------------------------- +// +void DRM::CDrmUtilityConnection::AttachExistingConnectionL() + { + TConnectionInfoBuf connInfo; + TUint count(0); + TInt error(KErrNotFound); + iStatus = KRequestPending; + + User::LeaveIfError(iConnection.EnumerateConnections(count)); + if (count) + { + // Select AP with largest index. (Latest created) + User::LeaveIfError(iConnection.GetConnectionInfo(count, connInfo)); + User::LeaveIfError(iConnection.Attach(connInfo, + RConnection::EAttachTypeNormal)); + iState = EConnected; + error = KErrNone; + } + else + { + iState = EConnecting; + } + CompleteSelf(error); + } + +// --------------------------------------------------------------------------- +// DRM::CDrmUtilityConnection::ConnectUsingDefaultL +// --------------------------------------------------------------------------- +// +void DRM::CDrmUtilityConnection::ConnectUsingDefaultL() + { + // Create overrides + TConnPrefList prefList; + TExtendedConnPref prefs; + + if (!iAllowQueries) + { + prefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent); + } + else + { + prefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnDisableQueries); + } + + //Fetch default connection + TBool hasDefault(ETrue); + TCmDefConnValue defConn; + RCmManager cmManager; + cmManager.OpenLC(); + cmManager.ReadDefConnL(defConn); + if (defConn.iType == ECmDefConnConnectionMethod) + { + prefs.SetIapId(defConn.iId); + } + else if (defConn.iType == ECmDefConnDestination) + { + prefs.SetSnapId(defConn.iId); + } + else + { + hasDefault = EFalse; + } + // End of fetch default connection + CleanupStack::PopAndDestroy(&cmManager); + if (hasDefault) + { + prefList.AppendL(&prefs); + + // Start an Outgoing Connection with overrides + iState = EConnecting; + iConnection.Start(prefList, iStatus); + SetActive(); + } + else + { + // No default found --> next iteration needed + CompleteSelf(KErrNotFound); + } + } + +// --------------------------------------------------------------------------- +// DRM::CDrmUtilityConnection::ConnectUsingSnapOperatorL +// --------------------------------------------------------------------------- +// +void DRM::CDrmUtilityConnection::ConnectUsingSnapPurposeL( + const TUint32 aPurpose) + { + // Create overrides + TConnPrefList prefList; + TExtendedConnPref prefs; + prefs.SetSnapPurpose(static_cast (aPurpose)); + if (aPurpose != CMManager::ESnapPurposeUnknown) + { + if (!iAllowQueries) + { + prefs.SetNoteBehaviour( + TExtendedConnPref::ENoteBehaviourConnSilent); + } + else + { + prefs.SetNoteBehaviour( + TExtendedConnPref::ENoteBehaviourConnDisableQueries); + } + } + else + { + prefs.SetConnSelectionDialog(ETrue); + prefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourDefault); + prefs.SetForcedRoaming(EFalse); + prefs.SetBearerSet(TExtendedConnPref::EExtendedConnBearerUnknown); + } + prefList.AppendL(&prefs); + iState = EConnecting; + + // Start an Outgoing Connection with overrides + iConnection.Start(prefList, iStatus); + SetActive(); + } + +// --------------------------------------------------------------------------- +// DRM::CDrmUtilityConnection::ConnectUsingQueryL +// --------------------------------------------------------------------------- +// +void DRM::CDrmUtilityConnection::ConnectUsingQueryL() + { + // Create overrides + TConnPrefList prefList; + TExtendedConnPref prefs; + + CCmApplicationSettingsUi* ui(CCmApplicationSettingsUi::NewLC()); + TCmSettingSelection selectedConn; + + TBool selected(ui->RunApplicationSettingsL(selectedConn)); + CleanupStack::PopAndDestroy(ui); + ui=NULL; + if (selected) + { + if (selectedConn.iResult == CMManager::EConnectionMethod) + { + prefs.SetIapId(selectedConn.iId); + } + else if (selectedConn.iResult == CMManager::EDestination) + { + prefs.SetSnapId(selectedConn.iId); + } + else if (selectedConn.iResult != CMManager::EDefaultConnection) + { + selected=EFalse; + } + } + if (selected) + { + if (selectedConn.iResult != CMManager::EDefaultConnection) + { + prefList.AppendL(&prefs); + // For ensuring possibly stale connections get disconnected first; + iConnection.Close(); + iConnection.Open(iSocketServ); + + iConnection.Start(prefList, iStatus); + } + else + { + iConnection.Start(iStatus); + } + SetActive(); + } + else + { + CompleteSelf(KErrCancel); + } + } +// --------------------------------------------------------------------------- +// DRM::CDrmUtilityConnection::CompleteSelf +// --------------------------------------------------------------------------- +// +void DRM::CDrmUtilityConnection::CompleteSelf(TInt aError) + { + TRequestStatus* status(&iStatus); + User::RequestComplete(status, aError); + SetActive(); + } + +// --------------------------------------------------------------------------- +// DRM::CDrmUtilityConnection::CompleteParent +// --------------------------------------------------------------------------- +// +void DRM::CDrmUtilityConnection::CompleteParent(TInt aError) + { + if (iParentStatus) + { + User::RequestComplete(iParentStatus, aError); + iParentStatus = NULL; + } + } + +// --------------------------------------------------------------------------- +// DRM::CDrmUtilityConnection::UpdateIapId +// --------------------------------------------------------------------------- +// +void DRM::CDrmUtilityConnection::UpdateIapIdL() + { + TBuf<16> query; + + query.Format(_L("%s\\%s"), IAP, COMMDB_ID); + User::LeaveIfError(iConnection.GetIntSetting(query, iIapId)); + + } diff -r 493788a4a8a4 -r 3bdc3b853094 commondrm/drmutility/src/drmutilitywmdrmwrapper.cpp --- a/commondrm/drmutility/src/drmutilitywmdrmwrapper.cpp Fri Apr 16 15:14:55 2010 +0300 +++ b/commondrm/drmutility/src/drmutilitywmdrmwrapper.cpp Mon May 03 12:46:34 2010 +0300 @@ -31,15 +31,12 @@ #include // access point utils -#include + #include #include #include #include #include -#ifdef __SERIES60_NATIVE_BROWSER -#include -#endif #include // for WMDRM file details view #include @@ -63,12 +60,6 @@ const TInt KMaxUrlLength( 1024 ); const TInt KMaxUrlSanityLength( 102400 ); -#ifndef __SERIES60_NATIVE_BROWSER -const TUid KCRUidBrowser = {0x10008D39}; -const TUint32 KBrowserDefaultAccessPoint = 0x0000000E; -const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E; -#endif - #ifdef _DEBUG // debug panic _LIT( KWmDrmWrapperDebugPanicMessage, "WmDrmWrapperDebugPanic" ); @@ -797,56 +788,38 @@ // TInt DRM::CDrmUtilityWMDrmWrapper::DefaultAccessPointL() { - const TInt KDestinationSelectionMode( 2 ); - CRepository* repository( NULL ); - TInt ap( 0 ); - TInt alwaysAsk( 0 ); + //Fetch default connection TUint32 iapd32( 0 ); - TInt defaultSnap( 0 ); + TCmDefConnValue defConn; + RCmManager cmManager; + cmManager.OpenLC(); + cmManager.ReadDefConnL(defConn); + if (defConn.iType == ECmDefConnConnectionMethod) + { + iapd32=defConn.iId; + } + else if (defConn.iType == ECmDefConnDestination) + { + RCmDestination dest( cmManager.DestinationL( defConn.iId ) ); + CleanupClosePushL( dest ); - repository = CRepository::NewL( KCRUidBrowser ); - CleanupStack::PushL( repository ); - repository->Get( KBrowserDefaultAccessPoint, ap ); - repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk ); - repository->Get( KBrowserNGDefaultSnapId, defaultSnap ); - CleanupStack::PopAndDestroy( repository ); + if ( dest.ConnectionMethodCount() <= 0 ) + { + User::Leave( KErrNotFound ); + } - if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound ) - { - alwaysAsk = ETrue; + RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) ); + CleanupClosePushL( cMeth ); + + iapd32 = cMeth.GetIntAttributeL( CMManager::ECmIapId ); + CleanupStack::PopAndDestroy( 2, &dest ); //cMeth, dest } else { - RCmManager cmManager; - cmManager.OpenLC(); - if ( !alwaysAsk ) - { - iapd32 = - cmManager.GetConnectionMethodInfoIntL( ap, - CMManager::ECmIapId ); - } - else if ( alwaysAsk == KDestinationSelectionMode ) - { - RCmDestination dest( cmManager.DestinationL( defaultSnap ) ); - CleanupClosePushL( dest ); - - if ( dest.ConnectionMethodCount() <= 0 ) - { - User::Leave( KErrNotFound ); - } - - RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) ); - CleanupClosePushL( cMeth ); - - iapd32 = cMeth.GetIntAttributeL( CMManager::ECmIapId ); - CleanupStack::PopAndDestroy( 2, &dest ); //cMeth, dest - } - CleanupStack::PopAndDestroy( &cmManager ); - } - if ( alwaysAsk && alwaysAsk != KDestinationSelectionMode ) - { User::Leave( KErrAccessDenied ); } + CleanupStack::PopAndDestroy(&cmManager); + // End of fetch default connection return iapd32; } diff -r 493788a4a8a4 -r 3bdc3b853094 commondrm/drmutility/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commondrm/drmutility/traces/OstTraceDefinitions.h Mon May 03 12:46:34 2010 +0300 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 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: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +// #define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r 493788a4a8a4 -r 3bdc3b853094 drm_plat/drm_common_api/tsrc/data/mmc/DRM/content.dcf diff -r 493788a4a8a4 -r 3bdc3b853094 drm_plat/drm_rights_api/tsrc/data/c/content.dcf diff -r 493788a4a8a4 -r 3bdc3b853094 drm_plat/group/bld.inf --- a/drm_plat/group/bld.inf Fri Apr 16 15:14:55 2010 +0300 +++ b/drm_plat/group/bld.inf Mon May 03 12:46:34 2010 +0300 @@ -30,6 +30,7 @@ #include "../drm_agents_api/group/bld.inf" #include "../wmdrm_core_api/group/bld.inf" #include "../wmdrm_access_api/group/bld.inf" +#include "../wmdrm_ota_access_api/group/bld.inf" #if (defined __WINDOWS_MEDIA_DRM) #include "../camese_utility_api/group/bld.inf" diff -r 493788a4a8a4 -r 3bdc3b853094 drm_plat/wmdrm_ota_access_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drm_plat/wmdrm_ota_access_api/group/bld.inf Mon May 03 12:46:34 2010 +0300 @@ -0,0 +1,32 @@ +/* +* 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: +* File that exports the files belonging to WMDRM Ota API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../inc/wmdrmotaaccess.h MW_LAYER_PLATFORM_EXPORT_PATH(wmdrmotaaccess.h) + +../inc/wmdrmotaaccessecominterface.h \ + MW_LAYER_PLATFORM_EXPORT_PATH(wmdrmotaaccessecominterface.h) + +../inc/wmdrmotaaccessecominterface.inl \ + MW_LAYER_PLATFORM_EXPORT_PATH(wmdrmotaaccessecominterface.inl) diff -r 493788a4a8a4 -r 3bdc3b853094 drm_plat/wmdrm_ota_access_api/inc/wmdrmotaaccess.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drm_plat/wmdrm_ota_access_api/inc/wmdrmotaaccess.h Mon May 03 12:46:34 2010 +0300 @@ -0,0 +1,118 @@ +/* +* 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: +* wmdrmotaaccess.h +* +*/ + +#ifndef _WMDRM_OTA_ACCESS_API_H_ +#define _WMDRM_OTA_ACCESS_API_H_ + +// Forward declarations +class CWmDrmOtaAccessEcomInterface; + +// Class declaration +/** +* Provides access to WM DRM Over-the-Air +* Functionality +* +* @code +* // Way to use CWmDrmOtaAccess +* +* CWmDrmOtaAccess* access( CWmDrmOtaAccess::NewL() ); +* delete access; +* @endcode +* +*/ +NONSHARABLE_CLASS( CWmDrmOtaAccess ) : public CBase + { +public: + /** Constructors */ + IMPORT_C static CWmDrmOtaAccess* NewL(); + IMPORT_C static CWmDrmOtaAccess* NewLC(); + + /** Destructor */ + IMPORT_C virtual ~CWmDrmOtaAccess(); + + /** + * GetLicenseChallengeL + * Syncronous method + * + * Get the license challenge that can be sent to the server to fetch + * a license + * + * @param aDrmHeader IN The drm header + * @param aChallenge OUT Resulting Challenge + * @return None + * @leave Symbian OS error codes + */ + IMPORT_C void GetLicenseChallengeL( const TDesC8& aDrmHeader, + HBufC8*& aChallenge ); + + /** + * GetLicenseChallengeL + * Asyncronous method + * + * Get the license challenge that can be sent to the server to fetch + * a license + * + * @param aDrmHeader IN The drm header + * @param aChallenge OUT Resulting Challenge + * @param aStatus OUT Asyncronous request status + * @return None + * @leave Symbian OS error codes + */ + IMPORT_C void GetLicenseChallengeL( const TDesC8& aDrmHeader, + HBufC8*& aChallenge, + TRequestStatus& aStatus ); + + /** + * HandleLicenseResponseL + * Syncronous method + * + * Handle the response received from the server in correspondence + * to the license challenge + * + * @param aResponse IN The license response + * @return None + * @leave Symbian OS error codes + */ + IMPORT_C void HandleLicenseResponseL( const TDesC8& aResponse ); + + /** + * GetLicenseChallengeL + * Asyncronous method + * + * Handle the response received from the server in correspondence + * to the license challenge + * + * @param aResponse IN The license response + * @param aStatus OUT Asyncronous request status + * @return None + * @leave Symbian OS error codes + */ + IMPORT_C void HandleLicenseResponseL( const TDesC8& aResponse, + TRequestStatus& aStatus ); + +private: + /** Default constructor */ + CWmDrmOtaAccess(); + /** Second phase constructor */ + void ConstructL(); + + /** Internal interface to the WM DRM system */ + CWmDrmOtaAccessEcomInterface* iWmDrmOtaAccessEcomInterface; + + }; +#endif // _WMDRM_OTA_ACCESS_API_H_ diff -r 493788a4a8a4 -r 3bdc3b853094 drm_plat/wmdrm_ota_access_api/inc/wmdrmotaaccessecominterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drm_plat/wmdrm_ota_access_api/inc/wmdrmotaaccessecominterface.h Mon May 03 12:46:34 2010 +0300 @@ -0,0 +1,104 @@ +/* +* 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: +* wmdrmotaaccessecominterface.h +* +*/ + +#ifndef _WMDRMOTAACCESSECOMINTERFACE_H_ +#define _WMDRMOTAACCESSECOMINTERFACE_H_ + +#include + +// Class declaration +// CWmDrmAccessEcomInterface +// ecom plugin interface for WM DRM access implementation +// @see CWmDrmAccess +NONSHARABLE_CLASS( CWmDrmOtaAccessEcomInterface ) : public CBase + { +public: + // Constructors + static CWmDrmOtaAccessEcomInterface* NewL(); + static CWmDrmOtaAccessEcomInterface* NewLC(); + + // Destructor + virtual ~CWmDrmOtaAccessEcomInterface(); + + /** + * GetLicenseChallengeL + * Syncronous method + * + * Get the license challenge that can be sent to the server to fetch + * a license + * + * @param aDrmHeader IN The drm header + * @param aChallenge OUT Resulting Challenge + * @return None + * @leave Symbian OS error codes + */ + virtual void GetLicenseChallengeL( const TDesC8& aDrmHeader, + HBufC8*& aChallenge ) = 0; + + /** + * GetLicenseChallengeL + * Asyncronous method + * + * Get the license challenge that can be sent to the server to fetch + * a license + * + * @param aDrmHeader IN The drm header + * @param aChallenge OUT Resulting Challenge + * @param aStatus OUT Asyncronous request status + * @return None + * @leave Symbian OS error codes + */ + virtual void GetLicenseChallengeL( const TDesC8& aDrmHeader, + HBufC8*& aChallenge, + TRequestStatus& aStatus ) = 0; + + /** + * HandleLicenseResponseL + * Syncronous method + * + * Handle the response received from the server in correspondence + * to the license challenge + * + * @param aResponse IN The license response + * @return None + * @leave Symbian OS error codes + */ + virtual void HandleLicenseResponseL( const TDesC8& aResponse ) = 0; + + /** + * GetLicenseChallengeL + * Asyncronous method + * + * Handle the response received from the server in correspondence + * to the license challenge + * + * @param aResponse IN The license response + * @param aStatus OUT Asyncronous request status + * @return None + * @leave Symbian OS error codes + */ + virtual void HandleLicenseResponseL( const TDesC8& aResponse, + TRequestStatus& aStatus ) = 0; + +private: + // internal variable used on freeing ecom related resources + TUid iDtor_ID_Key; + }; + +#include "wmdrmotaaccessecominterface.inl" +#endif _WMDRMOTAACCESSECOMINTERFACE_H_ diff -r 493788a4a8a4 -r 3bdc3b853094 drm_plat/wmdrm_ota_access_api/inc/wmdrmotaaccessecominterface.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drm_plat/wmdrm_ota_access_api/inc/wmdrmotaaccessecominterface.inl Mon May 03 12:46:34 2010 +0300 @@ -0,0 +1,67 @@ +/* +* 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: +* wmdrmotaaccessecominterface.inl +* +*/ + +#include // for interface + +// --------------------------------------------------------------------------- +// CWmDrmOtaAccessEcomInterface::NewL +// --------------------------------------------------------------------------- +// +CWmDrmOtaAccessEcomInterface* CWmDrmOtaAccessEcomInterface::NewL() + { + const TUid KWmdrmOtaAccessEcomInterfaceUid = + { + 0x2002E67D + }; + TAny* theImplementation( NULL ); + + TEComResolverParams resolveParams; + resolveParams.SetWildcardMatch( ETrue ); + + theImplementation = REComSession::CreateImplementationL( + KWmdrmOtaAccessEcomInterfaceUid, + _FOFF( CWmDrmOtaAccessEcomInterface, iDtor_ID_Key ), + resolveParams ); + + return reinterpret_cast( theImplementation ); + } + + +// --------------------------------------------------------------------------- +// CWmDrmOtaAccessEcomInterface::NewLC +// --------------------------------------------------------------------------- +// +CWmDrmOtaAccessEcomInterface* CWmDrmOtaAccessEcomInterface::NewLC() + { + CWmDrmOtaAccessEcomInterface* self( CWmDrmOtaAccessEcomInterface::NewL() ); + + CleanupStack::PushL( self ); + return self; + } + + + +// --------------------------------------------------------------------------- +// CWmDrmOtaAccessEcomInterface::~CWmDrmOtaAccessEcomInterface +// --------------------------------------------------------------------------- +// +CWmDrmOtaAccessEcomInterface::~CWmDrmOtaAccessEcomInterface() + { + REComSession::DestroyedImplementation( iDtor_ID_Key ); + } + diff -r 493788a4a8a4 -r 3bdc3b853094 drm_plat/wmdrm_ota_access_api/wmdrm_ota_access_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drm_plat/wmdrm_ota_access_api/wmdrm_ota_access_api.metaxml Mon May 03 12:46:34 2010 +0300 @@ -0,0 +1,15 @@ + + + WMDRM Ota Access API + Platform API to access WMDRM Ota Interface + c++ + wmdrm + + + + + + no + no + + diff -r 493788a4a8a4 -r 3bdc3b853094 drm_pub/oma_drm_caf_agent_api/tsrc/bc/DRM_CAF/data/content.dcf diff -r 493788a4a8a4 -r 3bdc3b853094 inc/DrmUtilityDmgrWrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/DrmUtilityDmgrWrapper.h Mon May 03 12:46:34 2010 +0300 @@ -0,0 +1,365 @@ +/* +* Copyright (c) 2007-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: +* +*/ + + +#ifndef CDRMUTILITYDMGRWRAPPER_H +#define CDRMUTILITYDMGRWRAPPER_H + +#include // RFs +#include +#include // Roap::MRoapObserver +#include // MAknProgressDialogCallback CAknProgressDialog + + +namespace Roap + { + class CRoapEng; + } + +namespace DRM + { + class CDrmUtilityConnection; + } +class CDRMRights; +class CEikProgressInfo; + + +/** +* Environment gate function +* +* @since S60 v5.0 +* @return pointer to DMgr handler +*/ +IMPORT_C TAny* GateFunctionDMgr(); + +class MDrmUtilityDmgrWrapper + { + +public: + virtual void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ) = 0; + + virtual void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl, + CCoeEnv& aCoeEnv ) = 0; + + virtual HBufC8* GetErrorUrlL() = 0; + + }; + +/** +* Class for downloading ROAP triggers +* +* @lib DrmUtilityDmgrWrapper +* @since S60 v5.0 +*/ +class CDrmUtilityDmgrWrapper : + public CActive, + public MHttpDownloadMgrObserver, + public Roap::MRoapObserver, + public MDrmUtilityDmgrWrapper, + public MProgressDialogCallback + { +private: + + enum TDownloadState + { + EInit, + EGetMeteringTrigger, + ESaveMeteringTrigger, + EMeteringReportSubmit, + EGetPrUrlTrigger, + ESavePrUrlTrigger, + EPrRoapRequest, + EComplete + }; +public: + + static CDrmUtilityDmgrWrapper* NewL(); + + static CDrmUtilityDmgrWrapper* NewLC(); + + virtual ~CDrmUtilityDmgrWrapper(); + + /** + * Download a ROAP trigger from URL and handle it + * + * @param aUrl URL of ROAP trigger + */ + void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ); + + void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl, + CCoeEnv& aCoeEnv ); + + HBufC8* GetErrorUrlL(); + + + // from base class MHttpDownloadMgrObserver + + /** + * From MHttpDownloadMgrObserver. + * Handle download manager events + * + * @param aDownload the download + * @param aEvent the event + */ + void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent ); + +// From Roap::MRoapObserver + /** + * ConnectionConfL + * @return ETrue: the network can be establish + * EFalse: the ROAP transaction is canceled + * + * @leave System wide error code */ + TBool ConnectionConfL(); + + /** + * ContactRiConfL + * @return ETrue: the user consent is achieved + * EFalse: the user consent is not achieved + * + * @leave System wide error code */ + TBool ContactRiConfL(); + + /** + * TransIdConfL + * @return ETrue: the user consent is achieved + * EFalse: the user consent is not achieved + * + * @leave System wide error code */ + + TBool TransIdConfL(); + + /** + * RightsObjectDetailsL + * + * The function is called after successful completion of RO acquisition + * protocol. The passes information about stored rights objects to the + * observer. + * + * @since 3.0 + * @param aRightsList: A list of pointers to rights objects. + * Contents of aRightsList are owend by ROAP engine + * + * @leave System wide error code */ + void RightsObjectDetailsL( const RPointerArray& aRightsList ); + + /** + * ContentDownloadInfoL + * + * The function is called when the ROAP engine notices that it is about to + * receive a multipart content as a ROAP response. The method must return via + * out-parameter the path to a temp folder where the content is saved during + * download. The name that is used as filename when saving the content to + * the appropriate palce and the maximum size of the content (a safety upper limit) + * must also be provided via out-parameters. + * + * @since 3.0 + * @param aTempFolder: (out-param) The path of the temp folder, or KNullDesC + * @param aContentName: (out-param) The name of the content, or KNullDesC (defaut name is used) + * @param aMaxSize: (out-param) The maximum size of the content, or -1 if not known + * + * @leave System wide error code */ + + void ContentDownloadInfoL( TPath& aTempFolder, + TFileName& aContentName, + TInt& aMaxSize ); + + /** + * ContentDetailsL + * + * The function is called when the ROAP engine has received a DCF content (together + * with a ROAP response) The ROAP engine saves the DCF to the appropriate location + * and gives out the information about the saved DCF file by calling this method + * + * @since 3.0 + * @param aPath: The path andf the filename of the saved DCF file + * @param aType: The plain MIME type of the saved DCF file + * @param aAppUid: The handler app UID of the saved DCF file + * + * @leave System wide error code */ + + void ContentDetailsL( const TDesC& aPath, + const TDesC8& aType, + const TUid& aAppUid ); + + /** + * RoapProgressInfoL + * + * The function provides progress information about ROAP processing to the + * observer + * + * @since 3.0 + * @param aProgressInfo: An integer value representing the state of + * ROAP processing, counting in bytes + * + * @leave System wide error code */ + + void RoapProgressInfoL( const TInt aProgressInfo ); + + /** + * ErrorUrlL + * + * The function is called in ROAP error case and it provides an error URL + * for the caller. The calling entity should send an HTTP GET request to + * the URL which should then return an HTML page. + * + * @since 3.0 + * @param aErrorUrl: The error URL + * + * + * @leave System wide error code */ + + void ErrorUrlL( const TDesC8& aErrorUrl ); + + /** + * PostResponseUrlL + * + * The function is called if handled ROAP metering report response + * contains PostResponseURL extension. The calling entity should send + * an HTTP GET request to the URL, which should return ROAP trigger, + * download descriptor or multipart message containing both + * download descriptor and ROAP trigger. + * + * @since 3.2 + * @param aPostResponseUrl: The URL to be fetched + * after handling ROAP metering response + * with PostResponseURL extension. + * + * + * @leave System wide error code */ + void PostResponseUrlL( const TDesC8& aPostResponseUrl ); + +public: // Call back methods of MAknProgressDialogCallback + + /** + * ProgressDialog call back method. + * Get's called when a dialog is dismissed. + * + * @param aButtonId ID of the button pressed + */ + void DialogDismissedL( TInt aButtonId ); + +protected: + //from Cactive + virtual void DoCancel(); + + virtual void RunL(); + + virtual TInt RunError( TInt aError ); +private: + + /** + * C++ default constructor. + */ + CDrmUtilityDmgrWrapper(); + + void ConstructL(); + + /** + * Set the browser default access point to be used + */ + + + void ShowProgressNoteL( ); + + void RemoveProgressNoteL( ); + + void DoConnectL( TDownloadState aNextState ); + + void DoDownloadRoapTriggerL( TDownloadState aNextState ); + + void DoSaveRoapTriggerL( TDownloadState aNextState ); + + void DoHandleRoapTriggerL( TDownloadState aNextState ); + + void CompleteToState( TDownloadState aNextState, TInt aError ); + +private: // data + + /** + * Download manager session + */ + RHttpDownloadMgr iDlMgr; + + /** + * Used to make downloads synchronous + */ + CActiveSchedulerWait iWait; + + /** + * to store information on download + */ + TBool iDownloadSuccess; + TBool iConnectionError; + + /** + * trigger URL + */ + HBufC8* iTriggerUrl; + + /** + * trigger buffer + */ + HBufC8* iTriggerBuf; + + TBool iDialogDismissed; + + /** + * Progess note dialog and progress info + */ + CAknProgressDialog* iProgressNoteDialog; // owned + CEikProgressInfo* iProgressInfo; // not owned + TInt iCurrentProgressValue; // owned + TInt iProgressIncrement; // owned + + /** + * Control environment + */ + CCoeEnv* iCoeEnv; + + /** + * Is CoeEnv given + */ + TBool iUseCoeEnv; + + /** + * Error url for ROAP temporary error + */ + HBufC8* iErrorUrl; + + /** + * Post response url for ROAP prUrl + */ + HBufC8* iPostResponseUrl; + + /** + * IAP (from ROAP or from UI) + */ + TUint32 iIapId; + + TDownloadState iState; + + Roap::CRoapEng* iRoapEng; + + RFs iFs; + + HBufC* iFileName; + + DRM::CDrmUtilityConnection* iConnection; + }; + +#endif // CDRMUTILITYDMGRWRAPPER_H diff -r 493788a4a8a4 -r 3bdc3b853094 inc/buffercontainers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/buffercontainers.h Mon May 03 12:46:34 2010 +0300 @@ -0,0 +1,53 @@ +/* +* 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: CBase derived container classes for easening +* dynamic memory allocation of TBuf type variables +* (TName etc.) +*/ +#ifndef BUFFERCONTAINERS_H +#define BUFFERCONTAINERS_H + +#include +namespace DRM +{ +template +NONSHARABLE_CLASS( CBufferContainer ): public CBase + { + // Note, this class is not intendend to be part of any API + public: + inline static CBufferContainer* NewL(); + inline static CBufferContainer* NewLC(); + + inline virtual ~CBufferContainer(); + private: + inline CBufferContainer(); + + //data + public: + // Contained TBuf member + T iBuffer; + }; + +//Containers for some TBuf based types defined at e32cmn.h +typedef CBufferContainer CNameContainer; +typedef CBufferContainer CFullNameContainer; +typedef CBufferContainer CExitCategoryNameContainer; +typedef CBufferContainer CFileNameContainer; +typedef CBufferContainer CPathContainer; +typedef CBufferContainer CVersionNameContainer; +typedef CBufferContainer CUidNameContainer; +} + +#include "buffercontainers.inl" +#endif // BUFFERCONTAINERS_H diff -r 493788a4a8a4 -r 3bdc3b853094 inc/buffercontainers.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/buffercontainers.inl Mon May 03 12:46:34 2010 +0300 @@ -0,0 +1,61 @@ +/* +* 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: +* +*/ +#ifndef BUFFERCONTAINERS_INL +#define BUFFERCONTAINERS_INL + +// --------------------------------------------------------------------------- +// DRM::CBufferContainer::NewL +// --------------------------------------------------------------------------- +// +template +inline DRM::CBufferContainer* DRM::CBufferContainer::NewL() +{ + CBufferContainer* self( CBufferContainer::NewLC() ); + CleanupStack::Pop( self ); + return self; +} + +// --------------------------------------------------------------------------- +// DRM::CBufferContainer::NewLC +// --------------------------------------------------------------------------- +// +template +inline DRM::CBufferContainer* DRM::CBufferContainer::NewLC() +{ + CBufferContainer* self( new (ELeave) CBufferContainer() ); + CleanupStack::PushL( self ); + return self; +} + +// --------------------------------------------------------------------------- +// DRM::CBufferContainer::CBufferContainer +// --------------------------------------------------------------------------- +// +template +inline DRM::CBufferContainer::CBufferContainer() +{} + +// --------------------------------------------------------------------------- +// DRM::CBufferContainer::~CBufferContainer +// --------------------------------------------------------------------------- +// +template +inline DRM::CBufferContainer::~CBufferContainer() +{} + + +#endif // BUFFERCONTAINERS_INL diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmengine/drmclock/Src/DRMClockClient.cpp --- a/omadrm/drmengine/drmclock/Src/DRMClockClient.cpp Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,174 +0,0 @@ -/* -* Copyright (c) 2003 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: Client side class implementation -* -*/ - - -// INCLUDE FILES -#include "DRMClockClient.h" -#include "DRMClientServer.h" - -#include "DRMLog.h" - -// EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES - -// CONSTANTS -// MACROS - -// LOCAL CONSTANTS AND MACROS -// To initialize C/S parameters. -#define PARAMS TAny* params[ KMaxMessageArguments ]; \ -for ( TUint8 i = 0; i < KMaxMessageArguments; ++i ) { params[ i ] = NULL; } -#define CLEARPARAM Mem::FillZ( params, \ -KMaxMessageArguments * sizeof( TAny* ) ); - -// Maximum number of message slots that we use -const TInt KMaxMessageSlots = 3; - - -// MODULE DATA STRUCTURES -// LOCAL FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -// ============================= LOCAL FUNCTIONS =============================== - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// RDRMClockClient::RDRMClockClient -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -EXPORT_C RDRMClockClient::RDRMClockClient() - { - } - -// ----------------------------------------------------------------------------- -// RDRMClockClient::~RDRMClockClient -// Destructor. -// ----------------------------------------------------------------------------- -// -EXPORT_C RDRMClockClient::~RDRMClockClient() - { - } - -// ----------------------------------------------------------------------------- -// RDRMClockClient::Connect -// Opens connection to the server. -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMClockClient::Connect() - { - TInt ret = KErrNone; - - DRMLOG( _L( "RDRMClockClient::Connect" ) ); - - const TVersion requiredVersion( - DRMClock::KServerMajorVersion, - DRMClock::KServerMinorVersion, - DRMClock::KServerBuildVersion ); - - DRMLOG( _L("RDRMClockClient: Create a new session" ) ); - ret = CreateSession( DRMClock::KDRMServerName, - requiredVersion, - KMaxMessageSlots ); - - DRMLOG2( _L( "Result: %d") , ret ); - - return ret; - } - -// ----------------------------------------------------------------------------- -// RDRMClockClient::Close -// Closes the connection to the server. -// ----------------------------------------------------------------------------- -// -EXPORT_C void RDRMClockClient::Close() - { - DRMLOG( _L( "RDRMClockClient::Close" ) ); - - RHandleBase::Close(); - } - -// ----------------------------------------------------------------------------- -// RDRMClockClient::GetSecureTime -// Gets the secure time from the DRMClockServer -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMClockClient::GetSecureTime( TTime& aTime, TInt& aTimeZone, - DRMClock::ESecurityLevel& aSecurityLevel ) - { - TPckg package(aTime); - TPckg package2(aTimeZone); - TPckg package3(aSecurityLevel); - - DRMLOG( _L( "RDRMClockClient::GetSecureTime" ) ); - TInt error = KErrNone; - - // For C/S communications. - PARAMS; - - // Set the parameters. - params[ 0 ] = reinterpret_cast< TAny* >( &package ); - params[ 1 ] = reinterpret_cast< TAny* >( &package2 ); - params[ 2 ] = reinterpret_cast< TAny* >( &package3 ); - - // Send the message. - error = SendReceive( DRMClock::EGetDRMTime, params ); - - // Reset - CLEARPARAM; - - DRMLOG2( _L( "RDRMClockClient::GetSecureTime: %d" ), error ); - - return error; - } - - -// ----------------------------------------------------------------------------- -// RDRMClockClient::UpdateSecureTime -// Updates the secure time on the DRMClockServer -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMClockClient::UpdateSecureTime( const TTime& aTime, const TInt& aTimeZone ) - { - TInt error = KErrNone; - TPckg package(aTime); - TPckg package2(aTimeZone); - - DRMLOG( _L( "RDRMClockClient::UpdateSecureTime" ) ); - - // For C/S communications. - PARAMS; - - params[ 0 ] = reinterpret_cast< TAny* >( &package ); - params[ 1 ] = reinterpret_cast< TAny* >( &package2 ); - - error = SendReceive( DRMClock::EUpdateDRMTime, params ); - - CLEARPARAM; - - DRMLOG2( _L( "RDRMClockClient::UpdateSecureTime: " ), error ); - - // All done. - return error; - } - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// End of File diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmengine/group/CryptoPrep.flm --- a/omadrm/drmengine/group/CryptoPrep.flm Fri Apr 16 15:14:55 2010 +0300 +++ b/omadrm/drmengine/group/CryptoPrep.flm Mon May 03 12:46:34 2010 +0300 @@ -1,4 +1,4 @@ -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available # under the terms of the License "Eclipse Public License v1.0" @@ -21,6 +21,11 @@ crypto_files:=$(wildcard $(EXTENSION_ROOT)/../drmengine/drmcrypto/CMLA/*.cpp) + +GUARD:=done_$(call sanitise,$(CLEANTARGETS)) +ifeq ($($(GUARD)),) +$(GUARD):=1 + BITMAP :: $(CREATABLEPATH) ifeq ($(crypto_files),) @@ -29,6 +34,8 @@ $(GNUCP) $(CREATABLEPATH)/../CMLA/CmlaCrypto.cpp $(CREATABLEPATH)/cmlacrypto.cpp endif $(GNUCP) $(CREATABLEPATH)/../src/OmaCrypto.cpp $(CREATABLEPATH)/omacrypto.cpp + $(GNUCHMOD) u+w $(CREATABLEPATH)/cmlacrypto.cpp + $(GNUCHMOD) u+w $(CREATABLEPATH)/omacrypto.cpp # Create dirs $(call makepath,$(CREATABLEPATH)) @@ -36,3 +43,11 @@ ## Clean up $(eval $(call GenerateStandardCleanTarget,$(CLEANTARGETS))) +## What +$(eval $(call whatmacro,$(CLEANTARGETS))) + + +else +$(info $(PLATFORM) $(CFG), up-to-date $(CLEANTARGETS)) + +endif diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmengine/group/ROAPHandler.mmp --- a/omadrm/drmengine/group/ROAPHandler.mmp Fri Apr 16 15:14:55 2010 +0300 +++ b/omadrm/drmengine/group/ROAPHandler.mmp Mon May 03 12:46:34 2010 +0300 @@ -113,8 +113,9 @@ LIBRARY DcfRep.lib LIBRARY caf.lib // Embedding domain ROs LIBRARY cafutils.lib // Embedding domain ROs -LIBRARY centralrepository.lib // Browser default AP +LIBRARY centralrepository.lib // CRepository LIBRARY cmmanager.lib +LIBRARY extendedconnpref.lib netmeta.lib // TExtendedConnPref LIBRARY SysUtil.lib LIBRARY HttpFilterCommon.lib diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmengine/keystorage/src/DrmStdKeyStorage.cpp --- a/omadrm/drmengine/keystorage/src/DrmStdKeyStorage.cpp Fri Apr 16 15:14:55 2010 +0300 +++ b/omadrm/drmengine/keystorage/src/DrmStdKeyStorage.cpp Mon May 03 12:46:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002-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" @@ -211,7 +211,7 @@ iFileMan = CFileMan::NewL(iFs); #ifdef __DRM_OMA2 - SelectDefaultRootL(); + TRAP_IGNORE( SelectDefaultRootL() ); // Allow startup anyway. #endif iDeviceSpecificKey.Copy(KDefaultKey); diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmengine/roap/inc/RoapConnection.h --- a/omadrm/drmengine/roap/inc/RoapConnection.h Fri Apr 16 15:14:55 2010 +0300 +++ b/omadrm/drmengine/roap/inc/RoapConnection.h Mon May 03 12:46:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002-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" @@ -23,7 +23,6 @@ #include #include -#include namespace Roap { @@ -86,7 +85,6 @@ RConnection iConnection; TState iState; TRequestStatus* iParentStatus; - TCommDbConnPref iConnPref; }; } diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmengine/roap/src/RoapConnection.cpp --- a/omadrm/drmengine/roap/src/RoapConnection.cpp Fri Apr 16 15:14:55 2010 +0300 +++ b/omadrm/drmengine/roap/src/RoapConnection.cpp Mon May 03 12:46:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002-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" @@ -22,54 +22,16 @@ #include #include #include -#include +#include #include +#include // IAP, COMMDB_ID #include -#ifdef __SERIES60_NATIVE_BROWSER -#include -#endif #include "RoapConnection.h" #include "RoapDef.h" #include "RoapLog.h" -#ifndef __SERIES60_NATIVE_BROWSER - const TUid KCRUidBrowser = {0x10008D39}; - const TUint32 KBrowserDefaultAccessPoint = 0x0000000E; - const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E; - const TUint32 KBrowserNGDefaultSnapId = 0x00000053; -#endif - - -// ================= LOCAL FUNCTIONS ========================================= -// --------------------------------------------------------------------------- -// IapIdOfDefaultSnapL -// for trapping purposes only -// --------------------------------------------------------------------------- -// -LOCAL_C TUint32 IapIdOfDefaultSnapL( - RCmManager& aCmManager, - const TUint32 aDefaultSnap ) - { - RCmDestination dest( aCmManager.DestinationL( aDefaultSnap ) ); - CleanupClosePushL( dest ); - TUint32 iapIdOfDest( 0 ); - - if ( dest.ConnectionMethodCount() <= 0 ) - { - User::Leave( KErrNotFound ); - } - - RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) ); - CleanupClosePushL( cMeth ); - - iapIdOfDest = cMeth.GetIntAttributeL( CMManager::ECmIapId ); - CleanupStack::PopAndDestroy( &cMeth ); - CleanupStack::PopAndDestroy( &dest ); - return iapIdOfDest; - } - // ================= MEMBER FUNCTIONS ======================= // --------------------------------------------------------------------------- @@ -104,8 +66,6 @@ ( TUint32 aIap, TRequestStatus* aStatus ) { LOGLIT( "CRoapConnection::ConnectL" ) - const TInt KAlwaysAskSelectionMode( 1 ); - const TInt KDestinationSelectionMode( 2 ); if ( iState == EInit ) { @@ -120,11 +80,9 @@ CleanupClosePushL( iConnection ); TConnectionInfoBuf connInfo; - TInt ap = 0; - TInt alwaysAsk = 0; - TUint count; + TUint count(0); User::LeaveIfError( iConnection.EnumerateConnections( count ) ); - TUint i; + TUint i(0); if ( count ) { // Select from existing connections. Try to make AP match. @@ -152,71 +110,44 @@ else { // No existing connections, create new one. -#ifdef __WINS__ - // WINS connection creation does not work if preferences are given. - // Defaults are to be used always. - iConnection.Start( iStatus ); -#else - // Note: the TCommDbConnPref must NOT be stack variable. - // It must persist until completion of RConnection::Start(). - iConnPref.SetDirection( ECommDbConnectionDirectionOutgoing ); - //iConnPref.SetDialogPreference( ECommDbDialogPrefWarn ) - iConnPref.SetBearerSet( ECommDbBearerCSD | ECommDbBearerWcdma ); - // New connection is always created with user-selected AP - // so 0 is used instead of aIap. + // Create overrides + TConnPrefList prefList; + TExtendedConnPref prefs; + + prefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent); - TInt defaultSnap( 0 ); - CRepository* repository( NULL ); - repository = CRepository::NewL( KCRUidBrowser ); - CleanupStack::PushL( repository ); - - repository->Get( KBrowserDefaultAccessPoint, ap); - repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk ); - repository->Get( KBrowserNGDefaultSnapId, defaultSnap ); - CleanupStack::PopAndDestroy( repository ); - repository = NULL; - - TUint32 iapd32 = 0; - TInt err = KErrNone; - - if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound ) + //Fetch default connection + TBool hasDefault(ETrue); + TCmDefConnValue defConn; + RCmManager cmManager; + cmManager.OpenLC(); + cmManager.ReadDefConnL(defConn); + if (defConn.iType == ECmDefConnConnectionMethod) { - alwaysAsk = KAlwaysAskSelectionMode; + prefs.SetIapId(defConn.iId); + } + else if (defConn.iType == ECmDefConnDestination) + { + prefs.SetSnapId(defConn.iId); } else { - RCmManager cmManager; - cmManager.OpenLC(); - if ( !alwaysAsk ) - { - TRAP( err, iapd32 = cmManager.GetConnectionMethodInfoIntL( - ap, CMManager::ECmIapId ) ); - } - else if ( alwaysAsk == KDestinationSelectionMode ) - { - TRAP( err, iapd32 = IapIdOfDefaultSnapL( - cmManager, defaultSnap ) ); - } - CleanupStack::PopAndDestroy( &cmManager ); + hasDefault = EFalse; } - - if ( err || alwaysAsk == KAlwaysAskSelectionMode ) + // End of fetch default connection + if (hasDefault) { - // Always ask - LOGLIT( "SetDialogPreference( ECommDbDialogPrefPrompt )" ) - iConnPref.SetDialogPreference( ECommDbDialogPrefPrompt ); - iapd32 = 0; + prefList.AppendL(&prefs); + + // Start an Outgoing Connection with overrides + iConnection.Start(prefList, iStatus); } else { - // User defined - LOGLIT( "SetDialogPreference( ECommDbDialogPrefDoNotPrompt )" ) - iConnPref.SetDialogPreference( ECommDbDialogPrefDoNotPrompt ); + // No default found --> trying with query + iConnection.Start(iStatus); } - - iConnPref.SetIapId( iapd32 ); - iConnection.Start( iConnPref, iStatus ); -#endif + CleanupStack::PopAndDestroy(&cmManager); iState = EConnecting; SetActive(); // The only path with a real async request. } diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmengine/roap/src/RoapEng.cpp --- a/omadrm/drmengine/roap/src/RoapEng.cpp Fri Apr 16 15:14:55 2010 +0300 +++ b/omadrm/drmengine/roap/src/RoapEng.cpp Mon May 03 12:46:34 2010 +0300 @@ -80,6 +80,7 @@ #include "DcfEntry.h" #include "Base64.h" #include "drmsettingsplugininternalcrkeys.h" +#include "buffercontainers.h" #define STUB_C_CLASS_IN_NAMESPACE( n, c ) namespace n { class c: public CBase { private: c(); public: virtual ~c(); }; } n::c::c() {} n::c::~c() {} @@ -2162,7 +2163,7 @@ #ifndef __WINS__ TInt numPhone = 0; TUint32 caps = 0; - TName tsyName; + DRM::CNameContainer* tsyName(NULL); RMobilePhone phone; RTelServer etelServer; RTelServer::TPhoneInfo phoneInfo; @@ -2173,18 +2174,20 @@ CleanupClosePushL( etelServer ); User::LeaveIfError( etelServer.LoadPhoneModule( KMmTsyModuleName ) ); - User::LeaveIfError( etelServer.EnumeratePhones( numPhone) ); + User::LeaveIfError( etelServer.EnumeratePhones( numPhone ) ); + tsyName = DRM::CNameContainer::NewLC(); for (TInt i(0); i < numPhone; i++) { User::LeaveIfError( etelServer.GetPhoneInfo( i, phoneInfo ) ); - User::LeaveIfError( etelServer.GetTsyName( i,tsyName ) ); + User::LeaveIfError( etelServer.GetTsyName( i,tsyName->iBuffer ) ); - if ( tsyName.CompareF( KMmTsyModuleName ) == 0) + if ( !tsyName->iBuffer.CompareF( KMmTsyModuleName ) ) { break; } } + CleanupStack::PopAndDestroy( tsyName ); User::LeaveIfError( phone.Open( etelServer, phoneInfo.iName ) ); CleanupClosePushL( phone ); diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmengine/roap/src/RoapHttpHandler.cpp --- a/omadrm/drmengine/roap/src/RoapHttpHandler.cpp Fri Apr 16 15:14:55 2010 +0300 +++ b/omadrm/drmengine/roap/src/RoapHttpHandler.cpp Mon May 03 12:46:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002-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" @@ -21,15 +21,19 @@ #include #include +//#include +//#include +//#include +#include + #include "RoapHttpHandler.h" +#include "RoapConnection.h" +#include "RoapResponse.h" #include "RoapObserver.h" #include "RoapDef.h" #include "RoapLog.h" -//#include -//#include -//#include -#include +#include "buffercontainers.h" using namespace Roap; @@ -39,12 +43,8 @@ // The time out value in HTTP, 30 sec LOCAL_D const TInt KRoapTimeoutValue = 60000000; -_LIT8( KTestUserName, "iopvf" ); -_LIT8( KTestPassword, "r72005" ); -/* -_LIT8( KTestUserName, "moria" ); -_LIT8( KTestPassword, "mellon" ); -*/ +_LIT8( KTestUserName, "" ); +_LIT8( KTestPassword, "" ); // ================= MEMBER FUNCTIONS ======================= @@ -564,6 +564,7 @@ { LOG( _L("HTTP event ERedirectRequiresConfirmation received") ); iTransaction.SubmitL(); + break; } default: @@ -641,13 +642,13 @@ if ( iResponse->iDataType == TDataType( KMultipartRelatedType ) ) { - TPath tempPath; - TFileName fileName; + DRM::CPathContainer* tempPath( DRM::CPathContainer::NewLC() ); + DRM::CFileNameContainer* fileName( DRM::CFileNameContainer::NewLC() ); TInt maxSize( 0 ); if ( iObserver ) { - iObserver->ContentDownloadInfoL( tempPath, fileName, maxSize ); + iObserver->ContentDownloadInfoL( tempPath->iBuffer, fileName->iBuffer, maxSize ); } boundaryStr = srtPool.StringF( HttpFilterCommonStringsExt::EBoundary, @@ -666,8 +667,10 @@ LOG( _L("Error: multipart boundary missing") ); User::Leave( KErrRoapGeneral ); } - iResponse->SetDcfPathL( tempPath ); - iResponse->SetContentNameL( fileName ); + iResponse->SetDcfPathL( tempPath->iBuffer ); + iResponse->SetContentNameL( fileName->iBuffer ); + CleanupStack::PopAndDestroy( fileName ); + CleanupStack::PopAndDestroy( tempPath ); iReportBytes = ETrue; if ( iObserver ) diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmengine/roapstorage/inc/RoapStorageSession.h --- a/omadrm/drmengine/roapstorage/inc/RoapStorageSession.h Fri Apr 16 15:14:55 2010 +0300 +++ b/omadrm/drmengine/roapstorage/inc/RoapStorageSession.h Mon May 03 12:46:34 2010 +0300 @@ -157,8 +157,7 @@ void UpdateDrmTimeL( const RMessage2& aMessage ); - void - CRoapStorageSession::VerifyOcspResponsesL( const RMessage2& aMessage ); + void VerifyOcspResponsesL( const RMessage2& aMessage ); void GetOcspResponderIdL( const RMessage2& aMessage ); diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmengine/server/inc/DRMActiveDeletion.h --- a/omadrm/drmengine/server/inc/DRMActiveDeletion.h Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +0,0 @@ -/* -* Copyright (c) 2005 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: Active object handling "Delete Expired Permission" -* -*/ - - -#ifndef DRMACTIVEDELETION_H -#define DRMACTIVEDELETION_H - -// INCLUDES - -#include - -// CONSTANTS - -// MACROS - -// DATA TYPES - -// FORWARD DECLARATIONS -class CDRMRightsDB; -class CDRMDbSession; - -// FUNCTION PROTOTYPES - -// CLASS DECLARATION - -/** -* CDRMActiveDeletion implements expired rights cleanup callback -* for drm rights database -* -* @lib RightsServer.exe -* @since 3.0 -*/ -NONSHARABLE_CLASS( CDRMActiveDeletion ) : public CActive - { - public: // Constructors and destructor - - /** - * NewL - * - * Creates an instance of the CDRMRightCleaner class and returns a pointer - * to it - * - * @since 3.0 - * @param aFs : Open file server session - * @param aDatabase : CDRMRightsDB object - * @param aStatus : The request status to complete when the operation is - * fully done - * @param aDatabasePath : full pathname of the database path - * @param aTime : Time to check expiration against - * - * @return Functional CDRMActiveDeletion object, Function leaves if an error - * occurs. - */ - static CDRMActiveDeletion* NewLC( const RMessagePtr2& aMessage, - CDRMDbSession& aSession ); - - /** - * Destructor - */ - virtual ~CDRMActiveDeletion(); - - public: // New functions - - /** - * ActivateL - * - * Activates the object by adding it to scheduler etc. - * - * @since 3.0 - * @return None - * - */ - void ActivateL( const TTime& aSecureTime, - CDRMRightsDB& aDb ); - - protected: - - /** - * Default Constructor - First phase. - */ - CDRMActiveDeletion( const RMessagePtr2& aMessage, - CDRMDbSession& aSession ); - - /** - * From CActive: RunL. - */ - void RunL(); - - /** - * From CActive: DoCancel performs cancel - */ - void DoCancel(); - - /** - * From CActive: RunError checks the errors from RunL. - */ - // void RunError(); - - private: - /** - * Default Constructor - First phase. Prevented. - */ - CDRMActiveDeletion(); - - /** - * Assignment operator - Prevented - */ - CDRMActiveDeletion& operator =( const CDRMActiveDeletion& ); - - /** - * Copy constructor - Prevented - */ - CDRMActiveDeletion( const CDRMActiveDeletion& ); - - private: - // The message. - const RMessagePtr2& iMessage; - CDRMDbSession& iSession; - - // The instane doing the deletion. - CActive* iActiveOperation; - }; - -#endif // DRMACTIVEDELETION_H - -// End of File diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmengine/server/inc/DRMPointerArray.h --- a/omadrm/drmengine/server/inc/DRMPointerArray.h Fri Apr 16 15:14:55 2010 +0300 +++ b/omadrm/drmengine/server/inc/DRMPointerArray.h Mon May 03 12:46:34 2010 +0300 @@ -39,7 +39,7 @@ TBool iDoResetAndDestroy; }; -template < class T > NONSHARABLE_CLASS( CDRMPointerArray ) : public CBase, public RDRMPointerArray< class T > +template < class T > NONSHARABLE_CLASS( CDRMPointerArray ) : public CBase, public RDRMPointerArray< T > { public: static CDRMPointerArray* NewLC( TInt aGranularity ); diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmengine/server/src/DRMActiveDeletion.cpp --- a/omadrm/drmengine/server/src/DRMActiveDeletion.cpp Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -/* -* Copyright (c) 2003 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 parent storage for Decision Making Machine -* -*/ - - -// INCLUDE FILES -#include "drmactivedeletion.h" -#include "drmrightsdb.h" -#include "drmrightscleaner.h" -#include "drmdbsession.h" - -// EXTERNAL DATA STRUCTURES - -// EXTERNAL FUNCTION PROTOTYPES - -// CONSTANTS - -// MACROS - -// LOCAL CONSTANTS AND MACROS - -// MODULE DATA STRUCTURES - -// LOCAL FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - - -// ============================= LOCAL FUNCTIONS =============================== - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CDRMActiveDeletion::NewLC -// -// Two-phase constructor. -// ----------------------------------------------------------------------------- -// -CDRMActiveDeletion* CDRMActiveDeletion::NewLC( const RMessagePtr2& aMessage, - CDRMDbSession& aSession ) - { - CDRMActiveDeletion* self = new( ELeave ) CDRMActiveDeletion( aMessage, - aSession ); - CleanupStack::PushL( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CDRMActiveDeletion::~CDRMActiveDeletion -// -// Destructor. -// ----------------------------------------------------------------------------- -// -CDRMActiveDeletion::~CDRMActiveDeletion() - { - if ( iActiveOperation ) - { - // Construction was successful, but - // something has went wrong. - - iActiveOperation->Cancel(); - iMessage.Complete( KErrCancel ); - } - } - -// ----------------------------------------------------------------------------- -// CDRMActiveDeletion::ActivateL -// -// Activate the thing by issuing a request to the DB and executing it also. -// ----------------------------------------------------------------------------- -// -void CDRMActiveDeletion::ActivateL( const TTime& aTime, - CDRMRightsDB& aDb ) - { - CActiveScheduler::Add( this ); - - CDRMRightsCleaner* cleaner = - aDb.DeleteExpiredPermissionsL( aTime, iStatus ); - CleanupStack::PushL( cleaner ); - cleaner->ExecuteCleanupLD(); - CleanupStack::Pop(); - - SetActive(); - iActiveOperation = cleaner; - } - -// ----------------------------------------------------------------------------- -// CDRMActiveDeletion::RunL -// -// Handles the completition of the request. -// ----------------------------------------------------------------------------- -// -void CDRMActiveDeletion::RunL() - { - // All done. - iMessage.Complete( iStatus.Int() ); - - // iActiveOperation deletes itself. - iActiveOperation = NULL; - - Deque(); - - iSession.AsyncOperationDone(); - } - -// ----------------------------------------------------------------------------- -// CDRMActiveDeletion::DoCancel -// -// Cancels the operation. -// ----------------------------------------------------------------------------- -// -void CDRMActiveDeletion::DoCancel() - { - iActiveOperation->Cancel(); - iActiveOperation = NULL; - } - -// ----------------------------------------------------------------------------- -// CDRMActiveDeletion::CDRMActiveDeletion -// -// Constructor. -// ----------------------------------------------------------------------------- -// -CDRMActiveDeletion::CDRMActiveDeletion( const RMessagePtr2& aMessage, - CDRMDbSession& aSession ): -CActive( EPriorityLow ), -iMessage( aMessage ), -iSession( aSession ) - { - // Nothing - } - -// End of file diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmengine/server/src/DRMRightsClientStub.cpp --- a/omadrm/drmengine/server/src/DRMRightsClientStub.cpp Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,253 +0,0 @@ -/* -* Copyright (c) 2003 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: Client side class implementation -* -*/ - - -// INCLUDE FILES -#include -#include "DRMRightsClient.h" -#include "DRMClientServer.h" -#ifdef _DRM_TESTING -#include "logfile.h" -#endif - -// EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES -#ifdef CLIENT_STARTS_SERVER -extern TInt DRMServerStarter(); -#endif - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// RDRMRightsClient::RDRMRightsClient -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -EXPORT_C RDRMRightsClient::RDRMRightsClient() : - iPtr( NULL ) - { - } - -// ----------------------------------------------------------------------------- -// RDRMRightsClient::~RDRMRightsClient -// Destructor. -// ----------------------------------------------------------------------------- -// -EXPORT_C RDRMRightsClient::~RDRMRightsClient() - { - } - -// ----------------------------------------------------------------------------- -// RDRMRightsClient::Connect -// Opens connection to the server. -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMRightsClient::Connect() - { - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// RDRMRightsClient::Close -// Closes the connection to the server. -// ----------------------------------------------------------------------------- -// -EXPORT_C void RDRMRightsClient::Close() - { - } - -// ----------------------------------------------------------------------------- -// RDRMRightsClient::AddRecord -// Add a new entry to the rights database. -// ----------------------------------------------------------------------------- -// -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 - TDRMUniqueID& aID ) // Unique ID, out-parameter - { - return KErrNone; - } - - -// ----------------------------------------------------------------------------- -// RDRMRightsClient::GetDBEntriesL -// Get a file name from the server. The file contains the rights objects, -// which are then converted to RPointerArray. -// ----------------------------------------------------------------------------- -// -EXPORT_C void RDRMRightsClient::GetDBEntriesL( const TDesC8& aId, - RPointerArray< CDRMPermission >& aRightsList ) - { - } - -// ----------------------------------------------------------------------------- -// RDRMRightsClient::GetDbEntryL -// Get a single RO from the server. -// ----------------------------------------------------------------------------- -// -EXPORT_C CDRMPermission* RDRMRightsClient::GetDbEntryL( const TDesC8& aContentID, - const TDRMUniqueID& aUniqueID ) - { - CDRMPermission* object = new (ELeave) CDRMPermission; - object->iUniqueID = aUniqueID; - return object; - } - -// ----------------------------------------------------------------------------- -// RDRMRightsClient::DeleteDbEntry -// Deletes all rights objects associated with the given UID. -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMRightsClient::DeleteDbEntry( const TDesC8& aContentID ) - { - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// RDRMRightsClient::DeleteDbEntry -// Delete a single rights object identified by given parameters. -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMRightsClient::DeleteDbEntry( const TDesC8& aContentID, - const TDRMUniqueID& aUniqueID ) - { - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// RDRMRightsClient::ExportContentIDList -// 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. -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMRightsClient::ExportContentIDList( TDes& aFileName ) - { - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// RDRMRightsClient::ExportContentIDList -// Overloaded method: requests all content IDs to be put to a file, -// and then converts the file into RPointerArray. -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMRightsClient::ExportContentIDList( RPointerArray< HBufC8 >& aCIDList ) - { - return KErrNone; - } - - -// ----------------------------------------------------------------------------- -// RDRMRightsClient::GetDecryptionKey -// Fetches the decryption key from the server. -// Uses TR mechanisms. Uses asynchronous C/S call. -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMRightsClient::GetDecryptionKey( const TInt aIntent, - const TDesC8& aContentID, - const TBool aUpdate, - TDes8& aKey ) - { - aKey.Copy(_L("0000000000000000")); - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// RDRMRightsClient::CheckRights -// Checks if appropriate rights exist for a certain content ID. -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMRightsClient::CheckRights( const TInt aIntent, - const TDesC8& aContentID ) - { - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// RDRMRightsClient::Count -// Returns the amount of unique content IDs in the database. -// If an error occurs, a negative value is returned (Symbian OS / DRM 3 specific -// error code). -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMRightsClient::Count() - { - return 1; - } - -// ----------------------------------------------------------------------------- -// RDRMRightsClient::DeleteAll -// Empties the database. -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMRightsClient::DeleteAll() - { - return KErrNone; - } - - -// ----------------------------------------------------------------------------- -// RDRMRightsClient::Consume() -// Consume the right with specific intent and contentID -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMRightsClient::Consume( const TInt aIntent, const TDesC8& aContentID, const TInt aActionIntent ) - { - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// RDRMRightsClient::CalculatePadding -// Calculate the padding from a data block and a certain content ID. -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMRightsClient::CalculatePadding( - const TDesC8& aContentID, - const TDesC8& aLastTwoDataBlocks) - { - return 0; - } - -// ----------------------------------------------------------------------------- -// RDRMRightsClient::FileToListL -// Converts the given file into an array. -// ----------------------------------------------------------------------------- -// -void RDRMRightsClient::FileToListL( RFs& aFs, - const TDesC& aFileName, - RPointerArray< CDRMPermission >& aList ) - { - } - -// ----------------------------------------------------------------------------- -// RDRMRightsClient::URIFileToArrayL -// Converts the given file into an array. -// ----------------------------------------------------------------------------- -// -void RDRMRightsClient::URIFileToArrayL( RFs& aFs, - const TDesC& aFile, - RPointerArray< HBufC8 >& aList ) - { - } - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// End of File diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmengine/server/src/DRMServerStarter.cpp --- a/omadrm/drmengine/server/src/DRMServerStarter.cpp Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,167 +0,0 @@ -/* -* Copyright (c) 2002 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: This file is used only if RDRMRightsClient starts the -* DRM Rights Database server. -* -*/ - -// INCLUDE FILES -#include -#include -#include - -#ifdef RD_MULTIPLE_DRIVE -#include -#endif - -#include "drmengineclientserver.h" - -// EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES -// CONSTANTS -#ifdef __WINS__ -LOCAL_C const TUint KServerMinHeapSize = 0x1000; -LOCAL_C const TUint KServerMaxHeapSize = 0x300000; -_LIT( KRightsServerFile, "RightsServer" ); -#else - -#ifdef RD_MULTIPLE_DRIVE -_LIT( KRightsServerFile, "%c:\\RightsServer.exe" ); -#else -_LIT( KRightsServerFile, "e:\\RightsServer.exe" ); -#endif -#endif - -// MACROS -// LOCAL CONSTANTS AND MACROS -// MODULE DATA STRUCTURES -// LOCAL FUNCTION PROTOTYPES -LOCAL_C TInt CreateServer( void ); - -// FORWARD DECLARATIONS - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CreateServer launches the DRM Rights server [process (THUMB/ARMI)|thread (WINS)]. -// Returns: KErrNone: No errors. -// CRYPTO_BLOCK_SIZE ) - { - DEBUG("Padding Size wrong!") - return DRM_ENG_ERROR; - } - - /* calculate new data length: - */ - *pDataLen = *pDataLen-padSize; - - return DRM_ENG_OK; - } - else - { - DEBUG( "Cypto Error: invalid uiPaddingMethod !" ) - ret = DRM_ENG_ERROR; - } - - return ret; - } - - -/* 7.8 */ - -/* Functional description - * - * Generates an initialization vector for cipher CBC mode. - * - * - * Parameters - * - * Lenght of the IV to be generated in bits. Must be a value between 1-16. - * - ivLen - * - * - * Pointer to pointer to the generated IV. - * - ppIV - * - * - * Return values - * - * If operation is OK, return DRM_ENG_OK, - * otherwize DRM_ENG_ERROR. - */ - -/* ---------------------------------------------------------------------- */ - -uint8 DRMCrypto_GenerateIV(uint32 ivLen, uint8 **ppIV) - { - /* Data structures */ - - /* return code */ - uint8 ret=DRM_ENG_OK; - - /* seed */ - uint8* pSeed=NULL; - - /* Code */ - - /* check parameter */ - if( ppIV == NULL || ivLen == 0 || ivLen > 16) - { - return DRM_ENG_INVALID_PARAM; - } - - /* allocate memory for IV */ - *ppIV = DRM_BLOCK_ALLOC( ivLen ); - - if( !(*ppIV) ) - { - return DRM_ENG_MEM_ERROR; - } - - /* generate random number as seed */ - pSeed = DRM_BLOCK_ALLOC( KEYSEED_LENGTH ); - if( !pSeed ) - { - ret = DRM_ENG_MEM_ERROR; - } - else - { - ret = DRMEnv_GetRandom( (uint32*)pSeed, KEYSEED_NUMBER_OF_INT32 ); - TRANSLATE_ERROR_CODE( ret ); - } - - /* generate IV by seed */ - if( ret == DRM_ENG_OK ) - { - /* Just copy the seed as IV. */ - DRM_BLOCK_COPY(*ppIV, pSeed, ivLen *&) - GetCountersL__27CDRMHelperRightsConstraintsRUlT1 @ 15 NONAME R3UNUSED ; CDRMHelperRightsConstraints::GetCountersL(unsigned long &, unsigned long &) - GetEndTimeL__27CDRMHelperRightsConstraintsR5TTime @ 16 NONAME R3UNUSED ; CDRMHelperRightsConstraints::GetEndTimeL(TTime &) - GetIntervalL__27CDRMHelperRightsConstraintsR20TTimeIntervalSeconds @ 17 NONAME R3UNUSED ; CDRMHelperRightsConstraints::GetIntervalL(TTimeIntervalSeconds &) - GetIntervalStartL__27CDRMHelperRightsConstraintsR5TTime @ 18 NONAME R3UNUSED ; CDRMHelperRightsConstraints::GetIntervalStartL(TTime &) - GetRightsDetailsL__10CDRMHelperRC7TDesC16UlRiT3RP21CDRMRightsConstraintsN35 @ 19 NONAME ; CDRMHelper::GetRightsDetailsL(TDesC16 const &, unsigned long, int &, int &, CDRMRightsConstraints *&, CDRMRightsConstraints *&, CDRMRightsConstraints *&, CDRMRightsConstraints *&) - GetRightsDetailsL__10CDRMHelperRC7TDesC16UlRiT3RP27CDRMHelperRightsConstraintsN35 @ 20 NONAME ; CDRMHelper::GetRightsDetailsL(TDesC16 const &, unsigned long, int &, int &, CDRMHelperRightsConstraints *&, CDRMHelperRightsConstraints *&, CDRMHelperRightsConstraints *&, CDRMHelperRightsConstraints *&) - GetStartTimeL__27CDRMHelperRightsConstraintsR5TTime @ 21 NONAME R3UNUSED ; CDRMHelperRightsConstraints::GetStartTimeL(TTime &) - HandleErrorL__10CDRMHelperiRC6TDesC8 @ 22 NONAME R3UNUSED ; CDRMHelper::HandleErrorL(int, TDesC8 const &) - HandleErrorL__10CDRMHelperiRC7TDesC16 @ 23 NONAME R3UNUSED ; CDRMHelper::HandleErrorL(int, TDesC16 const &) - IndicateIdle__10CDRMHelper @ 24 NONAME R3UNUSED ; CDRMHelper::IndicateIdle(void) - IsPreview__27CDRMHelperRightsConstraints @ 25 NONAME R3UNUSED ; CDRMHelperRightsConstraints::IsPreview(void) - LaunchDetailsViewEmbeddedL__10CDRMHelperPC6HBufC8 @ 26 NONAME R3UNUSED ; CDRMHelper::LaunchDetailsViewEmbeddedL(HBufC8 const *) - LaunchDetailsViewEmbeddedL__10CDRMHelperRC6TDesC8 @ 27 NONAME R3UNUSED ; CDRMHelper::LaunchDetailsViewEmbeddedL(TDesC8 const &) - LaunchDetailsViewEmbeddedL__10CDRMHelperRC7TDesC16 @ 28 NONAME R3UNUSED ; CDRMHelper::LaunchDetailsViewEmbeddedL(TDesC16 const &) - NewLC__10CDRMHelper @ 29 NONAME R3UNUSED ; CDRMHelper::NewLC(void) - NewLC__10CDRMHelperR7CCoeEnv @ 30 NONAME R3UNUSED ; CDRMHelper::NewLC(CCoeEnv &) - NewL__10CDRMHelper @ 31 NONAME R3UNUSED ; CDRMHelper::NewL(void) - NewL__10CDRMHelperR7CCoeEnv @ 32 NONAME R3UNUSED ; CDRMHelper::NewL(CCoeEnv &) - RegisterDataType__10CDRMHelperRC9TDataType @ 33 NONAME R3UNUSED ; CDRMHelper::RegisterDataType(TDataType const &) - RemoveAutomatedPassive__10CDRMHelperRC6TDesC8 @ 34 NONAME R3UNUSED ; CDRMHelper::RemoveAutomatedPassive(TDesC8 const &) - RemoveAutomatedPassive__10CDRMHelperRC7TDesC16 @ 35 NONAME R3UNUSED ; CDRMHelper::RemoveAutomatedPassive(TDesC16 const &) - RemoveAutomated__10CDRMHelperRC6TDesC8 @ 36 NONAME R3UNUSED ; CDRMHelper::RemoveAutomated(TDesC8 const &) - RemoveAutomated__10CDRMHelperRC7TDesC16 @ 37 NONAME R3UNUSED ; CDRMHelper::RemoveAutomated(TDesC16 const &) - SetAutomatedPassive__10CDRMHelperRC6TDesC8 @ 38 NONAME R3UNUSED ; CDRMHelper::SetAutomatedPassive(TDesC8 const &) - SetAutomatedPassive__10CDRMHelperRC7TDesC16 @ 39 NONAME R3UNUSED ; CDRMHelper::SetAutomatedPassive(TDesC16 const &) - SetAutomatedSilent__10CDRMHelperRC6TDesC8i @ 40 NONAME R3UNUSED ; CDRMHelper::SetAutomatedSilent(TDesC8 const &, int) - SetAutomatedSilent__10CDRMHelperRC7TDesC16i @ 41 NONAME R3UNUSED ; CDRMHelper::SetAutomatedSilent(TDesC16 const &, int) - SetAutomated__10CDRMHelperRC6TDesC8 @ 42 NONAME R3UNUSED ; CDRMHelper::SetAutomated(TDesC8 const &) - SetAutomated__10CDRMHelperRC7TDesC16 @ 43 NONAME R3UNUSED ; CDRMHelper::SetAutomated(TDesC16 const &) - SetCountLimitL__10CDRMHelperUi @ 44 NONAME R3UNUSED ; CDRMHelper::SetCountLimitL(unsigned int) - SetPercentageLimitL__10CDRMHelperUi @ 45 NONAME R3UNUSED ; CDRMHelper::SetPercentageLimitL(unsigned int) - SetTimeLimitL__10CDRMHelperUi @ 46 NONAME R3UNUSED ; CDRMHelper::SetTimeLimitL(unsigned int) - diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmhelper/BWINSCW/drmhelperdmgrwrapperU.DEF --- a/omadrm/drmhelper/BWINSCW/drmhelperdmgrwrapperU.DEF Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?GateFunctionDMgr@@YAPAXXZ @ 1 NONAME ; void * GateFunctionDMgr(void) - diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmhelper/EABI/drmhelperdmgrwrapperU.DEF --- a/omadrm/drmhelper/EABI/drmhelperdmgrwrapperU.DEF Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -EXPORTS - _Z16GateFunctionDMgrv @ 1 NONAME - _ZTI21CDRMHelperDMgrWrapper @ 2 NONAME ; ## - _ZTV21CDRMHelperDMgrWrapper @ 3 NONAME ; ## - diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmhelper/group/bld.inf --- a/omadrm/drmhelper/group/bld.inf Fri Apr 16 15:14:55 2010 +0300 +++ b/omadrm/drmhelper/group/bld.inf Mon May 03 12:46:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003 - 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" @@ -22,7 +22,6 @@ PRJ_MMPFILES -drmhelperdmgrwrapper.mmp DRMHelper.mmp // End of File diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmhelper/group/drmhelperdmgrwrapper.mmp --- a/omadrm/drmhelper/group/drmhelperdmgrwrapper.mmp Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* -* Copyright (c) 2006 - 2007 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: Project definition file for drmhelperdmgrwrapper -* -*/ - - -#include -#include - -TARGET drmhelperdmgrwrapper.dll -TARGETTYPE dll -UID 0x1000008D 0x102823D9 - -CAPABILITY CAP_GENERAL_DLL -VENDORID VID_DEFAULT - -SOURCE ../src/DRMHelperDMgrWrapper.cpp - -START RESOURCE drmhelperdmgrwrapper.rss -HEADER -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END - -USERINCLUDE ../inc -USERINCLUDE ../../drmengine/roap/inc -USERINCLUDE ../../../inc // ADo level inc dir - -// Default system include paths for middleware layer modules. -APP_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY centralrepository.lib // Browser default AP -LIBRARY cmmanager.lib -LIBRARY DownloadMgr.lib -LIBRARY RoapHandler.lib -LIBRARY efsrv.lib -LIBRARY avkon.lib -LIBRARY cone.lib -LIBRARY commonengine.lib -LIBRARY aknnotify.lib -LIBRARY eikctl.lib -LIBRARY eikcdlg.lib - -#ifdef RD_MULTIPLE_DRIVE -LIBRARY platformenv.lib -#endif - -DEBUGLIBRARY flogger.lib - -START WINS -END - -START MARM -END - -#if defined(ARMCC) -deffile ../EABI/ -#elif defined( WINSCW ) -deffile ../BWINSCW/ -#elif defined( WINS ) -deffile ../bwins/ -#else -deffile ../bmarm/ -#endif - -SMPSAFE diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmhelper/group/drmhelperdmgrwrapper.rss --- a/omadrm/drmhelper/group/drmhelperdmgrwrapper.rss Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* -* Copyright (c) 2006 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: Resource file for drmhelperdmgrwrapper -* -*/ - - -// RESOURCE IDENTIFIER -NAME DRMD - -// INCLUDES -#include -#include -#include -#include -#include -#include -#ifdef __DRM -#include -#endif - -// CONSTANTS - -// MACROS - -// RESOURCE DEFINITIONS - -RESOURCE RSS_SIGNATURE { } - -RESOURCE TBUF16 { buf="DRMD"; } - -// ----------------------------------------------------------------------------- -// -// r_silent_progress_note -// String displayed while getting silent rights -// expired. -// -// ----------------------------------------------------------------------------- -// -RESOURCE DIALOG r_silent_progress_note - { - flags = EAknProgressNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EGeneralQuery; - control= AVKON_NOTE - { - layout = EProgressLayout; - singular_label = qtn_drm_progress_opening; - imagefile = AVKON_BITMAP_FILE; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - }; - } - }; - } - -//End of File - diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmhelper/inc/DRMHelperDMgrWrapper.h --- a/omadrm/drmhelper/inc/DRMHelperDMgrWrapper.h Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,180 +0,0 @@ -/* -* Copyright (c) 2006-2008 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: -* -*/ - - -#ifndef CDRMHELPERDMGRWRAPPER_H -#define CDRMHELPERDMGRWRAPPER_H - -#include -#include -#include - -/** -* Environment gate function -* -* @since S60 3.1 -* @return pointer to DMgr handler -*/ -IMPORT_C TAny* GateFunctionDMgr(); - -class MDRMHelperDMgrWrapper - { - -public: - virtual void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ) = 0; - - virtual void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl, - CCoeEnv& aCoeEnv ) = 0; - - virtual HBufC8* GetErrorUrlL() = 0; - - }; - -/** -* Class for downloading ROAP triggers -* -* @lib DRMHelperDMgrWrapper -* @since S60 v3.1 -*/ -class CDRMHelperDMgrWrapper : CBase, - public MHttpDownloadMgrObserver, - public MDRMHelperDMgrWrapper, - public MProgressDialogCallback - { - -public: - - static CDRMHelperDMgrWrapper* NewL(); - - static CDRMHelperDMgrWrapper* NewLC(); - - virtual ~CDRMHelperDMgrWrapper(); - - /** - * Download a ROAP trigger from URL and handle it - * - * @since S60 3.1 - * @param aUrl URL of ROAP trigger - */ - void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ); - - void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl, CCoeEnv& aCoeEnv ); - - HBufC8* GetErrorUrlL(); - - -// from base class MHttpDownloadMgrObserver - - /** - * From MHttpDownloadMgrObserver. - * Handle download manager events - * - * @since S60 3.1 - * @param aDownload the download - * @param aEvent the event - */ - void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent ); - -public: // Call back methods of MAknProgressDialogCallback - - /** - * ProgressDialog call back method. - * Get's called when a dialog is dismissed. - * - * @since S60 3.2 - * @param aButtonId ID of the button pressed - */ - void DialogDismissedL( TInt aButtonId ); - -protected: - -private: - - /** - * C++ default constructor. - */ - CDRMHelperDMgrWrapper(); - - void ConstructL(); - - /** - * Set the browser default access point to be used - * - * @since S60 3.0 - */ - void SetDefaultAccessPointL(); - - void DoDownloadAndHandleRoapTriggerL( const HBufC8* aUrl ); - - void ShowProgressNoteL( ); - - void RemoveProgressNoteL( ); - - void HandlePostResponseUrlL(); - - -private: // data - - /** - * Download manager session - */ - RHttpDownloadMgr iDlMgr; - - /** - * Used to make downloads synchronous - */ - CActiveSchedulerWait iWait; - - /** - * to store information on download - */ - TBool iDownloadSuccess; - TBool iConnectionError; - - TBool iDialogDismissed; - - /** - * Progess note dialog and progress info - */ - CAknProgressDialog* iProgressNoteDialog; // owned - CEikProgressInfo* iProgressInfo; // not owned - TInt iCurrentProgressValue; // owned - TInt iProgressIncrement; // owned - - /** - * Control environment - */ - CCoeEnv* iCoeEnv; - - /** - * Is CoeEnv given - */ - TBool iUseCoeEnv; - - /** - * Error url for ROAP temporary error - */ - HBufC8* iErrorUrl; - - /** - * Post response url for ROAP prUrl - */ - HBufC8* iPostResponseUrl; - - }; - -#endif // CDRMHELPERDMGRWRAPPER_H diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmhelper/inc/DRMHelperDMgrWrapperLogger.h --- a/omadrm/drmhelper/inc/DRMHelperDMgrWrapperLogger.h Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,216 +0,0 @@ -/* -* Copyright (c) 2002 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: Logger utility. -* -*/ - - -#ifndef DRMUILOGGER_H -#define DRMUILOGGER_H - - -// INCLUDES - -#include -#include -#include -#include - - -#ifdef _DEBUG -#define __TEST_DRM_LOG__ -#endif // _DEBUG - - -#ifdef __TEST_DRM_LOG__ - -// CONSTANTS - -// DRMUI logging directory. -_LIT( KDRMUILogDir, "DRMUI" ); -// DRMUI log file name. -_LIT( KDRMUILogFile, "DMgrWrapper.log" ); -// Format string: enter function. -_LIT( KDRMUILogEnterFn, "-> %S" ); -// Format string: leave function. -_LIT( KDRMUILogLeaveFn, "<- %S" ); -// Format string: time. -_LIT( KDRMUILogTimeFormatString, "%H:%T:%S:%*C2" ); -// Format string: timestamp. -_LIT( KDRMUILogTimeStampFormatString, "%S %S" ); -//Banner message -_LIT( KDRMUILogBanner, "DRMUI 3.2"); -// Message of exit from app -_LIT( KDRMUILogExit, "DRMUI: Application exit"); - -// DEFINES - -// Create the log -#define CLOG_CREATE { FCreate(); } - -// Close the log -#define CLOG_CLOSE \ - { \ - RFileLogger::Write \ - ( \ - KDRMUILogDir, \ - KDRMUILogFile, \ - EFileLoggingModeAppend, \ - KDRMUILogExit \ - ); \ - } - -// Write log: enter function. -#define CLOG_ENTERFN( a ) \ - { \ - _LIT( temp, a ); \ - RFileLogger::WriteFormat \ - ( \ - KDRMUILogDir, \ - KDRMUILogFile, \ - EFileLoggingModeAppend, \ - KDRMUILogEnterFn, \ - &temp \ - ); \ - } - -// Write log: leave function. -#define CLOG_LEAVEFN( a ) \ - { \ - _LIT( temp, a ); \ - RFileLogger::WriteFormat \ - ( \ - KDRMUILogDir, \ - KDRMUILogFile, \ - EFileLoggingModeAppend, \ - KDRMUILogLeaveFn, \ - &temp \ - ); \ - } - -// Write log: string 'a'. -#define CLOG_WRITE( a ) \ - { \ - _LIT( temp, a ); \ - RFileLogger::Write \ - ( \ - KDRMUILogDir, \ - KDRMUILogFile, \ - EFileLoggingModeAppend, \ - temp \ - ); \ - } - -// Write log: formatted. -#define CLOG_WRITE_FORMAT( a, b ) \ - { \ - _LIT( temp, a ); \ - RFileLogger::WriteFormat \ - ( \ - KDRMUILogDir, \ - KDRMUILogFile, \ - EFileLoggingModeAppend, \ - temp, \ - b \ - ); \ - } - -// Write log: timestamp. -#define CLOG_WRITE_TIMESTAMP( a ) \ - { \ - _LIT( temp, a ); \ - TTime time; \ - time.HomeTime(); \ - TBuf<32> timeBuf; \ - TRAPD( err, time.FormatL( timeBuf, KDRMUILogTimeFormatString ) ); \ - if ( !err ) \ - { \ - RFileLogger::WriteFormat \ - ( \ - KDRMUILogDir, \ - KDRMUILogFile, \ - EFileLoggingModeAppend, \ - KDRMUILogTimeStampFormatString, \ - &temp, \ - &timeBuf \ - ); \ - } \ - } - -// Write formatted -#define CLOG_WRITEF FPrint - - -inline void FPrint( const TRefByValue aFmt, ... ) - { - VA_LIST list; - VA_START( list, aFmt ); - RFileLogger::WriteFormat( KDRMUILogDir, KDRMUILogFile, - EFileLoggingModeAppend, aFmt, list ); - } - - -inline void FPrint( const TDesC& aDes ) - { - RFileLogger::WriteFormat( KDRMUILogDir, KDRMUILogFile, - EFileLoggingModeAppend, aDes ); - } - - -inline void FCreate() - { - TFileName path( _L( "c:\\logs\\" ) ); - path.Append( KDRMUILogDir ); - path.Append( _L( "\\" ) ); - RFs& fs = CEikonEnv::Static()->FsSession(); - fs.MkDirAll( path ); - RFileLogger::WriteFormat( KDRMUILogDir, KDRMUILogFile, - EFileLoggingModeOverwrite, KDRMUILogBanner ); - } - - -#else // not defined __TEST_DRM_LOG__ - -inline void FPrint( const TRefByValue /*aFmt*/, ... ) {}; - - -// DEFINES - -// Empty definition (disable log). -#define CLOG_CREATE - -// Empty definition (disable log). -#define CLOG_CLOSE - -// Empty definition (disable log). -#define CLOG_ENTERFN( a ) - -// Empty definition (disable log). -#define CLOG_LEAVEFN( a ) - -// Empty definition (disable log). -#define CLOG_WRITE( a ) - -// Empty definition (disable log). -#define CLOG_WRITE_FORMAT( a, b ) - -// Empty definition (disable log). -#define CLOG_WRITE_TIMESTAMP( a ) - -// Empty definition (disable log). -#define CCDLGLOGGER_WRITEF 1 ? ((void)0) : FPrint - -#endif // __TEST_DRM_LOG__ - -#endif // DRMUILOGGER_H diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmhelper/inc/DRMHelperDownloadManager.h --- a/omadrm/drmhelper/inc/DRMHelperDownloadManager.h Fri Apr 16 15:14:55 2010 +0300 +++ b/omadrm/drmhelper/inc/DRMHelperDownloadManager.h Mon May 03 12:46:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2004-2006 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2004-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" @@ -22,7 +22,7 @@ #include #include -class CDRMHelperDMgrWrapper; +class CDrmUtilityDmgrWrapper; /** * This class encapsulates Download manager functionality. @@ -33,7 +33,7 @@ NONSHARABLE_CLASS(CDrmHelperDownloadManager) : public CBase { public: - + static CDrmHelperDownloadManager* NewL(); virtual ~CDrmHelperDownloadManager(); @@ -46,12 +46,12 @@ void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl, CCoeEnv& aCoeEnv ); void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ); - + HBufC8* GetErrorUrlL(); protected: - + private: CDrmHelperDownloadManager(); @@ -60,10 +60,10 @@ private: /** - * Download manager handler - */ + * Download manager handler + */ RLibrary iDMgrDll; - CDRMHelperDMgrWrapper* iDMgrHandler; + CDrmUtilityDmgrWrapper* iDMgrHandler; }; -#endif // CDRMHELPERDOWNLOADMANAGER_H +#endif // CDRMHELPERDOWNLOADMANAGER_H diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmhelper/src/DRMHelperClient.cpp --- a/omadrm/drmhelper/src/DRMHelperClient.cpp Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,613 +0,0 @@ -/* -* Copyright (c) 2004-2006 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 Helper Client session functionality -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include "DRMHelperCommon.h" -#include "DRMHelperClient.h" - - -// LOCAL CONSTANTS AND MACROS -// Number of message slots to reserve for this client server session. -// Since we only communicate synchronously here, we never have any -// outstanding asynchronous requests. -LOCAL_C const TUint KDefaultMessageSlots = 0; -LOCAL_C const TUid KServerUid3 = {0x101F6DC5}; - -#ifdef __WINS__ -LOCAL_C const TUint KServerMinHeapSize = 0x1000; // 4K -LOCAL_C const TUint KServerMaxHeapSize = 0x10000; // 64K -#endif - -// ============================ LOCAL FUNCTIONS =============================== -#ifdef _DRM_TESTING -LOCAL_C void WriteLogL( const TDesC8& text , RFs &aFs ); -LOCAL_C void WriteFileL( const TDesC8& text , RFs &aFs , const TDesC& aName ); -LOCAL_C void CreateLogL(); -LOCAL_C void WriteL( const TDesC& aText ); -LOCAL_C void WriteL( const TDesC8& aText ); -LOCAL_C void WriteCurrentTimeL(); -#endif - - -LOCAL_C TInt FromFileNameToUri(const TDesC16& aFileName , HBufC8*& aContentUri ); -LOCAL_C TInt CheckExpiration( const TDesC8& aUri , TTime& aEndTime , TInt& aCountLeft ); -LOCAL_C TInt StartServer(); -LOCAL_C TInt CreateServerProcess(); - - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// RDRMHelperClient::RDRMHelperClient -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -EXPORT_C RDRMHelperClient::RDRMHelperClient() -: RSessionBase() - { - // No implementation required - } - -// ----------------------------------------------------------------------------- -// RDRMHelperClient::Connect -// -// Connect to the server session -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMHelperClient::Connect() - { -#ifdef _DRM_TESTING - TRAPD( err , CreateLogL() ); - if (err) - { - return err; - } - TRAP( err , WriteL(_L("Connect")) ); - if (err) - { - return err; - } - TRAP( err , WriteCurrentTimeL() ); - if (err) - { - return err; - } -#endif - TInt error = StartServer(); - - if (KErrNone == error) - { - - error = CreateSession(KDRMHelperServerName, - Version(), - KDefaultMessageSlots); - } - return error; - } - -// ----------------------------------------------------------------------------- -// RDRMHelperClient::Version -// -// return server version -// ----------------------------------------------------------------------------- -// -EXPORT_C TVersion RDRMHelperClient::Version() const - { - return(TVersion(KDRMHSMajorVersionNumber, - KDRMHSMinorVersionNumber, - KDRMHSBuildVersionNumber)); - } - -// ----------------------------------------------------------------------------- -// RDRMHelperClient::SetAutomated -// -// Register one content uri to the helper server -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMHelperClient::SetAutomated( const TDesC8& aUri , const TInt& aType ) const - { - TInt temp = aType; - TPtrC8 descriptor(aUri); - - // This call waits for the server to complete the request before - // proceeding. - return SendReceive(ERegister, TIpcArgs( &descriptor, temp ) ); - } - -// ----------------------------------------------------------------------------- -// RDRMHelperClient::SetAutomated -// -// Register one file to the helper server -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMHelperClient::SetAutomated( const TDesC16& aFileName , const TInt& aType ) const - { - TInt temp = aType; - TPtrC8 descriptor( NULL , 0 ); - - descriptor.Set( reinterpret_cast( aFileName.Ptr() ), aFileName.Length()*2); - - // This call waits for the server to complete the request before - // proceeding. - return SendReceive(ERegisterFile, TIpcArgs( &descriptor, temp ) ); - } - -// ----------------------------------------------------------------------------- -// RDRMHelperClient::RemoveAutomated -// -// Register one content uri to the helper server -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMHelperClient::RemoveAutomated( const TDesC8& aUri , const TInt& aType ) const - { - TInt temp = aType; - TPtrC8 descriptor(aUri); - - // This call waits for the server to complete the request before - // proceeding. - return SendReceive(ERemove, TIpcArgs( &descriptor, temp ) ); - } - -// ----------------------------------------------------------------------------- -// RDRMHelperClient::RemoveAutomated -// -// Register one file to the helper server -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMHelperClient::RemoveAutomated( const TDesC16& aFileName , const TInt& aType ) const - { - TInt temp = aType; - TPtrC8 descriptor( NULL , 0 ); - - descriptor.Set( reinterpret_cast( aFileName.Ptr() ), aFileName.Length()*2); - - // This call waits for the server to complete the request before - // proceeding. - return SendReceive(ERemoveFile, TIpcArgs( &descriptor ) ); - } - -// ----------------------------------------------------------------------------- -// RDRMHelperClient::IndicateIdle -// -// Register one file to the helper server -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMHelperClient::IndicateIdle() const - { - return SendReceive(EIndicateIdle, TIpcArgs()); - } - - -// ----------------------------------------------------------------------------- -// RDRMHelperClient::CanSetAutomated -// -// Register one content uri to the helper server -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMHelperClient::CanSetAutomated( const TDesC8& aUri , TBool& aValue ) const - { - TTime endTime; - TTime temp; - TInt countsLeft = 0; - TInt err = 0; - temp.Set( KNullDate ); - endTime.Set( KNullDate ); - - err = CheckExpiration( aUri , endTime , countsLeft ); - if ( endTime != temp ) - { - aValue = ETrue; - } - else - { - aValue = EFalse; - } - return err; - } - -// ----------------------------------------------------------------------------- -// RDRMHelperClient::CanSetAutomated -// -// Register one file to the helper server -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMHelperClient::CanSetAutomated( const TDesC16& aFileName , TBool& aValue ) const - { - HBufC8* contentUri = NULL; - TInt err = 0; - err = FromFileNameToUri( aFileName , contentUri ); - if (err) - { - return err; - } - err = CanSetAutomated( contentUri->Des() , aValue ); - delete contentUri; - return err; - } - - -// ----------------------------------------------------------------------------- -// RDRMHelperClient::IsAutomated -// -// Register one content uri to the helper server -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMHelperClient::IsAutomated( const TDesC8& aUri , TInt& aType , TBool& aIs ) - { - TPtr8 type( reinterpret_cast< TUint8* >( &aType ), - 0, - sizeof( TInt ) ); - TPtr8 flag( reinterpret_cast< TUint8* >( &aIs ), - 0, - sizeof( TInt ) ); - - TPtrC8 descriptor(aUri); - - // This call waits for the server to complete the request before - // proceeding. - return SendReceive(EIsRegistered, TIpcArgs( &type, &descriptor, &flag ) ); - } - -// ----------------------------------------------------------------------------- -// RDRMHelperClient::IsAutomated -// -// Register one file to the helper server -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RDRMHelperClient::IsAutomated( const TDesC16& aFileName , TInt& aType , TBool& aIs ) - { - TPtr8 type( reinterpret_cast< TUint8* >( &aType ), - 0, - sizeof( TInt ) ); - TPtr8 flag( reinterpret_cast< TUint8* >( &aIs ), - 0, - sizeof( TInt ) ); - - TPtrC8 descriptor( NULL , 0 ); - - - descriptor.Set( reinterpret_cast( aFileName.Ptr() ), aFileName.Length()*2); - - // This call waits for the server to complete the request before - // proceeding. - return SendReceive(EIsRegisteredFile, TIpcArgs( &type, &descriptor, &flag ) ); - - } - - - -// ============================= LOCAL FUNCTIONS =============================== -// ----------------------------------------------------------------------------- -// StartServer -// -// Start the helper server -// ----------------------------------------------------------------------------- -// -LOCAL_C TInt StartServer() - { - -#ifdef _DRM_TESTING - TRAPD( err , WriteL(_L("StartServer")) ); - if (err) - { - return err; - } - TRAP( err , WriteCurrentTimeL() ); - if (err) - { - return err; - } -#endif - TInt result = 0; - - TFindServer findHelperServer(KDRMHelperServerName); - TFullName name; - - result = findHelperServer.Next(name); - if (result == KErrNone) - { - // Server already running - return KErrNone; - } - - RSemaphore semaphore; - result = semaphore.CreateGlobal(KDRMHelperServerSemaphoreName, 0); - if (result != KErrNone) - { - return result; - } - - result = CreateServerProcess(); - if (result != KErrNone) - { - semaphore.Close(); - return result; - } - - semaphore.Wait(); - semaphore.Close(); - - return KErrNone; - } - -LOCAL_C TInt CreateServerProcess() - { -#ifdef _DRM_TESTING - TRAPD( err , WriteL(_L("CreateServerProcess")) ); - if (err) - { - return err; - } - TRAP( err , WriteCurrentTimeL() ); - if (err) - { - return err; - } -#endif - TInt result; - - const TUidType serverUid(KNullUid, KNullUid, KServerUid3); - -#ifdef __WINS__ - - RLibrary lib; - result = lib.Load( KDRMHSServerFileName , serverUid ); - if (result != KErrNone) - { - return result; - } - -#ifdef _DRM_TESTING - TRAP( err , WriteL(_L("library is loaded")) ); - if (err) - { - return err; - } - TRAP( err , WriteCurrentTimeL() ); - if (err) - { - return err; - } -#endif - - // Get the WinsMain function - TLibraryFunction functionWinsMain = lib.Lookup(1); - - // Call it and cast the result to a thread function - TThreadFunction serverThreadFunction = reinterpret_cast(functionWinsMain()); - - TName threadName(KDRMHelperServerName); - - // Append a random number to make it unique - threadName.AppendNum(Math::Random(), EHex); - - RThread server; - - result = server.Create(threadName, // create new server thread - serverThreadFunction, // thread's main function - KDefaultStackSize, - NULL, - &lib, - NULL, - KServerMinHeapSize, - KServerMaxHeapSize, - EOwnerProcess); - - - - lib.Close(); // if successful, server thread has handle to library now - - if (result != KErrNone) - { - return result; - } -#ifdef _DRM_TESTING - TRAP( err , WriteL(_L("server thread is created")) ); - if (err) - { - return err; - } - TRAP( err , WriteCurrentTimeL() ); - if (err) - { - return err; - } -#endif - server.SetPriority(EPriorityMore); - - -#else - - RProcess server; - result = server.Create( KDRMHSServerFileName, KNullDesC, serverUid); - if (result != KErrNone) - { - return result; - } -#ifdef _DRM_TESTING - TRAP( err , WriteL(_L("server thread is created")) ); - if (err) - { - return err; - } - TRAP( err , WriteCurrentTimeL() ); - if (err) - { - return err; - } -#endif - -#endif - - server.Resume(); - server.Close(); - - return KErrNone; - } - -LOCAL_C TInt FromFileNameToUri(const TDesC16& aFileName , HBufC8*& aContentUri ) - { - DRMAuthenticated* c = NULL; - DRMCommon::TContentProtection protection; - HBufC8* mimeType = NULL; - TUint dataLen = 0; - TRAPD(err , c = DRMAuthenticated::NewL()); - if (err) - { - return err; - } - err = c->GetFileInfo( - aFileName, - protection, - mimeType, - aContentUri, - dataLen); - delete mimeType; - if (err) - { - delete aContentUri; - aContentUri = NULL; - } - return err; - } - - -LOCAL_C TInt CheckExpiration( const TDesC8& aUri , TTime& aEndTime , TInt& aCountLeft ) - { - DRMAuthenticated* c = NULL; - CDRMRights* right = NULL; - TRAPD( err , c = DRMAuthenticated::NewL() ); - if (err) - { - return err; - } - err = c->GetActiveRights( aUri , - DRMCommon::EPlay | DRMCommon::EExecute | DRMCommon::EPrint | DRMCommon::EDisplay , - right ); - if (!err) - { - err = right->GetExpirationDetails( - DRMCommon::EPlay | DRMCommon::EExecute | DRMCommon::EPrint | DRMCommon::EDisplay, - aEndTime, - aCountLeft); - } - delete right; - delete c; - return err; - } - -#ifdef _DRM_TESTING - -LOCAL_C void WriteLogL( const TDesC8& text , RFs &aFs ) - { - _LIT( KLogFile , "c:\\HSClientLog.txt" ); - WriteFileL( text , aFs , KLogFile ); - } - -LOCAL_C void WriteFileL( const TDesC8& text , RFs &aFs , const TDesC& aName ) - { - RFile file; - TInt size; - User::LeaveIfError( file.Open( aFs, aName , EFileWrite ) ); - CleanupClosePushL( file ); - User::LeaveIfError( file.Size( size ) ); - User::LeaveIfError( file.Write( size, text ) ); - CleanupStack::PopAndDestroy(); //file - } - -LOCAL_C void CreateLogL() - { - RFs fs; - User::LeaveIfError(fs.Connect()); - CleanupClosePushL(fs); - RFile file; - User::LeaveIfError( file.Replace( fs , _L("c:\\HSClientLog.txt") , EFileWrite ) ); - file.Close(); - CleanupStack::PopAndDestroy(); //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 ); - textptr.Append( _L("\r\n") ); - WriteLogL(textptr , fs); - CleanupStack::PopAndDestroy(text); - CleanupStack::PopAndDestroy(); //fs - } - -LOCAL_C void WriteL( const TDesC8& aText ) - { - RFs fs; - User::LeaveIfError( fs.Connect() ); - CleanupClosePushL(fs); - HBufC8* text = HBufC8::NewLC(1000); - TPtr8 textptr(text->Des() ); - textptr.Append( aText ); - textptr.Append( _L8("\r\n") ); - WriteLogL(textptr , fs); - CleanupStack::PopAndDestroy(text); - CleanupStack::PopAndDestroy(); //fs - } - - -LOCAL_C void WriteCurrentTimeL() - { - RFs fs; - User::LeaveIfError( fs.Connect() ); - CleanupClosePushL(fs); - 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); - CleanupStack::PopAndDestroy(text); - CleanupStack::PopAndDestroy(); //fs - } -#endif - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// Epoc DLL entry point, return that everything is ok -GLDEF_C TInt E32Dll(TDllReason) - { - return KErrNone; - } - -// End of File diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmhelper/src/DRMHelperDMgrWrapper.cpp --- a/omadrm/drmhelper/src/DRMHelperDMgrWrapper.cpp Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,723 +0,0 @@ -/* -* Copyright (c) 2006-2008 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: Dynamically loadable wrapper for Download manager -* -*/ - -#include -#include - -#include -#include -#include -#include - -#ifdef __SERIES60_NATIVE_BROWSER -#include -#endif - -#ifdef RD_MULTIPLE_DRIVE -#include -#endif - -#include -#include - -#include -#include - -#include - -#include "RoapEng.h" -#include "RoapSyncWrapper.h" -#include "RoapDef.h" -#include "DRMHelperDMgrWrapper.h" -#include "DRMHelperDMgrWrapperLogger.h" - -// DEBUG macros -#ifdef _DEBUG -#define DRMDEBUGLIT( a, b ) \ -_LIT( a , b ) -#define DRMDEBUG( a ) \ -RDebug::Print( a ) -#define DRMDEBUG2( a, b ) \ -RDebug::Print( a, b ) -#else -#define DRMDEBUGLIT( a, b ) -#define DRMDEBUG( a ) -#define DRMDEBUG2( a, b ) -#endif - -// CONSTANTS -#ifndef __SERIES60_NATIVE_BROWSER -const TUid KCRUidBrowser = {0x10008D39}; -const TUint32 KBrowserDefaultAccessPoint = 0x0000000E; -const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E; -#endif - -// CONSTANTS -#ifndef RD_MULTIPLE_DRIVE -_LIT( KDriveZ, "z:" ); -_LIT( KHelperTriggerFilePath, "d:\\" ); -#endif - -_LIT( KCDRMHelperDMgrWrapperResFileName,"DRMHelperDMgrWrapper.rsc" ); -const TInt KProgressInfoFinalValue( 200 ); -const TInt KProgressInfoIncrementSmall( 5 ); -const TInt KProgressInfoIncrementMedium( 10 ); -const TInt KProgressInfoIncrementLarge( 30 ); - -// ======== LOCAL FUNCTIONS ======== -LOCAL_C void DeleteHttpDowload( TAny* aDownload ) - { - reinterpret_cast< RHttpDownload* >( aDownload )->Delete(); - } - -// --------------------------------------------------------------------------- -// IapIdOfDefaultSnapL -// for trapping purposes only -// --------------------------------------------------------------------------- -// -LOCAL_C TUint32 IapIdOfDefaultSnapL( - RCmManager& aCmManager, - const TUint32 aDefaultSnap ) - { - RCmDestination dest( aCmManager.DestinationL( aDefaultSnap ) ); - CleanupClosePushL( dest ); - TUint32 iapIdOfDest( 0 ); - - if ( dest.ConnectionMethodCount() <= 0 ) - { - User::Leave( KErrNotFound ); - } - - RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) ); - CleanupClosePushL( cMeth ); - - iapIdOfDest = cMeth.GetIntAttributeL( CMManager::ECmIapId ); - CleanupStack::PopAndDestroy( &cMeth ); - CleanupStack::PopAndDestroy( &dest ); - return iapIdOfDest; - } - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CDRMHelperDMgrWrapper::CDRMHelperDMgrWrapper -// --------------------------------------------------------------------------- -// -CDRMHelperDMgrWrapper::CDRMHelperDMgrWrapper() : - iUseCoeEnv( EFalse ) - { - } - -// --------------------------------------------------------------------------- -// CDRMHelperDMgrWrapper::ConstructL -// --------------------------------------------------------------------------- -// -void CDRMHelperDMgrWrapper::ConstructL() - { - CLOG_WRITE( "DMgrWrapper::ConstructL" ); - const TInt KDrmHelperDMgrWrapperUid = 0x102823D9; - iDlMgr.ConnectL( TUid::Uid(KDrmHelperDMgrWrapperUid), *this, EFalse ); - iProgressInfo = NULL; - iProgressNoteDialog = NULL; - iDialogDismissed = ETrue; - } - - - -// --------------------------------------------------------------------------- -// CDRMHelperDMgrWrapper::NewL -// --------------------------------------------------------------------------- -// -CDRMHelperDMgrWrapper* CDRMHelperDMgrWrapper::NewL() - { - CLOG_WRITE( "DMgrWrapper::NewL" ); - CDRMHelperDMgrWrapper* self( CDRMHelperDMgrWrapper::NewLC() ); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------------------------- -// CDRMHelperDMgrWrapper::NewLC -// --------------------------------------------------------------------------- -// -CDRMHelperDMgrWrapper* CDRMHelperDMgrWrapper::NewLC() - { - CLOG_WRITE( "DMgrWrapper::NewLC" ); - CDRMHelperDMgrWrapper* self( new( ELeave ) CDRMHelperDMgrWrapper() ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - - -// --------------------------------------------------------------------------- -// CDRMHelperDMgrWrapper::~CDRMHelperDMgrWrapper -// --------------------------------------------------------------------------- -// -CDRMHelperDMgrWrapper::~CDRMHelperDMgrWrapper() - { - CLOG_WRITE( "DMgrWrapper destructor" ); - if ( iProgressNoteDialog ) - { - // deletes the dialog - TRAPD( err, iProgressNoteDialog->ProcessFinishedL() ); - if ( err ) - { - delete iProgressNoteDialog; - } - iProgressNoteDialog = NULL; - } - delete iErrorUrl; - delete iPostResponseUrl; - -#ifdef _DEBUG - - if ( iDlMgr.Handle() ) - { - iDlMgr.Close(); - } - -#else - - iDlMgr.Close(); - -#endif - - } - - -// --------------------------------------------------------------------------- -// CDRMHelperDMgrWrapper::DownloadAndHandleRoapTriggerL -// --------------------------------------------------------------------------- -// -void CDRMHelperDMgrWrapper::DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ) - { - CLOG_WRITE( "DMgrWrapper::DownloadAndHandleRoapTriggerL" ); - iUseCoeEnv = EFalse; - DoDownloadAndHandleRoapTriggerL( aUrl ); - HandlePostResponseUrlL(); - } - - -// --------------------------------------------------------------------------- -// CDRMHelperDMgrWrapper::DownloadAndHandleRoapTriggerL -// --------------------------------------------------------------------------- -// -void CDRMHelperDMgrWrapper::DownloadAndHandleRoapTriggerL( - const HBufC8* aUrl, CCoeEnv& aCoeEnv ) - { - CLOG_WRITE( "DMgrWrapper::DownloadAndHandleRoapTriggerL" ); - iCoeEnv = &aCoeEnv; - iUseCoeEnv = ETrue; - DoDownloadAndHandleRoapTriggerL( aUrl ); - HandlePostResponseUrlL(); - } - - -// --------------------------------------------------------------------------- -// CDRMHelperDMgrWrapper::HandlePostResponseUrlL -// --------------------------------------------------------------------------- -// -void CDRMHelperDMgrWrapper::HandlePostResponseUrlL() - { - if ( iPostResponseUrl ) - { - DoDownloadAndHandleRoapTriggerL( iPostResponseUrl ); - // prevent infinite post response fetches. - delete iPostResponseUrl; - iPostResponseUrl = NULL; - - // Ensure progress note gets deleted. - // It remains open if prUrl initialted ROAP operation has PrUrl - // (unsupported chained metering report) - RemoveProgressNoteL(); - } - } - - -// --------------------------------------------------------------------------- -// CDRMHelperDMgrWrapper::DoDownloadAndHandleRoapTriggerL -// --------------------------------------------------------------------------- -// -void CDRMHelperDMgrWrapper::DoDownloadAndHandleRoapTriggerL( - const HBufC8* aUrl ) - { - RFs fs; - RFile roapTrigger; - HBufC8* triggerBuf( NULL ); - TBool result( EFalse ); - TFileName triggerFileName; - - CLOG_WRITE( "DMgrWrapper::DoDownloadAndHandleRoapTriggerL" ); - User::LeaveIfError( fs.Connect() ); - CleanupClosePushL( fs ); - User::LeaveIfError( fs.ShareProtected() ); - - -#ifndef RD_MULTIPLE_DRIVE - - User::LeaveIfError( roapTrigger.Temp( - fs, KHelperTriggerFilePath, triggerFileName, EFileWrite ) ); - -#else //RD_MULTIPLE_DRIVE - - _LIT( KDrive, "%c:\\"); - TInt driveNumber( -1 ); - TChar driveLetter; - DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRam, driveNumber ); - fs.DriveToChar( driveNumber, driveLetter ); - - TFileName helperTriggerFilePath; - - helperTriggerFilePath.Format( KDrive, (TUint)driveLetter ); - - User::LeaveIfError( roapTrigger.Temp( - fs, helperTriggerFilePath, triggerFileName, EFileWrite ) ); - -#endif - - TPtrC8 KNullPtr8( NULL, 0 ); - RHttpDownload* downloadPtr( iDlMgr.FindDownload( *aUrl, KNullPtr8 ) ); - if ( downloadPtr ) - { - // Stale download found. - // Remove it, and re-create a new download. - downloadPtr->Delete(); - downloadPtr = NULL; - } - - // create and start download - RHttpDownload& download = iDlMgr.CreateDownloadL( *aUrl, result ); - // Put download for proper cleanup. - TCleanupItem item( DeleteHttpDowload, &download ); - CleanupStack::PushL( item ); - - CleanupClosePushL( roapTrigger ); - - if ( !iPostResponseUrl ) - { - // No post response retieval. Note must be created. - ShowProgressNoteL(); - } - - if ( result ) - { - const TInt KReadBufSize( 512 ); - TInt triggerFileSize( 0 ); - - CLOG_WRITE( - "DMgrWrapper::DoDownloadAndHandleRoapTriggerL: download created" ); - iDownloadSuccess = EFalse; - iConnectionError = EFalse; - - SetDefaultAccessPointL(); - - User::LeaveIfError( download.SetFileHandleAttribute( roapTrigger ) ); - User::LeaveIfError( - download.SetBoolAttribute( EDlAttrNoContentTypeCheck, ETrue ) ); - User::LeaveIfError( download.Start() ); - - // wait until download is finished - iWait.Start(); - - // Check success of download - CLOG_WRITE( - "DMgrWrapper::DoDownloadAndHandleRoapTriggerL: download finished" ); - - CleanupStack::Pop( &roapTrigger ); - roapTrigger.Close(); - if ( !iDownloadSuccess ) - { - RemoveProgressNoteL(); - if ( iConnectionError ) - { - User::Leave( KErrCouldNotConnect ); - } - else - { - User::Leave( KErrGeneral ); - } - } - User::LeaveIfError( roapTrigger.Open( fs, - triggerFileName, - EFileShareReadersOrWriters ) ); - CleanupClosePushL( roapTrigger ); - - // Get filehandle of ROAP trigger - // Read file to buffer - User::LeaveIfError( roapTrigger.Size( triggerFileSize ) ); - triggerBuf = HBufC8::NewLC( triggerFileSize ); - - RBuf8 readBuf; - readBuf.CleanupClosePushL(); - readBuf.CreateL( KReadBufSize ); - - User::LeaveIfError( roapTrigger.Read( readBuf, KReadBufSize ) ); - triggerBuf->Des().Copy( readBuf ); - while ( readBuf.Length() == KReadBufSize ) - { - User::LeaveIfError( roapTrigger.Read( readBuf, KReadBufSize ) ); - triggerBuf->Des().Append( readBuf ); - } - - CleanupStack::PopAndDestroy( &readBuf ); - - if ( iUseCoeEnv && iProgressInfo ) - { - iProgressInfo->IncrementAndDraw( KProgressInfoIncrementMedium ); - } - - // And let ROAP handle it... - CRoapSyncWrapper* roapWrapper( CRoapSyncWrapper::NewL() ); - CleanupStack::PushL( roapWrapper ); - TRAPD( err, roapWrapper->HandleTriggerL( *triggerBuf ) ); - if ( err ) - { - TInt errorType( 0 ); - TRAPD( err2, iErrorUrl = - roapWrapper->GetErrorUrlL( err, errorType ) ); - if ( err2 ) - { - RemoveProgressNoteL(); - delete iErrorUrl; - iErrorUrl = NULL; - User::Leave( err2 ); - } - else if ( errorType != KErrRoapTemporary ) - { - RemoveProgressNoteL(); - delete iErrorUrl; - iErrorUrl = NULL; - User::Leave( err ); - } - else - { - RemoveProgressNoteL(); - User::Leave( err ); - } - } - if ( iPostResponseUrl ) - { - delete iPostResponseUrl; - iPostResponseUrl = NULL; - } - iPostResponseUrl = roapWrapper->GetPostResponseUrlL(); - CleanupStack::PopAndDestroy( 2, triggerBuf ); - - if ( iUseCoeEnv && iProgressInfo && !iPostResponseUrl ) - { - // No PrUrl found. Progess is complete. - iProgressInfo->SetAndDraw( KProgressInfoFinalValue ); - } - } - - // Trick to keep note open long enough during prUrl retrieval - if ( !iPostResponseUrl ) - { - RemoveProgressNoteL(); - } - else - { - if ( iUseCoeEnv && iProgressInfo ) - { - iProgressInfo->IncrementAndDraw( KProgressInfoIncrementMedium ); - } - } - - CleanupStack::PopAndDestroy( &roapTrigger ); - CleanupStack::PopAndDestroy( &download ); - - fs.Delete(triggerFileName); - CleanupStack::PopAndDestroy(&fs); - } - - -// --------------------------------------------------------------------------- -// CDRMHelperDMgrWrapper::SetDefaultAccessPointL -// --------------------------------------------------------------------------- -// -void CDRMHelperDMgrWrapper::SetDefaultAccessPointL() - { - const TInt KDestinationSelectionMode( 2 ); - CRepository* repository( NULL ); - TInt ap( 0 ); - TInt alwaysAsk( 0 ); - TUint32 iapd32( 0 ); - TInt defaultSnap( 0 ); - TInt err( KErrNone ); - - CLOG_WRITE( "DMgrWrapper::SetDefaultAccessPointL" ); - repository = CRepository::NewL( KCRUidBrowser ); - CleanupStack::PushL( repository ); - repository->Get( KBrowserDefaultAccessPoint, ap ); - repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk ); - repository->Get( KBrowserNGDefaultSnapId, defaultSnap ); - - if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound ) - { - alwaysAsk = ETrue; - } - else - { - RCmManager cmManager; - cmManager.OpenLC(); - if ( !alwaysAsk ) - { - TRAP( err, iapd32 = cmManager.GetConnectionMethodInfoIntL( - ap, CMManager::ECmIapId ) ); - } - else if ( alwaysAsk == KDestinationSelectionMode ) - { - TRAP( err, iapd32 = - IapIdOfDefaultSnapL( cmManager, defaultSnap ) ); - } - CleanupStack::PopAndDestroy( &cmManager ); - } - if ( !err && ( !alwaysAsk || alwaysAsk == KDestinationSelectionMode ) ) - { - err = iDlMgr.SetIntAttribute( EDlMgrIap, iapd32 ); - } - CleanupStack::PopAndDestroy( repository ); - } - - -// --------------------------------------------------------------------------- -// CDRMHelperDMgrWrapper::GetErrorUrlL -// --------------------------------------------------------------------------- -// -HBufC8* CDRMHelperDMgrWrapper::GetErrorUrlL() - { - if( iErrorUrl ) - { - return iErrorUrl->AllocL(); - } - return NULL; - } - - -// --------------------------------------------------------------------------- -// From class MHttpDownloadMgrObserver -// --------------------------------------------------------------------------- -// -void CDRMHelperDMgrWrapper::HandleDMgrEventL( - RHttpDownload& aDownload, - THttpDownloadEvent aEvent ) - { - _LIT8( KDRMHelperMimeTypeROAPTrigger, - "application/vnd.oma.drm.roap-trigger+xml" ); - - CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL" ); - CLOG_WRITE_FORMAT( "iDownLoadState = %d", aEvent.iDownloadState ); - CLOG_WRITE_FORMAT( "iProgressState = %d", aEvent.iProgressState ); - - if ( aEvent.iProgressState == EHttpContentTypeReceived ) - { - // check received mimetype - RBuf8 contentType; - contentType.CleanupClosePushL(); - contentType.CreateL( KMaxContentTypeLength ); - User::LeaveIfError( - aDownload.GetStringAttribute( EDlAttrContentType, contentType ) ); - if ( !contentType.FindF( KDRMHelperMimeTypeROAPTrigger ) ) - { - // ROAP trigger found, continue download - User::LeaveIfError( aDownload.Start() ); - } - else - { - // wrong MIME type, so stop download - iDownloadSuccess = EFalse; - User::LeaveIfError( aDownload.Delete() ); - } - CleanupStack::PopAndDestroy( &contentType ); - } - - if ( aEvent.iDownloadState == EHttpDlCreated ) - { - CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlCreated" ); - if ( iUseCoeEnv ) - { - iProgressInfo->IncrementAndDraw( KProgressInfoIncrementMedium ); - } - } - else if ( aEvent.iProgressState == EHttpProgDisconnected ) - { - CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpProgDisconnected" ); - // store failure - iDownloadSuccess = EFalse; - iConnectionError = ETrue; - // finished - iWait.AsyncStop(); - } - else if ( aEvent.iDownloadState == EHttpDlInprogress ) - { - CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlInprogress" ); - if ( iUseCoeEnv ) - { - iProgressInfo->IncrementAndDraw( KProgressInfoIncrementSmall ); - } - } - else if ( aEvent.iDownloadState == EHttpDlCompleted ) - { - // store success - CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlCompleted" ); - iDownloadSuccess = ETrue; - if ( iUseCoeEnv ) - { - iProgressInfo->IncrementAndDraw( KProgressInfoIncrementLarge ); - } - // finished - iWait.AsyncStop(); - } - else if ( aEvent.iDownloadState == EHttpDlFailed ) - { - TInt32 err( KErrNone ); - - CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlFailed" ); - // store failure - iDownloadSuccess = EFalse; - User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrErrorId, err ) ); - CLOG_WRITE_FORMAT( "EDlAttrErrorId = %d", err ); - - if ( err == EConnectionFailed || - err == ETransactionFailed) - { - CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EConnectionFailed" ); - iConnectionError = ETrue; - } - - // finished - iWait.AsyncStop(); - } - } - - -// --------------------------------------------------------------------------- -// CDRMHelperDMgrWrapper::ShowProgressNoteL -// --------------------------------------------------------------------------- -// -void CDRMHelperDMgrWrapper::ShowProgressNoteL( ) - { - TFileName resFileName; - - CLOG_WRITE( "DMgrWrapper::ShowProgressNoteL" ); - if ( iUseCoeEnv ) - { - // Initialize the progress note dialog, it's values, - // and execute it - -#ifndef RD_MULTIPLE_DRIVE - - resFileName.Copy( KDriveZ ); - -#else //RD_MULTIPLE_DRIVE - - _LIT( KDrive, "%c:"); - TInt driveNumber( -1 ); - TChar driveLetter; - DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber ); - - iCoeEnv->FsSession().DriveToChar( driveNumber, driveLetter ); - - resFileName.Format( KDrive, (TUint)driveLetter ); - -#endif - - resFileName.Append( KDC_RESOURCE_FILES_DIR ); - resFileName.Append( KCDRMHelperDMgrWrapperResFileName ); - RConeResourceLoader loader( *iCoeEnv ); - loader.OpenL( resFileName ); - - iProgressNoteDialog = new (ELeave) CAknProgressDialog( - reinterpret_cast< CEikDialog** >( &iProgressNoteDialog ) ); - iProgressNoteDialog->PrepareLC( R_SILENT_PROGRESS_NOTE ); - iProgressNoteDialog->SetCallback( this ); - iProgressInfo = iProgressNoteDialog->GetProgressInfoL(); - iProgressInfo->SetFinalValue( KProgressInfoFinalValue ); - iDialogDismissed = EFalse; - iProgressNoteDialog->RunLD(); - - loader.Close(); - } - - } - - -// --------------------------------------------------------------------------- -// CDRMHelperDMgrWrapper::RemoveProgressNoteL -// --------------------------------------------------------------------------- -// -void CDRMHelperDMgrWrapper::RemoveProgressNoteL( ) - { - - if ( iUseCoeEnv ) - { - if (iProgressNoteDialog && !iDialogDismissed) - { - // deletes the dialog - TRAPD(err, iProgressNoteDialog->ProcessFinishedL()); - if (err != KErrNone) - { - delete iProgressNoteDialog; - } - iProgressNoteDialog = NULL; - } - } - - } - - -// --------------------------------------------------------------------------- -// From class MAknProgressDialogCallback -// --------------------------------------------------------------------------- -// -void CDRMHelperDMgrWrapper::DialogDismissedL( TInt /*aButtonId*/ ) - { - iDialogDismissed = ETrue; - - // Already freed, just set to NULL - iProgressNoteDialog = NULL; - iProgressInfo = NULL; - - if( iWait.IsStarted() ) - { - iWait.AsyncStop(); - } - - } - - -// ======== GLOBAL FUNCTIONS ======== - -//------------------------------------------------------------------------------ -// GateFunctionDRM -// DRM gate function -//------------------------------------------------------------------------------ -EXPORT_C TAny* GateFunctionDMgr() - { - CDRMHelperDMgrWrapper* launcher = NULL; - TRAPD( err, launcher = CDRMHelperDMgrWrapper::NewL() ); - if( err != KErrNone ) - { - return NULL; - } - - return launcher; - } - diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmhelper/src/DRMHelperDownloadManager.cpp --- a/omadrm/drmhelper/src/DRMHelperDownloadManager.cpp Fri Apr 16 15:14:55 2010 +0300 +++ b/omadrm/drmhelper/src/DRMHelperDownloadManager.cpp Mon May 03 12:46:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2004-2006 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2004-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" @@ -18,10 +18,10 @@ // INCLUDE FILES #include "DRMHelperDownloadManager.h" -#include "DRMHelperDMgrWrapper.h" +#include "DrmUtilityDmgrWrapper.h" // CONSTANTS -_LIT( KDRMHelperDMgrHandlerName, "\\system\\libs\\drmhelperdmgrwrapper.dll" ); +_LIT( KDrmUtilityDmgrHandlerName, "DrmUtilityDmgrWrapper.dll" ); typedef TAny* (*NewDMgrL)(); @@ -35,14 +35,14 @@ void CDrmHelperDownloadManager::ConstructL() { - User::LeaveIfError( iDMgrDll.Load( KDRMHelperDMgrHandlerName ) ); + User::LeaveIfError( iDMgrDll.Load( KDrmUtilityDmgrHandlerName ) ); NewDMgrL createDMgr = (NewDMgrL) iDMgrDll.Lookup( KFirstFunction ); if ( !createDMgr ) { User::Leave( KErrGeneral ); } // Create the class, leaves in case of failure - iDMgrHandler = (CDRMHelperDMgrWrapper*) (*createDMgr)(); + iDMgrHandler = reinterpret_cast( (*createDMgr)() ); } CDrmHelperDownloadManager* CDrmHelperDownloadManager::NewL() diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmhelper/src/drmhelper.cpp --- a/omadrm/drmhelper/src/drmhelper.cpp Fri Apr 16 15:14:55 2010 +0300 +++ b/omadrm/drmhelper/src/drmhelper.cpp Mon May 03 12:46:34 2010 +0300 @@ -25,7 +25,6 @@ #include "DcfCommon.h" #include "DRMHelperDownloadManager.h" -#include #include #include #include @@ -60,7 +59,7 @@ #include -#include // for handling URLs +#include // for handling URLs #include "DRMHelperServer.h" #include "ConsumeData.h" #include "DRMTypes.h" @@ -83,25 +82,15 @@ #include "DRMRIContext.h" #include "DRMDomainContext.h" -#include -#include -#include -#include - // publish & subrscibe #include #include -#ifdef __SERIES60_NATIVE_BROWSER -#include -#endif - -#ifndef __SERIES60_NATIVE_BROWSER -const TUid KCRUidBrowser = {0x10008D39}; -const TUint32 KBrowserDefaultAccessPoint = 0x0000000E; -const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E; -#endif - + +//connectivity logic +#include // RCmConnectionMethod +#include // RCmDestination +#include // RCmManager // EXTERNAL DATA STRUCTURES @@ -169,32 +158,65 @@ }; // ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// IapIdOfDefaultSnapL -// for trapping purposes only +// ----------------------------------------------------------------------------- +// HasDefaultConnectionL +// Finds default IAP id +// @return Etrue: valid AP found +// EFalse: valid AP not found +// @leave system wide error codes // ----------------------------------------------------------------------------- // -LOCAL_C TUint32 IapIdOfDefaultSnapL( - RCmManager& aCmManager, - const TUint32 aDefaultSnap ) - { - RCmDestination dest( aCmManager.DestinationL( aDefaultSnap ) ); - CleanupClosePushL( dest ); - TUint32 iapIdOfDest( 0 ); - - if ( dest.ConnectionMethodCount() <= 0 ) - { - User::Leave( KErrNotFound ); - } - - RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) ); - CleanupClosePushL( cMeth ); - - iapIdOfDest = cMeth.GetIntAttributeL( CMManager::ECmIapId ); - CleanupStack::PopAndDestroy( &cMeth ); - CleanupStack::PopAndDestroy( &dest ); - return iapIdOfDest; +LOCAL_C TBool HasDefaultConnectionL() + { + TBool hasDefault(EFalse); + TCmDefConnValue defConn; + RCmManager cmManager; + cmManager.OpenLC(); + cmManager.ReadDefConnL(defConn); + if (defConn.iType == ECmDefConnConnectionMethod) + { + cmManager.GetConnectionMethodInfoIntL(defConn.iId, + CMManager::ECmIapId); + hasDefault = ETrue; + } + else if (defConn.iType == ECmDefConnDestination) + { + RCmDestination dest(cmManager.DestinationL(defConn.iId)); + CleanupClosePushL(dest); + + if (dest.ConnectionMethodCount() <= 0) + { + User::Leave(KErrNotFound); + } + + RCmConnectionMethod cMeth(dest.ConnectionMethodL(0)); + CleanupClosePushL(cMeth); + + cMeth.GetIntAttributeL(CMManager::ECmIapId); + CleanupStack::PopAndDestroy(&cMeth); + CleanupStack::PopAndDestroy(&dest); + hasDefault = ETrue; + } + CleanupStack::PopAndDestroy(&cmManager); + return hasDefault; + } + +// ----------------------------------------------------------------------------- +// HasAccessPointsL +// ----------------------------------------------------------------------------- +// +LOCAL_C TBool HasAccessPointsL() + { + TInt apCount(0); + RCmManager cmManager; + CleanupClosePushL(cmManager); + cmManager.OpenL(); + RArray aps; + CleanupClosePushL(aps); + cmManager.ConnectionMethodL(aps, EFalse, EFalse, ETrue); + apCount = aps.Count(); + CleanupStack::PopAndDestroy(2, &cmManager); //aps, cmManager + return apCount > 0; } // ----------------------------------------------------------------------------- @@ -2339,13 +2361,7 @@ if ( buttonCode == EAknSoftkeyYes ) { // check if there are any APs defined - RCmManager cmManager; - cmManager.OpenLC(); - RArray aps; - CleanupClosePushL( aps ); - cmManager.ConnectionMethodL( aps, EFalse, EFalse, ETrue ); - TUint32 APs( aps.Count() ); - CleanupStack::PopAndDestroy( 2, &cmManager ); //aps, cmManager + TBool APs( HasAccessPointsL() ); if ( !APs ) { // No AP defined @@ -2430,43 +2446,17 @@ } +// ----------------------------------------------------------------------------- +// CDRMHelper::CheckRightsPercentL +// Note: obsolete function name kept only +// to avoid SC break on Helper selection logic +// ----------------------------------------------------------------------------- +// TBool CDRMHelper::BrowserAPDefinedL() { - const TInt KDestinationSelectionMode( 2 ); - TInt err( KErrNone ); - TInt ap( 0 ); - TInt alwaysAsk( 0 ); - TInt defaultSnap( 0 ); - - CRepository* repository( CRepository::NewL( KCRUidBrowser ) ); - repository->Get( KBrowserDefaultAccessPoint, ap ); - repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk ); - repository->Get( KBrowserNGDefaultSnapId, defaultSnap ); - delete repository; - if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound ) - { - alwaysAsk = ETrue; - } - else - { - RCmManager cmManager; - cmManager.OpenLC(); - if ( !alwaysAsk ) - { - TRAP( err, cmManager.GetConnectionMethodInfoIntL( - ap, CMManager::ECmIapId ) ); - } - else if ( alwaysAsk == KDestinationSelectionMode ) - { - TRAP( err, IapIdOfDefaultSnapL( cmManager, defaultSnap ) ); - } - CleanupStack::PopAndDestroy( &cmManager ); - if ( !err && ( !alwaysAsk || alwaysAsk == KDestinationSelectionMode ) ) - { - return ETrue; - } - } - return EFalse; + TBool apFound( EFalse ); + TRAP_IGNORE( apFound = HasDefaultConnectionL() ); + return apFound; } diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmlicensemanager/src/LMSecurity.cpp --- a/omadrm/drmlicensemanager/src/LMSecurity.cpp Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -/* -* Copyright (c) 2004 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: Encryption/Decryption support functions -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include -#include - -#include "LMSecurity.h" -#include "LMSecurityEncrypt.h" -#include "LMSecurityDecrypt.h" - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CLMSecurity::NewEncryptL -// Return a new encryptor -// ----------------------------------------------------------------------------- -// -CSecurityEncryptBase* CLMSecurity::NewEncryptL( - const TDesC8& init) const - { - return new CLMSecurityEncrypt(init); - }; - -// ----------------------------------------------------------------------------- -// CLMSecurity::NewDecryptL -// Return a new decryptor -// ----------------------------------------------------------------------------- -// -CSecurityDecryptBase* CLMSecurity::NewDecryptL( - const TDesC8& init) const - { - return new CLMSecurityDecrypt(init); - }; - -// ----------------------------------------------------------------------------- -// CLMSecurity::SetL -// Password functions not supported (handled via the encrypt/decrypt classes) -// ----------------------------------------------------------------------------- -// -void CLMSecurity::SetL( - const TDesC& /* aOldPassword */, - const TDesC& /* aNewPassword */) - { - }; - -// ----------------------------------------------------------------------------- -// CLMSecurity::SecurityData -// Password functions not supported (handled via the encrypt/decrypt classes) -// ----------------------------------------------------------------------------- -// -TPtrC8 CLMSecurity::SecurityData() const - { - return TPtrC8(0, 0); - }; - -// ----------------------------------------------------------------------------- -// CLMSecurity::PrepareL -// Password functions not supported (handled via the encrypt/decrypt classes) -// ----------------------------------------------------------------------------- -// -void CLMSecurity::PrepareL( - const TDesC& /* aPassword */) - { - }; - -// ----------------------------------------------------------------------------- -// CLMSecurity::IsEnabled -// Password functions not supported (handled via the encrypt/decrypt classes) -// ----------------------------------------------------------------------------- -// -TInt CLMSecurity::IsEnabled() const - { - return ETrue; - }; - -// ----------------------------------------------------------------------------- -// CLMSecurity::SetEnabledL -// Password functions not supported (handled via the encrypt/decrypt classes) -// ----------------------------------------------------------------------------- -// -void CLMSecurity::SetEnabledL( - const TDesC& /* aPassword */, - TBool /* aIsEnabled */) - { - }; diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmlicensemanager/src/LMSecurityDecrypt.cpp --- a/omadrm/drmlicensemanager/src/LMSecurityDecrypt.cpp Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* -* Copyright (c) 2004 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: Encryption/Decryption support functions -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include -#include - -#include "LMSecurity.h" -#include "LMSecurityDecrypt.h" - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// ?classname::?member_function -// ?implementation_description -// ----------------------------------------------------------------------------- -// -CLMSecurityDecrypt::CLMSecurityDecrypt( - const TDesC8& init) - { - TPckg p(0); - - p.Copy(init); - iKey = p(); - Math::Rand(iKey); - } - -// ----------------------------------------------------------------------------- -// ?classname::?member_function -// ?implementation_description -// ----------------------------------------------------------------------------- -// -TInt CLMSecurityDecrypt::DecryptL( - TDes8& aOutput, - const TDesC8& aInput) - { - TInt i; - TUint8* ptr; - - ptr = const_cast(aOutput.Ptr()); - for (i = 0; i < aInput.Size(); i++) - { - ptr[i] = static_cast(aInput[i] ^ Math::Rand(iKey)); - } - aOutput.SetLength(aInput.Size()); - return aInput.Size(); - } diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmlicensemanager/src/LMSecurityEncrypt.cpp --- a/omadrm/drmlicensemanager/src/LMSecurityEncrypt.cpp Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* -* Copyright (c) 2004 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: Encryption/Decryption support functions -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include -#include - -#include "LMSecurity.h" -#include "LMSecurityEncrypt.h" - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CLMSecurityEncrypt::CLMSecurityEncrypt -// Initialize the random key stream from a constant -// ----------------------------------------------------------------------------- -// -CLMSecurityEncrypt::CLMSecurityEncrypt( - const TDesC8& init) - { - TPckg p(0); - - p.Copy(init); - iKey = p(); - Math::Rand(iKey); - } - -// ----------------------------------------------------------------------------- -// CLMSecurityEncrypt::EncryptL -// Encrypt using the key stream -// ----------------------------------------------------------------------------- -// -TInt CLMSecurityEncrypt::EncryptL( - TDes8& aOutput, - const TDesC8& aInput) - { - TInt i; - TUint8* ptr; - - ptr = const_cast(aOutput.Ptr()); - for (i = 0; i < aInput.Size(); i++) - { - ptr[i] = static_cast(aInput[i] ^ Math::Rand(iKey)); - } - aOutput.SetLength(aInput.Size()); - return aInput.Size(); - } - -// ----------------------------------------------------------------------------- -// CLMSecurityEncrypt::CompleteL -// Final encryption -// ----------------------------------------------------------------------------- -// -TInt CLMSecurityEncrypt::CompleteL( - TDes8& aOutput, - const TDesC8& aInput) - { - return EncryptL(aOutput, aInput); - } diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmplugins/drmrohandler/inc/rohandlerdmgrwrapper.h --- a/omadrm/drmplugins/drmrohandler/inc/rohandlerdmgrwrapper.h Fri Apr 16 15:14:55 2010 +0300 +++ b/omadrm/drmplugins/drmrohandler/inc/rohandlerdmgrwrapper.h Mon May 03 12:46:34 2010 +0300 @@ -30,14 +30,8 @@ class MRoHandlerDMgrWrapper { - public: virtual void HandleRoapTriggerL( const TDesC8& aTrigger ) = 0; - - virtual void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ) = 0; - - virtual void DownloadAndHandleRoapTriggerFromPrUrlL( const HBufC8* aUrl ) = 0; - }; /** @@ -78,10 +72,6 @@ */ void HandleRoapTriggerL( const TDesC8& aTrigger ); - void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ); - - void DownloadAndHandleRoapTriggerFromPrUrlL( const HBufC8* aUrl ); - // from base class MHttpDownloadMgrObserver diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmplugins/drmrohandler/src/rohandlerdmgrwrapper.cpp --- a/omadrm/drmplugins/drmrohandler/src/rohandlerdmgrwrapper.cpp Fri Apr 16 15:14:55 2010 +0300 +++ b/omadrm/drmplugins/drmrohandler/src/rohandlerdmgrwrapper.cpp Mon May 03 12:46:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008 - 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2008 - 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" @@ -21,10 +21,6 @@ #include #include -#ifdef __SERIES60_NATIVE_BROWSER -#include -#endif - #include #include #include @@ -46,6 +42,8 @@ #include "RoapSyncWrapper.h" #include "rohandlerdmgrwrapper.h" +#include "cleanupresetanddestroy.h" +#include "buffercontainers.h" #ifdef _DEBUG #define DRMDEBUG( a ) RDebug::Print( a ) @@ -93,9 +91,6 @@ _LIT( KMethConstructL, "ConstructL" ); _LIT( KMethNewL, "NewL" ); _LIT( KMethNewLC, "NewLC" ); - _LIT( KMethDownloadAndHandleRoapTriggerL, "DownloadAndHandleRoapTriggerL" ); - _LIT( KMethDownloadAndHandleRoapTriggerFromPrUrlL, - "DownloadAndHandleRoapTriggerFromPrUrlL" ); _LIT( KMethDoDownloadAndHandleRoapTriggerL, "DoDownloadAndHandleRoapTriggerL" ); _LIT( KFormatDoDlHdlRoapTrigL, "DoDownloadAndHandleRoapTriggerL: %S" ); @@ -103,7 +98,6 @@ _LIT( KStrDlFinished, "download finished" ); _LIT( KMethSetDefaultAccessPointL, "SetDefaultAccessPointL" ); - _LIT( KMiIapId, "iIapId" ); _LIT( KMethHandleDMgrEventL, "HandleDMgrEventL" ); _LIT( KFormatMethHandleDMgrEventL, "HandleDMgrEventL %S" ); @@ -135,14 +129,6 @@ //#define LOG2( a, b ) #endif -#ifndef __SERIES60_NATIVE_BROWSER -const TUid KCRUidBrowser = - {0x10008D39}; -const TUint32 KBrowserDefaultAccessPoint = 0x0000000E; -const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E; -const TUint32 KBrowserNGDefaultSnapId = 0x00000053; -#endif - // CONSTANTS #ifndef RD_MULTIPLE_DRIVE _LIT( KHelperTriggerFilePath, "d:\\" ); @@ -151,18 +137,6 @@ // ============================== LOCAL FUNCTIONS ============================== // --------------------------------------------------------------------------- -// DoResetAndDestroy -// Does RPointerArray< typename >->ResetAndDestroy() for the given array aPtr. -// --------------------------------------------------------------------------- -// -template< typename elemType > -LOCAL_C void DoResetAndDestroy( TAny* aPtr ) - { - ( reinterpret_cast< RPointerArray< elemType >* >( aPtr ) )-> - ResetAndDestroy(); - } - -// --------------------------------------------------------------------------- // DeleteHttpDowload // --------------------------------------------------------------------------- // @@ -189,34 +163,6 @@ } } -// --------------------------------------------------------------------------- -// IapIdOfDefaultSnapL -// for trapping purposes only -// --------------------------------------------------------------------------- -// -LOCAL_C TUint32 IapIdOfDefaultSnapL( - RCmManager& aCmManager, - const TUint32 aDefaultSnap ) - { - RCmDestination dest( aCmManager.DestinationL( aDefaultSnap ) ); - CleanupClosePushL( dest ); - TUint32 iapIdOfDest( 0 ); - - if ( dest.ConnectionMethodCount() <= 0 ) - { - User::Leave( KErrNotFound ); - } - - RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) ); - CleanupClosePushL( cMeth ); - - iapIdOfDest = cMeth.GetIntAttributeL( CMManager::ECmIapId ); - CleanupStack::PopAndDestroy( &cMeth ); - CleanupStack::PopAndDestroy( &dest ); - return iapIdOfDest; - } - - // ============================= MEMBER FUNCTIONS ============================== // --------------------------------------------------------------------------- @@ -301,7 +247,7 @@ } // --------------------------------------------------------------------------- -// CRoHandlerDMgrWrapper::DownloadAndHandleRoapTriggerL +// CRoHandlerDMgrWrapper::HandleRoapTriggerL // --------------------------------------------------------------------------- // void CRoHandlerDMgrWrapper::HandleRoapTriggerL( const TDesC8& aTrigger ) @@ -317,42 +263,6 @@ } // --------------------------------------------------------------------------- -// CRoHandlerDMgrWrapper::DownloadAndHandleRoapTriggerL -// --------------------------------------------------------------------------- -// -void CRoHandlerDMgrWrapper::DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ) - { - DRMDEBUGMETHOD( - RoHdlrDMgrWrDebugLiterals::KMethDownloadAndHandleRoapTriggerL() ); - if ( iState != EInit || iWait.IsStarted() ) - { - User::Leave( KErrNotReady ); - } - - UpdateBufferL< HBufC8, TDesC8 >( iTriggerUrl, *aUrl ); - Continue( EGetMeteringTrigger, KErrNone ); - iWait.Start(); - } - -// --------------------------------------------------------------------------- -// CRoHandlerDMgrWrapper::DownloadAndHandleRoapTriggerFromPrUrlL -// --------------------------------------------------------------------------- -// -void CRoHandlerDMgrWrapper::DownloadAndHandleRoapTriggerFromPrUrlL( - const HBufC8* aUrl ) - { - DRMDEBUGMETHOD( RoHdlrDMgrWrDebugLiterals::KMethDownloadAndHandleRoapTriggerFromPrUrlL() ); - if ( iState != EInit || iWait.IsStarted() ) - { - User::Leave( KErrNotReady ); - } - - UpdateBufferL< HBufC8, TDesC8 >( iTriggerUrl, *aUrl ); - Continue( EGetPrUrlTrigger, KErrNone ); - iWait.Start(); - } - -// --------------------------------------------------------------------------- // CRoHandlerDMgrWrapper::DoDownloadRoapTriggerL // --------------------------------------------------------------------------- // @@ -360,7 +270,7 @@ { RFile roapTrigger; TBool result( EFalse ); - TFileName triggerFileName; + DRM::CFileNameContainer* triggerFileName(NULL); DRMDEBUGMETHOD( RoHdlrDMgrWrDebugLiterals::KMethDoDownloadAndHandleRoapTriggerL() ); // If no Trigger URL then nothing to download. So finish transaction @@ -370,10 +280,11 @@ return; } + triggerFileName=DRM::CFileNameContainer::NewLC(); #ifndef RD_MULTIPLE_DRIVE User::LeaveIfError( roapTrigger.Temp( - iFs, KHelperTriggerFilePath, triggerFileName, EFileWrite ) ); + iFs, KHelperTriggerFilePath, triggerFileName->iBuffer, EFileWrite ) ); #else //RD_MULTIPLE_DRIVE _LIT( KDrive, "%c:\\" ); @@ -382,15 +293,20 @@ DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRam, driveNumber ); iFs.DriveToChar( driveNumber, driveLetter ); - TFileName helperTriggerFilePath; + DRM::CFileNameContainer* + helperTriggerFilePath( DRM::CFileNameContainer::NewLC() ); + + helperTriggerFilePath->iBuffer.Format( KDrive, ( TUint )driveLetter ); - helperTriggerFilePath.Format( KDrive, ( TUint )driveLetter ); - - User::LeaveIfError( roapTrigger.Temp( iFs, helperTriggerFilePath, - triggerFileName, EFileWrite ) ); + User::LeaveIfError( roapTrigger.Temp( iFs, helperTriggerFilePath->iBuffer, + triggerFileName->iBuffer, EFileWrite ) ); + CleanupStack::PopAndDestroy( helperTriggerFilePath ); + helperTriggerFilePath=NULL; #endif - UpdateBufferL< HBufC, TFileName >( iFileName, triggerFileName ); + UpdateBufferL< HBufC, TFileName >( iFileName, triggerFileName->iBuffer ); + CleanupStack::PopAndDestroy( triggerFileName ); + triggerFileName=NULL; // create and start download RHttpDownload& download = iDlMgr.CreateDownloadL( *iTriggerUrl, result ); @@ -504,9 +420,7 @@ Roap::TDomainOperation domainOperation; RPointerArray< HBufC8 > contentIds; - - TCleanupItem cleanup( DoResetAndDestroy< HBufC8 >, &contentIds ); - CleanupStack::PushL( cleanup ); + CleanupResetAndDestroyPushL( contentIds ); iRoapEng = Roap::CRoapEng::NewL(); @@ -535,55 +449,11 @@ // void CRoHandlerDMgrWrapper::SetDefaultAccessPointL() { - const TInt KDestinationSelectionMode( 2 ); - CRepository* repository( NULL ); - TInt ap( 0 ); - TInt alwaysAsk( 0 ); - TUint32 iapd32( 0 ); - TInt defaultSnap( 0 ); - TInt err( KErrNone ); - DRMDEBUGMETHOD( RoHdlrDMgrWrDebugLiterals::KMethSetDefaultAccessPointL() ); - if ( !iIapId ) + if ( iIapId ) { - repository = CRepository::NewL( KCRUidBrowser ); - CleanupStack::PushL( repository ); - repository->Get( KBrowserDefaultAccessPoint, ap ); - repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk ); - repository->Get( KBrowserNGDefaultSnapId, defaultSnap ); - if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound ) - { - alwaysAsk = ETrue; - } - else - { - RCmManager cmManager; - cmManager.OpenLC(); - if ( !alwaysAsk ) - { - TRAP( err, iapd32 = cmManager.GetConnectionMethodInfoIntL( - ap, CMManager::ECmIapId ) ); - } - else if ( alwaysAsk == KDestinationSelectionMode ) - { - TRAP( err, iapd32 = IapIdOfDefaultSnapL( - cmManager, defaultSnap ) ); - } - CleanupStack::PopAndDestroy( &cmManager ); - } - if ( !err && ( !alwaysAsk || alwaysAsk == KDestinationSelectionMode ) ) - { - iIapId = iapd32; - DRMDEBUG3( RoHdlrDMgrWrDebugLiterals::KFormatMembValInt(), - &RoHdlrDMgrWrDebugLiterals::KMiIapId(), iIapId ); - err = iDlMgr.SetIntAttribute( EDlMgrIap, iapd32 ); - } - CleanupStack::PopAndDestroy( repository ); - } - else - { - err = iDlMgr.SetIntAttribute( EDlMgrIap, iIapId ); + iDlMgr.SetIntAttribute( EDlMgrIap, iIapId ); } } diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmplugins/drmudtmodule/bwinscw/DrmUdtModuleU.DEF --- a/omadrm/drmplugins/drmudtmodule/bwinscw/DrmUdtModuleU.DEF Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -EXPORTS - ??1CDrmUdtHandler@@UAE@XZ @ 1 NONAME ; CDrmUdtHandler::~CDrmUdtHandler(void) - ?DoUserDataTransferL@CDrmUdtHandler@@QAEXABVTDesC8@@0PAVMDrmUdtObserver@@AAVTRequestStatus@@@Z @ 2 NONAME ; void CDrmUdtHandler::DoUserDataTransferL(class TDesC8 const &, class TDesC8 const &, class MDrmUdtObserver *, class TRequestStatus &) - ?NewL@CDrmUdtHandler@@SAPAV1@XZ @ 3 NONAME ; class CDrmUdtHandler * CDrmUdtHandler::NewL(void) - ?SetPreferredIap@CDrmUdtHandler@@QAEXK@Z @ 4 NONAME ; void CDrmUdtHandler::SetPreferredIap(unsigned long) - diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmplugins/drmudtmodule/eabi/DrmUdtModuleU.DEF --- a/omadrm/drmplugins/drmudtmodule/eabi/DrmUdtModuleU.DEF Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -EXPORTS - _ZN14CDrmUdtHandler15SetPreferredIapEm @ 1 NONAME - _ZN14CDrmUdtHandler19DoUserDataTransferLERK6TDesC8S2_P15MDrmUdtObserverR14TRequestStatus @ 2 NONAME - _ZN14CDrmUdtHandler4NewLEv @ 3 NONAME - _ZTI11CDrmUdtConn @ 4 NONAME ; ## - _ZTI14CDrmUdtHandler @ 5 NONAME ; ## - _ZTV11CDrmUdtConn @ 6 NONAME ; ## - _ZTV14CDrmUdtHandler @ 7 NONAME ; ## - diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmplugins/drmudtmodule/group/DrmUdtModule.mmp --- a/omadrm/drmplugins/drmudtmodule/group/DrmUdtModule.mmp Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: ?Description -* -*/ - - -#include - -TARGET DrmUdtModule.dll -TARGETTYPE DLL -UID 0x1000008D 0x10205CAB -CAPABILITY CAP_GENERAL_DLL DRM -VENDORID VID_DEFAULT - -SOURCEPATH ../src -SOURCE DrmUdtHandler.cpp -SOURCE DrmUdtConn.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../../../omadrm/drmengine/RoapStorage/inc -USERINCLUDE ../../../../omadrm/drmengine/Utils/inc -USERINCLUDE ../../../../inc // ADo level inc dir - -// Default system include paths for middleware layer modules. -MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/http -SYSTEMINCLUDE /epoc32/include/ecom - -LIBRARY euser.lib -LIBRARY estor.lib -LIBRARY efsrv.lib -LIBRARY commdb.lib -LIBRARY bafl.lib -LIBRARY esock.lib -LIBRARY http.lib -LIBRARY inetprotutil.lib -LIBRARY apmime.lib -LIBRARY random.lib -LIBRARY hash.lib -LIBRARY etel.lib -LIBRARY etelmm.lib -LIBRARY flogger.lib -LIBRARY DrmServerInterfaces.lib - -#if defined(ARMCC) -deffile ../eabi/ -#elif defined( WINSCW ) -deffile ../bwinscw/ -#elif defined( WINS ) -deffile ../bwins/ -#else -deffile ../bmarm/ -#endif - -SMPSAFE diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmplugins/drmudtmodule/inc/DrmUdtConn.h --- a/omadrm/drmplugins/drmudtmodule/inc/DrmUdtConn.h Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* -* Copyright (c) 2002-2004 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: ?Description -* -*/ - - -#ifndef DRM_UDT_CONN_H -#define DRM_UDT_CONN_H - -// INCLUDES - -#include -#include -#include - - -// FORWARD DECLARATIONS -class MDrmUdtObserver; - -// CLASS DECLARATION - -class CDrmUdtConn : public CActive - { - public: // Constructors and destructor. - - static CDrmUdtConn* NewL(); - - CDrmUdtConn(); - - ~CDrmUdtConn(); - - public: // new methods - - void ConnectL( TUint32 aIap, - MDrmUdtObserver* aObserver, - TRequestStatus* aStatus ); - - void Close(); - - TBool IsConnected( TUint32& aIap ); - - RSocketServ& SocketServ(); - - RConnection& Conn(); - - private: - - enum TState - { - EInit, - EConnecting, - EConnected - }; - - private: // Constructors and destructor. - - void ConstructL(); - - private: // from CActive - - virtual void DoCancel(); - - virtual void RunL(); - - virtual TInt RunError( TInt aError ); - - private: // new methods - - void DoClose(); - - void Done(); - - private: // data - - RSocketServ iSocketServ; - RConnection iConnection; - TState iState; - TRequestStatus* iParentStatus; - TCommDbConnPref iConnPref; - MDrmUdtObserver* iObserver; - }; - -#endif /* def CONNECTION_H */ diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmplugins/drmudtmodule/src/DrmUdtConn.cpp --- a/omadrm/drmplugins/drmudtmodule/src/DrmUdtConn.cpp Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,311 +0,0 @@ -/* -* Copyright (c) 2002-2004 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: ?Description -* -*/ - - -// INCLUDE FILES - -#include "DrmUdtConn.h" -#include "DrmUdtObserver.h" - -#include -#include -#include -#include - -// #include // for checking APs - -#ifdef _DEBUG -#define LOGGING -#endif - -#define LOGGING - -#ifdef LOGGING -_LIT(KLogDir, "DRM"); -_LIT(KLogName, "UDT.log"); -#include "flogger.h" -#define LOG(string) \ - RFileLogger::Write(KLogDir, KLogName, \ - EFileLoggingModeAppend, string); -#define LOGHEX(buffer) \ - RFileLogger::HexDump(KLogDir, KLogName, \ - EFileLoggingModeAppend, _S(""), _S(""), \ - buffer.Ptr(), buffer.Length()); -#else -#define LOG -#define LOGHEX -#endif - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CDrmUdtConn::NewL() -// --------------------------------------------------------- -// -CDrmUdtConn* CDrmUdtConn::NewL() - { - LOG( _L("CDrmUdtConn::NewL") ); - CDrmUdtConn* conn = new (ELeave) CDrmUdtConn(); - CleanupStack::PushL( conn ); - conn->ConstructL(); - CleanupStack::Pop( conn ); - return conn; - } - -// --------------------------------------------------------- -// CDrmUdtConn::~CDrmUdtConn() -// --------------------------------------------------------- -// -CDrmUdtConn::~CDrmUdtConn() - { - LOG( _L("CDrmUdtConn::~CDrmUdtConn") ); - Cancel(); - iConnection.Close(); - iSocketServ.Close(); - } - -// --------------------------------------------------------- -// CDrmUdtConn::ConnectL() -// --------------------------------------------------------- -// -void CDrmUdtConn::ConnectL( TUint32 aIap, - MDrmUdtObserver* aObserver, - TRequestStatus* aStatus ) - { - LOG( _L("CDrmUdtConn::ConnectL") ); - - iObserver = aObserver; - - if ( iState == EInit ) - { - // Not connected. Attach to existing connection, or create new one if - // allowed. - iStatus = KErrGeneral; - - // Make this part atomic by pushing closes on the stack. - User::LeaveIfError( iSocketServ.Connect() ); - CleanupClosePushL( iSocketServ ); - User::LeaveIfError( iConnection.Open( iSocketServ ) ); - CleanupClosePushL( iConnection ); - - TConnectionInfoBuf connInfo; - TUint count; - User::LeaveIfError( iConnection.EnumerateConnections( count ) ); - TUint i; - if ( count ) - { - // Select from existing connections. Try to make AP match. - for ( i = count; i; i-- ) - { - // Note: GetConnectionInfo expects 1-based index. - User::LeaveIfError( iConnection.GetConnectionInfo( i, connInfo ) ); - if ( aIap == 0 || connInfo().iIapId == aIap ) - { - // "Accept any" or AP match. Attach to this one. - break; - } - } - if ( !i ) - { - // No AP match, select AP with largest index. - User::LeaveIfError - ( iConnection.GetConnectionInfo( count, connInfo ) ); - } - User::LeaveIfError - ( iConnection.Attach( connInfo, RConnection::EAttachTypeNormal ) ); - iState = EConnected; - iStatus = KErrNone; - } - else - { - // No existing connections, create new one. -#ifdef __WINS__ - // WINS connection creation does not work if preferences are given. - // Defaults are to be used always. - iConnection.Start( iStatus ); -#else - // Note: the TCommDbConnPref must NOT be stack variable. - // It must persist until completion of RConnection::Start(). - iConnPref.SetDirection( ECommDbConnectionDirectionOutgoing ); - iConnPref.SetDialogPreference( ECommDbDialogPrefPrompt ); - iConnPref.SetBearerSet( ECommDbBearerCSD | ECommDbBearerWcdma ); - // New connection is always created with user-selected AP; - // so 0 is used instead of aIap. - iConnPref.SetIapId( 0 ); - iConnection.Start( iConnPref, iStatus ); -#endif - if ( iObserver ) - { - iObserver->ConnectionStartedL(); - } - - iState = EConnecting; - SetActive(); // The only path with a real async request. - } - CleanupStack::Pop( 2 ); // closing iConn and iSockServ - // End of atomic part. - } - else - { - // Not expecting this to be called in other states. - } - - iParentStatus = aStatus; - *iParentStatus = KRequestPending; - - if ( !IsActive() ) - { - // Unless we have an outstanding connect request (iConn.Start), - // we are done. - User::RequestComplete( iParentStatus, iStatus.Int() ); - iParentStatus = NULL; - } - } - -// --------------------------------------------------------- -// CDrmUdtConn::Close() -// --------------------------------------------------------- -// -void CDrmUdtConn::Close() - { - LOG( _L("CDrmUdtConn::Close") ); - Cancel(); - iConnection.Close(); - iSocketServ.Close(); - iState = EInit; - } - -// --------------------------------------------------------- -// CDrmUdtConn::IsConnected() -// --------------------------------------------------------- -// -TBool CDrmUdtConn::IsConnected( TUint32& aIap ) - { - LOG( _L("CDrmUdtConn::IsConnected") ); - TBool connected( EFalse ); - if( iState == EConnected ) - { - TBuf iapId; - _LIT( KFormatIapId, "%S\\%S" ); - TPtrC iap( IAP ); - TPtrC id( COMMDB_ID ); - iapId.Format( KFormatIapId, &iap, &id ); - TInt err = iConnection.GetIntSetting( iapId, aIap ); - connected = err ? EFalse : ETrue; - } - return connected; - } - -// --------------------------------------------------------- -// CDrmUdtConn::CConnection() -// --------------------------------------------------------- -// -CDrmUdtConn::CDrmUdtConn() -: CActive( CActive::EPriorityStandard ), - iState( EInit ) - { - LOG( _L("CDrmUdtConn::CDrmUdtConn") ); - CActiveScheduler::Add( this ); - } - -// --------------------------------------------------------- -// CDrmUdtConn::ConstructL() -// --------------------------------------------------------- -// -void CDrmUdtConn::ConstructL() - { - LOG( _L("CDrmUdtConn::ConstructL") ); - /* - TUint32 APs( 0 ); - CCommsDatabase* commsdb = CCommsDatabase::NewL( EDatabaseTypeIAP ); - CleanupStack::PushL( commsdb ); - CApSelect* apSel = CApSelect::NewLC ( - *commsdb, - KEApIspTypeAll, - EApBearerTypeAll, - KEApSortUidAscending ); - APs = apSel->Count(); - CleanupStack::PopAndDestroy( 2 ); - if ( !APs ) - { - // No AP defined - User::Leave( KErrRoapGeneral ); - } - */ - } - -// --------------------------------------------------------- -// CDrmUdtConn::DoCancel() -// --------------------------------------------------------- -// -void CDrmUdtConn::DoCancel() - { - LOG( _L("CDrmUdtConn::DoCancel") ); - iConnection.Close(); - iSocketServ.Close(); - User::RequestComplete( iParentStatus, KErrCancel ); - } - -// --------------------------------------------------------- -// CDrmUdtConn::RunL() -// --------------------------------------------------------- -// -void CDrmUdtConn::RunL() - { - LOG( _L("CDrmUdtConn::RunL") ); - User::LeaveIfError( iStatus.Int() ); // Handle errors in RunError(). - - iState = EConnected; - User::RequestComplete( iParentStatus, iStatus.Int() ); - iParentStatus = NULL; - } - -// --------------------------------------------------------- -// CDrmUdtConn::RunError() -// --------------------------------------------------------- -// -TInt CDrmUdtConn::RunError( TInt /*aError*/ ) - { - LOG( _L("CDrmUdtConn::RunError") ); - iConnection.Close(); - iSocketServ.Close(); - iState = EInit; - User::RequestComplete( iParentStatus, iStatus.Int() ); - iParentStatus = NULL; - return KErrNone; - } - -// --------------------------------------------------------- -// CRoapConnection::Conn() -// --------------------------------------------------------- -// -RSocketServ& CDrmUdtConn::SocketServ() - { - LOG( _L("CDrmUdtConn::SocketServ") ); - return iSocketServ; - } - -// --------------------------------------------------------- -// CRoapConnection::Conn() -// --------------------------------------------------------- -// -RConnection& CDrmUdtConn::Conn() - { - LOG( _L("CDrmUdtConn::Conn") ); - return iConnection; - } - diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/drmplugins/drmudtmodule/src/DrmUdtHandler.cpp --- a/omadrm/drmplugins/drmudtmodule/src/DrmUdtHandler.cpp Fri Apr 16 15:14:55 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1228 +0,0 @@ -/* -* Copyright (c) 2005 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 User Data Transfer module -* -*/ - - -// INCLUDE FILES -#include "DrmUdtHandler.h" -#include "DrmUdtConn.h" -#include "RoapStorageClient.h" -#include "DrmRightsClient.h" -#include "DrmUdtObserver.h" - -#include -#include -#include -#include -#include - -#ifdef _DEBUG -#define LOGGING -#endif - -#define LOGGING - -#ifdef LOGGING -_LIT(KLogDir, "DRM"); -_LIT(KLogName, "UDT.log"); -#include "flogger.h" -#define LOG(string) \ - RFileLogger::Write(KLogDir, KLogName, \ - EFileLoggingModeAppend, string); -#define LOGINT(string, val) \ - RFileLogger::WriteFormat(KLogDir, KLogName, \ - EFileLoggingModeAppend, string, val); -#define LOGHEX(buffer) \ - RFileLogger::HexDump(KLogDir, KLogName, \ - EFileLoggingModeAppend, _S(""), _S(""), \ - buffer.Ptr(), buffer.Length()); -#else -#define LOG -#define LOGHEX -#endif - -using namespace Roap; - -// ================= CONSTANTS ====================== - -// The time out value in HTTP, 30 sec -LOCAL_D const TInt KUdtTimeoutValue = 30000000; - -LOCAL_D const TInt KMaxSerNumLength = 64; -LOCAL_D const TInt KRdbKeyLength = 256; -LOCAL_D const TInt KVersionSize = 1; -LOCAL_D const TInt KMessageIdSize = 1; -LOCAL_D const TInt KLengthSize = 4; -LOCAL_D const TInt KSignatureLength = 128; - -LOCAL_D const TInt KVersion = 0; - -LOCAL_D const TInt KPadding255 = 1; - -_LIT8( KUdtContentType, "application/binary" ); - -// UDT message identifiers -LOCAL_D const TUint8 KUdtRequestId = 0; -LOCAL_D const TUint8 KUdtResponseId = 1; -LOCAL_D const TUint8 KStatusResponseId = 3; -LOCAL_D const TUint8 KErrorResponseId = 4; -LOCAL_D const TUint8 KServerErrorValue = 0; -LOCAL_D const TUint8 KClientErrorValue = 1; - - -LOCAL_D const TInt KUdtResponseSize = 129; - -NONSHARABLE_STRUCT( TUnloadModule ) - { - RTelServer* iServer; - const TDesC* iName; - }; - -// ================= LOCAL FUNCTIONS ========================= - -LOCAL_C void WriteIntToBlock( TInt aValue, TDes8& aBlock, TInt aOffset ) - { - aBlock.SetLength(4); - aBlock[aOffset] = (aValue & 0xff000000) >> 24; - aBlock[aOffset + 1] = (aValue & 0x00ff0000) >> 16; - aBlock[aOffset + 2] = (aValue & 0x0000ff00) >> 8; - aBlock[aOffset + 3] = (aValue & 0x000000ff); - } - -template -void PointerArrayResetDestroyAndClose(TAny* aPtr) - { - (reinterpret_cast*>(aPtr))->ResetAndDestroy(); - (reinterpret_cast*>(aPtr))->Close(); - } - -LOCAL_C void DoUnloadPhoneModule( TAny* aAny ) - { - __ASSERT_DEBUG( aAny, User::Invariant() ); - TUnloadModule* module = ( TUnloadModule* ) aAny; - module->iServer->UnloadPhoneModule( *( module->iName ) ); - } - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CDrmUdtHandler::NewL() -// --------------------------------------------------------- -// -EXPORT_C CDrmUdtHandler* CDrmUdtHandler::NewL( ) - { - LOG( _L("CDrmUdtHandler:NewL:") ); - CDrmUdtHandler* handler = new( ELeave ) CDrmUdtHandler(); - CleanupStack::PushL( handler ); - handler->ConstructL(); - CleanupStack::Pop( handler ); - return handler; - } - -// --------------------------------------------------------- -// CDrmUdtHandler::~CDrmUdtModule() -// --------------------------------------------------------- -// -CDrmUdtHandler::~CDrmUdtHandler() - { - LOG( _L("CDrmUdtHandler::~CDrmUdtHandler") ); - Cancel(); - iSession.Close(); - delete iConnection; - delete iUri; - delete iTimeout; - delete iOneTimePassword; - delete iUdtRequest; - delete iUdtResponse; - } - -// --------------------------------------------------------- -// CDrmUdtHandler::ConstructL() -// --------------------------------------------------------- -// -void CDrmUdtHandler::ConstructL() - { - LOG( _L("CDrmUdtHandler::ConstructL") ); - iConnection = CDrmUdtConn::NewL(); - iTimeout = CPeriodic::NewL( CActive::EPriorityUserInput ); - iRequestType = EUdtRequest; - iUdtError = EUdtOk; - iStateInfo.iState = TUdtStateInfo::EUdtNotStarted; - iStateInfo.iProgress = 0; - iStateInfo.iError = EUdtOk; - } - -// ----------------------------------------------------------------------------- -// CDrmUdtHandler::DoUserDataTransferL() -// ----------------------------------------------------------------------------- -// -EXPORT_C void CDrmUdtHandler::DoUserDataTransferL( const TDesC8& aOneTimePassword, - const TDesC8& aServiceUrl, - MDrmUdtObserver* aObserver, - TRequestStatus& aStatus ) - { - LOG( _L("CDrmUdtHandler::DoUserDataTransferL") ); - __ASSERT_ALWAYS( iState == EInit, User::Invariant() ); - - /* - 1. fetch original RDB data from the rights client (serial number and key) - 2. create UDT package with the original RDB data, the one time password, - our serial number and our certificate - 3. open a connection to the service URL - 4. do a POST to the service URL, sending our UDT package - 5. receive the anwser with the re-encrypted RDB key - 6. tell the rights client to do a restore, using the re-encrypted RDB key - 7. do a POST to the service URL, sendind a success or error notification - */ - - iOneTimePassword = aOneTimePassword.AllocLC(); - iUri = aServiceUrl.AllocL(); - iObserver = aObserver; - - LOG( _L8("Password: ") ); - LOG( aOneTimePassword ); - LOG( _L8("URL: ") ); - LOG( aServiceUrl ); - - iParentStatus = &aStatus; - *iParentStatus = KRequestPending; - iState = EStart; - TRequestStatus* ownStatus = &iStatus; - *ownStatus = KRequestPending; - iRequestType = EUdtRequest; - - SetActive(); - User::RequestComplete( ownStatus, KErrNone ); - CleanupStack::Pop(); // iOneTimePassword - } - -// --------------------------------------------------------- -// CDrmUdtHandler::SetPreferredIap() -// --------------------------------------------------------- -EXPORT_C void CDrmUdtHandler::SetPreferredIap( TUint32 aPreferredIap ) - { - LOG( _L("CDrmUdtHandler::SetPreferredIap") ); - iPreferredIap = aPreferredIap; - } - -// --------------------------------------------------------- -// CDrmUdtHandler::DoCancel() -// --------------------------------------------------------- -// -void CDrmUdtHandler::DoCancel() - { - LOG( _L("CDrmUdtHandler::DoCancel") ); - switch ( iState ) - { - case EStart: - case EConnect: - { - iConnection->Cancel(); - break; - } - case EResponseReceived: - { - iTransaction.Close(); - SelfComplete( iError ); - break; - } - default: - { - break; - } - } - iError = KErrCancel; - Complete(); - } - -// --------------------------------------------------------- -// CDrmUdtHandler::RunL() -// --------------------------------------------------------- -// -void CDrmUdtHandler::RunL() - { - LOG( _L("CDrmUdtHandler::RunL") ); - User::LeaveIfError( iStatus.Int() ); - - switch ( iState ) - { - case EStart: - { - ConnectL(); - break; - } - case EConnect: - { - CreateSessionL(); - break; - } - case ESendMessage: - { - SendUdtMessageL(); - break; - } - case EResponseReceived: - { - ResponseReceivedL(); - break; - } - case EComplete: - { - iState = EInit; - Complete(); - break; - } - case EInit: - default: - { - break; - } - } - } - -// --------------------------------------------------------- -// CDrmUdtHandler::RunError() -// --------------------------------------------------------- -// -TInt CDrmUdtHandler::RunError( TInt aError ) - { - LOG( _L("CDrmUdtHandler::RunError") ); - iError = aError; - iState = EInit; - Complete(); - return KErrNone; - } - -// --------------------------------------------------------- -// CDrmUdtHandler::ConnectL() -// --------------------------------------------------------- -// -void CDrmUdtHandler::ConnectL() - { - LOG( _L("CDrmUdtHandler::ConnectL") ); - __ASSERT_ALWAYS( iState == EStart, User::Invariant() ); - - iConnection->ConnectL( iPreferredIap, iObserver, &iStatus ); - iState = EConnect; - iError = EUdtOk; - SetActive(); - } - -// --------------------------------------------------------- -// CDrmUdtHandler::CreateSessionL() -// --------------------------------------------------------- -// -void CDrmUdtHandler::CreateSessionL() - { - LOG( _L("CDrmUdtHandler::CreateSessionL") ); - __ASSERT_ALWAYS( iState == EConnect, User::Invariant() ); - - TUint32 ap; - - if( !iConnection->IsConnected( ap ) ) - { - User::Leave( KErrGeneral ); - } - - iSession.Close(); - iSession.OpenL(); - - RStringPool strPool = iSession.StringPool(); - - // Remove first session properties just in case. - RHTTPConnectionInfo connInfo = iSession.ConnectionInfo(); - - // Clear RConnection and Socket Server instances - connInfo.RemoveProperty(strPool.StringF(HTTP::EHttpSocketServ,RHTTPSession::GetTable())); - connInfo.RemoveProperty(strPool.StringF(HTTP::EHttpSocketConnection,RHTTPSession::GetTable())); - -#ifdef __WINS__ - // Clear the proxy settings - RStringF proxy; - proxy = strPool.OpenFStringL(_L8("172.22.168.15")); - connInfo.SetPropertyL - ( - strPool.StringF( HTTP::EProxyAddress, RHTTPSession::GetTable() ), - THTTPHdrVal( proxy ) - ); - proxy.Close(); - connInfo.SetPropertyL - ( - strPool.StringF( HTTP::EProxyUsage, RHTTPSession::GetTable() ), - THTTPHdrVal( strPool.StringF(HTTP::EUseProxy, RHTTPSession::GetTable() ) ) - ); - -#else - THTTPHdrVal proxyUsage(strPool.StringF(HTTP::EUseProxy,RHTTPSession::GetTable())); - connInfo.RemoveProperty(strPool.StringF(HTTP::EProxyUsage,RHTTPSession::GetTable())); - connInfo.RemoveProperty(strPool.StringF(HTTP::EProxyAddress,RHTTPSession::GetTable())); -#endif - - connInfo.SetPropertyL - ( - strPool.StringF( HTTP::EHttpSocketServ, RHTTPSession::GetTable() ), - THTTPHdrVal( iConnection->SocketServ().Handle() ) - ); - - connInfo.SetPropertyL - ( - strPool.StringF( HTTP::EHttpSocketConnection, RHTTPSession::GetTable() ), - THTTPHdrVal( REINTERPRET_CAST( TInt, &iConnection->Conn() ) ) - ); - - InstallHttpFiltersL(); - - // Complete requests - TRequestStatus* ownStatus = &iStatus; - *ownStatus = KRequestPending; - iState = ESendMessage; - SetActive(); - User::RequestComplete( ownStatus, KErrNone ); - } - - -// --------------------------------------------------------- -// CDrmUdtModule::InstallHttpFilters() -// --------------------------------------------------------- -// -void CDrmUdtHandler::InstallHttpFiltersL() - { - LOG( _L("CDrmUdtHandler::InstallHttpFiltersL") ); - // CHttpUAProfFilterInterface::InstallFilterL( iSession ); - // CHttpCookieFilter::InstallFilterL( iSession ); - // InstallAuthenticationL( iSession ); - // CHttpFilterProxyInterface::InstallFilterL( iSession ); - } - - -// --------------------------------------------------------- -// CDrmUdtHandler::SendUdtMessageL() -// --------------------------------------------------------- -// -void CDrmUdtHandler::SendUdtMessageL() - { - LOG( _L("CDrmUdtHandler::SendUdtMessageL") ); - __ASSERT_ALWAYS( iState == ESendMessage, User::Invariant() ); - - TUriParser8 uri; - - if ( iRequestType == EUdtRequest ) - { - CreateUdtRequestL(); - } - else if( iRequestType == EStatusNotification ) - { - CreateStatusNotificationL(); - } - - User::LeaveIfError( uri.Parse( *iUri ) ); - RStringF POST; - POST = iSession.StringPool().StringF( HTTP::EPOST, RHTTPSession::GetTable() ); - iTransaction = iSession.OpenTransactionL( uri, *this, POST ); - - // Set required headers - RHTTPHeaders hdrs = iTransaction.Request().GetHeaderCollection(); - - SetHeaderL(hdrs, HTTP::EAccept, KUdtContentType() ); - - SetHeaderL(hdrs, HTTP::EContentType, KUdtContentType() ); - - // Add request body - MHTTPDataSupplier* ds = this; - iTransaction.Request().SetBody(*ds); - - iTransaction.SubmitL(); - - iState = EResponseReceived; - iStatus = KRequestPending; - SetActive(); - - iTimeout->Cancel(); - iTimeout->Start( KUdtTimeoutValue, - KUdtTimeoutValue, - TCallBack( StaticTimeOut,this ) ); - } - - -// --------------------------------------------------------- -// CDrmUdtHandler::CreateUdtRequestL() -// --------------------------------------------------------- -// -void CDrmUdtHandler::CreateUdtRequestL() - { - RRoapStorageClient client; - RPointerArray< HBufC8 > certChain; - TCleanupItem listCleanup( PointerArrayResetDestroyAndClose< HBufC8 >, - &certChain ); - HBufC8* certBlock; - TInt i; - TInt n; - TPtr8 ptr( NULL, 0 ); - TBuf8< sizeof ( TUint32 ) > intBuf; - TBuf8< KMaxSerNumLength > targetSer; - TBuf8< KRdbKeyLength > rdb_data; - TBuf8< KSignatureLength > hash; - HBufC8* signature = NULL; - TInt udtVersion; - CSHA1* hasher = NULL; - - LOG( _L("CDrmUdtHandler::CreateUdtRequestL") ); - delete iUdtRequest; - - if ( iObserver ) - { - iStateInfo.iState = TUdtStateInfo::EUdtReguest; - iStateInfo.iProgress = 0; - iObserver->UdtProgressInfoL( iStateInfo ); - } - - hasher = CSHA1::NewL(); - CleanupStack::PushL( hasher ); - User::LeaveIfError( client.Connect() ); - CleanupClosePushL( client ); - client.SelectTrustedRootL( KNullDesC8 ); - - LOG( _L(" Getting cert chain") ); - User::LeaveIfError( client.GetDeviceCertificateChainL( certChain ) ); - CleanupStack::PushL( listCleanup ); - - LOG( _L(" Getting UDT data") ); - ReadUdtDataL( targetSer, udtVersion, rdb_data ); - - LOG(_L8("RDB data:")); - LOGHEX(rdb_data) - - n = 0; - for ( i = 0; i < certChain.Count(); i++ ) - { - n = n + KLengthSize + certChain[i]->Size(); - } - certBlock = HBufC8::NewL( n ); - CleanupStack::PushL( certBlock ); - ptr.Set( certBlock->Des() ); - for ( i = 0; i < certChain.Count(); i++ ) - { - WriteIntToBlock( certChain[i]->Size(), intBuf, 0 ); - ptr.Append( intBuf ); - ptr.Append( *certChain[i] ); - } - - n = KVersionSize + - KMessageIdSize + - KLengthSize + - iOneTimePassword->Size() + - KLengthSize + - certBlock->Size() + - KLengthSize + - targetSer.Size() + - rdb_data.Size() + - KLengthSize + - KSignatureLength; - - iUdtRequest = HBufC8::NewL( n ); - ptr.Set( iUdtRequest->Des() ); - WriteIntToBlock( n - (KVersionSize + KMessageIdSize + - KLengthSize + KSignatureLength), intBuf, 0 ); - - ptr.Append( KVersion ); // 1. version - ptr.Append( KUdtRequestId ); // 2. request id - ptr.Append( intBuf ); // 3. request length - ptr.Append( *iOneTimePassword ); // 4. password - WriteIntToBlock( certBlock->Size(), intBuf, 0 ); - ptr.Append( intBuf ); // 5. ceritificate block length - ptr.Append( *certBlock ); // 6. ceritificate block - WriteIntToBlock( targetSer.Size(), intBuf, 0 ); - ptr.Append( intBuf ); // 7. serial number length - ptr.Append( targetSer ); // 8. original serial number - ptr.Append( rdb_data ); // 9. RDB data - WriteIntToBlock( udtVersion, intBuf, 0 ); - ptr.Append( intBuf ); // 10. UDT key version - - hasher->Update( ptr ); - hash.Append( 0 ); - hash.Append( KPadding255 ); - for ( i = 2; i < KSignatureLength - SHA1_HASH - 1; i++ ) - { - hash.Append( 255 ); - } - hash.Append( 0 ); - hash.Append( hasher->Final() ); - LOG(_L8("Hash:")); - LOGHEX(hash); - client.RsaSignL( hash, signature ); - CleanupStack::PushL(signature); - ptr.Append( *signature ); // 11. signature - LOG(_L8("Signature:")); - LOGHEX((*signature)); - - CleanupStack::PopAndDestroy( 5 ); // certBlock, listCleanup, - // client, hasher, signature - if ( iObserver ) - { - iStateInfo.iState = TUdtStateInfo::EUdtReguest; - iStateInfo.iProgress += 20; - iObserver->UdtProgressInfoL( iStateInfo ); - } - - LOG(_L8("Request:")); - LOGHEX((*iUdtRequest)); - } - - -// --------------------------------------------------------- -// CDrmUdtHandler::CreateStatusNotificationL() -// --------------------------------------------------------- -// -void CDrmUdtHandler::CreateStatusNotificationL() - { - LOG( _L("CDrmUdtHandler::CreateStatusNotificationL") ); - - if ( iObserver ) - { - iStateInfo.iState = TUdtStateInfo::EUdtStatusNotification; - iStateInfo.iProgress += 20; - iObserver->UdtProgressInfoL( iStateInfo ); - } - - delete iUdtRequest; - iUdtRequest = NULL; - iUdtRequest = HBufC8::NewL(64); - TPtr8 ptr = iUdtRequest->Des(); - ptr.Append(0); - ptr.Append(2); - ptr.Append(*iOneTimePassword); - iUdtError == EUdtOk ? ptr.Append(1) : ptr.Append(0); - } - - -// --------------------------------------------------------- -// CDrmUdtHandler::ResponseReceivedL() -// --------------------------------------------------------- -// -void CDrmUdtHandler::ResponseReceivedL() - { - LOG( _L("CDrmUdtHandler::ResponseReceivedL") ); - __ASSERT_ALWAYS( iState == EResponseReceived, User::Invariant() ); - __ASSERT_ALWAYS( iUdtResponse, User::Invariant() ); - - TPtrC8 udtRespPtr( *iUdtResponse ); - HBufC8* origDBKey = NULL; - TPtrC8 origDBKeyPtr( KNullDesC8 ); - RDRMRightsClient rightsClient; - TInt error = EUdtOk; - - LOGHEX((*iUdtResponse)); - - // check response type - switch ( udtRespPtr[1] ) - { - case KUdtResponseId: - { - if ( iObserver ) - { - iStateInfo.iState = TUdtStateInfo::EUdtKeyRestore; - iStateInfo.iProgress += 20; - iObserver->UdtProgressInfoL( iStateInfo ); - } - - if ( udtRespPtr.Length() < KUdtResponseSize ) - { - User::Leave( KErrCorrupt ); - } - origDBKeyPtr.Set( udtRespPtr.Mid( 2 ) ); - origDBKey = origDBKeyPtr.AllocLC(); - - iUdtError = rightsClient.Connect(); - CleanupClosePushL( rightsClient ); - - if ( !iUdtError ) - { - iUdtError = rightsClient.InitiateUdt( origDBKeyPtr ); - } - - CleanupStack::PopAndDestroy( 2 ); // origDBKey, rightsClient - - iRequestType = EStatusNotification; - iState = ESendMessage; - iStatus = KRequestPending; - SetActive(); - SelfComplete( KErrNone ); - break; - } - case KStatusResponseId: - { - if ( iObserver ) - { - iStateInfo.iState = TUdtStateInfo::EUdtStatusNotification; - iStateInfo.iProgress += 20; - iObserver->UdtProgressInfoL( iStateInfo ); - } - - iState = EComplete; - iStatus = KRequestPending; - SetActive(); - - if ( iUdtError ) - { - error = EUdtKeyRestoreFailed; - iUdtError = EUdtOk; - } - SelfComplete( error ); - break; - } - case KErrorResponseId: - { - if ( udtRespPtr.Length() >= 3 && udtRespPtr[2] == KClientErrorValue ) - { - error = EUdtClientError; - } - else - { - error = EUdtServerError; - } - - iState = EComplete; - iStatus = KRequestPending; - SetActive(); - SelfComplete( error ); - break; - } - default: - { - User::Leave( KErrNotSupported ); - } - } - } - -// --------------------------------------------------------- -// CDrmUdtHandler::SetHeaderL() -// --------------------------------------------------------- -// -void CDrmUdtHandler::SetHeaderL(RHTTPHeaders aHeaders, TInt aHdrField, const TDesC8& aHdrValue) - { - LOG( _L("CDrmUdtHandler::SetHeaderL") ); - RStringF valStr = iSession.StringPool().OpenFStringL(aHdrValue); - THTTPHdrVal val(valStr); - aHeaders.SetFieldL(iSession.StringPool().StringF(aHdrField,RHTTPSession::GetTable()), val); - valStr.Close(); - } - - -// --------------------------------------------------------- -// CDrmUdtHandler::Complete() -// --------------------------------------------------------- -// -void CDrmUdtHandler::Complete() - { - LOG( _L("CDrmUdtHandler::Complete") ); - - delete iUri; - iUri = NULL; - delete iUdtResponse; - iUdtResponse = NULL; - delete iUdtRequest; - iUdtRequest = NULL; - delete iOneTimePassword; - iOneTimePassword = NULL; - - if( iTimeout ) - { - iTimeout->Cancel(); - } - - if ( iObserver ) - { - iStateInfo.iState = TUdtStateInfo::EUdtComplete; - iStateInfo.iProgress = 100; - iStateInfo.iError = iError; - TRAPD(ignore, iObserver->UdtProgressInfoL( iStateInfo )); - } - - User::RequestComplete( iParentStatus, iError ); - iParentStatus = NULL; - } - - -// --------------------------------------------------------- -// CDrmUdtHandler::CDrmUdtModule() -// --------------------------------------------------------- -// -CDrmUdtHandler::CDrmUdtHandler(): CActive( CActive::EPriorityStandard ) - { - LOG( _L("CDrmUdtHandler::CDrmUdtHandler") ); - CActiveScheduler::Add( this ); - } - - -// --------------------------------------------------------- -// CDrmUdtHandler::SelfComplete() -// --------------------------------------------------------- -// -void CDrmUdtHandler::SelfComplete( TInt aResult ) - { - LOG( _L("CDrmUdtHandler::SelfComplete") ); - if ( iStatus == KRequestPending ) - { - TRequestStatus* ownStatus = &iStatus; - User::RequestComplete( ownStatus, aResult ); - } - else - { - if ( aResult != KErrNone ) - { - iStatus = aResult; - } - } - } - - -// --------------------------------------------------------- -// CDrmUdtHandler::MHFRunL() -// --------------------------------------------------------- -// -void CDrmUdtHandler::MHFRunL( RHTTPTransaction /*aTransaction */, - const THTTPEvent& aEvent ) - { - LOGINT( _L("CDrmUdtHandler::MHFRunL: %d"), aEvent.iStatus ); - iTimeout->Cancel(); - iTimeout->Start( KUdtTimeoutValue, - KUdtTimeoutValue, - TCallBack( StaticTimeOut,this ) ); - - switch ( aEvent.iStatus ) - { - case THTTPEvent::EGotResponseHeaders: - { - HandleResponseHeadersL( iTransaction.Response() ); - break; - } - - case THTTPEvent::EGotResponseBodyData: - { - TInt ret( KErrNone ); - MHTTPDataSupplier* body = iTransaction.Response().Body(); - TPtrC8 ptr; - body->GetNextDataPart( ptr ); - ret = AppendResponseData( ptr ); - body->ReleaseData(); - User::LeaveIfError( ret ); - break; - } - - case THTTPEvent::EFailed: - { - if ( iError == KErrNone ) - { - iError = EUdtServerError; - } - iTransaction.Close(); - SelfComplete( iError ); - break; - } - - case THTTPEvent::ESucceeded: - { - iTransaction.Close(); - SelfComplete( iError ); - break; - } - - case THTTPEvent::ERedirectRequiresConfirmation: - { - iTransaction.SubmitL(); - } - - default: - { - if( aEvent.iStatus == KErrHttpRedirectUseProxy ) - { - } - else - { - User::LeaveIfError( aEvent.iStatus ); - } - break; - } - } - - } - -// --------------------------------------------------------- -// CDrmUdtHandler::MHFRunError() -// --------------------------------------------------------- -// -TInt CDrmUdtHandler::MHFRunError ( - TInt aError, - RHTTPTransaction /* aTransaction */, - const THTTPEvent& /* aEvent */ - ) - { - LOG( _L("CDrmUdtHandler::MHFRunError") ); - iTransaction.Close(); - iError = aError; - SelfComplete( iError ); - return KErrNone; - } - -// --------------------------------------------------------- -// CDrmUdtHandler::HandleResponseHeadersL() -// --------------------------------------------------------- -// -void CDrmUdtHandler::HandleResponseHeadersL( RHTTPResponse aHttpResponse ) - { - LOG( _L("CDrmUdtHandler::HandleResponseHeadersL") ); - RHTTPHeaders headers = aHttpResponse.GetHeaderCollection(); - - TInt httpCode = aHttpResponse.StatusCode(); - TBool status; - - status = CheckHttpCode( httpCode ); - - if ( status ) - { - RStringF contentTypeStr; - THTTPHdrVal contentTypeVal; - TPtrC8 ptrContentType(KNullDesC8); - RStringPool srtPool; - srtPool = iSession.StringPool(); - - contentTypeStr = srtPool.StringF( HTTP::EContentType, RHTTPSession::GetTable() ); - User::LeaveIfError( headers.GetField( contentTypeStr, 0, contentTypeVal ) ); - - if ( contentTypeVal.StrF().DesC().CompareF( KUdtContentType() ) != KErrNone ) - { - User::Leave( KErrNotSupported ); - } - - } - if ( aHttpResponse.HasBody() ) - { - TInt dataSize = aHttpResponse.Body()->OverallDataSize(); - if ( dataSize >= 0 ) - { - HBufC8* buf = HBufC8::NewL( dataSize ); - delete iUdtResponse; - iUdtResponse = buf; - } - } - } - -// --------------------------------------------------------- -// CDrmUdtHandler::CheckHttpCode() -// --------------------------------------------------------- -// -TBool CDrmUdtHandler::CheckHttpCode( TInt aHttpStatus ) - { - LOGINT(_L("CDrmUdtHandler::CheckHttpCode: %d"), aHttpStatus); - if ( HTTPStatus::IsInformational( aHttpStatus ) ) - { - // 1xx - // Informational messages. - iError = EUdtServerError; - return EFalse; - } - else if ( aHttpStatus == HTTPStatus::EOk || - aHttpStatus == HTTPStatus::ENonAuthoritativeInfo ) - { - // 200 OK - // 203 Non-Authoritative Information - iError = EUdtOk; - return ETrue; - } - else if ( HTTPStatus::IsSuccessful( aHttpStatus ) ) - { - // 2xx - // Success codes without an usable body. - iError = EUdtServerError; - return EFalse; - } - else if ( aHttpStatus == HTTPStatus::EUnauthorized || - aHttpStatus == HTTPStatus::EProxyAuthenticationRequired ) - { - // 401 Unauthorized - // 407 Proxy authentication required - iError = EUdtInvalidServerAddress; - return EFalse; - } - else if ( aHttpStatus == HTTPStatus::ENotFound || - aHttpStatus == HTTPStatus::EGone ) - { - // 404 Not found - // 410 Gone - iError = EUdtInvalidServerAddress; - return EFalse; - } - else if ( HTTPStatus::IsClientError( aHttpStatus ) ) - { - // 4xx - iError = EUdtInvalidServerAddress; - return EFalse; - } - else if ( aHttpStatus == HTTPStatus::EHTTPVersionNotSupported ) - { - // 505 HTTP Version Not Supported - iError = EUdtServerError; - return EFalse; - } - else if ( HTTPStatus::IsServerError( aHttpStatus ) ) - { - // 5xx - iError = EUdtServerError; - return EFalse; - } - else - { - // Everything else. - iError = EUdtServerError; - } - return EFalse; - } - - -// --------------------------------------------------------- -// CDrmUdtModule::AppendResponseData() -// --------------------------------------------------------- -// -TInt CDrmUdtHandler::AppendResponseData( const TDesC8& aDataChunk ) - { - LOG( _L("CDrmUdtHandler::AppendResponseData") ); - TInt needed = iUdtResponse->Des().Length() + aDataChunk.Length(); - if ( iUdtResponse->Des().MaxLength() < needed ) - { - HBufC8* buf = iUdtResponse->ReAlloc( needed ); - if ( buf ) - { - iUdtResponse = buf; - } - else - { - return KErrNoMemory; - } - } - iUdtResponse->Des().Append( aDataChunk ); - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CDrmUdtHandler::StaticTimeOut() -// ----------------------------------------------------------------------------- -// -TInt CDrmUdtHandler::StaticTimeOut( TAny* aPointer ) - { - LOG( _L("CDrmUdtHandler::StaticTimeOut") ); - CDrmUdtHandler* itself = STATIC_CAST(CDrmUdtHandler*, aPointer); - if(itself) - { - itself->TimeOut(); - } - return KErrNone; - } - - -// ----------------------------------------------------------------------------- -// CDrmUdtHandler::TimeOut() -// ----------------------------------------------------------------------------- -// -void CDrmUdtHandler::TimeOut() - { - LOG( _L("CDrmUdtHandler::TimeOut") ); - iTransaction.Close(); - iError = KErrTimedOut; - SelfComplete( iError ); - } - - -// --------------------------------------------------------- -// CDrmUdtHandler::GetNextDataPart() -// --------------------------------------------------------- -// -TBool CDrmUdtHandler::GetNextDataPart( TPtrC8& aDataPart ) - { - LOG( _L("CDrmUdtHandler::GetNextDataPart") ); - aDataPart.Set( iUdtRequest->Des() ); - return ETrue; - } - -// --------------------------------------------------------- -// CDrmUdtHandler::ReleaseData() -// --------------------------------------------------------- -// -void CDrmUdtHandler::ReleaseData() - { - LOG( _L("CDrmUdtHandler::ReleaseData") ); - } - -// --------------------------------------------------------- -// CDrmUdtHandler::OverallDataSize() -// --------------------------------------------------------- -// -TInt CDrmUdtHandler::OverallDataSize() - { - LOG( _L("CDrmUdtHandler::OverallDataSize") ); - return iUdtRequest->Des().Size(); - } - -// --------------------------------------------------------- -// CDrmUdtHandler::Reset() -// --------------------------------------------------------- -// -TInt CDrmUdtHandler::Reset() - { - LOG( _L("CDrmUdtHandler::Reset") ); - return KErrNone; - } - -// --------------------------------------------------------- -// CDrmUdtHandler::ReadUdtDataL -// -// --------------------------------------------------------- -// -void CDrmUdtHandler::ReadUdtDataL( - TDes8& aTargetSerialNumber, - TInt& aUdtKeyVersion, - TDes8& aEncryptedRdbData ) - { - RDRMRightsClient rightsClient; - HBufC* serialNum = NULL; - - LOG( _L("CDrmUdtHandler::ReadUdtDataL") ); - User::LeaveIfError( rightsClient.Connect() ); - CleanupClosePushL( rightsClient ); - serialNum = SerialNumberL(); - - aTargetSerialNumber.Copy( *serialNum ); - - aUdtKeyVersion = 0; - User::LeaveIfError( rightsClient.GetUdtData( aEncryptedRdbData ) ); - if( !aEncryptedRdbData.Length() ) - { - User::Leave( KErrNotFound ); - } - CleanupStack::PopAndDestroy(); // rightsClient - } - -// --------------------------------------------------------- -// CDrmUdtHandler::ReadUdtDataL -// -// --------------------------------------------------------- -// -HBufC* CDrmUdtHandler::SerialNumberL() - { - TInt error( KErrNone ); - TInt count( 0 ); - TInt count2( 0 ); - TUint32 caps( 0 ); - HBufC* imei = NULL; - -#ifndef __WINS__ - LOG( _L("CDrmUdtHandler::SerialNumberL") ); - - RTelServer etelServer; - RMobilePhone phone; - - for ( TUint8 i = 0; i < 3; ++i ) - { - error = etelServer.Connect(); - if ( error ) - { - User::After( TTimeIntervalMicroSeconds32( 100000 ) ); - } - } - - User::LeaveIfError( error ); - CleanupClosePushL( etelServer ); - - LOG( _L(" Connected to ETEL") ); - - User::LeaveIfError( etelServer.LoadPhoneModule( KMmTsyModuleName ) ); - - LOG( _L(" Phone Module loaded") ); - - TUnloadModule unload; - unload.iServer = &etelServer; - unload.iName = &KMmTsyModuleName; - - TCleanupItem item( DoUnloadPhoneModule, &unload ); - CleanupStack::PushL( item ); - - User::LeaveIfError( etelServer.EnumeratePhones( count ) ); - - LOG( _L(" Phones enumerated") ); - - for ( count2 = 0; count2 < count; ++count2 ) - { - RTelServer::TPhoneInfo phoneInfo; - User::LeaveIfError( etelServer.GetTsyName( count2, phoneInfo.iName ) ); - - LOG( _L(" Got TSY module") ); - LOG( phoneInfo.iName ); - if ( phoneInfo.iName.CompareF( KMmTsyModuleName ) == 0 ) - { - User::LeaveIfError( etelServer.GetPhoneInfo( count2, phoneInfo ) ); - LOG( _L(" Got phone info") ); - User::LeaveIfError( phone.Open( etelServer, phoneInfo.iName ) ); - LOG( _L(" Opened phone") ); - CleanupClosePushL( phone ); - break; - } - } - - if ( count2 == count ) - { - // Not found. - LOG( _L(" No phone found") ); - User::Leave( KErrNotFound ); - } - - LOG( _L(" Got phone") ); - - User::LeaveIfError( phone.GetIdentityCaps( caps ) ); - - LOG( _L(" Got Caps") ); - - if ( caps & RMobilePhone::KCapsGetSerialNumber ) - { - RMobilePhone::TMobilePhoneIdentityV1 id; - TRequestStatus status; - - phone.GetPhoneId( status, id ); - User::WaitForRequest( status ); - - User::LeaveIfError( status.Int() ); - - imei = id.iSerialNumber.AllocL(); - - LOG( _L(" Got serial number") ); - - CleanupStack::PopAndDestroy( 3 ); // phone, item, etelServer - - return imei; - } - - User::Leave( KErrNotFound ); - - // Never happens... - return imei; - -#else - _LIT( KDefaultSerialNumber, "123456789123456789" ); - imei = KDefaultSerialNumber().AllocL(); - - return imei; -#endif - } - - diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/group/bld.inf --- a/omadrm/group/bld.inf Fri Apr 16 15:14:55 2010 +0300 +++ b/omadrm/group/bld.inf Mon May 03 12:46:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2005-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" @@ -31,7 +31,7 @@ ../conf/drmutility_20022D51.crml MW_LAYER_CRML(drmutility_20022D51.crml) ../drmengine/group/CryptoPrep.flm /epoc32/tools/makefile_templates/s60/CryptoPrep.flm ../drmengine/group/CryptoPrep.xml /epoc32/tools/makefile_templates/s60/CryptoPrep.xml -../drmengine/server/data/101F51F2.exc /epoc32/data/Z/private/102073ea/excludes/101F51F2.exc +../drmengine/server/data/101F51F2.exc /epoc32/data/Z/private/102073ea/excludes/101F51F2.exc //Loc files // Ro Handler (only used if OMA DRM 1.0 Full is enabled) @@ -41,37 +41,6 @@ ../drmplugins/drmromtm/loc/RoMtmUi.loc MW_LAYER_LOC_EXPORT_PATH( romtmui.loc ) -// CMLA RnD keys -../drmengine/keystorage/data/CMLA/DevicePrivateKey.der /epoc32/winscw/c/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/DevicePrivateKey.der -../drmengine/keystorage/data/CMLA/DeviceCert.der /epoc32/winscw/c/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/DeviceCert.der -../drmengine/keystorage/data/CMLA/SigningCert00.der /epoc32/winscw/c/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/SigningCert00.der -../drmengine/keystorage/data/CMLA/SigningCert01.der /epoc32/winscw/c/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/SigningCert01.der - -../drmengine/keystorage/data/CMLA/DevicePrivateKey.der /epoc32/release/winscw/udeb/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/DevicePrivateKey.der -../drmengine/keystorage/data/CMLA/DeviceCert.der /epoc32/release/winscw/udeb/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/DeviceCert.der -../drmengine/keystorage/data/CMLA/SigningCert00.der /epoc32/release/winscw/udeb/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/SigningCert00.der -../drmengine/keystorage/data/CMLA/SigningCert01.der /epoc32/release/winscw/udeb/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/SigningCert01.der - -../drmengine/keystorage/data/CMLA/DevicePrivateKey.der /epoc32/release/winscw/urel/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/DevicePrivateKey.der -../drmengine/keystorage/data/CMLA/DeviceCert.der /epoc32/release/winscw/urel/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/DeviceCert.der -../drmengine/keystorage/data/CMLA/SigningCert00.der /epoc32/release/winscw/urel/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/SigningCert00.der -../drmengine/keystorage/data/CMLA/SigningCert01.der /epoc32/release/winscw/urel/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/SigningCert01.der - -../drmengine/keystorage/data/CMLA/DevicePrivateKey.der /epoc32/data/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/DevicePrivateKey.der -../drmengine/keystorage/data/CMLA/DeviceCert.der /epoc32/data/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/DeviceCert.der -../drmengine/keystorage/data/CMLA/SigningCert00.der /epoc32/data/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/SigningCert00.der -../drmengine/keystorage/data/CMLA/SigningCert01.der /epoc32/data/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/SigningCert01.der - -// Default UDT Key -#ifdef __DRM_USER_DATA_TRANSFER -../drmengine/keystorage/data/UdtCertificate.der /epoc32/winscw/c/private/101F51F2/PKI/UdtCertificate.der - -../drmengine/keystorage/data/UdtCertificate.der /epoc32/release/winscw/udeb/z/private/101F51F2/PKI/UdtCertificate.der -../drmengine/keystorage/data/UdtCertificate.der /epoc32/release/winscw/urel/z/private/101F51F2/PKI/UdtCertificate.der - -../drmengine/keystorage/data/UdtCertificate.der /epoc32/data/z/private/101F51F2/PKI/UdtCertificate.der -#endif - // backup_registration.xml ../drmengine/group/backup_registration.xml /epoc32/winscw/c/private/101F51F2/backup_registration.xml ../drmengine/group/backup_registration.xml /epoc32/data/z/private/101F51F2/backup_registration.xml @@ -127,10 +96,6 @@ ../drmengine/group/DcfRepSrv.mmp ../drmengine/group/ROAPHandler.mmp -#ifdef __DRM_USER_DATA_TRANSFER -../drmplugins/drmudtmodule/group/DrmUdtModule.mmp -#endif - // DRMService API ../drmengine/group/DrmServiceAPI.mmp @@ -156,7 +121,6 @@ // DRMHelper ../drmhelper/group/Drmhelper.mmp -../drmhelper/group/drmhelperdmgrwrapper.mmp #ifdef SBSV2 PRJ_EXTENSIONS diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/rom/DRM5.iby --- a/omadrm/rom/DRM5.iby Fri Apr 16 15:14:55 2010 +0300 +++ b/omadrm/rom/DRM5.iby Mon May 03 12:46:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2005-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" @@ -57,17 +57,12 @@ file=ABI_DIR\BUILD_DIR\DrmServerInterfaces.DLL SHARED_LIB_DIR\DrmServerInterfaces.DLL file=ABI_DIR\BUILD_DIR\DrmParsers.DLL SHARED_LIB_DIR\DrmParsers.DLL -// DRM Rights server +// DRM Rights server file=ABI_DIR\BUILD_DIR\RightsServer.EXE PROGRAMS_DIR\RightsServer.EXE // DRM Service API file=ABI_DIR\BUILD_DIR\DrmServiceAPI.dll SHARED_LIB_DIR\DrmServiceAPI.dll -// DRM UDT Module -#ifdef __DRM_USER_DATA_TRANSFER -file=ABI_DIR\BUILD_DIR\DRMUDTMODULE.DLL SHARED_LIB_DIR\DRMUDTMODULE.DLL -#endif - // DRM recognizer for protected contents #ifdef __DRM //S60_INTEGRATION file=ABI_DIR\BUILD_DIR\RECDRM.DLL RECOGNISERS_DIR\RECDRM.DLL @@ -76,7 +71,7 @@ ECOM_PLUGIN(RECDRM.DLL,101F51F4.RSC) // RFS exclude list -data=DATAZ_\private\102073ea\excludes\101F51F2.exc private\102073ea\excludes\101F51F2.exc +data=DATAZ_\private\102073ea\excludes\101F51F2.exc private\102073ea\excludes\101F51F2.exc #endif @@ -142,23 +137,11 @@ // #include // #include -// Default CMLA RnD Test Keys - -data=ZPRIVATE\101F51F2\PKI\96b7db19a4d05a4bc8e3a51c885088e679354469\DevicePrivateKey.der PRIVATE\101F51F2\PKI\96b7db19a4d05a4bc8e3a51c885088e679354469\DevicePrivateKey.der -data=ZPRIVATE\101F51F2\PKI\96b7db19a4d05a4bc8e3a51c885088e679354469\DeviceCert.der PRIVATE\101F51F2\PKI\96b7db19a4d05a4bc8e3a51c885088e679354469\DeviceCert.der -data=ZPRIVATE\101F51F2\PKI\96b7db19a4d05a4bc8e3a51c885088e679354469\SigningCert00.der PRIVATE\101F51F2\PKI\96b7db19a4d05a4bc8e3a51c885088e679354469\SigningCert00.der -data=ZPRIVATE\101F51F2\PKI\96b7db19a4d05a4bc8e3a51c885088e679354469\SigningCert01.der PRIVATE\101F51F2\PKI\96b7db19a4d05a4bc8e3a51c885088e679354469\SigningCert01.der +// Backup registration +data=ZPRIVATE\101F51F2\backup_registration.xml PRIVATE\101F51F2\backup_registration.xml -// Default UDT key -#ifdef __DRM_USER_DATA_TRANSFER -data=ZPRIVATE\101F51F2\PKI\UdtCertificate.der PRIVATE\101F51F2\PKI\UdtCertificate.der -#endif - -// Backup registration -data=ZPRIVATE\101F51F2\backup_registration.xml PRIVATE\101F51F2\backup_registration.xml - -// SIS stub for agent upgrades -data=ZSYSTEM\Install\OmaDrm_Stub.SIS \system\install\OmaDrm_Stub.SIS +// SIS stub for agent upgrades +data=ZSYSTEM\Install\OmaDrm_Stub.SIS \system\install\OmaDrm_Stub.SIS #endif // DRM #endif // __DRM5_IBY__ diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/rom/DRMHelper.iby --- a/omadrm/rom/DRMHelper.iby Fri Apr 16 15:14:55 2010 +0300 +++ b/omadrm/rom/DRMHelper.iby Mon May 03 12:46:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2005-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" @@ -19,7 +19,6 @@ #ifndef __DRMHELPER_IBY__ #define __DRMHELPER_IBY__ -file=ABI_DIR\BUILD_DIR\DRMHelperDMgrWrapper.dll SHARED_LIB_DIR\DRMHelperDMgrWrapper.dll file=ABI_DIR\BUILD_DIR\DRMHelper.dll SHARED_LIB_DIR\DRMHelper.dll #endif diff -r 493788a4a8a4 -r 3bdc3b853094 omadrm/rom/DRMHelperResources.iby --- a/omadrm/rom/DRMHelperResources.iby Fri Apr 16 15:14:55 2010 +0300 +++ b/omadrm/rom/DRMHelperResources.iby Mon May 03 12:46:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2005-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" @@ -19,7 +19,6 @@ #ifndef __DRMHELPER_RESOURCES_IBY__ #define __DRMHELPER_RESOURCES_IBY__ -data=DATAZ_\RESOURCE_FILES_DIR\drmhelper.rsc RESOURCE_FILES_DIR\drmhelper.rsc -data=DATAZ_\RESOURCE_FILES_DIR\drmhelperdmgrwrapper.rsc RESOURCE_FILES_DIR\drmhelperdmgrwrapper.rsc +data=DATAZ_\RESOURCE_FILES_DIR\drmhelper.rsc RESOURCE_FILES_DIR\drmhelper.rsc -#endif \ No newline at end of file +#endif diff -r 493788a4a8a4 -r 3bdc3b853094 wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowsercontainer.cpp --- a/wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowsercontainer.cpp Fri Apr 16 15:14:55 2010 +0300 +++ b/wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowsercontainer.cpp Mon May 03 12:46:34 2010 +0300 @@ -34,8 +34,7 @@ { CreateWindowL(); SetRect( iView->ClientRect() ); - ActivateL(); - + iBrCtlInterface = CreateBrowserControlL( this, // parent control iView->ClientRect(), // client rect @@ -59,6 +58,7 @@ ETrue ); iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsEmbedded, ETrue ); + ActivateL(); } // --------------------------------------------------------------------------- diff -r 493788a4a8a4 -r 3bdc3b853094 wmdrm/camese/wmdrmdladefaulthttpplugin/src/wmdrmdladefaulthttpmanager.cpp --- a/wmdrm/camese/wmdrmdladefaulthttpplugin/src/wmdrmdladefaulthttpmanager.cpp Fri Apr 16 15:14:55 2010 +0300 +++ b/wmdrm/camese/wmdrmdladefaulthttpplugin/src/wmdrmdladefaulthttpmanager.cpp Mon May 03 12:46:34 2010 +0300 @@ -660,9 +660,9 @@ if ( (iState == EOpen) && iKeepAlive ) { TConnectionInfo connectionInfo; - GetConnectionInfoL(connectionInfo); - if ( connectionInfo.iIapId != iIapNumber && - iIapNumber != 0 && connectionInfo.iIapId != 0 ) + TRAPD(err, GetConnectionInfoL(connectionInfo) ); + if ( err || ( connectionInfo.iIapId != iIapNumber && + iIapNumber != 0 && connectionInfo.iIapId != 0 ) ) { CleanupConnection(); iState = EStart; diff -r 493788a4a8a4 -r 3bdc3b853094 wmdrm/group/bld.inf --- a/wmdrm/group/bld.inf Fri Apr 16 15:14:55 2010 +0300 +++ b/wmdrm/group/bld.inf Mon May 03 12:46:34 2010 +0300 @@ -69,3 +69,5 @@ #endif // __WINDOWS_MEDIA_DRM #include "../wmdrmengine/wmdrmaccess/group/bld.inf" + +#include "../wmdrmengine/wmdrmotaaccess/group/bld.inf" diff -r 493788a4a8a4 -r 3bdc3b853094 wmdrm/wmdrmengine/wmdrmotaaccess/bwins/wmdrmotaaccessu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wmdrm/wmdrmengine/wmdrmotaaccess/bwins/wmdrmotaaccessu.def Mon May 03 12:46:34 2010 +0300 @@ -0,0 +1,9 @@ +EXPORTS + ??1CWmDrmOtaAccess@@UAE@XZ @ 1 NONAME ; CWmDrmOtaAccess::~CWmDrmOtaAccess(void) + ?NewL@CWmDrmOtaAccess@@SAPAV1@XZ @ 2 NONAME ; class CWmDrmOtaAccess * CWmDrmOtaAccess::NewL(void) + ?NewLC@CWmDrmOtaAccess@@SAPAV1@XZ @ 3 NONAME ; class CWmDrmOtaAccess * CWmDrmOtaAccess::NewLC(void) + ?HandleLicenseResponseL@CWmDrmOtaAccess@@QAEXABVTDesC8@@@Z @ 4 NONAME ; void CWmDrmOtaAccess::HandleLicenseResponseL(class TDesC8 const &) + ?GetLicenseChallengeL@CWmDrmOtaAccess@@QAEXABVTDesC8@@AAPAVHBufC8@@AAVTRequestStatus@@@Z @ 5 NONAME ; void CWmDrmOtaAccess::GetLicenseChallengeL(class TDesC8 const &, class HBufC8 * &, class TRequestStatus &) + ?HandleLicenseResponseL@CWmDrmOtaAccess@@QAEXABVTDesC8@@AAVTRequestStatus@@@Z @ 6 NONAME ; void CWmDrmOtaAccess::HandleLicenseResponseL(class TDesC8 const &, class TRequestStatus &) + ?GetLicenseChallengeL@CWmDrmOtaAccess@@QAEXABVTDesC8@@AAPAVHBufC8@@@Z @ 7 NONAME ; void CWmDrmOtaAccess::GetLicenseChallengeL(class TDesC8 const &, class HBufC8 * &) + diff -r 493788a4a8a4 -r 3bdc3b853094 wmdrm/wmdrmengine/wmdrmotaaccess/eabi/wmdrmotaaccessu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wmdrm/wmdrmengine/wmdrmotaaccess/eabi/wmdrmotaaccessu.def Mon May 03 12:46:34 2010 +0300 @@ -0,0 +1,11 @@ +EXPORTS + _ZN15CWmDrmOtaAccess4NewLEv @ 1 NONAME + _ZN15CWmDrmOtaAccess5NewLCEv @ 2 NONAME + _ZN15CWmDrmOtaAccessD0Ev @ 3 NONAME + _ZN15CWmDrmOtaAccessD1Ev @ 4 NONAME + _ZN15CWmDrmOtaAccessD2Ev @ 5 NONAME + _ZN15CWmDrmOtaAccess20GetLicenseChallengeLERK6TDesC8RP6HBufC8 @ 6 NONAME + _ZN15CWmDrmOtaAccess20GetLicenseChallengeLERK6TDesC8RP6HBufC8R14TRequestStatus @ 7 NONAME + _ZN15CWmDrmOtaAccess22HandleLicenseResponseLERK6TDesC8 @ 8 NONAME + _ZN15CWmDrmOtaAccess22HandleLicenseResponseLERK6TDesC8R14TRequestStatus @ 9 NONAME + diff -r 493788a4a8a4 -r 3bdc3b853094 wmdrm/wmdrmengine/wmdrmotaaccess/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wmdrm/wmdrmengine/wmdrmotaaccess/group/bld.inf Mon May 03 12:46:34 2010 +0300 @@ -0,0 +1,29 @@ +/* +* 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: +* bld.inf +* +*/ + +#include + +PRJ_EXPORTS +../rom/wmdrmotaaccess.iby CORE_MW_LAYER_IBY_EXPORT_PATH( wmdrmotaaccess.iby ) + +PRJ_PLATFORMS +DEFAULT + +PRJ_MMPFILES +wmdrmotaaccess.mmp + diff -r 493788a4a8a4 -r 3bdc3b853094 wmdrm/wmdrmengine/wmdrmotaaccess/group/wmdrmotaaccess.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wmdrm/wmdrmengine/wmdrmotaaccess/group/wmdrmotaaccess.mmp Mon May 03 12:46:34 2010 +0300 @@ -0,0 +1,42 @@ +/* +* 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: +* wmdrmotaaccess.mmp +* +*/ + +#include + +TARGET wmdrmotaaccess.dll +TARGETTYPE dll +UID 0x1000008D 0x2002E680 + +CAPABILITY ALL -TCB + +DEFFILE wmdrmotaaccess.def + +SOURCEPATH ../src +SOURCE wmdrmotaaccess.cpp + +MW_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc + +LIBRARY euser.lib +LIBRARY ecom.lib + +LANG SC + +SMPSAFE +// End of File diff -r 493788a4a8a4 -r 3bdc3b853094 wmdrm/wmdrmengine/wmdrmotaaccess/rom/wmdrmotaaccess.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wmdrm/wmdrmengine/wmdrmotaaccess/rom/wmdrmotaaccess.iby Mon May 03 12:46:34 2010 +0300 @@ -0,0 +1,27 @@ +/* +* 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: +* wmdrmotaaccess.iby +* +*/ + +#ifndef _WMDRMOTAACCESS_IBY_ +#define _WMDRMOTAACCESS_IBY_ +#include + +#if (defined __WINDOWS_MEDIA_DRM) +file=ABI_DIR\BUILD_DIR\wmdrmotaaccess.dll PROGRAMS_DIR\wmdrmotaaccess.dll +#endif // __WINDOWS_MEDIA_DRM + +#endif // _WMDRMACCESS_IBY_ diff -r 493788a4a8a4 -r 3bdc3b853094 wmdrm/wmdrmengine/wmdrmotaaccess/src/wmdrmotaaccess.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wmdrm/wmdrmengine/wmdrmotaaccess/src/wmdrmotaaccess.cpp Mon May 03 12:46:34 2010 +0300 @@ -0,0 +1,143 @@ +/* +* 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: +* wmdrmotaaccess.cpp +* +*/ + +#include +#include + +#include +#include + +// --------------------------------------------------------------------------- +// CWmDrmOtaAccess::NewL +// --------------------------------------------------------------------------- +EXPORT_C CWmDrmOtaAccess* CWmDrmOtaAccess::NewL() + { + CWmDrmOtaAccess* self(CWmDrmOtaAccess::NewLC()); + CleanupStack::Pop(self); + return self; + } + + +// --------------------------------------------------------------------------- +// CWmDrmOtaAccess::NewLC +// --------------------------------------------------------------------------- +EXPORT_C CWmDrmOtaAccess* CWmDrmOtaAccess::NewLC() + { + CWmDrmOtaAccess* self(new (ELeave) CWmDrmOtaAccess); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CWmDrmOtaAccess::ConstructL +// --------------------------------------------------------------------------- +void CWmDrmOtaAccess::ConstructL() + { + iWmDrmOtaAccessEcomInterface = CWmDrmOtaAccessEcomInterface::NewL(); + } + + +// --------------------------------------------------------------------------- +// CWmDrmOtaAccess::CWmDrmOtaAccess +// --------------------------------------------------------------------------- +CWmDrmOtaAccess::CWmDrmOtaAccess() + { + } + +// --------------------------------------------------------------------------- +// CWmDrmOtaAccess::~CWmDrmOtaAccess +// --------------------------------------------------------------------------- +EXPORT_C CWmDrmOtaAccess::~CWmDrmOtaAccess() + { + if (iWmDrmOtaAccessEcomInterface) + { + delete iWmDrmOtaAccessEcomInterface; + } + REComSession::FinalClose(); + } + + +// --------------------------------------------------------------------------- +// CWmDrmOtaAccess::GetLicenseChallengeL +// --------------------------------------------------------------------------- +EXPORT_C void CWmDrmOtaAccess::GetLicenseChallengeL( const TDesC8& aDrmHeader, + HBufC8*& aChallenge ) + { + // Ecom interface not available + if( !iWmDrmOtaAccessEcomInterface ) + { + User::Leave( KErrNotReady ); + } + + iWmDrmOtaAccessEcomInterface->GetLicenseChallengeL( aDrmHeader, + aChallenge ); + } + +// --------------------------------------------------------------------------- +// CWmDrmOtaAccess::GetLicenseChallengeL +// --------------------------------------------------------------------------- +EXPORT_C void CWmDrmOtaAccess::GetLicenseChallengeL( const TDesC8& aDrmHeader, + HBufC8*& aChallenge, + TRequestStatus& aStatus ) + { + // Ecom interface not available + if( !iWmDrmOtaAccessEcomInterface ) + { + User::Leave( KErrNotReady ); + } + + iWmDrmOtaAccessEcomInterface->GetLicenseChallengeL( aDrmHeader, + aChallenge, + aStatus ); + } + +// --------------------------------------------------------------------------- +// CWmDrmOtaAccess::HandleLicenseResponseL +// --------------------------------------------------------------------------- +EXPORT_C void CWmDrmOtaAccess::HandleLicenseResponseL( const TDesC8& aResponse ) + { + // Ecom interface not available + if( !iWmDrmOtaAccessEcomInterface ) + { + User::Leave( KErrNotReady ); + } + + iWmDrmOtaAccessEcomInterface->HandleLicenseResponseL( aResponse ); + } +// --------------------------------------------------------------------------- +// CWmDrmOtaAccess::HandleLicenseResponseL +// --------------------------------------------------------------------------- +EXPORT_C void CWmDrmOtaAccess::HandleLicenseResponseL( const TDesC8& aResponse, + TRequestStatus& aStatus ) + { + // Ecom interface not available + if( !iWmDrmOtaAccessEcomInterface ) + { + User::Leave( KErrNotReady ); + } + + iWmDrmOtaAccessEcomInterface->HandleLicenseResponseL( aResponse, + aStatus ); + } + + + + +// End of file