rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrserver.cpp
changeset 57 61b27eec6533
parent 45 7aa6007702af
equal deleted inserted replaced
45:7aa6007702af 57:61b27eec6533
     1 /*
       
     2 * Copyright (c) 2009 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:      
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #include <e32svr.h>
       
    23 #include <e32uid.h>
       
    24 
       
    25 #include "rtsecmgrserver.h"
       
    26 #include "rtsecmgrsession.h"
       
    27 #include "rtsecmgrsubsession.h"
       
    28 #include "rtsecmgrcommondef.h"
       
    29 #include "rtsecmgrstore.h"
       
    30 #include "rtsecmgrpolicymanager.h"
       
    31 #include "rtsecmgrscriptmanager.h"
       
    32 
       
    33 CRTSecMgrServer* CRTSecMgrServer::NewL(CActive::TPriority aActiveObjectPriority)
       
    34 	{
       
    35 	CRTSecMgrServer* self=new (ELeave) CRTSecMgrServer(aActiveObjectPriority);
       
    36 	CleanupStack::PushL(self);
       
    37 	self->ConstructL();
       
    38 	CleanupStack::Pop(self);
       
    39 	return self;
       
    40 	}
       
    41 
       
    42 CRTSecMgrServer* CRTSecMgrServer::NewLC(CActive::TPriority aActiveObjectPriority)
       
    43 	{
       
    44 	CRTSecMgrServer* self=new (ELeave) CRTSecMgrServer(aActiveObjectPriority);
       
    45 	CleanupStack::PushL(self);
       
    46 	self->ConstructL();
       
    47 	return self;
       
    48 	}
       
    49 
       
    50 void CRTSecMgrServer::ConstructL()
       
    51 	{
       
    52 	StartL(KSecServerProcessName);
       
    53 	iContainerIndex = CObjectConIx::NewL();
       
    54 	
       
    55 	iSecMgrDb = CSecMgrStore::NewL();	
       
    56 	iPolicyMgr = CPolicyManager::NewL(iSecMgrDb);
       
    57 	iPolicyMgr->RestorePoliciesL();
       
    58 	
       
    59 	iScriptMgr = CScriptManager::NewL(iSecMgrDb,iPolicyMgr);
       
    60 	
       
    61 	// Start the shutDown timer
       
    62 	iShutDown.ConstructL();
       
    63 
       
    64 	iShutDown.Start ();
       
    65 	}
       
    66 
       
    67 CRTSecMgrServer::~CRTSecMgrServer()
       
    68 	{
       
    69 	if(iPolicyMgr)
       
    70 	{
       
    71 		delete iPolicyMgr;			
       
    72 	}
       
    73 	
       
    74 	if(iScriptMgr)
       
    75 	{
       
    76 		delete iScriptMgr;
       
    77 	}
       
    78 	
       
    79 	if(iSecMgrDb)
       
    80 	{
       
    81 		delete iSecMgrDb;
       
    82 	}
       
    83 			
       
    84 	Delete(iContainerIndex); 
       
    85 	
       
    86 	iShutDown.Cancel();
       
    87 	}
       
    88 
       
    89 CSession2* CRTSecMgrServer::NewSessionL(const TVersion &aVersion,const RMessage2& /*aMessage*/) const
       
    90 	{
       
    91 	  // Check that the version is OK
       
    92 	TVersion v(KRTSecMgrServMajorVersionNumber,KRTSecMgrServMinorVersionNumber,KRTSecMgrServBuildVersionNumber);
       
    93 	if (!User::QueryVersionSupported(v,aVersion))
       
    94 		User::Leave(KErrNotSupported);
       
    95 	
       
    96 	return CRTSecMgrSession::NewL();
       
    97 	}
       
    98 	
       
    99 
       
   100