os/security/cryptoservices/filebasedcertificateandkeystores/test/ttesttools/ttesttoolserver.cpp
First public contribution.
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
23 * SWIS test server implementation
26 #include "ttesttoolserver.h"
27 #include "ttesttoolstep.h"
29 _LIT(KServerName, "ttesttools");
32 * Called inside the MainL() function to create and start the CTestServer
34 * @return Instance of the test server
36 CTestToolServer* CTestToolServer::NewL()
38 CTestToolServer *server = new(ELeave) CTestToolServer();
39 CleanupStack::PushL(server);
40 server->ConstructL(KServerName);
41 CleanupStack::Pop(server);
48 // Leave the hooks in for platform security
49 #if (defined __DATA_CAGING__)
50 RProcess().DataCaging(RProcess::EDataCagingOn);
51 RProcess().SecureApi(RProcess::ESecureApiOn);
54 CActiveScheduler* sched=NULL;
55 sched=new(ELeave) CActiveScheduler;
56 CActiveScheduler::Install(sched);
57 CTestToolServer* server = NULL;
58 // Create the CTestServer derived server
59 TRAPD(err, server = CTestToolServer::NewL());
62 // Sync with the client and enter the active scheduler
63 RProcess::Rendezvous(KErrNone);
72 * @return Standard Epoc error code on exit
74 GLDEF_C TInt E32Main()
77 CTrapCleanup* cleanup = CTrapCleanup::New();
89 * Implementation of CTestServer pure virtual
90 * @return A CTestStep derived instance
92 CTestStep* CTestToolServer::CreateTestStep(const TDesC& aStepName)
94 CTestStep* testStep = NULL;
96 // This server creates just one step but create as many as you want
97 // They are created "just in time" when the worker thread is created
99 if (aStepName == KTestToolListCertStep)
100 testStep = new CTestToolListCertStep();
101 else if (aStepName == KTestToolGetTrustAppsStep)
102 testStep = new CTestToolGetTrustAppsStep();
103 else if (aStepName == KTestToolGetTrustStep)
104 testStep = new CTestToolGetTrustStep();
105 else if (aStepName == KTestToolListKeyStep)
106 testStep = new CTestToolListKeyStep();
107 else if (aStepName == KTestToolGetPolicyStep)
108 testStep = new CTestToolGetPolicyStep();
109 else if (aStepName == KTestToolParseFileStep)
110 testStep = new CTestToolParseFileStep();
111 else if (aStepName == KTestToolCheckFileStep)
112 testStep = new CTestToolCheckFileStep();