os/security/cryptomgmtlibs/securitytestfw/test/securityframeworktestserver/src/securityframeworktestserver.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2008-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  @file 
    21 */
    22 #include "securityframeworktestserver.h"
    23 #include "nooperationteststep.h"
    24 
    25 _LIT(KServerName,"SecurityFrameworkTestServer");
    26 
    27 CSecurityFrameworkTestServer* CSecurityFrameworkTestServer::NewL()
    28 /**
    29  * @return - Instance of the test server
    30  * Called inside the MainL() function to create and start the
    31  * CTestServer derived server.
    32  */
    33 	{
    34 	CSecurityFrameworkTestServer * server = new (ELeave) CSecurityFrameworkTestServer();
    35 	CleanupStack::PushL(server);
    36 	
    37 	server-> ConstructL(KServerName);
    38 	CleanupStack::Pop(server);
    39 	return server;
    40 	}
    41 
    42 
    43 LOCAL_C void MainL()
    44 /**
    45  * Much simpler, uses the new Rendezvous() call to sync with the client
    46  */
    47 	{
    48 	// Leave the hooks in for platform security
    49 #if (defined __DATA_CAGING__)
    50 	RProcess().DataCaging(RProcess::EDataCagingOn);
    51 	RProcess().SecureApi(RProcess::ESecureApiOn);
    52 #endif
    53 	CActiveScheduler* sched=NULL;
    54 	sched=new(ELeave) CActiveScheduler;
    55 	CActiveScheduler::Install(sched);
    56 	CSecurityFrameworkTestServer* server = NULL;
    57 	TRAPD(err,server = CSecurityFrameworkTestServer::NewL());
    58 	if(!err)
    59 		{
    60 		// Sync with the client and enter the active scheduler
    61 		RProcess::Rendezvous(KErrNone);
    62 		sched->Start();
    63 		}
    64 	delete server;
    65 	delete sched;
    66 	}
    67 
    68 
    69 GLDEF_C TInt E32Main()
    70 /**
    71  * @return - Standard Epoc error code on exit
    72  */
    73 	{
    74 	CTrapCleanup* cleanup = CTrapCleanup::New();
    75 	if(cleanup == NULL)
    76 		{
    77 		return KErrNoMemory;
    78 		}
    79 	TRAP_IGNORE(MainL());
    80 	delete cleanup;
    81 	return KErrNone;
    82     }
    83 
    84 
    85 CTestStep* CSecurityFrameworkTestServer::CreateTestStep(const TDesC& aStepName)
    86 /**
    87  * @return - A CTestStep derived instance
    88  * Implementation of CTestServer pure virtual
    89  */
    90 	{
    91 	CTestStep* testStep = NULL;
    92 
    93 	if(aStepName == KNoOperationTestStep)
    94 		testStep = new CNoOperationTestStep();
    95 	return testStep;
    96 	}