breakdeps/DRMEngine/DRMRightsServer.cpp
author Tom Pritchard <tomp@symbian.org>
Wed, 27 Oct 2010 15:05:33 +0100
changeset 90 62156f66dbad
parent 88 ca165d35976d
permissions -rw-r--r--
Breaking DRM's dependency Etel so that AVKON can start. The ROM now boots, but doesn't seem to have any items in the matrix menu at all.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
88
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     1
/*
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     2
* Copyright (c) 2003 - 2007 Nokia Corporation and/or its subsidiary(-ies).
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     3
* All rights reserved.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     8
*
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     9
* Initial Contributors:
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    11
*
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    12
* Contributors:
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    13
*
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    14
* Description:  DRM3 Engine manages all DRM related database operations.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    15
*
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    16
*/
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    17
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    18
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    19
// INCLUDE FILES
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    20
#include <e32std.h>
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    21
#include <e32test.h>
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    22
#include <etelmm.h>
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    23
#include <DRMTypes.h>
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    24
#include <starterclient.h>
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    25
#include <featmgr.h>
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    26
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    27
#ifdef RD_MULTIPLE_DRIVE
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    28
#include <driveinfo.h>
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    29
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    30
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    31
#include "DRMRightsServer.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    32
#include "drmrightsdb.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    33
#include "DRMDbSession.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    34
#include "DRMEngineClientServer.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    35
#include "drmlog.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    36
#include "DRMNotifier.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    37
#include "DrmKeyStorage.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    38
#include "DRMNotifierServer.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    39
#include "RoapStorageServer.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    40
#include "drmnotifierclientserver.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    41
#include "drmroapclientserver.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    42
#include "DRMXOma.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    43
#include "DRMBackupObserver.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    44
#include "DRMBackup.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    45
#include "flogger.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    46
#include "DrmRightsParser.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    47
#include "DRMRights.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    48
#include "DRMHelperCommon.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    49
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    50
#include  "wmdrmclientwrapper.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    51
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    52
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    53
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    54
#ifdef __DRM_CLOCK
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    55
#include "DRMClockServer.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    56
#include "drmclockclientserver.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    57
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    58
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    59
#include <utf.h>
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    60
#include <DRMIndividualConstraintExtension.h>
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    61
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    62
/*
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    63
_LIT( KLogDir, "drm");
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    64
_LIT( KLogName, "backup.log");
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    65
*/
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    66
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    67
// EXTERNAL DATA STRUCTURES
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    68
// EXTERNAL FUNCTION PROTOTYPES
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    69
// CONSTANTS
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    70
LOCAL_C const TUint KMaxHeapsize = 0x7A120;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    71
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    72
_LIT8( KImsiId,"IMSI:");
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    73
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    74
// MACROS
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    75
#ifdef _DRM_TESTING
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    76
_LIT( KDateTimeFormat, "%F%Y%M%D%H%T%S%C" );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    77
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    78
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    79
// LOCAL CONSTANTS AND MACROS
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    80
const TUint8 KMaxStartTries = 30;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    81
const TInt KWaitingTime = 2000000; // 2 sec
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    82
_LIT( KRightsServerThread, "RightsServer" );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    83
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    84
#ifdef RD_MULTIPLE_DRIVE
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    85
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    86
_LIT( KDbTempPath, "%c:\\system\\temp\\" );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    87
_LIT( KIndividualConstraintExtensionDll, "%c:\\sys\\bin\\DRMIndividualConstraintExtension.dll" );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    88
_LIT( KRightsDir, "%c:\\private\\101F51F2\\rdb\\" );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    89
_LIT( KTimedReplayCacheFile, "%c:\\private\\101F51F2\\timererc.dat" );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    90
_LIT( KPlainReplayCacheFile, "%c:\\private\\101F51F2\\plainrc.dat" );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    91
#ifdef RD_DRM_METERING
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    92
_LIT( KMeteringDataBaseFile, "%c:\\private\\101F51F2\\meterdb.dat" );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    93
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    94
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    95
#define USE_RO_IMPORT
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    96
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    97
#ifdef USE_RO_IMPORT
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    98
_LIT( KInternalImportDir, "%c:\\private\\101F51F2\\import\\" );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    99
_LIT( KUserDiskImportDir, "%c:\\import\\" ); // usually embedded MMC
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   100
_LIT( KUserRemovableDiskImportDir, "%c:\\import\\" ); // usually external MMC
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   101
_LIT( KDrSuffix, ".dr" );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   102
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   103
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   104
#else
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   105
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   106
_LIT( KRightsDir, "c:\\private\\101F51F2\\rdb\\" );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   107
_LIT( KTimedReplayCacheFile, "c:\\private\\101F51F2\\timererc.dat" );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   108
_LIT( KPlainReplayCacheFile, "c:\\private\\101F51F2\\plainrc.dat" );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   109
#ifdef RD_DRM_METERING
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   110
_LIT( KMeteringDataBaseFile, "c:\\private\\101F51F2\\meterdb.dat" );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   111
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   112
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   113
#define USE_RO_IMPORT
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   114
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   115
#ifdef USE_RO_IMPORT
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   116
_LIT( KInternalImportDir, "c:\\private\\101F51F2\\import\\" );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   117
_LIT( KUserDiskImportDir, "e:\\import\\" );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   118
_LIT( KDrSuffix, ".dr" );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   119
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   120
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   121
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   122
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   123
_LIT(KWmDrmClientWrapperName, "wmdrmclientwrapper.dll");
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   124
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   125
// MODULE DATA STRUCTURES
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   126
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   127
NONSHARABLE_STRUCT( TUnloadModule )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   128
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   129
    RTelServer* iServer;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   130
    const TDesC* iName;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   131
    };
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   132
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   133
// LOCAL FUNCTION PROTOTYPES
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   134
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   135
LOCAL_C TInt Startup( void );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   136
LOCAL_C void SignalClient();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   137
LOCAL_C TInt StartDBServer( void );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   138
90
62156f66dbad Breaking DRM's dependency Etel so that AVKON can start. The ROM now boots, but doesn't seem to have any items in the matrix menu at all.
Tom Pritchard <tomp@symbian.org>
parents: 88
diff changeset
   139
#if 1 //defined( __WINS__ )
88
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   140
#else
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   141
#define DRM_USE_SERIALNUMBER_URI
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   142
#include <mmtsy_names.h>
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   143
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   144
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   145
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   146
#ifdef DRM_USE_SERIALNUMBER_URI
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   147
LOCAL_C void DoUnloadPhoneModule( TAny* aAny );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   148
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   149
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   150
// #define USE_RO_IMPORT
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   151
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   152
// FORWARD DECLARATIONS
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   153
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   154
// ============================= LOCAL FUNCTIONS ===============================
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   155
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   156
// Function Startup().
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   157
// This function starts the actual DRM Rights server after initializing
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   158
// the cleanup stack and active scheduler.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   159
// Returns: TInt: Symbian OS error code.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   160
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   161
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   162
LOCAL_C TInt Startup( void )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   163
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   164
    TInt error = KErrNone;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   165
    CTrapCleanup* trap = CTrapCleanup::New();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   166
    CActiveScheduler* scheduler = new CActiveScheduler();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   167
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   168
    if ( trap && scheduler )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   169
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   170
        CActiveScheduler::Install( scheduler );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   171
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   172
        error = StartDBServer();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   173
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   174
    else
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   175
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   176
        error = KErrNoMemory;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   177
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   178
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   179
    delete scheduler;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   180
    scheduler = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   181
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   182
    delete trap;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   183
    trap = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   184
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   185
    if ( error )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   186
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   187
        // Something went wrong. Release the client (if any).
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   188
        SignalClient();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   189
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   190
        if ( error == KErrAlreadyExists )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   191
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   192
            error = KErrNone;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   193
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   194
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   195
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   196
    return error;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   197
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   198
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   199
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   200
// Function SignalClient().
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   201
// Signal the waiting client (one of them if any exists).
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   202
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   203
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   204
void SignalClient( void )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   205
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   206
    RSemaphore semaphore;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   207
    if ( !semaphore.OpenGlobal( DRMEngine::KDRMSemaphore ) )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   208
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   209
        semaphore.Signal();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   210
        semaphore.Close();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   211
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   212
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   213
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   214
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   215
// Function StartDBServer().
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   216
// This function starts the actual server under TRAP harness and starts
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   217
// waiting for connections. This function returns only if there has been
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   218
// errors during server startup or the server is stopped for some reason.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   219
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   220
// Returns: TInt: Symbian OS error code.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   221
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   222
TInt StartDBServer( void )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   223
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   224
    TInt error = KErrNone;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   225
    CDRMRightsServer* server = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   226
    TUint8 count = 0;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   227
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   228
    do
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   229
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   230
        DRMLOG2( _L( "RightsServer.exe: StartDBServer: %d" ), error );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   231
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   232
        ++count;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   233
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   234
        TRAP( error, ( server = CDRMRightsServer::NewL() ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   235
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   236
        if ( error )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   237
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   238
            User::After( TTimeIntervalMicroSeconds32(KWaitingTime) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   239
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   240
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   241
        } while( error && ( count <= KMaxStartTries ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   242
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   243
    if( error )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   244
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   245
        DRMLOG2( _L( "RightsServer.exe: CDRMRightsServer::NewL failed: %d " ), error );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   246
        // Failed
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   247
        return error;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   248
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   249
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   250
    // Release the semaphore if necessary.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   251
    SignalClient();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   252
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   253
    // Start waiting for connections
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   254
    CActiveScheduler::Start();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   255
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   256
    // Dying...
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   257
    // Delete CDRMRigntsServer
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   258
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   259
    DRMLOG( _L( "RightsServer.exe: DB server dying..." ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   260
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   261
    delete server;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   262
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   263
    return KErrNone;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   264
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   265
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   266
#ifdef DRM_USE_SERIALNUMBER_URI
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   267
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   268
// Function DoUnloadPhoneModule
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   269
// Unload phone module
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   270
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   271
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   272
void DoUnloadPhoneModule( TAny* aAny )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   273
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   274
    __ASSERT_DEBUG( aAny, User::Invariant() );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   275
    TUnloadModule* module = ( TUnloadModule* ) aAny;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   276
    module->iServer->UnloadPhoneModule( *( module->iName ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   277
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   278
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   279
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   280
#ifdef USE_RO_IMPORT
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   281
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   282
// PointerArrayResetDestroyAndClose
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   283
// Template method used to push RPointerArrays to the cleanup stack. Takes
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   284
// care of deleting all pointers in the array.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   285
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   286
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   287
template<class S>
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   288
void PointerArrayResetDestroyAndClose(TAny* aPtr)
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   289
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   290
    (reinterpret_cast<RPointerArray<S>*>(aPtr))->ResetAndDestroy();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   291
    (reinterpret_cast<RPointerArray<S>*>(aPtr))->Close();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   292
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   293
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   294
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   295
// ============================ MEMBER FUNCTIONS ===============================
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   296
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   297
// CUsageUrl:
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   298
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   299
//--------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   300
// CUsageUrl::CUsageUrl
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   301
// Storage class default constructor
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   302
//--------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   303
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   304
CUsageUrl::CUsageUrl()
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   305
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   306
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   307
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   308
//--------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   309
// CUsageUrl::~CUsageUrl
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   310
// Storage class destructor
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   311
//--------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   312
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   313
CUsageUrl::~CUsageUrl()
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   314
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   315
    delete iUrl;    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   316
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   317
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   318
// CDRMRightsServer:
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   319
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   320
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   321
// CDRMRightsServer::NewLC
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   322
// Two-phased constructor.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   323
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   324
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   325
CDRMRightsServer* CDRMRightsServer::NewL()
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   326
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   327
    CDRMRightsServer* self = new( ELeave ) CDRMRightsServer();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   328
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   329
    CleanupStack::PushL( self );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   330
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   331
    self->ConstructL();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   332
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   333
    CleanupStack::Pop( self );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   334
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   335
    return self;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   336
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   337
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   338
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   339
// Destructor
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   340
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   341
CDRMRightsServer::~CDRMRightsServer()
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   342
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   343
    DRMLOG( _L( "CDRMRightsServer::~" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   344
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   345
    delete iIMEI; iIMEI = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   346
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   347
    delete iIMSI; iIMSI = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   348
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   349
    delete iDb; iDb = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   350
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   351
    iClock.Close();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   352
    iCache.Close();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   353
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   354
    iMeteringDb.Close();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   355
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   356
    iFs.Close();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   357
    iActiveCountConstraints.ResetAndDestroy();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   358
    iActiveCountConstraints.Close();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   359
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   360
    delete iBackupObserver;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   361
    delete iBackupHandler;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   362
    delete iActiveBackupClient;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   363
    delete iDbWatcher;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   364
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   365
#if 0
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   366
    // Close and delete the shared data client
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   367
    if( iSharedDataClient )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   368
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   369
        iSharedDataClient->Close();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   370
        delete iSharedDataClient;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   371
        iSharedDataClient = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   372
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   373
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   374
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   375
    if( iNotifier )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   376
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   377
        delete iNotifier; iNotifier = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   378
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   379
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   380
    iActiveUrls.ResetAndDestroy();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   381
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   382
    //An empty semaphore
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   383
    RSemaphore semaphore;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   384
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   385
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   386
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   387
// CDRMRightsServer::GetSecureTime
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   388
// Fetch the time from (secure) source.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   389
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   390
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   391
TBool CDRMRightsServer::GetSecureTime( TTime& aTime ) const
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   392
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   393
    DRMClock::ESecurityLevel secLevel = DRMClock::KInsecure;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   394
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   395
    TInt timezone( 0 );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   396
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   397
    iClock.GetSecureTime( aTime, timezone, secLevel );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   398
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   399
    if( secLevel == DRMClock::KSecure )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   400
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   401
        DRMLOG( _L( "CDRMRightsServer::GetSecureTime: Time is secure\r\n" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   402
        return ETrue;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   403
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   404
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   405
    DRMLOG( _L( "CDRMRightsServer::GetSecureTime: Time is not secure\r\n" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   406
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   407
    return EFalse;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   408
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   409
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   410
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   411
// CDRMRightsServer::Notifier
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   412
// Return a handle to DRM Notifier.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   413
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   414
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   415
CDRMNotifier& CDRMRightsServer::Notifier()
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   416
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   417
    return *iNotifier;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   418
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   419
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   420
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   421
// CDRMRightsServer::Notifier
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   422
// Return a handle to DRM Notifier.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   423
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   424
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   425
CDRMRightsDB& CDRMRightsServer::Database()
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   426
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   427
    return *iDb;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   428
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   429
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   430
RFs& CDRMRightsServer::FileServerSession()
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   431
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   432
    return iFs;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   433
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   434
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   435
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   436
RDRMReplayCache& CDRMRightsServer::ReplayCache()
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   437
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   438
    return iCache;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   439
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   440
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   441
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   442
RDrmMeteringDb& CDRMRightsServer::MeteringDatabase()
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   443
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   444
    return iMeteringDb;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   445
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   446
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   447
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   448
// CDRMRightsServer::HandleNotifyL
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   449
// Forward the event to the database.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   450
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   451
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   452
void CDRMRightsServer::HandleNotifyL(const TUid /*aUid*/,
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   453
                                     const TDesC& /*aKey*/,
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   454
                                     const TDesC& /*aValue*/)
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   455
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   456
    /* XXX Backup via Publish/Subscribe
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   457
    __ASSERT_DEBUG( iDb, User::Invariant() );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   458
    TInt value = -1;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   459
    TLex16 parser( aValue );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   460
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   461
    if ( aUid == KSDUidSystem )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   462
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   463
        // Check if it's a backup / restore status event
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   464
        if( !aKey.Compare( KBackupRestoreStatus ) )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   465
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   466
            User::LeaveIfError( parser.Val( value ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   467
            if( value == 3 ) // Complete
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   468
                {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   469
                iDb->MergeDBL();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   470
                }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   471
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   472
        // Check if it's a drm backup restore status event
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   473
        else if ( aUid == KSDUidSystem )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   474
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   475
            if( !aKey.Compare( KDRMBackupRestoreStatus ) )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   476
                {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   477
                User::LeaveIfError( parser.Val( value ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   478
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   479
                if( value == 1 ) // PrepareForBackup
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   480
                    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   481
                    TRAPD( error, iDb->BackupDBL( KNullDesC,
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   482
                                                  KNullDesC8 ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   483
                    // Notify that it's done
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   484
                    User::LeaveIfError( iSharedDataClient->AssignToTemporaryFile(
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   485
                                        KSDUidSystem ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   486
                    User::LeaveIfError( iSharedDataClient->SetInt(
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   487
                                        KDRMBackupRestoreStatus, 0 ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   488
                    iSharedDataClient->Flush();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   489
                    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   490
                }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   491
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   492
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   493
    */
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   494
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   495
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   496
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   497
// CDRMRightsServer::RunErrorL
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   498
// From CActive. Complete the request and restart the scheduler.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   499
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   500
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   501
TInt CDRMRightsServer::RunError( TInt aError )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   502
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   503
    DRMLOG2( _L( "CDRMRightsServer::RunError: %d" ), aError );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   504
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   505
    // Inform the client.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   506
    if ( !Message().IsNull() )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   507
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   508
        Message().Complete( aError );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   509
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   510
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   511
    // Restart the scheduler.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   512
    ReStart();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   513
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   514
    // Error handled.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   515
    return KErrNone;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   516
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   517
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   518
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   519
// CDRMRightsServer::NewSessionL
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   520
// Called when a client requires a new instance.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   521
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   522
CSession2* CDRMRightsServer::NewSessionL( const TVersion& aVersion,
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   523
                                          const RMessage2& /*aMessage*/ ) const
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   524
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   525
    DRMLOG( _L( "CDRMRightsServer::NewSessionL" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   526
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   527
    if ( ! User::QueryVersionSupported( TVersion( DRMEngine::KServerMajorVersion,
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   528
        DRMEngine::KServerMinorVersion,
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   529
        DRMEngine::KServerBuildVersion ),
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   530
        aVersion ) )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   531
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   532
        // Sorry, no can do.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   533
        User::Leave( KErrNotSupported );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   534
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   535
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   536
    DRMLOG( _L( "CDRMRightsServer::NewSessionL: Creating a new session" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   537
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   538
    return CDRMDbSession::NewL();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   539
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   540
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   541
// CDRMRightsServer::CDRMRightsServer
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   542
// C++ default constructor can NOT contain any code, that
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   543
// might leave.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   544
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   545
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   546
CDRMRightsServer::CDRMRightsServer() :
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   547
    CServer2( EPriorityStandard ),
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   548
    iIMEI( NULL ),
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   549
    iArmed( EFalse ),
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   550
    iIMSI( NULL ),
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   551
    iGetImsi( ETrue )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   552
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   553
    // Nothing
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   554
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   555
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   556
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   557
// CDRMRightsServer::ConstructL
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   558
// Symbian 2nd phase constructor can leave.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   559
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   560
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   561
void CDRMRightsServer::ConstructL()
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   562
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   563
    DRMLOG( _L( "CDRMRightsServer::ConstructL" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   564
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   565
    TDRMKey key;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   566
    RSemaphore semaphore;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   567
    RProcess currentprocess;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   568
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   569
    // Ignore errors
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   570
    User::RenameThread( KRightsServerThread );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   571
    User::LeaveIfError( iFs.Connect() );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   572
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   573
#ifndef RD_MULTIPLE_DRIVE
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   574
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   575
    // Ignore errors
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   576
    iFs.MkDirAll( KDRMDbTempPath );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   577
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   578
#else //RD_MULTIPLE_DRIVE
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   579
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   580
    TFileName tempPath;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   581
    TFileName tempPath2;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   582
    TFileName tempRemovablePath;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   583
    TInt driveNumber( -1 );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   584
    TChar driveLetter;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   585
    TChar driveLetterRemovable;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   586
    DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   587
    iFs.DriveToChar( driveNumber, driveLetter );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   588
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   589
    tempPath.Format( KDbTempPath, (TUint)driveLetter );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   590
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   591
    // Ignore errors
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   592
    iFs.MkDirAll( tempPath );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   593
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   594
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   595
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   596
    DRMLOG( _L( "CDRMRightsServer::ConstructL: SharedDataClient" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   597
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   598
    // Create and instance of the shared data client
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   599
    // iSharedDataClient = new (ELeave) RSharedDataClient(this);
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   600
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   601
    // Connecting to the shared data server
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   602
    // User::LeaveIfError(iSharedDataClient->Connect());
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   603
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   604
    /* XXX Backup via Publish/Subscribe
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   605
    User::LeaveIfError(iSharedDataClient->NotifyChange(
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   606
        KSDUidSystem, &KBackupRestoreStatus ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   607
    User::LeaveIfError(iSharedDataClient->NotifyChange(
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   608
        KSDUidSystem, &KDRMBackupRestoreStatus) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   609
    */
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   610
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   611
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   612
    GetDbKeyL( key );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   613
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   614
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   615
    DRMLOG( _L( "CDRMRightsServer::ConstructL: database" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   616
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   617
    GetIMEIL();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   618
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   619
    // Create the imsi pointer array:
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   620
    iIMSI = CDRMPointerArray<HBufC8>::NewL();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   621
    iIMSI->SetAutoCleanup(ETrue);
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   622
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   623
    GetIMSIL();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   624
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   625
#ifndef RD_MULTIPLE_DRIVE
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   626
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   627
    iDb = CDRMRightsDB::NewL( iFs, KRightsDir, key, *iIMEI, const_cast<CDRMRightsServer*>(this) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   628
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   629
#else //RD_MULTIPLE_DRIVE
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   630
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   631
    tempPath.Format( KRightsDir, (TUint)driveLetter );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   632
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   633
    iDb = CDRMRightsDB::NewL( iFs, tempPath, key, *iIMEI, const_cast<CDRMRightsServer*>(this) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   634
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   635
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   636
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   637
    key.FillZ();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   638
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   639
    DRMLOG( _L( "CDRMRightsServer::ConstructL: DB started." ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   640
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   641
    DRMLOG( _L( "CDRMRightsServer::ConstructL: Starting Notifier ." ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   642
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   643
    User::LeaveIfError( semaphore.CreateGlobal( KDRMEngCommonSemaphore, 0 ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   644
    CleanupClosePushL( semaphore );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   645
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   646
    StartThreadL( DRMNotifier::KServerName, StartupNotifier, semaphore );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   647
    DRMLOG( _L( "CDRMRightsServer::ConstructL: Notifier thread created." ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   648
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   649
    StartThreadL( Roap::KServerName, StartupRoapStorage, semaphore );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   650
    DRMLOG( _L( "CDRMRightsServer::ConstructL: ROAP thread created." ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   651
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   652
#ifdef __DRM_CLOCK
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   653
    StartThreadL( DRMClock::KServerName, StartupClock, semaphore );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   654
    DRMLOG( _L( "CDRMRightsServer::ConstructL: clock thread created." ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   655
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   656
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   657
    CleanupStack::PopAndDestroy(); // semaphore
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   658
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   659
    iNotifier = CDRMNotifier::NewL();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   660
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   661
    iCache.Set( iFs );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   662
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   663
#ifndef RD_MULTIPLE_DRIVE
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   664
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   665
    iCache.InitL( KTimedReplayCacheFile, KPlainReplayCacheFile );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   666
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   667
#ifdef RD_DRM_METERING
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   668
    iMeteringDb.Set( iFs );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   669
    iMeteringDb.InitL( KMeteringDataBaseFile );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   670
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   671
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   672
#else //RD_MULTIPLE_DRIVE
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   673
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   674
    tempPath.Format( KTimedReplayCacheFile, (TUint)driveLetter );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   675
    tempPath2.Format( KPlainReplayCacheFile, (TUint)driveLetter );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   676
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   677
    iCache.InitL( tempPath, tempPath2 );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   678
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   679
#ifdef RD_DRM_METERING
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   680
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   681
    tempPath.Format( KMeteringDataBaseFile, (TUint)driveLetter );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   682
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   683
    iMeteringDb.Set( iFs );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   684
    iMeteringDb.InitL( tempPath );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   685
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   686
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   687
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   688
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   689
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   690
    User::LeaveIfError( iClock.Connect() );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   691
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   692
    // xoma header list creation
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   693
    iXOmaHeaders = new (ELeave) RPointerArray< CDRMXOma >();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   694
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   695
    // p/s
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   696
    iBackupObserver = CDRMBackupObserver::NewL( *(const_cast<CDRMRightsServer*>(this)));
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   697
    iBackupObserver->Start();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   698
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   699
#ifdef USE_RO_IMPORT
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   700
    // Import any OMA DRM 1.0 RO in the import directory, ignore all errors (except
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   701
    // when checking the default removable mass storage)
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   702
    TInt r = KErrNone;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   703
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   704
#ifndef RD_MULTIPLE_DRIVE
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   705
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   706
    TRAP( r, ImportRightsObjectsL( KInternalImportDir ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   707
    TRAP( r, ImportRightsObjectsL( KUserDiskImportDir ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   708
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   709
#else //RD_MULTIPLE_DRIVE
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   710
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   711
    tempPath.Format( KInternalImportDir, (TUint)driveLetter );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   712
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   713
    DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, driveNumber );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   714
    iFs.DriveToChar( driveNumber, driveLetter );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   715
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   716
    // Default mass storage is usually eMMC
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   717
    tempPath2.Format( KUserDiskImportDir, (TUint)driveLetter );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   718
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   719
    // Find out if a removable mass storage also exists
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   720
    r = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, driveNumber );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   721
    iFs.DriveToChar( driveNumber, driveLetterRemovable );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   722
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   723
    // Import is not needed from the default removable mass storage drive if the drive
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   724
    // letter of the default mass storage and the default removable mass storage are
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   725
    // the same or the removable mass storage is not supported
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   726
    if ( ( driveLetter != driveLetterRemovable ) && ( r == KErrNone ) )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   727
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   728
        tempRemovablePath.Format( KUserRemovableDiskImportDir, (TUint)driveLetterRemovable );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   729
        TRAP( r, ImportRightsObjectsL( tempRemovablePath ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   730
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   731
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   732
    TRAP( r, ImportRightsObjectsL( tempPath ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   733
    TRAP( r, ImportRightsObjectsL( tempPath2 ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   734
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   735
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   736
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   737
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   738
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   739
    // Add the server to the scheduler.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   740
    StartL( DRMEngine::KServerName );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   741
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   742
    // Start watching our RDB
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   743
    iDbWatcher = CDbWatcher::NewL( *this );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   744
    iDbWatcher->StartWatching();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   745
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   746
    // Start watching the helper server
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   747
    iProcWatcher = CProcWatcher::NewL( *this, _L( "*DcfRepSrv*" ), _L( "DcfRepSrv" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   748
    iProcWatcher->StartWatching();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   749
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   750
    // Ready to watch
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   751
    iArmed = ETrue;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   752
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   753
    __UHEAP_MARK;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   754
    TRAP( r, FeatureManager::InitializeLibL() );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   755
    if( !r && FeatureManager::FeatureSupported( KFeatureIdWindowsMediaDrm ) )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   756
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   757
        static const TInt KGateOrdinal = 1;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   758
        RLibrary library;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   759
        r = library.Load( KWmDrmClientWrapperName );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   760
        if( !r )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   761
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   762
            CWmDrmClientWrapper* wrapper = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   763
            TLibraryFunction function = library.Lookup( KGateOrdinal );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   764
            if( function != NULL )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   765
                {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   766
                __UHEAP_MARK;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   767
                TRAP( r, wrapper = reinterpret_cast<CWmDrmClientWrapper*>( function() ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   768
                if( !r )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   769
                    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   770
                    r = wrapper->Connect();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   771
                    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   772
                delete wrapper;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   773
                __UHEAP_MARKEND;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   774
                }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   775
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   776
        library.Close();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   777
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   778
    FeatureManager::UnInitializeLib();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   779
    __UHEAP_MARKEND;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   780
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   781
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   782
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   783
// CDRMRightsServer::StartThreadL
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   784
// Start a new thread.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   785
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   786
void CDRMRightsServer::StartThreadL( const TDesC& aThreadName,
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   787
                                     TThreadFunction aFunc,
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   788
                                     RSemaphore& aSemaphore )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   789
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   790
    RThread thread;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   791
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   792
    User::LeaveIfError(
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   793
          thread.Create( aThreadName,
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   794
                         aFunc,
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   795
                         KDefaultStackSize,
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   796
                         KMinHeapSize,
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   797
                         KMaxHeapsize,
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   798
                         NULL ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   799
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   800
    thread.Resume();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   801
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   802
    aSemaphore.Wait();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   803
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   804
    thread.Close();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   805
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   806
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   807
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   808
// CDRMRightsServer::GetDbKeyL
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   809
// Fetches the rights database key from Wallet or uses a constant
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   810
// key if Wallet is not supported.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   811
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   812
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   813
void CDRMRightsServer::GetDbKeyL( TDRMKey& aKey  )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   814
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   815
    TInt r = KErrNone;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   816
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   817
    DRMLOG( _L( "CDRMRightsServer::GetDbKey" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   818
    MDrmKeyStorage* storage = DrmKeyStorageNewL();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   819
    TRAP( r, storage->GetDeviceSpecificKeyL( aKey ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   820
    delete storage;
90
62156f66dbad Breaking DRM's dependency Etel so that AVKON can start. The ROM now boots, but doesn't seem to have any items in the matrix menu at all.
Tom Pritchard <tomp@symbian.org>
parents: 88
diff changeset
   821
    DRMLOG2( _L( "CDRMRightsServer::GetDbKey err=%d" ),r );
88
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   822
    User::LeaveIfError( r );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   823
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   824
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   825
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   826
// CDRMRightsServer::GenerateKeyL
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   827
// Generates the actual key based on the given key seed.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   828
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   829
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   830
void CDRMRightsServer::GenerateKeyL( HBufC*& aKeySeed,
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   831
                                    TDRMKey& aKey ) const
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   832
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   833
    __ASSERT_ALWAYS( aKeySeed->Size() >= KDRMKeyLength,
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   834
        User::Leave( KErrUnderflow ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   835
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   836
    TPtrC8 key( reinterpret_cast< TUint8* >( const_cast< TUint16* >( aKeySeed->Ptr() ) ),
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   837
                KDRMKeyLength );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   838
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   839
    aKey = key;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   840
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   841
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   842
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   843
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   844
// CDRMRightsServer::XOmaHeaders()
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   845
// return the pointer of the X-Oma headers list
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   846
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   847
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   848
RPointerArray< CDRMXOma >& CDRMRightsServer::XOmaHeaders( void )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   849
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   850
    return *iXOmaHeaders;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   851
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   852
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   853
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   854
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   855
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   856
// CDRMRightsServer::GetIMEIL
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   857
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   858
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   859
const TDesC& CDRMRightsServer::GetIMEIL()
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   860
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   861
    if ( iIMEI )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   862
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   863
        return *iIMEI;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   864
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   865
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   866
#ifdef DRM_USE_SERIALNUMBER_URI
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   867
    TInt error( KErrNone );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   868
    TInt count( 0 );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   869
    TInt count2( 0 );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   870
    TUint32 caps( 0 );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   871
    TBool found (EFalse);
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   872
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   873
    RTelServer etelServer;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   874
    RMobilePhone phone;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   875
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   876
    TUint KMaxImeiTries = 5;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   877
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   878
    for ( TUint8 i = 0; i < KMaxImeiTries; ++i )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   879
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   880
        error = etelServer.Connect();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   881
        if ( error )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   882
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   883
            User::After( TTimeIntervalMicroSeconds32( KWaitingTime ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   884
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   885
        else
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   886
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   887
            break;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   888
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   889
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   890
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   891
    User::LeaveIfError( error );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   892
    CleanupClosePushL( etelServer );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   893
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   894
    User::LeaveIfError( etelServer.LoadPhoneModule( KMmTsyModuleName ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   895
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   896
    TUnloadModule unload;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   897
    unload.iServer = &etelServer;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   898
    unload.iName = &KMmTsyModuleName;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   899
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   900
    TCleanupItem item( DoUnloadPhoneModule, &unload );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   901
    CleanupStack::PushL( item );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   902
    User::LeaveIfError( etelServer.EnumeratePhones( count ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   903
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   904
    for ( count2 = 0; count2 < count && !found; ++count2 )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   905
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   906
        RTelServer::TPhoneInfo phoneInfo;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   907
        User::LeaveIfError( etelServer.GetTsyName( count2, phoneInfo.iName ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   908
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   909
        if ( phoneInfo.iName.CompareF(KMmTsyModuleName()) == 0 )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   910
           {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   911
            User::LeaveIfError( etelServer.GetPhoneInfo( count2, phoneInfo ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   912
            User::LeaveIfError( phone.Open( etelServer, phoneInfo.iName ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   913
            CleanupClosePushL( phone );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   914
            found = ETrue;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   915
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   916
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   917
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   918
    if ( !found )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   919
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   920
        // Not found.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   921
        User::Leave( KErrNotFound );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   922
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   923
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   924
    User::LeaveIfError( phone.GetIdentityCaps( caps ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   925
    if ( caps & RMobilePhone::KCapsGetSerialNumber )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   926
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   927
        RMobilePhone::TMobilePhoneIdentityV1 id;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   928
        TRequestStatus status;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   929
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   930
        phone.GetPhoneId( status, id );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   931
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   932
        User::WaitForRequest( status );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   933
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   934
        User::LeaveIfError( status.Int() );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   935
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   936
        iIMEI = id.iSerialNumber.AllocL();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   937
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   938
        CleanupStack::PopAndDestroy( 3 ); // phone, item, etelServer
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   939
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   940
        HBufC8* buf = HBufC8::NewL( iIMEI->Size() );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   941
        TPtr8 ptr( buf->Des() );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   942
        ptr.Copy( *iIMEI );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   943
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   944
        DRMLOG(_L("IMEI:"));
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   945
        DRMLOGHEX(ptr);
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   946
        delete buf;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   947
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   948
        return *iIMEI;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   949
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   950
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   951
    User::Leave( KErrNotFound );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   952
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   953
    // Never happens...
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   954
    return *iIMEI;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   955
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   956
#else
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   957
    _LIT( KDefaultSerialNumber, "123456789123456789" );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   958
    iIMEI = KDefaultSerialNumber().AllocL();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   959
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   960
    return *iIMEI;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   961
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   962
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   963
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   964
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   965
// CDRMRightsServer::GetIMSIL
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   966
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   967
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   968
const CDRMPointerArray<HBufC8>& CDRMRightsServer::GetIMSIL()
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   969
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   970
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   971
    if ( !iGetImsi )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   972
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   973
        return *iIMSI;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   974
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   975
90
62156f66dbad Breaking DRM's dependency Etel so that AVKON can start. The ROM now boots, but doesn't seem to have any items in the matrix menu at all.
Tom Pritchard <tomp@symbian.org>
parents: 88
diff changeset
   976
#if 0 // defined(__WINS__)
88
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   977
    TInt error( KErrNone );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   978
    TInt count( 0 );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   979
    TInt count2( 0 );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   980
    TUint32 caps( 0 );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   981
    TBool found (EFalse);
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   982
    HBufC8* imsi = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   983
    HBufC8* imsiNumber = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   984
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   985
    RTelServer etelServer;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   986
    RMobilePhone phone;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   987
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   988
    TUint KMaxImeiTries = 5;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   989
    for ( TUint8 i = 0; i < KMaxImeiTries; ++i )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   990
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   991
        error = etelServer.Connect();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   992
        if ( error )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   993
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   994
            User::After( TTimeIntervalMicroSeconds32( KWaitingTime ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   995
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   996
        else
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   997
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   998
            break;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   999
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1000
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1001
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1002
    User::LeaveIfError( error );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1003
    CleanupClosePushL( etelServer );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1004
    User::LeaveIfError( etelServer.LoadPhoneModule( KMmTsyModuleName ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1005
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1006
    TUnloadModule unload;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1007
    unload.iServer = &etelServer;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1008
    unload.iName = &KMmTsyModuleName;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1009
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1010
    TCleanupItem item( DoUnloadPhoneModule, &unload );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1011
    CleanupStack::PushL( item );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1012
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1013
    User::LeaveIfError( etelServer.EnumeratePhones( count ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1014
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1015
    for ( count2 = 0; count2 < count && !found; ++count2 )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1016
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1017
        RTelServer::TPhoneInfo phoneInfo;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1018
        User::LeaveIfError( etelServer.GetTsyName( count2, phoneInfo.iName ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1019
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1020
        if ( phoneInfo.iName.CompareF(KMmTsyModuleName()) == 0 )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1021
           {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1022
            User::LeaveIfError( etelServer.GetPhoneInfo( count2, phoneInfo ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1023
            User::LeaveIfError( phone.Open( etelServer, phoneInfo.iName ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1024
            CleanupClosePushL( phone );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1025
            found = ETrue;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1026
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1027
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1028
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1029
    if ( !found )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1030
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1031
        // Not found.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1032
        User::Leave( KErrNotFound );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1033
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1034
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1035
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1036
    User::LeaveIfError( phone.GetIdentityCaps( caps ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1037
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1038
    if( caps & RMobilePhone::KCapsGetSubscriberId )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1039
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1040
        RMobilePhone::TMobilePhoneSubscriberId imsiId;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1041
        TRequestStatus status;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1042
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1043
        phone.GetSubscriberId( status, imsiId );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1044
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1045
        User::WaitForRequest( status );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1046
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1047
        if( ! status.Int() )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1048
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1049
            imsi = HBufC8::NewMaxLC( imsiId.Length() + KImsiId().Size() );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1050
            TPtr8 imsiPtr(const_cast<TUint8*>(imsi->Ptr()), 0, imsi->Size());
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1051
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1052
            imsiNumber = CnvUtfConverter::ConvertFromUnicodeToUtf8L( imsiId );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1053
            CleanupStack::PushL( imsiNumber );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1054
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1055
            imsiPtr.Copy( KImsiId() );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1056
            imsiPtr.Append( *imsiNumber );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1057
            CleanupStack::PopAndDestroy(); // imsiNumber
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1058
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1059
        else
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1060
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1061
            imsi = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1062
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1063
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1064
    else
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1065
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1066
        imsi = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1067
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1068
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1069
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1070
    // Clean up whatever is in there
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1071
    iIMSI->ResetAndDestroy();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1072
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1073
    if( imsi )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1074
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1075
        // if we got it we wont try again
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1076
        iIMSI->AppendL( imsi );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1077
        CleanupStack::Pop(); // imsi
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1078
        iGetImsi = EFalse;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1079
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1080
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1081
    // Check for possible extra IMSI individual constraints
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1082
    AppendExtendedIndividualConstraintsL(&phone);
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1083
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1084
    CleanupStack::PopAndDestroy(); // phone
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1085
    CleanupStack::PopAndDestroy(); // cleanup item
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1086
    CleanupStack::PopAndDestroy(); // etel server
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1087
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1088
    return *iIMSI;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1089
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1090
#else
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1091
    HBufC8* imsi = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1092
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1093
    if( iGetImsi )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1094
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1095
        iGetImsi = EFalse;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1096
        _LIT8( KDefaultSerialNumber, "IMSI:123456789123456789" );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1097
        imsi = KDefaultSerialNumber().AllocLC();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1098
        iIMSI->AppendL( imsi );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1099
        CleanupStack::Pop();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1100
        AppendExtendedIndividualConstraintsL();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1101
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1102
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1103
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1104
    return *iIMSI;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1105
#endif // __WINS__
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1106
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1107
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1108
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1109
// CDRMRightsServer::AppendExtendedIndividualConstraintsL
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1110
// If the extension DLL exists it is loaded and used to obtain additional
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1111
// valid individual constraints
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1112
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1113
void CDRMRightsServer::AppendExtendedIndividualConstraintsL(RMobilePhone* aMobilePhone)
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1114
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1115
    // Load the externsion DLL
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1116
    RLibrary lib;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1117
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1118
#ifndef RD_MULTIPLE_DRIVE
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1119
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1120
    if (lib.LoadRomLibrary(KDRMIndividualConstraintExtensionDll,KNullDesC)==KErrNone)
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1121
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1122
#else //RD_MULTIPLE_DRIVE
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1123
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1124
    TInt driveNumber( -1 );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1125
    TChar driveLetter;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1126
    DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1127
    iFs.DriveToChar( driveNumber, driveLetter );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1128
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1129
    TFileName individualConstraindExtensionDll;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1130
    individualConstraindExtensionDll.Format(
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1131
                        KIndividualConstraintExtensionDll, (TUint)driveLetter );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1132
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1133
    if ( lib.LoadRomLibrary( individualConstraindExtensionDll, KNullDesC ) == KErrNone )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1134
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1135
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1136
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1137
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1138
        CleanupClosePushL(lib);
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1139
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1140
        // Get first exported ordinal - factory method returning
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1141
        // MDRMIndividualConstraintExtension*
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1142
        TLibraryFunction factory = lib.Lookup(1);
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1143
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1144
        if (factory)
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1145
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1146
            // Instantiate object
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1147
            MDRMIndividualConstraintExtension* extendedConstraints =
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1148
                reinterpret_cast<MDRMIndividualConstraintExtension*>(factory());
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1149
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1150
            if (extendedConstraints)
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1151
                {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1152
                CleanupStack::PushL(TCleanupItem(Release,extendedConstraints));
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1153
                extendedConstraints->AppendConstraintsL(*iIMSI,aMobilePhone);
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1154
                CleanupStack::PopAndDestroy(extendedConstraints); //calls Release
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1155
                }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1156
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1157
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1158
        // unload library
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1159
        CleanupStack::PopAndDestroy(&lib); //close
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1160
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1161
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1162
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1163
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1164
// CDRMRightsServer::Release
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1165
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1166
void CDRMRightsServer::Release(TAny* aIndividualConstraintExtension)
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1167
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1168
    MDRMIndividualConstraintExtension* extendedConstraints =
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1169
        reinterpret_cast<MDRMIndividualConstraintExtension*>(aIndividualConstraintExtension);
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1170
    extendedConstraints->Release(); //free resources
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1171
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1172
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1173
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1174
// CDRMRightsServer::HandleBackupEventL
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1175
// Handle Backup Events
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1176
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1177
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1178
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1179
void CDRMRightsServer::HandleBackupEventL( TInt aBackupEvent )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1180
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1181
    //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::BackupCalled\n\r"));
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1182
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1183
    //conn::TBURPartType eventType;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1184
    //conn::TBackupIncType incType;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1185
    TDriveList aDriveList;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1186
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1187
    //RFileLogger::WriteFormat(KLogDir, KLogName, EFileLoggingModeAppend, _L8("backupevent: %d"), aBackupEvent);
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1188
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1189
    // If there is no operation going or state is normal
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1190
    // Delete the client and handler
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1191
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1192
    if( aBackupEvent == conn::EBURUnset ||
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1193
        aBackupEvent & conn::EBURNormal )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1194
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1195
        /*
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1196
        if( aBackupEvent == conn::EBURUnset )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1197
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1198
                        RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Unset\n\r"));
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1199
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1200
        else
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1201
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1202
            RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Normal\n\r"));
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1203
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1204
        */
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1205
        if( iActiveBackupClient )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1206
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1207
            delete iActiveBackupClient;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1208
            iActiveBackupClient = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1209
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1210
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1211
        if( iBackupHandler )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1212
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1213
            delete iBackupHandler;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1214
            iBackupHandler = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1215
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1216
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1217
    else if( aBackupEvent & conn::EBURBackupFull ||
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1218
             aBackupEvent & conn::EBURRestoreFull )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1219
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1220
        //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Full\n\r"));
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1221
        // ab handler
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1222
        iBackupHandler = CDRMBackup::NewL( iDb, iFs );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1223
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1224
        // ab client
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1225
        iActiveBackupClient = conn::CActiveBackupClient::NewL( iBackupHandler );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1226
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1227
        // Confirm that we have done everything if there even was anything to do
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1228
        //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Confirm F \n\r"));
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1229
        iActiveBackupClient->ConfirmReadyForBURL( KErrNone );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1230
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1231
    else if( aBackupEvent & conn::EBURBackupPartial ||
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1232
             aBackupEvent & conn::EBURRestorePartial )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1233
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1234
        //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Partial\n\r"));
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1235
        // ab handler
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1236
        iBackupHandler = CDRMBackup::NewL( iDb, iFs );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1237
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1238
        // ab client
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1239
        iActiveBackupClient = conn::CActiveBackupClient::NewL( iBackupHandler );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1240
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1241
        if( !iActiveBackupClient->DoesPartialBURAffectMeL() )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1242
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1243
            //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::NotMe\n\r"));
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1244
            delete iActiveBackupClient;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1245
            iActiveBackupClient = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1246
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1247
            delete iBackupHandler;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1248
            iBackupHandler = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1249
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1250
        else
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1251
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1252
            //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Confirm P \n\r"));
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1253
            // Confirm that we have done everything if there even was anything to do
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1254
            iActiveBackupClient->ConfirmReadyForBURL( KErrNone );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1255
            //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Confirm P Done \n\r"));
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1256
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1257
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1258
    else
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1259
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1260
        //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Argument\n\r"));
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1261
        // Unknown operation
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1262
        User::Leave(KErrArgument);
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1263
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1264
    };
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1265
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1266
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1267
// CDRMRightsServer::WatchedObjectChangedL
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1268
// Handle Backup Events
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1269
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1270
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1271
void CDRMRightsServer::WatchedObjectChangedL( const TDesC& aObject )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1272
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1273
    DRMLOG( _L( "CDRMRightsServer::WatchedObjectChangedL ->" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1274
    DRMLOG( aObject );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1275
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1276
    if ( aObject.Left( KDirIdentifier().Length() ) == KDirIdentifier &&
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1277
         !iDb->Updating() && iArmed )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1278
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1279
#ifdef _DEBUG
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1280
        DRMLOG( _L( "RDB modified by outside party (DEBUG mode, not deleting the DB)" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1281
#else
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1282
        DRMLOG( _L( "RDB modified by outside party, deleting the DB" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1283
        iDb->MarkAsCorrupted();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1284
        RStarterSession starter;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1285
        User::LeaveIfError( starter.Connect() );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1286
        starter.Reset( RStarterSession::EDRMReset );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1287
        starter.Close();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1288
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1289
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1290
    else if ( aObject.Left( KProcIdentifier().Length() ) == KProcIdentifier && iArmed )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1291
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1292
#ifdef _DEBUG
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1293
        DRMLOG( _L( "Peer process killed (DEBUG mode, not rebooting)" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1294
#else
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1295
        DRMLOG( _L( "Peer process killed, rebooting" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1296
        RStarterSession starter;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1297
        User::LeaveIfError( starter.Connect() );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1298
        starter.Reset( RStarterSession::EDRMReset );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1299
        starter.Close();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1300
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1301
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1302
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1303
    DRMLOG( _L( "CDRMRightsServer::WatchedObjectChangedL <-" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1304
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1305
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1306
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1307
// CDRMRightsServer::HasActiveCountConstraint
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1308
// Check ID for active count constraint
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1309
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1310
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1311
TBool CDRMRightsServer::HasActiveCountConstraint( const TDesC8& aContentId )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1312
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1313
    TInt i;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1314
    TBool r = EFalse;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1315
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1316
    for ( i = 0; r == EFalse && i < iActiveCountConstraints.Count(); i++ )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1317
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1318
        if ( iActiveCountConstraints[i]->CompareF( aContentId ) == 0 )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1319
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1320
            r = ETrue;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1321
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1322
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1323
    return r;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1324
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1325
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1326
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1327
// CDRMRightsServer::RemoveActiveCountConstraint
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1328
// Remove ID from count constraint list
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1329
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1330
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1331
void CDRMRightsServer::RemoveActiveCountConstraint( const TDesC8& aContentId )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1332
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1333
    TInt i;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1334
    TInt r = KErrNotFound;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1335
    HBufC8* id = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1336
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1337
    for ( i = 0; r == KErrNotFound && i < iActiveCountConstraints.Count(); i++ )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1338
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1339
        if ( iActiveCountConstraints[i]->CompareF( aContentId ) == 0 )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1340
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1341
            r = i;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1342
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1343
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1344
    if ( r != KErrNotFound )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1345
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1346
        id = iActiveCountConstraints[r];
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1347
        iActiveCountConstraints.Remove( r );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1348
        delete id;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1349
        id = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1350
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1351
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1352
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1353
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1354
// CDRMRightsServer::AddActiveCountConstraint
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1355
// Add ID to count constraint list
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1356
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1357
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1358
void CDRMRightsServer::AddActiveCountConstraintL( const TDesC8& aContentId )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1359
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1360
    if ( !HasActiveCountConstraint( aContentId ) )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1361
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1362
        iActiveCountConstraints.AppendL( aContentId.AllocL() );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1363
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1364
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1365
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1366
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1367
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1368
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1369
// CDRMRightsServer::IsAccessingUrl
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1370
// Add ID to count constraint list
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1371
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1372
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1373
TInt CDRMRightsServer::IsAccessingUrl( const TDesC8& aContentId )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1374
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1375
    for( TInt i = 0; i < iActiveUrls.Count(); i++ )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1376
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1377
        if( !iActiveUrls[i]->iUrl->Compare( aContentId ) ) 
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1378
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1379
            return i;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1380
            }    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1381
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1382
    return KErrNotFound;        
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1383
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1384
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1385
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1386
// CDRMRightsServer::RemoveAccessingUrl
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1387
// Add ID to count constraint list
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1388
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1389
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1390
void CDRMRightsServer::RemoveAccessingUrl( const TDesC8& aContentId )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1391
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1392
    CUsageUrl* usage = NULL;    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1393
    TInt index = KErrNotFound;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1394
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1395
    index = IsAccessingUrl( aContentId );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1396
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1397
    if( index != KErrNotFound )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1398
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1399
        // If there are negative or 0 values in the list for some reason
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1400
        // remove them    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1401
        if( iActiveUrls[index]->iRefCounter <= 1 )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1402
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1403
            usage = iActiveUrls[index];    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1404
            iActiveUrls.Remove( index );    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1405
            delete usage;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1406
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1407
        else
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1408
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1409
            iActiveUrls[index]->iRefCounter--;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1410
            }           
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1411
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1412
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1413
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1414
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1415
// CDRMRightsServer::AddAccessingUrlL
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1416
// Add ID to count constraint list
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1417
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1418
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1419
void CDRMRightsServer::AddAccessingUrlL( const TDesC8& aContentId )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1420
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1421
    CUsageUrl* usage = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1422
    TInt index = KErrNotFound;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1423
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1424
    index = IsAccessingUrl( aContentId );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1425
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1426
    if( index == KErrNotFound )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1427
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1428
        usage = new ( ELeave ) CUsageUrl();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1429
        CleanupStack::PushL( usage );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1430
        usage->iUrl = aContentId.AllocL();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1431
        usage->iRefCounter = 1;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1432
        iActiveUrls.AppendL( usage );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1433
        CleanupStack::Pop( usage );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1434
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1435
    else
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1436
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1437
        usage = iActiveUrls[index];
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1438
        usage->iRefCounter++;    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1439
        }           
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1440
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1441
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1442
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1443
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1444
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1445
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1446
// CDRMRightsServer::StopWatchingL
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1447
// Delete the watchers
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1448
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1449
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1450
void CDRMRightsServer::StopWatchingL()
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1451
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1452
    iArmed = EFalse;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1453
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1454
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1455
#ifdef USE_RO_IMPORT
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1456
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1457
// CDRMRightsServer::ImportRightsObjectsL
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1458
// Open the import directory and add all ROs that can be found there. ROs file
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1459
// names must end with .dr. Only OMA DRM 1.0 ROs in XML format are supported for
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1460
// security reasons
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1461
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1462
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1463
void CDRMRightsServer::ImportRightsObjectsL( const TDesC& aImportDir )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1464
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1465
    CDrmRightsParser* p;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1466
    HBufC8* d = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1467
    HBufC8* k = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1468
    RFs fs;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1469
    RFile file;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1470
    TInt size;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1471
    RPointerArray<CDRMRights> rights;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1472
    CDir* dir;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1473
    TFileName name;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1474
    TPtr8 ptr( NULL, 0 );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1475
    TInt i;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1476
    TInt r = KErrNone;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1477
    TCleanupItem listCleanup(PointerArrayResetDestroyAndClose<CDRMRights>,
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1478
        &rights);
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1479
    TDRMUniqueID id;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1480
    TTime time;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1481
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1482
    DRMLOG( _L( "CDRMRightsServer::ImportRightsObjectsL" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1483
    DRMLOG( aImportDir );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1484
    __UHEAP_MARK;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1485
    GetSecureTime( time );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1486
    p = CDrmRightsParser::NewL();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1487
    CleanupStack::PushL( p );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1488
    User::LeaveIfError( iFs.GetDir( aImportDir, KEntryAttNormal,
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1489
        ESortNone, dir ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1490
    CleanupStack::PushL( dir );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1491
    for (i = 0; i < dir->Count(); i++)
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1492
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1493
        name.Copy( aImportDir );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1494
        name.Append( (*dir)[i].iName );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1495
        if ( ( name.Length() > 3 && name.Right(3).CompareF( KDrSuffix ) == 0 ) )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1496
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1497
            User::LeaveIfError( file.Open( iFs, name, EFileRead ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1498
            CleanupClosePushL( file );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1499
            User::LeaveIfError( file.Size( size ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1500
            d = HBufC8::NewLC( size );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1501
            ptr.Set( d->Des() );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1502
            User::LeaveIfError( file.Read( ptr ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1503
            p->ParseL( ptr, rights );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1504
            if ( rights.Count() > 0 )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1505
                {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1506
                k = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1507
                CleanupStack::PushL( listCleanup );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1508
                CDRMPermission& permission = rights[0]->GetPermission();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1509
                CDRMAsset& asset = rights[0]->GetAsset();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1510
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1511
                // Add RO only if no rights are available at all for this content
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1512
                TRAP( r, k = iDb->GetDecryptionKeyL( *asset.iUid ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1513
                if (k == NULL )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1514
                    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1515
                    iDb->AddDBEntryL( *asset.iUid, permission, asset.iKey, id );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1516
                    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1517
                else
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1518
                    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1519
                    delete k;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1520
                    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1521
                CleanupStack::PopAndDestroy(); // listCleanup
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1522
                }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1523
            CleanupStack::PopAndDestroy( 2 ); // d, file
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1524
            iFs.Delete( name );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1525
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1526
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1527
    CleanupStack::PopAndDestroy( 2 ); // dir, p
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1528
    __UHEAP_MARKEND;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1529
    DRMLOG( _L( "CDRMRightsServer::ImportRightsObjectsL done" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1530
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1531
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1532
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1533
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1534
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1535
// ========================== OTHER EXPORTED FUNCTIONS =========================
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1536
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1537
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1538
TInt E32Main()
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1539
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1540
    return Startup();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1541
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1542
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1543
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1544
//  End of File