rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrsession.h
changeset 57 61b27eec6533
parent 45 7aa6007702af
equal deleted inserted replaced
45:7aa6007702af 57:61b27eec6533
     1 /*
       
     2 * Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:       Security Manager Server Session Class
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 #ifndef C_CRTSECMGRSESSION_H
       
    24 #define C_CRTSECMGRSESSION_H
       
    25 
       
    26 #include "rtsecmgrcommondef.h"
       
    27 #include "rtsecmgrdata.h"
       
    28 
       
    29 class CSecMgrStore;
       
    30 class CRepository;
       
    31 class CRTSecMgrSubSession;
       
    32 
       
    33 /*
       
    34  * Server side session class
       
    35  * 
       
    36  * @exe rtsecmgrserver.exe
       
    37  * 
       
    38  */
       
    39 class CRTSecMgrSession : public CSession2
       
    40 	{
       
    41 public:
       
    42 
       
    43 	/*
       
    44 	 * Destructor
       
    45 	 * 
       
    46 	 */
       
    47 	inline ~CRTSecMgrSession();
       
    48 
       
    49 	/**
       
    50 	 * Two-phased constructor
       
    51 	 * 
       
    52 	 * Constructs a CRTSecMgrSession instance
       
    53 	 * 
       
    54 	 * @return CRTSecMgrSession* pointer to an instance of CRTSecMgrSession
       
    55 	 */
       
    56 	inline static CRTSecMgrSession* NewL();
       
    57 
       
    58 	/*
       
    59 	 * Called by client/server framework after 
       
    60 	 * session has been successfully created
       
    61 	 * 
       
    62 	 */
       
    63 	virtual void CreateL();
       
    64 
       
    65 	/*
       
    66 	 * Treats incoming service requests
       
    67 	 * and disatches accordingly
       
    68 	 * 
       
    69 	 * @param aMessage const RMessage2& Incoming message
       
    70 	 */
       
    71 	inline void ServiceL(const RMessage2& aMessage);
       
    72 
       
    73 	/*
       
    74 	 * Dispatches message to sub-session if the message
       
    75 	 * is to be handled by server sub-session. Server
       
    76 	 * session related messages are treated locally
       
    77 	 * 
       
    78 	 * @param aMessage const RMessage2& Incoming message
       
    79 	 */
       
    80 	void DispatchMessageL(const RMessage2& aMessage);
       
    81 
       
    82 	/*
       
    83 	 * Creates new subsession
       
    84 	 * 
       
    85 	 * @param aMessage const RMessage2& Incoming message
       
    86 	 */
       
    87 	void NewSubSessionL(const RMessage2& aMessage);
       
    88 
       
    89 	/*
       
    90 	 * Closes the subsession
       
    91 	 * 
       
    92 	 */
       
    93 	void CloseSession();
       
    94 
       
    95 	/*
       
    96 	 * Delete the subsession object through its handle.
       
    97 	 * 
       
    98 	 * @param aHandle TInt Subsession handle
       
    99 	 */
       
   100 	inline void DeleteSubSession(TInt aHandle);
       
   101 
       
   102 	/*
       
   103 	 * Gets The SubSession from Hnadle
       
   104 	 * 
       
   105 	 * @param aMessage const RMessage2& Incoming message
       
   106 	 * @param aHandle TInt Subsession handle
       
   107 	 * 
       
   108 	 * @return CRTSecMgrSubSession* pointer to subsession object
       
   109 	 */
       
   110 	CRTSecMgrSubSession* SubSessionFromHandle(const RMessage2& aMessage,
       
   111 			TInt aHandle);
       
   112 
       
   113 	/*
       
   114 	 * Utility method to panic client
       
   115 	 * 
       
   116 	 * @param aMessage const RMessage2& Incoming message
       
   117 	 * @param aPanic TInt Panic error code
       
   118 	 * 
       
   119 	 */
       
   120 	inline void PanicClient(const RMessage2& aMessage, TInt aPanic) const;
       
   121 
       
   122 	/*
       
   123 	 * Message handler method to set policy
       
   124 	 * 
       
   125 	 * @param aMessage const RMessage2& Incoming message
       
   126 	 * @param aIsUpdate TBool Toggle to identify whether the incoming
       
   127 	 * message is for setting policy or updating policy
       
   128 	 * 
       
   129 	 */
       
   130 	void SetPolicy(const RMessage2& aMessage, TBool aIsUpdate=EFalse);
       
   131 
       
   132 	/*
       
   133 	 * Message handler method to update policy
       
   134 	 * 
       
   135 	 * @param aMessage const RMessage2& Incoming message
       
   136 	 * 
       
   137 	 */
       
   138 	void UpdatePolicy(const RMessage2& aMessage);
       
   139 
       
   140 	/*
       
   141 	 * Message handler method to unset policy
       
   142 	 * 
       
   143 	 * @param aMessage const RMessage2& Incoming message
       
   144 	 * 
       
   145 	 */
       
   146 	void UnsetPolicy(const RMessage2& aMessage);
       
   147 
       
   148 	/*
       
   149 	 * Message handler method to register script
       
   150 	 * 
       
   151 	 * @param aMessage const RMessage2& Incoming message
       
   152 	 * @param aHashValue Toggle to indicate if script has hash value
       
   153 	 * 
       
   154 	 */
       
   155 	void RegisterScript(const RMessage2& aMessage, TBool aHashValue=EFalse);
       
   156 
       
   157 	/*
       
   158 	 * Message handler method to un-register script
       
   159 	 * 
       
   160 	 * @param aMessage const RMessage2& Incoming message
       
   161 	 * 
       
   162 	 */
       
   163 	void UnregisterScript(const RMessage2& aMessage);
       
   164 
       
   165 	/*
       
   166 	 * Message handler method to create script sub-session
       
   167 	 * 
       
   168 	 * @param aMessage const RMessage2& Incoming message
       
   169 	 * 
       
   170 	 */
       
   171 	void GetScriptSessionL(const RMessage2& aMessage);
       
   172 
       
   173 	/*
       
   174 	 * Message handler method to create script sub-session
       
   175 	 * for trusted unregistered scripts
       
   176 	 * 
       
   177 	 * @param aMessage const RMessage2& Incoming message
       
   178 	 * 
       
   179 	 */
       
   180 	void GetTrustedUnRegScriptSessionL(const RMessage2& aMessage);
       
   181 
       
   182 	/*
       
   183 	 * Utility method to find out if a script sub-session is open
       
   184 	 * with the script having the assocaited policy identifier 
       
   185 	 * specified in the input argument
       
   186 	 * 
       
   187 	 * @param aPolicyID TPolicyID policy identifier to be checked
       
   188 	 * 
       
   189 	 * @return TBool EFalse if no parallel script sub-sessions are open; ETrue 
       
   190 	 * otherwise ETrue
       
   191 	 * 
       
   192 	 */
       
   193 	TBool IsScriptOpenWithPolicy(TPolicyID aPolicyID);
       
   194 
       
   195 	/*
       
   196 	 * Utility method to find out if a script sub-session is open
       
   197 	 * with the script having the script identifier 
       
   198 	 * specified in the input argument
       
   199 	 * 
       
   200 	 * @param aScriptID TExecutableID script identifier to be checked
       
   201 	 * 
       
   202 	 * @return TBool EFalse if no parallel script sub-sessions are open; ETrue 
       
   203 	 * otherwise ETrue
       
   204 	 * 
       
   205 	 */
       
   206 	TBool IsScriptSessionOpen(TExecutableID aScriptID,CRTSecMgrSubSession* aCurrentSession=NULL);
       
   207 
       
   208 private:
       
   209 
       
   210 	/*
       
   211 	 * Default private constructor
       
   212 	 * 
       
   213 	 * 
       
   214 	 */
       
   215 	inline CRTSecMgrSession();
       
   216 
       
   217 private:
       
   218 	/*
       
   219 	 *  Object container for this session.
       
   220 	 * 
       
   221 	 */
       
   222 	CObjectCon *iContainer;
       
   223 
       
   224 	/*
       
   225 	 *  Object index which stores objects
       
   226 	 * 
       
   227 	 */
       
   228 	CObjectIx* iSubSessionObjectIndex;
       
   229 
       
   230 	/*
       
   231 	 * subsession counter
       
   232 	 * 
       
   233 	 */
       
   234 	TInt iSubSessionCount;
       
   235 	/*
       
   236 	 * Security manager server instance
       
   237 	 * 
       
   238 	 * Stored as member variable for convenient
       
   239 	 * access
       
   240 	 */
       
   241 	CRTSecMgrServer* iSecMgrServer;
       
   242 	};
       
   243 
       
   244 #include "rtsecmgrsession.inl"
       
   245 
       
   246 #endif //C_CRTSECMGRSESSION_H_
       
   247