debugsrv/runmodedebug/securityserver/inc/c_security_svr_server.h
branchRCL_3
changeset 20 ca8a1b6995f6
equal deleted inserted replaced
19:07b41fa8d1dd 20:ca8a1b6995f6
       
     1 // Copyright (c) 2006-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 the License "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 // Definitions for the security server server.
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef C_SECURITY_SVR_SERVER_H
       
    19 #define C_SECURITY_SVR_SERVER_H
       
    20 
       
    21 /**
       
    22 @file
       
    23 @internalTechnology
       
    24 @released
       
    25 */
       
    26 
       
    27 #include <rm_debug_api.h>
       
    28 #include "c_process_pair.h"
       
    29 #include "c_shutdown_timer.h"
       
    30 #include "rm_debug_kerneldriver.h"
       
    31 
       
    32 _LIT(KDebugDriverFileName,"rm_debug.ldd");
       
    33 class CSecuritySvrSession;
       
    34 
       
    35 /**
       
    36 Definition of a Debug Security Server. Responsible for managing all debug agent clients,
       
    37 including attachment/detachment from target executables. Keeps track of which executables
       
    38 are being debugged.
       
    39 */
       
    40 class CSecuritySvrServer : public CServer2
       
    41 	{
       
    42 	public:
       
    43 		CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
       
    44 		TInt AttachProcessL(const TDesC& aTargetProcessName, const TProcessId aDebugAgentProcessId, const TBool aPassive);
       
    45 		TInt DetachProcess(const TDesC& aTargetProcessName, const TProcessId aDebugAgentProcessId);
       
    46 		void DetachAllProcesses(const TProcessId aDebugAgentProcessId);
       
    47 		TBool CheckAttached(const TThreadId aTargetThreadId, const RMessage2& aMessage, const TBool aPassive);
       
    48 		TBool CheckAttached(const TProcessId aTargetProcessId, const RMessage2& aMessage, const TBool aPassive);
       
    49 		TBool CheckAttachedProcess(const TDesC& aTargetProcessName, const RMessage2& aMessage, const TBool aPassive) const;
       
    50 		TBool IsDebugged(const TDesC& aTargetProcessName, const TBool aPassive) const;
       
    51 		void SessionClosed();
       
    52 		void SessionOpened();
       
    53 		static CSecuritySvrServer* NewLC();
       
    54 
       
    55 		TBool OEMTokenPermitsDebugL(const TCapabilitySet aTokenCaps, const TCapabilitySet aTargetCaps);
       
    56 		TBool OEMTokenPermitsFlashAccessL(const TCapabilitySet aTokenCaps);
       
    57 
       
    58 	protected:
       
    59 		CSecuritySvrServer(CActive::TPriority aActiveObjectPriority);
       
    60 		void ConstructL();
       
    61 		
       
    62 	private:
       
    63 		~CSecuritySvrServer();
       
    64 		TBool IsActiveDebugger(const TDesC& aTargetProcessName, const TProcessId aDebugAgentProcessId) const;
       
    65 		TBool IsDebugger(const TDesC& aTargetProcessName, const TProcessId aDebugAgentProcessId) const;
       
    66 		TInt GetProcessIdFromMessage(TProcessId& aProcessId, const RMessage2& aMessage) const;
       
    67 
       
    68 	private:
       
    69 		RPointerArray<CProcessPair> iActiveDebugMap;
       
    70 		RPointerArray<CProcessPair> iPassiveDebugMap;
       
    71 		TInt iSessionCount;
       
    72 		CShutdownTimer iShutdown;
       
    73 		RRM_DebugDriver iKernelDriver;
       
    74 
       
    75 	// Declare the CSecuritySvrAsync as a friend so it can use the iKernelDriver too
       
    76 	friend class CSecuritySvrAsync;
       
    77 	friend class CSecuritySvrSession;
       
    78 	};
       
    79 
       
    80 #endif // C_SECURITY_SVR_SERVER_H