sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef MMFDRMPLUGINSERVER_H sl@0: #define MMFDRMPLUGINSERVER_H sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS sl@0: #include sl@0: #endif sl@0: class CStartAndMonitorControllerThread; sl@0: class RMMFControllerServerProxy; sl@0: sl@0: class CMMFDRMPluginServer : public CMmfIpcServer sl@0: /** sl@0: *@internalTechnology sl@0: */ sl@0: { sl@0: public: sl@0: static CMMFDRMPluginServer* NewL(); sl@0: ~CMMFDRMPluginServer(); sl@0: CMmfIpcSession* NewSessionL(const TVersion &aVersion) const; sl@0: sl@0: void IncrementSessionId(); sl@0: void DecrementSessionId(); sl@0: sl@0: void IncrementControllerCount(); sl@0: void DecrementControllerCount(); sl@0: sl@0: TInt StartControllerServer(const RThread& aClientThread, TUint aMaxHeapSize, TBool aUseSharedHeap, sl@0: RMMFControllerServerProxy& aDevSoundSessionHandle, TThreadId& aControllerTID, TUint aStackSize) const; sl@0: sl@0: void PanicControllerThread(TThreadId aTid, const TDesC& aCategory,TInt aReason); sl@0: void KillControllerThread(TThreadId aTid, TInt aReason); sl@0: TInt SetThreadPriority(TThreadId aTid, TThreadPriority aPriority); sl@0: void SetTimeout(TInt aTimeout) { iServerTimeout = aTimeout; }; sl@0: sl@0: private: sl@0: sl@0: class CDelayServerShutDown : public CActive sl@0: { sl@0: public: sl@0: // Construct/destruct sl@0: static CDelayServerShutDown* NewL(); sl@0: ~CDelayServerShutDown(); sl@0: // Request sl@0: void SetDelay(TTimeIntervalMicroSeconds32 aDelay); sl@0: sl@0: private: sl@0: // Construct/destruct sl@0: CDelayServerShutDown(); sl@0: void ConstructL(); sl@0: sl@0: // From CActive sl@0: void RunL(); sl@0: void DoCancel(); sl@0: private: sl@0: RTimer iShutDownTimer; // Has sl@0: }; sl@0: sl@0: private: sl@0: CMMFDRMPluginServer(); sl@0: void ConstructL(); sl@0: sl@0: private: sl@0: TInt iSessionCount; sl@0: TInt iControllerCount; sl@0: TInt iServerTimeout; sl@0: CDelayServerShutDown* iDelayServerShutDown; sl@0: mutable RPointerArray iControllerServList; sl@0: }; sl@0: sl@0: class CStartAndMonitorControllerThread: public CActive sl@0: { sl@0: public: sl@0: static CStartAndMonitorControllerThread* NewL(CMMFDRMPluginServer* aPluginServer); sl@0: ~CStartAndMonitorControllerThread(); sl@0: TInt StartControllerServer(const RThread& aClientThread, TUint aMaxHeapSize, TBool aUseSharedHeap, sl@0: RMMFControllerServerProxy& aControllerSessionHandle, TThreadId& aControllerTID, TUint aStackSize); sl@0: RThread& Thread() { return iServerThread; }; sl@0: private: sl@0: // Construct sl@0: CStartAndMonitorControllerThread(CMMFDRMPluginServer* aPluginServer); sl@0: void ConstructL(); sl@0: sl@0: // From CActive sl@0: void RunL(); sl@0: void DoCancel(); sl@0: private: sl@0: CMMFDRMPluginServer* iDrmPluginServer; sl@0: RThread iServerThread; sl@0: }; sl@0: sl@0: class RMMFControllerServerProxy : public RMmfSessionBase sl@0: { sl@0: public: sl@0: TInt Open(RServer2& aControllerServerHandle); sl@0: }; sl@0: sl@0: #endif