mmlibs/mmfw/SecureDRM/src/Server/MmfDrmPluginServer.h
changeset 0 b8ed18f6c07b
equal deleted inserted replaced
-1:000000000000 0:b8ed18f6c07b
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef MMFDRMPLUGINSERVER_H
       
    17 #define MMFDRMPLUGINSERVER_H
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <e32std.h>
       
    21 #include <mmf/common/mmfipc.h>
       
    22 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    23 #include <mmf/common/mmfipcserver.h>
       
    24 #endif
       
    25 class CStartAndMonitorControllerThread;
       
    26 class RMMFControllerServerProxy;
       
    27 
       
    28 class CMMFDRMPluginServer : public CMmfIpcServer
       
    29 /**
       
    30 *@internalTechnology
       
    31 */
       
    32 	{
       
    33 public:
       
    34 	static CMMFDRMPluginServer* NewL();
       
    35 	~CMMFDRMPluginServer();
       
    36 	CMmfIpcSession* NewSessionL(const TVersion &aVersion) const;
       
    37 
       
    38 	void IncrementSessionId();
       
    39 	void DecrementSessionId();
       
    40 	
       
    41 	void IncrementControllerCount();
       
    42 	void DecrementControllerCount();
       
    43 
       
    44 	TInt StartControllerServer(const RThread& aClientThread, TUint aMaxHeapSize, TBool aUseSharedHeap,
       
    45 							RMMFControllerServerProxy& aDevSoundSessionHandle, TThreadId& aControllerTID, TUint aStackSize) const;
       
    46 							
       
    47 	void PanicControllerThread(TThreadId aTid, const TDesC& aCategory,TInt aReason);
       
    48 	void KillControllerThread(TThreadId aTid, TInt aReason);
       
    49 	TInt SetThreadPriority(TThreadId aTid, TThreadPriority aPriority);
       
    50 	void SetTimeout(TInt aTimeout) { iServerTimeout = aTimeout; };
       
    51 	
       
    52 private:
       
    53 
       
    54 	class CDelayServerShutDown : public CActive
       
    55         {
       
    56     public:
       
    57         // Construct/destruct
       
    58         static CDelayServerShutDown* NewL();
       
    59         ~CDelayServerShutDown(); 
       
    60         // Request
       
    61         void SetDelay(TTimeIntervalMicroSeconds32 aDelay);   
       
    62         
       
    63     private:
       
    64         // Construct/destruct
       
    65         CDelayServerShutDown();
       
    66         void ConstructL();
       
    67     
       
    68         // From CActive
       
    69         void RunL();
       
    70         void DoCancel();   
       
    71     private:
       
    72         RTimer iShutDownTimer;      // Has
       
    73         };
       
    74 
       
    75 private:
       
    76 	CMMFDRMPluginServer();
       
    77 	void ConstructL();
       
    78 
       
    79 private:
       
    80 	TInt iSessionCount;
       
    81 	TInt iControllerCount;
       
    82 	TInt iServerTimeout;
       
    83 	CDelayServerShutDown* iDelayServerShutDown;
       
    84 	mutable RPointerArray<CStartAndMonitorControllerThread> iControllerServList;
       
    85 	};
       
    86 
       
    87 class CStartAndMonitorControllerThread: public CActive
       
    88 	{
       
    89 public:
       
    90 	static CStartAndMonitorControllerThread* NewL(CMMFDRMPluginServer* aPluginServer);
       
    91 	~CStartAndMonitorControllerThread();
       
    92 	TInt StartControllerServer(const RThread& aClientThread, TUint aMaxHeapSize, TBool aUseSharedHeap,
       
    93 							RMMFControllerServerProxy& aControllerSessionHandle, TThreadId& aControllerTID, TUint aStackSize);
       
    94 	RThread& Thread() { return iServerThread; };
       
    95 private:
       
    96 	// Construct
       
    97 	CStartAndMonitorControllerThread(CMMFDRMPluginServer* aPluginServer);
       
    98 	void ConstructL();
       
    99    
       
   100 	// From CActive
       
   101 	void RunL();
       
   102 	void DoCancel();
       
   103 private:
       
   104 	CMMFDRMPluginServer* iDrmPluginServer;
       
   105 	RThread iServerThread;
       
   106     };
       
   107         
       
   108 class RMMFControllerServerProxy : public RMmfSessionBase
       
   109 	{
       
   110 public:
       
   111 	TInt Open(RServer2& aControllerServerHandle);
       
   112 	};
       
   113 
       
   114 #endif