os/security/cryptomgmtlibs/securitytestfw/test/securityframeworktestserver/src/securityframeworktestserver.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/cryptomgmtlibs/securitytestfw/test/securityframeworktestserver/src/securityframeworktestserver.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,96 @@
1.4 +/*
1.5 +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 +*/
1.25 +#include "securityframeworktestserver.h"
1.26 +#include "nooperationteststep.h"
1.27 +
1.28 +_LIT(KServerName,"SecurityFrameworkTestServer");
1.29 +
1.30 +CSecurityFrameworkTestServer* CSecurityFrameworkTestServer::NewL()
1.31 +/**
1.32 + * @return - Instance of the test server
1.33 + * Called inside the MainL() function to create and start the
1.34 + * CTestServer derived server.
1.35 + */
1.36 + {
1.37 + CSecurityFrameworkTestServer * server = new (ELeave) CSecurityFrameworkTestServer();
1.38 + CleanupStack::PushL(server);
1.39 +
1.40 + server-> ConstructL(KServerName);
1.41 + CleanupStack::Pop(server);
1.42 + return server;
1.43 + }
1.44 +
1.45 +
1.46 +LOCAL_C void MainL()
1.47 +/**
1.48 + * Much simpler, uses the new Rendezvous() call to sync with the client
1.49 + */
1.50 + {
1.51 + // Leave the hooks in for platform security
1.52 +#if (defined __DATA_CAGING__)
1.53 + RProcess().DataCaging(RProcess::EDataCagingOn);
1.54 + RProcess().SecureApi(RProcess::ESecureApiOn);
1.55 +#endif
1.56 + CActiveScheduler* sched=NULL;
1.57 + sched=new(ELeave) CActiveScheduler;
1.58 + CActiveScheduler::Install(sched);
1.59 + CSecurityFrameworkTestServer* server = NULL;
1.60 + TRAPD(err,server = CSecurityFrameworkTestServer::NewL());
1.61 + if(!err)
1.62 + {
1.63 + // Sync with the client and enter the active scheduler
1.64 + RProcess::Rendezvous(KErrNone);
1.65 + sched->Start();
1.66 + }
1.67 + delete server;
1.68 + delete sched;
1.69 + }
1.70 +
1.71 +
1.72 +GLDEF_C TInt E32Main()
1.73 +/**
1.74 + * @return - Standard Epoc error code on exit
1.75 + */
1.76 + {
1.77 + CTrapCleanup* cleanup = CTrapCleanup::New();
1.78 + if(cleanup == NULL)
1.79 + {
1.80 + return KErrNoMemory;
1.81 + }
1.82 + TRAP_IGNORE(MainL());
1.83 + delete cleanup;
1.84 + return KErrNone;
1.85 + }
1.86 +
1.87 +
1.88 +CTestStep* CSecurityFrameworkTestServer::CreateTestStep(const TDesC& aStepName)
1.89 +/**
1.90 + * @return - A CTestStep derived instance
1.91 + * Implementation of CTestServer pure virtual
1.92 + */
1.93 + {
1.94 + CTestStep* testStep = NULL;
1.95 +
1.96 + if(aStepName == KNoOperationTestStep)
1.97 + testStep = new CNoOperationTestStep();
1.98 + return testStep;
1.99 + }